@fern-api/typescript-dynamic-snippets 3.48.3 → 3.48.4
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 +15 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";var Ve=Object.defineProperty;var ji=Object.getOwnPropertyDescriptor;var _i=Object.getOwnPropertyNames;var Di=Object.prototype.hasOwnProperty;var Wi=(s,t,e)=>t in s?Ve(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var he=(s,t)=>()=>(s&&(t=s(s=0)),t);var K=(s,t)=>{for(var e in t)Ve(s,e,{get:t[e],enumerable:!0})},Vi=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of _i(t))!Di.call(s,u)&&u!==e&&Ve(s,u,{get:()=>t[u],enumerable:!(o=ji(t,u))||o.enumerable});return s};var qi=s=>Vi(Ve({},"__esModule",{value:!0}),s);var b=(s,t,e)=>Wi(s,typeof t!="symbol"?t+"":t,e);var l=he(()=>{"use strict"});var x={};K(x,{_debugEnd:()=>vr,_debugProcess:()=>br,_events:()=>Mr,_eventsCount:()=>$r,_exiting:()=>tr,_fatalExceptions:()=>yr,_getActiveHandles:()=>or,_getActiveRequests:()=>ir,_kill:()=>sr,_linkedBinding:()=>Qt,_maxListeners:()=>Ur,_preload_modules:()=>Cr,_rawDebug:()=>Kt,_startProfilerIdleNotifier:()=>Ir,_stopProfilerIdleNotifier:()=>Er,_tickCallback:()=>wr,abort:()=>Br,addListener:()=>jr,allowedNodeEnvironmentFlags:()=>dr,arch:()=>Mt,argv:()=>_t,argv0:()=>kr,assert:()=>mr,binding:()=>Gt,browser:()=>Zt,chdir:()=>Yt,config:()=>rr,cpuUsage:()=>ze,cwd:()=>Ht,debugPort:()=>Lr,default:()=>Yr,dlopen:()=>nr,domain:()=>er,emit:()=>qr,emitWarning:()=>qt,env:()=>jt,execArgv:()=>Dt,execPath:()=>Sr,exit:()=>cr,features:()=>hr,hasUncaughtExceptionCaptureCallback:()=>gr,hrtime:()=>Ge,kill:()=>lr,listeners:()=>Hr,memoryUsage:()=>pr,moduleLoadList:()=>Xt,nextTick:()=>Pt,off:()=>Dr,on:()=>ee,once:()=>_r,openStdin:()=>fr,pid:()=>Fr,platform:()=>$t,ppid:()=>Nr,prependListener:()=>Gr,prependOnceListener:()=>zr,reallyExit:()=>ar,release:()=>Jt,removeAllListeners:()=>Vr,removeListener:()=>Wr,resourceUsage:()=>ur,setSourceMapsEnabled:()=>Pr,setUncaughtExceptionCaptureCallback:()=>xr,stderr:()=>Ar,stdin:()=>Rr,stdout:()=>Tr,title:()=>Ut,umask:()=>zt,uptime:()=>Or,version:()=>Wt,versions:()=>Vt});function pt(s){throw new Error("Node.js process "+s+" is not supported by JSPM core outside of Node.js")}function Gi(){!ye||!se||(ye=!1,se.length?Q=se.concat(Q):qe=-1,Q.length&&Ct())}function Ct(){if(!ye){var s=setTimeout(Gi,0);ye=!0;for(var t=Q.length;t;){for(se=Q,Q=[];++qe<t;)se&&se[qe].run();qe=-1,t=Q.length}se=null,ye=!1,clearTimeout(s)}}function Pt(s){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];Q.push(new Ot(s,t)),Q.length===1&&!ye&&setTimeout(Ct,0)}function Ot(s,t){this.fun=s,this.array=t}function D(){}function Qt(s){pt("_linkedBinding")}function nr(s){pt("dlopen")}function ir(){return[]}function or(){return[]}function mr(s,t){if(!s)throw new Error(t||"assertion error")}function gr(){return!1}function Or(){return ie.now()/1e3}function Ge(s){var t=Math.floor((Date.now()-ie.now())*.001),e=ie.now()*.001,o=Math.floor(e)+t,u=Math.floor(e%1*1e9);return s&&(o=o-s[0],u=u-s[1],u<0&&(o--,u+=ut)),[o,u]}function ee(){return Yr}function Hr(s){return[]}var Q,ye,se,qe,Ut,Mt,$t,jt,_t,Dt,Wt,Vt,qt,Gt,zt,Ht,Yt,Jt,Zt,Kt,Xt,er,tr,rr,ar,sr,ze,ur,pr,lr,cr,fr,dr,hr,yr,xr,wr,br,vr,Ir,Er,Tr,Ar,Rr,Br,Fr,Nr,Sr,Lr,kr,Cr,Pr,ie,st,ut,Ur,Mr,$r,jr,_r,Dr,Wr,Vr,qr,Gr,zr,Yr,Jr=he(()=>{"use strict";l();f();c();Q=[],ye=!1,qe=-1;Ot.prototype.run=function(){this.fun.apply(null,this.array)};Ut="browser",Mt="x64",$t="browser",jt={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},_t=["/usr/bin/node"],Dt=[],Wt="v16.8.0",Vt={},qt=function(s,t){console.warn((t?t+": ":"")+s)},Gt=function(s){pt("binding")},zt=function(s){return 0},Ht=function(){return"/"},Yt=function(s){},Jt={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Zt=!0,Kt=D,Xt=[];er={},tr=!1,rr={};ar=D,sr=D,ze=function(){return{}},ur=ze,pr=ze,lr=D,cr=D,fr=D,dr={};hr={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},yr=D,xr=D;wr=D,br=D,vr=D,Ir=D,Er=D,Tr=void 0,Ar=void 0,Rr=void 0,Br=D,Fr=2,Nr=1,Sr="/bin/usr/node",Lr=9229,kr="node",Cr=[],Pr=D,ie={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};ie.now===void 0&&(st=Date.now(),ie.timing&&ie.timing.navigationStart&&(st=ie.timing.navigationStart),ie.now=()=>Date.now()-st);ut=1e9;Ge.bigint=function(s){var t=Ge(s);return typeof BigInt>"u"?t[0]*ut+t[1]:BigInt(t[0]*ut)+BigInt(t[1])};Ur=10,Mr={},$r=0;jr=ee,_r=ee,Dr=ee,Wr=ee,Vr=ee,qr=D,Gr=ee,zr=ee;Yr={version:Wt,versions:Vt,arch:Mt,platform:$t,browser:Zt,release:Jt,_rawDebug:Kt,moduleLoadList:Xt,binding:Gt,_linkedBinding:Qt,_events:Mr,_eventsCount:$r,_maxListeners:Ur,on:ee,addListener:jr,once:_r,off:Dr,removeListener:Wr,removeAllListeners:Vr,emit:qr,prependListener:Gr,prependOnceListener:zr,listeners:Hr,domain:er,_exiting:tr,config:rr,dlopen:nr,uptime:Or,_getActiveRequests:ir,_getActiveHandles:or,reallyExit:ar,_kill:sr,cpuUsage:ze,resourceUsage:ur,memoryUsage:pr,kill:lr,exit:cr,openStdin:fr,allowedNodeEnvironmentFlags:dr,assert:mr,features:hr,_fatalExceptions:yr,setUncaughtExceptionCaptureCallback:xr,hasUncaughtExceptionCaptureCallback:gr,emitWarning:qt,nextTick:Pt,_tickCallback:wr,_debugProcess:br,_debugEnd:vr,_startProfilerIdleNotifier:Ir,_stopProfilerIdleNotifier:Er,stdout:Tr,stdin:Rr,stderr:Ar,abort:Br,umask:zt,chdir:Yt,cwd:Ht,env:jt,title:Ut,argv:_t,execArgv:Dt,pid:Fr,ppid:Nr,execPath:Sr,debugPort:Lr,hrtime:Ge,argv0:kr,_preload_modules:Cr,setSourceMapsEnabled:Pr}});var c=he(()=>{"use strict";Jr()});function zi(){if(Zr)return Fe;Zr=!0,Fe.byteLength=I,Fe.toByteArray=N,Fe.fromByteArray=W;for(var s=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,d=o.length;u<d;++u)s[u]=o[u],t[o.charCodeAt(u)]=u;t[45]=62,t[95]=63;function p(T){var A=T.length;if(A%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var S=T.indexOf("=");S===-1&&(S=A);var j=S===A?0:4-S%4;return[S,j]}function I(T){var A=p(T),S=A[0],j=A[1];return(S+j)*3/4-j}function E(T,A,S){return(A+S)*3/4-S}function N(T){var A,S=p(T),j=S[0],q=S[1],$=new e(E(T,j,q)),G=0,H=q>0?j-4:j,V;for(V=0;V<H;V+=4)A=t[T.charCodeAt(V)]<<18|t[T.charCodeAt(V+1)]<<12|t[T.charCodeAt(V+2)]<<6|t[T.charCodeAt(V+3)],$[G++]=A>>16&255,$[G++]=A>>8&255,$[G++]=A&255;return q===2&&(A=t[T.charCodeAt(V)]<<2|t[T.charCodeAt(V+1)]>>4,$[G++]=A&255),q===1&&(A=t[T.charCodeAt(V)]<<10|t[T.charCodeAt(V+1)]<<4|t[T.charCodeAt(V+2)]>>2,$[G++]=A>>8&255,$[G++]=A&255),$}function R(T){return s[T>>18&63]+s[T>>12&63]+s[T>>6&63]+s[T&63]}function k(T,A,S){for(var j,q=[],$=A;$<S;$+=3)j=(T[$]<<16&16711680)+(T[$+1]<<8&65280)+(T[$+2]&255),q.push(R(j));return q.join("")}function W(T){for(var A,S=T.length,j=S%3,q=[],$=16383,G=0,H=S-j;G<H;G+=$)q.push(k(T,G,G+$>H?H:G+$));return j===1?(A=T[S-1],q.push(s[A>>2]+s[A<<4&63]+"==")):j===2&&(A=(T[S-2]<<8)+T[S-1],q.push(s[A>>10]+s[A>>4&63]+s[A<<2&63]+"=")),q.join("")}return Fe}function Hi(){if(Kr)return He;Kr=!0;return He.read=function(s,t,e,o,u){var d,p,I=u*8-o-1,E=(1<<I)-1,N=E>>1,R=-7,k=e?u-1:0,W=e?-1:1,T=s[t+k];for(k+=W,d=T&(1<<-R)-1,T>>=-R,R+=I;R>0;d=d*256+s[t+k],k+=W,R-=8);for(p=d&(1<<-R)-1,d>>=-R,R+=o;R>0;p=p*256+s[t+k],k+=W,R-=8);if(d===0)d=1-N;else{if(d===E)return p?NaN:(T?-1:1)*(1/0);p=p+Math.pow(2,o),d=d-N}return(T?-1:1)*p*Math.pow(2,d-o)},He.write=function(s,t,e,o,u,d){var p,I,E,N=d*8-u-1,R=(1<<N)-1,k=R>>1,W=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=o?0:d-1,A=o?1:-1,S=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(I=isNaN(t)?1:0,p=R):(p=Math.floor(Math.log(t)/Math.LN2),t*(E=Math.pow(2,-p))<1&&(p--,E*=2),p+k>=1?t+=W/E:t+=W*Math.pow(2,1-k),t*E>=2&&(p++,E/=2),p+k>=R?(I=0,p=R):p+k>=1?(I=(t*E-1)*Math.pow(2,u),p=p+k):(I=t*Math.pow(2,k-1)*Math.pow(2,u),p=0));u>=8;s[e+T]=I&255,T+=A,I/=256,u-=8);for(p=p<<u|I,N+=u;N>0;s[e+T]=p&255,T+=A,p/=256,N-=8);s[e+T-A]|=S*128},He}function Qr(){if(Xr)return ue;Xr=!0;let s=zi(),t=Hi(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ue.Buffer=p,ue.SlowBuffer=q,ue.INSPECT_MAX_BYTES=50;let o=2147483647;ue.kMaxLength=o,p.TYPED_ARRAY_SUPPORT=u(),!p.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 u(){try{let i=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(i,r),i.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function d(i){if(i>o)throw new RangeError('The value "'+i+'" is invalid for option "size"');let r=new Uint8Array(i);return Object.setPrototypeOf(r,p.prototype),r}function p(i,r,n){if(typeof i=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return R(i)}return I(i,r,n)}p.poolSize=8192;function I(i,r,n){if(typeof i=="string")return k(i,r);if(ArrayBuffer.isView(i))return T(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(Z(i,ArrayBuffer)||i&&Z(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Z(i,SharedArrayBuffer)||i&&Z(i.buffer,SharedArrayBuffer)))return A(i,r,n);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let a=i.valueOf&&i.valueOf();if(a!=null&&a!==i)return p.from(a,r,n);let m=S(i);if(m)return m;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return p.from(i[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}p.from=function(i,r,n){return I(i,r,n)},Object.setPrototypeOf(p.prototype,Uint8Array.prototype),Object.setPrototypeOf(p,Uint8Array);function E(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function N(i,r,n){return E(i),i<=0?d(i):r!==void 0?typeof n=="string"?d(i).fill(r,n):d(i).fill(r):d(i)}p.alloc=function(i,r,n){return N(i,r,n)};function R(i){return E(i),d(i<0?0:j(i)|0)}p.allocUnsafe=function(i){return R(i)},p.allocUnsafeSlow=function(i){return R(i)};function k(i,r){if((typeof r!="string"||r==="")&&(r="utf8"),!p.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let n=$(i,r)|0,a=d(n),m=a.write(i,r);return m!==n&&(a=a.slice(0,m)),a}function W(i){let r=i.length<0?0:j(i.length)|0,n=d(r);for(let a=0;a<r;a+=1)n[a]=i[a]&255;return n}function T(i){if(Z(i,Uint8Array)){let r=new Uint8Array(i);return A(r.buffer,r.byteOffset,r.byteLength)}return W(i)}function A(i,r,n){if(r<0||i.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let a;return r===void 0&&n===void 0?a=new Uint8Array(i):n===void 0?a=new Uint8Array(i,r):a=new Uint8Array(i,r,n),Object.setPrototypeOf(a,p.prototype),a}function S(i){if(p.isBuffer(i)){let r=j(i.length)|0,n=d(r);return n.length===0||i.copy(n,0,0,r),n}if(i.length!==void 0)return typeof i.length!="number"||at(i.length)?d(0):W(i);if(i.type==="Buffer"&&Array.isArray(i.data))return W(i.data)}function j(i){if(i>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return i|0}function q(i){return+i!=i&&(i=0),p.alloc(+i)}p.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==p.prototype},p.compare=function(r,n){if(Z(r,Uint8Array)&&(r=p.from(r,r.offset,r.byteLength)),Z(n,Uint8Array)&&(n=p.from(n,n.offset,n.byteLength)),!p.isBuffer(r)||!p.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let a=r.length,m=n.length;for(let h=0,y=Math.min(a,m);h<y;++h)if(r[h]!==n[h]){a=r[h],m=n[h];break}return a<m?-1:m<a?1:0},p.isEncoding=function(r){switch(String(r).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}},p.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return p.alloc(0);let a;if(n===void 0)for(n=0,a=0;a<r.length;++a)n+=r[a].length;let m=p.allocUnsafe(n),h=0;for(a=0;a<r.length;++a){let y=r[a];if(Z(y,Uint8Array))h+y.length>m.length?(p.isBuffer(y)||(y=p.from(y)),y.copy(m,h)):Uint8Array.prototype.set.call(m,y,h);else if(p.isBuffer(y))y.copy(m,h);else throw new TypeError('"list" argument must be an Array of Buffers');h+=y.length}return m};function $(i,r){if(p.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||Z(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);let n=i.length,a=arguments.length>2&&arguments[2]===!0;if(!a&&n===0)return 0;let m=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ot(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return kt(i).length;default:if(m)return a?-1:ot(i).length;r=(""+r).toLowerCase(),m=!0}}p.byteLength=$;function G(i,r,n){let a=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return Si(this,r,n);case"utf8":case"utf-8":return Et(this,r,n);case"ascii":return Fi(this,r,n);case"latin1":case"binary":return Ni(this,r,n);case"base64":return Ri(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Li(this,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),a=!0}}p.prototype._isBuffer=!0;function H(i,r,n){let a=i[r];i[r]=i[n],i[n]=a}p.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<r;n+=2)H(this,n,n+1);return this},p.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<r;n+=4)H(this,n,n+3),H(this,n+1,n+2);return this},p.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<r;n+=8)H(this,n,n+7),H(this,n+1,n+6),H(this,n+2,n+5),H(this,n+3,n+4);return this},p.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?Et(this,0,r):G.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(r){if(!p.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:p.compare(this,r)===0},p.prototype.inspect=function(){let r="",n=ue.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},e&&(p.prototype[e]=p.prototype.inspect),p.prototype.compare=function(r,n,a,m,h){if(Z(r,Uint8Array)&&(r=p.from(r,r.offset,r.byteLength)),!p.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),a===void 0&&(a=r?r.length:0),m===void 0&&(m=0),h===void 0&&(h=this.length),n<0||a>r.length||m<0||h>this.length)throw new RangeError("out of range index");if(m>=h&&n>=a)return 0;if(m>=h)return-1;if(n>=a)return 1;if(n>>>=0,a>>>=0,m>>>=0,h>>>=0,this===r)return 0;let y=h-m,B=a-n,U=Math.min(y,B),O=this.slice(m,h),M=r.slice(n,a);for(let L=0;L<U;++L)if(O[L]!==M[L]){y=O[L],B=M[L];break}return y<B?-1:B<y?1:0};function V(i,r,n,a,m){if(i.length===0)return-1;if(typeof n=="string"?(a=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,at(n)&&(n=m?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(m)return-1;n=i.length-1}else if(n<0)if(m)n=0;else return-1;if(typeof r=="string"&&(r=p.from(r,a)),p.isBuffer(r))return r.length===0?-1:It(i,r,n,a,m);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?m?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):It(i,[r],n,a,m);throw new TypeError("val must be string, number or Buffer")}function It(i,r,n,a,m){let h=1,y=i.length,B=r.length;if(a!==void 0&&(a=String(a).toLowerCase(),a==="ucs2"||a==="ucs-2"||a==="utf16le"||a==="utf-16le")){if(i.length<2||r.length<2)return-1;h=2,y/=2,B/=2,n/=2}function U(M,L){return h===1?M[L]:M.readUInt16BE(L*h)}let O;if(m){let M=-1;for(O=n;O<y;O++)if(U(i,O)===U(r,M===-1?0:O-M)){if(M===-1&&(M=O),O-M+1===B)return M*h}else M!==-1&&(O-=O-M),M=-1}else for(n+B>y&&(n=y-B),O=n;O>=0;O--){let M=!0;for(let L=0;L<B;L++)if(U(i,O+L)!==U(r,L)){M=!1;break}if(M)return O}return-1}p.prototype.includes=function(r,n,a){return this.indexOf(r,n,a)!==-1},p.prototype.indexOf=function(r,n,a){return V(this,r,n,a,!0)},p.prototype.lastIndexOf=function(r,n,a){return V(this,r,n,a,!1)};function vi(i,r,n,a){n=Number(n)||0;let m=i.length-n;a?(a=Number(a),a>m&&(a=m)):a=m;let h=r.length;a>h/2&&(a=h/2);let y;for(y=0;y<a;++y){let B=parseInt(r.substr(y*2,2),16);if(at(B))return y;i[n+y]=B}return y}function Ii(i,r,n,a){return We(ot(r,i.length-n),i,n,a)}function Ei(i,r,n,a){return We(Oi(r),i,n,a)}function Ti(i,r,n,a){return We(kt(r),i,n,a)}function Ai(i,r,n,a){return We(Ui(r,i.length-n),i,n,a)}p.prototype.write=function(r,n,a,m){if(n===void 0)m="utf8",a=this.length,n=0;else if(a===void 0&&typeof n=="string")m=n,a=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(a)?(a=a>>>0,m===void 0&&(m="utf8")):(m=a,a=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-n;if((a===void 0||a>h)&&(a=h),r.length>0&&(a<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");m||(m="utf8");let y=!1;for(;;)switch(m){case"hex":return vi(this,r,n,a);case"utf8":case"utf-8":return Ii(this,r,n,a);case"ascii":case"latin1":case"binary":return Ei(this,r,n,a);case"base64":return Ti(this,r,n,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ai(this,r,n,a);default:if(y)throw new TypeError("Unknown encoding: "+m);m=(""+m).toLowerCase(),y=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ri(i,r,n){return r===0&&n===i.length?s.fromByteArray(i):s.fromByteArray(i.slice(r,n))}function Et(i,r,n){n=Math.min(i.length,n);let a=[],m=r;for(;m<n;){let h=i[m],y=null,B=h>239?4:h>223?3:h>191?2:1;if(m+B<=n){let U,O,M,L;switch(B){case 1:h<128&&(y=h);break;case 2:U=i[m+1],(U&192)===128&&(L=(h&31)<<6|U&63,L>127&&(y=L));break;case 3:U=i[m+1],O=i[m+2],(U&192)===128&&(O&192)===128&&(L=(h&15)<<12|(U&63)<<6|O&63,L>2047&&(L<55296||L>57343)&&(y=L));break;case 4:U=i[m+1],O=i[m+2],M=i[m+3],(U&192)===128&&(O&192)===128&&(M&192)===128&&(L=(h&15)<<18|(U&63)<<12|(O&63)<<6|M&63,L>65535&&L<1114112&&(y=L))}}y===null?(y=65533,B=1):y>65535&&(y-=65536,a.push(y>>>10&1023|55296),y=56320|y&1023),a.push(y),m+=B}return Bi(a)}let Tt=4096;function Bi(i){let r=i.length;if(r<=Tt)return String.fromCharCode.apply(String,i);let n="",a=0;for(;a<r;)n+=String.fromCharCode.apply(String,i.slice(a,a+=Tt));return n}function Fi(i,r,n){let a="";n=Math.min(i.length,n);for(let m=r;m<n;++m)a+=String.fromCharCode(i[m]&127);return a}function Ni(i,r,n){let a="";n=Math.min(i.length,n);for(let m=r;m<n;++m)a+=String.fromCharCode(i[m]);return a}function Si(i,r,n){let a=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>a)&&(n=a);let m="";for(let h=r;h<n;++h)m+=Mi[i[h]];return m}function Li(i,r,n){let a=i.slice(r,n),m="";for(let h=0;h<a.length-1;h+=2)m+=String.fromCharCode(a[h]+a[h+1]*256);return m}p.prototype.slice=function(r,n){let a=this.length;r=~~r,n=n===void 0?a:~~n,r<0?(r+=a,r<0&&(r=0)):r>a&&(r=a),n<0?(n+=a,n<0&&(n=0)):n>a&&(n=a),n<r&&(n=r);let m=this.subarray(r,n);return Object.setPrototypeOf(m,p.prototype),m};function _(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=this[r],h=1,y=0;for(;++y<n&&(h*=256);)m+=this[r+y]*h;return m},p.prototype.readUintBE=p.prototype.readUIntBE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=this[r+--n],h=1;for(;n>0&&(h*=256);)m+=this[r+--n]*h;return m},p.prototype.readUint8=p.prototype.readUInt8=function(r,n){return r=r>>>0,n||_(r,1,this.length),this[r]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||_(r,2,this.length),this[r]|this[r+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||_(r,2,this.length),this[r]<<8|this[r+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||_(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||_(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},p.prototype.readBigUInt64LE=ne(function(r){r=r>>>0,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(r,this.length-8);let m=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,h=this[++r]+this[++r]*2**8+this[++r]*2**16+a*2**24;return BigInt(m)+(BigInt(h)<<BigInt(32))}),p.prototype.readBigUInt64BE=ne(function(r){r=r>>>0,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(r,this.length-8);let m=n*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],h=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+a;return(BigInt(m)<<BigInt(32))+BigInt(h)}),p.prototype.readIntLE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=this[r],h=1,y=0;for(;++y<n&&(h*=256);)m+=this[r+y]*h;return h*=128,m>=h&&(m-=Math.pow(2,8*n)),m},p.prototype.readIntBE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=n,h=1,y=this[r+--m];for(;m>0&&(h*=256);)y+=this[r+--m]*h;return h*=128,y>=h&&(y-=Math.pow(2,8*n)),y},p.prototype.readInt8=function(r,n){return r=r>>>0,n||_(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},p.prototype.readInt16LE=function(r,n){r=r>>>0,n||_(r,2,this.length);let a=this[r]|this[r+1]<<8;return a&32768?a|4294901760:a},p.prototype.readInt16BE=function(r,n){r=r>>>0,n||_(r,2,this.length);let a=this[r+1]|this[r]<<8;return a&32768?a|4294901760:a},p.prototype.readInt32LE=function(r,n){return r=r>>>0,n||_(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},p.prototype.readInt32BE=function(r,n){return r=r>>>0,n||_(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},p.prototype.readBigInt64LE=ne(function(r){r=r>>>0,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(r,this.length-8);let m=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(a<<24);return(BigInt(m)<<BigInt(32))+BigInt(n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),p.prototype.readBigInt64BE=ne(function(r){r=r>>>0,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(r,this.length-8);let m=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(m)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+a)}),p.prototype.readFloatLE=function(r,n){return r=r>>>0,n||_(r,4,this.length),t.read(this,r,!0,23,4)},p.prototype.readFloatBE=function(r,n){return r=r>>>0,n||_(r,4,this.length),t.read(this,r,!1,23,4)},p.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||_(r,8,this.length),t.read(this,r,!0,52,8)},p.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||_(r,8,this.length),t.read(this,r,!1,52,8)};function z(i,r,n,a,m,h){if(!p.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>m||r<h)throw new RangeError('"value" argument is out of bounds');if(n+a>i.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(r,n,a,m){if(r=+r,n=n>>>0,a=a>>>0,!m){let B=Math.pow(2,8*a)-1;z(this,r,n,a,B,0)}let h=1,y=0;for(this[n]=r&255;++y<a&&(h*=256);)this[n+y]=r/h&255;return n+a},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(r,n,a,m){if(r=+r,n=n>>>0,a=a>>>0,!m){let B=Math.pow(2,8*a)-1;z(this,r,n,a,B,0)}let h=a-1,y=1;for(this[n+h]=r&255;--h>=0&&(y*=256);)this[n+h]=r/y&255;return n+a},p.prototype.writeUint8=p.prototype.writeUInt8=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,1,255,0),this[n]=r&255,n+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4};function At(i,r,n,a,m){Lt(r,a,m,i,n,7);let h=Number(r&BigInt(4294967295));i[n++]=h,h=h>>8,i[n++]=h,h=h>>8,i[n++]=h,h=h>>8,i[n++]=h;let y=Number(r>>BigInt(32)&BigInt(4294967295));return i[n++]=y,y=y>>8,i[n++]=y,y=y>>8,i[n++]=y,y=y>>8,i[n++]=y,n}function Rt(i,r,n,a,m){Lt(r,a,m,i,n,7);let h=Number(r&BigInt(4294967295));i[n+7]=h,h=h>>8,i[n+6]=h,h=h>>8,i[n+5]=h,h=h>>8,i[n+4]=h;let y=Number(r>>BigInt(32)&BigInt(4294967295));return i[n+3]=y,y=y>>8,i[n+2]=y,y=y>>8,i[n+1]=y,y=y>>8,i[n]=y,n+8}p.prototype.writeBigUInt64LE=ne(function(r,n=0){return At(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=ne(function(r,n=0){return Rt(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(r,n,a,m){if(r=+r,n=n>>>0,!m){let U=Math.pow(2,8*a-1);z(this,r,n,a,U-1,-U)}let h=0,y=1,B=0;for(this[n]=r&255;++h<a&&(y*=256);)r<0&&B===0&&this[n+h-1]!==0&&(B=1),this[n+h]=(r/y>>0)-B&255;return n+a},p.prototype.writeIntBE=function(r,n,a,m){if(r=+r,n=n>>>0,!m){let U=Math.pow(2,8*a-1);z(this,r,n,a,U-1,-U)}let h=a-1,y=1,B=0;for(this[n+h]=r&255;--h>=0&&(y*=256);)r<0&&B===0&&this[n+h+1]!==0&&(B=1),this[n+h]=(r/y>>0)-B&255;return n+a},p.prototype.writeInt8=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},p.prototype.writeInt16LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},p.prototype.writeInt16BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},p.prototype.writeInt32LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},p.prototype.writeInt32BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},p.prototype.writeBigInt64LE=ne(function(r,n=0){return At(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=ne(function(r,n=0){return Rt(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Bt(i,r,n,a,m,h){if(n+a>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Ft(i,r,n,a,m){return r=+r,n=n>>>0,m||Bt(i,r,n,4),t.write(i,r,n,a,23,4),n+4}p.prototype.writeFloatLE=function(r,n,a){return Ft(this,r,n,!0,a)},p.prototype.writeFloatBE=function(r,n,a){return Ft(this,r,n,!1,a)};function Nt(i,r,n,a,m){return r=+r,n=n>>>0,m||Bt(i,r,n,8),t.write(i,r,n,a,52,8),n+8}p.prototype.writeDoubleLE=function(r,n,a){return Nt(this,r,n,!0,a)},p.prototype.writeDoubleBE=function(r,n,a){return Nt(this,r,n,!1,a)},p.prototype.copy=function(r,n,a,m){if(!p.isBuffer(r))throw new TypeError("argument should be a Buffer");if(a||(a=0),!m&&m!==0&&(m=this.length),n>=r.length&&(n=r.length),n||(n=0),m>0&&m<a&&(m=a),m===a||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(a<0||a>=this.length)throw new RangeError("Index out of range");if(m<0)throw new RangeError("sourceEnd out of bounds");m>this.length&&(m=this.length),r.length-n<m-a&&(m=r.length-n+a);let h=m-a;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,a,m):Uint8Array.prototype.set.call(r,this.subarray(a,m),n),h},p.prototype.fill=function(r,n,a,m){if(typeof r=="string"){if(typeof n=="string"?(m=n,n=0,a=this.length):typeof a=="string"&&(m=a,a=this.length),m!==void 0&&typeof m!="string")throw new TypeError("encoding must be a string");if(typeof m=="string"&&!p.isEncoding(m))throw new TypeError("Unknown encoding: "+m);if(r.length===1){let y=r.charCodeAt(0);(m==="utf8"&&y<128||m==="latin1")&&(r=y)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<a)throw new RangeError("Out of range index");if(a<=n)return this;n=n>>>0,a=a===void 0?this.length:a>>>0,r||(r=0);let h;if(typeof r=="number")for(h=n;h<a;++h)this[h]=r;else{let y=p.isBuffer(r)?r:p.from(r,m),B=y.length;if(B===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(h=0;h<a-n;++h)this[h+n]=y[h%B]}return this};let de={};function it(i,r,n){de[i]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name}get code(){return i}set code(m){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:m,writable:!0})}toString(){return`${this.name} [${i}]: ${this.message}`}}}it("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),it("ERR_INVALID_ARG_TYPE",function(i,r){return`The "${i}" argument must be of type number. Received type ${typeof r}`},TypeError),it("ERR_OUT_OF_RANGE",function(i,r,n){let a=`The value of "${i}" is out of range.`,m=n;return Number.isInteger(n)&&Math.abs(n)>2**32?m=St(String(n)):typeof n=="bigint"&&(m=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(m=St(m)),m+="n"),a+=` It must be ${r}. Received ${m}`,a},RangeError);function St(i){let r="",n=i.length,a=i[0]==="-"?1:0;for(;n>=a+4;n-=3)r=`_${i.slice(n-3,n)}${r}`;return`${i.slice(0,n)}${r}`}function ki(i,r,n){me(r,"offset"),(i[r]===void 0||i[r+n]===void 0)&&Be(r,i.length-(n+1))}function Lt(i,r,n,a,m,h){if(i>n||i<r){let y=typeof r=="bigint"?"n":"",B;throw r===0||r===BigInt(0)?B=`>= 0${y} and < 2${y} ** ${(h+1)*8}${y}`:B=`>= -(2${y} ** ${(h+1)*8-1}${y}) and < 2 ** ${(h+1)*8-1}${y}`,new de.ERR_OUT_OF_RANGE("value",B,i)}ki(a,m,h)}function me(i,r){if(typeof i!="number")throw new de.ERR_INVALID_ARG_TYPE(r,"number",i)}function Be(i,r,n){throw Math.floor(i)!==i?(me(i,n),new de.ERR_OUT_OF_RANGE("offset","an integer",i)):r<0?new de.ERR_BUFFER_OUT_OF_BOUNDS:new de.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${r}`,i)}let Ci=/[^+/0-9A-Za-z-_]/g;function Pi(i){if(i=i.split("=")[0],i=i.trim().replace(Ci,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function ot(i,r){r=r||1/0;let n,a=i.length,m=null,h=[];for(let y=0;y<a;++y){if(n=i.charCodeAt(y),n>55295&&n<57344){if(!m){if(n>56319){(r-=3)>-1&&h.push(239,191,189);continue}else if(y+1===a){(r-=3)>-1&&h.push(239,191,189);continue}m=n;continue}if(n<56320){(r-=3)>-1&&h.push(239,191,189),m=n;continue}n=(m-55296<<10|n-56320)+65536}else m&&(r-=3)>-1&&h.push(239,191,189);if(m=null,n<128){if((r-=1)<0)break;h.push(n)}else if(n<2048){if((r-=2)<0)break;h.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;h.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;h.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return h}function Oi(i){let r=[];for(let n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Ui(i,r){let n,a,m,h=[];for(let y=0;y<i.length&&!((r-=2)<0);++y)n=i.charCodeAt(y),a=n>>8,m=n%256,h.push(m),h.push(a);return h}function kt(i){return s.toByteArray(Pi(i))}function We(i,r,n,a){let m;for(m=0;m<a&&!(m+n>=r.length||m>=i.length);++m)r[m+n]=i[m];return m}function Z(i,r){return i instanceof r||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===r.name}function at(i){return i!==i}let Mi=(function(){let i="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){let a=n*16;for(let m=0;m<16;++m)r[a+m]=i[n]+i[m]}return r})();function ne(i){return typeof BigInt>"u"?$i:i}function $i(){throw new Error("BigInt not supported")}return ue}var Fe,Zr,He,Kr,ue,Xr,en=he(()=>{"use strict";l();f();c();Fe={},Zr=!1;He={},Kr=!1;ue={},Xr=!1});var pe,g,fs,ds,tn=he(()=>{"use strict";l();f();c();en();pe=Qr();pe.Buffer;pe.SlowBuffer;pe.INSPECT_MAX_BYTES;pe.kMaxLength;g=pe.Buffer,fs=pe.INSPECT_MAX_BYTES,ds=pe.kMaxLength});var f=he(()=>{"use strict";tn()});var Qa={};K(Qa,{DynamicSnippetsGenerator:()=>nt});module.exports=qi(Qa);l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();var Yi=typeof global=="object"&&global&&global.Object===Object&&global,rn=Yi;var Ji=typeof self=="object"&&self&&self.Object===Object&&self,Zi=rn||Ji||Function("return this")(),nn=Zi;var Ki=nn.Symbol,te=Ki;l();f();c();var on=Object.prototype,Xi=on.hasOwnProperty,Qi=on.toString,Ne=te?te.toStringTag:void 0;function eo(s){var t=Xi.call(s,Ne),e=s[Ne];try{s[Ne]=void 0;var o=!0}catch{}var u=Qi.call(s);return o&&(t?s[Ne]=e:delete s[Ne]),u}var an=eo;l();f();c();var to=Object.prototype,ro=to.toString;function no(s){return ro.call(s)}var sn=no;var io="[object Null]",oo="[object Undefined]",un=te?te.toStringTag:void 0;function ao(s){return s==null?s===void 0?oo:io:un&&un in Object(s)?an(s):sn(s)}var pn=ao;l();f();c();function so(s){return s!=null&&typeof s=="object"}var ln=so;var uo="[object Symbol]";function po(s){return typeof s=="symbol"||ln(s)&&pn(s)==uo}var cn=po;l();f();c();l();f();c();function lo(s,t){for(var e=-1,o=s==null?0:s.length,u=Array(o);++e<o;)u[e]=t(s[e],e,s);return u}var fn=lo;l();f();c();var co=Array.isArray,dn=co;var fo=1/0,mn=te?te.prototype:void 0,hn=mn?mn.toString:void 0;function yn(s){if(typeof s=="string")return s;if(dn(s))return fn(s,yn)+"";if(cn(s))return hn?hn.call(s):"";var t=s+"";return t=="0"&&1/s==-fo?"-0":t}var xn=yn;l();f();c();function mo(s){return s==null?"":xn(s)}var oe=mo;l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();function ho(s,t,e){var o=-1,u=s.length;t<0&&(t=-t>u?0:u+t),e=e>u?u:e,e<0&&(e+=u),u=t>e?0:e-t>>>0,t>>>=0;for(var d=Array(u);++o<u;)d[o]=s[o+t];return d}var gn=ho;function yo(s,t,e){var o=s.length;return e=e===void 0?o:e,!t&&e>=o?s:gn(s,t,e)}var wn=yo;l();f();c();var xo="\\ud800-\\udfff",go="\\u0300-\\u036f",wo="\\ufe20-\\ufe2f",bo="\\u20d0-\\u20ff",vo=go+wo+bo,Io="\\ufe0e\\ufe0f",Eo="\\u200d",To=RegExp("["+Eo+xo+vo+Io+"]");function Ao(s){return To.test(s)}var Ye=Ao;l();f();c();l();f();c();function Ro(s){return s.split("")}var bn=Ro;l();f();c();var vn="\\ud800-\\udfff",Bo="\\u0300-\\u036f",Fo="\\ufe20-\\ufe2f",No="\\u20d0-\\u20ff",So=Bo+Fo+No,Lo="\\ufe0e\\ufe0f",ko="["+vn+"]",lt="["+So+"]",ct="\\ud83c[\\udffb-\\udfff]",Co="(?:"+lt+"|"+ct+")",In="[^"+vn+"]",En="(?:\\ud83c[\\udde6-\\uddff]){2}",Tn="[\\ud800-\\udbff][\\udc00-\\udfff]",Po="\\u200d",An=Co+"?",Rn="["+Lo+"]?",Oo="(?:"+Po+"(?:"+[In,En,Tn].join("|")+")"+Rn+An+")*",Uo=Rn+An+Oo,Mo="(?:"+[In+lt+"?",lt,En,Tn,ko].join("|")+")",$o=RegExp(ct+"(?="+ct+")|"+Mo+Uo,"g");function jo(s){return s.match($o)||[]}var Bn=jo;function _o(s){return Ye(s)?Bn(s):bn(s)}var Fn=_o;function Do(s){return function(t){t=oe(t);var e=Ye(t)?Fn(t):void 0,o=e?e[0]:t.charAt(0),u=e?wn(e,1).join(""):t.slice(1);return o[s]()+u}}var Nn=Do;var Wo=Nn("toUpperCase"),xe=Wo;function Vo(s){return xe(oe(s).toLowerCase())}var Sn=Vo;l();f();c();l();f();c();function qo(s,t,e,o){var u=-1,d=s==null?0:s.length;for(o&&d&&(e=s[++u]);++u<d;)e=t(e,s[u],u,s);return e}var Ln=qo;l();f();c();l();f();c();l();f();c();function Go(s){return function(t){return s?.[t]}}var kn=Go;var zo={\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"},Ho=kn(zo),Cn=Ho;var Yo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Jo="\\u0300-\\u036f",Zo="\\ufe20-\\ufe2f",Ko="\\u20d0-\\u20ff",Xo=Jo+Zo+Ko,Qo="["+Xo+"]",ea=RegExp(Qo,"g");function ta(s){return s=oe(s),s&&s.replace(Yo,Cn).replace(ea,"")}var Pn=ta;l();f();c();l();f();c();var ra=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function na(s){return s.match(ra)||[]}var On=na;l();f();c();var ia=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function oa(s){return ia.test(s)}var Un=oa;l();f();c();var Dn="\\ud800-\\udfff",aa="\\u0300-\\u036f",sa="\\ufe20-\\ufe2f",ua="\\u20d0-\\u20ff",pa=aa+sa+ua,Wn="\\u2700-\\u27bf",Vn="a-z\\xdf-\\xf6\\xf8-\\xff",la="\\xac\\xb1\\xd7\\xf7",ca="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",fa="\\u2000-\\u206f",da=" \\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",qn="A-Z\\xc0-\\xd6\\xd8-\\xde",ma="\\ufe0e\\ufe0f",Gn=la+ca+fa+da,zn="['\u2019]",Mn="["+Gn+"]",ha="["+pa+"]",Hn="\\d+",ya="["+Wn+"]",Yn="["+Vn+"]",Jn="[^"+Dn+Gn+Hn+Wn+Vn+qn+"]",xa="\\ud83c[\\udffb-\\udfff]",ga="(?:"+ha+"|"+xa+")",wa="[^"+Dn+"]",Zn="(?:\\ud83c[\\udde6-\\uddff]){2}",Kn="[\\ud800-\\udbff][\\udc00-\\udfff]",ge="["+qn+"]",ba="\\u200d",$n="(?:"+Yn+"|"+Jn+")",va="(?:"+ge+"|"+Jn+")",jn="(?:"+zn+"(?:d|ll|m|re|s|t|ve))?",_n="(?:"+zn+"(?:D|LL|M|RE|S|T|VE))?",Xn=ga+"?",Qn="["+ma+"]?",Ia="(?:"+ba+"(?:"+[wa,Zn,Kn].join("|")+")"+Qn+Xn+")*",Ea="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ta="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Aa=Qn+Xn+Ia,Ra="(?:"+[ya,Zn,Kn].join("|")+")"+Aa,Ba=RegExp([ge+"?"+Yn+"+"+jn+"(?="+[Mn,ge,"$"].join("|")+")",va+"+"+_n+"(?="+[Mn,ge+$n,"$"].join("|")+")",ge+"?"+$n+"+"+jn,ge+"+"+_n,Ta,Ea,Hn,Ra].join("|"),"g");function Fa(s){return s.match(Ba)||[]}var ei=Fa;function Na(s,t,e){return s=oe(s),t=e?void 0:t,t===void 0?Un(s)?ei(s):On(s):s.match(t)||[]}var ti=Na;var Sa="['\u2019]",La=RegExp(Sa,"g");function ka(s){return function(t){return Ln(ti(Pn(t).replace(La,"")),s,"")}}var ri=ka;var Ca=ri(function(s,t,e){return t=t.toLowerCase(),s+(e?Sn(t):t)}),Je=Ca;l();f();c();function P(s){throw new Error("Unexpected value: "+JSON.stringify(s))}l();f();c();function Se(s){return Object.keys(s)}l();f();c();l();f();c();l();f();c();var Le=x.env.FERN_STACK_TRACK?.toLowerCase()??"",X=Le!==""&&Le!=="0"&&Le!=="false",ft=["single","multiline","box"].includes(Le)?Le:"single";X&&(Error.stackTraceLimit=50);var Pa=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Oa=new Set(["stacktrace"]);function Ke({maxFrames:s=50,skip:t=0,filterPaths:e=[],filterFunctions:o=[],stopOn:u=[],filterNode:d=!0,filterJs:p=!0,formatFilename:I=E=>E}={}){if(!X)return[];o=[...o,...Pa],e=[...e,...Oa],u=[...u,"runInteractiveTask"];let E=!1;return(new Error().stack??"").split(`
|
|
2
|
-
`).map(N=>{let R=N.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(R&&R.length===5){let[,k,W,
|
|
3
|
-
`:""}${o.fn} - ${o.path}:${o.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},dt;function ni({maxFrames:s=50,skip:t=0,filterPaths:e=[],filterFunctions:o=[],stopOn:
|
|
1
|
+
"use strict";var Ve=Object.defineProperty;var ji=Object.getOwnPropertyDescriptor;var _i=Object.getOwnPropertyNames;var Di=Object.prototype.hasOwnProperty;var Wi=(s,t,e)=>t in s?Ve(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var he=(s,t)=>()=>(s&&(t=s(s=0)),t);var K=(s,t)=>{for(var e in t)Ve(s,e,{get:t[e],enumerable:!0})},Vi=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of _i(t))!Di.call(s,p)&&p!==e&&Ve(s,p,{get:()=>t[p],enumerable:!(o=ji(t,p))||o.enumerable});return s};var qi=s=>Vi(Ve({},"__esModule",{value:!0}),s);var b=(s,t,e)=>Wi(s,typeof t!="symbol"?t+"":t,e);var l=he(()=>{"use strict"});var x={};K(x,{_debugEnd:()=>vr,_debugProcess:()=>br,_events:()=>Mr,_eventsCount:()=>$r,_exiting:()=>tr,_fatalExceptions:()=>yr,_getActiveHandles:()=>or,_getActiveRequests:()=>ir,_kill:()=>sr,_linkedBinding:()=>Qt,_maxListeners:()=>Ur,_preload_modules:()=>Cr,_rawDebug:()=>Kt,_startProfilerIdleNotifier:()=>Ir,_stopProfilerIdleNotifier:()=>Tr,_tickCallback:()=>wr,abort:()=>Br,addListener:()=>jr,allowedNodeEnvironmentFlags:()=>dr,arch:()=>Mt,argv:()=>_t,argv0:()=>kr,assert:()=>mr,binding:()=>Gt,browser:()=>Zt,chdir:()=>Yt,config:()=>rr,cpuUsage:()=>ze,cwd:()=>Ht,debugPort:()=>Lr,default:()=>Yr,dlopen:()=>nr,domain:()=>er,emit:()=>qr,emitWarning:()=>qt,env:()=>jt,execArgv:()=>Dt,execPath:()=>Sr,exit:()=>cr,features:()=>hr,hasUncaughtExceptionCaptureCallback:()=>gr,hrtime:()=>Ge,kill:()=>lr,listeners:()=>Hr,memoryUsage:()=>pr,moduleLoadList:()=>Xt,nextTick:()=>Pt,off:()=>Dr,on:()=>ee,once:()=>_r,openStdin:()=>fr,pid:()=>Fr,platform:()=>$t,ppid:()=>Nr,prependListener:()=>Gr,prependOnceListener:()=>zr,reallyExit:()=>ar,release:()=>Jt,removeAllListeners:()=>Vr,removeListener:()=>Wr,resourceUsage:()=>ur,setSourceMapsEnabled:()=>Pr,setUncaughtExceptionCaptureCallback:()=>xr,stderr:()=>Ar,stdin:()=>Rr,stdout:()=>Er,title:()=>Ut,umask:()=>zt,uptime:()=>Or,version:()=>Wt,versions:()=>Vt});function pt(s){throw new Error("Node.js process "+s+" is not supported by JSPM core outside of Node.js")}function Gi(){!ye||!se||(ye=!1,se.length?Q=se.concat(Q):qe=-1,Q.length&&Ct())}function Ct(){if(!ye){var s=setTimeout(Gi,0);ye=!0;for(var t=Q.length;t;){for(se=Q,Q=[];++qe<t;)se&&se[qe].run();qe=-1,t=Q.length}se=null,ye=!1,clearTimeout(s)}}function Pt(s){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];Q.push(new Ot(s,t)),Q.length===1&&!ye&&setTimeout(Ct,0)}function Ot(s,t){this.fun=s,this.array=t}function D(){}function Qt(s){pt("_linkedBinding")}function nr(s){pt("dlopen")}function ir(){return[]}function or(){return[]}function mr(s,t){if(!s)throw new Error(t||"assertion error")}function gr(){return!1}function Or(){return ie.now()/1e3}function Ge(s){var t=Math.floor((Date.now()-ie.now())*.001),e=ie.now()*.001,o=Math.floor(e)+t,p=Math.floor(e%1*1e9);return s&&(o=o-s[0],p=p-s[1],p<0&&(o--,p+=ut)),[o,p]}function ee(){return Yr}function Hr(s){return[]}var Q,ye,se,qe,Ut,Mt,$t,jt,_t,Dt,Wt,Vt,qt,Gt,zt,Ht,Yt,Jt,Zt,Kt,Xt,er,tr,rr,ar,sr,ze,ur,pr,lr,cr,fr,dr,hr,yr,xr,wr,br,vr,Ir,Tr,Er,Ar,Rr,Br,Fr,Nr,Sr,Lr,kr,Cr,Pr,ie,st,ut,Ur,Mr,$r,jr,_r,Dr,Wr,Vr,qr,Gr,zr,Yr,Jr=he(()=>{"use strict";l();f();c();Q=[],ye=!1,qe=-1;Ot.prototype.run=function(){this.fun.apply(null,this.array)};Ut="browser",Mt="x64",$t="browser",jt={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},_t=["/usr/bin/node"],Dt=[],Wt="v16.8.0",Vt={},qt=function(s,t){console.warn((t?t+": ":"")+s)},Gt=function(s){pt("binding")},zt=function(s){return 0},Ht=function(){return"/"},Yt=function(s){},Jt={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Zt=!0,Kt=D,Xt=[];er={},tr=!1,rr={};ar=D,sr=D,ze=function(){return{}},ur=ze,pr=ze,lr=D,cr=D,fr=D,dr={};hr={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},yr=D,xr=D;wr=D,br=D,vr=D,Ir=D,Tr=D,Er=void 0,Ar=void 0,Rr=void 0,Br=D,Fr=2,Nr=1,Sr="/bin/usr/node",Lr=9229,kr="node",Cr=[],Pr=D,ie={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};ie.now===void 0&&(st=Date.now(),ie.timing&&ie.timing.navigationStart&&(st=ie.timing.navigationStart),ie.now=()=>Date.now()-st);ut=1e9;Ge.bigint=function(s){var t=Ge(s);return typeof BigInt>"u"?t[0]*ut+t[1]:BigInt(t[0]*ut)+BigInt(t[1])};Ur=10,Mr={},$r=0;jr=ee,_r=ee,Dr=ee,Wr=ee,Vr=ee,qr=D,Gr=ee,zr=ee;Yr={version:Wt,versions:Vt,arch:Mt,platform:$t,browser:Zt,release:Jt,_rawDebug:Kt,moduleLoadList:Xt,binding:Gt,_linkedBinding:Qt,_events:Mr,_eventsCount:$r,_maxListeners:Ur,on:ee,addListener:jr,once:_r,off:Dr,removeListener:Wr,removeAllListeners:Vr,emit:qr,prependListener:Gr,prependOnceListener:zr,listeners:Hr,domain:er,_exiting:tr,config:rr,dlopen:nr,uptime:Or,_getActiveRequests:ir,_getActiveHandles:or,reallyExit:ar,_kill:sr,cpuUsage:ze,resourceUsage:ur,memoryUsage:pr,kill:lr,exit:cr,openStdin:fr,allowedNodeEnvironmentFlags:dr,assert:mr,features:hr,_fatalExceptions:yr,setUncaughtExceptionCaptureCallback:xr,hasUncaughtExceptionCaptureCallback:gr,emitWarning:qt,nextTick:Pt,_tickCallback:wr,_debugProcess:br,_debugEnd:vr,_startProfilerIdleNotifier:Ir,_stopProfilerIdleNotifier:Tr,stdout:Er,stdin:Rr,stderr:Ar,abort:Br,umask:zt,chdir:Yt,cwd:Ht,env:jt,title:Ut,argv:_t,execArgv:Dt,pid:Fr,ppid:Nr,execPath:Sr,debugPort:Lr,hrtime:Ge,argv0:kr,_preload_modules:Cr,setSourceMapsEnabled:Pr}});var c=he(()=>{"use strict";Jr()});function zi(){if(Zr)return Fe;Zr=!0,Fe.byteLength=I,Fe.toByteArray=N,Fe.fromByteArray=W;for(var s=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,d=o.length;p<d;++p)s[p]=o[p],t[o.charCodeAt(p)]=p;t[45]=62,t[95]=63;function u(E){var A=E.length;if(A%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var S=E.indexOf("=");S===-1&&(S=A);var j=S===A?0:4-S%4;return[S,j]}function I(E){var A=u(E),S=A[0],j=A[1];return(S+j)*3/4-j}function T(E,A,S){return(A+S)*3/4-S}function N(E){var A,S=u(E),j=S[0],q=S[1],$=new e(T(E,j,q)),G=0,H=q>0?j-4:j,V;for(V=0;V<H;V+=4)A=t[E.charCodeAt(V)]<<18|t[E.charCodeAt(V+1)]<<12|t[E.charCodeAt(V+2)]<<6|t[E.charCodeAt(V+3)],$[G++]=A>>16&255,$[G++]=A>>8&255,$[G++]=A&255;return q===2&&(A=t[E.charCodeAt(V)]<<2|t[E.charCodeAt(V+1)]>>4,$[G++]=A&255),q===1&&(A=t[E.charCodeAt(V)]<<10|t[E.charCodeAt(V+1)]<<4|t[E.charCodeAt(V+2)]>>2,$[G++]=A>>8&255,$[G++]=A&255),$}function R(E){return s[E>>18&63]+s[E>>12&63]+s[E>>6&63]+s[E&63]}function k(E,A,S){for(var j,q=[],$=A;$<S;$+=3)j=(E[$]<<16&16711680)+(E[$+1]<<8&65280)+(E[$+2]&255),q.push(R(j));return q.join("")}function W(E){for(var A,S=E.length,j=S%3,q=[],$=16383,G=0,H=S-j;G<H;G+=$)q.push(k(E,G,G+$>H?H:G+$));return j===1?(A=E[S-1],q.push(s[A>>2]+s[A<<4&63]+"==")):j===2&&(A=(E[S-2]<<8)+E[S-1],q.push(s[A>>10]+s[A>>4&63]+s[A<<2&63]+"=")),q.join("")}return Fe}function Hi(){if(Kr)return He;Kr=!0;return He.read=function(s,t,e,o,p){var d,u,I=p*8-o-1,T=(1<<I)-1,N=T>>1,R=-7,k=e?p-1:0,W=e?-1:1,E=s[t+k];for(k+=W,d=E&(1<<-R)-1,E>>=-R,R+=I;R>0;d=d*256+s[t+k],k+=W,R-=8);for(u=d&(1<<-R)-1,d>>=-R,R+=o;R>0;u=u*256+s[t+k],k+=W,R-=8);if(d===0)d=1-N;else{if(d===T)return u?NaN:(E?-1:1)*(1/0);u=u+Math.pow(2,o),d=d-N}return(E?-1:1)*u*Math.pow(2,d-o)},He.write=function(s,t,e,o,p,d){var u,I,T,N=d*8-p-1,R=(1<<N)-1,k=R>>1,W=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=o?0:d-1,A=o?1:-1,S=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(I=isNaN(t)?1:0,u=R):(u=Math.floor(Math.log(t)/Math.LN2),t*(T=Math.pow(2,-u))<1&&(u--,T*=2),u+k>=1?t+=W/T:t+=W*Math.pow(2,1-k),t*T>=2&&(u++,T/=2),u+k>=R?(I=0,u=R):u+k>=1?(I=(t*T-1)*Math.pow(2,p),u=u+k):(I=t*Math.pow(2,k-1)*Math.pow(2,p),u=0));p>=8;s[e+E]=I&255,E+=A,I/=256,p-=8);for(u=u<<p|I,N+=p;N>0;s[e+E]=u&255,E+=A,u/=256,N-=8);s[e+E-A]|=S*128},He}function Qr(){if(Xr)return ue;Xr=!0;let s=zi(),t=Hi(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ue.Buffer=u,ue.SlowBuffer=q,ue.INSPECT_MAX_BYTES=50;let o=2147483647;ue.kMaxLength=o,u.TYPED_ARRAY_SUPPORT=p(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function p(){try{let i=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(i,r),i.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function d(i){if(i>o)throw new RangeError('The value "'+i+'" is invalid for option "size"');let r=new Uint8Array(i);return Object.setPrototypeOf(r,u.prototype),r}function u(i,r,n){if(typeof i=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return R(i)}return I(i,r,n)}u.poolSize=8192;function I(i,r,n){if(typeof i=="string")return k(i,r);if(ArrayBuffer.isView(i))return E(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(Z(i,ArrayBuffer)||i&&Z(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Z(i,SharedArrayBuffer)||i&&Z(i.buffer,SharedArrayBuffer)))return A(i,r,n);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let a=i.valueOf&&i.valueOf();if(a!=null&&a!==i)return u.from(a,r,n);let m=S(i);if(m)return m;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return u.from(i[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}u.from=function(i,r,n){return I(i,r,n)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function T(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function N(i,r,n){return T(i),i<=0?d(i):r!==void 0?typeof n=="string"?d(i).fill(r,n):d(i).fill(r):d(i)}u.alloc=function(i,r,n){return N(i,r,n)};function R(i){return T(i),d(i<0?0:j(i)|0)}u.allocUnsafe=function(i){return R(i)},u.allocUnsafeSlow=function(i){return R(i)};function k(i,r){if((typeof r!="string"||r==="")&&(r="utf8"),!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let n=$(i,r)|0,a=d(n),m=a.write(i,r);return m!==n&&(a=a.slice(0,m)),a}function W(i){let r=i.length<0?0:j(i.length)|0,n=d(r);for(let a=0;a<r;a+=1)n[a]=i[a]&255;return n}function E(i){if(Z(i,Uint8Array)){let r=new Uint8Array(i);return A(r.buffer,r.byteOffset,r.byteLength)}return W(i)}function A(i,r,n){if(r<0||i.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let a;return r===void 0&&n===void 0?a=new Uint8Array(i):n===void 0?a=new Uint8Array(i,r):a=new Uint8Array(i,r,n),Object.setPrototypeOf(a,u.prototype),a}function S(i){if(u.isBuffer(i)){let r=j(i.length)|0,n=d(r);return n.length===0||i.copy(n,0,0,r),n}if(i.length!==void 0)return typeof i.length!="number"||at(i.length)?d(0):W(i);if(i.type==="Buffer"&&Array.isArray(i.data))return W(i.data)}function j(i){if(i>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return i|0}function q(i){return+i!=i&&(i=0),u.alloc(+i)}u.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==u.prototype},u.compare=function(r,n){if(Z(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),Z(n,Uint8Array)&&(n=u.from(n,n.offset,n.byteLength)),!u.isBuffer(r)||!u.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let a=r.length,m=n.length;for(let h=0,y=Math.min(a,m);h<y;++h)if(r[h]!==n[h]){a=r[h],m=n[h];break}return a<m?-1:m<a?1:0},u.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);let a;if(n===void 0)for(n=0,a=0;a<r.length;++a)n+=r[a].length;let m=u.allocUnsafe(n),h=0;for(a=0;a<r.length;++a){let y=r[a];if(Z(y,Uint8Array))h+y.length>m.length?(u.isBuffer(y)||(y=u.from(y)),y.copy(m,h)):Uint8Array.prototype.set.call(m,y,h);else if(u.isBuffer(y))y.copy(m,h);else throw new TypeError('"list" argument must be an Array of Buffers');h+=y.length}return m};function $(i,r){if(u.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||Z(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);let n=i.length,a=arguments.length>2&&arguments[2]===!0;if(!a&&n===0)return 0;let m=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ot(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return kt(i).length;default:if(m)return a?-1:ot(i).length;r=(""+r).toLowerCase(),m=!0}}u.byteLength=$;function G(i,r,n){let a=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return Si(this,r,n);case"utf8":case"utf-8":return Tt(this,r,n);case"ascii":return Fi(this,r,n);case"latin1":case"binary":return Ni(this,r,n);case"base64":return Ri(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Li(this,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),a=!0}}u.prototype._isBuffer=!0;function H(i,r,n){let a=i[r];i[r]=i[n],i[n]=a}u.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<r;n+=2)H(this,n,n+1);return this},u.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<r;n+=4)H(this,n,n+3),H(this,n+1,n+2);return this},u.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<r;n+=8)H(this,n,n+7),H(this,n+1,n+6),H(this,n+2,n+5),H(this,n+3,n+4);return this},u.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?Tt(this,0,r):G.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(r){if(!u.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0},u.prototype.inspect=function(){let r="",n=ue.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},e&&(u.prototype[e]=u.prototype.inspect),u.prototype.compare=function(r,n,a,m,h){if(Z(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),a===void 0&&(a=r?r.length:0),m===void 0&&(m=0),h===void 0&&(h=this.length),n<0||a>r.length||m<0||h>this.length)throw new RangeError("out of range index");if(m>=h&&n>=a)return 0;if(m>=h)return-1;if(n>=a)return 1;if(n>>>=0,a>>>=0,m>>>=0,h>>>=0,this===r)return 0;let y=h-m,B=a-n,U=Math.min(y,B),O=this.slice(m,h),M=r.slice(n,a);for(let L=0;L<U;++L)if(O[L]!==M[L]){y=O[L],B=M[L];break}return y<B?-1:B<y?1:0};function V(i,r,n,a,m){if(i.length===0)return-1;if(typeof n=="string"?(a=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,at(n)&&(n=m?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(m)return-1;n=i.length-1}else if(n<0)if(m)n=0;else return-1;if(typeof r=="string"&&(r=u.from(r,a)),u.isBuffer(r))return r.length===0?-1:It(i,r,n,a,m);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?m?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):It(i,[r],n,a,m);throw new TypeError("val must be string, number or Buffer")}function It(i,r,n,a,m){let h=1,y=i.length,B=r.length;if(a!==void 0&&(a=String(a).toLowerCase(),a==="ucs2"||a==="ucs-2"||a==="utf16le"||a==="utf-16le")){if(i.length<2||r.length<2)return-1;h=2,y/=2,B/=2,n/=2}function U(M,L){return h===1?M[L]:M.readUInt16BE(L*h)}let O;if(m){let M=-1;for(O=n;O<y;O++)if(U(i,O)===U(r,M===-1?0:O-M)){if(M===-1&&(M=O),O-M+1===B)return M*h}else M!==-1&&(O-=O-M),M=-1}else for(n+B>y&&(n=y-B),O=n;O>=0;O--){let M=!0;for(let L=0;L<B;L++)if(U(i,O+L)!==U(r,L)){M=!1;break}if(M)return O}return-1}u.prototype.includes=function(r,n,a){return this.indexOf(r,n,a)!==-1},u.prototype.indexOf=function(r,n,a){return V(this,r,n,a,!0)},u.prototype.lastIndexOf=function(r,n,a){return V(this,r,n,a,!1)};function vi(i,r,n,a){n=Number(n)||0;let m=i.length-n;a?(a=Number(a),a>m&&(a=m)):a=m;let h=r.length;a>h/2&&(a=h/2);let y;for(y=0;y<a;++y){let B=parseInt(r.substr(y*2,2),16);if(at(B))return y;i[n+y]=B}return y}function Ii(i,r,n,a){return We(ot(r,i.length-n),i,n,a)}function Ti(i,r,n,a){return We(Oi(r),i,n,a)}function Ei(i,r,n,a){return We(kt(r),i,n,a)}function Ai(i,r,n,a){return We(Ui(r,i.length-n),i,n,a)}u.prototype.write=function(r,n,a,m){if(n===void 0)m="utf8",a=this.length,n=0;else if(a===void 0&&typeof n=="string")m=n,a=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(a)?(a=a>>>0,m===void 0&&(m="utf8")):(m=a,a=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-n;if((a===void 0||a>h)&&(a=h),r.length>0&&(a<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");m||(m="utf8");let y=!1;for(;;)switch(m){case"hex":return vi(this,r,n,a);case"utf8":case"utf-8":return Ii(this,r,n,a);case"ascii":case"latin1":case"binary":return Ti(this,r,n,a);case"base64":return Ei(this,r,n,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ai(this,r,n,a);default:if(y)throw new TypeError("Unknown encoding: "+m);m=(""+m).toLowerCase(),y=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ri(i,r,n){return r===0&&n===i.length?s.fromByteArray(i):s.fromByteArray(i.slice(r,n))}function Tt(i,r,n){n=Math.min(i.length,n);let a=[],m=r;for(;m<n;){let h=i[m],y=null,B=h>239?4:h>223?3:h>191?2:1;if(m+B<=n){let U,O,M,L;switch(B){case 1:h<128&&(y=h);break;case 2:U=i[m+1],(U&192)===128&&(L=(h&31)<<6|U&63,L>127&&(y=L));break;case 3:U=i[m+1],O=i[m+2],(U&192)===128&&(O&192)===128&&(L=(h&15)<<12|(U&63)<<6|O&63,L>2047&&(L<55296||L>57343)&&(y=L));break;case 4:U=i[m+1],O=i[m+2],M=i[m+3],(U&192)===128&&(O&192)===128&&(M&192)===128&&(L=(h&15)<<18|(U&63)<<12|(O&63)<<6|M&63,L>65535&&L<1114112&&(y=L))}}y===null?(y=65533,B=1):y>65535&&(y-=65536,a.push(y>>>10&1023|55296),y=56320|y&1023),a.push(y),m+=B}return Bi(a)}let Et=4096;function Bi(i){let r=i.length;if(r<=Et)return String.fromCharCode.apply(String,i);let n="",a=0;for(;a<r;)n+=String.fromCharCode.apply(String,i.slice(a,a+=Et));return n}function Fi(i,r,n){let a="";n=Math.min(i.length,n);for(let m=r;m<n;++m)a+=String.fromCharCode(i[m]&127);return a}function Ni(i,r,n){let a="";n=Math.min(i.length,n);for(let m=r;m<n;++m)a+=String.fromCharCode(i[m]);return a}function Si(i,r,n){let a=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>a)&&(n=a);let m="";for(let h=r;h<n;++h)m+=Mi[i[h]];return m}function Li(i,r,n){let a=i.slice(r,n),m="";for(let h=0;h<a.length-1;h+=2)m+=String.fromCharCode(a[h]+a[h+1]*256);return m}u.prototype.slice=function(r,n){let a=this.length;r=~~r,n=n===void 0?a:~~n,r<0?(r+=a,r<0&&(r=0)):r>a&&(r=a),n<0?(n+=a,n<0&&(n=0)):n>a&&(n=a),n<r&&(n=r);let m=this.subarray(r,n);return Object.setPrototypeOf(m,u.prototype),m};function _(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=this[r],h=1,y=0;for(;++y<n&&(h*=256);)m+=this[r+y]*h;return m},u.prototype.readUintBE=u.prototype.readUIntBE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=this[r+--n],h=1;for(;n>0&&(h*=256);)m+=this[r+--n]*h;return m},u.prototype.readUint8=u.prototype.readUInt8=function(r,n){return r=r>>>0,n||_(r,1,this.length),this[r]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||_(r,2,this.length),this[r]|this[r+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||_(r,2,this.length),this[r]<<8|this[r+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||_(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||_(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},u.prototype.readBigUInt64LE=ne(function(r){r=r>>>0,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(r,this.length-8);let m=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,h=this[++r]+this[++r]*2**8+this[++r]*2**16+a*2**24;return BigInt(m)+(BigInt(h)<<BigInt(32))}),u.prototype.readBigUInt64BE=ne(function(r){r=r>>>0,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(r,this.length-8);let m=n*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],h=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+a;return(BigInt(m)<<BigInt(32))+BigInt(h)}),u.prototype.readIntLE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=this[r],h=1,y=0;for(;++y<n&&(h*=256);)m+=this[r+y]*h;return h*=128,m>=h&&(m-=Math.pow(2,8*n)),m},u.prototype.readIntBE=function(r,n,a){r=r>>>0,n=n>>>0,a||_(r,n,this.length);let m=n,h=1,y=this[r+--m];for(;m>0&&(h*=256);)y+=this[r+--m]*h;return h*=128,y>=h&&(y-=Math.pow(2,8*n)),y},u.prototype.readInt8=function(r,n){return r=r>>>0,n||_(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},u.prototype.readInt16LE=function(r,n){r=r>>>0,n||_(r,2,this.length);let a=this[r]|this[r+1]<<8;return a&32768?a|4294901760:a},u.prototype.readInt16BE=function(r,n){r=r>>>0,n||_(r,2,this.length);let a=this[r+1]|this[r]<<8;return a&32768?a|4294901760:a},u.prototype.readInt32LE=function(r,n){return r=r>>>0,n||_(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},u.prototype.readInt32BE=function(r,n){return r=r>>>0,n||_(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},u.prototype.readBigInt64LE=ne(function(r){r=r>>>0,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(r,this.length-8);let m=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(a<<24);return(BigInt(m)<<BigInt(32))+BigInt(n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),u.prototype.readBigInt64BE=ne(function(r){r=r>>>0,me(r,"offset");let n=this[r],a=this[r+7];(n===void 0||a===void 0)&&Be(r,this.length-8);let m=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(m)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+a)}),u.prototype.readFloatLE=function(r,n){return r=r>>>0,n||_(r,4,this.length),t.read(this,r,!0,23,4)},u.prototype.readFloatBE=function(r,n){return r=r>>>0,n||_(r,4,this.length),t.read(this,r,!1,23,4)},u.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||_(r,8,this.length),t.read(this,r,!0,52,8)},u.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||_(r,8,this.length),t.read(this,r,!1,52,8)};function z(i,r,n,a,m,h){if(!u.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>m||r<h)throw new RangeError('"value" argument is out of bounds');if(n+a>i.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(r,n,a,m){if(r=+r,n=n>>>0,a=a>>>0,!m){let B=Math.pow(2,8*a)-1;z(this,r,n,a,B,0)}let h=1,y=0;for(this[n]=r&255;++y<a&&(h*=256);)this[n+y]=r/h&255;return n+a},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(r,n,a,m){if(r=+r,n=n>>>0,a=a>>>0,!m){let B=Math.pow(2,8*a)-1;z(this,r,n,a,B,0)}let h=a-1,y=1;for(this[n+h]=r&255;--h>=0&&(y*=256);)this[n+h]=r/y&255;return n+a},u.prototype.writeUint8=u.prototype.writeUInt8=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,1,255,0),this[n]=r&255,n+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4};function At(i,r,n,a,m){Lt(r,a,m,i,n,7);let h=Number(r&BigInt(4294967295));i[n++]=h,h=h>>8,i[n++]=h,h=h>>8,i[n++]=h,h=h>>8,i[n++]=h;let y=Number(r>>BigInt(32)&BigInt(4294967295));return i[n++]=y,y=y>>8,i[n++]=y,y=y>>8,i[n++]=y,y=y>>8,i[n++]=y,n}function Rt(i,r,n,a,m){Lt(r,a,m,i,n,7);let h=Number(r&BigInt(4294967295));i[n+7]=h,h=h>>8,i[n+6]=h,h=h>>8,i[n+5]=h,h=h>>8,i[n+4]=h;let y=Number(r>>BigInt(32)&BigInt(4294967295));return i[n+3]=y,y=y>>8,i[n+2]=y,y=y>>8,i[n+1]=y,y=y>>8,i[n]=y,n+8}u.prototype.writeBigUInt64LE=ne(function(r,n=0){return At(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=ne(function(r,n=0){return Rt(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(r,n,a,m){if(r=+r,n=n>>>0,!m){let U=Math.pow(2,8*a-1);z(this,r,n,a,U-1,-U)}let h=0,y=1,B=0;for(this[n]=r&255;++h<a&&(y*=256);)r<0&&B===0&&this[n+h-1]!==0&&(B=1),this[n+h]=(r/y>>0)-B&255;return n+a},u.prototype.writeIntBE=function(r,n,a,m){if(r=+r,n=n>>>0,!m){let U=Math.pow(2,8*a-1);z(this,r,n,a,U-1,-U)}let h=a-1,y=1,B=0;for(this[n+h]=r&255;--h>=0&&(y*=256);)r<0&&B===0&&this[n+h+1]!==0&&(B=1),this[n+h]=(r/y>>0)-B&255;return n+a},u.prototype.writeInt8=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},u.prototype.writeInt16LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},u.prototype.writeInt16BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},u.prototype.writeInt32LE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},u.prototype.writeInt32BE=function(r,n,a){return r=+r,n=n>>>0,a||z(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},u.prototype.writeBigInt64LE=ne(function(r,n=0){return At(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=ne(function(r,n=0){return Rt(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Bt(i,r,n,a,m,h){if(n+a>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Ft(i,r,n,a,m){return r=+r,n=n>>>0,m||Bt(i,r,n,4),t.write(i,r,n,a,23,4),n+4}u.prototype.writeFloatLE=function(r,n,a){return Ft(this,r,n,!0,a)},u.prototype.writeFloatBE=function(r,n,a){return Ft(this,r,n,!1,a)};function Nt(i,r,n,a,m){return r=+r,n=n>>>0,m||Bt(i,r,n,8),t.write(i,r,n,a,52,8),n+8}u.prototype.writeDoubleLE=function(r,n,a){return Nt(this,r,n,!0,a)},u.prototype.writeDoubleBE=function(r,n,a){return Nt(this,r,n,!1,a)},u.prototype.copy=function(r,n,a,m){if(!u.isBuffer(r))throw new TypeError("argument should be a Buffer");if(a||(a=0),!m&&m!==0&&(m=this.length),n>=r.length&&(n=r.length),n||(n=0),m>0&&m<a&&(m=a),m===a||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(a<0||a>=this.length)throw new RangeError("Index out of range");if(m<0)throw new RangeError("sourceEnd out of bounds");m>this.length&&(m=this.length),r.length-n<m-a&&(m=r.length-n+a);let h=m-a;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,a,m):Uint8Array.prototype.set.call(r,this.subarray(a,m),n),h},u.prototype.fill=function(r,n,a,m){if(typeof r=="string"){if(typeof n=="string"?(m=n,n=0,a=this.length):typeof a=="string"&&(m=a,a=this.length),m!==void 0&&typeof m!="string")throw new TypeError("encoding must be a string");if(typeof m=="string"&&!u.isEncoding(m))throw new TypeError("Unknown encoding: "+m);if(r.length===1){let y=r.charCodeAt(0);(m==="utf8"&&y<128||m==="latin1")&&(r=y)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<a)throw new RangeError("Out of range index");if(a<=n)return this;n=n>>>0,a=a===void 0?this.length:a>>>0,r||(r=0);let h;if(typeof r=="number")for(h=n;h<a;++h)this[h]=r;else{let y=u.isBuffer(r)?r:u.from(r,m),B=y.length;if(B===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(h=0;h<a-n;++h)this[h+n]=y[h%B]}return this};let de={};function it(i,r,n){de[i]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name}get code(){return i}set code(m){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:m,writable:!0})}toString(){return`${this.name} [${i}]: ${this.message}`}}}it("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),it("ERR_INVALID_ARG_TYPE",function(i,r){return`The "${i}" argument must be of type number. Received type ${typeof r}`},TypeError),it("ERR_OUT_OF_RANGE",function(i,r,n){let a=`The value of "${i}" is out of range.`,m=n;return Number.isInteger(n)&&Math.abs(n)>2**32?m=St(String(n)):typeof n=="bigint"&&(m=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(m=St(m)),m+="n"),a+=` It must be ${r}. Received ${m}`,a},RangeError);function St(i){let r="",n=i.length,a=i[0]==="-"?1:0;for(;n>=a+4;n-=3)r=`_${i.slice(n-3,n)}${r}`;return`${i.slice(0,n)}${r}`}function ki(i,r,n){me(r,"offset"),(i[r]===void 0||i[r+n]===void 0)&&Be(r,i.length-(n+1))}function Lt(i,r,n,a,m,h){if(i>n||i<r){let y=typeof r=="bigint"?"n":"",B;throw r===0||r===BigInt(0)?B=`>= 0${y} and < 2${y} ** ${(h+1)*8}${y}`:B=`>= -(2${y} ** ${(h+1)*8-1}${y}) and < 2 ** ${(h+1)*8-1}${y}`,new de.ERR_OUT_OF_RANGE("value",B,i)}ki(a,m,h)}function me(i,r){if(typeof i!="number")throw new de.ERR_INVALID_ARG_TYPE(r,"number",i)}function Be(i,r,n){throw Math.floor(i)!==i?(me(i,n),new de.ERR_OUT_OF_RANGE("offset","an integer",i)):r<0?new de.ERR_BUFFER_OUT_OF_BOUNDS:new de.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${r}`,i)}let Ci=/[^+/0-9A-Za-z-_]/g;function Pi(i){if(i=i.split("=")[0],i=i.trim().replace(Ci,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function ot(i,r){r=r||1/0;let n,a=i.length,m=null,h=[];for(let y=0;y<a;++y){if(n=i.charCodeAt(y),n>55295&&n<57344){if(!m){if(n>56319){(r-=3)>-1&&h.push(239,191,189);continue}else if(y+1===a){(r-=3)>-1&&h.push(239,191,189);continue}m=n;continue}if(n<56320){(r-=3)>-1&&h.push(239,191,189),m=n;continue}n=(m-55296<<10|n-56320)+65536}else m&&(r-=3)>-1&&h.push(239,191,189);if(m=null,n<128){if((r-=1)<0)break;h.push(n)}else if(n<2048){if((r-=2)<0)break;h.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;h.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;h.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return h}function Oi(i){let r=[];for(let n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Ui(i,r){let n,a,m,h=[];for(let y=0;y<i.length&&!((r-=2)<0);++y)n=i.charCodeAt(y),a=n>>8,m=n%256,h.push(m),h.push(a);return h}function kt(i){return s.toByteArray(Pi(i))}function We(i,r,n,a){let m;for(m=0;m<a&&!(m+n>=r.length||m>=i.length);++m)r[m+n]=i[m];return m}function Z(i,r){return i instanceof r||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===r.name}function at(i){return i!==i}let Mi=(function(){let i="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){let a=n*16;for(let m=0;m<16;++m)r[a+m]=i[n]+i[m]}return r})();function ne(i){return typeof BigInt>"u"?$i:i}function $i(){throw new Error("BigInt not supported")}return ue}var Fe,Zr,He,Kr,ue,Xr,en=he(()=>{"use strict";l();f();c();Fe={},Zr=!1;He={},Kr=!1;ue={},Xr=!1});var pe,g,fs,ds,tn=he(()=>{"use strict";l();f();c();en();pe=Qr();pe.Buffer;pe.SlowBuffer;pe.INSPECT_MAX_BYTES;pe.kMaxLength;g=pe.Buffer,fs=pe.INSPECT_MAX_BYTES,ds=pe.kMaxLength});var f=he(()=>{"use strict";tn()});var Qa={};K(Qa,{DynamicSnippetsGenerator:()=>nt});module.exports=qi(Qa);l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();var Yi=typeof global=="object"&&global&&global.Object===Object&&global,rn=Yi;var Ji=typeof self=="object"&&self&&self.Object===Object&&self,Zi=rn||Ji||Function("return this")(),nn=Zi;var Ki=nn.Symbol,te=Ki;l();f();c();var on=Object.prototype,Xi=on.hasOwnProperty,Qi=on.toString,Ne=te?te.toStringTag:void 0;function eo(s){var t=Xi.call(s,Ne),e=s[Ne];try{s[Ne]=void 0;var o=!0}catch{}var p=Qi.call(s);return o&&(t?s[Ne]=e:delete s[Ne]),p}var an=eo;l();f();c();var to=Object.prototype,ro=to.toString;function no(s){return ro.call(s)}var sn=no;var io="[object Null]",oo="[object Undefined]",un=te?te.toStringTag:void 0;function ao(s){return s==null?s===void 0?oo:io:un&&un in Object(s)?an(s):sn(s)}var pn=ao;l();f();c();function so(s){return s!=null&&typeof s=="object"}var ln=so;var uo="[object Symbol]";function po(s){return typeof s=="symbol"||ln(s)&&pn(s)==uo}var cn=po;l();f();c();l();f();c();function lo(s,t){for(var e=-1,o=s==null?0:s.length,p=Array(o);++e<o;)p[e]=t(s[e],e,s);return p}var fn=lo;l();f();c();var co=Array.isArray,dn=co;var fo=1/0,mn=te?te.prototype:void 0,hn=mn?mn.toString:void 0;function yn(s){if(typeof s=="string")return s;if(dn(s))return fn(s,yn)+"";if(cn(s))return hn?hn.call(s):"";var t=s+"";return t=="0"&&1/s==-fo?"-0":t}var xn=yn;l();f();c();function mo(s){return s==null?"":xn(s)}var oe=mo;l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();function ho(s,t,e){var o=-1,p=s.length;t<0&&(t=-t>p?0:p+t),e=e>p?p:e,e<0&&(e+=p),p=t>e?0:e-t>>>0,t>>>=0;for(var d=Array(p);++o<p;)d[o]=s[o+t];return d}var gn=ho;function yo(s,t,e){var o=s.length;return e=e===void 0?o:e,!t&&e>=o?s:gn(s,t,e)}var wn=yo;l();f();c();var xo="\\ud800-\\udfff",go="\\u0300-\\u036f",wo="\\ufe20-\\ufe2f",bo="\\u20d0-\\u20ff",vo=go+wo+bo,Io="\\ufe0e\\ufe0f",To="\\u200d",Eo=RegExp("["+To+xo+vo+Io+"]");function Ao(s){return Eo.test(s)}var Ye=Ao;l();f();c();l();f();c();function Ro(s){return s.split("")}var bn=Ro;l();f();c();var vn="\\ud800-\\udfff",Bo="\\u0300-\\u036f",Fo="\\ufe20-\\ufe2f",No="\\u20d0-\\u20ff",So=Bo+Fo+No,Lo="\\ufe0e\\ufe0f",ko="["+vn+"]",lt="["+So+"]",ct="\\ud83c[\\udffb-\\udfff]",Co="(?:"+lt+"|"+ct+")",In="[^"+vn+"]",Tn="(?:\\ud83c[\\udde6-\\uddff]){2}",En="[\\ud800-\\udbff][\\udc00-\\udfff]",Po="\\u200d",An=Co+"?",Rn="["+Lo+"]?",Oo="(?:"+Po+"(?:"+[In,Tn,En].join("|")+")"+Rn+An+")*",Uo=Rn+An+Oo,Mo="(?:"+[In+lt+"?",lt,Tn,En,ko].join("|")+")",$o=RegExp(ct+"(?="+ct+")|"+Mo+Uo,"g");function jo(s){return s.match($o)||[]}var Bn=jo;function _o(s){return Ye(s)?Bn(s):bn(s)}var Fn=_o;function Do(s){return function(t){t=oe(t);var e=Ye(t)?Fn(t):void 0,o=e?e[0]:t.charAt(0),p=e?wn(e,1).join(""):t.slice(1);return o[s]()+p}}var Nn=Do;var Wo=Nn("toUpperCase"),xe=Wo;function Vo(s){return xe(oe(s).toLowerCase())}var Sn=Vo;l();f();c();l();f();c();function qo(s,t,e,o){var p=-1,d=s==null?0:s.length;for(o&&d&&(e=s[++p]);++p<d;)e=t(e,s[p],p,s);return e}var Ln=qo;l();f();c();l();f();c();l();f();c();function Go(s){return function(t){return s?.[t]}}var kn=Go;var zo={\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"},Ho=kn(zo),Cn=Ho;var Yo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Jo="\\u0300-\\u036f",Zo="\\ufe20-\\ufe2f",Ko="\\u20d0-\\u20ff",Xo=Jo+Zo+Ko,Qo="["+Xo+"]",ea=RegExp(Qo,"g");function ta(s){return s=oe(s),s&&s.replace(Yo,Cn).replace(ea,"")}var Pn=ta;l();f();c();l();f();c();var ra=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function na(s){return s.match(ra)||[]}var On=na;l();f();c();var ia=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function oa(s){return ia.test(s)}var Un=oa;l();f();c();var Dn="\\ud800-\\udfff",aa="\\u0300-\\u036f",sa="\\ufe20-\\ufe2f",ua="\\u20d0-\\u20ff",pa=aa+sa+ua,Wn="\\u2700-\\u27bf",Vn="a-z\\xdf-\\xf6\\xf8-\\xff",la="\\xac\\xb1\\xd7\\xf7",ca="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",fa="\\u2000-\\u206f",da=" \\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",qn="A-Z\\xc0-\\xd6\\xd8-\\xde",ma="\\ufe0e\\ufe0f",Gn=la+ca+fa+da,zn="['\u2019]",Mn="["+Gn+"]",ha="["+pa+"]",Hn="\\d+",ya="["+Wn+"]",Yn="["+Vn+"]",Jn="[^"+Dn+Gn+Hn+Wn+Vn+qn+"]",xa="\\ud83c[\\udffb-\\udfff]",ga="(?:"+ha+"|"+xa+")",wa="[^"+Dn+"]",Zn="(?:\\ud83c[\\udde6-\\uddff]){2}",Kn="[\\ud800-\\udbff][\\udc00-\\udfff]",ge="["+qn+"]",ba="\\u200d",$n="(?:"+Yn+"|"+Jn+")",va="(?:"+ge+"|"+Jn+")",jn="(?:"+zn+"(?:d|ll|m|re|s|t|ve))?",_n="(?:"+zn+"(?:D|LL|M|RE|S|T|VE))?",Xn=ga+"?",Qn="["+ma+"]?",Ia="(?:"+ba+"(?:"+[wa,Zn,Kn].join("|")+")"+Qn+Xn+")*",Ta="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ea="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Aa=Qn+Xn+Ia,Ra="(?:"+[ya,Zn,Kn].join("|")+")"+Aa,Ba=RegExp([ge+"?"+Yn+"+"+jn+"(?="+[Mn,ge,"$"].join("|")+")",va+"+"+_n+"(?="+[Mn,ge+$n,"$"].join("|")+")",ge+"?"+$n+"+"+jn,ge+"+"+_n,Ea,Ta,Hn,Ra].join("|"),"g");function Fa(s){return s.match(Ba)||[]}var ei=Fa;function Na(s,t,e){return s=oe(s),t=e?void 0:t,t===void 0?Un(s)?ei(s):On(s):s.match(t)||[]}var ti=Na;var Sa="['\u2019]",La=RegExp(Sa,"g");function ka(s){return function(t){return Ln(ti(Pn(t).replace(La,"")),s,"")}}var ri=ka;var Ca=ri(function(s,t,e){return t=t.toLowerCase(),s+(e?Sn(t):t)}),Je=Ca;l();f();c();function P(s){throw new Error("Unexpected value: "+JSON.stringify(s))}l();f();c();function Se(s){return Object.keys(s)}l();f();c();l();f();c();l();f();c();var Le=x.env.FERN_STACK_TRACK?.toLowerCase()??"",X=Le!==""&&Le!=="0"&&Le!=="false",ft=["single","multiline","box"].includes(Le)?Le:"single";X&&(Error.stackTraceLimit=50);var Pa=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Oa=new Set(["stacktrace"]);function Ke({maxFrames:s=50,skip:t=0,filterPaths:e=[],filterFunctions:o=[],stopOn:p=[],filterNode:d=!0,filterJs:u=!0,formatFilename:I=T=>T}={}){if(!X)return[];o=[...o,...Pa],e=[...e,...Oa],p=[...p,"runInteractiveTask"];let T=!1;return(new Error().stack??"").split(`
|
|
2
|
+
`).map(N=>{let R=N.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(R&&R.length===5){let[,k,W,E,A]=R;if(!k||!W||!E||!A)return;if(T||p.some(S=>k?.includes(S))){T=!0;return}switch(k){case"Object.<anonymous>":k="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":k=`${k.substring(k.indexOf(".")+1)}()=> { ... }`;break}return{fn:k,path:I(W),position:`${E}:${A}`}}}).filter(N=>N&&!o.some(R=>N.fn.includes(R))&&!(d&&N.path?.startsWith("node:"))&&!(u&&N.path?.endsWith(".js"))&&!e.some(R=>N.path.includes(R))).slice(t,t+s)}var Ze=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:o=[],filterFunctions:p=[],stopOn:d=[],filterNode:u=!0,filterJs:I=!0,multiline:T=!1,formatFilename:N=R=>R}={}){b(this,"maxFrames");b(this,"skip");b(this,"filterPaths");b(this,"filterFunctions");b(this,"stopOn");b(this,"filterNode");b(this,"filterJs");b(this,"multiline");b(this,"formatFilename");b(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=o,this.filterFunctions=p,this.stopOn=d,this.filterNode=u,this.filterJs=I,this.multiline=T,this.formatFilename=N}tag(t){let e=this.tracking.get(t)||new Set;Ke({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(o=>e.add(o)),this.tracking.set(t,e)}trace(t){if(!X)return"";let e=this.tracking.get(t);return e?[...e].map(o=>`${this.multiline?`
|
|
3
|
+
`:""}${o.fn} - ${o.path}:${o.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},dt;function ni({maxFrames:s=50,skip:t=0,filterPaths:e=[],filterFunctions:o=[],stopOn:p=[],filterNode:d=!0,filterJs:u=!0,multiline:I=!1,formatFilename:T=N=>N}={}){X&&(dt??(dt=new Ze({maxFrames:s,skip:t,filterPaths:e,filterFunctions:o,stopOn:p,filterNode:d,filterJs:u,multiline:I,formatFilename:T})))}function ii(s){dt?.tag(s)}function mt(s){return dt?.frames(s)??[]}var le=class{constructor(){ii(this)}};l();f();c();var Xe=class{formatMultiple(t){return Promise.all(t.map(e=>this.format(e)))}formatMultipleSync(t){return t.map(e=>this.formatSync(e))}},ke=class extends Xe{async format(t){return t}formatSync(t){return t}};l();f();c();l();f();c();l();f();c();var Y=class extends le{constructor(e){super();b(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var Ua=4;ni({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Ce=class{constructor(){b(this,"lineBuffer",[]);b(this,"indentLevel",0);b(this,"hasWrittenAnything",!1);b(this,"lastCharacterIsSemicolon",!1);b(this,"lastCharacterIsNewline",!1);b(this,"nodeStackFrames",[])}get buffer(){return X&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
4
4
|
`),this.lineBuffer.join(`
|
|
5
5
|
`)+(this.lastCharacterIsNewline?`
|
|
6
6
|
`:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let o=e.length>0&&e.endsWith(`
|
|
7
|
-
`),
|
|
7
|
+
`),p=o?e.substring(0,e.length-1):e,d=this.getIndentString(),u=p.replaceAll(`
|
|
8
8
|
`,`
|
|
9
|
-
${d}`);this.isAtStartOfLine()&&(
|
|
10
|
-
`),this.writeInternal(
|
|
9
|
+
${d}`);this.isAtStartOfLine()&&(u=d+u),o&&(u+=`
|
|
10
|
+
`),this.writeInternal(u)}else this.writeNode(e)}writeStatement(...t){this.write(...t),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){X&&this.nodeStackFrames.push(...mt(t)),t.write(this),X&&ft!=="single"&&this.writeInternal(`
|
|
11
11
|
`)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){this.writeNode(t),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new Y(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new Y(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new Y(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new Y(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new Y(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(...t){this.write(...t.length===0?[""]:t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
12
12
|
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
13
|
-
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:o}){if(t.length>0){let
|
|
13
|
+
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:o}){if(t.length>0){let p=t[0];p!=null&&o(p);for(let d=1;d<t.length;d++){this.write(e);let u=t[d];u!=null&&o(u)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
|
|
14
14
|
`),this.lastCharacterIsSemicolon=t.endsWith(";");let o=t.split(`
|
|
15
|
-
`),u=X&&!this.shouldSkipTracking(o)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${o.shift()||""}`),this.lastCharacterIsNewline&&o.pop(),this.lineBuffer.push(...o),u&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(o=>`${e?`(${e}) `:""} ${o.fn} - ${o.path} : ${o.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(Ke({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,ft){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Ua}};l();f();c();l();f();c();l();f();c();var Pe=class{constructor(){b(this,"reporter");b(this,"snippet");b(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){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 "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>(this.snippet?.length??0)}};var Oe=class{constructor(t){b(this,"context");this.context=t}async generate(t,e={}){let o=this.resolveEndpoints({request:t,options:e});if(o.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let u=new Pe;for(let d of o){let p=this.context.clone(),I=this.createSnippetGenerator(p);try{let E=await I.generateSnippet({endpoint:d,request:t,options:e});if(p.errors.empty())return{snippet:E,errors:void 0};u.update({context:p,snippet:E})}catch(E){u.err==null&&(u.err=E)}}return u.getResponseOrThrow({endpoint:t.endpoint})}async generateSnippetAst(t,e={}){let o=this.resolveEndpoints({request:t,options:e});if(o.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let u;for(let d of o){let p=this.context.clone(),I=this.createSnippetGenerator(p);try{return await I.generateSnippetAst({endpoint:d,request:t,options:e})}catch(E){u=E}}throw u??new Error(`Failed to generate snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateSync(t,e={}){let o=this.resolveEndpoints({request:t,options:e});if(o.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let u=new Pe;for(let d of o){let p=this.context.clone(),I=this.createSnippetGenerator(p);try{let E=I.generateSnippetSync({endpoint:d,request:t,options:e});if(p.errors.empty())return{snippet:E,errors:void 0};u.update({context:p,snippet:E})}catch(E){u.err==null&&(u.err=E)}}return u.getResponseOrThrow({endpoint:t.endpoint})}resolveEndpoints({request:t,options:e}){if(e.endpointId!=null){let o=this.context.resolveEndpointById(e.endpointId);if(o==null)throw new Error(`No endpoint found with ID "${e.endpointId}"`);return[o]}return this.context.resolveEndpointLocationOrThrow(t.endpoint)}};l();f();c();l();f();c();l();f();c();var Ue=class{constructor(){b(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let o=t.match(this.REFERENCE_REGEX);if(!(o==null||o[2]==null||o[3]==null))return{namespace:o[1],method:o[2],path:o[3]}}};l();f();c();var F={Critical:"CRITICAL",Warning:"WARNING"},Me=class s{constructor(){b(this,"errors");b(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push({...t,path:[...this.path]})}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new s;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let o of t){if(typeof o=="string"){e.push(o);continue}e[e.length-1]+=`[${o.index}]`}return e}};var $e=class{constructor({ir:t,config:e,options:o={}}){b(this,"config");b(this,"options");b(this,"errors");b(this,"_ir");b(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=o,this.errors=new Me,this.httpEndpointReferenceParser=new Ue}associateQueryParametersByWireValue({parameters:t,values:e}){let o=[];for(let[u,d]of Object.entries(e))if(d!==void 0){this.errors.scope(u);try{let p=t.find(E=>E.name.wireValue===u);if(p==null)throw this.newParameterNotRecognizedError(u);let I=this.isListTypeReference(p.typeReference)&&!Array.isArray(d)?[d]:d;o.push({name:p.name,typeReference:p.typeReference,value:I})}finally{this.errors.unscope()}}return o}associateByWireValueOrDefault({parameters:t,values:e}){let o=[];for(let u of t){this.errors.scope(u.name.wireValue);try{let d=e[u.name.wireValue];if(d==null)if(u.typeReference.type==="primitive"&&u.typeReference.value==="STRING")d=`<${u.name.wireValue}>`;else{this.errors.add({severity:F.Critical,message:this.newParameterNotRecognizedError(u.name.wireValue).message});continue}o.push({name:u.name,typeReference:u.typeReference,value:d})}finally{this.errors.unscope()}}return o}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:o}){let u=[];for(let[d,p]of Object.entries(e))if(p!==void 0){this.errors.scope(d);try{let I=t.find(E=>E.name.wireValue===d);if(I==null){if(o)continue;this.errors.add({severity:F.Critical,message:this.newParameterNotRecognizedError(d).message});continue}u.push({name:I.name,typeReference:I.typeReference,value:p})}finally{this.errors.unscope()}}return u}getExampleObjectProperties({parameters:t,snippetObject:e}){let o=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},u=[];for(let d of t){let p=o[d.name.wireValue];p==null?d.typeReference.type==="nullable"&&u.push({name:d.name,typeReference:d.typeReference,value:null}):u.push({name:d.name,typeReference:d.typeReference,value:p})}return u}getSingleFileValue({property:t,record:e}){let o=e[t.wireValue];if(o!=null){if(typeof o!="string"){this.errors.add({severity:F.Critical,message:`Expected file value to be a string, got ${typeof o}`});return}return o}}getFileArrayValues({property:t,record:e}){let o=e[t.wireValue];if(o==null)return;if(!Array.isArray(o)){this.errors.add({severity:F.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}let u=[];for(let d of o){if(typeof d!="string"){this.errors.add({severity:F.Critical,message:`Expected file array value to be an array of strings, got ${typeof d}`});return}u.push(d)}return u}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:F.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t??{}}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:F.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let o=this.getRecord(e);if(o==null)return;let u=t.discriminant.wireValue,d=o[u];if(d==null){this.errors.add({severity:F.Critical,message:this.newParameterNotRecognizedError(u).message});return}if(typeof d!="string"){this.errors.add({severity:F.Critical,message:`Expected discriminant value to be a string but got: ${typeof d}`});return}let p=t.types[d];if(p==null){this.errors.add({severity:F.Critical,message:`No type found for discriminant value "${d}"`});return}let{[u]:I,...E}=o;return{singleDiscriminatedUnionType:p,discriminantValue:p.discriminantValue,value:E}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let o of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:o,parsedEndpoint:t})&&e.push(o);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}resolveEndpointById(t){return this._ir.endpoints[t]}resolveEndpointByIdOrThrow(t){let e=this.resolveEndpointById(t);if(e==null)throw new Error(`Failed to find endpoint with ID "${t}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:o}){return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:o}):!t.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){return e&&(t.metadata?.includePathParameters??!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:P(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let o=e.environments.find(u=>u.id===t);return o?.name}case"multipleBaseUrls":{let o=e.environments.find(u=>u.id===t);return o?.name}default:P(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:F.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:F.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let o=e.environments[0];if(o==null)return this.errors.add({severity:F.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let u=new Set(Se(o.urls));for(let d of Se(t))u.has(d)&&u.delete(d);return u.size>0?(this.errors.add({severity:F.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${Se(o.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:F.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:F.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:F.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:P(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:P(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:P(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};l();f();c();var J={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();var we=class extends Ce{constructor({customConfig:e,formatter:o}){super();b(this,"customConfig");b(this,"formatter");b(this,"imports",{});b(this,"defaultImports",{});b(this,"starImportAliases",{});b(this,"starImportAliasesInverse",{});this.customConfig=e,this.formatter=o??new ke}addImport(e){var o,u;if(e.importFrom!=null){switch(e.importFrom.type){case"default":{this.validateDefault(e);break}case"named":{this.validateNamed(e);break}case"star":{this.validateStar(e);break}}let d=(o=this.imports)[u=e.importFrom.moduleName]??(o[u]=[]);d.map(I=>I.name).includes(e.name)||d.push(e)}}validateDefault(e){var u,d;if(e.importFrom?.type!=="default")return;let o=(u=this.defaultImports)[d=e.importFrom.moduleName]??(u[d]=e);if(o.name!==e.name)throw new Error(`Cannot have multiple default imports for module ${e.importFrom.moduleName}: got ${e.name} but already had ${o.name}`)}validateNamed(e){if(e.importFrom?.type!=="named")return;let u=(this.imports[e.importFrom.moduleName]??[]).filter(p=>p.importFrom?.type==="star");if(u.length>0)throw new Error(`Cannot add named import ${e.name} because non-named imports ${u.map(p=>p.name)} already exist`);let d=[];for(let p of Object.values(this.imports))for(let I of p)I.importFrom?.type==="named"&&I.importFrom.moduleName!==e.importFrom.moduleName&&I.name===e.name&&d.push(I);if(d.length>0)throw new Error(`Cannot add named import from module ${e.importFrom.moduleName} because it is already imported from ${d[0]?.importFrom?.moduleName}`)}validateStar(e){var d,p,I,E;if(e.importFrom?.type!=="star")return;let o=(d=this.starImportAliases)[p=e.importFrom.moduleName]??(d[p]=e.importFrom.starImportAlias);if(o!==e.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${e.importFrom.starImportAlias} but already have ${o}.`);if(((I=this.starImportAliasesInverse)[E=e.importFrom.starImportAlias]??(I[E]=e.importFrom.moduleName))!==e.importFrom.moduleName)throw new Error(`Attempted to use alias ${e.importFrom.starImportAlias} for more than one module in the same file`)}};var je=class extends we{constructor({customConfig:t,formatter:e}){super({customConfig:t,formatter:e})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format TypeScript file: ${e}
|
|
15
|
+
`),p=X&&!this.shouldSkipTracking(o)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${o.shift()||""}`),this.lastCharacterIsNewline&&o.pop(),this.lineBuffer.push(...o),p&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(o=>`${e?`(${e}) `:""} ${o.fn} - ${o.path} : ${o.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(Ke({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,ft){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Ua}};l();f();c();l();f();c();l();f();c();var Pe=class{constructor(){b(this,"reporter");b(this,"snippet");b(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){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 "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>(this.snippet?.length??0)}};var Oe=class{constructor(t){b(this,"context");this.context=t}async generate(t,e={}){let o=this.resolveEndpoints({request:t,options:e});if(o.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let p=new Pe;for(let d of o){let u=this.context.clone(),I=this.createSnippetGenerator(u);try{let T=await I.generateSnippet({endpoint:d,request:t,options:e});if(u.errors.empty())return{snippet:T,errors:void 0};p.update({context:u,snippet:T})}catch(T){p.err==null&&(p.err=T)}}return p.getResponseOrThrow({endpoint:t.endpoint})}async generateSnippetAst(t,e={}){let o=this.resolveEndpoints({request:t,options:e});if(o.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let p;for(let d of o){let u=this.context.clone(),I=this.createSnippetGenerator(u);try{return await I.generateSnippetAst({endpoint:d,request:t,options:e})}catch(T){p=T}}throw p??new Error(`Failed to generate snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateSync(t,e={}){let o=this.resolveEndpoints({request:t,options:e});if(o.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let p=new Pe;for(let d of o){let u=this.context.clone(),I=this.createSnippetGenerator(u);try{let T=I.generateSnippetSync({endpoint:d,request:t,options:e});if(u.errors.empty())return{snippet:T,errors:void 0};p.update({context:u,snippet:T})}catch(T){p.err==null&&(p.err=T)}}return p.getResponseOrThrow({endpoint:t.endpoint})}resolveEndpoints({request:t,options:e}){if(e.endpointId!=null){let o=this.context.resolveEndpointById(e.endpointId);if(o==null)throw new Error(`No endpoint found with ID "${e.endpointId}"`);return[o]}return this.context.resolveEndpointLocationOrThrow(t.endpoint)}};l();f();c();l();f();c();l();f();c();var Ue=class{constructor(){b(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let o=t.match(this.REFERENCE_REGEX);if(!(o==null||o[2]==null||o[3]==null))return{namespace:o[1],method:o[2],path:o[3]}}};l();f();c();var F={Critical:"CRITICAL",Warning:"WARNING"},Me=class s{constructor(){b(this,"errors");b(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push({...t,path:[...this.path]})}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}truncate(t){this.errors.length=t}clone(){let t=new s;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let o of t){if(typeof o=="string"){e.push(o);continue}e[e.length-1]+=`[${o.index}]`}return e}};var $e=class{constructor({ir:t,config:e,options:o={}}){b(this,"config");b(this,"options");b(this,"errors");b(this,"_ir");b(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=o,this.errors=new Me,this.httpEndpointReferenceParser=new Ue}associateQueryParametersByWireValue({parameters:t,values:e}){let o=[];for(let[p,d]of Object.entries(e))if(d!==void 0){this.errors.scope(p);try{let u=t.find(T=>T.name.wireValue===p);if(u==null)throw this.newParameterNotRecognizedError(p);let I=this.isListTypeReference(u.typeReference)&&!Array.isArray(d)?[d]:d;o.push({name:u.name,typeReference:u.typeReference,value:I})}finally{this.errors.unscope()}}return o}associateByWireValueOrDefault({parameters:t,values:e}){let o=[];for(let p of t){this.errors.scope(p.name.wireValue);try{let d=e[p.name.wireValue];if(d==null)if(p.typeReference.type==="primitive"&&p.typeReference.value==="STRING")d=`<${p.name.wireValue}>`;else{this.errors.add({severity:F.Critical,message:this.newParameterNotRecognizedError(p.name.wireValue).message});continue}o.push({name:p.name,typeReference:p.typeReference,value:d})}finally{this.errors.unscope()}}return o}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:o}){let p=[];for(let[d,u]of Object.entries(e))if(u!==void 0){this.errors.scope(d);try{let I=t.find(T=>T.name.wireValue===d);if(I==null){if(o)continue;this.errors.add({severity:F.Critical,message:this.newParameterNotRecognizedError(d).message});continue}p.push({name:I.name,typeReference:I.typeReference,value:u})}finally{this.errors.unscope()}}return p}getExampleObjectProperties({parameters:t,snippetObject:e}){let o=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},p=[];for(let d of t){let u=o[d.name.wireValue];u==null?d.typeReference.type==="nullable"&&p.push({name:d.name,typeReference:d.typeReference,value:null}):p.push({name:d.name,typeReference:d.typeReference,value:u})}return p}getSingleFileValue({property:t,record:e}){let o=e[t.wireValue];if(o!=null){if(typeof o!="string"){this.errors.add({severity:F.Critical,message:`Expected file value to be a string, got ${typeof o}`});return}return o}}getFileArrayValues({property:t,record:e}){let o=e[t.wireValue];if(o==null)return;if(!Array.isArray(o)){this.errors.add({severity:F.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}let p=[];for(let d of o){if(typeof d!="string"){this.errors.add({severity:F.Critical,message:`Expected file array value to be an array of strings, got ${typeof d}`});return}p.push(d)}return p}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:F.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t??{}}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:F.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let o=this.getRecord(e);if(o==null)return;let p=t.discriminant.wireValue,d=o[p];if(d==null){this.errors.add({severity:F.Critical,message:this.newParameterNotRecognizedError(p).message});return}if(typeof d!="string"){this.errors.add({severity:F.Critical,message:`Expected discriminant value to be a string but got: ${typeof d}`});return}let u=t.types[d];if(u==null){this.errors.add({severity:F.Critical,message:`No type found for discriminant value "${d}"`});return}let{[p]:I,...T}=o;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:T}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let o of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:o,parsedEndpoint:t})&&e.push(o);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}resolveEndpointById(t){return this._ir.endpoints[t]}resolveEndpointByIdOrThrow(t){let e=this.resolveEndpointById(t);if(e==null)throw new Error(`Failed to find endpoint with ID "${t}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:o}){return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:o}):!t.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){return e&&(t.metadata?.includePathParameters??!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:P(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let o=e.environments.find(p=>p.id===t);return o?.name}case"multipleBaseUrls":{let o=e.environments.find(p=>p.id===t);return o?.name}default:P(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:F.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:F.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let o=e.environments[0];if(o==null)return this.errors.add({severity:F.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let p=new Set(Se(o.urls));for(let d of Se(t))p.has(d)&&p.delete(d);return p.size>0?(this.errors.add({severity:F.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${Se(o.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:F.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:F.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:F.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:P(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:P(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:P(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};l();f();c();var J={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();l();f();c();var we=class extends Ce{constructor({customConfig:e,formatter:o}){super();b(this,"customConfig");b(this,"formatter");b(this,"imports",{});b(this,"defaultImports",{});b(this,"starImportAliases",{});b(this,"starImportAliasesInverse",{});this.customConfig=e,this.formatter=o??new ke}addImport(e){var o,p;if(e.importFrom!=null){switch(e.importFrom.type){case"default":{this.validateDefault(e);break}case"named":{this.validateNamed(e);break}case"star":{this.validateStar(e);break}}let d=(o=this.imports)[p=e.importFrom.moduleName]??(o[p]=[]);d.map(I=>I.name).includes(e.name)||d.push(e)}}validateDefault(e){var p,d;if(e.importFrom?.type!=="default")return;let o=(p=this.defaultImports)[d=e.importFrom.moduleName]??(p[d]=e);if(o.name!==e.name)throw new Error(`Cannot have multiple default imports for module ${e.importFrom.moduleName}: got ${e.name} but already had ${o.name}`)}validateNamed(e){if(e.importFrom?.type!=="named")return;let p=(this.imports[e.importFrom.moduleName]??[]).filter(u=>u.importFrom?.type==="star");if(p.length>0)throw new Error(`Cannot add named import ${e.name} because non-named imports ${p.map(u=>u.name)} already exist`);let d=[];for(let u of Object.values(this.imports))for(let I of u)I.importFrom?.type==="named"&&I.importFrom.moduleName!==e.importFrom.moduleName&&I.name===e.name&&d.push(I);if(d.length>0)throw new Error(`Cannot add named import from module ${e.importFrom.moduleName} because it is already imported from ${d[0]?.importFrom?.moduleName}`)}validateStar(e){var d,u,I,T;if(e.importFrom?.type!=="star")return;let o=(d=this.starImportAliases)[u=e.importFrom.moduleName]??(d[u]=e.importFrom.starImportAlias);if(o!==e.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${e.importFrom.starImportAlias} but already have ${o}.`);if(((I=this.starImportAliasesInverse)[T=e.importFrom.starImportAlias]??(I[T]=e.importFrom.moduleName))!==e.importFrom.moduleName)throw new Error(`Attempted to use alias ${e.importFrom.starImportAlias} for more than one module in the same file`)}};var je=class extends we{constructor({customConfig:t,formatter:e}){super({customConfig:t,formatter:e})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format TypeScript file: ${e}
|
|
16
16
|
${t}`)}return t}toString(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(t)}catch(e){throw new Error(`Failed to format TypeScript file: ${e}
|
|
17
17
|
${t}`)}return t}getContent(){let t=this.stringifyImports();return t.length>0?t+`
|
|
18
|
-
`+this.buffer:this.buffer}stringifyImports(){let t="";for(let[e,o]of Object.entries(this.imports)){let
|
|
19
|
-
`}}return t}};var C=class extends le{async toStringAsync({customConfig:t,formatter:e}){let o=new je({customConfig:t,formatter:e});return this.write(o),await o.toStringAsync()}toString({customConfig:t,formatter:e}){let o=new je({customConfig:t,formatter:e});return this.write(o),o.toString()}};var v={};K(v,{AstNode:()=>C,ClassInstantiation:()=>be,CodeBlock:()=>ve,Comment:()=>ae,Function:()=>Ie,FunctionInvocation:()=>
|
|
20
|
-
`).forEach(o=>{e.writeLine(` * ${o}`)}),e.writeLine("*/"))}};l();f();c();l();f();c();var ce=class extends C{constructor(e){super();b(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"string":e.write("string");break;case"number":e.write("number");break;case"bigint":e.write("bigint");break;case"boolean":e.write("boolean");break;case"array":this.internalType.valueType.write(e),e.write("[]");break;case"map":e.write("Record<"),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write(">");break;case"object":e.write("{"),e.indent();for(let[o,
|
|
21
|
-
`)?this.writeStringWithBackticks({writer:e,value:this.internalType.value}):e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}case"tuple":{this.writeIterable({writer:e,iterable:this.internalType});break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:P(this.internalType)}}isObject(){return this.internalType.type==="object"}asObjectOrThrow(){if(this.isObject())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not an object")}isSet(){return this.internalType.type==="set"}asSetOrThrow(){if(this.isSet())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a set")}isSetOfObjects(){return this.isSet()&&this.asSetOrThrow().values.every(e=>e.isObject())}writeStringWithBackticks({writer:e,value:o}){e.write("`");let
|
|
22
|
-
`),d=
|
|
23
|
-
`,p
|
|
24
|
-
`);e.write(d.replaceAll("`","\\`")),e.writeNoIndent(p.replaceAll("`","\\`")),e.write("`")}writeIterable({writer:e,iterable:o}){let u=ja({values:o.values});if(u.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let d of u)d.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeRecord({writer:e,record:o}){let u=$a({entries:o.entries});if(u.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let d of u)d.key.write(e),e.write(": "),d.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}writeObject({writer:e,object:o}){let u=Ma({fields:o.fields});if(u.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let d of u)e.write(`${d.name}: `),d.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}static array({values:e}){return new this({type:"array",values:e})}static bigint(e){return new this({type:"bigint",value:e})}static blob(e){return new this({type:"blob",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static object({fields:e}){return new this({type:"object",fields:e})}static record({entries:e}){return new this({type:"record",entries:e})}static reference(e){return new this({type:"reference",value:e})}static set({values:e}){return new this({type:"set",values:e})}static string(e){return new this({type:"string",value:e})}static tuple({values:e}){return new this({type:"tuple",values:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:o}){switch(typeof o){case"boolean":e.write(o.toString());return;case"string":e.write(o.includes('"')?`\`${o}\``:`"${o}"`);return;case"number":e.write(o.toString());return;case"object":if(o==null){e.write("null");return}if(Array.isArray(o)){this.writeUnknownArray({writer:e,value:o});return}this.writeUnknownObject({writer:e,value:o});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof o}`)}}writeUnknownArray({writer:e,value:o}){if(o.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let u of o)e.writeNode(s.unknown(u)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:o}){let u=Object.entries(o);if(u.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[d,p]of u)e.write(`${d}: `),e.writeNode(s.unknown(p)),e.writeLine(",");e.dedent(),e.write("}")}};function Ma({fields:s}){return s.filter(t=>!re.isNop(t.value))}function $a({entries:s}){return s.filter(t=>!re.isNop(t.key)&&!re.isNop(t.value))}function ja({values:s}){return s.filter(t=>!re.isNop(t))}l();f();c();var Re=class extends C{constructor(e){super();b(this,"args");this.args=e}write(e){this.args.export&&e.write("export "),this.args.const?e.write("const "):e.write("let "),e.write(`${this.args.name} = `),e.writeNode(this.args.initializer)}};function Da(s){return new ve(s)}function Wa(s){return new Ie(s)}function Va(s){return new be(s)}function qa(s){return new Ee(s)}function Ga(s){return new Te(s)}function za(s){return new Ae(s)}function Ha(s){return new fe(s)}function Ya(s){return new Re(s)}l();f();c();l();f();c();function oi({generatorConfig:s,isPackagePrivate:t}){let e=s.output.mode;switch(e.type){case"downloadFiles":return;case"publish":return{packageName:e.registriesV2.npm.packageName,version:e.version,private:t,publishInfo:{registryUrl:e.registriesV2.npm.registryUrl,token:e.registriesV2.npm.token},license:void 0,repoUrl:void 0};case"github":if(e.publishInfo!=null&&e.publishInfo.type!=="npm")throw new Error(`Expected to receive npm publish info but received ${e.publishInfo.type} instead`);return{packageName:e.publishInfo!=null?e.publishInfo.packageName:"",version:e.version,private:t,publishInfo:void 0,repoUrl:Ja(e.repoUrl),license:s.license?._visit({basic:o=>o.id,custom:o=>`See ${o.filename}`,_other:()=>{}})};default:throw new Error(`Encountered unknown output mode: ${e}`)}}function Ja(s){if(s!=null)return s.startsWith("https://github.com/")?`git+${s}`:s.startsWith("ssh://github.com/")?`github:${_e(s).replace("ssh://github.com/","")}`:s.startsWith("https://bitbucket.org/")?`bitbucket:${_e(s).replace("https://bitbucket.org/","")}`:s.startsWith("ssh://bitbucket.org/")?`bitbucket:${_e(s).replace("ssh://bitbucket.org/","")}`:s.startsWith("https://gitlab.com/")?`gitlab:${_e(s).replace("https://gitlab.com/","")}`:s.startsWith("ssh://gitlab.com/")?`gitlab:${_e(s).replace("ssh://gitlab.com/","")}`:(s.startsWith("git+")||(s=`git+${s}`),s.endsWith(".git")||(s=`${s}.git`),s)}function _e(s){return s.endsWith(".git")?s.slice(0,-4):s}l();f();c();function ht({organization:s,workspaceName:t,namespaceExport:e}){return e??`${xe(Je(s))}${xe(Je(t))}`}l();f();c();l();f();c();var De={};K(De,{commons:()=>ai,dynamic:()=>wt,generatorExec:()=>vt});l();f();c();l();f();c();var ai={};l();f();c();var wt={};K(wt,{ErrorSeverity:()=>mi,HttpMethod:()=>fi,ObjectPropertyAccess:()=>hi,PrimitiveTypeV1:()=>yi,auth:()=>si,commons:()=>ui,declaration:()=>pi,endpoints:()=>li,environment:()=>ci,http:()=>yt,ir:()=>di,snippets:()=>xt,types:()=>gt,variables:()=>xi});l();f();c();l();f();c();var si={};l();f();c();var ui={};l();f();c();var pi={};l();f();c();var li={};l();f();c();var ci={};l();f();c();var yt={};K(yt,{HttpMethod:()=>fi});l();f();c();l();f();c();var fi={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var di={};l();f();c();var xt={};K(xt,{ErrorSeverity:()=>mi});l();f();c();l();f();c();var mi={Critical:"CRITICAL",Warning:"WARNING"};var gt={};K(gt,{ObjectPropertyAccess:()=>hi,PrimitiveTypeV1:()=>yi});l();f();c();l();f();c();var hi={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};l();f();c();var yi={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"};var xi={};l();f();c();var vt={};K(vt,{LicenseId:()=>gi,config:()=>bt});l();f();c();l();f();c();var bt={};K(bt,{LicenseId:()=>gi});l();f();c();l();f();c();var gi={Mit:"MIT",Apache2:"Apache-2.0"};var Za="value",Qe=class{constructor({context:t}){b(this,"context");this.context=t}convert(t){let e=t.convertOpts;if(t.value===null)return this.context.isNullable(t.typeReference)?v.TypeLiteral.null():(this.context.errors.add({severity:F.Critical,message:"Expected non-null value, but got null"}),v.TypeLiteral.nop());if(t.value===void 0)return v.TypeLiteral.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value,convertOpts:e});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value,convertOpts:e});case"map":return this.convertMap({map:t.typeReference,value:t.value,convertOpts:e});case"named":{let o=this.context.resolveNamedType({typeId:t.typeReference.value});return o==null?v.TypeLiteral.nop():this.convertNamed({named:o,value:t.value,as:t.as,convertOpts:e})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as,convertOpts:e});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as,convertOpts:e});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as,convertOpts:e});case"set":return this.convertSet({set:t.typeReference.value,value:t.value,convertOpts:e});case"unknown":return this.convertUnknown({value:t.value,convertOpts:e});default:P(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let o=this.context.getValueAsBoolean({value:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.boolean(o)}case"string":{let o=this.context.getValueAsString({value:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.string(o)}default:P(t)}}convertList({list:t,value:e,convertOpts:o}){return Array.isArray(e)?v.TypeLiteral.array({values:e.map((u,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:t,value:u,convertOpts:o})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:F.Critical,message:`Expected array but got: ${typeof e}`}),v.TypeLiteral.nop())}convertSet({set:t,value:e,convertOpts:o}){return Array.isArray(e)?v.TypeLiteral.set({values:e.map((u,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:t,value:u,convertOpts:o})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:F.Critical,message:`Expected array but got: ${typeof e}`}),v.TypeLiteral.nop())}convertMap({map:t,value:e,convertOpts:o}){return typeof e!="object"||e==null?(this.context.errors.add({severity:F.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),v.TypeLiteral.nop()):v.TypeLiteral.record({entries:Object.entries(e).map(([u,d])=>{this.context.errors.scope(u);try{return{key:this.convert({typeReference:t.key,value:u,as:"key",convertOpts:o}),value:this.convert({typeReference:t.value,value:d,convertOpts:o})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:o,convertOpts:u}){switch(t.type){case"alias":return this.context.customConfig?.useBrandedStringAliases?v.TypeLiteral.reference(v.codeblock(d=>{d.writeNode(v.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:t.declaration})})),d.write("("),d.writeNode(this.convert({typeReference:t.typeReference,value:e,as:o,convertOpts:u})),d.write(")")})):this.convert({typeReference:t.typeReference,value:e,as:o,convertOpts:u});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e,convertOpts:u});case"enum":return this.convertEnum({enum_:t,value:e,convertOpts:u});case"object":return this.convertObject({object_:t,value:e,convertOpts:u});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e,convertOpts:u});default:P(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e,convertOpts:o}){let u=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(u==null)return v.TypeLiteral.nop();let d=u.singleDiscriminatedUnionType,p=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:u,unionVariant:d,convertOpts:o});if(p==null)return v.TypeLiteral.nop();if(this.context.customConfig?.includeUtilsOnUnionMembers)return v.TypeLiteral.reference(v.codeblock(E=>{E.writeNode(v.invokeMethod({on:v.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:t.declaration})}),method:this.context.getMethodName(d.discriminantValue.name),arguments_:this.convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:u,unionVariant:d,unionProperties:p,convertOpts:o})}))}));let I={name:this.context.getPropertyName(t.discriminant.name),value:v.TypeLiteral.string(d.discriminantValue.wireValue)};return v.TypeLiteral.object({fields:[I,...p]})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e,convertOpts:o}){let u=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});switch(e.type){case"samePropertiesAsObject":{let d=this.context.resolveNamedType({typeId:e.typeId});if(d==null)return;let p=this.convertNamed({named:d,value:t.value,convertOpts:o});if(!p.isObject()){this.context.errors.add({severity:F.Critical,message:"Internal error; expected union value to be an object"});return}let I=p.asObjectOrThrow();return[...u,...I.fields]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let d=this.context.getRecord(t.value);return d==null?[...u,{name:Za,value:this.convert({typeReference:e.typeReference,value:t.value,convertOpts:o})}]:[...u,{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:d[e.discriminantValue.wireValue],convertOpts:o})}]}finally{this.context.errors.unscope()}case"noProperties":return u;default:P(e)}}convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:o,convertOpts:u}){return e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&o.length===1?[this.convert({typeReference:e.typeReference,value:t.value,convertOpts:u})]:o.length>0?[v.TypeLiteral.object({fields:o})]:[]}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e,convertOpts:o}){return this.context.associateByWireValue({parameters:e.properties??[],values:this.context.getRecord(t.value)??{},ignoreMissingParameters:!0}).map(d=>{this.context.errors.scope(d.name.wireValue);try{return{name:this.context.getPropertyName(d.name.name),value:this.convert({...d,convertOpts:o})}}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e,convertOpts:o}){let u=this.context.associateByWireValue({parameters:this.filterReadWriteProperties(t.properties,o),values:this.context.getRecord(e)??{}});return v.TypeLiteral.object({fields:u.map(d=>{this.context.errors.scope(d.name.wireValue);try{return{name:this.context.getPropertyName(d.name.name),value:this.convert({...d,convertOpts:o})}}finally{this.context.errors.unscope()}})})}filterReadWriteProperties(t,e){return this.context.customConfig?.experimentalGenerateReadWriteOnlyTypes!==!0||typeof e>"u"||(e.isForRequest&&(t=t.filter(o=>o.propertyAccess!==De.dynamic.ObjectPropertyAccess.ReadOnly)),e.isForResponse&&(t=t.filter(o=>o.propertyAccess!==De.dynamic.ObjectPropertyAccess.WriteOnly))),t}convertEnum({enum_:t,value:e}){let o=this.getEnumValue({enum_:t,value:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.string(o)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:F.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(u=>u.wireValue===e)==null){this.context.errors.add({severity:F.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return e}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e,convertOpts:o}){let u=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e,convertOpts:o});return u??v.TypeLiteral.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e,convertOpts:o}){for(let u of t.types)try{return this.convert({typeReference:u,value:e,convertOpts:o})}catch{continue}this.context.errors.add({severity:F.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t,convertOpts:e}){return v.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:o,convertOpts:u}){switch(t){case"INTEGER":case"UINT":{let d=this.getValueAsNumber({value:e,as:o});return d==null?v.TypeLiteral.nop():v.TypeLiteral.number(d)}case"LONG":case"UINT_64":{let d=this.getValueAsNumber({value:e,as:o});return d==null?v.TypeLiteral.nop():this.context.customConfig?.useBigInt?v.TypeLiteral.bigint(BigInt(d)):v.TypeLiteral.number(d)}case"FLOAT":case"DOUBLE":{let d=this.getValueAsNumber({value:e});return d==null?v.TypeLiteral.nop():v.TypeLiteral.number(d)}case"BOOLEAN":{let d=this.getValueAsBoolean({value:e,as:o});return d==null?v.TypeLiteral.nop():v.TypeLiteral.boolean(d)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let d=this.context.getValueAsString({value:e});return d==null?v.TypeLiteral.nop():v.TypeLiteral.string(d)}case"DATE_TIME":{let d=this.context.getValueAsString({value:e});return d==null?v.TypeLiteral.nop():v.TypeLiteral.datetime(d)}case"BIG_INTEGER":{let d=this.context.getValueAsString({value:e});return d==null?v.TypeLiteral.nop():this.context.customConfig?.useBigInt?v.TypeLiteral.bigint(BigInt(d)):v.TypeLiteral.string(d)}default:P(t)}}getValueAsNumber({value:t,as:e}){let o=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:o})}getValueAsBoolean({value:t,as:e}){let o=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:o})}};l();f();c();var et=class{constructor({context:t}){b(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){let o={fileFields:[],bodyPropertyFields:[]},u=this.context.getRecord(e)??{};for(let d of t.properties)switch(d.type){case"file":o.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getSingleFileProperty({property:d,record:u})});break;case"fileArray":o.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getArrayFileProperty({property:d,record:u})});break;case"bodyProperty":o.bodyPropertyFields.push({name:this.context.getPropertyName(d.name.name),value:this.getBodyProperty({property:d,record:u})});break;default:P(d)}return o}getSingleFileProperty({property:t,record:e}){let o=this.context.getSingleFileValue({property:t,record:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.blob(o)}getArrayFileProperty({property:t,record:e}){let o=this.context.getFileArrayValues({property:t,record:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.array({values:o.map(u=>v.TypeLiteral.blob(u))})}getBodyProperty({property:t,record:e}){let o=e[t.name.wireValue];return o==null?v.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:o})}};var tt=class s extends $e{constructor({ir:e,config:o}){super({ir:e,config:o});b(this,"ir");b(this,"customConfig");b(this,"dynamicTypeLiteralMapper");b(this,"filePropertyMapper");b(this,"moduleName");b(this,"namespaceExport");this.ir=e,this.customConfig=o.customConfig!=null?o.customConfig:void 0,this.dynamicTypeLiteralMapper=new Qe({context:this}),this.filePropertyMapper=new et({context:this}),this.moduleName=Ka({config:o,customConfig:this.customConfig}),this.namespaceExport=ht({organization:o.organization,workspaceName:o.workspaceName,namespaceExport:this.customConfig?.namespaceExport})}clone(){return new s({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return`${this.namespaceExport}Client`}getPropertyName(e){return this.customConfig?.retainOriginalCasing||this.customConfig?.noSerdeLayer?this.formatOriginalPropertyName(e.originalName):e.camelCase.unsafeName}getMethodName(e){return e.camelCase.unsafeName}getTypeName(e){return e.pascalCase.unsafeName}getEnvironmentTypeReferenceFromID(e){let o=this.resolveEnvironmentName(e);if(o!=null)return this.getEnvironmentsTypeReference(o)}getFullyQualifiedReference({declaration:e}){return e.fernFilepath.allParts.length>0?`${e.fernFilepath.allParts.map(o=>o.camelCase.unsafeName).join(".")}.${this.getTypeName(e.name)}`:`${this.getTypeName(e.name)}`}getEnvironmentsTypeReference(e){return v.reference({name:`${this.namespaceExport}Environment`,importFrom:this.getModuleImport(),memberName:this.getTypeName(e)})}formatOriginalPropertyName(e){return e.includes("-")?`"${e}"`:e}};function Ka({config:s,customConfig:t}){return oi({generatorConfig:s,isPackagePrivate:t?.private??!1})?.packageName??s.organization}l();f();c();var wi="client",bi="main",Xa={type:"primitive",value:"STRING"},rt=class{constructor({context:t}){b(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){return await this.buildCodeBlock({endpoint:t,snippet:e}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:t,request:e}){return this.buildCodeBlock({endpoint:t,snippet:e}).toString({customConfig:this.context.customConfig})}async generateSnippetAst({endpoint:t,request:e}){return this.buildCodeBlock({endpoint:t,snippet:e})}buildCodeBlock({endpoint:t,snippet:e}){return v.codeblock(o=>{o.writeNode(v.function_({name:bi,async:!0,parameters:[],body:v.codeblock(u=>{u.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),u.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})})),o.writeNodeStatement(v.invokeFunction({function_:v.reference({name:bi}),arguments_:[]}))})}constructClient({endpoint:t,snippet:e}){return v.variable({name:wi,const:!0,initializer:v.instantiateClass({class_:v.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:t,snippet:e})]})})}getConstructorArgs({endpoint:t,snippet:e}){let o=[],u=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return u.length>0&&o.push(...u),t.auth!=null&&(e.auth!=null?o.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:F.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(J.PathParameters),this.context.ir.pathParameters!=null&&o.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(J.Headers),this.context.ir.headers!=null&&e.headers!=null&&o.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),o.length===0?v.TypeLiteral.nop():v.TypeLiteral.object({fields:o})}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let o=this.getEnvironmentValue({baseUrl:t,environment:e});return o==null?[]:[{name:"environment",value:o}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:F.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return v.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let o=this.context.getEnvironmentTypeReferenceFromID(e);if(o==null){this.context.errors.add({severity:F.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return v.TypeLiteral.reference(o)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?v.TypeLiteral.object({fields:Object.entries(e).map(([o,u])=>({name:o,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Xa,value:u})}))}):void 0}}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBasicAuthArg({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.addAuthMismatchError(t,e),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.addAuthMismatchError(t,e),[]):this.getConstructorOAuthArgs({auth:t,values:e});case"inferred":return e.type!=="inferred"?(this.addAuthMismatchError(t,e),[]):(this.addWarning("The TypeScript SDK v2 Generator does not support Inferred auth scheme yet"),[]);default:P(t)}}addAuthMismatchError(t,e){this.context.errors.add({severity:F.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message})}addWarning(t){this.context.errors.add({severity:F.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:v.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),value:v.TypeLiteral.string(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:v.TypeLiteral.string(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorOAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.clientId),value:v.TypeLiteral.string(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:v.TypeLiteral.string(e.clientSecret)}]}getConstructorHeaderArgs({headers:t,values:e}){let o=[];for(let u of t){let d=this.getConstructorHeaderArg({header:u,value:e.value});d!=null&&o.push(d)}return o}getConstructorHeaderArg({header:t,value:e}){let o=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!v.TypeLiteral.isNop(o))return{name:this.context.getPropertyName(t.name.name),value:o}}callMethod({endpoint:t,snippet:e}){return v.invokeMethod({on:v.reference({name:wi}),method:this.getMethod({endpoint:t}),async:!0,arguments_:this.getMethodArgs({endpoint:t,snippet:e})})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:P(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){let o=[];this.context.errors.scope(J.PathParameters);let u=[...this.context.ir.pathParameters??[],...t.pathParameters??[]];return u.length>0&&o.push(...this.getPathParameters({namedParameters:u,snippet:e}).map(d=>d.value)),this.context.errors.unscope(),this.context.errors.scope(J.RequestBody),t.body!=null&&o.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),o}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,convertOpts:{isForRequest:!0}});default:P(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:F.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),v.TypeLiteral.nop()):v.TypeLiteral.blob(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){let o=[],{inlinePathParameters:u,inlineFileProperties:d}={inlinePathParameters:this.context.customConfig?.inlinePathParameters??!1,inlineFileProperties:this.context.customConfig?.inlineFileProperties??!1};this.context.errors.scope(J.PathParameters);let p=[];t.pathParameters!=null&&p.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(J.RequestBody);let I=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:u})||o.push(...p.map(E=>E.value)),d||o.push(...I.fileFields.map(E=>E.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:u,inlineFileProperties:d})&&o.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:u})?p:[],filePropertyInfo:I})),o}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:o,filePropertyInfo:u}){this.context.errors.scope(J.QueryParameters);let p=this.context.associateQueryParametersByWireValue({parameters:t.queryParameters??[],values:e.queryParameters??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(J.Headers);let E=this.context.associateByWireValue({parameters:t.headers??[],values:e.headers??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(J.RequestBody);let N=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:u}):[];return this.context.errors.unscope(),v.TypeLiteral.object({fields:[...o,...p,...E,...N]})}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:o}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:o});default:P(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return this.context.customConfig?.inlineFileProperties?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({body:t,value:e}){return{name:this.context.getPropertyName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,convertOpts:{isForRequest:!0}});default:P(t)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){let o=[],u=this.context.associateByWireValue({parameters:t,values:this.context.getRecord(e)??{}});for(let d of u)o.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...d,convertOpts:{isForRequest:!0}})});return o}getPathParameters({namedParameters:t,snippet:e}){let o=[],u=this.context.associateByWireValue({parameters:t,values:e.pathParameters??{},ignoreMissingParameters:!0});for(let d of u)o.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...d,convertOpts:{isForRequest:!0}})});return o}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getMethodName(e)).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}};var nt=class extends Oe{constructor({ir:t,config:e}){super(new tt({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new rt({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
18
|
+
`+this.buffer:this.buffer}stringifyImports(){let t="";for(let[e,o]of Object.entries(this.imports)){let p=this.defaultImports[e],d="",u=o.filter(T=>T.importFrom?.type==="named"),I=this.starImportAliases[e];if(u.length>0||p!=null||I!=null){if(t+="import",p!=null&&(t+=` ${p.name}`),u.length>0){for(let N of u.slice(0,-1))d+=`${N.name}, `;let T=u[u.length-1];T!=null&&(d+=`${T.name}`),p!=null&&(t+=","),t+=` { ${d} }`}I!=null&&((p!=null||u.length>0)&&(t+=", "),t+=` * as ${I}`),t+=` from "${e}";
|
|
19
|
+
`}}return t}};var C=class extends le{async toStringAsync({customConfig:t,formatter:e}){let o=new je({customConfig:t,formatter:e});return this.write(o),await o.toStringAsync()}toString({customConfig:t,formatter:e}){let o=new je({customConfig:t,formatter:e});return this.write(o),o.toString()}};var v={};K(v,{AstNode:()=>C,ClassInstantiation:()=>be,CodeBlock:()=>ve,Comment:()=>ae,Function:()=>Ie,FunctionInvocation:()=>Te,MethodInvocation:()=>Ee,Parameter:()=>Ae,Reference:()=>fe,Type:()=>ce,TypeLiteral:()=>re,Types:()=>ce,Variable:()=>Re,Writer:()=>we,codeblock:()=>Da,function_:()=>Wa,instantiateClass:()=>Va,invokeFunction:()=>qa,invokeMethod:()=>Ga,parameter:()=>za,reference:()=>Ha,variable:()=>Ya});l();f();c();l();f();c();l();f();c();var be=class extends C{constructor({class_:e,arguments_:o}){super();b(this,"class_");b(this,"arguments_");this.class_=e,this.arguments_=o}write(e){e.write("new "),e.writeNode(this.class_),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:o=>o.write(e)}),e.write(")")}};l();f();c();var ve=class extends C{constructor(e){super();b(this,"args");this.args=e}write(e){return new Y(this.args).write(e)}};l();f();c();var ae=class extends C{constructor({docs:e}={docs:void 0}){super();b(this,"docs");this.docs=e}write(e){this.docs!=null&&(e.writeLine("/**"),this.docs.split(`
|
|
20
|
+
`).forEach(o=>{e.writeLine(` * ${o}`)}),e.writeLine("*/"))}};l();f();c();l();f();c();var ce=class extends C{constructor(e){super();b(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"string":e.write("string");break;case"number":e.write("number");break;case"bigint":e.write("bigint");break;case"boolean":e.write("boolean");break;case"array":this.internalType.valueType.write(e),e.write("[]");break;case"map":e.write("Record<"),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write(">");break;case"object":e.write("{"),e.indent();for(let[o,p]of Object.entries(this.internalType.fields))e.write(`${o}: `),p.write(e),e.writeLine(",");e.dedent(),e.write("}");break;case"enum":e.write("enum");break;case"any":e.write("any");break;case"promise":e.write("Promise<"),this.internalType.value.write(e),e.write(">");break;case"unknown":e.write("unknown");break;case"void":e.write("void");break;case"undefined":e.write("undefined");break;case"null":e.write("null");break;case"never":e.write("never");break;case"nop":break;default:P(this.internalType)}}static string(){return new this({type:"string"})}static number(){return new this({type:"number"})}static bigint(){return new this({type:"bigint"})}static boolean(){return new this({type:"boolean"})}static array(e){return new this({type:"array",valueType:e})}static object(e){return new this({type:"object",fields:e})}static enum(e){return new this({type:"enum",values:e})}static any(){return new this({type:"any"})}static promise(e){return e.internalType.type==="promise"?e:new this({type:"promise",value:e})}static unknown(){return new this({type:"unknown"})}static void(){return new this({type:"void"})}static undefined(){return new this({type:"undefined"})}static null(){return new this({type:"null"})}static never(){return new this({type:"never"})}static nop(){return new this({type:"nop"})}};var Ie=class extends C{constructor({name:e,parameters:o,async:p,body:d,return_:u,docs:I}){super();b(this,"name");b(this,"parameters");b(this,"async");b(this,"body");b(this,"return_");b(this,"docs");this.name=e,this.parameters=o,this.async=p??!1,this.body=d,this.return_=u,this.docs=I}write(e){e.writeNode(new ae({docs:this.docs})),this.async&&e.write("async "),e.write("function "),e.write(`${this.name}`),this.writeParameters(e),this.return_!=null&&(e.write(": "),e.writeNode(this.async?ce.promise(this.return_):this.return_)),e.writeLine(" {"),e.indent(),this.body?.write(e),e.dedent(),e.writeNewLineIfLastLineNot(),e.writeLine("}")}writeParameters(e){if(this.parameters.length===0){e.write("()");return}e.indent(),e.writeLine("(");for(let o of this.parameters)e.writeNode(o),e.writeLine(",");e.dedent(),e.write(")")}};l();f();c();var Te=class extends C{constructor({function_:e,arguments_:o}){super();b(this,"function_");b(this,"arguments_");this.function_=e,this.arguments_=o}write(e){e.writeNode(this.function_),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:o=>o.write(e)}),e.write(")")}};l();f();c();var Ee=class extends C{constructor({on:e,method:o,arguments_:p,async:d}){super();b(this,"on");b(this,"method");b(this,"arguments_");b(this,"async");this.on=e,this.method=o,this.arguments_=p,this.async=d}write(e){this.async&&e.write("await "),this.on.write(e),e.write("."),e.write(this.method),e.write("("),e.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:o=>o.write(e)}),e.write(")")}};l();f();c();var Ae=class extends C{constructor({name:e,type:o,docs:p}){super();b(this,"name");b(this,"type");b(this,"docs");this.name=e,this.type=o,this.docs=p}write(e){this.docs!=null&&e.writeNode(new ae({docs:this.docs})),e.write(`${this.name}: `),this.type.write(e)}};l();f();c();var fe=class extends C{constructor({name:e,importFrom:o,memberName:p}){super();b(this,"name");b(this,"importFrom");b(this,"memberName");this.name=e,this.importFrom=o,this.memberName=p}write(e){this.importFrom!=null&&e.addImport(this);let o=this.importFrom?.type==="star"?`${this.importFrom.starImportAlias}.`:"",p=this.memberName!=null?`.${this.memberName}`:"";e.write(`${o}${this.name}${p}`)}};l();f();c();var re=class s extends C{constructor(e){super();b(this,"internalType");this.internalType=e}write(e){let o=!!e.customConfig?.noSerdeLayer,p=!!e.customConfig?.useBigInt;switch(this.internalType.type){case"array":{this.writeIterable({writer:e,iterable:this.internalType});break}case"blob":{if(o){e.writeNode(s.string(this.internalType.value));return}e.write("new Blob(["),e.writeNode(s.string(this.internalType.value)),e.write("])");break}case"boolean":{e.write(this.internalType.value.toString());break}case"bigint":{if(p){e.write(`BigInt("${this.internalType.value.toString()}")`);return}e.write(`"${this.internalType.value.toString()}"`);return}case"datetime":{if(o){e.writeNode(s.string(this.internalType.value));return}e.write("new Date("),e.writeNode(s.string(this.internalType.value)),e.write(")");break}case"number":{e.write(this.internalType.value.toString());break}case"object":{this.writeObject({writer:e,object:this.internalType});break}case"record":{this.writeRecord({writer:e,record:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"set":{if(o||this.isSetOfObjects()){e.writeNode(s.array({values:this.internalType.values}));return}e.write("new Set("),this.writeIterable({writer:e,iterable:this.internalType}),e.write(")");break}case"string":{this.internalType.value.includes(`
|
|
21
|
+
`)?this.writeStringWithBackticks({writer:e,value:this.internalType.value}):e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}case"tuple":{this.writeIterable({writer:e,iterable:this.internalType});break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:P(this.internalType)}}isObject(){return this.internalType.type==="object"}asObjectOrThrow(){if(this.isObject())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not an object")}isSet(){return this.internalType.type==="set"}asSetOrThrow(){if(this.isSet())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a set")}isSetOfObjects(){return this.isSet()&&this.asSetOrThrow().values.every(e=>e.isObject())}writeStringWithBackticks({writer:e,value:o}){e.write("`");let p=o.split(`
|
|
22
|
+
`),d=p[0]+`
|
|
23
|
+
`,u=p.slice(1).join(`
|
|
24
|
+
`);e.write(d.replaceAll("`","\\`")),e.writeNoIndent(u.replaceAll("`","\\`")),e.write("`")}writeIterable({writer:e,iterable:o}){let p=ja({values:o.values});if(p.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let d of p)d.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeRecord({writer:e,record:o}){let p=$a({entries:o.entries});if(p.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let d of p)d.key.write(e),e.write(": "),d.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}writeObject({writer:e,object:o}){let p=Ma({fields:o.fields});if(p.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let d of p)e.write(`${d.name}: `),d.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}static array({values:e}){return new this({type:"array",values:e})}static bigint(e){return new this({type:"bigint",value:e})}static blob(e){return new this({type:"blob",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static object({fields:e}){return new this({type:"object",fields:e})}static record({entries:e}){return new this({type:"record",entries:e})}static reference(e){return new this({type:"reference",value:e})}static set({values:e}){return new this({type:"set",values:e})}static string(e){return new this({type:"string",value:e})}static tuple({values:e}){return new this({type:"tuple",values:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:o}){switch(typeof o){case"boolean":e.write(o.toString());return;case"string":e.write(o.includes('"')?`\`${o}\``:`"${o}"`);return;case"number":e.write(o.toString());return;case"object":if(o==null){e.write("null");return}if(Array.isArray(o)){this.writeUnknownArray({writer:e,value:o});return}this.writeUnknownObject({writer:e,value:o});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof o}`)}}writeUnknownArray({writer:e,value:o}){if(o.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let p of o)e.writeNode(s.unknown(p)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:o}){let p=Object.entries(o);if(p.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[d,u]of p)e.write(`${d}: `),e.writeNode(s.unknown(u)),e.writeLine(",");e.dedent(),e.write("}")}};function Ma({fields:s}){return s.filter(t=>!re.isNop(t.value))}function $a({entries:s}){return s.filter(t=>!re.isNop(t.key)&&!re.isNop(t.value))}function ja({values:s}){return s.filter(t=>!re.isNop(t))}l();f();c();var Re=class extends C{constructor(e){super();b(this,"args");this.args=e}write(e){this.args.export&&e.write("export "),this.args.const?e.write("const "):e.write("let "),e.write(`${this.args.name} = `),e.writeNode(this.args.initializer)}};function Da(s){return new ve(s)}function Wa(s){return new Ie(s)}function Va(s){return new be(s)}function qa(s){return new Te(s)}function Ga(s){return new Ee(s)}function za(s){return new Ae(s)}function Ha(s){return new fe(s)}function Ya(s){return new Re(s)}l();f();c();l();f();c();function oi({generatorConfig:s,isPackagePrivate:t}){let e=s.output.mode;switch(e.type){case"downloadFiles":return;case"publish":return{packageName:e.registriesV2.npm.packageName,version:e.version,private:t,publishInfo:{registryUrl:e.registriesV2.npm.registryUrl,token:e.registriesV2.npm.token},license:void 0,repoUrl:void 0};case"github":if(e.publishInfo!=null&&e.publishInfo.type!=="npm")throw new Error(`Expected to receive npm publish info but received ${e.publishInfo.type} instead`);return{packageName:e.publishInfo!=null?e.publishInfo.packageName:"",version:e.version,private:t,publishInfo:void 0,repoUrl:Ja(e.repoUrl),license:s.license?._visit({basic:o=>o.id,custom:o=>`See ${o.filename}`,_other:()=>{}})};default:throw new Error(`Encountered unknown output mode: ${e}`)}}function Ja(s){if(s!=null)return s.startsWith("https://github.com/")?`git+${s}`:s.startsWith("ssh://github.com/")?`github:${_e(s).replace("ssh://github.com/","")}`:s.startsWith("https://bitbucket.org/")?`bitbucket:${_e(s).replace("https://bitbucket.org/","")}`:s.startsWith("ssh://bitbucket.org/")?`bitbucket:${_e(s).replace("ssh://bitbucket.org/","")}`:s.startsWith("https://gitlab.com/")?`gitlab:${_e(s).replace("https://gitlab.com/","")}`:s.startsWith("ssh://gitlab.com/")?`gitlab:${_e(s).replace("ssh://gitlab.com/","")}`:(s.startsWith("git+")||(s=`git+${s}`),s.endsWith(".git")||(s=`${s}.git`),s)}function _e(s){return s.endsWith(".git")?s.slice(0,-4):s}l();f();c();function ht({organization:s,workspaceName:t,namespaceExport:e}){return e??`${xe(Je(s))}${xe(Je(t))}`}l();f();c();l();f();c();var De={};K(De,{commons:()=>ai,dynamic:()=>wt,generatorExec:()=>vt});l();f();c();l();f();c();var ai={};l();f();c();var wt={};K(wt,{ErrorSeverity:()=>mi,HttpMethod:()=>fi,ObjectPropertyAccess:()=>hi,PrimitiveTypeV1:()=>yi,auth:()=>si,commons:()=>ui,declaration:()=>pi,endpoints:()=>li,environment:()=>ci,http:()=>yt,ir:()=>di,snippets:()=>xt,types:()=>gt,variables:()=>xi});l();f();c();l();f();c();var si={};l();f();c();var ui={};l();f();c();var pi={};l();f();c();var li={};l();f();c();var ci={};l();f();c();var yt={};K(yt,{HttpMethod:()=>fi});l();f();c();l();f();c();var fi={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var di={};l();f();c();var xt={};K(xt,{ErrorSeverity:()=>mi});l();f();c();l();f();c();var mi={Critical:"CRITICAL",Warning:"WARNING"};var gt={};K(gt,{ObjectPropertyAccess:()=>hi,PrimitiveTypeV1:()=>yi});l();f();c();l();f();c();var hi={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};l();f();c();var yi={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"};var xi={};l();f();c();var vt={};K(vt,{LicenseId:()=>gi,config:()=>bt});l();f();c();l();f();c();var bt={};K(bt,{LicenseId:()=>gi});l();f();c();l();f();c();var gi={Mit:"MIT",Apache2:"Apache-2.0"};var Za="value",Qe=class{constructor({context:t}){b(this,"context");this.context=t}convert(t){let e=t.convertOpts;if(t.value===null)return this.context.isNullable(t.typeReference)?v.TypeLiteral.null():(this.context.errors.add({severity:F.Critical,message:"Expected non-null value, but got null"}),v.TypeLiteral.nop());if(t.value===void 0)return v.TypeLiteral.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value,convertOpts:e});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value,convertOpts:e});case"map":return this.convertMap({map:t.typeReference,value:t.value,convertOpts:e});case"named":{let o=this.context.resolveNamedType({typeId:t.typeReference.value});return o==null?v.TypeLiteral.nop():this.convertNamed({named:o,value:t.value,as:t.as,convertOpts:e})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as,convertOpts:e});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as,convertOpts:e});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as,convertOpts:e});case"set":return this.convertSet({set:t.typeReference.value,value:t.value,convertOpts:e});case"unknown":return this.convertUnknown({value:t.value,convertOpts:e});default:P(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let o=this.context.getValueAsBoolean({value:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.boolean(o)}case"string":{let o=this.context.getValueAsString({value:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.string(o)}default:P(t)}}convertList({list:t,value:e,convertOpts:o}){return Array.isArray(e)?v.TypeLiteral.array({values:e.map((p,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:t,value:p,convertOpts:o})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:F.Critical,message:`Expected array but got: ${typeof e}`}),v.TypeLiteral.nop())}convertSet({set:t,value:e,convertOpts:o}){return Array.isArray(e)?v.TypeLiteral.set({values:e.map((p,d)=>{this.context.errors.scope({index:d});try{return this.convert({typeReference:t,value:p,convertOpts:o})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:F.Critical,message:`Expected array but got: ${typeof e}`}),v.TypeLiteral.nop())}convertMap({map:t,value:e,convertOpts:o}){return typeof e!="object"||e==null?(this.context.errors.add({severity:F.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),v.TypeLiteral.nop()):v.TypeLiteral.record({entries:Object.entries(e).map(([p,d])=>{this.context.errors.scope(p);try{return{key:this.convert({typeReference:t.key,value:p,as:"key",convertOpts:o}),value:this.convert({typeReference:t.value,value:d,convertOpts:o})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:o,convertOpts:p}){switch(t.type){case"alias":return this.context.customConfig?.useBrandedStringAliases?v.TypeLiteral.reference(v.codeblock(d=>{d.writeNode(v.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:t.declaration})})),d.write("("),d.writeNode(this.convert({typeReference:t.typeReference,value:e,as:o,convertOpts:p})),d.write(")")})):this.convert({typeReference:t.typeReference,value:e,as:o,convertOpts:p});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e,convertOpts:p});case"enum":return this.convertEnum({enum_:t,value:e,convertOpts:p});case"object":return this.convertObject({object_:t,value:e,convertOpts:p});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e,convertOpts:p});default:P(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e,convertOpts:o}){let p=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(p==null)return v.TypeLiteral.nop();let d=p.singleDiscriminatedUnionType,u=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:p,unionVariant:d,convertOpts:o});if(u==null)return v.TypeLiteral.nop();if(this.context.customConfig?.includeUtilsOnUnionMembers)return v.TypeLiteral.reference(v.codeblock(T=>{T.writeNode(v.invokeMethod({on:v.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:t.declaration})}),method:this.context.getMethodName(d.discriminantValue.name),arguments_:this.convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:p,unionVariant:d,unionProperties:u,convertOpts:o})}))}));let I={name:this.context.getPropertyName(t.discriminant.name),value:v.TypeLiteral.string(d.discriminantValue.wireValue)};return v.TypeLiteral.object({fields:[I,...u]})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e,convertOpts:o}){let p=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});switch(e.type){case"samePropertiesAsObject":{let d=this.context.resolveNamedType({typeId:e.typeId});if(d==null)return;let u=this.convertNamed({named:d,value:t.value,convertOpts:o});if(!u.isObject()){this.context.errors.add({severity:F.Critical,message:"Internal error; expected union value to be an object"});return}let I=u.asObjectOrThrow();return[...p,...I.fields]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let d=this.context.getRecord(t.value);return d==null?[...p,{name:Za,value:this.convert({typeReference:e.typeReference,value:t.value,convertOpts:o})}]:[...p,{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:d[e.discriminantValue.wireValue],convertOpts:o})}]}finally{this.context.errors.unscope()}case"noProperties":return p;default:P(e)}}convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:o,convertOpts:p}){return e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&o.length===1?[this.convert({typeReference:e.typeReference,value:t.value,convertOpts:p})]:o.length>0?[v.TypeLiteral.object({fields:o})]:[]}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e,convertOpts:o}){return this.context.associateByWireValue({parameters:e.properties??[],values:this.context.getRecord(t.value)??{},ignoreMissingParameters:!0}).map(d=>{this.context.errors.scope(d.name.wireValue);try{return{name:this.context.getPropertyName(d.name.name),value:this.convert({...d,convertOpts:o})}}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e,convertOpts:o}){let p=this.context.associateByWireValue({parameters:this.filterReadWriteProperties(t.properties,o),values:this.context.getRecord(e)??{}});return v.TypeLiteral.object({fields:p.map(d=>{this.context.errors.scope(d.name.wireValue);try{return{name:this.context.getPropertyName(d.name.name),value:this.convert({...d,convertOpts:o})}}finally{this.context.errors.unscope()}})})}filterReadWriteProperties(t,e){return this.context.customConfig?.experimentalGenerateReadWriteOnlyTypes!==!0||typeof e>"u"||(e.isForRequest&&(t=t.filter(o=>o.propertyAccess!==De.dynamic.ObjectPropertyAccess.ReadOnly)),e.isForResponse&&(t=t.filter(o=>o.propertyAccess!==De.dynamic.ObjectPropertyAccess.WriteOnly))),t}convertEnum({enum_:t,value:e}){let o=this.getEnumValue({enum_:t,value:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.string(o)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:F.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(p=>p.wireValue===e)==null){this.context.errors.add({severity:F.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return e}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e,convertOpts:o}){let p=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e,convertOpts:o});return p??v.TypeLiteral.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e,convertOpts:o}){for(let p of t.types){let d=this.context.errors.size();try{let u=this.convert({typeReference:p,value:e,convertOpts:o});if(v.TypeLiteral.isNop(u)){this.context.errors.truncate(d);continue}return u}catch{this.context.errors.truncate(d);continue}}this.context.errors.add({severity:F.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t,convertOpts:e}){return v.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:o,convertOpts:p}){switch(t){case"INTEGER":case"UINT":{let d=this.getValueAsNumber({value:e,as:o});return d==null?v.TypeLiteral.nop():v.TypeLiteral.number(d)}case"LONG":case"UINT_64":{let d=this.getValueAsNumber({value:e,as:o});return d==null?v.TypeLiteral.nop():this.context.customConfig?.useBigInt?v.TypeLiteral.bigint(BigInt(d)):v.TypeLiteral.number(d)}case"FLOAT":case"DOUBLE":{let d=this.getValueAsNumber({value:e});return d==null?v.TypeLiteral.nop():v.TypeLiteral.number(d)}case"BOOLEAN":{let d=this.getValueAsBoolean({value:e,as:o});return d==null?v.TypeLiteral.nop():v.TypeLiteral.boolean(d)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let d=this.context.getValueAsString({value:e});return d==null?v.TypeLiteral.nop():v.TypeLiteral.string(d)}case"DATE_TIME":{let d=this.context.getValueAsString({value:e});return d==null?v.TypeLiteral.nop():v.TypeLiteral.datetime(d)}case"BIG_INTEGER":{let d=this.context.getValueAsString({value:e});return d==null?v.TypeLiteral.nop():this.context.customConfig?.useBigInt?v.TypeLiteral.bigint(BigInt(d)):v.TypeLiteral.string(d)}default:P(t)}}getValueAsNumber({value:t,as:e}){let o=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:o})}getValueAsBoolean({value:t,as:e}){let o=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:o})}};l();f();c();var et=class{constructor({context:t}){b(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){let o={fileFields:[],bodyPropertyFields:[]},p=this.context.getRecord(e)??{};for(let d of t.properties)switch(d.type){case"file":o.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getSingleFileProperty({property:d,record:p})});break;case"fileArray":o.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getArrayFileProperty({property:d,record:p})});break;case"bodyProperty":o.bodyPropertyFields.push({name:this.context.getPropertyName(d.name.name),value:this.getBodyProperty({property:d,record:p})});break;default:P(d)}return o}getSingleFileProperty({property:t,record:e}){let o=this.context.getSingleFileValue({property:t,record:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.blob(o)}getArrayFileProperty({property:t,record:e}){let o=this.context.getFileArrayValues({property:t,record:e});return o==null?v.TypeLiteral.nop():v.TypeLiteral.array({values:o.map(p=>v.TypeLiteral.blob(p))})}getBodyProperty({property:t,record:e}){let o=e[t.name.wireValue];return o==null?v.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:o})}};var tt=class s extends $e{constructor({ir:e,config:o}){super({ir:e,config:o});b(this,"ir");b(this,"customConfig");b(this,"dynamicTypeLiteralMapper");b(this,"filePropertyMapper");b(this,"moduleName");b(this,"namespaceExport");this.ir=e,this.customConfig=o.customConfig!=null?o.customConfig:void 0,this.dynamicTypeLiteralMapper=new Qe({context:this}),this.filePropertyMapper=new et({context:this}),this.moduleName=Ka({config:o,customConfig:this.customConfig}),this.namespaceExport=ht({organization:o.organization,workspaceName:o.workspaceName,namespaceExport:this.customConfig?.namespaceExport})}clone(){return new s({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return`${this.namespaceExport}Client`}getPropertyName(e){return this.customConfig?.retainOriginalCasing||this.customConfig?.noSerdeLayer?this.formatOriginalPropertyName(e.originalName):e.camelCase.unsafeName}getMethodName(e){return e.camelCase.unsafeName}getTypeName(e){return e.pascalCase.unsafeName}getEnvironmentTypeReferenceFromID(e){let o=this.resolveEnvironmentName(e);if(o!=null)return this.getEnvironmentsTypeReference(o)}getFullyQualifiedReference({declaration:e}){return e.fernFilepath.allParts.length>0?`${e.fernFilepath.allParts.map(o=>o.camelCase.unsafeName).join(".")}.${this.getTypeName(e.name)}`:`${this.getTypeName(e.name)}`}getEnvironmentsTypeReference(e){return v.reference({name:`${this.namespaceExport}Environment`,importFrom:this.getModuleImport(),memberName:this.getTypeName(e)})}formatOriginalPropertyName(e){return e.includes("-")?`"${e}"`:e}};function Ka({config:s,customConfig:t}){return oi({generatorConfig:s,isPackagePrivate:t?.private??!1})?.packageName??s.organization}l();f();c();var wi="client",bi="main",Xa={type:"primitive",value:"STRING"},rt=class{constructor({context:t}){b(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){return await this.buildCodeBlock({endpoint:t,snippet:e}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:t,request:e}){return this.buildCodeBlock({endpoint:t,snippet:e}).toString({customConfig:this.context.customConfig})}async generateSnippetAst({endpoint:t,request:e}){return this.buildCodeBlock({endpoint:t,snippet:e})}buildCodeBlock({endpoint:t,snippet:e}){return v.codeblock(o=>{o.writeNode(v.function_({name:bi,async:!0,parameters:[],body:v.codeblock(p=>{p.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),p.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})})),o.writeNodeStatement(v.invokeFunction({function_:v.reference({name:bi}),arguments_:[]}))})}constructClient({endpoint:t,snippet:e}){return v.variable({name:wi,const:!0,initializer:v.instantiateClass({class_:v.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:t,snippet:e})]})})}getConstructorArgs({endpoint:t,snippet:e}){let o=[],p=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return p.length>0&&o.push(...p),t.auth!=null&&(e.auth!=null?o.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:F.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(J.PathParameters),this.context.ir.pathParameters!=null&&o.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(J.Headers),this.context.ir.headers!=null&&e.headers!=null&&o.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),o.length===0?v.TypeLiteral.nop():v.TypeLiteral.object({fields:o})}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let o=this.getEnvironmentValue({baseUrl:t,environment:e});return o==null?[]:[{name:"environment",value:o}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:F.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return v.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let o=this.context.getEnvironmentTypeReferenceFromID(e);if(o==null){this.context.errors.add({severity:F.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return v.TypeLiteral.reference(o)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?v.TypeLiteral.object({fields:Object.entries(e).map(([o,p])=>({name:o,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Xa,value:p})}))}):void 0}}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBasicAuthArg({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.addAuthMismatchError(t,e),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.addAuthMismatchError(t,e),[]):this.getConstructorOAuthArgs({auth:t,values:e});case"inferred":return e.type!=="inferred"?(this.addAuthMismatchError(t,e),[]):(this.addWarning("The TypeScript SDK v2 Generator does not support Inferred auth scheme yet"),[]);default:P(t)}}addAuthMismatchError(t,e){this.context.errors.add({severity:F.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message})}addWarning(t){this.context.errors.add({severity:F.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:v.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),value:v.TypeLiteral.string(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:v.TypeLiteral.string(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorOAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.clientId),value:v.TypeLiteral.string(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:v.TypeLiteral.string(e.clientSecret)}]}getConstructorHeaderArgs({headers:t,values:e}){let o=[];for(let p of t){let d=this.getConstructorHeaderArg({header:p,value:e.value});d!=null&&o.push(d)}return o}getConstructorHeaderArg({header:t,value:e}){let o=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!v.TypeLiteral.isNop(o))return{name:this.context.getPropertyName(t.name.name),value:o}}callMethod({endpoint:t,snippet:e}){return v.invokeMethod({on:v.reference({name:wi}),method:this.getMethod({endpoint:t}),async:!0,arguments_:this.getMethodArgs({endpoint:t,snippet:e})})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:P(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){let o=[];this.context.errors.scope(J.PathParameters);let p=[...this.context.ir.pathParameters??[],...t.pathParameters??[]];return p.length>0&&o.push(...this.getPathParameters({namedParameters:p,snippet:e}).map(d=>d.value)),this.context.errors.unscope(),this.context.errors.scope(J.RequestBody),t.body!=null&&o.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),o}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,convertOpts:{isForRequest:!0}});default:P(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:F.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),v.TypeLiteral.nop()):v.TypeLiteral.blob(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){let o=[],{inlinePathParameters:p,inlineFileProperties:d}={inlinePathParameters:this.context.customConfig?.inlinePathParameters??!1,inlineFileProperties:this.context.customConfig?.inlineFileProperties??!1};this.context.errors.scope(J.PathParameters);let u=[];t.pathParameters!=null&&u.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(J.RequestBody);let I=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:p})||o.push(...u.map(T=>T.value)),d||o.push(...I.fileFields.map(T=>T.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:p,inlineFileProperties:d})&&o.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:p})?u:[],filePropertyInfo:I})),o}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:o,filePropertyInfo:p}){this.context.errors.scope(J.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:t.queryParameters??[],values:e.queryParameters??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(J.Headers);let T=this.context.associateByWireValue({parameters:t.headers??[],values:e.headers??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(J.RequestBody);let N=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:p}):[];return this.context.errors.unscope(),v.TypeLiteral.object({fields:[...o,...u,...T,...N]})}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:o}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:o});default:P(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return this.context.customConfig?.inlineFileProperties?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({body:t,value:e}){return{name:this.context.getPropertyName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,convertOpts:{isForRequest:!0}});default:P(t)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){let o=[],p=this.context.associateByWireValue({parameters:t,values:this.context.getRecord(e)??{}});for(let d of p)o.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...d,convertOpts:{isForRequest:!0}})});return o}getPathParameters({namedParameters:t,snippet:e}){let o=[],p=this.context.associateByWireValue({parameters:t,values:e.pathParameters??{},ignoreMissingParameters:!0});for(let d of p)o.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...d,convertOpts:{isForRequest:!0}})});return o}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getMethodName(e)).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}};var nt=class extends Oe{constructor({ir:t,config:e}){super(new tt({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new rt({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
25
25
|
/*! Bundled license information:
|
|
26
26
|
|
|
27
27
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|