@fern-api/ruby-dynamic-snippets 0.0.6 → 1.0.0-rc59
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/cjs/DynamicSnippetsGenerator.cjs +8 -8
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
- package/cjs/EndpointSnippetGenerator.cjs +9 -9
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
- package/cjs/EndpointSnippetGenerator.d.cts +8 -0
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +8 -8
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
- package/cjs/context/DynamicToLiteralMapper.cjs +8 -8
- package/cjs/context/DynamicToLiteralMapper.cjs.map +1 -1
- package/cjs/index.cjs +8 -8
- package/cjs/index.cjs.map +1 -1
- package/esm/DynamicSnippetsGenerator.js +1 -1
- package/esm/EndpointSnippetGenerator.d.ts +8 -0
- package/esm/EndpointSnippetGenerator.js +1 -1
- package/esm/{chunk-KACH37MO.js → chunk-E7XDZIKI.js} +2 -2
- package/esm/{chunk-24Z62MLO.js → chunk-FWYXQB4R.js} +2 -2
- package/esm/chunk-NB75HQID.js +2 -0
- package/esm/chunk-NB75HQID.js.map +1 -0
- package/esm/{chunk-CWYMFRFT.js → chunk-SWWYKNFW.js} +2 -2
- package/esm/chunk-TGWLAKQC.js +34 -0
- package/esm/chunk-TGWLAKQC.js.map +1 -0
- package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
- package/esm/context/DynamicToLiteralMapper.js +1 -1
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/esm/chunk-43L44TD5.js +0 -2
- package/esm/chunk-43L44TD5.js.map +0 -1
- package/esm/chunk-SFFHNMMU.js +0 -34
- package/esm/chunk-SFFHNMMU.js.map +0 -1
- /package/esm/{chunk-KACH37MO.js.map → chunk-E7XDZIKI.js.map} +0 -0
- /package/esm/{chunk-24Z62MLO.js.map → chunk-FWYXQB4R.js.map} +0 -0
- /package/esm/{chunk-CWYMFRFT.js.map → chunk-SWWYKNFW.js.map} +0 -0
|
@@ -36,10 +36,18 @@ declare class EndpointSnippetGenerator {
|
|
|
36
36
|
private getRootClientHeaderArgs;
|
|
37
37
|
private getRootClientBuilderArgs;
|
|
38
38
|
private callMethod;
|
|
39
|
+
/**
|
|
40
|
+
* Builds request_options from snippet headers for per-request options.
|
|
41
|
+
* This is used when generating snippets for wire tests where headers like X-Test-Id
|
|
42
|
+
* should be passed as request_options[:additional_headers] rather than as method parameters.
|
|
43
|
+
* Only includes headers that are NOT already mapped to the request directly (i.e., not defined in the IR).
|
|
44
|
+
*/
|
|
45
|
+
private getRequestOptions;
|
|
39
46
|
private getMethodArgsForInlinedRequest;
|
|
40
47
|
private getNamedParameterArgs;
|
|
41
48
|
private getMethodArgsForPropertiesRequest;
|
|
42
49
|
private getMethodArgsForBodyRequest;
|
|
50
|
+
private getBodyFieldsAsKeywordArgs;
|
|
43
51
|
private getMethod;
|
|
44
52
|
}
|
|
45
53
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var Te=Object.defineProperty,fr=Object.defineProperties,lr=Object.getOwnPropertyDescriptor,ur=Object.getOwnPropertyDescriptors,pr=Object.getOwnPropertyNames,ve=Object.getOwnPropertySymbols;var Oe=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable;var $e=(n,t,e)=>t in n?Te(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Qe=(n,t)=>{for(var e in t||(t={}))Oe.call(t,e)&&$e(n,e,t[e]);if(ve)for(var e of ve(t))Ze.call(t,e)&&$e(n,e,t[e]);return n},et=(n,t)=>fr(n,ur(t));var tt=n=>typeof n=="symbol"?n:n+"",rt=(n,t)=>{var e={};for(var r in n)Oe.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&ve)for(var r of ve(n))t.indexOf(r)<0&&Ze.call(n,r)&&(e[r]=n[r]);return e};var We=(n,t)=>()=>(n&&(t=n(n=0)),t);var nt=(n,t)=>{for(var e in t)Te(n,e,{get:t[e],enumerable:!0})},cr=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pr(t))!Oe.call(n,i)&&i!==e&&Te(n,i,{get:()=>t[i],enumerable:!(r=lr(t,i))||r.enumerable});return n};var mr=n=>cr(Te({},"__esModule",{value:!0}),n);var u=(n,t,e)=>$e(n,typeof t!="symbol"?t+"":t,e);function ot(){throw new Error("setTimeout has not been defined")}function at(){throw new Error("clearTimeout has not been defined")}function st(n){if(Y===setTimeout)return setTimeout(n,0);if((Y===ot||!Y)&&setTimeout)return Y=setTimeout,setTimeout(n,0);try{return Y(n,0)}catch(t){try{return Y.call(null,n,0)}catch(e){return Y.call(this,n,0)}}}function hr(n){if(z===clearTimeout)return clearTimeout(n);if((z===at||!z)&&clearTimeout)return z=clearTimeout,clearTimeout(n);try{return z(n)}catch(t){try{return z.call(null,n)}catch(e){return z.call(this,n)}}}function dr(){!ne||!G||(ne=!1,G.length?F=G.concat(F):be=-1,F.length&&ft())}function ft(){if(!ne){var n=st(dr);ne=!0;for(var t=F.length;t;){for(G=F,F=[];++be<t;)G&&G[be].run();be=-1,t=F.length}G=null,ne=!1,hr(n)}}function xr(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];F.push(new lt(n,t)),F.length===1&&!ne&&st(ft)}function lt(n,t){this.fun=n,this.array=t}function q(){}function Pr(n){throw new Error("process.binding is not supported")}function Fr(){return"/"}function Ur(n){throw new Error("process.chdir is not supported")}function Mr(){return 0}function _r(n){var t=Dr.call(re)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function Or(){var n=new Date,t=n-$r;return t/1e3}var Y,z,F,ne,G,be,yr,wr,gr,vr,Tr,br,Er,Ar,Rr,Sr,kr,Nr,Ir,Lr,Cr,Br,re,Dr,$r,c,it,f=We(()=>{"use strict";Y=ot,z=at;typeof globalThis.setTimeout=="function"&&(Y=setTimeout);typeof globalThis.clearTimeout=="function"&&(z=clearTimeout);F=[],ne=!1,be=-1;lt.prototype.run=function(){this.fun.apply(null,this.array)};yr="browser",wr="browser",gr=!0,vr={},Tr=[],br="",Er={},Ar={},Rr={};Sr=q,kr=q,Nr=q,Ir=q,Lr=q,Cr=q,Br=q;re=globalThis.performance||{},Dr=re.now||re.mozNow||re.msNow||re.oNow||re.webkitNow||function(){return new Date().getTime()};$r=new Date;c={nextTick:xr,title:yr,browser:gr,env:vr,argv:Tr,version:br,versions:Er,on:Sr,addListener:kr,once:Nr,off:Ir,removeListener:Lr,removeAllListeners:Cr,emit:Br,binding:Pr,cwd:Fr,chdir:Ur,umask:Mr,hrtime:_r,platform:wr,release:Ar,config:Rr,uptime:Or},it={};Object.keys(it).forEach(n=>{let t=n.split("."),e=c;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=it[n]:e=e[i]||(e[i]={})}})});function mt(){Ve=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)L[t]=n[t],S[n.charCodeAt(t)]=t;S[45]=62,S[95]=63}function jr(n){Ve||mt();var t,e,r,i,o,a,p=n.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[p-2]==="="?2:n[p-1]==="="?1:0,a=new Wr(p*3/4-o),r=o>0?p-4:p;var m=0;for(t=0,e=0;t<r;t+=4,e+=3)i=S[n.charCodeAt(t)]<<18|S[n.charCodeAt(t+1)]<<12|S[n.charCodeAt(t+2)]<<6|S[n.charCodeAt(t+3)],a[m++]=i>>16&255,a[m++]=i>>8&255,a[m++]=i&255;return o===2?(i=S[n.charCodeAt(t)]<<2|S[n.charCodeAt(t+1)]>>4,a[m++]=i&255):o===1&&(i=S[n.charCodeAt(t)]<<10|S[n.charCodeAt(t+1)]<<4|S[n.charCodeAt(t+2)]>>2,a[m++]=i>>8&255,a[m++]=i&255),a}function Vr(n){return L[n>>18&63]+L[n>>12&63]+L[n>>6&63]+L[n&63]}function Yr(n,t,e){for(var r,i=[],o=t;o<e;o+=3)r=(n[o]<<16)+(n[o+1]<<8)+n[o+2],i.push(Vr(r));return i.join("")}function ut(n){Ve||mt();for(var t,e=n.length,r=e%3,i="",o=[],a=16383,p=0,m=e-r;p<m;p+=a)o.push(Yr(n,p,p+a>m?m:p+a));return r===1?(t=n[e-1],i+=L[t>>2],i+=L[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=L[t>>10],i+=L[t>>4&63],i+=L[t<<2&63],i+="="),o.push(i),o.join("")}function Ee(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(n,t){if(Ee()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=s.prototype):(n===null&&(n=new s(t)),n.length=t),n}function s(n,t,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Ye(this,n)}return ht(this,n,t,e)}function ht(n,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?qr(n,t,e,r):typeof t=="string"?Gr(n,t,e):Hr(n,t)}function dt(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function zr(n,t,e,r){return dt(t),t<=0?U(n,t):e!==void 0?typeof r=="string"?U(n,t).fill(e,r):U(n,t).fill(e):U(n,t)}function Ye(n,t){if(dt(t),n=U(n,t<0?0:ze(t)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Gr(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=xt(t,e)|0;n=U(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function je(n,t){var e=t.length<0?0:ze(t.length)|0;n=U(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function qr(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),s.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=s.prototype):n=je(n,t),n}function Hr(n,t){if(C(t)){var e=ze(t.length)|0;return n=U(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||hn(t.length)?U(n,0):je(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return je(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ze(n){if(n>=Ee())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ee().toString(16)+" bytes");return n|0}function C(n){return!!(n!=null&&n._isBuffer)}function xt(n,t){if(C(n))return n.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var e=n.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Ae(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Et(n).length;default:if(r)return Ae(n).length;t=(""+t).toLowerCase(),r=!0}}function Kr(n,t,e){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return an(this,t,e);case"utf8":case"utf-8":return gt(this,t,e);case"ascii":return nn(this,t,e);case"latin1":case"binary":return on(this,t,e);case"base64":return tn(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sn(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function H(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function yt(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=s.from(t,r)),C(t))return t.length===0?-1:pt(n,t,e,r,i);if(typeof t=="number")return t=t&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):pt(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function pt(n,t,e,r,i){var o=1,a=n.length,p=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;o=2,a/=2,p/=2,e/=2}function m(T,P){return o===1?T[P]:T.readUInt16BE(P*o)}var h;if(i){var d=-1;for(h=e;h<a;h++)if(m(n,h)===m(t,d===-1?0:h-d)){if(d===-1&&(d=h),h-d+1===p)return d*o}else d!==-1&&(h-=h-d),d=-1}else for(e+p>a&&(e=a-p),h=e;h>=0;h--){for(var x=!0,g=0;g<p;g++)if(m(n,h+g)!==m(t,g)){x=!1;break}if(x)return h}return-1}function Jr(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var p=parseInt(t.substr(a*2,2),16);if(isNaN(p))return a;n[e+a]=p}return a}function Xr(n,t,e,r){return ke(Ae(t,n.length-e),n,e,r)}function wt(n,t,e,r){return ke(cn(t),n,e,r)}function Zr(n,t,e,r){return wt(n,t,e,r)}function Qr(n,t,e,r){return ke(Et(t),n,e,r)}function en(n,t,e,r){return ke(mn(t,n.length-e),n,e,r)}function tn(n,t,e){return t===0&&e===n.length?ut(n):ut(n.slice(t,e))}function gt(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],a=null,p=o>239?4:o>223?3:o>191?2:1;if(i+p<=e){var m,h,d,x;switch(p){case 1:o<128&&(a=o);break;case 2:m=n[i+1],(m&192)===128&&(x=(o&31)<<6|m&63,x>127&&(a=x));break;case 3:m=n[i+1],h=n[i+2],(m&192)===128&&(h&192)===128&&(x=(o&15)<<12|(m&63)<<6|h&63,x>2047&&(x<55296||x>57343)&&(a=x));break;case 4:m=n[i+1],h=n[i+2],d=n[i+3],(m&192)===128&&(h&192)===128&&(d&192)===128&&(x=(o&15)<<18|(m&63)<<12|(h&63)<<6|d&63,x>65535&&x<1114112&&(a=x))}}a===null?(a=65533,p=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=p}return rn(r)}function rn(n){var t=n.length;if(t<=ct)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=ct));return e}function nn(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function on(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function an(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",o=t;o<e;++o)i+=pn(n[o]);return i}function sn(n,t,e){for(var r=n.slice(t,e),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}function E(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function R(n,t,e,r,i,o){if(!C(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function Re(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(n.length-e,2);i<o;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function Se(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(n.length-e,4);i<o;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function vt(n,t,e,r,i,o){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Tt(n,t,e,r,i){return i||vt(n,t,e,4,34028234663852886e22,-34028234663852886e22),Rt(n,t,e,r,23,4),e+4}function bt(n,t,e,r,i){return i||vt(n,t,e,8,17976931348623157e292,-17976931348623157e292),Rt(n,t,e,r,52,8),e+8}function ln(n){if(n=un(n).replace(fn,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function un(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function pn(n){return n<16?"0"+n.toString(16):n.toString(16)}function Ae(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],a=0;a<r;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function cn(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function mn(n,t){for(var e,r,i,o=[],a=0;a<n.length&&!((t-=2)<0);++a)e=n.charCodeAt(a),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function Et(n){return jr(ln(n))}function ke(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function hn(n){return n!==n}function dn(n){return n!=null&&(!!n._isBuffer||At(n)||xn(n))}function At(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function xn(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&At(n.slice(0,0))}function Ne(n,t,e,r,i){var o,a,p=i*8-r-1,m=(1<<p)-1,h=m>>1,d=-7,x=e?i-1:0,g=e?-1:1,T=n[t+x];for(x+=g,o=T&(1<<-d)-1,T>>=-d,d+=p;d>0;o=o*256+n[t+x],x+=g,d-=8);for(a=o&(1<<-d)-1,o>>=-d,d+=r;d>0;a=a*256+n[t+x],x+=g,d-=8);if(o===0)o=1-h;else{if(o===m)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,r),o=o-h}return(T?-1:1)*a*Math.pow(2,o-r)}function Rt(n,t,e,r,i,o){var a,p,m,h=o*8-i-1,d=(1<<h)-1,x=d>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=r?0:o-1,P=r?1:-1,ge=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(p=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+x>=1?t+=g/m:t+=g*Math.pow(2,1-x),t*m>=2&&(a++,m/=2),a+x>=d?(p=0,a=d):a+x>=1?(p=(t*m-1)*Math.pow(2,i),a=a+x):(p=t*Math.pow(2,x-1)*Math.pow(2,i),a=0));i>=8;n[e+T]=p&255,T+=P,p/=256,i-=8);for(a=a<<i|p,h+=i;h>0;n[e+T]=a&255,T+=P,a/=256,h-=8);n[e+T-P]|=ge*128}var L,S,Wr,Ve,ct,fn,St=We(()=>{"use strict";f();l();L=[],S=[],Wr=typeof Uint8Array!="undefined"?Uint8Array:Array,Ve=!1;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;s.poolSize=8192;s._augment=function(n){return n.__proto__=s.prototype,n};s.from=function(n,t,e){return ht(null,n,t,e)};s.kMaxLength=Ee();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&s[Symbol.species]);s.alloc=function(n,t,e){return zr(null,n,t,e)};s.allocUnsafe=function(n){return Ye(null,n)};s.allocUnsafeSlow=function(n){return Ye(null,n)};s.isBuffer=dn;s.compare=function(t,e){if(!C(t)||!C(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,a=Math.min(r,i);o<a;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};s.isEncoding=function(t){switch(String(t).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}};s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return s.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=s.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var a=t[r];if(!C(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};s.byteLength=xt;s.prototype._isBuffer=!0;s.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)H(this,e,e+1);return this};s.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)H(this,e,e+3),H(this,e+1,e+2);return this};s.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)H(this,e,e+7),H(this,e+1,e+6),H(this,e+2,e+5),H(this,e+3,e+4);return this};s.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?gt(this,0,t):Kr.apply(this,arguments)};s.prototype.equals=function(t){if(!C(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:s.compare(this,t)===0};s.prototype.compare=function(t,e,r,i,o){if(!C(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var a=o-i,p=r-e,m=Math.min(a,p),h=this.slice(i,o),d=t.slice(e,r),x=0;x<m;++x)if(h[x]!==d[x]){a=h[x],p=d[x];break}return a<p?-1:p<a?1:0};s.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};s.prototype.indexOf=function(t,e,r){return yt(this,t,e,r,!0)};s.prototype.lastIndexOf=function(t,e,r){return yt(this,t,e,r,!1)};s.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Jr(this,t,e,r);case"utf8":case"utf-8":return Xr(this,t,e,r);case"ascii":return wt(this,t,e,r);case"latin1":case"binary":return Zr(this,t,e,r);case"base64":return Qr(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return en(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};ct=4096;s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(s.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=s.prototype;else{var o=e-t;i=new s(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+t]}return i};s.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||E(t,e,this.length);for(var i=this[t],o=1,a=0;++a<e&&(o*=256);)i+=this[t+a]*o;return i};s.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||E(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};s.prototype.readUInt8=function(t,e){return e||E(t,1,this.length),this[t]};s.prototype.readUInt16LE=function(t,e){return e||E(t,2,this.length),this[t]|this[t+1]<<8};s.prototype.readUInt16BE=function(t,e){return e||E(t,2,this.length),this[t]<<8|this[t+1]};s.prototype.readUInt32LE=function(t,e){return e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};s.prototype.readUInt32BE=function(t,e){return e||E(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};s.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||E(t,e,this.length);for(var i=this[t],o=1,a=0;++a<e&&(o*=256);)i+=this[t+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};s.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||E(t,e,this.length);for(var i=e,o=1,a=this[t+--i];i>0&&(o*=256);)a+=this[t+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};s.prototype.readInt8=function(t,e){return e||E(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};s.prototype.readInt16LE=function(t,e){e||E(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};s.prototype.readInt16BE=function(t,e){e||E(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};s.prototype.readInt32LE=function(t,e){return e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};s.prototype.readInt32BE=function(t,e){return e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};s.prototype.readFloatLE=function(t,e){return e||E(t,4,this.length),Ne(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,e){return e||E(t,4,this.length),Ne(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,e){return e||E(t,8,this.length),Ne(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,e){return e||E(t,8,this.length),Ne(this,t,!1,52,8)};s.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var a=1,p=0;for(this[e]=t&255;++p<r&&(a*=256);)this[e+p]=t/a&255;return e+r};s.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var a=r-1,p=1;for(this[e+a]=t&255;--a>=0&&(p*=256);)this[e+a]=t/p&255;return e+r};s.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Re(this,t,e,!0),e+2};s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Re(this,t,e,!1),e+2};s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Se(this,t,e,!0),e+4};s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Se(this,t,e,!1),e+4};s.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);R(this,t,e,r,o-1,-o)}var a=0,p=1,m=0;for(this[e]=t&255;++a<r&&(p*=256);)t<0&&m===0&&this[e+a-1]!==0&&(m=1),this[e+a]=(t/p>>0)-m&255;return e+r};s.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);R(this,t,e,r,o-1,-o)}var a=r-1,p=1,m=0;for(this[e+a]=t&255;--a>=0&&(p*=256);)t<0&&m===0&&this[e+a+1]!==0&&(m=1),this[e+a]=(t/p>>0)-m&255;return e+r};s.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};s.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Re(this,t,e,!0),e+2};s.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Re(this,t,e,!1),e+2};s.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Se(this,t,e,!0),e+4};s.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Se(this,t,e,!1),e+4};s.prototype.writeFloatLE=function(t,e,r){return Tt(this,t,e,!0,r)};s.prototype.writeFloatBE=function(t,e,r){return Tt(this,t,e,!1,r)};s.prototype.writeDoubleLE=function(t,e,r){return bt(this,t,e,!0,r)};s.prototype.writeDoubleBE=function(t,e,r){return bt(this,t,e,!1,r)};s.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r,a;if(this===t&&r<e&&e<i)for(a=o-1;a>=0;--a)t[a+e]=this[a+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};s.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var a;if(typeof t=="number")for(a=e;a<r;++a)this[a]=t;else{var p=C(t)?t:Ae(new s(t,i).toString()),m=p.length;for(a=0;a<r-e;++a)this[a+e]=p[a%m]}return this};fn=/[^+\/0-9A-Za-z-_]/g});var l=We(()=>{"use strict";St()});var Pi={};nt(Pi,{DynamicSnippetsGeneratorContext:()=>Xe});module.exports=mr(Pi);f();l();f();l();f();l();function b(n){throw new Error("Unexpected value: "+JSON.stringify(n))}f();l();f();l();f();l();f();l();f();l();f();l();var yn=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,kt=yn;var wn=typeof self=="object"&&self&&self.Object===Object&&self,gn=kt||wn||Function("return this")(),Nt=gn;var vn=Nt.Symbol,M=vn;f();l();var It=Object.prototype,Tn=It.hasOwnProperty,bn=It.toString,oe=M?M.toStringTag:void 0;function En(n){var t=Tn.call(n,oe),e=n[oe];try{n[oe]=void 0;var r=!0}catch(o){}var i=bn.call(n);return r&&(t?n[oe]=e:delete n[oe]),i}var Lt=En;f();l();var An=Object.prototype,Rn=An.toString;function Sn(n){return Rn.call(n)}var Ct=Sn;var kn="[object Null]",Nn="[object Undefined]",Bt=M?M.toStringTag:void 0;function In(n){return n==null?n===void 0?Nn:kn:Bt&&Bt in Object(n)?Lt(n):Ct(n)}var Pt=In;f();l();function Ln(n){return n!=null&&typeof n=="object"}var Ft=Ln;var Cn="[object Symbol]";function Bn(n){return typeof n=="symbol"||Ft(n)&&Pt(n)==Cn}var Ut=Bn;f();l();f();l();function Pn(n,t){for(var e=-1,r=n==null?0:n.length,i=Array(r);++e<r;)i[e]=t(n[e],e,n);return i}var Mt=Pn;f();l();var Fn=Array.isArray,Dt=Fn;var Un=1/0,_t=M?M.prototype:void 0,$t=_t?_t.toString:void 0;function Ot(n){if(typeof n=="string")return n;if(Dt(n))return Mt(n,Ot)+"";if(Ut(n))return $t?$t.call(n):"";var t=n+"";return t=="0"&&1/n==-Un?"-0":t}var Wt=Ot;f();l();function Mn(n){return n==null?"":Wt(n)}var jt=Mn;f();l();f();l();f();l();f();l();function Dn(n,t,e){var r=-1,i=n.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=n[r+t];return o}var Vt=Dn;function _n(n,t,e){var r=n.length;return e=e===void 0?r:e,!t&&e>=r?n:Vt(n,t,e)}var Yt=_n;f();l();var $n="\\ud800-\\udfff",On="\\u0300-\\u036f",Wn="\\ufe20-\\ufe2f",jn="\\u20d0-\\u20ff",Vn=On+Wn+jn,Yn="\\ufe0e\\ufe0f",zn="\\u200d",Gn=RegExp("["+zn+$n+Vn+Yn+"]");function qn(n){return Gn.test(n)}var Ie=qn;f();l();f();l();function Hn(n){return n.split("")}var zt=Hn;f();l();var Gt="\\ud800-\\udfff",Kn="\\u0300-\\u036f",Jn="\\ufe20-\\ufe2f",Xn="\\u20d0-\\u20ff",Zn=Kn+Jn+Xn,Qn="\\ufe0e\\ufe0f",ei="["+Gt+"]",Ge="["+Zn+"]",qe="\\ud83c[\\udffb-\\udfff]",ti="(?:"+Ge+"|"+qe+")",qt="[^"+Gt+"]",Ht="(?:\\ud83c[\\udde6-\\uddff]){2}",Kt="[\\ud800-\\udbff][\\udc00-\\udfff]",ri="\\u200d",Jt=ti+"?",Xt="["+Qn+"]?",ni="(?:"+ri+"(?:"+[qt,Ht,Kt].join("|")+")"+Xt+Jt+")*",ii=Xt+Jt+ni,oi="(?:"+[qt+Ge+"?",Ge,Ht,Kt,ei].join("|")+")",ai=RegExp(qe+"(?="+qe+")|"+oi+ii,"g");function si(n){return n.match(ai)||[]}var Zt=si;function fi(n){return Ie(n)?Zt(n):zt(n)}var Qt=fi;function li(n){return function(t){t=jt(t);var e=Ie(t)?Qt(t):void 0,r=e?e[0]:t.charAt(0),i=e?Yt(e,1).join(""):t.slice(1);return r[n]()+i}}var er=li;var ui=er("toUpperCase"),He=ui;f();l();function ae(n){return Object.keys(n)}f();l();f();l();f();l();var tr,rr,se=(rr=(tr=c.env.FERN_STACK_TRACK)==null?void 0:tr.toLowerCase())!=null?rr:"",B=se!==""&&se!=="0"&&se!=="false",Ke=["single","multiline","box"].includes(se)?se:"single";B&&(Error.stackTraceLimit=50);var pi=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),ci=new Set(["stacktrace"]);function Ce({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:o=!0,filterJs:a=!0,formatFilename:p=m=>m}={}){var h;if(!B)return[];r=[...r,...pi],e=[...e,...ci],i=[...i,"runInteractiveTask"];let m=!1;return((h=new Error().stack)!=null?h:"").split(`
|
|
2
|
-
`).map(d=>{let x=d.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(x&&x.length===5){let[,g,T,P,ge]=x;if(!g||!T||!P||!ge)return;if(
|
|
3
|
-
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},D;function nr({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:o=!0,filterJs:a=!0,multiline:p=!1,formatFilename:
|
|
1
|
+
"use strict";var Te=Object.defineProperty,fr=Object.defineProperties,lr=Object.getOwnPropertyDescriptor,ur=Object.getOwnPropertyDescriptors,pr=Object.getOwnPropertyNames,ve=Object.getOwnPropertySymbols;var Oe=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable;var $e=(n,t,e)=>t in n?Te(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Qe=(n,t)=>{for(var e in t||(t={}))Oe.call(t,e)&&$e(n,e,t[e]);if(ve)for(var e of ve(t))Ze.call(t,e)&&$e(n,e,t[e]);return n},et=(n,t)=>fr(n,ur(t));var tt=n=>typeof n=="symbol"?n:n+"",rt=(n,t)=>{var e={};for(var r in n)Oe.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&ve)for(var r of ve(n))t.indexOf(r)<0&&Ze.call(n,r)&&(e[r]=n[r]);return e};var We=(n,t)=>()=>(n&&(t=n(n=0)),t);var nt=(n,t)=>{for(var e in t)Te(n,e,{get:t[e],enumerable:!0})},cr=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pr(t))!Oe.call(n,i)&&i!==e&&Te(n,i,{get:()=>t[i],enumerable:!(r=lr(t,i))||r.enumerable});return n};var mr=n=>cr(Te({},"__esModule",{value:!0}),n);var u=(n,t,e)=>$e(n,typeof t!="symbol"?t+"":t,e);function ot(){throw new Error("setTimeout has not been defined")}function at(){throw new Error("clearTimeout has not been defined")}function st(n){if(Y===setTimeout)return setTimeout(n,0);if((Y===ot||!Y)&&setTimeout)return Y=setTimeout,setTimeout(n,0);try{return Y(n,0)}catch(t){try{return Y.call(null,n,0)}catch(e){return Y.call(this,n,0)}}}function hr(n){if(z===clearTimeout)return clearTimeout(n);if((z===at||!z)&&clearTimeout)return z=clearTimeout,clearTimeout(n);try{return z(n)}catch(t){try{return z.call(null,n)}catch(e){return z.call(this,n)}}}function dr(){!ne||!G||(ne=!1,G.length?F=G.concat(F):be=-1,F.length&&ft())}function ft(){if(!ne){var n=st(dr);ne=!0;for(var t=F.length;t;){for(G=F,F=[];++be<t;)G&&G[be].run();be=-1,t=F.length}G=null,ne=!1,hr(n)}}function xr(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];F.push(new lt(n,t)),F.length===1&&!ne&&st(ft)}function lt(n,t){this.fun=n,this.array=t}function q(){}function Pr(n){throw new Error("process.binding is not supported")}function Fr(){return"/"}function Mr(n){throw new Error("process.chdir is not supported")}function Ur(){return 0}function _r(n){var t=Dr.call(re)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function Or(){var n=new Date,t=n-$r;return t/1e3}var Y,z,F,ne,G,be,yr,wr,gr,vr,Tr,br,Er,Ar,Rr,Sr,kr,Nr,Lr,Ir,Cr,Br,re,Dr,$r,m,it,f=We(()=>{"use strict";Y=ot,z=at;typeof globalThis.setTimeout=="function"&&(Y=setTimeout);typeof globalThis.clearTimeout=="function"&&(z=clearTimeout);F=[],ne=!1,be=-1;lt.prototype.run=function(){this.fun.apply(null,this.array)};yr="browser",wr="browser",gr=!0,vr={},Tr=[],br="",Er={},Ar={},Rr={};Sr=q,kr=q,Nr=q,Lr=q,Ir=q,Cr=q,Br=q;re=globalThis.performance||{},Dr=re.now||re.mozNow||re.msNow||re.oNow||re.webkitNow||function(){return new Date().getTime()};$r=new Date;m={nextTick:xr,title:yr,browser:gr,env:vr,argv:Tr,version:br,versions:Er,on:Sr,addListener:kr,once:Nr,off:Lr,removeListener:Ir,removeAllListeners:Cr,emit:Br,binding:Pr,cwd:Fr,chdir:Mr,umask:Ur,hrtime:_r,platform:wr,release:Ar,config:Rr,uptime:Or},it={};Object.keys(it).forEach(n=>{let t=n.split("."),e=m;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=it[n]:e=e[i]||(e[i]={})}})});function mt(){Ve=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)I[t]=n[t],S[n.charCodeAt(t)]=t;S[45]=62,S[95]=63}function jr(n){Ve||mt();var t,e,r,i,o,a,p=n.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[p-2]==="="?2:n[p-1]==="="?1:0,a=new Wr(p*3/4-o),r=o>0?p-4:p;var c=0;for(t=0,e=0;t<r;t+=4,e+=3)i=S[n.charCodeAt(t)]<<18|S[n.charCodeAt(t+1)]<<12|S[n.charCodeAt(t+2)]<<6|S[n.charCodeAt(t+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=i&255;return o===2?(i=S[n.charCodeAt(t)]<<2|S[n.charCodeAt(t+1)]>>4,a[c++]=i&255):o===1&&(i=S[n.charCodeAt(t)]<<10|S[n.charCodeAt(t+1)]<<4|S[n.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=i&255),a}function Vr(n){return I[n>>18&63]+I[n>>12&63]+I[n>>6&63]+I[n&63]}function Yr(n,t,e){for(var r,i=[],o=t;o<e;o+=3)r=(n[o]<<16)+(n[o+1]<<8)+n[o+2],i.push(Vr(r));return i.join("")}function ut(n){Ve||mt();for(var t,e=n.length,r=e%3,i="",o=[],a=16383,p=0,c=e-r;p<c;p+=a)o.push(Yr(n,p,p+a>c?c:p+a));return r===1?(t=n[e-1],i+=I[t>>2],i+=I[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=I[t>>10],i+=I[t>>4&63],i+=I[t<<2&63],i+="="),o.push(i),o.join("")}function Ee(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(n,t){if(Ee()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=s.prototype):(n===null&&(n=new s(t)),n.length=t),n}function s(n,t,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Ye(this,n)}return ht(this,n,t,e)}function ht(n,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?qr(n,t,e,r):typeof t=="string"?Gr(n,t,e):Hr(n,t)}function dt(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function zr(n,t,e,r){return dt(t),t<=0?M(n,t):e!==void 0?typeof r=="string"?M(n,t).fill(e,r):M(n,t).fill(e):M(n,t)}function Ye(n,t){if(dt(t),n=M(n,t<0?0:ze(t)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Gr(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=xt(t,e)|0;n=M(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function je(n,t){var e=t.length<0?0:ze(t.length)|0;n=M(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function qr(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),s.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=s.prototype):n=je(n,t),n}function Hr(n,t){if(C(t)){var e=ze(t.length)|0;return n=M(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||hn(t.length)?M(n,0):je(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return je(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ze(n){if(n>=Ee())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ee().toString(16)+" bytes");return n|0}function C(n){return!!(n!=null&&n._isBuffer)}function xt(n,t){if(C(n))return n.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var e=n.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Ae(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Et(n).length;default:if(r)return Ae(n).length;t=(""+t).toLowerCase(),r=!0}}function Kr(n,t,e){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return an(this,t,e);case"utf8":case"utf-8":return gt(this,t,e);case"ascii":return nn(this,t,e);case"latin1":case"binary":return on(this,t,e);case"base64":return tn(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sn(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function H(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function yt(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=s.from(t,r)),C(t))return t.length===0?-1:pt(n,t,e,r,i);if(typeof t=="number")return t=t&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):pt(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function pt(n,t,e,r,i){var o=1,a=n.length,p=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;o=2,a/=2,p/=2,e/=2}function c(T,P){return o===1?T[P]:T.readUInt16BE(P*o)}var h;if(i){var d=-1;for(h=e;h<a;h++)if(c(n,h)===c(t,d===-1?0:h-d)){if(d===-1&&(d=h),h-d+1===p)return d*o}else d!==-1&&(h-=h-d),d=-1}else for(e+p>a&&(e=a-p),h=e;h>=0;h--){for(var x=!0,g=0;g<p;g++)if(c(n,h+g)!==c(t,g)){x=!1;break}if(x)return h}return-1}function Jr(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var p=parseInt(t.substr(a*2,2),16);if(isNaN(p))return a;n[e+a]=p}return a}function Xr(n,t,e,r){return ke(Ae(t,n.length-e),n,e,r)}function wt(n,t,e,r){return ke(cn(t),n,e,r)}function Zr(n,t,e,r){return wt(n,t,e,r)}function Qr(n,t,e,r){return ke(Et(t),n,e,r)}function en(n,t,e,r){return ke(mn(t,n.length-e),n,e,r)}function tn(n,t,e){return t===0&&e===n.length?ut(n):ut(n.slice(t,e))}function gt(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],a=null,p=o>239?4:o>223?3:o>191?2:1;if(i+p<=e){var c,h,d,x;switch(p){case 1:o<128&&(a=o);break;case 2:c=n[i+1],(c&192)===128&&(x=(o&31)<<6|c&63,x>127&&(a=x));break;case 3:c=n[i+1],h=n[i+2],(c&192)===128&&(h&192)===128&&(x=(o&15)<<12|(c&63)<<6|h&63,x>2047&&(x<55296||x>57343)&&(a=x));break;case 4:c=n[i+1],h=n[i+2],d=n[i+3],(c&192)===128&&(h&192)===128&&(d&192)===128&&(x=(o&15)<<18|(c&63)<<12|(h&63)<<6|d&63,x>65535&&x<1114112&&(a=x))}}a===null?(a=65533,p=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=p}return rn(r)}function rn(n){var t=n.length;if(t<=ct)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=ct));return e}function nn(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function on(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function an(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",o=t;o<e;++o)i+=pn(n[o]);return i}function sn(n,t,e){for(var r=n.slice(t,e),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}function E(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function R(n,t,e,r,i,o){if(!C(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function Re(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(n.length-e,2);i<o;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function Se(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(n.length-e,4);i<o;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function vt(n,t,e,r,i,o){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Tt(n,t,e,r,i){return i||vt(n,t,e,4,34028234663852886e22,-34028234663852886e22),Rt(n,t,e,r,23,4),e+4}function bt(n,t,e,r,i){return i||vt(n,t,e,8,17976931348623157e292,-17976931348623157e292),Rt(n,t,e,r,52,8),e+8}function ln(n){if(n=un(n).replace(fn,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function un(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function pn(n){return n<16?"0"+n.toString(16):n.toString(16)}function Ae(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],a=0;a<r;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function cn(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function mn(n,t){for(var e,r,i,o=[],a=0;a<n.length&&!((t-=2)<0);++a)e=n.charCodeAt(a),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function Et(n){return jr(ln(n))}function ke(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function hn(n){return n!==n}function dn(n){return n!=null&&(!!n._isBuffer||At(n)||xn(n))}function At(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function xn(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&At(n.slice(0,0))}function Ne(n,t,e,r,i){var o,a,p=i*8-r-1,c=(1<<p)-1,h=c>>1,d=-7,x=e?i-1:0,g=e?-1:1,T=n[t+x];for(x+=g,o=T&(1<<-d)-1,T>>=-d,d+=p;d>0;o=o*256+n[t+x],x+=g,d-=8);for(a=o&(1<<-d)-1,o>>=-d,d+=r;d>0;a=a*256+n[t+x],x+=g,d-=8);if(o===0)o=1-h;else{if(o===c)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,r),o=o-h}return(T?-1:1)*a*Math.pow(2,o-r)}function Rt(n,t,e,r,i,o){var a,p,c,h=o*8-i-1,d=(1<<h)-1,x=d>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=r?0:o-1,P=r?1:-1,ge=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(p=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+x>=1?t+=g/c:t+=g*Math.pow(2,1-x),t*c>=2&&(a++,c/=2),a+x>=d?(p=0,a=d):a+x>=1?(p=(t*c-1)*Math.pow(2,i),a=a+x):(p=t*Math.pow(2,x-1)*Math.pow(2,i),a=0));i>=8;n[e+T]=p&255,T+=P,p/=256,i-=8);for(a=a<<i|p,h+=i;h>0;n[e+T]=a&255,T+=P,a/=256,h-=8);n[e+T-P]|=ge*128}var I,S,Wr,Ve,ct,fn,St=We(()=>{"use strict";f();l();I=[],S=[],Wr=typeof Uint8Array!="undefined"?Uint8Array:Array,Ve=!1;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;s.poolSize=8192;s._augment=function(n){return n.__proto__=s.prototype,n};s.from=function(n,t,e){return ht(null,n,t,e)};s.kMaxLength=Ee();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&s[Symbol.species]);s.alloc=function(n,t,e){return zr(null,n,t,e)};s.allocUnsafe=function(n){return Ye(null,n)};s.allocUnsafeSlow=function(n){return Ye(null,n)};s.isBuffer=dn;s.compare=function(t,e){if(!C(t)||!C(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,a=Math.min(r,i);o<a;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};s.isEncoding=function(t){switch(String(t).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}};s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return s.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=s.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var a=t[r];if(!C(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};s.byteLength=xt;s.prototype._isBuffer=!0;s.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)H(this,e,e+1);return this};s.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)H(this,e,e+3),H(this,e+1,e+2);return this};s.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)H(this,e,e+7),H(this,e+1,e+6),H(this,e+2,e+5),H(this,e+3,e+4);return this};s.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?gt(this,0,t):Kr.apply(this,arguments)};s.prototype.equals=function(t){if(!C(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:s.compare(this,t)===0};s.prototype.compare=function(t,e,r,i,o){if(!C(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var a=o-i,p=r-e,c=Math.min(a,p),h=this.slice(i,o),d=t.slice(e,r),x=0;x<c;++x)if(h[x]!==d[x]){a=h[x],p=d[x];break}return a<p?-1:p<a?1:0};s.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};s.prototype.indexOf=function(t,e,r){return yt(this,t,e,r,!0)};s.prototype.lastIndexOf=function(t,e,r){return yt(this,t,e,r,!1)};s.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Jr(this,t,e,r);case"utf8":case"utf-8":return Xr(this,t,e,r);case"ascii":return wt(this,t,e,r);case"latin1":case"binary":return Zr(this,t,e,r);case"base64":return Qr(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return en(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};ct=4096;s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(s.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=s.prototype;else{var o=e-t;i=new s(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+t]}return i};s.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||E(t,e,this.length);for(var i=this[t],o=1,a=0;++a<e&&(o*=256);)i+=this[t+a]*o;return i};s.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||E(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};s.prototype.readUInt8=function(t,e){return e||E(t,1,this.length),this[t]};s.prototype.readUInt16LE=function(t,e){return e||E(t,2,this.length),this[t]|this[t+1]<<8};s.prototype.readUInt16BE=function(t,e){return e||E(t,2,this.length),this[t]<<8|this[t+1]};s.prototype.readUInt32LE=function(t,e){return e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};s.prototype.readUInt32BE=function(t,e){return e||E(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};s.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||E(t,e,this.length);for(var i=this[t],o=1,a=0;++a<e&&(o*=256);)i+=this[t+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};s.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||E(t,e,this.length);for(var i=e,o=1,a=this[t+--i];i>0&&(o*=256);)a+=this[t+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};s.prototype.readInt8=function(t,e){return e||E(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};s.prototype.readInt16LE=function(t,e){e||E(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};s.prototype.readInt16BE=function(t,e){e||E(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};s.prototype.readInt32LE=function(t,e){return e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};s.prototype.readInt32BE=function(t,e){return e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};s.prototype.readFloatLE=function(t,e){return e||E(t,4,this.length),Ne(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,e){return e||E(t,4,this.length),Ne(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,e){return e||E(t,8,this.length),Ne(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,e){return e||E(t,8,this.length),Ne(this,t,!1,52,8)};s.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var a=1,p=0;for(this[e]=t&255;++p<r&&(a*=256);)this[e+p]=t/a&255;return e+r};s.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var a=r-1,p=1;for(this[e+a]=t&255;--a>=0&&(p*=256);)this[e+a]=t/p&255;return e+r};s.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Re(this,t,e,!0),e+2};s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Re(this,t,e,!1),e+2};s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Se(this,t,e,!0),e+4};s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Se(this,t,e,!1),e+4};s.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);R(this,t,e,r,o-1,-o)}var a=0,p=1,c=0;for(this[e]=t&255;++a<r&&(p*=256);)t<0&&c===0&&this[e+a-1]!==0&&(c=1),this[e+a]=(t/p>>0)-c&255;return e+r};s.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);R(this,t,e,r,o-1,-o)}var a=r-1,p=1,c=0;for(this[e+a]=t&255;--a>=0&&(p*=256);)t<0&&c===0&&this[e+a+1]!==0&&(c=1),this[e+a]=(t/p>>0)-c&255;return e+r};s.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};s.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Re(this,t,e,!0),e+2};s.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Re(this,t,e,!1),e+2};s.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Se(this,t,e,!0),e+4};s.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Se(this,t,e,!1),e+4};s.prototype.writeFloatLE=function(t,e,r){return Tt(this,t,e,!0,r)};s.prototype.writeFloatBE=function(t,e,r){return Tt(this,t,e,!1,r)};s.prototype.writeDoubleLE=function(t,e,r){return bt(this,t,e,!0,r)};s.prototype.writeDoubleBE=function(t,e,r){return bt(this,t,e,!1,r)};s.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r,a;if(this===t&&r<e&&e<i)for(a=o-1;a>=0;--a)t[a+e]=this[a+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};s.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var a;if(typeof t=="number")for(a=e;a<r;++a)this[a]=t;else{var p=C(t)?t:Ae(new s(t,i).toString()),c=p.length;for(a=0;a<r-e;++a)this[a+e]=p[a%c]}return this};fn=/[^+\/0-9A-Za-z-_]/g});var l=We(()=>{"use strict";St()});var Mi={};nt(Mi,{DynamicSnippetsGeneratorContext:()=>Xe});module.exports=mr(Mi);f();l();f();l();f();l();function b(n){throw new Error("Unexpected value: "+JSON.stringify(n))}f();l();f();l();f();l();f();l();f();l();f();l();var yn=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,kt=yn;var wn=typeof self=="object"&&self&&self.Object===Object&&self,gn=kt||wn||Function("return this")(),Nt=gn;var vn=Nt.Symbol,U=vn;f();l();var Lt=Object.prototype,Tn=Lt.hasOwnProperty,bn=Lt.toString,oe=U?U.toStringTag:void 0;function En(n){var t=Tn.call(n,oe),e=n[oe];try{n[oe]=void 0;var r=!0}catch(o){}var i=bn.call(n);return r&&(t?n[oe]=e:delete n[oe]),i}var It=En;f();l();var An=Object.prototype,Rn=An.toString;function Sn(n){return Rn.call(n)}var Ct=Sn;var kn="[object Null]",Nn="[object Undefined]",Bt=U?U.toStringTag:void 0;function Ln(n){return n==null?n===void 0?Nn:kn:Bt&&Bt in Object(n)?It(n):Ct(n)}var Pt=Ln;f();l();function In(n){return n!=null&&typeof n=="object"}var Ft=In;var Cn="[object Symbol]";function Bn(n){return typeof n=="symbol"||Ft(n)&&Pt(n)==Cn}var Mt=Bn;f();l();f();l();function Pn(n,t){for(var e=-1,r=n==null?0:n.length,i=Array(r);++e<r;)i[e]=t(n[e],e,n);return i}var Ut=Pn;f();l();var Fn=Array.isArray,Dt=Fn;var Mn=1/0,_t=U?U.prototype:void 0,$t=_t?_t.toString:void 0;function Ot(n){if(typeof n=="string")return n;if(Dt(n))return Ut(n,Ot)+"";if(Mt(n))return $t?$t.call(n):"";var t=n+"";return t=="0"&&1/n==-Mn?"-0":t}var Wt=Ot;f();l();function Un(n){return n==null?"":Wt(n)}var jt=Un;f();l();f();l();f();l();f();l();function Dn(n,t,e){var r=-1,i=n.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=n[r+t];return o}var Vt=Dn;function _n(n,t,e){var r=n.length;return e=e===void 0?r:e,!t&&e>=r?n:Vt(n,t,e)}var Yt=_n;f();l();var $n="\\ud800-\\udfff",On="\\u0300-\\u036f",Wn="\\ufe20-\\ufe2f",jn="\\u20d0-\\u20ff",Vn=On+Wn+jn,Yn="\\ufe0e\\ufe0f",zn="\\u200d",Gn=RegExp("["+zn+$n+Vn+Yn+"]");function qn(n){return Gn.test(n)}var Le=qn;f();l();f();l();function Hn(n){return n.split("")}var zt=Hn;f();l();var Gt="\\ud800-\\udfff",Kn="\\u0300-\\u036f",Jn="\\ufe20-\\ufe2f",Xn="\\u20d0-\\u20ff",Zn=Kn+Jn+Xn,Qn="\\ufe0e\\ufe0f",ei="["+Gt+"]",Ge="["+Zn+"]",qe="\\ud83c[\\udffb-\\udfff]",ti="(?:"+Ge+"|"+qe+")",qt="[^"+Gt+"]",Ht="(?:\\ud83c[\\udde6-\\uddff]){2}",Kt="[\\ud800-\\udbff][\\udc00-\\udfff]",ri="\\u200d",Jt=ti+"?",Xt="["+Qn+"]?",ni="(?:"+ri+"(?:"+[qt,Ht,Kt].join("|")+")"+Xt+Jt+")*",ii=Xt+Jt+ni,oi="(?:"+[qt+Ge+"?",Ge,Ht,Kt,ei].join("|")+")",ai=RegExp(qe+"(?="+qe+")|"+oi+ii,"g");function si(n){return n.match(ai)||[]}var Zt=si;function fi(n){return Le(n)?Zt(n):zt(n)}var Qt=fi;function li(n){return function(t){t=jt(t);var e=Le(t)?Qt(t):void 0,r=e?e[0]:t.charAt(0),i=e?Yt(e,1).join(""):t.slice(1);return r[n]()+i}}var er=li;var ui=er("toUpperCase"),He=ui;f();l();function ae(n){return Object.keys(n)}f();l();f();l();f();l();var tr,rr,se=(rr=(tr=m.env.FERN_STACK_TRACK)==null?void 0:tr.toLowerCase())!=null?rr:"",B=se!==""&&se!=="0"&&se!=="false",Ke=["single","multiline","box"].includes(se)?se:"single";B&&(Error.stackTraceLimit=50);var pi=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),ci=new Set(["stacktrace"]);function Ce({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:o=!0,filterJs:a=!0,formatFilename:p=c=>c}={}){var h;if(!B)return[];r=[...r,...pi],e=[...e,...ci],i=[...i,"runInteractiveTask"];let c=!1;return((h=new Error().stack)!=null?h:"").split(`
|
|
2
|
+
`).map(d=>{let x=d.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(x&&x.length===5){let[,g,T,P,ge]=x;if(!g||!T||!P||!ge)return;if(c||i.some(sr=>g==null?void 0:g.includes(sr))){c=!0;return}switch(g){case"Object.<anonymous>":g="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":g=`${g.substring(g.indexOf(".")+1)}()=> { ... }`;break}return{fn:g,path:p(T),position:`${P}:${ge}`}}}).filter(d=>{var x,g;return d&&!r.some(T=>d.fn.includes(T))&&!(o&&((x=d.path)!=null&&x.startsWith("node:")))&&!(a&&((g=d.path)!=null&&g.endsWith(".js")))&&!e.some(T=>d.path.includes(T))}).slice(t,t+n)}var Ie=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:r=[],filterFunctions:i=[],stopOn:o=[],filterNode:a=!0,filterJs:p=!0,multiline:c=!1,formatFilename:h=d=>d}={}){u(this,"maxFrames");u(this,"skip");u(this,"filterPaths");u(this,"filterFunctions");u(this,"stopOn");u(this,"filterNode");u(this,"filterJs");u(this,"multiline");u(this,"formatFilename");u(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=r,this.filterFunctions=i,this.stopOn=o,this.filterNode=a,this.filterJs=p,this.multiline=c,this.formatFilename=h}tag(t){let e=this.tracking.get(t)||new Set;Ce({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>e.add(r)),this.tracking.set(t,e)}trace(t){if(!B)return"";let e=this.tracking.get(t);return e?[...e].map(r=>`${this.multiline?`
|
|
3
|
+
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},D;function nr({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:o=!0,filterJs:a=!0,multiline:p=!1,formatFilename:c=h=>h}={}){B&&(D!=null||(D=new Ie({maxFrames:n,skip:t,filterPaths:e,filterFunctions:r,stopOn:i,filterNode:o,filterJs:a,multiline:p,formatFilename:c})))}function ir(n){D==null||D.tag(n)}function Je(n){var t;return(t=D==null?void 0:D.frames(n))!=null?t:[]}var K=class{constructor(){ir(this)}};f();l();var Be=class{formatMultiple(t){return Promise.all(t.map(e=>this.format(e)))}formatMultipleSync(t){return t.map(e=>this.formatSync(e))}},fe=class extends Be{async format(t){return t}formatSync(t){return t}};f();l();f();l();f();l();var N=class extends K{constructor(e){super();u(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 mi=4;nr({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var le=class{constructor(){u(this,"lineBuffer",[]);u(this,"indentLevel",0);u(this,"hasWrittenAnything",!1);u(this,"lastCharacterIsSemicolon",!1);u(this,"lastCharacterIsNewline",!1);u(this,"nodeStackFrames",[])}get buffer(){return B&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
4
4
|
`),this.lineBuffer.join(`
|
|
5
5
|
`)+(this.lastCharacterIsNewline?`
|
|
6
6
|
`:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let r=e.length>0&&e.endsWith(`
|
|
@@ -12,15 +12,15 @@ ${o}`);this.isAtStartOfLine()&&(a=o+a),r&&(a+=`
|
|
|
12
12
|
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
13
13
|
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let o=1;o<t.length;o++){this.write(e);let a=t[o];a!=null&&r(a)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
|
|
14
14
|
`),this.lastCharacterIsSemicolon=t.endsWith(";");let r=t.split(`
|
|
15
|
-
`),i=B&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),i&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(r=>`${e?`(${e}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(Ce({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,Ke){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return mi}};f();l();f();l();f();l();f();l();var ue=class{constructor(){u(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let r=t.match(this.REFERENCE_REGEX);if(!(r==null||r[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};f();l();var v={Critical:"CRITICAL",Warning:"WARNING"},pe=class n{constructor(){u(this,"errors");u(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(et(Qe({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new n;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let r of t){if(typeof r=="string"){e.push(r);continue}e[e.length-1]+=`[${r.index}]`}return e}};var ce=class{constructor({ir:t,config:e,options:r={}}){u(this,"config");u(this,"options");u(this,"errors");u(this,"_ir");u(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=r,this.errors=new pe,this.httpEndpointReferenceParser=new ue}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let a=t.find(m=>m.name.wireValue===i);if(a==null)throw this.newParameterNotRecognizedError(i);let p=this.isListTypeReference(a.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:a.name,typeReference:a.typeReference,value:p})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:t,values:e}){let r=[];for(let i of t){this.errors.scope(i.name.wireValue);try{let o=e[i.name.wireValue];if(o==null)if(i.typeReference.type==="primitive"&&i.typeReference.value==="STRING")o=`<${i.name.wireValue}>`;else{this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i.name.wireValue).message});continue}r.push({name:i.name,typeReference:i.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let i=[];for(let[o,a]of Object.entries(e)){this.errors.scope(o);try{let p=t.find(m=>m.name.wireValue===o);if(p==null){if(r)continue;this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:p.name,typeReference:p.typeReference,value:a})}finally{this.errors.unscope()}}return i}getExampleObjectProperties({parameters:t,snippetObject:e}){let r=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},i=[];for(let o of t){let a=r[o.name.wireValue];a==null?o.typeReference.type==="nullable"&&i.push({name:o.name,typeReference:o.typeReference,value:null}):i.push({name:o.name,typeReference:o.typeReference,value:a})}return i}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:v.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:t,record:e}){let r=e[t.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let i=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}i.push(o)}return i}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:v.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:v.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let r=this.getRecord(e);if(r==null)return;let i=t.discriminant.wireValue,o=r[i];if(o==null){this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let a=t.types[o];if(a==null){this.errors.add({severity:v.Critical,message:`No type found for discriminant value "${o}"`});return}let h=r,{[i]:p}=h,m=rt(h,[tt(i)]);return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:m}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:t})&&e.push(r);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){var i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:r}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var r,i;return e&&((i=(r=t.metadata)==null?void 0:r.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:b(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}case"multipleBaseUrls":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}default:b(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=e.environments[0];if(r==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(ae(r.urls));for(let o of ae(t))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:v.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${ae(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:b(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:b(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:b(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};f();l();f();l();f();l();var hi=2,k=class extends le{constructor({customConfig:e,formatter:r}){super();u(this,"customConfig");u(this,"formatter");u(this,"requires",new Set);this.customConfig=e,this.formatter=r!=null?r:new fe}addRequire(e){this.requires.add(e)}getTabSize(){return hi}};var ie=class extends k{constructor({customConfig:t,formatter:e}){super({customConfig:t,formatter:e})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format Ruby file: ${e}
|
|
15
|
+
`),i=B&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),i&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(r=>`${e?`(${e}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(Ce({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,Ke){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return mi}};f();l();f();l();f();l();f();l();var ue=class{constructor(){u(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let r=t.match(this.REFERENCE_REGEX);if(!(r==null||r[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};f();l();var v={Critical:"CRITICAL",Warning:"WARNING"},pe=class n{constructor(){u(this,"errors");u(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(et(Qe({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new n;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let r of t){if(typeof r=="string"){e.push(r);continue}e[e.length-1]+=`[${r.index}]`}return e}};var ce=class{constructor({ir:t,config:e,options:r={}}){u(this,"config");u(this,"options");u(this,"errors");u(this,"_ir");u(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=r,this.errors=new pe,this.httpEndpointReferenceParser=new ue}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let a=t.find(c=>c.name.wireValue===i);if(a==null)throw this.newParameterNotRecognizedError(i);let p=this.isListTypeReference(a.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:a.name,typeReference:a.typeReference,value:p})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:t,values:e}){let r=[];for(let i of t){this.errors.scope(i.name.wireValue);try{let o=e[i.name.wireValue];if(o==null)if(i.typeReference.type==="primitive"&&i.typeReference.value==="STRING")o=`<${i.name.wireValue}>`;else{this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i.name.wireValue).message});continue}r.push({name:i.name,typeReference:i.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let i=[];for(let[o,a]of Object.entries(e)){this.errors.scope(o);try{let p=t.find(c=>c.name.wireValue===o);if(p==null){if(r)continue;this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:p.name,typeReference:p.typeReference,value:a})}finally{this.errors.unscope()}}return i}getExampleObjectProperties({parameters:t,snippetObject:e}){let r=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},i=[];for(let o of t){let a=r[o.name.wireValue];a==null?o.typeReference.type==="nullable"&&i.push({name:o.name,typeReference:o.typeReference,value:null}):i.push({name:o.name,typeReference:o.typeReference,value:a})}return i}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:v.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:t,record:e}){let r=e[t.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let i=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}i.push(o)}return i}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:v.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:v.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let r=this.getRecord(e);if(r==null)return;let i=t.discriminant.wireValue,o=r[i];if(o==null){this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let a=t.types[o];if(a==null){this.errors.add({severity:v.Critical,message:`No type found for discriminant value "${o}"`});return}let h=r,{[i]:p}=h,c=rt(h,[tt(i)]);return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:c}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:t})&&e.push(r);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){var i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:r}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var r,i;return e&&((i=(r=t.metadata)==null?void 0:r.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:b(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}case"multipleBaseUrls":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}default:b(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=e.environments[0];if(r==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(ae(r.urls));for(let o of ae(t))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:v.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${ae(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:b(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:b(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:b(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};f();l();f();l();f();l();var hi=2,k=class extends le{constructor({customConfig:e,formatter:r}){super();u(this,"customConfig");u(this,"formatter");u(this,"requires",new Set);u(this,"_indentLevel",0);this.customConfig=e,this.formatter=r!=null?r:new fe}addRequire(e){this.requires.add(e)}get currentIndentLevel(){return this._indentLevel}indent(){this._indentLevel++,super.indent()}dedent(){this._indentLevel--,super.dedent()}getTabSize(){return hi}};var ie=class extends k{constructor({customConfig:t,formatter:e}){super({customConfig:t,formatter:e})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format Ruby file: ${e}
|
|
16
16
|
${t}`)}return t}toString(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(t)}catch(e){throw new Error(`Failed to format Ruby file: ${e}
|
|
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 y={};nt(y,{AstNode:()=>w,ClassInstantiation:()=>J,ClassReference:()=>_,Class_:()=>V,CodeBlock:()=>X,KeywordArgument:()=>Z,KeywordParameter:()=>Q,Method:()=>W,MethodInvocation:()=>ee,MethodKind:()=>O,Module_:()=>j,Parameter:()=>A,Type:()=>$,TypeLiteral:()=>ye,TypeParameter:()=>te,Writer:()=>k,begin:()=>
|
|
21
|
-
`).forEach(r=>{e.writeLine(`# ${r}`)})}};f();l();f();l();f();l();var _=class extends w{constructor({name:e,modules:r,fullyQualified:i}){super();u(this,"name");u(this,"modules");u(this,"fullyQualified");this.name=e,this.modules=r!=null?r:[],this.fullyQualified=i!=null?i:!1}write(e){if(this.fullyQualified||this.modules.length>0){let r=[...this.modules,this.name].join("::");e.write(r);return}e.write(this.name)}};var $=class n extends w{constructor(e){super();u(this,"internalType");this.internalType=e}write(e){var r,i,o;if(this.internalType)switch((r=this.internalType)==null?void 0:r.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&&((o=(i=this.internalType.elems[1])==null?void 0:i.internalType)==null?void 0:o.type)==="nil"){let a=this.internalType.elems[0];a!=null&&a.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:b(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:r=>r.writeTypeDefinition(e)});break;case"intersection":e.delimit({nodes:this.internalType.elems,delimiter:" & ",writeFunction:r=>r.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:r=>r.write(e)}),e.write("]");break;case"generic":e.write(`${this.internalType.baseKlass}[`),e.delimit({nodes:this.internalType.parameters,delimiter:", ",writeFunction:r=>r.writeTypeDefinition(e)}),e.write("]");break;default:b(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 _({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,r){return new this({type:"hash",keyType:e,valueType:r})}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,r){return new this({type:"generic",baseKlass:e,parameters:r})}static nilable(e){return n.union([e,n.nil()])}nilable(){return n.nilable(this)}};var O={Instance:"instance",Class_:"class"},or={Public:"public",Private:"private",Protected:"protected"},W=class extends w{constructor({name:e,docstring:r,kind:i,visibility:o,parameters:a,returnType:p,statements:m,splatOptionDocs:h}){var d,x;super();u(this,"name");u(this,"docstring");u(this,"kind");u(this,"positionalParameters");u(this,"keywordParameters");u(this,"positionalSplatParameter");u(this,"keywordSplatParameter");u(this,"yieldParameter");u(this,"visibility");u(this,"statements");u(this,"returnType");u(this,"splatOptionDocs");this.name=e,this.docstring=r,this.kind=i!=null?i:O.Instance,this.visibility=o!=null?o:or.Public,this.positionalParameters=(d=a==null?void 0:a.positional)!=null?d:[],this.keywordParameters=(x=a==null?void 0:a.keyword)!=null?x:[],this.positionalSplatParameter=a==null?void 0:a.positionalSplat,this.keywordSplatParameter=a==null?void 0:a.keywordSplat,this.yieldParameter=a==null?void 0:a.yield,this.returnType=p!=null?p:$.untyped(),this.statements=m!=null?m:[],this.splatOptionDocs=h!=null?h:[]}addStatement(e){this.statements.push(e)}write(e){this.docstring&&new I({docs:this.docstring}).write(e);let r=this.positionalParameters.length>0||this.keywordParameters.length>0||this.keywordSplatParameter!=null;this.docstring&&r&&e.writeLine("#");for(let i of this.positionalParameters){e.write(`# @option ${i.name} [`);let o=new k({customConfig:e.customConfig});i.type.writeTypeDefinition(o),e.write(this.normalizeForYard(o.toString())),e.write("]"),e.newLine()}for(let i of this.keywordParameters){e.write(`# @param ${i.name} [`);let o=new k({customConfig:e.customConfig});i.type.writeTypeDefinition(o),e.write(this.normalizeForYard(o.toString())),e.write("]"),i.docs&&e.write(` ${i.docs}`),e.newLine()}if(this.keywordSplatParameter!=null){e.write(`# @param ${this.keywordSplatParameter.name} [`);let i=new k({customConfig:e.customConfig});this.keywordSplatParameter.type.writeTypeDefinition(i),e.write(this.normalizeForYard(i.toString())),e.write("]"),this.keywordSplatParameter.docs&&e.write(` ${this.keywordSplatParameter.docs}`),e.newLine()}for(let i of this.splatOptionDocs)e.writeLine(`# ${i}`);if(this.returnType!=null){(r||this.docstring)&&e.writeLine("#"),e.write("# @return [");let i=new k({customConfig:e.customConfig});this.returnType.writeTypeDefinition(i),e.write(this.normalizeForYard(i.toString())),e.write("]"),e.newLine()}switch(this.visibility!==or.Public&&(e.write(this.visibility),this.kind===O.Class_&&e.write("_class_method"),e.write(" ")),this.kind){case O.Instance:e.write(`def ${this.name}`);break;case O.Class_:e.write(`def self.${this.name}`);break}this.parameters.length&&(e.write("("),e.delimit({nodes:this.parameters,delimiter:", ",writeFunction:i=>i.write(e)}),e.write(")")),this.statements.length?(e.newLine(),e.indent(),this.statements.forEach((i,o)=>{i.write(e),o<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((r,i)=>{r.writeTypeDefinition(e),i<this.parameters.length-1&&e.write(", ")}),e.write(") -> "),this.returnType.writeTypeDefinition(e)}normalizeForYard(e){let r=e.replace(/\s*\|\s*/g,", ");return r=r.replace(/\bbool\b/g,"Boolean"),r=r.replace(/(^|,\s*)nil(?:,\s*nil)+(?=,|\]|$)/g,"$1nil"),r=r.replace(/Hash\[untyped,\s*untyped\]/g,"Hash"),r}get parameters(){return[...this.positionalParameters,...this.keywordParameters,this.positionalSplatParameter,this.keywordSplatParameter,this.yieldParameter].flatMap(e=>e!==void 0?e:[])}};f();l();var j=class n extends w{constructor({name:e,namespace:r,typeParameters:i,docstring:o,statements:a}){super();u(this,"name");u(this,"namespace");u(this,"typeParameters");u(this,"docstring");u(this,"statements");this.name=e,this.namespace=r!=null?r:new Set,this.typeParameters=i!=null?i:[],this.docstring=o,this.statements=a!=null?a:[],this.populateChildNamespaces()}addStatement(e){this.statements.push(e)}write(e){this.docstring&&new I({docs:this.docstring}).write(e),e.write(`module ${this.name}`),this.statements.length?(e.newLine(),e.indent(),this.statements.forEach((r,i)=>{r.write(e),i<this.statements.length-1&&e.newLine()}),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:r=>r.writeTypeDefinition(e)}),e.write("]")),e.newLine(),this.statements.length&&(e.indent(),this.statements.forEach(r=>{r.writeTypeDefinition(e),e.newLine()}),e.dedent()),e.write("end")}populateChildNamespaces(){this.statements.filter(e=>e instanceof n||e instanceof V).forEach(e=>{e.namespace=new Set([...this.namespace,this]),e.populateChildNamespaces()})}get fullyQualifiedNamespace(){return[...this.namespace,this].map(e=>e.name).join("::")}};var V=class extends j{constructor({name:e,superclass:r,typeParameters:i,docstring:o,statements:a}){super({name:e,docstring:o,typeParameters:i});u(this,"superclass");u(this,"statements");u(this,"methods",[]);this.superclass=r,this.statements=a!=null?a:[]}addStatement(e){this.statements.push(e)}addStatements(e){this.statements.push(...e)}addInstanceMethod(e,r,i){let o=new W({name:e,kind:O.Instance,returnType:r,statements:i});this.addMethod(o)}addMethod(e){this.methods.push(e)}addMethods(e){e.forEach(r=>this.addMethod(r))}write(e){if(this.docstring&&new I({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((r,i)=>{r.write(e),e.newLine()}),e.dedent()),this.methods.length&&(e.newLine(),e.indent(),this.methods.forEach(r=>{r.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:r=>r.writeTypeDefinition(e)}),e.write("]")),this.superclass&&(e.write(" < "),this.superclass.write(e)),e.newLine(),this.statements.length&&(e.indent(),this.statements.forEach(r=>{r.writeTypeDefinition(e),e.newLine()}),e.dedent()),e.write("end")}};f();l();var J=class extends w{constructor({classReference:e,arguments_:r}){super();u(this,"classReference");u(this,"arguments_");this.classReference=e,this.arguments_=r}write(e){e.writeNode(this.classReference),e.write("."),e.write("new"),e.write("("),this.arguments_.length>1?(e.indent(),e.newLine(),this.arguments_.forEach((r,i)=>{i>0&&(e.write(","),e.newLine()),r.write(e)}),e.newLine(),e.dedent()):this.arguments_.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write(")")}};f();l();var X=class extends w{constructor(e){super();u(this,"arg");this.arg=e}write(e){return new N(this.arg).write(e)}};f();l();var Z=class extends w{constructor({name:e,value:r}){super();u(this,"name");u(this,"value");this.name=e,this.value=r}write(e){e.write(`${this.name}: `),this.value.write(e)}};f();l();f();l();var A=class extends w{constructor({name:e,type:r,optional:i,docs:o}){super();u(this,"name");u(this,"type");u(this,"optional");u(this,"docs");this.name=e,this.type=r!=null?r:$.untyped(),this.optional=i!=null?i:!1,this.docs=o}};var Q=class extends A{constructor({name:e,type:r,initializer:i,optional:o}){super({name:e,type:r,optional:o});u(this,"initializer");this.initializer=i}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)}};f();l();var me=class extends A{constructor(){super(...arguments);u(this,"initializer")}write(e){e.write(`**${this.name}`)}writeTypeDefinition(e){e.write("**"),this.type.writeTypeDefinition(e)}};f();l();var ee=class extends w{constructor({on:e,method:r,arguments_:i,keywordArguments:o,block:a}){super();u(this,"on");u(this,"method");u(this,"arguments_");u(this,"keywordArguments");u(this,"block");this.on=e,this.method=r,this.arguments_=i,this.keywordArguments=o,this.block=a}write(e){this.on.write(e),e.write("."),e.write(this.method),e.write("(");let r=[];for(let i of this.arguments_)r.push({kind:"positional",node:i});for(let i of this.keywordArguments||[])r.push({kind:"keyword",arg:i});if(r.length>1?(e.indent(),e.newLine(),r.forEach((i,o)=>{o>0&&(e.write(","),e.newLine()),ar(e,i)}),e.newLine(),e.dedent()):r.forEach((i,o)=>{o>0&&e.write(", "),ar(e,i)}),e.write(")"),this.block){let[i,o]=this.block;e.write(" do"),i.length>0&&(e.write(" |"),i.forEach((a,p)=>{p>0&&e.write(", "),e.write(a)}),e.write("|")),e.newLine(),e.indent();for(let a of o)a.write(e),e.writeNewLineIfLastLineNot();e.dedent(),e.write("end")}}};function ar(n,t){switch(t.kind){case"positional":t.node.write(n);break;case"keyword":t.arg.write(n);break;default:b(t)}}f();l();var he=class extends w{constructor({value:e}){super();u(this,"value");this.value=e}write(e){this.value.write(e)}};f();l();var de=class extends A{constructor({name:e,type:r,optional:i,initializer:o}){super({name:e,type:r,optional:i});u(this,"initializer");this.initializer=o}write(e){e.write(this.name),this.initializer&&e.write(` = ${this.initializer.write(e)}`)}writeTypeDefinition(e){this.optional&&e.write("?"),this.type.writeTypeDefinition(e)}};f();l();var xe=class extends A{write(t){t.write(`*${this.name}`)}writeTypeDefinition(t){t.write("*"),this.type.writeTypeDefinition(t)}};f();l();var ye=class n extends w{constructor(e){super();u(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 n&&e.internalType.type==="nop"}static isNil(e){return e instanceof n&&e.internalType.type==="nil"}write(e){switch(this.internalType.type){case"str":{this.internalType.value.includes("'")||this.internalType.value.includes("#")?e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`):e.write(`'${this.internalType.value}'`);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 r=this.internalType.entries.filter(i=>!n.isNop(i.key)&&!n.isNop(i.value));if(r.length===0){e.write("{}");break}e.write(`{
|
|
22
|
-
`),r.forEach((i,o)=>{o>0&&e.writeLine(","),e.indent();let a=!1;if(i.key instanceof n&&i.key.internalType.type==="str"){let p=i.key.internalType.value;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(p)&&(e.write(`${p}:`),a=!0)}a||(i.key.write(e),e.write("
|
|
23
|
-
}`);break}case"set":{let r=this.internalType.values.filter(i=>!n.isNop(i));if(r.length===0){e.write("Set.new([])");break}e.write("Set.new(["),r.forEach((i,o)=>{o>0&&e.write(", "),i.write(e)}),e.write("])");break}case"list":{let r=this.internalType.values.filter(i=>!n.isNop(i));if(r.length===0){e.write("[]");break}e.write("["),r.forEach((i,o)=>{o>0&&e.write(", "),i.write(e)}),e.write("]");break}case"nop":break;case"nil":e.write("nil");break;default:b(this.internalType)}}};f();l();var Pe;(function(n){n[n.Invariant=0]="Invariant",n.Covariant="out",n.Contravariant="in"})(Pe||(Pe={}));var te=class extends w{constructor({name:e,unchecked:r,bound:i,variance:o,defaultType:a}){super();u(this,"name");u(this,"unchecked");u(this,"bound");u(this,"variance");u(this,"defaultType");this.name=e,this.unchecked=r!=null?r:!1,this.bound=i,this.variance=o!=null?o:Pe.Invariant,this.defaultType=a}write(e){}writeTypeDefinition(e){this.unchecked&&e.write("unchecked "),this.variance!=Pe.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))}};f();l();var we=class extends A{constructor(){super(...arguments);u(this,"initializer")}write(e){e.write(`&${this.name}`)}};f();l();var Fe=class extends w{constructor({body:e,rescues:r}){super();u(this,"body");u(this,"rescues");this.body=e,this.rescues=r}write(e){e.write("begin"),e.writeLine(),this.body&&(e.indent(),this.body.write(e),e.writeNewLineIfLastLineNot(),e.dedent());for(let{errorClass:r,errorVariable:i,body:o}of this.rescues)e.write("rescue"),r&&(e.write(" "),r.write(e)),i&&(e.write(" => "),e.write(i)),e.writeLine(),o&&(e.indent(),o.write(e),e.writeNewLineIfLastLineNot(),e.dedent());e.write("end")}};f();l();var
|
|
20
|
+
`)}};var y={};nt(y,{AstNode:()=>w,ClassInstantiation:()=>J,ClassReference:()=>_,Class_:()=>V,CodeBlock:()=>X,KeywordArgument:()=>Z,KeywordParameter:()=>Q,Method:()=>W,MethodInvocation:()=>ee,MethodKind:()=>O,Module_:()=>j,Parameter:()=>A,Type:()=>$,TypeLiteral:()=>ye,TypeParameter:()=>te,Writer:()=>k,begin:()=>Bi,classReference:()=>Si,class_:()=>Ti,codeblock:()=>De,comment:()=>Ai,falseValue:()=>wi,ifElse:()=>Ci,instantiateClass:()=>ki,invokeMethod:()=>Li,keywordArgument:()=>Ni,method:()=>Ei,module:()=>bi,nilValue:()=>gi,parameters:()=>vi,positionalArgument:()=>Ii,raise:()=>Pi,trueValue:()=>yi,typeParameter:()=>Ri,wrapInModules:()=>Fi});f();l();f();l();f();l();f();l();f();l();var w=class extends K{async toStringAsync({customConfig:t,formatter:e}={}){let r=new ie({customConfig:t!=null?t:{},formatter:e});return this.write(r),r.toStringAsync()}toString({customConfig:t,formatter:e}={}){let r=new ie({customConfig:t!=null?t:{},formatter:e});return this.write(r),r.toString()}typeDefinitionToString({customConfig:t,formatter:e}={}){let r=new ie({customConfig:t!=null?t:{},formatter:e});return this.writeTypeDefinition(r),r.toString()}writeTypeDefinition(t){}};var di=120,xi=2,L=class extends w{constructor({docs:e}){super();u(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
|
|
21
|
+
`).forEach(r=>{this.wrapLine(r,e).forEach(o=>{e.writeLine(`# ${o}`)})})}wrapLine(e,r){let i=r.currentIndentLevel*2,o=di-i-xi;if(e.length<=o)return[e];if(o<20)return[e];let a=e.split(/(\s+)/),p=[],c="";for(let h of a){if(h===""||c===""&&/^\s+$/.test(h))continue;let d=c+h;d.length<=o?c=d:(c.trim()!==""&&p.push(c.trimEnd()),c=h.trimStart(),c.length>o&&(p.push(c),c=""))}return c.trim()!==""&&p.push(c.trimEnd()),p.length===0?[e]:p}};f();l();f();l();f();l();var _=class extends w{constructor({name:e,modules:r,fullyQualified:i}){super();u(this,"name");u(this,"modules");u(this,"fullyQualified");this.name=e,this.modules=r!=null?r:[],this.fullyQualified=i!=null?i:!1}write(e){if(this.fullyQualified||this.modules.length>0){let r=[...this.modules,this.name].join("::");e.write(r);return}e.write(this.name)}};var $=class n extends w{constructor(e){super();u(this,"internalType");this.internalType=e}write(e){var r,i,o;if(this.internalType)switch((r=this.internalType)==null?void 0:r.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&&((o=(i=this.internalType.elems[1])==null?void 0:i.internalType)==null?void 0:o.type)==="nil"){let a=this.internalType.elems[0];a!=null&&a.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:b(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:r=>r.writeTypeDefinition(e)});break;case"intersection":e.delimit({nodes:this.internalType.elems,delimiter:" & ",writeFunction:r=>r.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:r=>r.write(e)}),e.write("]");break;case"generic":e.write(`${this.internalType.baseKlass}[`),e.delimit({nodes:this.internalType.parameters,delimiter:", ",writeFunction:r=>r.writeTypeDefinition(e)}),e.write("]");break;default:b(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 _({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,r){return new this({type:"hash",keyType:e,valueType:r})}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,r){return new this({type:"generic",baseKlass:e,parameters:r})}static nilable(e){return n.union([e,n.nil()])}nilable(){return n.nilable(this)}};var O={Instance:"instance",Class_:"class"},or={Public:"public",Private:"private",Protected:"protected"},W=class extends w{constructor({name:e,docstring:r,kind:i,visibility:o,parameters:a,returnType:p,statements:c,splatOptionDocs:h}){var d,x;super();u(this,"name");u(this,"docstring");u(this,"kind");u(this,"positionalParameters");u(this,"keywordParameters");u(this,"positionalSplatParameter");u(this,"keywordSplatParameter");u(this,"yieldParameter");u(this,"visibility");u(this,"statements");u(this,"returnType");u(this,"splatOptionDocs");this.name=e,this.docstring=r,this.kind=i!=null?i:O.Instance,this.visibility=o!=null?o:or.Public,this.positionalParameters=(d=a==null?void 0:a.positional)!=null?d:[],this.keywordParameters=(x=a==null?void 0:a.keyword)!=null?x:[],this.positionalSplatParameter=a==null?void 0:a.positionalSplat,this.keywordSplatParameter=a==null?void 0:a.keywordSplat,this.yieldParameter=a==null?void 0:a.yield,this.returnType=p!=null?p:$.untyped(),this.statements=c!=null?c:[],this.splatOptionDocs=h!=null?h:[]}addStatement(e){this.statements.push(e)}write(e){this.docstring&&new L({docs:this.docstring}).write(e);let r=this.positionalParameters.length>0||this.keywordParameters.length>0||this.keywordSplatParameter!=null;this.docstring&&r&&e.writeLine("#");for(let i of this.positionalParameters){e.write(`# @option ${i.name} [`);let o=new k({customConfig:e.customConfig});i.type.writeTypeDefinition(o),e.write(this.normalizeForYard(o.toString())),e.write("]"),e.newLine()}for(let i of this.keywordParameters){e.write(`# @param ${i.name} [`);let o=new k({customConfig:e.customConfig});i.type.writeTypeDefinition(o),e.write(this.normalizeForYard(o.toString())),e.write("]"),i.docs&&e.write(` ${i.docs}`),e.newLine()}if(this.keywordSplatParameter!=null){e.write(`# @param ${this.keywordSplatParameter.name} [`);let i=new k({customConfig:e.customConfig});this.keywordSplatParameter.type.writeTypeDefinition(i),e.write(this.normalizeForYard(i.toString())),e.write("]"),this.keywordSplatParameter.docs&&e.write(` ${this.keywordSplatParameter.docs}`),e.newLine()}for(let i of this.splatOptionDocs)e.writeLine(`# ${i}`);if(this.returnType!=null){(r||this.docstring)&&e.writeLine("#"),e.write("# @return [");let i=new k({customConfig:e.customConfig});this.returnType.writeTypeDefinition(i),e.write(this.normalizeForYard(i.toString())),e.write("]"),e.newLine()}switch(this.visibility!==or.Public&&(e.write(this.visibility),this.kind===O.Class_&&e.write("_class_method"),e.write(" ")),this.kind){case O.Instance:e.write(`def ${this.name}`);break;case O.Class_:e.write(`def self.${this.name}`);break}this.parameters.length&&(e.write("("),e.delimit({nodes:this.parameters,delimiter:", ",writeFunction:i=>i.write(e)}),e.write(")")),this.statements.length?(e.newLine(),e.indent(),this.statements.forEach((i,o)=>{i.write(e),o<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((r,i)=>{r.writeTypeDefinition(e),i<this.parameters.length-1&&e.write(", ")}),e.write(") -> "),this.returnType.writeTypeDefinition(e)}normalizeForYard(e){let r=e.replace(/\s*\|\s*/g,", ");return r=r.replace(/\bbool\b/g,"Boolean"),r=r.replace(/(^|,\s*)nil(?:,\s*nil)+(?=,|\]|$)/g,"$1nil"),r=r.replace(/Hash\[untyped,\s*untyped\]/g,"Hash"),r}get parameters(){return[...this.positionalParameters,...this.keywordParameters,this.positionalSplatParameter,this.keywordSplatParameter,this.yieldParameter].flatMap(e=>e!==void 0?e:[])}};f();l();var j=class n extends w{constructor({name:e,namespace:r,typeParameters:i,docstring:o,statements:a}){super();u(this,"name");u(this,"namespace");u(this,"typeParameters");u(this,"docstring");u(this,"statements");this.name=e,this.namespace=r!=null?r:new Set,this.typeParameters=i!=null?i:[],this.docstring=o,this.statements=a!=null?a:[],this.populateChildNamespaces()}addStatement(e){this.statements.push(e)}write(e){this.docstring&&new L({docs:this.docstring}).write(e),e.write(`module ${this.name}`),this.statements.length?(e.newLine(),e.indent(),this.statements.forEach((r,i)=>{r.write(e),i<this.statements.length-1&&e.newLine()}),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:r=>r.writeTypeDefinition(e)}),e.write("]")),e.newLine(),this.statements.length&&(e.indent(),this.statements.forEach(r=>{r.writeTypeDefinition(e),e.newLine()}),e.dedent()),e.write("end")}populateChildNamespaces(){this.statements.filter(e=>e instanceof n||e instanceof V).forEach(e=>{e.namespace=new Set([...this.namespace,this]),e.populateChildNamespaces()})}get fullyQualifiedNamespace(){return[...this.namespace,this].map(e=>e.name).join("::")}};var V=class extends j{constructor({name:e,superclass:r,typeParameters:i,docstring:o,statements:a}){super({name:e,docstring:o,typeParameters:i});u(this,"superclass");u(this,"statements");u(this,"methods",[]);this.superclass=r,this.statements=a!=null?a:[]}addStatement(e){this.statements.push(e)}addStatements(e){this.statements.push(...e)}addInstanceMethod(e,r,i){let o=new W({name:e,kind:O.Instance,returnType:r,statements:i});this.addMethod(o)}addMethod(e){this.methods.push(e)}addMethods(e){e.forEach(r=>this.addMethod(r))}write(e){if(this.docstring&&new L({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((r,i)=>{r.write(e),e.newLine()}),e.dedent()),this.methods.length&&(e.newLine(),e.indent(),this.methods.forEach(r=>{r.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:r=>r.writeTypeDefinition(e)}),e.write("]")),this.superclass&&(e.write(" < "),this.superclass.write(e)),e.newLine(),this.statements.length&&(e.indent(),this.statements.forEach(r=>{r.writeTypeDefinition(e),e.newLine()}),e.dedent()),e.write("end")}};f();l();var J=class extends w{constructor({classReference:e,arguments_:r}){super();u(this,"classReference");u(this,"arguments_");this.classReference=e,this.arguments_=r}write(e){e.writeNode(this.classReference),e.write("."),e.write("new"),e.write("("),this.arguments_.length>1?(e.indent(),e.newLine(),this.arguments_.forEach((r,i)=>{i>0&&(e.write(","),e.newLine()),r.write(e)}),e.newLine(),e.dedent()):this.arguments_.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write(")")}};f();l();var X=class extends w{constructor(e){super();u(this,"arg");this.arg=e}write(e){return new N(this.arg).write(e)}};f();l();var Z=class extends w{constructor({name:e,value:r}){super();u(this,"name");u(this,"value");this.name=e,this.value=r}write(e){e.write(`${this.name}: `),this.value.write(e)}};f();l();f();l();var A=class extends w{constructor({name:e,type:r,optional:i,docs:o}){super();u(this,"name");u(this,"type");u(this,"optional");u(this,"docs");this.name=e,this.type=r!=null?r:$.untyped(),this.optional=i!=null?i:!1,this.docs=o}};var Q=class extends A{constructor({name:e,type:r,initializer:i,optional:o}){super({name:e,type:r,optional:o});u(this,"initializer");this.initializer=i}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)}};f();l();var me=class extends A{constructor(){super(...arguments);u(this,"initializer")}write(e){e.write(`**${this.name}`)}writeTypeDefinition(e){e.write("**"),this.type.writeTypeDefinition(e)}};f();l();var ee=class extends w{constructor({on:e,method:r,arguments_:i,keywordArguments:o,block:a}){super();u(this,"on");u(this,"method");u(this,"arguments_");u(this,"keywordArguments");u(this,"block");this.on=e,this.method=r,this.arguments_=i,this.keywordArguments=o,this.block=a}write(e){this.on.write(e),e.write("."),e.write(this.method),e.write("(");let r=[];for(let i of this.arguments_)r.push({kind:"positional",node:i});for(let i of this.keywordArguments||[])r.push({kind:"keyword",arg:i});if(r.length>1?(e.indent(),e.newLine(),r.forEach((i,o)=>{o>0&&(e.write(","),e.newLine()),ar(e,i)}),e.newLine(),e.dedent()):r.forEach((i,o)=>{o>0&&e.write(", "),ar(e,i)}),e.write(")"),this.block){let[i,o]=this.block;e.write(" do"),i.length>0&&(e.write(" |"),i.forEach((a,p)=>{p>0&&e.write(", "),e.write(a)}),e.write("|")),e.newLine(),e.indent();for(let a of o)a.write(e),e.writeNewLineIfLastLineNot();e.dedent(),e.write("end")}}};function ar(n,t){switch(t.kind){case"positional":t.node.write(n);break;case"keyword":t.arg.write(n);break;default:b(t)}}f();l();var he=class extends w{constructor({value:e}){super();u(this,"value");this.value=e}write(e){this.value.write(e)}};f();l();var de=class extends A{constructor({name:e,type:r,optional:i,initializer:o}){super({name:e,type:r,optional:i});u(this,"initializer");this.initializer=o}write(e){e.write(this.name),this.initializer&&e.write(` = ${this.initializer.write(e)}`)}writeTypeDefinition(e){this.optional&&e.write("?"),this.type.writeTypeDefinition(e)}};f();l();var xe=class extends A{write(t){t.write(`*${this.name}`)}writeTypeDefinition(t){t.write("*"),this.type.writeTypeDefinition(t)}};f();l();var ye=class n extends w{constructor(e){super();u(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 n&&e.internalType.type==="nop"}static isNil(e){return e instanceof n&&e.internalType.type==="nil"}write(e){switch(this.internalType.type){case"str":{this.internalType.value.includes("'")||this.internalType.value.includes("#")?e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`):e.write(`'${this.internalType.value}'`);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 r=this.internalType.entries.filter(i=>!n.isNop(i.key)&&!n.isNop(i.value));if(r.length===0){e.write("{}");break}e.write(`{
|
|
22
|
+
`),r.forEach((i,o)=>{o>0&&e.writeLine(","),e.indent();let a=!1;if(i.key instanceof n&&i.key.internalType.type==="str"){let p=i.key.internalType.value;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(p)&&(e.write(`${p}:`),a=!0)}a||(i.key.write(e),e.write(" =>")),e.write(" "),i.value.write(e),e.dedent()}),e.write(`
|
|
23
|
+
}`);break}case"set":{let r=this.internalType.values.filter(i=>!n.isNop(i));if(r.length===0){e.write("Set.new([])");break}e.write("Set.new(["),r.forEach((i,o)=>{o>0&&e.write(", "),i.write(e)}),e.write("])");break}case"list":{let r=this.internalType.values.filter(i=>!n.isNop(i));if(r.length===0){e.write("[]");break}e.write("["),r.forEach((i,o)=>{o>0&&e.write(", "),i.write(e)}),e.write("]");break}case"nop":break;case"nil":e.write("nil");break;default:b(this.internalType)}}};f();l();var Pe;(function(n){n[n.Invariant=0]="Invariant",n.Covariant="out",n.Contravariant="in"})(Pe||(Pe={}));var te=class extends w{constructor({name:e,unchecked:r,bound:i,variance:o,defaultType:a}){super();u(this,"name");u(this,"unchecked");u(this,"bound");u(this,"variance");u(this,"defaultType");this.name=e,this.unchecked=r!=null?r:!1,this.bound=i,this.variance=o!=null?o:Pe.Invariant,this.defaultType=a}write(e){}writeTypeDefinition(e){this.unchecked&&e.write("unchecked "),this.variance!=Pe.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))}};f();l();var we=class extends A{constructor(){super(...arguments);u(this,"initializer")}write(e){e.write(`&${this.name}`)}};f();l();var Fe=class extends w{constructor({body:e,rescues:r}){super();u(this,"body");u(this,"rescues");this.body=e,this.rescues=r}write(e){e.write("begin"),e.writeLine(),this.body&&(e.indent(),this.body.write(e),e.writeNewLineIfLastLineNot(),e.dedent());for(let{errorClass:r,errorVariable:i,body:o}of this.rescues)e.write("rescue"),r&&(e.write(" "),r.write(e)),i&&(e.write(" => "),e.write(i)),e.writeLine(),o&&(e.indent(),o.write(e),e.writeNewLineIfLastLineNot(),e.dedent());e.write("end")}};f();l();var Me=class extends w{constructor({if:e,elseIf:r,elseBody:i}){super();u(this,"ifBranch");u(this,"elseIfs");u(this,"elseBody");this.ifBranch=e,this.elseIfs=r!=null?r:[],this.elseBody=i?Array.isArray(i)?i:[i]:void 0}write(e){e.write("if "),this.ifBranch.condition.write(e),e.writeLine(),e.indent();for(let r of this.ifBranch.thenBody)r.write(e),e.writeNewLineIfLastLineNot();e.dedent();for(let r of this.elseIfs){e.write("elsif "),r.condition.write(e),e.writeLine(),e.indent();for(let i of r.thenBody)i.write(e),e.writeNewLineIfLastLineNot();e.dedent()}if(this.elseBody&&this.elseBody.length>0){e.writeLine("else"),e.indent();for(let r of this.elseBody)r.write(e),e.writeNewLineIfLastLineNot();e.dedent()}e.write("end"),e.writeNewLineIfLastLineNot()}};f();l();var Ue=class extends w{constructor({errorClass:e,message:r}){super();u(this,"errorClass");u(this,"message");this.errorClass=e,this.message=r}write(e){e.write("raise"),this.errorClass&&(e.write(" "),this.errorClass.write(e)),this.message&&(this.errorClass&&e.write(", "),this.message.write(e))}};function De(n){return new X(n)}function yi(){return De("true")}function wi(){return De("false")}function gi(){return De("nil")}var vi={positional(n){return new de(n)},keyword(n){return new Q(n)},positionalSplat(n){return new xe(n)},keywordSplat(n){return new me(n)},yield(n){return new we(n)}};function Ti(n){return new V(n)}function bi(n){return new j(n)}function Ei(n){return new W(n)}function Ai(n){return new L(n)}function Ri(n){return new te(n)}function Si(n){return new _(n)}function ki(n){return new J(n)}function Ni(n){return new Z(n)}function Li(n){return new ee(n)}function Ii(n){return new he(n)}function Ci(n){return new Me(n)}function Bi(n){return new Fe(n)}function Pi(n){return new Ue(n)}function Fi(n,t){let e=n;for(let r of t.toReversed())r.addStatement(e),e=r;return e}f();l();var _e=class{constructor({context:t}){u(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?y.TypeLiteral.nil():(this.context.errors.add({severity:v.Critical,message:"Expected non-null value, but got null"}),y.TypeLiteral.nop());if(t.value===void 0)return y.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?y.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 y.TypeLiteral.nop();default:b(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let r=this.context.getValueAsBoolean({value:e});return r==null?y.TypeLiteral.nop():y.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:e});return r==null?y.TypeLiteral.nop():y.TypeLiteral.string(r)}default:b(t)}}convertList({list:t,value:e}){return Array.isArray(e)?y.TypeLiteral.list(e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}})):(this.context.errors.add({severity:v.Critical,message:`Expected array but got: ${typeof e}`}),y.TypeLiteral.nop())}convertSet({set:t,value:e}){return Array.isArray(e)?y.TypeLiteral.set(e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}})):(this.context.errors.add({severity:v.Critical,message:`Expected array but got: ${typeof e}`}),y.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:v.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),y.TypeLiteral.nop()):y.TypeLiteral.hash(Object.entries(e).map(([r,i])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:t.key,value:r,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}}))}convertNamed({named:t,value:e,as:r}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:r});case"discriminatedUnion":return y.TypeLiteral.nop();case"object":return this.convertObject({object:t,value:e});case"enum":return y.TypeLiteral.nop();case"undiscriminatedUnion":return y.TypeLiteral.nop();default:b(t)}}convertPrimitive({primitive:t,value:e,as:r}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:r});return i==null?y.TypeLiteral.nop():y.TypeLiteral.integer(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:r});return i==null?y.TypeLiteral.nop():y.TypeLiteral.boolean(i)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.string(i)}case"UUID":{let i=this.context.getValueAsString({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.string(i)}case"DATE":{let i=this.context.getValueAsString({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.string(i)}case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.string(i)}default:b(t)}}convertObject({object:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:v.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),y.TypeLiteral.nop()):y.TypeLiteral.hash(Object.entries(e).map(([r,i])=>{var h,d;this.context.errors.scope(r);let o=t.properties.find(x=>x.name.wireValue===r),a=(h=o==null?void 0:o.typeReference)!=null?h:{type:"unknown"},p=(d=o==null?void 0:o.name.name.snakeCase.safeName)!=null?d:r,c={key:y.TypeLiteral.string(p),value:this.convert({typeReference:a,value:i})};return this.context.errors.unscope(),c}))}getValueAsNumber({value:t,as:e}){let r=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:t,as:e}){let r=e==="key"?typeof t=="string"?t==="true":!!t:t;return this.context.getValueAsBoolean({value:r})}};var Xe=class n extends ce{constructor({ir:e,config:r}){super({ir:e,config:r});u(this,"ir");u(this,"customConfig");u(this,"dynamicTypeLiteralMapper");this.ir=e,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeLiteralMapper=new _e({context:this})}clone(){return new n({ir:this.ir,config:this.config})}getRootClientClassReference(){return y.classReference({name:this.getRootClientClassName(),modules:[this.getRootModuleName()]})}getRootClientClassName(){return"Client"}getRootModuleName(){var e,r;return He((r=(e=this.customConfig)==null?void 0:e.clientModuleName)!=null?r:this.config.organization)}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}getEnvironmentTypeReferenceFromID(e){let r=this.resolveEnvironmentName(e);if(r!=null)return y.codeblock(i=>{i.writeNode(this.getEnvironmentClassReference()),i.write("::"),i.write(this.getEnumName(r))})}getEnvironmentClassReference(){return y.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}};0&&(module.exports={DynamicSnippetsGeneratorContext});
|
|
24
24
|
/*! Bundled license information:
|
|
25
25
|
|
|
26
26
|
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|