@fern-api/java-dynamic-snippets 3.29.1 → 3.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- var $r=Object.defineProperty;var Gi=(n,e,t)=>e in n?$r(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pt=(n,e)=>()=>(n&&(e=n(n=0)),e);var cr=(n,e)=>{for(var t in e)$r(n,t,{get:e[t],enumerable:!0})};var _=(n,e,t)=>Gi(n,typeof e!="symbol"?e+"":e,t);var m=pt(()=>{"use strict"});var T={};cr(T,{_debugEnd:()=>Cn,_debugProcess:()=>En,_events:()=>Zn,_eventsCount:()=>Gn,_exiting:()=>cn,_fatalExceptions:()=>Nn,_getActiveHandles:()=>mn,_getActiveRequests:()=>fn,_kill:()=>yn,_linkedBinding:()=>un,_maxListeners:()=>zn,_preload_modules:()=>Vn,_rawDebug:()=>sn,_startProfilerIdleNotifier:()=>Sn,_stopProfilerIdleNotifier:()=>Ln,_tickCallback:()=>An,abort:()=>On,addListener:()=>Hn,allowedNodeEnvironmentFlags:()=>Tn,arch:()=>zr,argv:()=>Hr,argv0:()=>Dn,assert:()=>_n,binding:()=>Xr,browser:()=>an,chdir:()=>rn,config:()=>pn,cpuUsage:()=>Vt,cwd:()=>tn,debugPort:()=>$n,default:()=>na,dlopen:()=>dn,domain:()=>ln,emit:()=>Xn,emitWarning:()=>Qr,env:()=>Gr,execArgv:()=>Jr,execPath:()=>Mn,exit:()=>wn,features:()=>kn,hasUncaughtExceptionCaptureCallback:()=>In,hrtime:()=>Dt,kill:()=>vn,listeners:()=>ra,memoryUsage:()=>xn,moduleLoadList:()=>on,nextTick:()=>Vr,off:()=>Yn,on:()=>Te,once:()=>Jn,openStdin:()=>bn,pid:()=>Un,platform:()=>Zr,ppid:()=>jn,prependListener:()=>ea,prependOnceListener:()=>ta,reallyExit:()=>hn,release:()=>nn,removeAllListeners:()=>Qn,removeListener:()=>Kn,resourceUsage:()=>gn,setSourceMapsEnabled:()=>qn,setUncaughtExceptionCaptureCallback:()=>Rn,stderr:()=>Pn,stdin:()=>Fn,stdout:()=>Bn,title:()=>Wr,umask:()=>en,uptime:()=>Wn,version:()=>Yr,versions:()=>Kr});function fr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function Hi(){!dt||!Fe||(dt=!1,Fe.length?be=Fe.concat(be):$t=-1,be.length&&Dr())}function Dr(){if(!dt){var n=setTimeout(Hi,0);dt=!0;for(var e=be.length;e;){for(Fe=be,be=[];++$t<e;)Fe&&Fe[$t].run();$t=-1,e=be.length}Fe=null,dt=!1,clearTimeout(n)}}function Vr(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 qr(n,e)),be.length===1&&!dt&&setTimeout(Dr,0)}function qr(n,e){this.fun=n,this.array=e}function ee(){}function un(n){fr("_linkedBinding")}function dn(n){fr("dlopen")}function fn(){return[]}function mn(){return[]}function _n(n,e){if(!n)throw new Error(e||"assertion error")}function In(){return!1}function Wn(){return Ee.now()/1e3}function Dt(n){var e=Math.floor((Date.now()-Ee.now())*.001),t=Ee.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+=dr)),[r,a]}function Te(){return na}function ra(n){return[]}var be,dt,Fe,$t,Wr,zr,Zr,Gr,Hr,Jr,Yr,Kr,Qr,Xr,en,tn,rn,nn,an,sn,on,ln,cn,pn,hn,yn,Vt,gn,xn,vn,wn,bn,Tn,kn,Nn,Rn,An,En,Cn,Sn,Ln,Bn,Pn,Fn,On,Un,jn,Mn,$n,Dn,Vn,qn,Ee,pr,dr,zn,Zn,Gn,Hn,Jn,Yn,Kn,Qn,Xn,ea,ta,na,aa=pt(()=>{"use strict";m();y();h();be=[],dt=!1,$t=-1;qr.prototype.run=function(){this.fun.apply(null,this.array)};Wr="browser",zr="x64",Zr="browser",Gr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Hr=["/usr/bin/node"],Jr=[],Yr="v16.8.0",Kr={},Qr=function(n,e){console.warn((e?e+": ":"")+n)},Xr=function(n){fr("binding")},en=function(n){return 0},tn=function(){return"/"},rn=function(n){},nn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};an=!0,sn=ee,on=[];ln={},cn=!1,pn={};hn=ee,yn=ee,Vt=function(){return{}},gn=Vt,xn=Vt,vn=ee,wn=ee,bn=ee,Tn={};kn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Nn=ee,Rn=ee;An=ee,En=ee,Cn=ee,Sn=ee,Ln=ee,Bn=void 0,Pn=void 0,Fn=void 0,On=ee,Un=2,jn=1,Mn="/bin/usr/node",$n=9229,Dn="node",Vn=[],qn=ee,Ee={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Ee.now===void 0&&(pr=Date.now(),Ee.timing&&Ee.timing.navigationStart&&(pr=Ee.timing.navigationStart),Ee.now=()=>Date.now()-pr);dr=1e9;Dt.bigint=function(n){var e=Dt(n);return typeof BigInt>"u"?e[0]*dr+e[1]:BigInt(e[0]*dr)+BigInt(e[1])};zn=10,Zn={},Gn=0;Hn=Te,Jn=Te,Yn=Te,Kn=Te,Qn=Te,Xn=ee,ea=Te,ta=Te;na={version:Yr,versions:Kr,arch:zr,platform:Zr,browser:an,release:nn,_rawDebug:sn,moduleLoadList:on,binding:Xr,_linkedBinding:un,_events:Zn,_eventsCount:Gn,_maxListeners:zn,on:Te,addListener:Hn,once:Jn,off:Yn,removeListener:Kn,removeAllListeners:Qn,emit:Xn,prependListener:ea,prependOnceListener:ta,listeners:ra,domain:ln,_exiting:cn,config:pn,dlopen:dn,uptime:Wn,_getActiveRequests:fn,_getActiveHandles:mn,reallyExit:hn,_kill:yn,cpuUsage:Vt,resourceUsage:gn,memoryUsage:xn,kill:vn,exit:wn,openStdin:bn,allowedNodeEnvironmentFlags:Tn,assert:_n,features:kn,_fatalExceptions:Nn,setUncaughtExceptionCaptureCallback:Rn,hasUncaughtExceptionCaptureCallback:In,emitWarning:Qr,nextTick:Vr,_tickCallback:An,_debugProcess:En,_debugEnd:Cn,_startProfilerIdleNotifier:Sn,_stopProfilerIdleNotifier:Ln,stdout:Bn,stdin:Fn,stderr:Pn,abort:On,umask:en,chdir:rn,cwd:tn,env:Gr,title:Wr,argv:Hr,execArgv:Jr,pid:Un,ppid:jn,execPath:Mn,debugPort:$n,hrtime:Dt,argv0:Dn,_preload_modules:Vn,setSourceMapsEnabled:qn}});var h=pt(()=>{"use strict";aa()});function Ji(){if(ia)return _t;ia=!0,_t.byteLength=p,_t.toByteArray=w,_t.fromByteArray=J;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=r.length;a<o;++a)n[a]=r[a],e[r.charCodeAt(a)]=a;e[45]=62,e[95]=63;function u(C){var S=C.length;if(S%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var q=C.indexOf("=");q===-1&&(q=S);var K=q===S?0:4-q%4;return[q,K]}function p(C){var S=u(C),q=S[0],K=S[1];return(q+K)*3/4-K}function g(C,S,q){return(S+q)*3/4-q}function w(C){var S,q=u(C),K=q[0],ne=q[1],Y=new t(g(C,K,ne)),ae=0,ce=ne>0?K-4:K,re;for(re=0;re<ce;re+=4)S=e[C.charCodeAt(re)]<<18|e[C.charCodeAt(re+1)]<<12|e[C.charCodeAt(re+2)]<<6|e[C.charCodeAt(re+3)],Y[ae++]=S>>16&255,Y[ae++]=S>>8&255,Y[ae++]=S&255;return ne===2&&(S=e[C.charCodeAt(re)]<<2|e[C.charCodeAt(re+1)]>>4,Y[ae++]=S&255),ne===1&&(S=e[C.charCodeAt(re)]<<10|e[C.charCodeAt(re+1)]<<4|e[C.charCodeAt(re+2)]>>2,Y[ae++]=S>>8&255,Y[ae++]=S&255),Y}function A(C){return n[C>>18&63]+n[C>>12&63]+n[C>>6&63]+n[C&63]}function F(C,S,q){for(var K,ne=[],Y=S;Y<q;Y+=3)K=(C[Y]<<16&16711680)+(C[Y+1]<<8&65280)+(C[Y+2]&255),ne.push(A(K));return ne.join("")}function J(C){for(var S,q=C.length,K=q%3,ne=[],Y=16383,ae=0,ce=q-K;ae<ce;ae+=Y)ne.push(F(C,ae,ae+Y>ce?ce:ae+Y));return K===1?(S=C[q-1],ne.push(n[S>>2]+n[S<<4&63]+"==")):K===2&&(S=(C[q-2]<<8)+C[q-1],ne.push(n[S>>10]+n[S>>4&63]+n[S<<2&63]+"=")),ne.join("")}return _t}function Yi(){if(sa)return qt;sa=!0;return qt.read=function(n,e,t,r,a){var o,u,p=a*8-r-1,g=(1<<p)-1,w=g>>1,A=-7,F=t?a-1:0,J=t?-1:1,C=n[e+F];for(F+=J,o=C&(1<<-A)-1,C>>=-A,A+=p;A>0;o=o*256+n[e+F],F+=J,A-=8);for(u=o&(1<<-A)-1,o>>=-A,A+=r;A>0;u=u*256+n[e+F],F+=J,A-=8);if(o===0)o=1-w;else{if(o===g)return u?NaN:(C?-1:1)*(1/0);u=u+Math.pow(2,r),o=o-w}return(C?-1:1)*u*Math.pow(2,o-r)},qt.write=function(n,e,t,r,a,o){var u,p,g,w=o*8-a-1,A=(1<<w)-1,F=A>>1,J=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=r?0:o-1,S=r?1:-1,q=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,u=A):(u=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-u))<1&&(u--,g*=2),u+F>=1?e+=J/g:e+=J*Math.pow(2,1-F),e*g>=2&&(u++,g/=2),u+F>=A?(p=0,u=A):u+F>=1?(p=(e*g-1)*Math.pow(2,a),u=u+F):(p=e*Math.pow(2,F-1)*Math.pow(2,a),u=0));a>=8;n[t+C]=p&255,C+=S,p/=256,a-=8);for(u=u<<a|p,w+=a;w>0;n[t+C]=u&255,C+=S,u/=256,w-=8);n[t+C-S]|=q*128},qt}function ua(){if(oa)return Oe;oa=!0;let n=Ji(),e=Yi(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Oe.Buffer=u,Oe.SlowBuffer=ne,Oe.INSPECT_MAX_BYTES=50;let r=2147483647;Oe.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 A(l)}return p(l,i,s)}u.poolSize=8192;function p(l,i,s){if(typeof l=="string")return F(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(ye(l,ArrayBuffer)||l&&ye(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(l,SharedArrayBuffer)||l&&ye(l.buffer,SharedArrayBuffer)))return S(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 f=q(l);if(f)return f;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 p(l,i,s)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function g(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 w(l,i,s){return g(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 w(l,i,s)};function A(l){return g(l),o(l<0?0:K(l)|0)}u.allocUnsafe=function(l){return A(l)},u.allocUnsafeSlow=function(l){return A(l)};function F(l,i){if((typeof i!="string"||i==="")&&(i="utf8"),!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=Y(l,i)|0,c=o(s),f=c.write(l,i);return f!==s&&(c=c.slice(0,f)),c}function J(l){let i=l.length<0?0:K(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(ye(l,Uint8Array)){let i=new Uint8Array(l);return S(i.buffer,i.byteOffset,i.byteLength)}return J(l)}function S(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 q(l){if(u.isBuffer(l)){let i=K(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"||lr(l.length)?o(0):J(l);if(l.type==="Buffer"&&Array.isArray(l.data))return J(l.data)}function K(l){if(l>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return l|0}function ne(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(ye(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),ye(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,f=s.length;for(let x=0,v=Math.min(c,f);x<v;++x)if(i[x]!==s[x]){c=i[x],f=s[x];break}return c<f?-1:f<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 f=u.allocUnsafe(s),x=0;for(c=0;c<i.length;++c){let v=i[c];if(ye(v,Uint8Array))x+v.length>f.length?(u.isBuffer(v)||(v=u.from(v)),v.copy(f,x)):Uint8Array.prototype.set.call(f,v,x);else if(u.isBuffer(v))v.copy(f,x);else throw new TypeError('"list" argument must be an Array of Buffers');x+=v.length}return f};function Y(l,i){if(u.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||ye(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 f=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":return ur(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return Mr(l).length;default:if(f)return c?-1:ur(l).length;i=(""+i).toLowerCase(),f=!0}}u.byteLength=Y;function ae(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 ji(this,i,s);case"utf8":case"utf-8":return Cr(this,i,s);case"ascii":return Oi(this,i,s);case"latin1":case"binary":return Ui(this,i,s);case"base64":return Pi(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mi(this,i,s);default:if(c)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),c=!0}}u.prototype._isBuffer=!0;function ce(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)ce(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)ce(this,s,s+3),ce(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)ce(this,s,s+7),ce(this,s+1,s+6),ce(this,s+2,s+5),ce(this,s+3,s+4);return this},u.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Cr(this,0,i):ae.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=Oe.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,f,x){if(ye(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),f===void 0&&(f=0),x===void 0&&(x=this.length),s<0||c>i.length||f<0||x>this.length)throw new RangeError("out of range index");if(f>=x&&s>=c)return 0;if(f>=x)return-1;if(s>=c)return 1;if(s>>>=0,c>>>=0,f>>>=0,x>>>=0,this===i)return 0;let v=x-f,U=c-s,G=Math.min(v,U),z=this.slice(f,x),H=i.slice(s,c);for(let W=0;W<G;++W)if(z[W]!==H[W]){v=z[W],U=H[W];break}return v<U?-1:U<v?1:0};function re(l,i,s,c,f){if(l.length===0)return-1;if(typeof s=="string"?(c=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,lr(s)&&(s=f?0:l.length-1),s<0&&(s=l.length+s),s>=l.length){if(f)return-1;s=l.length-1}else if(s<0)if(f)s=0;else return-1;if(typeof i=="string"&&(i=u.from(i,c)),u.isBuffer(i))return i.length===0?-1:Er(l,i,s,c,f);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(l,i,s):Uint8Array.prototype.lastIndexOf.call(l,i,s):Er(l,[i],s,c,f);throw new TypeError("val must be string, number or Buffer")}function Er(l,i,s,c,f){let x=1,v=l.length,U=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;x=2,v/=2,U/=2,s/=2}function G(H,W){return x===1?H[W]:H.readUInt16BE(W*x)}let z;if(f){let H=-1;for(z=s;z<v;z++)if(G(l,z)===G(i,H===-1?0:z-H)){if(H===-1&&(H=z),z-H+1===U)return H*x}else H!==-1&&(z-=z-H),H=-1}else for(s+U>v&&(s=v-U),z=s;z>=0;z--){let H=!0;for(let W=0;W<U;W++)if(G(l,z+W)!==G(i,W)){H=!1;break}if(H)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 re(this,i,s,c,!0)},u.prototype.lastIndexOf=function(i,s,c){return re(this,i,s,c,!1)};function Ei(l,i,s,c){s=Number(s)||0;let f=l.length-s;c?(c=Number(c),c>f&&(c=f)):c=f;let x=i.length;c>x/2&&(c=x/2);let v;for(v=0;v<c;++v){let U=parseInt(i.substr(v*2,2),16);if(lr(U))return v;l[s+v]=U}return v}function Ci(l,i,s,c){return Mt(ur(i,l.length-s),l,s,c)}function Si(l,i,s,c){return Mt(qi(i),l,s,c)}function Li(l,i,s,c){return Mt(Mr(i),l,s,c)}function Bi(l,i,s,c){return Mt(Wi(i,l.length-s),l,s,c)}u.prototype.write=function(i,s,c,f){if(s===void 0)f="utf8",c=this.length,s=0;else if(c===void 0&&typeof s=="string")f=s,c=this.length,s=0;else if(isFinite(s))s=s>>>0,isFinite(c)?(c=c>>>0,f===void 0&&(f="utf8")):(f=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let x=this.length-s;if((c===void 0||c>x)&&(c=x),i.length>0&&(c<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");let v=!1;for(;;)switch(f){case"hex":return Ei(this,i,s,c);case"utf8":case"utf-8":return Ci(this,i,s,c);case"ascii":case"latin1":case"binary":return Si(this,i,s,c);case"base64":return Li(this,i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bi(this,i,s,c);default:if(v)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),v=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pi(l,i,s){return i===0&&s===l.length?n.fromByteArray(l):n.fromByteArray(l.slice(i,s))}function Cr(l,i,s){s=Math.min(l.length,s);let c=[],f=i;for(;f<s;){let x=l[f],v=null,U=x>239?4:x>223?3:x>191?2:1;if(f+U<=s){let G,z,H,W;switch(U){case 1:x<128&&(v=x);break;case 2:G=l[f+1],(G&192)===128&&(W=(x&31)<<6|G&63,W>127&&(v=W));break;case 3:G=l[f+1],z=l[f+2],(G&192)===128&&(z&192)===128&&(W=(x&15)<<12|(G&63)<<6|z&63,W>2047&&(W<55296||W>57343)&&(v=W));break;case 4:G=l[f+1],z=l[f+2],H=l[f+3],(G&192)===128&&(z&192)===128&&(H&192)===128&&(W=(x&15)<<18|(G&63)<<12|(z&63)<<6|H&63,W>65535&&W<1114112&&(v=W))}}v===null?(v=65533,U=1):v>65535&&(v-=65536,c.push(v>>>10&1023|55296),v=56320|v&1023),c.push(v),f+=U}return Fi(c)}let Sr=4096;function Fi(l){let i=l.length;if(i<=Sr)return String.fromCharCode.apply(String,l);let s="",c=0;for(;c<i;)s+=String.fromCharCode.apply(String,l.slice(c,c+=Sr));return s}function Oi(l,i,s){let c="";s=Math.min(l.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(l[f]&127);return c}function Ui(l,i,s){let c="";s=Math.min(l.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(l[f]);return c}function ji(l,i,s){let c=l.length;(!i||i<0)&&(i=0),(!s||s<0||s>c)&&(s=c);let f="";for(let x=i;x<s;++x)f+=zi[l[x]];return f}function Mi(l,i,s){let c=l.slice(i,s),f="";for(let x=0;x<c.length-1;x+=2)f+=String.fromCharCode(c[x]+c[x+1]*256);return f}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 f=this.subarray(i,s);return Object.setPrototypeOf(f,u.prototype),f};function Q(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||Q(i,s,this.length);let f=this[i],x=1,v=0;for(;++v<s&&(x*=256);)f+=this[i+v]*x;return f},u.prototype.readUintBE=u.prototype.readUIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=this[i+--s],x=1;for(;s>0&&(x*=256);)f+=this[i+--s]*x;return f},u.prototype.readUint8=u.prototype.readUInt8=function(i,s){return i=i>>>0,s||Q(i,1,this.length),this[i]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||Q(i,2,this.length),this[i]|this[i+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||Q(i,2,this.length),this[i]<<8|this[i+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||Q(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||Q(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},u.prototype.readBigUInt64LE=Ae(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24,x=this[++i]+this[++i]*2**8+this[++i]*2**16+c*2**24;return BigInt(f)+(BigInt(x)<<BigInt(32))}),u.prototype.readBigUInt64BE=Ae(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=s*2**24+this[++i]*2**16+this[++i]*2**8+this[++i],x=this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+c;return(BigInt(f)<<BigInt(32))+BigInt(x)}),u.prototype.readIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=this[i],x=1,v=0;for(;++v<s&&(x*=256);)f+=this[i+v]*x;return x*=128,f>=x&&(f-=Math.pow(2,8*s)),f},u.prototype.readIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=s,x=1,v=this[i+--f];for(;f>0&&(x*=256);)v+=this[i+--f]*x;return x*=128,v>=x&&(v-=Math.pow(2,8*s)),v},u.prototype.readInt8=function(i,s){return i=i>>>0,s||Q(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},u.prototype.readInt16LE=function(i,s){i=i>>>0,s||Q(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||Q(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||Q(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||Q(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},u.prototype.readBigInt64LE=Ae(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(c<<24);return(BigInt(f)<<BigInt(32))+BigInt(s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24)}),u.prototype.readBigInt64BE=Ae(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=(s<<24)+this[++i]*2**16+this[++i]*2**8+this[++i];return(BigInt(f)<<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||Q(i,4,this.length),e.read(this,i,!0,23,4)},u.prototype.readFloatBE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),e.read(this,i,!1,23,4)},u.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||Q(i,8,this.length),e.read(this,i,!0,52,8)},u.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||Q(i,8,this.length),e.read(this,i,!1,52,8)};function ie(l,i,s,c,f,x){if(!u.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>f||i<x)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,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let U=Math.pow(2,8*c)-1;ie(this,i,s,c,U,0)}let x=1,v=0;for(this[s]=i&255;++v<c&&(x*=256);)this[s+v]=i/x&255;return s+c},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let U=Math.pow(2,8*c)-1;ie(this,i,s,c,U,0)}let x=c-1,v=1;for(this[s+x]=i&255;--x>=0&&(v*=256);)this[s+x]=i/v&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 Lr(l,i,s,c,f){jr(i,c,f,l,s,7);let x=Number(i&BigInt(4294967295));l[s++]=x,x=x>>8,l[s++]=x,x=x>>8,l[s++]=x,x=x>>8,l[s++]=x;let v=Number(i>>BigInt(32)&BigInt(4294967295));return l[s++]=v,v=v>>8,l[s++]=v,v=v>>8,l[s++]=v,v=v>>8,l[s++]=v,s}function Br(l,i,s,c,f){jr(i,c,f,l,s,7);let x=Number(i&BigInt(4294967295));l[s+7]=x,x=x>>8,l[s+6]=x,x=x>>8,l[s+5]=x,x=x>>8,l[s+4]=x;let v=Number(i>>BigInt(32)&BigInt(4294967295));return l[s+3]=v,v=v>>8,l[s+2]=v,v=v>>8,l[s+1]=v,v=v>>8,l[s]=v,s+8}u.prototype.writeBigUInt64LE=Ae(function(i,s=0){return Lr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Ae(function(i,s=0){return Br(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let G=Math.pow(2,8*c-1);ie(this,i,s,c,G-1,-G)}let x=0,v=1,U=0;for(this[s]=i&255;++x<c&&(v*=256);)i<0&&U===0&&this[s+x-1]!==0&&(U=1),this[s+x]=(i/v>>0)-U&255;return s+c},u.prototype.writeIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let G=Math.pow(2,8*c-1);ie(this,i,s,c,G-1,-G)}let x=c-1,v=1,U=0;for(this[s+x]=i&255;--x>=0&&(v*=256);)i<0&&U===0&&this[s+x+1]!==0&&(U=1),this[s+x]=(i/v>>0)-U&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=Ae(function(i,s=0){return Lr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Ae(function(i,s=0){return Br(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pr(l,i,s,c,f,x){if(s+c>l.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Fr(l,i,s,c,f){return i=+i,s=s>>>0,f||Pr(l,i,s,4),e.write(l,i,s,c,23,4),s+4}u.prototype.writeFloatLE=function(i,s,c){return Fr(this,i,s,!0,c)},u.prototype.writeFloatBE=function(i,s,c){return Fr(this,i,s,!1,c)};function Or(l,i,s,c,f){return i=+i,s=s>>>0,f||Pr(l,i,s,8),e.write(l,i,s,c,52,8),s+8}u.prototype.writeDoubleLE=function(i,s,c){return Or(this,i,s,!0,c)},u.prototype.writeDoubleBE=function(i,s,c){return Or(this,i,s,!1,c)},u.prototype.copy=function(i,s,c,f){if(!u.isBuffer(i))throw new TypeError("argument should be a Buffer");if(c||(c=0),!f&&f!==0&&(f=this.length),s>=i.length&&(s=i.length),s||(s=0),f>0&&f<c&&(f=c),f===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(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),i.length-s<f-c&&(f=i.length-s+c);let x=f-c;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,c,f):Uint8Array.prototype.set.call(i,this.subarray(c,f),s),x},u.prototype.fill=function(i,s,c,f){if(typeof i=="string"){if(typeof s=="string"?(f=s,s=0,c=this.length):typeof c=="string"&&(f=c,c=this.length),f!==void 0&&typeof f!="string")throw new TypeError("encoding must be a string");if(typeof f=="string"&&!u.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(i.length===1){let v=i.charCodeAt(0);(f==="utf8"&&v<128||f==="latin1")&&(i=v)}}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 x;if(typeof i=="number")for(x=s;x<c;++x)this[x]=i;else{let v=u.isBuffer(i)?i:u.from(i,f),U=v.length;if(U===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(x=0;x<c-s;++x)this[x+s]=v[x%U]}return this};let lt={};function or(l,i,s){lt[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(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${l}]: ${this.message}`}}}or("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),or("ERR_INVALID_ARG_TYPE",function(l,i){return`The "${l}" argument must be of type number. Received type ${typeof i}`},TypeError),or("ERR_OUT_OF_RANGE",function(l,i,s){let c=`The value of "${l}" is out of range.`,f=s;return Number.isInteger(s)&&Math.abs(s)>2**32?f=Ur(String(s)):typeof s=="bigint"&&(f=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(f=Ur(f)),f+="n"),c+=` It must be ${i}. Received ${f}`,c},RangeError);function Ur(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 $i(l,i,s){ct(i,"offset"),(l[i]===void 0||l[i+s]===void 0)&&Tt(i,l.length-(s+1))}function jr(l,i,s,c,f,x){if(l>s||l<i){let v=typeof i=="bigint"?"n":"",U;throw i===0||i===BigInt(0)?U=`>= 0${v} and < 2${v} ** ${(x+1)*8}${v}`:U=`>= -(2${v} ** ${(x+1)*8-1}${v}) and < 2 ** ${(x+1)*8-1}${v}`,new lt.ERR_OUT_OF_RANGE("value",U,l)}$i(c,f,x)}function ct(l,i){if(typeof l!="number")throw new lt.ERR_INVALID_ARG_TYPE(i,"number",l)}function Tt(l,i,s){throw Math.floor(l)!==l?(ct(l,s),new lt.ERR_OUT_OF_RANGE("offset","an integer",l)):i<0?new lt.ERR_BUFFER_OUT_OF_BOUNDS:new lt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,l)}let Di=/[^+/0-9A-Za-z-_]/g;function Vi(l){if(l=l.split("=")[0],l=l.trim().replace(Di,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function ur(l,i){i=i||1/0;let s,c=l.length,f=null,x=[];for(let v=0;v<c;++v){if(s=l.charCodeAt(v),s>55295&&s<57344){if(!f){if(s>56319){(i-=3)>-1&&x.push(239,191,189);continue}else if(v+1===c){(i-=3)>-1&&x.push(239,191,189);continue}f=s;continue}if(s<56320){(i-=3)>-1&&x.push(239,191,189),f=s;continue}s=(f-55296<<10|s-56320)+65536}else f&&(i-=3)>-1&&x.push(239,191,189);if(f=null,s<128){if((i-=1)<0)break;x.push(s)}else if(s<2048){if((i-=2)<0)break;x.push(s>>6|192,s&63|128)}else if(s<65536){if((i-=3)<0)break;x.push(s>>12|224,s>>6&63|128,s&63|128)}else if(s<1114112){if((i-=4)<0)break;x.push(s>>18|240,s>>12&63|128,s>>6&63|128,s&63|128)}else throw new Error("Invalid code point")}return x}function qi(l){let i=[];for(let s=0;s<l.length;++s)i.push(l.charCodeAt(s)&255);return i}function Wi(l,i){let s,c,f,x=[];for(let v=0;v<l.length&&!((i-=2)<0);++v)s=l.charCodeAt(v),c=s>>8,f=s%256,x.push(f),x.push(c);return x}function Mr(l){return n.toByteArray(Vi(l))}function Mt(l,i,s,c){let f;for(f=0;f<c&&!(f+s>=i.length||f>=l.length);++f)i[f+s]=l[f];return f}function ye(l,i){return l instanceof i||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===i.name}function lr(l){return l!==l}let zi=(function(){let l="0123456789abcdef",i=new Array(256);for(let s=0;s<16;++s){let c=s*16;for(let f=0;f<16;++f)i[c+f]=l[s]+l[f]}return i})();function Ae(l){return typeof BigInt>"u"?Zi:l}function Zi(){throw new Error("BigInt not supported")}return Oe}var _t,ia,qt,sa,Oe,oa,la=pt(()=>{"use strict";m();y();h();_t={},ia=!1;qt={},sa=!1;Oe={},oa=!1});var Ue,k,$l,Dl,ca=pt(()=>{"use strict";m();y();h();la();Ue=ua();Ue.Buffer;Ue.SlowBuffer;Ue.INSPECT_MAX_BYTES;Ue.kMaxLength;k=Ue.Buffer,$l=Ue.INSPECT_MAX_BYTES,Dl=Ue.kMaxLength});var y=pt(()=>{"use strict";ca()});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var Ki=typeof global=="object"&&global&&global.Object===Object&&global,pa=Ki;var Qi=typeof self=="object"&&self&&self.Object===Object&&self,Xi=pa||Qi||Function("return this")(),da=Xi;var es=da.Symbol,_e=es;m();y();h();var fa=Object.prototype,ts=fa.hasOwnProperty,rs=fa.toString,kt=_e?_e.toStringTag:void 0;function ns(n){var e=ts.call(n,kt),t=n[kt];try{n[kt]=void 0;var r=!0}catch{}var a=rs.call(n);return r&&(e?n[kt]=t:delete n[kt]),a}var ma=ns;m();y();h();var as=Object.prototype,is=as.toString;function ss(n){return is.call(n)}var ha=ss;var os="[object Null]",us="[object Undefined]",ya=_e?_e.toStringTag:void 0;function ls(n){return n==null?n===void 0?us:os:ya&&ya in Object(n)?ma(n):ha(n)}var ga=ls;m();y();h();function cs(n){return n!=null&&typeof n=="object"}var xa=cs;var ps="[object Symbol]";function ds(n){return typeof n=="symbol"||xa(n)&&ga(n)==ps}var va=ds;m();y();h();m();y();h();function fs(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 wa=fs;m();y();h();var ms=Array.isArray,ba=ms;var hs=1/0,Ta=_e?_e.prototype:void 0,_a=Ta?Ta.toString:void 0;function ka(n){if(typeof n=="string")return n;if(ba(n))return wa(n,ka)+"";if(va(n))return _a?_a.call(n):"";var e=n+"";return e=="0"&&1/n==-hs?"-0":e}var Na=ka;m();y();h();function ys(n){return n==null?"":Na(n)}var Ce=ys;m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();function gs(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 Ra=gs;function xs(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ra(n,e,t)}var Ia=xs;m();y();h();var vs="\\ud800-\\udfff",ws="\\u0300-\\u036f",bs="\\ufe20-\\ufe2f",Ts="\\u20d0-\\u20ff",_s=ws+bs+Ts,ks="\\ufe0e\\ufe0f",Ns="\\u200d",Rs=RegExp("["+Ns+vs+_s+ks+"]");function Is(n){return Rs.test(n)}var Wt=Is;m();y();h();m();y();h();function As(n){return n.split("")}var Aa=As;m();y();h();var Ea="\\ud800-\\udfff",Es="\\u0300-\\u036f",Cs="\\ufe20-\\ufe2f",Ss="\\u20d0-\\u20ff",Ls=Es+Cs+Ss,Bs="\\ufe0e\\ufe0f",Ps="["+Ea+"]",mr="["+Ls+"]",hr="\\ud83c[\\udffb-\\udfff]",Fs="(?:"+mr+"|"+hr+")",Ca="[^"+Ea+"]",Sa="(?:\\ud83c[\\udde6-\\uddff]){2}",La="[\\ud800-\\udbff][\\udc00-\\udfff]",Os="\\u200d",Ba=Fs+"?",Pa="["+Bs+"]?",Us="(?:"+Os+"(?:"+[Ca,Sa,La].join("|")+")"+Pa+Ba+")*",js=Pa+Ba+Us,Ms="(?:"+[Ca+mr+"?",mr,Sa,La,Ps].join("|")+")",$s=RegExp(hr+"(?="+hr+")|"+Ms+js,"g");function Ds(n){return n.match($s)||[]}var Fa=Ds;function Vs(n){return Wt(n)?Fa(n):Aa(n)}var Oa=Vs;function qs(n){return function(e){e=Ce(e);var t=Wt(e)?Oa(e):void 0,r=t?t[0]:e.charAt(0),a=t?Ia(t,1).join(""):e.slice(1);return r[n]()+a}}var Ua=qs;var Ws=Ua("toUpperCase"),ja=Ws;function zs(n){return ja(Ce(n).toLowerCase())}var Ma=zs;m();y();h();m();y();h();function Zs(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 $a=Zs;m();y();h();m();y();h();m();y();h();function Gs(n){return function(e){return n?.[e]}}var Da=Gs;var Hs={\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"},Js=Da(Hs),Va=Js;var Ys=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ks="\\u0300-\\u036f",Qs="\\ufe20-\\ufe2f",Xs="\\u20d0-\\u20ff",eo=Ks+Qs+Xs,to="["+eo+"]",ro=RegExp(to,"g");function no(n){return n=Ce(n),n&&n.replace(Ys,Va).replace(ro,"")}var qa=no;m();y();h();m();y();h();var ao=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function io(n){return n.match(ao)||[]}var Wa=io;m();y();h();var so=/[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 so.test(n)}var za=oo;m();y();h();var Ya="\\ud800-\\udfff",uo="\\u0300-\\u036f",lo="\\ufe20-\\ufe2f",co="\\u20d0-\\u20ff",po=uo+lo+co,Ka="\\u2700-\\u27bf",Qa="a-z\\xdf-\\xf6\\xf8-\\xff",fo="\\xac\\xb1\\xd7\\xf7",mo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ho="\\u2000-\\u206f",yo=" \\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",Xa="A-Z\\xc0-\\xd6\\xd8-\\xde",go="\\ufe0e\\ufe0f",ei=fo+mo+ho+yo,ti="['\u2019]",Za="["+ei+"]",xo="["+po+"]",ri="\\d+",vo="["+Ka+"]",ni="["+Qa+"]",ai="[^"+Ya+ei+ri+Ka+Qa+Xa+"]",wo="\\ud83c[\\udffb-\\udfff]",bo="(?:"+xo+"|"+wo+")",To="[^"+Ya+"]",ii="(?:\\ud83c[\\udde6-\\uddff]){2}",si="[\\ud800-\\udbff][\\udc00-\\udfff]",ft="["+Xa+"]",_o="\\u200d",Ga="(?:"+ni+"|"+ai+")",ko="(?:"+ft+"|"+ai+")",Ha="(?:"+ti+"(?:d|ll|m|re|s|t|ve))?",Ja="(?:"+ti+"(?:D|LL|M|RE|S|T|VE))?",oi=bo+"?",ui="["+go+"]?",No="(?:"+_o+"(?:"+[To,ii,si].join("|")+")"+ui+oi+")*",Ro="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Io="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ao=ui+oi+No,Eo="(?:"+[vo,ii,si].join("|")+")"+Ao,Co=RegExp([ft+"?"+ni+"+"+Ha+"(?="+[Za,ft,"$"].join("|")+")",ko+"+"+Ja+"(?="+[Za,ft+Ga,"$"].join("|")+")",ft+"?"+Ga+"+"+Ha,ft+"+"+Ja,Io,Ro,ri,Eo].join("|"),"g");function So(n){return n.match(Co)||[]}var li=So;function Lo(n,e,t){return n=Ce(n),e=t?void 0:e,e===void 0?za(n)?li(n):Wa(n):n.match(e)||[]}var ci=Lo;var Bo="['\u2019]",Po=RegExp(Bo,"g");function Fo(n){return function(e){return $a(ci(qa(e).replace(Po,"")),n,"")}}var pi=Fo;var Oo=pi(function(n,e,t){return e=e.toLowerCase(),n+(t?Ma(e):e)}),yr=Oo;m();y();h();function M(n){throw new Error("Unexpected value: "+JSON.stringify(n))}m();y();h();function Nt(n){return Object.keys(n)}m();y();h();m();y();h();m();y();h();var Rt=T.env.FERN_STACK_TRACK?.toLowerCase()??"",ge=Rt!==""&&Rt!=="0"&&Rt!=="false",gr=["single","multiline","box"].includes(Rt)?Rt:"single";ge&&(Error.stackTraceLimit=50);var Uo=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),jo=new Set(["stacktrace"]);function Zt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,formatFilename:p=g=>g}={}){if(!ge)return[];r=[...r,...Uo],t=[...t,...jo],a=[...a,"runInteractiveTask"];let g=!1;return(new Error().stack??"").split(`
2
- `).map(w=>{let A=w.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(A&&A.length===5){let[,F,J,C,S]=A;if(!F||!J||!C||!S)return;if(g||a.some(q=>F?.includes(q))){g=!0;return}switch(F){case"Object.<anonymous>":F="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":F=`${F.substring(F.indexOf(".")+1)}()=> { ... }`;break}return{fn:F,path:p(J),position:`${C}:${S}`}}}).filter(w=>w&&!r.some(A=>w.fn.includes(A))&&!(o&&w.path?.startsWith("node:"))&&!(u&&w.path?.endsWith(".js"))&&!t.some(A=>w.path.includes(A))).slice(e,e+n)}var zt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:o=[],filterNode:u=!0,filterJs:p=!0,multiline:g=!1,formatFilename:w=A=>A}={}){_(this,"maxFrames");_(this,"skip");_(this,"filterPaths");_(this,"filterFunctions");_(this,"stopOn");_(this,"filterNode");_(this,"filterJs");_(this,"multiline");_(this,"formatFilename");_(this,"tracking",new WeakMap);this.maxFrames=e,this.skip=t,this.filterPaths=r,this.filterFunctions=a,this.stopOn=o,this.filterNode=u,this.filterJs=p,this.multiline=g,this.formatFilename=w}tag(e){let t=this.tracking.get(e)||new Set;Zt({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(!ge)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}},xr;function di({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,multiline:p=!1,formatFilename:g=w=>w}={}){ge&&(xr??(xr=new zt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:o,filterJs:u,multiline:p,formatFilename:g})))}function fi(n){xr?.tag(n)}function vr(n){return xr?.frames(n)??[]}var je=class{constructor(){fi(this)}};m();y();h();var Gt=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}},It=class extends Gt{async format(e){return e}formatSync(e){return e}};m();y();h();m();y();h();m();y();h();var me=class extends je{constructor(t){super();_(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 Mo=4;di({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var At=class{constructor(){_(this,"lineBuffer",[]);_(this,"indentLevel",0);_(this,"hasWrittenAnything",!1);_(this,"lastCharacterIsSemicolon",!1);_(this,"lastCharacterIsNewline",!1);_(this,"nodeStackFrames",[])}get buffer(){return ge&&this.nodeStackFrames.length>0&&this.writeInternal(`
1
+ var $r=Object.defineProperty;var Gi=(n,e,t)=>e in n?$r(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pt=(n,e)=>()=>(n&&(e=n(n=0)),e);var cr=(n,e)=>{for(var t in e)$r(n,t,{get:e[t],enumerable:!0})};var _=(n,e,t)=>Gi(n,typeof e!="symbol"?e+"":e,t);var m=pt(()=>{"use strict"});var T={};cr(T,{_debugEnd:()=>Sn,_debugProcess:()=>An,_events:()=>Zn,_eventsCount:()=>Gn,_exiting:()=>cn,_fatalExceptions:()=>Nn,_getActiveHandles:()=>mn,_getActiveRequests:()=>fn,_kill:()=>yn,_linkedBinding:()=>un,_maxListeners:()=>zn,_preload_modules:()=>Vn,_rawDebug:()=>sn,_startProfilerIdleNotifier:()=>Cn,_stopProfilerIdleNotifier:()=>Ln,_tickCallback:()=>En,abort:()=>On,addListener:()=>Hn,allowedNodeEnvironmentFlags:()=>Tn,arch:()=>zr,argv:()=>Hr,argv0:()=>Dn,assert:()=>_n,binding:()=>Xr,browser:()=>an,chdir:()=>rn,config:()=>pn,cpuUsage:()=>Vt,cwd:()=>tn,debugPort:()=>$n,default:()=>na,dlopen:()=>dn,domain:()=>ln,emit:()=>Xn,emitWarning:()=>Qr,env:()=>Gr,execArgv:()=>Jr,execPath:()=>Mn,exit:()=>wn,features:()=>kn,hasUncaughtExceptionCaptureCallback:()=>In,hrtime:()=>Dt,kill:()=>vn,listeners:()=>ra,memoryUsage:()=>xn,moduleLoadList:()=>on,nextTick:()=>Vr,off:()=>Yn,on:()=>Te,once:()=>Jn,openStdin:()=>bn,pid:()=>Un,platform:()=>Zr,ppid:()=>jn,prependListener:()=>ea,prependOnceListener:()=>ta,reallyExit:()=>hn,release:()=>nn,removeAllListeners:()=>Qn,removeListener:()=>Kn,resourceUsage:()=>gn,setSourceMapsEnabled:()=>qn,setUncaughtExceptionCaptureCallback:()=>Rn,stderr:()=>Pn,stdin:()=>Fn,stdout:()=>Bn,title:()=>Wr,umask:()=>en,uptime:()=>Wn,version:()=>Yr,versions:()=>Kr});function fr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function Hi(){!dt||!Fe||(dt=!1,Fe.length?be=Fe.concat(be):$t=-1,be.length&&Dr())}function Dr(){if(!dt){var n=setTimeout(Hi,0);dt=!0;for(var e=be.length;e;){for(Fe=be,be=[];++$t<e;)Fe&&Fe[$t].run();$t=-1,e=be.length}Fe=null,dt=!1,clearTimeout(n)}}function Vr(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 qr(n,e)),be.length===1&&!dt&&setTimeout(Dr,0)}function qr(n,e){this.fun=n,this.array=e}function ee(){}function un(n){fr("_linkedBinding")}function dn(n){fr("dlopen")}function fn(){return[]}function mn(){return[]}function _n(n,e){if(!n)throw new Error(e||"assertion error")}function In(){return!1}function Wn(){return Ae.now()/1e3}function Dt(n){var e=Math.floor((Date.now()-Ae.now())*.001),t=Ae.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+=dr)),[r,a]}function Te(){return na}function ra(n){return[]}var be,dt,Fe,$t,Wr,zr,Zr,Gr,Hr,Jr,Yr,Kr,Qr,Xr,en,tn,rn,nn,an,sn,on,ln,cn,pn,hn,yn,Vt,gn,xn,vn,wn,bn,Tn,kn,Nn,Rn,En,An,Sn,Cn,Ln,Bn,Pn,Fn,On,Un,jn,Mn,$n,Dn,Vn,qn,Ae,pr,dr,zn,Zn,Gn,Hn,Jn,Yn,Kn,Qn,Xn,ea,ta,na,aa=pt(()=>{"use strict";m();y();h();be=[],dt=!1,$t=-1;qr.prototype.run=function(){this.fun.apply(null,this.array)};Wr="browser",zr="x64",Zr="browser",Gr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Hr=["/usr/bin/node"],Jr=[],Yr="v16.8.0",Kr={},Qr=function(n,e){console.warn((e?e+": ":"")+n)},Xr=function(n){fr("binding")},en=function(n){return 0},tn=function(){return"/"},rn=function(n){},nn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};an=!0,sn=ee,on=[];ln={},cn=!1,pn={};hn=ee,yn=ee,Vt=function(){return{}},gn=Vt,xn=Vt,vn=ee,wn=ee,bn=ee,Tn={};kn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Nn=ee,Rn=ee;En=ee,An=ee,Sn=ee,Cn=ee,Ln=ee,Bn=void 0,Pn=void 0,Fn=void 0,On=ee,Un=2,jn=1,Mn="/bin/usr/node",$n=9229,Dn="node",Vn=[],qn=ee,Ae={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Ae.now===void 0&&(pr=Date.now(),Ae.timing&&Ae.timing.navigationStart&&(pr=Ae.timing.navigationStart),Ae.now=()=>Date.now()-pr);dr=1e9;Dt.bigint=function(n){var e=Dt(n);return typeof BigInt>"u"?e[0]*dr+e[1]:BigInt(e[0]*dr)+BigInt(e[1])};zn=10,Zn={},Gn=0;Hn=Te,Jn=Te,Yn=Te,Kn=Te,Qn=Te,Xn=ee,ea=Te,ta=Te;na={version:Yr,versions:Kr,arch:zr,platform:Zr,browser:an,release:nn,_rawDebug:sn,moduleLoadList:on,binding:Xr,_linkedBinding:un,_events:Zn,_eventsCount:Gn,_maxListeners:zn,on:Te,addListener:Hn,once:Jn,off:Yn,removeListener:Kn,removeAllListeners:Qn,emit:Xn,prependListener:ea,prependOnceListener:ta,listeners:ra,domain:ln,_exiting:cn,config:pn,dlopen:dn,uptime:Wn,_getActiveRequests:fn,_getActiveHandles:mn,reallyExit:hn,_kill:yn,cpuUsage:Vt,resourceUsage:gn,memoryUsage:xn,kill:vn,exit:wn,openStdin:bn,allowedNodeEnvironmentFlags:Tn,assert:_n,features:kn,_fatalExceptions:Nn,setUncaughtExceptionCaptureCallback:Rn,hasUncaughtExceptionCaptureCallback:In,emitWarning:Qr,nextTick:Vr,_tickCallback:En,_debugProcess:An,_debugEnd:Sn,_startProfilerIdleNotifier:Cn,_stopProfilerIdleNotifier:Ln,stdout:Bn,stdin:Fn,stderr:Pn,abort:On,umask:en,chdir:rn,cwd:tn,env:Gr,title:Wr,argv:Hr,execArgv:Jr,pid:Un,ppid:jn,execPath:Mn,debugPort:$n,hrtime:Dt,argv0:Dn,_preload_modules:Vn,setSourceMapsEnabled:qn}});var h=pt(()=>{"use strict";aa()});function Ji(){if(ia)return _t;ia=!0,_t.byteLength=p,_t.toByteArray=w,_t.fromByteArray=J;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=r.length;a<o;++a)n[a]=r[a],e[r.charCodeAt(a)]=a;e[45]=62,e[95]=63;function u(S){var C=S.length;if(C%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var q=S.indexOf("=");q===-1&&(q=C);var K=q===C?0:4-q%4;return[q,K]}function p(S){var C=u(S),q=C[0],K=C[1];return(q+K)*3/4-K}function g(S,C,q){return(C+q)*3/4-q}function w(S){var C,q=u(S),K=q[0],ne=q[1],Y=new t(g(S,K,ne)),ae=0,ce=ne>0?K-4:K,re;for(re=0;re<ce;re+=4)C=e[S.charCodeAt(re)]<<18|e[S.charCodeAt(re+1)]<<12|e[S.charCodeAt(re+2)]<<6|e[S.charCodeAt(re+3)],Y[ae++]=C>>16&255,Y[ae++]=C>>8&255,Y[ae++]=C&255;return ne===2&&(C=e[S.charCodeAt(re)]<<2|e[S.charCodeAt(re+1)]>>4,Y[ae++]=C&255),ne===1&&(C=e[S.charCodeAt(re)]<<10|e[S.charCodeAt(re+1)]<<4|e[S.charCodeAt(re+2)]>>2,Y[ae++]=C>>8&255,Y[ae++]=C&255),Y}function E(S){return n[S>>18&63]+n[S>>12&63]+n[S>>6&63]+n[S&63]}function F(S,C,q){for(var K,ne=[],Y=C;Y<q;Y+=3)K=(S[Y]<<16&16711680)+(S[Y+1]<<8&65280)+(S[Y+2]&255),ne.push(E(K));return ne.join("")}function J(S){for(var C,q=S.length,K=q%3,ne=[],Y=16383,ae=0,ce=q-K;ae<ce;ae+=Y)ne.push(F(S,ae,ae+Y>ce?ce:ae+Y));return K===1?(C=S[q-1],ne.push(n[C>>2]+n[C<<4&63]+"==")):K===2&&(C=(S[q-2]<<8)+S[q-1],ne.push(n[C>>10]+n[C>>4&63]+n[C<<2&63]+"=")),ne.join("")}return _t}function Yi(){if(sa)return qt;sa=!0;return qt.read=function(n,e,t,r,a){var o,u,p=a*8-r-1,g=(1<<p)-1,w=g>>1,E=-7,F=t?a-1:0,J=t?-1:1,S=n[e+F];for(F+=J,o=S&(1<<-E)-1,S>>=-E,E+=p;E>0;o=o*256+n[e+F],F+=J,E-=8);for(u=o&(1<<-E)-1,o>>=-E,E+=r;E>0;u=u*256+n[e+F],F+=J,E-=8);if(o===0)o=1-w;else{if(o===g)return u?NaN:(S?-1:1)*(1/0);u=u+Math.pow(2,r),o=o-w}return(S?-1:1)*u*Math.pow(2,o-r)},qt.write=function(n,e,t,r,a,o){var u,p,g,w=o*8-a-1,E=(1<<w)-1,F=E>>1,J=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=r?0:o-1,C=r?1:-1,q=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,u=E):(u=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-u))<1&&(u--,g*=2),u+F>=1?e+=J/g:e+=J*Math.pow(2,1-F),e*g>=2&&(u++,g/=2),u+F>=E?(p=0,u=E):u+F>=1?(p=(e*g-1)*Math.pow(2,a),u=u+F):(p=e*Math.pow(2,F-1)*Math.pow(2,a),u=0));a>=8;n[t+S]=p&255,S+=C,p/=256,a-=8);for(u=u<<a|p,w+=a;w>0;n[t+S]=u&255,S+=C,u/=256,w-=8);n[t+S-C]|=q*128},qt}function ua(){if(oa)return Oe;oa=!0;let n=Ji(),e=Yi(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Oe.Buffer=u,Oe.SlowBuffer=ne,Oe.INSPECT_MAX_BYTES=50;let r=2147483647;Oe.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 E(l)}return p(l,i,s)}u.poolSize=8192;function p(l,i,s){if(typeof l=="string")return F(l,i);if(ArrayBuffer.isView(l))return S(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(ye(l,ArrayBuffer)||l&&ye(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(l,SharedArrayBuffer)||l&&ye(l.buffer,SharedArrayBuffer)))return C(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 f=q(l);if(f)return f;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 p(l,i,s)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function g(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 w(l,i,s){return g(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 w(l,i,s)};function E(l){return g(l),o(l<0?0:K(l)|0)}u.allocUnsafe=function(l){return E(l)},u.allocUnsafeSlow=function(l){return E(l)};function F(l,i){if((typeof i!="string"||i==="")&&(i="utf8"),!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=Y(l,i)|0,c=o(s),f=c.write(l,i);return f!==s&&(c=c.slice(0,f)),c}function J(l){let i=l.length<0?0:K(l.length)|0,s=o(i);for(let c=0;c<i;c+=1)s[c]=l[c]&255;return s}function S(l){if(ye(l,Uint8Array)){let i=new Uint8Array(l);return C(i.buffer,i.byteOffset,i.byteLength)}return J(l)}function C(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 q(l){if(u.isBuffer(l)){let i=K(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"||lr(l.length)?o(0):J(l);if(l.type==="Buffer"&&Array.isArray(l.data))return J(l.data)}function K(l){if(l>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return l|0}function ne(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(ye(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),ye(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,f=s.length;for(let x=0,v=Math.min(c,f);x<v;++x)if(i[x]!==s[x]){c=i[x],f=s[x];break}return c<f?-1:f<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 f=u.allocUnsafe(s),x=0;for(c=0;c<i.length;++c){let v=i[c];if(ye(v,Uint8Array))x+v.length>f.length?(u.isBuffer(v)||(v=u.from(v)),v.copy(f,x)):Uint8Array.prototype.set.call(f,v,x);else if(u.isBuffer(v))v.copy(f,x);else throw new TypeError('"list" argument must be an Array of Buffers');x+=v.length}return f};function Y(l,i){if(u.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||ye(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 f=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":return ur(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return Mr(l).length;default:if(f)return c?-1:ur(l).length;i=(""+i).toLowerCase(),f=!0}}u.byteLength=Y;function ae(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 ji(this,i,s);case"utf8":case"utf-8":return Sr(this,i,s);case"ascii":return Oi(this,i,s);case"latin1":case"binary":return Ui(this,i,s);case"base64":return Pi(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mi(this,i,s);default:if(c)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),c=!0}}u.prototype._isBuffer=!0;function ce(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)ce(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)ce(this,s,s+3),ce(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)ce(this,s,s+7),ce(this,s+1,s+6),ce(this,s+2,s+5),ce(this,s+3,s+4);return this},u.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Sr(this,0,i):ae.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=Oe.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,f,x){if(ye(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),f===void 0&&(f=0),x===void 0&&(x=this.length),s<0||c>i.length||f<0||x>this.length)throw new RangeError("out of range index");if(f>=x&&s>=c)return 0;if(f>=x)return-1;if(s>=c)return 1;if(s>>>=0,c>>>=0,f>>>=0,x>>>=0,this===i)return 0;let v=x-f,U=c-s,G=Math.min(v,U),z=this.slice(f,x),H=i.slice(s,c);for(let W=0;W<G;++W)if(z[W]!==H[W]){v=z[W],U=H[W];break}return v<U?-1:U<v?1:0};function re(l,i,s,c,f){if(l.length===0)return-1;if(typeof s=="string"?(c=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,lr(s)&&(s=f?0:l.length-1),s<0&&(s=l.length+s),s>=l.length){if(f)return-1;s=l.length-1}else if(s<0)if(f)s=0;else return-1;if(typeof i=="string"&&(i=u.from(i,c)),u.isBuffer(i))return i.length===0?-1:Ar(l,i,s,c,f);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(l,i,s):Uint8Array.prototype.lastIndexOf.call(l,i,s):Ar(l,[i],s,c,f);throw new TypeError("val must be string, number or Buffer")}function Ar(l,i,s,c,f){let x=1,v=l.length,U=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;x=2,v/=2,U/=2,s/=2}function G(H,W){return x===1?H[W]:H.readUInt16BE(W*x)}let z;if(f){let H=-1;for(z=s;z<v;z++)if(G(l,z)===G(i,H===-1?0:z-H)){if(H===-1&&(H=z),z-H+1===U)return H*x}else H!==-1&&(z-=z-H),H=-1}else for(s+U>v&&(s=v-U),z=s;z>=0;z--){let H=!0;for(let W=0;W<U;W++)if(G(l,z+W)!==G(i,W)){H=!1;break}if(H)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 re(this,i,s,c,!0)},u.prototype.lastIndexOf=function(i,s,c){return re(this,i,s,c,!1)};function Ai(l,i,s,c){s=Number(s)||0;let f=l.length-s;c?(c=Number(c),c>f&&(c=f)):c=f;let x=i.length;c>x/2&&(c=x/2);let v;for(v=0;v<c;++v){let U=parseInt(i.substr(v*2,2),16);if(lr(U))return v;l[s+v]=U}return v}function Si(l,i,s,c){return Mt(ur(i,l.length-s),l,s,c)}function Ci(l,i,s,c){return Mt(qi(i),l,s,c)}function Li(l,i,s,c){return Mt(Mr(i),l,s,c)}function Bi(l,i,s,c){return Mt(Wi(i,l.length-s),l,s,c)}u.prototype.write=function(i,s,c,f){if(s===void 0)f="utf8",c=this.length,s=0;else if(c===void 0&&typeof s=="string")f=s,c=this.length,s=0;else if(isFinite(s))s=s>>>0,isFinite(c)?(c=c>>>0,f===void 0&&(f="utf8")):(f=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let x=this.length-s;if((c===void 0||c>x)&&(c=x),i.length>0&&(c<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");let v=!1;for(;;)switch(f){case"hex":return Ai(this,i,s,c);case"utf8":case"utf-8":return Si(this,i,s,c);case"ascii":case"latin1":case"binary":return Ci(this,i,s,c);case"base64":return Li(this,i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bi(this,i,s,c);default:if(v)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),v=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pi(l,i,s){return i===0&&s===l.length?n.fromByteArray(l):n.fromByteArray(l.slice(i,s))}function Sr(l,i,s){s=Math.min(l.length,s);let c=[],f=i;for(;f<s;){let x=l[f],v=null,U=x>239?4:x>223?3:x>191?2:1;if(f+U<=s){let G,z,H,W;switch(U){case 1:x<128&&(v=x);break;case 2:G=l[f+1],(G&192)===128&&(W=(x&31)<<6|G&63,W>127&&(v=W));break;case 3:G=l[f+1],z=l[f+2],(G&192)===128&&(z&192)===128&&(W=(x&15)<<12|(G&63)<<6|z&63,W>2047&&(W<55296||W>57343)&&(v=W));break;case 4:G=l[f+1],z=l[f+2],H=l[f+3],(G&192)===128&&(z&192)===128&&(H&192)===128&&(W=(x&15)<<18|(G&63)<<12|(z&63)<<6|H&63,W>65535&&W<1114112&&(v=W))}}v===null?(v=65533,U=1):v>65535&&(v-=65536,c.push(v>>>10&1023|55296),v=56320|v&1023),c.push(v),f+=U}return Fi(c)}let Cr=4096;function Fi(l){let i=l.length;if(i<=Cr)return String.fromCharCode.apply(String,l);let s="",c=0;for(;c<i;)s+=String.fromCharCode.apply(String,l.slice(c,c+=Cr));return s}function Oi(l,i,s){let c="";s=Math.min(l.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(l[f]&127);return c}function Ui(l,i,s){let c="";s=Math.min(l.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(l[f]);return c}function ji(l,i,s){let c=l.length;(!i||i<0)&&(i=0),(!s||s<0||s>c)&&(s=c);let f="";for(let x=i;x<s;++x)f+=zi[l[x]];return f}function Mi(l,i,s){let c=l.slice(i,s),f="";for(let x=0;x<c.length-1;x+=2)f+=String.fromCharCode(c[x]+c[x+1]*256);return f}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 f=this.subarray(i,s);return Object.setPrototypeOf(f,u.prototype),f};function Q(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||Q(i,s,this.length);let f=this[i],x=1,v=0;for(;++v<s&&(x*=256);)f+=this[i+v]*x;return f},u.prototype.readUintBE=u.prototype.readUIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=this[i+--s],x=1;for(;s>0&&(x*=256);)f+=this[i+--s]*x;return f},u.prototype.readUint8=u.prototype.readUInt8=function(i,s){return i=i>>>0,s||Q(i,1,this.length),this[i]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||Q(i,2,this.length),this[i]|this[i+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||Q(i,2,this.length),this[i]<<8|this[i+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||Q(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||Q(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},u.prototype.readBigUInt64LE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24,x=this[++i]+this[++i]*2**8+this[++i]*2**16+c*2**24;return BigInt(f)+(BigInt(x)<<BigInt(32))}),u.prototype.readBigUInt64BE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=s*2**24+this[++i]*2**16+this[++i]*2**8+this[++i],x=this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+c;return(BigInt(f)<<BigInt(32))+BigInt(x)}),u.prototype.readIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=this[i],x=1,v=0;for(;++v<s&&(x*=256);)f+=this[i+v]*x;return x*=128,f>=x&&(f-=Math.pow(2,8*s)),f},u.prototype.readIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=s,x=1,v=this[i+--f];for(;f>0&&(x*=256);)v+=this[i+--f]*x;return x*=128,v>=x&&(v-=Math.pow(2,8*s)),v},u.prototype.readInt8=function(i,s){return i=i>>>0,s||Q(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},u.prototype.readInt16LE=function(i,s){i=i>>>0,s||Q(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||Q(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||Q(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||Q(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},u.prototype.readBigInt64LE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(c<<24);return(BigInt(f)<<BigInt(32))+BigInt(s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24)}),u.prototype.readBigInt64BE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=(s<<24)+this[++i]*2**16+this[++i]*2**8+this[++i];return(BigInt(f)<<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||Q(i,4,this.length),e.read(this,i,!0,23,4)},u.prototype.readFloatBE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),e.read(this,i,!1,23,4)},u.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||Q(i,8,this.length),e.read(this,i,!0,52,8)},u.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||Q(i,8,this.length),e.read(this,i,!1,52,8)};function ie(l,i,s,c,f,x){if(!u.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>f||i<x)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,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let U=Math.pow(2,8*c)-1;ie(this,i,s,c,U,0)}let x=1,v=0;for(this[s]=i&255;++v<c&&(x*=256);)this[s+v]=i/x&255;return s+c},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let U=Math.pow(2,8*c)-1;ie(this,i,s,c,U,0)}let x=c-1,v=1;for(this[s+x]=i&255;--x>=0&&(v*=256);)this[s+x]=i/v&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 Lr(l,i,s,c,f){jr(i,c,f,l,s,7);let x=Number(i&BigInt(4294967295));l[s++]=x,x=x>>8,l[s++]=x,x=x>>8,l[s++]=x,x=x>>8,l[s++]=x;let v=Number(i>>BigInt(32)&BigInt(4294967295));return l[s++]=v,v=v>>8,l[s++]=v,v=v>>8,l[s++]=v,v=v>>8,l[s++]=v,s}function Br(l,i,s,c,f){jr(i,c,f,l,s,7);let x=Number(i&BigInt(4294967295));l[s+7]=x,x=x>>8,l[s+6]=x,x=x>>8,l[s+5]=x,x=x>>8,l[s+4]=x;let v=Number(i>>BigInt(32)&BigInt(4294967295));return l[s+3]=v,v=v>>8,l[s+2]=v,v=v>>8,l[s+1]=v,v=v>>8,l[s]=v,s+8}u.prototype.writeBigUInt64LE=Ee(function(i,s=0){return Lr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Ee(function(i,s=0){return Br(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let G=Math.pow(2,8*c-1);ie(this,i,s,c,G-1,-G)}let x=0,v=1,U=0;for(this[s]=i&255;++x<c&&(v*=256);)i<0&&U===0&&this[s+x-1]!==0&&(U=1),this[s+x]=(i/v>>0)-U&255;return s+c},u.prototype.writeIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let G=Math.pow(2,8*c-1);ie(this,i,s,c,G-1,-G)}let x=c-1,v=1,U=0;for(this[s+x]=i&255;--x>=0&&(v*=256);)i<0&&U===0&&this[s+x+1]!==0&&(U=1),this[s+x]=(i/v>>0)-U&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=Ee(function(i,s=0){return Lr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Ee(function(i,s=0){return Br(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pr(l,i,s,c,f,x){if(s+c>l.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Fr(l,i,s,c,f){return i=+i,s=s>>>0,f||Pr(l,i,s,4),e.write(l,i,s,c,23,4),s+4}u.prototype.writeFloatLE=function(i,s,c){return Fr(this,i,s,!0,c)},u.prototype.writeFloatBE=function(i,s,c){return Fr(this,i,s,!1,c)};function Or(l,i,s,c,f){return i=+i,s=s>>>0,f||Pr(l,i,s,8),e.write(l,i,s,c,52,8),s+8}u.prototype.writeDoubleLE=function(i,s,c){return Or(this,i,s,!0,c)},u.prototype.writeDoubleBE=function(i,s,c){return Or(this,i,s,!1,c)},u.prototype.copy=function(i,s,c,f){if(!u.isBuffer(i))throw new TypeError("argument should be a Buffer");if(c||(c=0),!f&&f!==0&&(f=this.length),s>=i.length&&(s=i.length),s||(s=0),f>0&&f<c&&(f=c),f===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(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),i.length-s<f-c&&(f=i.length-s+c);let x=f-c;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,c,f):Uint8Array.prototype.set.call(i,this.subarray(c,f),s),x},u.prototype.fill=function(i,s,c,f){if(typeof i=="string"){if(typeof s=="string"?(f=s,s=0,c=this.length):typeof c=="string"&&(f=c,c=this.length),f!==void 0&&typeof f!="string")throw new TypeError("encoding must be a string");if(typeof f=="string"&&!u.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(i.length===1){let v=i.charCodeAt(0);(f==="utf8"&&v<128||f==="latin1")&&(i=v)}}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 x;if(typeof i=="number")for(x=s;x<c;++x)this[x]=i;else{let v=u.isBuffer(i)?i:u.from(i,f),U=v.length;if(U===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(x=0;x<c-s;++x)this[x+s]=v[x%U]}return this};let lt={};function or(l,i,s){lt[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(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${l}]: ${this.message}`}}}or("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),or("ERR_INVALID_ARG_TYPE",function(l,i){return`The "${l}" argument must be of type number. Received type ${typeof i}`},TypeError),or("ERR_OUT_OF_RANGE",function(l,i,s){let c=`The value of "${l}" is out of range.`,f=s;return Number.isInteger(s)&&Math.abs(s)>2**32?f=Ur(String(s)):typeof s=="bigint"&&(f=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(f=Ur(f)),f+="n"),c+=` It must be ${i}. Received ${f}`,c},RangeError);function Ur(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 $i(l,i,s){ct(i,"offset"),(l[i]===void 0||l[i+s]===void 0)&&Tt(i,l.length-(s+1))}function jr(l,i,s,c,f,x){if(l>s||l<i){let v=typeof i=="bigint"?"n":"",U;throw i===0||i===BigInt(0)?U=`>= 0${v} and < 2${v} ** ${(x+1)*8}${v}`:U=`>= -(2${v} ** ${(x+1)*8-1}${v}) and < 2 ** ${(x+1)*8-1}${v}`,new lt.ERR_OUT_OF_RANGE("value",U,l)}$i(c,f,x)}function ct(l,i){if(typeof l!="number")throw new lt.ERR_INVALID_ARG_TYPE(i,"number",l)}function Tt(l,i,s){throw Math.floor(l)!==l?(ct(l,s),new lt.ERR_OUT_OF_RANGE("offset","an integer",l)):i<0?new lt.ERR_BUFFER_OUT_OF_BOUNDS:new lt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,l)}let Di=/[^+/0-9A-Za-z-_]/g;function Vi(l){if(l=l.split("=")[0],l=l.trim().replace(Di,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function ur(l,i){i=i||1/0;let s,c=l.length,f=null,x=[];for(let v=0;v<c;++v){if(s=l.charCodeAt(v),s>55295&&s<57344){if(!f){if(s>56319){(i-=3)>-1&&x.push(239,191,189);continue}else if(v+1===c){(i-=3)>-1&&x.push(239,191,189);continue}f=s;continue}if(s<56320){(i-=3)>-1&&x.push(239,191,189),f=s;continue}s=(f-55296<<10|s-56320)+65536}else f&&(i-=3)>-1&&x.push(239,191,189);if(f=null,s<128){if((i-=1)<0)break;x.push(s)}else if(s<2048){if((i-=2)<0)break;x.push(s>>6|192,s&63|128)}else if(s<65536){if((i-=3)<0)break;x.push(s>>12|224,s>>6&63|128,s&63|128)}else if(s<1114112){if((i-=4)<0)break;x.push(s>>18|240,s>>12&63|128,s>>6&63|128,s&63|128)}else throw new Error("Invalid code point")}return x}function qi(l){let i=[];for(let s=0;s<l.length;++s)i.push(l.charCodeAt(s)&255);return i}function Wi(l,i){let s,c,f,x=[];for(let v=0;v<l.length&&!((i-=2)<0);++v)s=l.charCodeAt(v),c=s>>8,f=s%256,x.push(f),x.push(c);return x}function Mr(l){return n.toByteArray(Vi(l))}function Mt(l,i,s,c){let f;for(f=0;f<c&&!(f+s>=i.length||f>=l.length);++f)i[f+s]=l[f];return f}function ye(l,i){return l instanceof i||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===i.name}function lr(l){return l!==l}let zi=(function(){let l="0123456789abcdef",i=new Array(256);for(let s=0;s<16;++s){let c=s*16;for(let f=0;f<16;++f)i[c+f]=l[s]+l[f]}return i})();function Ee(l){return typeof BigInt>"u"?Zi:l}function Zi(){throw new Error("BigInt not supported")}return Oe}var _t,ia,qt,sa,Oe,oa,la=pt(()=>{"use strict";m();y();h();_t={},ia=!1;qt={},sa=!1;Oe={},oa=!1});var Ue,k,Dl,Vl,ca=pt(()=>{"use strict";m();y();h();la();Ue=ua();Ue.Buffer;Ue.SlowBuffer;Ue.INSPECT_MAX_BYTES;Ue.kMaxLength;k=Ue.Buffer,Dl=Ue.INSPECT_MAX_BYTES,Vl=Ue.kMaxLength});var y=pt(()=>{"use strict";ca()});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var Ki=typeof global=="object"&&global&&global.Object===Object&&global,pa=Ki;var Qi=typeof self=="object"&&self&&self.Object===Object&&self,Xi=pa||Qi||Function("return this")(),da=Xi;var es=da.Symbol,_e=es;m();y();h();var fa=Object.prototype,ts=fa.hasOwnProperty,rs=fa.toString,kt=_e?_e.toStringTag:void 0;function ns(n){var e=ts.call(n,kt),t=n[kt];try{n[kt]=void 0;var r=!0}catch{}var a=rs.call(n);return r&&(e?n[kt]=t:delete n[kt]),a}var ma=ns;m();y();h();var as=Object.prototype,is=as.toString;function ss(n){return is.call(n)}var ha=ss;var os="[object Null]",us="[object Undefined]",ya=_e?_e.toStringTag:void 0;function ls(n){return n==null?n===void 0?us:os:ya&&ya in Object(n)?ma(n):ha(n)}var ga=ls;m();y();h();function cs(n){return n!=null&&typeof n=="object"}var xa=cs;var ps="[object Symbol]";function ds(n){return typeof n=="symbol"||xa(n)&&ga(n)==ps}var va=ds;m();y();h();m();y();h();function fs(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 wa=fs;m();y();h();var ms=Array.isArray,ba=ms;var hs=1/0,Ta=_e?_e.prototype:void 0,_a=Ta?Ta.toString:void 0;function ka(n){if(typeof n=="string")return n;if(ba(n))return wa(n,ka)+"";if(va(n))return _a?_a.call(n):"";var e=n+"";return e=="0"&&1/n==-hs?"-0":e}var Na=ka;m();y();h();function ys(n){return n==null?"":Na(n)}var Se=ys;m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();function gs(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 Ra=gs;function xs(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ra(n,e,t)}var Ia=xs;m();y();h();var vs="\\ud800-\\udfff",ws="\\u0300-\\u036f",bs="\\ufe20-\\ufe2f",Ts="\\u20d0-\\u20ff",_s=ws+bs+Ts,ks="\\ufe0e\\ufe0f",Ns="\\u200d",Rs=RegExp("["+Ns+vs+_s+ks+"]");function Is(n){return Rs.test(n)}var Wt=Is;m();y();h();m();y();h();function Es(n){return n.split("")}var Ea=Es;m();y();h();var Aa="\\ud800-\\udfff",As="\\u0300-\\u036f",Ss="\\ufe20-\\ufe2f",Cs="\\u20d0-\\u20ff",Ls=As+Ss+Cs,Bs="\\ufe0e\\ufe0f",Ps="["+Aa+"]",mr="["+Ls+"]",hr="\\ud83c[\\udffb-\\udfff]",Fs="(?:"+mr+"|"+hr+")",Sa="[^"+Aa+"]",Ca="(?:\\ud83c[\\udde6-\\uddff]){2}",La="[\\ud800-\\udbff][\\udc00-\\udfff]",Os="\\u200d",Ba=Fs+"?",Pa="["+Bs+"]?",Us="(?:"+Os+"(?:"+[Sa,Ca,La].join("|")+")"+Pa+Ba+")*",js=Pa+Ba+Us,Ms="(?:"+[Sa+mr+"?",mr,Ca,La,Ps].join("|")+")",$s=RegExp(hr+"(?="+hr+")|"+Ms+js,"g");function Ds(n){return n.match($s)||[]}var Fa=Ds;function Vs(n){return Wt(n)?Fa(n):Ea(n)}var Oa=Vs;function qs(n){return function(e){e=Se(e);var t=Wt(e)?Oa(e):void 0,r=t?t[0]:e.charAt(0),a=t?Ia(t,1).join(""):e.slice(1);return r[n]()+a}}var Ua=qs;var Ws=Ua("toUpperCase"),ja=Ws;function zs(n){return ja(Se(n).toLowerCase())}var Ma=zs;m();y();h();m();y();h();function Zs(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 $a=Zs;m();y();h();m();y();h();m();y();h();function Gs(n){return function(e){return n?.[e]}}var Da=Gs;var Hs={\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"},Js=Da(Hs),Va=Js;var Ys=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ks="\\u0300-\\u036f",Qs="\\ufe20-\\ufe2f",Xs="\\u20d0-\\u20ff",eo=Ks+Qs+Xs,to="["+eo+"]",ro=RegExp(to,"g");function no(n){return n=Se(n),n&&n.replace(Ys,Va).replace(ro,"")}var qa=no;m();y();h();m();y();h();var ao=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function io(n){return n.match(ao)||[]}var Wa=io;m();y();h();var so=/[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 so.test(n)}var za=oo;m();y();h();var Ya="\\ud800-\\udfff",uo="\\u0300-\\u036f",lo="\\ufe20-\\ufe2f",co="\\u20d0-\\u20ff",po=uo+lo+co,Ka="\\u2700-\\u27bf",Qa="a-z\\xdf-\\xf6\\xf8-\\xff",fo="\\xac\\xb1\\xd7\\xf7",mo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ho="\\u2000-\\u206f",yo=" \\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",Xa="A-Z\\xc0-\\xd6\\xd8-\\xde",go="\\ufe0e\\ufe0f",ei=fo+mo+ho+yo,ti="['\u2019]",Za="["+ei+"]",xo="["+po+"]",ri="\\d+",vo="["+Ka+"]",ni="["+Qa+"]",ai="[^"+Ya+ei+ri+Ka+Qa+Xa+"]",wo="\\ud83c[\\udffb-\\udfff]",bo="(?:"+xo+"|"+wo+")",To="[^"+Ya+"]",ii="(?:\\ud83c[\\udde6-\\uddff]){2}",si="[\\ud800-\\udbff][\\udc00-\\udfff]",ft="["+Xa+"]",_o="\\u200d",Ga="(?:"+ni+"|"+ai+")",ko="(?:"+ft+"|"+ai+")",Ha="(?:"+ti+"(?:d|ll|m|re|s|t|ve))?",Ja="(?:"+ti+"(?:D|LL|M|RE|S|T|VE))?",oi=bo+"?",ui="["+go+"]?",No="(?:"+_o+"(?:"+[To,ii,si].join("|")+")"+ui+oi+")*",Ro="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Io="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Eo=ui+oi+No,Ao="(?:"+[vo,ii,si].join("|")+")"+Eo,So=RegExp([ft+"?"+ni+"+"+Ha+"(?="+[Za,ft,"$"].join("|")+")",ko+"+"+Ja+"(?="+[Za,ft+Ga,"$"].join("|")+")",ft+"?"+Ga+"+"+Ha,ft+"+"+Ja,Io,Ro,ri,Ao].join("|"),"g");function Co(n){return n.match(So)||[]}var li=Co;function Lo(n,e,t){return n=Se(n),e=t?void 0:e,e===void 0?za(n)?li(n):Wa(n):n.match(e)||[]}var ci=Lo;var Bo="['\u2019]",Po=RegExp(Bo,"g");function Fo(n){return function(e){return $a(ci(qa(e).replace(Po,"")),n,"")}}var pi=Fo;var Oo=pi(function(n,e,t){return e=e.toLowerCase(),n+(t?Ma(e):e)}),yr=Oo;m();y();h();function M(n){throw new Error("Unexpected value: "+JSON.stringify(n))}m();y();h();function Nt(n){return Object.keys(n)}m();y();h();m();y();h();m();y();h();var Rt=T.env.FERN_STACK_TRACK?.toLowerCase()??"",ge=Rt!==""&&Rt!=="0"&&Rt!=="false",gr=["single","multiline","box"].includes(Rt)?Rt:"single";ge&&(Error.stackTraceLimit=50);var Uo=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),jo=new Set(["stacktrace"]);function Zt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,formatFilename:p=g=>g}={}){if(!ge)return[];r=[...r,...Uo],t=[...t,...jo],a=[...a,"runInteractiveTask"];let g=!1;return(new Error().stack??"").split(`
2
+ `).map(w=>{let E=w.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(E&&E.length===5){let[,F,J,S,C]=E;if(!F||!J||!S||!C)return;if(g||a.some(q=>F?.includes(q))){g=!0;return}switch(F){case"Object.<anonymous>":F="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":F=`${F.substring(F.indexOf(".")+1)}()=> { ... }`;break}return{fn:F,path:p(J),position:`${S}:${C}`}}}).filter(w=>w&&!r.some(E=>w.fn.includes(E))&&!(o&&w.path?.startsWith("node:"))&&!(u&&w.path?.endsWith(".js"))&&!t.some(E=>w.path.includes(E))).slice(e,e+n)}var zt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:o=[],filterNode:u=!0,filterJs:p=!0,multiline:g=!1,formatFilename:w=E=>E}={}){_(this,"maxFrames");_(this,"skip");_(this,"filterPaths");_(this,"filterFunctions");_(this,"stopOn");_(this,"filterNode");_(this,"filterJs");_(this,"multiline");_(this,"formatFilename");_(this,"tracking",new WeakMap);this.maxFrames=e,this.skip=t,this.filterPaths=r,this.filterFunctions=a,this.stopOn=o,this.filterNode=u,this.filterJs=p,this.multiline=g,this.formatFilename=w}tag(e){let t=this.tracking.get(e)||new Set;Zt({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(!ge)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}},xr;function di({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,multiline:p=!1,formatFilename:g=w=>w}={}){ge&&(xr??(xr=new zt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:o,filterJs:u,multiline:p,formatFilename:g})))}function fi(n){xr?.tag(n)}function vr(n){return xr?.frames(n)??[]}var je=class{constructor(){fi(this)}};m();y();h();var Gt=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}},It=class extends Gt{async format(e){return e}formatSync(e){return e}};m();y();h();m();y();h();m();y();h();var me=class extends je{constructor(t){super();_(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 Mo=4;di({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Et=class{constructor(){_(this,"lineBuffer",[]);_(this,"indentLevel",0);_(this,"hasWrittenAnything",!1);_(this,"lastCharacterIsSemicolon",!1);_(this,"lastCharacterIsNewline",!1);_(this,"nodeStackFrames",[])}get buffer(){return ge&&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,20 +12,20 @@ ${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=ge&&!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(Zt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,gr){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 Mo}};m();y();h();function wr(n){return n?.name!=null&&n?.assignment!=null}m();y();h();m();y();h();m();y();h();var Et=class{constructor(){_(this,"reporter");_(this,"snippet");_(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 Ct=class{constructor(e){_(this,"context");this.context=e}async generate(e,t={}){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Et;for(let o of r){let u=this.context.clone(),p=this.createSnippetGenerator(u);try{let g=await p.generateSnippet({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:g,errors:void 0};a.update({context:u,snippet:g})}catch(g){a.err==null&&(a.err=g)}}return a.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,t={}){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);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(),p=this.createSnippetGenerator(u);try{return await p.generateSnippetAst({endpoint:o,request:e,options:t})}catch(g){a=g}}throw a??new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,t={}){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Et;for(let o of r){let u=this.context.clone(),p=this.createSnippetGenerator(u);try{let g=p.generateSnippetSync({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:g,errors:void 0};a.update({context:u,snippet:g})}catch(g){a.err==null&&(a.err=g)}}return a.getResponseOrThrow({endpoint:e.endpoint})}};m();y();h();m();y();h();m();y();h();var St=class{constructor(){_(this,"REFERENCE_REGEX",/^(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[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};m();y();h();var $={Critical:"CRITICAL",Warning:"WARNING"},Lt=class n{constructor(){_(this,"errors");_(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}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 Bt=class{constructor({ir:e,config:t,options:r={}}){_(this,"config");_(this,"options");_(this,"errors");_(this,"_ir");_(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new Lt,this.httpEndpointReferenceParser=new St}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(g=>g.name.wireValue===a);if(u==null)throw this.newParameterNotRecognizedError(a);let p=this.isListTypeReference(u.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:u.name,typeReference:u.typeReference,value:p})}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=[];for(let[o,u]of Object.entries(t))if(u!==void 0){this.errors.scope(o);try{let p=e.find(g=>g.name.wireValue===o);if(p==null){if(r)continue;this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(o).message});continue}a.push({name:p.name,typeReference:p.typeReference,value:u})}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]:p,...g}=r;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:g}}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:M(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:M(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:M(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:M(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:M(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}};m();y();h();var Me;(function(n){n.Concise="concise",n.Full="full"})(Me||(Me={}));m();y();h();var se={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};m();y();h();m();y();h();m();y();h();m();y();h();var $e=class extends At{constructor({packageName:t,customConfig:r,formatter:a}){super();_(this,"packageName");_(this,"customConfig");_(this,"formatter");_(this,"imports",new Set);this.packageName=t,this.customConfig=r,this.formatter=a??new It}addImport(t){this.imports.add(t)}getImports(){return new Set(this.imports)}};var Pt=class extends $e{constructor({packageName:e,customConfig:t,formatter:r}){super({packageName:e,customConfig:t,formatter:r})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format Java file: ${t}
15
+ `),a=ge&&!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(Zt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,gr){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 Mo}};m();y();h();function wr(n){return n?.name!=null&&n?.assignment!=null}m();y();h();m();y();h();m();y();h();var At=class{constructor(){_(this,"reporter");_(this,"snippet");_(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 St=class{constructor(e){_(this,"context");this.context=e}async generate(e,t={}){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new At;for(let o of r){let u=this.context.clone(),p=this.createSnippetGenerator(u);try{let g=await p.generateSnippet({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:g,errors:void 0};a.update({context:u,snippet:g})}catch(g){a.err==null&&(a.err=g)}}return a.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,t={}){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);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(),p=this.createSnippetGenerator(u);try{return await p.generateSnippetAst({endpoint:o,request:e,options:t})}catch(g){a=g}}throw a??new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,t={}){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new At;for(let o of r){let u=this.context.clone(),p=this.createSnippetGenerator(u);try{let g=p.generateSnippetSync({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:g,errors:void 0};a.update({context:u,snippet:g})}catch(g){a.err==null&&(a.err=g)}}return a.getResponseOrThrow({endpoint:e.endpoint})}};m();y();h();m();y();h();m();y();h();var Ct=class{constructor(){_(this,"REFERENCE_REGEX",/^(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[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};m();y();h();var D={Critical:"CRITICAL",Warning:"WARNING"},Lt=class n{constructor(){_(this,"errors");_(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}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 Bt=class{constructor({ir:e,config:t,options:r={}}){_(this,"config");_(this,"options");_(this,"errors");_(this,"_ir");_(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new Lt,this.httpEndpointReferenceParser=new Ct}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(g=>g.name.wireValue===a);if(u==null)throw this.newParameterNotRecognizedError(a);let p=this.isListTypeReference(u.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:u.name,typeReference:u.typeReference,value:p})}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:D.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=[];for(let[o,u]of Object.entries(t))if(u!==void 0){this.errors.scope(o);try{let p=e.find(g=>g.name.wireValue===o);if(p==null){if(r)continue;this.errors.add({severity:D.Critical,message:this.newParameterNotRecognizedError(o).message});continue}a.push({name:p.name,typeReference:p.typeReference,value:u})}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:D.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:D.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:D.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:D.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:D.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:D.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof o!="string"){this.errors.add({severity:D.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:D.Critical,message:`No type found for discriminant value "${o}"`});return}let{[a]:p,...g}=r;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:g}}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:M(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:M(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:D.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:D.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:D.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:D.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:D.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:D.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:D.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:M(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:M(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:M(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}};m();y();h();var Me;(function(n){n.Concise="concise",n.Full="full"})(Me||(Me={}));m();y();h();var se={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};m();y();h();m();y();h();m();y();h();m();y();h();var $e=class extends Et{constructor({packageName:t,customConfig:r,formatter:a}){super();_(this,"packageName");_(this,"customConfig");_(this,"formatter");_(this,"imports",new Set);this.packageName=t,this.customConfig=r,this.formatter=a??new It}addImport(t){this.imports.add(t)}getImports(){return new Set(this.imports)}};var Pt=class extends $e{constructor({packageName:e,customConfig:t,formatter:r}){super({packageName:e,customConfig:t,formatter:r})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format Java file: ${t}
16
16
  ${e}`)}return e}toString(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(e)}catch(t){throw new Error(`Failed to format Java file: ${t}
17
17
  ${e}`)}return e}getContent(){let e=`package ${this.packageName};
18
18
 
19
19
  `,t=this.stringifyImports();return t.length>0?`${e}${t}
20
20
 
21
21
  ${this.buffer}`:e+this.buffer}stringifyImports(){return Array.from(this.imports).filter(e=>e!==this.packageName).map(e=>`import ${e};`).sort().join(`
22
- `)}};m();y();h();m();y();h();var D={};cr(D,{BRAND:()=>pu,DIRTY:()=>De,EMPTY_PATH:()=>qo,INVALID:()=>L,NEVER:()=>Ju,OK:()=>te,ParseStatus:()=>X,Schema:()=>O,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>qe,ZodBoolean:()=>We,ZodBranded:()=>Ot,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>Yt,ZodEffects:()=>fe,ZodEnum:()=>Qe,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>Qt,ZodIntersection:()=>Je,ZodIssueCode:()=>b,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>vt,ZodNaN:()=>bt,ZodNativeEnum:()=>Xe,ZodNever:()=>he,ZodNull:()=>Ge,ZodNullable:()=>we,ZodNumber:()=>Ve,ZodObject:()=>ue,ZodOptional:()=>pe,ZodParsedType:()=>I,ZodPipeline:()=>Ut,ZodPromise:()=>Pe,ZodReadonly:()=>rt,ZodRecord:()=>Kt,ZodSchema:()=>O,ZodSet:()=>wt,ZodString:()=>Le,ZodSymbol:()=>gt,ZodTransformer:()=>fe,ZodTuple:()=>ve,ZodType:()=>O,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Re,ZodVoid:()=>xt,addIssueToContext:()=>R,any:()=>wu,array:()=>ku,bigint:()=>hu,boolean:()=>ki,coerce:()=>Hu,custom:()=>bi,date:()=>yu,datetimeRegex:()=>vi,defaultErrorMap:()=>ke,discriminatedUnion:()=>Au,effect:()=>$u,enum:()=>Uu,function:()=>Pu,getErrorMap:()=>mt,getParsedType:()=>xe,instanceof:()=>fu,intersection:()=>Eu,isAborted:()=>Ht,isAsync:()=>ht,isDirty:()=>Jt,isValid:()=>Se,late:()=>du,lazy:()=>Fu,literal:()=>Ou,makeIssue:()=>Ft,map:()=>Lu,nan:()=>mu,nativeEnum:()=>ju,never:()=>Tu,null:()=>vu,nullable:()=>Vu,number:()=>_i,object:()=>Nu,objectUtil:()=>br,oboolean:()=>Gu,onumber:()=>Zu,optional:()=>Du,ostring:()=>zu,pipeline:()=>Wu,preprocess:()=>qu,promise:()=>Mu,quotelessJson:()=>$o,record:()=>Su,set:()=>Bu,setErrorMap:()=>Vo,strictObject:()=>Ru,string:()=>Ti,symbol:()=>gu,transformer:()=>$u,tuple:()=>Cu,undefined:()=>xu,union:()=>Iu,unknown:()=>bu,util:()=>j,void:()=>_u});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var j;(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(p=>typeof a[a[p]]!="number"),u={};for(let p of o)u[p]=a[p];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})(j||(j={}));var br;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(br||(br={}));var I=j.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xe=n=>{switch(typeof n){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(n)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(n)?I.array:n===null?I.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?I.promise:typeof Map<"u"&&n instanceof Map?I.map:typeof Set<"u"&&n instanceof Set?I.set:typeof Date<"u"&&n instanceof Date?I.date:I.object;default:return I.unknown}};var b=j.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"]),$o=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),oe=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(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 p=r,g=0;for(;g<u.path.length;){let w=u.path[g];g===u.path.length-1?(p[w]=p[w]||{_errors:[]},p[w]._errors.push(t(u))):p[w]=p[w]||{_errors:[]},p=p[w],g++}}};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,j.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()}};oe.create=n=>new oe(n);var Do=(n,e)=>{let t;switch(n.code){case b.invalid_type:n.received===I.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case b.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,j.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:t=`Unrecognized key(s) in object: ${j.joinValues(n.keys,", ")}`;break;case b.invalid_union:t="Invalid input";break;case b.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${j.joinValues(n.options)}`;break;case b.invalid_enum_value:t=`Invalid enum value. Expected ${j.joinValues(n.options)}, received '${n.received}'`;break;case b.invalid_arguments:t="Invalid function arguments";break;case b.invalid_return_type:t="Invalid function return type";break;case b.invalid_date:t="Invalid date";break;case b.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}"`:j.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case b.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 b.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 b.custom:t="Invalid input";break;case b.invalid_intersection_types:t="Intersection results could not be merged";break;case b.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case b.not_finite:t="Number must be finite";break;default:t=e.defaultError,j.assertNever(n)}return{message:t}},ke=Do;var mi=ke;function Vo(n){mi=n}function mt(){return mi}m();y();h();var Ft=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 p="",g=r.filter(w=>!!w).slice().reverse();for(let w of g)p=w(u,{data:e,defaultError:p}).message;return{...a,path:o,message:p}},qo=[];function R(n,e){let t=mt(),r=Ft({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===ke?void 0:ke].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 L;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 L;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}}},L=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),te=n=>({status:"valid",value:n}),Ht=n=>n.status==="aborted",Jt=n=>n.status==="dirty",Se=n=>n.status==="valid",ht=n=>typeof Promise<"u"&&n instanceof Promise;m();y();h();m();y();h();var E;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(E||(E={}));var de=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}},hi=(n,e)=>{if(Se(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new oe(n.common.issues);return this._error=t,this._error}}};function P(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,p)=>{let{message:g}=n;return u.code==="invalid_enum_value"?{message:g??p.defaultError}:typeof p.data>"u"?{message:g??r??p.defaultError}:u.code!=="invalid_type"?{message:p.defaultError}:{message:g??t??p.defaultError}},description:a}}var O=class{get description(){return this._def.description}_getType(e){return xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xe(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:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ht(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:xe(e)},a=this._parseSync({data:e,path:r.path,parent:r});return hi(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Se(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=>Se(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:xe(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(ht(a)?a:Promise.resolve(a));return hi(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),p=()=>o.addIssue({code:b.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(g=>g?!0:(p(),!1)):u?!0:(p(),!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 fe({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 pe.create(this,this._def)}nullable(){return we.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Pe.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 fe({...P(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...P(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Ot({typeName:B.ZodBranded,type:this,...P(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...P(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 Ut.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wo=/^c[^\s-]{8,}$/i,zo=/^[0-9a-z]+$/,Zo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Go=/^[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,Ho=/^[a-z0-9_-]{21}$/i,Jo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yo=/^[-+]?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)?)??$/,Ko=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Tr,Xo=/^(?:(?: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])$/,tu=/^(([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])$/,nu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,au=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gi="((\\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])))",iu=new RegExp(`^${gi}$`);function xi(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 su(n){return new RegExp(`^${xi(n)}$`)}function vi(n){let e=`${gi}T${xi(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 ou(n,e){return!!((e==="v4"||!e)&&Xo.test(n)||(e==="v6"||!e)&&tu.test(n))}function uu(n,e){if(!Jo.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 Le=class n extends O{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==I.string){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.string,received:o.parsedType}),L}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),R(a,{code:b.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),R(a,{code:b.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,p=e.data.length<o.value;(u||p)&&(a=this._getOrReturnCtx(e,a),u?R(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):p&&R(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Ko.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")Tr||(Tr=new RegExp(Qo,"u")),Tr.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Go.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")Ho.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")Wo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")zo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Zo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),R(a,{validation:"url",code:b.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),R(a,{validation:"regex",code:b.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),R(a,{code:b.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),R(a,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?vi(o).test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?iu.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?su(o).test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Yo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?ou(e.data,o.version)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?uu(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?lu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?nu.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?au.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):j.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:b.invalid_string,...E.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...E.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...E.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,...E.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,...E.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...E.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.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}};Le.create=n=>new Le({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...P(n)});function cu(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 O{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)!==I.number){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.number,received:o.parsedType}),L}let r,a=new X;for(let o of this._def.checks)o.kind==="int"?j.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),R(r,{code:b.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),R(r,{code:b.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),R(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?cu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_finite,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.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"&&j.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,...P(n)});var qe=class n extends O{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)!==I.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),R(r,{code:b.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),R(r,{code:b.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),R(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return R(t,{code:b.invalid_type,expected:I.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.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:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.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}};qe.create=n=>new qe({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...P(n)});var We=class extends O{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==I.boolean){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.boolean,received:r.parsedType}),L}return te(e.data)}};We.create=n=>new We({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...P(n)});var ze=class n extends O{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==I.date){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.date,received:o.parsedType}),L}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_date}),L}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),R(a,{code:b.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),R(a,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):j.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:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.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,...P(n)});var gt=class extends O{_parse(e){if(this._getType(e)!==I.symbol){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.symbol,received:r.parsedType}),L}return te(e.data)}};gt.create=n=>new gt({typeName:B.ZodSymbol,...P(n)});var Ze=class extends O{_parse(e){if(this._getType(e)!==I.undefined){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.undefined,received:r.parsedType}),L}return te(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...P(n)});var Ge=class extends O{_parse(e){if(this._getType(e)!==I.null){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.null,received:r.parsedType}),L}return te(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...P(n)});var Be=class extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}};Be.create=n=>new Be({typeName:B.ZodAny,...P(n)});var Re=class extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}};Re.create=n=>new Re({typeName:B.ZodUnknown,...P(n)});var he=class extends O{_parse(e){let t=this._getOrReturnCtx(e);return R(t,{code:b.invalid_type,expected:I.never,received:t.parsedType}),L}};he.create=n=>new he({typeName:B.ZodNever,...P(n)});var xt=class extends O{_parse(e){if(this._getType(e)!==I.undefined){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.void,received:r.parsedType}),L}return te(e.data)}};xt.create=n=>new xt({typeName:B.ZodVoid,...P(n)});var Ie=class n extends O{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==I.array)return R(t,{code:b.invalid_type,expected:I.array,received:t.parsedType}),L;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,p=t.data.length<a.exactLength.value;(u||p)&&(R(t,{code:u?b.too_big:b.too_small,minimum:p?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&&(R(t,{code:b.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&&(R(t,{code:b.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,p)=>a.type._parseAsync(new de(t,u,t.path,p)))).then(u=>X.mergeArray(r,u));let o=[...t.data].map((u,p)=>a.type._parseSync(new de(t,u,t.path,p)));return X.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...P(e)});function yt(n){if(n instanceof ue){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=pe.create(yt(r))}return new ue({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:yt(n.element)}):n instanceof pe?pe.create(yt(n.unwrap())):n instanceof we?we.create(yt(n.unwrap())):n instanceof ve?ve.create(n.items.map(e=>yt(e))):n}var ue=class n extends O{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=j.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==I.object){let w=this._getOrReturnCtx(e);return R(w,{code:b.invalid_type,expected:I.object,received:w.parsedType}),L}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),p=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(let w in a.data)u.includes(w)||p.push(w);let g=[];for(let w of u){let A=o[w],F=a.data[w];g.push({key:{status:"valid",value:w},value:A._parse(new de(a,F,a.path,w)),alwaysSet:w in a.data})}if(this._def.catchall instanceof he){let w=this._def.unknownKeys;if(w==="passthrough")for(let A of p)g.push({key:{status:"valid",value:A},value:{status:"valid",value:a.data[A]}});else if(w==="strict")p.length>0&&(R(a,{code:b.unrecognized_keys,keys:p}),r.dirty());else if(w!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let A of p){let F=a.data[A];g.push({key:{status:"valid",value:A},value:w._parse(new de(a,F,a.path,A)),alwaysSet:A in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let w=[];for(let A of g){let F=await A.key,J=await A.value;w.push({key:F,value:J,alwaysSet:A.alwaysSet})}return w}).then(w=>X.mergeObjectSync(r,w)):X.mergeObjectSync(r,g)}get shape(){return this._def.shape()}strict(e){return E.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:E.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 j.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 j.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return yt(this)}partial(e){let t={};for(let r of j.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 j.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof pe;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return wi(j.objectKeys(this.shape))}};ue.create=(n,e)=>new ue({shape:()=>n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...P(e)});ue.strictCreate=(n,e)=>new ue({shape:()=>n,unknownKeys:"strict",catchall:he.create(),typeName:B.ZodObject,...P(e)});ue.lazycreate=(n,e)=>new ue({shape:n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...P(e)});var He=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(o){for(let p of o)if(p.result.status==="valid")return p.result;for(let p of o)if(p.result.status==="dirty")return t.common.issues.push(...p.ctx.common.issues),p.result;let u=o.map(p=>new oe(p.ctx.common.issues));return R(t,{code:b.invalid_union,unionErrors:u}),L}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 g of r){let w={...t,common:{...t.common,issues:[]},parent:null},A=g._parseSync({data:t.data,path:t.path,parent:w});if(A.status==="valid")return A;A.status==="dirty"&&!o&&(o={result:A,ctx:w}),w.common.issues.length&&u.push(w.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let p=u.map(g=>new oe(g));return R(t,{code:b.invalid_union,unionErrors:p}),L}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...P(e)});var Ne=n=>n instanceof Ye?Ne(n.schema):n instanceof fe?Ne(n.innerType()):n instanceof Ke?[n.value]:n instanceof Qe?n.options:n instanceof Xe?j.objectValues(n.enum):n instanceof et?Ne(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof pe?[void 0,...Ne(n.unwrap())]:n instanceof we?[null,...Ne(n.unwrap())]:n instanceof Ot||n instanceof rt?Ne(n.unwrap()):n instanceof tt?Ne(n._def.innerType):[],Yt=class n extends O{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.object)return R(t,{code:b.invalid_type,expected:I.object,received:t.parsedType}),L;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}):(R(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),L)}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=Ne(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 p of u){if(a.has(p))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(p)}`);a.set(p,o)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...P(r)})}};function _r(n,e){let t=xe(n),r=xe(e);if(n===e)return{valid:!0,data:n};if(t===I.object&&r===I.object){let a=j.objectKeys(e),o=j.objectKeys(n).filter(p=>a.indexOf(p)!==-1),u={...n,...e};for(let p of o){let g=_r(n[p],e[p]);if(!g.valid)return{valid:!1};u[p]=g.data}return{valid:!0,data:u}}else if(t===I.array&&r===I.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let u=n[o],p=e[o],g=_r(u,p);if(!g.valid)return{valid:!1};a.push(g.data)}return{valid:!0,data:a}}else return t===I.date&&r===I.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Je=class extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(Ht(o)||Ht(u))return L;let p=_r(o.value,u.value);return p.valid?((Jt(o)||Jt(u))&&t.dirty(),{status:t.value,value:p.data}):(R(r,{code:b.invalid_intersection_types}),L)};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,...P(t)});var ve=class n extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.array)return R(r,{code:b.invalid_type,expected:I.array,received:r.parsedType}),L;if(r.data.length<this._def.items.length)return R(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;!this._def.rest&&r.data.length>this._def.items.length&&(R(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((u,p)=>{let g=this._def.items[p]||this._def.rest;return g?g._parse(new de(r,u,r.path,p)):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})}};ve.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ve({items:n,typeName:B.ZodTuple,rest:null,...P(e)})};var Kt=class n extends O{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!==I.object)return R(r,{code:b.invalid_type,expected:I.object,received:r.parsedType}),L;let a=[],o=this._def.keyType,u=this._def.valueType;for(let p in r.data)a.push({key:o._parse(new de(r,p,r.path,p)),value:u._parse(new de(r,r.data[p],r.path,p)),alwaysSet:p 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 O?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...P(r)}):new n({keyType:Le.create(),valueType:e,typeName:B.ZodRecord,...P(t)})}},vt=class extends O{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!==I.map)return R(r,{code:b.invalid_type,expected:I.map,received:r.parsedType}),L;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([p,g],w)=>({key:a._parse(new de(r,p,r.path,[w,"key"])),value:o._parse(new de(r,g,r.path,[w,"value"]))}));if(r.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let g of u){let w=await g.key,A=await g.value;if(w.status==="aborted"||A.status==="aborted")return L;(w.status==="dirty"||A.status==="dirty")&&t.dirty(),p.set(w.value,A.value)}return{status:t.value,value:p}})}else{let p=new Map;for(let g of u){let w=g.key,A=g.value;if(w.status==="aborted"||A.status==="aborted")return L;(w.status==="dirty"||A.status==="dirty")&&t.dirty(),p.set(w.value,A.value)}return{status:t.value,value:p}}}};vt.create=(n,e,t)=>new vt({valueType:e,keyType:n,typeName:B.ZodMap,...P(t)});var wt=class n extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.set)return R(r,{code:b.invalid_type,expected:I.set,received:r.parsedType}),L;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(R(r,{code:b.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&&(R(r,{code:b.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(g){let w=new Set;for(let A of g){if(A.status==="aborted")return L;A.status==="dirty"&&t.dirty(),w.add(A.value)}return{status:t.value,value:w}}let p=[...r.data.values()].map((g,w)=>o._parse(new de(r,g,r.path,w)));return r.common.async?Promise.all(p).then(g=>u(g)):u(p)}min(e,t){return new n({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};wt.create=(n,e)=>new wt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...P(e)});var Qt=class n extends O{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.function)return R(t,{code:b.invalid_type,expected:I.function,received:t.parsedType}),L;function r(p,g){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_arguments,argumentsError:g}})}function a(p,g){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_return_type,returnTypeError:g}})}let o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Pe){let p=this;return te(async function(...g){let w=new oe([]),A=await p._def.args.parseAsync(g,o).catch(C=>{throw w.addIssue(r(g,C)),w}),F=await Reflect.apply(u,this,A);return await p._def.returns._def.type.parseAsync(F,o).catch(C=>{throw w.addIssue(a(F,C)),w})})}else{let p=this;return te(function(...g){let w=p._def.args.safeParse(g,o);if(!w.success)throw new oe([r(g,w.error)]);let A=Reflect.apply(u,this,w.data),F=p._def.returns.safeParse(A,o);if(!F.success)throw new oe([a(A,F.error)]);return F.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:ve.create(e).rest(Re.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||ve.create([]).rest(Re.create()),returns:t||Re.create(),typeName:B.ZodFunction,...P(r)})}},Ye=class extends O{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,...P(e)});var Ke=class extends O{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return R(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...P(e)});function wi(n,e){return new Qe({values:n,typeName:B.ZodEnum,...P(e)})}var Qe=class n extends O{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return R(t,{expected:j.joinValues(r),received:t.parsedType,code:b.invalid_type}),L}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 R(t,{received:t.data,code:b.invalid_enum_value,options:r}),L}return te(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})}};Qe.create=wi;var Xe=class extends O{_parse(e){let t=j.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==I.string&&r.parsedType!==I.number){let a=j.objectValues(t);return R(r,{expected:j.joinValues(a),received:r.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set(j.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=j.objectValues(t);return R(r,{received:r.data,code:b.invalid_enum_value,options:a}),L}return te(e.data)}get enum(){return this._def.values}};Xe.create=(n,e)=>new Xe({values:n,typeName:B.ZodNativeEnum,...P(e)});var Pe=class extends O{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.promise&&t.common.async===!1)return R(t,{code:b.invalid_type,expected:I.promise,received:t.parsedType}),L;let r=t.parsedType===I.promise?t.data:Promise.resolve(t.data);return te(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Pe.create=(n,e)=>new Pe({type:n,typeName:B.ZodPromise,...P(e)});var fe=class extends O{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=>{R(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 p=>{if(t.value==="aborted")return L;let g=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return g.status==="aborted"?L:g.status==="dirty"?De(g.value):t.value==="dirty"?De(g.value):g});{if(t.value==="aborted")return L;let p=this._def.schema._parseSync({data:u,path:r.path,parent:r});return p.status==="aborted"?L:p.status==="dirty"?De(p.value):t.value==="dirty"?De(p.value):p}}if(a.type==="refinement"){let u=p=>{let g=a.refinement(p,o);if(r.common.async)return Promise.resolve(g);if(g instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(r.common.async===!1){let p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value),{status:t.value,value:p.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value).then(()=>({status:t.value,value:p.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(!Se(u))return L;let p=a.transform(u.value,o);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:p}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Se(u)?Promise.resolve(a.transform(u.value,o)).then(p=>({status:t.value,value:p})):L);j.assertNever(a)}};fe.create=(n,e,t)=>new fe({schema:n,typeName:B.ZodEffects,effect:e,...P(t)});fe.createWithPreprocess=(n,e,t)=>new fe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...P(t)});var pe=class extends O{_parse(e){return this._getType(e)===I.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pe.create=(n,e)=>new pe({innerType:n,typeName:B.ZodOptional,...P(e)});var we=class extends O{_parse(e){return this._getType(e)===I.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.create=(n,e)=>new we({innerType:n,typeName:B.ZodNullable,...P(e)});var et=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===I.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,...P(e)});var tt=class extends O{_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 ht(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});var bt=class extends O{_parse(e){if(this._getType(e)!==I.nan){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.nan,received:r.parsedType}),L}return{status:"valid",value:e.data}}};bt.create=n=>new bt({typeName:B.ZodNaN,...P(n)});var pu=Symbol("zod_brand"),Ot=class extends O{_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}},Ut=class n extends O{_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"?L: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"?L: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 O{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Se(a)&&(a.value=Object.freeze(a.value)),a);return ht(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...P(e)});function yi(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function bi(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 p=yi(e,r),g=p.fatal??t??!0;a.addIssue({code:"custom",...p,fatal:g})}});if(!o){let u=yi(e,r),p=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:p})}}):Be.create()}var du={object:ue.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 fu=(n,e={message:`Input not instance of ${n.name}`})=>bi(t=>t instanceof n,e),Ti=Le.create,_i=Ve.create,mu=bt.create,hu=qe.create,ki=We.create,yu=ze.create,gu=gt.create,xu=Ze.create,vu=Ge.create,wu=Be.create,bu=Re.create,Tu=he.create,_u=xt.create,ku=Ie.create,Nu=ue.create,Ru=ue.strictCreate,Iu=He.create,Au=Yt.create,Eu=Je.create,Cu=ve.create,Su=Kt.create,Lu=vt.create,Bu=wt.create,Pu=Qt.create,Fu=Ye.create,Ou=Ke.create,Uu=Qe.create,ju=Xe.create,Mu=Pe.create,$u=fe.create,Du=pe.create,Vu=we.create,qu=fe.createWithPreprocess,Wu=Ut.create,zu=()=>Ti().optional(),Zu=()=>_i().optional(),Gu=()=>ki().optional(),Hu={string:(n=>Le.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>We.create({...n,coerce:!0})),bigint:(n=>qe.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var Ju=L;m();y();h();var Ni=D.strictObject({title:D.string(),content:D.string()});var kr=D.object({"base-api-exception-class-name":D.string().optional(),"base-exception-class-name":D.string().optional(),"client-class-name":D.string().optional(),"inline-file-properties":D.boolean().optional(),"inline-path-parameters":D.boolean().optional(),"package-layout":D.enum(["flat","nested"]).optional(),"package-prefix":D.string().optional(),"use-local-date-for-dates":D.boolean().optional(),"custom-dependencies":D.array(D.string()).optional(),"disable-required-property-builder-checks":D.boolean().optional(),"enable-forward-compatible-enums":D.boolean().optional(),"enable-inline-types":D.boolean().optional(),"enable-public-constructors":D.boolean().optional(),"generate-unknown-as-json-node":D.boolean().optional(),"json-include":D.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":D.boolean().optional(),"use-default-request-parameter-values":D.boolean().optional(),"enable-wire-tests":D.boolean().default(!1),"collapse-optional-nullable":D.boolean().optional(),"custom-readme-sections":D.array(Ni).optional(),"custom-pager-name":D.string().optional(),"default-timeout-in-seconds":D.number().optional(),"gradle-distribution-url":D.string().optional(),"gradle-plugin-management":D.string().optional(),"gradle-central-dependency-management":D.boolean().optional(),"wrapped-aliases":D.boolean().optional()});var d={};cr(d,{Access:()=>Nr,AstNode:()=>Z,Class:()=>nt,ClassInstantiation:()=>at,ClassReference:()=>V,CodeBlock:()=>it,Method:()=>st,MethodInvocation:()=>ot,Parameter:()=>ut,Type:()=>jt,TypeLiteral:()=>le,Writer:()=>$e,classReference:()=>gl,class_:()=>yl,codeblock:()=>hl,instantiateClass:()=>xl,invokeMethod:()=>vl,method:()=>wl,parameter:()=>bl});m();y();h();m();y();h();m();y();h();var Nr={Public:"public",Protected:"protected",Private:"private"};m();y();h();m();y();h();var Z=class extends je{async toStringAsync({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toStringAsync()}toString({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toString()}};var nt=class extends Z{constructor({name:t,access:r}){super();_(this,"name");_(this,"access");_(this,"methods",[]);this.name=t,this.access=r}write(t){if(t.write(`${this.access} class ${this.name}`),this.isEmpty()){t.writeLine(" {}");return}t.writeLine(" {"),t.indent();for(let r of this.methods)t.writeNode(r),t.newLine();t.dedent(),t.write("}")}addMethod(t){this.methods.push(t)}isEmpty(){return this.methods.length===0}};m();y();h();m();y();h();m();y();h();m();y();h();var V=class extends Z{constructor({name:t,packageName:r,fullyQualified:a}){super();_(this,"name");_(this,"packageName");_(this,"fullyQualified");this.name=t,this.packageName=r,this.fullyQualified=a??!1}write(t){if(t.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){t.write(`${this.packageName}.${this.name}`);return}t.write(this.name)}};m();y();h();var jt=class extends Z{constructor(t){super();_(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"array":t.writeNode(this.internalType.value),t.write("[]");break;case"bigInteger":t.writeNode(Yu);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.write("String");break;case"dateTime":t.writeNode(Xu);break;case"double":t.write("Double");break;case"float":t.write("Float");break;case"generic":t.writeNode(this.internalType.value),t.write("<");for(let[r,a]of this.internalType.parameters.entries())t.writeNode(a),r<this.internalType.parameters.length-1&&t.write(", ");t.write(">");break;case"inputStream":t.writeNode(rl);break;case"integer":t.write("Integer");break;case"iterable":this.writeIterable({writer:t,iterable:this.internalType});break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write("Long");break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"object":{t.write("Object");break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write("String");break;case"uuid":t.writeNode(tl);break;case"void":t.write("Void");break;default:M(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(t){return new this({type:"array",value:t})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(t){return new this({type:"list",value:t})}static long(){return new this({type:"long"})}static map(t,r){return new this({type:"map",keyType:t,valueType:r})}static object(){return new this({type:"object"})}static optional(t){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t})}static reference(t){return new this({type:"reference",value:t})}static generic(t,r){return new this({type:"generic",value:t,parameters:r})}static set(t){return new this({type:"set",value:t})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(t){return new this({type:"iterable",value:t})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:t,list:r}){t.writeNode(Ku),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(Qu),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Rr),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(nl),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(el),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Xt=new V({name:"Arrays",packageName:"java.util"}),Yu=new V({name:"BigInteger",packageName:"java.math"}),og=new V({name:"HashMap",packageName:"java.util"}),Ku=new V({name:"List",packageName:"java.util"}),Qu=new V({name:"Map",packageName:"java.util"}),Xu=new V({name:"OffsetDateTime",packageName:"java.time"}),Rr=new V({name:"Optional",packageName:"java.util"}),el=new V({name:"Set",packageName:"java.util"}),tl=new V({name:"UUID",packageName:"java.util"}),rl=new V({name:"InputStream",packageName:"java.io"}),nl=new V({name:"Iterable",packageName:"java.lang"});var le=class n extends Z{constructor(t){super();_(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:t,bigInteger:this.internalType});break;case"boolean":t.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:t,builder:this.internalType});break;case"bytes":t.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:t,class_:this.internalType});break}case"date":this.writeDate({writer:t,date:this.internalType});break;case"dateTime":this.writeDateTime({writer:t,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?t.write(`${r}.0`):t.write(r);break}case"enum":this.writeEnum({writer:t,enum_:this.internalType});break;case"float":t.write(`${this.internalType.value}f`);break;case"integer":t.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"raw":{this.internalType.value instanceof Z?t.writeNode(this.internalType.value):t.write(this.internalType.value);break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:t,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:t,uuid:this.internalType});break;case"nop":break;default:M(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(t){return new this({type:"bigInteger",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static builder({classReference:t,parameters:r}){return new this({type:"builder",classReference:t,parameters:r})}static bytes(t){return new this({type:"bytes",value:t})}static class_({reference:t,parameters:r}){return new this({type:"class",reference:t,parameters:r})}static date(t){return new this({type:"date",value:t})}static dateTime(t){return new this({type:"dateTime",value:t})}static double(t){return new this({type:"double",value:t})}static enum_({classReference:t,value:r}){return new this({type:"enum",classReference:t,value:r})}static float(t){return new this({type:"float",value:t})}static integer(t){return new this({type:"integer",value:t})}static list({valueType:t,values:r,isParameter:a}){return new this({type:"list",valueType:t,values:r,isParameter:a})}static long(t){return new this({type:"long",value:t})}static map({keyType:t,valueType:r,entries:a}){return new this({type:"map",keyType:t,valueType:r,entries:a})}static optional({value:t,useOf:r}){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t,useOf:r})}static raw(t){return new this({type:"raw",value:t})}static reference(t){return new this({type:"reference",value:t})}static set({valueType:t,values:r}){return new this({type:"set",valueType:t,values:r})}static string(t){return new this({type:"string",value:t})}static unknown(t){return new this({type:"unknown",value:t})}static uuid(t){return new this({type:"uuid",value:t})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:M(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(d.instantiateClass({classReference:al,arguments_:[n.string(r.value)]}))}writeBuilder({writer:t,builder:r}){t.writeNode(r.classReference),t.writeNewLineIfLastLineNot(),t.indent(),this.writeBuilderParameters({writer:t,parameters:this.orderBuilderParameters(cl({parameters:r.parameters}))}),t.dedent()}writeBuilderParameters({writer:t,parameters:r}){t.writeLine(".builder()");for(let a of r)t.write(`.${a.name}(`),a.value.shouldWriteInLine()||t.newLine(),t.indent(),t.writeNode(a.value),t.dedent(),a.value.shouldWriteInLine()||t.newLine(),t.writeLine(")");t.writeNewLineIfLastLineNot(),t.write(".build()")}orderBuilderParameters(t){return t.some(a=>!a.value.isOptional()&&!this.isCollection(a.value))?t.sort((a,o)=>{let u=this.isNonRequired(a.value),p=this.isNonRequired(o.value);return u&&!p?1:!u&&p?-1:0}):t.sort((a,o)=>{let u=a.value.isOptional(),p=o.value.isOptional();return u&&!p?1:!u&&p?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=ll({parameters:r.parameters});t.writeNode(d.instantiateClass({classReference:r.reference,arguments_:a.map(o=>o.value)}))}writeDate({writer:t,date:r}){t.writeNode(d.invokeMethod({on:sl,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(d.invokeMethod({on:ol,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:t,enum_:r}){t.writeNode(r.classReference),t.write("."+r.value)}writeList({writer:t,list:r}){this.writeIterable({writer:t,iterable:r})}writeMap({writer:t,map:r}){let a=pl({entries:r.entries});if(a.length===0){t.write("new "),t.writeNode(er),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(er),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.writeLine(">() {{"),t.indent();for(let o of a)t.write("put("),t.writeNode(o.key),t.write(", "),t.writeNode(o.value),t.writeLine(");");t.dedent(),t.write("}}")}writeOptional({writer:t,optional:r}){if(!r.useOf){t.writeNode(r.value);return}t.writeNode(d.invokeMethod({on:Rr,method:"of",arguments_:[r.value]}))}writeSet({writer:t,set:r}){this.writeIterable({writer:t,iterable:r})}writeIterable({writer:t,iterable:r}){let a=r.type==="list"?Ir:il,o=dl({values:r.values});if(r.type==="list"&&r.isParameter&&o.length>0){t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:o}));return}if(o.length===0){t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.writeLine(">("),t.indent(),t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:o})),t.writeNewLineIfLastLineNot(),t.dedent(),t.write(")")}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(`"${this.escapeString(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.writeUnknownMap({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("new "),t.writeNode(Ir),t.write("<Object>()");return}t.write("new "),t.writeNode(Ir),t.write("<Object>("),t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:r.map(a=>n.unknown(a))})),t.write(")")}writeUnknownMap({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("new "),t.writeNode(er),t.write("<String, Object>()");return}t.writeLine("new "),t.writeNode(er),t.write("<String, Object>() {{"),t.indent();for(let[o,u]of a)t.write(`put("${o}", `),t.writeNode(n.unknown(u)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(d.invokeMethod({on:ul,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Ir=new V({name:"ArrayList",packageName:"java.util"}),al=new V({name:"BigInteger",packageName:"java.math"}),er=new V({name:"HashMap",packageName:"java.util"}),il=new V({name:"HashSet",packageName:"java.util"}),xg=new V({name:"List",packageName:"java.util"}),sl=new V({name:"LocalDate",packageName:"java.time"}),vg=new V({name:"Map",packageName:"java.util"}),ol=new V({name:"OffsetDateTime",packageName:"java.time"}),wg=new V({name:"Set",packageName:"java.util"}),ul=new V({name:"UUID",packageName:"java.util"});function ll({parameters:n}){return n.filter(e=>!le.isNop(e.value))}function cl({parameters:n}){return n.filter(e=>!le.isNop(e.value))}function pl({entries:n}){return n.filter(e=>!le.isNop(e.key)&&!le.isNop(e.value))}function dl({values:n}){return n.filter(e=>!le.isNop(e))}function tr({writer:n,arguments_:e}){let t=ml(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof le&&!a.shouldWriteInLine())){fl({writer:n,arguments_:t});return}n.write("("),t.forEach((a,o)=>{o>0&&n.write(", "),Ri({writer:n,argument:a})}),n.write(")")}function fl({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Ri({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Ri({writer:n,argument:e}){wr(e)?n.writeNodeOrString(e.assignment):e.write(n)}function ml(n){return n.filter(e=>!(e instanceof le&&le.isNop(e)))}var at=class extends Z{constructor({classReference:t,arguments_:r}){super();_(this,"classReference");_(this,"arguments_");this.classReference=t,this.arguments_=r}write(t){t.writeNode(this.classReference),tr({writer:t,arguments_:this.arguments_})}};m();y();h();var it=class extends Z{constructor(t){super();_(this,"arg");this.arg=t}write(t){return new me(this.arg).write(t)}};m();y();h();var st=class extends Z{constructor({name:t,access:r,parameters:a,body:o,static_:u,return_:p}){super();_(this,"name");_(this,"access");_(this,"parameters");_(this,"body");_(this,"return_");_(this,"static_");this.name=t,this.access=r,this.parameters=a,this.body=o,this.return_=p,this.static_=u??!1}write(t){if(t.write(`${this.access} `),this.static_&&t.write("static "),this.return_!=null?t.writeNode(this.return_):t.write("void"),t.write(` ${this.name}`),this.parameters.length===0)t.write("()");else if(this.parameters.length===1){if(t.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);t.writeNode(this.parameters[0]),t.write(")")}else t.writeLine("("),t.indent(),this.parameters.forEach((r,a)=>{a>0&&t.writeLine(", "),t.writeNode(r)}),t.dedent(),t.write(")");if(this.body==null){t.write(";");return}t.writeLine(" {"),t.indent(),t.writeNode(this.body),t.writeNewLineIfLastLineNot(),t.dedent(),t.write("}")}};m();y();h();var ot=class extends Z{constructor({method:t,arguments_:r,on:a}){super();_(this,"on");_(this,"method");_(this,"arguments_");this.on=a,this.method=t,this.arguments_=r}write(t){this.on.write(t),t.write("."),t.write(this.method),tr({writer:t,arguments_:this.arguments_})}};m();y();h();var ut=class extends Z{constructor({name:t,type:r}){super();_(this,"name");_(this,"type");this.name=t,this.type=r}write(t){t.writeNode(this.type),t.write(` ${this.name}`)}};function hl(n){return new it(n)}function yl(n){return new nt(n)}function gl(n){return new V(n)}function xl(n){return new at(n)}function vl(n){return new ot(n)}function wl(n){return new st(n)}function bl(n){return new ut(n)}m();y();h();var rr=class{constructor({context:e}){_(this,"context");this.context=e}isNopTypeLiteral(e){return e.internalType?.type==="nop"}usesOptionalNullable(){return this.context.customConfig?.["collapse-optional-nullable"]===!0}wrapInOptionalIfNotNop(e,t=!1){return this.isNopTypeLiteral(e)?e:this.usesOptionalNullable()?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:t})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:$.Critical,message:"Expected non-null value, but got null"}),d.TypeLiteral.nop());if(e.value===void 0)return d.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,as:e.as});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,as:e.as});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?d.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion})}case"nullable":case"optional":{if(e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&e.typeReference.value.type==="named")return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(e.typeReference.value.type==="list"){let a=this.convertList({list:e.typeReference.value.value,value:e.value});return this.wrapInOptionalIfNotNop(a,!0)}if(this.usesOptionalNullable()&&(e.typeReference.value.type==="optional"||e.typeReference.value.type==="nullable"))return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion});let t=this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion}),r=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapInOptionalIfNotNop(t,r)}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,as:e.as});case"unknown":return this.convertUnknown({value:e.value});default:M(e.typeReference)}}convertList({list:e,value:t,as:r}){if(!Array.isArray(t))return this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop();let a=e.type==="optional"||e.type==="nullable";return d.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((o,u)=>{this.context.errors.scope({index:u});try{if(a){let p=this.convert({typeReference:e.value,value:o,as:r});return this.wrapInOptionalIfNotNop(p,!0)}return this.convert({typeReference:e,value:o,as:r})}finally{this.context.errors.unscope()}}),isParameter:!0})}convertLiteral({literal:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.string(r)}default:M(e)}}convertSet({set:e,value:t,as:r}){return Array.isArray(t)?d.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,as:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop())}convertMap({map:e,value:t,as:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:$.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),d.TypeLiteral.nop()):d.TypeLiteral.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(t).map(([a,o])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"mapKey"}),value:this.convert({typeReference:e.value,value:o,as:"mapValue"})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t,as:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:M(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let r=this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return d.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType;switch(o.type){case"samePropertiesAsObject":{let u=this.context.resolveNamedType({typeId:o.typeId});return u==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convertNamed({named:u,value:a.value})]}))}case"singleProperty":{let u=this.context.getRecord(a.value);if(u==null)return d.TypeLiteral.nop();try{return this.context.errors.scope(o.discriminantValue.wireValue),d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convert({typeReference:o.typeReference,value:u["value"]})]}))}finally{this.context.errors.unscope()}}case"noProperties":return d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[]}));default:M(o)}}convertObject({object_:e,value:t,as:r}){let a=this.context.associateByWireValue({parameters:e.properties,values:this.context.getRecord(t)??{}}),o=r==="request"?a.filter(u=>!this.context.isDirectLiteral(u.typeReference)):a;return d.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),parameters:o.map(u=>{this.context.errors.scope(u.name.wireValue);try{return{name:this.context.getMethodName(u.name.name),value:this.convert({typeReference:u.typeReference,value:u.value,as:r})}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:t}){let r=this.getEnumValueName({enum_:e,value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.enum_({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:r})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:$.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let r=e.values.find(a=>a.wireValue===t);if(r==null){this.context.errors.add({severity:$.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return this.context.getEnumName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return r==null?d.TypeLiteral.nop():this.context.isPrimitive(r.valueTypeReference)?d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]})):d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){let r=[],a=[];for(let p of e.types)try{r.push(JSON.stringify(p));let g=this.convert({typeReference:p,value:t,inUndiscriminatedUnion:!0});return{valueTypeReference:p,typeInstantiation:g}}catch(g){a.push(`Type ${JSON.stringify(p)}: ${g instanceof Error?g.message:String(g)}`);continue}this.context.errors.add({severity:$.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value. Tried ${r.length} variants. Errors: ${a.join("; ")}`});let o=e.declaration.name??"UnknownUnion",u=a.map((p,g)=>` ${g+1}. ${p}`).join(`
22
+ `)}};m();y();h();m();y();h();var $={};cr($,{BRAND:()=>pu,DIRTY:()=>De,EMPTY_PATH:()=>qo,INVALID:()=>L,NEVER:()=>Ju,OK:()=>te,ParseStatus:()=>X,Schema:()=>O,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>qe,ZodBoolean:()=>We,ZodBranded:()=>Ot,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>Yt,ZodEffects:()=>fe,ZodEnum:()=>Qe,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>Qt,ZodIntersection:()=>Je,ZodIssueCode:()=>b,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>vt,ZodNaN:()=>bt,ZodNativeEnum:()=>Xe,ZodNever:()=>he,ZodNull:()=>Ge,ZodNullable:()=>we,ZodNumber:()=>Ve,ZodObject:()=>ue,ZodOptional:()=>pe,ZodParsedType:()=>I,ZodPipeline:()=>Ut,ZodPromise:()=>Pe,ZodReadonly:()=>rt,ZodRecord:()=>Kt,ZodSchema:()=>O,ZodSet:()=>wt,ZodString:()=>Le,ZodSymbol:()=>gt,ZodTransformer:()=>fe,ZodTuple:()=>ve,ZodType:()=>O,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Re,ZodVoid:()=>xt,addIssueToContext:()=>R,any:()=>wu,array:()=>ku,bigint:()=>hu,boolean:()=>ki,coerce:()=>Hu,custom:()=>bi,date:()=>yu,datetimeRegex:()=>vi,defaultErrorMap:()=>ke,discriminatedUnion:()=>Eu,effect:()=>$u,enum:()=>Uu,function:()=>Pu,getErrorMap:()=>mt,getParsedType:()=>xe,instanceof:()=>fu,intersection:()=>Au,isAborted:()=>Ht,isAsync:()=>ht,isDirty:()=>Jt,isValid:()=>Ce,late:()=>du,lazy:()=>Fu,literal:()=>Ou,makeIssue:()=>Ft,map:()=>Lu,nan:()=>mu,nativeEnum:()=>ju,never:()=>Tu,null:()=>vu,nullable:()=>Vu,number:()=>_i,object:()=>Nu,objectUtil:()=>br,oboolean:()=>Gu,onumber:()=>Zu,optional:()=>Du,ostring:()=>zu,pipeline:()=>Wu,preprocess:()=>qu,promise:()=>Mu,quotelessJson:()=>$o,record:()=>Cu,set:()=>Bu,setErrorMap:()=>Vo,strictObject:()=>Ru,string:()=>Ti,symbol:()=>gu,transformer:()=>$u,tuple:()=>Su,undefined:()=>xu,union:()=>Iu,unknown:()=>bu,util:()=>j,void:()=>_u});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var j;(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(p=>typeof a[a[p]]!="number"),u={};for(let p of o)u[p]=a[p];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})(j||(j={}));var br;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(br||(br={}));var I=j.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xe=n=>{switch(typeof n){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(n)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(n)?I.array:n===null?I.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?I.promise:typeof Map<"u"&&n instanceof Map?I.map:typeof Set<"u"&&n instanceof Set?I.set:typeof Date<"u"&&n instanceof Date?I.date:I.object;default:return I.unknown}};var b=j.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"]),$o=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),oe=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(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 p=r,g=0;for(;g<u.path.length;){let w=u.path[g];g===u.path.length-1?(p[w]=p[w]||{_errors:[]},p[w]._errors.push(t(u))):p[w]=p[w]||{_errors:[]},p=p[w],g++}}};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,j.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()}};oe.create=n=>new oe(n);var Do=(n,e)=>{let t;switch(n.code){case b.invalid_type:n.received===I.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case b.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,j.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:t=`Unrecognized key(s) in object: ${j.joinValues(n.keys,", ")}`;break;case b.invalid_union:t="Invalid input";break;case b.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${j.joinValues(n.options)}`;break;case b.invalid_enum_value:t=`Invalid enum value. Expected ${j.joinValues(n.options)}, received '${n.received}'`;break;case b.invalid_arguments:t="Invalid function arguments";break;case b.invalid_return_type:t="Invalid function return type";break;case b.invalid_date:t="Invalid date";break;case b.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}"`:j.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case b.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 b.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 b.custom:t="Invalid input";break;case b.invalid_intersection_types:t="Intersection results could not be merged";break;case b.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case b.not_finite:t="Number must be finite";break;default:t=e.defaultError,j.assertNever(n)}return{message:t}},ke=Do;var mi=ke;function Vo(n){mi=n}function mt(){return mi}m();y();h();var Ft=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 p="",g=r.filter(w=>!!w).slice().reverse();for(let w of g)p=w(u,{data:e,defaultError:p}).message;return{...a,path:o,message:p}},qo=[];function R(n,e){let t=mt(),r=Ft({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===ke?void 0:ke].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 L;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 L;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}}},L=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),te=n=>({status:"valid",value:n}),Ht=n=>n.status==="aborted",Jt=n=>n.status==="dirty",Ce=n=>n.status==="valid",ht=n=>typeof Promise<"u"&&n instanceof Promise;m();y();h();m();y();h();var A;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(A||(A={}));var de=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}},hi=(n,e)=>{if(Ce(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new oe(n.common.issues);return this._error=t,this._error}}};function P(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,p)=>{let{message:g}=n;return u.code==="invalid_enum_value"?{message:g??p.defaultError}:typeof p.data>"u"?{message:g??r??p.defaultError}:u.code!=="invalid_type"?{message:p.defaultError}:{message:g??t??p.defaultError}},description:a}}var O=class{get description(){return this._def.description}_getType(e){return xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xe(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:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ht(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:xe(e)},a=this._parseSync({data:e,path:r.path,parent:r});return hi(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(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:xe(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(ht(a)?a:Promise.resolve(a));return hi(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),p=()=>o.addIssue({code:b.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(g=>g?!0:(p(),!1)):u?!0:(p(),!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 fe({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 pe.create(this,this._def)}nullable(){return we.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Pe.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 fe({...P(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...P(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Ot({typeName:B.ZodBranded,type:this,...P(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...P(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 Ut.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wo=/^c[^\s-]{8,}$/i,zo=/^[0-9a-z]+$/,Zo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Go=/^[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,Ho=/^[a-z0-9_-]{21}$/i,Jo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yo=/^[-+]?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)?)??$/,Ko=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Tr,Xo=/^(?:(?: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])$/,tu=/^(([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])$/,nu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,au=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gi="((\\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])))",iu=new RegExp(`^${gi}$`);function xi(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 su(n){return new RegExp(`^${xi(n)}$`)}function vi(n){let e=`${gi}T${xi(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 ou(n,e){return!!((e==="v4"||!e)&&Xo.test(n)||(e==="v6"||!e)&&tu.test(n))}function uu(n,e){if(!Jo.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 Le=class n extends O{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==I.string){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.string,received:o.parsedType}),L}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),R(a,{code:b.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),R(a,{code:b.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,p=e.data.length<o.value;(u||p)&&(a=this._getOrReturnCtx(e,a),u?R(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):p&&R(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Ko.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")Tr||(Tr=new RegExp(Qo,"u")),Tr.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Go.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")Ho.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")Wo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")zo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Zo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),R(a,{validation:"url",code:b.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),R(a,{validation:"regex",code:b.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),R(a,{code:b.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),R(a,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?vi(o).test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?iu.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?su(o).test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Yo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?ou(e.data,o.version)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?uu(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?lu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?nu.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?au.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):j.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:b.invalid_string,...A.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...A.errToObj(e)})}url(e){return this._addCheck({kind:"url",...A.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...A.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...A.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...A.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...A.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...A.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...A.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...A.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...A.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...A.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...A.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...A.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,...A.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,...A.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...A.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...A.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...A.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...A.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...A.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...A.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...A.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...A.errToObj(t)})}nonempty(e){return this.min(1,A.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}};Le.create=n=>new Le({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...P(n)});function cu(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 O{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)!==I.number){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.number,received:o.parsedType}),L}let r,a=new X;for(let o of this._def.checks)o.kind==="int"?j.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),R(r,{code:b.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),R(r,{code:b.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),R(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?cu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_finite,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:A.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:A.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:A.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.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"&&j.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,...P(n)});var qe=class n extends O{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)!==I.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),R(r,{code:b.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),R(r,{code:b.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),R(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return R(t,{code:b.invalid_type,expected:I.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:A.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:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.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}};qe.create=n=>new qe({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...P(n)});var We=class extends O{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==I.boolean){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.boolean,received:r.parsedType}),L}return te(e.data)}};We.create=n=>new We({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...P(n)});var ze=class n extends O{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==I.date){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:I.date,received:o.parsedType}),L}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_date}),L}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),R(a,{code:b.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),R(a,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):j.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:A.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:A.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,...P(n)});var gt=class extends O{_parse(e){if(this._getType(e)!==I.symbol){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.symbol,received:r.parsedType}),L}return te(e.data)}};gt.create=n=>new gt({typeName:B.ZodSymbol,...P(n)});var Ze=class extends O{_parse(e){if(this._getType(e)!==I.undefined){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.undefined,received:r.parsedType}),L}return te(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...P(n)});var Ge=class extends O{_parse(e){if(this._getType(e)!==I.null){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.null,received:r.parsedType}),L}return te(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...P(n)});var Be=class extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}};Be.create=n=>new Be({typeName:B.ZodAny,...P(n)});var Re=class extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}};Re.create=n=>new Re({typeName:B.ZodUnknown,...P(n)});var he=class extends O{_parse(e){let t=this._getOrReturnCtx(e);return R(t,{code:b.invalid_type,expected:I.never,received:t.parsedType}),L}};he.create=n=>new he({typeName:B.ZodNever,...P(n)});var xt=class extends O{_parse(e){if(this._getType(e)!==I.undefined){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.void,received:r.parsedType}),L}return te(e.data)}};xt.create=n=>new xt({typeName:B.ZodVoid,...P(n)});var Ie=class n extends O{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==I.array)return R(t,{code:b.invalid_type,expected:I.array,received:t.parsedType}),L;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,p=t.data.length<a.exactLength.value;(u||p)&&(R(t,{code:u?b.too_big:b.too_small,minimum:p?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&&(R(t,{code:b.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&&(R(t,{code:b.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,p)=>a.type._parseAsync(new de(t,u,t.path,p)))).then(u=>X.mergeArray(r,u));let o=[...t.data].map((u,p)=>a.type._parseSync(new de(t,u,t.path,p)));return X.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:A.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:A.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:A.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...P(e)});function yt(n){if(n instanceof ue){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=pe.create(yt(r))}return new ue({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:yt(n.element)}):n instanceof pe?pe.create(yt(n.unwrap())):n instanceof we?we.create(yt(n.unwrap())):n instanceof ve?ve.create(n.items.map(e=>yt(e))):n}var ue=class n extends O{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=j.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==I.object){let w=this._getOrReturnCtx(e);return R(w,{code:b.invalid_type,expected:I.object,received:w.parsedType}),L}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),p=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(let w in a.data)u.includes(w)||p.push(w);let g=[];for(let w of u){let E=o[w],F=a.data[w];g.push({key:{status:"valid",value:w},value:E._parse(new de(a,F,a.path,w)),alwaysSet:w in a.data})}if(this._def.catchall instanceof he){let w=this._def.unknownKeys;if(w==="passthrough")for(let E of p)g.push({key:{status:"valid",value:E},value:{status:"valid",value:a.data[E]}});else if(w==="strict")p.length>0&&(R(a,{code:b.unrecognized_keys,keys:p}),r.dirty());else if(w!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let E of p){let F=a.data[E];g.push({key:{status:"valid",value:E},value:w._parse(new de(a,F,a.path,E)),alwaysSet:E in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let w=[];for(let E of g){let F=await E.key,J=await E.value;w.push({key:F,value:J,alwaysSet:E.alwaysSet})}return w}).then(w=>X.mergeObjectSync(r,w)):X.mergeObjectSync(r,g)}get shape(){return this._def.shape()}strict(e){return A.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:A.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 j.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 j.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return yt(this)}partial(e){let t={};for(let r of j.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 j.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof pe;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return wi(j.objectKeys(this.shape))}};ue.create=(n,e)=>new ue({shape:()=>n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...P(e)});ue.strictCreate=(n,e)=>new ue({shape:()=>n,unknownKeys:"strict",catchall:he.create(),typeName:B.ZodObject,...P(e)});ue.lazycreate=(n,e)=>new ue({shape:n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...P(e)});var He=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(o){for(let p of o)if(p.result.status==="valid")return p.result;for(let p of o)if(p.result.status==="dirty")return t.common.issues.push(...p.ctx.common.issues),p.result;let u=o.map(p=>new oe(p.ctx.common.issues));return R(t,{code:b.invalid_union,unionErrors:u}),L}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 g of r){let w={...t,common:{...t.common,issues:[]},parent:null},E=g._parseSync({data:t.data,path:t.path,parent:w});if(E.status==="valid")return E;E.status==="dirty"&&!o&&(o={result:E,ctx:w}),w.common.issues.length&&u.push(w.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let p=u.map(g=>new oe(g));return R(t,{code:b.invalid_union,unionErrors:p}),L}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...P(e)});var Ne=n=>n instanceof Ye?Ne(n.schema):n instanceof fe?Ne(n.innerType()):n instanceof Ke?[n.value]:n instanceof Qe?n.options:n instanceof Xe?j.objectValues(n.enum):n instanceof et?Ne(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof pe?[void 0,...Ne(n.unwrap())]:n instanceof we?[null,...Ne(n.unwrap())]:n instanceof Ot||n instanceof rt?Ne(n.unwrap()):n instanceof tt?Ne(n._def.innerType):[],Yt=class n extends O{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.object)return R(t,{code:b.invalid_type,expected:I.object,received:t.parsedType}),L;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}):(R(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),L)}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=Ne(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 p of u){if(a.has(p))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(p)}`);a.set(p,o)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...P(r)})}};function _r(n,e){let t=xe(n),r=xe(e);if(n===e)return{valid:!0,data:n};if(t===I.object&&r===I.object){let a=j.objectKeys(e),o=j.objectKeys(n).filter(p=>a.indexOf(p)!==-1),u={...n,...e};for(let p of o){let g=_r(n[p],e[p]);if(!g.valid)return{valid:!1};u[p]=g.data}return{valid:!0,data:u}}else if(t===I.array&&r===I.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let u=n[o],p=e[o],g=_r(u,p);if(!g.valid)return{valid:!1};a.push(g.data)}return{valid:!0,data:a}}else return t===I.date&&r===I.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Je=class extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(Ht(o)||Ht(u))return L;let p=_r(o.value,u.value);return p.valid?((Jt(o)||Jt(u))&&t.dirty(),{status:t.value,value:p.data}):(R(r,{code:b.invalid_intersection_types}),L)};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,...P(t)});var ve=class n extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.array)return R(r,{code:b.invalid_type,expected:I.array,received:r.parsedType}),L;if(r.data.length<this._def.items.length)return R(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;!this._def.rest&&r.data.length>this._def.items.length&&(R(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((u,p)=>{let g=this._def.items[p]||this._def.rest;return g?g._parse(new de(r,u,r.path,p)):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})}};ve.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ve({items:n,typeName:B.ZodTuple,rest:null,...P(e)})};var Kt=class n extends O{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!==I.object)return R(r,{code:b.invalid_type,expected:I.object,received:r.parsedType}),L;let a=[],o=this._def.keyType,u=this._def.valueType;for(let p in r.data)a.push({key:o._parse(new de(r,p,r.path,p)),value:u._parse(new de(r,r.data[p],r.path,p)),alwaysSet:p 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 O?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...P(r)}):new n({keyType:Le.create(),valueType:e,typeName:B.ZodRecord,...P(t)})}},vt=class extends O{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!==I.map)return R(r,{code:b.invalid_type,expected:I.map,received:r.parsedType}),L;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([p,g],w)=>({key:a._parse(new de(r,p,r.path,[w,"key"])),value:o._parse(new de(r,g,r.path,[w,"value"]))}));if(r.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let g of u){let w=await g.key,E=await g.value;if(w.status==="aborted"||E.status==="aborted")return L;(w.status==="dirty"||E.status==="dirty")&&t.dirty(),p.set(w.value,E.value)}return{status:t.value,value:p}})}else{let p=new Map;for(let g of u){let w=g.key,E=g.value;if(w.status==="aborted"||E.status==="aborted")return L;(w.status==="dirty"||E.status==="dirty")&&t.dirty(),p.set(w.value,E.value)}return{status:t.value,value:p}}}};vt.create=(n,e,t)=>new vt({valueType:e,keyType:n,typeName:B.ZodMap,...P(t)});var wt=class n extends O{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==I.set)return R(r,{code:b.invalid_type,expected:I.set,received:r.parsedType}),L;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(R(r,{code:b.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&&(R(r,{code:b.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(g){let w=new Set;for(let E of g){if(E.status==="aborted")return L;E.status==="dirty"&&t.dirty(),w.add(E.value)}return{status:t.value,value:w}}let p=[...r.data.values()].map((g,w)=>o._parse(new de(r,g,r.path,w)));return r.common.async?Promise.all(p).then(g=>u(g)):u(p)}min(e,t){return new n({...this._def,minSize:{value:e,message:A.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:A.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};wt.create=(n,e)=>new wt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...P(e)});var Qt=class n extends O{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.function)return R(t,{code:b.invalid_type,expected:I.function,received:t.parsedType}),L;function r(p,g){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_arguments,argumentsError:g}})}function a(p,g){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_return_type,returnTypeError:g}})}let o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Pe){let p=this;return te(async function(...g){let w=new oe([]),E=await p._def.args.parseAsync(g,o).catch(S=>{throw w.addIssue(r(g,S)),w}),F=await Reflect.apply(u,this,E);return await p._def.returns._def.type.parseAsync(F,o).catch(S=>{throw w.addIssue(a(F,S)),w})})}else{let p=this;return te(function(...g){let w=p._def.args.safeParse(g,o);if(!w.success)throw new oe([r(g,w.error)]);let E=Reflect.apply(u,this,w.data),F=p._def.returns.safeParse(E,o);if(!F.success)throw new oe([a(E,F.error)]);return F.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:ve.create(e).rest(Re.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||ve.create([]).rest(Re.create()),returns:t||Re.create(),typeName:B.ZodFunction,...P(r)})}},Ye=class extends O{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,...P(e)});var Ke=class extends O{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return R(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...P(e)});function wi(n,e){return new Qe({values:n,typeName:B.ZodEnum,...P(e)})}var Qe=class n extends O{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return R(t,{expected:j.joinValues(r),received:t.parsedType,code:b.invalid_type}),L}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 R(t,{received:t.data,code:b.invalid_enum_value,options:r}),L}return te(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})}};Qe.create=wi;var Xe=class extends O{_parse(e){let t=j.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==I.string&&r.parsedType!==I.number){let a=j.objectValues(t);return R(r,{expected:j.joinValues(a),received:r.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set(j.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=j.objectValues(t);return R(r,{received:r.data,code:b.invalid_enum_value,options:a}),L}return te(e.data)}get enum(){return this._def.values}};Xe.create=(n,e)=>new Xe({values:n,typeName:B.ZodNativeEnum,...P(e)});var Pe=class extends O{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.promise&&t.common.async===!1)return R(t,{code:b.invalid_type,expected:I.promise,received:t.parsedType}),L;let r=t.parsedType===I.promise?t.data:Promise.resolve(t.data);return te(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Pe.create=(n,e)=>new Pe({type:n,typeName:B.ZodPromise,...P(e)});var fe=class extends O{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=>{R(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 p=>{if(t.value==="aborted")return L;let g=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return g.status==="aborted"?L:g.status==="dirty"?De(g.value):t.value==="dirty"?De(g.value):g});{if(t.value==="aborted")return L;let p=this._def.schema._parseSync({data:u,path:r.path,parent:r});return p.status==="aborted"?L:p.status==="dirty"?De(p.value):t.value==="dirty"?De(p.value):p}}if(a.type==="refinement"){let u=p=>{let g=a.refinement(p,o);if(r.common.async)return Promise.resolve(g);if(g instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(r.common.async===!1){let p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value),{status:t.value,value:p.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value).then(()=>({status:t.value,value:p.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 L;let p=a.transform(u.value,o);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:p}}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(p=>({status:t.value,value:p})):L);j.assertNever(a)}};fe.create=(n,e,t)=>new fe({schema:n,typeName:B.ZodEffects,effect:e,...P(t)});fe.createWithPreprocess=(n,e,t)=>new fe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...P(t)});var pe=class extends O{_parse(e){return this._getType(e)===I.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pe.create=(n,e)=>new pe({innerType:n,typeName:B.ZodOptional,...P(e)});var we=class extends O{_parse(e){return this._getType(e)===I.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.create=(n,e)=>new we({innerType:n,typeName:B.ZodNullable,...P(e)});var et=class extends O{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===I.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,...P(e)});var tt=class extends O{_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 ht(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});var bt=class extends O{_parse(e){if(this._getType(e)!==I.nan){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:I.nan,received:r.parsedType}),L}return{status:"valid",value:e.data}}};bt.create=n=>new bt({typeName:B.ZodNaN,...P(n)});var pu=Symbol("zod_brand"),Ot=class extends O{_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}},Ut=class n extends O{_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"?L: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"?L: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 O{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Ce(a)&&(a.value=Object.freeze(a.value)),a);return ht(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...P(e)});function yi(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function bi(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 p=yi(e,r),g=p.fatal??t??!0;a.addIssue({code:"custom",...p,fatal:g})}});if(!o){let u=yi(e,r),p=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:p})}}):Be.create()}var du={object:ue.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 fu=(n,e={message:`Input not instance of ${n.name}`})=>bi(t=>t instanceof n,e),Ti=Le.create,_i=Ve.create,mu=bt.create,hu=qe.create,ki=We.create,yu=ze.create,gu=gt.create,xu=Ze.create,vu=Ge.create,wu=Be.create,bu=Re.create,Tu=he.create,_u=xt.create,ku=Ie.create,Nu=ue.create,Ru=ue.strictCreate,Iu=He.create,Eu=Yt.create,Au=Je.create,Su=ve.create,Cu=Kt.create,Lu=vt.create,Bu=wt.create,Pu=Qt.create,Fu=Ye.create,Ou=Ke.create,Uu=Qe.create,ju=Xe.create,Mu=Pe.create,$u=fe.create,Du=pe.create,Vu=we.create,qu=fe.createWithPreprocess,Wu=Ut.create,zu=()=>Ti().optional(),Zu=()=>_i().optional(),Gu=()=>ki().optional(),Hu={string:(n=>Le.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>We.create({...n,coerce:!0})),bigint:(n=>qe.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var Ju=L;m();y();h();var Ni=$.strictObject({title:$.string(),content:$.string()});var kr=$.object({"base-api-exception-class-name":$.string().optional(),"base-exception-class-name":$.string().optional(),"client-class-name":$.string().optional(),"inline-file-properties":$.boolean().optional(),"inline-path-parameters":$.boolean().optional(),"package-layout":$.enum(["flat","nested"]).optional(),"package-prefix":$.string().optional(),"use-local-date-for-dates":$.boolean().optional(),"custom-dependencies":$.array($.string()).optional(),"disable-required-property-builder-checks":$.boolean().optional(),"enable-forward-compatible-enums":$.boolean().optional(),"enable-inline-types":$.boolean().optional(),"enable-public-constructors":$.boolean().optional(),"generate-unknown-as-json-node":$.boolean().optional(),"json-include":$.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":$.boolean().optional(),"use-default-request-parameter-values":$.boolean().optional(),"enable-wire-tests":$.boolean().default(!1),"collapse-optional-nullable":$.boolean().optional(),"custom-readme-sections":$.array(Ni).optional(),"custom-pager-name":$.string().optional(),"default-timeout-in-seconds":$.number().optional(),"gradle-distribution-url":$.string().optional(),"gradle-plugin-management":$.string().optional(),"gradle-central-dependency-management":$.boolean().optional(),"enable-gradle-profiling":$.boolean().optional(),"wrapped-aliases":$.boolean().optional()});var d={};cr(d,{Access:()=>Nr,AstNode:()=>Z,Class:()=>nt,ClassInstantiation:()=>at,ClassReference:()=>V,CodeBlock:()=>it,Method:()=>st,MethodInvocation:()=>ot,Parameter:()=>ut,Type:()=>jt,TypeLiteral:()=>le,Writer:()=>$e,classReference:()=>gl,class_:()=>yl,codeblock:()=>hl,instantiateClass:()=>xl,invokeMethod:()=>vl,method:()=>wl,parameter:()=>bl});m();y();h();m();y();h();m();y();h();var Nr={Public:"public",Protected:"protected",Private:"private"};m();y();h();m();y();h();var Z=class extends je{async toStringAsync({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toStringAsync()}toString({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toString()}};var nt=class extends Z{constructor({name:t,access:r}){super();_(this,"name");_(this,"access");_(this,"methods",[]);this.name=t,this.access=r}write(t){if(t.write(`${this.access} class ${this.name}`),this.isEmpty()){t.writeLine(" {}");return}t.writeLine(" {"),t.indent();for(let r of this.methods)t.writeNode(r),t.newLine();t.dedent(),t.write("}")}addMethod(t){this.methods.push(t)}isEmpty(){return this.methods.length===0}};m();y();h();m();y();h();m();y();h();m();y();h();var V=class extends Z{constructor({name:t,packageName:r,fullyQualified:a}){super();_(this,"name");_(this,"packageName");_(this,"fullyQualified");this.name=t,this.packageName=r,this.fullyQualified=a??!1}write(t){if(t.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){t.write(`${this.packageName}.${this.name}`);return}t.write(this.name)}};m();y();h();var jt=class extends Z{constructor(t){super();_(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"array":t.writeNode(this.internalType.value),t.write("[]");break;case"bigInteger":t.writeNode(Yu);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.write("String");break;case"dateTime":t.writeNode(Xu);break;case"double":t.write("Double");break;case"float":t.write("Float");break;case"generic":t.writeNode(this.internalType.value),t.write("<");for(let[r,a]of this.internalType.parameters.entries())t.writeNode(a),r<this.internalType.parameters.length-1&&t.write(", ");t.write(">");break;case"inputStream":t.writeNode(rl);break;case"integer":t.write("Integer");break;case"iterable":this.writeIterable({writer:t,iterable:this.internalType});break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write("Long");break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"object":{t.write("Object");break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write("String");break;case"uuid":t.writeNode(tl);break;case"void":t.write("Void");break;default:M(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(t){return new this({type:"array",value:t})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(t){return new this({type:"list",value:t})}static long(){return new this({type:"long"})}static map(t,r){return new this({type:"map",keyType:t,valueType:r})}static object(){return new this({type:"object"})}static optional(t){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t})}static reference(t){return new this({type:"reference",value:t})}static generic(t,r){return new this({type:"generic",value:t,parameters:r})}static set(t){return new this({type:"set",value:t})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(t){return new this({type:"iterable",value:t})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:t,list:r}){t.writeNode(Ku),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(Qu),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Rr),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(nl),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(el),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Xt=new V({name:"Arrays",packageName:"java.util"}),Yu=new V({name:"BigInteger",packageName:"java.math"}),ug=new V({name:"HashMap",packageName:"java.util"}),Ku=new V({name:"List",packageName:"java.util"}),Qu=new V({name:"Map",packageName:"java.util"}),Xu=new V({name:"OffsetDateTime",packageName:"java.time"}),Rr=new V({name:"Optional",packageName:"java.util"}),el=new V({name:"Set",packageName:"java.util"}),tl=new V({name:"UUID",packageName:"java.util"}),rl=new V({name:"InputStream",packageName:"java.io"}),nl=new V({name:"Iterable",packageName:"java.lang"});var le=class n extends Z{constructor(t){super();_(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:t,bigInteger:this.internalType});break;case"boolean":t.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:t,builder:this.internalType});break;case"bytes":t.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:t,class_:this.internalType});break}case"date":this.writeDate({writer:t,date:this.internalType});break;case"dateTime":this.writeDateTime({writer:t,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?t.write(`${r}.0`):t.write(r);break}case"enum":this.writeEnum({writer:t,enum_:this.internalType});break;case"float":t.write(`${this.internalType.value}f`);break;case"integer":t.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"raw":{this.internalType.value instanceof Z?t.writeNode(this.internalType.value):t.write(this.internalType.value);break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:t,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:t,uuid:this.internalType});break;case"nop":break;default:M(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(t){return new this({type:"bigInteger",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static builder({classReference:t,parameters:r}){return new this({type:"builder",classReference:t,parameters:r})}static bytes(t){return new this({type:"bytes",value:t})}static class_({reference:t,parameters:r}){return new this({type:"class",reference:t,parameters:r})}static date(t){return new this({type:"date",value:t})}static dateTime(t){return new this({type:"dateTime",value:t})}static double(t){return new this({type:"double",value:t})}static enum_({classReference:t,value:r}){return new this({type:"enum",classReference:t,value:r})}static float(t){return new this({type:"float",value:t})}static integer(t){return new this({type:"integer",value:t})}static list({valueType:t,values:r,isParameter:a}){return new this({type:"list",valueType:t,values:r,isParameter:a})}static long(t){return new this({type:"long",value:t})}static map({keyType:t,valueType:r,entries:a}){return new this({type:"map",keyType:t,valueType:r,entries:a})}static optional({value:t,useOf:r}){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t,useOf:r})}static raw(t){return new this({type:"raw",value:t})}static reference(t){return new this({type:"reference",value:t})}static set({valueType:t,values:r}){return new this({type:"set",valueType:t,values:r})}static string(t){return new this({type:"string",value:t})}static unknown(t){return new this({type:"unknown",value:t})}static uuid(t){return new this({type:"uuid",value:t})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:M(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(d.instantiateClass({classReference:al,arguments_:[n.string(r.value)]}))}writeBuilder({writer:t,builder:r}){t.writeNode(r.classReference),t.writeNewLineIfLastLineNot(),t.indent(),this.writeBuilderParameters({writer:t,parameters:this.orderBuilderParameters(cl({parameters:r.parameters}))}),t.dedent()}writeBuilderParameters({writer:t,parameters:r}){t.writeLine(".builder()");for(let a of r)t.write(`.${a.name}(`),a.value.shouldWriteInLine()||t.newLine(),t.indent(),t.writeNode(a.value),t.dedent(),a.value.shouldWriteInLine()||t.newLine(),t.writeLine(")");t.writeNewLineIfLastLineNot(),t.write(".build()")}orderBuilderParameters(t){return t.some(a=>!a.value.isOptional()&&!this.isCollection(a.value))?t.sort((a,o)=>{let u=this.isNonRequired(a.value),p=this.isNonRequired(o.value);return u&&!p?1:!u&&p?-1:0}):t.sort((a,o)=>{let u=a.value.isOptional(),p=o.value.isOptional();return u&&!p?1:!u&&p?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=ll({parameters:r.parameters});t.writeNode(d.instantiateClass({classReference:r.reference,arguments_:a.map(o=>o.value)}))}writeDate({writer:t,date:r}){t.writeNode(d.invokeMethod({on:sl,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(d.invokeMethod({on:ol,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:t,enum_:r}){t.writeNode(r.classReference),t.write("."+r.value)}writeList({writer:t,list:r}){this.writeIterable({writer:t,iterable:r})}writeMap({writer:t,map:r}){let a=pl({entries:r.entries});if(a.length===0){t.write("new "),t.writeNode(er),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(er),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.writeLine(">() {{"),t.indent();for(let o of a)t.write("put("),t.writeNode(o.key),t.write(", "),t.writeNode(o.value),t.writeLine(");");t.dedent(),t.write("}}")}writeOptional({writer:t,optional:r}){if(!r.useOf){t.writeNode(r.value);return}t.writeNode(d.invokeMethod({on:Rr,method:"of",arguments_:[r.value]}))}writeSet({writer:t,set:r}){this.writeIterable({writer:t,iterable:r})}writeIterable({writer:t,iterable:r}){let a=r.type==="list"?Ir:il,o=dl({values:r.values});if(r.type==="list"&&r.isParameter&&o.length>0){t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:o}));return}if(o.length===0){t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.writeLine(">("),t.indent(),t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:o})),t.writeNewLineIfLastLineNot(),t.dedent(),t.write(")")}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(`"${this.escapeString(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.writeUnknownMap({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("new "),t.writeNode(Ir),t.write("<Object>()");return}t.write("new "),t.writeNode(Ir),t.write("<Object>("),t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:r.map(a=>n.unknown(a))})),t.write(")")}writeUnknownMap({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("new "),t.writeNode(er),t.write("<String, Object>()");return}t.writeLine("new "),t.writeNode(er),t.write("<String, Object>() {{"),t.indent();for(let[o,u]of a)t.write(`put("${o}", `),t.writeNode(n.unknown(u)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(d.invokeMethod({on:ul,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Ir=new V({name:"ArrayList",packageName:"java.util"}),al=new V({name:"BigInteger",packageName:"java.math"}),er=new V({name:"HashMap",packageName:"java.util"}),il=new V({name:"HashSet",packageName:"java.util"}),vg=new V({name:"List",packageName:"java.util"}),sl=new V({name:"LocalDate",packageName:"java.time"}),wg=new V({name:"Map",packageName:"java.util"}),ol=new V({name:"OffsetDateTime",packageName:"java.time"}),bg=new V({name:"Set",packageName:"java.util"}),ul=new V({name:"UUID",packageName:"java.util"});function ll({parameters:n}){return n.filter(e=>!le.isNop(e.value))}function cl({parameters:n}){return n.filter(e=>!le.isNop(e.value))}function pl({entries:n}){return n.filter(e=>!le.isNop(e.key)&&!le.isNop(e.value))}function dl({values:n}){return n.filter(e=>!le.isNop(e))}function tr({writer:n,arguments_:e}){let t=ml(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof le&&!a.shouldWriteInLine())){fl({writer:n,arguments_:t});return}n.write("("),t.forEach((a,o)=>{o>0&&n.write(", "),Ri({writer:n,argument:a})}),n.write(")")}function fl({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Ri({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Ri({writer:n,argument:e}){wr(e)?n.writeNodeOrString(e.assignment):e.write(n)}function ml(n){return n.filter(e=>!(e instanceof le&&le.isNop(e)))}var at=class extends Z{constructor({classReference:t,arguments_:r}){super();_(this,"classReference");_(this,"arguments_");this.classReference=t,this.arguments_=r}write(t){t.writeNode(this.classReference),tr({writer:t,arguments_:this.arguments_})}};m();y();h();var it=class extends Z{constructor(t){super();_(this,"arg");this.arg=t}write(t){return new me(this.arg).write(t)}};m();y();h();var st=class extends Z{constructor({name:t,access:r,parameters:a,body:o,static_:u,return_:p}){super();_(this,"name");_(this,"access");_(this,"parameters");_(this,"body");_(this,"return_");_(this,"static_");this.name=t,this.access=r,this.parameters=a,this.body=o,this.return_=p,this.static_=u??!1}write(t){if(t.write(`${this.access} `),this.static_&&t.write("static "),this.return_!=null?t.writeNode(this.return_):t.write("void"),t.write(` ${this.name}`),this.parameters.length===0)t.write("()");else if(this.parameters.length===1){if(t.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);t.writeNode(this.parameters[0]),t.write(")")}else t.writeLine("("),t.indent(),this.parameters.forEach((r,a)=>{a>0&&t.writeLine(", "),t.writeNode(r)}),t.dedent(),t.write(")");if(this.body==null){t.write(";");return}t.writeLine(" {"),t.indent(),t.writeNode(this.body),t.writeNewLineIfLastLineNot(),t.dedent(),t.write("}")}};m();y();h();var ot=class extends Z{constructor({method:t,arguments_:r,on:a}){super();_(this,"on");_(this,"method");_(this,"arguments_");this.on=a,this.method=t,this.arguments_=r}write(t){this.on.write(t),t.write("."),t.write(this.method),tr({writer:t,arguments_:this.arguments_})}};m();y();h();var ut=class extends Z{constructor({name:t,type:r}){super();_(this,"name");_(this,"type");this.name=t,this.type=r}write(t){t.writeNode(this.type),t.write(` ${this.name}`)}};function hl(n){return new it(n)}function yl(n){return new nt(n)}function gl(n){return new V(n)}function xl(n){return new at(n)}function vl(n){return new ot(n)}function wl(n){return new st(n)}function bl(n){return new ut(n)}m();y();h();var rr=class{constructor({context:e}){_(this,"context");this.context=e}isNopTypeLiteral(e){return e.internalType?.type==="nop"}usesOptionalNullable(){return this.context.customConfig?.["collapse-optional-nullable"]===!0}wrapInOptionalIfNotNop(e,t=!1){return this.isNopTypeLiteral(e)?e:this.usesOptionalNullable()?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:t})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:D.Critical,message:"Expected non-null value, but got null"}),d.TypeLiteral.nop());if(e.value===void 0)return d.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,as:e.as});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,as:e.as});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?d.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion})}case"nullable":case"optional":{if(e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&e.typeReference.value.type==="named")return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(e.typeReference.value.type==="list"){let a=this.convertList({list:e.typeReference.value.value,value:e.value});return this.wrapInOptionalIfNotNop(a,!0)}if(this.usesOptionalNullable()&&(e.typeReference.value.type==="optional"||e.typeReference.value.type==="nullable"))return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion});let t=this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion}),r=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapInOptionalIfNotNop(t,r)}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,as:e.as});case"unknown":return this.convertUnknown({value:e.value});default:M(e.typeReference)}}convertList({list:e,value:t,as:r}){if(!Array.isArray(t))return this.context.errors.add({severity:D.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop();let a=e.type==="optional"||e.type==="nullable";return d.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((o,u)=>{this.context.errors.scope({index:u});try{if(a){let p=this.convert({typeReference:e.value,value:o,as:r});return this.wrapInOptionalIfNotNop(p,!0)}return this.convert({typeReference:e,value:o,as:r})}finally{this.context.errors.unscope()}}),isParameter:!0})}convertLiteral({literal:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.string(r)}default:M(e)}}convertSet({set:e,value:t,as:r}){return Array.isArray(t)?d.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,as:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:D.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop())}convertMap({map:e,value:t,as:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:D.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),d.TypeLiteral.nop()):d.TypeLiteral.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(t).map(([a,o])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"mapKey"}),value:this.convert({typeReference:e.value,value:o,as:"mapValue"})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t,as:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:M(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let r=this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return d.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType;switch(o.type){case"samePropertiesAsObject":{let u=this.context.resolveNamedType({typeId:o.typeId});return u==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convertNamed({named:u,value:a.value})]}))}case"singleProperty":{let u=this.context.getRecord(a.value);if(u==null)return d.TypeLiteral.nop();try{return this.context.errors.scope(o.discriminantValue.wireValue),d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convert({typeReference:o.typeReference,value:u["value"]})]}))}finally{this.context.errors.unscope()}}case"noProperties":return d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[]}));default:M(o)}}convertObject({object_:e,value:t,as:r}){let a=this.context.associateByWireValue({parameters:e.properties,values:this.context.getRecord(t)??{}}),o=r==="request"?a.filter(u=>!this.context.isDirectLiteral(u.typeReference)):a;return d.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),parameters:o.map(u=>{this.context.errors.scope(u.name.wireValue);try{return{name:this.context.getMethodName(u.name.name),value:this.convert({typeReference:u.typeReference,value:u.value,as:r})}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:t}){let r=this.getEnumValueName({enum_:e,value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.enum_({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:r})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:D.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let r=e.values.find(a=>a.wireValue===t);if(r==null){this.context.errors.add({severity:D.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return this.context.getEnumName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return r==null?d.TypeLiteral.nop():this.context.isPrimitive(r.valueTypeReference)?d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]})):d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){let r=[],a=[];for(let p of e.types)try{r.push(JSON.stringify(p));let g=this.convert({typeReference:p,value:t,inUndiscriminatedUnion:!0});return{valueTypeReference:p,typeInstantiation:g}}catch(g){a.push(`Type ${JSON.stringify(p)}: ${g instanceof Error?g.message:String(g)}`);continue}this.context.errors.add({severity:D.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value. Tried ${r.length} variants. Errors: ${a.join("; ")}`});let o=e.declaration.name??"UnknownUnion",u=a.map((p,g)=>` ${g+1}. ${p}`).join(`
23
23
  `);throw new Error(`Failed to match undiscriminated union "${o}" for ${typeof t} value.
24
24
  Value: ${JSON.stringify(t)}
25
25
  Attempted ${r.length} variants:
26
26
  ${u}
27
27
 
28
- This prevents invalid snippet code generation that would cause formatter errors.`)}getUndiscriminatedUnionFieldName({typeReference:e}){switch(e.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:e});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:e.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:e});case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t==null?void 0:this.context.getClassName(t.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"nullable":return this.getUndiscriminatedUnionFieldNameForNullable({typeReference:e});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:e.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:e});case"unknown":return"Unknown";default:M(e)}}getUndiscriminatedUnionFieldNameForList({list:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`ListOf${t}`}getUndiscriminatedUnionFieldNameForMap({map:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e.key});if(t==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:e.value});if(r!=null)return`MapOf${t}To${r}`}getUndiscriminatedUnionFieldNameForOptional({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Optional${t}`}getUndiscriminatedUnionFieldNameForNullable({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Nullable${t}`}getUndiscriminatedUnionFieldNameForSet({set:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`SetOf${t}`}getUndiscriminatedUnionFieldNameForLiteral({literal:e}){}getUndiscriminatedUnionFieldNameForPrimitive({primitive:e}){switch(e){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":return"Float";case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":return"BigInteger";case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:M(e)}}convertUnknown({value:e}){return this.context.customConfig?.["generate-unknown-as-json-node"]===!0?this.convertToJsonNode({value:e}):d.TypeLiteral.unknown(e)}convertToJsonNode({value:e}){let t=d.classReference({name:"ObjectMappers",packageName:this.context.getCorePackageName()});return typeof e=="string"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.string(e)]})):typeof e=="number"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.integer(e)]})):typeof e=="boolean"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.boolean(e)]})):e===null?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.raw(d.codeblock("null"))]})):Array.isArray(e)?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.list({valueType:d.Type.object(),values:e.map(r=>d.TypeLiteral.unknown(r)),isParameter:!0})]})):typeof e=="object"&&e!==null?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.unknown(e)]})):d.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:r}){switch(e){case"INTEGER":case"UINT":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.integer(a)}case"LONG":case"UINT_64":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.long(a)}case"FLOAT":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.float(a)}case"DOUBLE":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.double(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(a)}case"STRING":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.string(a)}case"DATE":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():this.context.customConfig?.["use-local-date-for-dates"]===!0?d.TypeLiteral.date(a):d.TypeLiteral.string(a)}case"DATE_TIME":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.dateTime(a)}case"UUID":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.uuid(a)}case"BASE_64":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.bytes(a)}case"BIG_INTEGER":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.bigInteger(a)}default:M(e)}}getValueAsNumber({value:e,as:t}){let r=t==="mapKey"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:t}){let r=t==="mapKey"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};m();y();h();var nr=class{constructor({context:e}){_(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return d.Type.list(this.convert({typeReference:e.typeReference}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return d.Type.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t})}case"optional":case"nullable":return d.Type.optional(this.convert({typeReference:e.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return d.Type.set(this.convert({typeReference:e.typeReference}));case"unknown":return this.convertUnknown();default:M(e.typeReference)}}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return d.Type.reference(d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getTypesPackageName(e.declaration.fernFilepath)}));default:M(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return d.Type.boolean();case"string":return d.Type.string()}}convertUnknown(){return this.context.customConfig?.["generate-unknown-as-json-node"]===!0?d.Type.reference(d.classReference({name:"JsonNode",packageName:"com.fasterxml.jackson.databind"})):d.Type.object()}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return d.Type.integer();case"UINT":return d.Type.integer();case"LONG":return d.Type.long();case"UINT_64":return d.Type.long();case"FLOAT":return d.Type.float();case"DOUBLE":return d.Type.double();case"BOOLEAN":return d.Type.boolean();case"STRING":return d.Type.string();case"DATE":return d.Type.date();case"DATE_TIME":return d.Type.dateTime();case"UUID":return d.Type.uuid();case"BASE_64":return d.Type.bytes();case"BIG_INTEGER":return d.Type.bigInteger();default:M(e)}}};m();y();h();var ar=class{constructor({context:e}){_(this,"context");this.context=e}getFilePropertyInfo({body:e,value:t}){let r={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(t)??{};for(let o of e.properties)switch(o.type){case"file":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getMethodName(o.name.name),value:this.getBodyProperty({property:o,record:a})});break;default:M(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.reference(this.context.getFileStreamFromString(r))}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});if(r==null)return d.TypeLiteral.nop();for(let a of r)return d.TypeLiteral.reference(this.context.getFileStreamFromString(a));return d.TypeLiteral.nop()}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?d.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var Tl=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch","getClass"]),ir=class n extends Bt{constructor({ir:t,config:r,options:a}){super({ir:t,config:r,options:a});_(this,"ir");_(this,"customConfig");_(this,"dynamicTypeMapper");_(this,"dynamicTypeLiteralMapper");_(this,"filePropertyMapper");this.ir=t,this.customConfig=kr.parse(r.customConfig??{}),this.dynamicTypeMapper=new nr({context:this}),this.dynamicTypeLiteralMapper=new rr({context:this}),this.filePropertyMapper=new ar({context:this})}clone(){return new n({ir:this.ir,config:this.config,options:this.options})}getClassName(t){return this.getName(t.pascalCase.safeName)}getEnumName(t){return this.getName(t.screamingSnakeCase.safeName)}getPropertyName(t){return this.getName(t.camelCase.safeName)}getMethodName(t){return this.getName(t.camelCase.safeName)}getRootClientClassReference(){return d.classReference({name:this.getRootClientClassName(),packageName:this.getRootPackageName()})}getRootClientClassName(){return this.customConfig?.["client-class-name"]??`${this.getBaseNamePrefix()}Client`}getEnvironmentClassName(){return"Environment"}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return d.codeblock(a=>{a.writeNode(this.getEnvironmentClassReference()),a.write("."),a.write(this.getEnumName(r))})}getEnvironmentClassReference(){return d.classReference({name:this.getEnvironmentClassName(),packageName:this.getCorePackageName()})}getJavaClassReferenceFromDeclaration({declaration:t}){return d.classReference({name:t.name.pascalCase.unsafeName,packageName:this.getTypesPackageName(t.fernFilepath)})}getNullableClassReference(){return d.classReference({name:"Nullable",packageName:this.getCorePackageName()})}getNullableOfNull(){return d.TypeLiteral.reference(d.invokeMethod({on:this.getNullableClassReference(),method:"ofNull",arguments_:[]}))}getOptionalNullableClassReference(){return d.classReference({name:"OptionalNullable",packageName:this.getCorePackageName()})}getOptionalNullableAbsent(){return d.TypeLiteral.reference(d.invokeMethod({on:this.getOptionalNullableClassReference(),method:"absent",arguments_:[]}))}getOptionalNullableOf(t){return d.TypeLiteral.reference(d.invokeMethod({on:this.getOptionalNullableClassReference(),method:"of",arguments_:[t]}))}getFileStreamFromString(t){return d.TypeLiteral.reference(d.codeblock(r=>{r.write("new "),r.writeNode(this.getFileStreamClassReference()),r.write("("),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getFileStreamClassReference(){return d.classReference({name:"FileStream",packageName:this.getCorePackageName()})}getByteArrayInputStreamClassReference(){return d.classReference({name:"ByteArrayInputStream",packageName:"java.io"})}getStandardCharsetsClassReference(){return d.classReference({name:"StandardCharsets",packageName:"java.nio.charset"})}isPrimitive(t){switch(t.type){case"primitive":return!0;case"optional":case"nullable":return this.isPrimitive(t.value);case"named":{let r=this.resolveNamedType({typeId:t.value});if(r==null)return!1;switch(r.type){case"alias":return this.isPrimitive(r.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:M(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:M(t)}}isDirectLiteral(t){return t.type==="literal"}sortTypeInstancesByRequiredFirst(t,r){let a=new Map;r.forEach((p,g)=>{a.set(p.name.wireValue,g)});let o=[],u=[];for(let p of t)this.isOptional(p.typeReference)?u.push(p):o.push(p);return o.sort((p,g)=>(a.get(p.name.wireValue)??0)-(a.get(g.name.wireValue)??0)),[...o,...u]}associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}){let o=super.associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}),u=new Map;for(let g of o)u.set(g.name.wireValue,g);let p=[];for(let g of t){let w=u.get(g.name.wireValue);w!=null&&p.push(w)}return p}getRootPackageName(){let t=this.getPackagePrefixTokens();return this.joinPackageTokens(t)}getCorePackageName(){let t=this.getPackagePrefixTokens();return t.push("core"),this.joinPackageTokens(t)}getTypesPackageName(t){return this.getResourcesPackage(t,"types")}getRequestsPackageName(t){return this.getPackageLayout()==="flat"?this.getTypesPackageName(t):this.getResourcesPackage(t,"requests")}getResourcesPackage(t,r){let a=this.getPackagePrefixTokens();switch(this.getPackageLayout()){case"flat":t!=null&&a.push(...t.packagePath.map(o=>this.getPackageNameSegment(o)));break;case"nested":default:t!=null&&t.allParts.length>0&&a.push("resources"),t!=null&&a.push(...t.allParts.map(o=>this.getPackageNameSegment(o)))}return r!=null&&a.push(r),this.joinPackageTokens(a)}getPackageName(t,r){let a=this.getPackageNameSegments(t);return a=r!=null?[...a,r]:a,[...this.getPackagePrefixTokens(),...a].join(".")}getPackageLayout(){return this.customConfig?.["package-layout"]??"nested"}shouldInlinePathParameters(){return this.customConfig?.["inline-path-parameters"]??!1}shouldInlineFileProperties(){return this.customConfig?.["inline-file-properties"]??!1}getPackageNameSegments(t){return t.packagePath.map(r=>this.getPackageNameSegment(r))}getPackageNameSegment(t){return t.camelCase.safeName.toLowerCase()}getPackagePrefixTokens(){if(this.customConfig?.["package-prefix"]!=null)return this.customConfig["package-prefix"].split(".");let t=[];return t.push("com"),t.push(...this.splitOnNonAlphaNumericChar(this.config.organization)),t.push(...this.splitOnNonAlphaNumericChar(this.getApiName())),t}getBaseNamePrefix(){return this.convertKebabCaseToUpperCamelCase(this.config.organization)+this.convertKebabCaseToUpperCamelCase(this.getApiName())}getApiName(){return yr(this.config.workspaceName)}startsWithNumber(t){return/^\d/.test(t)}splitOnNonAlphaNumericChar(t){return t.split(/[^a-zA-Z0-9]/)}convertKebabCaseToUpperCamelCase(t){return t.replace(/-([a-z])/g,(r,a)=>a.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}joinPackageTokens(t){return t.map(a=>this.startsWithNumber(a)?"_"+a:a).join(".")}getName(t){return this.isReservedName(t)?"_"+t:t}isReservedName(t){return Tl.has(t)}};m();y();h();var Ii="com.example.usage",_l="Example",kl="main",Nl="args",Ai="client",Rl={type:"primitive",value:"STRING"};function Il(n){if(n.type==="optional"&&n.value.type==="list"){let t=n.value.value;if(t.type==="optional")return{type:"optional",value:{type:"list",value:t.value}}}if(n.type==="list"){let e=n.value;if(e.type==="optional")return{type:"list",value:e.value}}return n}var sr=class{constructor({context:e,formatter:t}){_(this,"context");_(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t,options:r}){let a=this.getConfig(r);return await this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toStringAsync({packageName:a.fullStylePackageName??Ii,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t,options:r}){let a=this.getConfig(r);return this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toString({packageName:a.fullStylePackageName??Ii,customConfig:this.context.customConfig,formatter:this.formatter})}async generateSnippetAst({endpoint:e,request:t,options:r}){throw new Error("Unsupported")}buildCodeBlock({endpoint:e,snippet:t,options:r}){let a=d.codeblock(u=>{u.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),u.newLine(),u.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),o=this.getStyle(r);switch(o){case Me.Concise:return a;case Me.Full:return this.buildFullCodeBlock({body:a,options:r});default:M(o)}}constructClient({endpoint:e,snippet:t}){let r=e.auth?.type==="oauth";return d.codeblock(a=>{if(a.writeNode(this.context.getRootClientClassReference()),a.write(` ${Ai} = `),r&&t.auth?.type==="oauth"){let o=t.auth;a.writeNode(this.context.getRootClientClassReference()),a.write(`.withCredentials("${o.clientId}", "${o.clientSecret}")`),a.writeNewLineIfLastLineNot(),a.indent();let u=this.getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t});for(let p of u)a.write(`.${p.name}(`),p.value.shouldWriteInLine()||a.newLine(),a.writeNode(p.value),p.value.shouldWriteInLine()||a.newLine(),a.writeLine(")");a.writeLine(".build()"),a.dedent()}else a.writeNode(d.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:e,snippet:t})}))})}getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t}){let r=[],a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(se.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let o=new Set;if([...this.context.ir.pathParameters??[],...e.request.pathParameters??[]].forEach(p=>{p.variable!=null&&o.add(p.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let p of this.context.ir.variables)if(o.has(p.id)){let g=p.name.camelCase.unsafeName;r.push({name:g,value:d.TypeLiteral.string(`YOUR_${p.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(se.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let p=this.context.ir.pathParameters.filter(g=>g.variable==null);p.length>0&&r.push(...this.getPathParameters({namedParameters:p,snippet:t}))}return this.context.errors.unscope(),r}buildFullCodeBlock({body:e,options:t}){let r=this.getConfig(t),a=d.class_({name:r.fullStyleClassName??_l,access:d.Access.Public}),o=d.parameter({name:Nl,type:d.Type.array(d.Type.string())});return a.addMethod(d.method({name:kl,access:d.Access.Public,static_:!0,parameters:[o],body:e})),a}getRootClientBuilderArgs({endpoint:e,snippet:t}){let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getRootClientAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:$.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(se.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let o=new Set;if([...this.context.ir.pathParameters??[],...e.request.pathParameters??[]].forEach(p=>{p.variable!=null&&o.add(p.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let p of this.context.ir.variables)if(o.has(p.id)){let g=p.name.camelCase.unsafeName;r.push({name:g,value:d.TypeLiteral.string(`YOUR_${p.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(se.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let p=this.context.ir.pathParameters.filter(g=>g.variable==null);p.length>0&&r.push(...this.getPathParameters({namedParameters:p,snippet:t}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({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){if(this.context.ir.environments?.environments.type==="multipleBaseUrls"){this.context.errors.add({severity:$.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:d.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{name:"environment",value:d.TypeLiteral.reference(r)}}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?{name:"environment",value:d.TypeLiteral.reference(d.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(t).map(r=>this.context.dynamicTypeLiteralMapper.convert({typeReference:Rl,value:r}))}))}:void 0}}getRootClientAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getRootClientBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getRootClientBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getRootClientHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getRootClientOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:M(e)}}addError(e){this.context.errors.add({severity:$.Critical,message:e})}addWarning(e){this.context.errors.add({severity:$.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){return[{name:"credentials",value:d.TypeLiteral.raw(`"${t.username}", "${t.password}"`)}]}getRootClientBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.token),value:d.TypeLiteral.string(t.token)}]}getRootClientHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getRootClientOAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.clientId),value:d.TypeLiteral.string(t.clientId)},{name:this.context.getMethodName(e.clientSecret),value:d.TypeLiteral.string(t.clientSecret)}]}getRootClientHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let o=this.getRootClientHeaderArg({header:a,value:t.value});o!=null&&r.push({name:this.context.getMethodName(a.name.name),value:o})}return r}getRootClientHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!d.TypeLiteral.isNop(r))return r}callMethod({endpoint:e,snippet:t}){return d.invokeMethod({on:d.codeblock(Ai),method:this.getMethod({endpoint:e}),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:M(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(se.PathParameters);let a=(e.pathParameters??[]).filter(u=>u.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(se.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope();let o=this.getRequestOptionsArg({request:e,snippet:t});return o!=null&&r.push(o),r}usesOptionalNullable(){return this.context.customConfig?.["collapse-optional-nullable"]===!0}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":{if(e.value.type==="optional"){if(t==null)return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t,as:"request"}),a=r.toString({packageName:"com.example",customConfig:this.context.customConfig});return a.includes("Optional.empty()")||a.includes("OptionalNullable.absent()")?r:this.usesOptionalNullable()?this.context.getOptionalNullableOf(r):d.TypeLiteral.optional({value:r,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:M(e)}}getBytesBodyRequestArg({value:e}){return e==null?d.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:$.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),d.TypeLiteral.nop()):d.TypeLiteral.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[],{inlinePathParameters:a,inlineFileProperties:o}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(se.PathParameters);let u=[],p=(e.pathParameters??[]).filter(w=>w.variable==null);p.length>0&&u.push(...this.getPathParameters({namedParameters:p,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(se.RequestBody);let g=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...u.map(w=>w.value)),o||r.push(...g.fileFields.map(w=>w.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?u:[],filePropertyInfo:g})),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(se.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),g=this.context.sortTypeInstancesByRequiredFirst(u,e.queryParameters??[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Il(S.typeReference),value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.Headers);let A=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),J=this.context.sortTypeInstancesByRequiredFirst(A,e.headers??[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:S.typeReference,value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.RequestBody);let C=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)}),parameters:[...r,...J,...g,...C]})}getRequestOptionsArg({request:e,snippet:t}){let r="headers"in e?e.headers??[]:[];if(r.length===0||Object.keys(t.headers??{}).length===0)return;this.context.errors.scope(se.Headers);let a=this.context.associateByWireValue({parameters:r,values:t.headers??{}});if(this.context.errors.unscope(),a.length===0)return;let o=d.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),u=d.invokeMethod({on:o,method:"builder",arguments_:[]});for(let g of a)u=d.invokeMethod({on:u,method:"addHeader",arguments_:[d.TypeLiteral.string(g.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(g)]});let p=d.invokeMethod({on:u,method:"build",arguments_:[]});return d.TypeLiteral.reference(p)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:M(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t}){return{name:this.context.getMethodName(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,as:"request"});default:M(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t}){let a=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}}).filter(u=>!this.context.isDirectLiteral(u.typeReference));return this.context.sortTypeInstancesByRequiredFirst(a,e).map(u=>({name:this.context.getMethodName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:u.typeReference,value:u.value,as:"request"})}))}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{}});for(let o of a)r.push({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});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)}getStyle(e){return e.style??this.context.options.style??Me.Full}getConfig(e){return e.config??this.context.options.config??{}}};var Ar=class extends Ct{constructor({ir:t,config:r,options:a={}}){super(new ir({ir:t,config:r,options:a}));_(this,"formatter")}async generate(t,r={}){return super.generate(t,r)}generateSync(t,r={}){return super.generateSync(t,r)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new sr({context:t})}};export{Ar as DynamicSnippetsGenerator};
28
+ This prevents invalid snippet code generation that would cause formatter errors.`)}getUndiscriminatedUnionFieldName({typeReference:e}){switch(e.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:e});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:e.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:e});case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t==null?void 0:this.context.getClassName(t.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"nullable":return this.getUndiscriminatedUnionFieldNameForNullable({typeReference:e});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:e.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:e});case"unknown":return"Unknown";default:M(e)}}getUndiscriminatedUnionFieldNameForList({list:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`ListOf${t}`}getUndiscriminatedUnionFieldNameForMap({map:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e.key});if(t==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:e.value});if(r!=null)return`MapOf${t}To${r}`}getUndiscriminatedUnionFieldNameForOptional({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Optional${t}`}getUndiscriminatedUnionFieldNameForNullable({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Nullable${t}`}getUndiscriminatedUnionFieldNameForSet({set:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`SetOf${t}`}getUndiscriminatedUnionFieldNameForLiteral({literal:e}){}getUndiscriminatedUnionFieldNameForPrimitive({primitive:e}){switch(e){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":return"Float";case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":return"BigInteger";case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:M(e)}}convertUnknown({value:e}){return this.context.customConfig?.["generate-unknown-as-json-node"]===!0?this.convertToJsonNode({value:e}):d.TypeLiteral.unknown(e)}convertToJsonNode({value:e}){let t=d.classReference({name:"ObjectMappers",packageName:this.context.getCorePackageName()});return typeof e=="string"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.string(e)]})):typeof e=="number"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.integer(e)]})):typeof e=="boolean"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.boolean(e)]})):e===null?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.raw(d.codeblock("null"))]})):Array.isArray(e)?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.list({valueType:d.Type.object(),values:e.map(r=>d.TypeLiteral.unknown(r)),isParameter:!0})]})):typeof e=="object"&&e!==null?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.unknown(e)]})):d.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:r}){switch(e){case"INTEGER":case"UINT":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.integer(a)}case"LONG":case"UINT_64":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.long(a)}case"FLOAT":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.float(a)}case"DOUBLE":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.double(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(a)}case"STRING":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.string(a)}case"DATE":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():this.context.customConfig?.["use-local-date-for-dates"]===!0?d.TypeLiteral.date(a):d.TypeLiteral.string(a)}case"DATE_TIME":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.dateTime(a)}case"UUID":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.uuid(a)}case"BASE_64":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.bytes(a)}case"BIG_INTEGER":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.bigInteger(a)}default:M(e)}}getValueAsNumber({value:e,as:t}){let r=t==="mapKey"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:t}){let r=t==="mapKey"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};m();y();h();var nr=class{constructor({context:e}){_(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return d.Type.list(this.convert({typeReference:e.typeReference}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return d.Type.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t})}case"optional":case"nullable":return d.Type.optional(this.convert({typeReference:e.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return d.Type.set(this.convert({typeReference:e.typeReference}));case"unknown":return this.convertUnknown();default:M(e.typeReference)}}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return d.Type.reference(d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getTypesPackageName(e.declaration.fernFilepath)}));default:M(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return d.Type.boolean();case"string":return d.Type.string()}}convertUnknown(){return this.context.customConfig?.["generate-unknown-as-json-node"]===!0?d.Type.reference(d.classReference({name:"JsonNode",packageName:"com.fasterxml.jackson.databind"})):d.Type.object()}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return d.Type.integer();case"UINT":return d.Type.integer();case"LONG":return d.Type.long();case"UINT_64":return d.Type.long();case"FLOAT":return d.Type.float();case"DOUBLE":return d.Type.double();case"BOOLEAN":return d.Type.boolean();case"STRING":return d.Type.string();case"DATE":return d.Type.date();case"DATE_TIME":return d.Type.dateTime();case"UUID":return d.Type.uuid();case"BASE_64":return d.Type.bytes();case"BIG_INTEGER":return d.Type.bigInteger();default:M(e)}}};m();y();h();var ar=class{constructor({context:e}){_(this,"context");this.context=e}getFilePropertyInfo({body:e,value:t}){let r={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(t)??{};for(let o of e.properties)switch(o.type){case"file":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getMethodName(o.name.name),value:this.getBodyProperty({property:o,record:a})});break;default:M(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.reference(this.context.getFileStreamFromString(r))}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});if(r==null)return d.TypeLiteral.nop();for(let a of r)return d.TypeLiteral.reference(this.context.getFileStreamFromString(a));return d.TypeLiteral.nop()}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?d.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var Tl=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch"]),_l=new Set(["getClass","notify","notifyAll","wait"]),ir=class n extends Bt{constructor({ir:t,config:r,options:a}){super({ir:t,config:r,options:a});_(this,"ir");_(this,"customConfig");_(this,"dynamicTypeMapper");_(this,"dynamicTypeLiteralMapper");_(this,"filePropertyMapper");this.ir=t,this.customConfig=kr.parse(r.customConfig??{}),this.dynamicTypeMapper=new nr({context:this}),this.dynamicTypeLiteralMapper=new rr({context:this}),this.filePropertyMapper=new ar({context:this})}clone(){return new n({ir:this.ir,config:this.config,options:this.options})}getClassName(t){return this.getName(t.pascalCase.safeName)}getEnumName(t){return this.getName(t.screamingSnakeCase.safeName)}getPropertyName(t){return this.getName(t.camelCase.safeName)}getMethodName(t){let r=t.camelCase.safeName;return this.isReservedMethodName(r)?r+"_":this.getName(r)}getRootClientClassReference(){return d.classReference({name:this.getRootClientClassName(),packageName:this.getRootPackageName()})}getRootClientClassName(){return this.customConfig?.["client-class-name"]??`${this.getBaseNamePrefix()}Client`}getEnvironmentClassName(){return"Environment"}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return d.codeblock(a=>{a.writeNode(this.getEnvironmentClassReference()),a.write("."),a.write(this.getEnumName(r))})}getEnvironmentClassReference(){return d.classReference({name:this.getEnvironmentClassName(),packageName:this.getCorePackageName()})}getJavaClassReferenceFromDeclaration({declaration:t}){return d.classReference({name:t.name.pascalCase.unsafeName,packageName:this.getTypesPackageName(t.fernFilepath)})}getNullableClassReference(){return d.classReference({name:"Nullable",packageName:this.getCorePackageName()})}getNullableOfNull(){return d.TypeLiteral.reference(d.invokeMethod({on:this.getNullableClassReference(),method:"ofNull",arguments_:[]}))}getOptionalNullableClassReference(){return d.classReference({name:"OptionalNullable",packageName:this.getCorePackageName()})}getOptionalNullableAbsent(){return d.TypeLiteral.reference(d.invokeMethod({on:this.getOptionalNullableClassReference(),method:"absent",arguments_:[]}))}getOptionalNullableOf(t){return d.TypeLiteral.reference(d.invokeMethod({on:this.getOptionalNullableClassReference(),method:"of",arguments_:[t]}))}getFileStreamFromString(t){return d.TypeLiteral.reference(d.codeblock(r=>{r.write("new "),r.writeNode(this.getFileStreamClassReference()),r.write("("),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getFileStreamClassReference(){return d.classReference({name:"FileStream",packageName:this.getCorePackageName()})}getByteArrayInputStreamClassReference(){return d.classReference({name:"ByteArrayInputStream",packageName:"java.io"})}getStandardCharsetsClassReference(){return d.classReference({name:"StandardCharsets",packageName:"java.nio.charset"})}isPrimitive(t){switch(t.type){case"primitive":return!0;case"optional":case"nullable":return this.isPrimitive(t.value);case"named":{let r=this.resolveNamedType({typeId:t.value});if(r==null)return!1;switch(r.type){case"alias":return this.isPrimitive(r.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:M(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:M(t)}}isDirectLiteral(t){return t.type==="literal"}sortTypeInstancesByRequiredFirst(t,r){let a=new Map;r.forEach((p,g)=>{a.set(p.name.wireValue,g)});let o=[],u=[];for(let p of t)this.isOptional(p.typeReference)?u.push(p):o.push(p);return o.sort((p,g)=>(a.get(p.name.wireValue)??0)-(a.get(g.name.wireValue)??0)),[...o,...u]}associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}){let o=super.associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}),u=new Map;for(let g of o)u.set(g.name.wireValue,g);let p=[];for(let g of t){let w=u.get(g.name.wireValue);w!=null&&p.push(w)}return p}getRootPackageName(){let t=this.getPackagePrefixTokens();return this.joinPackageTokens(t)}getCorePackageName(){let t=this.getPackagePrefixTokens();return t.push("core"),this.joinPackageTokens(t)}getTypesPackageName(t){return this.getResourcesPackage(t,"types")}getRequestsPackageName(t){return this.getPackageLayout()==="flat"?this.getTypesPackageName(t):this.getResourcesPackage(t,"requests")}getResourcesPackage(t,r){let a=this.getPackagePrefixTokens();switch(this.getPackageLayout()){case"flat":t!=null&&a.push(...t.packagePath.map(o=>this.getPackageNameSegment(o)));break;case"nested":default:t!=null&&t.allParts.length>0&&a.push("resources"),t!=null&&a.push(...t.allParts.map(o=>this.getPackageNameSegment(o)))}return r!=null&&a.push(r),this.joinPackageTokens(a)}getPackageName(t,r){let a=this.getPackageNameSegments(t);return a=r!=null?[...a,r]:a,[...this.getPackagePrefixTokens(),...a].join(".")}getPackageLayout(){return this.customConfig?.["package-layout"]??"nested"}shouldInlinePathParameters(){return this.customConfig?.["inline-path-parameters"]??!1}shouldInlineFileProperties(){return this.customConfig?.["inline-file-properties"]??!1}getPackageNameSegments(t){return t.packagePath.map(r=>this.getPackageNameSegment(r))}getPackageNameSegment(t){return t.camelCase.safeName.toLowerCase()}getPackagePrefixTokens(){if(this.customConfig?.["package-prefix"]!=null)return this.customConfig["package-prefix"].split(".");let t=[];return t.push("com"),t.push(...this.splitOnNonAlphaNumericChar(this.config.organization)),t.push(...this.splitOnNonAlphaNumericChar(this.getApiName())),t}getBaseNamePrefix(){return this.convertKebabCaseToUpperCamelCase(this.config.organization)+this.convertKebabCaseToUpperCamelCase(this.getApiName())}getApiName(){return yr(this.config.workspaceName)}startsWithNumber(t){return/^\d/.test(t)}splitOnNonAlphaNumericChar(t){return t.split(/[^a-zA-Z0-9]/)}convertKebabCaseToUpperCamelCase(t){return t.replace(/-([a-z])/g,(r,a)=>a.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}joinPackageTokens(t){return t.map(a=>this.startsWithNumber(a)?"_"+a:a).join(".")}getName(t){return this.isReservedName(t)?"_"+t:t}isReservedName(t){return Tl.has(t)}isReservedMethodName(t){return _l.has(t)}};m();y();h();var Ii="com.example.usage",kl="Example",Nl="main",Rl="args",Ei="client",Il={type:"primitive",value:"STRING"};function El(n){if(n.type==="optional"&&n.value.type==="list"){let t=n.value.value;if(t.type==="optional")return{type:"optional",value:{type:"list",value:t.value}}}if(n.type==="list"){let e=n.value;if(e.type==="optional")return{type:"list",value:e.value}}return n}var sr=class{constructor({context:e,formatter:t}){_(this,"context");_(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t,options:r}){let a=this.getConfig(r);return await this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toStringAsync({packageName:a.fullStylePackageName??Ii,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t,options:r}){let a=this.getConfig(r);return this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toString({packageName:a.fullStylePackageName??Ii,customConfig:this.context.customConfig,formatter:this.formatter})}async generateSnippetAst({endpoint:e,request:t,options:r}){throw new Error("Unsupported")}buildCodeBlock({endpoint:e,snippet:t,options:r}){let a=d.codeblock(u=>{u.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),u.newLine(),u.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),o=this.getStyle(r);switch(o){case Me.Concise:return a;case Me.Full:return this.buildFullCodeBlock({body:a,options:r});default:M(o)}}constructClient({endpoint:e,snippet:t}){let r=e.auth?.type==="oauth";return d.codeblock(a=>{if(a.writeNode(this.context.getRootClientClassReference()),a.write(` ${Ei} = `),r&&t.auth?.type==="oauth"){let o=t.auth;a.writeNode(this.context.getRootClientClassReference()),a.write(`.withCredentials("${o.clientId}", "${o.clientSecret}")`),a.writeNewLineIfLastLineNot(),a.indent();let u=this.getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t});for(let p of u)a.write(`.${p.name}(`),p.value.shouldWriteInLine()||a.newLine(),a.writeNode(p.value),p.value.shouldWriteInLine()||a.newLine(),a.writeLine(")");a.writeLine(".build()"),a.dedent()}else a.writeNode(d.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:e,snippet:t})}))})}getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t}){let r=[],a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(se.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let o=new Set;if([...this.context.ir.pathParameters??[],...e.request.pathParameters??[]].forEach(p=>{p.variable!=null&&o.add(p.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let p of this.context.ir.variables)if(o.has(p.id)){let g=p.name.camelCase.unsafeName;r.push({name:g,value:d.TypeLiteral.string(`YOUR_${p.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(se.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let p=this.context.ir.pathParameters.filter(g=>g.variable==null);p.length>0&&r.push(...this.getPathParameters({namedParameters:p,snippet:t}))}return this.context.errors.unscope(),r}buildFullCodeBlock({body:e,options:t}){let r=this.getConfig(t),a=d.class_({name:r.fullStyleClassName??kl,access:d.Access.Public}),o=d.parameter({name:Rl,type:d.Type.array(d.Type.string())});return a.addMethod(d.method({name:Nl,access:d.Access.Public,static_:!0,parameters:[o],body:e})),a}getRootClientBuilderArgs({endpoint:e,snippet:t}){let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getRootClientAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:D.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(se.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let o=new Set;if([...this.context.ir.pathParameters??[],...e.request.pathParameters??[]].forEach(p=>{p.variable!=null&&o.add(p.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let p of this.context.ir.variables)if(o.has(p.id)){let g=p.name.camelCase.unsafeName;r.push({name:g,value:d.TypeLiteral.string(`YOUR_${p.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(se.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let p=this.context.ir.pathParameters.filter(g=>g.variable==null);p.length>0&&r.push(...this.getPathParameters({namedParameters:p,snippet:t}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:D.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null){if(this.context.ir.environments?.environments.type==="multipleBaseUrls"){this.context.errors.add({severity:D.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:d.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:D.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return{name:"environment",value:d.TypeLiteral.reference(r)}}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?{name:"environment",value:d.TypeLiteral.reference(d.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(t).map(r=>this.context.dynamicTypeLiteralMapper.convert({typeReference:Il,value:r}))}))}:void 0}}getRootClientAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getRootClientBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getRootClientBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getRootClientHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getRootClientOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:M(e)}}addError(e){this.context.errors.add({severity:D.Critical,message:e})}addWarning(e){this.context.errors.add({severity:D.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){return[{name:"credentials",value:d.TypeLiteral.raw(`"${t.username}", "${t.password}"`)}]}getRootClientBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.token),value:d.TypeLiteral.string(t.token)}]}getRootClientHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getRootClientOAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.clientId),value:d.TypeLiteral.string(t.clientId)},{name:this.context.getMethodName(e.clientSecret),value:d.TypeLiteral.string(t.clientSecret)}]}getRootClientHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let o=this.getRootClientHeaderArg({header:a,value:t.value});o!=null&&r.push({name:this.context.getMethodName(a.name.name),value:o})}return r}getRootClientHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!d.TypeLiteral.isNop(r))return r}callMethod({endpoint:e,snippet:t}){return d.invokeMethod({on:d.codeblock(Ei),method:this.getMethod({endpoint:e}),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:M(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(se.PathParameters);let a=(e.pathParameters??[]).filter(u=>u.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(se.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope();let o=this.getRequestOptionsArg({request:e,snippet:t});return o!=null&&r.push(o),r}usesOptionalNullable(){return this.context.customConfig?.["collapse-optional-nullable"]===!0}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":{if(e.value.type==="optional"){if(t==null)return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t,as:"request"}),a=r.toString({packageName:"com.example",customConfig:this.context.customConfig});return a.includes("Optional.empty()")||a.includes("OptionalNullable.absent()")?r:this.usesOptionalNullable()?this.context.getOptionalNullableOf(r):d.TypeLiteral.optional({value:r,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:M(e)}}getBytesBodyRequestArg({value:e}){return e==null?d.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:D.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),d.TypeLiteral.nop()):d.TypeLiteral.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[],{inlinePathParameters:a,inlineFileProperties:o}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(se.PathParameters);let u=[],p=(e.pathParameters??[]).filter(w=>w.variable==null);p.length>0&&u.push(...this.getPathParameters({namedParameters:p,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(se.RequestBody);let g=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...u.map(w=>w.value)),o||r.push(...g.fileFields.map(w=>w.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?u:[],filePropertyInfo:g})),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(se.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).filter(C=>!this.context.isDirectLiteral(C.typeReference)),g=this.context.sortTypeInstancesByRequiredFirst(u,e.queryParameters??[]).map(C=>({name:this.context.getMethodName(C.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:El(C.typeReference),value:C.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.Headers);let E=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).filter(C=>!this.context.isDirectLiteral(C.typeReference)),J=this.context.sortTypeInstancesByRequiredFirst(E,e.headers??[]).map(C=>({name:this.context.getMethodName(C.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:C.typeReference,value:C.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.RequestBody);let S=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)}),parameters:[...r,...J,...g,...S]})}getRequestOptionsArg({request:e,snippet:t}){let r="headers"in e?e.headers??[]:[];if(r.length===0||Object.keys(t.headers??{}).length===0)return;this.context.errors.scope(se.Headers);let a=this.context.associateByWireValue({parameters:r,values:t.headers??{}});if(this.context.errors.unscope(),a.length===0)return;let o=d.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),u=d.invokeMethod({on:o,method:"builder",arguments_:[]});for(let g of a)u=d.invokeMethod({on:u,method:"addHeader",arguments_:[d.TypeLiteral.string(g.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(g)]});let p=d.invokeMethod({on:u,method:"build",arguments_:[]});return d.TypeLiteral.reference(p)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:M(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t}){return{name:this.context.getMethodName(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,as:"request"});default:M(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t}){let a=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}}).filter(u=>!this.context.isDirectLiteral(u.typeReference));return this.context.sortTypeInstancesByRequiredFirst(a,e).map(u=>({name:this.context.getMethodName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:u.typeReference,value:u.value,as:"request"})}))}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{}});for(let o of a)r.push({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});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)}getStyle(e){return e.style??this.context.options.style??Me.Full}getConfig(e){return e.config??this.context.options.config??{}}};var Er=class extends St{constructor({ir:t,config:r,options:a={}}){super(new ir({ir:t,config:r,options:a}));_(this,"formatter")}async generate(t,r={}){return super.generate(t,r)}generateSync(t,r={}){return super.generateSync(t,r)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new sr({context:t})}};export{Er as DynamicSnippetsGenerator};
29
29
  /*! Bundled license information:
30
30
 
31
31
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js: