@fern-api/php-dynamic-snippets 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.cjs CHANGED
@@ -1,30 +1,30 @@
1
- "use strict";var nt=Object.defineProperty,go=Object.defineProperties,wo=Object.getOwnPropertyDescriptor,vo=Object.getOwnPropertyDescriptors,To=Object.getOwnPropertyNames,rt=Object.getOwnPropertySymbols;var jt=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable;var $t=(r,t,e)=>t in r?nt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Se=(r,t)=>{for(var e in t||(t={}))jt.call(t,e)&&$t(r,e,t[e]);if(rt)for(var e of rt(t))pr.call(t,e)&&$t(r,e,t[e]);return r},Le=(r,t)=>go(r,vo(t));var fr=r=>typeof r=="symbol"?r:r+"",lr=(r,t)=>{var e={};for(var n in r)jt.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&rt)for(var n of rt(r))t.indexOf(n)<0&&pr.call(r,n)&&(e[n]=r[n]);return e};var Wt=(r,t)=>()=>(r&&(t=r(r=0)),t);var cr=(r,t)=>{for(var e in t)nt(r,e,{get:t[e],enumerable:!0})},bo=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of To(t))!jt.call(r,i)&&i!==e&&nt(r,i,{get:()=>t[i],enumerable:!(n=wo(t,i))||n.enumerable});return r};var Ao=r=>bo(nt({},"__esModule",{value:!0}),r);var c=(r,t,e)=>$t(r,typeof t!="symbol"?t+"":t,e);function dr(){throw new Error("setTimeout has not been defined")}function hr(){throw new Error("clearTimeout has not been defined")}function yr(r){if(ie===setTimeout)return setTimeout(r,0);if((ie===dr||!ie)&&setTimeout)return ie=setTimeout,setTimeout(r,0);try{return ie(r,0)}catch(t){try{return ie.call(null,r,0)}catch(e){return ie.call(this,r,0)}}}function Eo(r){if(oe===clearTimeout)return clearTimeout(r);if((oe===hr||!oe)&&clearTimeout)return oe=clearTimeout,clearTimeout(r);try{return oe(r)}catch(t){try{return oe.call(null,r)}catch(e){return oe.call(this,r)}}}function Ro(){!Fe||!xe||(Fe=!1,xe.length?H=xe.concat(H):it=-1,H.length&&xr())}function xr(){if(!Fe){var r=yr(Ro);Fe=!0;for(var t=H.length;t;){for(xe=H,H=[];++it<t;)xe&&xe[it].run();it=-1,t=H.length}xe=null,Fe=!1,Eo(r)}}function Co(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];H.push(new gr(r,t)),H.length===1&&!Fe&&yr(xr)}function gr(r,t){this.fun=r,this.array=t}function ge(){}function qo(r){throw new Error("process.binding is not supported")}function Vo(){return"/"}function Go(r){throw new Error("process.chdir is not supported")}function zo(){return 0}function Yo(r){var t=Ho.call(Pe)*.001,e=Math.floor(t),n=Math.floor(t%1*1e9);return r&&(e=e-r[0],n=n-r[1],n<0&&(e--,n+=1e9)),[e,n]}function Jo(){var r=new Date,t=r-Ko;return t/1e3}var ie,oe,H,Fe,xe,it,Io,No,So,Lo,Po,Fo,_o,ko,Bo,Uo,Oo,Mo,Do,$o,jo,Wo,Pe,Ho,Ko,f,mr,a=Wt(()=>{"use strict";ie=dr,oe=hr;typeof globalThis.setTimeout=="function"&&(ie=setTimeout);typeof globalThis.clearTimeout=="function"&&(oe=clearTimeout);H=[],Fe=!1,it=-1;gr.prototype.run=function(){this.fun.apply(null,this.array)};Io="browser",No="browser",So=!0,Lo={},Po=[],Fo="",_o={},ko={},Bo={};Uo=ge,Oo=ge,Mo=ge,Do=ge,$o=ge,jo=ge,Wo=ge;Pe=globalThis.performance||{},Ho=Pe.now||Pe.mozNow||Pe.msNow||Pe.oNow||Pe.webkitNow||function(){return new Date().getTime()};Ko=new Date;f={nextTick:Co,title:Io,browser:So,env:Lo,argv:Po,version:Fo,versions:_o,on:Uo,addListener:Oo,once:Mo,off:Do,removeListener:$o,removeAllListeners:jo,emit:Wo,binding:qo,cwd:Vo,chdir:Go,umask:zo,hrtime:Yo,platform:No,release:ko,config:Bo,uptime:Jo},mr={};Object.keys(mr).forEach(r=>{let t=r.split("."),e=f;for(let n=0;n<t.length;n++){let i=t[n];n===t.length-1?e[i]=mr[r]:e=e[i]||(e[i]={})}})});function br(){Vt=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=r.length;t<e;++t)j[t]=r[t],F[r.charCodeAt(t)]=t;F[45]=62,F[95]=63}function Qo(r){Vt||br();var t,e,n,i,o,u,l=r.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=r[l-2]==="="?2:r[l-1]==="="?1:0,u=new Zo(l*3/4-o),n=o>0?l-4:l;var m=0;for(t=0,e=0;t<n;t+=4,e+=3)i=F[r.charCodeAt(t)]<<18|F[r.charCodeAt(t+1)]<<12|F[r.charCodeAt(t+2)]<<6|F[r.charCodeAt(t+3)],u[m++]=i>>16&255,u[m++]=i>>8&255,u[m++]=i&255;return o===2?(i=F[r.charCodeAt(t)]<<2|F[r.charCodeAt(t+1)]>>4,u[m++]=i&255):o===1&&(i=F[r.charCodeAt(t)]<<10|F[r.charCodeAt(t+1)]<<4|F[r.charCodeAt(t+2)]>>2,u[m++]=i>>8&255,u[m++]=i&255),u}function Xo(r){return j[r>>18&63]+j[r>>12&63]+j[r>>6&63]+j[r&63]}function ea(r,t,e){for(var n,i=[],o=t;o<e;o+=3)n=(r[o]<<16)+(r[o+1]<<8)+r[o+2],i.push(Xo(n));return i.join("")}function wr(r){Vt||br();for(var t,e=r.length,n=e%3,i="",o=[],u=16383,l=0,m=e-n;l<m;l+=u)o.push(ea(r,l,l+u>m?m:l+u));return n===1?(t=r[e-1],i+=j[t>>2],i+=j[t<<4&63],i+="=="):n===2&&(t=(r[e-2]<<8)+r[e-1],i+=j[t>>10],i+=j[t>>4&63],i+=j[t<<2&63],i+="="),o.push(i),o.join("")}function ot(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Y(r,t){if(ot()<t)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t),r.__proto__=p.prototype):(r===null&&(r=new p(t)),r.length=t),r}function p(r,t,e){if(!p.TYPED_ARRAY_SUPPORT&&!(this instanceof p))return new p(r,t,e);if(typeof r=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Gt(this,r)}return Ar(this,r,t,e)}function Ar(r,t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?na(r,t,e,n):typeof t=="string"?ra(r,t,e):ia(r,t)}function Er(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function ta(r,t,e,n){return Er(t),t<=0?Y(r,t):e!==void 0?typeof n=="string"?Y(r,t).fill(e,n):Y(r,t).fill(e):Y(r,t)}function Gt(r,t){if(Er(t),r=Y(r,t<0?0:zt(t)|0),!p.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)r[e]=0;return r}function ra(r,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Rr(t,e)|0;r=Y(r,n);var i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function qt(r,t){var e=t.length<0?0:zt(t.length)|0;r=Y(r,e);for(var n=0;n<e;n+=1)r[n]=t[n]&255;return r}function na(r,t,e,n){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?t=new Uint8Array(t):n===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,n),p.TYPED_ARRAY_SUPPORT?(r=t,r.__proto__=p.prototype):r=qt(r,t),r}function ia(r,t){if(W(t)){var e=zt(t.length)|0;return r=Y(r,e),r.length===0||t.copy(r,0,0,e),r}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||Aa(t.length)?Y(r,0):qt(r,t);if(t.type==="Buffer"&&Array.isArray(t.data))return qt(r,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function zt(r){if(r>=ot())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ot().toString(16)+" bytes");return r|0}function W(r){return!!(r!=null&&r._isBuffer)}function Rr(r,t){if(W(r))return r.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var e=r.length;if(e===0)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return at(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Fr(r).length;default:if(n)return at(r).length;t=(""+t).toLowerCase(),n=!0}}function oa(r,t,e){var n=!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(r||(r="utf8");;)switch(r){case"hex":return ha(this,t,e);case"utf8":case"utf-8":return Nr(this,t,e);case"ascii":return ma(this,t,e);case"latin1":case"binary":return da(this,t,e);case"base64":return la(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ya(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function we(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}function Cr(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=p.from(t,n)),W(t))return t.length===0?-1:vr(r,t,e,n,i);if(typeof t=="number")return t=t&255,p.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):vr(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function vr(r,t,e,n,i){var o=1,u=r.length,l=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;o=2,u/=2,l/=2,e/=2}function m(T,b){return o===1?T[b]:T.readUInt16BE(b*o)}var d;if(i){var y=-1;for(d=e;d<u;d++)if(m(r,d)===m(t,y===-1?0:d-y)){if(y===-1&&(y=d),d-y+1===l)return y*o}else y!==-1&&(d-=d-y),y=-1}else for(e+l>u&&(e=u-l),d=e;d>=0;d--){for(var x=!0,g=0;g<l;g++)if(m(r,d+g)!==m(t,g)){x=!1;break}if(x)return d}return-1}function aa(r,t,e,n){e=Number(e)||0;var i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u<n;++u){var l=parseInt(t.substr(u*2,2),16);if(isNaN(l))return u;r[e+u]=l}return u}function sa(r,t,e,n){return pt(at(t,r.length-e),r,e,n)}function Ir(r,t,e,n){return pt(Ta(t),r,e,n)}function ua(r,t,e,n){return Ir(r,t,e,n)}function pa(r,t,e,n){return pt(Fr(t),r,e,n)}function fa(r,t,e,n){return pt(ba(t,r.length-e),r,e,n)}function la(r,t,e){return t===0&&e===r.length?wr(r):wr(r.slice(t,e))}function Nr(r,t,e){e=Math.min(r.length,e);for(var n=[],i=t;i<e;){var o=r[i],u=null,l=o>239?4:o>223?3:o>191?2:1;if(i+l<=e){var m,d,y,x;switch(l){case 1:o<128&&(u=o);break;case 2:m=r[i+1],(m&192)===128&&(x=(o&31)<<6|m&63,x>127&&(u=x));break;case 3:m=r[i+1],d=r[i+2],(m&192)===128&&(d&192)===128&&(x=(o&15)<<12|(m&63)<<6|d&63,x>2047&&(x<55296||x>57343)&&(u=x));break;case 4:m=r[i+1],d=r[i+2],y=r[i+3],(m&192)===128&&(d&192)===128&&(y&192)===128&&(x=(o&15)<<18|(m&63)<<12|(d&63)<<6|y&63,x>65535&&x<1114112&&(u=x))}}u===null?(u=65533,l=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u),i+=l}return ca(n)}function ca(r){var t=r.length;if(t<=Tr)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=Tr));return e}function ma(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function da(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function ha(r,t,e){var n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=t;o<e;++o)i+=va(r[o]);return i}function ya(r,t,e){for(var n=r.slice(t,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}function R(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}function L(r,t,e,n,i,o){if(!W(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}function st(r,t,e,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(r.length-e,2);i<o;++i)r[e+i]=(t&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function ut(r,t,e,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(r.length-e,4);i<o;++i)r[e+i]=t>>>(n?i:3-i)*8&255}function Sr(r,t,e,n,i,o){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Lr(r,t,e,n,i){return i||Sr(r,t,e,4,34028234663852886e22,-34028234663852886e22),kr(r,t,e,n,23,4),e+4}function Pr(r,t,e,n,i){return i||Sr(r,t,e,8,17976931348623157e292,-17976931348623157e292),kr(r,t,e,n,52,8),e+8}function ga(r){if(r=wa(r).replace(xa,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function wa(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function va(r){return r<16?"0"+r.toString(16):r.toString(16)}function at(r,t){t=t||1/0;for(var e,n=r.length,i=null,o=[],u=0;u<n;++u){if(e=r.charCodeAt(u),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(u+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Ta(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function ba(r,t){for(var e,n,i,o=[],u=0;u<r.length&&!((t-=2)<0);++u)e=r.charCodeAt(u),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function Fr(r){return Qo(ga(r))}function pt(r,t,e,n){for(var i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function Aa(r){return r!==r}function Ea(r){return r!=null&&(!!r._isBuffer||_r(r)||Ra(r))}function _r(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Ra(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&_r(r.slice(0,0))}function ft(r,t,e,n,i){var o,u,l=i*8-n-1,m=(1<<l)-1,d=m>>1,y=-7,x=e?i-1:0,g=e?-1:1,T=r[t+x];for(x+=g,o=T&(1<<-y)-1,T>>=-y,y+=l;y>0;o=o*256+r[t+x],x+=g,y-=8);for(u=o&(1<<-y)-1,o>>=-y,y+=n;y>0;u=u*256+r[t+x],x+=g,y-=8);if(o===0)o=1-d;else{if(o===m)return u?NaN:(T?-1:1)*(1/0);u=u+Math.pow(2,n),o=o-d}return(T?-1:1)*u*Math.pow(2,o-n)}function kr(r,t,e,n,i,o){var u,l,m,d=o*8-i-1,y=(1<<d)-1,x=y>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=n?0:o-1,b=n?1:-1,N=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,u=y):(u=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-u))<1&&(u--,m*=2),u+x>=1?t+=g/m:t+=g*Math.pow(2,1-x),t*m>=2&&(u++,m/=2),u+x>=y?(l=0,u=y):u+x>=1?(l=(t*m-1)*Math.pow(2,i),u=u+x):(l=t*Math.pow(2,x-1)*Math.pow(2,i),u=0));i>=8;r[e+T]=l&255,T+=b,l/=256,i-=8);for(u=u<<i|l,d+=i;d>0;r[e+T]=u&255,T+=b,u/=256,d-=8);r[e+T-b]|=N*128}var j,F,Zo,Vt,Tr,xa,Br=Wt(()=>{"use strict";a();s();j=[],F=[],Zo=typeof Uint8Array!="undefined"?Uint8Array:Array,Vt=!1;p.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;p.poolSize=8192;p._augment=function(r){return r.__proto__=p.prototype,r};p.from=function(r,t,e){return Ar(null,r,t,e)};p.kMaxLength=ot();p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&p[Symbol.species]);p.alloc=function(r,t,e){return ta(null,r,t,e)};p.allocUnsafe=function(r){return Gt(null,r)};p.allocUnsafeSlow=function(r){return Gt(null,r)};p.isBuffer=Ea;p.compare=function(t,e){if(!W(t)||!W(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,o=0,u=Math.min(n,i);o<u;++o)if(t[o]!==e[o]){n=t[o],i=e[o];break}return n<i?-1:i<n?1:0};p.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}};p.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return p.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=p.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var u=t[n];if(!W(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(i,o),o+=u.length}return i};p.byteLength=Rr;p.prototype._isBuffer=!0;p.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)we(this,e,e+1);return this};p.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)we(this,e,e+3),we(this,e+1,e+2);return this};p.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)we(this,e,e+7),we(this,e+1,e+6),we(this,e+2,e+5),we(this,e+3,e+4);return this};p.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Nr(this,0,t):oa.apply(this,arguments)};p.prototype.equals=function(t){if(!W(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:p.compare(this,t)===0};p.prototype.compare=function(t,e,n,i,o){if(!W(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var u=o-i,l=n-e,m=Math.min(u,l),d=this.slice(i,o),y=t.slice(e,n),x=0;x<m;++x)if(d[x]!==y[x]){u=d[x],l=y[x];break}return u<l?-1:l<u?1:0};p.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};p.prototype.indexOf=function(t,e,n){return Cr(this,t,e,n,!0)};p.prototype.lastIndexOf=function(t,e,n){return Cr(this,t,e,n,!1)};p.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((n===void 0||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var u=!1;;)switch(i){case"hex":return aa(this,t,e,n);case"utf8":case"utf-8":return sa(this,t,e,n);case"ascii":return Ir(this,t,e,n);case"latin1":case"binary":return ua(this,t,e,n);case"base64":return pa(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fa(this,t,e,n);default:if(u)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),u=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Tr=4096;p.prototype.slice=function(t,e){var n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var i;if(p.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=p.prototype;else{var o=e-t;i=new p(o,void 0);for(var u=0;u<o;++u)i[u]=this[u+t]}return i};p.prototype.readUIntLE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=this[t],o=1,u=0;++u<e&&(o*=256);)i+=this[t+u]*o;return i};p.prototype.readUIntBE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};p.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]};p.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8};p.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]};p.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};p.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};p.prototype.readIntLE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=this[t],o=1,u=0;++u<e&&(o*=256);)i+=this[t+u]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};p.prototype.readIntBE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=e,o=1,u=this[t+--i];i>0&&(o*=256);)u+=this[t+--i]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*e)),u};p.prototype.readInt8=function(t,e){return e||R(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};p.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};p.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};p.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),ft(this,t,!0,23,4)};p.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),ft(this,t,!1,23,4)};p.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),ft(this,t,!0,52,8)};p.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),ft(this,t,!1,52,8)};p.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;L(this,t,e,n,o,0)}var u=1,l=0;for(this[e]=t&255;++l<n&&(u*=256);)this[e+l]=t/u&255;return e+n};p.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;L(this,t,e,n,o,0)}var u=n-1,l=1;for(this[e+u]=t&255;--u>=0&&(l*=256);)this[e+u]=t/l&255;return e+n};p.prototype.writeUInt8=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,1,255,0),p.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};p.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):st(this,t,e,!0),e+2};p.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):st(this,t,e,!1),e+2};p.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):ut(this,t,e,!0),e+4};p.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ut(this,t,e,!1),e+4};p.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*n-1);L(this,t,e,n,o-1,-o)}var u=0,l=1,m=0;for(this[e]=t&255;++u<n&&(l*=256);)t<0&&m===0&&this[e+u-1]!==0&&(m=1),this[e+u]=(t/l>>0)-m&255;return e+n};p.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*n-1);L(this,t,e,n,o-1,-o)}var u=n-1,l=1,m=0;for(this[e+u]=t&255;--u>=0&&(l*=256);)t<0&&m===0&&this[e+u+1]!==0&&(m=1),this[e+u]=(t/l>>0)-m&255;return e+n};p.prototype.writeInt8=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,1,127,-128),p.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};p.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):st(this,t,e,!0),e+2};p.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):st(this,t,e,!1),e+2};p.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ut(this,t,e,!0),e+4};p.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ut(this,t,e,!1),e+4};p.prototype.writeFloatLE=function(t,e,n){return Lr(this,t,e,!0,n)};p.prototype.writeFloatBE=function(t,e,n){return Lr(this,t,e,!1,n)};p.prototype.writeDoubleLE=function(t,e,n){return Pr(this,t,e,!0,n)};p.prototype.writeDoubleBE=function(t,e,n){return Pr(this,t,e,!1,n)};p.prototype.copy=function(t,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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-n&&(i=t.length-e+n);var o=i-n,u;if(this===t&&n<e&&e<i)for(u=o-1;u>=0;--u)t[u+e]=this[u+n];else if(o<1e3||!p.TYPED_ARRAY_SUPPORT)for(u=0;u<o;++u)t[u+e]=this[u+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o};p.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var u;if(typeof t=="number")for(u=e;u<n;++u)this[u]=t;else{var l=W(t)?t:at(new p(t,i).toString()),m=l.length;for(u=0;u<n-e;++u)this[u+e]=l[u%m]}return this};xa=/[^+\/0-9A-Za-z-_]/g});var s=Wt(()=>{"use strict";Br()});var ic={};cr(ic,{DynamicSnippetsGenerator:()=>Dt,EndpointSnippetGenerator:()=>je});module.exports=Ao(ic);a();s();a();s();a();s();a();s();function A(r){throw new Error("Unexpected value: "+JSON.stringify(r))}a();s();a();s();a();s();a();s();a();s();a();s();var Ca=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,lt=Ca;var Ia=typeof self=="object"&&self&&self.Object===Object&&self,Na=lt||Ia||Function("return this")(),C=Na;var Sa=C.Symbol,_=Sa;a();s();var Ur=Object.prototype,La=Ur.hasOwnProperty,Pa=Ur.toString,We=_?_.toStringTag:void 0;function Fa(r){var t=La.call(r,We),e=r[We];try{r[We]=void 0;var n=!0}catch(o){}var i=Pa.call(r);return n&&(t?r[We]=e:delete r[We]),i}var Or=Fa;a();s();var _a=Object.prototype,ka=_a.toString;function Ba(r){return ka.call(r)}var Mr=Ba;var Ua="[object Null]",Oa="[object Undefined]",Dr=_?_.toStringTag:void 0;function Ma(r){return r==null?r===void 0?Oa:Ua:Dr&&Dr in Object(r)?Or(r):Mr(r)}var B=Ma;a();s();function Da(r){return r!=null&&typeof r=="object"}var U=Da;var $a="[object Symbol]";function ja(r){return typeof r=="symbol"||U(r)&&B(r)==$a}var $r=ja;a();s();a();s();function Wa(r,t){for(var e=-1,n=r==null?0:r.length,i=Array(n);++e<n;)i[e]=t(r[e],e,r);return i}var jr=Wa;a();s();var qa=Array.isArray,K=qa;var Va=1/0,Wr=_?_.prototype:void 0,qr=Wr?Wr.toString:void 0;function Vr(r){if(typeof r=="string")return r;if(K(r))return jr(r,Vr)+"";if($r(r))return qr?qr.call(r):"";var t=r+"";return t=="0"&&1/r==-Va?"-0":t}var Gr=Vr;a();s();function Ga(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}var ct=Ga;a();s();a();s();a();s();a();s();var za="[object AsyncFunction]",Ha="[object Function]",Ya="[object GeneratorFunction]",Ka="[object Proxy]";function Ja(r){if(!ct(r))return!1;var t=B(r);return t==Ha||t==Ya||t==za||t==Ka}var mt=Ja;a();s();a();s();var Za=C["__core-js_shared__"],dt=Za;var zr=(function(){var r=/[^.]+$/.exec(dt&&dt.keys&&dt.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function Qa(r){return!!zr&&zr in r}var Hr=Qa;a();s();var Xa=Function.prototype,es=Xa.toString;function ts(r){if(r!=null){try{return es.call(r)}catch(t){}try{return r+""}catch(t){}}return""}var J=ts;var rs=/[\\^$.*+?()[\]{}|]/g,ns=/^\[object .+?Constructor\]$/,is=Function.prototype,os=Object.prototype,as=is.toString,ss=os.hasOwnProperty,us=RegExp("^"+as.call(ss).replace(rs,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ps(r){if(!ct(r)||Hr(r))return!1;var t=mt(r)?us:ns;return t.test(J(r))}var Yr=ps;a();s();function fs(r,t){return r==null?void 0:r[t]}var Kr=fs;function ls(r,t){var e=Kr(r,t);return Yr(e)?e:void 0}var k=ls;var cs=k(C,"WeakMap"),ht=cs;a();s();function ms(){}var Jr=ms;a();s();a();s();a();s();function ds(r,t,e,n){for(var i=r.length,o=e+(n?1:-1);n?o--:++o<i;)if(t(r[o],o,r))return o;return-1}var Zr=ds;a();s();function hs(r){return r!==r}var Qr=hs;a();s();function ys(r,t,e){for(var n=e-1,i=r.length;++n<i;)if(r[n]===t)return n;return-1}var Xr=ys;function xs(r,t,e){return t===t?Xr(r,t,e):Zr(r,Qr,e)}var en=xs;function gs(r,t){var e=r==null?0:r.length;return!!e&&en(r,t,0)>-1}var tn=gs;a();s();var ws=9007199254740991,vs=/^(?:0|[1-9]\d*)$/;function Ts(r,t){var e=typeof r;return t=t==null?ws:t,!!t&&(e=="number"||e!="symbol"&&vs.test(r))&&r>-1&&r%1==0&&r<t}var rn=Ts;a();s();function bs(r,t){return r===t||r!==r&&t!==t}var yt=bs;a();s();a();s();var As=9007199254740991;function Es(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=As}var xt=Es;function Rs(r){return r!=null&&xt(r.length)&&!mt(r)}var nn=Rs;a();s();var Cs=Object.prototype;function Is(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||Cs;return r===e}var on=Is;a();s();a();s();a();s();function Ns(r,t){for(var e=-1,n=Array(r);++e<r;)n[e]=t(e);return n}var an=Ns;a();s();a();s();var Ss="[object Arguments]";function Ls(r){return U(r)&&B(r)==Ss}var Ht=Ls;var sn=Object.prototype,Ps=sn.hasOwnProperty,Fs=sn.propertyIsEnumerable,_s=Ht((function(){return arguments})())?Ht:function(r){return U(r)&&Ps.call(r,"callee")&&!Fs.call(r,"callee")},un=_s;a();s();a();s();function ks(){return!1}var pn=ks;var cn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fn=cn&&typeof module=="object"&&module&&!module.nodeType&&module,Bs=fn&&fn.exports===cn,ln=Bs?C.Buffer:void 0,Us=ln?ln.isBuffer:void 0,Os=Us||pn,qe=Os;a();s();a();s();var Ms="[object Arguments]",Ds="[object Array]",$s="[object Boolean]",js="[object Date]",Ws="[object Error]",qs="[object Function]",Vs="[object Map]",Gs="[object Number]",zs="[object Object]",Hs="[object RegExp]",Ys="[object Set]",Ks="[object String]",Js="[object WeakMap]",Zs="[object ArrayBuffer]",Qs="[object DataView]",Xs="[object Float32Array]",eu="[object Float64Array]",tu="[object Int8Array]",ru="[object Int16Array]",nu="[object Int32Array]",iu="[object Uint8Array]",ou="[object Uint8ClampedArray]",au="[object Uint16Array]",su="[object Uint32Array]",E={};E[Xs]=E[eu]=E[tu]=E[ru]=E[nu]=E[iu]=E[ou]=E[au]=E[su]=!0;E[Ms]=E[Ds]=E[Zs]=E[$s]=E[Qs]=E[js]=E[Ws]=E[qs]=E[Vs]=E[Gs]=E[zs]=E[Hs]=E[Ys]=E[Ks]=E[Js]=!1;function uu(r){return U(r)&&xt(r.length)&&!!E[B(r)]}var mn=uu;a();s();function pu(r){return function(t){return r(t)}}var dn=pu;a();s();var hn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ve=hn&&typeof module=="object"&&module&&!module.nodeType&&module,fu=Ve&&Ve.exports===hn,Yt=fu&&lt.process,lu=(function(){try{var r=Ve&&Ve.require&&Ve.require("util").types;return r||Yt&&Yt.binding&&Yt.binding("util")}catch(t){}})(),Kt=lu;var yn=Kt&&Kt.isTypedArray,cu=yn?dn(yn):mn,gt=cu;var mu=Object.prototype,du=mu.hasOwnProperty;function hu(r,t){var e=K(r),n=!e&&un(r),i=!e&&!n&&qe(r),o=!e&&!n&&!i&&gt(r),u=e||n||i||o,l=u?an(r.length,String):[],m=l.length;for(var d in r)(t||du.call(r,d))&&!(u&&(d=="length"||i&&(d=="offset"||d=="parent")||o&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||rn(d,m)))&&l.push(d);return l}var xn=hu;a();s();a();s();a();s();function yu(r,t){return function(e){return r(t(e))}}var gn=yu;var xu=gn(Object.keys,Object),wn=xu;var gu=Object.prototype,wu=gu.hasOwnProperty;function vu(r){if(!on(r))return wn(r);var t=[];for(var e in Object(r))wu.call(r,e)&&e!="constructor"&&t.push(e);return t}var vn=vu;function Tu(r){return nn(r)?xn(r):vn(r)}var Tn=Tu;a();s();a();s();a();s();a();s();a();s();var bu=k(Object,"create"),Z=bu;function Au(){this.__data__=Z?Z(null):{},this.size=0}var bn=Au;a();s();function Eu(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}var An=Eu;a();s();var Ru="__lodash_hash_undefined__",Cu=Object.prototype,Iu=Cu.hasOwnProperty;function Nu(r){var t=this.__data__;if(Z){var e=t[r];return e===Ru?void 0:e}return Iu.call(t,r)?t[r]:void 0}var En=Nu;a();s();var Su=Object.prototype,Lu=Su.hasOwnProperty;function Pu(r){var t=this.__data__;return Z?t[r]!==void 0:Lu.call(t,r)}var Rn=Pu;a();s();var Fu="__lodash_hash_undefined__";function _u(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=Z&&t===void 0?Fu:t,this}var Cn=_u;function _e(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}_e.prototype.clear=bn;_e.prototype.delete=An;_e.prototype.get=En;_e.prototype.has=Rn;_e.prototype.set=Cn;var Jt=_e;a();s();a();s();function ku(){this.__data__=[],this.size=0}var In=ku;a();s();a();s();function Bu(r,t){for(var e=r.length;e--;)if(yt(r[e][0],t))return e;return-1}var ae=Bu;var Uu=Array.prototype,Ou=Uu.splice;function Mu(r){var t=this.__data__,e=ae(t,r);if(e<0)return!1;var n=t.length-1;return e==n?t.pop():Ou.call(t,e,1),--this.size,!0}var Nn=Mu;a();s();function Du(r){var t=this.__data__,e=ae(t,r);return e<0?void 0:t[e][1]}var Sn=Du;a();s();function $u(r){return ae(this.__data__,r)>-1}var Ln=$u;a();s();function ju(r,t){var e=this.__data__,n=ae(e,r);return n<0?(++this.size,e.push([r,t])):e[n][1]=t,this}var Pn=ju;function ke(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}ke.prototype.clear=In;ke.prototype.delete=Nn;ke.prototype.get=Sn;ke.prototype.has=Ln;ke.prototype.set=Pn;var se=ke;a();s();var Wu=k(C,"Map"),ue=Wu;function qu(){this.size=0,this.__data__={hash:new Jt,map:new(ue||se),string:new Jt}}var Fn=qu;a();s();a();s();a();s();function Vu(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}var _n=Vu;function Gu(r,t){var e=r.__data__;return _n(t)?e[typeof t=="string"?"string":"hash"]:e.map}var pe=Gu;function zu(r){var t=pe(this,r).delete(r);return this.size-=t?1:0,t}var kn=zu;a();s();function Hu(r){return pe(this,r).get(r)}var Bn=Hu;a();s();function Yu(r){return pe(this,r).has(r)}var Un=Yu;a();s();function Ku(r,t){var e=pe(this,r),n=e.size;return e.set(r,t),this.size+=e.size==n?0:1,this}var On=Ku;function Be(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}Be.prototype.clear=Fn;Be.prototype.delete=kn;Be.prototype.get=Bn;Be.prototype.has=Un;Be.prototype.set=On;var wt=Be;a();s();function Ju(r){return r==null?"":Gr(r)}var fe=Ju;a();s();function Zu(r,t){for(var e=-1,n=t.length,i=r.length;++e<n;)r[i+e]=t[e];return r}var Mn=Zu;a();s();a();s();a();s();a();s();a();s();a();s();function Qu(r,t,e){var n=-1,i=r.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=r[n+t];return o}var Dn=Qu;function Xu(r,t,e){var n=r.length;return e=e===void 0?n:e,!t&&e>=n?r:Dn(r,t,e)}var $n=Xu;a();s();var ep="\\ud800-\\udfff",tp="\\u0300-\\u036f",rp="\\ufe20-\\ufe2f",np="\\u20d0-\\u20ff",ip=tp+rp+np,op="\\ufe0e\\ufe0f",ap="\\u200d",sp=RegExp("["+ap+ep+ip+op+"]");function up(r){return sp.test(r)}var vt=up;a();s();a();s();function pp(r){return r.split("")}var jn=pp;a();s();var Wn="\\ud800-\\udfff",fp="\\u0300-\\u036f",lp="\\ufe20-\\ufe2f",cp="\\u20d0-\\u20ff",mp=fp+lp+cp,dp="\\ufe0e\\ufe0f",hp="["+Wn+"]",Zt="["+mp+"]",Qt="\\ud83c[\\udffb-\\udfff]",yp="(?:"+Zt+"|"+Qt+")",qn="[^"+Wn+"]",Vn="(?:\\ud83c[\\udde6-\\uddff]){2}",Gn="[\\ud800-\\udbff][\\udc00-\\udfff]",xp="\\u200d",zn=yp+"?",Hn="["+dp+"]?",gp="(?:"+xp+"(?:"+[qn,Vn,Gn].join("|")+")"+Hn+zn+")*",wp=Hn+zn+gp,vp="(?:"+[qn+Zt+"?",Zt,Vn,Gn,hp].join("|")+")",Tp=RegExp(Qt+"(?="+Qt+")|"+vp+wp,"g");function bp(r){return r.match(Tp)||[]}var Yn=bp;function Ap(r){return vt(r)?Yn(r):jn(r)}var Kn=Ap;function Ep(r){return function(t){t=fe(t);var e=vt(t)?Kn(t):void 0,n=e?e[0]:t.charAt(0),i=e?$n(e,1).join(""):t.slice(1);return n[r]()+i}}var Jn=Ep;var Rp=Jn("toUpperCase"),Ue=Rp;function Cp(r){return Ue(fe(r).toLowerCase())}var Zn=Cp;a();s();a();s();function Ip(r,t,e,n){var i=-1,o=r==null?0:r.length;for(n&&o&&(e=r[++i]);++i<o;)e=t(e,r[i],i,r);return e}var Qn=Ip;a();s();a();s();a();s();function Np(r){return function(t){return r==null?void 0:r[t]}}var Xn=Np;var Sp={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Lp=Xn(Sp),ei=Lp;var Pp=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Fp="\\u0300-\\u036f",_p="\\ufe20-\\ufe2f",kp="\\u20d0-\\u20ff",Bp=Fp+_p+kp,Up="["+Bp+"]",Op=RegExp(Up,"g");function Mp(r){return r=fe(r),r&&r.replace(Pp,ei).replace(Op,"")}var ti=Mp;a();s();a();s();var Dp=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function $p(r){return r.match(Dp)||[]}var ri=$p;a();s();var jp=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Wp(r){return jp.test(r)}var ni=Wp;a();s();var ui="\\ud800-\\udfff",qp="\\u0300-\\u036f",Vp="\\ufe20-\\ufe2f",Gp="\\u20d0-\\u20ff",zp=qp+Vp+Gp,pi="\\u2700-\\u27bf",fi="a-z\\xdf-\\xf6\\xf8-\\xff",Hp="\\xac\\xb1\\xd7\\xf7",Yp="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Kp="\\u2000-\\u206f",Jp=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",li="A-Z\\xc0-\\xd6\\xd8-\\xde",Zp="\\ufe0e\\ufe0f",ci=Hp+Yp+Kp+Jp,mi="['\u2019]",ii="["+ci+"]",Qp="["+zp+"]",di="\\d+",Xp="["+pi+"]",hi="["+fi+"]",yi="[^"+ui+ci+di+pi+fi+li+"]",ef="\\ud83c[\\udffb-\\udfff]",tf="(?:"+Qp+"|"+ef+")",rf="[^"+ui+"]",xi="(?:\\ud83c[\\udde6-\\uddff]){2}",gi="[\\ud800-\\udbff][\\udc00-\\udfff]",Oe="["+li+"]",nf="\\u200d",oi="(?:"+hi+"|"+yi+")",of="(?:"+Oe+"|"+yi+")",ai="(?:"+mi+"(?:d|ll|m|re|s|t|ve))?",si="(?:"+mi+"(?:D|LL|M|RE|S|T|VE))?",wi=tf+"?",vi="["+Zp+"]?",af="(?:"+nf+"(?:"+[rf,xi,gi].join("|")+")"+vi+wi+")*",sf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",uf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",pf=vi+wi+af,ff="(?:"+[Xp,xi,gi].join("|")+")"+pf,lf=RegExp([Oe+"?"+hi+"+"+ai+"(?="+[ii,Oe,"$"].join("|")+")",of+"+"+si+"(?="+[ii,Oe+oi,"$"].join("|")+")",Oe+"?"+oi+"+"+ai,Oe+"+"+si,uf,sf,di,ff].join("|"),"g");function cf(r){return r.match(lf)||[]}var Ti=cf;function mf(r,t,e){return r=fe(r),t=e?void 0:t,t===void 0?ni(r)?Ti(r):ri(r):r.match(t)||[]}var bi=mf;var df="['\u2019]",hf=RegExp(df,"g");function yf(r){return function(t){return Qn(bi(ti(t).replace(hf,"")),r,"")}}var Ai=yf;var xf=Ai(function(r,t,e){return t=t.toLowerCase(),r+(e?Zn(t):t)}),Tt=xf;a();s();a();s();function gf(){this.__data__=new se,this.size=0}var Ei=gf;a();s();function wf(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}var Ri=wf;a();s();function vf(r){return this.__data__.get(r)}var Ci=vf;a();s();function Tf(r){return this.__data__.has(r)}var Ii=Tf;a();s();var bf=200;function Af(r,t){var e=this.__data__;if(e instanceof se){var n=e.__data__;if(!ue||n.length<bf-1)return n.push([r,t]),this.size=++e.size,this;e=this.__data__=new wt(n)}return e.set(r,t),this.size=e.size,this}var Ni=Af;function Me(r){var t=this.__data__=new se(r);this.size=t.size}Me.prototype.clear=Ei;Me.prototype.delete=Ri;Me.prototype.get=Ci;Me.prototype.has=Ii;Me.prototype.set=Ni;var bt=Me;a();s();a();s();function Ef(r,t){for(var e=-1,n=r==null?0:r.length,i=0,o=[];++e<n;){var u=r[e];t(u,e,r)&&(o[i++]=u)}return o}var Si=Ef;a();s();function Rf(){return[]}var Li=Rf;var Cf=Object.prototype,If=Cf.propertyIsEnumerable,Pi=Object.getOwnPropertySymbols,Nf=Pi?function(r){return r==null?[]:(r=Object(r),Si(Pi(r),function(t){return If.call(r,t)}))}:Li,Fi=Nf;a();s();a();s();function Sf(r,t,e){var n=t(r);return K(r)?n:Mn(n,e(r))}var _i=Sf;function Lf(r){return _i(r,Tn,Fi)}var Xt=Lf;a();s();a();s();var Pf=k(C,"DataView"),At=Pf;a();s();var Ff=k(C,"Promise"),Et=Ff;a();s();var _f=k(C,"Set"),le=_f;var ki="[object Map]",kf="[object Object]",Bi="[object Promise]",Ui="[object Set]",Oi="[object WeakMap]",Mi="[object DataView]",Bf=J(At),Uf=J(ue),Of=J(Et),Mf=J(le),Df=J(ht),ve=B;(At&&ve(new At(new ArrayBuffer(1)))!=Mi||ue&&ve(new ue)!=ki||Et&&ve(Et.resolve())!=Bi||le&&ve(new le)!=Ui||ht&&ve(new ht)!=Oi)&&(ve=function(r){var t=B(r),e=t==kf?r.constructor:void 0,n=e?J(e):"";if(n)switch(n){case Bf:return Mi;case Uf:return ki;case Of:return Bi;case Mf:return Ui;case Df:return Oi}return t});var er=ve;a();s();var $f=C.Uint8Array,tr=$f;a();s();a();s();a();s();a();s();a();s();var jf="__lodash_hash_undefined__";function Wf(r){return this.__data__.set(r,jf),this}var Di=Wf;a();s();function qf(r){return this.__data__.has(r)}var $i=qf;function Rt(r){var t=-1,e=r==null?0:r.length;for(this.__data__=new wt;++t<e;)this.add(r[t])}Rt.prototype.add=Rt.prototype.push=Di;Rt.prototype.has=$i;var Ct=Rt;a();s();function Vf(r,t){for(var e=-1,n=r==null?0:r.length;++e<n;)if(t(r[e],e,r))return!0;return!1}var ji=Vf;a();s();function Gf(r,t){return r.has(t)}var It=Gf;var zf=1,Hf=2;function Yf(r,t,e,n,i,o){var u=e&zf,l=r.length,m=t.length;if(l!=m&&!(u&&m>l))return!1;var d=o.get(r),y=o.get(t);if(d&&y)return d==t&&y==r;var x=-1,g=!0,T=e&Hf?new Ct:void 0;for(o.set(r,t),o.set(t,r);++x<l;){var b=r[x],N=t[x];if(n)var $=u?n(N,b,x,t,r,o):n(b,N,x,r,t,o);if($!==void 0){if($)continue;g=!1;break}if(T){if(!ji(t,function(he,ye){if(!It(T,ye)&&(b===he||i(b,he,e,n,o)))return T.push(ye)})){g=!1;break}}else if(!(b===N||i(b,N,e,n,o))){g=!1;break}}return o.delete(r),o.delete(t),g}var Nt=Yf;a();s();a();s();function Kf(r){var t=-1,e=Array(r.size);return r.forEach(function(n,i){e[++t]=[i,n]}),e}var Wi=Kf;a();s();function Jf(r){var t=-1,e=Array(r.size);return r.forEach(function(n){e[++t]=n}),e}var De=Jf;var Zf=1,Qf=2,Xf="[object Boolean]",el="[object Date]",tl="[object Error]",rl="[object Map]",nl="[object Number]",il="[object RegExp]",ol="[object Set]",al="[object String]",sl="[object Symbol]",ul="[object ArrayBuffer]",pl="[object DataView]",qi=_?_.prototype:void 0,rr=qi?qi.valueOf:void 0;function fl(r,t,e,n,i,o,u){switch(e){case pl:if(r.byteLength!=t.byteLength||r.byteOffset!=t.byteOffset)return!1;r=r.buffer,t=t.buffer;case ul:return!(r.byteLength!=t.byteLength||!o(new tr(r),new tr(t)));case Xf:case el:case nl:return yt(+r,+t);case tl:return r.name==t.name&&r.message==t.message;case il:case al:return r==t+"";case rl:var l=Wi;case ol:var m=n&Zf;if(l||(l=De),r.size!=t.size&&!m)return!1;var d=u.get(r);if(d)return d==t;n|=Qf,u.set(r,t);var y=Nt(l(r),l(t),n,i,o,u);return u.delete(r),y;case sl:if(rr)return rr.call(r)==rr.call(t)}return!1}var Vi=fl;a();s();var ll=1,cl=Object.prototype,ml=cl.hasOwnProperty;function dl(r,t,e,n,i,o){var u=e&ll,l=Xt(r),m=l.length,d=Xt(t),y=d.length;if(m!=y&&!u)return!1;for(var x=m;x--;){var g=l[x];if(!(u?g in t:ml.call(t,g)))return!1}var T=o.get(r),b=o.get(t);if(T&&b)return T==t&&b==r;var N=!0;o.set(r,t),o.set(t,r);for(var $=u;++x<m;){g=l[x];var he=r[g],ye=t[g];if(n)var ur=u?n(ye,he,g,t,r,o):n(he,ye,g,r,t,o);if(!(ur===void 0?he===ye||i(he,ye,e,n,o):ur)){N=!1;break}$||($=g=="constructor")}if(N&&!$){var et=r.constructor,tt=t.constructor;et!=tt&&"constructor"in r&&"constructor"in t&&!(typeof et=="function"&&et instanceof et&&typeof tt=="function"&&tt instanceof tt)&&(N=!1)}return o.delete(r),o.delete(t),N}var Gi=dl;var hl=1,zi="[object Arguments]",Hi="[object Array]",St="[object Object]",yl=Object.prototype,Yi=yl.hasOwnProperty;function xl(r,t,e,n,i,o){var u=K(r),l=K(t),m=u?Hi:er(r),d=l?Hi:er(t);m=m==zi?St:m,d=d==zi?St:d;var y=m==St,x=d==St,g=m==d;if(g&&qe(r)){if(!qe(t))return!1;u=!0,y=!1}if(g&&!y)return o||(o=new bt),u||gt(r)?Nt(r,t,e,n,i,o):Vi(r,t,m,e,n,i,o);if(!(e&hl)){var T=y&&Yi.call(r,"__wrapped__"),b=x&&Yi.call(t,"__wrapped__");if(T||b){var N=T?r.value():r,$=b?t.value():t;return o||(o=new bt),i(N,$,e,n,o)}}return g?(o||(o=new bt),Gi(r,t,e,n,i,o)):!1}var Ki=xl;function Ji(r,t,e,n,i){return r===t?!0:r==null||t==null||!U(r)&&!U(t)?r!==r&&t!==t:Ki(r,t,e,n,Ji,i)}var Zi=Ji;a();s();function gl(r,t,e){for(var n=-1,i=r==null?0:r.length;++n<i;)if(e(t,r[n]))return!0;return!1}var Qi=gl;a();s();function wl(r,t){return Zi(r,t)}var Lt=wl;a();s();a();s();var vl=1/0,Tl=le&&1/De(new le([,-0]))[1]==vl?function(r){return new le(r)}:Jr,Xi=Tl;var bl=200;function Al(r,t,e){var n=-1,i=tn,o=r.length,u=!0,l=[],m=l;if(e)u=!1,i=Qi;else if(o>=bl){var d=t?null:Xi(r);if(d)return De(d);u=!1,i=It,m=new Ct}else m=t?[]:l;e:for(;++n<o;){var y=r[n],x=t?t(y):y;if(y=e||y!==0?y:0,u&&x===x){for(var g=m.length;g--;)if(m[g]===x)continue e;t&&m.push(x),l.push(y)}else i(m,x,e)||(m!==l&&m.push(x),l.push(y))}return l}var eo=Al;a();s();function El(r,t){return t=typeof t=="function"?t:void 0,r&&r.length?eo(r,void 0,t):[]}var Pt=El;a();s();function Ge(r){return Object.keys(r)}a();s();a();s();a();s();var to,ro,ze=(ro=(to=f.env.FERN_STACK_TRACK)==null?void 0:to.toLowerCase())!=null?ro:"",q=ze!==""&&ze!=="0"&&ze!=="false",nr=["single","multiline","box"].includes(ze)?ze:"single";q&&(Error.stackTraceLimit=50);var Rl=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Cl=new Set(["stacktrace"]);function _t({maxFrames:r=50,skip:t=0,filterPaths:e=[],filterFunctions:n=[],stopOn:i=[],filterNode:o=!0,filterJs:u=!0,formatFilename:l=m=>m}={}){var d;if(!q)return[];n=[...n,...Rl],e=[...e,...Cl],i=[...i,"runInteractiveTask"];let m=!1;return((d=new Error().stack)!=null?d:"").split(`
2
- `).map(y=>{let x=y.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(x&&x.length===5){let[,g,T,b,N]=x;if(!g||!T||!b||!N)return;if(m||i.some($=>g==null?void 0:g.includes($))){m=!0;return}switch(g){case"Object.<anonymous>":g="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":g=`${g.substring(g.indexOf(".")+1)}()=> { ... }`;break}return{fn:g,path:l(T),position:`${b}:${N}`}}}).filter(y=>{var x,g;return y&&!n.some(T=>y.fn.includes(T))&&!(o&&((x=y.path)!=null&&x.startsWith("node:")))&&!(u&&((g=y.path)!=null&&g.endsWith(".js")))&&!e.some(T=>y.path.includes(T))}).slice(t,t+r)}var Ft=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:n=[],filterFunctions:i=[],stopOn:o=[],filterNode:u=!0,filterJs:l=!0,multiline:m=!1,formatFilename:d=y=>y}={}){c(this,"maxFrames");c(this,"skip");c(this,"filterPaths");c(this,"filterFunctions");c(this,"stopOn");c(this,"filterNode");c(this,"filterJs");c(this,"multiline");c(this,"formatFilename");c(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=n,this.filterFunctions=i,this.stopOn=o,this.filterNode=u,this.filterJs=l,this.multiline=m,this.formatFilename=d}tag(t){let e=this.tracking.get(t)||new Set;_t({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(n=>e.add(n)),this.tracking.set(t,e)}trace(t){if(!q)return"";let e=this.tracking.get(t);return e?[...e].map(n=>`${this.multiline?`
3
- `:""}${n.fn} - ${n.path}:${n.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},Q;function no({maxFrames:r=50,skip:t=0,filterPaths:e=[],filterFunctions:n=[],stopOn:i=[],filterNode:o=!0,filterJs:u=!0,multiline:l=!1,formatFilename:m=d=>d}={}){q&&(Q!=null||(Q=new Ft({maxFrames:r,skip:t,filterPaths:e,filterFunctions:n,stopOn:i,filterNode:o,filterJs:u,multiline:l,formatFilename:m})))}function io(r){Q==null||Q.tag(r)}function ir(r){var t;return(t=Q==null?void 0:Q.frames(r))!=null?t:[]}var X=class{constructor(){io(this)}};a();s();a();s();a();s();var O=class extends X{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var Il=4;no({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var He=class{constructor(){c(this,"lineBuffer",[]);c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsSemicolon",!1);c(this,"lastCharacterIsNewline",!1);c(this,"nodeStackFrames",[])}get buffer(){return q&&this.nodeStackFrames.length>0&&this.writeInternal(`
1
+ "use strict";var nt=Object.defineProperty,go=Object.defineProperties,wo=Object.getOwnPropertyDescriptor,vo=Object.getOwnPropertyDescriptors,To=Object.getOwnPropertyNames,rt=Object.getOwnPropertySymbols;var jt=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable;var $t=(r,t,e)=>t in r?nt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ne=(r,t)=>{for(var e in t||(t={}))jt.call(t,e)&&$t(r,e,t[e]);if(rt)for(var e of rt(t))pr.call(t,e)&&$t(r,e,t[e]);return r},Le=(r,t)=>go(r,vo(t));var fr=r=>typeof r=="symbol"?r:r+"",lr=(r,t)=>{var e={};for(var n in r)jt.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&rt)for(var n of rt(r))t.indexOf(n)<0&&pr.call(r,n)&&(e[n]=r[n]);return e};var qt=(r,t)=>()=>(r&&(t=r(r=0)),t);var cr=(r,t)=>{for(var e in t)nt(r,e,{get:t[e],enumerable:!0})},bo=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of To(t))!jt.call(r,i)&&i!==e&&nt(r,i,{get:()=>t[i],enumerable:!(n=wo(t,i))||n.enumerable});return r};var Ao=r=>bo(nt({},"__esModule",{value:!0}),r);var m=(r,t,e)=>$t(r,typeof t!="symbol"?t+"":t,e);function dr(){throw new Error("setTimeout has not been defined")}function hr(){throw new Error("clearTimeout has not been defined")}function yr(r){if(ie===setTimeout)return setTimeout(r,0);if((ie===dr||!ie)&&setTimeout)return ie=setTimeout,setTimeout(r,0);try{return ie(r,0)}catch(t){try{return ie.call(null,r,0)}catch(e){return ie.call(this,r,0)}}}function Eo(r){if(oe===clearTimeout)return clearTimeout(r);if((oe===hr||!oe)&&clearTimeout)return oe=clearTimeout,clearTimeout(r);try{return oe(r)}catch(t){try{return oe.call(null,r)}catch(e){return oe.call(this,r)}}}function Ro(){!Fe||!xe||(Fe=!1,xe.length?H=xe.concat(H):it=-1,H.length&&xr())}function xr(){if(!Fe){var r=yr(Ro);Fe=!0;for(var t=H.length;t;){for(xe=H,H=[];++it<t;)xe&&xe[it].run();it=-1,t=H.length}xe=null,Fe=!1,Eo(r)}}function Co(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];H.push(new gr(r,t)),H.length===1&&!Fe&&yr(xr)}function gr(r,t){this.fun=r,this.array=t}function ge(){}function Wo(r){throw new Error("process.binding is not supported")}function Vo(){return"/"}function Go(r){throw new Error("process.chdir is not supported")}function zo(){return 0}function Yo(r){var t=Ho.call(Pe)*.001,e=Math.floor(t),n=Math.floor(t%1*1e9);return r&&(e=e-r[0],n=n-r[1],n<0&&(e--,n+=1e9)),[e,n]}function Jo(){var r=new Date,t=r-Ko;return t/1e3}var ie,oe,H,Fe,xe,it,Io,So,No,Lo,Po,Fo,_o,ko,Bo,Oo,Uo,Mo,Do,$o,jo,qo,Pe,Ho,Ko,f,mr,a=qt(()=>{"use strict";ie=dr,oe=hr;typeof globalThis.setTimeout=="function"&&(ie=setTimeout);typeof globalThis.clearTimeout=="function"&&(oe=clearTimeout);H=[],Fe=!1,it=-1;gr.prototype.run=function(){this.fun.apply(null,this.array)};Io="browser",So="browser",No=!0,Lo={},Po=[],Fo="",_o={},ko={},Bo={};Oo=ge,Uo=ge,Mo=ge,Do=ge,$o=ge,jo=ge,qo=ge;Pe=globalThis.performance||{},Ho=Pe.now||Pe.mozNow||Pe.msNow||Pe.oNow||Pe.webkitNow||function(){return new Date().getTime()};Ko=new Date;f={nextTick:Co,title:Io,browser:No,env:Lo,argv:Po,version:Fo,versions:_o,on:Oo,addListener:Uo,once:Mo,off:Do,removeListener:$o,removeAllListeners:jo,emit:qo,binding:Wo,cwd:Vo,chdir:Go,umask:zo,hrtime:Yo,platform:So,release:ko,config:Bo,uptime:Jo},mr={};Object.keys(mr).forEach(r=>{let t=r.split("."),e=f;for(let n=0;n<t.length;n++){let i=t[n];n===t.length-1?e[i]=mr[r]:e=e[i]||(e[i]={})}})});function br(){Vt=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=r.length;t<e;++t)j[t]=r[t],F[r.charCodeAt(t)]=t;F[45]=62,F[95]=63}function Qo(r){Vt||br();var t,e,n,i,o,u,l=r.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=r[l-2]==="="?2:r[l-1]==="="?1:0,u=new Zo(l*3/4-o),n=o>0?l-4:l;var c=0;for(t=0,e=0;t<n;t+=4,e+=3)i=F[r.charCodeAt(t)]<<18|F[r.charCodeAt(t+1)]<<12|F[r.charCodeAt(t+2)]<<6|F[r.charCodeAt(t+3)],u[c++]=i>>16&255,u[c++]=i>>8&255,u[c++]=i&255;return o===2?(i=F[r.charCodeAt(t)]<<2|F[r.charCodeAt(t+1)]>>4,u[c++]=i&255):o===1&&(i=F[r.charCodeAt(t)]<<10|F[r.charCodeAt(t+1)]<<4|F[r.charCodeAt(t+2)]>>2,u[c++]=i>>8&255,u[c++]=i&255),u}function Xo(r){return j[r>>18&63]+j[r>>12&63]+j[r>>6&63]+j[r&63]}function ea(r,t,e){for(var n,i=[],o=t;o<e;o+=3)n=(r[o]<<16)+(r[o+1]<<8)+r[o+2],i.push(Xo(n));return i.join("")}function wr(r){Vt||br();for(var t,e=r.length,n=e%3,i="",o=[],u=16383,l=0,c=e-n;l<c;l+=u)o.push(ea(r,l,l+u>c?c:l+u));return n===1?(t=r[e-1],i+=j[t>>2],i+=j[t<<4&63],i+="=="):n===2&&(t=(r[e-2]<<8)+r[e-1],i+=j[t>>10],i+=j[t>>4&63],i+=j[t<<2&63],i+="="),o.push(i),o.join("")}function ot(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Y(r,t){if(ot()<t)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t),r.__proto__=p.prototype):(r===null&&(r=new p(t)),r.length=t),r}function p(r,t,e){if(!p.TYPED_ARRAY_SUPPORT&&!(this instanceof p))return new p(r,t,e);if(typeof r=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Gt(this,r)}return Ar(this,r,t,e)}function Ar(r,t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?na(r,t,e,n):typeof t=="string"?ra(r,t,e):ia(r,t)}function Er(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function ta(r,t,e,n){return Er(t),t<=0?Y(r,t):e!==void 0?typeof n=="string"?Y(r,t).fill(e,n):Y(r,t).fill(e):Y(r,t)}function Gt(r,t){if(Er(t),r=Y(r,t<0?0:zt(t)|0),!p.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)r[e]=0;return r}function ra(r,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Rr(t,e)|0;r=Y(r,n);var i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function Wt(r,t){var e=t.length<0?0:zt(t.length)|0;r=Y(r,e);for(var n=0;n<e;n+=1)r[n]=t[n]&255;return r}function na(r,t,e,n){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?t=new Uint8Array(t):n===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,n),p.TYPED_ARRAY_SUPPORT?(r=t,r.__proto__=p.prototype):r=Wt(r,t),r}function ia(r,t){if(q(t)){var e=zt(t.length)|0;return r=Y(r,e),r.length===0||t.copy(r,0,0,e),r}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||Aa(t.length)?Y(r,0):Wt(r,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Wt(r,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function zt(r){if(r>=ot())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ot().toString(16)+" bytes");return r|0}function q(r){return!!(r!=null&&r._isBuffer)}function Rr(r,t){if(q(r))return r.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var e=r.length;if(e===0)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return at(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Fr(r).length;default:if(n)return at(r).length;t=(""+t).toLowerCase(),n=!0}}function oa(r,t,e){var n=!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(r||(r="utf8");;)switch(r){case"hex":return ha(this,t,e);case"utf8":case"utf-8":return Sr(this,t,e);case"ascii":return ma(this,t,e);case"latin1":case"binary":return da(this,t,e);case"base64":return la(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ya(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function we(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}function Cr(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=p.from(t,n)),q(t))return t.length===0?-1:vr(r,t,e,n,i);if(typeof t=="number")return t=t&255,p.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):vr(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function vr(r,t,e,n,i){var o=1,u=r.length,l=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;o=2,u/=2,l/=2,e/=2}function c(T,b){return o===1?T[b]:T.readUInt16BE(b*o)}var d;if(i){var y=-1;for(d=e;d<u;d++)if(c(r,d)===c(t,y===-1?0:d-y)){if(y===-1&&(y=d),d-y+1===l)return y*o}else y!==-1&&(d-=d-y),y=-1}else for(e+l>u&&(e=u-l),d=e;d>=0;d--){for(var x=!0,g=0;g<l;g++)if(c(r,d+g)!==c(t,g)){x=!1;break}if(x)return d}return-1}function aa(r,t,e,n){e=Number(e)||0;var i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u<n;++u){var l=parseInt(t.substr(u*2,2),16);if(isNaN(l))return u;r[e+u]=l}return u}function sa(r,t,e,n){return pt(at(t,r.length-e),r,e,n)}function Ir(r,t,e,n){return pt(Ta(t),r,e,n)}function ua(r,t,e,n){return Ir(r,t,e,n)}function pa(r,t,e,n){return pt(Fr(t),r,e,n)}function fa(r,t,e,n){return pt(ba(t,r.length-e),r,e,n)}function la(r,t,e){return t===0&&e===r.length?wr(r):wr(r.slice(t,e))}function Sr(r,t,e){e=Math.min(r.length,e);for(var n=[],i=t;i<e;){var o=r[i],u=null,l=o>239?4:o>223?3:o>191?2:1;if(i+l<=e){var c,d,y,x;switch(l){case 1:o<128&&(u=o);break;case 2:c=r[i+1],(c&192)===128&&(x=(o&31)<<6|c&63,x>127&&(u=x));break;case 3:c=r[i+1],d=r[i+2],(c&192)===128&&(d&192)===128&&(x=(o&15)<<12|(c&63)<<6|d&63,x>2047&&(x<55296||x>57343)&&(u=x));break;case 4:c=r[i+1],d=r[i+2],y=r[i+3],(c&192)===128&&(d&192)===128&&(y&192)===128&&(x=(o&15)<<18|(c&63)<<12|(d&63)<<6|y&63,x>65535&&x<1114112&&(u=x))}}u===null?(u=65533,l=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u),i+=l}return ca(n)}function ca(r){var t=r.length;if(t<=Tr)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=Tr));return e}function ma(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function da(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function ha(r,t,e){var n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=t;o<e;++o)i+=va(r[o]);return i}function ya(r,t,e){for(var n=r.slice(t,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}function R(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}function L(r,t,e,n,i,o){if(!q(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}function st(r,t,e,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(r.length-e,2);i<o;++i)r[e+i]=(t&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function ut(r,t,e,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(r.length-e,4);i<o;++i)r[e+i]=t>>>(n?i:3-i)*8&255}function Nr(r,t,e,n,i,o){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Lr(r,t,e,n,i){return i||Nr(r,t,e,4,34028234663852886e22,-34028234663852886e22),kr(r,t,e,n,23,4),e+4}function Pr(r,t,e,n,i){return i||Nr(r,t,e,8,17976931348623157e292,-17976931348623157e292),kr(r,t,e,n,52,8),e+8}function ga(r){if(r=wa(r).replace(xa,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function wa(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function va(r){return r<16?"0"+r.toString(16):r.toString(16)}function at(r,t){t=t||1/0;for(var e,n=r.length,i=null,o=[],u=0;u<n;++u){if(e=r.charCodeAt(u),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(u+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Ta(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function ba(r,t){for(var e,n,i,o=[],u=0;u<r.length&&!((t-=2)<0);++u)e=r.charCodeAt(u),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function Fr(r){return Qo(ga(r))}function pt(r,t,e,n){for(var i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function Aa(r){return r!==r}function Ea(r){return r!=null&&(!!r._isBuffer||_r(r)||Ra(r))}function _r(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Ra(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&_r(r.slice(0,0))}function ft(r,t,e,n,i){var o,u,l=i*8-n-1,c=(1<<l)-1,d=c>>1,y=-7,x=e?i-1:0,g=e?-1:1,T=r[t+x];for(x+=g,o=T&(1<<-y)-1,T>>=-y,y+=l;y>0;o=o*256+r[t+x],x+=g,y-=8);for(u=o&(1<<-y)-1,o>>=-y,y+=n;y>0;u=u*256+r[t+x],x+=g,y-=8);if(o===0)o=1-d;else{if(o===c)return u?NaN:(T?-1:1)*(1/0);u=u+Math.pow(2,n),o=o-d}return(T?-1:1)*u*Math.pow(2,o-n)}function kr(r,t,e,n,i,o){var u,l,c,d=o*8-i-1,y=(1<<d)-1,x=y>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=n?0:o-1,b=n?1:-1,S=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,u=y):(u=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-u))<1&&(u--,c*=2),u+x>=1?t+=g/c:t+=g*Math.pow(2,1-x),t*c>=2&&(u++,c/=2),u+x>=y?(l=0,u=y):u+x>=1?(l=(t*c-1)*Math.pow(2,i),u=u+x):(l=t*Math.pow(2,x-1)*Math.pow(2,i),u=0));i>=8;r[e+T]=l&255,T+=b,l/=256,i-=8);for(u=u<<i|l,d+=i;d>0;r[e+T]=u&255,T+=b,u/=256,d-=8);r[e+T-b]|=S*128}var j,F,Zo,Vt,Tr,xa,Br=qt(()=>{"use strict";a();s();j=[],F=[],Zo=typeof Uint8Array!="undefined"?Uint8Array:Array,Vt=!1;p.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;p.poolSize=8192;p._augment=function(r){return r.__proto__=p.prototype,r};p.from=function(r,t,e){return Ar(null,r,t,e)};p.kMaxLength=ot();p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&p[Symbol.species]);p.alloc=function(r,t,e){return ta(null,r,t,e)};p.allocUnsafe=function(r){return Gt(null,r)};p.allocUnsafeSlow=function(r){return Gt(null,r)};p.isBuffer=Ea;p.compare=function(t,e){if(!q(t)||!q(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,o=0,u=Math.min(n,i);o<u;++o)if(t[o]!==e[o]){n=t[o],i=e[o];break}return n<i?-1:i<n?1:0};p.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}};p.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return p.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=p.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var u=t[n];if(!q(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(i,o),o+=u.length}return i};p.byteLength=Rr;p.prototype._isBuffer=!0;p.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)we(this,e,e+1);return this};p.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)we(this,e,e+3),we(this,e+1,e+2);return this};p.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)we(this,e,e+7),we(this,e+1,e+6),we(this,e+2,e+5),we(this,e+3,e+4);return this};p.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Sr(this,0,t):oa.apply(this,arguments)};p.prototype.equals=function(t){if(!q(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:p.compare(this,t)===0};p.prototype.compare=function(t,e,n,i,o){if(!q(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var u=o-i,l=n-e,c=Math.min(u,l),d=this.slice(i,o),y=t.slice(e,n),x=0;x<c;++x)if(d[x]!==y[x]){u=d[x],l=y[x];break}return u<l?-1:l<u?1:0};p.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};p.prototype.indexOf=function(t,e,n){return Cr(this,t,e,n,!0)};p.prototype.lastIndexOf=function(t,e,n){return Cr(this,t,e,n,!1)};p.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((n===void 0||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var u=!1;;)switch(i){case"hex":return aa(this,t,e,n);case"utf8":case"utf-8":return sa(this,t,e,n);case"ascii":return Ir(this,t,e,n);case"latin1":case"binary":return ua(this,t,e,n);case"base64":return pa(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fa(this,t,e,n);default:if(u)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),u=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Tr=4096;p.prototype.slice=function(t,e){var n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var i;if(p.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=p.prototype;else{var o=e-t;i=new p(o,void 0);for(var u=0;u<o;++u)i[u]=this[u+t]}return i};p.prototype.readUIntLE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=this[t],o=1,u=0;++u<e&&(o*=256);)i+=this[t+u]*o;return i};p.prototype.readUIntBE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};p.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]};p.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8};p.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]};p.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};p.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};p.prototype.readIntLE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=this[t],o=1,u=0;++u<e&&(o*=256);)i+=this[t+u]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};p.prototype.readIntBE=function(t,e,n){t=t|0,e=e|0,n||R(t,e,this.length);for(var i=e,o=1,u=this[t+--i];i>0&&(o*=256);)u+=this[t+--i]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*e)),u};p.prototype.readInt8=function(t,e){return e||R(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};p.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};p.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};p.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),ft(this,t,!0,23,4)};p.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),ft(this,t,!1,23,4)};p.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),ft(this,t,!0,52,8)};p.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),ft(this,t,!1,52,8)};p.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;L(this,t,e,n,o,0)}var u=1,l=0;for(this[e]=t&255;++l<n&&(u*=256);)this[e+l]=t/u&255;return e+n};p.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;L(this,t,e,n,o,0)}var u=n-1,l=1;for(this[e+u]=t&255;--u>=0&&(l*=256);)this[e+u]=t/l&255;return e+n};p.prototype.writeUInt8=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,1,255,0),p.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};p.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):st(this,t,e,!0),e+2};p.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):st(this,t,e,!1),e+2};p.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):ut(this,t,e,!0),e+4};p.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ut(this,t,e,!1),e+4};p.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*n-1);L(this,t,e,n,o-1,-o)}var u=0,l=1,c=0;for(this[e]=t&255;++u<n&&(l*=256);)t<0&&c===0&&this[e+u-1]!==0&&(c=1),this[e+u]=(t/l>>0)-c&255;return e+n};p.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*n-1);L(this,t,e,n,o-1,-o)}var u=n-1,l=1,c=0;for(this[e+u]=t&255;--u>=0&&(l*=256);)t<0&&c===0&&this[e+u+1]!==0&&(c=1),this[e+u]=(t/l>>0)-c&255;return e+n};p.prototype.writeInt8=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,1,127,-128),p.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};p.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):st(this,t,e,!0),e+2};p.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):st(this,t,e,!1),e+2};p.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ut(this,t,e,!0),e+4};p.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),p.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ut(this,t,e,!1),e+4};p.prototype.writeFloatLE=function(t,e,n){return Lr(this,t,e,!0,n)};p.prototype.writeFloatBE=function(t,e,n){return Lr(this,t,e,!1,n)};p.prototype.writeDoubleLE=function(t,e,n){return Pr(this,t,e,!0,n)};p.prototype.writeDoubleBE=function(t,e,n){return Pr(this,t,e,!1,n)};p.prototype.copy=function(t,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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-n&&(i=t.length-e+n);var o=i-n,u;if(this===t&&n<e&&e<i)for(u=o-1;u>=0;--u)t[u+e]=this[u+n];else if(o<1e3||!p.TYPED_ARRAY_SUPPORT)for(u=0;u<o;++u)t[u+e]=this[u+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o};p.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var u;if(typeof t=="number")for(u=e;u<n;++u)this[u]=t;else{var l=q(t)?t:at(new p(t,i).toString()),c=l.length;for(u=0;u<n-e;++u)this[u+e]=l[u%c]}return this};xa=/[^+\/0-9A-Za-z-_]/g});var s=qt(()=>{"use strict";Br()});var ic={};cr(ic,{DynamicSnippetsGenerator:()=>Dt,EndpointSnippetGenerator:()=>je});module.exports=Ao(ic);a();s();a();s();a();s();a();s();function A(r){throw new Error("Unexpected value: "+JSON.stringify(r))}a();s();a();s();a();s();a();s();a();s();a();s();var Ca=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,lt=Ca;var Ia=typeof self=="object"&&self&&self.Object===Object&&self,Sa=lt||Ia||Function("return this")(),C=Sa;var Na=C.Symbol,_=Na;a();s();var Or=Object.prototype,La=Or.hasOwnProperty,Pa=Or.toString,qe=_?_.toStringTag:void 0;function Fa(r){var t=La.call(r,qe),e=r[qe];try{r[qe]=void 0;var n=!0}catch(o){}var i=Pa.call(r);return n&&(t?r[qe]=e:delete r[qe]),i}var Ur=Fa;a();s();var _a=Object.prototype,ka=_a.toString;function Ba(r){return ka.call(r)}var Mr=Ba;var Oa="[object Null]",Ua="[object Undefined]",Dr=_?_.toStringTag:void 0;function Ma(r){return r==null?r===void 0?Ua:Oa:Dr&&Dr in Object(r)?Ur(r):Mr(r)}var B=Ma;a();s();function Da(r){return r!=null&&typeof r=="object"}var O=Da;var $a="[object Symbol]";function ja(r){return typeof r=="symbol"||O(r)&&B(r)==$a}var $r=ja;a();s();a();s();function qa(r,t){for(var e=-1,n=r==null?0:r.length,i=Array(n);++e<n;)i[e]=t(r[e],e,r);return i}var jr=qa;a();s();var Wa=Array.isArray,K=Wa;var Va=1/0,qr=_?_.prototype:void 0,Wr=qr?qr.toString:void 0;function Vr(r){if(typeof r=="string")return r;if(K(r))return jr(r,Vr)+"";if($r(r))return Wr?Wr.call(r):"";var t=r+"";return t=="0"&&1/r==-Va?"-0":t}var Gr=Vr;a();s();function Ga(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}var ct=Ga;a();s();a();s();a();s();a();s();var za="[object AsyncFunction]",Ha="[object Function]",Ya="[object GeneratorFunction]",Ka="[object Proxy]";function Ja(r){if(!ct(r))return!1;var t=B(r);return t==Ha||t==Ya||t==za||t==Ka}var mt=Ja;a();s();a();s();var Za=C["__core-js_shared__"],dt=Za;var zr=(function(){var r=/[^.]+$/.exec(dt&&dt.keys&&dt.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function Qa(r){return!!zr&&zr in r}var Hr=Qa;a();s();var Xa=Function.prototype,es=Xa.toString;function ts(r){if(r!=null){try{return es.call(r)}catch(t){}try{return r+""}catch(t){}}return""}var J=ts;var rs=/[\\^$.*+?()[\]{}|]/g,ns=/^\[object .+?Constructor\]$/,is=Function.prototype,os=Object.prototype,as=is.toString,ss=os.hasOwnProperty,us=RegExp("^"+as.call(ss).replace(rs,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ps(r){if(!ct(r)||Hr(r))return!1;var t=mt(r)?us:ns;return t.test(J(r))}var Yr=ps;a();s();function fs(r,t){return r==null?void 0:r[t]}var Kr=fs;function ls(r,t){var e=Kr(r,t);return Yr(e)?e:void 0}var k=ls;var cs=k(C,"WeakMap"),ht=cs;a();s();function ms(){}var Jr=ms;a();s();a();s();a();s();function ds(r,t,e,n){for(var i=r.length,o=e+(n?1:-1);n?o--:++o<i;)if(t(r[o],o,r))return o;return-1}var Zr=ds;a();s();function hs(r){return r!==r}var Qr=hs;a();s();function ys(r,t,e){for(var n=e-1,i=r.length;++n<i;)if(r[n]===t)return n;return-1}var Xr=ys;function xs(r,t,e){return t===t?Xr(r,t,e):Zr(r,Qr,e)}var en=xs;function gs(r,t){var e=r==null?0:r.length;return!!e&&en(r,t,0)>-1}var tn=gs;a();s();var ws=9007199254740991,vs=/^(?:0|[1-9]\d*)$/;function Ts(r,t){var e=typeof r;return t=t==null?ws:t,!!t&&(e=="number"||e!="symbol"&&vs.test(r))&&r>-1&&r%1==0&&r<t}var rn=Ts;a();s();function bs(r,t){return r===t||r!==r&&t!==t}var yt=bs;a();s();a();s();var As=9007199254740991;function Es(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=As}var xt=Es;function Rs(r){return r!=null&&xt(r.length)&&!mt(r)}var nn=Rs;a();s();var Cs=Object.prototype;function Is(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||Cs;return r===e}var on=Is;a();s();a();s();a();s();function Ss(r,t){for(var e=-1,n=Array(r);++e<r;)n[e]=t(e);return n}var an=Ss;a();s();a();s();var Ns="[object Arguments]";function Ls(r){return O(r)&&B(r)==Ns}var Ht=Ls;var sn=Object.prototype,Ps=sn.hasOwnProperty,Fs=sn.propertyIsEnumerable,_s=Ht((function(){return arguments})())?Ht:function(r){return O(r)&&Ps.call(r,"callee")&&!Fs.call(r,"callee")},un=_s;a();s();a();s();function ks(){return!1}var pn=ks;var cn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fn=cn&&typeof module=="object"&&module&&!module.nodeType&&module,Bs=fn&&fn.exports===cn,ln=Bs?C.Buffer:void 0,Os=ln?ln.isBuffer:void 0,Us=Os||pn,We=Us;a();s();a();s();var Ms="[object Arguments]",Ds="[object Array]",$s="[object Boolean]",js="[object Date]",qs="[object Error]",Ws="[object Function]",Vs="[object Map]",Gs="[object Number]",zs="[object Object]",Hs="[object RegExp]",Ys="[object Set]",Ks="[object String]",Js="[object WeakMap]",Zs="[object ArrayBuffer]",Qs="[object DataView]",Xs="[object Float32Array]",eu="[object Float64Array]",tu="[object Int8Array]",ru="[object Int16Array]",nu="[object Int32Array]",iu="[object Uint8Array]",ou="[object Uint8ClampedArray]",au="[object Uint16Array]",su="[object Uint32Array]",E={};E[Xs]=E[eu]=E[tu]=E[ru]=E[nu]=E[iu]=E[ou]=E[au]=E[su]=!0;E[Ms]=E[Ds]=E[Zs]=E[$s]=E[Qs]=E[js]=E[qs]=E[Ws]=E[Vs]=E[Gs]=E[zs]=E[Hs]=E[Ys]=E[Ks]=E[Js]=!1;function uu(r){return O(r)&&xt(r.length)&&!!E[B(r)]}var mn=uu;a();s();function pu(r){return function(t){return r(t)}}var dn=pu;a();s();var hn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ve=hn&&typeof module=="object"&&module&&!module.nodeType&&module,fu=Ve&&Ve.exports===hn,Yt=fu&&lt.process,lu=(function(){try{var r=Ve&&Ve.require&&Ve.require("util").types;return r||Yt&&Yt.binding&&Yt.binding("util")}catch(t){}})(),Kt=lu;var yn=Kt&&Kt.isTypedArray,cu=yn?dn(yn):mn,gt=cu;var mu=Object.prototype,du=mu.hasOwnProperty;function hu(r,t){var e=K(r),n=!e&&un(r),i=!e&&!n&&We(r),o=!e&&!n&&!i&&gt(r),u=e||n||i||o,l=u?an(r.length,String):[],c=l.length;for(var d in r)(t||du.call(r,d))&&!(u&&(d=="length"||i&&(d=="offset"||d=="parent")||o&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||rn(d,c)))&&l.push(d);return l}var xn=hu;a();s();a();s();a();s();function yu(r,t){return function(e){return r(t(e))}}var gn=yu;var xu=gn(Object.keys,Object),wn=xu;var gu=Object.prototype,wu=gu.hasOwnProperty;function vu(r){if(!on(r))return wn(r);var t=[];for(var e in Object(r))wu.call(r,e)&&e!="constructor"&&t.push(e);return t}var vn=vu;function Tu(r){return nn(r)?xn(r):vn(r)}var Tn=Tu;a();s();a();s();a();s();a();s();a();s();var bu=k(Object,"create"),Z=bu;function Au(){this.__data__=Z?Z(null):{},this.size=0}var bn=Au;a();s();function Eu(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}var An=Eu;a();s();var Ru="__lodash_hash_undefined__",Cu=Object.prototype,Iu=Cu.hasOwnProperty;function Su(r){var t=this.__data__;if(Z){var e=t[r];return e===Ru?void 0:e}return Iu.call(t,r)?t[r]:void 0}var En=Su;a();s();var Nu=Object.prototype,Lu=Nu.hasOwnProperty;function Pu(r){var t=this.__data__;return Z?t[r]!==void 0:Lu.call(t,r)}var Rn=Pu;a();s();var Fu="__lodash_hash_undefined__";function _u(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=Z&&t===void 0?Fu:t,this}var Cn=_u;function _e(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}_e.prototype.clear=bn;_e.prototype.delete=An;_e.prototype.get=En;_e.prototype.has=Rn;_e.prototype.set=Cn;var Jt=_e;a();s();a();s();function ku(){this.__data__=[],this.size=0}var In=ku;a();s();a();s();function Bu(r,t){for(var e=r.length;e--;)if(yt(r[e][0],t))return e;return-1}var ae=Bu;var Ou=Array.prototype,Uu=Ou.splice;function Mu(r){var t=this.__data__,e=ae(t,r);if(e<0)return!1;var n=t.length-1;return e==n?t.pop():Uu.call(t,e,1),--this.size,!0}var Sn=Mu;a();s();function Du(r){var t=this.__data__,e=ae(t,r);return e<0?void 0:t[e][1]}var Nn=Du;a();s();function $u(r){return ae(this.__data__,r)>-1}var Ln=$u;a();s();function ju(r,t){var e=this.__data__,n=ae(e,r);return n<0?(++this.size,e.push([r,t])):e[n][1]=t,this}var Pn=ju;function ke(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}ke.prototype.clear=In;ke.prototype.delete=Sn;ke.prototype.get=Nn;ke.prototype.has=Ln;ke.prototype.set=Pn;var se=ke;a();s();var qu=k(C,"Map"),ue=qu;function Wu(){this.size=0,this.__data__={hash:new Jt,map:new(ue||se),string:new Jt}}var Fn=Wu;a();s();a();s();a();s();function Vu(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}var _n=Vu;function Gu(r,t){var e=r.__data__;return _n(t)?e[typeof t=="string"?"string":"hash"]:e.map}var pe=Gu;function zu(r){var t=pe(this,r).delete(r);return this.size-=t?1:0,t}var kn=zu;a();s();function Hu(r){return pe(this,r).get(r)}var Bn=Hu;a();s();function Yu(r){return pe(this,r).has(r)}var On=Yu;a();s();function Ku(r,t){var e=pe(this,r),n=e.size;return e.set(r,t),this.size+=e.size==n?0:1,this}var Un=Ku;function Be(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}Be.prototype.clear=Fn;Be.prototype.delete=kn;Be.prototype.get=Bn;Be.prototype.has=On;Be.prototype.set=Un;var wt=Be;a();s();function Ju(r){return r==null?"":Gr(r)}var fe=Ju;a();s();function Zu(r,t){for(var e=-1,n=t.length,i=r.length;++e<n;)r[i+e]=t[e];return r}var Mn=Zu;a();s();a();s();a();s();a();s();a();s();a();s();function Qu(r,t,e){var n=-1,i=r.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=r[n+t];return o}var Dn=Qu;function Xu(r,t,e){var n=r.length;return e=e===void 0?n:e,!t&&e>=n?r:Dn(r,t,e)}var $n=Xu;a();s();var ep="\\ud800-\\udfff",tp="\\u0300-\\u036f",rp="\\ufe20-\\ufe2f",np="\\u20d0-\\u20ff",ip=tp+rp+np,op="\\ufe0e\\ufe0f",ap="\\u200d",sp=RegExp("["+ap+ep+ip+op+"]");function up(r){return sp.test(r)}var vt=up;a();s();a();s();function pp(r){return r.split("")}var jn=pp;a();s();var qn="\\ud800-\\udfff",fp="\\u0300-\\u036f",lp="\\ufe20-\\ufe2f",cp="\\u20d0-\\u20ff",mp=fp+lp+cp,dp="\\ufe0e\\ufe0f",hp="["+qn+"]",Zt="["+mp+"]",Qt="\\ud83c[\\udffb-\\udfff]",yp="(?:"+Zt+"|"+Qt+")",Wn="[^"+qn+"]",Vn="(?:\\ud83c[\\udde6-\\uddff]){2}",Gn="[\\ud800-\\udbff][\\udc00-\\udfff]",xp="\\u200d",zn=yp+"?",Hn="["+dp+"]?",gp="(?:"+xp+"(?:"+[Wn,Vn,Gn].join("|")+")"+Hn+zn+")*",wp=Hn+zn+gp,vp="(?:"+[Wn+Zt+"?",Zt,Vn,Gn,hp].join("|")+")",Tp=RegExp(Qt+"(?="+Qt+")|"+vp+wp,"g");function bp(r){return r.match(Tp)||[]}var Yn=bp;function Ap(r){return vt(r)?Yn(r):jn(r)}var Kn=Ap;function Ep(r){return function(t){t=fe(t);var e=vt(t)?Kn(t):void 0,n=e?e[0]:t.charAt(0),i=e?$n(e,1).join(""):t.slice(1);return n[r]()+i}}var Jn=Ep;var Rp=Jn("toUpperCase"),Oe=Rp;function Cp(r){return Oe(fe(r).toLowerCase())}var Zn=Cp;a();s();a();s();function Ip(r,t,e,n){var i=-1,o=r==null?0:r.length;for(n&&o&&(e=r[++i]);++i<o;)e=t(e,r[i],i,r);return e}var Qn=Ip;a();s();a();s();a();s();function Sp(r){return function(t){return r==null?void 0:r[t]}}var Xn=Sp;var Np={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Lp=Xn(Np),ei=Lp;var Pp=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Fp="\\u0300-\\u036f",_p="\\ufe20-\\ufe2f",kp="\\u20d0-\\u20ff",Bp=Fp+_p+kp,Op="["+Bp+"]",Up=RegExp(Op,"g");function Mp(r){return r=fe(r),r&&r.replace(Pp,ei).replace(Up,"")}var ti=Mp;a();s();a();s();var Dp=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function $p(r){return r.match(Dp)||[]}var ri=$p;a();s();var jp=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function qp(r){return jp.test(r)}var ni=qp;a();s();var ui="\\ud800-\\udfff",Wp="\\u0300-\\u036f",Vp="\\ufe20-\\ufe2f",Gp="\\u20d0-\\u20ff",zp=Wp+Vp+Gp,pi="\\u2700-\\u27bf",fi="a-z\\xdf-\\xf6\\xf8-\\xff",Hp="\\xac\\xb1\\xd7\\xf7",Yp="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Kp="\\u2000-\\u206f",Jp=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",li="A-Z\\xc0-\\xd6\\xd8-\\xde",Zp="\\ufe0e\\ufe0f",ci=Hp+Yp+Kp+Jp,mi="['\u2019]",ii="["+ci+"]",Qp="["+zp+"]",di="\\d+",Xp="["+pi+"]",hi="["+fi+"]",yi="[^"+ui+ci+di+pi+fi+li+"]",ef="\\ud83c[\\udffb-\\udfff]",tf="(?:"+Qp+"|"+ef+")",rf="[^"+ui+"]",xi="(?:\\ud83c[\\udde6-\\uddff]){2}",gi="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+li+"]",nf="\\u200d",oi="(?:"+hi+"|"+yi+")",of="(?:"+Ue+"|"+yi+")",ai="(?:"+mi+"(?:d|ll|m|re|s|t|ve))?",si="(?:"+mi+"(?:D|LL|M|RE|S|T|VE))?",wi=tf+"?",vi="["+Zp+"]?",af="(?:"+nf+"(?:"+[rf,xi,gi].join("|")+")"+vi+wi+")*",sf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",uf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",pf=vi+wi+af,ff="(?:"+[Xp,xi,gi].join("|")+")"+pf,lf=RegExp([Ue+"?"+hi+"+"+ai+"(?="+[ii,Ue,"$"].join("|")+")",of+"+"+si+"(?="+[ii,Ue+oi,"$"].join("|")+")",Ue+"?"+oi+"+"+ai,Ue+"+"+si,uf,sf,di,ff].join("|"),"g");function cf(r){return r.match(lf)||[]}var Ti=cf;function mf(r,t,e){return r=fe(r),t=e?void 0:t,t===void 0?ni(r)?Ti(r):ri(r):r.match(t)||[]}var bi=mf;var df="['\u2019]",hf=RegExp(df,"g");function yf(r){return function(t){return Qn(bi(ti(t).replace(hf,"")),r,"")}}var Ai=yf;var xf=Ai(function(r,t,e){return t=t.toLowerCase(),r+(e?Zn(t):t)}),Tt=xf;a();s();a();s();function gf(){this.__data__=new se,this.size=0}var Ei=gf;a();s();function wf(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}var Ri=wf;a();s();function vf(r){return this.__data__.get(r)}var Ci=vf;a();s();function Tf(r){return this.__data__.has(r)}var Ii=Tf;a();s();var bf=200;function Af(r,t){var e=this.__data__;if(e instanceof se){var n=e.__data__;if(!ue||n.length<bf-1)return n.push([r,t]),this.size=++e.size,this;e=this.__data__=new wt(n)}return e.set(r,t),this.size=e.size,this}var Si=Af;function Me(r){var t=this.__data__=new se(r);this.size=t.size}Me.prototype.clear=Ei;Me.prototype.delete=Ri;Me.prototype.get=Ci;Me.prototype.has=Ii;Me.prototype.set=Si;var bt=Me;a();s();a();s();function Ef(r,t){for(var e=-1,n=r==null?0:r.length,i=0,o=[];++e<n;){var u=r[e];t(u,e,r)&&(o[i++]=u)}return o}var Ni=Ef;a();s();function Rf(){return[]}var Li=Rf;var Cf=Object.prototype,If=Cf.propertyIsEnumerable,Pi=Object.getOwnPropertySymbols,Sf=Pi?function(r){return r==null?[]:(r=Object(r),Ni(Pi(r),function(t){return If.call(r,t)}))}:Li,Fi=Sf;a();s();a();s();function Nf(r,t,e){var n=t(r);return K(r)?n:Mn(n,e(r))}var _i=Nf;function Lf(r){return _i(r,Tn,Fi)}var Xt=Lf;a();s();a();s();var Pf=k(C,"DataView"),At=Pf;a();s();var Ff=k(C,"Promise"),Et=Ff;a();s();var _f=k(C,"Set"),le=_f;var ki="[object Map]",kf="[object Object]",Bi="[object Promise]",Oi="[object Set]",Ui="[object WeakMap]",Mi="[object DataView]",Bf=J(At),Of=J(ue),Uf=J(Et),Mf=J(le),Df=J(ht),ve=B;(At&&ve(new At(new ArrayBuffer(1)))!=Mi||ue&&ve(new ue)!=ki||Et&&ve(Et.resolve())!=Bi||le&&ve(new le)!=Oi||ht&&ve(new ht)!=Ui)&&(ve=function(r){var t=B(r),e=t==kf?r.constructor:void 0,n=e?J(e):"";if(n)switch(n){case Bf:return Mi;case Of:return ki;case Uf:return Bi;case Mf:return Oi;case Df:return Ui}return t});var er=ve;a();s();var $f=C.Uint8Array,tr=$f;a();s();a();s();a();s();a();s();a();s();var jf="__lodash_hash_undefined__";function qf(r){return this.__data__.set(r,jf),this}var Di=qf;a();s();function Wf(r){return this.__data__.has(r)}var $i=Wf;function Rt(r){var t=-1,e=r==null?0:r.length;for(this.__data__=new wt;++t<e;)this.add(r[t])}Rt.prototype.add=Rt.prototype.push=Di;Rt.prototype.has=$i;var Ct=Rt;a();s();function Vf(r,t){for(var e=-1,n=r==null?0:r.length;++e<n;)if(t(r[e],e,r))return!0;return!1}var ji=Vf;a();s();function Gf(r,t){return r.has(t)}var It=Gf;var zf=1,Hf=2;function Yf(r,t,e,n,i,o){var u=e&zf,l=r.length,c=t.length;if(l!=c&&!(u&&c>l))return!1;var d=o.get(r),y=o.get(t);if(d&&y)return d==t&&y==r;var x=-1,g=!0,T=e&Hf?new Ct:void 0;for(o.set(r,t),o.set(t,r);++x<l;){var b=r[x],S=t[x];if(n)var $=u?n(S,b,x,t,r,o):n(b,S,x,r,t,o);if($!==void 0){if($)continue;g=!1;break}if(T){if(!ji(t,function(he,ye){if(!It(T,ye)&&(b===he||i(b,he,e,n,o)))return T.push(ye)})){g=!1;break}}else if(!(b===S||i(b,S,e,n,o))){g=!1;break}}return o.delete(r),o.delete(t),g}var St=Yf;a();s();a();s();function Kf(r){var t=-1,e=Array(r.size);return r.forEach(function(n,i){e[++t]=[i,n]}),e}var qi=Kf;a();s();function Jf(r){var t=-1,e=Array(r.size);return r.forEach(function(n){e[++t]=n}),e}var De=Jf;var Zf=1,Qf=2,Xf="[object Boolean]",el="[object Date]",tl="[object Error]",rl="[object Map]",nl="[object Number]",il="[object RegExp]",ol="[object Set]",al="[object String]",sl="[object Symbol]",ul="[object ArrayBuffer]",pl="[object DataView]",Wi=_?_.prototype:void 0,rr=Wi?Wi.valueOf:void 0;function fl(r,t,e,n,i,o,u){switch(e){case pl:if(r.byteLength!=t.byteLength||r.byteOffset!=t.byteOffset)return!1;r=r.buffer,t=t.buffer;case ul:return!(r.byteLength!=t.byteLength||!o(new tr(r),new tr(t)));case Xf:case el:case nl:return yt(+r,+t);case tl:return r.name==t.name&&r.message==t.message;case il:case al:return r==t+"";case rl:var l=qi;case ol:var c=n&Zf;if(l||(l=De),r.size!=t.size&&!c)return!1;var d=u.get(r);if(d)return d==t;n|=Qf,u.set(r,t);var y=St(l(r),l(t),n,i,o,u);return u.delete(r),y;case sl:if(rr)return rr.call(r)==rr.call(t)}return!1}var Vi=fl;a();s();var ll=1,cl=Object.prototype,ml=cl.hasOwnProperty;function dl(r,t,e,n,i,o){var u=e&ll,l=Xt(r),c=l.length,d=Xt(t),y=d.length;if(c!=y&&!u)return!1;for(var x=c;x--;){var g=l[x];if(!(u?g in t:ml.call(t,g)))return!1}var T=o.get(r),b=o.get(t);if(T&&b)return T==t&&b==r;var S=!0;o.set(r,t),o.set(t,r);for(var $=u;++x<c;){g=l[x];var he=r[g],ye=t[g];if(n)var ur=u?n(ye,he,g,t,r,o):n(he,ye,g,r,t,o);if(!(ur===void 0?he===ye||i(he,ye,e,n,o):ur)){S=!1;break}$||($=g=="constructor")}if(S&&!$){var et=r.constructor,tt=t.constructor;et!=tt&&"constructor"in r&&"constructor"in t&&!(typeof et=="function"&&et instanceof et&&typeof tt=="function"&&tt instanceof tt)&&(S=!1)}return o.delete(r),o.delete(t),S}var Gi=dl;var hl=1,zi="[object Arguments]",Hi="[object Array]",Nt="[object Object]",yl=Object.prototype,Yi=yl.hasOwnProperty;function xl(r,t,e,n,i,o){var u=K(r),l=K(t),c=u?Hi:er(r),d=l?Hi:er(t);c=c==zi?Nt:c,d=d==zi?Nt:d;var y=c==Nt,x=d==Nt,g=c==d;if(g&&We(r)){if(!We(t))return!1;u=!0,y=!1}if(g&&!y)return o||(o=new bt),u||gt(r)?St(r,t,e,n,i,o):Vi(r,t,c,e,n,i,o);if(!(e&hl)){var T=y&&Yi.call(r,"__wrapped__"),b=x&&Yi.call(t,"__wrapped__");if(T||b){var S=T?r.value():r,$=b?t.value():t;return o||(o=new bt),i(S,$,e,n,o)}}return g?(o||(o=new bt),Gi(r,t,e,n,i,o)):!1}var Ki=xl;function Ji(r,t,e,n,i){return r===t?!0:r==null||t==null||!O(r)&&!O(t)?r!==r&&t!==t:Ki(r,t,e,n,Ji,i)}var Zi=Ji;a();s();function gl(r,t,e){for(var n=-1,i=r==null?0:r.length;++n<i;)if(e(t,r[n]))return!0;return!1}var Qi=gl;a();s();function wl(r,t){return Zi(r,t)}var Lt=wl;a();s();a();s();var vl=1/0,Tl=le&&1/De(new le([,-0]))[1]==vl?function(r){return new le(r)}:Jr,Xi=Tl;var bl=200;function Al(r,t,e){var n=-1,i=tn,o=r.length,u=!0,l=[],c=l;if(e)u=!1,i=Qi;else if(o>=bl){var d=t?null:Xi(r);if(d)return De(d);u=!1,i=It,c=new Ct}else c=t?[]:l;e:for(;++n<o;){var y=r[n],x=t?t(y):y;if(y=e||y!==0?y:0,u&&x===x){for(var g=c.length;g--;)if(c[g]===x)continue e;t&&c.push(x),l.push(y)}else i(c,x,e)||(c!==l&&c.push(x),l.push(y))}return l}var eo=Al;a();s();function El(r,t){return t=typeof t=="function"?t:void 0,r&&r.length?eo(r,void 0,t):[]}var Pt=El;a();s();function Ge(r){return Object.keys(r)}a();s();a();s();a();s();var to,ro,ze=(ro=(to=f.env.FERN_STACK_TRACK)==null?void 0:to.toLowerCase())!=null?ro:"",W=ze!==""&&ze!=="0"&&ze!=="false",nr=["single","multiline","box"].includes(ze)?ze:"single";W&&(Error.stackTraceLimit=50);var Rl=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Cl=new Set(["stacktrace"]);function _t({maxFrames:r=50,skip:t=0,filterPaths:e=[],filterFunctions:n=[],stopOn:i=[],filterNode:o=!0,filterJs:u=!0,formatFilename:l=c=>c}={}){var d;if(!W)return[];n=[...n,...Rl],e=[...e,...Cl],i=[...i,"runInteractiveTask"];let c=!1;return((d=new Error().stack)!=null?d:"").split(`
2
+ `).map(y=>{let x=y.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(x&&x.length===5){let[,g,T,b,S]=x;if(!g||!T||!b||!S)return;if(c||i.some($=>g==null?void 0:g.includes($))){c=!0;return}switch(g){case"Object.<anonymous>":g="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":g=`${g.substring(g.indexOf(".")+1)}()=> { ... }`;break}return{fn:g,path:l(T),position:`${b}:${S}`}}}).filter(y=>{var x,g;return y&&!n.some(T=>y.fn.includes(T))&&!(o&&((x=y.path)!=null&&x.startsWith("node:")))&&!(u&&((g=y.path)!=null&&g.endsWith(".js")))&&!e.some(T=>y.path.includes(T))}).slice(t,t+r)}var Ft=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:n=[],filterFunctions:i=[],stopOn:o=[],filterNode:u=!0,filterJs:l=!0,multiline:c=!1,formatFilename:d=y=>y}={}){m(this,"maxFrames");m(this,"skip");m(this,"filterPaths");m(this,"filterFunctions");m(this,"stopOn");m(this,"filterNode");m(this,"filterJs");m(this,"multiline");m(this,"formatFilename");m(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=n,this.filterFunctions=i,this.stopOn=o,this.filterNode=u,this.filterJs=l,this.multiline=c,this.formatFilename=d}tag(t){let e=this.tracking.get(t)||new Set;_t({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(n=>e.add(n)),this.tracking.set(t,e)}trace(t){if(!W)return"";let e=this.tracking.get(t);return e?[...e].map(n=>`${this.multiline?`
3
+ `:""}${n.fn} - ${n.path}:${n.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},Q;function no({maxFrames:r=50,skip:t=0,filterPaths:e=[],filterFunctions:n=[],stopOn:i=[],filterNode:o=!0,filterJs:u=!0,multiline:l=!1,formatFilename:c=d=>d}={}){W&&(Q!=null||(Q=new Ft({maxFrames:r,skip:t,filterPaths:e,filterFunctions:n,stopOn:i,filterNode:o,filterJs:u,multiline:l,formatFilename:c})))}function io(r){Q==null||Q.tag(r)}function ir(r){var t;return(t=Q==null?void 0:Q.frames(r))!=null?t:[]}var X=class{constructor(){io(this)}};a();s();a();s();a();s();var U=class extends X{constructor(e){super();m(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var Il=4;no({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var He=class{constructor(){m(this,"lineBuffer",[]);m(this,"indentLevel",0);m(this,"hasWrittenAnything",!1);m(this,"lastCharacterIsSemicolon",!1);m(this,"lastCharacterIsNewline",!1);m(this,"nodeStackFrames",[])}get buffer(){return W&&this.nodeStackFrames.length>0&&this.writeInternal(`
4
4
  `),this.lineBuffer.join(`
5
5
  `)+(this.lastCharacterIsNewline?`
6
6
  `:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let n=e.length>0&&e.endsWith(`
7
7
  `),i=n?e.substring(0,e.length-1):e,o=this.getIndentString(),u=i.replaceAll(`
8
8
  `,`
9
9
  ${o}`);this.isAtStartOfLine()&&(u=o+u),n&&(u+=`
10
- `),this.writeInternal(u)}else this.writeNode(e)}writeStatement(...t){this.write(...t),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){q&&this.nodeStackFrames.push(...ir(t)),t.write(this),q&&nr!=="single"&&this.writeInternal(`
11
- `)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){this.writeNode(t),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new O(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new O(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new O(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new O(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new O(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(...t){this.write(...t.length===0?[""]:t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
10
+ `),this.writeInternal(u)}else this.writeNode(e)}writeStatement(...t){this.write(...t),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){W&&this.nodeStackFrames.push(...ir(t)),t.write(this),W&&nr!=="single"&&this.writeInternal(`
11
+ `)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){this.writeNode(t),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new U(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new U(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new U(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new U(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new U(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(...t){this.write(...t.length===0?[""]:t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
12
12
  `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
13
13
  `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:n}){if(t.length>0){let i=t[0];i!=null&&n(i);for(let o=1;o<t.length;o++){this.write(e);let u=t[o];u!=null&&n(u)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
14
14
  `),this.lastCharacterIsSemicolon=t.endsWith(";");let n=t.split(`
15
- `),i=q&&!this.shouldSkipTracking(n)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${n.shift()||""}`),this.lastCharacterIsNewline&&n.pop(),this.lineBuffer.push(...n),i&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(n=>`${e?`(${e}) `:""} ${n.fn} - ${n.path} : ${n.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(_t({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,nr){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Il}};a();s();function or(r){return(r==null?void 0:r.name)!=null&&(r==null?void 0:r.assignment)!=null}a();s();var Ye=class extends X{constructor({condition:e,true_:n,false_:i}){super();c(this,"condition");c(this,"true_");c(this,"false_");this.condition=e,this.true_=n,this.false_=i}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};a();s();a();s();a();s();var Ke=class{constructor(){c(this,"reporter");c(this,"snippet");c(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){var e;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(e=this.err)!=null?e:new Error(`Failed to generate snippet for endpoint "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){var n,i;return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>((i=(n=this.snippet)==null?void 0:n.length)!=null?i:0)}};var Je=class{constructor(t){c(this,"context");this.context=t}async generate(t,e={}){let n=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i=new Ke;for(let o of n){let u=this.context.clone(),l=this.createSnippetGenerator(u);try{let m=await l.generateSnippet({endpoint:o,request:t,options:e});if(u.errors.empty())return{snippet:m,errors:void 0};i.update({context:u,snippet:m})}catch(m){i.err==null&&(i.err=m)}}return i.getResponseOrThrow({endpoint:t.endpoint})}async generateSnippetAst(t,e={}){let n=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i;for(let o of n){let u=this.context.clone(),l=this.createSnippetGenerator(u);try{return await l.generateSnippetAst({endpoint:o,request:t,options:e})}catch(m){i=m}}throw i!=null?i:new Error(`Failed to generate snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateSync(t,e={}){let n=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i=new Ke;for(let o of n){let u=this.context.clone(),l=this.createSnippetGenerator(u);try{let m=l.generateSnippetSync({endpoint:o,request:t,options:e});if(u.errors.empty())return{snippet:m,errors:void 0};i.update({context:u,snippet:m})}catch(m){i.err==null&&(i.err=m)}}return i.getResponseOrThrow({endpoint:t.endpoint})}};a();s();a();s();a();s();var Ze=class{constructor(){c(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let n=t.match(this.REFERENCE_REGEX);if(!(n==null||n[1]==null||n[2]==null))return{method:n[1],path:n[2]}}};a();s();var v={Critical:"CRITICAL",Warning:"WARNING"},Qe=class r{constructor(){c(this,"errors");c(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(Le(Se({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new r;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let n of t){if(typeof n=="string"){e.push(n);continue}e[e.length-1]+=`[${n.index}]`}return e}};var Xe=class{constructor({ir:t,config:e,options:n={}}){c(this,"config");c(this,"options");c(this,"errors");c(this,"_ir");c(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=n,this.errors=new Qe,this.httpEndpointReferenceParser=new Ze}associateQueryParametersByWireValue({parameters:t,values:e}){let n=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let u=t.find(m=>m.name.wireValue===i);if(u==null)throw this.newParameterNotRecognizedError(i);let l=this.isListTypeReference(u.typeReference)&&!Array.isArray(o)?[o]:o;n.push({name:u.name,typeReference:u.typeReference,value:l})}finally{this.errors.unscope()}}return n}associateByWireValueOrDefault({parameters:t,values:e}){let n=[];for(let i of t){this.errors.scope(i.name.wireValue);try{let o=e[i.name.wireValue];if(o==null)if(i.typeReference.type==="primitive"&&i.typeReference.value==="STRING")o=`<${i.name.wireValue}>`;else{this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i.name.wireValue).message});continue}n.push({name:i.name,typeReference:i.typeReference,value:o})}finally{this.errors.unscope()}}return n}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:n}){let i=[];for(let[o,u]of Object.entries(e)){this.errors.scope(o);try{let l=t.find(m=>m.name.wireValue===o);if(l==null){if(n)continue;this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:l.name,typeReference:l.typeReference,value:u})}finally{this.errors.unscope()}}return i}getExampleObjectProperties({parameters:t,snippetObject:e}){let n=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},i=[];for(let o of t){let u=n[o.name.wireValue];u==null?o.typeReference.type==="nullable"&&i.push({name:o.name,typeReference:o.typeReference,value:null}):i.push({name:o.name,typeReference:o.typeReference,value:u})}return i}getSingleFileValue({property:t,record:e}){let n=e[t.wireValue];if(n!=null){if(typeof n!="string"){this.errors.add({severity:v.Critical,message:`Expected file value to be a string, got ${typeof n}`});return}return n}}getFileArrayValues({property:t,record:e}){let n=e[t.wireValue];if(n==null)return;if(!Array.isArray(n)){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof n}`});return}let i=[];for(let o of n){if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}i.push(o)}return i}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:v.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:v.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let n=this.getRecord(e);if(n==null)return;let i=t.discriminant.wireValue,o=n[i];if(o==null){this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let u=t.types[o];if(u==null){this.errors.add({severity:v.Critical,message:`No type found for discriminant value "${o}"`});return}let d=n,{[i]:l}=d,m=lr(d,[fr(i)]);return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:m}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let n of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:n,parsedEndpoint:t})&&e.push(n);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:n}){var i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:n}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var n,i;return e&&((i=(n=t.metadata)==null?void 0:n.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:A(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let n=e.environments.find(i=>i.id===t);return n==null?void 0:n.name}case"multipleBaseUrls":{let n=e.environments.find(i=>i.id===t);return n==null?void 0:n.name}default:A(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let n=e.environments[0];if(n==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(Ge(n.urls));for(let o of Ge(t))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:v.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${Ge(n.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:A(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:A(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:A(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};a();s();var V={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};a();s();a();s();a();s();var oo="self",ao="static";a();s();var so=new Set(["abstract","and","array","as","break","callable","case","catch","class","clone","const","continue","declare","default","die","do","echo","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","eval","exit","extends","final","finally","fn","for","foreach","function","global","goto","if","implements","include","include_once","instanceof","insteadof","interface","isset","list","match","namespace","new","or","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","unset","use","var","while","xor","yield","yield_from","__halt_compiler"]);var h={};cr(h,{Access:()=>ce,Array:()=>Te,AstNode:()=>w,Attribute:()=>be,Class:()=>ee,ClassInstantiation:()=>z,ClassReference:()=>I,CodeBlock:()=>S,DataClass:()=>Ae,Enum:()=>Ee,Field:()=>Re,Map:()=>Ce,Method:()=>ne,MethodInvocation:()=>re,Parameter:()=>te,Trait:()=>Ie,Type:()=>D,TypeLiteral:()=>M,Writer:()=>G,array:()=>Bl,assignVariable:()=>Kl,attribute:()=>Ul,classReference:()=>Dl,class_:()=>Ol,codeblock:()=>Ne,dataClass:()=>$l,enum_:()=>jl,escapePhpString:()=>ar,field:()=>Wl,instantiateClass:()=>ho,invokeMethod:()=>ql,map:()=>Gl,mergeArrays:()=>Ql,method:()=>zl,parameter:()=>Hl,string:()=>Zl,ternary:()=>Yl,this_:()=>Xl,throwException:()=>Vl,trait:()=>Ml,variable:()=>Jl});a();s();a();s();a();s();var ce={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};a();s();a();s();a();s();function uo(r){return{namespace:r.substring(0,r.lastIndexOf("\\")),name:r.substring(r.lastIndexOf("\\")+1)}}var G=class extends He{constructor({namespace:e,rootNamespace:n,customConfig:i}){super();c(this,"namespace");c(this,"rootNamespace");c(this,"customConfig");c(this,"references",{});this.namespace=e,this.rootNamespace=n,this.customConfig=i}addReference(e){var u,l;if(e.namespace==null)return;if(Object.keys(this.references).filter(m=>{let d=uo(m);return d.namespace!==e.namespace&&d.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===""?e.name:`${e.namespace}\\${e.name}`;((l=(u=this.references)[i])!=null?l:u[i]=[]).push(e)}toString(e=!1){if(e)return this.buffer;let n=`namespace ${this.namespace};`,i=this.stringifyImports();return i.length>0?`${n}
15
+ `),i=W&&!this.shouldSkipTracking(n)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${n.shift()||""}`),this.lastCharacterIsNewline&&n.pop(),this.lineBuffer.push(...n),i&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(n=>`${e?`(${e}) `:""} ${n.fn} - ${n.path} : ${n.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(_t({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,nr){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Il}};a();s();function or(r){return(r==null?void 0:r.name)!=null&&(r==null?void 0:r.assignment)!=null}a();s();var Ye=class extends X{constructor({condition:e,true_:n,false_:i}){super();m(this,"condition");m(this,"true_");m(this,"false_");this.condition=e,this.true_=n,this.false_=i}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};a();s();a();s();a();s();var Ke=class{constructor(){m(this,"reporter");m(this,"snippet");m(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){var e;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(e=this.err)!=null?e:new Error(`Failed to generate snippet for endpoint "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){var n,i;return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>((i=(n=this.snippet)==null?void 0:n.length)!=null?i:0)}};var Je=class{constructor(t){m(this,"context");this.context=t}async generate(t,e={}){let n=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i=new Ke;for(let o of n){let u=this.context.clone(),l=this.createSnippetGenerator(u);try{let c=await l.generateSnippet({endpoint:o,request:t,options:e});if(u.errors.empty())return{snippet:c,errors:void 0};i.update({context:u,snippet:c})}catch(c){i.err==null&&(i.err=c)}}return i.getResponseOrThrow({endpoint:t.endpoint})}async generateSnippetAst(t,e={}){let n=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i;for(let o of n){let u=this.context.clone(),l=this.createSnippetGenerator(u);try{return await l.generateSnippetAst({endpoint:o,request:t,options:e})}catch(c){i=c}}throw i!=null?i:new Error(`Failed to generate snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateSync(t,e={}){let n=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i=new Ke;for(let o of n){let u=this.context.clone(),l=this.createSnippetGenerator(u);try{let c=l.generateSnippetSync({endpoint:o,request:t,options:e});if(u.errors.empty())return{snippet:c,errors:void 0};i.update({context:u,snippet:c})}catch(c){i.err==null&&(i.err=c)}}return i.getResponseOrThrow({endpoint:t.endpoint})}};a();s();a();s();a();s();var Ze=class{constructor(){m(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let n=t.match(this.REFERENCE_REGEX);if(!(n==null||n[1]==null||n[2]==null))return{method:n[1],path:n[2]}}};a();s();var v={Critical:"CRITICAL",Warning:"WARNING"},Qe=class r{constructor(){m(this,"errors");m(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(Le(Ne({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new r;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let n of t){if(typeof n=="string"){e.push(n);continue}e[e.length-1]+=`[${n.index}]`}return e}};var Xe=class{constructor({ir:t,config:e,options:n={}}){m(this,"config");m(this,"options");m(this,"errors");m(this,"_ir");m(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=n,this.errors=new Qe,this.httpEndpointReferenceParser=new Ze}associateQueryParametersByWireValue({parameters:t,values:e}){let n=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let u=t.find(c=>c.name.wireValue===i);if(u==null)throw this.newParameterNotRecognizedError(i);let l=this.isListTypeReference(u.typeReference)&&!Array.isArray(o)?[o]:o;n.push({name:u.name,typeReference:u.typeReference,value:l})}finally{this.errors.unscope()}}return n}associateByWireValueOrDefault({parameters:t,values:e}){let n=[];for(let i of t){this.errors.scope(i.name.wireValue);try{let o=e[i.name.wireValue];if(o==null)if(i.typeReference.type==="primitive"&&i.typeReference.value==="STRING")o=`<${i.name.wireValue}>`;else{this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i.name.wireValue).message});continue}n.push({name:i.name,typeReference:i.typeReference,value:o})}finally{this.errors.unscope()}}return n}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:n}){let i=[];for(let[o,u]of Object.entries(e)){this.errors.scope(o);try{let l=t.find(c=>c.name.wireValue===o);if(l==null){if(n)continue;this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:l.name,typeReference:l.typeReference,value:u})}finally{this.errors.unscope()}}return i}getExampleObjectProperties({parameters:t,snippetObject:e}){let n=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},i=[];for(let o of t){let u=n[o.name.wireValue];u==null?o.typeReference.type==="nullable"&&i.push({name:o.name,typeReference:o.typeReference,value:null}):i.push({name:o.name,typeReference:o.typeReference,value:u})}return i}getSingleFileValue({property:t,record:e}){let n=e[t.wireValue];if(n!=null){if(typeof n!="string"){this.errors.add({severity:v.Critical,message:`Expected file value to be a string, got ${typeof n}`});return}return n}}getFileArrayValues({property:t,record:e}){let n=e[t.wireValue];if(n==null)return;if(!Array.isArray(n)){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof n}`});return}let i=[];for(let o of n){if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}i.push(o)}return i}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:v.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:v.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let n=this.getRecord(e);if(n==null)return;let i=t.discriminant.wireValue,o=n[i];if(o==null){this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let u=t.types[o];if(u==null){this.errors.add({severity:v.Critical,message:`No type found for discriminant value "${o}"`});return}let d=n,{[i]:l}=d,c=lr(d,[fr(i)]);return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:c}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let n of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:n,parsedEndpoint:t})&&e.push(n);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:n}){var i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:n}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var n,i;return e&&((i=(n=t.metadata)==null?void 0:n.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:A(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let n=e.environments.find(i=>i.id===t);return n==null?void 0:n.name}case"multipleBaseUrls":{let n=e.environments.find(i=>i.id===t);return n==null?void 0:n.name}default:A(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let n=e.environments[0];if(n==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(Ge(n.urls));for(let o of Ge(t))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:v.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${Ge(n.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:A(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:A(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:A(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};a();s();var V={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};a();s();a();s();a();s();var oo="self",ao="static";a();s();var so=new Set(["abstract","and","array","as","break","callable","case","catch","class","clone","const","continue","declare","default","die","do","echo","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","eval","exit","extends","final","finally","fn","for","foreach","function","global","goto","if","implements","include","include_once","instanceof","insteadof","interface","isset","list","match","namespace","new","or","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","unset","use","var","while","xor","yield","yield_from","__halt_compiler"]);var h={};cr(h,{Access:()=>ce,Array:()=>Te,AstNode:()=>w,Attribute:()=>be,Class:()=>ee,ClassInstantiation:()=>z,ClassReference:()=>I,CodeBlock:()=>N,DataClass:()=>Ae,Enum:()=>Ee,Field:()=>Re,Map:()=>Ce,Method:()=>ne,MethodInvocation:()=>re,Parameter:()=>te,Trait:()=>Ie,Type:()=>D,TypeLiteral:()=>M,Writer:()=>G,array:()=>Bl,assignVariable:()=>Kl,attribute:()=>Ol,classReference:()=>Dl,class_:()=>Ul,codeblock:()=>Se,dataClass:()=>$l,enum_:()=>jl,escapePhpString:()=>ar,field:()=>ql,instantiateClass:()=>ho,invokeMethod:()=>Wl,map:()=>Gl,mergeArrays:()=>Ql,method:()=>zl,parameter:()=>Hl,string:()=>Zl,ternary:()=>Yl,this_:()=>Xl,throwException:()=>Vl,trait:()=>Ml,variable:()=>Jl});a();s();a();s();a();s();var ce={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};a();s();a();s();a();s();function uo(r){return{namespace:r.substring(0,r.lastIndexOf("\\")),name:r.substring(r.lastIndexOf("\\")+1)}}var G=class extends He{constructor({namespace:e,rootNamespace:n,customConfig:i}){super();m(this,"namespace");m(this,"rootNamespace");m(this,"customConfig");m(this,"references",{});this.namespace=e,this.rootNamespace=n,this.customConfig=i}addReference(e){var u,l;if(e.namespace==null)return;if(Object.keys(this.references).filter(c=>{let d=uo(c);return d.namespace!==e.namespace&&d.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===""?e.name:`${e.namespace}\\${e.name}`;((l=(u=this.references)[i])!=null?l:u[i]=[]).push(e)}toString(e=!1){if(e)return this.buffer;let n=`namespace ${this.namespace};`,i=this.stringifyImports();return i.length>0?`${n}
16
16
 
17
17
  ${i}
18
18
 
19
19
  ${this.buffer}`:n+`
20
20
 
21
21
  `+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(n=>uo(n).namespace!==this.namespace).map(n=>`use ${n};`).join(`
22
- `)}};var w=class extends X{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:n,customConfig:i,skipImports:o=!1}=t,u=new G({namespace:e,rootNamespace:n,customConfig:i});return this.write(u),u.toString(o)}async toStringAsync({namespace:t,rootNamespace:e,customConfig:n}){let i=new G({namespace:t,rootNamespace:e,customConfig:n});return this.write(i),i.toString()}};var Te=class extends w{constructor({entries:e}){super();c(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((n,i)=>{i>0&&e.write(", "),n.write(e)}),e.write("]")}};a();s();var be=class extends w{constructor(e){var n;super();c(this,"reference");c(this,"arguments");this.reference=e.reference,this.arguments=(n=e.arguments)!=null?n:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((n,i)=>{i>0&&e.write(","),typeof n=="string"?e.write(n):n.write(e)}),e.write(")"))}};a();s();a();s();var I=class extends w{constructor({name:e,namespace:n,generics:i}){super();c(this,"name");c(this,"namespace");c(this,"generics");c(this,"fullyQualified");this.name=e,this.namespace=n,this.generics=i,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let n=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${n}`)}};a();s();a();s();function me(r){return r.startsWith("$")?r:`$${r}`}var P=class extends w{constructor({docs:e}={}){super();c(this,"docs");c(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(Le(Se({},e),{name:e.name!=null?me(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
22
+ `)}};var w=class extends X{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:n,customConfig:i,skipImports:o=!1}=t,u=new G({namespace:e,rootNamespace:n,customConfig:i});return this.write(u),u.toString(o)}async toStringAsync({namespace:t,rootNamespace:e,customConfig:n}){let i=new G({namespace:t,rootNamespace:e,customConfig:n});return this.write(i),i.toString()}};var Te=class extends w{constructor({entries:e}){super();m(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((n,i)=>{i>0&&e.write(", "),n.write(e)}),e.write("]")}};a();s();var be=class extends w{constructor(e){var n;super();m(this,"reference");m(this,"arguments");this.reference=e.reference,this.arguments=(n=e.arguments)!=null?n:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((n,i)=>{i>0&&e.write(","),typeof n=="string"?e.write(n):n.write(e)}),e.write(")"))}};a();s();a();s();var I=class extends w{constructor({name:e,namespace:n,generics:i}){super();m(this,"name");m(this,"namespace");m(this,"generics");m(this,"fullyQualified");this.name=e,this.namespace=n,this.generics=i,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let n=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${n}`)}};a();s();a();s();function me(r){return r.startsWith("$")?r:`$${r}`}var P=class extends w{constructor({docs:e}={}){super();m(this,"docs");m(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(Le(Ne({},e),{name:e.name!=null?me(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
23
23
  `).forEach(n=>{e.writeLine(` * ${n}`)}),this.tags.length>0&&e.writeLine(" *"));for(let n of this.tags)this.writeTag({writer:e,tag:n});e.writeLine(" */")}writeTag({writer:e,tag:n}){let i=n.docs!=null?n.docs.split(`
24
- `):void 0;i!=null&&i.length>1&&(i.forEach(o=>{e.writeLine(` * ${o}`)}),e.writeLine(" *")),e.write(` * @${n.tagType} `),n.type.write(e,{comment:!0}),n.name!=null&&e.write(` ${n.name}`),i!=null&&i.length===1&&e.write(` ${i[0]}`),e.newLine()}};a();s();function de(r){return Nl(r,[ce.Public,ce.PublicReadonly,ce.Protected,ce.Private])}function Nl(r,t){return t.reduce((e,n)=>[...e,...r.filter(i=>i.access===n)],[])}var ee=class extends w{constructor({name:e,namespace:n,abstract:i,docs:o,parentClassReference:u,traits:l}){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=n,this.abstract=i!=null?i:!1,this.docs=o,this.parentClassReference=u,this.traits=l!=null?l:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addMethods(e){this.methods.push(...e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new I({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((n,i)=>{i>0&&e.write(","),e.writeNode(n)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:de(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:de(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new P({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:n}){var i;this.writeConstructorComment({writer:e,constructor:n}),n.access!=null&&e.write(`${n.access} `),e.write("function __construct("),e.indent(),n.parameters.forEach((o,u)=>{u===0&&e.newLine(),o.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(i=n.body)==null||i.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:n}){if(n.parameters.length===0)return;let i=new P;for(let o of n.parameters)i.addTag(o.getCommentTag());i.write(e)}writeFields({writer:e,fields:n}){n.filter(i=>!i.inherited).forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};a();s();a();s();function $e({writer:r,arguments_:t,multiline:e}){if(t.length===0){r.write("()");return}if(e){Sl({writer:r,arguments_:t});return}Ll({writer:r,arguments_:t})}function Sl({writer:r,arguments_:t}){r.writeLine("("),r.indent();for(let e of t)fo({writer:r,argument:e,writeCompact:!1}),r.writeLine(",");r.dedent(),r.write(")")}function Ll({writer:r,arguments_:t}){r.write("("),t.forEach((e,n)=>{n>0&&r.write(", "),fo({writer:r,argument:e,writeCompact:!0})}),r.write(")")}function fo({writer:r,argument:t,writeCompact:e}){or(t)?(t.docs&&(e?r.write(`/* ${t.docs} */ `):r.writeLine(`/* ${t.docs} */`)),r.write(`${t.name}: `),r.writeNodeOrString(t.assignment)):t.write(r)}var z=class extends w{constructor({classReference:e,arguments_:n,multiline:i}){super();c(this,"classReference");c(this,"arguments_");c(this,"multiline");this.classReference=e,this.arguments_=n,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),$e({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};a();s();var S=class extends w{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new O(this.arg).write(e)}};a();s();a();s();var te=class extends w{constructor({name:e,type:n,docs:i,initializer:o,access:u,readonly_:l}){super();c(this,"name");c(this,"type");c(this,"docs");c(this,"initializer");c(this,"access");c(this,"readonly_");this.name=me(e),this.type=n,this.docs=i,this.initializer=o,this.access=u,this.readonly_=l!=null?l:!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")}};a();s();a();s();a();s();a();s();var re=class extends w{constructor({method:e,arguments_:n,static_:i,multiline:o,on:u}){super();c(this,"method");c(this,"arguments_");c(this,"multiline");c(this,"static_");c(this,"on");this.method=e,this.arguments_=n,this.static_=i!=null?i:!1,this.multiline=o!=null?o:!1,this.on=u}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),$e({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};var M=class r extends w{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(Fl({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(Pl({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
25
- `)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}if(this.internalType.value.includes("'")){e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}e.write(`'${this.internalType.value}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:A(this.internalType)}}isClass(){return this.internalType.type==="class"}asClassOrThrow(){if(this.isClass())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a class")}writeStringWithHeredoc({writer:e,value:n}){e.writeLine("<<<EOT"),e.writeNoIndent(n),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:n}){e.writeNode(new z({classReference:n.reference,arguments_:[r.map({entries:n.fields.map(i=>({key:r.string(i.name),value:i.value}))})]}))}writeList({writer:e,list:n}){let i=kl({values:n.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:n}){let i=_l({entries:n.entries});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.key.write(e),e.write(" => "),o.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:n}){return new this({type:"class",reference:e,fields:n})}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:n}){switch(typeof n){case"boolean":e.write(n.toString());return;case"string":e.write(n.includes('"')?`\`${n}\``:`"${n}"`);return;case"number":e.write(n.toString());return;case"object":if(n==null){e.write("null");return}if(Array.isArray(n)){this.writeUnknownArray({writer:e,value:n});return}this.writeUnknownMap({writer:e,value:n});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof n}`)}}writeUnknownArray({writer:e,value:n}){if(n.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of n)e.writeNode(r.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:n}){let i=Object.entries(n);if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[o,u]of i)e.write(`'${o}' => `),e.writeNode(r.unknown(u)),e.writeLine(",");e.dedent(),e.write("]")}};function Pl({writer:r,value:t}){return new z({classReference:new I({name:"DateTime",namespace:""}),arguments_:[new S(`'${t}'`)]})}function Fl({writer:r,value:t}){return new re({on:new I({name:"File",namespace:`${r.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new S(`"${t}"`)]})}function _l({entries:r}){return r.filter(t=>!M.isNop(t.key)&&!M.isNop(t.value))}function kl({values:r}){return r.filter(t=>!M.isNop(t))}var D=class r extends w{constructor(e){super();c(this,"internalType");this.internalType=e}write(e,{comment:n}={}){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(lo),e.write("DateTime");break;case"dateTime":e.addReference(lo),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!n){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:n}),e.write(">");break;case"map":{if(!n){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:n}),e.write(", "),this.internalType.valueType.write(e,{comment:n}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!n){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");let i=this.internalType.entries.filter(l=>!l.valueType.isOptional()),o=this.internalType.entries.filter(l=>l.valueType.isOptional()),u=[...i,...o];for(let l of u)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:l,comment:n}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((i,o)=>{o>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:i,comment:n})}),e.write("}");break}case"union":{this.writeUnion({writer:e,unionTypes:this.internalType.types,comment:n});break}case"optional":{let i=this.internalType.value.internalType,o=i.type==="mixed",u=i.type==="union";!u&&!o&&e.write("?"),this.internalType.value.write(e,{comment:n}),u&&!this.unionHasOptional(i.types)&&(e.write("|"),e.writeNode(r.null()));break}case"reference":if(n){e.writeNode(this.internalType.value);let i=this.internalType.value.generics;i&&i.length>0&&(e.write("<"),i.forEach((o,u)=>{u>0&&e.write(", "),o.write(e,{comment:n})}),e.write(">"))}else e.writeNode(this.internalType.value);break;case"enumString":n?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;case"literal":if(n)e.writeNode(this.internalType.value);else switch(this.internalType.value.internalType.type){case"string":e.write("string");break;case"boolean":e.write("bool");break;default:A(this.internalType.value.internalType)}break;default:A(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:r.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"}getClassReference(){switch(this.internalType.type){case"date":case"dateTime":return new I({name:"DateTime",namespace:""});case"enumString":case"reference":return this.internalType.value;case"int":case"string":case"bool":case"float":case"object":case"map":case"array":case"null":case"mixed":case"optional":case"typeDict":case"union":case"literal":throw new Error("Cannot get class reference for "+this.internalType.type);default:A(this.internalType)}}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,n){return new this({type:"map",keyType:e,valueType:n})}static typeDict(e,{multiline:n}={}){return new this({type:"typeDict",entries:e,multiline:n})}static union(e){let n=this.flattenUnionTypes(e),i=Pt(n,Lt);return new this({type:"union",types:i})}static flattenUnionTypes(e){let n=[];for(let i of e)i.internalType.type==="union"?n.push(...this.flattenUnionTypes(i.internalType.types)):n.push(i);return n}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 literalString(e){return new this({type:"literal",value:M.string(e)})}static literalBoolean(e){return new this({type:"literal",value:M.boolean(e)})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeUnion({writer:e,unionTypes:n,comment:i}){let o=this.getUniqueTypes({types:n,comment:i,writer:e}),u=this.unwrapOptionalTypes(o),l=u.filter(m=>m.underlyingType().internalType.type==="mixed").length>0;if(l&&!i){e.write("mixed");return}if(u.length>0&&i){e.writeLine("("),u.forEach((m,d)=>{d>0?e.write(" * |"):e.write(" * "),l&&(m=m.underlyingType()),m.write(e,{comment:i}),e.writeLine(),d++}),e.write(" * )");return}u.forEach((m,d)=>{d>0&&e.write("|"),l&&(m=m.underlyingType()),m.write(e,{comment:i}),d++})}writeTypeDictEntry({writer:e,entry:n,comment:i}){e.write(n.key),n.optional&&e.write("?"),e.write(": "),n.valueType.write(e,{comment:i})}getUniqueTypes({writer:e,types:n,comment:i}){let o=Pt(n,Lt),u=new Set;return o.filter(l=>{let m=l.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig,comment:i});return u.has(m)?!1:(u.add(m),!0)})}unwrapOptionalTypes(e){let n=!1,i=e.map(o=>o.internalType.type==="optional"?(n=!0,o.internalType.value):o);return n&&i.push(r.null()),i}unionHasOptional(e){return e.filter(n=>n.internalType.type==="optional").length>0}toString({namespace:e,rootNamespace:n,customConfig:i,comment:o}){let u=new G({namespace:e,rootNamespace:n,customConfig:i});return this.write(u,{comment:o!=null?o:!1}),u.toString()}},lo=new I({namespace:"",name:"DateTime"});a();s();function co(r){return r.startsWith("$")?r.slice(1):r}var mo="values",Ae=class extends w{constructor({name:e,namespace:n,abstract:i,docs:o,parentClassReference:u,traits:l,constructorAccess:m}){super();c(this,"name");c(this,"namespace");c(this,"constructorAccess");c(this,"class_");this.name=e,this.namespace=n,this.constructorAccess=m!=null?m:"public",this.class_=new ee({name:e,namespace:n,abstract:i,docs:o,parentClassReference:u,traits:l})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let n=de(this.class_.fields).map(i=>Le(Se({},i),{name:co(i.name)}));n.length>0&&this.class_.addConstructor({access:this.constructorAccess,parameters:this.getConstructorParameters({orderedFields:n}),body:h.codeblock(i=>{for(let o of n)i.write(`$this->${o.name} = $${mo}['${o.name}']`),o.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 te({name:mo,type:D.typeDict(e.map(n=>({key:n.name,valueType:n.type,optional:n.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new S("[]"):void 0})]}};a();s();a();s();var ne=class extends w{constructor({name:e,access:n,parameters:i,throws:o,return_:u,body:l,docs:m,classReference:d,static_:y}){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");c(this,"static_");this.name=e,this.access=n,this.parameters=i,this.throws=o!=null?o:[],this.return_=u,this.body=l,this.docs=m,this.classReference=d,this.static_=y!=null?y:!1}write(e){var u;this.writeComment(e),e.write(`${this.access}${this.static_?" static":""} function ${this.name}(`);let n=this.parameters.filter(l=>!l.type.isOptional()),i=this.parameters.filter(l=>l.type.isOptional());[...n,...i].forEach((l,m)=>{m>0&&e.write(", "),l.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),(u=this.body)==null||u.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let n=new P({docs:this.docs});for(let i of this.parameters)n.addTag({tagType:"param",type:i.type,name:i.name,docs:i.docs});this.return_!=null&&this.return_!==oo&&this.return_!==ao&&n.addTag({tagType:"return",type:this.return_});for(let i of this.throws)n.addTag({tagType:"throws",type:D.reference(i)});e.writeNode(n)}};var Ee=class extends w{constructor({name:e,namespace:n,backing:i,docs:o,serializable:u}){super();c(this,"name");c(this,"namespace");c(this,"backing");c(this,"docs");c(this,"members",[]);c(this,"serializable");this.name=e,this.namespace=n,this.backing=i,this.docs=o,this.serializable=u!=null?u:!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 I({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let n of this.members){if(e.write(`case ${n.name}`),n.value!=null)if(typeof n.value=="string"){let i=ar(n.value);e.write(` = "${i}"`)}else e.write(` = ${n.value}`);e.writeTextStatement("")}this.serializable&&(e.newLine(),e.writeNode(new ne({name:"jsonSerialize",return_:D.string(),access:"public",parameters:[],body:new S("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new P({docs:this.docs}).write(e)}};a();s();var Re=class extends w{constructor({name:e,type:n,access:i,readonly_:o,initializer:u,docs:l,inlineDocs:m,attributes:d,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=me(e),this.type=n,this.access=i,this.readonly_=o!=null?o:!1,this.initializer=u,this.docs=l,this.inlineDocs=m,this.attributes=d!=null?d:[],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 n=new P;n.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),n.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((n,i)=>{i>0&&e.write(", "),n.write(e)}),e.writeLine("]"))}};a();s();var Ce=class extends w{constructor({entries:e,multiline:n}){super();c(this,"entries");c(this,"multiline");this.entries=e!=null?e:[],this.multiline=n!=null?n:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:n,value:i}of this.entries)n.write(e),e.write(" => "),i.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[n,{key:i,value:o}]of this.entries.entries())n>0&&e.write(", "),i.write(e),e.write(" => "),o.write(e);e.write("]")}};a();s();var Ie=class extends w{constructor({name:e,namespace:n,docs:i,traits:o}){super();c(this,"name");c(this,"namespace");c(this,"docs");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);this.name=e,this.namespace=n,this.docs=i,this.traits=o!=null?o:[]}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((n,i)=>{i>0&&e.write(","),e.writeNode(n)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:de(this.fields)}),this.fields.length>0&&this.methods.length>0&&e.newLine(),this.writeMethods({writer:e,methods:de(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){let n=new P({docs:this.docs});for(let i of this.fields)n.addTag({tagType:"property",type:i.type,name:i.name});n.write(e)}writeFields({writer:e,fields:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};a();s();var kt=class extends w{constructor(e){super();c(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),$e({writer:e,arguments_:this.arrays.map(n=>Ne(i=>{if(typeof n=="string"||n instanceof w){i.writeNodeOrString(n);return}i.writeNodeOrString(n.ref),n.fallback&&(i.write(" ?? "),i.writeNodeOrString(n.fallback))}))})}};function Bl(r){return new Te(r)}function Ul(r){return new be(r)}function Ol(r){return new ee(r)}function Ml(r){return new Ie(r)}function Dl(r){return new I(r)}function Ne(r){return new S(r)}function $l(r){return new Ae(r)}function jl(r){return new Ee(r)}function Wl(r){return new Re(r)}function ho(r){return new z(r)}function ql(r){return new re(r)}function Vl(r){return Ne(t=>{t.write("throw "),t.writeNode(ho(r))})}function Gl(r){return new Ce(r)}function zl(r){return new ne(r)}function Hl(r){return new te(r)}function Yl(r){return new Ye(r)}function Kl(r,t){return Ne(e=>{e.writeNodeOrString(r),e.write(" = "),e.writeNodeOrString(t)})}function Jl(r){return Ne(me(r))}function Zl(r){return Ne(`"${r}"`)}function Ql(...r){return new kt(r)}function ar(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\$/g,"\\$")}function Xl(){return new S(r=>{r.write("$this")})}a();s();function sr(r){return so.has(r.toLowerCase())?`${r}_`:r}a();s();var Bt=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?h.TypeLiteral.null():(this.context.errors.add({severity:v.Critical,message:"Expected non-null value, but got null"}),h.TypeLiteral.nop());if(t.value===void 0)return h.TypeLiteral.nop();switch(t.typeReference.type){case"list":case"set":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?h.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"unknown":return this.convertUnknown({value:t.value});default:A(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let n=this.context.getValueAsBoolean({value:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.boolean(n)}case"string":{let n=this.context.getValueAsString({value:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.string(n)}default:A(t)}}convertList({list:t,value:e}){return Array.isArray(e)?h.TypeLiteral.list({values:e.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:v.Critical,message:`Expected array but got: ${typeof e}`}),h.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:v.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),h.TypeLiteral.nop()):h.TypeLiteral.map({entries:Object.entries(e).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:t.key,value:n,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:n}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"object":return this.convertObject({object_:t,value:e});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:A(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(n==null)return h.TypeLiteral.nop();let i=n.singleDiscriminatedUnionType,o=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:n,unionVariant:i});return o==null?h.TypeLiteral.nop():h.TypeLiteral.reference(h.codeblock(u=>{u.writeNode(h.invokeMethod({on:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),method:this.context.getMethodName(i.discriminantValue.name),arguments_:this.convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:n,unionVariant:i,unionProperties:o}),static_:!0}))}))}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){switch(e.type){case"samePropertiesAsObject":{let n=this.context.resolveNamedType({typeId:e.typeId});if(n==null)return;let i=this.convertNamed({named:n,value:t.value});if(!i.isClass()){this.context.errors.add({severity:v.Critical,message:"Internal error; expected union value to be an object"});return}return i.asClassOrThrow().fields}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let n=this.context.getRecord(t.value);return n==null?[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:t.value})}]:[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:n[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return[];default:A(e)}}convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:n}){let i=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});if(e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&n.length===1)return[...i,this.convert({typeReference:e.typeReference,value:t.value})];if(e.type==="samePropertiesAsObject"){let o=this.context.resolveNamedType({typeId:e.typeId});return o==null?[]:[...i,h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(o.declaration.name),namespace:this.context.getTypesNamespace(o.declaration.fernFilepath)}),fields:n})]}return i}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){var i,o;return this.context.associateByWireValue({parameters:(i=e.properties)!=null?i:[],values:(o=this.context.getRecord(t.value))!=null?o:{},ignoreMissingParameters:!0}).map(u=>{this.context.errors.scope(u.name.wireValue);try{return this.convert(u)}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e}){var i;let n=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),fields:n.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:t,value:e}){let n=this.getEnumValueName({enum_:t,value:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.reference(h.codeblock(i=>{i.writeNode(h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)})),i.write("::"),i.write(n),i.write("->value")}))}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:v.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let n=t.values.find(i=>i.wireValue===e);if(n==null){this.context.errors.add({severity:v.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return this.context.getClassName(n.name)}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return n==null?h.TypeLiteral.nop():n}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let n of t.types)try{return this.convert({typeReference:n,value:e})}catch(i){continue}this.context.errors.add({severity:v.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t}){return h.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:n}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:n});return i==null?h.TypeLiteral.nop():h.TypeLiteral.number(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:n});return i==null?h.TypeLiteral.nop():h.TypeLiteral.boolean(i)}case"DATE":case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.datetime(i)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.string(i)}default:A(t)}}getValueAsNumber({value:t,as:e}){let n=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:t,as:e}){let n=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:n})}};a();s();var Ut=class{constructor({context:t}){c(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){var o;let n={fileFields:[],bodyPropertyFields:[]},i=(o=this.context.getRecord(e))!=null?o:{};for(let u of t.properties)switch(u.type){case"file":n.fileFields.push({name:this.context.getPropertyName(u.name),value:this.getSingleFileProperty({property:u,record:i})});break;case"fileArray":n.fileFields.push({name:this.context.getPropertyName(u.name),value:this.getArrayFileProperty({property:u,record:i})});break;case"bodyProperty":n.bodyPropertyFields.push({name:this.context.getPropertyName(u.name.name),value:this.getBodyProperty({property:u,record:i})});break;default:A(u)}return n}getSingleFileProperty({property:t,record:e}){let n=this.context.getSingleFileValue({property:t,record:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.file(n)}getArrayFileProperty({property:t,record:e}){let n=this.context.getFileArrayValues({property:t,record:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.list({values:n.map(i=>h.TypeLiteral.file(i))})}getBodyProperty({property:t,record:e}){let n=e[t.name.wireValue];return n==null?h.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:n})}};var ec=["use","clone","list"],tc="Requests",rc="Types",Ot=class r extends Xe{constructor({ir:e,config:n}){var i;super({ir:e,config:n});c(this,"ir");c(this,"customConfig");c(this,"dynamicTypeLiteralMapper");c(this,"filePropertyMapper");c(this,"rootNamespace");this.ir=e,this.customConfig=n.customConfig!=null?n.customConfig:void 0,this.dynamicTypeLiteralMapper=new Bt({context:this}),this.filePropertyMapper=new Ut({context:this}),this.rootNamespace=nc({organization:n.organization,namespaceOverride:(i=this.customConfig)==null?void 0:i.namespace})}clone(){return new r({ir:this.ir,config:this.config})}getParameterName(e){return this.prependUnderscoreIfNeeded(e.camelCase.unsafeName)}getPropertyName(e){return this.prependUnderscoreIfNeeded(e.camelCase.unsafeName)}getMethodName(e){let n=e.camelCase.unsafeName;return ec.includes(n)?n:e.camelCase.safeName}getClassName(e){return sr(e.pascalCase.safeName)}getRootClientClassName(){var e,n,i;return((e=this.customConfig)==null?void 0:e.clientName)!=null?this.customConfig.clientName:((n=this.customConfig)==null?void 0:n["client-class-name"])!=null?(i=this.customConfig)==null?void 0:i["client-class-name"]:this.getComputedClientName()}getEnvironmentsClassReference(){return h.classReference({name:"Environments",namespace:this.rootNamespace})}getRequestNamespace(e){return this.getNamespace(e,tc)}getTypesNamespace(e){return this.getNamespace(e,rc)}getNamespace(e,n){let i=e.allParts.map(o=>o.pascalCase.safeName);return i=n!=null?[...i,n]:i,[this.rootNamespace,...i].join("\\")}getEnvironmentClassAccessFromID(e){let n=this.resolveEnvironmentName(e);if(n!=null)return h.codeblock(i=>{i.writeNode(this.getEnvironmentClassReference(n)),i.write("::"),i.write(this.getClassName(n))})}getEnvironmentClassReference(e){return h.classReference({name:"Environments",namespace:this.rootNamespace})}prependUnderscoreIfNeeded(e){return/^[a-zA-Z_]/.test(e)?e:`_${e}`}getComputedClientName(){return`${this.getOrganizationPascalCase()}Client`}getOrganizationPascalCase(){return`${Ue(Tt(this.config.organization))}`}};function nc({organization:r,namespaceOverride:t}){return t!=null?t:`${Ue(Tt(r))}`}a();s();var yo="$client",Mt="Example",xo=`<?php
24
+ `):void 0;i!=null&&i.length>1&&(i.forEach(o=>{e.writeLine(` * ${o}`)}),e.writeLine(" *")),e.write(` * @${n.tagType} `),n.type.write(e,{comment:!0}),n.name!=null&&e.write(` ${n.name}`),i!=null&&i.length===1&&e.write(` ${i[0]}`),e.newLine()}};a();s();function de(r){return Sl(r,[ce.Public,ce.PublicReadonly,ce.Protected,ce.Private])}function Sl(r,t){return t.reduce((e,n)=>[...e,...r.filter(i=>i.access===n)],[])}var ee=class extends w{constructor({name:e,namespace:n,abstract:i,docs:o,parentClassReference:u,traits:l}){super();m(this,"name");m(this,"namespace");m(this,"abstract");m(this,"docs");m(this,"parentClassReference");m(this,"traits");m(this,"fields",[]);m(this,"methods",[]);m(this,"constructor_");this.name=e,this.namespace=n,this.abstract=i!=null?i:!1,this.docs=o,this.parentClassReference=u,this.traits=l!=null?l:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addMethods(e){this.methods.push(...e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new I({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((n,i)=>{i>0&&e.write(","),e.writeNode(n)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:de(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:de(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new P({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:n}){var i;this.writeConstructorComment({writer:e,constructor:n}),n.access!=null&&e.write(`${n.access} `),e.write("function __construct("),e.indent(),n.parameters.forEach((o,u)=>{u===0&&e.newLine(),o.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(i=n.body)==null||i.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:n}){if(n.parameters.length===0)return;let i=new P;for(let o of n.parameters)i.addTag(o.getCommentTag());i.write(e)}writeFields({writer:e,fields:n}){n.filter(i=>!i.inherited).forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};a();s();a();s();function $e({writer:r,arguments_:t,multiline:e}){if(t.length===0){r.write("()");return}if(e){Nl({writer:r,arguments_:t});return}Ll({writer:r,arguments_:t})}function Nl({writer:r,arguments_:t}){r.writeLine("("),r.indent();for(let e of t)fo({writer:r,argument:e,writeCompact:!1}),r.writeLine(",");r.dedent(),r.write(")")}function Ll({writer:r,arguments_:t}){r.write("("),t.forEach((e,n)=>{n>0&&r.write(", "),fo({writer:r,argument:e,writeCompact:!0})}),r.write(")")}function fo({writer:r,argument:t,writeCompact:e}){or(t)?(t.docs&&(e?r.write(`/* ${t.docs} */ `):r.writeLine(`/* ${t.docs} */`)),r.write(`${t.name}: `),r.writeNodeOrString(t.assignment)):t.write(r)}var z=class extends w{constructor({classReference:e,arguments_:n,multiline:i}){super();m(this,"classReference");m(this,"arguments_");m(this,"multiline");this.classReference=e,this.arguments_=n,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),$e({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};a();s();var N=class extends w{constructor(e){super();m(this,"arg");this.arg=e}write(e){return new U(this.arg).write(e)}};a();s();a();s();var te=class extends w{constructor({name:e,type:n,docs:i,initializer:o,access:u,readonly_:l}){super();m(this,"name");m(this,"type");m(this,"docs");m(this,"initializer");m(this,"access");m(this,"readonly_");this.name=me(e),this.type=n,this.docs=i,this.initializer=o,this.access=u,this.readonly_=l!=null?l:!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")}};a();s();a();s();a();s();a();s();var re=class extends w{constructor({method:e,arguments_:n,static_:i,multiline:o,on:u}){super();m(this,"method");m(this,"arguments_");m(this,"multiline");m(this,"static_");m(this,"on");this.method=e,this.arguments_=n,this.static_=i!=null?i:!1,this.multiline=o!=null?o:!1,this.on=u}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),$e({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};var M=class r extends w{constructor(e){super();m(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(Fl({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(Pl({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
25
+ `)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}if(this.internalType.value.includes("'")){e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}e.write(`'${this.internalType.value}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:A(this.internalType)}}isClass(){return this.internalType.type==="class"}asClassOrThrow(){if(this.isClass())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a class")}writeStringWithHeredoc({writer:e,value:n}){e.writeLine("<<<EOT"),e.writeNoIndent(n),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:n}){e.writeNode(new z({classReference:n.reference,arguments_:[r.map({entries:n.fields.map(i=>({key:r.string(i.name),value:i.value}))})]}))}writeList({writer:e,list:n}){let i=kl({values:n.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:n}){let i=_l({entries:n.entries});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.key.write(e),e.write(" => "),o.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:n}){return new this({type:"class",reference:e,fields:n})}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:n}){switch(typeof n){case"boolean":e.write(n.toString());return;case"string":e.write(n.includes('"')?`\`${n}\``:`"${n}"`);return;case"number":e.write(n.toString());return;case"object":if(n==null){e.write("null");return}if(Array.isArray(n)){this.writeUnknownArray({writer:e,value:n});return}this.writeUnknownMap({writer:e,value:n});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof n}`)}}writeUnknownArray({writer:e,value:n}){if(n.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of n)e.writeNode(r.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:n}){let i=Object.entries(n);if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[o,u]of i)e.write(`'${o}' => `),e.writeNode(r.unknown(u)),e.writeLine(",");e.dedent(),e.write("]")}};function Pl({writer:r,value:t}){return new z({classReference:new I({name:"DateTime",namespace:""}),arguments_:[new N(`'${t}'`)]})}function Fl({writer:r,value:t}){return new re({on:new I({name:"File",namespace:`${r.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new N(`"${t}"`)]})}function _l({entries:r}){return r.filter(t=>!M.isNop(t.key)&&!M.isNop(t.value))}function kl({values:r}){return r.filter(t=>!M.isNop(t))}var D=class r extends w{constructor(e){super();m(this,"internalType");this.internalType=e}write(e,{comment:n}={}){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(lo),e.write("DateTime");break;case"dateTime":e.addReference(lo),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!n){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:n}),e.write(">");break;case"map":{if(!n){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:n}),e.write(", "),this.internalType.valueType.write(e,{comment:n}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!n){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");let i=this.internalType.entries.filter(l=>!l.valueType.isOptional()),o=this.internalType.entries.filter(l=>l.valueType.isOptional()),u=[...i,...o];for(let l of u)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:l,comment:n}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((i,o)=>{o>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:i,comment:n})}),e.write("}");break}case"union":{this.writeUnion({writer:e,unionTypes:this.internalType.types,comment:n});break}case"optional":{let i=this.internalType.value.internalType,o=i.type==="mixed",u=i.type==="union";!u&&!o&&e.write("?"),this.internalType.value.write(e,{comment:n}),u&&!this.unionHasOptional(i.types)&&(e.write("|"),e.writeNode(r.null()));break}case"reference":if(n){e.writeNode(this.internalType.value);let i=this.internalType.value.generics;i&&i.length>0&&(e.write("<"),i.forEach((o,u)=>{u>0&&e.write(", "),o.write(e,{comment:n})}),e.write(">"))}else e.writeNode(this.internalType.value);break;case"enumString":n?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;case"literal":if(n)e.writeNode(this.internalType.value);else switch(this.internalType.value.internalType.type){case"string":e.write("string");break;case"boolean":e.write("bool");break;default:A(this.internalType.value.internalType)}break;default:A(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:r.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"}getClassReference(){switch(this.internalType.type){case"date":case"dateTime":return new I({name:"DateTime",namespace:""});case"enumString":case"reference":return this.internalType.value;case"int":case"string":case"bool":case"float":case"object":case"map":case"array":case"null":case"mixed":case"optional":case"typeDict":case"union":case"literal":throw new Error("Cannot get class reference for "+this.internalType.type);default:A(this.internalType)}}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,n){return new this({type:"map",keyType:e,valueType:n})}static typeDict(e,{multiline:n}={}){return new this({type:"typeDict",entries:e,multiline:n})}static union(e){let n=this.flattenUnionTypes(e),i=Pt(n,Lt);return new this({type:"union",types:i})}static flattenUnionTypes(e){let n=[];for(let i of e)i.internalType.type==="union"?n.push(...this.flattenUnionTypes(i.internalType.types)):n.push(i);return n}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 literalString(e){return new this({type:"literal",value:M.string(e)})}static literalBoolean(e){return new this({type:"literal",value:M.boolean(e)})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeUnion({writer:e,unionTypes:n,comment:i}){let o=this.getUniqueTypes({types:n,comment:i,writer:e}),u=this.unwrapOptionalTypes(o),l=u.filter(c=>c.underlyingType().internalType.type==="mixed").length>0;if(l&&!i){e.write("mixed");return}if(u.length>0&&i){e.writeLine("("),u.forEach((c,d)=>{d>0?e.write(" * |"):e.write(" * "),l&&(c=c.underlyingType()),c.write(e,{comment:i}),e.writeLine(),d++}),e.write(" * )");return}u.forEach((c,d)=>{d>0&&e.write("|"),l&&(c=c.underlyingType()),c.write(e,{comment:i}),d++})}writeTypeDictEntry({writer:e,entry:n,comment:i}){e.write(n.key),n.optional&&e.write("?"),e.write(": "),n.valueType.write(e,{comment:i})}getUniqueTypes({writer:e,types:n,comment:i}){let o=Pt(n,Lt),u=new Set;return o.filter(l=>{let c=l.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig,comment:i});return u.has(c)?!1:(u.add(c),!0)})}unwrapOptionalTypes(e){let n=!1,i=e.map(o=>o.internalType.type==="optional"?(n=!0,o.internalType.value):o);return n&&i.push(r.null()),i}unionHasOptional(e){return e.filter(n=>n.internalType.type==="optional").length>0}toString({namespace:e,rootNamespace:n,customConfig:i,comment:o}){let u=new G({namespace:e,rootNamespace:n,customConfig:i});return this.write(u,{comment:o!=null?o:!1}),u.toString()}},lo=new I({namespace:"",name:"DateTime"});a();s();function co(r){return r.startsWith("$")?r.slice(1):r}var mo="values",Ae=class extends w{constructor({name:e,namespace:n,abstract:i,docs:o,parentClassReference:u,traits:l,constructorAccess:c}){super();m(this,"name");m(this,"namespace");m(this,"constructorAccess");m(this,"class_");this.name=e,this.namespace=n,this.constructorAccess=c!=null?c:"public",this.class_=new ee({name:e,namespace:n,abstract:i,docs:o,parentClassReference:u,traits:l})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let n=de(this.class_.fields).map(i=>Le(Ne({},i),{name:co(i.name)}));n.length>0&&this.class_.addConstructor({access:this.constructorAccess,parameters:this.getConstructorParameters({orderedFields:n}),body:h.codeblock(i=>{for(let o of n)i.write(`$this->${o.name} = $${mo}['${o.name}']`),o.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 te({name:mo,type:D.typeDict(e.map(n=>({key:n.name,valueType:n.type,optional:n.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new N("[]"):void 0})]}};a();s();a();s();var ne=class extends w{constructor({name:e,access:n,parameters:i,throws:o,return_:u,body:l,docs:c,classReference:d,static_:y}){super();m(this,"name");m(this,"access");m(this,"parameters");m(this,"throws");m(this,"return_");m(this,"body");m(this,"docs");m(this,"classReference");m(this,"static_");this.name=e,this.access=n,this.parameters=i,this.throws=o!=null?o:[],this.return_=u,this.body=l,this.docs=c,this.classReference=d,this.static_=y!=null?y:!1}write(e){var u;this.writeComment(e),e.write(`${this.access}${this.static_?" static":""} function ${this.name}(`);let n=this.parameters.filter(l=>!l.type.isOptional()),i=this.parameters.filter(l=>l.type.isOptional());[...n,...i].forEach((l,c)=>{c>0&&e.write(", "),l.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),(u=this.body)==null||u.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let n=new P({docs:this.docs});for(let i of this.parameters)n.addTag({tagType:"param",type:i.type,name:i.name,docs:i.docs});this.return_!=null&&this.return_!==oo&&this.return_!==ao&&n.addTag({tagType:"return",type:this.return_});for(let i of this.throws)n.addTag({tagType:"throws",type:D.reference(i)});e.writeNode(n)}};var Ee=class extends w{constructor({name:e,namespace:n,backing:i,docs:o,serializable:u}){super();m(this,"name");m(this,"namespace");m(this,"backing");m(this,"docs");m(this,"members",[]);m(this,"serializable");this.name=e,this.namespace=n,this.backing=i,this.docs=o,this.serializable=u!=null?u:!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 I({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let n of this.members){if(e.write(`case ${n.name}`),n.value!=null)if(typeof n.value=="string"){let i=ar(n.value);e.write(` = "${i}"`)}else e.write(` = ${n.value}`);e.writeTextStatement("")}this.serializable&&(e.newLine(),e.writeNode(new ne({name:"jsonSerialize",return_:D.string(),access:"public",parameters:[],body:new N("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new P({docs:this.docs}).write(e)}};a();s();var Re=class extends w{constructor({name:e,type:n,access:i,readonly_:o,initializer:u,docs:l,inlineDocs:c,attributes:d,inherited:y}){super();m(this,"name");m(this,"type");m(this,"access");m(this,"readonly_");m(this,"initializer");m(this,"docs");m(this,"inlineDocs");m(this,"attributes");m(this,"inherited");this.name=me(e),this.type=n,this.access=i,this.readonly_=o!=null?o:!1,this.initializer=u,this.docs=l,this.inlineDocs=c,this.attributes=d!=null?d:[],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 n=new P;n.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),n.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((n,i)=>{i>0&&e.write(", "),n.write(e)}),e.writeLine("]"))}};a();s();var Ce=class extends w{constructor({entries:e,multiline:n}){super();m(this,"entries");m(this,"multiline");this.entries=e!=null?e:[],this.multiline=n!=null?n:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:n,value:i}of this.entries)n.write(e),e.write(" => "),i.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[n,{key:i,value:o}]of this.entries.entries())n>0&&e.write(", "),i.write(e),e.write(" => "),o.write(e);e.write("]")}};a();s();var Ie=class extends w{constructor({name:e,namespace:n,docs:i,traits:o}){super();m(this,"name");m(this,"namespace");m(this,"docs");m(this,"traits");m(this,"fields",[]);m(this,"methods",[]);this.name=e,this.namespace=n,this.docs=i,this.traits=o!=null?o:[]}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((n,i)=>{i>0&&e.write(","),e.writeNode(n)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:de(this.fields)}),this.fields.length>0&&this.methods.length>0&&e.newLine(),this.writeMethods({writer:e,methods:de(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){let n=new P({docs:this.docs});for(let i of this.fields)n.addTag({tagType:"property",type:i.type,name:i.name});n.write(e)}writeFields({writer:e,fields:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};a();s();var kt=class extends w{constructor(e){super();m(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),$e({writer:e,arguments_:this.arrays.map(n=>Se(i=>{if(typeof n=="string"||n instanceof w){i.writeNodeOrString(n);return}i.writeNodeOrString(n.ref),n.fallback&&(i.write(" ?? "),i.writeNodeOrString(n.fallback))}))})}};function Bl(r){return new Te(r)}function Ol(r){return new be(r)}function Ul(r){return new ee(r)}function Ml(r){return new Ie(r)}function Dl(r){return new I(r)}function Se(r){return new N(r)}function $l(r){return new Ae(r)}function jl(r){return new Ee(r)}function ql(r){return new Re(r)}function ho(r){return new z(r)}function Wl(r){return new re(r)}function Vl(r){return Se(t=>{t.write("throw "),t.writeNode(ho(r))})}function Gl(r){return new Ce(r)}function zl(r){return new ne(r)}function Hl(r){return new te(r)}function Yl(r){return new Ye(r)}function Kl(r,t){return Se(e=>{e.writeNodeOrString(r),e.write(" = "),e.writeNodeOrString(t)})}function Jl(r){return Se(me(r))}function Zl(r){return Se(`"${r}"`)}function Ql(...r){return new kt(r)}function ar(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\$/g,"\\$")}function Xl(){return new N(r=>{r.write("$this")})}a();s();function sr(r){return so.has(r.toLowerCase())?`${r}_`:r}a();s();var Bt=class{constructor({context:t}){m(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?h.TypeLiteral.null():(this.context.errors.add({severity:v.Critical,message:"Expected non-null value, but got null"}),h.TypeLiteral.nop());if(t.value===void 0)return h.TypeLiteral.nop();switch(t.typeReference.type){case"list":case"set":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?h.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"unknown":return this.convertUnknown({value:t.value});default:A(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let n=this.context.getValueAsBoolean({value:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.boolean(n)}case"string":{let n=this.context.getValueAsString({value:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.string(n)}default:A(t)}}convertList({list:t,value:e}){return Array.isArray(e)?h.TypeLiteral.list({values:e.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:v.Critical,message:`Expected array but got: ${typeof e}`}),h.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:v.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),h.TypeLiteral.nop()):h.TypeLiteral.map({entries:Object.entries(e).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:t.key,value:n,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:n}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"object":return this.convertObject({object_:t,value:e});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:A(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(n==null)return h.TypeLiteral.nop();let i=n.singleDiscriminatedUnionType,o=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:n,unionVariant:i});return o==null?h.TypeLiteral.nop():h.TypeLiteral.reference(h.codeblock(u=>{u.writeNode(h.invokeMethod({on:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),method:this.context.getMethodName(i.discriminantValue.name),arguments_:this.convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:n,unionVariant:i,unionProperties:o}),static_:!0}))}))}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){switch(e.type){case"samePropertiesAsObject":{let n=this.context.resolveNamedType({typeId:e.typeId});if(n==null)return;let i=this.convertNamed({named:n,value:t.value});if(!i.isClass()){this.context.errors.add({severity:v.Critical,message:"Internal error; expected union value to be an object"});return}return i.asClassOrThrow().fields}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let n=this.context.getRecord(t.value);return n==null?[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:t.value})}]:[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:n[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return[];default:A(e)}}convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:n}){let i=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});if(e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&n.length===1)return[...i,this.convert({typeReference:e.typeReference,value:t.value})];if(e.type==="samePropertiesAsObject"){let o=this.context.resolveNamedType({typeId:e.typeId});return o==null?[]:[...i,h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(o.declaration.name),namespace:this.context.getTypesNamespace(o.declaration.fernFilepath)}),fields:n})]}return i}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){var i,o;return this.context.associateByWireValue({parameters:(i=e.properties)!=null?i:[],values:(o=this.context.getRecord(t.value))!=null?o:{},ignoreMissingParameters:!0}).map(u=>{this.context.errors.scope(u.name.wireValue);try{return this.convert(u)}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e}){var i;let n=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),fields:n.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:t,value:e}){let n=this.getEnumValueName({enum_:t,value:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.reference(h.codeblock(i=>{i.writeNode(h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)})),i.write("::"),i.write(n),i.write("->value")}))}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:v.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let n=t.values.find(i=>i.wireValue===e);if(n==null){this.context.errors.add({severity:v.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return this.context.getClassName(n.name)}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return n==null?h.TypeLiteral.nop():n}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let n of t.types)try{return this.convert({typeReference:n,value:e})}catch(i){continue}this.context.errors.add({severity:v.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t}){return h.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:n}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:n});return i==null?h.TypeLiteral.nop():h.TypeLiteral.number(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:n});return i==null?h.TypeLiteral.nop():h.TypeLiteral.boolean(i)}case"DATE":case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.datetime(i)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.string(i)}default:A(t)}}getValueAsNumber({value:t,as:e}){let n=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:t,as:e}){let n=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:n})}};a();s();var Ot=class{constructor({context:t}){m(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){var o;let n={fileFields:[],bodyPropertyFields:[]},i=(o=this.context.getRecord(e))!=null?o:{};for(let u of t.properties)switch(u.type){case"file":n.fileFields.push({name:this.context.getPropertyName(u.name),value:this.getSingleFileProperty({property:u,record:i})});break;case"fileArray":n.fileFields.push({name:this.context.getPropertyName(u.name),value:this.getArrayFileProperty({property:u,record:i})});break;case"bodyProperty":n.bodyPropertyFields.push({name:this.context.getPropertyName(u.name.name),value:this.getBodyProperty({property:u,record:i})});break;default:A(u)}return n}getSingleFileProperty({property:t,record:e}){let n=this.context.getSingleFileValue({property:t,record:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.file(n)}getArrayFileProperty({property:t,record:e}){let n=this.context.getFileArrayValues({property:t,record:e});return n==null?h.TypeLiteral.nop():h.TypeLiteral.list({values:n.map(i=>h.TypeLiteral.file(i))})}getBodyProperty({property:t,record:e}){let n=e[t.name.wireValue];return n==null?h.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:n})}};var ec=["use","clone","list"],tc="Requests",rc="Types",Ut=class r extends Xe{constructor({ir:e,config:n}){var i;super({ir:e,config:n});m(this,"ir");m(this,"customConfig");m(this,"dynamicTypeLiteralMapper");m(this,"filePropertyMapper");m(this,"rootNamespace");this.ir=e,this.customConfig=n.customConfig!=null?n.customConfig:void 0,this.dynamicTypeLiteralMapper=new Bt({context:this}),this.filePropertyMapper=new Ot({context:this}),this.rootNamespace=nc({organization:n.organization,namespaceOverride:(i=this.customConfig)==null?void 0:i.namespace})}clone(){return new r({ir:this.ir,config:this.config})}getParameterName(e){return this.prependUnderscoreIfNeeded(e.camelCase.unsafeName)}getPropertyName(e){return this.prependUnderscoreIfNeeded(e.camelCase.unsafeName)}getMethodName(e){let n=e.camelCase.unsafeName;return ec.includes(n)?n:e.camelCase.safeName}getClassName(e){return sr(e.pascalCase.safeName)}getRootClientClassName(){var e,n,i;return((e=this.customConfig)==null?void 0:e.clientName)!=null?this.customConfig.clientName:((n=this.customConfig)==null?void 0:n["client-class-name"])!=null?(i=this.customConfig)==null?void 0:i["client-class-name"]:this.getComputedClientName()}getEnvironmentsClassReference(){return h.classReference({name:"Environments",namespace:this.rootNamespace})}getRequestNamespace(e){return this.getNamespace(e,tc)}getTypesNamespace(e){return this.getNamespace(e,rc)}getNamespace(e,n){let i=e.allParts.map(o=>o.pascalCase.safeName);return i=n!=null?[...i,n]:i,[this.rootNamespace,...i].join("\\")}getEnvironmentClassAccessFromID(e){let n=this.resolveEnvironmentName(e);if(n!=null)return h.codeblock(i=>{i.writeNode(this.getEnvironmentClassReference(n)),i.write("::"),i.write(this.getClassName(n))})}getEnvironmentClassReference(e){return h.classReference({name:"Environments",namespace:this.rootNamespace})}prependUnderscoreIfNeeded(e){return/^[a-zA-Z_]/.test(e)?e:`_${e}`}getComputedClientName(){return`${this.getOrganizationPascalCase()}Client`}getOrganizationPascalCase(){return`${Oe(Tt(this.config.organization))}`}};function nc({organization:r,namespaceOverride:t}){return t!=null?t:`${Oe(Tt(r))}`}a();s();var yo="$client",Mt="Example",xo=`<?php
26
26
 
27
- `,je=class{constructor({context:t}){c(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){var i;let n=this.buildCodeBlock({endpoint:t,snippet:e});return xo+await n.toStringAsync({namespace:Mt,rootNamespace:Mt,customConfig:(i=this.context.customConfig)!=null?i:{}})}generateSnippetSync({endpoint:t,request:e}){var i;let n=this.buildCodeBlock({endpoint:t,snippet:e});return xo+n.toString({namespace:Mt,rootNamespace:Mt,customConfig:(i=this.context.customConfig)!=null?i:{}})}async generateSnippetAst({endpoint:t,request:e,options:n}){return n!=null&&n.skipClientInstantiation?this.buildCodeBlockWithoutClient({endpoint:t,snippet:e}):this.buildCodeBlock({endpoint:t,snippet:e})}buildCodeBlock({endpoint:t,snippet:e}){return h.codeblock(n=>{n.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),n.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})}buildCodeBlockWithoutClient({endpoint:t,snippet:e}){return h.codeblock(n=>{n.writeNodeStatement(this.callMethodOnExistingClient({endpoint:t,snippet:e}))})}constructClient({endpoint:t,snippet:e}){return h.codeblock(n=>{n.write(`${yo} = `),n.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:t,snippet:e})))})}callMethod({endpoint:t,snippet:e}){return h.invokeMethod({on:h.codeblock(yo),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}),multiline:!0})}callMethodOnExistingClient({endpoint:t,snippet:e}){return h.invokeMethod({on:h.codeblock("$this->client"),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}),multiline:!0})}getConstructorArgs({endpoint:t,snippet:e}){var m;let n=[];if(t.auth!=null)if(e.auth!=null)n.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth}));else if(t.auth.type==="inferred"){let d={type:"inferred"};n.push(...this.getConstructorInferredAuthArgs({auth:t.auth,values:d}))}else this.context.errors.add({severity:v.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`});let i=((m=this.context.ir.environments)==null?void 0:m.environments.type)==="multipleBaseUrls",o=this.getConstructorEnvironmentArg({environment:e.environment,hasMultiUrlEnvironments:i}),u=[];if(!i){let d=this.getConstructorBaseUrlArgs({baseUrl:e.baseURL,environment:e.environment});d.length>0&&u.push(...d)}this.context.errors.scope(V.Headers),this.context.ir.headers!=null&&e.headers!=null&&u.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope();let l=[...n];return o!=null&&l.push(o),u.length>0&&l.push({name:"options",assignment:h.TypeLiteral.map({entries:u.map(d=>({key:h.TypeLiteral.string(d.name),value:d.value}))})}),l}getConstructorAuthArgs({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),[];switch(t.type){case"basic":return e.type==="basic"?this.getConstructorBasicAuthArgs({auth:t,values:e}):[];case"bearer":return e.type==="bearer"?this.getConstructorBearerAuthArgs({auth:t,values:e}):[];case"header":return e.type==="header"?this.getConstructorHeaderAuthArgs({auth:t,values:e}):[];case"oauth":return e.type==="oauth"?this.getConstructorOAuthArgs({auth:t,values:e}):[];case"inferred":return e.type==="inferred"?this.getConstructorInferredAuthArgs({auth:t,values:e}):[];default:A(t)}}addError(t){this.context.errors.add({severity:v.Critical,message:t})}addWarning(t){this.context.errors.add({severity:v.Warning,message:t})}getConstructorBasicAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),assignment:h.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),assignment:h.TypeLiteral.string(e.password)}]}getConstructorEnvironmentArg({environment:t,hasMultiUrlEnvironments:e}){if(!e)return;let n=this.context.getEnvironmentsClassReference();if(t!=null){if(this.context.isSingleEnvironmentID(t)){let o=this.context.resolveEnvironmentName(t);if(o==null){this.addWarning(`Environment "${t}" was not found`);return}let u=this.context.getClassName(o);return{name:"environment",assignment:h.TypeLiteral.reference(h.codeblock(l=>{l.writeNode(n),l.write("::"),l.write(u),l.write("()")}))}}if(this.context.isMultiEnvironmentValues(t)){let o=this.resolveMultiEnvironmentName(t);if(o==null){this.addWarning("Invalid multi url environment");return}return o.type==="named"?{name:"environment",assignment:h.TypeLiteral.reference(h.codeblock(u=>{u.writeNode(n),u.write("::"),u.write(o.name),u.write("()")}))}:{name:"environment",assignment:h.TypeLiteral.reference(h.codeblock(u=>{u.writeNode(n),u.write("::custom(");let l=Object.entries(o.urls);l.forEach(([m,d],y)=>{u.write(`${m}: '${d}'`),y<l.length-1&&u.write(", ")}),u.write(")")}))}}}let i=this.getDefaultEnvironmentName();if(i!=null)return{name:"environment",assignment:h.TypeLiteral.reference(h.codeblock(o=>{o.writeNode(n),o.write("::"),o.write(i),o.write("()")}))}}getDefaultEnvironmentName(){var i;if(((i=this.context.ir.environments)==null?void 0:i.environments.type)!=="multipleBaseUrls")return;let t=this.context.ir.environments.environments;if(t.type!=="multipleBaseUrls")return;let e=t.environments;if(e.length===0)return;for(let o of e){let u=this.context.getClassName(o.name);if(u==="Production")return u}let n=e[0];if(n!=null)return this.context.getClassName(n.name)}resolveMultiEnvironmentName(t){let e=Object.keys(t);if(e.length===0||!this.context.validateMultiEnvironmentUrlValues(t))return;let n=e[0];if(n==null)return;let i=t[n];if(i==null)return;let o=this.context.resolveEnvironmentName(i);if(o!=null&&e.every(m=>{let d=t[m];return d==null?!1:this.context.resolveEnvironmentName(d)!=null&&d===i}))return{type:"named",name:this.context.getClassName(o)};let u={};for(let l of e){let m=t[l];if(m==null)continue;let d=this.getBaseUrlPropertyName(l);u[d]=m}if(Object.keys(u).length>0)return{type:"custom",urls:u}}getBaseUrlPropertyName(t){var i;if(((i=this.context.ir.environments)==null?void 0:i.environments.type)!=="multipleBaseUrls")return t;let e=this.context.ir.environments.environments;if(e.type!=="multipleBaseUrls")return t;let n=e.baseUrls.find(o=>o.id===t);return n==null?t:n.name.camelCase.safeName}getConstructorBaseUrlArgs({baseUrl:t,environment:e}){let n=this.getBaseUrlArg({baseUrl:t,environment:e});return h.TypeLiteral.isNop(n)?[]:[{name:"baseUrl",value:n}]}getBaseUrlArg({baseUrl:t,environment:e}){var n;if(t!=null&&e!=null)return this.context.errors.add({severity:v.Critical,message:"Cannot specify both baseUrl and environment options"}),h.TypeLiteral.nop();if(t!=null)return h.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let i=this.context.getEnvironmentClassAccessFromID(e);return i==null?(this.context.errors.add({severity:v.Warning,message:`Environment ${JSON.stringify(e)} was not found`}),h.TypeLiteral.nop()):h.TypeLiteral.reference(h.codeblock(o=>{o.writeNode(i),o.write("->value")}))}if(((n=this.context.ir.environments)==null?void 0:n.environments.type)==="multipleBaseUrls")return h.TypeLiteral.nop()}return h.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),assignment:h.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})}]}getConstructorOAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.clientId),assignment:h.TypeLiteral.string(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),assignment:h.TypeLiteral.string(e.clientSecret)}]}getConstructorInferredAuthArgs({auth:t,values:e}){return[]}getConstructorHeaderArgs({headers:t,values:e}){let n=[];for(let i of t){let o=this.getConstructorHeaderArg({header:i,value:e.value});o!=null&&n.push({name:this.context.getPropertyName(i.name.name),value:o})}return n}getConstructorHeaderArg({header:t,value:e}){let n=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!h.TypeLiteral.isNop(n))return n}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:A(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var o,u;let n=[];this.context.errors.scope(V.PathParameters);let i=[...(o=this.context.ir.pathParameters)!=null?o:[],...(u=t.pathParameters)!=null?u:[]];return i.length>0&&n.push(...this.getPathParameters({namedParameters:i,snippet:e}).map(l=>l.value)),this.context.errors.unscope(),this.context.errors.scope(V.RequestBody),t.body!=null&&n.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),n}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:A(t)}}getBytesBodyRequestArg({value:t}){return this.context.errors.add({severity:v.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),h.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:t,snippet:e}){var m,d,y,x;let n=[],i=(d=(m=this.context.customConfig)==null?void 0:m.inlinePathParameters)!=null?d:!1;this.context.errors.scope(V.PathParameters);let o=[],u=[...(y=this.context.ir.pathParameters)!=null?y:[],...(x=t.pathParameters)!=null?x:[]];u.length>0&&o.push(...this.getPathParameters({namedParameters:u,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(V.RequestBody);let l=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||n.push(...o.map(g=>g.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:!0})&&n.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?o:[],filePropertyInfo:l})),n}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:n,filePropertyInfo:i}){var y,x,g,T;this.context.errors.scope(V.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:(y=t.queryParameters)!=null?y:[],values:(x=e.queryParameters)!=null?x:{}}).map(b=>({name:this.context.getPropertyName(b.name.name),value:this.context.dynamicTypeLiteralMapper.convert(b)}));this.context.errors.unscope(),this.context.errors.scope(V.Headers);let m=this.context.associateByWireValue({parameters:(g=t.headers)!=null?g:[],values:(T=e.headers)!=null?T:{}}).map(b=>({name:this.context.getPropertyName(b.name.name),value:this.context.dynamicTypeLiteralMapper.convert(b)}));this.context.errors.unscope(),this.context.errors.scope(V.RequestBody);let d=t.body!=null?this.getInlinedRequestBodyConstructorFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getRequestNamespace(t.declaration.fernFilepath)}),fields:[...n,...u,...m,...d]})}getInlinedRequestBodyConstructorFields({body:t,value:e,filePropertyInfo:n}){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:n});default:A(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:A(t)}}getInlinedRequestBodyPropertyConstructorFields({parameters:t,value:e}){var o;let n=[],i=this.context.associateByWireValue({parameters:t,values:(o=this.context.getRecord(e))!=null?o:{}});for(let u of i)n.push({name:this.context.getPropertyName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert(u)});return n}getPathParameters({namedParameters:t,snippet:e}){var o;let n=[],i=this.context.associateByWireValue({parameters:t,values:(o=e.pathParameters)!=null?o:{}});for(let u of i)n.push({name:this.context.getPropertyName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert(u)});return n}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 h.instantiateClass({classReference:h.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:t,multiline:!0})}};var Dt=class extends Je{constructor({ir:t,config:e}){super(new Ot({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}async generateSnippetAst(t,e){return await super.generateSnippetAst(t,e)}createSnippetGenerator(t){return new je({context:t})}};0&&(module.exports={DynamicSnippetsGenerator,EndpointSnippetGenerator});
27
+ `,je=class{constructor({context:t}){m(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){var i;let n=this.buildCodeBlock({endpoint:t,snippet:e});return xo+await n.toStringAsync({namespace:Mt,rootNamespace:Mt,customConfig:(i=this.context.customConfig)!=null?i:{}})}generateSnippetSync({endpoint:t,request:e}){var i;let n=this.buildCodeBlock({endpoint:t,snippet:e});return xo+n.toString({namespace:Mt,rootNamespace:Mt,customConfig:(i=this.context.customConfig)!=null?i:{}})}async generateSnippetAst({endpoint:t,request:e,options:n}){return n!=null&&n.skipClientInstantiation?this.buildCodeBlockWithoutClient({endpoint:t,snippet:e}):this.buildCodeBlock({endpoint:t,snippet:e})}buildCodeBlock({endpoint:t,snippet:e}){return h.codeblock(n=>{n.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),n.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})}buildCodeBlockWithoutClient({endpoint:t,snippet:e}){return h.codeblock(n=>{n.writeNodeStatement(this.callMethodOnExistingClient({endpoint:t,snippet:e}))})}constructClient({endpoint:t,snippet:e}){return h.codeblock(n=>{n.write(`${yo} = `),n.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:t,snippet:e})))})}callMethod({endpoint:t,snippet:e}){return h.invokeMethod({on:h.codeblock(yo),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}),multiline:!0})}callMethodOnExistingClient({endpoint:t,snippet:e}){let n=this.getMethodArgs({endpoint:t,snippet:e}),i=this.getRequestOptions({endpoint:t,snippet:e});return h.TypeLiteral.isNop(i)||n.push(i),h.invokeMethod({on:h.codeblock("$this->client"),method:this.getMethod({endpoint:t}),arguments_:n,multiline:!0})}getRequestOptions({endpoint:t,snippet:e}){var l;let n=(l=e.headers)!=null?l:{},i=Object.entries(n);if(i.length===0)return h.TypeLiteral.nop();let o=new Set;if(this.context.ir.headers!=null)for(let c of this.context.ir.headers)o.add(c.name.wireValue.toLowerCase());if(t.request.type==="inlined"&&t.request.headers!=null)for(let c of t.request.headers)o.add(c.name.wireValue.toLowerCase());let u=i.filter(([c])=>!o.has(c.toLowerCase()));return u.length===0?h.TypeLiteral.nop():h.TypeLiteral.map({entries:[{key:h.TypeLiteral.string("headers"),value:h.TypeLiteral.map({entries:u.map(([c,d])=>({key:h.TypeLiteral.string(c),value:h.TypeLiteral.string(String(d))}))})}]})}getConstructorArgs({endpoint:t,snippet:e}){var c;let n=[];if(t.auth!=null)if(e.auth!=null)n.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth}));else if(t.auth.type==="inferred"){let d={type:"inferred"};n.push(...this.getConstructorInferredAuthArgs({auth:t.auth,values:d}))}else this.context.errors.add({severity:v.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`});let i=((c=this.context.ir.environments)==null?void 0:c.environments.type)==="multipleBaseUrls",o=this.getConstructorEnvironmentArg({environment:e.environment,hasMultiUrlEnvironments:i}),u=[];if(!i){let d=this.getConstructorBaseUrlArgs({baseUrl:e.baseURL,environment:e.environment});d.length>0&&u.push(...d)}this.context.errors.scope(V.Headers),this.context.ir.headers!=null&&e.headers!=null&&u.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope();let l=[...n];return o!=null&&l.push(o),u.length>0&&l.push({name:"options",assignment:h.TypeLiteral.map({entries:u.map(d=>({key:h.TypeLiteral.string(d.name),value:d.value}))})}),l}getConstructorAuthArgs({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),[];switch(t.type){case"basic":return e.type==="basic"?this.getConstructorBasicAuthArgs({auth:t,values:e}):[];case"bearer":return e.type==="bearer"?this.getConstructorBearerAuthArgs({auth:t,values:e}):[];case"header":return e.type==="header"?this.getConstructorHeaderAuthArgs({auth:t,values:e}):[];case"oauth":return e.type==="oauth"?this.getConstructorOAuthArgs({auth:t,values:e}):[];case"inferred":return e.type==="inferred"?this.getConstructorInferredAuthArgs({auth:t,values:e}):[];default:A(t)}}addError(t){this.context.errors.add({severity:v.Critical,message:t})}addWarning(t){this.context.errors.add({severity:v.Warning,message:t})}getConstructorBasicAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),assignment:h.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),assignment:h.TypeLiteral.string(e.password)}]}getConstructorEnvironmentArg({environment:t,hasMultiUrlEnvironments:e}){if(!e)return;let n=this.context.getEnvironmentsClassReference();if(t!=null){if(this.context.isSingleEnvironmentID(t)){let o=this.context.resolveEnvironmentName(t);if(o==null){this.addWarning(`Environment "${t}" was not found`);return}let u=this.context.getClassName(o);return{name:"environment",assignment:h.TypeLiteral.reference(h.codeblock(l=>{l.writeNode(n),l.write("::"),l.write(u),l.write("()")}))}}if(this.context.isMultiEnvironmentValues(t)){let o=this.resolveMultiEnvironmentName(t);if(o==null){this.addWarning("Invalid multi url environment");return}return o.type==="named"?{name:"environment",assignment:h.TypeLiteral.reference(h.codeblock(u=>{u.writeNode(n),u.write("::"),u.write(o.name),u.write("()")}))}:{name:"environment",assignment:h.TypeLiteral.reference(h.codeblock(u=>{u.writeNode(n),u.write("::custom(");let l=Object.entries(o.urls);l.forEach(([c,d],y)=>{u.write(`${c}: '${d}'`),y<l.length-1&&u.write(", ")}),u.write(")")}))}}}let i=this.getDefaultEnvironmentName();if(i!=null)return{name:"environment",assignment:h.TypeLiteral.reference(h.codeblock(o=>{o.writeNode(n),o.write("::"),o.write(i),o.write("()")}))}}getDefaultEnvironmentName(){var i;if(((i=this.context.ir.environments)==null?void 0:i.environments.type)!=="multipleBaseUrls")return;let t=this.context.ir.environments.environments;if(t.type!=="multipleBaseUrls")return;let e=t.environments;if(e.length===0)return;for(let o of e){let u=this.context.getClassName(o.name);if(u==="Production")return u}let n=e[0];if(n!=null)return this.context.getClassName(n.name)}resolveMultiEnvironmentName(t){let e=Object.keys(t);if(e.length===0||!this.context.validateMultiEnvironmentUrlValues(t))return;let n=e[0];if(n==null)return;let i=t[n];if(i==null)return;let o=this.context.resolveEnvironmentName(i);if(o!=null&&e.every(c=>{let d=t[c];return d==null?!1:this.context.resolveEnvironmentName(d)!=null&&d===i}))return{type:"named",name:this.context.getClassName(o)};let u={};for(let l of e){let c=t[l];if(c==null)continue;let d=this.getBaseUrlPropertyName(l);u[d]=c}if(Object.keys(u).length>0)return{type:"custom",urls:u}}getBaseUrlPropertyName(t){var i;if(((i=this.context.ir.environments)==null?void 0:i.environments.type)!=="multipleBaseUrls")return t;let e=this.context.ir.environments.environments;if(e.type!=="multipleBaseUrls")return t;let n=e.baseUrls.find(o=>o.id===t);return n==null?t:n.name.camelCase.safeName}getConstructorBaseUrlArgs({baseUrl:t,environment:e}){let n=this.getBaseUrlArg({baseUrl:t,environment:e});return h.TypeLiteral.isNop(n)?[]:[{name:"baseUrl",value:n}]}getBaseUrlArg({baseUrl:t,environment:e}){var n;if(t!=null&&e!=null)return this.context.errors.add({severity:v.Critical,message:"Cannot specify both baseUrl and environment options"}),h.TypeLiteral.nop();if(t!=null)return h.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let i=this.context.getEnvironmentClassAccessFromID(e);return i==null?(this.context.errors.add({severity:v.Warning,message:`Environment ${JSON.stringify(e)} was not found`}),h.TypeLiteral.nop()):h.TypeLiteral.reference(h.codeblock(o=>{o.writeNode(i),o.write("->value")}))}if(((n=this.context.ir.environments)==null?void 0:n.environments.type)==="multipleBaseUrls")return h.TypeLiteral.nop()}return h.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),assignment:h.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})}]}getConstructorOAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.clientId),assignment:h.TypeLiteral.string(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),assignment:h.TypeLiteral.string(e.clientSecret)}]}getConstructorInferredAuthArgs({auth:t,values:e}){return[]}getConstructorHeaderArgs({headers:t,values:e}){let n=[];for(let i of t){let o=this.getConstructorHeaderArg({header:i,value:e.value});o!=null&&n.push({name:this.context.getPropertyName(i.name.name),value:o})}return n}getConstructorHeaderArg({header:t,value:e}){let n=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!h.TypeLiteral.isNop(n))return n}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:A(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var o,u;let n=[];this.context.errors.scope(V.PathParameters);let i=[...(o=this.context.ir.pathParameters)!=null?o:[],...(u=t.pathParameters)!=null?u:[]];return i.length>0&&n.push(...this.getPathParameters({namedParameters:i,snippet:e}).map(l=>l.value)),this.context.errors.unscope(),this.context.errors.scope(V.RequestBody),t.body!=null&&n.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),n}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:A(t)}}getBytesBodyRequestArg({value:t}){return this.context.errors.add({severity:v.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),h.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:t,snippet:e}){var c,d,y,x;let n=[],i=(d=(c=this.context.customConfig)==null?void 0:c.inlinePathParameters)!=null?d:!1;this.context.errors.scope(V.PathParameters);let o=[],u=[...(y=this.context.ir.pathParameters)!=null?y:[],...(x=t.pathParameters)!=null?x:[]];u.length>0&&o.push(...this.getPathParameters({namedParameters:u,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(V.RequestBody);let l=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||n.push(...o.map(g=>g.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:!0})&&n.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?o:[],filePropertyInfo:l})),n}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:n,filePropertyInfo:i}){var y,x,g,T;this.context.errors.scope(V.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:(y=t.queryParameters)!=null?y:[],values:(x=e.queryParameters)!=null?x:{}}).map(b=>({name:this.context.getPropertyName(b.name.name),value:this.context.dynamicTypeLiteralMapper.convert(b)}));this.context.errors.unscope(),this.context.errors.scope(V.Headers);let c=this.context.associateByWireValue({parameters:(g=t.headers)!=null?g:[],values:(T=e.headers)!=null?T:{}}).map(b=>({name:this.context.getPropertyName(b.name.name),value:this.context.dynamicTypeLiteralMapper.convert(b)}));this.context.errors.unscope(),this.context.errors.scope(V.RequestBody);let d=t.body!=null?this.getInlinedRequestBodyConstructorFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getRequestNamespace(t.declaration.fernFilepath)}),fields:[...n,...u,...c,...d]})}getInlinedRequestBodyConstructorFields({body:t,value:e,filePropertyInfo:n}){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:n});default:A(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:A(t)}}getInlinedRequestBodyPropertyConstructorFields({parameters:t,value:e}){var o;let n=[],i=this.context.associateByWireValue({parameters:t,values:(o=this.context.getRecord(e))!=null?o:{}});for(let u of i)n.push({name:this.context.getPropertyName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert(u)});return n}getPathParameters({namedParameters:t,snippet:e}){var o;let n=[],i=this.context.associateByWireValue({parameters:t,values:(o=e.pathParameters)!=null?o:{}});for(let u of i)n.push({name:this.context.getPropertyName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert(u)});return n}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 h.instantiateClass({classReference:h.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:t,multiline:!0})}};var Dt=class extends Je{constructor({ir:t,config:e}){super(new Ut({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}async generateSnippetAst(t,e){return await super.generateSnippetAst(t,e)}createSnippetGenerator(t){return new je({context:t})}};0&&(module.exports={DynamicSnippetsGenerator,EndpointSnippetGenerator});
28
28
  /*! Bundled license information:
29
29
 
30
30
  @esbuild-plugins/node-globals-polyfill/Buffer.js: