@fern-api/php-dynamic-snippets 0.0.2 → 0.0.3

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.
@@ -1,23 +1,23 @@
1
- "use strict";var le=Object.defineProperty,mt=Object.defineProperties,dt=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyDescriptors,wt=Object.getOwnPropertyNames,Fe=Object.getOwnPropertySymbols;var ke=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable;var Ie=(n,t,e)=>t in n?le(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ue=(n,t)=>{for(var e in t||(t={}))ke.call(t,e)&&Ie(n,e,t[e]);if(Fe)for(var e of Fe(t))xt.call(t,e)&&Ie(n,e,t[e]);return n},pe=(n,t)=>mt(n,yt(t));var Ne=(n,t)=>()=>(n&&(t=n(n=0)),t);var _e=(n,t)=>{for(var e in t)le(n,e,{get:t[e],enumerable:!0})},gt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wt(t))!ke.call(n,i)&&i!==e&&le(n,i,{get:()=>t[i],enumerable:!(r=dt(t,i))||r.enumerable});return n};var At=n=>gt(le({},"__esModule",{value:!0}),n);var c=(n,t,e)=>Ie(n,typeof t!="symbol"?t+"":t,e);function Ue(){throw new Error("setTimeout has not been defined")}function De(){throw new Error("clearTimeout has not been defined")}function qe(n){if(O===setTimeout)return setTimeout(n,0);if((O===Ue||!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 Tt(n){if(W===clearTimeout)return clearTimeout(n);if((W===De||!W)&&clearTimeout)return W=clearTimeout,clearTimeout(n);try{return W(n)}catch(t){try{return W.call(null,n)}catch(e){return W.call(this,n)}}}function vt(){!ae||!Q||(ae=!1,Q.length?_=Q.concat(_):me=-1,_.length&&$e())}function $e(){if(!ae){var n=qe(vt);ae=!0;for(var t=_.length;t;){for(Q=_,_=[];++me<t;)Q&&Q[me].run();me=-1,t=_.length}Q=null,ae=!1,Tt(n)}}function Et(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];_.push(new Ye(n,t)),_.length===1&&!ae&&qe($e)}function Ye(n,t){this.fun=n,this.array=t}function K(){}function $t(n){throw new Error("process.binding is not supported")}function Yt(){return"/"}function Ot(n){throw new Error("process.chdir is not supported")}function Wt(){return 0}function Ht(n){var t=Vt.call(oe)*.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 Gt(){var n=new Date,t=n-zt;return t/1e3}var O,W,_,ae,Q,me,Rt,It,Nt,Ct,Lt,Pt,Bt,bt,St,Ft,kt,_t,Mt,Ut,Dt,qt,oe,Vt,zt,l,Me,u=Ne(()=>{"use strict";O=Ue,W=De;typeof globalThis.setTimeout=="function"&&(O=setTimeout);typeof globalThis.clearTimeout=="function"&&(W=clearTimeout);_=[],ae=!1,me=-1;Ye.prototype.run=function(){this.fun.apply(null,this.array)};Rt="browser",It="browser",Nt=!0,Ct={},Lt=[],Pt="",Bt={},bt={},St={};Ft=K,kt=K,_t=K,Mt=K,Ut=K,Dt=K,qt=K;oe=globalThis.performance||{},Vt=oe.now||oe.mozNow||oe.msNow||oe.oNow||oe.webkitNow||function(){return new Date().getTime()};zt=new Date;l={nextTick:Et,title:Rt,browser:Nt,env:Ct,argv:Lt,version:Pt,versions:Bt,on:Ft,addListener:kt,once:_t,off:Mt,removeListener:Ut,removeAllListeners:Dt,emit:qt,binding:$t,cwd:Yt,chdir:Ot,umask:Wt,hrtime:Ht,platform:It,release:bt,config:St,uptime:Gt},Me={};Object.keys(Me).forEach(n=>{let t=n.split("."),e=l;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Me[n]:e=e[i]||(e[i]={})}})});function He(){Le=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)B[t]=n[t],C[n.charCodeAt(t)]=t;C[45]=62,C[95]=63}function Qt(n){Le||He();var t,e,r,i,s,o,h=n.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=n[h-2]==="="?2:n[h-1]==="="?1:0,o=new Jt(h*3/4-s),r=s>0?h-4:h;var f=0;for(t=0,e=0;t<r;t+=4,e+=3)i=C[n.charCodeAt(t)]<<18|C[n.charCodeAt(t+1)]<<12|C[n.charCodeAt(t+2)]<<6|C[n.charCodeAt(t+3)],o[f++]=i>>16&255,o[f++]=i>>8&255,o[f++]=i&255;return s===2?(i=C[n.charCodeAt(t)]<<2|C[n.charCodeAt(t+1)]>>4,o[f++]=i&255):s===1&&(i=C[n.charCodeAt(t)]<<10|C[n.charCodeAt(t+1)]<<4|C[n.charCodeAt(t+2)]>>2,o[f++]=i>>8&255,o[f++]=i&255),o}function Kt(n){return B[n>>18&63]+B[n>>12&63]+B[n>>6&63]+B[n&63]}function Xt(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(Kt(r));return i.join("")}function Oe(n){Le||He();for(var t,e=n.length,r=e%3,i="",s=[],o=16383,h=0,f=e-r;h<f;h+=o)s.push(Xt(n,h,h+o>f?f:h+o));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 de(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(n,t){if(de()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=a.prototype):(n===null&&(n=new a(t)),n.length=t),n}function a(n,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(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 Pe(this,n)}return ze(this,n,t,e)}function ze(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?er(n,t,e,r):typeof t=="string"?jt(n,t,e):tr(n,t)}function Ge(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 Zt(n,t,e,r){return Ge(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 Pe(n,t){if(Ge(t),n=M(n,t<0?0:Be(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function jt(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Je(t,e)|0;n=M(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Ce(n,t){var e=t.length<0?0:Be(t.length)|0;n=M(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function er(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),a.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=a.prototype):n=Ce(n,t),n}function tr(n,t){if(b(t)){var e=Be(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"||Ar(t.length)?M(n,0):Ce(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ce(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Be(n){if(n>=de())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+de().toString(16)+" bytes");return n|0}function b(n){return!!(n!=null&&n._isBuffer)}function Je(n,t){if(b(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 ye(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return tt(n).length;default:if(r)return ye(n).length;t=(""+t).toLowerCase(),r=!0}}function rr(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 fr(this,t,e);case"utf8":case"utf-8":return Xe(this,t,e);case"ascii":return pr(this,t,e);case"latin1":case"binary":return hr(this,t,e);case"base64":return cr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function X(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Qe(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=a.from(t,r)),b(t))return t.length===0?-1:We(n,t,e,r,i);if(typeof t=="number")return t=t&255,a.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,o=n.length,h=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,o/=2,h/=2,e/=2}function f(A,N){return s===1?A[N]:A.readUInt16BE(N*s)}var m;if(i){var y=-1;for(m=e;m<o;m++)if(f(n,m)===f(t,y===-1?0:m-y)){if(y===-1&&(y=m),m-y+1===h)return y*s}else y!==-1&&(m-=m-y),y=-1}else for(e+h>o&&(e=o-h),m=e;m>=0;m--){for(var w=!0,E=0;E<h;E++)if(f(n,m+E)!==f(t,E)){w=!1;break}if(w)return m}return-1}function nr(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 o=0;o<r;++o){var h=parseInt(t.substr(o*2,2),16);if(isNaN(h))return o;n[e+o]=h}return o}function ir(n,t,e,r){return ge(ye(t,n.length-e),n,e,r)}function Ke(n,t,e,r){return ge(xr(t),n,e,r)}function sr(n,t,e,r){return Ke(n,t,e,r)}function or(n,t,e,r){return ge(tt(t),n,e,r)}function ar(n,t,e,r){return ge(gr(t,n.length-e),n,e,r)}function cr(n,t,e){return t===0&&e===n.length?Oe(n):Oe(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],o=null,h=s>239?4:s>223?3:s>191?2:1;if(i+h<=e){var f,m,y,w;switch(h){case 1:s<128&&(o=s);break;case 2:f=n[i+1],(f&192)===128&&(w=(s&31)<<6|f&63,w>127&&(o=w));break;case 3:f=n[i+1],m=n[i+2],(f&192)===128&&(m&192)===128&&(w=(s&15)<<12|(f&63)<<6|m&63,w>2047&&(w<55296||w>57343)&&(o=w));break;case 4:f=n[i+1],m=n[i+2],y=n[i+3],(f&192)===128&&(m&192)===128&&(y&192)===128&&(w=(s&15)<<18|(f&63)<<12|(m&63)<<6|y&63,w>65535&&w<1114112&&(o=w))}}o===null?(o=65533,h=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=h}return ur(r)}function ur(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 pr(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 hr(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 fr(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+=wr(n[s]);return i}function lr(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 g(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(!b(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 we(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 xe(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 je(n,t,e,r,i){return i||Ze(n,t,e,4,34028234663852886e22,-34028234663852886e22),nt(n,t,e,r,23,4),e+4}function et(n,t,e,r,i){return i||Ze(n,t,e,8,17976931348623157e292,-17976931348623157e292),nt(n,t,e,r,52,8),e+8}function dr(n){if(n=yr(n).replace(mr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function yr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function wr(n){return n<16?"0"+n.toString(16):n.toString(16)}function ye(n,t){t=t||1/0;for(var e,r=n.length,i=null,s=[],o=0;o<r;++o){if(e=n.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+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 xr(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=[],o=0;o<n.length&&!((t-=2)<0);++o)e=n.charCodeAt(o),r=e>>8,i=e%256,s.push(i),s.push(r);return s}function tt(n){return Qt(dr(n))}function ge(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 Ar(n){return n!==n}function Tr(n){return n!=null&&(!!n._isBuffer||rt(n)||vr(n))}function rt(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"&&rt(n.slice(0,0))}function Ae(n,t,e,r,i){var s,o,h=i*8-r-1,f=(1<<h)-1,m=f>>1,y=-7,w=e?i-1:0,E=e?-1:1,A=n[t+w];for(w+=E,s=A&(1<<-y)-1,A>>=-y,y+=h;y>0;s=s*256+n[t+w],w+=E,y-=8);for(o=s&(1<<-y)-1,s>>=-y,y+=r;y>0;o=o*256+n[t+w],w+=E,y-=8);if(s===0)s=1-m;else{if(s===f)return o?NaN:(A?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-m}return(A?-1:1)*o*Math.pow(2,s-r)}function nt(n,t,e,r,i,s){var o,h,f,m=s*8-i-1,y=(1<<m)-1,w=y>>1,E=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=r?0:s-1,N=r?1:-1,lt=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(h=isNaN(t)?1:0,o=y):(o=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+w>=1?t+=E/f:t+=E*Math.pow(2,1-w),t*f>=2&&(o++,f/=2),o+w>=y?(h=0,o=y):o+w>=1?(h=(t*f-1)*Math.pow(2,i),o=o+w):(h=t*Math.pow(2,w-1)*Math.pow(2,i),o=0));i>=8;n[e+A]=h&255,A+=N,h/=256,i-=8);for(o=o<<i|h,m+=i;m>0;n[e+A]=o&255,A+=N,o/=256,m-=8);n[e+A-N]|=lt*128}var B,C,Jt,Le,Ve,mr,it=Ne(()=>{"use strict";u();p();B=[],C=[],Jt=typeof Uint8Array!="undefined"?Uint8Array:Array,Le=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(n){return n.__proto__=a.prototype,n};a.from=function(n,t,e){return ze(null,n,t,e)};a.kMaxLength=de();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(n,t,e){return Zt(null,n,t,e)};a.allocUnsafe=function(n){return Pe(null,n)};a.allocUnsafeSlow=function(n){return Pe(null,n)};a.isBuffer=Tr;a.compare=function(t,e){if(!b(t)||!b(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,s=0,o=Math.min(r,i);s<o;++s)if(t[s]!==e[s]){r=t[s],i=e[s];break}return r<i?-1:i<r?1:0};a.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}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),s=0;for(r=0;r<t.length;++r){var o=t[r];if(!b(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,s),s+=o.length}return i};a.byteLength=Je;a.prototype._isBuffer=!0;a.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)X(this,e,e+1);return this};a.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)X(this,e,e+3),X(this,e+1,e+2);return this};a.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)X(this,e,e+7),X(this,e+1,e+6),X(this,e+2,e+5),X(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Xe(this,0,t):rr.apply(this,arguments)};a.prototype.equals=function(t){if(!b(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,i,s){if(!b(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 o=s-i,h=r-e,f=Math.min(o,h),m=this.slice(i,s),y=t.slice(e,r),w=0;w<f;++w)if(m[w]!==y[w]){o=m[w],h=y[w];break}return o<h?-1:h<o?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return Qe(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return Qe(this,t,e,r,!1)};a.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 o=!1;;)switch(i){case"hex":return nr(this,t,e,r);case"utf8":case"utf-8":return ir(this,t,e,r);case"ascii":return Ke(this,t,e,r);case"latin1":case"binary":return sr(this,t,e,r);case"base64":return or(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ar(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ve=4096;a.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(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var s=e-t;i=new a(s,void 0);for(var o=0;o<s;++o)i[o]=this[o+t]}return i};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||g(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return i};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||g(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};a.prototype.readUInt8=function(t,e){return e||g(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||g(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||g(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||g(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||g(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||g(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||g(t,e,this.length);for(var i=e,s=1,o=this[t+--i];i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};a.prototype.readInt8=function(t,e){return e||g(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||g(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||g(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||g(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||g(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||g(t,4,this.length),Ae(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||g(t,4,this.length),Ae(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||g(t,8,this.length),Ae(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||g(t,8,this.length),Ae(this,t,!1,52,8)};a.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 o=1,h=0;for(this[e]=t&255;++h<r&&(o*=256);)this[e+h]=t/o&255;return e+r};a.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 o=r-1,h=1;for(this[e+o]=t&255;--o>=0&&(h*=256);)this[e+o]=t/h&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):we(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):we(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):xe(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):xe(this,t,e,!1),e+4};a.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 o=0,h=1,f=0;for(this[e]=t&255;++o<r&&(h*=256);)t<0&&f===0&&this[e+o-1]!==0&&(f=1),this[e+o]=(t/h>>0)-f&255;return e+r};a.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 o=r-1,h=1,f=0;for(this[e+o]=t&255;--o>=0&&(h*=256);)t<0&&f===0&&this[e+o+1]!==0&&(f=1),this[e+o]=(t/h>>0)-f&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):we(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):we(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):xe(this,t,e,!0),e+4};a.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),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):xe(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,r){return je(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return je(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return et(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return et(this,t,e,!1,r)};a.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,o;if(this===t&&r<e&&e<i)for(o=s-1;o>=0;--o)t[o+e]=this[o+r];else if(s<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s};a.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"&&!a.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 o;if(typeof t=="number")for(o=e;o<r;++o)this[o]=t;else{var h=b(t)?t:ye(new a(t,i).toString()),f=h.length;for(o=0;o<r-e;++o)this[o+e]=h[o%f]}return this};mr=/[^+\/0-9A-Za-z-_]/g});var p=Ne(()=>{"use strict";it()});var Kr={};_e(Kr,{EndpointSnippetGenerator:()=>Se});module.exports=At(Kr);u();p();u();p();u();p();function L(n){throw new Error("Unexpected value: "+JSON.stringify(n))}u();p();u();p();var U=class{};u();p();u();p();var V=class extends U{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var Er=4,he=class{constructor(){c(this,"buffer","");c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
1
+ "use strict";var me=Object.defineProperty,dt=Object.defineProperties,yt=Object.getOwnPropertyDescriptor,wt=Object.getOwnPropertyDescriptors,xt=Object.getOwnPropertyNames,Fe=Object.getOwnPropertySymbols;var _e=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable;var Ie=(n,t,e)=>t in n?me(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,pe=(n,t)=>{for(var e in t||(t={}))_e.call(t,e)&&Ie(n,e,t[e]);if(Fe)for(var e of Fe(t))gt.call(t,e)&&Ie(n,e,t[e]);return n},he=(n,t)=>dt(n,wt(t));var Ne=(n,t)=>()=>(n&&(t=n(n=0)),t);var ke=(n,t)=>{for(var e in t)me(n,e,{get:t[e],enumerable:!0})},At=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xt(t))!_e.call(n,i)&&i!==e&&me(n,i,{get:()=>t[i],enumerable:!(r=yt(t,i))||r.enumerable});return n};var Tt=n=>At(me({},"__esModule",{value:!0}),n);var c=(n,t,e)=>Ie(n,typeof t!="symbol"?t+"":t,e);function Ue(){throw new Error("setTimeout has not been defined")}function De(){throw new Error("clearTimeout has not been defined")}function qe(n){if(O===setTimeout)return setTimeout(n,0);if((O===Ue||!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 vt(n){if(W===clearTimeout)return clearTimeout(n);if((W===De||!W)&&clearTimeout)return W=clearTimeout,clearTimeout(n);try{return W(n)}catch(t){try{return W.call(null,n)}catch(e){return W.call(this,n)}}}function Et(){!ce||!K||(ce=!1,K.length?k=K.concat(k):de=-1,k.length&&$e())}function $e(){if(!ce){var n=qe(Et);ce=!0;for(var t=k.length;t;){for(K=k,k=[];++de<t;)K&&K[de].run();de=-1,t=k.length}K=null,ce=!1,vt(n)}}function Rt(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];k.push(new Ye(n,t)),k.length===1&&!ce&&qe($e)}function Ye(n,t){this.fun=n,this.array=t}function X(){}function Yt(n){throw new Error("process.binding is not supported")}function Ot(){return"/"}function Wt(n){throw new Error("process.chdir is not supported")}function Vt(){return 0}function zt(n){var t=Ht.call(ae)*.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 Jt(){var n=new Date,t=n-Gt;return t/1e3}var O,W,k,ce,K,de,It,Nt,Lt,Ct,Pt,bt,Bt,St,Ft,_t,kt,Mt,Ut,Dt,qt,$t,ae,Ht,Gt,m,Me,u=Ne(()=>{"use strict";O=Ue,W=De;typeof globalThis.setTimeout=="function"&&(O=setTimeout);typeof globalThis.clearTimeout=="function"&&(W=clearTimeout);k=[],ce=!1,de=-1;Ye.prototype.run=function(){this.fun.apply(null,this.array)};It="browser",Nt="browser",Lt=!0,Ct={},Pt=[],bt="",Bt={},St={},Ft={};_t=X,kt=X,Mt=X,Ut=X,Dt=X,qt=X,$t=X;ae=globalThis.performance||{},Ht=ae.now||ae.mozNow||ae.msNow||ae.oNow||ae.webkitNow||function(){return new Date().getTime()};Gt=new Date;m={nextTick:Rt,title:It,browser:Lt,env:Ct,argv:Pt,version:bt,versions:Bt,on:_t,addListener:kt,once:Mt,off:Ut,removeListener:Dt,removeAllListeners:qt,emit:$t,binding:Yt,cwd:Ot,chdir:Wt,umask:Vt,hrtime:zt,platform:Nt,release:St,config:Ft,uptime:Jt},Me={};Object.keys(Me).forEach(n=>{let t=n.split("."),e=m;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Me[n]:e=e[i]||(e[i]={})}})});function He(){Ce=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)b[t]=n[t],L[n.charCodeAt(t)]=t;L[45]=62,L[95]=63}function Kt(n){Ce||He();var t,e,r,i,s,o,h=n.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=n[h-2]==="="?2:n[h-1]==="="?1:0,o=new Qt(h*3/4-s),r=s>0?h-4:h;var f=0;for(t=0,e=0;t<r;t+=4,e+=3)i=L[n.charCodeAt(t)]<<18|L[n.charCodeAt(t+1)]<<12|L[n.charCodeAt(t+2)]<<6|L[n.charCodeAt(t+3)],o[f++]=i>>16&255,o[f++]=i>>8&255,o[f++]=i&255;return s===2?(i=L[n.charCodeAt(t)]<<2|L[n.charCodeAt(t+1)]>>4,o[f++]=i&255):s===1&&(i=L[n.charCodeAt(t)]<<10|L[n.charCodeAt(t+1)]<<4|L[n.charCodeAt(t+2)]>>2,o[f++]=i>>8&255,o[f++]=i&255),o}function Xt(n){return b[n>>18&63]+b[n>>12&63]+b[n>>6&63]+b[n&63]}function Zt(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(Xt(r));return i.join("")}function Oe(n){Ce||He();for(var t,e=n.length,r=e%3,i="",s=[],o=16383,h=0,f=e-r;h<f;h+=o)s.push(Zt(n,h,h+o>f?f:h+o));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 ye(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(n,t){if(ye()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=a.prototype):(n===null&&(n=new a(t)),n.length=t),n}function a(n,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(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 Pe(this,n)}return ze(this,n,t,e)}function ze(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?tr(n,t,e,r):typeof t=="string"?er(n,t,e):rr(n,t)}function Ge(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 jt(n,t,e,r){return Ge(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 Pe(n,t){if(Ge(t),n=M(n,t<0?0:be(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function er(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Je(t,e)|0;n=M(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Le(n,t){var e=t.length<0?0:be(t.length)|0;n=M(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function tr(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),a.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=a.prototype):n=Le(n,t),n}function rr(n,t){if(B(t)){var e=be(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"||Tr(t.length)?M(n,0):Le(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Le(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function be(n){if(n>=ye())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ye().toString(16)+" bytes");return n|0}function B(n){return!!(n!=null&&n._isBuffer)}function Je(n,t){if(B(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 we(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return tt(n).length;default:if(r)return we(n).length;t=(""+t).toLowerCase(),r=!0}}function nr(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 hr(this,t,e);case"latin1":case"binary":return fr(this,t,e);case"base64":return ur(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function Z(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Qe(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=a.from(t,r)),B(t))return t.length===0?-1:We(n,t,e,r,i);if(typeof t=="number")return t=t&255,a.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,o=n.length,h=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,o/=2,h/=2,e/=2}function f(A,N){return s===1?A[N]:A.readUInt16BE(N*s)}var l;if(i){var y=-1;for(l=e;l<o;l++)if(f(n,l)===f(t,y===-1?0:l-y)){if(y===-1&&(y=l),l-y+1===h)return y*s}else y!==-1&&(l-=l-y),y=-1}else for(e+h>o&&(e=o-h),l=e;l>=0;l--){for(var w=!0,E=0;E<h;E++)if(f(n,l+E)!==f(t,E)){w=!1;break}if(w)return l}return-1}function ir(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 o=0;o<r;++o){var h=parseInt(t.substr(o*2,2),16);if(isNaN(h))return o;n[e+o]=h}return o}function sr(n,t,e,r){return Ae(we(t,n.length-e),n,e,r)}function Ke(n,t,e,r){return Ae(gr(t),n,e,r)}function or(n,t,e,r){return Ke(n,t,e,r)}function ar(n,t,e,r){return Ae(tt(t),n,e,r)}function cr(n,t,e,r){return Ae(Ar(t,n.length-e),n,e,r)}function ur(n,t,e){return t===0&&e===n.length?Oe(n):Oe(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],o=null,h=s>239?4:s>223?3:s>191?2:1;if(i+h<=e){var f,l,y,w;switch(h){case 1:s<128&&(o=s);break;case 2:f=n[i+1],(f&192)===128&&(w=(s&31)<<6|f&63,w>127&&(o=w));break;case 3:f=n[i+1],l=n[i+2],(f&192)===128&&(l&192)===128&&(w=(s&15)<<12|(f&63)<<6|l&63,w>2047&&(w<55296||w>57343)&&(o=w));break;case 4:f=n[i+1],l=n[i+2],y=n[i+3],(f&192)===128&&(l&192)===128&&(y&192)===128&&(w=(s&15)<<18|(f&63)<<12|(l&63)<<6|y&63,w>65535&&w<1114112&&(o=w))}}o===null?(o=65533,h=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=h}return pr(r)}function pr(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 hr(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 fr(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+=xr(n[s]);return i}function mr(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 g(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(!B(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 xe(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 ge(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 je(n,t,e,r,i){return i||Ze(n,t,e,4,34028234663852886e22,-34028234663852886e22),nt(n,t,e,r,23,4),e+4}function et(n,t,e,r,i){return i||Ze(n,t,e,8,17976931348623157e292,-17976931348623157e292),nt(n,t,e,r,52,8),e+8}function yr(n){if(n=wr(n).replace(dr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function wr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function xr(n){return n<16?"0"+n.toString(16):n.toString(16)}function we(n,t){t=t||1/0;for(var e,r=n.length,i=null,s=[],o=0;o<r;++o){if(e=n.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+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 gr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Ar(n,t){for(var e,r,i,s=[],o=0;o<n.length&&!((t-=2)<0);++o)e=n.charCodeAt(o),r=e>>8,i=e%256,s.push(i),s.push(r);return s}function tt(n){return Kt(yr(n))}function Ae(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 Tr(n){return n!==n}function vr(n){return n!=null&&(!!n._isBuffer||rt(n)||Er(n))}function rt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Er(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&rt(n.slice(0,0))}function Te(n,t,e,r,i){var s,o,h=i*8-r-1,f=(1<<h)-1,l=f>>1,y=-7,w=e?i-1:0,E=e?-1:1,A=n[t+w];for(w+=E,s=A&(1<<-y)-1,A>>=-y,y+=h;y>0;s=s*256+n[t+w],w+=E,y-=8);for(o=s&(1<<-y)-1,s>>=-y,y+=r;y>0;o=o*256+n[t+w],w+=E,y-=8);if(s===0)s=1-l;else{if(s===f)return o?NaN:(A?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-l}return(A?-1:1)*o*Math.pow(2,s-r)}function nt(n,t,e,r,i,s){var o,h,f,l=s*8-i-1,y=(1<<l)-1,w=y>>1,E=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=r?0:s-1,N=r?1:-1,mt=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(h=isNaN(t)?1:0,o=y):(o=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+w>=1?t+=E/f:t+=E*Math.pow(2,1-w),t*f>=2&&(o++,f/=2),o+w>=y?(h=0,o=y):o+w>=1?(h=(t*f-1)*Math.pow(2,i),o=o+w):(h=t*Math.pow(2,w-1)*Math.pow(2,i),o=0));i>=8;n[e+A]=h&255,A+=N,h/=256,i-=8);for(o=o<<i|h,l+=i;l>0;n[e+A]=o&255,A+=N,o/=256,l-=8);n[e+A-N]|=mt*128}var b,L,Qt,Ce,Ve,dr,it=Ne(()=>{"use strict";u();p();b=[],L=[],Qt=typeof Uint8Array!="undefined"?Uint8Array:Array,Ce=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(n){return n.__proto__=a.prototype,n};a.from=function(n,t,e){return ze(null,n,t,e)};a.kMaxLength=ye();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(n,t,e){return jt(null,n,t,e)};a.allocUnsafe=function(n){return Pe(null,n)};a.allocUnsafeSlow=function(n){return Pe(null,n)};a.isBuffer=vr;a.compare=function(t,e){if(!B(t)||!B(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,s=0,o=Math.min(r,i);s<o;++s)if(t[s]!==e[s]){r=t[s],i=e[s];break}return r<i?-1:i<r?1:0};a.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}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),s=0;for(r=0;r<t.length;++r){var o=t[r];if(!B(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,s),s+=o.length}return i};a.byteLength=Je;a.prototype._isBuffer=!0;a.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)Z(this,e,e+1);return this};a.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)Z(this,e,e+3),Z(this,e+1,e+2);return this};a.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)Z(this,e,e+7),Z(this,e+1,e+6),Z(this,e+2,e+5),Z(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Xe(this,0,t):nr.apply(this,arguments)};a.prototype.equals=function(t){if(!B(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,i,s){if(!B(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 o=s-i,h=r-e,f=Math.min(o,h),l=this.slice(i,s),y=t.slice(e,r),w=0;w<f;++w)if(l[w]!==y[w]){o=l[w],h=y[w];break}return o<h?-1:h<o?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return Qe(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return Qe(this,t,e,r,!1)};a.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 o=!1;;)switch(i){case"hex":return ir(this,t,e,r);case"utf8":case"utf-8":return sr(this,t,e,r);case"ascii":return Ke(this,t,e,r);case"latin1":case"binary":return or(this,t,e,r);case"base64":return ar(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return cr(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ve=4096;a.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(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var s=e-t;i=new a(s,void 0);for(var o=0;o<s;++o)i[o]=this[o+t]}return i};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||g(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return i};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||g(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};a.prototype.readUInt8=function(t,e){return e||g(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||g(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||g(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||g(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||g(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||g(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||g(t,e,this.length);for(var i=e,s=1,o=this[t+--i];i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};a.prototype.readInt8=function(t,e){return e||g(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||g(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||g(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||g(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||g(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||g(t,4,this.length),Te(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||g(t,4,this.length),Te(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||g(t,8,this.length),Te(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||g(t,8,this.length),Te(this,t,!1,52,8)};a.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 o=1,h=0;for(this[e]=t&255;++h<r&&(o*=256);)this[e+h]=t/o&255;return e+r};a.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 o=r-1,h=1;for(this[e+o]=t&255;--o>=0&&(h*=256);)this[e+o]=t/h&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):xe(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):xe(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):ge(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ge(this,t,e,!1),e+4};a.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 o=0,h=1,f=0;for(this[e]=t&255;++o<r&&(h*=256);)t<0&&f===0&&this[e+o-1]!==0&&(f=1),this[e+o]=(t/h>>0)-f&255;return e+r};a.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 o=r-1,h=1,f=0;for(this[e+o]=t&255;--o>=0&&(h*=256);)t<0&&f===0&&this[e+o+1]!==0&&(f=1),this[e+o]=(t/h>>0)-f&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):xe(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):xe(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ge(this,t,e,!0),e+4};a.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),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ge(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,r){return je(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return je(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return et(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return et(this,t,e,!1,r)};a.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,o;if(this===t&&r<e&&e<i)for(o=s-1;o>=0;--o)t[o+e]=this[o+r];else if(s<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s};a.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"&&!a.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 o;if(typeof t=="number")for(o=e;o<r;++o)this[o]=t;else{var h=B(t)?t:we(new a(t,i).toString()),f=h.length;for(o=0;o<r-e;++o)this[o+e]=h[o%f]}return this};dr=/[^+\/0-9A-Za-z-_]/g});var p=Ne(()=>{"use strict";it()});var Xr={};ke(Xr,{EndpointSnippetGenerator:()=>Se});module.exports=Tt(Xr);u();p();u();p();u();p();function C(n){throw new Error("Unexpected value: "+JSON.stringify(n))}u();p();u();p();var U=class{};u();p();u();p();var V=class extends U{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var Rr=4,fe=class{constructor(){c(this,"buffer","");c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
2
2
  `),r=e?t.substring(0,t.length-1):t,i=this.getIndentString(),s=r.replaceAll(`
3
3
  `,`
4
4
  ${i}`);this.isAtStartOfLine()&&(s=i+s),e&&(s+=`
5
5
  `),this.writeInternal(s)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new V(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new V(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}openBlock(t,e="{",r,i="}"){let s=t.filter(o=>o!==void 0).join(" ");s?this.write(`${s} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),r(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
6
  `)}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
7
  `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let s=1;s<t.length;s++){this.write(e);let o=t[s];o!=null&&r(o)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
- `)),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Er)}};u();p();function be(n){return(n==null?void 0:n.name)!=null}u();p();var fe=class extends U{constructor({condition:e,true_:r,false_:i}){super();c(this,"condition");c(this,"true_");c(this,"false_");this.condition=e,this.true_=r,this.false_=i}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};u();p();u();p();var S={Critical:"CRITICAL",Warning:"WARNING"};u();p();var F={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};u();p();u();p();var Te="";var x={};_e(x,{Array:()=>Z,AstNode:()=>d,Attribute:()=>j,Class:()=>D,ClassInstantiation:()=>k,ClassReference:()=>T,CodeBlock:()=>v,DataClass:()=>te,Enum:()=>re,Field:()=>ne,Map:()=>ie,Method:()=>$,MethodInvocation:()=>Y,Parameter:()=>q,Trait:()=>ee,Type:()=>P,TypeLiteral:()=>J,Writer:()=>H,array:()=>br,assignVariable:()=>Hr,attribute:()=>Sr,classReference:()=>_r,class_:()=>Fr,codeblock:()=>se,dataClass:()=>Mr,enum_:()=>Ur,field:()=>Dr,instantiateClass:()=>pt,invokeMethod:()=>qr,map:()=>Yr,mergeArrays:()=>Jr,method:()=>Or,parameter:()=>Wr,string:()=>Gr,ternary:()=>Vr,this_:()=>Qr,throwException:()=>$r,trait:()=>kr,variable:()=>zr});u();p();u();p();u();p();u();p();u();p();function st(n){return{namespace:n.substring(0,n.lastIndexOf("\\")),name:n.substring(n.lastIndexOf("\\")+1)}}var H=class extends he{constructor({namespace:e,rootNamespace:r,customConfig:i}){super();c(this,"namespace");c(this,"rootNamespace");c(this,"customConfig");c(this,"references",{});this.namespace=e,this.rootNamespace=r,this.customConfig=i}addReference(e){var o,h;if(e.namespace==null)return;if(Object.keys(this.references).filter(f=>{let m=st(f);return m.namespace!==e.namespace&&m.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===Te?e.name:`${e.namespace}\\${e.name}`;((h=(o=this.references)[i])!=null?h:o[i]=[]).push(e)}toString(){let e=`namespace ${this.namespace};`,r=this.stringifyImports();return r.length>0?`${e}
8
+ `)),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Rr)}};u();p();function Be(n){return(n==null?void 0:n.name)!=null}u();p();var le=class extends U{constructor({condition:e,true_:r,false_:i}){super();c(this,"condition");c(this,"true_");c(this,"false_");this.condition=e,this.true_=r,this.false_=i}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};u();p();u();p();var S={Critical:"CRITICAL",Warning:"WARNING"};u();p();var F={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};u();p();u();p();var ve="",st="self";var x={};ke(x,{Access:()=>H,Array:()=>j,AstNode:()=>d,Attribute:()=>ee,Class:()=>D,ClassInstantiation:()=>_,ClassReference:()=>T,CodeBlock:()=>v,DataClass:()=>re,Enum:()=>ne,Field:()=>ie,Map:()=>se,Method:()=>$,MethodInvocation:()=>Y,Parameter:()=>q,Trait:()=>te,Type:()=>P,TypeLiteral:()=>Q,Writer:()=>z,array:()=>Sr,assignVariable:()=>zr,attribute:()=>Fr,classReference:()=>Mr,class_:()=>_r,codeblock:()=>oe,dataClass:()=>Ur,enum_:()=>Dr,field:()=>qr,instantiateClass:()=>ht,invokeMethod:()=>$r,map:()=>Or,mergeArrays:()=>Qr,method:()=>Wr,parameter:()=>Vr,string:()=>Jr,ternary:()=>Hr,this_:()=>Kr,throwException:()=>Yr,trait:()=>kr,variable:()=>Gr});u();p();u();p();u();p();var H={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};u();p();u();p();u();p();function ot(n){return{namespace:n.substring(0,n.lastIndexOf("\\")),name:n.substring(n.lastIndexOf("\\")+1)}}var z=class extends fe{constructor({namespace:e,rootNamespace:r,customConfig:i}){super();c(this,"namespace");c(this,"rootNamespace");c(this,"customConfig");c(this,"references",{});this.namespace=e,this.rootNamespace=r,this.customConfig=i}addReference(e){var o,h;if(e.namespace==null)return;if(Object.keys(this.references).filter(f=>{let l=ot(f);return l.namespace!==e.namespace&&l.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===ve?e.name:`${e.namespace}\\${e.name}`;((h=(o=this.references)[i])!=null?h:o[i]=[]).push(e)}toString(){let e=`namespace ${this.namespace};`,r=this.stringifyImports();return r.length>0?`${e}
9
9
 
10
10
  ${r}
11
11
 
12
12
  ${this.buffer}`:e+`
13
13
 
14
- `+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(r=>st(r).namespace!==this.namespace).map(r=>`use ${r};`).join(`
15
- `)}};var d=class extends U{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:r,customConfig:i}=t,s=new H({namespace:e,rootNamespace:r,customConfig:i});return this.write(s),s.toString()}async toStringAsync({namespace:t,rootNamespace:e,customConfig:r}){let i=new H({namespace:t,rootNamespace:e,customConfig:r});return this.write(i),i.toString()}};var Z=class extends d{constructor({entries:e}){super();c(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]")}};u();p();var j=class extends d{constructor(e){var r;super();c(this,"reference");c(this,"arguments");this.reference=e.reference,this.arguments=(r=e.arguments)!=null?r:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((r,i)=>{i>0&&e.write(","),typeof r=="string"?e.write(r):r.write(e)}),e.write(")"))}};u();p();u();p();var T=class extends d{constructor({name:e,namespace:r}){super();c(this,"name");c(this,"namespace");c(this,"fullyQualified");this.name=e,this.namespace=r,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let r=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${r}`)}};u();p();u();p();function z(n){return n.startsWith("$")?n:`$${n}`}var I=class extends d{constructor({docs:e}={}){super();c(this,"docs");c(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(pe(ue({},e),{name:e.name!=null?z(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
14
+ `+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(r=>ot(r).namespace!==this.namespace).map(r=>`use ${r};`).join(`
15
+ `)}};var d=class extends U{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:r,customConfig:i}=t,s=new z({namespace:e,rootNamespace:r,customConfig:i});return this.write(s),s.toString()}async toStringAsync({namespace:t,rootNamespace:e,customConfig:r}){let i=new z({namespace:t,rootNamespace:e,customConfig:r});return this.write(i),i.toString()}};var j=class extends d{constructor({entries:e}){super();c(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]")}};u();p();var ee=class extends d{constructor(e){var r;super();c(this,"reference");c(this,"arguments");this.reference=e.reference,this.arguments=(r=e.arguments)!=null?r:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((r,i)=>{i>0&&e.write(","),typeof r=="string"?e.write(r):r.write(e)}),e.write(")"))}};u();p();u();p();var T=class extends d{constructor({name:e,namespace:r}){super();c(this,"name");c(this,"namespace");c(this,"fullyQualified");this.name=e,this.namespace=r,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let r=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${r}`)}};u();p();u();p();function G(n){return n.startsWith("$")?n:`$${n}`}var I=class extends d{constructor({docs:e}={}){super();c(this,"docs");c(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(he(pe({},e),{name:e.name!=null?G(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
16
16
  `).forEach(r=>{e.writeLine(` * ${r}`)}),this.tags.length>0&&e.writeLine(" *"));for(let r of this.tags)this.writeTag({writer:e,tag:r});e.writeLine(" */")}writeTag({writer:e,tag:r}){let i=r.docs!=null?r.docs.split(`
17
- `):void 0;i!=null&&i.length>1&&(i.forEach(s=>{e.writeLine(` * ${s}`)}),e.writeLine(" *")),e.write(` * @${r.tagType} `),r.type.write(e,{comment:!0}),r.name!=null&&e.write(` ${r.name}`),i!=null&&i.length===1&&e.write(` ${i[0]}`),e.newLine()}};u();p();u();p();var ve={Public:"public",Private:"private",Protected:"protected"};function G(n){return Rr(n,[ve.Public,ve.Protected,ve.Private])}function Rr(n,t){return t.reduce((e,r)=>[...e,...n.filter(i=>i.access===r)],[])}var D=class extends d{constructor({name:e,namespace:r,abstract:i,docs:s,parentClassReference:o,traits:h}){super();c(this,"name");c(this,"namespace");c(this,"abstract");c(this,"docs");c(this,"parentClassReference");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);c(this,"constructor_");this.name=e,this.namespace=r,this.abstract=i!=null?i:!1,this.docs=s,this.parentClassReference=o,this.traits=h!=null?h:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new T({name:this.name,namespace:this.namespace})),this.abstract&&e.write("abstract "),this.writeComment(e),e.write(`class ${this.name} `),this.parentClassReference!=null&&(e.write("extends "),this.parentClassReference.write(e)),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((r,i)=>{i>0&&e.write(","),e.writeNode(r)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:G(this.fields)}),(this.constructor!=null||this.methods.length>0)&&e.newLine(),this.constructor_!=null&&(this.writeConstructor({writer:e,constructor:this.constructor_}),this.methods.length>0&&e.newLine()),this.writeMethods({writer:e,methods:G(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new I({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:r}){var i;this.writeConstructorComment({writer:e,constructor:r}),r.access!=null&&e.write(`${r.access} `),e.write("function __construct("),e.indent(),r.parameters.forEach((s,o)=>{o===0&&e.newLine(),s.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(i=r.body)==null||i.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:r}){if(r.parameters.length===0)return;let i=new I;for(let s of r.parameters)i.addTag(s.getCommentTag());i.write(e)}writeFields({writer:e,fields:r}){r.filter(i=>!i.inherited).forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:r}){r.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};u();p();var ee=class extends d{constructor({name:e,namespace:r,docs:i,traits:s}){super();c(this,"name");c(this,"namespace");c(this,"docs");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);this.name=e,this.namespace=r,this.docs=i,this.traits=s!=null?s:[]}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeComment(e),e.write(`trait ${this.name} `),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((r,i)=>{i>0&&e.write(","),e.writeNode(r)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:G(this.fields)}),this.writeMethods({writer:e,methods:G(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new I({docs:this.docs}).write(e)}writeFields({writer:e,fields:r}){r.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:r}){r.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};u();p();u();p();function ce({writer:n,arguments_:t,multiline:e}){if(t.length===0){n.write("()");return}if(e){Ir({writer:n,arguments_:t});return}Nr({writer:n,arguments_:t})}function Ir({writer:n,arguments_:t}){n.writeLine("("),n.indent();for(let e of t)ot({writer:n,argument:e}),n.writeLine(",");n.dedent(),n.write(")")}function Nr({writer:n,arguments_:t}){n.write("("),t.forEach((e,r)=>{r>0&&n.write(", "),ot({writer:n,argument:e})}),n.write(")")}function ot({writer:n,argument:t}){be(t)?(n.write(`${t.name}: `),n.writeNodeOrString(t.assignment)):t.write(n)}var k=class extends d{constructor({classReference:e,arguments_:r,multiline:i}){super();c(this,"classReference");c(this,"arguments_");c(this,"multiline");this.classReference=e,this.arguments_=r,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),ce({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};u();p();var v=class extends d{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new V(this.arg).write(e)}};u();p();u();p();var q=class extends d{constructor({name:e,type:r,docs:i,initializer:s,access:o,readonly_:h}){super();c(this,"name");c(this,"type");c(this,"docs");c(this,"initializer");c(this,"access");c(this,"readonly_");this.name=z(e),this.type=r,this.docs=i,this.initializer=s,this.access=o,this.readonly_=h!=null?h:!1}getCommentTag(){return{tagType:"param",type:this.type,name:this.name,docs:this.docs}}write(e){this.access!=null&&e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null?(e.write(" = "),this.initializer.write(e)):this.type.isOptional()&&e.write(" = null")}};u();p();var P=class n extends d{constructor(e){super();c(this,"internalType");this.internalType=e}write(e,{comment:r}={}){switch(this.internalType.type){case"int":e.write("int");break;case"string":e.write("string");break;case"bool":e.write("bool");break;case"float":e.write("float");break;case"date":e.addReference(at),e.write("DateTime");break;case"dateTime":e.addReference(at),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!r){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:r}),e.write(">");break;case"map":{if(!r){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:r}),e.write(", "),this.internalType.valueType.write(e,{comment:r}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!r){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");for(let i of this.internalType.entries)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:i,comment:r}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((i,s)=>{s>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:i,comment:r})}),e.write("}");break}case"union":{this.getUniqueTypes({types:this.internalType.types,comment:r,writer:e}).forEach((s,o)=>{o>0&&e.write("|"),s.write(e,{comment:r}),o++});break}case"optional":{let i=this.internalType.value.internalType.type==="mixed",s=this.internalType.value.internalType.type==="union";!s&&!i&&e.write("?"),this.internalType.value.write(e,{comment:r}),s&&(e.write("|"),e.writeNode(n.null()));break}case"reference":e.writeNode(this.internalType.value);break;case"enumString":r?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;default:L(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:n.optional(this)}underlyingTypeIfOptional(){if(this.internalType.type==="optional")return this.internalType.value}underlyingType(){var e;return(e=this.underlyingTypeIfOptional())!=null?e:this}isOptional(){return this.internalType.type==="optional"}static int(){return new this({type:"int"})}static string(){return new this({type:"string"})}static bool(){return new this({type:"bool"})}static float(){return new this({type:"float"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static mixed(){return new this({type:"mixed"})}static object(){return new this({type:"object"})}static array(e){return new this({type:"array",value:e})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static typeDict(e,{multiline:r}={}){return new this({type:"typeDict",entries:e,multiline:r})}static union(e){return new this({type:"union",types:e})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static null(){return new this({type:"null"})}static reference(e){return new this({type:"reference",value:e})}static enumString(e){return new this({type:"enumString",value:e})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeTypeDictEntry({writer:e,entry:r,comment:i}){e.write(r.key),r.optional&&e.write("?"),e.write(": "),r.valueType.write(e,{comment:i})}getUniqueTypes({writer:e,types:r,comment:i}){let s=new Set;return r.filter(o=>{if(i)return!0;let h=o.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig});return s.has(h)?!1:(s.add(h),!0)})}},at=new T({namespace:Te,name:"DateTime"});u();p();function ct(n){return n.startsWith("$")?n.slice(1):n}var ut="values",te=class extends d{constructor({name:e,namespace:r,abstract:i,docs:s,parentClassReference:o,traits:h}){super();c(this,"name");c(this,"namespace");c(this,"class_");this.name=e,this.namespace=r,this.class_=new D({name:e,namespace:r,abstract:i,docs:s,parentClassReference:o,traits:h})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let r=G(this.class_.fields).map(i=>pe(ue({},i),{name:ct(i.name)}));r.length>0&&this.class_.addConstructor({access:"public",parameters:this.getConstructorParameters({orderedFields:r}),body:x.codeblock(i=>{for(let s of r)i.write(`$this->${s.name} = $${ut}['${s.name}']`),s.type.isOptional()&&i.write(" ?? null"),i.write(";")})}),this.class_.write(e)}allFieldsAreOptional(){return this.class_.fields.every(e=>e.type.isOptional())}getConstructorParameters({orderedFields:e}){return[new q({name:ut,type:P.typeDict(e.map(r=>({key:r.name,valueType:r.type,optional:r.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new v("[]"):void 0})]}};u();p();u();p();var $=class extends d{constructor({name:e,access:r,parameters:i,throws:s,return_:o,body:h,docs:f,classReference:m}){super();c(this,"name");c(this,"access");c(this,"parameters");c(this,"throws");c(this,"return_");c(this,"body");c(this,"docs");c(this,"classReference");this.name=e,this.access=r,this.parameters=i,this.throws=s!=null?s:[],this.return_=o,this.body=h,this.docs=f,this.classReference=m}write(e){var r;this.writeComment(e),e.write(`${this.access} function ${this.name}(`),this.parameters.forEach((i,s)=>{s>0&&e.write(", "),i.write(e)}),e.write("): "),this.return_!=null?this.return_.write(e):e.write("void"),e.writeLine(" {"),e.indent(),(r=this.body)==null||r.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let r=new I({docs:this.docs});for(let i of this.parameters)r.addTag({tagType:"param",type:i.type,name:i.name,docs:i.docs});this.return_!=null&&r.addTag({tagType:"return",type:this.return_});for(let i of this.throws)r.addTag({tagType:"throws",type:P.reference(i)});e.writeNode(r)}};var re=class extends d{constructor({name:e,namespace:r,backing:i,docs:s,serializable:o}){super();c(this,"name");c(this,"namespace");c(this,"backing");c(this,"docs");c(this,"members",[]);c(this,"serializable");this.name=e,this.namespace=r,this.backing=i,this.docs=s,this.serializable=o!=null?o:!1}addMember(e){this.members.push(e)}write(e){this.writeComment(e),e.write("enum "),e.writeLine(`${this.name}`),this.backing!=null&&e.write(` : ${this.backing}`),this.serializable&&(e.addReference(new T({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let r of this.members)e.write(`case ${r.name}`),r.value!=null&&(typeof r.value=="string"?e.write(` = "${r.value}"`):e.write(` = ${r.value}`)),e.writeTextStatement("");this.serializable&&(e.newLine(),e.writeNode(new $({name:"jsonSerialize",return_:P.string(),access:"public",parameters:[],body:new v("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new I({docs:this.docs}).write(e)}};u();p();var ne=class extends d{constructor({name:e,type:r,access:i,readonly_:s,initializer:o,docs:h,inlineDocs:f,attributes:m,inherited:y}){super();c(this,"name");c(this,"type");c(this,"access");c(this,"readonly_");c(this,"initializer");c(this,"docs");c(this,"inlineDocs");c(this,"attributes");c(this,"inherited");this.name=z(e),this.type=r,this.access=i,this.readonly_=s!=null?s:!1,this.initializer=o,this.docs=h,this.inlineDocs=f,this.attributes=m!=null?m:[],this.inherited=y!=null?y:!1}write(e){this.writeComment(e),this.writeAttributesIfPresent(e),e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null&&(e.write(" = "),this.initializer.write(e)),e.write(";"),this.inlineDocs!=null&&e.write(` // ${this.inlineDocs}`),e.newLine()}writeComment(e){let r=new I;r.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),r.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.writeLine("]"))}};u();p();var ie=class extends d{constructor({entries:e,multiline:r}){super();c(this,"entries");c(this,"multiline");this.entries=e!=null?e:[],this.multiline=r!=null?r:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:r,value:i}of this.entries)r.write(e),e.write(" => "),i.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[r,{key:i,value:s}]of this.entries.entries())r>0&&e.write(", "),i.write(e),e.write(" => "),s.write(e);e.write("]")}};u();p();var Y=class extends d{constructor({method:e,arguments_:r,static_:i,multiline:s,on:o}){super();c(this,"method");c(this,"arguments_");c(this,"multiline");c(this,"static_");c(this,"on");this.method=e,this.arguments_=r,this.static_=i!=null?i:!1,this.multiline=s!=null?s:!1,this.on=o}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),ce({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};u();p();u();p();var J=class n extends d{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"list":{this.writeList({writer:e,list:this.internalType});break}case"boolean":{e.write(this.internalType.value.toString());break}case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"file":{e.writeNode(Lr({writer:e,value:this.internalType.value}));break}case"float":{e.write(this.internalType.value.toString());break}case"number":{e.write(this.internalType.value.toString());break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"datetime":{e.writeNode(Cr({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
18
- `)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}e.write(`'${this.internalType.value.replaceAll("'","\\'")}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:L(this.internalType)}}writeStringWithHeredoc({writer:e,value:r}){e.writeLine("<<<EOT"),e.writeNoIndent(r),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:r}){e.writeNode(new k({classReference:r.reference,arguments_:[n.map({entries:r.fields.map(i=>({key:n.string(i.name),value:i.value}))})]}))}writeList({writer:e,list:r}){let i=Br({values:r.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let s of i)s.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:r}){let i=Pr({entries:r.entries});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let s of i)s.key.write(e),e.write(" => "),s.value.write(e),e.writeLine(",");e.dedent(),e.write("]")}static list({values:e}){return new this({type:"list",values:e})}static boolean(e){return new this({type:"boolean",value:e})}static class_({reference:e,fields:r}){return new this({type:"class",reference:e,fields:r})}static file(e){return new this({type:"file",value:e})}static float(e){return new this({type:"float",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static map({entries:e}){return new this({type:"map",entries:e})}static reference(e){return new this({type:"reference",value:e})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(r.includes('"')?`\`${r}\``:`"${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("[]");return}e.writeLine("["),e.indent();for(let i of r)e.writeNode(n.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[s,o]of i)e.write(`'${s}' => `),e.writeNode(n.unknown(o)),e.writeLine(",");e.dedent(),e.write("]")}};function Cr({writer:n,value:t}){return new k({classReference:new T({name:"DateTime",namespace:""}),arguments_:[new v(`'${t}'`)]})}function Lr({writer:n,value:t}){return new Y({on:new T({name:"File",namespace:`${n.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new v(`"${t}"`)]})}function Pr({entries:n}){return n.filter(t=>!J.isNop(t.key)&&!J.isNop(t.value))}function Br({values:n}){return n.filter(t=>!J.isNop(t))}u();p();var Ee=class extends d{constructor(e){super();c(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),ce({writer:e,arguments_:this.arrays.map(r=>se(i=>{if(typeof r=="string"||r instanceof d){i.writeNodeOrString(r);return}i.writeNodeOrString(r.ref),r.fallback&&(i.write(" ?? "),i.writeNodeOrString(r.fallback))}))})}};function br(n){return new Z(n)}function Sr(n){return new j(n)}function Fr(n){return new D(n)}function kr(n){return new ee(n)}function _r(n){return new T(n)}function se(n){return new v(n)}function Mr(n){return new te(n)}function Ur(n){return new re(n)}function Dr(n){return new ne(n)}function pt(n){return new k(n)}function qr(n){return new Y(n)}function $r(n){return se(t=>{t.write("throw "),t.writeNode(pt(n))})}function Yr(n){return new ie(n)}function Or(n){return new $(n)}function Wr(n){return new q(n)}function Vr(n){return new fe(n)}function Hr(n,t){return se(e=>{e.writeNodeOrString(n),e.write(" = "),e.writeNodeOrString(t)})}function zr(n){return se(z(n))}function Gr(n){return se(`"${n}"`)}function Jr(...n){return new Ee(n)}function Qr(){return new v(n=>{n.write("$this")})}var ht="$client",Re="Example",ft=`<?php
17
+ `):void 0;i!=null&&i.length>1&&(i.forEach(s=>{e.writeLine(` * ${s}`)}),e.writeLine(" *")),e.write(` * @${r.tagType} `),r.type.write(e,{comment:!0}),r.name!=null&&e.write(` ${r.name}`),i!=null&&i.length===1&&e.write(` ${i[0]}`),e.newLine()}};u();p();function J(n){return Ir(n,[H.Public,H.PublicReadonly,H.Protected,H.Private])}function Ir(n,t){return t.reduce((e,r)=>[...e,...n.filter(i=>i.access===r)],[])}var D=class extends d{constructor({name:e,namespace:r,abstract:i,docs:s,parentClassReference:o,traits:h}){super();c(this,"name");c(this,"namespace");c(this,"abstract");c(this,"docs");c(this,"parentClassReference");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);c(this,"constructor_");this.name=e,this.namespace=r,this.abstract=i!=null?i:!1,this.docs=s,this.parentClassReference=o,this.traits=h!=null?h:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new T({name:this.name,namespace:this.namespace})),this.abstract&&e.write("abstract "),this.writeComment(e),e.write(`class ${this.name} `),this.parentClassReference!=null&&(e.write("extends "),this.parentClassReference.write(e)),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((r,i)=>{i>0&&e.write(","),e.writeNode(r)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:J(this.fields)}),(this.constructor!=null||this.methods.length>0)&&e.newLine(),this.constructor_!=null&&(this.writeConstructor({writer:e,constructor:this.constructor_}),this.methods.length>0&&e.newLine()),this.writeMethods({writer:e,methods:J(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new I({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:r}){var i;this.writeConstructorComment({writer:e,constructor:r}),r.access!=null&&e.write(`${r.access} `),e.write("function __construct("),e.indent(),r.parameters.forEach((s,o)=>{o===0&&e.newLine(),s.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(i=r.body)==null||i.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:r}){if(r.parameters.length===0)return;let i=new I;for(let s of r.parameters)i.addTag(s.getCommentTag());i.write(e)}writeFields({writer:e,fields:r}){r.filter(i=>!i.inherited).forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:r}){r.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};u();p();var te=class extends d{constructor({name:e,namespace:r,docs:i,traits:s}){super();c(this,"name");c(this,"namespace");c(this,"docs");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);this.name=e,this.namespace=r,this.docs=i,this.traits=s!=null?s:[]}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeComment(e),e.write(`trait ${this.name} `),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((r,i)=>{i>0&&e.write(","),e.writeNode(r)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:J(this.fields)}),this.fields.length>0&&this.methods.length>0&&e.newLine(),this.writeMethods({writer:e,methods:J(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){let r=new I({docs:this.docs});for(let i of this.fields)r.addTag({tagType:"property",type:i.type,name:i.name});r.write(e)}writeFields({writer:e,fields:r}){r.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:r}){r.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};u();p();u();p();function ue({writer:n,arguments_:t,multiline:e}){if(t.length===0){n.write("()");return}if(e){Nr({writer:n,arguments_:t});return}Lr({writer:n,arguments_:t})}function Nr({writer:n,arguments_:t}){n.writeLine("("),n.indent();for(let e of t)at({writer:n,argument:e}),n.writeLine(",");n.dedent(),n.write(")")}function Lr({writer:n,arguments_:t}){n.write("("),t.forEach((e,r)=>{r>0&&n.write(", "),at({writer:n,argument:e})}),n.write(")")}function at({writer:n,argument:t}){Be(t)?(n.write(`${t.name}: `),n.writeNodeOrString(t.assignment)):t.write(n)}var _=class extends d{constructor({classReference:e,arguments_:r,multiline:i}){super();c(this,"classReference");c(this,"arguments_");c(this,"multiline");this.classReference=e,this.arguments_=r,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),ue({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};u();p();var v=class extends d{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new V(this.arg).write(e)}};u();p();u();p();var q=class extends d{constructor({name:e,type:r,docs:i,initializer:s,access:o,readonly_:h}){super();c(this,"name");c(this,"type");c(this,"docs");c(this,"initializer");c(this,"access");c(this,"readonly_");this.name=G(e),this.type=r,this.docs=i,this.initializer=s,this.access=o,this.readonly_=h!=null?h:!1}getCommentTag(){return{tagType:"param",type:this.type,name:this.name,docs:this.docs}}write(e){this.access!=null&&e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null?(e.write(" = "),this.initializer.write(e)):this.type.isOptional()&&e.write(" = null")}};u();p();var P=class n extends d{constructor(e){super();c(this,"internalType");this.internalType=e}write(e,{comment:r}={}){switch(this.internalType.type){case"int":e.write("int");break;case"string":e.write("string");break;case"bool":e.write("bool");break;case"float":e.write("float");break;case"date":e.addReference(ct),e.write("DateTime");break;case"dateTime":e.addReference(ct),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!r){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:r}),e.write(">");break;case"map":{if(!r){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:r}),e.write(", "),this.internalType.valueType.write(e,{comment:r}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!r){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");for(let i of this.internalType.entries)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:i,comment:r}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((i,s)=>{s>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:i,comment:r})}),e.write("}");break}case"union":{this.getUniqueTypes({types:this.internalType.types,comment:r,writer:e}).forEach((s,o)=>{o>0&&e.write("|"),s.write(e,{comment:r}),o++});break}case"optional":{let i=this.internalType.value.internalType.type==="mixed",s=this.internalType.value.internalType.type==="union";!s&&!i&&e.write("?"),this.internalType.value.write(e,{comment:r}),s&&(e.write("|"),e.writeNode(n.null()));break}case"reference":e.writeNode(this.internalType.value);break;case"enumString":r?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;default:C(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:n.optional(this)}underlyingTypeIfOptional(){if(this.internalType.type==="optional")return this.internalType.value}underlyingType(){var e;return(e=this.underlyingTypeIfOptional())!=null?e:this}isOptional(){return this.internalType.type==="optional"}static int(){return new this({type:"int"})}static string(){return new this({type:"string"})}static bool(){return new this({type:"bool"})}static float(){return new this({type:"float"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static mixed(){return new this({type:"mixed"})}static object(){return new this({type:"object"})}static array(e){return new this({type:"array",value:e})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static typeDict(e,{multiline:r}={}){return new this({type:"typeDict",entries:e,multiline:r})}static union(e){return new this({type:"union",types:e})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static null(){return new this({type:"null"})}static reference(e){return new this({type:"reference",value:e})}static enumString(e){return new this({type:"enumString",value:e})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeTypeDictEntry({writer:e,entry:r,comment:i}){e.write(r.key),r.optional&&e.write("?"),e.write(": "),r.valueType.write(e,{comment:i})}getUniqueTypes({writer:e,types:r,comment:i}){let s=new Set;return r.filter(o=>{if(i)return!0;let h=o.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig});return s.has(h)?!1:(s.add(h),!0)})}},ct=new T({namespace:ve,name:"DateTime"});u();p();function ut(n){return n.startsWith("$")?n.slice(1):n}var pt="values",re=class extends d{constructor({name:e,namespace:r,abstract:i,docs:s,parentClassReference:o,traits:h}){super();c(this,"name");c(this,"namespace");c(this,"class_");this.name=e,this.namespace=r,this.class_=new D({name:e,namespace:r,abstract:i,docs:s,parentClassReference:o,traits:h})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let r=J(this.class_.fields).map(i=>he(pe({},i),{name:ut(i.name)}));r.length>0&&this.class_.addConstructor({access:"public",parameters:this.getConstructorParameters({orderedFields:r}),body:x.codeblock(i=>{for(let s of r)i.write(`$this->${s.name} = $${pt}['${s.name}']`),s.type.isOptional()&&i.write(" ?? null"),i.write(";")})}),this.class_.write(e)}allFieldsAreOptional(){return this.class_.fields.every(e=>e.type.isOptional())}getConstructorParameters({orderedFields:e}){return[new q({name:pt,type:P.typeDict(e.map(r=>({key:r.name,valueType:r.type,optional:r.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new v("[]"):void 0})]}};u();p();u();p();var $=class extends d{constructor({name:e,access:r,parameters:i,throws:s,return_:o,body:h,docs:f,classReference:l}){super();c(this,"name");c(this,"access");c(this,"parameters");c(this,"throws");c(this,"return_");c(this,"body");c(this,"docs");c(this,"classReference");this.name=e,this.access=r,this.parameters=i,this.throws=s!=null?s:[],this.return_=o,this.body=h,this.docs=f,this.classReference=l}write(e){var r;this.writeComment(e),e.write(`${this.access} function ${this.name}(`),this.parameters.forEach((i,s)=>{s>0&&e.write(", "),i.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),(r=this.body)==null||r.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let r=new I({docs:this.docs});for(let i of this.parameters)r.addTag({tagType:"param",type:i.type,name:i.name,docs:i.docs});this.return_!=null&&this.return_!==st&&r.addTag({tagType:"return",type:this.return_});for(let i of this.throws)r.addTag({tagType:"throws",type:P.reference(i)});e.writeNode(r)}};var ne=class extends d{constructor({name:e,namespace:r,backing:i,docs:s,serializable:o}){super();c(this,"name");c(this,"namespace");c(this,"backing");c(this,"docs");c(this,"members",[]);c(this,"serializable");this.name=e,this.namespace=r,this.backing=i,this.docs=s,this.serializable=o!=null?o:!1}addMember(e){this.members.push(e)}write(e){this.writeComment(e),e.write("enum "),e.writeLine(`${this.name}`),this.backing!=null&&e.write(` : ${this.backing}`),this.serializable&&(e.addReference(new T({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let r of this.members)e.write(`case ${r.name}`),r.value!=null&&(typeof r.value=="string"?e.write(` = "${r.value}"`):e.write(` = ${r.value}`)),e.writeTextStatement("");this.serializable&&(e.newLine(),e.writeNode(new $({name:"jsonSerialize",return_:P.string(),access:"public",parameters:[],body:new v("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new I({docs:this.docs}).write(e)}};u();p();var ie=class extends d{constructor({name:e,type:r,access:i,readonly_:s,initializer:o,docs:h,inlineDocs:f,attributes:l,inherited:y}){super();c(this,"name");c(this,"type");c(this,"access");c(this,"readonly_");c(this,"initializer");c(this,"docs");c(this,"inlineDocs");c(this,"attributes");c(this,"inherited");this.name=G(e),this.type=r,this.access=i,this.readonly_=s!=null?s:!1,this.initializer=o,this.docs=h,this.inlineDocs=f,this.attributes=l!=null?l:[],this.inherited=y!=null?y:!1}write(e){this.writeComment(e),this.writeAttributesIfPresent(e),e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null&&(e.write(" = "),this.initializer.write(e)),e.write(";"),this.inlineDocs!=null&&e.write(` // ${this.inlineDocs}`),e.newLine()}writeComment(e){let r=new I;r.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),r.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.writeLine("]"))}};u();p();var se=class extends d{constructor({entries:e,multiline:r}){super();c(this,"entries");c(this,"multiline");this.entries=e!=null?e:[],this.multiline=r!=null?r:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:r,value:i}of this.entries)r.write(e),e.write(" => "),i.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[r,{key:i,value:s}]of this.entries.entries())r>0&&e.write(", "),i.write(e),e.write(" => "),s.write(e);e.write("]")}};u();p();var Y=class extends d{constructor({method:e,arguments_:r,static_:i,multiline:s,on:o}){super();c(this,"method");c(this,"arguments_");c(this,"multiline");c(this,"static_");c(this,"on");this.method=e,this.arguments_=r,this.static_=i!=null?i:!1,this.multiline=s!=null?s:!1,this.on=o}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),ue({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};u();p();u();p();var Q=class n extends d{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"list":{this.writeList({writer:e,list:this.internalType});break}case"boolean":{e.write(this.internalType.value.toString());break}case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"file":{e.writeNode(Pr({writer:e,value:this.internalType.value}));break}case"float":{e.write(this.internalType.value.toString());break}case"number":{e.write(this.internalType.value.toString());break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"datetime":{e.writeNode(Cr({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
18
+ `)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}e.write(`'${this.internalType.value.replaceAll("'","\\'")}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:C(this.internalType)}}writeStringWithHeredoc({writer:e,value:r}){e.writeLine("<<<EOT"),e.writeNoIndent(r),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:r}){e.writeNode(new _({classReference:r.reference,arguments_:[n.map({entries:r.fields.map(i=>({key:n.string(i.name),value:i.value}))})]}))}writeList({writer:e,list:r}){let i=Br({values:r.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let s of i)s.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:r}){let i=br({entries:r.entries});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let s of i)s.key.write(e),e.write(" => "),s.value.write(e),e.writeLine(",");e.dedent(),e.write("]")}static list({values:e}){return new this({type:"list",values:e})}static boolean(e){return new this({type:"boolean",value:e})}static class_({reference:e,fields:r}){return new this({type:"class",reference:e,fields:r})}static file(e){return new this({type:"file",value:e})}static float(e){return new this({type:"float",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static map({entries:e}){return new this({type:"map",entries:e})}static reference(e){return new this({type:"reference",value:e})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(r.includes('"')?`\`${r}\``:`"${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("[]");return}e.writeLine("["),e.indent();for(let i of r)e.writeNode(n.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[s,o]of i)e.write(`'${s}' => `),e.writeNode(n.unknown(o)),e.writeLine(",");e.dedent(),e.write("]")}};function Cr({writer:n,value:t}){return new _({classReference:new T({name:"DateTime",namespace:""}),arguments_:[new v(`'${t}'`)]})}function Pr({writer:n,value:t}){return new Y({on:new T({name:"File",namespace:`${n.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new v(`"${t}"`)]})}function br({entries:n}){return n.filter(t=>!Q.isNop(t.key)&&!Q.isNop(t.value))}function Br({values:n}){return n.filter(t=>!Q.isNop(t))}u();p();var Ee=class extends d{constructor(e){super();c(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),ue({writer:e,arguments_:this.arrays.map(r=>oe(i=>{if(typeof r=="string"||r instanceof d){i.writeNodeOrString(r);return}i.writeNodeOrString(r.ref),r.fallback&&(i.write(" ?? "),i.writeNodeOrString(r.fallback))}))})}};function Sr(n){return new j(n)}function Fr(n){return new ee(n)}function _r(n){return new D(n)}function kr(n){return new te(n)}function Mr(n){return new T(n)}function oe(n){return new v(n)}function Ur(n){return new re(n)}function Dr(n){return new ne(n)}function qr(n){return new ie(n)}function ht(n){return new _(n)}function $r(n){return new Y(n)}function Yr(n){return oe(t=>{t.write("throw "),t.writeNode(ht(n))})}function Or(n){return new se(n)}function Wr(n){return new $(n)}function Vr(n){return new q(n)}function Hr(n){return new le(n)}function zr(n,t){return oe(e=>{e.writeNodeOrString(n),e.write(" = "),e.writeNodeOrString(t)})}function Gr(n){return oe(G(n))}function Jr(n){return oe(`"${n}"`)}function Qr(...n){return new Ee(n)}function Kr(){return new v(n=>{n.write("$this")})}var ft="$client",Re="Example",lt=`<?php
19
19
 
20
- `,Se=class{constructor({context:t}){c(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){var i;let r=this.buildCodeBlock({endpoint:t,snippet:e});return ft+await r.toStringAsync({namespace:Re,rootNamespace:Re,customConfig:(i=this.context.customConfig)!=null?i:{}})}generateSnippetSync({endpoint:t,request:e}){var i;let r=this.buildCodeBlock({endpoint:t,snippet:e});return ft+r.toString({namespace:Re,rootNamespace:Re,customConfig:(i=this.context.customConfig)!=null?i:{}})}buildCodeBlock({endpoint:t,snippet:e}){return x.codeblock(r=>{r.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),r.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})}constructClient({endpoint:t,snippet:e}){return x.codeblock(r=>{r.write(`${ht} = `),r.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:t,snippet:e})))})}callMethod({endpoint:t,snippet:e}){return x.invokeMethod({on:x.codeblock(ht),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}),multiline:!0})}getConstructorArgs({endpoint:t,snippet:e}){let r=[];t.auth!=null&&(e.auth!=null?r.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:S.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let i=[],s=this.getConstructorBaseUrlArgs({baseUrl:e.baseURL,environment:e.environment});return s.length>0&&i.push(...s),this.context.errors.scope(F.Headers),this.context.ir.headers!=null&&e.headers!=null&&i.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),i.length===0?r:[...r,{name:"options",assignment:x.TypeLiteral.map({entries:i.map(o=>({key:x.TypeLiteral.string(o.name),value:o.value}))})}]}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.context.errors.add({severity:S.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBasicAuthArgs({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.context.errors.add({severity:S.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.context.errors.add({severity:S.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});default:L(t)}}getConstructorBasicAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),assignment:x.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),assignment:x.TypeLiteral.string(e.password)}]}getConstructorBaseUrlArgs({baseUrl:t,environment:e}){let r=this.getBaseUrlArg({baseUrl:t,environment:e});return x.TypeLiteral.isNop(r)?[]:[{name:"baseUrl",value:r}]}getBaseUrlArg({baseUrl:t,environment:e}){if(t!=null&&e!=null)return this.context.errors.add({severity:S.Critical,message:"Cannot specify both baseUrl and environment options"}),x.TypeLiteral.nop();if(t!=null)return x.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let r=this.context.getEnvironmentClassAccessFromID(e);return r==null?(this.context.errors.add({severity:S.Warning,message:`Environment ${JSON.stringify(e)} was not found`}),x.TypeLiteral.nop()):x.TypeLiteral.reference(x.codeblock(i=>{i.writeNode(r),i.write("->value")}))}this.context.isMultiEnvironmentValues(e)&&this.context.errors.add({severity:S.Warning,message:"The PHP SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}return x.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),assignment:x.TypeLiteral.string(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let s=this.getConstructorHeaderArg({header:i,value:e.value});s!=null&&r.push({name:this.context.getPropertyName(i.name.name),value:s})}return r}getConstructorHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!x.TypeLiteral.isNop(r))return r}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:L(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){let r=[];if(this.context.errors.scope(F.PathParameters),t.pathParameters!=null){let i=this.getPathParameters({namedParameters:t.pathParameters,snippet:e});r.push(...i.map(s=>s.value))}return this.context.errors.unscope(),this.context.errors.scope(F.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:L(t)}}getBytesBodyRequestArg({value:t}){return this.context.errors.add({severity:S.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),x.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:t,snippet:e}){let r=[];this.context.errors.scope(F.PathParameters);let s=[];t.pathParameters!=null&&s.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(F.RequestBody);let o=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:!1})||r.push(...s.map(h=>h.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:!1,inlineFileProperties:!0})&&r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:!1})?s:[],filePropertyInfo:o})),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 y,w,E,A;this.context.errors.scope(F.QueryParameters);let o=this.context.associateQueryParametersByWireValue({parameters:(y=t.queryParameters)!=null?y:[],values:(w=e.queryParameters)!=null?w:{}}).map(N=>({name:this.context.getPropertyName(N.name.name),value:this.context.dynamicTypeLiteralMapper.convert(N)}));this.context.errors.unscope(),this.context.errors.scope(F.Headers);let f=this.context.associateByWireValue({parameters:(E=t.headers)!=null?E:[],values:(A=e.headers)!=null?A:{}}).map(N=>({name:this.context.getPropertyName(N.name.name),value:this.context.dynamicTypeLiteralMapper.convert(N)}));this.context.errors.unscope(),this.context.errors.scope(F.RequestBody);let m=t.body!=null?this.getInlinedRequestBodyConstructorFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),x.TypeLiteral.class_({reference:x.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getRequestNamespace(t.declaration.fernFilepath)}),fields:[...r,...o,...f,...m]})}getInlinedRequestBodyConstructorFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:r});default:L(t)}}getFileUploadRequestBodyConstructorFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:t,value:e}){return{name:this.context.getPropertyName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:L(t)}}getInlinedRequestBodyPropertyConstructorFields({parameters:t,value:e}){var s;let r=[],i=this.context.associateByWireValue({parameters:t,values:(s=this.context.getRecord(e))!=null?s:{}});for(let o of i)r.push({name:this.context.getPropertyName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});return r}getPathParameters({namedParameters:t,snippet:e}){var s;let r=[],i=this.context.associateByWireValue({parameters:t,values:(s=e.pathParameters)!=null?s:{}});for(let o of i)r.push({name:this.context.getPropertyName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getPropertyName(e)).join("->")}->${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getRootClientClassInstantiation(t){return x.instantiateClass({classReference:x.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:t,multiline:!0})}};0&&(module.exports={EndpointSnippetGenerator});
20
+ `,Se=class{constructor({context:t}){c(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){var i;let r=this.buildCodeBlock({endpoint:t,snippet:e});return lt+await r.toStringAsync({namespace:Re,rootNamespace:Re,customConfig:(i=this.context.customConfig)!=null?i:{}})}generateSnippetSync({endpoint:t,request:e}){var i;let r=this.buildCodeBlock({endpoint:t,snippet:e});return lt+r.toString({namespace:Re,rootNamespace:Re,customConfig:(i=this.context.customConfig)!=null?i:{}})}buildCodeBlock({endpoint:t,snippet:e}){return x.codeblock(r=>{r.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),r.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})}constructClient({endpoint:t,snippet:e}){return x.codeblock(r=>{r.write(`${ft} = `),r.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:t,snippet:e})))})}callMethod({endpoint:t,snippet:e}){return x.invokeMethod({on:x.codeblock(ft),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}),multiline:!0})}getConstructorArgs({endpoint:t,snippet:e}){let r=[];t.auth!=null&&(e.auth!=null?r.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:S.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let i=[],s=this.getConstructorBaseUrlArgs({baseUrl:e.baseURL,environment:e.environment});return s.length>0&&i.push(...s),this.context.errors.scope(F.Headers),this.context.ir.headers!=null&&e.headers!=null&&i.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),i.length===0?r:[...r,{name:"options",assignment:x.TypeLiteral.map({entries:i.map(o=>({key:x.TypeLiteral.string(o.name),value:o.value}))})}]}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.context.errors.add({severity:S.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBasicAuthArgs({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.context.errors.add({severity:S.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.context.errors.add({severity:S.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});default:C(t)}}getConstructorBasicAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),assignment:x.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),assignment:x.TypeLiteral.string(e.password)}]}getConstructorBaseUrlArgs({baseUrl:t,environment:e}){let r=this.getBaseUrlArg({baseUrl:t,environment:e});return x.TypeLiteral.isNop(r)?[]:[{name:"baseUrl",value:r}]}getBaseUrlArg({baseUrl:t,environment:e}){if(t!=null&&e!=null)return this.context.errors.add({severity:S.Critical,message:"Cannot specify both baseUrl and environment options"}),x.TypeLiteral.nop();if(t!=null)return x.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let r=this.context.getEnvironmentClassAccessFromID(e);return r==null?(this.context.errors.add({severity:S.Warning,message:`Environment ${JSON.stringify(e)} was not found`}),x.TypeLiteral.nop()):x.TypeLiteral.reference(x.codeblock(i=>{i.writeNode(r),i.write("->value")}))}this.context.isMultiEnvironmentValues(e)&&this.context.errors.add({severity:S.Warning,message:"The PHP SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}return x.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),assignment:x.TypeLiteral.string(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let s=this.getConstructorHeaderArg({header:i,value:e.value});s!=null&&r.push({name:this.context.getPropertyName(i.name.name),value:s})}return r}getConstructorHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!x.TypeLiteral.isNop(r))return r}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:C(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){let r=[];if(this.context.errors.scope(F.PathParameters),t.pathParameters!=null){let i=this.getPathParameters({namedParameters:t.pathParameters,snippet:e});r.push(...i.map(s=>s.value))}return this.context.errors.unscope(),this.context.errors.scope(F.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:C(t)}}getBytesBodyRequestArg({value:t}){return this.context.errors.add({severity:S.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),x.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:t,snippet:e}){var h,f;let r=[],i=(f=(h=this.context.customConfig)==null?void 0:h.inlinePathParameters)!=null?f:!1;this.context.errors.scope(F.PathParameters);let s=[];t.pathParameters!=null&&s.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(F.RequestBody);let o=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...s.map(l=>l.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:!0})&&r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?s:[],filePropertyInfo:o})),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 y,w,E,A;this.context.errors.scope(F.QueryParameters);let o=this.context.associateQueryParametersByWireValue({parameters:(y=t.queryParameters)!=null?y:[],values:(w=e.queryParameters)!=null?w:{}}).map(N=>({name:this.context.getPropertyName(N.name.name),value:this.context.dynamicTypeLiteralMapper.convert(N)}));this.context.errors.unscope(),this.context.errors.scope(F.Headers);let f=this.context.associateByWireValue({parameters:(E=t.headers)!=null?E:[],values:(A=e.headers)!=null?A:{}}).map(N=>({name:this.context.getPropertyName(N.name.name),value:this.context.dynamicTypeLiteralMapper.convert(N)}));this.context.errors.unscope(),this.context.errors.scope(F.RequestBody);let l=t.body!=null?this.getInlinedRequestBodyConstructorFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),x.TypeLiteral.class_({reference:x.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getRequestNamespace(t.declaration.fernFilepath)}),fields:[...r,...o,...f,...l]})}getInlinedRequestBodyConstructorFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:r});default:C(t)}}getFileUploadRequestBodyConstructorFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:t,value:e}){return{name:this.context.getPropertyName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:C(t)}}getInlinedRequestBodyPropertyConstructorFields({parameters:t,value:e}){var s;let r=[],i=this.context.associateByWireValue({parameters:t,values:(s=this.context.getRecord(e))!=null?s:{}});for(let o of i)r.push({name:this.context.getPropertyName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});return r}getPathParameters({namedParameters:t,snippet:e}){var s;let r=[],i=this.context.associateByWireValue({parameters:t,values:(s=e.pathParameters)!=null?s:{}});for(let o of i)r.push({name:this.context.getPropertyName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getPropertyName(e)).join("->")}->${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getRootClientClassInstantiation(t){return x.instantiateClass({classReference:x.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:t,multiline:!0})}};0&&(module.exports={EndpointSnippetGenerator});
21
21
  /*! Bundled license information:
22
22
 
23
23
  @esbuild-plugins/node-globals-polyfill/Buffer.js: