@fern-api/java-dynamic-snippets 4.10.8 → 4.10.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var $t=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var Ki=Object.getOwnPropertyNames;var Qi=Object.prototype.hasOwnProperty;var Xi=(n,e,t)=>e in n?$t(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pt=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var Vt=(n,e)=>{for(var t in e)$t(n,t,{get:e[t],enumerable:!0})},es=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ki(e))!Qi.call(n,a)&&a!==t&&$t(n,a,{get:()=>e[a],enumerable:!(r=Yi(e,a))||r.enumerable});return n};var ts=n=>es($t({},"__esModule",{value:!0}),n);var _=(n,e,t)=>Xi(n,typeof e!="symbol"?e+"":e,t);var m=pt(()=>{"use strict"});var T={};Vt(T,{_debugEnd:()=>Ln,_debugProcess:()=>Sn,_events:()=>Jn,_eventsCount:()=>Hn,_exiting:()=>dn,_fatalExceptions:()=>In,_getActiveHandles:()=>yn,_getActiveRequests:()=>hn,_kill:()=>xn,_linkedBinding:()=>cn,_maxListeners:()=>Gn,_preload_modules:()=>Wn,_rawDebug:()=>ln,_startProfilerIdleNotifier:()=>Bn,_stopProfilerIdleNotifier:()=>Pn,_tickCallback:()=>An,abort:()=>Un,addListener:()=>Yn,allowedNodeEnvironmentFlags:()=>_n,arch:()=>Gr,argv:()=>Yr,argv0:()=>qn,assert:()=>kn,binding:()=>tn,browser:()=>on,chdir:()=>an,config:()=>fn,cpuUsage:()=>Wt,cwd:()=>nn,debugPort:()=>Dn,default:()=>ia,dlopen:()=>mn,domain:()=>pn,emit:()=>ta,emitWarning:()=>en,env:()=>Hr,execArgv:()=>Kr,execPath:()=>Vn,exit:()=>Tn,features:()=>Nn,hasUncaughtExceptionCaptureCallback:()=>En,hrtime:()=>qt,kill:()=>bn,listeners:()=>aa,memoryUsage:()=>wn,moduleLoadList:()=>un,nextTick:()=>Wr,off:()=>Qn,on:()=>Te,once:()=>Kn,openStdin:()=>Rn,pid:()=>Mn,platform:()=>Jr,ppid:()=>$n,prependListener:()=>ra,prependOnceListener:()=>na,reallyExit:()=>gn,release:()=>sn,removeAllListeners:()=>ea,removeListener:()=>Xn,resourceUsage:()=>vn,setSourceMapsEnabled:()=>zn,setUncaughtExceptionCaptureCallback:()=>Cn,stderr:()=>On,stdin:()=>jn,stdout:()=>Fn,title:()=>Zr,umask:()=>rn,uptime:()=>Zn,version:()=>Qr,versions:()=>Xr});function hr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function rs(){!dt||!Fe||(dt=!1,Fe.length?be=Fe.concat(be):Dt=-1,be.length&&qr())}function qr(){if(!dt){var n=setTimeout(rs,0);dt=!0;for(var e=be.length;e;){for(Fe=be,be=[];++Dt<e;)Fe&&Fe[Dt].run();Dt=-1,e=be.length}Fe=null,dt=!1,clearTimeout(n)}}function Wr(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 zr(n,e)),be.length===1&&!dt&&setTimeout(qr,0)}function zr(n,e){this.fun=n,this.array=e}function te(){}function cn(n){hr("_linkedBinding")}function mn(n){hr("dlopen")}function hn(){return[]}function yn(){return[]}function kn(n,e){if(!n)throw new Error(e||"assertion error")}function En(){return!1}function Zn(){return Ee.now()/1e3}function qt(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+=mr)),[r,a]}function Te(){return ia}function aa(n){return[]}var be,dt,Fe,Dt,Zr,Gr,Jr,Hr,Yr,Kr,Qr,Xr,en,tn,rn,nn,an,sn,on,ln,un,pn,dn,fn,gn,xn,Wt,vn,wn,bn,Tn,Rn,_n,Nn,In,Cn,An,Sn,Ln,Bn,Pn,Fn,On,jn,Un,Mn,$n,Vn,Dn,qn,Wn,zn,Ee,fr,mr,Gn,Jn,Hn,Yn,Kn,Qn,Xn,ea,ta,ra,na,ia,sa=pt(()=>{"use strict";m();y();h();be=[],dt=!1,Dt=-1;zr.prototype.run=function(){this.fun.apply(null,this.array)};Zr="browser",Gr="x64",Jr="browser",Hr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Yr=["/usr/bin/node"],Kr=[],Qr="v16.8.0",Xr={},en=function(n,e){console.warn((e?e+": ":"")+n)},tn=function(n){hr("binding")},rn=function(n){return 0},nn=function(){return"/"},an=function(n){},sn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};on=!0,ln=te,un=[];pn={},dn=!1,fn={};gn=te,xn=te,Wt=function(){return{}},vn=Wt,wn=Wt,bn=te,Tn=te,Rn=te,_n={};Nn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},In=te,Cn=te;An=te,Sn=te,Ln=te,Bn=te,Pn=te,Fn=void 0,On=void 0,jn=void 0,Un=te,Mn=2,$n=1,Vn="/bin/usr/node",Dn=9229,qn="node",Wn=[],zn=te,Ee={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Ee.now===void 0&&(fr=Date.now(),Ee.timing&&Ee.timing.navigationStart&&(fr=Ee.timing.navigationStart),Ee.now=()=>Date.now()-fr);mr=1e9;qt.bigint=function(n){var e=qt(n);return typeof BigInt>"u"?e[0]*mr+e[1]:BigInt(e[0]*mr)+BigInt(e[1])};Gn=10,Jn={},Hn=0;Yn=Te,Kn=Te,Qn=Te,Xn=Te,ea=Te,ta=te,ra=Te,na=Te;ia={version:Qr,versions:Xr,arch:Gr,platform:Jr,browser:on,release:sn,_rawDebug:ln,moduleLoadList:un,binding:tn,_linkedBinding:cn,_events:Jn,_eventsCount:Hn,_maxListeners:Gn,on:Te,addListener:Yn,once:Kn,off:Qn,removeListener:Xn,removeAllListeners:ea,emit:ta,prependListener:ra,prependOnceListener:na,listeners:aa,domain:pn,_exiting:dn,config:fn,dlopen:mn,uptime:Zn,_getActiveRequests:hn,_getActiveHandles:yn,reallyExit:gn,_kill:xn,cpuUsage:Wt,resourceUsage:vn,memoryUsage:wn,kill:bn,exit:Tn,openStdin:Rn,allowedNodeEnvironmentFlags:_n,assert:kn,features:Nn,_fatalExceptions:In,setUncaughtExceptionCaptureCallback:Cn,hasUncaughtExceptionCaptureCallback:En,emitWarning:en,nextTick:Wr,_tickCallback:An,_debugProcess:Sn,_debugEnd:Ln,_startProfilerIdleNotifier:Bn,_stopProfilerIdleNotifier:Pn,stdout:Fn,stdin:jn,stderr:On,abort:Un,umask:rn,chdir:an,cwd:nn,env:Hr,title:Zr,argv:Yr,execArgv:Kr,pid:Mn,ppid:$n,execPath:Vn,debugPort:Dn,hrtime:qt,argv0:qn,_preload_modules:Wn,setSourceMapsEnabled:zn}});var h=pt(()=>{"use strict";sa()});function ns(){if(oa)return Rt;oa=!0,Rt.byteLength=p,Rt.toByteArray=v,Rt.fromByteArray=G;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 l(A){var O=A.length;if(O%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var j=A.indexOf("=");j===-1&&(j=O);var L=j===O?0:4-j%4;return[j,L]}function p(A){var O=l(A),j=O[0],L=O[1];return(j+L)*3/4-L}function g(A,O,j){return(O+j)*3/4-j}function v(A){var O,j=l(A),L=j[0],z=j[1],H=new t(g(A,L,z)),ae=0,ce=z>0?L-4:L,ne;for(ne=0;ne<ce;ne+=4)O=e[A.charCodeAt(ne)]<<18|e[A.charCodeAt(ne+1)]<<12|e[A.charCodeAt(ne+2)]<<6|e[A.charCodeAt(ne+3)],H[ae++]=O>>16&255,H[ae++]=O>>8&255,H[ae++]=O&255;return z===2&&(O=e[A.charCodeAt(ne)]<<2|e[A.charCodeAt(ne+1)]>>4,H[ae++]=O&255),z===1&&(O=e[A.charCodeAt(ne)]<<10|e[A.charCodeAt(ne+1)]<<4|e[A.charCodeAt(ne+2)]>>2,H[ae++]=O>>8&255,H[ae++]=O&255),H}function N(A){return n[A>>18&63]+n[A>>12&63]+n[A>>6&63]+n[A&63]}function P(A,O,j){for(var L,z=[],H=O;H<j;H+=3)L=(A[H]<<16&16711680)+(A[H+1]<<8&65280)+(A[H+2]&255),z.push(N(L));return z.join("")}function G(A){for(var O,j=A.length,L=j%3,z=[],H=16383,ae=0,ce=j-L;ae<ce;ae+=H)z.push(P(A,ae,ae+H>ce?ce:ae+H));return L===1?(O=A[j-1],z.push(n[O>>2]+n[O<<4&63]+"==")):L===2&&(O=(A[j-2]<<8)+A[j-1],z.push(n[O>>10]+n[O>>4&63]+n[O<<2&63]+"=")),z.join("")}return Rt}function as(){if(la)return zt;la=!0;return zt.read=function(n,e,t,r,a){var o,l,p=a*8-r-1,g=(1<<p)-1,v=g>>1,N=-7,P=t?a-1:0,G=t?-1:1,A=n[e+P];for(P+=G,o=A&(1<<-N)-1,A>>=-N,N+=p;N>0;o=o*256+n[e+P],P+=G,N-=8);for(l=o&(1<<-N)-1,o>>=-N,N+=r;N>0;l=l*256+n[e+P],P+=G,N-=8);if(o===0)o=1-v;else{if(o===g)return l?NaN:(A?-1:1)*(1/0);l=l+Math.pow(2,r),o=o-v}return(A?-1:1)*l*Math.pow(2,o-r)},zt.write=function(n,e,t,r,a,o){var l,p,g,v=o*8-a-1,N=(1<<v)-1,P=N>>1,G=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=r?0:o-1,O=r?1:-1,j=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,l=N):(l=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-l))<1&&(l--,g*=2),l+P>=1?e+=G/g:e+=G*Math.pow(2,1-P),e*g>=2&&(l++,g/=2),l+P>=N?(p=0,l=N):l+P>=1?(p=(e*g-1)*Math.pow(2,a),l=l+P):(p=e*Math.pow(2,P-1)*Math.pow(2,a),l=0));a>=8;n[t+A]=p&255,A+=O,p/=256,a-=8);for(l=l<<a|p,v+=a;v>0;n[t+A]=l&255,A+=O,l/=256,v-=8);n[t+A-O]|=j*128},zt}function ca(){if(ua)return Oe;ua=!0;let n=ns(),e=as(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Oe.Buffer=l,Oe.SlowBuffer=z,Oe.INSPECT_MAX_BYTES=50;let r=2147483647;Oe.kMaxLength=r,l.TYPED_ARRAY_SUPPORT=a(),!l.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 u=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(u,i),u.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function o(u){if(u>r)throw new RangeError('The value "'+u+'" is invalid for option "size"');let i=new Uint8Array(u);return Object.setPrototypeOf(i,l.prototype),i}function l(u,i,s){if(typeof u=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return N(u)}return p(u,i,s)}l.poolSize=8192;function p(u,i,s){if(typeof u=="string")return P(u,i);if(ArrayBuffer.isView(u))return A(u);if(u==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u);if(ye(u,ArrayBuffer)||u&&ye(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(u,SharedArrayBuffer)||u&&ye(u.buffer,SharedArrayBuffer)))return O(u,i,s);if(typeof u=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=u.valueOf&&u.valueOf();if(c!=null&&c!==u)return l.from(c,i,s);let f=j(u);if(f)return f;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof u[Symbol.toPrimitive]=="function")return l.from(u[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 u)}l.from=function(u,i,s){return p(u,i,s)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function g(u){if(typeof u!="number")throw new TypeError('"size" argument must be of type number');if(u<0)throw new RangeError('The value "'+u+'" is invalid for option "size"')}function v(u,i,s){return g(u),u<=0?o(u):i!==void 0?typeof s=="string"?o(u).fill(i,s):o(u).fill(i):o(u)}l.alloc=function(u,i,s){return v(u,i,s)};function N(u){return g(u),o(u<0?0:L(u)|0)}l.allocUnsafe=function(u){return N(u)},l.allocUnsafeSlow=function(u){return N(u)};function P(u,i){if((typeof i!="string"||i==="")&&(i="utf8"),!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=H(u,i)|0,c=o(s),f=c.write(u,i);return f!==s&&(c=c.slice(0,f)),c}function G(u){let i=u.length<0?0:L(u.length)|0,s=o(i);for(let c=0;c<i;c+=1)s[c]=u[c]&255;return s}function A(u){if(ye(u,Uint8Array)){let i=new Uint8Array(u);return O(i.buffer,i.byteOffset,i.byteLength)}return G(u)}function O(u,i,s){if(i<0||u.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(u.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(u):s===void 0?c=new Uint8Array(u,i):c=new Uint8Array(u,i,s),Object.setPrototypeOf(c,l.prototype),c}function j(u){if(l.isBuffer(u)){let i=L(u.length)|0,s=o(i);return s.length===0||u.copy(s,0,0,i),s}if(u.length!==void 0)return typeof u.length!="number"||dr(u.length)?o(0):G(u);if(u.type==="Buffer"&&Array.isArray(u.data))return G(u.data)}function L(u){if(u>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return u|0}function z(u){return+u!=u&&(u=0),l.alloc(+u)}l.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==l.prototype},l.compare=function(i,s){if(ye(i,Uint8Array)&&(i=l.from(i,i.offset,i.byteLength)),ye(s,Uint8Array)&&(s=l.from(s,s.offset,s.byteLength)),!l.isBuffer(i)||!l.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,w=Math.min(c,f);x<w;++x)if(i[x]!==s[x]){c=i[x],f=s[x];break}return c<f?-1:f<c?1:0},l.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}},l.concat=function(i,s){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return l.alloc(0);let c;if(s===void 0)for(s=0,c=0;c<i.length;++c)s+=i[c].length;let f=l.allocUnsafe(s),x=0;for(c=0;c<i.length;++c){let w=i[c];if(ye(w,Uint8Array))x+w.length>f.length?(l.isBuffer(w)||(w=l.from(w)),w.copy(f,x)):Uint8Array.prototype.set.call(f,w,x);else if(l.isBuffer(w))w.copy(f,x);else throw new TypeError('"list" argument must be an Array of Buffers');x+=w.length}return f};function H(u,i){if(l.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||ye(u,ArrayBuffer))return u.byteLength;if(typeof u!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof u);let s=u.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 pr(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return Dr(u).length;default:if(f)return c?-1:pr(u).length;i=(""+i).toLowerCase(),f=!0}}l.byteLength=H;function ae(u,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(u||(u="utf8");;)switch(u){case"hex":return Vi(this,i,s);case"utf8":case"utf-8":return Br(this,i,s);case"ascii":return Mi(this,i,s);case"latin1":case"binary":return $i(this,i,s);case"base64":return ji(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Di(this,i,s);default:if(c)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),c=!0}}l.prototype._isBuffer=!0;function ce(u,i,s){let c=u[i];u[i]=u[s],u[s]=c}l.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},l.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},l.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},l.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Br(this,0,i):ae.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(i){if(!l.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:l.compare(this,i)===0},l.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&&(l.prototype[t]=l.prototype.inspect),l.prototype.compare=function(i,s,c,f,x){if(ye(i,Uint8Array)&&(i=l.from(i,i.offset,i.byteLength)),!l.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 w=x-f,V=c-s,K=Math.min(w,V),J=this.slice(f,x),Q=i.slice(s,c);for(let Z=0;Z<K;++Z)if(J[Z]!==Q[Z]){w=J[Z],V=Q[Z];break}return w<V?-1:V<w?1:0};function ne(u,i,s,c,f){if(u.length===0)return-1;if(typeof s=="string"?(c=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,dr(s)&&(s=f?0:u.length-1),s<0&&(s=u.length+s),s>=u.length){if(f)return-1;s=u.length-1}else if(s<0)if(f)s=0;else return-1;if(typeof i=="string"&&(i=l.from(i,c)),l.isBuffer(i))return i.length===0?-1:Lr(u,i,s,c,f);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(u,i,s):Uint8Array.prototype.lastIndexOf.call(u,i,s):Lr(u,[i],s,c,f);throw new TypeError("val must be string, number or Buffer")}function Lr(u,i,s,c,f){let x=1,w=u.length,V=i.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(u.length<2||i.length<2)return-1;x=2,w/=2,V/=2,s/=2}function K(Q,Z){return x===1?Q[Z]:Q.readUInt16BE(Z*x)}let J;if(f){let Q=-1;for(J=s;J<w;J++)if(K(u,J)===K(i,Q===-1?0:J-Q)){if(Q===-1&&(Q=J),J-Q+1===V)return Q*x}else Q!==-1&&(J-=J-Q),Q=-1}else for(s+V>w&&(s=w-V),J=s;J>=0;J--){let Q=!0;for(let Z=0;Z<V;Z++)if(K(u,J+Z)!==K(i,Z)){Q=!1;break}if(Q)return J}return-1}l.prototype.includes=function(i,s,c){return this.indexOf(i,s,c)!==-1},l.prototype.indexOf=function(i,s,c){return ne(this,i,s,c,!0)},l.prototype.lastIndexOf=function(i,s,c){return ne(this,i,s,c,!1)};function Li(u,i,s,c){s=Number(s)||0;let f=u.length-s;c?(c=Number(c),c>f&&(c=f)):c=f;let x=i.length;c>x/2&&(c=x/2);let w;for(w=0;w<c;++w){let V=parseInt(i.substr(w*2,2),16);if(dr(V))return w;u[s+w]=V}return w}function Bi(u,i,s,c){return Mt(pr(i,u.length-s),u,s,c)}function Pi(u,i,s,c){return Mt(Zi(i),u,s,c)}function Fi(u,i,s,c){return Mt(Dr(i),u,s,c)}function Oi(u,i,s,c){return Mt(Gi(i,u.length-s),u,s,c)}l.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 w=!1;for(;;)switch(f){case"hex":return Li(this,i,s,c);case"utf8":case"utf-8":return Bi(this,i,s,c);case"ascii":case"latin1":case"binary":return Pi(this,i,s,c);case"base64":return Fi(this,i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oi(this,i,s,c);default:if(w)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),w=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ji(u,i,s){return i===0&&s===u.length?n.fromByteArray(u):n.fromByteArray(u.slice(i,s))}function Br(u,i,s){s=Math.min(u.length,s);let c=[],f=i;for(;f<s;){let x=u[f],w=null,V=x>239?4:x>223?3:x>191?2:1;if(f+V<=s){let K,J,Q,Z;switch(V){case 1:x<128&&(w=x);break;case 2:K=u[f+1],(K&192)===128&&(Z=(x&31)<<6|K&63,Z>127&&(w=Z));break;case 3:K=u[f+1],J=u[f+2],(K&192)===128&&(J&192)===128&&(Z=(x&15)<<12|(K&63)<<6|J&63,Z>2047&&(Z<55296||Z>57343)&&(w=Z));break;case 4:K=u[f+1],J=u[f+2],Q=u[f+3],(K&192)===128&&(J&192)===128&&(Q&192)===128&&(Z=(x&15)<<18|(K&63)<<12|(J&63)<<6|Q&63,Z>65535&&Z<1114112&&(w=Z))}}w===null?(w=65533,V=1):w>65535&&(w-=65536,c.push(w>>>10&1023|55296),w=56320|w&1023),c.push(w),f+=V}return Ui(c)}let Pr=4096;function Ui(u){let i=u.length;if(i<=Pr)return String.fromCharCode.apply(String,u);let s="",c=0;for(;c<i;)s+=String.fromCharCode.apply(String,u.slice(c,c+=Pr));return s}function Mi(u,i,s){let c="";s=Math.min(u.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(u[f]&127);return c}function $i(u,i,s){let c="";s=Math.min(u.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(u[f]);return c}function Vi(u,i,s){let c=u.length;(!i||i<0)&&(i=0),(!s||s<0||s>c)&&(s=c);let f="";for(let x=i;x<s;++x)f+=Ji[u[x]];return f}function Di(u,i,s){let c=u.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}l.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,l.prototype),f};function X(u,i,s){if(u%1!==0||u<0)throw new RangeError("offset is not uint");if(u+i>s)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i],x=1,w=0;for(;++w<s&&(x*=256);)f+=this[i+w]*x;return f},l.prototype.readUintBE=l.prototype.readUIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i+--s],x=1;for(;s>0&&(x*=256);)f+=this[i+--s]*x;return f},l.prototype.readUint8=l.prototype.readUInt8=function(i,s){return i=i>>>0,s||X(i,1,this.length),this[i]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||X(i,2,this.length),this[i]|this[i+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||X(i,2,this.length),this[i]<<8|this[i+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||X(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},l.prototype.readBigUInt64LE=Ce(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))}),l.prototype.readBigUInt64BE=Ce(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)}),l.prototype.readIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i],x=1,w=0;for(;++w<s&&(x*=256);)f+=this[i+w]*x;return x*=128,f>=x&&(f-=Math.pow(2,8*s)),f},l.prototype.readIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=s,x=1,w=this[i+--f];for(;f>0&&(x*=256);)w+=this[i+--f]*x;return x*=128,w>=x&&(w-=Math.pow(2,8*s)),w},l.prototype.readInt8=function(i,s){return i=i>>>0,s||X(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},l.prototype.readInt16LE=function(i,s){i=i>>>0,s||X(i,2,this.length);let c=this[i]|this[i+1]<<8;return c&32768?c|4294901760:c},l.prototype.readInt16BE=function(i,s){i=i>>>0,s||X(i,2,this.length);let c=this[i+1]|this[i]<<8;return c&32768?c|4294901760:c},l.prototype.readInt32LE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},l.prototype.readInt32BE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},l.prototype.readBigInt64LE=Ce(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)}),l.prototype.readBigInt64BE=Ce(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)}),l.prototype.readFloatLE=function(i,s){return i=i>>>0,s||X(i,4,this.length),e.read(this,i,!0,23,4)},l.prototype.readFloatBE=function(i,s){return i=i>>>0,s||X(i,4,this.length),e.read(this,i,!1,23,4)},l.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||X(i,8,this.length),e.read(this,i,!0,52,8)},l.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||X(i,8,this.length),e.read(this,i,!1,52,8)};function ie(u,i,s,c,f,x){if(!l.isBuffer(u))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>u.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let V=Math.pow(2,8*c)-1;ie(this,i,s,c,V,0)}let x=1,w=0;for(this[s]=i&255;++w<c&&(x*=256);)this[s+w]=i/x&255;return s+c},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let V=Math.pow(2,8*c)-1;ie(this,i,s,c,V,0)}let x=c-1,w=1;for(this[s+x]=i&255;--x>=0&&(w*=256);)this[s+x]=i/w&255;return s+c},l.prototype.writeUint8=l.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},l.prototype.writeUint16LE=l.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},l.prototype.writeUint16BE=l.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},l.prototype.writeUint32LE=l.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},l.prototype.writeUint32BE=l.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 Fr(u,i,s,c,f){Vr(i,c,f,u,s,7);let x=Number(i&BigInt(4294967295));u[s++]=x,x=x>>8,u[s++]=x,x=x>>8,u[s++]=x,x=x>>8,u[s++]=x;let w=Number(i>>BigInt(32)&BigInt(4294967295));return u[s++]=w,w=w>>8,u[s++]=w,w=w>>8,u[s++]=w,w=w>>8,u[s++]=w,s}function Or(u,i,s,c,f){Vr(i,c,f,u,s,7);let x=Number(i&BigInt(4294967295));u[s+7]=x,x=x>>8,u[s+6]=x,x=x>>8,u[s+5]=x,x=x>>8,u[s+4]=x;let w=Number(i>>BigInt(32)&BigInt(4294967295));return u[s+3]=w,w=w>>8,u[s+2]=w,w=w>>8,u[s+1]=w,w=w>>8,u[s]=w,s+8}l.prototype.writeBigUInt64LE=Ce(function(i,s=0){return Fr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Ce(function(i,s=0){return Or(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let K=Math.pow(2,8*c-1);ie(this,i,s,c,K-1,-K)}let x=0,w=1,V=0;for(this[s]=i&255;++x<c&&(w*=256);)i<0&&V===0&&this[s+x-1]!==0&&(V=1),this[s+x]=(i/w>>0)-V&255;return s+c},l.prototype.writeIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let K=Math.pow(2,8*c-1);ie(this,i,s,c,K-1,-K)}let x=c-1,w=1,V=0;for(this[s+x]=i&255;--x>=0&&(w*=256);)i<0&&V===0&&this[s+x+1]!==0&&(V=1),this[s+x]=(i/w>>0)-V&255;return s+c},l.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},l.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},l.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},l.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},l.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},l.prototype.writeBigInt64LE=Ce(function(i,s=0){return Fr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Ce(function(i,s=0){return Or(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function jr(u,i,s,c,f,x){if(s+c>u.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Ur(u,i,s,c,f){return i=+i,s=s>>>0,f||jr(u,i,s,4),e.write(u,i,s,c,23,4),s+4}l.prototype.writeFloatLE=function(i,s,c){return Ur(this,i,s,!0,c)},l.prototype.writeFloatBE=function(i,s,c){return Ur(this,i,s,!1,c)};function Mr(u,i,s,c,f){return i=+i,s=s>>>0,f||jr(u,i,s,8),e.write(u,i,s,c,52,8),s+8}l.prototype.writeDoubleLE=function(i,s,c){return Mr(this,i,s,!0,c)},l.prototype.writeDoubleBE=function(i,s,c){return Mr(this,i,s,!1,c)},l.prototype.copy=function(i,s,c,f){if(!l.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},l.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"&&!l.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(i.length===1){let w=i.charCodeAt(0);(f==="utf8"&&w<128||f==="latin1")&&(i=w)}}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 w=l.isBuffer(i)?i:l.from(i,f),V=w.length;if(V===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(x=0;x<c-s;++x)this[x+s]=w[x%V]}return this};let ut={};function cr(u,i,s){ut[u]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${u}]`,this.stack,delete this.name}get code(){return u}set code(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${u}]: ${this.message}`}}}cr("ERR_BUFFER_OUT_OF_BOUNDS",function(u){return u?`${u} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),cr("ERR_INVALID_ARG_TYPE",function(u,i){return`The "${u}" argument must be of type number. Received type ${typeof i}`},TypeError),cr("ERR_OUT_OF_RANGE",function(u,i,s){let c=`The value of "${u}" is out of range.`,f=s;return Number.isInteger(s)&&Math.abs(s)>2**32?f=$r(String(s)):typeof s=="bigint"&&(f=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(f=$r(f)),f+="n"),c+=` It must be ${i}. Received ${f}`,c},RangeError);function $r(u){let i="",s=u.length,c=u[0]==="-"?1:0;for(;s>=c+4;s-=3)i=`_${u.slice(s-3,s)}${i}`;return`${u.slice(0,s)}${i}`}function qi(u,i,s){ct(i,"offset"),(u[i]===void 0||u[i+s]===void 0)&&Tt(i,u.length-(s+1))}function Vr(u,i,s,c,f,x){if(u>s||u<i){let w=typeof i=="bigint"?"n":"",V;throw i===0||i===BigInt(0)?V=`>= 0${w} and < 2${w} ** ${(x+1)*8}${w}`:V=`>= -(2${w} ** ${(x+1)*8-1}${w}) and < 2 ** ${(x+1)*8-1}${w}`,new ut.ERR_OUT_OF_RANGE("value",V,u)}qi(c,f,x)}function ct(u,i){if(typeof u!="number")throw new ut.ERR_INVALID_ARG_TYPE(i,"number",u)}function Tt(u,i,s){throw Math.floor(u)!==u?(ct(u,s),new ut.ERR_OUT_OF_RANGE("offset","an integer",u)):i<0?new ut.ERR_BUFFER_OUT_OF_BOUNDS:new ut.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,u)}let Wi=/[^+/0-9A-Za-z-_]/g;function zi(u){if(u=u.split("=")[0],u=u.trim().replace(Wi,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}function pr(u,i){i=i||1/0;let s,c=u.length,f=null,x=[];for(let w=0;w<c;++w){if(s=u.charCodeAt(w),s>55295&&s<57344){if(!f){if(s>56319){(i-=3)>-1&&x.push(239,191,189);continue}else if(w+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 Zi(u){let i=[];for(let s=0;s<u.length;++s)i.push(u.charCodeAt(s)&255);return i}function Gi(u,i){let s,c,f,x=[];for(let w=0;w<u.length&&!((i-=2)<0);++w)s=u.charCodeAt(w),c=s>>8,f=s%256,x.push(f),x.push(c);return x}function Dr(u){return n.toByteArray(zi(u))}function Mt(u,i,s,c){let f;for(f=0;f<c&&!(f+s>=i.length||f>=u.length);++f)i[f+s]=u[f];return f}function ye(u,i){return u instanceof i||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===i.name}function dr(u){return u!==u}let Ji=(function(){let u="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]=u[s]+u[f]}return i})();function Ce(u){return typeof BigInt>"u"?Hi:u}function Hi(){throw new Error("BigInt not supported")}return Oe}var Rt,oa,zt,la,Oe,ua,pa=pt(()=>{"use strict";m();y();h();Rt={},oa=!1;zt={},la=!1;Oe={},ua=!1});var je,R,Ku,Qu,da=pt(()=>{"use strict";m();y();h();pa();je=ca();je.Buffer;je.SlowBuffer;je.INSPECT_MAX_BYTES;je.kMaxLength;R=je.Buffer,Ku=je.INSPECT_MAX_BYTES,Qu=je.kMaxLength});var y=pt(()=>{"use strict";da()});var Uu={};Vt(Uu,{DynamicSnippetsGenerator:()=>ur});module.exports=ts(Uu);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 is=typeof global=="object"&&global&&global.Object===Object&&global,fa=is;var ss=typeof self=="object"&&self&&self.Object===Object&&self,os=fa||ss||Function("return this")(),ma=os;var ls=ma.Symbol,Re=ls;m();y();h();var ha=Object.prototype,us=ha.hasOwnProperty,cs=ha.toString,_t=Re?Re.toStringTag:void 0;function ps(n){var e=us.call(n,_t),t=n[_t];try{n[_t]=void 0;var r=!0}catch{}var a=cs.call(n);return r&&(e?n[_t]=t:delete n[_t]),a}var ya=ps;m();y();h();var ds=Object.prototype,fs=ds.toString;function ms(n){return fs.call(n)}var ga=ms;var hs="[object Null]",ys="[object Undefined]",xa=Re?Re.toStringTag:void 0;function gs(n){return n==null?n===void 0?ys:hs:xa&&xa in Object(n)?ya(n):ga(n)}var va=gs;m();y();h();function xs(n){return n!=null&&typeof n=="object"}var wa=xs;var vs="[object Symbol]";function ws(n){return typeof n=="symbol"||wa(n)&&va(n)==vs}var ba=ws;m();y();h();m();y();h();function bs(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 Ta=bs;m();y();h();var Ts=Array.isArray,Ra=Ts;var Rs=1/0,_a=Re?Re.prototype:void 0,ka=_a?_a.toString:void 0;function Na(n){if(typeof n=="string")return n;if(Ra(n))return Ta(n,Na)+"";if(ba(n))return ka?ka.call(n):"";var e=n+"";return e=="0"&&1/n==-Rs?"-0":e}var Ia=Na;m();y();h();function _s(n){return n==null?"":Ia(n)}var Ae=_s;m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();function ks(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 Ca=ks;function Ns(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ca(n,e,t)}var Ea=Ns;m();y();h();var Is="\\ud800-\\udfff",Cs="\\u0300-\\u036f",Es="\\ufe20-\\ufe2f",As="\\u20d0-\\u20ff",Ss=Cs+Es+As,Ls="\\ufe0e\\ufe0f",Bs="\\u200d",Ps=RegExp("["+Bs+Is+Ss+Ls+"]");function Fs(n){return Ps.test(n)}var Zt=Fs;m();y();h();m();y();h();function Os(n){return n.split("")}var Aa=Os;m();y();h();var Sa="\\ud800-\\udfff",js="\\u0300-\\u036f",Us="\\ufe20-\\ufe2f",Ms="\\u20d0-\\u20ff",$s=js+Us+Ms,Vs="\\ufe0e\\ufe0f",Ds="["+Sa+"]",yr="["+$s+"]",gr="\\ud83c[\\udffb-\\udfff]",qs="(?:"+yr+"|"+gr+")",La="[^"+Sa+"]",Ba="(?:\\ud83c[\\udde6-\\uddff]){2}",Pa="[\\ud800-\\udbff][\\udc00-\\udfff]",Ws="\\u200d",Fa=qs+"?",Oa="["+Vs+"]?",zs="(?:"+Ws+"(?:"+[La,Ba,Pa].join("|")+")"+Oa+Fa+")*",Zs=Oa+Fa+zs,Gs="(?:"+[La+yr+"?",yr,Ba,Pa,Ds].join("|")+")",Js=RegExp(gr+"(?="+gr+")|"+Gs+Zs,"g");function Hs(n){return n.match(Js)||[]}var ja=Hs;function Ys(n){return Zt(n)?ja(n):Aa(n)}var Ua=Ys;function Ks(n){return function(e){e=Ae(e);var t=Zt(e)?Ua(e):void 0,r=t?t[0]:e.charAt(0),a=t?Ea(t,1).join(""):e.slice(1);return r[n]()+a}}var Ma=Ks;var Qs=Ma("toUpperCase"),$a=Qs;function Xs(n){return $a(Ae(n).toLowerCase())}var Va=Xs;m();y();h();m();y();h();function eo(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 Da=eo;m();y();h();m();y();h();m();y();h();function to(n){return function(e){return n?.[e]}}var qa=to;var ro={\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"},no=qa(ro),Wa=no;var ao=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,io="\\u0300-\\u036f",so="\\ufe20-\\ufe2f",oo="\\u20d0-\\u20ff",lo=io+so+oo,uo="["+lo+"]",co=RegExp(uo,"g");function po(n){return n=Ae(n),n&&n.replace(ao,Wa).replace(co,"")}var za=po;m();y();h();m();y();h();var fo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function mo(n){return n.match(fo)||[]}var Za=mo;m();y();h();var ho=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function yo(n){return ho.test(n)}var Ga=yo;m();y();h();var Qa="\\ud800-\\udfff",go="\\u0300-\\u036f",xo="\\ufe20-\\ufe2f",vo="\\u20d0-\\u20ff",wo=go+xo+vo,Xa="\\u2700-\\u27bf",ei="a-z\\xdf-\\xf6\\xf8-\\xff",bo="\\xac\\xb1\\xd7\\xf7",To="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ro="\\u2000-\\u206f",_o=" \\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",ti="A-Z\\xc0-\\xd6\\xd8-\\xde",ko="\\ufe0e\\ufe0f",ri=bo+To+Ro+_o,ni="['\u2019]",Ja="["+ri+"]",No="["+wo+"]",ai="\\d+",Io="["+Xa+"]",ii="["+ei+"]",si="[^"+Qa+ri+ai+Xa+ei+ti+"]",Co="\\ud83c[\\udffb-\\udfff]",Eo="(?:"+No+"|"+Co+")",Ao="[^"+Qa+"]",oi="(?:\\ud83c[\\udde6-\\uddff]){2}",li="[\\ud800-\\udbff][\\udc00-\\udfff]",ft="["+ti+"]",So="\\u200d",Ha="(?:"+ii+"|"+si+")",Lo="(?:"+ft+"|"+si+")",Ya="(?:"+ni+"(?:d|ll|m|re|s|t|ve))?",Ka="(?:"+ni+"(?:D|LL|M|RE|S|T|VE))?",ui=Eo+"?",ci="["+ko+"]?",Bo="(?:"+So+"(?:"+[Ao,oi,li].join("|")+")"+ci+ui+")*",Po="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Oo=ci+ui+Bo,jo="(?:"+[Io,oi,li].join("|")+")"+Oo,Uo=RegExp([ft+"?"+ii+"+"+Ya+"(?="+[Ja,ft,"$"].join("|")+")",Lo+"+"+Ka+"(?="+[Ja,ft+Ha,"$"].join("|")+")",ft+"?"+Ha+"+"+Ya,ft+"+"+Ka,Fo,Po,ai,jo].join("|"),"g");function Mo(n){return n.match(Uo)||[]}var pi=Mo;function $o(n,e,t){return n=Ae(n),e=t?void 0:e,e===void 0?Ga(n)?pi(n):Za(n):n.match(e)||[]}var di=$o;var Vo="['\u2019]",Do=RegExp(Vo,"g");function qo(n){return function(e){return Da(di(za(e).replace(Do,"")),n,"")}}var fi=qo;var Wo=fi(function(n,e,t){return e=e.toLowerCase(),n+(t?Va(e):e)}),xr=Wo;m();y();h();function $(n){throw new Error("Unexpected value: "+JSON.stringify(n))}m();y();h();function kt(n){return Object.keys(n)}m();y();h();m();y();h();m();y();h();var Nt=T.env.FERN_STACK_TRACK?.toLowerCase()??"",ge=Nt!==""&&Nt!=="0"&&Nt!=="false",vr=["single","multiline","box"].includes(Nt)?Nt:"single";ge&&(Error.stackTraceLimit=50);var zo=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Zo=new Set(["stacktrace"]);function Jt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:l=!0,formatFilename:p=g=>g}={}){if(!ge)return[];r=[...r,...zo],t=[...t,...Zo],a=[...a,"runInteractiveTask"];let g=!1;return(new Error().stack??"").split(`
|
|
2
|
-
`).map(v=>{let N=v.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(N&&N.length===5){let[,P,G,A,O]=N;if(!P||!G||!A||!O)return;if(g||a.some(j=>P?.includes(j))){g=!0;return}switch(P){case"Object.<anonymous>":P="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":P=`${P.substring(P.indexOf(".")+1)}()=> { ... }`;break}return{fn:P,path:p(G),position:`${A}:${O}`}}}).filter(v=>v&&!r.some(N=>v.fn.includes(N))&&!(o&&v.path?.startsWith("node:"))&&!(l&&v.path?.endsWith(".js"))&&!t.some(N=>v.path.includes(N))).slice(e,e+n)}var Gt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:o=[],filterNode:l=!0,filterJs:p=!0,multiline:g=!1,formatFilename:v=N=>N}={}){
|
|
3
|
-
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(e){let t=this.tracking.get(e);return t?[...t]:[]}free(e){this.tracking.delete(e)}clear(){this.tracking=new WeakMap}},wr;function mi({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:l=!0,multiline:p=!1,formatFilename:g=v=>v}={}){ge&&(wr??(wr=new Gt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:o,filterJs:l,multiline:p,formatFilename:g})))}function hi(n){wr?.tag(n)}function br(n){return wr?.frames(n)??[]}var Ue=class{constructor(){hi(this)}};m();y();h();var Ht=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}dispose(){}},It=class extends Ht{async format(e){return e}formatSync(e){return e}};m();y();h();m();y();h();m();y();h();var me=class extends Ue{constructor(t){super();
|
|
1
|
+
"use strict";var $t=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var Ki=Object.getOwnPropertyNames;var Qi=Object.prototype.hasOwnProperty;var Xi=(n,e,t)=>e in n?$t(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pt=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var Vt=(n,e)=>{for(var t in e)$t(n,t,{get:e[t],enumerable:!0})},es=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ki(e))!Qi.call(n,a)&&a!==t&&$t(n,a,{get:()=>e[a],enumerable:!(r=Yi(e,a))||r.enumerable});return n};var ts=n=>es($t({},"__esModule",{value:!0}),n);var R=(n,e,t)=>Xi(n,typeof e!="symbol"?e+"":e,t);var m=pt(()=>{"use strict"});var T={};Vt(T,{_debugEnd:()=>Ln,_debugProcess:()=>Sn,_events:()=>Jn,_eventsCount:()=>Hn,_exiting:()=>dn,_fatalExceptions:()=>In,_getActiveHandles:()=>yn,_getActiveRequests:()=>hn,_kill:()=>xn,_linkedBinding:()=>cn,_maxListeners:()=>Gn,_preload_modules:()=>Wn,_rawDebug:()=>ln,_startProfilerIdleNotifier:()=>Bn,_stopProfilerIdleNotifier:()=>Pn,_tickCallback:()=>An,abort:()=>Un,addListener:()=>Yn,allowedNodeEnvironmentFlags:()=>_n,arch:()=>Gr,argv:()=>Yr,argv0:()=>qn,assert:()=>kn,binding:()=>tn,browser:()=>on,chdir:()=>an,config:()=>fn,cpuUsage:()=>Wt,cwd:()=>nn,debugPort:()=>Dn,default:()=>ia,dlopen:()=>mn,domain:()=>pn,emit:()=>ta,emitWarning:()=>en,env:()=>Hr,execArgv:()=>Kr,execPath:()=>Vn,exit:()=>Tn,features:()=>Nn,hasUncaughtExceptionCaptureCallback:()=>En,hrtime:()=>qt,kill:()=>bn,listeners:()=>aa,memoryUsage:()=>wn,moduleLoadList:()=>un,nextTick:()=>Wr,off:()=>Qn,on:()=>Te,once:()=>Kn,openStdin:()=>Rn,pid:()=>Mn,platform:()=>Jr,ppid:()=>$n,prependListener:()=>ra,prependOnceListener:()=>na,reallyExit:()=>gn,release:()=>sn,removeAllListeners:()=>ea,removeListener:()=>Xn,resourceUsage:()=>vn,setSourceMapsEnabled:()=>zn,setUncaughtExceptionCaptureCallback:()=>Cn,stderr:()=>On,stdin:()=>jn,stdout:()=>Fn,title:()=>Zr,umask:()=>rn,uptime:()=>Zn,version:()=>Qr,versions:()=>Xr});function hr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function rs(){!dt||!Fe||(dt=!1,Fe.length?be=Fe.concat(be):Dt=-1,be.length&&qr())}function qr(){if(!dt){var n=setTimeout(rs,0);dt=!0;for(var e=be.length;e;){for(Fe=be,be=[];++Dt<e;)Fe&&Fe[Dt].run();Dt=-1,e=be.length}Fe=null,dt=!1,clearTimeout(n)}}function Wr(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 zr(n,e)),be.length===1&&!dt&&setTimeout(qr,0)}function zr(n,e){this.fun=n,this.array=e}function te(){}function cn(n){hr("_linkedBinding")}function mn(n){hr("dlopen")}function hn(){return[]}function yn(){return[]}function kn(n,e){if(!n)throw new Error(e||"assertion error")}function En(){return!1}function Zn(){return Ee.now()/1e3}function qt(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+=mr)),[r,a]}function Te(){return ia}function aa(n){return[]}var be,dt,Fe,Dt,Zr,Gr,Jr,Hr,Yr,Kr,Qr,Xr,en,tn,rn,nn,an,sn,on,ln,un,pn,dn,fn,gn,xn,Wt,vn,wn,bn,Tn,Rn,_n,Nn,In,Cn,An,Sn,Ln,Bn,Pn,Fn,On,jn,Un,Mn,$n,Vn,Dn,qn,Wn,zn,Ee,fr,mr,Gn,Jn,Hn,Yn,Kn,Qn,Xn,ea,ta,ra,na,ia,sa=pt(()=>{"use strict";m();y();h();be=[],dt=!1,Dt=-1;zr.prototype.run=function(){this.fun.apply(null,this.array)};Zr="browser",Gr="x64",Jr="browser",Hr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Yr=["/usr/bin/node"],Kr=[],Qr="v16.8.0",Xr={},en=function(n,e){console.warn((e?e+": ":"")+n)},tn=function(n){hr("binding")},rn=function(n){return 0},nn=function(){return"/"},an=function(n){},sn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};on=!0,ln=te,un=[];pn={},dn=!1,fn={};gn=te,xn=te,Wt=function(){return{}},vn=Wt,wn=Wt,bn=te,Tn=te,Rn=te,_n={};Nn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},In=te,Cn=te;An=te,Sn=te,Ln=te,Bn=te,Pn=te,Fn=void 0,On=void 0,jn=void 0,Un=te,Mn=2,$n=1,Vn="/bin/usr/node",Dn=9229,qn="node",Wn=[],zn=te,Ee={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Ee.now===void 0&&(fr=Date.now(),Ee.timing&&Ee.timing.navigationStart&&(fr=Ee.timing.navigationStart),Ee.now=()=>Date.now()-fr);mr=1e9;qt.bigint=function(n){var e=qt(n);return typeof BigInt>"u"?e[0]*mr+e[1]:BigInt(e[0]*mr)+BigInt(e[1])};Gn=10,Jn={},Hn=0;Yn=Te,Kn=Te,Qn=Te,Xn=Te,ea=Te,ta=te,ra=Te,na=Te;ia={version:Qr,versions:Xr,arch:Gr,platform:Jr,browser:on,release:sn,_rawDebug:ln,moduleLoadList:un,binding:tn,_linkedBinding:cn,_events:Jn,_eventsCount:Hn,_maxListeners:Gn,on:Te,addListener:Yn,once:Kn,off:Qn,removeListener:Xn,removeAllListeners:ea,emit:ta,prependListener:ra,prependOnceListener:na,listeners:aa,domain:pn,_exiting:dn,config:fn,dlopen:mn,uptime:Zn,_getActiveRequests:hn,_getActiveHandles:yn,reallyExit:gn,_kill:xn,cpuUsage:Wt,resourceUsage:vn,memoryUsage:wn,kill:bn,exit:Tn,openStdin:Rn,allowedNodeEnvironmentFlags:_n,assert:kn,features:Nn,_fatalExceptions:In,setUncaughtExceptionCaptureCallback:Cn,hasUncaughtExceptionCaptureCallback:En,emitWarning:en,nextTick:Wr,_tickCallback:An,_debugProcess:Sn,_debugEnd:Ln,_startProfilerIdleNotifier:Bn,_stopProfilerIdleNotifier:Pn,stdout:Fn,stdin:jn,stderr:On,abort:Un,umask:rn,chdir:an,cwd:nn,env:Hr,title:Zr,argv:Yr,execArgv:Kr,pid:Mn,ppid:$n,execPath:Vn,debugPort:Dn,hrtime:qt,argv0:qn,_preload_modules:Wn,setSourceMapsEnabled:zn}});var h=pt(()=>{"use strict";sa()});function ns(){if(oa)return Rt;oa=!0,Rt.byteLength=p,Rt.toByteArray=v,Rt.fromByteArray=G;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 l(A){var O=A.length;if(O%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var j=A.indexOf("=");j===-1&&(j=O);var L=j===O?0:4-j%4;return[j,L]}function p(A){var O=l(A),j=O[0],L=O[1];return(j+L)*3/4-L}function g(A,O,j){return(O+j)*3/4-j}function v(A){var O,j=l(A),L=j[0],z=j[1],H=new t(g(A,L,z)),ae=0,ce=z>0?L-4:L,ne;for(ne=0;ne<ce;ne+=4)O=e[A.charCodeAt(ne)]<<18|e[A.charCodeAt(ne+1)]<<12|e[A.charCodeAt(ne+2)]<<6|e[A.charCodeAt(ne+3)],H[ae++]=O>>16&255,H[ae++]=O>>8&255,H[ae++]=O&255;return z===2&&(O=e[A.charCodeAt(ne)]<<2|e[A.charCodeAt(ne+1)]>>4,H[ae++]=O&255),z===1&&(O=e[A.charCodeAt(ne)]<<10|e[A.charCodeAt(ne+1)]<<4|e[A.charCodeAt(ne+2)]>>2,H[ae++]=O>>8&255,H[ae++]=O&255),H}function N(A){return n[A>>18&63]+n[A>>12&63]+n[A>>6&63]+n[A&63]}function P(A,O,j){for(var L,z=[],H=O;H<j;H+=3)L=(A[H]<<16&16711680)+(A[H+1]<<8&65280)+(A[H+2]&255),z.push(N(L));return z.join("")}function G(A){for(var O,j=A.length,L=j%3,z=[],H=16383,ae=0,ce=j-L;ae<ce;ae+=H)z.push(P(A,ae,ae+H>ce?ce:ae+H));return L===1?(O=A[j-1],z.push(n[O>>2]+n[O<<4&63]+"==")):L===2&&(O=(A[j-2]<<8)+A[j-1],z.push(n[O>>10]+n[O>>4&63]+n[O<<2&63]+"=")),z.join("")}return Rt}function as(){if(la)return zt;la=!0;return zt.read=function(n,e,t,r,a){var o,l,p=a*8-r-1,g=(1<<p)-1,v=g>>1,N=-7,P=t?a-1:0,G=t?-1:1,A=n[e+P];for(P+=G,o=A&(1<<-N)-1,A>>=-N,N+=p;N>0;o=o*256+n[e+P],P+=G,N-=8);for(l=o&(1<<-N)-1,o>>=-N,N+=r;N>0;l=l*256+n[e+P],P+=G,N-=8);if(o===0)o=1-v;else{if(o===g)return l?NaN:(A?-1:1)*(1/0);l=l+Math.pow(2,r),o=o-v}return(A?-1:1)*l*Math.pow(2,o-r)},zt.write=function(n,e,t,r,a,o){var l,p,g,v=o*8-a-1,N=(1<<v)-1,P=N>>1,G=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=r?0:o-1,O=r?1:-1,j=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,l=N):(l=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-l))<1&&(l--,g*=2),l+P>=1?e+=G/g:e+=G*Math.pow(2,1-P),e*g>=2&&(l++,g/=2),l+P>=N?(p=0,l=N):l+P>=1?(p=(e*g-1)*Math.pow(2,a),l=l+P):(p=e*Math.pow(2,P-1)*Math.pow(2,a),l=0));a>=8;n[t+A]=p&255,A+=O,p/=256,a-=8);for(l=l<<a|p,v+=a;v>0;n[t+A]=l&255,A+=O,l/=256,v-=8);n[t+A-O]|=j*128},zt}function ca(){if(ua)return Oe;ua=!0;let n=ns(),e=as(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Oe.Buffer=l,Oe.SlowBuffer=z,Oe.INSPECT_MAX_BYTES=50;let r=2147483647;Oe.kMaxLength=r,l.TYPED_ARRAY_SUPPORT=a(),!l.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 u=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(u,i),u.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function o(u){if(u>r)throw new RangeError('The value "'+u+'" is invalid for option "size"');let i=new Uint8Array(u);return Object.setPrototypeOf(i,l.prototype),i}function l(u,i,s){if(typeof u=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return N(u)}return p(u,i,s)}l.poolSize=8192;function p(u,i,s){if(typeof u=="string")return P(u,i);if(ArrayBuffer.isView(u))return A(u);if(u==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u);if(ye(u,ArrayBuffer)||u&&ye(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(u,SharedArrayBuffer)||u&&ye(u.buffer,SharedArrayBuffer)))return O(u,i,s);if(typeof u=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=u.valueOf&&u.valueOf();if(c!=null&&c!==u)return l.from(c,i,s);let f=j(u);if(f)return f;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof u[Symbol.toPrimitive]=="function")return l.from(u[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 u)}l.from=function(u,i,s){return p(u,i,s)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function g(u){if(typeof u!="number")throw new TypeError('"size" argument must be of type number');if(u<0)throw new RangeError('The value "'+u+'" is invalid for option "size"')}function v(u,i,s){return g(u),u<=0?o(u):i!==void 0?typeof s=="string"?o(u).fill(i,s):o(u).fill(i):o(u)}l.alloc=function(u,i,s){return v(u,i,s)};function N(u){return g(u),o(u<0?0:L(u)|0)}l.allocUnsafe=function(u){return N(u)},l.allocUnsafeSlow=function(u){return N(u)};function P(u,i){if((typeof i!="string"||i==="")&&(i="utf8"),!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=H(u,i)|0,c=o(s),f=c.write(u,i);return f!==s&&(c=c.slice(0,f)),c}function G(u){let i=u.length<0?0:L(u.length)|0,s=o(i);for(let c=0;c<i;c+=1)s[c]=u[c]&255;return s}function A(u){if(ye(u,Uint8Array)){let i=new Uint8Array(u);return O(i.buffer,i.byteOffset,i.byteLength)}return G(u)}function O(u,i,s){if(i<0||u.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(u.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(u):s===void 0?c=new Uint8Array(u,i):c=new Uint8Array(u,i,s),Object.setPrototypeOf(c,l.prototype),c}function j(u){if(l.isBuffer(u)){let i=L(u.length)|0,s=o(i);return s.length===0||u.copy(s,0,0,i),s}if(u.length!==void 0)return typeof u.length!="number"||dr(u.length)?o(0):G(u);if(u.type==="Buffer"&&Array.isArray(u.data))return G(u.data)}function L(u){if(u>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return u|0}function z(u){return+u!=u&&(u=0),l.alloc(+u)}l.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==l.prototype},l.compare=function(i,s){if(ye(i,Uint8Array)&&(i=l.from(i,i.offset,i.byteLength)),ye(s,Uint8Array)&&(s=l.from(s,s.offset,s.byteLength)),!l.isBuffer(i)||!l.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,w=Math.min(c,f);x<w;++x)if(i[x]!==s[x]){c=i[x],f=s[x];break}return c<f?-1:f<c?1:0},l.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}},l.concat=function(i,s){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return l.alloc(0);let c;if(s===void 0)for(s=0,c=0;c<i.length;++c)s+=i[c].length;let f=l.allocUnsafe(s),x=0;for(c=0;c<i.length;++c){let w=i[c];if(ye(w,Uint8Array))x+w.length>f.length?(l.isBuffer(w)||(w=l.from(w)),w.copy(f,x)):Uint8Array.prototype.set.call(f,w,x);else if(l.isBuffer(w))w.copy(f,x);else throw new TypeError('"list" argument must be an Array of Buffers');x+=w.length}return f};function H(u,i){if(l.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||ye(u,ArrayBuffer))return u.byteLength;if(typeof u!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof u);let s=u.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 pr(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return Dr(u).length;default:if(f)return c?-1:pr(u).length;i=(""+i).toLowerCase(),f=!0}}l.byteLength=H;function ae(u,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(u||(u="utf8");;)switch(u){case"hex":return Vi(this,i,s);case"utf8":case"utf-8":return Br(this,i,s);case"ascii":return Mi(this,i,s);case"latin1":case"binary":return $i(this,i,s);case"base64":return ji(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Di(this,i,s);default:if(c)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),c=!0}}l.prototype._isBuffer=!0;function ce(u,i,s){let c=u[i];u[i]=u[s],u[s]=c}l.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},l.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},l.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},l.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Br(this,0,i):ae.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(i){if(!l.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:l.compare(this,i)===0},l.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&&(l.prototype[t]=l.prototype.inspect),l.prototype.compare=function(i,s,c,f,x){if(ye(i,Uint8Array)&&(i=l.from(i,i.offset,i.byteLength)),!l.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 w=x-f,V=c-s,K=Math.min(w,V),J=this.slice(f,x),Q=i.slice(s,c);for(let Z=0;Z<K;++Z)if(J[Z]!==Q[Z]){w=J[Z],V=Q[Z];break}return w<V?-1:V<w?1:0};function ne(u,i,s,c,f){if(u.length===0)return-1;if(typeof s=="string"?(c=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,dr(s)&&(s=f?0:u.length-1),s<0&&(s=u.length+s),s>=u.length){if(f)return-1;s=u.length-1}else if(s<0)if(f)s=0;else return-1;if(typeof i=="string"&&(i=l.from(i,c)),l.isBuffer(i))return i.length===0?-1:Lr(u,i,s,c,f);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(u,i,s):Uint8Array.prototype.lastIndexOf.call(u,i,s):Lr(u,[i],s,c,f);throw new TypeError("val must be string, number or Buffer")}function Lr(u,i,s,c,f){let x=1,w=u.length,V=i.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(u.length<2||i.length<2)return-1;x=2,w/=2,V/=2,s/=2}function K(Q,Z){return x===1?Q[Z]:Q.readUInt16BE(Z*x)}let J;if(f){let Q=-1;for(J=s;J<w;J++)if(K(u,J)===K(i,Q===-1?0:J-Q)){if(Q===-1&&(Q=J),J-Q+1===V)return Q*x}else Q!==-1&&(J-=J-Q),Q=-1}else for(s+V>w&&(s=w-V),J=s;J>=0;J--){let Q=!0;for(let Z=0;Z<V;Z++)if(K(u,J+Z)!==K(i,Z)){Q=!1;break}if(Q)return J}return-1}l.prototype.includes=function(i,s,c){return this.indexOf(i,s,c)!==-1},l.prototype.indexOf=function(i,s,c){return ne(this,i,s,c,!0)},l.prototype.lastIndexOf=function(i,s,c){return ne(this,i,s,c,!1)};function Li(u,i,s,c){s=Number(s)||0;let f=u.length-s;c?(c=Number(c),c>f&&(c=f)):c=f;let x=i.length;c>x/2&&(c=x/2);let w;for(w=0;w<c;++w){let V=parseInt(i.substr(w*2,2),16);if(dr(V))return w;u[s+w]=V}return w}function Bi(u,i,s,c){return Mt(pr(i,u.length-s),u,s,c)}function Pi(u,i,s,c){return Mt(Zi(i),u,s,c)}function Fi(u,i,s,c){return Mt(Dr(i),u,s,c)}function Oi(u,i,s,c){return Mt(Gi(i,u.length-s),u,s,c)}l.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 w=!1;for(;;)switch(f){case"hex":return Li(this,i,s,c);case"utf8":case"utf-8":return Bi(this,i,s,c);case"ascii":case"latin1":case"binary":return Pi(this,i,s,c);case"base64":return Fi(this,i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oi(this,i,s,c);default:if(w)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),w=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ji(u,i,s){return i===0&&s===u.length?n.fromByteArray(u):n.fromByteArray(u.slice(i,s))}function Br(u,i,s){s=Math.min(u.length,s);let c=[],f=i;for(;f<s;){let x=u[f],w=null,V=x>239?4:x>223?3:x>191?2:1;if(f+V<=s){let K,J,Q,Z;switch(V){case 1:x<128&&(w=x);break;case 2:K=u[f+1],(K&192)===128&&(Z=(x&31)<<6|K&63,Z>127&&(w=Z));break;case 3:K=u[f+1],J=u[f+2],(K&192)===128&&(J&192)===128&&(Z=(x&15)<<12|(K&63)<<6|J&63,Z>2047&&(Z<55296||Z>57343)&&(w=Z));break;case 4:K=u[f+1],J=u[f+2],Q=u[f+3],(K&192)===128&&(J&192)===128&&(Q&192)===128&&(Z=(x&15)<<18|(K&63)<<12|(J&63)<<6|Q&63,Z>65535&&Z<1114112&&(w=Z))}}w===null?(w=65533,V=1):w>65535&&(w-=65536,c.push(w>>>10&1023|55296),w=56320|w&1023),c.push(w),f+=V}return Ui(c)}let Pr=4096;function Ui(u){let i=u.length;if(i<=Pr)return String.fromCharCode.apply(String,u);let s="",c=0;for(;c<i;)s+=String.fromCharCode.apply(String,u.slice(c,c+=Pr));return s}function Mi(u,i,s){let c="";s=Math.min(u.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(u[f]&127);return c}function $i(u,i,s){let c="";s=Math.min(u.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(u[f]);return c}function Vi(u,i,s){let c=u.length;(!i||i<0)&&(i=0),(!s||s<0||s>c)&&(s=c);let f="";for(let x=i;x<s;++x)f+=Ji[u[x]];return f}function Di(u,i,s){let c=u.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}l.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,l.prototype),f};function X(u,i,s){if(u%1!==0||u<0)throw new RangeError("offset is not uint");if(u+i>s)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i],x=1,w=0;for(;++w<s&&(x*=256);)f+=this[i+w]*x;return f},l.prototype.readUintBE=l.prototype.readUIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i+--s],x=1;for(;s>0&&(x*=256);)f+=this[i+--s]*x;return f},l.prototype.readUint8=l.prototype.readUInt8=function(i,s){return i=i>>>0,s||X(i,1,this.length),this[i]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||X(i,2,this.length),this[i]|this[i+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||X(i,2,this.length),this[i]<<8|this[i+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||X(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},l.prototype.readBigUInt64LE=Ce(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))}),l.prototype.readBigUInt64BE=Ce(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)}),l.prototype.readIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i],x=1,w=0;for(;++w<s&&(x*=256);)f+=this[i+w]*x;return x*=128,f>=x&&(f-=Math.pow(2,8*s)),f},l.prototype.readIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=s,x=1,w=this[i+--f];for(;f>0&&(x*=256);)w+=this[i+--f]*x;return x*=128,w>=x&&(w-=Math.pow(2,8*s)),w},l.prototype.readInt8=function(i,s){return i=i>>>0,s||X(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},l.prototype.readInt16LE=function(i,s){i=i>>>0,s||X(i,2,this.length);let c=this[i]|this[i+1]<<8;return c&32768?c|4294901760:c},l.prototype.readInt16BE=function(i,s){i=i>>>0,s||X(i,2,this.length);let c=this[i+1]|this[i]<<8;return c&32768?c|4294901760:c},l.prototype.readInt32LE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},l.prototype.readInt32BE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},l.prototype.readBigInt64LE=Ce(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)}),l.prototype.readBigInt64BE=Ce(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)}),l.prototype.readFloatLE=function(i,s){return i=i>>>0,s||X(i,4,this.length),e.read(this,i,!0,23,4)},l.prototype.readFloatBE=function(i,s){return i=i>>>0,s||X(i,4,this.length),e.read(this,i,!1,23,4)},l.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||X(i,8,this.length),e.read(this,i,!0,52,8)},l.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||X(i,8,this.length),e.read(this,i,!1,52,8)};function ie(u,i,s,c,f,x){if(!l.isBuffer(u))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>u.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let V=Math.pow(2,8*c)-1;ie(this,i,s,c,V,0)}let x=1,w=0;for(this[s]=i&255;++w<c&&(x*=256);)this[s+w]=i/x&255;return s+c},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let V=Math.pow(2,8*c)-1;ie(this,i,s,c,V,0)}let x=c-1,w=1;for(this[s+x]=i&255;--x>=0&&(w*=256);)this[s+x]=i/w&255;return s+c},l.prototype.writeUint8=l.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},l.prototype.writeUint16LE=l.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},l.prototype.writeUint16BE=l.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},l.prototype.writeUint32LE=l.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},l.prototype.writeUint32BE=l.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 Fr(u,i,s,c,f){Vr(i,c,f,u,s,7);let x=Number(i&BigInt(4294967295));u[s++]=x,x=x>>8,u[s++]=x,x=x>>8,u[s++]=x,x=x>>8,u[s++]=x;let w=Number(i>>BigInt(32)&BigInt(4294967295));return u[s++]=w,w=w>>8,u[s++]=w,w=w>>8,u[s++]=w,w=w>>8,u[s++]=w,s}function Or(u,i,s,c,f){Vr(i,c,f,u,s,7);let x=Number(i&BigInt(4294967295));u[s+7]=x,x=x>>8,u[s+6]=x,x=x>>8,u[s+5]=x,x=x>>8,u[s+4]=x;let w=Number(i>>BigInt(32)&BigInt(4294967295));return u[s+3]=w,w=w>>8,u[s+2]=w,w=w>>8,u[s+1]=w,w=w>>8,u[s]=w,s+8}l.prototype.writeBigUInt64LE=Ce(function(i,s=0){return Fr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Ce(function(i,s=0){return Or(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let K=Math.pow(2,8*c-1);ie(this,i,s,c,K-1,-K)}let x=0,w=1,V=0;for(this[s]=i&255;++x<c&&(w*=256);)i<0&&V===0&&this[s+x-1]!==0&&(V=1),this[s+x]=(i/w>>0)-V&255;return s+c},l.prototype.writeIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let K=Math.pow(2,8*c-1);ie(this,i,s,c,K-1,-K)}let x=c-1,w=1,V=0;for(this[s+x]=i&255;--x>=0&&(w*=256);)i<0&&V===0&&this[s+x+1]!==0&&(V=1),this[s+x]=(i/w>>0)-V&255;return s+c},l.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},l.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},l.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},l.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},l.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},l.prototype.writeBigInt64LE=Ce(function(i,s=0){return Fr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Ce(function(i,s=0){return Or(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function jr(u,i,s,c,f,x){if(s+c>u.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Ur(u,i,s,c,f){return i=+i,s=s>>>0,f||jr(u,i,s,4),e.write(u,i,s,c,23,4),s+4}l.prototype.writeFloatLE=function(i,s,c){return Ur(this,i,s,!0,c)},l.prototype.writeFloatBE=function(i,s,c){return Ur(this,i,s,!1,c)};function Mr(u,i,s,c,f){return i=+i,s=s>>>0,f||jr(u,i,s,8),e.write(u,i,s,c,52,8),s+8}l.prototype.writeDoubleLE=function(i,s,c){return Mr(this,i,s,!0,c)},l.prototype.writeDoubleBE=function(i,s,c){return Mr(this,i,s,!1,c)},l.prototype.copy=function(i,s,c,f){if(!l.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},l.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"&&!l.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(i.length===1){let w=i.charCodeAt(0);(f==="utf8"&&w<128||f==="latin1")&&(i=w)}}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 w=l.isBuffer(i)?i:l.from(i,f),V=w.length;if(V===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(x=0;x<c-s;++x)this[x+s]=w[x%V]}return this};let ut={};function cr(u,i,s){ut[u]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${u}]`,this.stack,delete this.name}get code(){return u}set code(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${u}]: ${this.message}`}}}cr("ERR_BUFFER_OUT_OF_BOUNDS",function(u){return u?`${u} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),cr("ERR_INVALID_ARG_TYPE",function(u,i){return`The "${u}" argument must be of type number. Received type ${typeof i}`},TypeError),cr("ERR_OUT_OF_RANGE",function(u,i,s){let c=`The value of "${u}" is out of range.`,f=s;return Number.isInteger(s)&&Math.abs(s)>2**32?f=$r(String(s)):typeof s=="bigint"&&(f=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(f=$r(f)),f+="n"),c+=` It must be ${i}. Received ${f}`,c},RangeError);function $r(u){let i="",s=u.length,c=u[0]==="-"?1:0;for(;s>=c+4;s-=3)i=`_${u.slice(s-3,s)}${i}`;return`${u.slice(0,s)}${i}`}function qi(u,i,s){ct(i,"offset"),(u[i]===void 0||u[i+s]===void 0)&&Tt(i,u.length-(s+1))}function Vr(u,i,s,c,f,x){if(u>s||u<i){let w=typeof i=="bigint"?"n":"",V;throw i===0||i===BigInt(0)?V=`>= 0${w} and < 2${w} ** ${(x+1)*8}${w}`:V=`>= -(2${w} ** ${(x+1)*8-1}${w}) and < 2 ** ${(x+1)*8-1}${w}`,new ut.ERR_OUT_OF_RANGE("value",V,u)}qi(c,f,x)}function ct(u,i){if(typeof u!="number")throw new ut.ERR_INVALID_ARG_TYPE(i,"number",u)}function Tt(u,i,s){throw Math.floor(u)!==u?(ct(u,s),new ut.ERR_OUT_OF_RANGE("offset","an integer",u)):i<0?new ut.ERR_BUFFER_OUT_OF_BOUNDS:new ut.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,u)}let Wi=/[^+/0-9A-Za-z-_]/g;function zi(u){if(u=u.split("=")[0],u=u.trim().replace(Wi,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}function pr(u,i){i=i||1/0;let s,c=u.length,f=null,x=[];for(let w=0;w<c;++w){if(s=u.charCodeAt(w),s>55295&&s<57344){if(!f){if(s>56319){(i-=3)>-1&&x.push(239,191,189);continue}else if(w+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 Zi(u){let i=[];for(let s=0;s<u.length;++s)i.push(u.charCodeAt(s)&255);return i}function Gi(u,i){let s,c,f,x=[];for(let w=0;w<u.length&&!((i-=2)<0);++w)s=u.charCodeAt(w),c=s>>8,f=s%256,x.push(f),x.push(c);return x}function Dr(u){return n.toByteArray(zi(u))}function Mt(u,i,s,c){let f;for(f=0;f<c&&!(f+s>=i.length||f>=u.length);++f)i[f+s]=u[f];return f}function ye(u,i){return u instanceof i||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===i.name}function dr(u){return u!==u}let Ji=(function(){let u="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]=u[s]+u[f]}return i})();function Ce(u){return typeof BigInt>"u"?Hi:u}function Hi(){throw new Error("BigInt not supported")}return Oe}var Rt,oa,zt,la,Oe,ua,pa=pt(()=>{"use strict";m();y();h();Rt={},oa=!1;zt={},la=!1;Oe={},ua=!1});var je,_,Ku,Qu,da=pt(()=>{"use strict";m();y();h();pa();je=ca();je.Buffer;je.SlowBuffer;je.INSPECT_MAX_BYTES;je.kMaxLength;_=je.Buffer,Ku=je.INSPECT_MAX_BYTES,Qu=je.kMaxLength});var y=pt(()=>{"use strict";da()});var Uu={};Vt(Uu,{DynamicSnippetsGenerator:()=>ur});module.exports=ts(Uu);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 is=typeof global=="object"&&global&&global.Object===Object&&global,fa=is;var ss=typeof self=="object"&&self&&self.Object===Object&&self,os=fa||ss||Function("return this")(),ma=os;var ls=ma.Symbol,Re=ls;m();y();h();var ha=Object.prototype,us=ha.hasOwnProperty,cs=ha.toString,_t=Re?Re.toStringTag:void 0;function ps(n){var e=us.call(n,_t),t=n[_t];try{n[_t]=void 0;var r=!0}catch{}var a=cs.call(n);return r&&(e?n[_t]=t:delete n[_t]),a}var ya=ps;m();y();h();var ds=Object.prototype,fs=ds.toString;function ms(n){return fs.call(n)}var ga=ms;var hs="[object Null]",ys="[object Undefined]",xa=Re?Re.toStringTag:void 0;function gs(n){return n==null?n===void 0?ys:hs:xa&&xa in Object(n)?ya(n):ga(n)}var va=gs;m();y();h();function xs(n){return n!=null&&typeof n=="object"}var wa=xs;var vs="[object Symbol]";function ws(n){return typeof n=="symbol"||wa(n)&&va(n)==vs}var ba=ws;m();y();h();m();y();h();function bs(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 Ta=bs;m();y();h();var Ts=Array.isArray,Ra=Ts;var Rs=1/0,_a=Re?Re.prototype:void 0,ka=_a?_a.toString:void 0;function Na(n){if(typeof n=="string")return n;if(Ra(n))return Ta(n,Na)+"";if(ba(n))return ka?ka.call(n):"";var e=n+"";return e=="0"&&1/n==-Rs?"-0":e}var Ia=Na;m();y();h();function _s(n){return n==null?"":Ia(n)}var Ae=_s;m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();function ks(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 Ca=ks;function Ns(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ca(n,e,t)}var Ea=Ns;m();y();h();var Is="\\ud800-\\udfff",Cs="\\u0300-\\u036f",Es="\\ufe20-\\ufe2f",As="\\u20d0-\\u20ff",Ss=Cs+Es+As,Ls="\\ufe0e\\ufe0f",Bs="\\u200d",Ps=RegExp("["+Bs+Is+Ss+Ls+"]");function Fs(n){return Ps.test(n)}var Zt=Fs;m();y();h();m();y();h();function Os(n){return n.split("")}var Aa=Os;m();y();h();var Sa="\\ud800-\\udfff",js="\\u0300-\\u036f",Us="\\ufe20-\\ufe2f",Ms="\\u20d0-\\u20ff",$s=js+Us+Ms,Vs="\\ufe0e\\ufe0f",Ds="["+Sa+"]",yr="["+$s+"]",gr="\\ud83c[\\udffb-\\udfff]",qs="(?:"+yr+"|"+gr+")",La="[^"+Sa+"]",Ba="(?:\\ud83c[\\udde6-\\uddff]){2}",Pa="[\\ud800-\\udbff][\\udc00-\\udfff]",Ws="\\u200d",Fa=qs+"?",Oa="["+Vs+"]?",zs="(?:"+Ws+"(?:"+[La,Ba,Pa].join("|")+")"+Oa+Fa+")*",Zs=Oa+Fa+zs,Gs="(?:"+[La+yr+"?",yr,Ba,Pa,Ds].join("|")+")",Js=RegExp(gr+"(?="+gr+")|"+Gs+Zs,"g");function Hs(n){return n.match(Js)||[]}var ja=Hs;function Ys(n){return Zt(n)?ja(n):Aa(n)}var Ua=Ys;function Ks(n){return function(e){e=Ae(e);var t=Zt(e)?Ua(e):void 0,r=t?t[0]:e.charAt(0),a=t?Ea(t,1).join(""):e.slice(1);return r[n]()+a}}var Ma=Ks;var Qs=Ma("toUpperCase"),$a=Qs;function Xs(n){return $a(Ae(n).toLowerCase())}var Va=Xs;m();y();h();m();y();h();function eo(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 Da=eo;m();y();h();m();y();h();m();y();h();function to(n){return function(e){return n?.[e]}}var qa=to;var ro={\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"},no=qa(ro),Wa=no;var ao=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,io="\\u0300-\\u036f",so="\\ufe20-\\ufe2f",oo="\\u20d0-\\u20ff",lo=io+so+oo,uo="["+lo+"]",co=RegExp(uo,"g");function po(n){return n=Ae(n),n&&n.replace(ao,Wa).replace(co,"")}var za=po;m();y();h();m();y();h();var fo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function mo(n){return n.match(fo)||[]}var Za=mo;m();y();h();var ho=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function yo(n){return ho.test(n)}var Ga=yo;m();y();h();var Qa="\\ud800-\\udfff",go="\\u0300-\\u036f",xo="\\ufe20-\\ufe2f",vo="\\u20d0-\\u20ff",wo=go+xo+vo,Xa="\\u2700-\\u27bf",ei="a-z\\xdf-\\xf6\\xf8-\\xff",bo="\\xac\\xb1\\xd7\\xf7",To="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ro="\\u2000-\\u206f",_o=" \\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",ti="A-Z\\xc0-\\xd6\\xd8-\\xde",ko="\\ufe0e\\ufe0f",ri=bo+To+Ro+_o,ni="['\u2019]",Ja="["+ri+"]",No="["+wo+"]",ai="\\d+",Io="["+Xa+"]",ii="["+ei+"]",si="[^"+Qa+ri+ai+Xa+ei+ti+"]",Co="\\ud83c[\\udffb-\\udfff]",Eo="(?:"+No+"|"+Co+")",Ao="[^"+Qa+"]",oi="(?:\\ud83c[\\udde6-\\uddff]){2}",li="[\\ud800-\\udbff][\\udc00-\\udfff]",ft="["+ti+"]",So="\\u200d",Ha="(?:"+ii+"|"+si+")",Lo="(?:"+ft+"|"+si+")",Ya="(?:"+ni+"(?:d|ll|m|re|s|t|ve))?",Ka="(?:"+ni+"(?:D|LL|M|RE|S|T|VE))?",ui=Eo+"?",ci="["+ko+"]?",Bo="(?:"+So+"(?:"+[Ao,oi,li].join("|")+")"+ci+ui+")*",Po="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Oo=ci+ui+Bo,jo="(?:"+[Io,oi,li].join("|")+")"+Oo,Uo=RegExp([ft+"?"+ii+"+"+Ya+"(?="+[Ja,ft,"$"].join("|")+")",Lo+"+"+Ka+"(?="+[Ja,ft+Ha,"$"].join("|")+")",ft+"?"+Ha+"+"+Ya,ft+"+"+Ka,Fo,Po,ai,jo].join("|"),"g");function Mo(n){return n.match(Uo)||[]}var pi=Mo;function $o(n,e,t){return n=Ae(n),e=t?void 0:e,e===void 0?Ga(n)?pi(n):Za(n):n.match(e)||[]}var di=$o;var Vo="['\u2019]",Do=RegExp(Vo,"g");function qo(n){return function(e){return Da(di(za(e).replace(Do,"")),n,"")}}var fi=qo;var Wo=fi(function(n,e,t){return e=e.toLowerCase(),n+(t?Va(e):e)}),xr=Wo;m();y();h();function $(n){throw new Error("Unexpected value: "+JSON.stringify(n))}m();y();h();function kt(n){return Object.keys(n)}m();y();h();m();y();h();m();y();h();var Nt=T.env.FERN_STACK_TRACK?.toLowerCase()??"",ge=Nt!==""&&Nt!=="0"&&Nt!=="false",vr=["single","multiline","box"].includes(Nt)?Nt:"single";ge&&(Error.stackTraceLimit=50);var zo=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Zo=new Set(["stacktrace"]);function Jt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:l=!0,formatFilename:p=g=>g}={}){if(!ge)return[];r=[...r,...zo],t=[...t,...Zo],a=[...a,"runInteractiveTask"];let g=!1;return(new Error().stack??"").split(`
|
|
2
|
+
`).map(v=>{let N=v.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(N&&N.length===5){let[,P,G,A,O]=N;if(!P||!G||!A||!O)return;if(g||a.some(j=>P?.includes(j))){g=!0;return}switch(P){case"Object.<anonymous>":P="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":P=`${P.substring(P.indexOf(".")+1)}()=> { ... }`;break}return{fn:P,path:p(G),position:`${A}:${O}`}}}).filter(v=>v&&!r.some(N=>v.fn.includes(N))&&!(o&&v.path?.startsWith("node:"))&&!(l&&v.path?.endsWith(".js"))&&!t.some(N=>v.path.includes(N))).slice(e,e+n)}var Gt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:o=[],filterNode:l=!0,filterJs:p=!0,multiline:g=!1,formatFilename:v=N=>N}={}){R(this,"maxFrames");R(this,"skip");R(this,"filterPaths");R(this,"filterFunctions");R(this,"stopOn");R(this,"filterNode");R(this,"filterJs");R(this,"multiline");R(this,"formatFilename");R(this,"tracking",new WeakMap);this.maxFrames=e,this.skip=t,this.filterPaths=r,this.filterFunctions=a,this.stopOn=o,this.filterNode=l,this.filterJs=p,this.multiline=g,this.formatFilename=v}tag(e){let t=this.tracking.get(e)||new Set;Jt({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}},wr;function mi({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:l=!0,multiline:p=!1,formatFilename:g=v=>v}={}){ge&&(wr??(wr=new Gt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:o,filterJs:l,multiline:p,formatFilename:g})))}function hi(n){wr?.tag(n)}function br(n){return wr?.frames(n)??[]}var Ue=class{constructor(){hi(this)}};m();y();h();var Ht=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}dispose(){}},It=class extends Ht{async format(e){return e}formatSync(e){return e}};m();y();h();m();y();h();m();y();h();var me=class extends Ue{constructor(t){super();R(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 Go=4;mi({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Ct=class{constructor(){R(this,"lineBuffer",[]);R(this,"indentLevel",0);R(this,"hasWrittenAnything",!1);R(this,"lastCharacterIsSemicolon",!1);R(this,"lastCharacterIsNewline",!1);R(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,14 +12,14 @@ ${o}`);this.isAtStartOfLine()&&(l=o+l),r&&(l+=`
|
|
|
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 l=e[o];l!=null&&r(l)}}}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(Jt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,vr){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 Go}};m();y();h();function Tr(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 At=class{constructor(e){_(this,"context");this.context=e}async generate(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Et;for(let o of r){let l=this.context.clone(),p=this.createSnippetGenerator(l);try{let g=await p.generateSnippet({endpoint:o,request:e,options:t});if(l.errors.empty())return{snippet:g,errors:void 0};a.update({context:l,snippet:g})}catch(g){a.err==null&&(a.err=g)}}return a.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a;for(let o of r){let l=this.context.clone(),p=this.createSnippetGenerator(l);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.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Et;for(let o of r){let l=this.context.clone(),p=this.createSnippetGenerator(l);try{let g=p.generateSnippetSync({endpoint:o,request:e,options:t});if(l.errors.empty())return{snippet:g,errors:void 0};a.update({context:l,snippet:g})}catch(g){a.err==null&&(a.err=g)}}return a.getResponseOrThrow({endpoint:e.endpoint})}resolveEndpoints({request:e,options:t}){if(t.endpointId!=null){let r=this.context.resolveEndpointById(t.endpointId);if(r==null)throw new Error(`No endpoint found with ID "${t.endpointId}"`);return[r]}return this.context.resolveEndpointLocationOrThrow(e.endpoint)}};m();y();h();m();y();h();m();y();h();var St=class{constructor(){_(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let r=e.match(this.REFERENCE_REGEX);if(!(r==null||r[2]==null||r[3]==null))return{namespace:r[1],method:r[2],path:r[3]}}};m();y();h();var q={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}truncate(e){this.errors.length=e}clone(){let e=new n;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let t=[];for(let r of e){if(typeof r=="string"){t.push(r);continue}t[t.length-1]+=`[${r.index}]`}return t}};var 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 l=e.find(g=>g.name.wireValue===a);if(l==null)throw this.newParameterNotRecognizedError(a);let p=this.isListTypeReference(l.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:l.name,typeReference:l.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:q.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}r.push({name:a.name,typeReference:a.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:e,values:t,ignoreMissingParameters:r}){let a=[],o=new Set;for(let l of e){let p=l.name.wireValue,g=t[p];if(g!==void 0){o.add(p),this.errors.scope(p);try{a.push({name:l.name,typeReference:l.typeReference,value:g})}finally{this.errors.unscope()}}}if(!r){for(let[l,p]of Object.entries(t))if(!(p===void 0||o.has(l))){this.errors.scope(l);try{this.errors.add({severity:q.Critical,message:this.newParameterNotRecognizedError(l).message})}finally{this.errors.unscope()}}}return a}getExampleObjectProperties({parameters:e,snippetObject:t}){let r=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},a=[];for(let o of e){let l=r[o.name.wireValue];l==null?o.typeReference.type==="nullable"&&a.push({name:o.name,typeReference:o.typeReference,value:null}):a.push({name:o.name,typeReference:o.typeReference,value:l})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:q.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:q.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:q.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:q.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:q.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:q.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof o!="string"){this.errors.add({severity:q.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let l=e.types[o];if(l==null){this.errors.add({severity:q.Critical,message:`No type found for discriminant value "${o}"`});return}let{[a]:p,...g}=r;return{singleDiscriminatedUnionType:l,discriminantValue:l.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:$(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:$(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:q.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:q.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:q.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(kt(r.urls));for(let o of kt(e))a.has(o)&&a.delete(o);return a.size>0?(this.errors.add({severity:q.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${kt(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:q.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:q.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:q.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:$(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:$(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:$(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 Ct{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(Jt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,vr){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 Go}};m();y();h();function Tr(n){return n?.name!=null&&n?.assignment!=null}m();y();h();m();y();h();m();y();h();var Et=class{constructor(){R(this,"reporter");R(this,"snippet");R(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 At=class{constructor(e){R(this,"context");this.context=e}async generate(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Et;for(let o of r){let l=this.context.clone(),p=this.createSnippetGenerator(l);try{let g=await p.generateSnippet({endpoint:o,request:e,options:t});if(l.errors.empty())return{snippet:g,errors:void 0};a.update({context:l,snippet:g})}catch(g){a.err==null&&(a.err=g)}}return a.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a;for(let o of r){let l=this.context.clone(),p=this.createSnippetGenerator(l);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.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Et;for(let o of r){let l=this.context.clone(),p=this.createSnippetGenerator(l);try{let g=p.generateSnippetSync({endpoint:o,request:e,options:t});if(l.errors.empty())return{snippet:g,errors:void 0};a.update({context:l,snippet:g})}catch(g){a.err==null&&(a.err=g)}}return a.getResponseOrThrow({endpoint:e.endpoint})}resolveEndpoints({request:e,options:t}){if(t.endpointId!=null){let r=this.context.resolveEndpointById(t.endpointId);if(r==null)throw new Error(`No endpoint found with ID "${t.endpointId}"`);return[r]}return this.context.resolveEndpointLocationOrThrow(e.endpoint)}};m();y();h();m();y();h();m();y();h();var St=class{constructor(){R(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let r=e.match(this.REFERENCE_REGEX);if(!(r==null||r[2]==null||r[3]==null))return{namespace:r[1],method:r[2],path:r[3]}}};m();y();h();var q={Critical:"CRITICAL",Warning:"WARNING"},Lt=class n{constructor(){R(this,"errors");R(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push({...e,path:[...this.path]})}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(t=>t.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}truncate(e){this.errors.length=e}clone(){let e=new n;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let t=[];for(let r of e){if(typeof r=="string"){t.push(r);continue}t[t.length-1]+=`[${r.index}]`}return t}};var Bt=class{constructor({ir:e,config:t,options:r={}}){R(this,"config");R(this,"options");R(this,"errors");R(this,"_ir");R(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 l=e.find(g=>g.name.wireValue===a);if(l==null)throw this.newParameterNotRecognizedError(a);let p=this.isListTypeReference(l.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:l.name,typeReference:l.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:q.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}r.push({name:a.name,typeReference:a.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:e,values:t,ignoreMissingParameters:r}){let a=[],o=new Set;for(let l of e){let p=l.name.wireValue,g=t[p];if(g!==void 0){o.add(p),this.errors.scope(p);try{a.push({name:l.name,typeReference:l.typeReference,value:g})}finally{this.errors.unscope()}}}if(!r){for(let[l,p]of Object.entries(t))if(!(p===void 0||o.has(l))){this.errors.scope(l);try{this.errors.add({severity:q.Critical,message:this.newParameterNotRecognizedError(l).message})}finally{this.errors.unscope()}}}return a}getExampleObjectProperties({parameters:e,snippetObject:t}){let r=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},a=[];for(let o of e){let l=r[o.name.wireValue];l==null?o.typeReference.type==="nullable"&&a.push({name:o.name,typeReference:o.typeReference,value:null}):a.push({name:o.name,typeReference:o.typeReference,value:l})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:q.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:q.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:q.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:q.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:q.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:q.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof o!="string"){this.errors.add({severity:q.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let l=e.types[o];if(l==null){this.errors.add({severity:q.Critical,message:`No type found for discriminant value "${o}"`});return}let{[a]:p,...g}=r;return{singleDiscriminatedUnionType:l,discriminantValue:l.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:$(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:$(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:q.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:q.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:q.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(kt(r.urls));for(let o of kt(e))a.has(o)&&a.delete(o);return a.size>0?(this.errors.add({severity:q.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${kt(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:q.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:q.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:q.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:$(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:$(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:$(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 Ct{constructor({packageName:t,customConfig:r,formatter:a}){super();R(this,"packageName");R(this,"customConfig");R(this,"formatter");R(this,"imports",new Set);R(this,"importedSimpleNames",new Map);this.packageName=t,this.customConfig=r,this.formatter=a??new It}addImport(t){this.imports.add(t)}addReference({name:t,packageName:r}){let a=this.importedSimpleNames.get(t);return a==null?(this.importedSimpleNames.set(t,r),this.imports.add(`${r}.${t}`),{shouldFullyQualify:!1}):a===r?(this.imports.add(`${r}.${t}`),{shouldFullyQualify:!1}):{shouldFullyQualify:!0}}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 F={};Vt(F,{BRAND:()=>vl,DIRTY:()=>Ve,EMPTY_PATH:()=>Ko,INVALID:()=>S,NEVER:()=>nu,OK:()=>re,ParseStatus:()=>ee,Schema:()=>M,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>qe,ZodBoolean:()=>We,ZodBranded:()=>Ot,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>Qt,ZodEffects:()=>fe,ZodEnum:()=>Qe,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>er,ZodIntersection:()=>He,ZodIssueCode:()=>b,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>vt,ZodNaN:()=>bt,ZodNativeEnum:()=>Xe,ZodNever:()=>he,ZodNull:()=>Ge,ZodNullable:()=>we,ZodNumber:()=>De,ZodObject:()=>le,ZodOptional:()=>pe,ZodParsedType:()=>C,ZodPipeline:()=>jt,ZodPromise:()=>Pe,ZodReadonly:()=>rt,ZodRecord:()=>Xt,ZodSchema:()=>M,ZodSet:()=>wt,ZodString:()=>Le,ZodSymbol:()=>gt,ZodTransformer:()=>fe,ZodTuple:()=>ve,ZodType:()=>M,ZodUndefined:()=>Ze,ZodUnion:()=>Je,ZodUnknown:()=>Ne,ZodVoid:()=>xt,addIssueToContext:()=>I,any:()=>Cl,array:()=>Ll,bigint:()=>Rl,boolean:()=>Ni,coerce:()=>ru,custom:()=>Ri,date:()=>_l,datetimeRegex:()=>bi,defaultErrorMap:()=>_e,discriminatedUnion:()=>Ol,effect:()=>Jl,enum:()=>zl,function:()=>Dl,getErrorMap:()=>mt,getParsedType:()=>xe,instanceof:()=>bl,intersection:()=>jl,isAborted:()=>Yt,isAsync:()=>ht,isDirty:()=>Kt,isValid:()=>Se,late:()=>wl,lazy:()=>ql,literal:()=>Wl,makeIssue:()=>Ft,map:()=>$l,nan:()=>Tl,nativeEnum:()=>Zl,never:()=>Al,null:()=>Il,nullable:()=>Yl,number:()=>ki,object:()=>Bl,objectUtil:()=>Rr,oboolean:()=>tu,onumber:()=>eu,optional:()=>Hl,ostring:()=>Xl,pipeline:()=>Ql,preprocess:()=>Kl,promise:()=>Gl,quotelessJson:()=>Jo,record:()=>Ml,set:()=>Vl,setErrorMap:()=>Yo,strictObject:()=>Pl,string:()=>_i,symbol:()=>kl,transformer:()=>Jl,tuple:()=>Ul,undefined:()=>Nl,union:()=>Fl,unknown:()=>El,util:()=>D,void:()=>Sl});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var D;(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 l of a)o[l]=l;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(p=>typeof a[a[p]]!="number"),l={};for(let p of o)l[p]=a[p];return n.objectValues(l)},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 l in a)Object.prototype.hasOwnProperty.call(a,l)&&o.push(l);return o},n.find=(a,o)=>{for(let l of a)if(o(l))return l},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(l=>typeof l=="string"?`'${l}'`:l).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(D||(D={}));var Rr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Rr||(Rr={}));var C=D.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 C.undefined;case"string":return C.string;case"number":return Number.isNaN(n)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(n)?C.array:n===null?C.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?C.promise:typeof Map<"u"&&n instanceof Map?C.map:typeof Set<"u"&&n instanceof Set?C.set:typeof Date<"u"&&n instanceof Date?C.date:C.object;default:return C.unknown}};var b=D.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"]),Jo=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 l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)r._errors.push(t(l));else{let p=r,g=0;for(;g<l.path.length;){let v=l.path[g];g===l.path.length-1?(p[v]=p[v]||{_errors:[]},p[v]._errors.push(t(l))):p[v]=p[v]||{_errors:[]},p=p[v],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,D.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 Ho=(n,e)=>{let t;switch(n.code){case b.invalid_type:n.received===C.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case b.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,D.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:t=`Unrecognized key(s) in object: ${D.joinValues(n.keys,", ")}`;break;case b.invalid_union:t="Invalid input";break;case b.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${D.joinValues(n.options)}`;break;case b.invalid_enum_value:t=`Invalid enum value. Expected ${D.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}"`:D.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,D.assertNever(n)}return{message:t}},_e=Ho;var yi=_e;function Yo(n){yi=n}function mt(){return yi}m();y();h();var Ft=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let p="",g=r.filter(v=>!!v).slice().reverse();for(let v of g)p=v(l,{data:e,defaultError:p}).message;return{...a,path:o,message:p}},Ko=[];function I(n,e){let t=mt(),r=Ft({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===_e?void 0:_e].filter(a=>!!a)});n.common.issues.push(r)}var ee=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 S;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,l=await a.value;r.push({key:o,value:l})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return S;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(r[o.value]=l.value)}return{status:e.value,value:r}}},S=Object.freeze({status:"aborted"}),Ve=n=>({status:"dirty",value:n}),re=n=>({status:"valid",value:n}),Yt=n=>n.status==="aborted",Kt=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}},gi=(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 U(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:(l,p)=>{let{message:g}=n;return l.code==="invalid_enum_value"?{message:g??p.defaultError}:typeof p.data>"u"?{message:g??r??p.defaultError}:l.code!=="invalid_type"?{message:p.defaultError}:{message:g??t??p.defaultError}},description:a}}var M=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 ee,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 gi(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 gi(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 l=e(a),p=()=>o.addIssue({code:b.custom,...r(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(g=>g?!0:(p(),!1)):l?!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 Je.create([this,e],this._def)}and(e){return He.create(this,e,this._def)}transform(e){return new fe({...U(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...U(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Ot({typeName:B.ZodBranded,type:this,...U(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...U(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 jt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Qo=/^c[^\s-]{8,}$/i,Xo=/^[0-9a-z]+$/,el=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tl=/^[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,rl=/^[a-z0-9_-]{21}$/i,nl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,al=/^[-+]?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)?)??$/,il=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_r,ol=/^(?:(?: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])$/,ll=/^(?:(?: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])$/,ul=/^(([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]))$/,cl=/^(([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])$/,pl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vi="((\\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])))",fl=new RegExp(`^${vi}$`);function wi(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 ml(n){return new RegExp(`^${wi(n)}$`)}function bi(n){let e=`${vi}T${wi(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 hl(n,e){return!!((e==="v4"||!e)&&ol.test(n)||(e==="v6"||!e)&&ul.test(n))}function yl(n,e){if(!nl.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 gl(n,e){return!!((e==="v4"||!e)&&ll.test(n)||(e==="v6"||!e)&&cl.test(n))}var Le=class n extends M{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.string,received:o.parsedType}),S}let r=new ee,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),I(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),I(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 l=e.data.length>o.value,p=e.data.length<o.value;(l||p)&&(a=this._getOrReturnCtx(e,a),l?I(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):p&&I(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")il.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")_r||(_r=new RegExp(sl,"u")),_r.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")tl.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")rl.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")Qo.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")Xo.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")el.test(e.data)||(a=this._getOrReturnCtx(e,a),I(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),I(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),I(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),I(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),I(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),I(a,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?bi(o).test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?fl.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?ml(o).test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?al.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?hl(e.data,o.version)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?yl(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?gl(e.data,o.version)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?pl.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?dl.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):D.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,...U(n)});function xl(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(".","")),l=Number.parseInt(e.toFixed(a).replace(".",""));return o%l/10**a}var De=class n extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.number,received:o.parsedType}),S}let r,a=new ee;for(let o of this._def.checks)o.kind==="int"?D.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),I(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),I(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),I(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?xl(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),I(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),I(r,{code:b.not_finite,message:o.message}),a.dirty()):D.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"&&D.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)}};De.create=n=>new De({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...U(n)});var qe=class n extends M{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)!==C.bigint)return this._getInvalidInput(e);let r,a=new ee;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),I(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),I(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),I(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):D.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:b.invalid_type,expected:C.bigint,received:t.parsedType}),S}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,...U(n)});var We=class extends M{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.boolean,received:r.parsedType}),S}return re(e.data)}};We.create=n=>new We({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...U(n)});var ze=class n extends M{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.date,received:o.parsedType}),S}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_date}),S}let r=new ee,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),I(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),I(a,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):D.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,...U(n)});var gt=class extends M{_parse(e){if(this._getType(e)!==C.symbol){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.symbol,received:r.parsedType}),S}return re(e.data)}};gt.create=n=>new gt({typeName:B.ZodSymbol,...U(n)});var Ze=class extends M{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.undefined,received:r.parsedType}),S}return re(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...U(n)});var Ge=class extends M{_parse(e){if(this._getType(e)!==C.null){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.null,received:r.parsedType}),S}return re(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...U(n)});var Be=class extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return re(e.data)}};Be.create=n=>new Be({typeName:B.ZodAny,...U(n)});var Ne=class extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return re(e.data)}};Ne.create=n=>new Ne({typeName:B.ZodUnknown,...U(n)});var he=class extends M{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:b.invalid_type,expected:C.never,received:t.parsedType}),S}};he.create=n=>new he({typeName:B.ZodNever,...U(n)});var xt=class extends M{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.void,received:r.parsedType}),S}return re(e.data)}};xt.create=n=>new xt({typeName:B.ZodVoid,...U(n)});var Ie=class n extends M{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==C.array)return I(t,{code:b.invalid_type,expected:C.array,received:t.parsedType}),S;if(a.exactLength!==null){let l=t.data.length>a.exactLength.value,p=t.data.length<a.exactLength.value;(l||p)&&(I(t,{code:l?b.too_big:b.too_small,minimum:p?a.exactLength.value:void 0,maximum:l?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&&(I(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&&(I(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((l,p)=>a.type._parseAsync(new de(t,l,t.path,p)))).then(l=>ee.mergeArray(r,l));let o=[...t.data].map((l,p)=>a.type._parseSync(new de(t,l,t.path,p)));return ee.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,...U(e)});function yt(n){if(n instanceof le){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=pe.create(yt(r))}return new le({...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 le=class n extends M{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=D.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==C.object){let v=this._getOrReturnCtx(e);return I(v,{code:b.invalid_type,expected:C.object,received:v.parsedType}),S}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),p=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(let v in a.data)l.includes(v)||p.push(v);let g=[];for(let v of l){let N=o[v],P=a.data[v];g.push({key:{status:"valid",value:v},value:N._parse(new de(a,P,a.path,v)),alwaysSet:v in a.data})}if(this._def.catchall instanceof he){let v=this._def.unknownKeys;if(v==="passthrough")for(let N of p)g.push({key:{status:"valid",value:N},value:{status:"valid",value:a.data[N]}});else if(v==="strict")p.length>0&&(I(a,{code:b.unrecognized_keys,keys:p}),r.dirty());else if(v!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let v=this._def.catchall;for(let N of p){let P=a.data[N];g.push({key:{status:"valid",value:N},value:v._parse(new de(a,P,a.path,N)),alwaysSet:N in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let v=[];for(let N of g){let P=await N.key,G=await N.value;v.push({key:P,value:G,alwaysSet:N.alwaysSet})}return v}).then(v=>ee.mergeObjectSync(r,v)):ee.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 D.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 D.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 D.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 D.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 Ti(D.objectKeys(this.shape))}};le.create=(n,e)=>new le({shape:()=>n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...U(e)});le.strictCreate=(n,e)=>new le({shape:()=>n,unknownKeys:"strict",catchall:he.create(),typeName:B.ZodObject,...U(e)});le.lazycreate=(n,e)=>new le({shape:n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...U(e)});var Je=class extends M{_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 l=o.map(p=>new oe(p.ctx.common.issues));return I(t,{code:b.invalid_union,unionErrors:l}),S}if(t.common.async)return Promise.all(r.map(async o=>{let l={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(a);{let o,l=[];for(let g of r){let v={...t,common:{...t.common,issues:[]},parent:null},N=g._parseSync({data:t.data,path:t.path,parent:v});if(N.status==="valid")return N;N.status==="dirty"&&!o&&(o={result:N,ctx:v}),v.common.issues.length&&l.push(v.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let p=l.map(g=>new oe(g));return I(t,{code:b.invalid_union,unionErrors:p}),S}}get options(){return this._def.options}};Je.create=(n,e)=>new Je({options:n,typeName:B.ZodUnion,...U(e)});var ke=n=>n instanceof Ye?ke(n.schema):n instanceof fe?ke(n.innerType()):n instanceof Ke?[n.value]:n instanceof Qe?n.options:n instanceof Xe?D.objectValues(n.enum):n instanceof et?ke(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof pe?[void 0,...ke(n.unwrap())]:n instanceof we?[null,...ke(n.unwrap())]:n instanceof Ot||n instanceof rt?ke(n.unwrap()):n instanceof tt?ke(n._def.innerType):[],Qt=class n extends M{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.object)return I(t,{code:b.invalid_type,expected:C.object,received:t.parsedType}),S;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}):(I(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),S)}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 l=ke(o.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let p of l){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,...U(r)})}};function kr(n,e){let t=xe(n),r=xe(e);if(n===e)return{valid:!0,data:n};if(t===C.object&&r===C.object){let a=D.objectKeys(e),o=D.objectKeys(n).filter(p=>a.indexOf(p)!==-1),l={...n,...e};for(let p of o){let g=kr(n[p],e[p]);if(!g.valid)return{valid:!1};l[p]=g.data}return{valid:!0,data:l}}else if(t===C.array&&r===C.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let l=n[o],p=e[o],g=kr(l,p);if(!g.valid)return{valid:!1};a.push(g.data)}return{valid:!0,data:a}}else return t===C.date&&r===C.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var He=class extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,l)=>{if(Yt(o)||Yt(l))return S;let p=kr(o.value,l.value);return p.valid?((Kt(o)||Kt(l))&&t.dirty(),{status:t.value,value:p.data}):(I(r,{code:b.invalid_intersection_types}),S)};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,l])=>a(o,l)):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}))}};He.create=(n,e,t)=>new He({left:n,right:e,typeName:B.ZodIntersection,...U(t)});var ve=class n extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.array)return I(r,{code:b.invalid_type,expected:C.array,received:r.parsedType}),S;if(r.data.length<this._def.items.length)return I(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&r.data.length>this._def.items.length&&(I(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((l,p)=>{let g=this._def.items[p]||this._def.rest;return g?g._parse(new de(r,l,r.path,p)):null}).filter(l=>!!l);return r.common.async?Promise.all(o).then(l=>ee.mergeArray(t,l)):ee.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,...U(e)})};var Xt=class n extends M{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!==C.object)return I(r,{code:b.invalid_type,expected:C.object,received:r.parsedType}),S;let a=[],o=this._def.keyType,l=this._def.valueType;for(let p in r.data)a.push({key:o._parse(new de(r,p,r.path,p)),value:l._parse(new de(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?ee.mergeObjectAsync(t,a):ee.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof M?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...U(r)}):new n({keyType:Le.create(),valueType:e,typeName:B.ZodRecord,...U(t)})}},vt=class extends M{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!==C.map)return I(r,{code:b.invalid_type,expected:C.map,received:r.parsedType}),S;let a=this._def.keyType,o=this._def.valueType,l=[...r.data.entries()].map(([p,g],v)=>({key:a._parse(new de(r,p,r.path,[v,"key"])),value:o._parse(new de(r,g,r.path,[v,"value"]))}));if(r.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let g of l){let v=await g.key,N=await g.value;if(v.status==="aborted"||N.status==="aborted")return S;(v.status==="dirty"||N.status==="dirty")&&t.dirty(),p.set(v.value,N.value)}return{status:t.value,value:p}})}else{let p=new Map;for(let g of l){let v=g.key,N=g.value;if(v.status==="aborted"||N.status==="aborted")return S;(v.status==="dirty"||N.status==="dirty")&&t.dirty(),p.set(v.value,N.value)}return{status:t.value,value:p}}}};vt.create=(n,e,t)=>new vt({valueType:e,keyType:n,typeName:B.ZodMap,...U(t)});var wt=class n extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.set)return I(r,{code:b.invalid_type,expected:C.set,received:r.parsedType}),S;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(I(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&&(I(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 l(g){let v=new Set;for(let N of g){if(N.status==="aborted")return S;N.status==="dirty"&&t.dirty(),v.add(N.value)}return{status:t.value,value:v}}let p=[...r.data.values()].map((g,v)=>o._parse(new de(r,g,r.path,v)));return r.common.async?Promise.all(p).then(g=>l(g)):l(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,...U(e)});var er=class n extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.function)return I(t,{code:b.invalid_type,expected:C.function,received:t.parsedType}),S;function r(p,g){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),_e].filter(v=>!!v),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(),_e].filter(v=>!!v),issueData:{code:b.invalid_return_type,returnTypeError:g}})}let o={errorMap:t.common.contextualErrorMap},l=t.data;if(this._def.returns instanceof Pe){let p=this;return re(async function(...g){let v=new oe([]),N=await p._def.args.parseAsync(g,o).catch(A=>{throw v.addIssue(r(g,A)),v}),P=await Reflect.apply(l,this,N);return await p._def.returns._def.type.parseAsync(P,o).catch(A=>{throw v.addIssue(a(P,A)),v})})}else{let p=this;return re(function(...g){let v=p._def.args.safeParse(g,o);if(!v.success)throw new oe([r(g,v.error)]);let N=Reflect.apply(l,this,v.data),P=p._def.returns.safeParse(N,o);if(!P.success)throw new oe([a(N,P.error)]);return P.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:ve.create(e).rest(Ne.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(Ne.create()),returns:t||Ne.create(),typeName:B.ZodFunction,...U(r)})}},Ye=class extends M{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,...U(e)});var Ke=class extends M{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return I(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...U(e)});function Ti(n,e){return new Qe({values:n,typeName:B.ZodEnum,...U(e)})}var Qe=class n extends M{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{expected:D.joinValues(r),received:t.parsedType,code:b.invalid_type}),S}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 I(t,{received:t.data,code:b.invalid_enum_value,options:r}),S}return re(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=Ti;var Xe=class extends M{_parse(e){let t=D.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==C.string&&r.parsedType!==C.number){let a=D.objectValues(t);return I(r,{expected:D.joinValues(a),received:r.parsedType,code:b.invalid_type}),S}if(this._cache||(this._cache=new Set(D.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=D.objectValues(t);return I(r,{received:r.data,code:b.invalid_enum_value,options:a}),S}return re(e.data)}get enum(){return this._def.values}};Xe.create=(n,e)=>new Xe({values:n,typeName:B.ZodNativeEnum,...U(e)});var Pe=class extends M{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.promise&&t.common.async===!1)return I(t,{code:b.invalid_type,expected:C.promise,received:t.parsedType}),S;let r=t.parsedType===C.promise?t.data:Promise.resolve(t.data);return re(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,...U(e)});var fe=class extends M{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:l=>{I(r,l),l.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let l=a.transform(r.data,o);if(r.common.async)return Promise.resolve(l).then(async p=>{if(t.value==="aborted")return S;let g=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return g.status==="aborted"?S:g.status==="dirty"?Ve(g.value):t.value==="dirty"?Ve(g.value):g});{if(t.value==="aborted")return S;let p=this._def.schema._parseSync({data:l,path:r.path,parent:r});return p.status==="aborted"?S:p.status==="dirty"?Ve(p.value):t.value==="dirty"?Ve(p.value):p}}if(a.type==="refinement"){let l=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"?S:(p.status==="dirty"&&t.dirty(),l(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"?S:(p.status==="dirty"&&t.dirty(),l(p.value).then(()=>({status:t.value,value:p.value}))))}if(a.type==="transform")if(r.common.async===!1){let l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Se(l))return S;let p=a.transform(l.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(l=>Se(l)?Promise.resolve(a.transform(l.value,o)).then(p=>({status:t.value,value:p})):S);D.assertNever(a)}};fe.create=(n,e,t)=>new fe({schema:n,typeName:B.ZodEffects,effect:e,...U(t)});fe.createWithPreprocess=(n,e,t)=>new fe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...U(t)});var pe=class extends M{_parse(e){return this._getType(e)===C.undefined?re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pe.create=(n,e)=>new pe({innerType:n,typeName:B.ZodOptional,...U(e)});var we=class extends M{_parse(e){return this._getType(e)===C.null?re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.create=(n,e)=>new we({innerType:n,typeName:B.ZodNullable,...U(e)});var et=class extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===C.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,...U(e)});var tt=class extends M{_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,...U(e)});var bt=class extends M{_parse(e){if(this._getType(e)!==C.nan){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.nan,received:r.parsedType}),S}return{status:"valid",value:e.data}}};bt.create=n=>new bt({typeName:B.ZodNaN,...U(n)});var vl=Symbol("zod_brand"),Ot=class extends M{_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}},jt=class n extends M{_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"?S:o.status==="dirty"?(t.dirty(),Ve(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"?S: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 M{_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,...U(e)});function xi(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ri(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(l=>{if(!l){let p=xi(e,r),g=p.fatal??t??!0;a.addIssue({code:"custom",...p,fatal:g})}});if(!o){let l=xi(e,r),p=l.fatal??t??!0;a.addIssue({code:"custom",...l,fatal:p})}}):Be.create()}var wl={object:le.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 bl=(n,e={message:`Input not instance of ${n.name}`})=>Ri(t=>t instanceof n,e),_i=Le.create,ki=De.create,Tl=bt.create,Rl=qe.create,Ni=We.create,_l=ze.create,kl=gt.create,Nl=Ze.create,Il=Ge.create,Cl=Be.create,El=Ne.create,Al=he.create,Sl=xt.create,Ll=Ie.create,Bl=le.create,Pl=le.strictCreate,Fl=Je.create,Ol=Qt.create,jl=He.create,Ul=ve.create,Ml=Xt.create,$l=vt.create,Vl=wt.create,Dl=er.create,ql=Ye.create,Wl=Ke.create,zl=Qe.create,Zl=Xe.create,Gl=Pe.create,Jl=fe.create,Hl=pe.create,Yl=we.create,Kl=fe.createWithPreprocess,Ql=jt.create,Xl=()=>_i().optional(),eu=()=>ki().optional(),tu=()=>Ni().optional(),ru={string:(n=>Le.create({...n,coerce:!0})),number:(n=>De.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 nu=S;m();y();h();var Ii=F.strictObject({title:F.string(),content:F.string()});var Nr=F.object({"base-api-exception-class-name":F.string().optional(),"base-exception-class-name":F.string().optional(),"client-class-name":F.string().optional(),"exported-client-class-name":F.string().optional(),"inline-file-properties":F.boolean().optional(),"inline-path-parameters":F.boolean().optional(),"package-layout":F.enum(["flat","nested"]).optional(),"package-prefix":F.string().optional(),"use-local-date-for-dates":F.boolean().optional(),"custom-dependencies":F.array(F.string()).optional(),"custom-plugins":F.array(F.string()).optional(),"disable-required-property-builder-checks":F.boolean().optional(),"enable-forward-compatible-enums":F.boolean().optional(),"enable-inline-types":F.boolean().optional(),"enable-public-constructors":F.boolean().optional(),"generate-unknown-as-json-node":F.boolean().optional(),"json-include":F.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":F.boolean().optional(),"use-default-request-parameter-values":F.boolean().optional(),"enable-wire-tests":F.boolean().default(!1),"collapse-optional-nullable":F.boolean().optional(),"use-nullable-annotation":F.boolean().optional(),"custom-readme-sections":F.array(Ii).optional(),"custom-pager-name":F.string().optional(),"offset-semantics":F.enum(["item-index","page-index"]).optional(),"default-timeout-in-seconds":F.number().optional(),"gradle-distribution-url":F.string().optional(),"gradle-plugin-management":F.string().optional(),"gradle-central-dependency-management":F.boolean().optional(),"output-directory":F.enum(["source-root","project-root"]).optional(),"custom-interceptors":F.boolean().optional(),"omit-fern-headers":F.boolean().optional(),"retry-status-codes":F.optional(F.enum(["legacy","recommended"])),"enable-gradle-profiling":F.boolean().optional(),"wrapped-aliases":F.boolean().optional(),maxRetries:F.number().int().min(0).optional()});var d={};Vt(d,{Access:()=>Ir,AstNode:()=>Y,Class:()=>nt,ClassInstantiation:()=>at,ClassReference:()=>W,CodeBlock:()=>it,Method:()=>st,MethodInvocation:()=>ot,Parameter:()=>lt,Type:()=>Ut,TypeLiteral:()=>ue,Writer:()=>$e,classReference:()=>ku,class_:()=>_u,codeblock:()=>Ru,instantiateClass:()=>Nu,invokeMethod:()=>Iu,method:()=>Cu,parameter:()=>Eu});m();y();h();m();y();h();m();y();h();var Y=class extends Ue{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 Y{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();var Ir={Public:"public",Protected:"protected",Private:"private"};m();y();h();m();y();h();m();y();h();m();y();h();var W=class extends Y{constructor({name:t,packageName:r,fullyQualified:a,enclosingClasses:o}){super();_(this,"name");_(this,"packageName");_(this,"fullyQualified");_(this,"enclosingClasses");this.name=t,this.packageName=r,this.fullyQualified=a??!1,this.enclosingClasses=o??[]}write(t){let r=this.enclosingClasses[0]??this.name,a=[...this.enclosingClasses,this.name].join(".");if(t.addImport(`${this.packageName}.${r}`),this.fullyQualified){t.write(`${this.packageName}.${a}`);return}t.write(a)}};m();y();h();var Ut=class extends Y{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(au);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.write("String");break;case"dateTime":t.writeNode(ou);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(cu);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(uu);break;case"void":t.write("Void");break;default:$(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(iu),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(su),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Cr),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(pu),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(lu),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},tr=new W({name:"Arrays",packageName:"java.util"}),au=new W({name:"BigInteger",packageName:"java.math"}),xg=new W({name:"HashMap",packageName:"java.util"}),iu=new W({name:"List",packageName:"java.util"}),su=new W({name:"Map",packageName:"java.util"}),ou=new W({name:"OffsetDateTime",packageName:"java.time"}),Cr=new W({name:"Optional",packageName:"java.util"}),lu=new W({name:"Set",packageName:"java.util"}),uu=new W({name:"UUID",packageName:"java.util"}),cu=new W({name:"InputStream",packageName:"java.io"}),pu=new W({name:"Iterable",packageName:"java.lang"});var ue=class n extends Y{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 Y?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:$(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:$(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(d.instantiateClass({classReference:du,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(xu({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=>this.isRequiredBuilderParameter(a))?t.sort((a,o)=>{let l=!this.isRequiredBuilderParameter(a),p=!this.isRequiredBuilderParameter(o);return l&&!p?1:!l&&p?-1:0}):t.sort((a,o)=>{let l=a.value.isOptional(),p=o.value.isOptional();return l&&!p?1:!l&&p?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isRequiredBuilderParameter(t){return t.isRequired!=null?t.isRequired:!this.isNonRequired(t.value)}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=gu({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:mu,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(d.invokeMethod({on:hu,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=vu({entries:r.entries});if(a.length===0){t.write("new "),t.writeNode(rr),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(rr),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:Cr,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"?Er:fu,o=wu({values:r.values});if(r.type==="list"&&r.isParameter&&o.length>0){t.writeNode(d.invokeMethod({on:tr,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:tr,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(Er),t.write("<Object>()");return}t.write("new "),t.writeNode(Er),t.write("<Object>("),t.writeNode(d.invokeMethod({on:tr,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(rr),t.write("<String, Object>()");return}t.writeLine("new "),t.writeNode(rr),t.write("<String, Object>() {{"),t.indent();for(let[o,l]of a)t.write(`put("${o}", `),t.writeNode(n.unknown(l)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(d.invokeMethod({on:yu,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"}},Er=new W({name:"ArrayList",packageName:"java.util"}),du=new W({name:"BigInteger",packageName:"java.math"}),rr=new W({name:"HashMap",packageName:"java.util"}),fu=new W({name:"HashSet",packageName:"java.util"}),Eg=new W({name:"List",packageName:"java.util"}),mu=new W({name:"LocalDate",packageName:"java.time"}),Ag=new W({name:"Map",packageName:"java.util"}),hu=new W({name:"OffsetDateTime",packageName:"java.time"}),Sg=new W({name:"Set",packageName:"java.util"}),yu=new W({name:"UUID",packageName:"java.util"});function gu({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function xu({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function vu({entries:n}){return n.filter(e=>!ue.isNop(e.key)&&!ue.isNop(e.value))}function wu({values:n}){return n.filter(e=>!ue.isNop(e))}function nr({writer:n,arguments_:e}){let t=Tu(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof ue&&!a.shouldWriteInLine())){bu({writer:n,arguments_:t});return}n.write("("),t.forEach((a,o)=>{o>0&&n.write(", "),Ci({writer:n,argument:a})}),n.write(")")}function bu({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Ci({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Ci({writer:n,argument:e}){Tr(e)?n.writeNodeOrString(e.assignment):e.write(n)}function Tu(n){return n.filter(e=>!(e instanceof ue&&ue.isNop(e)))}var at=class extends Y{constructor({classReference:t,arguments_:r}){super();_(this,"classReference");_(this,"arguments_");this.classReference=t,this.arguments_=r}write(t){t.writeNode(this.classReference),nr({writer:t,arguments_:this.arguments_})}};m();y();h();var it=class extends Y{constructor(t){super();_(this,"arg");this.arg=t}write(t){return new me(this.arg).write(t)}};m();y();h();var st=class extends Y{constructor({name:t,access:r,parameters:a,body:o,static_:l,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_=l??!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 Y{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),nr({writer:t,arguments_:this.arguments_})}};m();y();h();var lt=class extends Y{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 Ru(n){return new it(n)}function _u(n){return new nt(n)}function ku(n){return new W(n)}function Nu(n){return new at(n)}function Iu(n){return new ot(n)}function Cu(n){return new st(n)}function Eu(n){return new lt(n)}m();y();h();var Au=new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while","true","false","null","_"]);function Ei(n){return Au.has(n.toLowerCase())}function Ar(n){return Ei(n)?"_"+n:n}m();y();h();var ar=class{constructor({context:e}){_(this,"context");this.context=e}usesOptionalNullable(){return this.context.usesOptionalNullable()}usesNullableAnnotation(){return this.context.usesNullableAnnotation()}wrapInOptionalIfNotNop(e,t=!1,r=!1){return d.TypeLiteral.isNop(e)?e:r?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:t})}wrapNullableOrOptionalValue({value:e,wrapperType:t,useOf:r,propagatedCollapse:a}){return d.TypeLiteral.isNop(e)||t==="nullable"&&this.usesNullableAnnotation()?e:a||this.usesOptionalNullable()&&t==="nullable"?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:r})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:q.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,nestedClassReference:e.nestedClassReference});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,nestedClassReference:e.nestedClassReference});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,nestedClassReference:e.nestedClassReference})}case"nullable":case"optional":{let t=e.typeReference.type,r=e.typeReference.value;if((e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&r.type==="named")&&!(t==="nullable"&&this.usesNullableAnnotation()))return e.isCollapsedOptionalNullable||this.usesOptionalNullable()&&(t==="nullable"||r.type==="optional"||r.type==="nullable")?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(this.usesOptionalNullable()&&(r.type==="optional"||r.type==="nullable"))return this.convert({typeReference:r,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion,isCollapsedOptionalNullable:!0,nestedClassReference:e.nestedClassReference});if(r.type==="list"){let l=this.convertList({list:r.value,value:e.value,nestedClassReference:e.nestedClassReference});return this.wrapNullableOrOptionalValue({value:l,wrapperType:t,useOf:!0,propagatedCollapse:e.isCollapsedOptionalNullable===!0})}let a=this.convert({typeReference:r,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion,nestedClassReference:e.nestedClassReference}),o=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapNullableOrOptionalValue({value:a,wrapperType:t,useOf:o,propagatedCollapse:e.isCollapsedOptionalNullable===!0})}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,nestedClassReference:e.nestedClassReference});case"unknown":return this.convertUnknown({value:e.value});default:$(e.typeReference)}}convertList({list:e,value:t,as:r,nestedClassReference:a}){if(!Array.isArray(t))return this.context.errors.add({severity:q.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop();let o=e.type==="optional"||e.type==="nullable";return d.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((l,p)=>{this.context.errors.scope({index:p});try{if(o&&(e.type==="optional"||e.type==="nullable")){let g=this.convert({typeReference:e.value,value:l,as:r,nestedClassReference:a});return this.wrapNullableOrOptionalValue({value:g,wrapperType:e.type,useOf:!0,propagatedCollapse:!1})}return this.convert({typeReference:e,value:l,as:r,nestedClassReference:a})}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:$(e)}}convertSet({set:e,value:t,as:r,nestedClassReference:a}){return Array.isArray(t)?d.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((o,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:e,value:o,as:r,nestedClassReference:a})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:q.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop())}convertMap({map:e,value:t,as:r,nestedClassReference:a}){return typeof t!="object"||t==null?(this.context.errors.add({severity:q.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(([o,l])=>{this.context.errors.scope(o);try{return{key:this.convert({typeReference:e.key,value:o,as:"mapKey"}),value:this.convert({typeReference:e.value,value:l,as:"mapValue",nestedClassReference:a})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o}){switch(e.type){case"alias":if(e.typeReference.type==="unknown"){let l=this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});return d.TypeLiteral.reference(d.invokeMethod({on:o??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[l]}))}return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t,as:r,nestedClassReference:o});case"enum":return this.convertEnum({enum_:e,value:t,nestedClassReference:o});case"object":return this.convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,as:r,nestedClassReference:o});default:$(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t,as:r,nestedClassReference:a}){let o=a??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),l=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(l==null)return d.TypeLiteral.nop();let p=l.singleDiscriminatedUnionType,g=new Set([...o.enclosingClasses,o.name]),v=new Set(Object.values(e.types).map(N=>this.context.getClassName(N.discriminantValue.name)));switch(p.type){case"samePropertiesAsObject":{let N=this.context.resolveNamedType({typeId:p.typeId});if(N==null)return d.TypeLiteral.nop();let P=this.resolveInlineNestedClassReference({enclosing:o,baseName:this.context.getClassName(p.discriminantValue.name),typeReference:{type:"named",value:p.typeId},reservedNames:g,siblingPropertyNames:v});return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[this.convertNamed({named:N,value:l.value,as:r,nestedClassReference:P})]}))}case"singleProperty":{let N=this.context.getRecord(l.value);if(N==null)return d.TypeLiteral.nop();try{this.context.errors.scope(p.discriminantValue.wireValue);let P="value",G=this.resolveInlineNestedClassReference({enclosing:o,baseName:this.context.getClassName(p.discriminantValue.name),typeReference:p.typeReference,reservedNames:g,siblingPropertyNames:v});return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[this.convert({typeReference:p.typeReference,value:N[P],as:r,nestedClassReference:G})]}))}finally{this.context.errors.unscope()}}case"noProperties":return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[]}));default:$(p)}}convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o}){let l=o??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),p=this.context.getRecord(t)??{},g=this.context.associateByWireValue({parameters:e.properties,values:p}),v=new Set(g.map(L=>L.name.wireValue));for(let L of e.properties)if(!v.has(L.name.wireValue)&&!this.context.isOptional(L.typeReference)){if(a===!0)throw new Error(`Required property "${L.name.wireValue}" is missing from value`);let z=this.getDefaultValueForTypeReference(L.typeReference);z!==void 0&&g.push({name:L.name,typeReference:L.typeReference,value:z})}let N=new Map,P=new Set;e.properties.forEach((L,z)=>{N.set(L.name.wireValue,z),P.add(L.name.wireValue)}),g.sort((L,z)=>(N.get(L.name.wireValue)??0)-(N.get(z.name.wireValue)??0));let G=r==="request"?g.filter(L=>!this.context.isDirectLiteral(L.typeReference)):g,A=new Set([...l.enclosingClasses,l.name]),O=new Set(e.properties.map(L=>this.context.getClassName(L.name.name))),j=[];for(let L of G){this.context.errors.scope(L.name.wireValue);try{let z=this.convert({typeReference:L.typeReference,value:L.value,as:r,inUndiscriminatedUnion:a,nestedClassReference:this.resolveInlineNestedClassReference({enclosing:l,baseName:this.context.getClassName(L.name.name),typeReference:L.typeReference,reservedNames:A,siblingPropertyNames:O})});if(d.TypeLiteral.isNop(z)&&!this.context.isOptional(L.typeReference)){if(a===!0)throw new Error(`Required property "${L.name.wireValue}" could not be converted`);continue}j.push({name:this.context.getMethodName(L.name.name),value:z,isRequired:this.isStagedBuilderProperty(L.typeReference)})}finally{this.context.errors.unscope()}}for(let[L,z]of Object.entries(p))if(!P.has(L)&&z!==void 0){let H=this.convertToRawJavaLiteral(z);H!=null&&j.push({name:"additionalProperty",value:d.TypeLiteral.raw(`"${this.escapeJavaString(L)}", ${H}`),isRequired:!1})}return d.TypeLiteral.builder({classReference:l,parameters:j})}resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:r,reservedNames:a,siblingPropertyNames:o}){if(this.context.enableInlineTypes())switch(r.type){case"optional":case"nullable":return this.resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"list":case"set":return this.resolveInlineNestedClassReference({enclosing:e,baseName:`${t}Item`,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"map":return this.resolveInlineNestedClassReference({enclosing:e,baseName:`${t}Value`,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"named":{let l=r.value,p=this.context.resolveNamedType({typeId:l});if(p==null)return;if(p.type==="alias"&&!this.context.wrappedAliases())return this.resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:p.typeReference,reservedNames:a,siblingPropertyNames:o});if(!this.context.isInlineType(l))return;let g=t;for(;a.has(g)||o.has(g)&&g!==t;)g=`${g}_`;return a.add(g),this.context.getNestedInlineClassReference({enclosing:e,name:g})}case"primitive":case"literal":case"unknown":return;default:$(r)}}resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t,reservedNames:r,unionPrefix:a}){if(this.context.enableInlineTypes())switch(t.type){case"optional":case"nullable":case"list":case"set":return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t.value,reservedNames:r,unionPrefix:a});case"map":return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t.value,reservedNames:r,unionPrefix:a});case"named":{let o=t.value,l=this.context.resolveNamedType({typeId:o});if(l==null)return;if(l.type==="alias"&&!this.context.wrappedAliases())return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:l.typeReference,reservedNames:r,unionPrefix:a});if(!this.context.isInlineType(o))return;let p=this.context.getClassName(l.declaration.name);for(p.startsWith(a)&&p!==a&&(p=p.substring(a.length));r.has(p);)p=`${p}_`;return this.context.getNestedInlineClassReference({enclosing:e,name:p})}case"primitive":case"literal":case"unknown":return;default:$(t)}}isStagedBuilderProperty(e){switch(e.type){case"optional":case"nullable":case"list":case"set":case"map":return!1;case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t!=null&&t.type==="alias"?this.isStagedBuilderProperty(t.typeReference):!0}default:return!0}}convertToRawJavaLiteral(e){return typeof e=="string"?`"${this.escapeJavaString(e)}"`:typeof e=="number"||typeof e=="boolean"?e.toString():e===null?"null":null}escapeJavaString(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}getDefaultValueForTypeReference(e){switch(e.type){case"primitive":return this.getDefaultPrimitiveValue(e.value);case"nullable":return null;case"optional":return;case"list":case"set":return[];case"map":return{};case"named":{let t=this.context.resolveNamedType({typeId:e.value});if(t==null)return{};switch(t.type){case"enum":if(t.values.length>0){let r=t.values[0];return r?.wireValue}return;case"object":case"alias":return{};case"discriminatedUnion":case"undiscriminatedUnion":return;default:return{}}}case"literal":return e.value.value;case"unknown":return{};default:$(e)}}getDefaultPrimitiveValue(e){switch(e){case"STRING":return"string";case"INTEGER":case"UINT":return 1;case"LONG":case"UINT_64":return 1e6;case"FLOAT":case"DOUBLE":return 1.1;case"BOOLEAN":return!0;case"DATE":return"2024-01-15";case"DATE_TIME":return"2024-01-15T09:30:00Z";case"DATE_TIME_RFC_2822":return"Tue, 15 Jan 2024 09:30:00 +0000";case"UUID":return"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32";case"BASE_64":return"SGVsbG8gd29ybGQh";case"BIG_INTEGER":return"123456789";default:return"string"}}convertEnum({enum_:e,value:t,nestedClassReference:r}){let a=this.getEnumValueName({enum_:e,value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.enum_({classReference:r??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:a})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:q.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:q.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,as:r,nestedClassReference:a}){let o=a??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),l=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,as:r,enclosing:o});return l==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.invokeMethod({on:o,method:"of",arguments_:[l.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,as:r,enclosing:a}){let o=new Set([...a.enclosingClasses,a.name]),l=this.context.getClassName(e.declaration.name);for(let p of e.types){let g=this.context.errors.size();try{let v=this.convert({typeReference:p,value:t,as:r,inUndiscriminatedUnion:!0,nestedClassReference:this.resolveUndiscriminatedInlineNestedClassReference({enclosing:a,typeReference:p,reservedNames:new Set(o),unionPrefix:l})});if(d.TypeLiteral.isNop(v)||this.context.errors.size()>g){this.context.errors.truncate(g);continue}return{valueTypeReference:p,typeInstantiation:v}}catch{this.context.errors.truncate(g);continue}}this.context.errors.add({severity:q.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}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:$(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"DATE_TIME_RFC_2822":return"DateTimeRfc2822";case"BASE_64":return"Base64";default:$(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":case"DATE_TIME_RFC_2822":{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:$(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 ir=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":{let t=e.typeReference.value;return this.context.usesOptionalNullable()&&(t.type==="nullable"||t.type==="optional")?d.Type.generic(this.context.getOptionalNullableClassReference(),[this.convert({typeReference:t.value})]):d.Type.optional(this.convert({typeReference:t}))}case"nullable":{let t=e.typeReference.value;if(this.context.usesNullableAnnotation())return this.convert({typeReference:t});if(this.context.usesOptionalNullable()){let r=t.type==="optional"||t.type==="nullable"?t.value:t;return d.Type.generic(this.context.getOptionalNullableClassReference(),[this.convert({typeReference:r})])}return d.Type.optional(this.convert({typeReference:t}))}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:$(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:$(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":case"DATE_TIME_RFC_2822":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:$(e)}}};m();y();h();var sr=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:$(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return this.context.shouldInlineFileProperties()?this.context.getJavaIoFileFromString(r??"path/to/file"):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(this.context.shouldInlineFileProperties()){let a=r?.[0]??"path/to/file";return this.context.getJavaIoFileFromString(a)}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 Su=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch"]),Lu=new Set(["getClass","notify","notifyAll","wait"]),or=class n extends Bt{constructor({ir:t,config:r,options:a,sharedCustomConfig:o,inlineTypeIds:l}){super({ir:t,config:r,options:a});_(this,"ir");_(this,"customConfig");_(this,"dynamicTypeMapper");_(this,"dynamicTypeLiteralMapper");_(this,"filePropertyMapper");_(this,"inlineTypeIds");this.ir=t,this.customConfig=o??Nr.parse(r.customConfig??{}),this.dynamicTypeMapper=new ir({context:this}),this.dynamicTypeLiteralMapper=new ar({context:this}),this.filePropertyMapper=new sr({context:this}),this.inlineTypeIds=l??new Set}clone(){return new n({ir:this.ir,config:this.config,options:this.options,sharedCustomConfig:this.customConfig,inlineTypeIds:this.inlineTypeIds})}isInlineType(t){return this.inlineTypeIds.has(t)}getNestedInlineClassReference({enclosing:t,name:r}){return d.classReference({name:r,packageName:t.packageName,enclosingClasses:[...t.enclosingClasses,t.name]})}wrappedAliases(){return this.customConfig?.["wrapped-aliases"]??!1}enableInlineTypes(){return this.customConfig?.["enable-inline-types"]??!1}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.getRootClientClassNameForSnippets(),packageName:this.getRootPackageName()})}getRootClientClassName(){return this.customConfig?.["client-class-name"]??`${this.getBaseNamePrefix()}Client`}getRootClientClassNameForSnippets(){return this.customConfig?.["exported-client-class-name"]??this.getRootClientClassName()}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("(new "),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getJavaIoFileFromString(t){return d.TypeLiteral.reference(d.codeblock(r=>{r.write("new "),r.writeNode(this.getJavaIoFileClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(")")}))}getJavaIoFileClassReference(){return d.classReference({name:"File",packageName:"java.io"})}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:$(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:$(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=[],l=[];for(let p of t)this.isOptional(p.typeReference)?l.push(p):o.push(p);return o.sort((p,g)=>(a.get(p.name.wireValue)??0)-(a.get(g.name.wireValue)??0)),[...o,...l]}associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}){let o=super.associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}),l=new Map;for(let g of o)l.set(g.name.wireValue,g);let p=[];for(let g of t){let v=l.get(g.name.wireValue);v!=null&&p.push(v)}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();return this.getPackageLayout()==="flat"?t!=null&&a.push(...t.packagePath.map(o=>this.getPackageNameSegment(o))):(t!=null&&t.allParts.length>0&&a.push("resources"),t!=null&&a.push(...t.allParts.map(o=>this.getPackageNameSegment(o)))),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}usesNullableAnnotation(){return this.customConfig?.["use-nullable-annotation"]===!0}usesOptionalNullable(){return this.customConfig?.["collapse-optional-nullable"]===!0}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 xr(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:Ar(a)).join(".")}getName(t){return this.isReservedName(t)?"_"+t:t}isReservedName(t){return Su.has(t)}isReservedMethodName(t){return Lu.has(t)}};m();y();h();var Ai="com.example.usage",Bu="Example",Pu="main",Fu="args",Si="client",Ou={type:"primitive",value:"STRING"};function Sr(n){let e=n;for(;e.type==="optional"||e.type==="nullable";)e=e.value;return e}function ju(n){if(n.type==="optional"&&n.value.type==="list"){let e=n.value.value,t=Sr(e);return t===e?n:{type:"optional",value:{type:"list",value:t}}}if(n.type==="list"){let e=Sr(n.value);return e===n.value?n:{type:"list",value:e}}return n}var lr=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??Ai,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??Ai,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(l=>{l.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),l.newLine(),l.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:$(o)}}constructClient({endpoint:e,snippet:t}){let r=e.auth?.type==="oauth";return d.codeblock(a=>{if(a.writeNode(this.context.getRootClientClassReference()),a.write(` ${Si} = `),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 l=this.getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t});for(let p of l)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??Bu,access:d.Access.Public}),o=d.parameter({name:Fu,type:d.Type.array(d.Type.string())});return a.addMethod(d.method({name:Pu,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:q.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:q.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:q.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:q.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:Ou,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:$(e)}}addError(e){this.context.errors.add({severity:q.Critical,message:e})}addWarning(e){this.context.errors.add({severity:q.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){let r=e,a=!!r.usernameOmit,o=!!r.passwordOmit,l=[];return a||l.push(`"${t.username}"`),o||l.push(`"${t.password}"`),l.length===0?[]:[{name:"credentials",value:d.TypeLiteral.raw(l.join(", "))}]}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=t[a.name.wireValue],l=this.getRootClientHeaderArg({header:a,value:o});l!=null&&r.push({name:this.context.getMethodName(a.name.name),value:l})}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(Si),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:$(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(se.PathParameters);let a=(e.pathParameters??[]).filter(l=>l.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(l=>l.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"){let r=this.usesOptionalNullable()&&(e.value.value.type==="optional"||e.value.value.type==="nullable");if(t==null)return r?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let a=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t,as:"request",isCollapsedOptionalNullable:r}),o=a.toString({packageName:"com.example",customConfig:this.context.customConfig});if(o.includes("Optional.empty()")||o.includes("OptionalNullable.absent()"))return a;let l=this.context.dynamicTypeLiteralMapper.convert({typeReference:Sr(e.value),value:t,as:"request"});return r?this.context.getOptionalNullableOf(l):d.TypeLiteral.optional({value:l,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:$(e)}}getBytesBodyRequestArg({value:e}){return e==null?d.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:q.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 l=[],p=(e.pathParameters??[]).filter(v=>v.variable==null);p.length>0&&l.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(...l.map(v=>v.value)),o||r.push(...g.fileFields.map(v=>d.TypeLiteral.isNop(v.value)?d.TypeLiteral.raw("null"):v.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?l:[],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 l=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).filter(j=>!this.context.isDirectLiteral(j.typeReference)),g=this.context.sortTypeInstancesByRequiredFirst(l,e.queryParameters??[]).map(j=>({name:this.context.getMethodName(j.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:ju(j.typeReference),value:j.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.Headers);let N=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).filter(j=>!this.context.isDirectLiteral(j.typeReference)),G=this.context.sortTypeInstancesByRequiredFirst(N,e.headers??[]).map(j=>({name:this.context.getMethodName(j.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:j.typeReference,value:j.value,as:"request"})}));this.context.errors.unscope();let A=d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)});this.context.errors.scope(se.RequestBody);let O=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a,enclosing:A}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:A,parameters:[...r,...G,...g,...O]})}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()}),l=d.invokeMethod({on:o,method:"builder",arguments_:[]});for(let g of a)l=d.invokeMethod({on:l,method:"addHeader",arguments_:[d.TypeLiteral.string(g.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(g)]});let p=d.invokeMethod({on:l,method:"build",arguments_:[]});return d.TypeLiteral.reference(p)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r,enclosing:a}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t,enclosing:a});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:$(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.bodyPropertyFields,...e.fileFields]: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:$(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t,enclosing:r}){let o=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}}).filter(v=>!this.context.isDirectLiteral(v.typeReference)),l=this.context.sortTypeInstancesByRequiredFirst(o,e),p=new Set([...r.enclosingClasses,r.name]),g=new Set(e.map(v=>this.context.getClassName(v.name.name)));return l.map(v=>({name:this.context.getMethodName(v.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:v.typeReference,value:v.value,as:"request",nestedClassReference:this.context.dynamicTypeLiteralMapper.resolveInlineNestedClassReference({enclosing:r,baseName:this.context.getClassName(v.name.name),typeReference:v.typeReference,reservedNames:p,siblingPropertyNames:g})})}))}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{},ignoreMissingParameters:!0});for(let o of a)r.push({name:this.context.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 ur=class extends At{constructor({ir:e,config:t,options:r={},inlineTypeIds:a}){super(new or({ir:e,config:t,options:r,inlineTypeIds:a}))}async generate(e,t={}){return super.generate(e,t)}generateSync(e,t={}){return super.generateSync(e,t)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new lr({context:e})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
22
|
+
`)}};m();y();h();m();y();h();var F={};Vt(F,{BRAND:()=>vl,DIRTY:()=>Ve,EMPTY_PATH:()=>Ko,INVALID:()=>S,NEVER:()=>nu,OK:()=>re,ParseStatus:()=>ee,Schema:()=>M,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>qe,ZodBoolean:()=>We,ZodBranded:()=>Ot,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>Qt,ZodEffects:()=>fe,ZodEnum:()=>Qe,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>er,ZodIntersection:()=>He,ZodIssueCode:()=>b,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>vt,ZodNaN:()=>bt,ZodNativeEnum:()=>Xe,ZodNever:()=>he,ZodNull:()=>Ge,ZodNullable:()=>we,ZodNumber:()=>De,ZodObject:()=>le,ZodOptional:()=>pe,ZodParsedType:()=>C,ZodPipeline:()=>jt,ZodPromise:()=>Pe,ZodReadonly:()=>rt,ZodRecord:()=>Xt,ZodSchema:()=>M,ZodSet:()=>wt,ZodString:()=>Le,ZodSymbol:()=>gt,ZodTransformer:()=>fe,ZodTuple:()=>ve,ZodType:()=>M,ZodUndefined:()=>Ze,ZodUnion:()=>Je,ZodUnknown:()=>Ne,ZodVoid:()=>xt,addIssueToContext:()=>I,any:()=>Cl,array:()=>Ll,bigint:()=>Rl,boolean:()=>Ni,coerce:()=>ru,custom:()=>Ri,date:()=>_l,datetimeRegex:()=>bi,defaultErrorMap:()=>_e,discriminatedUnion:()=>Ol,effect:()=>Jl,enum:()=>zl,function:()=>Dl,getErrorMap:()=>mt,getParsedType:()=>xe,instanceof:()=>bl,intersection:()=>jl,isAborted:()=>Yt,isAsync:()=>ht,isDirty:()=>Kt,isValid:()=>Se,late:()=>wl,lazy:()=>ql,literal:()=>Wl,makeIssue:()=>Ft,map:()=>$l,nan:()=>Tl,nativeEnum:()=>Zl,never:()=>Al,null:()=>Il,nullable:()=>Yl,number:()=>ki,object:()=>Bl,objectUtil:()=>Rr,oboolean:()=>tu,onumber:()=>eu,optional:()=>Hl,ostring:()=>Xl,pipeline:()=>Ql,preprocess:()=>Kl,promise:()=>Gl,quotelessJson:()=>Jo,record:()=>Ml,set:()=>Vl,setErrorMap:()=>Yo,strictObject:()=>Pl,string:()=>_i,symbol:()=>kl,transformer:()=>Jl,tuple:()=>Ul,undefined:()=>Nl,union:()=>Fl,unknown:()=>El,util:()=>D,void:()=>Sl});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var D;(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 l of a)o[l]=l;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(p=>typeof a[a[p]]!="number"),l={};for(let p of o)l[p]=a[p];return n.objectValues(l)},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 l in a)Object.prototype.hasOwnProperty.call(a,l)&&o.push(l);return o},n.find=(a,o)=>{for(let l of a)if(o(l))return l},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(l=>typeof l=="string"?`'${l}'`:l).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(D||(D={}));var Rr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Rr||(Rr={}));var C=D.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 C.undefined;case"string":return C.string;case"number":return Number.isNaN(n)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(n)?C.array:n===null?C.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?C.promise:typeof Map<"u"&&n instanceof Map?C.map:typeof Set<"u"&&n instanceof Set?C.set:typeof Date<"u"&&n instanceof Date?C.date:C.object;default:return C.unknown}};var b=D.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"]),Jo=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 l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)r._errors.push(t(l));else{let p=r,g=0;for(;g<l.path.length;){let v=l.path[g];g===l.path.length-1?(p[v]=p[v]||{_errors:[]},p[v]._errors.push(t(l))):p[v]=p[v]||{_errors:[]},p=p[v],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,D.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 Ho=(n,e)=>{let t;switch(n.code){case b.invalid_type:n.received===C.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case b.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,D.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:t=`Unrecognized key(s) in object: ${D.joinValues(n.keys,", ")}`;break;case b.invalid_union:t="Invalid input";break;case b.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${D.joinValues(n.options)}`;break;case b.invalid_enum_value:t=`Invalid enum value. Expected ${D.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}"`:D.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,D.assertNever(n)}return{message:t}},_e=Ho;var yi=_e;function Yo(n){yi=n}function mt(){return yi}m();y();h();var Ft=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let p="",g=r.filter(v=>!!v).slice().reverse();for(let v of g)p=v(l,{data:e,defaultError:p}).message;return{...a,path:o,message:p}},Ko=[];function I(n,e){let t=mt(),r=Ft({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===_e?void 0:_e].filter(a=>!!a)});n.common.issues.push(r)}var ee=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 S;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,l=await a.value;r.push({key:o,value:l})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return S;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(r[o.value]=l.value)}return{status:e.value,value:r}}},S=Object.freeze({status:"aborted"}),Ve=n=>({status:"dirty",value:n}),re=n=>({status:"valid",value:n}),Yt=n=>n.status==="aborted",Kt=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}},gi=(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 U(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:(l,p)=>{let{message:g}=n;return l.code==="invalid_enum_value"?{message:g??p.defaultError}:typeof p.data>"u"?{message:g??r??p.defaultError}:l.code!=="invalid_type"?{message:p.defaultError}:{message:g??t??p.defaultError}},description:a}}var M=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 ee,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 gi(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 gi(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 l=e(a),p=()=>o.addIssue({code:b.custom,...r(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(g=>g?!0:(p(),!1)):l?!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 Je.create([this,e],this._def)}and(e){return He.create(this,e,this._def)}transform(e){return new fe({...U(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...U(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Ot({typeName:B.ZodBranded,type:this,...U(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...U(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 jt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Qo=/^c[^\s-]{8,}$/i,Xo=/^[0-9a-z]+$/,el=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tl=/^[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,rl=/^[a-z0-9_-]{21}$/i,nl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,al=/^[-+]?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)?)??$/,il=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_r,ol=/^(?:(?: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])$/,ll=/^(?:(?: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])$/,ul=/^(([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]))$/,cl=/^(([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])$/,pl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vi="((\\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])))",fl=new RegExp(`^${vi}$`);function wi(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 ml(n){return new RegExp(`^${wi(n)}$`)}function bi(n){let e=`${vi}T${wi(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 hl(n,e){return!!((e==="v4"||!e)&&ol.test(n)||(e==="v6"||!e)&&ul.test(n))}function yl(n,e){if(!nl.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 gl(n,e){return!!((e==="v4"||!e)&&ll.test(n)||(e==="v6"||!e)&&cl.test(n))}var Le=class n extends M{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.string,received:o.parsedType}),S}let r=new ee,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),I(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),I(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 l=e.data.length>o.value,p=e.data.length<o.value;(l||p)&&(a=this._getOrReturnCtx(e,a),l?I(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):p&&I(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")il.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")_r||(_r=new RegExp(sl,"u")),_r.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")tl.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")rl.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")Qo.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")Xo.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")el.test(e.data)||(a=this._getOrReturnCtx(e,a),I(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),I(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),I(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),I(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),I(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),I(a,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?bi(o).test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?fl.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?ml(o).test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?al.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?hl(e.data,o.version)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?yl(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?gl(e.data,o.version)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?pl.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?dl.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):D.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,...U(n)});function xl(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(".","")),l=Number.parseInt(e.toFixed(a).replace(".",""));return o%l/10**a}var De=class n extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.number,received:o.parsedType}),S}let r,a=new ee;for(let o of this._def.checks)o.kind==="int"?D.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),I(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),I(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),I(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?xl(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),I(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),I(r,{code:b.not_finite,message:o.message}),a.dirty()):D.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"&&D.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)}};De.create=n=>new De({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...U(n)});var qe=class n extends M{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)!==C.bigint)return this._getInvalidInput(e);let r,a=new ee;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),I(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),I(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),I(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):D.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:b.invalid_type,expected:C.bigint,received:t.parsedType}),S}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,...U(n)});var We=class extends M{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.boolean,received:r.parsedType}),S}return re(e.data)}};We.create=n=>new We({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...U(n)});var ze=class n extends M{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.date,received:o.parsedType}),S}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_date}),S}let r=new ee,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),I(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),I(a,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):D.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,...U(n)});var gt=class extends M{_parse(e){if(this._getType(e)!==C.symbol){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.symbol,received:r.parsedType}),S}return re(e.data)}};gt.create=n=>new gt({typeName:B.ZodSymbol,...U(n)});var Ze=class extends M{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.undefined,received:r.parsedType}),S}return re(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...U(n)});var Ge=class extends M{_parse(e){if(this._getType(e)!==C.null){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.null,received:r.parsedType}),S}return re(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...U(n)});var Be=class extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return re(e.data)}};Be.create=n=>new Be({typeName:B.ZodAny,...U(n)});var Ne=class extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return re(e.data)}};Ne.create=n=>new Ne({typeName:B.ZodUnknown,...U(n)});var he=class extends M{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:b.invalid_type,expected:C.never,received:t.parsedType}),S}};he.create=n=>new he({typeName:B.ZodNever,...U(n)});var xt=class extends M{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.void,received:r.parsedType}),S}return re(e.data)}};xt.create=n=>new xt({typeName:B.ZodVoid,...U(n)});var Ie=class n extends M{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==C.array)return I(t,{code:b.invalid_type,expected:C.array,received:t.parsedType}),S;if(a.exactLength!==null){let l=t.data.length>a.exactLength.value,p=t.data.length<a.exactLength.value;(l||p)&&(I(t,{code:l?b.too_big:b.too_small,minimum:p?a.exactLength.value:void 0,maximum:l?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&&(I(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&&(I(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((l,p)=>a.type._parseAsync(new de(t,l,t.path,p)))).then(l=>ee.mergeArray(r,l));let o=[...t.data].map((l,p)=>a.type._parseSync(new de(t,l,t.path,p)));return ee.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,...U(e)});function yt(n){if(n instanceof le){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=pe.create(yt(r))}return new le({...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 le=class n extends M{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=D.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==C.object){let v=this._getOrReturnCtx(e);return I(v,{code:b.invalid_type,expected:C.object,received:v.parsedType}),S}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),p=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(let v in a.data)l.includes(v)||p.push(v);let g=[];for(let v of l){let N=o[v],P=a.data[v];g.push({key:{status:"valid",value:v},value:N._parse(new de(a,P,a.path,v)),alwaysSet:v in a.data})}if(this._def.catchall instanceof he){let v=this._def.unknownKeys;if(v==="passthrough")for(let N of p)g.push({key:{status:"valid",value:N},value:{status:"valid",value:a.data[N]}});else if(v==="strict")p.length>0&&(I(a,{code:b.unrecognized_keys,keys:p}),r.dirty());else if(v!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let v=this._def.catchall;for(let N of p){let P=a.data[N];g.push({key:{status:"valid",value:N},value:v._parse(new de(a,P,a.path,N)),alwaysSet:N in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let v=[];for(let N of g){let P=await N.key,G=await N.value;v.push({key:P,value:G,alwaysSet:N.alwaysSet})}return v}).then(v=>ee.mergeObjectSync(r,v)):ee.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 D.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 D.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 D.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 D.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 Ti(D.objectKeys(this.shape))}};le.create=(n,e)=>new le({shape:()=>n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...U(e)});le.strictCreate=(n,e)=>new le({shape:()=>n,unknownKeys:"strict",catchall:he.create(),typeName:B.ZodObject,...U(e)});le.lazycreate=(n,e)=>new le({shape:n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...U(e)});var Je=class extends M{_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 l=o.map(p=>new oe(p.ctx.common.issues));return I(t,{code:b.invalid_union,unionErrors:l}),S}if(t.common.async)return Promise.all(r.map(async o=>{let l={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(a);{let o,l=[];for(let g of r){let v={...t,common:{...t.common,issues:[]},parent:null},N=g._parseSync({data:t.data,path:t.path,parent:v});if(N.status==="valid")return N;N.status==="dirty"&&!o&&(o={result:N,ctx:v}),v.common.issues.length&&l.push(v.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let p=l.map(g=>new oe(g));return I(t,{code:b.invalid_union,unionErrors:p}),S}}get options(){return this._def.options}};Je.create=(n,e)=>new Je({options:n,typeName:B.ZodUnion,...U(e)});var ke=n=>n instanceof Ye?ke(n.schema):n instanceof fe?ke(n.innerType()):n instanceof Ke?[n.value]:n instanceof Qe?n.options:n instanceof Xe?D.objectValues(n.enum):n instanceof et?ke(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof pe?[void 0,...ke(n.unwrap())]:n instanceof we?[null,...ke(n.unwrap())]:n instanceof Ot||n instanceof rt?ke(n.unwrap()):n instanceof tt?ke(n._def.innerType):[],Qt=class n extends M{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.object)return I(t,{code:b.invalid_type,expected:C.object,received:t.parsedType}),S;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}):(I(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),S)}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 l=ke(o.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let p of l){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,...U(r)})}};function kr(n,e){let t=xe(n),r=xe(e);if(n===e)return{valid:!0,data:n};if(t===C.object&&r===C.object){let a=D.objectKeys(e),o=D.objectKeys(n).filter(p=>a.indexOf(p)!==-1),l={...n,...e};for(let p of o){let g=kr(n[p],e[p]);if(!g.valid)return{valid:!1};l[p]=g.data}return{valid:!0,data:l}}else if(t===C.array&&r===C.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let l=n[o],p=e[o],g=kr(l,p);if(!g.valid)return{valid:!1};a.push(g.data)}return{valid:!0,data:a}}else return t===C.date&&r===C.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var He=class extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,l)=>{if(Yt(o)||Yt(l))return S;let p=kr(o.value,l.value);return p.valid?((Kt(o)||Kt(l))&&t.dirty(),{status:t.value,value:p.data}):(I(r,{code:b.invalid_intersection_types}),S)};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,l])=>a(o,l)):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}))}};He.create=(n,e,t)=>new He({left:n,right:e,typeName:B.ZodIntersection,...U(t)});var ve=class n extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.array)return I(r,{code:b.invalid_type,expected:C.array,received:r.parsedType}),S;if(r.data.length<this._def.items.length)return I(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&r.data.length>this._def.items.length&&(I(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((l,p)=>{let g=this._def.items[p]||this._def.rest;return g?g._parse(new de(r,l,r.path,p)):null}).filter(l=>!!l);return r.common.async?Promise.all(o).then(l=>ee.mergeArray(t,l)):ee.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,...U(e)})};var Xt=class n extends M{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!==C.object)return I(r,{code:b.invalid_type,expected:C.object,received:r.parsedType}),S;let a=[],o=this._def.keyType,l=this._def.valueType;for(let p in r.data)a.push({key:o._parse(new de(r,p,r.path,p)),value:l._parse(new de(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?ee.mergeObjectAsync(t,a):ee.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof M?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...U(r)}):new n({keyType:Le.create(),valueType:e,typeName:B.ZodRecord,...U(t)})}},vt=class extends M{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!==C.map)return I(r,{code:b.invalid_type,expected:C.map,received:r.parsedType}),S;let a=this._def.keyType,o=this._def.valueType,l=[...r.data.entries()].map(([p,g],v)=>({key:a._parse(new de(r,p,r.path,[v,"key"])),value:o._parse(new de(r,g,r.path,[v,"value"]))}));if(r.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let g of l){let v=await g.key,N=await g.value;if(v.status==="aborted"||N.status==="aborted")return S;(v.status==="dirty"||N.status==="dirty")&&t.dirty(),p.set(v.value,N.value)}return{status:t.value,value:p}})}else{let p=new Map;for(let g of l){let v=g.key,N=g.value;if(v.status==="aborted"||N.status==="aborted")return S;(v.status==="dirty"||N.status==="dirty")&&t.dirty(),p.set(v.value,N.value)}return{status:t.value,value:p}}}};vt.create=(n,e,t)=>new vt({valueType:e,keyType:n,typeName:B.ZodMap,...U(t)});var wt=class n extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.set)return I(r,{code:b.invalid_type,expected:C.set,received:r.parsedType}),S;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(I(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&&(I(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 l(g){let v=new Set;for(let N of g){if(N.status==="aborted")return S;N.status==="dirty"&&t.dirty(),v.add(N.value)}return{status:t.value,value:v}}let p=[...r.data.values()].map((g,v)=>o._parse(new de(r,g,r.path,v)));return r.common.async?Promise.all(p).then(g=>l(g)):l(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,...U(e)});var er=class n extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.function)return I(t,{code:b.invalid_type,expected:C.function,received:t.parsedType}),S;function r(p,g){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),_e].filter(v=>!!v),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(),_e].filter(v=>!!v),issueData:{code:b.invalid_return_type,returnTypeError:g}})}let o={errorMap:t.common.contextualErrorMap},l=t.data;if(this._def.returns instanceof Pe){let p=this;return re(async function(...g){let v=new oe([]),N=await p._def.args.parseAsync(g,o).catch(A=>{throw v.addIssue(r(g,A)),v}),P=await Reflect.apply(l,this,N);return await p._def.returns._def.type.parseAsync(P,o).catch(A=>{throw v.addIssue(a(P,A)),v})})}else{let p=this;return re(function(...g){let v=p._def.args.safeParse(g,o);if(!v.success)throw new oe([r(g,v.error)]);let N=Reflect.apply(l,this,v.data),P=p._def.returns.safeParse(N,o);if(!P.success)throw new oe([a(N,P.error)]);return P.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:ve.create(e).rest(Ne.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(Ne.create()),returns:t||Ne.create(),typeName:B.ZodFunction,...U(r)})}},Ye=class extends M{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,...U(e)});var Ke=class extends M{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return I(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...U(e)});function Ti(n,e){return new Qe({values:n,typeName:B.ZodEnum,...U(e)})}var Qe=class n extends M{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{expected:D.joinValues(r),received:t.parsedType,code:b.invalid_type}),S}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 I(t,{received:t.data,code:b.invalid_enum_value,options:r}),S}return re(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=Ti;var Xe=class extends M{_parse(e){let t=D.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==C.string&&r.parsedType!==C.number){let a=D.objectValues(t);return I(r,{expected:D.joinValues(a),received:r.parsedType,code:b.invalid_type}),S}if(this._cache||(this._cache=new Set(D.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=D.objectValues(t);return I(r,{received:r.data,code:b.invalid_enum_value,options:a}),S}return re(e.data)}get enum(){return this._def.values}};Xe.create=(n,e)=>new Xe({values:n,typeName:B.ZodNativeEnum,...U(e)});var Pe=class extends M{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.promise&&t.common.async===!1)return I(t,{code:b.invalid_type,expected:C.promise,received:t.parsedType}),S;let r=t.parsedType===C.promise?t.data:Promise.resolve(t.data);return re(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,...U(e)});var fe=class extends M{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:l=>{I(r,l),l.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let l=a.transform(r.data,o);if(r.common.async)return Promise.resolve(l).then(async p=>{if(t.value==="aborted")return S;let g=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return g.status==="aborted"?S:g.status==="dirty"?Ve(g.value):t.value==="dirty"?Ve(g.value):g});{if(t.value==="aborted")return S;let p=this._def.schema._parseSync({data:l,path:r.path,parent:r});return p.status==="aborted"?S:p.status==="dirty"?Ve(p.value):t.value==="dirty"?Ve(p.value):p}}if(a.type==="refinement"){let l=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"?S:(p.status==="dirty"&&t.dirty(),l(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"?S:(p.status==="dirty"&&t.dirty(),l(p.value).then(()=>({status:t.value,value:p.value}))))}if(a.type==="transform")if(r.common.async===!1){let l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Se(l))return S;let p=a.transform(l.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(l=>Se(l)?Promise.resolve(a.transform(l.value,o)).then(p=>({status:t.value,value:p})):S);D.assertNever(a)}};fe.create=(n,e,t)=>new fe({schema:n,typeName:B.ZodEffects,effect:e,...U(t)});fe.createWithPreprocess=(n,e,t)=>new fe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...U(t)});var pe=class extends M{_parse(e){return this._getType(e)===C.undefined?re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pe.create=(n,e)=>new pe({innerType:n,typeName:B.ZodOptional,...U(e)});var we=class extends M{_parse(e){return this._getType(e)===C.null?re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.create=(n,e)=>new we({innerType:n,typeName:B.ZodNullable,...U(e)});var et=class extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===C.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,...U(e)});var tt=class extends M{_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,...U(e)});var bt=class extends M{_parse(e){if(this._getType(e)!==C.nan){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.nan,received:r.parsedType}),S}return{status:"valid",value:e.data}}};bt.create=n=>new bt({typeName:B.ZodNaN,...U(n)});var vl=Symbol("zod_brand"),Ot=class extends M{_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}},jt=class n extends M{_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"?S:o.status==="dirty"?(t.dirty(),Ve(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"?S: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 M{_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,...U(e)});function xi(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ri(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(l=>{if(!l){let p=xi(e,r),g=p.fatal??t??!0;a.addIssue({code:"custom",...p,fatal:g})}});if(!o){let l=xi(e,r),p=l.fatal??t??!0;a.addIssue({code:"custom",...l,fatal:p})}}):Be.create()}var wl={object:le.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 bl=(n,e={message:`Input not instance of ${n.name}`})=>Ri(t=>t instanceof n,e),_i=Le.create,ki=De.create,Tl=bt.create,Rl=qe.create,Ni=We.create,_l=ze.create,kl=gt.create,Nl=Ze.create,Il=Ge.create,Cl=Be.create,El=Ne.create,Al=he.create,Sl=xt.create,Ll=Ie.create,Bl=le.create,Pl=le.strictCreate,Fl=Je.create,Ol=Qt.create,jl=He.create,Ul=ve.create,Ml=Xt.create,$l=vt.create,Vl=wt.create,Dl=er.create,ql=Ye.create,Wl=Ke.create,zl=Qe.create,Zl=Xe.create,Gl=Pe.create,Jl=fe.create,Hl=pe.create,Yl=we.create,Kl=fe.createWithPreprocess,Ql=jt.create,Xl=()=>_i().optional(),eu=()=>ki().optional(),tu=()=>Ni().optional(),ru={string:(n=>Le.create({...n,coerce:!0})),number:(n=>De.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 nu=S;m();y();h();var Ii=F.strictObject({title:F.string(),content:F.string()});var Nr=F.object({"base-api-exception-class-name":F.string().optional(),"base-exception-class-name":F.string().optional(),"client-class-name":F.string().optional(),"exported-client-class-name":F.string().optional(),"inline-file-properties":F.boolean().optional(),"inline-path-parameters":F.boolean().optional(),"package-layout":F.enum(["flat","nested"]).optional(),"package-prefix":F.string().optional(),"use-local-date-for-dates":F.boolean().optional(),"custom-dependencies":F.array(F.string()).optional(),"custom-plugins":F.array(F.string()).optional(),"disable-required-property-builder-checks":F.boolean().optional(),"enable-forward-compatible-enums":F.boolean().optional(),"enable-inline-types":F.boolean().optional(),"enable-public-constructors":F.boolean().optional(),"generate-unknown-as-json-node":F.boolean().optional(),"json-include":F.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":F.boolean().optional(),"use-default-request-parameter-values":F.boolean().optional(),"enable-wire-tests":F.boolean().default(!1),"collapse-optional-nullable":F.boolean().optional(),"use-nullable-annotation":F.boolean().optional(),"custom-readme-sections":F.array(Ii).optional(),"custom-pager-name":F.string().optional(),"offset-semantics":F.enum(["item-index","page-index"]).optional(),"default-timeout-in-seconds":F.number().optional(),"gradle-distribution-url":F.string().optional(),"gradle-plugin-management":F.string().optional(),"gradle-central-dependency-management":F.boolean().optional(),"output-directory":F.enum(["source-root","project-root"]).optional(),"custom-interceptors":F.boolean().optional(),"omit-fern-headers":F.boolean().optional(),"retry-status-codes":F.optional(F.enum(["legacy","recommended"])),"enable-gradle-profiling":F.boolean().optional(),"wrapped-aliases":F.boolean().optional(),maxRetries:F.number().int().min(0).optional()});var d={};Vt(d,{Access:()=>Ir,AstNode:()=>Y,Class:()=>nt,ClassInstantiation:()=>at,ClassReference:()=>W,CodeBlock:()=>it,Method:()=>st,MethodInvocation:()=>ot,Parameter:()=>lt,Type:()=>Ut,TypeLiteral:()=>ue,Writer:()=>$e,classReference:()=>ku,class_:()=>_u,codeblock:()=>Ru,instantiateClass:()=>Nu,invokeMethod:()=>Iu,method:()=>Cu,parameter:()=>Eu});m();y();h();m();y();h();m();y();h();var Y=class extends Ue{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 Y{constructor({name:t,access:r}){super();R(this,"name");R(this,"access");R(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();var Ir={Public:"public",Protected:"protected",Private:"private"};m();y();h();m();y();h();m();y();h();m();y();h();var W=class extends Y{constructor({name:t,packageName:r,fullyQualified:a,enclosingClasses:o}){super();R(this,"name");R(this,"packageName");R(this,"fullyQualified");R(this,"enclosingClasses");this.name=t,this.packageName=r,this.fullyQualified=a??!1,this.enclosingClasses=o??[]}write(t){let r=this.enclosingClasses[0]??this.name,a=[...this.enclosingClasses,this.name].join(".");if(this.fullyQualified){t.write(`${this.packageName}.${a}`);return}let{shouldFullyQualify:o}=t.addReference({name:r,packageName:this.packageName});if(o){t.write(`${this.packageName}.${a}`);return}t.write(a)}};m();y();h();var Ut=class extends Y{constructor(t){super();R(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(au);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.write("String");break;case"dateTime":t.writeNode(ou);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(cu);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(uu);break;case"void":t.write("Void");break;default:$(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(iu),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(su),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Cr),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(pu),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(lu),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},tr=new W({name:"Arrays",packageName:"java.util"}),au=new W({name:"BigInteger",packageName:"java.math"}),xg=new W({name:"HashMap",packageName:"java.util"}),iu=new W({name:"List",packageName:"java.util"}),su=new W({name:"Map",packageName:"java.util"}),ou=new W({name:"OffsetDateTime",packageName:"java.time"}),Cr=new W({name:"Optional",packageName:"java.util"}),lu=new W({name:"Set",packageName:"java.util"}),uu=new W({name:"UUID",packageName:"java.util"}),cu=new W({name:"InputStream",packageName:"java.io"}),pu=new W({name:"Iterable",packageName:"java.lang"});var ue=class n extends Y{constructor(t){super();R(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 Y?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:$(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:$(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(d.instantiateClass({classReference:du,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(xu({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=>this.isRequiredBuilderParameter(a))?t.sort((a,o)=>{let l=!this.isRequiredBuilderParameter(a),p=!this.isRequiredBuilderParameter(o);return l&&!p?1:!l&&p?-1:0}):t.sort((a,o)=>{let l=a.value.isOptional(),p=o.value.isOptional();return l&&!p?1:!l&&p?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isRequiredBuilderParameter(t){return t.isRequired!=null?t.isRequired:!this.isNonRequired(t.value)}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=gu({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:mu,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(d.invokeMethod({on:hu,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=vu({entries:r.entries});if(a.length===0){t.write("new "),t.writeNode(rr),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(rr),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:Cr,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"?Er:fu,o=wu({values:r.values});if(r.type==="list"&&r.isParameter&&o.length>0){t.writeNode(d.invokeMethod({on:tr,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:tr,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(Er),t.write("<Object>()");return}t.write("new "),t.writeNode(Er),t.write("<Object>("),t.writeNode(d.invokeMethod({on:tr,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(rr),t.write("<String, Object>()");return}t.writeLine("new "),t.writeNode(rr),t.write("<String, Object>() {{"),t.indent();for(let[o,l]of a)t.write(`put("${o}", `),t.writeNode(n.unknown(l)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(d.invokeMethod({on:yu,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"}},Er=new W({name:"ArrayList",packageName:"java.util"}),du=new W({name:"BigInteger",packageName:"java.math"}),rr=new W({name:"HashMap",packageName:"java.util"}),fu=new W({name:"HashSet",packageName:"java.util"}),Eg=new W({name:"List",packageName:"java.util"}),mu=new W({name:"LocalDate",packageName:"java.time"}),Ag=new W({name:"Map",packageName:"java.util"}),hu=new W({name:"OffsetDateTime",packageName:"java.time"}),Sg=new W({name:"Set",packageName:"java.util"}),yu=new W({name:"UUID",packageName:"java.util"});function gu({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function xu({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function vu({entries:n}){return n.filter(e=>!ue.isNop(e.key)&&!ue.isNop(e.value))}function wu({values:n}){return n.filter(e=>!ue.isNop(e))}function nr({writer:n,arguments_:e}){let t=Tu(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof ue&&!a.shouldWriteInLine())){bu({writer:n,arguments_:t});return}n.write("("),t.forEach((a,o)=>{o>0&&n.write(", "),Ci({writer:n,argument:a})}),n.write(")")}function bu({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Ci({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Ci({writer:n,argument:e}){Tr(e)?n.writeNodeOrString(e.assignment):e.write(n)}function Tu(n){return n.filter(e=>!(e instanceof ue&&ue.isNop(e)))}var at=class extends Y{constructor({classReference:t,arguments_:r}){super();R(this,"classReference");R(this,"arguments_");this.classReference=t,this.arguments_=r}write(t){t.writeNode(this.classReference),nr({writer:t,arguments_:this.arguments_})}};m();y();h();var it=class extends Y{constructor(t){super();R(this,"arg");this.arg=t}write(t){return new me(this.arg).write(t)}};m();y();h();var st=class extends Y{constructor({name:t,access:r,parameters:a,body:o,static_:l,return_:p}){super();R(this,"name");R(this,"access");R(this,"parameters");R(this,"body");R(this,"return_");R(this,"static_");this.name=t,this.access=r,this.parameters=a,this.body=o,this.return_=p,this.static_=l??!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 Y{constructor({method:t,arguments_:r,on:a}){super();R(this,"on");R(this,"method");R(this,"arguments_");this.on=a,this.method=t,this.arguments_=r}write(t){this.on.write(t),t.write("."),t.write(this.method),nr({writer:t,arguments_:this.arguments_})}};m();y();h();var lt=class extends Y{constructor({name:t,type:r}){super();R(this,"name");R(this,"type");this.name=t,this.type=r}write(t){t.writeNode(this.type),t.write(` ${this.name}`)}};function Ru(n){return new it(n)}function _u(n){return new nt(n)}function ku(n){return new W(n)}function Nu(n){return new at(n)}function Iu(n){return new ot(n)}function Cu(n){return new st(n)}function Eu(n){return new lt(n)}m();y();h();var Au=new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while","true","false","null","_"]);function Ei(n){return Au.has(n.toLowerCase())}function Ar(n){return Ei(n)?"_"+n:n}m();y();h();var ar=class{constructor({context:e}){R(this,"context");this.context=e}usesOptionalNullable(){return this.context.usesOptionalNullable()}usesNullableAnnotation(){return this.context.usesNullableAnnotation()}wrapInOptionalIfNotNop(e,t=!1,r=!1){return d.TypeLiteral.isNop(e)?e:r?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:t})}wrapNullableOrOptionalValue({value:e,wrapperType:t,useOf:r,propagatedCollapse:a}){return d.TypeLiteral.isNop(e)||t==="nullable"&&this.usesNullableAnnotation()?e:a||this.usesOptionalNullable()&&t==="nullable"?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:r})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:q.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,nestedClassReference:e.nestedClassReference});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,nestedClassReference:e.nestedClassReference});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,nestedClassReference:e.nestedClassReference})}case"nullable":case"optional":{let t=e.typeReference.type,r=e.typeReference.value;if((e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&r.type==="named")&&!(t==="nullable"&&this.usesNullableAnnotation()))return e.isCollapsedOptionalNullable||this.usesOptionalNullable()&&(t==="nullable"||r.type==="optional"||r.type==="nullable")?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(this.usesOptionalNullable()&&(r.type==="optional"||r.type==="nullable"))return this.convert({typeReference:r,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion,isCollapsedOptionalNullable:!0,nestedClassReference:e.nestedClassReference});if(r.type==="list"){let l=this.convertList({list:r.value,value:e.value,nestedClassReference:e.nestedClassReference});return this.wrapNullableOrOptionalValue({value:l,wrapperType:t,useOf:!0,propagatedCollapse:e.isCollapsedOptionalNullable===!0})}let a=this.convert({typeReference:r,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion,nestedClassReference:e.nestedClassReference}),o=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapNullableOrOptionalValue({value:a,wrapperType:t,useOf:o,propagatedCollapse:e.isCollapsedOptionalNullable===!0})}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,nestedClassReference:e.nestedClassReference});case"unknown":return this.convertUnknown({value:e.value});default:$(e.typeReference)}}convertList({list:e,value:t,as:r,nestedClassReference:a}){if(!Array.isArray(t))return this.context.errors.add({severity:q.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop();let o=e.type==="optional"||e.type==="nullable";return d.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((l,p)=>{this.context.errors.scope({index:p});try{if(o&&(e.type==="optional"||e.type==="nullable")){let g=this.convert({typeReference:e.value,value:l,as:r,nestedClassReference:a});return this.wrapNullableOrOptionalValue({value:g,wrapperType:e.type,useOf:!0,propagatedCollapse:!1})}return this.convert({typeReference:e,value:l,as:r,nestedClassReference:a})}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:$(e)}}convertSet({set:e,value:t,as:r,nestedClassReference:a}){return Array.isArray(t)?d.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((o,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:e,value:o,as:r,nestedClassReference:a})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:q.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop())}convertMap({map:e,value:t,as:r,nestedClassReference:a}){return typeof t!="object"||t==null?(this.context.errors.add({severity:q.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(([o,l])=>{this.context.errors.scope(o);try{return{key:this.convert({typeReference:e.key,value:o,as:"mapKey"}),value:this.convert({typeReference:e.value,value:l,as:"mapValue",nestedClassReference:a})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o}){switch(e.type){case"alias":if(e.typeReference.type==="unknown"){let l=this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});return d.TypeLiteral.reference(d.invokeMethod({on:o??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[l]}))}return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t,as:r,nestedClassReference:o});case"enum":return this.convertEnum({enum_:e,value:t,nestedClassReference:o});case"object":return this.convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,as:r,nestedClassReference:o});default:$(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t,as:r,nestedClassReference:a}){let o=a??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),l=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(l==null)return d.TypeLiteral.nop();let p=l.singleDiscriminatedUnionType,g=new Set([...o.enclosingClasses,o.name]),v=new Set(Object.values(e.types).map(N=>this.context.getClassName(N.discriminantValue.name)));switch(p.type){case"samePropertiesAsObject":{let N=this.context.resolveNamedType({typeId:p.typeId});if(N==null)return d.TypeLiteral.nop();let P=this.resolveInlineNestedClassReference({enclosing:o,baseName:this.context.getClassName(p.discriminantValue.name),typeReference:{type:"named",value:p.typeId},reservedNames:g,siblingPropertyNames:v});return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[this.convertNamed({named:N,value:l.value,as:r,nestedClassReference:P})]}))}case"singleProperty":{let N=this.context.getRecord(l.value);if(N==null)return d.TypeLiteral.nop();try{this.context.errors.scope(p.discriminantValue.wireValue);let P="value",G=this.resolveInlineNestedClassReference({enclosing:o,baseName:this.context.getClassName(p.discriminantValue.name),typeReference:p.typeReference,reservedNames:g,siblingPropertyNames:v});return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[this.convert({typeReference:p.typeReference,value:N[P],as:r,nestedClassReference:G})]}))}finally{this.context.errors.unscope()}}case"noProperties":return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[]}));default:$(p)}}convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o}){let l=o??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),p=this.context.getRecord(t)??{},g=this.context.associateByWireValue({parameters:e.properties,values:p}),v=new Set(g.map(L=>L.name.wireValue));for(let L of e.properties)if(!v.has(L.name.wireValue)&&!this.context.isOptional(L.typeReference)){if(a===!0)throw new Error(`Required property "${L.name.wireValue}" is missing from value`);let z=this.getDefaultValueForTypeReference(L.typeReference);z!==void 0&&g.push({name:L.name,typeReference:L.typeReference,value:z})}let N=new Map,P=new Set;e.properties.forEach((L,z)=>{N.set(L.name.wireValue,z),P.add(L.name.wireValue)}),g.sort((L,z)=>(N.get(L.name.wireValue)??0)-(N.get(z.name.wireValue)??0));let G=r==="request"?g.filter(L=>!this.context.isDirectLiteral(L.typeReference)):g,A=new Set([...l.enclosingClasses,l.name]),O=new Set(e.properties.map(L=>this.context.getClassName(L.name.name))),j=[];for(let L of G){this.context.errors.scope(L.name.wireValue);try{let z=this.convert({typeReference:L.typeReference,value:L.value,as:r,inUndiscriminatedUnion:a,nestedClassReference:this.resolveInlineNestedClassReference({enclosing:l,baseName:this.context.getClassName(L.name.name),typeReference:L.typeReference,reservedNames:A,siblingPropertyNames:O})});if(d.TypeLiteral.isNop(z)&&!this.context.isOptional(L.typeReference)){if(a===!0)throw new Error(`Required property "${L.name.wireValue}" could not be converted`);continue}j.push({name:this.context.getMethodName(L.name.name),value:z,isRequired:this.isStagedBuilderProperty(L.typeReference)})}finally{this.context.errors.unscope()}}for(let[L,z]of Object.entries(p))if(!P.has(L)&&z!==void 0){let H=this.convertToRawJavaLiteral(z);H!=null&&j.push({name:"additionalProperty",value:d.TypeLiteral.raw(`"${this.escapeJavaString(L)}", ${H}`),isRequired:!1})}return d.TypeLiteral.builder({classReference:l,parameters:j})}resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:r,reservedNames:a,siblingPropertyNames:o}){if(this.context.enableInlineTypes())switch(r.type){case"optional":case"nullable":return this.resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"list":case"set":return this.resolveInlineNestedClassReference({enclosing:e,baseName:`${t}Item`,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"map":return this.resolveInlineNestedClassReference({enclosing:e,baseName:`${t}Value`,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"named":{let l=r.value,p=this.context.resolveNamedType({typeId:l});if(p==null)return;if(p.type==="alias"&&!this.context.wrappedAliases())return this.resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:p.typeReference,reservedNames:a,siblingPropertyNames:o});if(!this.context.isInlineType(l))return;let g=t;for(;a.has(g)||o.has(g)&&g!==t;)g=`${g}_`;return a.add(g),this.context.getNestedInlineClassReference({enclosing:e,name:g})}case"primitive":case"literal":case"unknown":return;default:$(r)}}resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t,reservedNames:r,unionPrefix:a}){if(this.context.enableInlineTypes())switch(t.type){case"optional":case"nullable":case"list":case"set":return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t.value,reservedNames:r,unionPrefix:a});case"map":return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t.value,reservedNames:r,unionPrefix:a});case"named":{let o=t.value,l=this.context.resolveNamedType({typeId:o});if(l==null)return;if(l.type==="alias"&&!this.context.wrappedAliases())return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:l.typeReference,reservedNames:r,unionPrefix:a});if(!this.context.isInlineType(o))return;let p=this.context.getClassName(l.declaration.name);for(p.startsWith(a)&&p!==a&&(p=p.substring(a.length));r.has(p);)p=`${p}_`;return this.context.getNestedInlineClassReference({enclosing:e,name:p})}case"primitive":case"literal":case"unknown":return;default:$(t)}}isStagedBuilderProperty(e){switch(e.type){case"optional":case"nullable":case"list":case"set":case"map":return!1;case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t!=null&&t.type==="alias"?this.isStagedBuilderProperty(t.typeReference):!0}default:return!0}}convertToRawJavaLiteral(e){return typeof e=="string"?`"${this.escapeJavaString(e)}"`:typeof e=="number"||typeof e=="boolean"?e.toString():e===null?"null":null}escapeJavaString(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}getDefaultValueForTypeReference(e){switch(e.type){case"primitive":return this.getDefaultPrimitiveValue(e.value);case"nullable":return null;case"optional":return;case"list":case"set":return[];case"map":return{};case"named":{let t=this.context.resolveNamedType({typeId:e.value});if(t==null)return{};switch(t.type){case"enum":if(t.values.length>0){let r=t.values[0];return r?.wireValue}return;case"object":case"alias":return{};case"discriminatedUnion":case"undiscriminatedUnion":return;default:return{}}}case"literal":return e.value.value;case"unknown":return{};default:$(e)}}getDefaultPrimitiveValue(e){switch(e){case"STRING":return"string";case"INTEGER":case"UINT":return 1;case"LONG":case"UINT_64":return 1e6;case"FLOAT":case"DOUBLE":return 1.1;case"BOOLEAN":return!0;case"DATE":return"2024-01-15";case"DATE_TIME":return"2024-01-15T09:30:00Z";case"DATE_TIME_RFC_2822":return"Tue, 15 Jan 2024 09:30:00 +0000";case"UUID":return"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32";case"BASE_64":return"SGVsbG8gd29ybGQh";case"BIG_INTEGER":return"123456789";default:return"string"}}convertEnum({enum_:e,value:t,nestedClassReference:r}){let a=this.getEnumValueName({enum_:e,value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.enum_({classReference:r??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:a})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:q.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:q.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,as:r,nestedClassReference:a}){let o=a??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),l=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,as:r,enclosing:o});return l==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.invokeMethod({on:o,method:"of",arguments_:[l.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,as:r,enclosing:a}){let o=new Set([...a.enclosingClasses,a.name]),l=this.context.getClassName(e.declaration.name);for(let p of e.types){let g=this.context.errors.size();try{let v=this.convert({typeReference:p,value:t,as:r,inUndiscriminatedUnion:!0,nestedClassReference:this.resolveUndiscriminatedInlineNestedClassReference({enclosing:a,typeReference:p,reservedNames:new Set(o),unionPrefix:l})});if(d.TypeLiteral.isNop(v)||this.context.errors.size()>g){this.context.errors.truncate(g);continue}return{valueTypeReference:p,typeInstantiation:v}}catch{this.context.errors.truncate(g);continue}}this.context.errors.add({severity:q.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}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:$(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"DATE_TIME_RFC_2822":return"DateTimeRfc2822";case"BASE_64":return"Base64";default:$(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":case"DATE_TIME_RFC_2822":{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:$(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 ir=class{constructor({context:e}){R(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":{let t=e.typeReference.value;return this.context.usesOptionalNullable()&&(t.type==="nullable"||t.type==="optional")?d.Type.generic(this.context.getOptionalNullableClassReference(),[this.convert({typeReference:t.value})]):d.Type.optional(this.convert({typeReference:t}))}case"nullable":{let t=e.typeReference.value;if(this.context.usesNullableAnnotation())return this.convert({typeReference:t});if(this.context.usesOptionalNullable()){let r=t.type==="optional"||t.type==="nullable"?t.value:t;return d.Type.generic(this.context.getOptionalNullableClassReference(),[this.convert({typeReference:r})])}return d.Type.optional(this.convert({typeReference:t}))}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:$(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:$(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":case"DATE_TIME_RFC_2822":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:$(e)}}};m();y();h();var sr=class{constructor({context:e}){R(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:$(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return this.context.shouldInlineFileProperties()?this.context.getJavaIoFileFromString(r??"path/to/file"):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(this.context.shouldInlineFileProperties()){let a=r?.[0]??"path/to/file";return this.context.getJavaIoFileFromString(a)}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 Su=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch"]),Lu=new Set(["getClass","notify","notifyAll","wait"]),or=class n extends Bt{constructor({ir:t,config:r,options:a,sharedCustomConfig:o,inlineTypeIds:l}){super({ir:t,config:r,options:a});R(this,"ir");R(this,"customConfig");R(this,"dynamicTypeMapper");R(this,"dynamicTypeLiteralMapper");R(this,"filePropertyMapper");R(this,"inlineTypeIds");this.ir=t,this.customConfig=o??Nr.parse(r.customConfig??{}),this.dynamicTypeMapper=new ir({context:this}),this.dynamicTypeLiteralMapper=new ar({context:this}),this.filePropertyMapper=new sr({context:this}),this.inlineTypeIds=l??new Set}clone(){return new n({ir:this.ir,config:this.config,options:this.options,sharedCustomConfig:this.customConfig,inlineTypeIds:this.inlineTypeIds})}isInlineType(t){return this.inlineTypeIds.has(t)}getNestedInlineClassReference({enclosing:t,name:r}){return d.classReference({name:r,packageName:t.packageName,enclosingClasses:[...t.enclosingClasses,t.name]})}wrappedAliases(){return this.customConfig?.["wrapped-aliases"]??!1}enableInlineTypes(){return this.customConfig?.["enable-inline-types"]??!1}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.getRootClientClassNameForSnippets(),packageName:this.getRootPackageName()})}getRootClientClassName(){return this.customConfig?.["client-class-name"]??`${this.getBaseNamePrefix()}Client`}getRootClientClassNameForSnippets(){return this.customConfig?.["exported-client-class-name"]??this.getRootClientClassName()}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("(new "),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getJavaIoFileFromString(t){return d.TypeLiteral.reference(d.codeblock(r=>{r.write("new "),r.writeNode(this.getJavaIoFileClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(")")}))}getJavaIoFileClassReference(){return d.classReference({name:"File",packageName:"java.io"})}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:$(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:$(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=[],l=[];for(let p of t)this.isOptional(p.typeReference)?l.push(p):o.push(p);return o.sort((p,g)=>(a.get(p.name.wireValue)??0)-(a.get(g.name.wireValue)??0)),[...o,...l]}associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}){let o=super.associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}),l=new Map;for(let g of o)l.set(g.name.wireValue,g);let p=[];for(let g of t){let v=l.get(g.name.wireValue);v!=null&&p.push(v)}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();return this.getPackageLayout()==="flat"?t!=null&&a.push(...t.packagePath.map(o=>this.getPackageNameSegment(o))):(t!=null&&t.allParts.length>0&&a.push("resources"),t!=null&&a.push(...t.allParts.map(o=>this.getPackageNameSegment(o)))),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}usesNullableAnnotation(){return this.customConfig?.["use-nullable-annotation"]===!0}usesOptionalNullable(){return this.customConfig?.["collapse-optional-nullable"]===!0}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 xr(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:Ar(a)).join(".")}getName(t){return this.isReservedName(t)?"_"+t:t}isReservedName(t){return Su.has(t)}isReservedMethodName(t){return Lu.has(t)}};m();y();h();var Ai="com.example.usage",Bu="Example",Pu="main",Fu="args",Si="client",Ou={type:"primitive",value:"STRING"};function Sr(n){let e=n;for(;e.type==="optional"||e.type==="nullable";)e=e.value;return e}function ju(n){if(n.type==="optional"&&n.value.type==="list"){let e=n.value.value,t=Sr(e);return t===e?n:{type:"optional",value:{type:"list",value:t}}}if(n.type==="list"){let e=Sr(n.value);return e===n.value?n:{type:"list",value:e}}return n}var lr=class{constructor({context:e,formatter:t}){R(this,"context");R(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??Ai,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??Ai,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(l=>{l.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),l.newLine(),l.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:$(o)}}constructClient({endpoint:e,snippet:t}){let r=e.auth?.type==="oauth";return d.codeblock(a=>{if(a.writeNode(this.context.getRootClientClassReference()),a.write(` ${Si} = `),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 l=this.getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t});for(let p of l)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??Bu,access:d.Access.Public}),o=d.parameter({name:Fu,type:d.Type.array(d.Type.string())});return a.addMethod(d.method({name:Pu,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:q.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:q.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:q.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:q.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:Ou,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:$(e)}}addError(e){this.context.errors.add({severity:q.Critical,message:e})}addWarning(e){this.context.errors.add({severity:q.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){let r=e,a=!!r.usernameOmit,o=!!r.passwordOmit,l=[];return a||l.push(`"${t.username}"`),o||l.push(`"${t.password}"`),l.length===0?[]:[{name:"credentials",value:d.TypeLiteral.raw(l.join(", "))}]}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=t[a.name.wireValue],l=this.getRootClientHeaderArg({header:a,value:o});l!=null&&r.push({name:this.context.getMethodName(a.name.name),value:l})}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(Si),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:$(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(se.PathParameters);let a=(e.pathParameters??[]).filter(l=>l.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(l=>l.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"){let r=this.usesOptionalNullable()&&(e.value.value.type==="optional"||e.value.value.type==="nullable");if(t==null)return r?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let a=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t,as:"request",isCollapsedOptionalNullable:r}),o=a.toString({packageName:"com.example",customConfig:this.context.customConfig});if(o.includes("Optional.empty()")||o.includes("OptionalNullable.absent()"))return a;let l=this.context.dynamicTypeLiteralMapper.convert({typeReference:Sr(e.value),value:t,as:"request"});return r?this.context.getOptionalNullableOf(l):d.TypeLiteral.optional({value:l,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:$(e)}}getBytesBodyRequestArg({value:e}){return e==null?d.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:q.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 l=[],p=(e.pathParameters??[]).filter(v=>v.variable==null);p.length>0&&l.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(...l.map(v=>v.value)),o||r.push(...g.fileFields.map(v=>d.TypeLiteral.isNop(v.value)?d.TypeLiteral.raw("null"):v.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?l:[],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 l=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).filter(j=>!this.context.isDirectLiteral(j.typeReference)),g=this.context.sortTypeInstancesByRequiredFirst(l,e.queryParameters??[]).map(j=>({name:this.context.getMethodName(j.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:ju(j.typeReference),value:j.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.Headers);let N=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).filter(j=>!this.context.isDirectLiteral(j.typeReference)),G=this.context.sortTypeInstancesByRequiredFirst(N,e.headers??[]).map(j=>({name:this.context.getMethodName(j.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:j.typeReference,value:j.value,as:"request"})}));this.context.errors.unscope();let A=d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)});this.context.errors.scope(se.RequestBody);let O=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a,enclosing:A}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:A,parameters:[...r,...G,...g,...O]})}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()}),l=d.invokeMethod({on:o,method:"builder",arguments_:[]});for(let g of a)l=d.invokeMethod({on:l,method:"addHeader",arguments_:[d.TypeLiteral.string(g.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(g)]});let p=d.invokeMethod({on:l,method:"build",arguments_:[]});return d.TypeLiteral.reference(p)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r,enclosing:a}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t,enclosing:a});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:$(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.bodyPropertyFields,...e.fileFields]: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:$(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t,enclosing:r}){let o=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}}).filter(v=>!this.context.isDirectLiteral(v.typeReference)),l=this.context.sortTypeInstancesByRequiredFirst(o,e),p=new Set([...r.enclosingClasses,r.name]),g=new Set(e.map(v=>this.context.getClassName(v.name.name)));return l.map(v=>({name:this.context.getMethodName(v.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:v.typeReference,value:v.value,as:"request",nestedClassReference:this.context.dynamicTypeLiteralMapper.resolveInlineNestedClassReference({enclosing:r,baseName:this.context.getClassName(v.name.name),typeReference:v.typeReference,reservedNames:p,siblingPropertyNames:g})})}))}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{},ignoreMissingParameters:!0});for(let o of a)r.push({name:this.context.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 ur=class extends At{constructor({ir:e,config:t,options:r={},inlineTypeIds:a}){super(new or({ir:e,config:t,options:r,inlineTypeIds:a}))}async generate(e,t={}){return super.generate(e,t)}generateSync(e,t={}){return super.generateSync(e,t)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new lr({context:e})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
23
23
|
/*! Bundled license information:
|
|
24
24
|
|
|
25
25
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|