@fern-api/java-dynamic-snippets 0.0.6 → 0.0.8

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.
Files changed (59) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +6 -6
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
  3. package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
  4. package/cjs/{DynamicSnippetsGeneratorContext-CqPRgNNz.d.cts → DynamicSnippetsGeneratorContext-BhCKaadj.d.cts} +16 -1
  5. package/cjs/EndpointSnippetGenerator.cjs +2 -2
  6. package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
  7. package/cjs/EndpointSnippetGenerator.d.cts +1 -1
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +6 -6
  9. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
  10. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  11. package/cjs/context/DynamicTypeLiteralMapper.cjs +6 -6
  12. package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -1
  13. package/cjs/context/DynamicTypeLiteralMapper.d.cts +1 -1
  14. package/cjs/context/DynamicTypeMapper.cjs +5 -5
  15. package/cjs/context/DynamicTypeMapper.cjs.map +1 -1
  16. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  17. package/cjs/context/FilePropertyMapper.cjs +5 -5
  18. package/cjs/context/FilePropertyMapper.cjs.map +1 -1
  19. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  20. package/cjs/index.cjs +6 -6
  21. package/cjs/index.cjs.map +1 -1
  22. package/cjs/index.d.cts +1 -1
  23. package/esm/DynamicSnippetsGenerator.d.ts +1 -1
  24. package/esm/DynamicSnippetsGenerator.js +1 -1
  25. package/esm/{DynamicSnippetsGeneratorContext-CqPRgNNz.d.ts → DynamicSnippetsGeneratorContext-BhCKaadj.d.ts} +16 -1
  26. package/esm/EndpointSnippetGenerator.d.ts +1 -1
  27. package/esm/EndpointSnippetGenerator.js +1 -1
  28. package/esm/{chunk-2KH7MFRW.js → chunk-4CABHDQV.js} +2 -2
  29. package/esm/{chunk-SNGFCNTO.js → chunk-ATHAOWL4.js} +2 -2
  30. package/esm/{chunk-GESEOQT7.js → chunk-DD37GKIE.js} +2 -2
  31. package/esm/{chunk-6CITGEM3.js → chunk-JWUP3MFF.js} +3 -3
  32. package/esm/chunk-JWUP3MFF.js.map +1 -0
  33. package/esm/{chunk-G35HVZPV.js → chunk-PSRNJYSA.js} +2 -2
  34. package/esm/{chunk-L6HHZWHP.js → chunk-RVPVA4ZP.js} +2 -2
  35. package/esm/chunk-V3XTHNV6.js +8 -0
  36. package/esm/chunk-V3XTHNV6.js.map +1 -0
  37. package/esm/chunk-Z267S5KO.js +15 -0
  38. package/esm/chunk-Z267S5KO.js.map +1 -0
  39. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  40. package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
  41. package/esm/context/DynamicTypeLiteralMapper.d.ts +1 -1
  42. package/esm/context/DynamicTypeLiteralMapper.js +1 -1
  43. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  44. package/esm/context/DynamicTypeMapper.js +1 -1
  45. package/esm/context/FilePropertyMapper.d.ts +1 -1
  46. package/esm/context/FilePropertyMapper.js +1 -1
  47. package/esm/index.d.ts +1 -1
  48. package/esm/index.js +1 -1
  49. package/package.json +1 -1
  50. package/esm/chunk-6CITGEM3.js.map +0 -1
  51. package/esm/chunk-GTD7VYDZ.js +0 -8
  52. package/esm/chunk-GTD7VYDZ.js.map +0 -1
  53. package/esm/chunk-OMKG67AN.js +0 -15
  54. package/esm/chunk-OMKG67AN.js.map +0 -1
  55. /package/esm/{chunk-2KH7MFRW.js.map → chunk-4CABHDQV.js.map} +0 -0
  56. /package/esm/{chunk-SNGFCNTO.js.map → chunk-ATHAOWL4.js.map} +0 -0
  57. /package/esm/{chunk-GESEOQT7.js.map → chunk-DD37GKIE.js.map} +0 -0
  58. /package/esm/{chunk-G35HVZPV.js.map → chunk-PSRNJYSA.js.map} +0 -0
  59. /package/esm/{chunk-L6HHZWHP.js.map → chunk-RVPVA4ZP.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, Options } from '@fern-api/browser-compatible-base-generator';
2
2
  import { FernIr } from '@fern-api/dynamic-ir-sdk';
3
- import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-CqPRgNNz.cjs';
3
+ import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-BhCKaadj.cjs';
4
4
  import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.cjs';
5
5
  import '@fern-api/java-ast';
6
6
 
@@ -1,4 +1,4 @@
1
- import { AbstractDynamicSnippetsGeneratorContext, FernGeneratorExec, Options } from '@fern-api/browser-compatible-base-generator';
1
+ import { AbstractDynamicSnippetsGeneratorContext, FernGeneratorExec, Options, TypeInstance } from '@fern-api/browser-compatible-base-generator';
2
2
  import { FernIr } from '@fern-api/dynamic-ir-sdk';
3
3
  import { java, BaseJavaCustomConfigSchema } from '@fern-api/java-ast';
4
4
 
@@ -124,6 +124,21 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
124
124
  typeReference: FernIr.dynamic.TypeReference;
125
125
  value: unknown;
126
126
  }>;
127
+ /**
128
+ * Override to preserve parameter order for Java staged builders.
129
+ *
130
+ * Java uses type-state staged builders where method call order is enforced at compile time.
131
+ * Unlike Python/TypeScript/Go which use keyword arguments or object literals (order-independent),
132
+ * Java requires fields to be set in the exact order they appear in the schema definition.
133
+ *
134
+ * This override calls the base implementation to preserve all error handling semantics,
135
+ * then reorders the results to match schema parameter order.
136
+ */
137
+ associateByWireValue({ parameters, values, ignoreMissingParameters }: {
138
+ parameters: FernIr.dynamic.NamedParameter[];
139
+ values: FernIr.dynamic.Values;
140
+ ignoreMissingParameters?: boolean;
141
+ }): TypeInstance[];
127
142
  getRootPackageName(): string;
128
143
  getCorePackageName(): string;
129
144
  getTypesPackageName(fernFilepath: FernIr.dynamic.FernFilepath): string;
@@ -1,4 +1,4 @@
1
- "use strict";var oe=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var yt=(n,t,e)=>t in n?oe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var Ne=(n,t)=>()=>(n&&(t=n(n=0)),t);var _e=(n,t)=>{for(var e in t)oe(n,e,{get:t[e],enumerable:!0})},gt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mt(t))!dt.call(n,i)&&i!==e&&oe(n,i,{get:()=>t[i],enumerable:!(r=ft(t,i))||r.enumerable});return n};var wt=n=>gt(oe({},"__esModule",{value:!0}),n);var h=(n,t,e)=>yt(n,typeof t!="symbol"?t+"":t,e);function Oe(){throw new Error("setTimeout has not been defined")}function qe(){throw new Error("clearTimeout has not been defined")}function je(n){if(O===setTimeout)return setTimeout(n,0);if((O===Oe||!O)&&setTimeout)return O=setTimeout,setTimeout(n,0);try{return O(n,0)}catch(t){try{return O.call(null,n,0)}catch(e){return O.call(this,n,0)}}}function xt(n){if(q===clearTimeout)return clearTimeout(n);if((q===qe||!q)&&clearTimeout)return q=clearTimeout,clearTimeout(n);try{return q(n)}catch(t){try{return q.call(null,n)}catch(e){return q.call(this,n)}}}function vt(){!ee||!D||(ee=!1,D.length?F=D.concat(F):ue=-1,F.length&&De())}function De(){if(!ee){var n=je(vt);ee=!0;for(var t=F.length;t;){for(D=F,F=[];++ue<t;)D&&D[ue].run();ue=-1,t=F.length}D=null,ee=!1,xt(n)}}function Tt(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 $e(n,t)),F.length===1&&!ee&&je(De)}function $e(n,t){this.fun=n,this.array=t}function $(){}function Ot(n){throw new Error("process.binding is not supported")}function qt(){return"/"}function jt(n){throw new Error("process.chdir is not supported")}function Dt(){return 0}function Yt(n){var t=$t.call(Z)*.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 Vt(){var n=new Date,t=n-Wt;return t/1e3}var O,q,F,ee,D,ue,Nt,Rt,It,At,kt,bt,Et,St,Pt,Bt,Ct,Lt,Ft,Mt,_t,Ut,Z,$t,Wt,g,Ue,l=Ne(()=>{"use strict";O=Oe,q=qe;typeof globalThis.setTimeout=="function"&&(O=setTimeout);typeof globalThis.clearTimeout=="function"&&(q=clearTimeout);F=[],ee=!1,ue=-1;$e.prototype.run=function(){this.fun.apply(null,this.array)};Nt="browser",Rt="browser",It=!0,At={},kt=[],bt="",Et={},St={},Pt={};Bt=$,Ct=$,Lt=$,Ft=$,Mt=$,_t=$,Ut=$;Z=globalThis.performance||{},$t=Z.now||Z.mozNow||Z.msNow||Z.oNow||Z.webkitNow||function(){return new Date().getTime()};Wt=new Date;g={nextTick:Tt,title:Nt,browser:It,env:At,argv:kt,version:bt,versions:Et,on:Bt,addListener:Ct,once:Lt,off:Ft,removeListener:Mt,removeAllListeners:_t,emit:Ut,binding:Ot,cwd:qt,chdir:jt,umask:Dt,hrtime:Yt,platform:Rt,release:St,config:Pt,uptime:Vt},Ue={};Object.keys(Ue).forEach(n=>{let t=n.split("."),e=g;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Ue[n]:e=e[i]||(e[i]={})}})});function He(){Ie=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)B[t]=n[t],b[n.charCodeAt(t)]=t;b[45]=62,b[95]=63}function Gt(n){Ie||He();var t,e,r,i,s,a,u=n.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=n[u-2]==="="?2:n[u-1]==="="?1:0,a=new Ht(u*3/4-s),r=s>0?u-4:u;var c=0;for(t=0,e=0;t<r;t+=4,e+=3)i=b[n.charCodeAt(t)]<<18|b[n.charCodeAt(t+1)]<<12|b[n.charCodeAt(t+2)]<<6|b[n.charCodeAt(t+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=i&255;return s===2?(i=b[n.charCodeAt(t)]<<2|b[n.charCodeAt(t+1)]>>4,a[c++]=i&255):s===1&&(i=b[n.charCodeAt(t)]<<10|b[n.charCodeAt(t+1)]<<4|b[n.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=i&255),a}function Jt(n){return B[n>>18&63]+B[n>>12&63]+B[n>>6&63]+B[n&63]}function Qt(n,t,e){for(var r,i=[],s=t;s<e;s+=3)r=(n[s]<<16)+(n[s+1]<<8)+n[s+2],i.push(Jt(r));return i.join("")}function Ye(n){Ie||He();for(var t,e=n.length,r=e%3,i="",s=[],a=16383,u=0,c=e-r;u<c;u+=a)s.push(Qt(n,u,u+a>c?c:u+a));return r===1?(t=n[e-1],i+=B[t>>2],i+=B[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=B[t>>10],i+=B[t>>4&63],i+=B[t<<2&63],i+="="),s.push(i),s.join("")}function ce(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(n,t){if(ce()<t)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=o.prototype):(n===null&&(n=new o(t)),n.length=t),n}function o(n,t,e){if(!o.TYPED_ARRAY_SUPPORT&&!(this instanceof o))return new o(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 Ae(this,n)}return Ge(this,n,t,e)}function Ge(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?Xt(n,t,e,r):typeof t=="string"?zt(n,t,e):Zt(n,t)}function Je(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 Kt(n,t,e,r){return Je(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 Ae(n,t){if(Je(t),n=M(n,t<0?0:ke(t)|0),!o.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function zt(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!o.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Qe(t,e)|0;n=M(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Re(n,t){var e=t.length<0?0:ke(t.length)|0;n=M(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Xt(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),o.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=o.prototype):n=Re(n,t),n}function Zt(n,t){if(C(t)){var e=ke(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"||wr(t.length)?M(n,0):Re(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Re(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ke(n){if(n>=ce())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ce().toString(16)+" bytes");return n|0}function C(n){return!!(n!=null&&n._isBuffer)}function Qe(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 le(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return rt(n).length;default:if(r)return le(n).length;t=(""+t).toLowerCase(),r=!0}}function er(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 lr(this,t,e);case"utf8":case"utf-8":return Xe(this,t,e);case"ascii":return ur(this,t,e);case"latin1":case"binary":return cr(this,t,e);case"base64":return sr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function Y(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Ke(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=o.from(t,r)),C(t))return t.length===0?-1:We(n,t,e,r,i);if(typeof t=="number")return t=t&255,o.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):We(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function We(n,t,e,r,i){var s=1,a=n.length,u=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;s=2,a/=2,u/=2,e/=2}function c(T,k){return s===1?T[k]:T.readUInt16BE(k*s)}var m;if(i){var f=-1;for(m=e;m<a;m++)if(c(n,m)===c(t,f===-1?0:m-f)){if(f===-1&&(f=m),m-f+1===u)return f*s}else f!==-1&&(m-=m-f),f=-1}else for(e+u>a&&(e=a-u),m=e;m>=0;m--){for(var y=!0,x=0;x<u;x++)if(c(n,m+x)!==c(t,x)){y=!1;break}if(y)return m}return-1}function tr(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var a=0;a<r;++a){var u=parseInt(t.substr(a*2,2),16);if(isNaN(u))return a;n[e+a]=u}return a}function rr(n,t,e,r){return fe(le(t,n.length-e),n,e,r)}function ze(n,t,e,r){return fe(yr(t),n,e,r)}function nr(n,t,e,r){return ze(n,t,e,r)}function ir(n,t,e,r){return fe(rt(t),n,e,r)}function ar(n,t,e,r){return fe(gr(t,n.length-e),n,e,r)}function sr(n,t,e){return t===0&&e===n.length?Ye(n):Ye(n.slice(t,e))}function Xe(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var s=n[i],a=null,u=s>239?4:s>223?3:s>191?2:1;if(i+u<=e){var c,m,f,y;switch(u){case 1:s<128&&(a=s);break;case 2:c=n[i+1],(c&192)===128&&(y=(s&31)<<6|c&63,y>127&&(a=y));break;case 3:c=n[i+1],m=n[i+2],(c&192)===128&&(m&192)===128&&(y=(s&15)<<12|(c&63)<<6|m&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:c=n[i+1],m=n[i+2],f=n[i+3],(c&192)===128&&(m&192)===128&&(f&192)===128&&(y=(s&15)<<18|(c&63)<<12|(m&63)<<6|f&63,y>65535&&y<1114112&&(a=y))}}a===null?(a=65533,u=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=u}return or(r)}function or(n){var t=n.length;if(t<=Ve)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Ve));return e}function ur(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 cr(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 lr(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",s=t;s<e;++s)i+=dr(n[s]);return i}function pr(n,t,e){for(var r=n.slice(t,e),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+r[s+1]*256);return i}function N(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,s){if(!C(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function pe(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(n.length-e,2);i<s;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function he(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(n.length-e,4);i<s;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function Ze(n,t,e,r,i,s){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function et(n,t,e,r,i){return i||Ze(n,t,e,4,34028234663852886e22,-34028234663852886e22),it(n,t,e,r,23,4),e+4}function tt(n,t,e,r,i){return i||Ze(n,t,e,8,17976931348623157e292,-17976931348623157e292),it(n,t,e,r,52,8),e+8}function fr(n){if(n=mr(n).replace(hr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function mr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function dr(n){return n<16?"0"+n.toString(16):n.toString(16)}function le(n,t){t=t||1/0;for(var e,r=n.length,i=null,s=[],a=0;a<r;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(a+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function yr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function gr(n,t){for(var e,r,i,s=[],a=0;a<n.length&&!((t-=2)<0);++a)e=n.charCodeAt(a),r=e>>8,i=e%256,s.push(i),s.push(r);return s}function rt(n){return Gt(fr(n))}function fe(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 wr(n){return n!==n}function xr(n){return n!=null&&(!!n._isBuffer||nt(n)||vr(n))}function nt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function vr(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&nt(n.slice(0,0))}function me(n,t,e,r,i){var s,a,u=i*8-r-1,c=(1<<u)-1,m=c>>1,f=-7,y=e?i-1:0,x=e?-1:1,T=n[t+y];for(y+=x,s=T&(1<<-f)-1,T>>=-f,f+=u;f>0;s=s*256+n[t+y],y+=x,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=r;f>0;a=a*256+n[t+y],y+=x,f-=8);if(s===0)s=1-m;else{if(s===c)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,r),s=s-m}return(T?-1:1)*a*Math.pow(2,s-r)}function it(n,t,e,r,i,s){var a,u,c,m=s*8-i-1,f=(1<<m)-1,y=f>>1,x=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=r?0:s-1,k=r?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+y>=1?t+=x/c:t+=x*Math.pow(2,1-y),t*c>=2&&(a++,c/=2),a+y>=f?(u=0,a=f):a+y>=1?(u=(t*c-1)*Math.pow(2,i),a=a+y):(u=t*Math.pow(2,y-1)*Math.pow(2,i),a=0));i>=8;n[e+T]=u&255,T+=k,u/=256,i-=8);for(a=a<<i|u,m+=i;m>0;n[e+T]=a&255,T+=k,a/=256,m-=8);n[e+T-k]|=j*128}var B,b,Ht,Ie,Ve,hr,at=Ne(()=>{"use strict";l();p();B=[],b=[],Ht=typeof Uint8Array!="undefined"?Uint8Array:Array,Ie=!1;o.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;o.poolSize=8192;o._augment=function(n){return n.__proto__=o.prototype,n};o.from=function(n,t,e){return Ge(null,n,t,e)};o.kMaxLength=ce();o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&o[Symbol.species]);o.alloc=function(n,t,e){return Kt(null,n,t,e)};o.allocUnsafe=function(n){return Ae(null,n)};o.allocUnsafeSlow=function(n){return Ae(null,n)};o.isBuffer=xr;o.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,s=0,a=Math.min(r,i);s<a;++s)if(t[s]!==e[s]){r=t[s],i=e[s];break}return r<i?-1:i<r?1:0};o.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}};o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return o.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=o.allocUnsafe(e),s=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,s),s+=a.length}return i};o.byteLength=Qe;o.prototype._isBuffer=!0;o.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)Y(this,e,e+1);return this};o.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)Y(this,e,e+3),Y(this,e+1,e+2);return this};o.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)Y(this,e,e+7),Y(this,e+1,e+6),Y(this,e+2,e+5),Y(this,e+3,e+4);return this};o.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Xe(this,0,t):er.apply(this,arguments)};o.prototype.equals=function(t){if(!C(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:o.compare(this,t)===0};o.prototype.compare=function(t,e,r,i,s){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),s===void 0&&(s=this.length),e<0||r>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=r)return 0;if(i>=s)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var a=s-i,u=r-e,c=Math.min(a,u),m=this.slice(i,s),f=t.slice(e,r),y=0;y<c;++y)if(m[y]!==f[y]){a=m[y],u=f[y];break}return a<u?-1:u<a?1:0};o.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};o.prototype.indexOf=function(t,e,r){return Ke(this,t,e,r,!0)};o.prototype.lastIndexOf=function(t,e,r){return Ke(this,t,e,r,!1)};o.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 s=this.length-e;if((r===void 0||r>s)&&(r=s),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 tr(this,t,e,r);case"utf8":case"utf-8":return rr(this,t,e,r);case"ascii":return ze(this,t,e,r);case"latin1":case"binary":return nr(this,t,e,r);case"base64":return ir(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ar(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ve=4096;o.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(o.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=o.prototype;else{var s=e-t;i=new o(s,void 0);for(var a=0;a<s;++a)i[a]=this[a+t]}return i};o.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=this[t],s=1,a=0;++a<e&&(s*=256);)i+=this[t+a]*s;return i};o.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};o.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]};o.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8};o.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]};o.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};o.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};o.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=this[t],s=1,a=0;++a<e&&(s*=256);)i+=this[t+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};o.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=e,s=1,a=this[t+--i];i>0&&(s*=256);)a+=this[t+--i]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*e)),a};o.prototype.readInt8=function(t,e){return e||N(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};o.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};o.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};o.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};o.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};o.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),me(this,t,!0,23,4)};o.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),me(this,t,!1,23,4)};o.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),me(this,t,!0,52,8)};o.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),me(this,t,!1,52,8)};o.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;R(this,t,e,r,s,0)}var a=1,u=0;for(this[e]=t&255;++u<r&&(a*=256);)this[e+u]=t/a&255;return e+r};o.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;R(this,t,e,r,s,0)}var a=r-1,u=1;for(this[e+a]=t&255;--a>=0&&(u*=256);)this[e+a]=t/u&255;return e+r};o.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):pe(this,t,e,!0),e+2};o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):pe(this,t,e,!1),e+2};o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):he(this,t,e,!0),e+4};o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):he(this,t,e,!1),e+4};o.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);R(this,t,e,r,s-1,-s)}var a=0,u=1,c=0;for(this[e]=t&255;++a<r&&(u*=256);)t<0&&c===0&&this[e+a-1]!==0&&(c=1),this[e+a]=(t/u>>0)-c&255;return e+r};o.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);R(this,t,e,r,s-1,-s)}var a=r-1,u=1,c=0;for(this[e+a]=t&255;--a>=0&&(u*=256);)t<0&&c===0&&this[e+a+1]!==0&&(c=1),this[e+a]=(t/u>>0)-c&255;return e+r};o.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):pe(this,t,e,!0),e+2};o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):pe(this,t,e,!1),e+2};o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):he(this,t,e,!0),e+4};o.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),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):he(this,t,e,!1),e+4};o.prototype.writeFloatLE=function(t,e,r){return et(this,t,e,!0,r)};o.prototype.writeFloatBE=function(t,e,r){return et(this,t,e,!1,r)};o.prototype.writeDoubleLE=function(t,e,r){return tt(this,t,e,!0,r)};o.prototype.writeDoubleBE=function(t,e,r){return tt(this,t,e,!1,r)};o.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 s=i-r,a;if(this===t&&r<e&&e<i)for(a=s-1;a>=0;--a)t[a+e]=this[a+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(a=0;a<s;++a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s};o.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 s=t.charCodeAt(0);s<256&&(t=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!o.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 u=C(t)?t:le(new o(t,i).toString()),c=u.length;for(a=0;a<r-e;++a)this[a+e]=u[a%c]}return this};hr=/[^+\/0-9A-Za-z-_]/g});var p=Ne(()=>{"use strict";at()});var Xr={};_e(Xr,{EndpointSnippetGenerator:()=>Ce});module.exports=wt(Xr);l();p();l();p();l();p();function A(n){throw new Error("Unexpected value: "+JSON.stringify(n))}l();p();l();p();l();p();var st,ot,te=(ot=(st=g.env.FERN_STACK_TRACK)==null?void 0:st.toLowerCase())!=null?ot:"",L=te!==""&&te!=="0"&&te!=="false",be=["single","multiline","box"].includes(te)?te:"single";L&&(Error.stackTraceLimit=50);var Tr=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Nr=new Set(["stacktrace"]);function ye({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:s=!0,filterJs:a=!0,formatFilename:u=c=>c}={}){var m;if(!L)return[];r=[...r,...Tr],e=[...e,...Nr],i=[...i,"runInteractiveTask"];let c=!1;return((m=new Error().stack)!=null?m:"").split(`
1
+ "use strict";var oe=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var yt=(n,t,e)=>t in n?oe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var Ne=(n,t)=>()=>(n&&(t=n(n=0)),t);var _e=(n,t)=>{for(var e in t)oe(n,e,{get:t[e],enumerable:!0})},gt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mt(t))!dt.call(n,i)&&i!==e&&oe(n,i,{get:()=>t[i],enumerable:!(r=ft(t,i))||r.enumerable});return n};var wt=n=>gt(oe({},"__esModule",{value:!0}),n);var h=(n,t,e)=>yt(n,typeof t!="symbol"?t+"":t,e);function Oe(){throw new Error("setTimeout has not been defined")}function qe(){throw new Error("clearTimeout has not been defined")}function je(n){if(O===setTimeout)return setTimeout(n,0);if((O===Oe||!O)&&setTimeout)return O=setTimeout,setTimeout(n,0);try{return O(n,0)}catch(t){try{return O.call(null,n,0)}catch(e){return O.call(this,n,0)}}}function xt(n){if(q===clearTimeout)return clearTimeout(n);if((q===qe||!q)&&clearTimeout)return q=clearTimeout,clearTimeout(n);try{return q(n)}catch(t){try{return q.call(null,n)}catch(e){return q.call(this,n)}}}function vt(){!ee||!D||(ee=!1,D.length?F=D.concat(F):ue=-1,F.length&&De())}function De(){if(!ee){var n=je(vt);ee=!0;for(var t=F.length;t;){for(D=F,F=[];++ue<t;)D&&D[ue].run();ue=-1,t=F.length}D=null,ee=!1,xt(n)}}function Tt(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 $e(n,t)),F.length===1&&!ee&&je(De)}function $e(n,t){this.fun=n,this.array=t}function $(){}function Ot(n){throw new Error("process.binding is not supported")}function qt(){return"/"}function jt(n){throw new Error("process.chdir is not supported")}function Dt(){return 0}function Yt(n){var t=$t.call(Z)*.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 Vt(){var n=new Date,t=n-Wt;return t/1e3}var O,q,F,ee,D,ue,Nt,Rt,It,At,kt,bt,Et,St,Pt,Bt,Ct,Lt,Ft,Mt,_t,Ut,Z,$t,Wt,g,Ue,l=Ne(()=>{"use strict";O=Oe,q=qe;typeof globalThis.setTimeout=="function"&&(O=setTimeout);typeof globalThis.clearTimeout=="function"&&(q=clearTimeout);F=[],ee=!1,ue=-1;$e.prototype.run=function(){this.fun.apply(null,this.array)};Nt="browser",Rt="browser",It=!0,At={},kt=[],bt="",Et={},St={},Pt={};Bt=$,Ct=$,Lt=$,Ft=$,Mt=$,_t=$,Ut=$;Z=globalThis.performance||{},$t=Z.now||Z.mozNow||Z.msNow||Z.oNow||Z.webkitNow||function(){return new Date().getTime()};Wt=new Date;g={nextTick:Tt,title:Nt,browser:It,env:At,argv:kt,version:bt,versions:Et,on:Bt,addListener:Ct,once:Lt,off:Ft,removeListener:Mt,removeAllListeners:_t,emit:Ut,binding:Ot,cwd:qt,chdir:jt,umask:Dt,hrtime:Yt,platform:Rt,release:St,config:Pt,uptime:Vt},Ue={};Object.keys(Ue).forEach(n=>{let t=n.split("."),e=g;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Ue[n]:e=e[i]||(e[i]={})}})});function He(){Ie=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)B[t]=n[t],b[n.charCodeAt(t)]=t;b[45]=62,b[95]=63}function Gt(n){Ie||He();var t,e,r,i,s,a,u=n.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=n[u-2]==="="?2:n[u-1]==="="?1:0,a=new Ht(u*3/4-s),r=s>0?u-4:u;var c=0;for(t=0,e=0;t<r;t+=4,e+=3)i=b[n.charCodeAt(t)]<<18|b[n.charCodeAt(t+1)]<<12|b[n.charCodeAt(t+2)]<<6|b[n.charCodeAt(t+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=i&255;return s===2?(i=b[n.charCodeAt(t)]<<2|b[n.charCodeAt(t+1)]>>4,a[c++]=i&255):s===1&&(i=b[n.charCodeAt(t)]<<10|b[n.charCodeAt(t+1)]<<4|b[n.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=i&255),a}function Jt(n){return B[n>>18&63]+B[n>>12&63]+B[n>>6&63]+B[n&63]}function Qt(n,t,e){for(var r,i=[],s=t;s<e;s+=3)r=(n[s]<<16)+(n[s+1]<<8)+n[s+2],i.push(Jt(r));return i.join("")}function Ye(n){Ie||He();for(var t,e=n.length,r=e%3,i="",s=[],a=16383,u=0,c=e-r;u<c;u+=a)s.push(Qt(n,u,u+a>c?c:u+a));return r===1?(t=n[e-1],i+=B[t>>2],i+=B[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=B[t>>10],i+=B[t>>4&63],i+=B[t<<2&63],i+="="),s.push(i),s.join("")}function ce(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(n,t){if(ce()<t)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=o.prototype):(n===null&&(n=new o(t)),n.length=t),n}function o(n,t,e){if(!o.TYPED_ARRAY_SUPPORT&&!(this instanceof o))return new o(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 Ae(this,n)}return Ge(this,n,t,e)}function Ge(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?Xt(n,t,e,r):typeof t=="string"?zt(n,t,e):Zt(n,t)}function Je(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 Kt(n,t,e,r){return Je(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 Ae(n,t){if(Je(t),n=M(n,t<0?0:ke(t)|0),!o.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function zt(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!o.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Qe(t,e)|0;n=M(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Re(n,t){var e=t.length<0?0:ke(t.length)|0;n=M(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Xt(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),o.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=o.prototype):n=Re(n,t),n}function Zt(n,t){if(C(t)){var e=ke(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"||wr(t.length)?M(n,0):Re(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Re(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ke(n){if(n>=ce())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ce().toString(16)+" bytes");return n|0}function C(n){return!!(n!=null&&n._isBuffer)}function Qe(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 le(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return rt(n).length;default:if(r)return le(n).length;t=(""+t).toLowerCase(),r=!0}}function er(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 lr(this,t,e);case"utf8":case"utf-8":return Xe(this,t,e);case"ascii":return ur(this,t,e);case"latin1":case"binary":return cr(this,t,e);case"base64":return sr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function Y(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Ke(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=o.from(t,r)),C(t))return t.length===0?-1:We(n,t,e,r,i);if(typeof t=="number")return t=t&255,o.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):We(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function We(n,t,e,r,i){var s=1,a=n.length,u=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;s=2,a/=2,u/=2,e/=2}function c(T,k){return s===1?T[k]:T.readUInt16BE(k*s)}var m;if(i){var f=-1;for(m=e;m<a;m++)if(c(n,m)===c(t,f===-1?0:m-f)){if(f===-1&&(f=m),m-f+1===u)return f*s}else f!==-1&&(m-=m-f),f=-1}else for(e+u>a&&(e=a-u),m=e;m>=0;m--){for(var y=!0,x=0;x<u;x++)if(c(n,m+x)!==c(t,x)){y=!1;break}if(y)return m}return-1}function tr(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var a=0;a<r;++a){var u=parseInt(t.substr(a*2,2),16);if(isNaN(u))return a;n[e+a]=u}return a}function rr(n,t,e,r){return fe(le(t,n.length-e),n,e,r)}function ze(n,t,e,r){return fe(yr(t),n,e,r)}function nr(n,t,e,r){return ze(n,t,e,r)}function ir(n,t,e,r){return fe(rt(t),n,e,r)}function ar(n,t,e,r){return fe(gr(t,n.length-e),n,e,r)}function sr(n,t,e){return t===0&&e===n.length?Ye(n):Ye(n.slice(t,e))}function Xe(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var s=n[i],a=null,u=s>239?4:s>223?3:s>191?2:1;if(i+u<=e){var c,m,f,y;switch(u){case 1:s<128&&(a=s);break;case 2:c=n[i+1],(c&192)===128&&(y=(s&31)<<6|c&63,y>127&&(a=y));break;case 3:c=n[i+1],m=n[i+2],(c&192)===128&&(m&192)===128&&(y=(s&15)<<12|(c&63)<<6|m&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:c=n[i+1],m=n[i+2],f=n[i+3],(c&192)===128&&(m&192)===128&&(f&192)===128&&(y=(s&15)<<18|(c&63)<<12|(m&63)<<6|f&63,y>65535&&y<1114112&&(a=y))}}a===null?(a=65533,u=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=u}return or(r)}function or(n){var t=n.length;if(t<=Ve)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Ve));return e}function ur(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 cr(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 lr(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",s=t;s<e;++s)i+=dr(n[s]);return i}function pr(n,t,e){for(var r=n.slice(t,e),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+r[s+1]*256);return i}function N(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,s){if(!C(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function pe(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(n.length-e,2);i<s;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function he(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(n.length-e,4);i<s;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function Ze(n,t,e,r,i,s){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function et(n,t,e,r,i){return i||Ze(n,t,e,4,34028234663852886e22,-34028234663852886e22),it(n,t,e,r,23,4),e+4}function tt(n,t,e,r,i){return i||Ze(n,t,e,8,17976931348623157e292,-17976931348623157e292),it(n,t,e,r,52,8),e+8}function fr(n){if(n=mr(n).replace(hr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function mr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function dr(n){return n<16?"0"+n.toString(16):n.toString(16)}function le(n,t){t=t||1/0;for(var e,r=n.length,i=null,s=[],a=0;a<r;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(a+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function yr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function gr(n,t){for(var e,r,i,s=[],a=0;a<n.length&&!((t-=2)<0);++a)e=n.charCodeAt(a),r=e>>8,i=e%256,s.push(i),s.push(r);return s}function rt(n){return Gt(fr(n))}function fe(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 wr(n){return n!==n}function xr(n){return n!=null&&(!!n._isBuffer||nt(n)||vr(n))}function nt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function vr(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&nt(n.slice(0,0))}function me(n,t,e,r,i){var s,a,u=i*8-r-1,c=(1<<u)-1,m=c>>1,f=-7,y=e?i-1:0,x=e?-1:1,T=n[t+y];for(y+=x,s=T&(1<<-f)-1,T>>=-f,f+=u;f>0;s=s*256+n[t+y],y+=x,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=r;f>0;a=a*256+n[t+y],y+=x,f-=8);if(s===0)s=1-m;else{if(s===c)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,r),s=s-m}return(T?-1:1)*a*Math.pow(2,s-r)}function it(n,t,e,r,i,s){var a,u,c,m=s*8-i-1,f=(1<<m)-1,y=f>>1,x=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=r?0:s-1,k=r?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+y>=1?t+=x/c:t+=x*Math.pow(2,1-y),t*c>=2&&(a++,c/=2),a+y>=f?(u=0,a=f):a+y>=1?(u=(t*c-1)*Math.pow(2,i),a=a+y):(u=t*Math.pow(2,y-1)*Math.pow(2,i),a=0));i>=8;n[e+T]=u&255,T+=k,u/=256,i-=8);for(a=a<<i|u,m+=i;m>0;n[e+T]=a&255,T+=k,a/=256,m-=8);n[e+T-k]|=j*128}var B,b,Ht,Ie,Ve,hr,at=Ne(()=>{"use strict";l();p();B=[],b=[],Ht=typeof Uint8Array!="undefined"?Uint8Array:Array,Ie=!1;o.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;o.poolSize=8192;o._augment=function(n){return n.__proto__=o.prototype,n};o.from=function(n,t,e){return Ge(null,n,t,e)};o.kMaxLength=ce();o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&o[Symbol.species]);o.alloc=function(n,t,e){return Kt(null,n,t,e)};o.allocUnsafe=function(n){return Ae(null,n)};o.allocUnsafeSlow=function(n){return Ae(null,n)};o.isBuffer=xr;o.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,s=0,a=Math.min(r,i);s<a;++s)if(t[s]!==e[s]){r=t[s],i=e[s];break}return r<i?-1:i<r?1:0};o.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}};o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return o.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=o.allocUnsafe(e),s=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,s),s+=a.length}return i};o.byteLength=Qe;o.prototype._isBuffer=!0;o.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)Y(this,e,e+1);return this};o.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)Y(this,e,e+3),Y(this,e+1,e+2);return this};o.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)Y(this,e,e+7),Y(this,e+1,e+6),Y(this,e+2,e+5),Y(this,e+3,e+4);return this};o.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Xe(this,0,t):er.apply(this,arguments)};o.prototype.equals=function(t){if(!C(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:o.compare(this,t)===0};o.prototype.compare=function(t,e,r,i,s){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),s===void 0&&(s=this.length),e<0||r>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=r)return 0;if(i>=s)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var a=s-i,u=r-e,c=Math.min(a,u),m=this.slice(i,s),f=t.slice(e,r),y=0;y<c;++y)if(m[y]!==f[y]){a=m[y],u=f[y];break}return a<u?-1:u<a?1:0};o.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};o.prototype.indexOf=function(t,e,r){return Ke(this,t,e,r,!0)};o.prototype.lastIndexOf=function(t,e,r){return Ke(this,t,e,r,!1)};o.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 s=this.length-e;if((r===void 0||r>s)&&(r=s),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 tr(this,t,e,r);case"utf8":case"utf-8":return rr(this,t,e,r);case"ascii":return ze(this,t,e,r);case"latin1":case"binary":return nr(this,t,e,r);case"base64":return ir(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ar(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ve=4096;o.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(o.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=o.prototype;else{var s=e-t;i=new o(s,void 0);for(var a=0;a<s;++a)i[a]=this[a+t]}return i};o.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=this[t],s=1,a=0;++a<e&&(s*=256);)i+=this[t+a]*s;return i};o.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};o.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]};o.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8};o.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]};o.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};o.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};o.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=this[t],s=1,a=0;++a<e&&(s*=256);)i+=this[t+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};o.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=e,s=1,a=this[t+--i];i>0&&(s*=256);)a+=this[t+--i]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*e)),a};o.prototype.readInt8=function(t,e){return e||N(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};o.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};o.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};o.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};o.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};o.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),me(this,t,!0,23,4)};o.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),me(this,t,!1,23,4)};o.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),me(this,t,!0,52,8)};o.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),me(this,t,!1,52,8)};o.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;R(this,t,e,r,s,0)}var a=1,u=0;for(this[e]=t&255;++u<r&&(a*=256);)this[e+u]=t/a&255;return e+r};o.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;R(this,t,e,r,s,0)}var a=r-1,u=1;for(this[e+a]=t&255;--a>=0&&(u*=256);)this[e+a]=t/u&255;return e+r};o.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):pe(this,t,e,!0),e+2};o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):pe(this,t,e,!1),e+2};o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):he(this,t,e,!0),e+4};o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):he(this,t,e,!1),e+4};o.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);R(this,t,e,r,s-1,-s)}var a=0,u=1,c=0;for(this[e]=t&255;++a<r&&(u*=256);)t<0&&c===0&&this[e+a-1]!==0&&(c=1),this[e+a]=(t/u>>0)-c&255;return e+r};o.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);R(this,t,e,r,s-1,-s)}var a=r-1,u=1,c=0;for(this[e+a]=t&255;--a>=0&&(u*=256);)t<0&&c===0&&this[e+a+1]!==0&&(c=1),this[e+a]=(t/u>>0)-c&255;return e+r};o.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):pe(this,t,e,!0),e+2};o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):pe(this,t,e,!1),e+2};o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):he(this,t,e,!0),e+4};o.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),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):he(this,t,e,!1),e+4};o.prototype.writeFloatLE=function(t,e,r){return et(this,t,e,!0,r)};o.prototype.writeFloatBE=function(t,e,r){return et(this,t,e,!1,r)};o.prototype.writeDoubleLE=function(t,e,r){return tt(this,t,e,!0,r)};o.prototype.writeDoubleBE=function(t,e,r){return tt(this,t,e,!1,r)};o.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 s=i-r,a;if(this===t&&r<e&&e<i)for(a=s-1;a>=0;--a)t[a+e]=this[a+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(a=0;a<s;++a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s};o.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 s=t.charCodeAt(0);s<256&&(t=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!o.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 u=C(t)?t:le(new o(t,i).toString()),c=u.length;for(a=0;a<r-e;++a)this[a+e]=u[a%c]}return this};hr=/[^+\/0-9A-Za-z-_]/g});var p=Ne(()=>{"use strict";at()});var Zr={};_e(Zr,{EndpointSnippetGenerator:()=>Ce});module.exports=wt(Zr);l();p();l();p();l();p();function A(n){throw new Error("Unexpected value: "+JSON.stringify(n))}l();p();l();p();l();p();var st,ot,te=(ot=(st=g.env.FERN_STACK_TRACK)==null?void 0:st.toLowerCase())!=null?ot:"",L=te!==""&&te!=="0"&&te!=="false",be=["single","multiline","box"].includes(te)?te:"single";L&&(Error.stackTraceLimit=50);var Tr=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Nr=new Set(["stacktrace"]);function ye({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:s=!0,filterJs:a=!0,formatFilename:u=c=>c}={}){var m;if(!L)return[];r=[...r,...Tr],e=[...e,...Nr],i=[...i,"runInteractiveTask"];let c=!1;return((m=new Error().stack)!=null?m:"").split(`
2
2
  `).map(f=>{let y=f.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(y&&y.length===5){let[,x,T,k,j]=y;if(!x||!T||!k||!j)return;if(c||i.some(se=>x==null?void 0:x.includes(se))){c=!0;return}switch(x){case"Object.<anonymous>":x="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":x=`${x.substring(x.indexOf(".")+1)}()=> { ... }`;break}return{fn:x,path:u(T),position:`${k}:${j}`}}}).filter(f=>{var y,x;return f&&!r.some(T=>f.fn.includes(T))&&!(s&&((y=f.path)!=null&&y.startsWith("node:")))&&!(a&&((x=f.path)!=null&&x.endsWith(".js")))&&!e.some(T=>f.path.includes(T))}).slice(t,t+n)}var de=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:r=[],filterFunctions:i=[],stopOn:s=[],filterNode:a=!0,filterJs:u=!0,multiline:c=!1,formatFilename:m=f=>f}={}){h(this,"maxFrames");h(this,"skip");h(this,"filterPaths");h(this,"filterFunctions");h(this,"stopOn");h(this,"filterNode");h(this,"filterJs");h(this,"multiline");h(this,"formatFilename");h(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=r,this.filterFunctions=i,this.stopOn=s,this.filterNode=a,this.filterJs=u,this.multiline=c,this.formatFilename=m}tag(t){let e=this.tracking.get(t)||new Set;ye({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(!L)return"";let e=this.tracking.get(t);return e?[...e].map(r=>`${this.multiline?`
3
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}},_;function ut({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:s=!0,filterJs:a=!0,multiline:u=!1,formatFilename:c=m=>m}={}){L&&(_!=null||(_=new de({maxFrames:n,skip:t,filterPaths:e,filterFunctions:r,stopOn:i,filterNode:s,filterJs:a,multiline:u,formatFilename:c})))}function ct(n){_==null||_.tag(n)}function Ee(n){var t;return(t=_==null?void 0:_.frames(n))!=null?t:[]}var W=class{constructor(){ct(this)}};l();p();var ge=class{formatMultiple(t){return Promise.all(t.map(e=>this.format(e)))}formatMultipleSync(t){return t.map(e=>this.formatSync(e))}},re=class extends ge{async format(t){return t}formatSync(t){return t}};l();p();l();p();l();p();var P=class extends W{constructor(e){super();h(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 Rr=4;ut({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var ne=class{constructor(){h(this,"lineBuffer",[]);h(this,"indentLevel",0);h(this,"hasWrittenAnything",!1);h(this,"lastCharacterIsSemicolon",!1);h(this,"lastCharacterIsNewline",!1);h(this,"nodeStackFrames",[])}get buffer(){return L&&this.nodeStackFrames.length>0&&this.writeInternal(`
4
4
  `),this.lineBuffer.join(`
@@ -19,7 +19,7 @@ ${t}`)}return t}getContent(){let t=`package ${this.packageName};
19
19
  `,e=this.stringifyImports();return e.length>0?`${t}${e}
20
20
 
21
21
  ${this.buffer}`:t+this.buffer}stringifyImports(){return Array.from(this.imports).filter(t=>t!==this.packageName).map(t=>`import ${t};`).sort().join(`
22
- `)}};var d={};_e(d,{Access:()=>Pe,AstNode:()=>v,Class:()=>G,ClassInstantiation:()=>J,ClassReference:()=>w,CodeBlock:()=>Q,Method:()=>K,MethodInvocation:()=>z,Parameter:()=>X,Type:()=>ae,TypeLiteral:()=>I,Writer:()=>H,classReference:()=>Yr,class_:()=>$r,codeblock:()=>Dr,instantiateClass:()=>Wr,invokeMethod:()=>Vr,method:()=>Hr,parameter:()=>Gr});l();p();l();p();l();p();var Pe={Public:"public",Protected:"protected",Private:"private"};l();p();l();p();var v=class extends W{async toStringAsync({packageName:t,customConfig:e,formatter:r}){let i=new ie({packageName:t,customConfig:e,formatter:r});return this.write(i),i.toStringAsync()}toString({packageName:t,customConfig:e,formatter:r}){let i=new ie({packageName:t,customConfig:e,formatter:r});return this.write(i),i.toString()}};var G=class extends v{constructor({name:e,access:r}){super();h(this,"name");h(this,"access");h(this,"methods",[]);this.name=e,this.access=r}write(e){if(e.write(`${this.access} class ${this.name}`),this.isEmpty()){e.writeLine(" {}");return}e.writeLine(" {"),e.indent();for(let r of this.methods)e.writeNode(r),e.newLine();e.dedent(),e.write("}")}addMethod(e){this.methods.push(e)}isEmpty(){return this.methods.length===0}};l();p();l();p();l();p();l();p();var w=class extends v{constructor({name:e,packageName:r,fullyQualified:i}){super();h(this,"name");h(this,"packageName");h(this,"fullyQualified");this.name=e,this.packageName=r,this.fullyQualified=i!=null?i:!1}write(e){if(e.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){e.write(`${this.packageName}.${this.name}`);return}e.write(this.name)}};l();p();var ae=class extends v{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"array":e.writeNode(this.internalType.value),e.write("[]");break;case"bigInteger":e.writeNode(Ir);break;case"boolean":e.write("Boolean");break;case"bytes":e.write("byte[]");break;case"date":e.write("String");break;case"dateTime":e.writeNode(br);break;case"double":e.write("Double");break;case"float":e.write("Float");break;case"generic":e.writeNode(this.internalType.value),e.write("<");for(let[r,i]of this.internalType.parameters.entries())e.writeNode(i),r<this.internalType.parameters.length-1&&e.write(", ");e.write(">");break;case"inputStream":e.writeNode(Pr);break;case"integer":e.write("Integer");break;case"iterable":this.writeIterable({writer:e,iterable:this.internalType});break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write("Long");break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"object":{e.write("Object");break}case"optional":{this.writeOptional({writer:e,optional:this.internalType});break}case"reference":e.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:e,set:this.internalType});break}case"string":e.write("String");break;case"uuid":e.writeNode(Sr);break;case"void":e.write("Void");break;default:A(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(e){return new this({type:"array",value:e})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(e){return new this({type:"list",value:e})}static long(){return new this({type:"long"})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static object(){return new this({type:"object"})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static reference(e){return new this({type:"reference",value:e})}static generic(e,r){return new this({type:"generic",value:e,parameters:r})}static set(e){return new this({type:"set",value:e})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(e){return new this({type:"iterable",value:e})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:e,list:r}){e.writeNode(Ar),e.write("<"),r.value.write(e),e.write(">")}writeMap({writer:e,map:r}){e.writeNode(kr),e.write("<"),r.keyType.write(e),e.write(", "),r.valueType.write(e),e.write(">")}writeOptional({writer:e,optional:r}){e.writeNode(we),e.write("<"),r.value.write(e),e.write(">")}writeIterable({writer:e,iterable:r}){e.writeNode(we),e.write("<"),r.value.write(e),e.write(">")}writeSet({writer:e,set:r}){e.writeNode(Er),e.write("<"),r.value.write(e),e.write(">")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},xe=new w({name:"Arrays",packageName:"java.util"}),Ir=new w({name:"BigInteger",packageName:"java.math"}),na=new w({name:"HashMap",packageName:"java.util"}),Ar=new w({name:"List",packageName:"java.util"}),kr=new w({name:"Map",packageName:"java.util"}),br=new w({name:"OffsetDateTime",packageName:"java.time"}),we=new w({name:"Optional",packageName:"java.util"}),Er=new w({name:"Set",packageName:"java.util"}),Sr=new w({name:"UUID",packageName:"java.util"}),Pr=new w({name:"InputStream",packageName:"java.io"});var I=class n extends v{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:e,bigInteger:this.internalType});break;case"boolean":e.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:e,builder:this.internalType});break;case"bytes":e.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"date":e.write(`"${this.internalType.value}"`);break;case"dateTime":this.writeDateTime({writer:e,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?e.write(`${r}.0`):e.write(r);break}case"enum":this.writeEnum({writer:e,enum_:this.internalType});break;case"float":e.write(`${this.internalType.value}f`);break;case"integer":e.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"optional":{this.writeOptional({writer:e,optional:this.internalType});break}case"raw":{this.internalType.value instanceof v?e.writeNode(this.internalType.value):e.write(this.internalType.value);break}case"reference":e.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:e,set:this.internalType});break}case"string":e.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:e,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:e,uuid:this.internalType});break;case"nop":break;default:A(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(e){return new this({type:"bigInteger",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static builder({classReference:e,parameters:r}){return new this({type:"builder",classReference:e,parameters:r})}static bytes(e){return new this({type:"bytes",value:e})}static class_({reference:e,parameters:r}){return new this({type:"class",reference:e,parameters:r})}static date(e){return new this({type:"date",value:e})}static dateTime(e){return new this({type:"dateTime",value:e})}static double(e){return new this({type:"double",value:e})}static enum_({classReference:e,value:r}){return new this({type:"enum",classReference:e,value:r})}static float(e){return new this({type:"float",value:e})}static integer(e){return new this({type:"integer",value:e})}static list({valueType:e,values:r,isParameter:i}){return new this({type:"list",valueType:e,values:r,isParameter:i})}static long(e){return new this({type:"long",value:e})}static map({keyType:e,valueType:r,entries:i}){return new this({type:"map",keyType:e,valueType:r,entries:i})}static optional({value:e,useOf:r}){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e,useOf:r})}static raw(e){return new this({type:"raw",value:e})}static reference(e){return new this({type:"reference",value:e})}static set({valueType:e,values:r}){return new this({type:"set",valueType:e,values:r})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){return new this({type:"uuid",value:e})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:A(this.internalType)}}writeBigInteger({writer:e,bigInteger:r}){e.write("new "),e.writeNode(d.instantiateClass({classReference:Br,arguments_:[n.string(r.value)]}))}writeBuilder({writer:e,builder:r}){e.writeNode(r.classReference),e.writeNewLineIfLastLineNot(),e.indent(),this.writeBuilderParameters({writer:e,parameters:this.orderBuilderParameters(_r({parameters:r.parameters}))}),e.dedent()}writeBuilderParameters({writer:e,parameters:r}){e.writeLine(".builder()");for(let i of r)e.write(`.${i.name}(`),i.value.shouldWriteInLine()||e.newLine(),e.indent(),e.writeNode(i.value),e.dedent(),i.value.shouldWriteInLine()||e.newLine(),e.writeLine(")");e.writeNewLineIfLastLineNot(),e.write(".build()")}orderBuilderParameters(e){return e.some(i=>!i.value.isOptional()&&!this.isCollection(i.value))?e.sort((i,s)=>{let a=this.isNonRequired(i.value),u=this.isNonRequired(s.value);return a&&!u?1:!a&&u?-1:0}):e.sort((i,s)=>{let a=i.value.isOptional(),u=s.value.isOptional();return a&&!u?1:!a&&u?-1:0})}isCollection(e){let r=e.internalType.type;return r==="list"||r==="set"||r==="map"}isNonRequired(e){return e.isOptional()||this.isCollection(e)}writeClass({writer:e,class_:r}){let i=Mr({parameters:r.parameters});e.writeNode(d.instantiateClass({classReference:r.reference,arguments_:i.map(s=>s.value)}))}writeDateTime({writer:e,dateTime:r}){e.writeNode(d.invokeMethod({on:Lr,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:e,enum_:r}){e.writeNode(r.classReference),e.write("."+r.value)}writeList({writer:e,list:r}){this.writeIterable({writer:e,iterable:r})}writeMap({writer:e,map:r}){let i=Ur({entries:r.entries});if(i.length===0){e.write("new "),e.writeNode(ve),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(ve),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.writeLine(">() {{"),e.indent();for(let s of i)e.write("put("),e.writeNode(s.key),e.write(", "),e.writeNode(s.value),e.writeLine(");");e.dedent(),e.write("}}")}writeOptional({writer:e,optional:r}){if(!r.useOf){e.writeNode(r.value);return}e.writeNode(d.invokeMethod({on:we,method:"of",arguments_:[r.value]}))}writeSet({writer:e,set:r}){this.writeIterable({writer:e,iterable:r})}writeIterable({writer:e,iterable:r}){let i=r.type==="list"?Be:Cr,s=Or({values:r.values});if(r.type==="list"&&r.isParameter&&s.length>0){e.writeNode(d.invokeMethod({on:xe,method:"asList",arguments_:s}));return}if(s.length===0){e.write(`new ${i.name}<`),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(i),e.write("<"),e.writeNode(r.valueType),e.writeLine(">("),e.indent(),e.writeNode(d.invokeMethod({on:xe,method:"asList",arguments_:s})),e.writeNewLineIfLastLineNot(),e.dedent(),e.write(")")}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(`"${this.escapeString(r)}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:e,value:r});return}this.writeUnknownMap({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:e,value:r}){if(r.length===0){e.write("new "),e.writeNode(Be),e.write("<Object>()");return}e.write("new "),e.writeNode(Be),e.write("<Object>("),e.writeNode(d.invokeMethod({on:xe,method:"asList",arguments_:r.map(i=>n.unknown(i))})),e.write(")")}writeUnknownMap({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("new "),e.writeNode(ve),e.write("<String, Object>()");return}e.writeLine("new "),e.writeNode(ve),e.write("<String, Object>() {{"),e.indent();for(let[s,a]of i)e.write(`put("${s}", `),e.writeNode(n.unknown(a)),e.writeLine(");");e.dedent(),e.write("}}")}writeUUID({writer:e,uuid:r}){e.writeNode(d.invokeMethod({on:Fr,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},Be=new w({name:"ArrayList",packageName:"java.util"}),Br=new w({name:"BigInteger",packageName:"java.math"}),ve=new w({name:"HashMap",packageName:"java.util"}),Cr=new w({name:"HashSet",packageName:"java.util"}),fa=new w({name:"List",packageName:"java.util"}),ma=new w({name:"Map",packageName:"java.util"}),Lr=new w({name:"OffsetDateTime",packageName:"java.time"}),da=new w({name:"Set",packageName:"java.util"}),Fr=new w({name:"UUID",packageName:"java.util"});function Mr({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function _r({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function Ur({entries:n}){return n.filter(t=>!I.isNop(t.key)&&!I.isNop(t.value))}function Or({values:n}){return n.filter(t=>!I.isNop(t))}function Te({writer:n,arguments_:t}){let e=jr(t);if(e.length===0){n.write("()");return}if(e.some(i=>i instanceof I&&!i.shouldWriteInLine())){qr({writer:n,arguments_:e});return}n.write("("),e.forEach((i,s)=>{s>0&&n.write(", "),lt({writer:n,argument:i})}),n.write(")")}function qr({writer:n,arguments_:t}){n.writeLine("("),n.indent(),t.forEach((e,r)=>{r>0&&n.writeLine(","),lt({writer:n,argument:e})}),n.dedent(),t.length>0&&n.newLine(),n.write(")")}function lt({writer:n,argument:t}){Se(t)?n.writeNodeOrString(t.assignment):t.write(n)}function jr(n){return n.filter(t=>!(t instanceof I&&I.isNop(t)))}var J=class extends v{constructor({classReference:e,arguments_:r}){super();h(this,"classReference");h(this,"arguments_");this.classReference=e,this.arguments_=r}write(e){e.writeNode(this.classReference),Te({writer:e,arguments_:this.arguments_})}};l();p();var Q=class extends v{constructor(e){super();h(this,"arg");this.arg=e}write(e){return new P(this.arg).write(e)}};l();p();var K=class extends v{constructor({name:e,access:r,parameters:i,body:s,static_:a,return_:u}){super();h(this,"name");h(this,"access");h(this,"parameters");h(this,"body");h(this,"return_");h(this,"static_");this.name=e,this.access=r,this.parameters=i,this.body=s,this.return_=u,this.static_=a!=null?a:!1}write(e){if(e.write(`${this.access} `),this.static_&&e.write("static "),this.return_!=null?e.writeNode(this.return_):e.write("void"),e.write(` ${this.name}`),this.parameters.length===0)e.write("()");else if(this.parameters.length===1){if(e.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);e.writeNode(this.parameters[0]),e.write(")")}else e.writeLine("("),e.indent(),this.parameters.forEach((r,i)=>{i>0&&e.writeLine(", "),e.writeNode(r)}),e.dedent(),e.write(")");if(this.body==null){e.write(";");return}e.writeLine(" {"),e.indent(),e.writeNode(this.body),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("}")}};l();p();var z=class extends v{constructor({method:e,arguments_:r,on:i}){super();h(this,"on");h(this,"method");h(this,"arguments_");this.on=i,this.method=e,this.arguments_=r}write(e){this.on.write(e),e.write("."),e.write(this.method),Te({writer:e,arguments_:this.arguments_})}};l();p();var X=class extends v{constructor({name:e,type:r}){super();h(this,"name");h(this,"type");this.name=e,this.type=r}write(e){e.writeNode(this.type),e.write(` ${this.name}`)}};function Dr(n){return new Q(n)}function $r(n){return new G(n)}function Yr(n){return new w(n)}function Wr(n){return new J(n)}function Vr(n){return new z(n)}function Hr(n){return new K(n)}function Gr(n){return new X(n)}var pt="com.example.usage",Jr="Example",Qr="main",Kr="args",ht="client",zr={type:"primitive",value:"STRING"},Ce=class{constructor({context:t,formatter:e}){h(this,"context");h(this,"formatter");this.context=t,this.formatter=e}async generateSnippet({endpoint:t,request:e,options:r}){var a;let i=this.getConfig(r);return await this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toStringAsync({packageName:(a=i.fullStylePackageName)!=null?a:pt,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e,options:r}){var a;let i=this.getConfig(r);return this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toString({packageName:(a=i.fullStylePackageName)!=null?a:pt,customConfig:this.context.customConfig,formatter:this.formatter})}buildCodeBlock({endpoint:t,snippet:e,options:r}){let i=d.codeblock(a=>{a.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),a.newLine(),a.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))}),s=this.getStyle(r);switch(s){case V.Concise:return i;case V.Full:return this.buildFullCodeBlock({body:i,options:r});default:A(s)}}constructClient({endpoint:t,snippet:e}){return d.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${ht} = `),r.writeNode(d.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:t,snippet:e})}))})}buildFullCodeBlock({body:t,options:e}){var a;let r=this.getConfig(e),i=d.class_({name:(a=r.fullStyleClassName)!=null?a:Jr,access:d.Access.Public}),s=d.parameter({name:Kr,type:d.Type.array(d.Type.string())});return i.addMethod(d.method({name:Qr,access:d.Access.Public,static_:!0,parameters:[s],body:t})),i}getRootClientBuilderArgs({endpoint:t,snippet:e}){var u,c;let r=[];t.auth!=null&&(e.auth!=null?r.push(...this.getRootClientAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:U.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let i=this.getRootClientBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});i!=null&&r.push(i),this.context.errors.scope(E.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope();let s=new Set;if([...(u=this.context.ir.pathParameters)!=null?u:[],...(c=t.request.pathParameters)!=null?c:[]].forEach(m=>{m.variable!=null&&s.add(m.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let m of this.context.ir.variables)if(s.has(m.id)){let f=m.name.camelCase.unsafeName;r.push({name:f,value:d.TypeLiteral.string(`YOUR_${m.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(E.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let m=this.context.ir.pathParameters.filter(f=>f.variable==null);m.length>0&&r.push(...this.getPathParameters({namedParameters:m,snippet:e}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:t,environment:e}){var r;if(t!=null&&e!=null){this.context.errors.add({severity:U.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null){if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"){this.context.errors.add({severity:U.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:d.TypeLiteral.string(t)}}if(e!=null){if(this.context.isSingleEnvironmentID(e)){let i=this.context.getEnvironmentTypeReferenceFromID(e);if(i==null){this.context.errors.add({severity:U.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return{name:"environment",value:d.TypeLiteral.reference(i)}}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?{name:"environment",value:d.TypeLiteral.reference(d.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(e).map(i=>this.context.dynamicTypeLiteralMapper.convert({typeReference:zr,value:i}))}))}:void 0}}getRootClientAuthArgs({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),[];switch(t.type){case"basic":return e.type==="basic"?this.getRootClientBasicAuthArgs({auth:t,values:e}):[];case"bearer":return e.type==="bearer"?this.getRootClientBearerAuthArgs({auth:t,values:e}):[];case"header":return e.type==="header"?this.getRootClientHeaderAuthArgs({auth:t,values:e}):[];case"oauth":return e.type==="oauth"?this.getRootClientOAuthArgs({auth:t,values:e}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:A(t)}}addError(t){this.context.errors.add({severity:U.Critical,message:t})}addWarning(t){this.context.errors.add({severity:U.Warning,message:t})}getRootClientBasicAuthArgs({auth:t,values:e}){return[{name:"credentials",value:d.TypeLiteral.raw(`"${e.username}", "${e.password}"`)}]}getRootClientBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.token),value:d.TypeLiteral.string(e.token)}]}getRootClientHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getRootClientOAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.clientId),value:d.TypeLiteral.string(e.clientId)},{name:this.context.getMethodName(t.clientSecret),value:d.TypeLiteral.string(e.clientSecret)}]}getRootClientHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let s=this.getRootClientHeaderArg({header:i,value:e.value});s!=null&&r.push({name:this.context.getMethodName(i.name.name),value:s})}return r}getRootClientHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!d.TypeLiteral.isNop(r))return r}callMethod({endpoint:t,snippet:e}){return d.invokeMethod({on:d.codeblock(ht),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e})})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:A(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var a;let r=[];this.context.errors.scope(E.PathParameters);let i=((a=t.pathParameters)!=null?a:[]).filter(u=>u.variable==null);i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:e}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(E.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope();let s=this.getRequestOptionsArg({request:t,snippet:e});return s!=null&&r.push(s),r}usesOptionalNullable(){var t;return((t=this.context.customConfig)==null?void 0:t["collapse-optional-nullable"])===!0}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":{if(t.value.type==="optional"){if(e==null)return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value.value,value:e,as:"request"}),i=r.toString({packageName:"com.example",customConfig:this.context.customConfig});return i.includes("Optional.empty()")||i.includes("OptionalNullable.absent()")?r:this.usesOptionalNullable()?this.context.getOptionalNullableOf(r):d.TypeLiteral.optional({value:r,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,as:"request"})}default:A(t)}}getBytesBodyRequestArg({value:t}){return t==null?d.TypeLiteral.bytes(""):typeof t!="string"?(this.context.errors.add({severity:U.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),d.TypeLiteral.nop()):d.TypeLiteral.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){var m;let r=[],{inlinePathParameters:i,inlineFileProperties:s}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(E.PathParameters);let a=[],u=((m=t.pathParameters)!=null?m:[]).filter(f=>f.variable==null);u.length>0&&a.push(...this.getPathParameters({namedParameters:u,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(E.RequestBody);let c=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...a.map(f=>f.value)),s||r.push(...c.fileFields.map(f=>f.value)),r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?a:[],filePropertyInfo:c})),r}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:i}){var k,j,se,Le,Fe,Me;this.context.errors.scope(E.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(k=t.queryParameters)!=null?k:[],values:(j=e.queryParameters)!=null?j:{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),c=this.context.sortTypeInstancesByRequiredFirst(a,(se=t.queryParameters)!=null?se:[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:S.typeReference,value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(E.Headers);let f=this.context.associateByWireValue({parameters:(Le=t.headers)!=null?Le:[],values:(Fe=e.headers)!=null?Fe:{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),x=this.context.sortTypeInstancesByRequiredFirst(f,(Me=t.headers)!=null?Me:[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:S.typeReference,value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(E.RequestBody);let T=t.body!=null?this.getInlinedRequestBodyBuilderParameters({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:d.classReference({name:this.context.getClassName(t.declaration.name),packageName:this.context.getRequestsPackageName(t.declaration.fernFilepath)}),parameters:[...r,...x,...c,...T]})}getRequestOptionsArg({request:t,snippet:e}){var c,m,f;let r="headers"in t?(c=t.headers)!=null?c:[]:[];if(r.length===0||Object.keys((m=e.headers)!=null?m:{}).length===0)return;this.context.errors.scope(E.Headers);let i=this.context.associateByWireValue({parameters:r,values:(f=e.headers)!=null?f:{}});if(this.context.errors.unscope(),i.length===0)return;let s=d.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),a=d.invokeMethod({on:s,method:"builder",arguments_:[]});for(let y of i)a=d.invokeMethod({on:a,method:"addHeader",arguments_:[d.TypeLiteral.string(y.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(y)]});let u=d.invokeMethod({on:a,method:"build",arguments_:[]});return d.TypeLiteral.reference(u)}getInlinedRequestBodyBuilderParameters({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:A(t)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:t}){return this.context.shouldInlineFileProperties()?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e}){return{name:this.context.getMethodName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,as:"request"});default:A(t)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:t,value:e}){var a;let i=this.context.associateByWireValue({parameters:t,values:(a=this.context.getRecord(e))!=null?a:{}}).filter(u=>!this.context.isDirectLiteral(u.typeReference));return this.context.sortTypeInstancesByRequiredFirst(i,t).map(u=>({name:this.context.getMethodName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:u.typeReference,value:u.value,as:"request"})}))}getPathParameters({namedParameters:t,snippet:e}){var s;let r=[],i=this.context.associateByWireValue({parameters:t,values:(s=e.pathParameters)!=null?s:{}});for(let a of i)r.push({name:this.context.getMethodName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>`${this.context.getMethodName(e)}()`).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getStyle(t){var e,r;return(r=(e=t.style)!=null?e:this.context.options.style)!=null?r:V.Full}getConfig(t){var e,r;return(r=(e=t.config)!=null?e:this.context.options.config)!=null?r:{}}};0&&(module.exports={EndpointSnippetGenerator});
22
+ `)}};var d={};_e(d,{Access:()=>Pe,AstNode:()=>v,Class:()=>G,ClassInstantiation:()=>J,ClassReference:()=>w,CodeBlock:()=>Q,Method:()=>K,MethodInvocation:()=>z,Parameter:()=>X,Type:()=>ae,TypeLiteral:()=>I,Writer:()=>H,classReference:()=>Wr,class_:()=>Yr,codeblock:()=>$r,instantiateClass:()=>Vr,invokeMethod:()=>Hr,method:()=>Gr,parameter:()=>Jr});l();p();l();p();l();p();var Pe={Public:"public",Protected:"protected",Private:"private"};l();p();l();p();var v=class extends W{async toStringAsync({packageName:t,customConfig:e,formatter:r}){let i=new ie({packageName:t,customConfig:e,formatter:r});return this.write(i),i.toStringAsync()}toString({packageName:t,customConfig:e,formatter:r}){let i=new ie({packageName:t,customConfig:e,formatter:r});return this.write(i),i.toString()}};var G=class extends v{constructor({name:e,access:r}){super();h(this,"name");h(this,"access");h(this,"methods",[]);this.name=e,this.access=r}write(e){if(e.write(`${this.access} class ${this.name}`),this.isEmpty()){e.writeLine(" {}");return}e.writeLine(" {"),e.indent();for(let r of this.methods)e.writeNode(r),e.newLine();e.dedent(),e.write("}")}addMethod(e){this.methods.push(e)}isEmpty(){return this.methods.length===0}};l();p();l();p();l();p();l();p();var w=class extends v{constructor({name:e,packageName:r,fullyQualified:i}){super();h(this,"name");h(this,"packageName");h(this,"fullyQualified");this.name=e,this.packageName=r,this.fullyQualified=i!=null?i:!1}write(e){if(e.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){e.write(`${this.packageName}.${this.name}`);return}e.write(this.name)}};l();p();var ae=class extends v{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"array":e.writeNode(this.internalType.value),e.write("[]");break;case"bigInteger":e.writeNode(Ir);break;case"boolean":e.write("Boolean");break;case"bytes":e.write("byte[]");break;case"date":e.write("String");break;case"dateTime":e.writeNode(br);break;case"double":e.write("Double");break;case"float":e.write("Float");break;case"generic":e.writeNode(this.internalType.value),e.write("<");for(let[r,i]of this.internalType.parameters.entries())e.writeNode(i),r<this.internalType.parameters.length-1&&e.write(", ");e.write(">");break;case"inputStream":e.writeNode(Pr);break;case"integer":e.write("Integer");break;case"iterable":this.writeIterable({writer:e,iterable:this.internalType});break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write("Long");break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"object":{e.write("Object");break}case"optional":{this.writeOptional({writer:e,optional:this.internalType});break}case"reference":e.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:e,set:this.internalType});break}case"string":e.write("String");break;case"uuid":e.writeNode(Sr);break;case"void":e.write("Void");break;default:A(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(e){return new this({type:"array",value:e})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(e){return new this({type:"list",value:e})}static long(){return new this({type:"long"})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static object(){return new this({type:"object"})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static reference(e){return new this({type:"reference",value:e})}static generic(e,r){return new this({type:"generic",value:e,parameters:r})}static set(e){return new this({type:"set",value:e})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(e){return new this({type:"iterable",value:e})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:e,list:r}){e.writeNode(Ar),e.write("<"),r.value.write(e),e.write(">")}writeMap({writer:e,map:r}){e.writeNode(kr),e.write("<"),r.keyType.write(e),e.write(", "),r.valueType.write(e),e.write(">")}writeOptional({writer:e,optional:r}){e.writeNode(we),e.write("<"),r.value.write(e),e.write(">")}writeIterable({writer:e,iterable:r}){e.writeNode(we),e.write("<"),r.value.write(e),e.write(">")}writeSet({writer:e,set:r}){e.writeNode(Er),e.write("<"),r.value.write(e),e.write(">")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},xe=new w({name:"Arrays",packageName:"java.util"}),Ir=new w({name:"BigInteger",packageName:"java.math"}),ia=new w({name:"HashMap",packageName:"java.util"}),Ar=new w({name:"List",packageName:"java.util"}),kr=new w({name:"Map",packageName:"java.util"}),br=new w({name:"OffsetDateTime",packageName:"java.time"}),we=new w({name:"Optional",packageName:"java.util"}),Er=new w({name:"Set",packageName:"java.util"}),Sr=new w({name:"UUID",packageName:"java.util"}),Pr=new w({name:"InputStream",packageName:"java.io"});var I=class n extends v{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:e,bigInteger:this.internalType});break;case"boolean":e.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:e,builder:this.internalType});break;case"bytes":e.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"date":this.writeDate({writer:e,date:this.internalType});break;case"dateTime":this.writeDateTime({writer:e,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?e.write(`${r}.0`):e.write(r);break}case"enum":this.writeEnum({writer:e,enum_:this.internalType});break;case"float":e.write(`${this.internalType.value}f`);break;case"integer":e.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"optional":{this.writeOptional({writer:e,optional:this.internalType});break}case"raw":{this.internalType.value instanceof v?e.writeNode(this.internalType.value):e.write(this.internalType.value);break}case"reference":e.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:e,set:this.internalType});break}case"string":e.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:e,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:e,uuid:this.internalType});break;case"nop":break;default:A(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(e){return new this({type:"bigInteger",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static builder({classReference:e,parameters:r}){return new this({type:"builder",classReference:e,parameters:r})}static bytes(e){return new this({type:"bytes",value:e})}static class_({reference:e,parameters:r}){return new this({type:"class",reference:e,parameters:r})}static date(e){return new this({type:"date",value:e})}static dateTime(e){return new this({type:"dateTime",value:e})}static double(e){return new this({type:"double",value:e})}static enum_({classReference:e,value:r}){return new this({type:"enum",classReference:e,value:r})}static float(e){return new this({type:"float",value:e})}static integer(e){return new this({type:"integer",value:e})}static list({valueType:e,values:r,isParameter:i}){return new this({type:"list",valueType:e,values:r,isParameter:i})}static long(e){return new this({type:"long",value:e})}static map({keyType:e,valueType:r,entries:i}){return new this({type:"map",keyType:e,valueType:r,entries:i})}static optional({value:e,useOf:r}){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e,useOf:r})}static raw(e){return new this({type:"raw",value:e})}static reference(e){return new this({type:"reference",value:e})}static set({valueType:e,values:r}){return new this({type:"set",valueType:e,values:r})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){return new this({type:"uuid",value:e})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:A(this.internalType)}}writeBigInteger({writer:e,bigInteger:r}){e.write("new "),e.writeNode(d.instantiateClass({classReference:Br,arguments_:[n.string(r.value)]}))}writeBuilder({writer:e,builder:r}){e.writeNode(r.classReference),e.writeNewLineIfLastLineNot(),e.indent(),this.writeBuilderParameters({writer:e,parameters:this.orderBuilderParameters(Ur({parameters:r.parameters}))}),e.dedent()}writeBuilderParameters({writer:e,parameters:r}){e.writeLine(".builder()");for(let i of r)e.write(`.${i.name}(`),i.value.shouldWriteInLine()||e.newLine(),e.indent(),e.writeNode(i.value),e.dedent(),i.value.shouldWriteInLine()||e.newLine(),e.writeLine(")");e.writeNewLineIfLastLineNot(),e.write(".build()")}orderBuilderParameters(e){return e.some(i=>!i.value.isOptional()&&!this.isCollection(i.value))?e.sort((i,s)=>{let a=this.isNonRequired(i.value),u=this.isNonRequired(s.value);return a&&!u?1:!a&&u?-1:0}):e.sort((i,s)=>{let a=i.value.isOptional(),u=s.value.isOptional();return a&&!u?1:!a&&u?-1:0})}isCollection(e){let r=e.internalType.type;return r==="list"||r==="set"||r==="map"}isNonRequired(e){return e.isOptional()||this.isCollection(e)}writeClass({writer:e,class_:r}){let i=_r({parameters:r.parameters});e.writeNode(d.instantiateClass({classReference:r.reference,arguments_:i.map(s=>s.value)}))}writeDate({writer:e,date:r}){e.writeNode(d.invokeMethod({on:Lr,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:e,dateTime:r}){e.writeNode(d.invokeMethod({on:Fr,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:e,enum_:r}){e.writeNode(r.classReference),e.write("."+r.value)}writeList({writer:e,list:r}){this.writeIterable({writer:e,iterable:r})}writeMap({writer:e,map:r}){let i=Or({entries:r.entries});if(i.length===0){e.write("new "),e.writeNode(ve),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(ve),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.writeLine(">() {{"),e.indent();for(let s of i)e.write("put("),e.writeNode(s.key),e.write(", "),e.writeNode(s.value),e.writeLine(");");e.dedent(),e.write("}}")}writeOptional({writer:e,optional:r}){if(!r.useOf){e.writeNode(r.value);return}e.writeNode(d.invokeMethod({on:we,method:"of",arguments_:[r.value]}))}writeSet({writer:e,set:r}){this.writeIterable({writer:e,iterable:r})}writeIterable({writer:e,iterable:r}){let i=r.type==="list"?Be:Cr,s=qr({values:r.values});if(r.type==="list"&&r.isParameter&&s.length>0){e.writeNode(d.invokeMethod({on:xe,method:"asList",arguments_:s}));return}if(s.length===0){e.write(`new ${i.name}<`),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(i),e.write("<"),e.writeNode(r.valueType),e.writeLine(">("),e.indent(),e.writeNode(d.invokeMethod({on:xe,method:"asList",arguments_:s})),e.writeNewLineIfLastLineNot(),e.dedent(),e.write(")")}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(`"${this.escapeString(r)}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:e,value:r});return}this.writeUnknownMap({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:e,value:r}){if(r.length===0){e.write("new "),e.writeNode(Be),e.write("<Object>()");return}e.write("new "),e.writeNode(Be),e.write("<Object>("),e.writeNode(d.invokeMethod({on:xe,method:"asList",arguments_:r.map(i=>n.unknown(i))})),e.write(")")}writeUnknownMap({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("new "),e.writeNode(ve),e.write("<String, Object>()");return}e.writeLine("new "),e.writeNode(ve),e.write("<String, Object>() {{"),e.indent();for(let[s,a]of i)e.write(`put("${s}", `),e.writeNode(n.unknown(a)),e.writeLine(");");e.dedent(),e.write("}}")}writeUUID({writer:e,uuid:r}){e.writeNode(d.invokeMethod({on:Mr,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},Be=new w({name:"ArrayList",packageName:"java.util"}),Br=new w({name:"BigInteger",packageName:"java.math"}),ve=new w({name:"HashMap",packageName:"java.util"}),Cr=new w({name:"HashSet",packageName:"java.util"}),ma=new w({name:"List",packageName:"java.util"}),Lr=new w({name:"LocalDate",packageName:"java.time"}),da=new w({name:"Map",packageName:"java.util"}),Fr=new w({name:"OffsetDateTime",packageName:"java.time"}),ya=new w({name:"Set",packageName:"java.util"}),Mr=new w({name:"UUID",packageName:"java.util"});function _r({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function Ur({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function Or({entries:n}){return n.filter(t=>!I.isNop(t.key)&&!I.isNop(t.value))}function qr({values:n}){return n.filter(t=>!I.isNop(t))}function Te({writer:n,arguments_:t}){let e=Dr(t);if(e.length===0){n.write("()");return}if(e.some(i=>i instanceof I&&!i.shouldWriteInLine())){jr({writer:n,arguments_:e});return}n.write("("),e.forEach((i,s)=>{s>0&&n.write(", "),lt({writer:n,argument:i})}),n.write(")")}function jr({writer:n,arguments_:t}){n.writeLine("("),n.indent(),t.forEach((e,r)=>{r>0&&n.writeLine(","),lt({writer:n,argument:e})}),n.dedent(),t.length>0&&n.newLine(),n.write(")")}function lt({writer:n,argument:t}){Se(t)?n.writeNodeOrString(t.assignment):t.write(n)}function Dr(n){return n.filter(t=>!(t instanceof I&&I.isNop(t)))}var J=class extends v{constructor({classReference:e,arguments_:r}){super();h(this,"classReference");h(this,"arguments_");this.classReference=e,this.arguments_=r}write(e){e.writeNode(this.classReference),Te({writer:e,arguments_:this.arguments_})}};l();p();var Q=class extends v{constructor(e){super();h(this,"arg");this.arg=e}write(e){return new P(this.arg).write(e)}};l();p();var K=class extends v{constructor({name:e,access:r,parameters:i,body:s,static_:a,return_:u}){super();h(this,"name");h(this,"access");h(this,"parameters");h(this,"body");h(this,"return_");h(this,"static_");this.name=e,this.access=r,this.parameters=i,this.body=s,this.return_=u,this.static_=a!=null?a:!1}write(e){if(e.write(`${this.access} `),this.static_&&e.write("static "),this.return_!=null?e.writeNode(this.return_):e.write("void"),e.write(` ${this.name}`),this.parameters.length===0)e.write("()");else if(this.parameters.length===1){if(e.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);e.writeNode(this.parameters[0]),e.write(")")}else e.writeLine("("),e.indent(),this.parameters.forEach((r,i)=>{i>0&&e.writeLine(", "),e.writeNode(r)}),e.dedent(),e.write(")");if(this.body==null){e.write(";");return}e.writeLine(" {"),e.indent(),e.writeNode(this.body),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("}")}};l();p();var z=class extends v{constructor({method:e,arguments_:r,on:i}){super();h(this,"on");h(this,"method");h(this,"arguments_");this.on=i,this.method=e,this.arguments_=r}write(e){this.on.write(e),e.write("."),e.write(this.method),Te({writer:e,arguments_:this.arguments_})}};l();p();var X=class extends v{constructor({name:e,type:r}){super();h(this,"name");h(this,"type");this.name=e,this.type=r}write(e){e.writeNode(this.type),e.write(` ${this.name}`)}};function $r(n){return new Q(n)}function Yr(n){return new G(n)}function Wr(n){return new w(n)}function Vr(n){return new J(n)}function Hr(n){return new z(n)}function Gr(n){return new K(n)}function Jr(n){return new X(n)}var pt="com.example.usage",Qr="Example",Kr="main",zr="args",ht="client",Xr={type:"primitive",value:"STRING"},Ce=class{constructor({context:t,formatter:e}){h(this,"context");h(this,"formatter");this.context=t,this.formatter=e}async generateSnippet({endpoint:t,request:e,options:r}){var a;let i=this.getConfig(r);return await this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toStringAsync({packageName:(a=i.fullStylePackageName)!=null?a:pt,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e,options:r}){var a;let i=this.getConfig(r);return this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toString({packageName:(a=i.fullStylePackageName)!=null?a:pt,customConfig:this.context.customConfig,formatter:this.formatter})}buildCodeBlock({endpoint:t,snippet:e,options:r}){let i=d.codeblock(a=>{a.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),a.newLine(),a.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))}),s=this.getStyle(r);switch(s){case V.Concise:return i;case V.Full:return this.buildFullCodeBlock({body:i,options:r});default:A(s)}}constructClient({endpoint:t,snippet:e}){return d.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${ht} = `),r.writeNode(d.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:t,snippet:e})}))})}buildFullCodeBlock({body:t,options:e}){var a;let r=this.getConfig(e),i=d.class_({name:(a=r.fullStyleClassName)!=null?a:Qr,access:d.Access.Public}),s=d.parameter({name:zr,type:d.Type.array(d.Type.string())});return i.addMethod(d.method({name:Kr,access:d.Access.Public,static_:!0,parameters:[s],body:t})),i}getRootClientBuilderArgs({endpoint:t,snippet:e}){var u,c;let r=[];t.auth!=null&&(e.auth!=null?r.push(...this.getRootClientAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:U.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let i=this.getRootClientBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});i!=null&&r.push(i),this.context.errors.scope(E.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope();let s=new Set;if([...(u=this.context.ir.pathParameters)!=null?u:[],...(c=t.request.pathParameters)!=null?c:[]].forEach(m=>{m.variable!=null&&s.add(m.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let m of this.context.ir.variables)if(s.has(m.id)){let f=m.name.camelCase.unsafeName;r.push({name:f,value:d.TypeLiteral.string(`YOUR_${m.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(E.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let m=this.context.ir.pathParameters.filter(f=>f.variable==null);m.length>0&&r.push(...this.getPathParameters({namedParameters:m,snippet:e}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:t,environment:e}){var r;if(t!=null&&e!=null){this.context.errors.add({severity:U.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null){if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"){this.context.errors.add({severity:U.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:d.TypeLiteral.string(t)}}if(e!=null){if(this.context.isSingleEnvironmentID(e)){let i=this.context.getEnvironmentTypeReferenceFromID(e);if(i==null){this.context.errors.add({severity:U.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return{name:"environment",value:d.TypeLiteral.reference(i)}}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?{name:"environment",value:d.TypeLiteral.reference(d.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(e).map(i=>this.context.dynamicTypeLiteralMapper.convert({typeReference:Xr,value:i}))}))}:void 0}}getRootClientAuthArgs({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),[];switch(t.type){case"basic":return e.type==="basic"?this.getRootClientBasicAuthArgs({auth:t,values:e}):[];case"bearer":return e.type==="bearer"?this.getRootClientBearerAuthArgs({auth:t,values:e}):[];case"header":return e.type==="header"?this.getRootClientHeaderAuthArgs({auth:t,values:e}):[];case"oauth":return e.type==="oauth"?this.getRootClientOAuthArgs({auth:t,values:e}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:A(t)}}addError(t){this.context.errors.add({severity:U.Critical,message:t})}addWarning(t){this.context.errors.add({severity:U.Warning,message:t})}getRootClientBasicAuthArgs({auth:t,values:e}){return[{name:"credentials",value:d.TypeLiteral.raw(`"${e.username}", "${e.password}"`)}]}getRootClientBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.token),value:d.TypeLiteral.string(e.token)}]}getRootClientHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getRootClientOAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.clientId),value:d.TypeLiteral.string(e.clientId)},{name:this.context.getMethodName(t.clientSecret),value:d.TypeLiteral.string(e.clientSecret)}]}getRootClientHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let s=this.getRootClientHeaderArg({header:i,value:e.value});s!=null&&r.push({name:this.context.getMethodName(i.name.name),value:s})}return r}getRootClientHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!d.TypeLiteral.isNop(r))return r}callMethod({endpoint:t,snippet:e}){return d.invokeMethod({on:d.codeblock(ht),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e})})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:A(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var a;let r=[];this.context.errors.scope(E.PathParameters);let i=((a=t.pathParameters)!=null?a:[]).filter(u=>u.variable==null);i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:e}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(E.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope();let s=this.getRequestOptionsArg({request:t,snippet:e});return s!=null&&r.push(s),r}usesOptionalNullable(){var t;return((t=this.context.customConfig)==null?void 0:t["collapse-optional-nullable"])===!0}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":{if(t.value.type==="optional"){if(e==null)return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value.value,value:e,as:"request"}),i=r.toString({packageName:"com.example",customConfig:this.context.customConfig});return i.includes("Optional.empty()")||i.includes("OptionalNullable.absent()")?r:this.usesOptionalNullable()?this.context.getOptionalNullableOf(r):d.TypeLiteral.optional({value:r,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,as:"request"})}default:A(t)}}getBytesBodyRequestArg({value:t}){return t==null?d.TypeLiteral.bytes(""):typeof t!="string"?(this.context.errors.add({severity:U.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),d.TypeLiteral.nop()):d.TypeLiteral.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){var m;let r=[],{inlinePathParameters:i,inlineFileProperties:s}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(E.PathParameters);let a=[],u=((m=t.pathParameters)!=null?m:[]).filter(f=>f.variable==null);u.length>0&&a.push(...this.getPathParameters({namedParameters:u,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(E.RequestBody);let c=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...a.map(f=>f.value)),s||r.push(...c.fileFields.map(f=>f.value)),r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?a:[],filePropertyInfo:c})),r}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:i}){var k,j,se,Le,Fe,Me;this.context.errors.scope(E.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(k=t.queryParameters)!=null?k:[],values:(j=e.queryParameters)!=null?j:{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),c=this.context.sortTypeInstancesByRequiredFirst(a,(se=t.queryParameters)!=null?se:[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:S.typeReference,value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(E.Headers);let f=this.context.associateByWireValue({parameters:(Le=t.headers)!=null?Le:[],values:(Fe=e.headers)!=null?Fe:{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),x=this.context.sortTypeInstancesByRequiredFirst(f,(Me=t.headers)!=null?Me:[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:S.typeReference,value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(E.RequestBody);let T=t.body!=null?this.getInlinedRequestBodyBuilderParameters({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:d.classReference({name:this.context.getClassName(t.declaration.name),packageName:this.context.getRequestsPackageName(t.declaration.fernFilepath)}),parameters:[...r,...x,...c,...T]})}getRequestOptionsArg({request:t,snippet:e}){var c,m,f;let r="headers"in t?(c=t.headers)!=null?c:[]:[];if(r.length===0||Object.keys((m=e.headers)!=null?m:{}).length===0)return;this.context.errors.scope(E.Headers);let i=this.context.associateByWireValue({parameters:r,values:(f=e.headers)!=null?f:{}});if(this.context.errors.unscope(),i.length===0)return;let s=d.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),a=d.invokeMethod({on:s,method:"builder",arguments_:[]});for(let y of i)a=d.invokeMethod({on:a,method:"addHeader",arguments_:[d.TypeLiteral.string(y.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(y)]});let u=d.invokeMethod({on:a,method:"build",arguments_:[]});return d.TypeLiteral.reference(u)}getInlinedRequestBodyBuilderParameters({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:A(t)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:t}){return this.context.shouldInlineFileProperties()?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e}){return{name:this.context.getMethodName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e,as:"request"});default:A(t)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:t,value:e}){var a;let i=this.context.associateByWireValue({parameters:t,values:(a=this.context.getRecord(e))!=null?a:{}}).filter(u=>!this.context.isDirectLiteral(u.typeReference));return this.context.sortTypeInstancesByRequiredFirst(i,t).map(u=>({name:this.context.getMethodName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:u.typeReference,value:u.value,as:"request"})}))}getPathParameters({namedParameters:t,snippet:e}){var s;let r=[],i=this.context.associateByWireValue({parameters:t,values:(s=e.pathParameters)!=null?s:{}});for(let a of i)r.push({name:this.context.getMethodName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>`${this.context.getMethodName(e)}()`).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getStyle(t){var e,r;return(r=(e=t.style)!=null?e:this.context.options.style)!=null?r:V.Full}getConfig(t){var e,r;return(r=(e=t.config)!=null?e:this.context.options.config)!=null?r:{}}};0&&(module.exports={EndpointSnippetGenerator});
23
23
  /*! Bundled license information:
24
24
 
25
25
  @esbuild-plugins/node-globals-polyfill/Buffer.js: