@fern-api/ruby-dynamic-snippets 1.7.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ge=Object.defineProperty;var ei=Object.getOwnPropertyDescriptor;var ti=Object.getOwnPropertyNames;var ri=Object.prototype.hasOwnProperty;var ni=(l,t,e)=>t in l?Ge(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var Ae=(l,t)=>()=>(l&&(t=l(l=0)),t);var ct=(l,t)=>{for(var e in t)Ge(l,e,{get:t[e],enumerable:!0})},ii=(l,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ti(t))!ri.call(l,s)&&s!==e&&Ge(l,s,{get:()=>t[s],enumerable:!(i=ei(t,s))||i.enumerable});return l};var oi=l=>ii(Ge({},"__esModule",{value:!0}),l);var y=(l,t,e)=>ni(l,typeof t!="symbol"?t+"":t,e);var c=Ae(()=>{"use strict"});var v={};ct(v,{_debugEnd:()=>vr,_debugProcess:()=>br,_events:()=>Dr,_eventsCount:()=>Or,_exiting:()=>tr,_fatalExceptions:()=>yr,_getActiveHandles:()=>or,_getActiveRequests:()=>ir,_kill:()=>ar,_linkedBinding:()=>Zt,_maxListeners:()=>Mr,_preload_modules:()=>Fr,_rawDebug:()=>Xt,_startProfilerIdleNotifier:()=>Tr,_stopProfilerIdleNotifier:()=>Ar,_tickCallback:()=>wr,abort:()=>Rr,addListener:()=>$r,allowedNodeEnvironmentFlags:()=>dr,arch:()=>Dt,argv:()=>_t,argv0:()=>Cr,assert:()=>mr,binding:()=>Gt,browser:()=>Jt,chdir:()=>Ht,config:()=>rr,cpuUsage:()=>He,cwd:()=>Kt,debugPort:()=>Sr,default:()=>Hr,dlopen:()=>nr,domain:()=>er,emit:()=>Wr,emitWarning:()=>Wt,env:()=>$t,execArgv:()=>jt,execPath:()=>Lr,exit:()=>fr,features:()=>hr,hasUncaughtExceptionCaptureCallback:()=>xr,hrtime:()=>Ke,kill:()=>pr,listeners:()=>Kr,memoryUsage:()=>lr,moduleLoadList:()=>Qt,nextTick:()=>Pt,off:()=>jr,on:()=>te,once:()=>_r,openStdin:()=>cr,pid:()=>Nr,platform:()=>Ot,ppid:()=>Br,prependListener:()=>Gr,prependOnceListener:()=>zr,reallyExit:()=>sr,release:()=>Yt,removeAllListeners:()=>qr,removeListener:()=>Vr,resourceUsage:()=>ur,setSourceMapsEnabled:()=>Pr,setUncaughtExceptionCaptureCallback:()=>gr,stderr:()=>Ir,stdin:()=>kr,stdout:()=>Er,title:()=>Mt,umask:()=>zt,uptime:()=>Ur,version:()=>Vt,versions:()=>qt});function ht(l){throw new Error("Node.js process "+l+" is not supported by JSPM core outside of Node.js")}function si(){!Ee||!fe||(Ee=!1,fe.length?ee=fe.concat(ee):ze=-1,ee.length&&Ft())}function Ft(){if(!Ee){var l=setTimeout(si,0);Ee=!0;for(var t=ee.length;t;){for(fe=ee,ee=[];++ze<t;)fe&&fe[ze].run();ze=-1,t=ee.length}fe=null,Ee=!1,clearTimeout(l)}}function Pt(l){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];ee.push(new Ut(l,t)),ee.length===1&&!Ee&&setTimeout(Ft,0)}function Ut(l,t){this.fun=l,this.array=t}function V(){}function Zt(l){ht("_linkedBinding")}function nr(l){ht("dlopen")}function ir(){return[]}function or(){return[]}function mr(l,t){if(!l)throw new Error(t||"assertion error")}function xr(){return!1}function Ur(){return pe.now()/1e3}function Ke(l){var t=Math.floor((Date.now()-pe.now())*.001),e=pe.now()*.001,i=Math.floor(e)+t,s=Math.floor(e%1*1e9);return l&&(i=i-l[0],s=s-l[1],s<0&&(i--,s+=mt)),[i,s]}function te(){return Hr}function Kr(l){return[]}var ee,Ee,fe,ze,Mt,Dt,Ot,$t,_t,jt,Vt,qt,Wt,Gt,zt,Kt,Ht,Yt,Jt,Xt,Qt,er,tr,rr,sr,ar,He,ur,lr,pr,fr,cr,dr,hr,yr,gr,wr,br,vr,Tr,Ar,Er,Ir,kr,Rr,Nr,Br,Lr,Sr,Cr,Fr,Pr,pe,dt,mt,Mr,Dr,Or,$r,_r,jr,Vr,qr,Wr,Gr,zr,Hr,Yr=Ae(()=>{"use strict";c();m();d();ee=[],Ee=!1,ze=-1;Ut.prototype.run=function(){this.fun.apply(null,this.array)};Mt="browser",Dt="x64",Ot="browser",$t={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},_t=["/usr/bin/node"],jt=[],Vt="v16.8.0",qt={},Wt=function(l,t){console.warn((t?t+": ":"")+l)},Gt=function(l){ht("binding")},zt=function(l){return 0},Kt=function(){return"/"},Ht=function(l){},Yt={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Jt=!0,Xt=V,Qt=[];er={},tr=!1,rr={};sr=V,ar=V,He=function(){return{}},ur=He,lr=He,pr=V,fr=V,cr=V,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=V,gr=V;wr=V,br=V,vr=V,Tr=V,Ar=V,Er=void 0,Ir=void 0,kr=void 0,Rr=V,Nr=2,Br=1,Lr="/bin/usr/node",Sr=9229,Cr="node",Fr=[],Pr=V,pe={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};pe.now===void 0&&(dt=Date.now(),pe.timing&&pe.timing.navigationStart&&(dt=pe.timing.navigationStart),pe.now=()=>Date.now()-dt);mt=1e9;Ke.bigint=function(l){var t=Ke(l);return typeof BigInt>"u"?t[0]*mt+t[1]:BigInt(t[0]*mt)+BigInt(t[1])};Mr=10,Dr={},Or=0;$r=te,_r=te,jr=te,Vr=te,qr=te,Wr=V,Gr=te,zr=te;Hr={version:Vt,versions:qt,arch:Dt,platform:Ot,browser:Jt,release:Yt,_rawDebug:Xt,moduleLoadList:Qt,binding:Gt,_linkedBinding:Zt,_events:Dr,_eventsCount:Or,_maxListeners:Mr,on:te,addListener:$r,once:_r,off:jr,removeListener:Vr,removeAllListeners:qr,emit:Wr,prependListener:Gr,prependOnceListener:zr,listeners:Kr,domain:er,_exiting:tr,config:rr,dlopen:nr,uptime:Ur,_getActiveRequests:ir,_getActiveHandles:or,reallyExit:sr,_kill:ar,cpuUsage:He,resourceUsage:ur,memoryUsage:lr,kill:pr,exit:fr,openStdin:cr,allowedNodeEnvironmentFlags:dr,assert:mr,features:hr,_fatalExceptions:yr,setUncaughtExceptionCaptureCallback:gr,hasUncaughtExceptionCaptureCallback:xr,emitWarning:Wt,nextTick:Pt,_tickCallback:wr,_debugProcess:br,_debugEnd:vr,_startProfilerIdleNotifier:Tr,_stopProfilerIdleNotifier:Ar,stdout:Er,stdin:kr,stderr:Ir,abort:Rr,umask:zt,chdir:Ht,cwd:Kt,env:$t,title:Mt,argv:_t,execArgv:jt,pid:Nr,ppid:Br,execPath:Lr,debugPort:Sr,hrtime:Ke,argv0:Cr,_preload_modules:Fr,setSourceMapsEnabled:Pr}});var d=Ae(()=>{"use strict";Yr()});function ai(){if(Jr)return Re;Jr=!0,Re.byteLength=w,Re.toByteArray=R,Re.fromByteArray=M;for(var l=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,p=i.length;s<p;++s)l[s]=i[s],t[i.charCodeAt(s)]=s;t[45]=62,t[95]=63;function a(E){var k=E.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=E.indexOf("=");F===-1&&(F=k);var _=F===k?0:4-F%4;return[F,_]}function w(E){var k=a(E),F=k[0],_=k[1];return(F+_)*3/4-_}function b(E,k,F){return(k+F)*3/4-F}function R(E){var k,F=a(E),_=F[0],G=F[1],$=new e(b(E,_,G)),z=0,H=G>0?_-4:_,q;for(q=0;q<H;q+=4)k=t[E.charCodeAt(q)]<<18|t[E.charCodeAt(q+1)]<<12|t[E.charCodeAt(q+2)]<<6|t[E.charCodeAt(q+3)],$[z++]=k>>16&255,$[z++]=k>>8&255,$[z++]=k&255;return G===2&&(k=t[E.charCodeAt(q)]<<2|t[E.charCodeAt(q+1)]>>4,$[z++]=k&255),G===1&&(k=t[E.charCodeAt(q)]<<10|t[E.charCodeAt(q+1)]<<4|t[E.charCodeAt(q+2)]>>2,$[z++]=k>>8&255,$[z++]=k&255),$}function I(E){return l[E>>18&63]+l[E>>12&63]+l[E>>6&63]+l[E&63]}function C(E,k,F){for(var _,G=[],$=k;$<F;$+=3)_=(E[$]<<16&16711680)+(E[$+1]<<8&65280)+(E[$+2]&255),G.push(I(_));return G.join("")}function M(E){for(var k,F=E.length,_=F%3,G=[],$=16383,z=0,H=F-_;z<H;z+=$)G.push(C(E,z,z+$>H?H:z+$));return _===1?(k=E[F-1],G.push(l[k>>2]+l[k<<4&63]+"==")):_===2&&(k=(E[F-2]<<8)+E[F-1],G.push(l[k>>10]+l[k>>4&63]+l[k<<2&63]+"=")),G.join("")}return Re}function ui(){if(Xr)return Ye;Xr=!0;return Ye.read=function(l,t,e,i,s){var p,a,w=s*8-i-1,b=(1<<w)-1,R=b>>1,I=-7,C=e?s-1:0,M=e?-1:1,E=l[t+C];for(C+=M,p=E&(1<<-I)-1,E>>=-I,I+=w;I>0;p=p*256+l[t+C],C+=M,I-=8);for(a=p&(1<<-I)-1,p>>=-I,I+=i;I>0;a=a*256+l[t+C],C+=M,I-=8);if(p===0)p=1-R;else{if(p===b)return a?NaN:(E?-1:1)*(1/0);a=a+Math.pow(2,i),p=p-R}return(E?-1:1)*a*Math.pow(2,p-i)},Ye.write=function(l,t,e,i,s,p){var a,w,b,R=p*8-s-1,I=(1<<R)-1,C=I>>1,M=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:p-1,k=i?1:-1,F=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(w=isNaN(t)?1:0,a=I):(a=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-a))<1&&(a--,b*=2),a+C>=1?t+=M/b:t+=M*Math.pow(2,1-C),t*b>=2&&(a++,b/=2),a+C>=I?(w=0,a=I):a+C>=1?(w=(t*b-1)*Math.pow(2,s),a=a+C):(w=t*Math.pow(2,C-1)*Math.pow(2,s),a=0));s>=8;l[e+E]=w&255,E+=k,w/=256,s-=8);for(a=a<<s|w,R+=s;R>0;l[e+E]=a&255,E+=k,a/=256,R-=8);l[e+E-k]|=F*128},Ye}function Zr(){if(Qr)return ce;Qr=!0;let l=ai(),t=ui(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ce.Buffer=a,ce.SlowBuffer=G,ce.INSPECT_MAX_BYTES=50;let i=2147483647;ce.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.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 s(){try{let o=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(o,r),o.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function p(o){if(o>i)throw new RangeError('The value "'+o+'" is invalid for option "size"');let r=new Uint8Array(o);return Object.setPrototypeOf(r,a.prototype),r}function a(o,r,n){if(typeof o=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return I(o)}return w(o,r,n)}a.poolSize=8192;function w(o,r,n){if(typeof o=="string")return C(o,r);if(ArrayBuffer.isView(o))return E(o);if(o==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o);if(Q(o,ArrayBuffer)||o&&Q(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Q(o,SharedArrayBuffer)||o&&Q(o.buffer,SharedArrayBuffer)))return k(o,r,n);if(typeof o=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let u=o.valueOf&&o.valueOf();if(u!=null&&u!==o)return a.from(u,r,n);let f=F(o);if(f)return f;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]=="function")return a.from(o[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 o)}a.from=function(o,r,n){return w(o,r,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function b(o){if(typeof o!="number")throw new TypeError('"size" argument must be of type number');if(o<0)throw new RangeError('The value "'+o+'" is invalid for option "size"')}function R(o,r,n){return b(o),o<=0?p(o):r!==void 0?typeof n=="string"?p(o).fill(r,n):p(o).fill(r):p(o)}a.alloc=function(o,r,n){return R(o,r,n)};function I(o){return b(o),p(o<0?0:_(o)|0)}a.allocUnsafe=function(o){return I(o)},a.allocUnsafeSlow=function(o){return I(o)};function C(o,r){if((typeof r!="string"||r==="")&&(r="utf8"),!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let n=$(o,r)|0,u=p(n),f=u.write(o,r);return f!==n&&(u=u.slice(0,f)),u}function M(o){let r=o.length<0?0:_(o.length)|0,n=p(r);for(let u=0;u<r;u+=1)n[u]=o[u]&255;return n}function E(o){if(Q(o,Uint8Array)){let r=new Uint8Array(o);return k(r.buffer,r.byteOffset,r.byteLength)}return M(o)}function k(o,r,n){if(r<0||o.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(o.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let u;return r===void 0&&n===void 0?u=new Uint8Array(o):n===void 0?u=new Uint8Array(o,r):u=new Uint8Array(o,r,n),Object.setPrototypeOf(u,a.prototype),u}function F(o){if(a.isBuffer(o)){let r=_(o.length)|0,n=p(r);return n.length===0||o.copy(n,0,0,r),n}if(o.length!==void 0)return typeof o.length!="number"||ft(o.length)?p(0):M(o);if(o.type==="Buffer"&&Array.isArray(o.data))return M(o.data)}function _(o){if(o>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return o|0}function G(o){return+o!=o&&(o=0),a.alloc(+o)}a.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==a.prototype},a.compare=function(r,n){if(Q(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),Q(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(r)||!a.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let u=r.length,f=n.length;for(let h=0,x=Math.min(u,f);h<x;++h)if(r[h]!==n[h]){u=r[h],f=n[h];break}return u<f?-1:f<u?1:0},a.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}},a.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);let u;if(n===void 0)for(n=0,u=0;u<r.length;++u)n+=r[u].length;let f=a.allocUnsafe(n),h=0;for(u=0;u<r.length;++u){let x=r[u];if(Q(x,Uint8Array))h+x.length>f.length?(a.isBuffer(x)||(x=a.from(x)),x.copy(f,h)):Uint8Array.prototype.set.call(f,x,h);else if(a.isBuffer(x))x.copy(f,h);else throw new TypeError('"list" argument must be an Array of Buffers');h+=x.length}return f};function $(o,r){if(a.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||Q(o,ArrayBuffer))return o.byteLength;if(typeof o!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof o);let n=o.length,u=arguments.length>2&&arguments[2]===!0;if(!u&&n===0)return 0;let f=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return pt(o).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Ct(o).length;default:if(f)return u?-1:pt(o).length;r=(""+r).toLowerCase(),f=!0}}a.byteLength=$;function z(o,r,n){let u=!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(o||(o="utf8");;)switch(o){case"hex":return Gn(this,r,n);case"utf8":case"utf-8":return At(this,r,n);case"ascii":return qn(this,r,n);case"latin1":case"binary":return Wn(this,r,n);case"base64":return jn(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zn(this,r,n);default:if(u)throw new TypeError("Unknown encoding: "+o);o=(o+"").toLowerCase(),u=!0}}a.prototype._isBuffer=!0;function H(o,r,n){let u=o[r];o[r]=o[n],o[n]=u}a.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},a.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},a.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},a.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?At(this,0,r):z.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(r){if(!a.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0},a.prototype.inspect=function(){let r="",n=ce.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},e&&(a.prototype[e]=a.prototype.inspect),a.prototype.compare=function(r,n,u,f,h){if(Q(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),!a.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),u===void 0&&(u=r?r.length:0),f===void 0&&(f=0),h===void 0&&(h=this.length),n<0||u>r.length||f<0||h>this.length)throw new RangeError("out of range index");if(f>=h&&n>=u)return 0;if(f>=h)return-1;if(n>=u)return 1;if(n>>>=0,u>>>=0,f>>>=0,h>>>=0,this===r)return 0;let x=h-f,N=u-n,D=Math.min(x,N),U=this.slice(f,h),O=r.slice(n,u);for(let P=0;P<D;++P)if(U[P]!==O[P]){x=U[P],N=O[P];break}return x<N?-1:N<x?1:0};function q(o,r,n,u,f){if(o.length===0)return-1;if(typeof n=="string"?(u=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ft(n)&&(n=f?0:o.length-1),n<0&&(n=o.length+n),n>=o.length){if(f)return-1;n=o.length-1}else if(n<0)if(f)n=0;else return-1;if(typeof r=="string"&&(r=a.from(r,u)),a.isBuffer(r))return r.length===0?-1:Tt(o,r,n,u,f);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(o,r,n):Uint8Array.prototype.lastIndexOf.call(o,r,n):Tt(o,[r],n,u,f);throw new TypeError("val must be string, number or Buffer")}function Tt(o,r,n,u,f){let h=1,x=o.length,N=r.length;if(u!==void 0&&(u=String(u).toLowerCase(),u==="ucs2"||u==="ucs-2"||u==="utf16le"||u==="utf-16le")){if(o.length<2||r.length<2)return-1;h=2,x/=2,N/=2,n/=2}function D(O,P){return h===1?O[P]:O.readUInt16BE(P*h)}let U;if(f){let O=-1;for(U=n;U<x;U++)if(D(o,U)===D(r,O===-1?0:U-O)){if(O===-1&&(O=U),U-O+1===N)return O*h}else O!==-1&&(U-=U-O),O=-1}else for(n+N>x&&(n=x-N),U=n;U>=0;U--){let O=!0;for(let P=0;P<N;P++)if(D(o,U+P)!==D(r,P)){O=!1;break}if(O)return U}return-1}a.prototype.includes=function(r,n,u){return this.indexOf(r,n,u)!==-1},a.prototype.indexOf=function(r,n,u){return q(this,r,n,u,!0)},a.prototype.lastIndexOf=function(r,n,u){return q(this,r,n,u,!1)};function Mn(o,r,n,u){n=Number(n)||0;let f=o.length-n;u?(u=Number(u),u>f&&(u=f)):u=f;let h=r.length;u>h/2&&(u=h/2);let x;for(x=0;x<u;++x){let N=parseInt(r.substr(x*2,2),16);if(ft(N))return x;o[n+x]=N}return x}function Dn(o,r,n,u){return We(pt(r,o.length-n),o,n,u)}function On(o,r,n,u){return We(Jn(r),o,n,u)}function $n(o,r,n,u){return We(Ct(r),o,n,u)}function _n(o,r,n,u){return We(Xn(r,o.length-n),o,n,u)}a.prototype.write=function(r,n,u,f){if(n===void 0)f="utf8",u=this.length,n=0;else if(u===void 0&&typeof n=="string")f=n,u=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(u)?(u=u>>>0,f===void 0&&(f="utf8")):(f=u,u=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-n;if((u===void 0||u>h)&&(u=h),r.length>0&&(u<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");let x=!1;for(;;)switch(f){case"hex":return Mn(this,r,n,u);case"utf8":case"utf-8":return Dn(this,r,n,u);case"ascii":case"latin1":case"binary":return On(this,r,n,u);case"base64":return $n(this,r,n,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _n(this,r,n,u);default:if(x)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),x=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function jn(o,r,n){return r===0&&n===o.length?l.fromByteArray(o):l.fromByteArray(o.slice(r,n))}function At(o,r,n){n=Math.min(o.length,n);let u=[],f=r;for(;f<n;){let h=o[f],x=null,N=h>239?4:h>223?3:h>191?2:1;if(f+N<=n){let D,U,O,P;switch(N){case 1:h<128&&(x=h);break;case 2:D=o[f+1],(D&192)===128&&(P=(h&31)<<6|D&63,P>127&&(x=P));break;case 3:D=o[f+1],U=o[f+2],(D&192)===128&&(U&192)===128&&(P=(h&15)<<12|(D&63)<<6|U&63,P>2047&&(P<55296||P>57343)&&(x=P));break;case 4:D=o[f+1],U=o[f+2],O=o[f+3],(D&192)===128&&(U&192)===128&&(O&192)===128&&(P=(h&15)<<18|(D&63)<<12|(U&63)<<6|O&63,P>65535&&P<1114112&&(x=P))}}x===null?(x=65533,N=1):x>65535&&(x-=65536,u.push(x>>>10&1023|55296),x=56320|x&1023),u.push(x),f+=N}return Vn(u)}let Et=4096;function Vn(o){let r=o.length;if(r<=Et)return String.fromCharCode.apply(String,o);let n="",u=0;for(;u<r;)n+=String.fromCharCode.apply(String,o.slice(u,u+=Et));return n}function qn(o,r,n){let u="";n=Math.min(o.length,n);for(let f=r;f<n;++f)u+=String.fromCharCode(o[f]&127);return u}function Wn(o,r,n){let u="";n=Math.min(o.length,n);for(let f=r;f<n;++f)u+=String.fromCharCode(o[f]);return u}function Gn(o,r,n){let u=o.length;(!r||r<0)&&(r=0),(!n||n<0||n>u)&&(n=u);let f="";for(let h=r;h<n;++h)f+=Qn[o[h]];return f}function zn(o,r,n){let u=o.slice(r,n),f="";for(let h=0;h<u.length-1;h+=2)f+=String.fromCharCode(u[h]+u[h+1]*256);return f}a.prototype.slice=function(r,n){let u=this.length;r=~~r,n=n===void 0?u:~~n,r<0?(r+=u,r<0&&(r=0)):r>u&&(r=u),n<0?(n+=u,n<0&&(n=0)):n>u&&(n=u),n<r&&(n=r);let f=this.subarray(r,n);return Object.setPrototypeOf(f,a.prototype),f};function j(o,r,n){if(o%1!==0||o<0)throw new RangeError("offset is not uint");if(o+r>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(r,n,u){r=r>>>0,n=n>>>0,u||j(r,n,this.length);let f=this[r],h=1,x=0;for(;++x<n&&(h*=256);)f+=this[r+x]*h;return f},a.prototype.readUintBE=a.prototype.readUIntBE=function(r,n,u){r=r>>>0,n=n>>>0,u||j(r,n,this.length);let f=this[r+--n],h=1;for(;n>0&&(h*=256);)f+=this[r+--n]*h;return f},a.prototype.readUint8=a.prototype.readUInt8=function(r,n){return r=r>>>0,n||j(r,1,this.length),this[r]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||j(r,2,this.length),this[r]|this[r+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||j(r,2,this.length),this[r]<<8|this[r+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||j(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||j(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},a.prototype.readBigUInt64LE=le(function(r){r=r>>>0,Te(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&ke(r,this.length-8);let f=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,h=this[++r]+this[++r]*2**8+this[++r]*2**16+u*2**24;return BigInt(f)+(BigInt(h)<<BigInt(32))}),a.prototype.readBigUInt64BE=le(function(r){r=r>>>0,Te(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&ke(r,this.length-8);let f=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+u;return(BigInt(f)<<BigInt(32))+BigInt(h)}),a.prototype.readIntLE=function(r,n,u){r=r>>>0,n=n>>>0,u||j(r,n,this.length);let f=this[r],h=1,x=0;for(;++x<n&&(h*=256);)f+=this[r+x]*h;return h*=128,f>=h&&(f-=Math.pow(2,8*n)),f},a.prototype.readIntBE=function(r,n,u){r=r>>>0,n=n>>>0,u||j(r,n,this.length);let f=n,h=1,x=this[r+--f];for(;f>0&&(h*=256);)x+=this[r+--f]*h;return h*=128,x>=h&&(x-=Math.pow(2,8*n)),x},a.prototype.readInt8=function(r,n){return r=r>>>0,n||j(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},a.prototype.readInt16LE=function(r,n){r=r>>>0,n||j(r,2,this.length);let u=this[r]|this[r+1]<<8;return u&32768?u|4294901760:u},a.prototype.readInt16BE=function(r,n){r=r>>>0,n||j(r,2,this.length);let u=this[r+1]|this[r]<<8;return u&32768?u|4294901760:u},a.prototype.readInt32LE=function(r,n){return r=r>>>0,n||j(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},a.prototype.readInt32BE=function(r,n){return r=r>>>0,n||j(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},a.prototype.readBigInt64LE=le(function(r){r=r>>>0,Te(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&ke(r,this.length-8);let f=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(u<<24);return(BigInt(f)<<BigInt(32))+BigInt(n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),a.prototype.readBigInt64BE=le(function(r){r=r>>>0,Te(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&ke(r,this.length-8);let f=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(f)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+u)}),a.prototype.readFloatLE=function(r,n){return r=r>>>0,n||j(r,4,this.length),t.read(this,r,!0,23,4)},a.prototype.readFloatBE=function(r,n){return r=r>>>0,n||j(r,4,this.length),t.read(this,r,!1,23,4)},a.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||j(r,8,this.length),t.read(this,r,!0,52,8)},a.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||j(r,8,this.length),t.read(this,r,!1,52,8)};function K(o,r,n,u,f,h){if(!a.isBuffer(o))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>f||r<h)throw new RangeError('"value" argument is out of bounds');if(n+u>o.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(r,n,u,f){if(r=+r,n=n>>>0,u=u>>>0,!f){let N=Math.pow(2,8*u)-1;K(this,r,n,u,N,0)}let h=1,x=0;for(this[n]=r&255;++x<u&&(h*=256);)this[n+x]=r/h&255;return n+u},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(r,n,u,f){if(r=+r,n=n>>>0,u=u>>>0,!f){let N=Math.pow(2,8*u)-1;K(this,r,n,u,N,0)}let h=u-1,x=1;for(this[n+h]=r&255;--h>=0&&(x*=256);)this[n+h]=r/x&255;return n+u},a.prototype.writeUint8=a.prototype.writeUInt8=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,1,255,0),this[n]=r&255,n+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(r,n,u){return r=+r,n=n>>>0,u||K(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},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(r,n,u){return r=+r,n=n>>>0,u||K(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 It(o,r,n,u,f){St(r,u,f,o,n,7);let h=Number(r&BigInt(4294967295));o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h;let x=Number(r>>BigInt(32)&BigInt(4294967295));return o[n++]=x,x=x>>8,o[n++]=x,x=x>>8,o[n++]=x,x=x>>8,o[n++]=x,n}function kt(o,r,n,u,f){St(r,u,f,o,n,7);let h=Number(r&BigInt(4294967295));o[n+7]=h,h=h>>8,o[n+6]=h,h=h>>8,o[n+5]=h,h=h>>8,o[n+4]=h;let x=Number(r>>BigInt(32)&BigInt(4294967295));return o[n+3]=x,x=x>>8,o[n+2]=x,x=x>>8,o[n+1]=x,x=x>>8,o[n]=x,n+8}a.prototype.writeBigUInt64LE=le(function(r,n=0){return It(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=le(function(r,n=0){return kt(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(r,n,u,f){if(r=+r,n=n>>>0,!f){let D=Math.pow(2,8*u-1);K(this,r,n,u,D-1,-D)}let h=0,x=1,N=0;for(this[n]=r&255;++h<u&&(x*=256);)r<0&&N===0&&this[n+h-1]!==0&&(N=1),this[n+h]=(r/x>>0)-N&255;return n+u},a.prototype.writeIntBE=function(r,n,u,f){if(r=+r,n=n>>>0,!f){let D=Math.pow(2,8*u-1);K(this,r,n,u,D-1,-D)}let h=u-1,x=1,N=0;for(this[n+h]=r&255;--h>=0&&(x*=256);)r<0&&N===0&&this[n+h+1]!==0&&(N=1),this[n+h]=(r/x>>0)-N&255;return n+u},a.prototype.writeInt8=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},a.prototype.writeInt16LE=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},a.prototype.writeInt16BE=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},a.prototype.writeInt32LE=function(r,n,u){return r=+r,n=n>>>0,u||K(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},a.prototype.writeInt32BE=function(r,n,u){return r=+r,n=n>>>0,u||K(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},a.prototype.writeBigInt64LE=le(function(r,n=0){return It(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=le(function(r,n=0){return kt(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Rt(o,r,n,u,f,h){if(n+u>o.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Nt(o,r,n,u,f){return r=+r,n=n>>>0,f||Rt(o,r,n,4),t.write(o,r,n,u,23,4),n+4}a.prototype.writeFloatLE=function(r,n,u){return Nt(this,r,n,!0,u)},a.prototype.writeFloatBE=function(r,n,u){return Nt(this,r,n,!1,u)};function Bt(o,r,n,u,f){return r=+r,n=n>>>0,f||Rt(o,r,n,8),t.write(o,r,n,u,52,8),n+8}a.prototype.writeDoubleLE=function(r,n,u){return Bt(this,r,n,!0,u)},a.prototype.writeDoubleBE=function(r,n,u){return Bt(this,r,n,!1,u)},a.prototype.copy=function(r,n,u,f){if(!a.isBuffer(r))throw new TypeError("argument should be a Buffer");if(u||(u=0),!f&&f!==0&&(f=this.length),n>=r.length&&(n=r.length),n||(n=0),f>0&&f<u&&(f=u),f===u||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(u<0||u>=this.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),r.length-n<f-u&&(f=r.length-n+u);let h=f-u;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,u,f):Uint8Array.prototype.set.call(r,this.subarray(u,f),n),h},a.prototype.fill=function(r,n,u,f){if(typeof r=="string"){if(typeof n=="string"?(f=n,n=0,u=this.length):typeof u=="string"&&(f=u,u=this.length),f!==void 0&&typeof f!="string")throw new TypeError("encoding must be a string");if(typeof f=="string"&&!a.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(r.length===1){let x=r.charCodeAt(0);(f==="utf8"&&x<128||f==="latin1")&&(r=x)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<u)throw new RangeError("Out of range index");if(u<=n)return this;n=n>>>0,u=u===void 0?this.length:u>>>0,r||(r=0);let h;if(typeof r=="number")for(h=n;h<u;++h)this[h]=r;else{let x=a.isBuffer(r)?r:a.from(r,f),N=x.length;if(N===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(h=0;h<u-n;++h)this[h+n]=x[h%N]}return this};let ve={};function lt(o,r,n){ve[o]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${o}]`,this.stack,delete this.name}get code(){return o}set code(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${o}]: ${this.message}`}}}lt("ERR_BUFFER_OUT_OF_BOUNDS",function(o){return o?`${o} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),lt("ERR_INVALID_ARG_TYPE",function(o,r){return`The "${o}" argument must be of type number. Received type ${typeof r}`},TypeError),lt("ERR_OUT_OF_RANGE",function(o,r,n){let u=`The value of "${o}" is out of range.`,f=n;return Number.isInteger(n)&&Math.abs(n)>2**32?f=Lt(String(n)):typeof n=="bigint"&&(f=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(f=Lt(f)),f+="n"),u+=` It must be ${r}. Received ${f}`,u},RangeError);function Lt(o){let r="",n=o.length,u=o[0]==="-"?1:0;for(;n>=u+4;n-=3)r=`_${o.slice(n-3,n)}${r}`;return`${o.slice(0,n)}${r}`}function Kn(o,r,n){Te(r,"offset"),(o[r]===void 0||o[r+n]===void 0)&&ke(r,o.length-(n+1))}function St(o,r,n,u,f,h){if(o>n||o<r){let x=typeof r=="bigint"?"n":"",N;throw r===0||r===BigInt(0)?N=`>= 0${x} and < 2${x} ** ${(h+1)*8}${x}`:N=`>= -(2${x} ** ${(h+1)*8-1}${x}) and < 2 ** ${(h+1)*8-1}${x}`,new ve.ERR_OUT_OF_RANGE("value",N,o)}Kn(u,f,h)}function Te(o,r){if(typeof o!="number")throw new ve.ERR_INVALID_ARG_TYPE(r,"number",o)}function ke(o,r,n){throw Math.floor(o)!==o?(Te(o,n),new ve.ERR_OUT_OF_RANGE("offset","an integer",o)):r<0?new ve.ERR_BUFFER_OUT_OF_BOUNDS:new ve.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${r}`,o)}let Hn=/[^+/0-9A-Za-z-_]/g;function Yn(o){if(o=o.split("=")[0],o=o.trim().replace(Hn,""),o.length<2)return"";for(;o.length%4!==0;)o=o+"=";return o}function pt(o,r){r=r||1/0;let n,u=o.length,f=null,h=[];for(let x=0;x<u;++x){if(n=o.charCodeAt(x),n>55295&&n<57344){if(!f){if(n>56319){(r-=3)>-1&&h.push(239,191,189);continue}else if(x+1===u){(r-=3)>-1&&h.push(239,191,189);continue}f=n;continue}if(n<56320){(r-=3)>-1&&h.push(239,191,189),f=n;continue}n=(f-55296<<10|n-56320)+65536}else f&&(r-=3)>-1&&h.push(239,191,189);if(f=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 Jn(o){let r=[];for(let n=0;n<o.length;++n)r.push(o.charCodeAt(n)&255);return r}function Xn(o,r){let n,u,f,h=[];for(let x=0;x<o.length&&!((r-=2)<0);++x)n=o.charCodeAt(x),u=n>>8,f=n%256,h.push(f),h.push(u);return h}function Ct(o){return l.toByteArray(Yn(o))}function We(o,r,n,u){let f;for(f=0;f<u&&!(f+n>=r.length||f>=o.length);++f)r[f+n]=o[f];return f}function Q(o,r){return o instanceof r||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===r.name}function ft(o){return o!==o}let Qn=(function(){let o="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){let u=n*16;for(let f=0;f<16;++f)r[u+f]=o[n]+o[f]}return r})();function le(o){return typeof BigInt>"u"?Zn:o}function Zn(){throw new Error("BigInt not supported")}return ce}var Re,Jr,Ye,Xr,ce,Qr,en=Ae(()=>{"use strict";c();m();d();Re={},Jr=!1;Ye={},Xr=!1;ce={},Qr=!1});var de,T,Vo,qo,tn=Ae(()=>{"use strict";c();m();d();en();de=Zr();de.Buffer;de.SlowBuffer;de.INSPECT_MAX_BYTES;de.kMaxLength;T=de.Buffer,Vo=de.INSPECT_MAX_BYTES,qo=de.kMaxLength});var m=Ae(()=>{"use strict";tn()});var Bo={};ct(Bo,{DynamicSnippetsGenerator:()=>ut});module.exports=oi(Bo);c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();var li=typeof global=="object"&&global&&global.Object===Object&&global,rn=li;var pi=typeof self=="object"&&self&&self.Object===Object&&self,fi=rn||pi||Function("return this")(),nn=fi;var ci=nn.Symbol,re=ci;c();m();d();var on=Object.prototype,di=on.hasOwnProperty,mi=on.toString,Ne=re?re.toStringTag:void 0;function hi(l){var t=di.call(l,Ne),e=l[Ne];try{l[Ne]=void 0;var i=!0}catch{}var s=mi.call(l);return i&&(t?l[Ne]=e:delete l[Ne]),s}var sn=hi;c();m();d();var yi=Object.prototype,gi=yi.toString;function xi(l){return gi.call(l)}var an=xi;var wi="[object Null]",bi="[object Undefined]",un=re?re.toStringTag:void 0;function vi(l){return l==null?l===void 0?bi:wi:un&&un in Object(l)?sn(l):an(l)}var ln=vi;c();m();d();function Ti(l){return l!=null&&typeof l=="object"}var pn=Ti;var Ai="[object Symbol]";function Ei(l){return typeof l=="symbol"||pn(l)&&ln(l)==Ai}var fn=Ei;c();m();d();c();m();d();function Ii(l,t){for(var e=-1,i=l==null?0:l.length,s=Array(i);++e<i;)s[e]=t(l[e],e,l);return s}var cn=Ii;c();m();d();var ki=Array.isArray,dn=ki;var Ri=1/0,mn=re?re.prototype:void 0,hn=mn?mn.toString:void 0;function yn(l){if(typeof l=="string")return l;if(dn(l))return cn(l,yn)+"";if(fn(l))return hn?hn.call(l):"";var t=l+"";return t=="0"&&1/l==-Ri?"-0":t}var gn=yn;c();m();d();function Ni(l){return l==null?"":gn(l)}var xn=Ni;c();m();d();c();m();d();c();m();d();c();m();d();function Bi(l,t,e){var i=-1,s=l.length;t<0&&(t=-t>s?0:s+t),e=e>s?s:e,e<0&&(e+=s),s=t>e?0:e-t>>>0,t>>>=0;for(var p=Array(s);++i<s;)p[i]=l[i+t];return p}var wn=Bi;function Li(l,t,e){var i=l.length;return e=e===void 0?i:e,!t&&e>=i?l:wn(l,t,e)}var bn=Li;c();m();d();var Si="\\ud800-\\udfff",Ci="\\u0300-\\u036f",Fi="\\ufe20-\\ufe2f",Pi="\\u20d0-\\u20ff",Ui=Ci+Fi+Pi,Mi="\\ufe0e\\ufe0f",Di="\\u200d",Oi=RegExp("["+Di+Si+Ui+Mi+"]");function $i(l){return Oi.test(l)}var Je=$i;c();m();d();c();m();d();function _i(l){return l.split("")}var vn=_i;c();m();d();var Tn="\\ud800-\\udfff",ji="\\u0300-\\u036f",Vi="\\ufe20-\\ufe2f",qi="\\u20d0-\\u20ff",Wi=ji+Vi+qi,Gi="\\ufe0e\\ufe0f",zi="["+Tn+"]",yt="["+Wi+"]",gt="\\ud83c[\\udffb-\\udfff]",Ki="(?:"+yt+"|"+gt+")",An="[^"+Tn+"]",En="(?:\\ud83c[\\udde6-\\uddff]){2}",In="[\\ud800-\\udbff][\\udc00-\\udfff]",Hi="\\u200d",kn=Ki+"?",Rn="["+Gi+"]?",Yi="(?:"+Hi+"(?:"+[An,En,In].join("|")+")"+Rn+kn+")*",Ji=Rn+kn+Yi,Xi="(?:"+[An+yt+"?",yt,En,In,zi].join("|")+")",Qi=RegExp(gt+"(?="+gt+")|"+Xi+Ji,"g");function Zi(l){return l.match(Qi)||[]}var Nn=Zi;function eo(l){return Je(l)?Nn(l):vn(l)}var Bn=eo;function to(l){return function(t){t=xn(t);var e=Je(t)?Bn(t):void 0,i=e?e[0]:t.charAt(0),s=e?bn(e,1).join(""):t.slice(1);return i[l]()+s}}var Ln=to;var ro=Ln("toUpperCase"),xt=ro;c();m();d();function L(l){throw new Error("Unexpected value: "+JSON.stringify(l))}c();m();d();function Be(l){return Object.keys(l)}c();m();d();c();m();d();c();m();d();var Le=v.env.FERN_STACK_TRACK?.toLowerCase()??"",Z=Le!==""&&Le!=="0"&&Le!=="false",wt=["single","multiline","box"].includes(Le)?Le:"single";Z&&(Error.stackTraceLimit=50);var no=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),io=new Set(["stacktrace"]);function Qe({maxFrames:l=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:s=[],filterNode:p=!0,filterJs:a=!0,formatFilename:w=b=>b}={}){if(!Z)return[];i=[...i,...no],e=[...e,...io],s=[...s,"runInteractiveTask"];let b=!1;return(new Error().stack??"").split(`
1
+ "use strict";var Ge=Object.defineProperty;var ei=Object.getOwnPropertyDescriptor;var ti=Object.getOwnPropertyNames;var ri=Object.prototype.hasOwnProperty;var ni=(l,t,e)=>t in l?Ge(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var Ae=(l,t)=>()=>(l&&(t=l(l=0)),t);var ct=(l,t)=>{for(var e in t)Ge(l,e,{get:t[e],enumerable:!0})},ii=(l,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ti(t))!ri.call(l,s)&&s!==e&&Ge(l,s,{get:()=>t[s],enumerable:!(i=ei(t,s))||i.enumerable});return l};var oi=l=>ii(Ge({},"__esModule",{value:!0}),l);var y=(l,t,e)=>ni(l,typeof t!="symbol"?t+"":t,e);var c=Ae(()=>{"use strict"});var v={};ct(v,{_debugEnd:()=>vr,_debugProcess:()=>br,_events:()=>Dr,_eventsCount:()=>Or,_exiting:()=>tr,_fatalExceptions:()=>yr,_getActiveHandles:()=>or,_getActiveRequests:()=>ir,_kill:()=>ar,_linkedBinding:()=>Zt,_maxListeners:()=>Mr,_preload_modules:()=>Fr,_rawDebug:()=>Xt,_startProfilerIdleNotifier:()=>Tr,_stopProfilerIdleNotifier:()=>Ar,_tickCallback:()=>wr,abort:()=>Rr,addListener:()=>$r,allowedNodeEnvironmentFlags:()=>dr,arch:()=>Dt,argv:()=>_t,argv0:()=>Cr,assert:()=>mr,binding:()=>Gt,browser:()=>Jt,chdir:()=>Ht,config:()=>rr,cpuUsage:()=>He,cwd:()=>Kt,debugPort:()=>Sr,default:()=>Hr,dlopen:()=>nr,domain:()=>er,emit:()=>qr,emitWarning:()=>qt,env:()=>$t,execArgv:()=>jt,execPath:()=>Lr,exit:()=>fr,features:()=>hr,hasUncaughtExceptionCaptureCallback:()=>xr,hrtime:()=>Ke,kill:()=>pr,listeners:()=>Kr,memoryUsage:()=>lr,moduleLoadList:()=>Qt,nextTick:()=>Pt,off:()=>jr,on:()=>te,once:()=>_r,openStdin:()=>cr,pid:()=>Nr,platform:()=>Ot,ppid:()=>Br,prependListener:()=>Gr,prependOnceListener:()=>zr,reallyExit:()=>sr,release:()=>Yt,removeAllListeners:()=>Wr,removeListener:()=>Vr,resourceUsage:()=>ur,setSourceMapsEnabled:()=>Pr,setUncaughtExceptionCaptureCallback:()=>gr,stderr:()=>Ir,stdin:()=>kr,stdout:()=>Er,title:()=>Mt,umask:()=>zt,uptime:()=>Ur,version:()=>Vt,versions:()=>Wt});function ht(l){throw new Error("Node.js process "+l+" is not supported by JSPM core outside of Node.js")}function si(){!Ee||!fe||(Ee=!1,fe.length?ee=fe.concat(ee):ze=-1,ee.length&&Ft())}function Ft(){if(!Ee){var l=setTimeout(si,0);Ee=!0;for(var t=ee.length;t;){for(fe=ee,ee=[];++ze<t;)fe&&fe[ze].run();ze=-1,t=ee.length}fe=null,Ee=!1,clearTimeout(l)}}function Pt(l){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];ee.push(new Ut(l,t)),ee.length===1&&!Ee&&setTimeout(Ft,0)}function Ut(l,t){this.fun=l,this.array=t}function V(){}function Zt(l){ht("_linkedBinding")}function nr(l){ht("dlopen")}function ir(){return[]}function or(){return[]}function mr(l,t){if(!l)throw new Error(t||"assertion error")}function xr(){return!1}function Ur(){return pe.now()/1e3}function Ke(l){var t=Math.floor((Date.now()-pe.now())*.001),e=pe.now()*.001,i=Math.floor(e)+t,s=Math.floor(e%1*1e9);return l&&(i=i-l[0],s=s-l[1],s<0&&(i--,s+=mt)),[i,s]}function te(){return Hr}function Kr(l){return[]}var ee,Ee,fe,ze,Mt,Dt,Ot,$t,_t,jt,Vt,Wt,qt,Gt,zt,Kt,Ht,Yt,Jt,Xt,Qt,er,tr,rr,sr,ar,He,ur,lr,pr,fr,cr,dr,hr,yr,gr,wr,br,vr,Tr,Ar,Er,Ir,kr,Rr,Nr,Br,Lr,Sr,Cr,Fr,Pr,pe,dt,mt,Mr,Dr,Or,$r,_r,jr,Vr,Wr,qr,Gr,zr,Hr,Yr=Ae(()=>{"use strict";c();m();d();ee=[],Ee=!1,ze=-1;Ut.prototype.run=function(){this.fun.apply(null,this.array)};Mt="browser",Dt="x64",Ot="browser",$t={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},_t=["/usr/bin/node"],jt=[],Vt="v16.8.0",Wt={},qt=function(l,t){console.warn((t?t+": ":"")+l)},Gt=function(l){ht("binding")},zt=function(l){return 0},Kt=function(){return"/"},Ht=function(l){},Yt={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Jt=!0,Xt=V,Qt=[];er={},tr=!1,rr={};sr=V,ar=V,He=function(){return{}},ur=He,lr=He,pr=V,fr=V,cr=V,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=V,gr=V;wr=V,br=V,vr=V,Tr=V,Ar=V,Er=void 0,Ir=void 0,kr=void 0,Rr=V,Nr=2,Br=1,Lr="/bin/usr/node",Sr=9229,Cr="node",Fr=[],Pr=V,pe={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};pe.now===void 0&&(dt=Date.now(),pe.timing&&pe.timing.navigationStart&&(dt=pe.timing.navigationStart),pe.now=()=>Date.now()-dt);mt=1e9;Ke.bigint=function(l){var t=Ke(l);return typeof BigInt>"u"?t[0]*mt+t[1]:BigInt(t[0]*mt)+BigInt(t[1])};Mr=10,Dr={},Or=0;$r=te,_r=te,jr=te,Vr=te,Wr=te,qr=V,Gr=te,zr=te;Hr={version:Vt,versions:Wt,arch:Dt,platform:Ot,browser:Jt,release:Yt,_rawDebug:Xt,moduleLoadList:Qt,binding:Gt,_linkedBinding:Zt,_events:Dr,_eventsCount:Or,_maxListeners:Mr,on:te,addListener:$r,once:_r,off:jr,removeListener:Vr,removeAllListeners:Wr,emit:qr,prependListener:Gr,prependOnceListener:zr,listeners:Kr,domain:er,_exiting:tr,config:rr,dlopen:nr,uptime:Ur,_getActiveRequests:ir,_getActiveHandles:or,reallyExit:sr,_kill:ar,cpuUsage:He,resourceUsage:ur,memoryUsage:lr,kill:pr,exit:fr,openStdin:cr,allowedNodeEnvironmentFlags:dr,assert:mr,features:hr,_fatalExceptions:yr,setUncaughtExceptionCaptureCallback:gr,hasUncaughtExceptionCaptureCallback:xr,emitWarning:qt,nextTick:Pt,_tickCallback:wr,_debugProcess:br,_debugEnd:vr,_startProfilerIdleNotifier:Tr,_stopProfilerIdleNotifier:Ar,stdout:Er,stdin:kr,stderr:Ir,abort:Rr,umask:zt,chdir:Ht,cwd:Kt,env:$t,title:Mt,argv:_t,execArgv:jt,pid:Nr,ppid:Br,execPath:Lr,debugPort:Sr,hrtime:Ke,argv0:Cr,_preload_modules:Fr,setSourceMapsEnabled:Pr}});var d=Ae(()=>{"use strict";Yr()});function ai(){if(Jr)return Re;Jr=!0,Re.byteLength=w,Re.toByteArray=R,Re.fromByteArray=M;for(var l=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,p=i.length;s<p;++s)l[s]=i[s],t[i.charCodeAt(s)]=s;t[45]=62,t[95]=63;function a(E){var k=E.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=E.indexOf("=");F===-1&&(F=k);var _=F===k?0:4-F%4;return[F,_]}function w(E){var k=a(E),F=k[0],_=k[1];return(F+_)*3/4-_}function b(E,k,F){return(k+F)*3/4-F}function R(E){var k,F=a(E),_=F[0],G=F[1],$=new e(b(E,_,G)),z=0,H=G>0?_-4:_,W;for(W=0;W<H;W+=4)k=t[E.charCodeAt(W)]<<18|t[E.charCodeAt(W+1)]<<12|t[E.charCodeAt(W+2)]<<6|t[E.charCodeAt(W+3)],$[z++]=k>>16&255,$[z++]=k>>8&255,$[z++]=k&255;return G===2&&(k=t[E.charCodeAt(W)]<<2|t[E.charCodeAt(W+1)]>>4,$[z++]=k&255),G===1&&(k=t[E.charCodeAt(W)]<<10|t[E.charCodeAt(W+1)]<<4|t[E.charCodeAt(W+2)]>>2,$[z++]=k>>8&255,$[z++]=k&255),$}function I(E){return l[E>>18&63]+l[E>>12&63]+l[E>>6&63]+l[E&63]}function C(E,k,F){for(var _,G=[],$=k;$<F;$+=3)_=(E[$]<<16&16711680)+(E[$+1]<<8&65280)+(E[$+2]&255),G.push(I(_));return G.join("")}function M(E){for(var k,F=E.length,_=F%3,G=[],$=16383,z=0,H=F-_;z<H;z+=$)G.push(C(E,z,z+$>H?H:z+$));return _===1?(k=E[F-1],G.push(l[k>>2]+l[k<<4&63]+"==")):_===2&&(k=(E[F-2]<<8)+E[F-1],G.push(l[k>>10]+l[k>>4&63]+l[k<<2&63]+"=")),G.join("")}return Re}function ui(){if(Xr)return Ye;Xr=!0;return Ye.read=function(l,t,e,i,s){var p,a,w=s*8-i-1,b=(1<<w)-1,R=b>>1,I=-7,C=e?s-1:0,M=e?-1:1,E=l[t+C];for(C+=M,p=E&(1<<-I)-1,E>>=-I,I+=w;I>0;p=p*256+l[t+C],C+=M,I-=8);for(a=p&(1<<-I)-1,p>>=-I,I+=i;I>0;a=a*256+l[t+C],C+=M,I-=8);if(p===0)p=1-R;else{if(p===b)return a?NaN:(E?-1:1)*(1/0);a=a+Math.pow(2,i),p=p-R}return(E?-1:1)*a*Math.pow(2,p-i)},Ye.write=function(l,t,e,i,s,p){var a,w,b,R=p*8-s-1,I=(1<<R)-1,C=I>>1,M=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:p-1,k=i?1:-1,F=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(w=isNaN(t)?1:0,a=I):(a=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-a))<1&&(a--,b*=2),a+C>=1?t+=M/b:t+=M*Math.pow(2,1-C),t*b>=2&&(a++,b/=2),a+C>=I?(w=0,a=I):a+C>=1?(w=(t*b-1)*Math.pow(2,s),a=a+C):(w=t*Math.pow(2,C-1)*Math.pow(2,s),a=0));s>=8;l[e+E]=w&255,E+=k,w/=256,s-=8);for(a=a<<s|w,R+=s;R>0;l[e+E]=a&255,E+=k,a/=256,R-=8);l[e+E-k]|=F*128},Ye}function Zr(){if(Qr)return ce;Qr=!0;let l=ai(),t=ui(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ce.Buffer=a,ce.SlowBuffer=G,ce.INSPECT_MAX_BYTES=50;let i=2147483647;ce.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.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 s(){try{let o=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(o,r),o.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function p(o){if(o>i)throw new RangeError('The value "'+o+'" is invalid for option "size"');let r=new Uint8Array(o);return Object.setPrototypeOf(r,a.prototype),r}function a(o,r,n){if(typeof o=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return I(o)}return w(o,r,n)}a.poolSize=8192;function w(o,r,n){if(typeof o=="string")return C(o,r);if(ArrayBuffer.isView(o))return E(o);if(o==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o);if(Q(o,ArrayBuffer)||o&&Q(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Q(o,SharedArrayBuffer)||o&&Q(o.buffer,SharedArrayBuffer)))return k(o,r,n);if(typeof o=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let u=o.valueOf&&o.valueOf();if(u!=null&&u!==o)return a.from(u,r,n);let f=F(o);if(f)return f;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]=="function")return a.from(o[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 o)}a.from=function(o,r,n){return w(o,r,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function b(o){if(typeof o!="number")throw new TypeError('"size" argument must be of type number');if(o<0)throw new RangeError('The value "'+o+'" is invalid for option "size"')}function R(o,r,n){return b(o),o<=0?p(o):r!==void 0?typeof n=="string"?p(o).fill(r,n):p(o).fill(r):p(o)}a.alloc=function(o,r,n){return R(o,r,n)};function I(o){return b(o),p(o<0?0:_(o)|0)}a.allocUnsafe=function(o){return I(o)},a.allocUnsafeSlow=function(o){return I(o)};function C(o,r){if((typeof r!="string"||r==="")&&(r="utf8"),!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let n=$(o,r)|0,u=p(n),f=u.write(o,r);return f!==n&&(u=u.slice(0,f)),u}function M(o){let r=o.length<0?0:_(o.length)|0,n=p(r);for(let u=0;u<r;u+=1)n[u]=o[u]&255;return n}function E(o){if(Q(o,Uint8Array)){let r=new Uint8Array(o);return k(r.buffer,r.byteOffset,r.byteLength)}return M(o)}function k(o,r,n){if(r<0||o.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(o.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let u;return r===void 0&&n===void 0?u=new Uint8Array(o):n===void 0?u=new Uint8Array(o,r):u=new Uint8Array(o,r,n),Object.setPrototypeOf(u,a.prototype),u}function F(o){if(a.isBuffer(o)){let r=_(o.length)|0,n=p(r);return n.length===0||o.copy(n,0,0,r),n}if(o.length!==void 0)return typeof o.length!="number"||ft(o.length)?p(0):M(o);if(o.type==="Buffer"&&Array.isArray(o.data))return M(o.data)}function _(o){if(o>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return o|0}function G(o){return+o!=o&&(o=0),a.alloc(+o)}a.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==a.prototype},a.compare=function(r,n){if(Q(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),Q(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(r)||!a.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let u=r.length,f=n.length;for(let h=0,x=Math.min(u,f);h<x;++h)if(r[h]!==n[h]){u=r[h],f=n[h];break}return u<f?-1:f<u?1:0},a.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}},a.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);let u;if(n===void 0)for(n=0,u=0;u<r.length;++u)n+=r[u].length;let f=a.allocUnsafe(n),h=0;for(u=0;u<r.length;++u){let x=r[u];if(Q(x,Uint8Array))h+x.length>f.length?(a.isBuffer(x)||(x=a.from(x)),x.copy(f,h)):Uint8Array.prototype.set.call(f,x,h);else if(a.isBuffer(x))x.copy(f,h);else throw new TypeError('"list" argument must be an Array of Buffers');h+=x.length}return f};function $(o,r){if(a.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||Q(o,ArrayBuffer))return o.byteLength;if(typeof o!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof o);let n=o.length,u=arguments.length>2&&arguments[2]===!0;if(!u&&n===0)return 0;let f=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return pt(o).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Ct(o).length;default:if(f)return u?-1:pt(o).length;r=(""+r).toLowerCase(),f=!0}}a.byteLength=$;function z(o,r,n){let u=!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(o||(o="utf8");;)switch(o){case"hex":return Gn(this,r,n);case"utf8":case"utf-8":return At(this,r,n);case"ascii":return Wn(this,r,n);case"latin1":case"binary":return qn(this,r,n);case"base64":return jn(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zn(this,r,n);default:if(u)throw new TypeError("Unknown encoding: "+o);o=(o+"").toLowerCase(),u=!0}}a.prototype._isBuffer=!0;function H(o,r,n){let u=o[r];o[r]=o[n],o[n]=u}a.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},a.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},a.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},a.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?At(this,0,r):z.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(r){if(!a.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0},a.prototype.inspect=function(){let r="",n=ce.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},e&&(a.prototype[e]=a.prototype.inspect),a.prototype.compare=function(r,n,u,f,h){if(Q(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),!a.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),u===void 0&&(u=r?r.length:0),f===void 0&&(f=0),h===void 0&&(h=this.length),n<0||u>r.length||f<0||h>this.length)throw new RangeError("out of range index");if(f>=h&&n>=u)return 0;if(f>=h)return-1;if(n>=u)return 1;if(n>>>=0,u>>>=0,f>>>=0,h>>>=0,this===r)return 0;let x=h-f,N=u-n,D=Math.min(x,N),U=this.slice(f,h),O=r.slice(n,u);for(let P=0;P<D;++P)if(U[P]!==O[P]){x=U[P],N=O[P];break}return x<N?-1:N<x?1:0};function W(o,r,n,u,f){if(o.length===0)return-1;if(typeof n=="string"?(u=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ft(n)&&(n=f?0:o.length-1),n<0&&(n=o.length+n),n>=o.length){if(f)return-1;n=o.length-1}else if(n<0)if(f)n=0;else return-1;if(typeof r=="string"&&(r=a.from(r,u)),a.isBuffer(r))return r.length===0?-1:Tt(o,r,n,u,f);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(o,r,n):Uint8Array.prototype.lastIndexOf.call(o,r,n):Tt(o,[r],n,u,f);throw new TypeError("val must be string, number or Buffer")}function Tt(o,r,n,u,f){let h=1,x=o.length,N=r.length;if(u!==void 0&&(u=String(u).toLowerCase(),u==="ucs2"||u==="ucs-2"||u==="utf16le"||u==="utf-16le")){if(o.length<2||r.length<2)return-1;h=2,x/=2,N/=2,n/=2}function D(O,P){return h===1?O[P]:O.readUInt16BE(P*h)}let U;if(f){let O=-1;for(U=n;U<x;U++)if(D(o,U)===D(r,O===-1?0:U-O)){if(O===-1&&(O=U),U-O+1===N)return O*h}else O!==-1&&(U-=U-O),O=-1}else for(n+N>x&&(n=x-N),U=n;U>=0;U--){let O=!0;for(let P=0;P<N;P++)if(D(o,U+P)!==D(r,P)){O=!1;break}if(O)return U}return-1}a.prototype.includes=function(r,n,u){return this.indexOf(r,n,u)!==-1},a.prototype.indexOf=function(r,n,u){return W(this,r,n,u,!0)},a.prototype.lastIndexOf=function(r,n,u){return W(this,r,n,u,!1)};function Mn(o,r,n,u){n=Number(n)||0;let f=o.length-n;u?(u=Number(u),u>f&&(u=f)):u=f;let h=r.length;u>h/2&&(u=h/2);let x;for(x=0;x<u;++x){let N=parseInt(r.substr(x*2,2),16);if(ft(N))return x;o[n+x]=N}return x}function Dn(o,r,n,u){return qe(pt(r,o.length-n),o,n,u)}function On(o,r,n,u){return qe(Jn(r),o,n,u)}function $n(o,r,n,u){return qe(Ct(r),o,n,u)}function _n(o,r,n,u){return qe(Xn(r,o.length-n),o,n,u)}a.prototype.write=function(r,n,u,f){if(n===void 0)f="utf8",u=this.length,n=0;else if(u===void 0&&typeof n=="string")f=n,u=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(u)?(u=u>>>0,f===void 0&&(f="utf8")):(f=u,u=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-n;if((u===void 0||u>h)&&(u=h),r.length>0&&(u<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");let x=!1;for(;;)switch(f){case"hex":return Mn(this,r,n,u);case"utf8":case"utf-8":return Dn(this,r,n,u);case"ascii":case"latin1":case"binary":return On(this,r,n,u);case"base64":return $n(this,r,n,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _n(this,r,n,u);default:if(x)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),x=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function jn(o,r,n){return r===0&&n===o.length?l.fromByteArray(o):l.fromByteArray(o.slice(r,n))}function At(o,r,n){n=Math.min(o.length,n);let u=[],f=r;for(;f<n;){let h=o[f],x=null,N=h>239?4:h>223?3:h>191?2:1;if(f+N<=n){let D,U,O,P;switch(N){case 1:h<128&&(x=h);break;case 2:D=o[f+1],(D&192)===128&&(P=(h&31)<<6|D&63,P>127&&(x=P));break;case 3:D=o[f+1],U=o[f+2],(D&192)===128&&(U&192)===128&&(P=(h&15)<<12|(D&63)<<6|U&63,P>2047&&(P<55296||P>57343)&&(x=P));break;case 4:D=o[f+1],U=o[f+2],O=o[f+3],(D&192)===128&&(U&192)===128&&(O&192)===128&&(P=(h&15)<<18|(D&63)<<12|(U&63)<<6|O&63,P>65535&&P<1114112&&(x=P))}}x===null?(x=65533,N=1):x>65535&&(x-=65536,u.push(x>>>10&1023|55296),x=56320|x&1023),u.push(x),f+=N}return Vn(u)}let Et=4096;function Vn(o){let r=o.length;if(r<=Et)return String.fromCharCode.apply(String,o);let n="",u=0;for(;u<r;)n+=String.fromCharCode.apply(String,o.slice(u,u+=Et));return n}function Wn(o,r,n){let u="";n=Math.min(o.length,n);for(let f=r;f<n;++f)u+=String.fromCharCode(o[f]&127);return u}function qn(o,r,n){let u="";n=Math.min(o.length,n);for(let f=r;f<n;++f)u+=String.fromCharCode(o[f]);return u}function Gn(o,r,n){let u=o.length;(!r||r<0)&&(r=0),(!n||n<0||n>u)&&(n=u);let f="";for(let h=r;h<n;++h)f+=Qn[o[h]];return f}function zn(o,r,n){let u=o.slice(r,n),f="";for(let h=0;h<u.length-1;h+=2)f+=String.fromCharCode(u[h]+u[h+1]*256);return f}a.prototype.slice=function(r,n){let u=this.length;r=~~r,n=n===void 0?u:~~n,r<0?(r+=u,r<0&&(r=0)):r>u&&(r=u),n<0?(n+=u,n<0&&(n=0)):n>u&&(n=u),n<r&&(n=r);let f=this.subarray(r,n);return Object.setPrototypeOf(f,a.prototype),f};function j(o,r,n){if(o%1!==0||o<0)throw new RangeError("offset is not uint");if(o+r>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(r,n,u){r=r>>>0,n=n>>>0,u||j(r,n,this.length);let f=this[r],h=1,x=0;for(;++x<n&&(h*=256);)f+=this[r+x]*h;return f},a.prototype.readUintBE=a.prototype.readUIntBE=function(r,n,u){r=r>>>0,n=n>>>0,u||j(r,n,this.length);let f=this[r+--n],h=1;for(;n>0&&(h*=256);)f+=this[r+--n]*h;return f},a.prototype.readUint8=a.prototype.readUInt8=function(r,n){return r=r>>>0,n||j(r,1,this.length),this[r]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||j(r,2,this.length),this[r]|this[r+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||j(r,2,this.length),this[r]<<8|this[r+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||j(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||j(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},a.prototype.readBigUInt64LE=le(function(r){r=r>>>0,Te(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&ke(r,this.length-8);let f=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,h=this[++r]+this[++r]*2**8+this[++r]*2**16+u*2**24;return BigInt(f)+(BigInt(h)<<BigInt(32))}),a.prototype.readBigUInt64BE=le(function(r){r=r>>>0,Te(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&ke(r,this.length-8);let f=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+u;return(BigInt(f)<<BigInt(32))+BigInt(h)}),a.prototype.readIntLE=function(r,n,u){r=r>>>0,n=n>>>0,u||j(r,n,this.length);let f=this[r],h=1,x=0;for(;++x<n&&(h*=256);)f+=this[r+x]*h;return h*=128,f>=h&&(f-=Math.pow(2,8*n)),f},a.prototype.readIntBE=function(r,n,u){r=r>>>0,n=n>>>0,u||j(r,n,this.length);let f=n,h=1,x=this[r+--f];for(;f>0&&(h*=256);)x+=this[r+--f]*h;return h*=128,x>=h&&(x-=Math.pow(2,8*n)),x},a.prototype.readInt8=function(r,n){return r=r>>>0,n||j(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},a.prototype.readInt16LE=function(r,n){r=r>>>0,n||j(r,2,this.length);let u=this[r]|this[r+1]<<8;return u&32768?u|4294901760:u},a.prototype.readInt16BE=function(r,n){r=r>>>0,n||j(r,2,this.length);let u=this[r+1]|this[r]<<8;return u&32768?u|4294901760:u},a.prototype.readInt32LE=function(r,n){return r=r>>>0,n||j(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},a.prototype.readInt32BE=function(r,n){return r=r>>>0,n||j(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},a.prototype.readBigInt64LE=le(function(r){r=r>>>0,Te(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&ke(r,this.length-8);let f=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(u<<24);return(BigInt(f)<<BigInt(32))+BigInt(n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),a.prototype.readBigInt64BE=le(function(r){r=r>>>0,Te(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&ke(r,this.length-8);let f=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(f)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+u)}),a.prototype.readFloatLE=function(r,n){return r=r>>>0,n||j(r,4,this.length),t.read(this,r,!0,23,4)},a.prototype.readFloatBE=function(r,n){return r=r>>>0,n||j(r,4,this.length),t.read(this,r,!1,23,4)},a.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||j(r,8,this.length),t.read(this,r,!0,52,8)},a.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||j(r,8,this.length),t.read(this,r,!1,52,8)};function K(o,r,n,u,f,h){if(!a.isBuffer(o))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>f||r<h)throw new RangeError('"value" argument is out of bounds');if(n+u>o.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(r,n,u,f){if(r=+r,n=n>>>0,u=u>>>0,!f){let N=Math.pow(2,8*u)-1;K(this,r,n,u,N,0)}let h=1,x=0;for(this[n]=r&255;++x<u&&(h*=256);)this[n+x]=r/h&255;return n+u},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(r,n,u,f){if(r=+r,n=n>>>0,u=u>>>0,!f){let N=Math.pow(2,8*u)-1;K(this,r,n,u,N,0)}let h=u-1,x=1;for(this[n+h]=r&255;--h>=0&&(x*=256);)this[n+h]=r/x&255;return n+u},a.prototype.writeUint8=a.prototype.writeUInt8=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,1,255,0),this[n]=r&255,n+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(r,n,u){return r=+r,n=n>>>0,u||K(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},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(r,n,u){return r=+r,n=n>>>0,u||K(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 It(o,r,n,u,f){St(r,u,f,o,n,7);let h=Number(r&BigInt(4294967295));o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h;let x=Number(r>>BigInt(32)&BigInt(4294967295));return o[n++]=x,x=x>>8,o[n++]=x,x=x>>8,o[n++]=x,x=x>>8,o[n++]=x,n}function kt(o,r,n,u,f){St(r,u,f,o,n,7);let h=Number(r&BigInt(4294967295));o[n+7]=h,h=h>>8,o[n+6]=h,h=h>>8,o[n+5]=h,h=h>>8,o[n+4]=h;let x=Number(r>>BigInt(32)&BigInt(4294967295));return o[n+3]=x,x=x>>8,o[n+2]=x,x=x>>8,o[n+1]=x,x=x>>8,o[n]=x,n+8}a.prototype.writeBigUInt64LE=le(function(r,n=0){return It(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=le(function(r,n=0){return kt(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(r,n,u,f){if(r=+r,n=n>>>0,!f){let D=Math.pow(2,8*u-1);K(this,r,n,u,D-1,-D)}let h=0,x=1,N=0;for(this[n]=r&255;++h<u&&(x*=256);)r<0&&N===0&&this[n+h-1]!==0&&(N=1),this[n+h]=(r/x>>0)-N&255;return n+u},a.prototype.writeIntBE=function(r,n,u,f){if(r=+r,n=n>>>0,!f){let D=Math.pow(2,8*u-1);K(this,r,n,u,D-1,-D)}let h=u-1,x=1,N=0;for(this[n+h]=r&255;--h>=0&&(x*=256);)r<0&&N===0&&this[n+h+1]!==0&&(N=1),this[n+h]=(r/x>>0)-N&255;return n+u},a.prototype.writeInt8=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},a.prototype.writeInt16LE=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},a.prototype.writeInt16BE=function(r,n,u){return r=+r,n=n>>>0,u||K(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},a.prototype.writeInt32LE=function(r,n,u){return r=+r,n=n>>>0,u||K(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},a.prototype.writeInt32BE=function(r,n,u){return r=+r,n=n>>>0,u||K(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},a.prototype.writeBigInt64LE=le(function(r,n=0){return It(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=le(function(r,n=0){return kt(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Rt(o,r,n,u,f,h){if(n+u>o.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Nt(o,r,n,u,f){return r=+r,n=n>>>0,f||Rt(o,r,n,4),t.write(o,r,n,u,23,4),n+4}a.prototype.writeFloatLE=function(r,n,u){return Nt(this,r,n,!0,u)},a.prototype.writeFloatBE=function(r,n,u){return Nt(this,r,n,!1,u)};function Bt(o,r,n,u,f){return r=+r,n=n>>>0,f||Rt(o,r,n,8),t.write(o,r,n,u,52,8),n+8}a.prototype.writeDoubleLE=function(r,n,u){return Bt(this,r,n,!0,u)},a.prototype.writeDoubleBE=function(r,n,u){return Bt(this,r,n,!1,u)},a.prototype.copy=function(r,n,u,f){if(!a.isBuffer(r))throw new TypeError("argument should be a Buffer");if(u||(u=0),!f&&f!==0&&(f=this.length),n>=r.length&&(n=r.length),n||(n=0),f>0&&f<u&&(f=u),f===u||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(u<0||u>=this.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),r.length-n<f-u&&(f=r.length-n+u);let h=f-u;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,u,f):Uint8Array.prototype.set.call(r,this.subarray(u,f),n),h},a.prototype.fill=function(r,n,u,f){if(typeof r=="string"){if(typeof n=="string"?(f=n,n=0,u=this.length):typeof u=="string"&&(f=u,u=this.length),f!==void 0&&typeof f!="string")throw new TypeError("encoding must be a string");if(typeof f=="string"&&!a.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(r.length===1){let x=r.charCodeAt(0);(f==="utf8"&&x<128||f==="latin1")&&(r=x)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<u)throw new RangeError("Out of range index");if(u<=n)return this;n=n>>>0,u=u===void 0?this.length:u>>>0,r||(r=0);let h;if(typeof r=="number")for(h=n;h<u;++h)this[h]=r;else{let x=a.isBuffer(r)?r:a.from(r,f),N=x.length;if(N===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(h=0;h<u-n;++h)this[h+n]=x[h%N]}return this};let ve={};function lt(o,r,n){ve[o]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${o}]`,this.stack,delete this.name}get code(){return o}set code(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${o}]: ${this.message}`}}}lt("ERR_BUFFER_OUT_OF_BOUNDS",function(o){return o?`${o} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),lt("ERR_INVALID_ARG_TYPE",function(o,r){return`The "${o}" argument must be of type number. Received type ${typeof r}`},TypeError),lt("ERR_OUT_OF_RANGE",function(o,r,n){let u=`The value of "${o}" is out of range.`,f=n;return Number.isInteger(n)&&Math.abs(n)>2**32?f=Lt(String(n)):typeof n=="bigint"&&(f=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(f=Lt(f)),f+="n"),u+=` It must be ${r}. Received ${f}`,u},RangeError);function Lt(o){let r="",n=o.length,u=o[0]==="-"?1:0;for(;n>=u+4;n-=3)r=`_${o.slice(n-3,n)}${r}`;return`${o.slice(0,n)}${r}`}function Kn(o,r,n){Te(r,"offset"),(o[r]===void 0||o[r+n]===void 0)&&ke(r,o.length-(n+1))}function St(o,r,n,u,f,h){if(o>n||o<r){let x=typeof r=="bigint"?"n":"",N;throw r===0||r===BigInt(0)?N=`>= 0${x} and < 2${x} ** ${(h+1)*8}${x}`:N=`>= -(2${x} ** ${(h+1)*8-1}${x}) and < 2 ** ${(h+1)*8-1}${x}`,new ve.ERR_OUT_OF_RANGE("value",N,o)}Kn(u,f,h)}function Te(o,r){if(typeof o!="number")throw new ve.ERR_INVALID_ARG_TYPE(r,"number",o)}function ke(o,r,n){throw Math.floor(o)!==o?(Te(o,n),new ve.ERR_OUT_OF_RANGE("offset","an integer",o)):r<0?new ve.ERR_BUFFER_OUT_OF_BOUNDS:new ve.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${r}`,o)}let Hn=/[^+/0-9A-Za-z-_]/g;function Yn(o){if(o=o.split("=")[0],o=o.trim().replace(Hn,""),o.length<2)return"";for(;o.length%4!==0;)o=o+"=";return o}function pt(o,r){r=r||1/0;let n,u=o.length,f=null,h=[];for(let x=0;x<u;++x){if(n=o.charCodeAt(x),n>55295&&n<57344){if(!f){if(n>56319){(r-=3)>-1&&h.push(239,191,189);continue}else if(x+1===u){(r-=3)>-1&&h.push(239,191,189);continue}f=n;continue}if(n<56320){(r-=3)>-1&&h.push(239,191,189),f=n;continue}n=(f-55296<<10|n-56320)+65536}else f&&(r-=3)>-1&&h.push(239,191,189);if(f=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 Jn(o){let r=[];for(let n=0;n<o.length;++n)r.push(o.charCodeAt(n)&255);return r}function Xn(o,r){let n,u,f,h=[];for(let x=0;x<o.length&&!((r-=2)<0);++x)n=o.charCodeAt(x),u=n>>8,f=n%256,h.push(f),h.push(u);return h}function Ct(o){return l.toByteArray(Yn(o))}function qe(o,r,n,u){let f;for(f=0;f<u&&!(f+n>=r.length||f>=o.length);++f)r[f+n]=o[f];return f}function Q(o,r){return o instanceof r||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===r.name}function ft(o){return o!==o}let Qn=(function(){let o="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){let u=n*16;for(let f=0;f<16;++f)r[u+f]=o[n]+o[f]}return r})();function le(o){return typeof BigInt>"u"?Zn:o}function Zn(){throw new Error("BigInt not supported")}return ce}var Re,Jr,Ye,Xr,ce,Qr,en=Ae(()=>{"use strict";c();m();d();Re={},Jr=!1;Ye={},Xr=!1;ce={},Qr=!1});var de,T,Vo,Wo,tn=Ae(()=>{"use strict";c();m();d();en();de=Zr();de.Buffer;de.SlowBuffer;de.INSPECT_MAX_BYTES;de.kMaxLength;T=de.Buffer,Vo=de.INSPECT_MAX_BYTES,Wo=de.kMaxLength});var m=Ae(()=>{"use strict";tn()});var Bo={};ct(Bo,{DynamicSnippetsGenerator:()=>ut});module.exports=oi(Bo);c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();var li=typeof global=="object"&&global&&global.Object===Object&&global,rn=li;var pi=typeof self=="object"&&self&&self.Object===Object&&self,fi=rn||pi||Function("return this")(),nn=fi;var ci=nn.Symbol,re=ci;c();m();d();var on=Object.prototype,di=on.hasOwnProperty,mi=on.toString,Ne=re?re.toStringTag:void 0;function hi(l){var t=di.call(l,Ne),e=l[Ne];try{l[Ne]=void 0;var i=!0}catch{}var s=mi.call(l);return i&&(t?l[Ne]=e:delete l[Ne]),s}var sn=hi;c();m();d();var yi=Object.prototype,gi=yi.toString;function xi(l){return gi.call(l)}var an=xi;var wi="[object Null]",bi="[object Undefined]",un=re?re.toStringTag:void 0;function vi(l){return l==null?l===void 0?bi:wi:un&&un in Object(l)?sn(l):an(l)}var ln=vi;c();m();d();function Ti(l){return l!=null&&typeof l=="object"}var pn=Ti;var Ai="[object Symbol]";function Ei(l){return typeof l=="symbol"||pn(l)&&ln(l)==Ai}var fn=Ei;c();m();d();c();m();d();function Ii(l,t){for(var e=-1,i=l==null?0:l.length,s=Array(i);++e<i;)s[e]=t(l[e],e,l);return s}var cn=Ii;c();m();d();var ki=Array.isArray,dn=ki;var Ri=1/0,mn=re?re.prototype:void 0,hn=mn?mn.toString:void 0;function yn(l){if(typeof l=="string")return l;if(dn(l))return cn(l,yn)+"";if(fn(l))return hn?hn.call(l):"";var t=l+"";return t=="0"&&1/l==-Ri?"-0":t}var gn=yn;c();m();d();function Ni(l){return l==null?"":gn(l)}var xn=Ni;c();m();d();c();m();d();c();m();d();c();m();d();function Bi(l,t,e){var i=-1,s=l.length;t<0&&(t=-t>s?0:s+t),e=e>s?s:e,e<0&&(e+=s),s=t>e?0:e-t>>>0,t>>>=0;for(var p=Array(s);++i<s;)p[i]=l[i+t];return p}var wn=Bi;function Li(l,t,e){var i=l.length;return e=e===void 0?i:e,!t&&e>=i?l:wn(l,t,e)}var bn=Li;c();m();d();var Si="\\ud800-\\udfff",Ci="\\u0300-\\u036f",Fi="\\ufe20-\\ufe2f",Pi="\\u20d0-\\u20ff",Ui=Ci+Fi+Pi,Mi="\\ufe0e\\ufe0f",Di="\\u200d",Oi=RegExp("["+Di+Si+Ui+Mi+"]");function $i(l){return Oi.test(l)}var Je=$i;c();m();d();c();m();d();function _i(l){return l.split("")}var vn=_i;c();m();d();var Tn="\\ud800-\\udfff",ji="\\u0300-\\u036f",Vi="\\ufe20-\\ufe2f",Wi="\\u20d0-\\u20ff",qi=ji+Vi+Wi,Gi="\\ufe0e\\ufe0f",zi="["+Tn+"]",yt="["+qi+"]",gt="\\ud83c[\\udffb-\\udfff]",Ki="(?:"+yt+"|"+gt+")",An="[^"+Tn+"]",En="(?:\\ud83c[\\udde6-\\uddff]){2}",In="[\\ud800-\\udbff][\\udc00-\\udfff]",Hi="\\u200d",kn=Ki+"?",Rn="["+Gi+"]?",Yi="(?:"+Hi+"(?:"+[An,En,In].join("|")+")"+Rn+kn+")*",Ji=Rn+kn+Yi,Xi="(?:"+[An+yt+"?",yt,En,In,zi].join("|")+")",Qi=RegExp(gt+"(?="+gt+")|"+Xi+Ji,"g");function Zi(l){return l.match(Qi)||[]}var Nn=Zi;function eo(l){return Je(l)?Nn(l):vn(l)}var Bn=eo;function to(l){return function(t){t=xn(t);var e=Je(t)?Bn(t):void 0,i=e?e[0]:t.charAt(0),s=e?bn(e,1).join(""):t.slice(1);return i[l]()+s}}var Ln=to;var ro=Ln("toUpperCase"),xt=ro;c();m();d();function L(l){throw new Error("Unexpected value: "+JSON.stringify(l))}c();m();d();function Be(l){return Object.keys(l)}c();m();d();c();m();d();c();m();d();var Le=v.env.FERN_STACK_TRACK?.toLowerCase()??"",Z=Le!==""&&Le!=="0"&&Le!=="false",wt=["single","multiline","box"].includes(Le)?Le:"single";Z&&(Error.stackTraceLimit=50);var no=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),io=new Set(["stacktrace"]);function Qe({maxFrames:l=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:s=[],filterNode:p=!0,filterJs:a=!0,formatFilename:w=b=>b}={}){if(!Z)return[];i=[...i,...no],e=[...e,...io],s=[...s,"runInteractiveTask"];let b=!1;return(new Error().stack??"").split(`
2
2
  `).map(R=>{let I=R.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(I&&I.length===5){let[,C,M,E,k]=I;if(!C||!M||!E||!k)return;if(b||s.some(F=>C?.includes(F))){b=!0;return}switch(C){case"Object.<anonymous>":C="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":C=`${C.substring(C.indexOf(".")+1)}()=> { ... }`;break}return{fn:C,path:w(M),position:`${E}:${k}`}}}).filter(R=>R&&!i.some(I=>R.fn.includes(I))&&!(p&&R.path?.startsWith("node:"))&&!(a&&R.path?.endsWith(".js"))&&!e.some(I=>R.path.includes(I))).slice(t,t+l)}var Xe=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:i=[],filterFunctions:s=[],stopOn:p=[],filterNode:a=!0,filterJs:w=!0,multiline:b=!1,formatFilename:R=I=>I}={}){y(this,"maxFrames");y(this,"skip");y(this,"filterPaths");y(this,"filterFunctions");y(this,"stopOn");y(this,"filterNode");y(this,"filterJs");y(this,"multiline");y(this,"formatFilename");y(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=i,this.filterFunctions=s,this.stopOn=p,this.filterNode=a,this.filterJs=w,this.multiline=b,this.formatFilename=R}tag(t){let e=this.tracking.get(t)||new Set;Qe({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(i=>e.add(i)),this.tracking.set(t,e)}trace(t){if(!Z)return"";let e=this.tracking.get(t);return e?[...e].map(i=>`${this.multiline?`
3
3
  `:""}${i.fn} - ${i.path}:${i.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},bt;function Sn({maxFrames:l=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:s=[],filterNode:p=!0,filterJs:a=!0,multiline:w=!1,formatFilename:b=R=>R}={}){Z&&(bt??(bt=new Xe({maxFrames:l,skip:t,filterPaths:e,filterFunctions:i,stopOn:s,filterNode:p,filterJs:a,multiline:w,formatFilename:b})))}function Cn(l){bt?.tag(l)}function vt(l){return bt?.frames(l)??[]}var me=class{constructor(){Cn(this)}};c();m();d();var Ze=class{formatMultiple(t){return Promise.all(t.map(e=>this.format(e)))}formatMultipleSync(t){return t.map(e=>this.formatSync(e))}dispose(){}},Se=class extends Ze{async format(t){return t}formatSync(t){return t}};c();m();d();c();m();d();c();m();d();var J=class extends me{constructor(e){super();y(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 oo=4;Sn({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Ce=class{constructor(){y(this,"lineBuffer",[]);y(this,"indentLevel",0);y(this,"hasWrittenAnything",!1);y(this,"lastCharacterIsSemicolon",!1);y(this,"lastCharacterIsNewline",!1);y(this,"nodeStackFrames",[])}get buffer(){return Z&&this.nodeStackFrames.length>0&&this.writeInternal(`
4
4
  `),this.lineBuffer.join(`
@@ -17,12 +17,12 @@ ${t}`)}return t}toString(){let t=this.getContent();if(this.formatter!=null)try{r
17
17
  ${t}`)}return t}getContent(){let t=this.stringifyRequires();return t.length>0?`${t}
18
18
 
19
19
  ${this.buffer}`:this.buffer}stringifyRequires(){return Array.from(this.requires).map(t=>`require "${t}"`).join(`
20
- `)}};var B=class extends me{async toStringAsync({customConfig:t,formatter:e}={}){let i=new Ie({customConfig:t??{},formatter:e});return this.write(i),i.toStringAsync()}toString({customConfig:t,formatter:e}={}){let i=new Ie({customConfig:t??{},formatter:e});return this.write(i),i.toString()}typeDefinitionToString({customConfig:t,formatter:e}={}){let i=new Ie({customConfig:t??{},formatter:e});return this.writeTypeDefinition(i),i.toString()}writeTypeDefinition(t){}};var ne=class extends B{constructor({name:e,modules:i,fullyQualified:s}){super();y(this,"name");y(this,"modules");y(this,"fullyQualified");this.name=e,this.modules=i??[],this.fullyQualified=s??!1}write(e){if(this.fullyQualified||this.modules.length>0){let i=[...this.modules,this.name].join("::");e.write(i);return}e.write(this.name)}};var g={};ct(g,{AstNode:()=>B,ClassInstantiation:()=>he,ClassReference:()=>ne,Class_:()=>ue,CodeBlock:()=>ye,KeywordArgument:()=>ge,KeywordParameter:()=>xe,Method:()=>se,MethodInvocation:()=>we,MethodKind:()=>oe,Module_:()=>ae,Parameter:()=>W,Type:()=>ie,TypeLiteral:()=>Ve,TypeParameter:()=>be,Writer:()=>Y,begin:()=>Io,classReference:()=>wo,class_:()=>mo,codeblock:()=>it,comment:()=>go,falseValue:()=>po,ifElse:()=>Eo,instantiateClass:()=>bo,invokeMethod:()=>To,keywordArgument:()=>vo,method:()=>yo,module:()=>ho,nilValue:()=>fo,parameters:()=>co,positionalArgument:()=>Ao,raise:()=>ko,trueValue:()=>lo,typeParameter:()=>xo,wrapInModules:()=>Ro});c();m();d();c();m();d();var et=class extends B{constructor({body:e,rescues:i}){super();y(this,"body");y(this,"rescues");this.body=e,this.rescues=i}write(e){e.write("begin"),e.writeLine(),this.body&&(e.indent(),this.body.write(e),e.writeNewLineIfLastLineNot(),e.dedent());for(let{errorClass:i,errorVariable:s,body:p}of this.rescues)e.write("rescue"),i&&(e.write(" "),i.write(e)),s&&(e.write(" => "),e.write(s)),e.writeLine(),p&&(e.indent(),p.write(e),e.writeNewLineIfLastLineNot(),e.dedent());e.write("end")}};c();m();d();var tt=class extends B{constructor({if:e,elseIf:i,elseBody:s}){super();y(this,"ifBranch");y(this,"elseIfs");y(this,"elseBody");this.ifBranch=e,this.elseIfs=i??[],this.elseBody=s?Array.isArray(s)?s:[s]:void 0}write(e){e.write("if "),this.ifBranch.condition.write(e),e.writeLine(),e.indent();for(let i of this.ifBranch.thenBody)i.write(e),e.writeNewLineIfLastLineNot();e.dedent();for(let i of this.elseIfs){e.write("elsif "),i.condition.write(e),e.writeLine(),e.indent();for(let s of i.thenBody)s.write(e),e.writeNewLineIfLastLineNot();e.dedent()}if(this.elseBody&&this.elseBody.length>0){e.writeLine("else"),e.indent();for(let i of this.elseBody)i.write(e),e.writeNewLineIfLastLineNot();e.dedent()}e.write("end"),e.writeNewLineIfLastLineNot()}};c();m();d();c();m();d();c();m();d();var ao=120,uo=2,X=class extends B{constructor({docs:e}){super();y(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
21
- `).forEach(i=>{this.wrapLine(i,e).forEach(p=>{e.writeLine(`# ${p}`)})})}wrapLine(e,i){let s=i.currentIndentLevel*2,p=ao-s-uo;if(e.length<=p)return[e];if(p<20)return[e];let a=e.split(/(\s+)/),w=[],b="";for(let R of a){if(R===""||b===""&&/^\s+$/.test(R))continue;let I=b+R;I.length<=p?b=I:(b.trim()!==""&&w.push(b.trimEnd()),b=R.trimStart(),b.length>p&&(w.push(b),b=""))}return b.trim()!==""&&w.push(b.trimEnd()),w.length===0?[e]:w}};c();m();d();c();m();d();var ie=class l extends B{constructor(e){super();y(this,"internalType");this.internalType=e}write(e){if(this.internalType)switch(this.internalType?.type){case"integer":e.write("Integer");return;case"string":e.write("String");return;case"class":e.writeNode(this.internalType.reference);return;case"instance":break;case"boolean":e.write("Internal::Types::Boolean");return;case"nil":break;case"top":break;case"bot":break;case"void":break;case"boolish":break;case"union":if(this.internalType.elems.length===2&&this.internalType.elems[1]?.internalType?.type==="nil"){let i=this.internalType.elems[0];i?.write(e)}break;case"intersection":break;case"array":e.write("Internal::Types::Array["),this.internalType.elem.write(e),e.write("]");return;case"hash":e.write("Internal::Types::Hash["),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write("]");return;case"object":e.write("Object");break;case"singleton":break;case"generic":break;case"self":break;case"tuple":break;default:L(this.internalType)}}writeTypeDefinition(e){if(this.internalType)switch(this.internalType.type){case"self":e.write("self");break;case"class":e.write(this.internalType.reference.toString(e));break;case"instance":e.write("instance");break;case"boolean":e.write("bool");break;case"nil":e.write("nil");break;case"top":e.write("top");break;case"bot":e.write("bot");break;case"void":e.write("void");break;case"boolish":e.write("boolish");break;case"string":e.write("String");break;case"integer":e.write("Integer");break;case"union":e.delimit({nodes:this.internalType.elems,delimiter:" | ",writeFunction:i=>i.writeTypeDefinition(e)});break;case"intersection":e.delimit({nodes:this.internalType.elems,delimiter:" & ",writeFunction:i=>i.writeTypeDefinition(e)});break;case"array":e.write("Array["),this.internalType.elem.writeTypeDefinition(e),e.write("]");break;case"hash":e.write("Hash["),this.internalType.keyType.writeTypeDefinition(e),e.write(", "),this.internalType.valueType.writeTypeDefinition(e),e.write("]");break;case"object":e.write(this.internalType.klass);break;case"singleton":e.write("singleton("),e.write(this.internalType.klass),e.write(")");break;case"tuple":e.write("["),e.delimit({nodes:this.internalType.elems,delimiter:", ",writeFunction:i=>i.write(e)}),e.write("]");break;case"generic":e.write(`${this.internalType.baseKlass}[`),e.delimit({nodes:this.internalType.parameters,delimiter:", ",writeFunction:i=>i.writeTypeDefinition(e)}),e.write("]");break;default:L(this.internalType)}else e.write("untyped")}static untyped(){return new this(void 0)}static self(){return new this({type:"self"})}static class_(e){return new this({type:"class",reference:new ne({name:e.name,modules:e.modules,fullyQualified:!0})})}static instance(){return new this({type:"instance"})}static boolean(){return new this({type:"boolean"})}static nil(){return new this({type:"nil"})}static top(){return new this({type:"top"})}static bot(){return new this({type:"bot"})}static void(){return new this({type:"void"})}static boolish(){return new this({type:"boolish"})}static string(){return new this({type:"string"})}static integer(){return new this({type:"integer"})}static union(e){return new this({type:"union",elems:e})}static intersection(e){return new this({type:"intersection",elems:e})}static array(e){return new this({type:"array",elem:e})}static hash(e,i){return new this({type:"hash",keyType:e,valueType:i})}static object(e){return new this({type:"object",klass:e})}static singleton(e){return new this({type:"singleton",klass:e})}static tuple(e){return new this({type:"tuple",elems:e})}static generic(e,i){return new this({type:"generic",baseKlass:e,parameters:i})}static nilable(e){return l.union([e,l.nil()])}nilable(){return l.nilable(this)}};var oe={Instance:"instance",Class_:"class"},Fn={Public:"public",Private:"private",Protected:"protected"},se=class extends B{constructor({name:e,docstring:i,kind:s,visibility:p,parameters:a,returnType:w,statements:b,splatOptionDocs:R}){super();y(this,"name");y(this,"docstring");y(this,"kind");y(this,"positionalParameters");y(this,"keywordParameters");y(this,"positionalSplatParameter");y(this,"keywordSplatParameter");y(this,"yieldParameter");y(this,"visibility");y(this,"statements");y(this,"returnType");y(this,"splatOptionDocs");this.name=e,this.docstring=i,this.kind=s??oe.Instance,this.visibility=p??Fn.Public,this.positionalParameters=a?.positional??[],this.keywordParameters=a?.keyword??[],this.positionalSplatParameter=a?.positionalSplat,this.keywordSplatParameter=a?.keywordSplat,this.yieldParameter=a?.yield,this.returnType=w??ie.untyped(),this.statements=b??[],this.splatOptionDocs=R??[]}addStatement(e){this.statements.push(e)}write(e){this.docstring&&new X({docs:this.docstring}).write(e);let i=this.positionalParameters.length>0||this.keywordParameters.length>0||this.keywordSplatParameter!=null;this.docstring&&i&&e.writeLine("#");for(let s of this.positionalParameters){e.write(`# @option ${s.name} [`);let p=new Y({customConfig:e.customConfig});s.type.writeTypeDefinition(p),e.write(this.normalizeForYard(p.toString())),e.write("]"),e.newLine()}for(let s of this.keywordParameters){e.write(`# @param ${s.name} [`);let p=new Y({customConfig:e.customConfig});s.type.writeTypeDefinition(p),e.write(this.normalizeForYard(p.toString())),e.write("]"),s.docs&&e.write(` ${s.docs}`),e.newLine()}if(this.keywordSplatParameter!=null){e.write(`# @param ${this.keywordSplatParameter.name} [`);let s=new Y({customConfig:e.customConfig});this.keywordSplatParameter.type.writeTypeDefinition(s),e.write(this.normalizeForYard(s.toString())),e.write("]"),this.keywordSplatParameter.docs&&e.write(` ${this.keywordSplatParameter.docs}`),e.newLine()}for(let s of this.splatOptionDocs)e.writeLine(`# ${s}`);if(this.returnType!=null){(i||this.docstring)&&e.writeLine("#"),e.write("# @return [");let s=new Y({customConfig:e.customConfig});this.returnType.writeTypeDefinition(s),e.write(this.normalizeForYard(s.toString())),e.write("]"),e.newLine()}switch(this.visibility!==Fn.Public&&(e.write(this.visibility),this.kind===oe.Class_&&e.write("_class_method"),e.write(" ")),this.kind){case oe.Instance:e.write(`def ${this.name}`);break;case oe.Class_:e.write(`def self.${this.name}`);break}this.parameters.length&&(e.write("("),e.delimit({nodes:this.parameters,delimiter:", ",writeFunction:s=>s.write(e)}),e.write(")")),this.statements.length?(e.newLine(),e.indent(),this.statements.forEach((s,p)=>{s.write(e),p<this.statements.length-1&&e.newLine()}),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("end")):e.write("; end"),e.newLine()}writeTypeDefinition(e){e.write(`def ${this.name}: (`),this.parameters.forEach((i,s)=>{i.writeTypeDefinition(e),s<this.parameters.length-1&&e.write(", ")}),e.write(") -> "),this.returnType.writeTypeDefinition(e)}normalizeForYard(e){let i=e.replace(/\s*\|\s*/g,", ");return i=i.replace(/\bbool\b/g,"Boolean"),i=i.replace(/(^|,\s*)nil(?:,\s*nil)+(?=,|\]|$)/g,"$1nil"),i=i.replace(/Hash\[untyped,\s*untyped\]/g,"Hash"),i}get parameters(){return[...this.positionalParameters,...this.keywordParameters,this.positionalSplatParameter,this.keywordSplatParameter,this.yieldParameter].flatMap(e=>e!==void 0?e:[])}};c();m();d();var ae=class l extends B{constructor({name:e,namespace:i,typeParameters:s,docstring:p,statements:a}){super();y(this,"name");y(this,"namespace");y(this,"typeParameters");y(this,"docstring");y(this,"statements");this.name=e,this.namespace=i??new Set,this.typeParameters=s??[],this.docstring=p,this.statements=a??[],this.populateChildNamespaces()}addStatement(e){this.statements.push(e)}write(e){this.docstring&&new X({docs:this.docstring}).write(e),e.write(`module ${this.name}`),this.statements.length?(e.newLine(),e.indent(),this.statements.forEach((i,s)=>{i.write(e),s<this.statements.length-1&&e.newLine()}),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("end")):e.write("; end"),e.newLine()}writeTypeDefinition(e){e.write(`module ${this.name}`),this.typeParameters.length&&(e.write("["),e.delimit({nodes:this.typeParameters,delimiter:", ",writeFunction:i=>i.writeTypeDefinition(e)}),e.write("]")),e.newLine(),this.statements.length&&(e.indent(),this.statements.forEach(i=>{i.writeTypeDefinition(e),e.newLine()}),e.dedent()),e.write("end")}populateChildNamespaces(){this.statements.filter(e=>e instanceof l||e instanceof ue).forEach(e=>{e.namespace=new Set([...this.namespace,this]),e.populateChildNamespaces()})}get fullyQualifiedNamespace(){return[...this.namespace,this].map(e=>e.name).join("::")}};var ue=class extends ae{constructor({name:e,superclass:i,typeParameters:s,docstring:p,statements:a}){super({name:e,docstring:p,typeParameters:s});y(this,"superclass");y(this,"statements");y(this,"methods",[]);this.superclass=i,this.statements=a??[]}addStatement(e){this.statements.push(e)}addStatements(e){this.statements.push(...e)}addInstanceMethod(e,i,s){let p=new se({name:e,kind:oe.Instance,returnType:i,statements:s});this.addMethod(p)}addMethod(e){this.methods.push(e)}addMethods(e){e.forEach(i=>this.addMethod(i))}write(e){if(this.docstring&&new X({docs:this.docstring}).write(e),e.write(`class ${this.name}`),this.superclass&&(e.write(" < "),this.superclass.write(e)),!this.hasBody()){e.writeLine("; end");return}this.statements.length&&(e.newLine(),e.indent(),this.statements.forEach((i,s)=>{i.write(e),e.newLine()}),e.dedent()),this.methods.length&&(e.newLine(),e.indent(),this.methods.forEach(i=>{i.write(e)}),e.dedent()),e.writeLine("end")}hasBody(){return this.statements.length>0||this.methods.length>0}writeTypeDefinition(e){e.write(`class ${this.name}`),this.typeParameters.length&&(e.write("["),e.delimit({nodes:this.typeParameters,delimiter:", ",writeFunction:i=>i.writeTypeDefinition(e)}),e.write("]")),this.superclass&&(e.write(" < "),this.superclass.write(e)),e.newLine(),this.statements.length&&(e.indent(),this.statements.forEach(i=>{i.writeTypeDefinition(e),e.newLine()}),e.dedent()),e.write("end")}};c();m();d();var he=class extends B{constructor({classReference:e,arguments_:i}){super();y(this,"classReference");y(this,"arguments_");this.classReference=e,this.arguments_=i}write(e){e.writeNode(this.classReference),e.write("."),e.write("new"),this.arguments_.length!==0&&(e.write("("),this.arguments_.length>1?(e.indent(),e.newLine(),this.arguments_.forEach((i,s)=>{s>0&&(e.write(","),e.newLine()),i.write(e)}),e.newLine(),e.dedent()):this.arguments_.forEach((i,s)=>{s>0&&e.write(", "),i.write(e)}),e.write(")"))}};c();m();d();var ye=class extends B{constructor(e){super();y(this,"arg");this.arg=e}write(e){return new J(this.arg).write(e)}};c();m();d();var ge=class extends B{constructor({name:e,value:i}){super();y(this,"name");y(this,"value");this.name=e,this.value=i}write(e){e.write(`${this.name}: `),this.value.write(e)}};c();m();d();c();m();d();var W=class extends B{constructor({name:e,type:i,optional:s,docs:p}){super();y(this,"name");y(this,"type");y(this,"optional");y(this,"docs");this.name=e,this.type=i??ie.untyped(),this.optional=s??!1,this.docs=p}};var xe=class extends W{constructor({name:e,type:i,initializer:s,optional:p}){super({name:e,type:i,optional:p});y(this,"initializer");this.initializer=s}write(e){e.write(`${this.name}:`),this.initializer&&(e.write(" "),e.writeNode(this.initializer))}writeTypeDefinition(e){this.optional&&e.write("?"),e.write(`${this.name}: `),this.type.writeTypeDefinition(e)}};c();m();d();var Oe=class extends W{constructor(){super(...arguments);y(this,"initializer")}write(e){e.write(`**${this.name}`)}writeTypeDefinition(e){e.write("**"),this.type.writeTypeDefinition(e)}};c();m();d();var we=class extends B{constructor({on:e,method:i,arguments_:s,keywordArguments:p,block:a}){super();y(this,"on");y(this,"method");y(this,"arguments_");y(this,"keywordArguments");y(this,"block");this.on=e,this.method=i,this.arguments_=s,this.keywordArguments=p,this.block=a}write(e){this.on.write(e),e.write("."),e.write(this.method);let i=[];for(let s of this.arguments_)i.push({kind:"positional",node:s});for(let s of this.keywordArguments||[])i.push({kind:"keyword",arg:s});if(!(i.length===0&&this.block==null)&&(e.write("("),i.length>1?(e.indent(),e.newLine(),i.forEach((s,p)=>{p>0&&(e.write(","),e.newLine()),Pn(e,s)}),e.newLine(),e.dedent()):i.forEach((s,p)=>{p>0&&e.write(", "),Pn(e,s)}),e.write(")"),this.block)){let[s,p]=this.block;e.write(" do"),s.length>0&&(e.write(" |"),s.forEach((a,w)=>{w>0&&e.write(", "),e.write(a)}),e.write("|")),e.newLine(),e.indent();for(let a of p)a.write(e),e.writeNewLineIfLastLineNot();e.dedent(),e.write("end")}}};function Pn(l,t){switch(t.kind){case"positional":t.node.write(l);break;case"keyword":t.arg.write(l);break;default:L(t)}}c();m();d();var $e=class extends B{constructor({value:e}){super();y(this,"value");this.value=e}write(e){this.value.write(e)}};c();m();d();var _e=class extends W{constructor({name:e,type:i,optional:s,initializer:p}){super({name:e,type:i,optional:s});y(this,"initializer");this.initializer=p}write(e){e.write(this.name),this.initializer&&e.write(` = ${this.initializer.write(e)}`)}writeTypeDefinition(e){this.optional&&e.write("?"),this.type.writeTypeDefinition(e)}};c();m();d();var je=class extends W{write(t){t.write(`*${this.name}`)}writeTypeDefinition(t){t.write("*"),this.type.writeTypeDefinition(t)}};c();m();d();var Ve=class l extends B{constructor(e){super();y(this,"internalType");this.internalType=e}static string(e){return new this({type:"str",value:e})}static integer(e){return new this({type:"int",value:e})}static float(e){return new this({type:"float",value:e})}static boolean(e){return new this({type:"bool",value:e})}static hash(e){return new this({type:"hash",entries:e})}static set(e){return new this({type:"set",values:e})}static list(e){return new this({type:"list",values:e})}static nop(){return new this({type:"nop"})}static nil(){return new this({type:"nil"})}static isNop(e){return e instanceof l&&e.internalType.type==="nop"}static isNil(e){return e instanceof l&&e.internalType.type==="nil"}write(e){switch(this.internalType.type){case"str":{let i=this.internalType.value.replaceAll(`\r
20
+ `)}};var B=class extends me{async toStringAsync({customConfig:t,formatter:e}={}){let i=new Ie({customConfig:t??{},formatter:e});return this.write(i),i.toStringAsync()}toString({customConfig:t,formatter:e}={}){let i=new Ie({customConfig:t??{},formatter:e});return this.write(i),i.toString()}typeDefinitionToString({customConfig:t,formatter:e}={}){let i=new Ie({customConfig:t??{},formatter:e});return this.writeTypeDefinition(i),i.toString()}writeTypeDefinition(t){}};var ne=class extends B{constructor({name:e,modules:i,fullyQualified:s}){super();y(this,"name");y(this,"modules");y(this,"fullyQualified");this.name=e,this.modules=i??[],this.fullyQualified=s??!1}write(e){if(this.fullyQualified||this.modules.length>0){let i=[...this.modules,this.name].join("::");e.write(i);return}e.write(this.name)}};var g={};ct(g,{AstNode:()=>B,ClassInstantiation:()=>he,ClassReference:()=>ne,Class_:()=>ue,CodeBlock:()=>ye,KeywordArgument:()=>ge,KeywordParameter:()=>xe,Method:()=>se,MethodInvocation:()=>we,MethodKind:()=>oe,Module_:()=>ae,Parameter:()=>q,Type:()=>ie,TypeLiteral:()=>Ve,TypeParameter:()=>be,Writer:()=>Y,begin:()=>Io,classReference:()=>wo,class_:()=>mo,codeblock:()=>it,comment:()=>go,falseValue:()=>po,ifElse:()=>Eo,instantiateClass:()=>bo,invokeMethod:()=>To,keywordArgument:()=>vo,method:()=>yo,module:()=>ho,nilValue:()=>fo,parameters:()=>co,positionalArgument:()=>Ao,raise:()=>ko,trueValue:()=>lo,typeParameter:()=>xo,wrapInModules:()=>Ro});c();m();d();c();m();d();var et=class extends B{constructor({body:e,rescues:i}){super();y(this,"body");y(this,"rescues");this.body=e,this.rescues=i}write(e){e.write("begin"),e.writeLine(),this.body&&(e.indent(),this.body.write(e),e.writeNewLineIfLastLineNot(),e.dedent());for(let{errorClass:i,errorVariable:s,body:p}of this.rescues)e.write("rescue"),i&&(e.write(" "),i.write(e)),s&&(e.write(" => "),e.write(s)),e.writeLine(),p&&(e.indent(),p.write(e),e.writeNewLineIfLastLineNot(),e.dedent());e.write("end")}};c();m();d();var tt=class extends B{constructor({if:e,elseIf:i,elseBody:s}){super();y(this,"ifBranch");y(this,"elseIfs");y(this,"elseBody");this.ifBranch=e,this.elseIfs=i??[],this.elseBody=s?Array.isArray(s)?s:[s]:void 0}write(e){e.write("if "),this.ifBranch.condition.write(e),e.writeLine(),e.indent();for(let i of this.ifBranch.thenBody)i.write(e),e.writeNewLineIfLastLineNot();e.dedent();for(let i of this.elseIfs){e.write("elsif "),i.condition.write(e),e.writeLine(),e.indent();for(let s of i.thenBody)s.write(e),e.writeNewLineIfLastLineNot();e.dedent()}if(this.elseBody&&this.elseBody.length>0){e.writeLine("else"),e.indent();for(let i of this.elseBody)i.write(e),e.writeNewLineIfLastLineNot();e.dedent()}e.write("end"),e.writeNewLineIfLastLineNot()}};c();m();d();c();m();d();c();m();d();var ao=120,uo=2,X=class extends B{constructor({docs:e}){super();y(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
21
+ `).forEach(i=>{this.wrapLine(i,e).forEach(p=>{e.writeLine(`# ${p}`)})})}wrapLine(e,i){let s=i.currentIndentLevel*2,p=ao-s-uo;if(e.length<=p)return[e];if(p<20)return[e];let a=e.split(/(\s+)/),w=[],b="";for(let R of a){if(R===""||b===""&&/^\s+$/.test(R))continue;let I=b+R;I.length<=p?b=I:(b.trim()!==""&&w.push(b.trimEnd()),b=R.trimStart(),b.length>p&&(w.push(b),b=""))}return b.trim()!==""&&w.push(b.trimEnd()),w.length===0?[e]:w}};c();m();d();c();m();d();var ie=class l extends B{constructor(e){super();y(this,"internalType");this.internalType=e}write(e){if(this.internalType)switch(this.internalType?.type){case"integer":e.write("Integer");return;case"string":e.write("String");return;case"class":e.writeNode(this.internalType.reference);return;case"instance":break;case"boolean":e.write("Internal::Types::Boolean");return;case"nil":break;case"top":break;case"bot":break;case"void":break;case"boolish":break;case"union":if(this.internalType.elems.length===2&&this.internalType.elems[1]?.internalType?.type==="nil"){let i=this.internalType.elems[0];i?.write(e)}break;case"intersection":break;case"array":e.write("Internal::Types::Array["),this.internalType.elem.write(e),e.write("]");return;case"hash":e.write("Internal::Types::Hash["),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write("]");return;case"object":e.write("Object");break;case"singleton":break;case"generic":break;case"self":break;case"tuple":break;default:L(this.internalType)}}writeTypeDefinition(e){if(this.internalType)switch(this.internalType.type){case"self":e.write("self");break;case"class":e.write(this.internalType.reference.toString(e));break;case"instance":e.write("instance");break;case"boolean":e.write("bool");break;case"nil":e.write("nil");break;case"top":e.write("top");break;case"bot":e.write("bot");break;case"void":e.write("void");break;case"boolish":e.write("boolish");break;case"string":e.write("String");break;case"integer":e.write("Integer");break;case"union":e.delimit({nodes:this.internalType.elems,delimiter:" | ",writeFunction:i=>i.writeTypeDefinition(e)});break;case"intersection":e.delimit({nodes:this.internalType.elems,delimiter:" & ",writeFunction:i=>i.writeTypeDefinition(e)});break;case"array":e.write("Array["),this.internalType.elem.writeTypeDefinition(e),e.write("]");break;case"hash":e.write("Hash["),this.internalType.keyType.writeTypeDefinition(e),e.write(", "),this.internalType.valueType.writeTypeDefinition(e),e.write("]");break;case"object":e.write(this.internalType.klass);break;case"singleton":e.write("singleton("),e.write(this.internalType.klass),e.write(")");break;case"tuple":e.write("["),e.delimit({nodes:this.internalType.elems,delimiter:", ",writeFunction:i=>i.write(e)}),e.write("]");break;case"generic":e.write(`${this.internalType.baseKlass}[`),e.delimit({nodes:this.internalType.parameters,delimiter:", ",writeFunction:i=>i.writeTypeDefinition(e)}),e.write("]");break;default:L(this.internalType)}else e.write("untyped")}static untyped(){return new this(void 0)}static self(){return new this({type:"self"})}static class_(e){return new this({type:"class",reference:new ne({name:e.name,modules:e.modules,fullyQualified:!0})})}static instance(){return new this({type:"instance"})}static boolean(){return new this({type:"boolean"})}static nil(){return new this({type:"nil"})}static top(){return new this({type:"top"})}static bot(){return new this({type:"bot"})}static void(){return new this({type:"void"})}static boolish(){return new this({type:"boolish"})}static string(){return new this({type:"string"})}static integer(){return new this({type:"integer"})}static union(e){return new this({type:"union",elems:e})}static intersection(e){return new this({type:"intersection",elems:e})}static array(e){return new this({type:"array",elem:e})}static hash(e,i){return new this({type:"hash",keyType:e,valueType:i})}static object(e){return new this({type:"object",klass:e})}static singleton(e){return new this({type:"singleton",klass:e})}static tuple(e){return new this({type:"tuple",elems:e})}static generic(e,i){return new this({type:"generic",baseKlass:e,parameters:i})}static nilable(e){return l.union([e,l.nil()])}nilable(){return l.nilable(this)}};var oe={Instance:"instance",Class_:"class"},Fn={Public:"public",Private:"private",Protected:"protected"},se=class extends B{constructor({name:e,docstring:i,kind:s,visibility:p,parameters:a,returnType:w,statements:b,splatOptionDocs:R}){super();y(this,"name");y(this,"docstring");y(this,"kind");y(this,"positionalParameters");y(this,"keywordParameters");y(this,"positionalSplatParameter");y(this,"keywordSplatParameter");y(this,"yieldParameter");y(this,"visibility");y(this,"statements");y(this,"returnType");y(this,"splatOptionDocs");this.name=e,this.docstring=i,this.kind=s??oe.Instance,this.visibility=p??Fn.Public,this.positionalParameters=a?.positional??[],this.keywordParameters=a?.keyword??[],this.positionalSplatParameter=a?.positionalSplat,this.keywordSplatParameter=a?.keywordSplat,this.yieldParameter=a?.yield,this.returnType=w??ie.untyped(),this.statements=b??[],this.splatOptionDocs=R??[]}addStatement(e){this.statements.push(e)}write(e){this.docstring&&new X({docs:this.docstring}).write(e);let i=this.positionalParameters.length>0||this.keywordParameters.length>0||this.keywordSplatParameter!=null;this.docstring&&i&&e.writeLine("#");for(let s of this.positionalParameters){e.write(`# @option ${s.name} [`);let p=new Y({customConfig:e.customConfig});s.type.writeTypeDefinition(p),e.write(this.normalizeForYard(p.toString())),e.write("]"),e.newLine()}for(let s of this.keywordParameters){e.write(`# @param ${s.name} [`);let p=new Y({customConfig:e.customConfig});s.type.writeTypeDefinition(p),e.write(this.normalizeForYard(p.toString())),e.write("]"),s.docs&&e.write(` ${s.docs}`),e.newLine()}if(this.keywordSplatParameter!=null){e.write(`# @param ${this.keywordSplatParameter.name} [`);let s=new Y({customConfig:e.customConfig});this.keywordSplatParameter.type.writeTypeDefinition(s),e.write(this.normalizeForYard(s.toString())),e.write("]"),this.keywordSplatParameter.docs&&e.write(` ${this.keywordSplatParameter.docs}`),e.newLine()}for(let s of this.splatOptionDocs)e.writeLine(`# ${s}`);if(this.returnType!=null){(i||this.docstring)&&e.writeLine("#"),e.write("# @return [");let s=new Y({customConfig:e.customConfig});this.returnType.writeTypeDefinition(s),e.write(this.normalizeForYard(s.toString())),e.write("]"),e.newLine()}switch(this.visibility!==Fn.Public&&(e.write(this.visibility),this.kind===oe.Class_&&e.write("_class_method"),e.write(" ")),this.kind){case oe.Instance:e.write(`def ${this.name}`);break;case oe.Class_:e.write(`def self.${this.name}`);break}this.parameters.length&&(e.write("("),e.delimit({nodes:this.parameters,delimiter:", ",writeFunction:s=>s.write(e)}),e.write(")")),this.statements.length?(e.newLine(),e.indent(),this.statements.forEach((s,p)=>{s.write(e),p<this.statements.length-1&&e.newLine()}),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("end")):e.write("; end"),e.newLine()}writeTypeDefinition(e){e.write(`def ${this.name}: (`),this.parameters.forEach((i,s)=>{i.writeTypeDefinition(e),s<this.parameters.length-1&&e.write(", ")}),e.write(") -> "),this.returnType.writeTypeDefinition(e)}normalizeForYard(e){let i=e.replace(/\s*\|\s*/g,", ");return i=i.replace(/\bbool\b/g,"Boolean"),i=i.replace(/(^|,\s*)nil(?:,\s*nil)+(?=,|\]|$)/g,"$1nil"),i=i.replace(/Hash\[untyped,\s*untyped\]/g,"Hash"),i}get parameters(){return[...this.positionalParameters,...this.keywordParameters,this.positionalSplatParameter,this.keywordSplatParameter,this.yieldParameter].flatMap(e=>e!==void 0?e:[])}};c();m();d();var ae=class l extends B{constructor({name:e,namespace:i,typeParameters:s,docstring:p,statements:a}){super();y(this,"name");y(this,"namespace");y(this,"typeParameters");y(this,"docstring");y(this,"statements");this.name=e,this.namespace=i??new Set,this.typeParameters=s??[],this.docstring=p,this.statements=a??[],this.populateChildNamespaces()}addStatement(e){this.statements.push(e)}write(e){this.docstring&&new X({docs:this.docstring}).write(e),e.write(`module ${this.name}`),this.statements.length?(e.newLine(),e.indent(),this.statements.forEach((i,s)=>{i.write(e),s<this.statements.length-1&&e.newLine()}),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("end")):e.write("; end"),e.newLine()}writeTypeDefinition(e){e.write(`module ${this.name}`),this.typeParameters.length&&(e.write("["),e.delimit({nodes:this.typeParameters,delimiter:", ",writeFunction:i=>i.writeTypeDefinition(e)}),e.write("]")),e.newLine(),this.statements.length&&(e.indent(),this.statements.forEach(i=>{i.writeTypeDefinition(e),e.newLine()}),e.dedent()),e.write("end")}populateChildNamespaces(){this.statements.filter(e=>e instanceof l||e instanceof ue).forEach(e=>{e.namespace=new Set([...this.namespace,this]),e.populateChildNamespaces()})}get fullyQualifiedNamespace(){return[...this.namespace,this].map(e=>e.name).join("::")}};var ue=class extends ae{constructor({name:e,superclass:i,typeParameters:s,docstring:p,statements:a}){super({name:e,docstring:p,typeParameters:s});y(this,"superclass");y(this,"statements");y(this,"methods",[]);this.superclass=i,this.statements=a??[]}addStatement(e){this.statements.push(e)}addStatements(e){this.statements.push(...e)}addInstanceMethod(e,i,s){let p=new se({name:e,kind:oe.Instance,returnType:i,statements:s});this.addMethod(p)}addMethod(e){this.methods.push(e)}addMethods(e){e.forEach(i=>this.addMethod(i))}write(e){if(this.docstring&&new X({docs:this.docstring}).write(e),e.write(`class ${this.name}`),this.superclass&&(e.write(" < "),this.superclass.write(e)),!this.hasBody()){e.writeLine("; end");return}this.statements.length&&(e.newLine(),e.indent(),this.statements.forEach((i,s)=>{i.write(e),e.newLine()}),e.dedent()),this.methods.length&&(e.newLine(),e.indent(),this.methods.forEach(i=>{i.write(e)}),e.dedent()),e.writeLine("end")}hasBody(){return this.statements.length>0||this.methods.length>0}writeTypeDefinition(e){e.write(`class ${this.name}`),this.typeParameters.length&&(e.write("["),e.delimit({nodes:this.typeParameters,delimiter:", ",writeFunction:i=>i.writeTypeDefinition(e)}),e.write("]")),this.superclass&&(e.write(" < "),this.superclass.write(e)),e.newLine(),this.statements.length&&(e.indent(),this.statements.forEach(i=>{i.writeTypeDefinition(e),e.newLine()}),e.dedent()),e.write("end")}};c();m();d();var he=class extends B{constructor({classReference:e,arguments_:i}){super();y(this,"classReference");y(this,"arguments_");this.classReference=e,this.arguments_=i}write(e){e.writeNode(this.classReference),e.write("."),e.write("new"),this.arguments_.length!==0&&(e.write("("),this.arguments_.length>1?(e.indent(),e.newLine(),this.arguments_.forEach((i,s)=>{s>0&&(e.write(","),e.newLine()),i.write(e)}),e.newLine(),e.dedent()):this.arguments_.forEach((i,s)=>{s>0&&e.write(", "),i.write(e)}),e.write(")"))}};c();m();d();var ye=class extends B{constructor(e){super();y(this,"arg");this.arg=e}write(e){return new J(this.arg).write(e)}};c();m();d();var ge=class extends B{constructor({name:e,value:i}){super();y(this,"name");y(this,"value");this.name=e,this.value=i}write(e){e.write(`${this.name}: `),this.value.write(e)}};c();m();d();c();m();d();var q=class extends B{constructor({name:e,type:i,optional:s,docs:p}){super();y(this,"name");y(this,"type");y(this,"optional");y(this,"docs");this.name=e,this.type=i??ie.untyped(),this.optional=s??!1,this.docs=p}};var xe=class extends q{constructor({name:e,type:i,initializer:s,optional:p}){super({name:e,type:i,optional:p});y(this,"initializer");this.initializer=s}write(e){e.write(`${this.name}:`),this.initializer&&(e.write(" "),e.writeNode(this.initializer))}writeTypeDefinition(e){this.optional&&e.write("?"),e.write(`${this.name}: `),this.type.writeTypeDefinition(e)}};c();m();d();var Oe=class extends q{constructor(){super(...arguments);y(this,"initializer")}write(e){e.write(`**${this.name}`)}writeTypeDefinition(e){e.write("**"),this.type.writeTypeDefinition(e)}};c();m();d();var we=class extends B{constructor({on:e,method:i,arguments_:s,keywordArguments:p,block:a}){super();y(this,"on");y(this,"method");y(this,"arguments_");y(this,"keywordArguments");y(this,"block");this.on=e,this.method=i,this.arguments_=s,this.keywordArguments=p,this.block=a}write(e){this.on.write(e),e.write("."),e.write(this.method);let i=[];for(let s of this.arguments_)i.push({kind:"positional",node:s});for(let s of this.keywordArguments||[])i.push({kind:"keyword",arg:s});if(!(i.length===0&&this.block==null)&&(e.write("("),i.length>1?(e.indent(),e.newLine(),i.forEach((s,p)=>{p>0&&(e.write(","),e.newLine()),Pn(e,s)}),e.newLine(),e.dedent()):i.forEach((s,p)=>{p>0&&e.write(", "),Pn(e,s)}),e.write(")"),this.block)){let[s,p]=this.block;e.write(" do"),s.length>0&&(e.write(" |"),s.forEach((a,w)=>{w>0&&e.write(", "),e.write(a)}),e.write("|")),e.newLine(),e.indent();for(let a of p)a.write(e),e.writeNewLineIfLastLineNot();e.dedent(),e.write("end")}}};function Pn(l,t){switch(t.kind){case"positional":t.node.write(l);break;case"keyword":t.arg.write(l);break;default:L(t)}}c();m();d();var $e=class extends B{constructor({value:e}){super();y(this,"value");this.value=e}write(e){this.value.write(e)}};c();m();d();var _e=class extends q{constructor({name:e,type:i,optional:s,initializer:p}){super({name:e,type:i,optional:s});y(this,"initializer");this.initializer=p}write(e){e.write(this.name),this.initializer&&e.write(` = ${this.initializer.write(e)}`)}writeTypeDefinition(e){this.optional&&e.write("?"),this.type.writeTypeDefinition(e)}};c();m();d();var je=class extends q{write(t){t.write(`*${this.name}`)}writeTypeDefinition(t){t.write("*"),this.type.writeTypeDefinition(t)}};c();m();d();var Ve=class l extends B{constructor(e){super();y(this,"internalType");this.internalType=e}static string(e){return new this({type:"str",value:e})}static integer(e){return new this({type:"int",value:e})}static float(e){return new this({type:"float",value:e})}static boolean(e){return new this({type:"bool",value:e})}static hash(e){return new this({type:"hash",entries:e})}static set(e){return new this({type:"set",values:e})}static list(e){return new this({type:"list",values:e})}static nop(){return new this({type:"nop"})}static nil(){return new this({type:"nil"})}static isNop(e){return e instanceof l&&e.internalType.type==="nop"}static isNil(e){return e instanceof l&&e.internalType.type==="nil"}write(e){switch(this.internalType.type){case"str":{let i=this.internalType.value.replaceAll(`\r
22
22
  `,`
23
23
  `);e.write(`"${i.replaceAll("\\","\\\\").replaceAll('"','\\"')}"`);break}case"int":{e.write(this.internalType.value.toString());break}case"float":{e.write(this.internalType.value.toString());break}case"bool":{e.write(this.internalType.value?"true":"false");break}case"hash":{let i=this.internalType.entries.filter(s=>!l.isNop(s.key)&&!l.isNop(s.value));if(i.length===0){e.write("{}");break}e.write(`{
24
24
  `),i.forEach((s,p)=>{p>0&&e.writeLine(","),e.indent();let a=!1;if(s.key instanceof l&&s.key.internalType.type==="str"){let w=s.key.internalType.value;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(w)&&(e.write(`${w}:`),a=!0)}a||(s.key.write(e),e.write(" =>")),e.write(" "),s.value.write(e),e.dedent()}),e.write(`
25
- }`);break}case"set":{let i=this.internalType.values.filter(s=>!l.isNop(s));if(i.length===0){e.write("Set.new([])");break}e.write("Set.new(["),i.forEach((s,p)=>{p>0&&e.write(", "),s.write(e)}),e.write("])");break}case"list":{let i=this.internalType.values.filter(s=>!l.isNop(s));if(i.length===0){e.write("[]");break}if(i.length>=2&&i.every(s=>s instanceof l&&s.internalType.type==="str"&&!/[\s\\[\]]/.test(s.internalType.value))){let s=i.map(p=>p.internalType.value);e.write(`%w[${s.join(" ")}]`);break}e.write("["),i.forEach((s,p)=>{p>0&&e.write(", "),s.write(e)}),e.write("]");break}case"nop":break;case"nil":e.write("nil");break;default:L(this.internalType)}}};c();m();d();var rt;(function(l){l[l.Invariant=0]="Invariant",l.Covariant="out",l.Contravariant="in"})(rt||(rt={}));var be=class extends B{constructor({name:e,unchecked:i,bound:s,variance:p,defaultType:a}){super();y(this,"name");y(this,"unchecked");y(this,"bound");y(this,"variance");y(this,"defaultType");this.name=e,this.unchecked=i??!1,this.bound=s,this.variance=p??rt.Invariant,this.defaultType=a}write(e){}writeTypeDefinition(e){this.unchecked&&e.write("unchecked "),this.variance!=rt.Invariant&&e.write(`${this.variance} `),e.write(this.name),this.bound&&(e.write(" < "),this.bound.writeTypeDefinition(e)),this.defaultType&&(e.write(" = "),this.defaultType.writeTypeDefinition(e))}};c();m();d();var qe=class extends W{constructor(){super(...arguments);y(this,"initializer")}write(e){e.write(`&${this.name}`)}};c();m();d();var nt=class extends B{constructor({errorClass:e,message:i}){super();y(this,"errorClass");y(this,"message");this.errorClass=e,this.message=i}write(e){e.write("raise"),this.errorClass&&(e.write(" "),this.errorClass.write(e)),this.message&&(this.errorClass&&e.write(", "),this.message.write(e))}};function it(l){return new ye(l)}function lo(){return it("true")}function po(){return it("false")}function fo(){return it("nil")}var co={positional(l){return new _e(l)},keyword(l){return new xe(l)},positionalSplat(l){return new je(l)},keywordSplat(l){return new Oe(l)},yield(l){return new qe(l)}};function mo(l){return new ue(l)}function ho(l){return new ae(l)}function yo(l){return new se(l)}function go(l){return new X(l)}function xo(l){return new be(l)}function wo(l){return new ne(l)}function bo(l){return new he(l)}function vo(l){return new ge(l)}function To(l){return new we(l)}function Ao(l){return new $e(l)}function Eo(l){return new tt(l)}function Io(l){return new et(l)}function ko(l){return new nt(l)}function Ro(l,t){let e=l;for(let i of t.toReversed())i.addStatement(e),e=i;return e}c();m();d();var ot=class l{constructor({context:t}){y(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?g.TypeLiteral.nil():(this.context.errors.add({severity:S.Critical,message:"Expected non-null value, but got null"}),g.TypeLiteral.nop());if(t.value===void 0)return g.TypeLiteral.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?g.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"set":return this.convertSet({set:t.typeReference.value,value:t.value});case"unknown":return g.TypeLiteral.nop();default:L(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let i=this.context.getValueAsBoolean({value:e});return i==null?g.TypeLiteral.nop():g.TypeLiteral.boolean(i)}case"string":{let i=this.context.getValueAsString({value:e});return i==null?g.TypeLiteral.nop():g.TypeLiteral.string(i)}default:L(t)}}convertList({list:t,value:e}){return Array.isArray(e)?g.TypeLiteral.list(e.map((i,s)=>{this.context.errors.scope({index:s});try{return this.convert({typeReference:t,value:i})}finally{this.context.errors.unscope()}})):(this.context.errors.add({severity:S.Critical,message:`Expected array but got: ${typeof e}`}),g.TypeLiteral.nop())}convertSet({set:t,value:e}){return Array.isArray(e)?g.TypeLiteral.set(e.map((i,s)=>{this.context.errors.scope({index:s});try{return this.convert({typeReference:t,value:i})}finally{this.context.errors.unscope()}})):(this.context.errors.add({severity:S.Critical,message:`Expected array but got: ${typeof e}`}),g.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:S.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),g.TypeLiteral.nop()):g.TypeLiteral.hash(Object.entries(e).map(([i,s])=>{this.context.errors.scope(i);try{return{key:this.convert({typeReference:t.key,value:i,as:"key"}),value:this.convert({typeReference:t.value,value:s})}}finally{this.context.errors.unscope()}}))}convertNamed({named:t,value:e,as:i}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:i});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"object":return this.convertObject({object:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:L(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let i=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(i==null)return g.TypeLiteral.nop();let s=i.singleDiscriminatedUnionType,p=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:i,unionVariant:s});return p==null?g.TypeLiteral.nop():g.TypeLiteral.hash(p)}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){switch(e.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:e.typeId});if(i==null)return;let s=this.convertNamed({named:i,value:t.value});return this.extractHashEntries(s)}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let i=this.context.getRecord(t.value);return i==null?[{key:g.TypeLiteral.string(this.context.getPropertyName(e.discriminantValue.name)),value:this.convert({typeReference:e.typeReference,value:t.value})}]:[{key:g.TypeLiteral.string(this.context.getPropertyName(e.discriminantValue.name)),value:this.convert({typeReference:e.typeReference,value:i[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return[];default:L(e)}}extractHashEntries(t){t instanceof g.TypeLiteral}convertEnum({enum_:t,value:e}){let i=this.getEnumValueName({enum_:t,value:e});return i==null?g.TypeLiteral.nop():g.TypeLiteral.string(i)}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:S.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let i=t.values.find(s=>s.wireValue===e);if(i==null){this.context.errors.add({severity:S.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return i.wireValue}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let i=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return i??g.TypeLiteral.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let i of t.types){let s=this.context.clone(),a=new l({context:s}).convert({typeReference:i,value:e});if(s.errors.empty())return a}this.context.errors.add({severity:S.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertPrimitive({primitive:t,value:e,as:i}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let s=this.getValueAsNumber({value:e,as:i});return s==null?g.TypeLiteral.nop():g.TypeLiteral.integer(s)}case"FLOAT":case"DOUBLE":{let s=this.getValueAsNumber({value:e});return s==null?g.TypeLiteral.nop():g.TypeLiteral.float(s)}case"BOOLEAN":{let s=this.getValueAsBoolean({value:e,as:i});return s==null?g.TypeLiteral.nop():g.TypeLiteral.boolean(s)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let s=this.context.getValueAsString({value:e});return s==null?g.TypeLiteral.nop():g.TypeLiteral.string(s)}case"UUID":{let s=this.context.getValueAsString({value:e});return s==null?g.TypeLiteral.nop():g.TypeLiteral.string(s)}case"DATE":{let s=this.context.getValueAsString({value:e});return s==null?g.TypeLiteral.nop():g.TypeLiteral.string(s)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let s=this.context.getValueAsString({value:e});return s==null?g.TypeLiteral.nop():g.TypeLiteral.string(s)}default:L(t)}}convertObject({object:t,value:e}){if(typeof e!="object"||e==null)return this.context.errors.add({severity:S.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),g.TypeLiteral.nop();let i=this.convertObjectEntries({object:t,value:e});return g.TypeLiteral.hash(i)}convertObjectEntries({object:t,value:e}){let i=typeof e=="object"&&e!=null?e:{},s=new Set(Object.keys(i)),p=[];for(let[a,w]of Object.entries(i)){this.context.errors.scope(a);let b=t.properties.find(M=>M.name.wireValue===a),R=b?.typeReference??{type:"unknown"},I=b?.name.name.snakeCase.safeName??a,C=this.convert({typeReference:R,value:w});g.TypeLiteral.isNop(C)||p.push({key:g.TypeLiteral.string(I),value:C}),this.context.errors.unscope()}for(let a of t.properties){if(s.has(a.name.wireValue)||this.context.isOptional(a.typeReference)||this.context.isNullable(a.typeReference))continue;let w=this.synthesizeDefaultValue(a.typeReference);g.TypeLiteral.isNop(w)||p.push({key:g.TypeLiteral.string(a.name.name.snakeCase.safeName),value:w})}return p.filter(a=>!g.TypeLiteral.isNop(a.value))}synthesizeDefaultValue(t,e=new Set){switch(t.type){case"optional":case"nullable":return g.TypeLiteral.nop();case"primitive":return this.synthesizeDefaultPrimitive(t.value);case"literal":return this.synthesizeDefaultLiteral(t.value);case"list":return g.TypeLiteral.list([]);case"set":return g.TypeLiteral.list([]);case"map":return g.TypeLiteral.hash([]);case"named":{if(e.has(t.value))return g.TypeLiteral.nop();let i=this.context.resolveNamedType({typeId:t.value});return i==null?g.TypeLiteral.nop():this.synthesizeDefaultNamed({named:i,typeId:t.value,seen:e})}case"unknown":return g.TypeLiteral.nop();default:L(t)}}synthesizeDefaultPrimitive(t){switch(t){case"STRING":case"BASE_64":case"BIG_INTEGER":return g.TypeLiteral.string("string");case"INTEGER":case"LONG":case"UINT":case"UINT_64":return g.TypeLiteral.integer(1);case"FLOAT":case"DOUBLE":return g.TypeLiteral.float(1.1);case"BOOLEAN":return g.TypeLiteral.boolean(!0);case"DATE":return g.TypeLiteral.string("2024-01-15");case"DATE_TIME":case"DATE_TIME_RFC_2822":return g.TypeLiteral.string("2024-01-15T09:30:00Z");case"UUID":return g.TypeLiteral.string("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32");default:L(t)}}synthesizeDefaultLiteral(t){switch(t.type){case"boolean":return g.TypeLiteral.boolean(t.value);case"string":return g.TypeLiteral.string(t.value);default:L(t)}}synthesizeDefaultNamed({named:t,typeId:e,seen:i}){let s=new Set(i);switch(s.add(e),t.type){case"alias":return this.synthesizeDefaultValue(t.typeReference,s);case"enum":{let p=t.values[0];return p==null?g.TypeLiteral.nop():g.TypeLiteral.string(p.wireValue)}case"object":{let p=[];for(let a of t.properties){if(this.context.isOptional(a.typeReference)||this.context.isNullable(a.typeReference))continue;let w=this.synthesizeDefaultValue(a.typeReference,s);g.TypeLiteral.isNop(w)||p.push({key:g.TypeLiteral.string(a.name.name.snakeCase.safeName),value:w})}return g.TypeLiteral.hash(p)}case"discriminatedUnion":case"undiscriminatedUnion":return g.TypeLiteral.nop();default:L(t)}}getValueAsNumber({value:t,as:e}){let i=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:t,as:e}){let i=e==="key"?typeof t=="string"?t==="true":!!t:t;return this.context.getValueAsBoolean({value:i})}};var st=class l extends De{constructor({ir:e,config:i}){super({ir:e,config:i});y(this,"ir");y(this,"customConfig");y(this,"dynamicTypeLiteralMapper");this.ir=e,this.customConfig=i.customConfig!=null?i.customConfig:void 0,this.dynamicTypeLiteralMapper=new ot({context:this})}clone(){return new l({ir:this.ir,config:this.config})}getRootClientClassReference(){return g.classReference({name:this.getRootClientClassName(),modules:[this.getRootModuleName()]})}getRootClientClassName(){return this.customConfig?.clientModuleName??"Client"}getRootModuleName(){return xt(this.customConfig?.moduleName??this.config.organization)}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}getEnvironmentTypeReferenceFromID(e){let i=this.resolveEnvironmentName(e);if(i!=null)return g.codeblock(s=>{s.writeNode(this.getEnvironmentClassReference()),s.write("::"),s.write(this.getEnumName(i))})}getEnvironmentClassReference(){return g.classReference({name:"Environment",modules:[this.getRootModuleName()]})}getEnumName(e){return this.getName(e.screamingSnakeCase.safeName)}getMethodName(e){return this.getName(e.snakeCase.safeName)}getPropertyName(e){return this.getName(e.snakeCase.safeName)}getName(e){return e}};c();m();d();var Un="client",No="@client",at=class{constructor({context:t,formatter:e}){y(this,"context");y(this,"formatter");this.context=t,this.formatter=e}async generateSnippet({endpoint:t,request:e}){return await this.buildCodeBlock({endpoint:t,snippet:e}).toStringAsync({customConfig:this.context.customConfig??{},formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e}){return this.buildCodeBlock({endpoint:t,snippet:e}).toString({customConfig:this.context.customConfig??{},formatter:this.formatter})}async generateSnippetAst({endpoint:t,request:e,options:i}){return i?.skipClientInstantiation?this.buildCodeBlockWithoutClient({endpoint:t,snippet:e}):this.buildCodeBlock({endpoint:t,snippet:e})}buildCodeBlock({endpoint:t,snippet:e}){return g.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),i.newLine(),i.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})}buildCodeBlockWithoutClient({endpoint:t,snippet:e}){return g.codeblock(i=>{i.writeNodeStatement(this.callMethodOnExistingClient({endpoint:t,snippet:e}))})}constructClient({endpoint:t,snippet:e}){return g.codeblock(i=>{i.addRequire(this.context.getRootModuleName().toLowerCase());let s=this.context.getRootClientClassReference(),p=this.getRootClientBuilderArgs({endpoint:t,snippet:e});i.write(`${Un} = `),i.writeNode(g.instantiateClass({classReference:s,arguments_:p}))})}getRootClientBaseUrlArg({baseUrl:t,environment:e}){if(t!=null&&e!=null)return this.context.errors.add({severity:"CRITICAL",message:"Cannot specify both baseUrl and environment options"}),[];if(t!=null)return[g.keywordArgument({name:"base_url",value:g.TypeLiteral.string(t)})];if(e!=null){if(this.context.isSingleEnvironmentID(e)){let i=this.context.getEnvironmentTypeReferenceFromID(e);return i==null?(this.context.errors.add({severity:"CRITICAL",message:`Environment ID ${e} not found`}),[]):[g.keywordArgument({name:"environment",value:i})]}if(this.context.isMultiEnvironmentValues(e))return this.context.errors.add({severity:"CRITICAL",message:"Multi-environment values are not supported in Ruby snippets yet"}),[]}return[]}getRootClientAuthArgs({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),[];switch(t.type){case"basic":return e.type==="basic"?this.getRootClientBasicAuthArgs({auth:t,values:e}):[];case"bearer":return e.type==="bearer"?this.getRootClientBearerAuthArgs({auth:t,values:e}):[];case"header":return e.type==="header"?this.getRootClientHeaderAuthArgs({auth:t,values:e}):[];case"oauth":return e.type==="oauth"?this.getRootClientOAuthArgs({auth:t,values:e}):[];case"inferred":return[];default:L(t)}}addError(t){this.context.errors.add({severity:S.Critical,message:t})}addWarning(t){this.context.errors.add({severity:S.Warning,message:t})}getRootClientBasicAuthArgs({auth:t,values:e}){let i=t,s=!!i.usernameOmit,p=!!i.passwordOmit,a=[];return s||a.push(g.keywordArgument({name:t.username.snakeCase.safeName,value:g.TypeLiteral.string(e.username)})),p||a.push(g.keywordArgument({name:t.password.snakeCase.safeName,value:g.TypeLiteral.string(e.password)})),a}getRootClientBearerAuthArgs({auth:t,values:e}){return[g.keywordArgument({name:t.token.snakeCase.safeName,value:g.TypeLiteral.string(e.token)})]}getRootClientHeaderAuthArgs({auth:t,values:e}){return[g.keywordArgument({name:t.header.name.name.snakeCase.safeName,value:g.TypeLiteral.string(e.value)})]}getRootClientOAuthArgs({auth:t,values:e}){return[g.keywordArgument({name:t.clientId.snakeCase.safeName,value:g.TypeLiteral.string(e.clientId)}),g.keywordArgument({name:t.clientSecret.snakeCase.safeName,value:g.TypeLiteral.string(e.clientSecret)})]}getRootClientHeaderArgs({headers:t,values:e}){let i=[];for(let s of t){let p=e[s.name.wireValue];p!=null&&typeof p=="string"&&i.push(g.keywordArgument({name:s.name.name.snakeCase.safeName,value:g.TypeLiteral.string(p)}))}return i}getRootClientBuilderArgs({endpoint:t,snippet:e}){let i=[];t.auth!=null&&(e.auth!=null?i.push(...this.getRootClientAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:"WARNING",message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let s=this.getRootClientBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});return s.length>0&&i.push(...s),this.context.errors.scope("Headers"),this.context.ir.headers!=null&&e.headers!=null&&i.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),i}callMethod({endpoint:t,snippet:e}){let i={on:g.codeblock(Un),method:this.getMethod({endpoint:t}),arguments_:[]};switch(t.request.type){case"inlined":i.keywordArguments=this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});break;case"body":i.keywordArguments=this.getMethodArgsForBodyRequest({request:t.request,snippet:e});break;default:L(t.request)}let s=this.getRequestOptions({endpoint:t,snippet:e});return s!=null&&(i.keywordArguments=i.keywordArguments??[],i.keywordArguments.push(s)),g.invokeMethod(i)}callMethodOnExistingClient({endpoint:t,snippet:e}){let i={on:g.codeblock(No),method:this.getMethod({endpoint:t}),arguments_:[]};switch(t.request.type){case"inlined":i.keywordArguments=this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});break;case"body":i.keywordArguments=this.getMethodArgsForBodyRequest({request:t.request,snippet:e});break;default:L(t.request)}let s=this.getRequestOptions({endpoint:t,snippet:e});return s!=null&&(i.keywordArguments=i.keywordArguments??[],i.keywordArguments.push(s)),g.invokeMethod(i)}getRequestOptions({endpoint:t,snippet:e}){let i=e.headers??{},s=Object.entries(i);if(s.length===0)return;let p=new Set;if(this.context.ir.headers!=null)for(let b of this.context.ir.headers)p.add(b.name.wireValue.toLowerCase());if(t.request.type==="inlined"&&t.request.headers!=null)for(let b of t.request.headers)p.add(b.name.wireValue.toLowerCase());let a=s.filter(([b])=>!p.has(b.toLowerCase()));if(a.length===0)return;let w=a.map(([b,R])=>({key:g.TypeLiteral.string(b),value:g.TypeLiteral.string(String(R))}));return g.keywordArgument({name:"request_options",value:g.TypeLiteral.hash([{key:g.TypeLiteral.string("additional_headers"),value:g.TypeLiteral.hash(w)}])})}getMethodArgsForInlinedRequest({request:t,snippet:e}){let i=[];if(i.push(...this.getNamedParameterArgs({kind:"PathParameters",namedParameters:t.pathParameters,values:e.pathParameters})),i.push(...this.getNamedParameterArgs({kind:"QueryParameters",namedParameters:t.queryParameters,values:e.queryParameters})),i.push(...this.getNamedParameterArgs({kind:"Headers",namedParameters:t.headers,values:e.headers})),t.body!=null&&e.requestBody!=null)switch(t.body.type){case"properties":i.push(...this.getMethodArgsForPropertiesRequest({request:t.body,snippet:e}));break;case"referenced":{let s=t.body.bodyType;if(s.type==="typeReference"){let p=s.value;if(p.type==="named"){let a=this.context.resolveNamedType({typeId:p.value});if(a!=null&&a.type==="object"){let w=this.context.getRecord(e.requestBody);if(w!=null){let b=this.getBodyFieldsAsKeywordArgs({namedType:a,bodyRecord:w});i.push(...b)}}else if(a!=null){let w=this.getBodyArgsForNonObjectType({namedType:a,typeRef:p,bodyValue:e.requestBody});i.push(...w)}}else{let a=this.context.dynamicTypeLiteralMapper.convert({typeReference:p,value:e.requestBody});g.TypeLiteral.isNop(a)||i.push(g.keywordArgument({name:t.body.bodyKey.snakeCase.safeName,value:a}))}}break}case"fileUpload":break;default:L(t.body)}return i}getNamedParameterArgs({kind:t,namedParameters:e,values:i}){let s=[];if(this.context.errors.scope(t),e!=null){let p=this.context.associateByWireValue({parameters:e,values:i??{},ignoreMissingParameters:!0});for(let a of p){let w=this.context.dynamicTypeLiteralMapper.convert(a);g.TypeLiteral.isNop(w)||s.push(g.keywordArgument({name:this.context.getPropertyName(a.name.name),value:w}))}}return this.context.errors.unscope(),s}getMethodArgsForPropertiesRequest({request:t,snippet:e}){let i=[],s=this.context.getRecord(e.requestBody)??{},p=this.context.associateByWireValue({parameters:t.value,values:s});for(let a of p){let w=this.context.dynamicTypeLiteralMapper.convert(a);g.TypeLiteral.isNop(w)||i.push(g.keywordArgument({name:this.context.getPropertyName(a.name.name),value:w}))}return i}getMethodArgsForBodyRequest({request:t,snippet:e}){let i=[];if(i.push(...this.getNamedParameterArgs({kind:"PathParameters",namedParameters:t.pathParameters,values:e.pathParameters})),t.body!=null&&e.requestBody!=null)switch(t.body.type){case"bytes":this.context.errors.add({severity:"CRITICAL",message:"Bytes request body is not supported in Ruby snippets yet"});break;case"typeReference":{let s=t.body.value;if(s.type==="named"){let p=this.context.resolveNamedType({typeId:s.value});if(p!=null&&p.type==="object"){let a=this.context.getRecord(e.requestBody);if(a!=null){let w=this.getBodyFieldsAsKeywordArgs({namedType:p,bodyRecord:a});i.push(...w)}}else if(p!=null){let a=this.getBodyArgsForNonObjectType({namedType:p,typeRef:s,bodyValue:e.requestBody});i.push(...a)}}else{let p=this.context.dynamicTypeLiteralMapper.convert({typeReference:s,value:e.requestBody});g.TypeLiteral.isNop(p)||i.push(g.keywordArgument({name:"request",value:p}))}break}default:L(t.body)}return i}getBodyArgsForNonObjectType({namedType:t,typeRef:e,bodyValue:i}){let s=[];switch(t.type){case"undiscriminatedUnion":{let p=this.context.getRecord(i);if(p!=null){for(let w of t.types)if(w.type==="named"){let b=this.context.resolveNamedType({typeId:w.value});if(b!=null&&b.type==="object"){let R=new Set(b.properties.map(M=>M.name.wireValue)),I=Object.keys(p);if(I.every(M=>R.has(M))&&I.length>0){let M=this.getBodyFieldsAsKeywordArgs({namedType:b,bodyRecord:p});return s.push(...M),s}}}}let a=this.context.dynamicTypeLiteralMapper.convert({typeReference:e,value:i});g.TypeLiteral.isNop(a)||s.push(g.keywordArgument({name:"request",value:a}));break}case"alias":{let p=t.typeReference;if(p.type==="named"){let w=this.context.resolveNamedType({typeId:p.value});if(w!=null&&w.type==="object"){let b=this.context.getRecord(i);if(b!=null){let R=this.getBodyFieldsAsKeywordArgs({namedType:w,bodyRecord:b});return s.push(...R),s}}}let a=this.context.dynamicTypeLiteralMapper.convert({typeReference:e,value:i});g.TypeLiteral.isNop(a)||s.push(g.keywordArgument({name:"request",value:a}));break}case"discriminatedUnion":case"enum":{let p=this.context.dynamicTypeLiteralMapper.convert({typeReference:e,value:i});g.TypeLiteral.isNop(p)||s.push(g.keywordArgument({name:"request",value:p}));break}case"object":break;default:L(t)}return s}getBodyFieldsAsKeywordArgs({namedType:t,bodyRecord:e}){let i=[];switch(t.type){case"object":{for(let s of t.properties){let p=s.name.wireValue,a=e[p];if(a!==void 0){this.context.errors.scope(p);let w=this.context.dynamicTypeLiteralMapper.convert({typeReference:s.typeReference,value:a});this.context.errors.unscope(),g.TypeLiteral.isNop(w)||i.push(g.keywordArgument({name:this.context.getPropertyName(s.name.name),value:w}))}}break}case"alias":case"discriminatedUnion":case"undiscriminatedUnion":case"enum":break;default:L(t)}return i}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 ut=class extends Pe{constructor({ir:e,config:i,formatter:s}){super(new st({ir:e,config:i}));y(this,"formatter");this.formatter=s}async generate(e,i={}){return super.generate(e,i)}generateSync(e){return super.generateSync(e)}async generateSnippetAst(e,i){return super.generateSnippetAst(e,i)}createSnippetGenerator(e){return new at({context:e,formatter:this.formatter})}};0&&(module.exports={DynamicSnippetsGenerator});
25
+ }`);break}case"set":{let i=this.internalType.values.filter(s=>!l.isNop(s));if(i.length===0){e.write("Set.new([])");break}e.write("Set.new(["),i.forEach((s,p)=>{p>0&&e.write(", "),s.write(e)}),e.write("])");break}case"list":{let i=this.internalType.values.filter(s=>!l.isNop(s));if(i.length===0){e.write("[]");break}if(i.length>=2&&i.every(s=>s instanceof l&&s.internalType.type==="str"&&!/[\s\\[\]]/.test(s.internalType.value))){let s=i.map(p=>p.internalType.value);e.write(`%w[${s.join(" ")}]`);break}e.write("["),i.forEach((s,p)=>{p>0&&e.write(", "),s.write(e)}),e.write("]");break}case"nop":break;case"nil":e.write("nil");break;default:L(this.internalType)}}};c();m();d();var rt;(function(l){l[l.Invariant=0]="Invariant",l.Covariant="out",l.Contravariant="in"})(rt||(rt={}));var be=class extends B{constructor({name:e,unchecked:i,bound:s,variance:p,defaultType:a}){super();y(this,"name");y(this,"unchecked");y(this,"bound");y(this,"variance");y(this,"defaultType");this.name=e,this.unchecked=i??!1,this.bound=s,this.variance=p??rt.Invariant,this.defaultType=a}write(e){}writeTypeDefinition(e){this.unchecked&&e.write("unchecked "),this.variance!=rt.Invariant&&e.write(`${this.variance} `),e.write(this.name),this.bound&&(e.write(" < "),this.bound.writeTypeDefinition(e)),this.defaultType&&(e.write(" = "),this.defaultType.writeTypeDefinition(e))}};c();m();d();var We=class extends q{constructor(){super(...arguments);y(this,"initializer")}write(e){e.write(`&${this.name}`)}};c();m();d();var nt=class extends B{constructor({errorClass:e,message:i}){super();y(this,"errorClass");y(this,"message");this.errorClass=e,this.message=i}write(e){e.write("raise"),this.errorClass&&(e.write(" "),this.errorClass.write(e)),this.message&&(this.errorClass&&e.write(", "),this.message.write(e))}};function it(l){return new ye(l)}function lo(){return it("true")}function po(){return it("false")}function fo(){return it("nil")}var co={positional(l){return new _e(l)},keyword(l){return new xe(l)},positionalSplat(l){return new je(l)},keywordSplat(l){return new Oe(l)},yield(l){return new We(l)}};function mo(l){return new ue(l)}function ho(l){return new ae(l)}function yo(l){return new se(l)}function go(l){return new X(l)}function xo(l){return new be(l)}function wo(l){return new ne(l)}function bo(l){return new he(l)}function vo(l){return new ge(l)}function To(l){return new we(l)}function Ao(l){return new $e(l)}function Eo(l){return new tt(l)}function Io(l){return new et(l)}function ko(l){return new nt(l)}function Ro(l,t){let e=l;for(let i of t.toReversed())i.addStatement(e),e=i;return e}c();m();d();var ot=class l{constructor({context:t}){y(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?g.TypeLiteral.nil():(this.context.errors.add({severity:S.Critical,message:"Expected non-null value, but got null"}),g.TypeLiteral.nop());if(t.value===void 0)return g.TypeLiteral.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?g.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"set":return this.convertSet({set:t.typeReference.value,value:t.value});case"unknown":return g.TypeLiteral.nop();default:L(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let i=this.context.getValueAsBoolean({value:e});return i==null?g.TypeLiteral.nop():g.TypeLiteral.boolean(i)}case"string":{let i=this.context.getValueAsString({value:e});return i==null?g.TypeLiteral.nop():g.TypeLiteral.string(i)}default:L(t)}}convertList({list:t,value:e}){return Array.isArray(e)?g.TypeLiteral.list(e.map((i,s)=>{this.context.errors.scope({index:s});try{return this.convert({typeReference:t,value:i})}finally{this.context.errors.unscope()}})):(this.context.errors.add({severity:S.Critical,message:`Expected array but got: ${typeof e}`}),g.TypeLiteral.nop())}convertSet({set:t,value:e}){return Array.isArray(e)?g.TypeLiteral.set(e.map((i,s)=>{this.context.errors.scope({index:s});try{return this.convert({typeReference:t,value:i})}finally{this.context.errors.unscope()}})):(this.context.errors.add({severity:S.Critical,message:`Expected array but got: ${typeof e}`}),g.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:S.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),g.TypeLiteral.nop()):g.TypeLiteral.hash(Object.entries(e).map(([i,s])=>{this.context.errors.scope(i);try{return{key:this.convert({typeReference:t.key,value:i,as:"key"}),value:this.convert({typeReference:t.value,value:s})}}finally{this.context.errors.unscope()}}))}convertNamed({named:t,value:e,as:i}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:i});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"object":return this.convertObject({object:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:L(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let i=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(i==null)return g.TypeLiteral.nop();let s=i.singleDiscriminatedUnionType,p=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:i,unionVariant:s});return p==null?g.TypeLiteral.nop():g.TypeLiteral.hash(p)}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){switch(e.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:e.typeId});if(i==null)return;let s=this.convertNamed({named:i,value:t.value});return this.extractHashEntries(s)}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let i=this.context.getRecord(t.value);return i==null?[{key:g.TypeLiteral.string(this.context.getPropertyName(e.discriminantValue.name)),value:this.convert({typeReference:e.typeReference,value:t.value})}]:[{key:g.TypeLiteral.string(this.context.getPropertyName(e.discriminantValue.name)),value:this.convert({typeReference:e.typeReference,value:i[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return[];default:L(e)}}extractHashEntries(t){t instanceof g.TypeLiteral}convertEnum({enum_:t,value:e}){let i=this.getEnumValueName({enum_:t,value:e});return i==null?g.TypeLiteral.nop():g.TypeLiteral.string(i)}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:S.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let i=t.values.find(s=>s.wireValue===e);if(i==null){this.context.errors.add({severity:S.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return i.wireValue}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let i=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return i??g.TypeLiteral.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let i of t.types){let s=this.context.clone(),a=new l({context:s}).convert({typeReference:i,value:e});if(s.errors.empty())return a}this.context.errors.add({severity:S.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertPrimitive({primitive:t,value:e,as:i}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let s=this.getValueAsNumber({value:e,as:i});return s==null?g.TypeLiteral.nop():g.TypeLiteral.integer(s)}case"FLOAT":case"DOUBLE":{let s=this.getValueAsNumber({value:e});return s==null?g.TypeLiteral.nop():g.TypeLiteral.float(s)}case"BOOLEAN":{let s=this.getValueAsBoolean({value:e,as:i});return s==null?g.TypeLiteral.nop():g.TypeLiteral.boolean(s)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let s=this.context.getValueAsString({value:e});return s==null?g.TypeLiteral.nop():g.TypeLiteral.string(s)}case"UUID":{let s=this.context.getValueAsString({value:e});return s==null?g.TypeLiteral.nop():g.TypeLiteral.string(s)}case"DATE":{let s=this.context.getValueAsString({value:e});return s==null?g.TypeLiteral.nop():g.TypeLiteral.string(s)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let s=this.context.getValueAsString({value:e});return s==null?g.TypeLiteral.nop():g.TypeLiteral.string(s)}default:L(t)}}convertObject({object:t,value:e}){if(typeof e!="object"||e==null)return this.context.errors.add({severity:S.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),g.TypeLiteral.nop();let i=this.convertObjectEntries({object:t,value:e});return g.TypeLiteral.hash(i)}convertObjectEntries({object:t,value:e}){let i=typeof e=="object"&&e!=null?e:{},s=new Set(Object.keys(i)),p=[];for(let[a,w]of Object.entries(i)){this.context.errors.scope(a);let b=t.properties.find(M=>M.name.wireValue===a),R=b?.typeReference??{type:"unknown"},I=b?.name.name.snakeCase.safeName??a,C=this.convert({typeReference:R,value:w});g.TypeLiteral.isNop(C)||p.push({key:g.TypeLiteral.string(I),value:C}),this.context.errors.unscope()}for(let a of t.properties){if(s.has(a.name.wireValue)||this.context.isOptional(a.typeReference)||this.context.isNullable(a.typeReference))continue;let w=this.synthesizeDefaultValue(a.typeReference);g.TypeLiteral.isNop(w)||p.push({key:g.TypeLiteral.string(a.name.name.snakeCase.safeName),value:w})}return p.filter(a=>!g.TypeLiteral.isNop(a.value))}synthesizeDefaultValue(t,e=new Set){switch(t.type){case"optional":case"nullable":return g.TypeLiteral.nop();case"primitive":return this.synthesizeDefaultPrimitive(t.value);case"literal":return this.synthesizeDefaultLiteral(t.value);case"list":return g.TypeLiteral.list([]);case"set":return g.TypeLiteral.list([]);case"map":return g.TypeLiteral.hash([]);case"named":{if(e.has(t.value))return g.TypeLiteral.nop();let i=this.context.resolveNamedType({typeId:t.value});return i==null?g.TypeLiteral.nop():this.synthesizeDefaultNamed({named:i,typeId:t.value,seen:e})}case"unknown":return g.TypeLiteral.nop();default:L(t)}}synthesizeDefaultPrimitive(t){switch(t){case"STRING":case"BASE_64":case"BIG_INTEGER":return g.TypeLiteral.string("string");case"INTEGER":case"LONG":case"UINT":case"UINT_64":return g.TypeLiteral.integer(1);case"FLOAT":case"DOUBLE":return g.TypeLiteral.float(1.1);case"BOOLEAN":return g.TypeLiteral.boolean(!0);case"DATE":return g.TypeLiteral.string("2024-01-15");case"DATE_TIME":case"DATE_TIME_RFC_2822":return g.TypeLiteral.string("2024-01-15T09:30:00Z");case"UUID":return g.TypeLiteral.string("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32");default:L(t)}}synthesizeDefaultLiteral(t){switch(t.type){case"boolean":return g.TypeLiteral.boolean(t.value);case"string":return g.TypeLiteral.string(t.value);default:L(t)}}synthesizeDefaultNamed({named:t,typeId:e,seen:i}){let s=new Set(i);switch(s.add(e),t.type){case"alias":return this.synthesizeDefaultValue(t.typeReference,s);case"enum":{let p=t.values[0];return p==null?g.TypeLiteral.nop():g.TypeLiteral.string(p.wireValue)}case"object":{let p=[];for(let a of t.properties){if(this.context.isOptional(a.typeReference)||this.context.isNullable(a.typeReference))continue;let w=this.synthesizeDefaultValue(a.typeReference,s);g.TypeLiteral.isNop(w)||p.push({key:g.TypeLiteral.string(a.name.name.snakeCase.safeName),value:w})}return g.TypeLiteral.hash(p)}case"discriminatedUnion":case"undiscriminatedUnion":return g.TypeLiteral.nop();default:L(t)}}getValueAsNumber({value:t,as:e}){let i=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:t,as:e}){let i=e==="key"?typeof t=="string"?t==="true":!!t:t;return this.context.getValueAsBoolean({value:i})}};var st=class l extends De{constructor({ir:e,config:i}){super({ir:e,config:i});y(this,"ir");y(this,"customConfig");y(this,"dynamicTypeLiteralMapper");this.ir=e,this.customConfig=i.customConfig!=null?i.customConfig:void 0,this.dynamicTypeLiteralMapper=new ot({context:this})}clone(){return new l({ir:this.ir,config:this.config})}getRootClientClassReference(){return g.classReference({name:this.getRootClientClassName(),modules:[this.getRootModuleName()]})}getRootClientClassName(){return this.customConfig?.clientModuleName??"Client"}getRootModuleName(){return xt(this.customConfig?.moduleName??this.config.organization)}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}getEnvironmentTypeReferenceFromID(e){let i=this.resolveEnvironmentName(e);if(i!=null)return g.codeblock(s=>{s.writeNode(this.getEnvironmentClassReference()),s.write("::"),s.write(this.getEnumName(i))})}getEnvironmentClassReference(){return g.classReference({name:"Environment",modules:[this.getRootModuleName()]})}getEnumName(e){return this.getName(e.screamingSnakeCase.safeName)}getMethodName(e){return this.getName(e.snakeCase.safeName)}getPropertyName(e){return this.getName(e.snakeCase.safeName)}getName(e){return e}};c();m();d();var Un="client",No="@client",at=class{constructor({context:t,formatter:e}){y(this,"context");y(this,"formatter");this.context=t,this.formatter=e}async generateSnippet({endpoint:t,request:e}){return await this.buildCodeBlock({endpoint:t,snippet:e}).toStringAsync({customConfig:this.context.customConfig??{},formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e}){return this.buildCodeBlock({endpoint:t,snippet:e}).toString({customConfig:this.context.customConfig??{},formatter:this.formatter})}async generateSnippetAst({endpoint:t,request:e,options:i}){return i?.skipClientInstantiation?this.buildCodeBlockWithoutClient({endpoint:t,snippet:e}):this.buildCodeBlock({endpoint:t,snippet:e})}buildCodeBlock({endpoint:t,snippet:e}){return g.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),i.newLine(),i.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})}buildCodeBlockWithoutClient({endpoint:t,snippet:e}){return g.codeblock(i=>{i.writeNodeStatement(this.callMethodOnExistingClient({endpoint:t,snippet:e}))})}constructClient({endpoint:t,snippet:e}){return g.codeblock(i=>{i.addRequire(this.context.getRootModuleName().toLowerCase());let s=this.context.getRootClientClassReference(),p=this.getRootClientBuilderArgs({endpoint:t,snippet:e});i.write(`${Un} = `),i.writeNode(g.instantiateClass({classReference:s,arguments_:p}))})}getRootClientBaseUrlArg({baseUrl:t,environment:e}){if(t!=null&&e!=null)return this.context.errors.add({severity:"CRITICAL",message:"Cannot specify both baseUrl and environment options"}),[];if(t!=null)return[g.keywordArgument({name:"base_url",value:g.TypeLiteral.string(t)})];if(e!=null){if(this.context.isSingleEnvironmentID(e)){let i=this.context.getEnvironmentTypeReferenceFromID(e);return i==null?(this.context.errors.add({severity:"CRITICAL",message:`Environment ID ${e} not found`}),[]):[g.keywordArgument({name:"environment",value:i})]}if(this.context.isMultiEnvironmentValues(e))return this.context.errors.add({severity:"CRITICAL",message:"Multi-environment values are not supported in Ruby snippets yet"}),[]}return[]}getRootClientAuthArgs({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),[];switch(t.type){case"basic":return e.type==="basic"?this.getRootClientBasicAuthArgs({auth:t,values:e}):[];case"bearer":return e.type==="bearer"?this.getRootClientBearerAuthArgs({auth:t,values:e}):[];case"header":return e.type==="header"?this.getRootClientHeaderAuthArgs({auth:t,values:e}):[];case"oauth":return e.type==="oauth"?this.getRootClientOAuthArgs({auth:t,values:e}):[];case"inferred":return[];default:L(t)}}addError(t){this.context.errors.add({severity:S.Critical,message:t})}addWarning(t){this.context.errors.add({severity:S.Warning,message:t})}getRootClientBasicAuthArgs({auth:t,values:e}){let i=t,s=!!i.usernameOmit,p=!!i.passwordOmit,a=[];return s||a.push(g.keywordArgument({name:t.username.snakeCase.safeName,value:g.TypeLiteral.string(e.username)})),p||a.push(g.keywordArgument({name:t.password.snakeCase.safeName,value:g.TypeLiteral.string(e.password)})),a}getRootClientBearerAuthArgs({auth:t,values:e}){return[g.keywordArgument({name:t.token.snakeCase.safeName,value:g.TypeLiteral.string(e.token)})]}getRootClientHeaderAuthArgs({auth:t,values:e}){return[g.keywordArgument({name:t.header.name.name.snakeCase.safeName,value:g.TypeLiteral.string(e.value)})]}getRootClientOAuthArgs({auth:t,values:e}){return[g.keywordArgument({name:t.clientId.snakeCase.safeName,value:g.TypeLiteral.string(e.clientId)}),g.keywordArgument({name:t.clientSecret.snakeCase.safeName,value:g.TypeLiteral.string(e.clientSecret)})]}getRootClientHeaderArgs({headers:t,values:e}){let i=[];for(let s of t){let p=e[s.name.wireValue];p!=null&&typeof p=="string"&&i.push(g.keywordArgument({name:s.name.name.snakeCase.safeName,value:g.TypeLiteral.string(p)}))}return i}getRootClientBuilderArgs({endpoint:t,snippet:e}){let i=[];t.auth!=null&&(e.auth!=null?i.push(...this.getRootClientAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:"WARNING",message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let s=this.getRootClientBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});return s.length>0&&i.push(...s),this.context.errors.scope("Headers"),this.context.ir.headers!=null&&e.headers!=null&&i.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),i}callMethod({endpoint:t,snippet:e}){let i={on:g.codeblock(Un),method:this.getMethod({endpoint:t}),arguments_:[]};switch(t.request.type){case"inlined":i.keywordArguments=this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});break;case"body":i.keywordArguments=this.getMethodArgsForBodyRequest({request:t.request,snippet:e});break;default:L(t.request)}let s=this.getRequestOptions({endpoint:t,snippet:e});return s!=null&&(i.keywordArguments=i.keywordArguments??[],i.keywordArguments.push(s)),g.invokeMethod(i)}callMethodOnExistingClient({endpoint:t,snippet:e}){let i={on:g.codeblock(No),method:this.getMethod({endpoint:t}),arguments_:[]};switch(t.request.type){case"inlined":i.keywordArguments=this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});break;case"body":i.keywordArguments=this.getMethodArgsForBodyRequest({request:t.request,snippet:e});break;default:L(t.request)}let s=this.getRequestOptions({endpoint:t,snippet:e});return s!=null&&(i.keywordArguments=i.keywordArguments??[],i.keywordArguments.push(s)),g.invokeMethod(i)}getRequestOptions({endpoint:t,snippet:e}){let i=e.headers??{},s=Object.entries(i);if(s.length===0)return;let p=new Set;if(this.context.ir.headers!=null)for(let b of this.context.ir.headers)p.add(b.name.wireValue.toLowerCase());if(t.request.type==="inlined"&&t.request.headers!=null)for(let b of t.request.headers)p.add(b.name.wireValue.toLowerCase());let a=s.filter(([b])=>!p.has(b.toLowerCase()));if(a.length===0)return;let w=a.map(([b,R])=>({key:g.TypeLiteral.string(b),value:g.TypeLiteral.string(String(R))}));return g.keywordArgument({name:"request_options",value:g.TypeLiteral.hash([{key:g.TypeLiteral.string("additional_headers"),value:g.TypeLiteral.hash(w)}])})}getMethodArgsForInlinedRequest({request:t,snippet:e}){let i=[];if(i.push(...this.getNamedParameterArgs({kind:"PathParameters",namedParameters:t.pathParameters,values:e.pathParameters})),i.push(...this.getNamedParameterArgs({kind:"QueryParameters",namedParameters:t.queryParameters,values:e.queryParameters})),i.push(...this.getNamedParameterArgs({kind:"Headers",namedParameters:t.headers,values:e.headers})),t.body!=null&&e.requestBody!=null)switch(t.body.type){case"properties":i.push(...this.getMethodArgsForPropertiesRequest({request:t.body,snippet:e}));break;case"referenced":{let s=t.body.bodyType;if(s.type==="typeReference"){let p=s.value;if(p.type==="named"){let a=this.context.resolveNamedType({typeId:p.value});if(a!=null&&a.type==="object"){let w=this.context.getRecord(e.requestBody);if(w!=null){let b=this.getBodyFieldsAsKeywordArgs({namedType:a,bodyRecord:w});i.push(...b)}}else if(a!=null){let w=this.getBodyArgsForNonObjectType({namedType:a,typeRef:p,bodyValue:e.requestBody});i.push(...w)}}else{let a=this.context.dynamicTypeLiteralMapper.convert({typeReference:p,value:e.requestBody});g.TypeLiteral.isNop(a)||i.push(g.keywordArgument({name:t.body.bodyKey.snakeCase.safeName,value:a}))}}break}case"fileUpload":break;default:L(t.body)}return i}getNamedParameterArgs({kind:t,namedParameters:e,values:i}){let s=[];if(this.context.errors.scope(t),e!=null){let p=this.context.associateByWireValue({parameters:e,values:i??{},ignoreMissingParameters:!0});for(let a of p){let w=this.context.dynamicTypeLiteralMapper.convert(a);g.TypeLiteral.isNop(w)||s.push(g.keywordArgument({name:this.context.getPropertyName(a.name.name),value:w}))}}return this.context.errors.unscope(),s}getMethodArgsForPropertiesRequest({request:t,snippet:e}){let i=[],s=this.context.getRecord(e.requestBody)??{},p=this.context.associateByWireValue({parameters:t.value,values:s});for(let a of p){let w=this.context.dynamicTypeLiteralMapper.convert(a);g.TypeLiteral.isNop(w)||i.push(g.keywordArgument({name:this.context.getPropertyName(a.name.name),value:w}))}return i}getMethodArgsForBodyRequest({request:t,snippet:e}){let i=[];if(i.push(...this.getNamedParameterArgs({kind:"PathParameters",namedParameters:t.pathParameters,values:e.pathParameters})),t.body!=null&&e.requestBody!=null)switch(t.body.type){case"bytes":this.context.errors.add({severity:"CRITICAL",message:"Bytes request body is not supported in Ruby snippets yet"});break;case"typeReference":{let s=t.body.value;if(s.type==="named"){let p=this.context.resolveNamedType({typeId:s.value});if(p!=null&&p.type==="object"){let a=this.context.getRecord(e.requestBody);if(a!=null){let w=this.getBodyFieldsAsKeywordArgs({namedType:p,bodyRecord:a});i.push(...w)}}else if(p!=null){let a=this.getBodyArgsForNonObjectType({namedType:p,typeRef:s,bodyValue:e.requestBody});i.push(...a)}}else{let p=this.context.dynamicTypeLiteralMapper.convert({typeReference:s,value:e.requestBody});g.TypeLiteral.isNop(p)||i.push(g.keywordArgument({name:"request",value:p}))}break}default:L(t.body)}return i}getBodyArgsForNonObjectType({namedType:t,typeRef:e,bodyValue:i}){let s=[];switch(t.type){case"undiscriminatedUnion":{let p=this.context.getRecord(i);if(p!=null){for(let w of t.types)if(w.type==="named"){let b=this.context.resolveNamedType({typeId:w.value});if(b!=null&&b.type==="object"){let R=new Set(b.properties.map(M=>M.name.wireValue)),I=Object.keys(p);if(I.every(M=>R.has(M))&&I.length>0){let M=this.getBodyFieldsAsKeywordArgs({namedType:b,bodyRecord:p});return s.push(...M),s}}}}let a=this.context.dynamicTypeLiteralMapper.convert({typeReference:e,value:i});g.TypeLiteral.isNop(a)||s.push(g.keywordArgument({name:"request",value:a}));break}case"alias":{let p=t.typeReference;if(p.type==="named"){let w=this.context.resolveNamedType({typeId:p.value});if(w!=null&&w.type==="object"){let b=this.context.getRecord(i);if(b!=null){let R=this.getBodyFieldsAsKeywordArgs({namedType:w,bodyRecord:b});return s.push(...R),s}}}let a=this.context.dynamicTypeLiteralMapper.convert({typeReference:e,value:i});g.TypeLiteral.isNop(a)||s.push(g.keywordArgument({name:"request",value:a}));break}case"discriminatedUnion":case"enum":{let p=this.context.dynamicTypeLiteralMapper.convert({typeReference:e,value:i});g.TypeLiteral.isNop(p)||s.push(g.keywordArgument({name:"request",value:p}));break}case"object":break;default:L(t)}return s}getBodyFieldsAsKeywordArgs({namedType:t,bodyRecord:e}){let i=[];switch(t.type){case"object":{for(let s of t.properties){let p=s.name.wireValue,a=e[p];if(a!==void 0){this.context.errors.scope(p);let w=this.context.dynamicTypeLiteralMapper.convert({typeReference:s.typeReference,value:a});this.context.errors.unscope(),g.TypeLiteral.isNop(w)||i.push(g.keywordArgument({name:this.context.getPropertyName(s.name.name),value:w}))}}break}case"alias":case"discriminatedUnion":case"undiscriminatedUnion":case"enum":break;default:L(t)}return i}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 ut=class extends Pe{constructor({ir:e,config:i,formatter:s}){super(new st({ir:e,config:i}));y(this,"formatter");this.formatter=s}async generate(e,i={}){return super.generate(e,i)}generateSync(e){return super.generateSync(e)}async generateSnippetAst(e,i){return super.generateSnippetAst(e,i)}createSnippetGenerator(e){return new at({context:e,formatter:this.formatter})}};0&&(module.exports={DynamicSnippetsGenerator});
26
26
  /*! Bundled license information:
27
27
 
28
28
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js: