@fern-api/go-dynamic-snippets 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DynamicSnippetsGenerator.cjs +18 -10
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
- package/cjs/DynamicSnippetsGenerator.d.cts +4 -4
- package/cjs/{DynamicSnippetsGeneratorContext-CpOvS1wA.d.cts → DynamicSnippetsGeneratorContext-BusKoNq4.d.cts} +10 -1
- package/cjs/EndpointSnippetGenerator.cjs +19 -11
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
- package/cjs/EndpointSnippetGenerator.d.cts +15 -4
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +18 -10
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
- package/cjs/context/DynamicTypeInstantiationMapper.cjs +19 -11
- package/cjs/context/DynamicTypeInstantiationMapper.cjs.map +1 -0
- package/cjs/context/DynamicTypeInstantiationMapper.d.cts +1 -1
- package/cjs/context/DynamicTypeMapper.cjs +18 -10
- package/cjs/context/DynamicTypeMapper.cjs.map +1 -0
- package/cjs/context/DynamicTypeMapper.d.cts +1 -1
- package/cjs/context/FilePropertyMapper.cjs +18 -10
- package/cjs/context/FilePropertyMapper.cjs.map +1 -0
- package/cjs/context/FilePropertyMapper.d.cts +1 -1
- package/cjs/index.cjs +24 -28
- package/cjs/index.cjs.map +1 -0
- package/cjs/index.d.cts +2 -2
- package/esm/DynamicSnippetsGenerator.d.ts +4 -4
- package/esm/DynamicSnippetsGenerator.js +2 -1
- package/esm/DynamicSnippetsGenerator.js.map +1 -0
- package/esm/{DynamicSnippetsGeneratorContext-CpOvS1wA.d.ts → DynamicSnippetsGeneratorContext-BusKoNq4.d.ts} +10 -1
- package/esm/EndpointSnippetGenerator.d.ts +15 -4
- package/esm/EndpointSnippetGenerator.js +2 -1
- package/esm/EndpointSnippetGenerator.js.map +1 -0
- package/esm/chunk-2YRGTA73.js +2 -0
- package/esm/chunk-2YRGTA73.js.map +1 -0
- package/esm/chunk-BI26DLZ5.js +2 -0
- package/esm/chunk-BI26DLZ5.js.map +1 -0
- package/esm/chunk-D6NMQKNQ.js +2 -0
- package/esm/chunk-D6NMQKNQ.js.map +1 -0
- package/esm/chunk-FD44EP2P.js +2 -0
- package/esm/chunk-FD44EP2P.js.map +1 -0
- package/esm/chunk-GUJUKQKZ.js +37 -0
- package/esm/chunk-GUJUKQKZ.js.map +1 -0
- package/esm/chunk-Q6YO7G6Y.js +2 -0
- package/esm/chunk-Q6YO7G6Y.js.map +1 -0
- package/esm/chunk-UZEM7EUP.js +2 -0
- package/esm/chunk-UZEM7EUP.js.map +1 -0
- package/esm/chunk-VCNL2JWU.js +2 -0
- package/esm/chunk-VCNL2JWU.js.map +1 -0
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
- package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
- package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
- package/esm/context/DynamicTypeInstantiationMapper.d.ts +1 -1
- package/esm/context/DynamicTypeInstantiationMapper.js +2 -1
- package/esm/context/DynamicTypeInstantiationMapper.js.map +1 -0
- package/esm/context/DynamicTypeMapper.d.ts +1 -1
- package/esm/context/DynamicTypeMapper.js +2 -1
- package/esm/context/DynamicTypeMapper.js.map +1 -0
- package/esm/context/FilePropertyMapper.d.ts +1 -1
- package/esm/context/FilePropertyMapper.js +2 -1
- package/esm/context/FilePropertyMapper.js.map +1 -0
- package/esm/index.d.ts +2 -2
- package/esm/index.js +2 -13
- package/esm/index.js.map +1 -0
- package/package.json +1 -1
- package/esm/chunk-55JFNSPF.js +0 -1
- package/esm/chunk-EQTG6W6V.js +0 -1
- package/esm/chunk-H7X5SHRQ.js +0 -1
- package/esm/chunk-IYOA724T.js +0 -1
- package/esm/chunk-LZIEHSJ7.js +0 -1
- package/esm/chunk-RX5QSNXP.js +0 -1
- package/esm/chunk-SX53R7DQ.js +0 -1
- package/esm/chunk-XL5OWIY6.js +0 -29
package/cjs/index.cjs
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
|
-
"use strict";var pp=Object.create;var Qe=Object.defineProperty,cp=Object.defineProperties,lp=Object.getOwnPropertyDescriptor,fp=Object.getOwnPropertyDescriptors,yp=Object.getOwnPropertyNames,Nt=Object.getOwnPropertySymbols,hp=Object.getPrototypeOf,Or=Object.prototype.hasOwnProperty,ui=Object.prototype.propertyIsEnumerable;var Nr=(r,e,t)=>e in r?Qe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pi=(r,e)=>{for(var t in e||(e={}))Or.call(e,t)&&Nr(r,t,e[t]);if(Nt)for(var t of Nt(e))ui.call(e,t)&&Nr(r,t,e[t]);return r},ci=(r,e)=>cp(r,fp(e));var li=r=>typeof r=="symbol"?r:r+"",fi=(r,e)=>{var t={};for(var n in r)Or.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&Nt)for(var n of Nt(r))e.indexOf(n)<0&&ui.call(r,n)&&(t[n]=r[n]);return t};var Be=(r,e)=>()=>(r&&(e=r(r=0)),e);var d=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ur=(r,e)=>{for(var t in e)Qe(r,t,{get:e[t],enumerable:!0})},yi=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of yp(e))!Or.call(r,i)&&i!==t&&Qe(r,i,{get:()=>e[i],enumerable:!(n=lp(e,i))||n.enumerable});return r};var dp=(r,e,t)=>(t=r!=null?pp(hp(r)):{},yi(e||!r||!r.__esModule?Qe(t,"default",{value:r,enumerable:!0}):t,r)),hi=r=>yi(Qe({},"__esModule",{value:!0}),r);var h=(r,e,t)=>Nr(r,typeof e!="symbol"?e+"":e,t);function mi(){throw new Error("setTimeout has not been defined")}function gi(){throw new Error("clearTimeout has not been defined")}function vi(r){if(ae===setTimeout)return setTimeout(r,0);if((ae===mi||!ae)&&setTimeout)return ae=setTimeout,setTimeout(r,0);try{return ae(r,0)}catch(e){try{return ae.call(null,r,0)}catch(t){return ae.call(this,r,0)}}}function mp(r){if(se===clearTimeout)return clearTimeout(r);if((se===gi||!se)&&clearTimeout)return se=clearTimeout,clearTimeout(r);try{return se(r)}catch(e){try{return se.call(null,r)}catch(t){return se.call(this,r)}}}function gp(){!qe||!ye||(qe=!1,ye.length?X=ye.concat(X):Ot=-1,X.length&&wi())}function wi(){if(!qe){var r=vi(gp);qe=!0;for(var e=X.length;e;){for(ye=X,X=[];++Ot<e;)ye&&ye[Ot].run();Ot=-1,e=X.length}ye=null,qe=!1,mp(r)}}function vp(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];X.push(new xi(r,e)),X.length===1&&!qe&&vi(wi)}function xi(r,e){this.fun=r,this.array=e}function he(){}function qp(r){throw new Error("process.binding is not supported")}function Cp(){return"/"}function _p(r){throw new Error("process.chdir is not supported")}function kp(){return 0}function Dp(r){var e=Mp.call($e)*.001,t=Math.floor(e),n=Math.floor(e%1*1e9);return r&&(t=t-r[0],n=n-r[1],n<0&&(t--,n+=1e9)),[t,n]}function Gp(){var r=new Date,e=r-Lp;return e/1e3}var ae,se,X,qe,ye,Ot,wp,xp,Ap,Tp,bp,Ip,Sp,Ep,Pp,Rp,Fp,Np,Op,Up,Bp,$p,$e,Mp,Lp,l,di,s=Be(()=>{"use strict";ae=mi,se=gi;typeof globalThis.setTimeout=="function"&&(ae=setTimeout);typeof globalThis.clearTimeout=="function"&&(se=clearTimeout);X=[],qe=!1,Ot=-1;xi.prototype.run=function(){this.fun.apply(null,this.array)};wp="browser",xp="browser",Ap=!0,Tp={},bp=[],Ip="",Sp={},Ep={},Pp={};Rp=he,Fp=he,Np=he,Op=he,Up=he,Bp=he,$p=he;$e=globalThis.performance||{},Mp=$e.now||$e.mozNow||$e.msNow||$e.oNow||$e.webkitNow||function(){return new Date().getTime()};Lp=new Date;l={nextTick:vp,title:wp,browser:Ap,env:Tp,argv:bp,version:Ip,versions:Sp,on:Rp,addListener:Fp,once:Np,off:Op,removeListener:Up,removeAllListeners:Bp,emit:$p,binding:qp,cwd:Cp,chdir:_p,umask:kp,hrtime:Dp,platform:xp,release:Ep,config:Pp,uptime:Gp},di={};Object.keys(di).forEach(r=>{let e=r.split("."),t=l;for(let n=0;n<e.length;n++){let i=e[n];n===e.length-1?t[i]=di[r]:t=t[i]||(t[i]={})}})});function Ii(){$r=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)G[e]=r[e],_[r.charCodeAt(e)]=e;_[45]=62,_[95]=63}function Vp(r){$r||Ii();var e,t,n,i,o,a,c=r.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=r[c-2]==="="?2:r[c-1]==="="?1:0,a=new Wp(c*3/4-o),n=o>0?c-4:c;var f=0;for(e=0,t=0;e<n;e+=4,t+=3)i=_[r.charCodeAt(e)]<<18|_[r.charCodeAt(e+1)]<<12|_[r.charCodeAt(e+2)]<<6|_[r.charCodeAt(e+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=i&255;return o===2?(i=_[r.charCodeAt(e)]<<2|_[r.charCodeAt(e+1)]>>4,a[f++]=i&255):o===1&&(i=_[r.charCodeAt(e)]<<10|_[r.charCodeAt(e+1)]<<4|_[r.charCodeAt(e+2)]>>2,a[f++]=i>>8&255,a[f++]=i&255),a}function jp(r){return G[r>>18&63]+G[r>>12&63]+G[r>>6&63]+G[r&63]}function Yp(r,e,t){for(var n,i=[],o=e;o<t;o+=3)n=(r[o]<<16)+(r[o+1]<<8)+r[o+2],i.push(jp(n));return i.join("")}function Ai(r){$r||Ii();for(var e,t=r.length,n=t%3,i="",o=[],a=16383,c=0,f=t-n;c<f;c+=a)o.push(Yp(r,c,c+a>f?f:c+a));return n===1?(e=r[t-1],i+=G[e>>2],i+=G[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=G[e>>10],i+=G[e>>4&63],i+=G[e<<2&63],i+="="),o.push(i),o.join("")}function Ut(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Z(r,e){if(Ut()<e)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=p.prototype):(r===null&&(r=new p(e)),r.length=e),r}function p(r,e,t){if(!p.TYPED_ARRAY_SUPPORT&&!(this instanceof p))return new p(r,e,t);if(typeof r=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return qr(this,r)}return Si(this,r,e,t)}function Si(r,e,t,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&e instanceof ArrayBuffer?Jp(r,e,t,n):typeof e=="string"?Hp(r,e,t):Kp(r,e)}function Ei(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 zp(r,e,t,n){return Ei(e),e<=0?Z(r,e):t!==void 0?typeof n=="string"?Z(r,e).fill(t,n):Z(r,e).fill(t):Z(r,e)}function qr(r,e){if(Ei(e),r=Z(r,e<0?0:Cr(e)|0),!p.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)r[t]=0;return r}function Hp(r,e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!p.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=Pi(e,t)|0;r=Z(r,n);var i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function Br(r,e){var t=e.length<0?0:Cr(e.length)|0;r=Z(r,t);for(var n=0;n<t;n+=1)r[n]=e[n]&255;return r}function Jp(r,e,t,n){if(e.byteLength,t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(n||0))throw new RangeError("'length' is out of bounds");return t===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,t):e=new Uint8Array(e,t,n),p.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=p.prototype):r=Br(r,e),r}function Kp(r,e){if(W(e)){var t=Cr(e.length)|0;return r=Z(r,t),r.length===0||e.copy(r,0,0,t),r}if(e){if(typeof ArrayBuffer!="undefined"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||dc(e.length)?Z(r,0):Br(r,e);if(e.type==="Buffer"&&Array.isArray(e.data))return Br(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Cr(r){if(r>=Ut())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ut().toString(16)+" bytes");return r|0}function W(r){return!!(r!=null&&r._isBuffer)}function Pi(r,e){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 t=r.length;if(t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return Bt(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return $i(r).length;default:if(n)return Bt(r).length;e=(""+e).toLowerCase(),n=!0}}function Qp(r,e,t){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return sc(this,e,t);case"utf8":case"utf-8":return Ni(this,e,t);case"ascii":return oc(this,e,t);case"latin1":case"binary":return ac(this,e,t);case"base64":return nc(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return uc(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function de(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}function Ri(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=p.from(e,n)),W(e))return e.length===0?-1:Ti(r,e,t,n,i);if(typeof e=="number")return e=e&255,p.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Ti(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Ti(r,e,t,n,i){var o=1,a=r.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,a/=2,c/=2,t/=2}function f(x,I){return o===1?x[I]:x.readUInt16BE(I*o)}var v;if(i){var g=-1;for(v=t;v<a;v++)if(f(r,v)===f(e,g===-1?0:v-g)){if(g===-1&&(g=v),v-g+1===c)return g*o}else g!==-1&&(v-=v-g),g=-1}else for(t+c>a&&(t=a-c),v=t;v>=0;v--){for(var m=!0,w=0;w<c;w++)if(f(r,v+w)!==f(e,w)){m=!1;break}if(m)return v}return-1}function Xp(r,e,t,n){t=Number(t)||0;var i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var c=parseInt(e.substr(a*2,2),16);if(isNaN(c))return a;r[t+a]=c}return a}function Zp(r,e,t,n){return Ct(Bt(e,r.length-t),r,t,n)}function Fi(r,e,t,n){return Ct(yc(e),r,t,n)}function ec(r,e,t,n){return Fi(r,e,t,n)}function tc(r,e,t,n){return Ct($i(e),r,t,n)}function rc(r,e,t,n){return Ct(hc(e,r.length-t),r,t,n)}function nc(r,e,t){return e===0&&t===r.length?Ai(r):Ai(r.slice(e,t))}function Ni(r,e,t){t=Math.min(r.length,t);for(var n=[],i=e;i<t;){var o=r[i],a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=t){var f,v,g,m;switch(c){case 1:o<128&&(a=o);break;case 2:f=r[i+1],(f&192)===128&&(m=(o&31)<<6|f&63,m>127&&(a=m));break;case 3:f=r[i+1],v=r[i+2],(f&192)===128&&(v&192)===128&&(m=(o&15)<<12|(f&63)<<6|v&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:f=r[i+1],v=r[i+2],g=r[i+3],(f&192)===128&&(v&192)===128&&(g&192)===128&&(m=(o&15)<<18|(f&63)<<12|(v&63)<<6|g&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=c}return ic(n)}function ic(r){var e=r.length;if(e<=bi)return String.fromCharCode.apply(String,r);for(var t="",n=0;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=bi));return t}function oc(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function ac(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function sc(r,e,t){var n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);for(var i="",o=e;o<t;++o)i+=fc(r[o]);return i}function uc(r,e,t){for(var n=r.slice(e,t),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}function F(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}function $(r,e,t,n,i,o){if(!W(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}function $t(r,e,t,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(r.length-t,2);i<o;++i)r[t+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function qt(r,e,t,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(r.length-t,4);i<o;++i)r[t+i]=e>>>(n?i:3-i)*8&255}function Oi(r,e,t,n,i,o){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ui(r,e,t,n,i){return i||Oi(r,e,t,4,34028234663852886e22,-34028234663852886e22),Ci(r,e,t,n,23,4),t+4}function Bi(r,e,t,n,i){return i||Oi(r,e,t,8,17976931348623157e292,-17976931348623157e292),Ci(r,e,t,n,52,8),t+8}function cc(r){if(r=lc(r).replace(pc,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function lc(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function fc(r){return r<16?"0"+r.toString(16):r.toString(16)}function Bt(r,e){e=e||1/0;for(var t,n=r.length,i=null,o=[],a=0;a<n;++a){if(t=r.charCodeAt(a),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function yc(r){for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function hc(r,e){for(var t,n,i,o=[],a=0;a<r.length&&!((e-=2)<0);++a)t=r.charCodeAt(a),n=t>>8,i=t%256,o.push(i),o.push(n);return o}function $i(r){return Vp(cc(r))}function Ct(r,e,t,n){for(var i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function dc(r){return r!==r}function mc(r){return r!=null&&(!!r._isBuffer||qi(r)||gc(r))}function qi(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function gc(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&qi(r.slice(0,0))}function _t(r,e,t,n,i){var o,a,c=i*8-n-1,f=(1<<c)-1,v=f>>1,g=-7,m=t?i-1:0,w=t?-1:1,x=r[e+m];for(m+=w,o=x&(1<<-g)-1,x>>=-g,g+=c;g>0;o=o*256+r[e+m],m+=w,g-=8);for(a=o&(1<<-g)-1,o>>=-g,g+=n;g>0;a=a*256+r[e+m],m+=w,g-=8);if(o===0)o=1-v;else{if(o===f)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-v}return(x?-1:1)*a*Math.pow(2,o-n)}function Ci(r,e,t,n,i,o){var a,c,f,v=o*8-i-1,g=(1<<v)-1,m=g>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,I=n?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,a=g):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+m>=1?e+=w/f:e+=w*Math.pow(2,1-m),e*f>=2&&(a++,f/=2),a+m>=g?(c=0,a=g):a+m>=1?(c=(e*f-1)*Math.pow(2,i),a=a+m):(c=e*Math.pow(2,m-1)*Math.pow(2,i),a=0));i>=8;r[t+x]=c&255,x+=I,c/=256,i-=8);for(a=a<<i|c,v+=i;v>0;r[t+x]=a&255,x+=I,a/=256,v-=8);r[t+x-I]|=P*128}var G,_,Wp,$r,bi,pc,_i=Be(()=>{"use strict";s();u();G=[],_=[],Wp=typeof Uint8Array!="undefined"?Uint8Array:Array,$r=!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,e,t){return Si(null,r,e,t)};p.kMaxLength=Ut();p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&p[Symbol.species]);p.alloc=function(r,e,t){return zp(null,r,e,t)};p.allocUnsafe=function(r){return qr(null,r)};p.allocUnsafeSlow=function(r){return qr(null,r)};p.isBuffer=mc;p.compare=function(e,t){if(!W(e)||!W(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,o=0,a=Math.min(n,i);o<a;++o)if(e[o]!==t[o]){n=e[o],i=t[o];break}return n<i?-1:i<n?1:0};p.isEncoding=function(e){switch(String(e).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(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=p.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var a=e[n];if(!W(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};p.byteLength=Pi;p.prototype._isBuffer=!0;p.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)de(this,t,t+1);return this};p.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)de(this,t,t+3),de(this,t+1,t+2);return this};p.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)de(this,t,t+7),de(this,t+1,t+6),de(this,t+2,t+5),de(this,t+3,t+4);return this};p.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?Ni(this,0,e):Qp.apply(this,arguments)};p.prototype.equals=function(e){if(!W(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0};p.prototype.compare=function(e,t,n,i,o){if(!W(e))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),t<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var a=o-i,c=n-t,f=Math.min(a,c),v=this.slice(i,o),g=e.slice(t,n),m=0;m<f;++m)if(v[m]!==g[m]){a=v[m],c=g[m];break}return a<c?-1:c<a?1:0};p.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};p.prototype.indexOf=function(e,t,n){return Ri(this,e,t,n,!0)};p.prototype.lastIndexOf=function(e,t,n){return Ri(this,e,t,n,!1)};p.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t|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-t;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Xp(this,e,t,n);case"utf8":case"utf-8":return Zp(this,e,t,n);case"ascii":return Fi(this,e,t,n);case"latin1":case"binary":return ec(this,e,t,n);case"base64":return tc(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rc(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};bi=4096;p.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var i;if(p.TYPED_ARRAY_SUPPORT)i=this.subarray(e,t),i.__proto__=p.prototype;else{var o=t-e;i=new p(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+e]}return i};p.prototype.readUIntLE=function(e,t,n){e=e|0,t=t|0,n||F(e,t,this.length);for(var i=this[e],o=1,a=0;++a<t&&(o*=256);)i+=this[e+a]*o;return i};p.prototype.readUIntBE=function(e,t,n){e=e|0,t=t|0,n||F(e,t,this.length);for(var i=this[e+--t],o=1;t>0&&(o*=256);)i+=this[e+--t]*o;return i};p.prototype.readUInt8=function(e,t){return t||F(e,1,this.length),this[e]};p.prototype.readUInt16LE=function(e,t){return t||F(e,2,this.length),this[e]|this[e+1]<<8};p.prototype.readUInt16BE=function(e,t){return t||F(e,2,this.length),this[e]<<8|this[e+1]};p.prototype.readUInt32LE=function(e,t){return t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};p.prototype.readUInt32BE=function(e,t){return t||F(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};p.prototype.readIntLE=function(e,t,n){e=e|0,t=t|0,n||F(e,t,this.length);for(var i=this[e],o=1,a=0;++a<t&&(o*=256);)i+=this[e+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i};p.prototype.readIntBE=function(e,t,n){e=e|0,t=t|0,n||F(e,t,this.length);for(var i=t,o=1,a=this[e+--i];i>0&&(o*=256);)a+=this[e+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*t)),a};p.prototype.readInt8=function(e,t){return t||F(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};p.prototype.readInt16LE=function(e,t){t||F(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(e,t){t||F(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(e,t){return t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};p.prototype.readInt32BE=function(e,t){return t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};p.prototype.readFloatLE=function(e,t){return t||F(e,4,this.length),_t(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,t){return t||F(e,4,this.length),_t(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,t){return t||F(e,8,this.length),_t(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,t){return t||F(e,8,this.length),_t(this,e,!1,52,8)};p.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;$(this,e,t,n,o,0)}var a=1,c=0;for(this[t]=e&255;++c<n&&(a*=256);)this[t+c]=e/a&255;return t+n};p.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;$(this,e,t,n,o,0)}var a=n-1,c=1;for(this[t+a]=e&255;--a>=0&&(c*=256);)this[t+a]=e/c&255;return t+n};p.prototype.writeUInt8=function(e,t,n){return e=+e,t=t|0,n||$(this,e,t,1,255,0),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};p.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t|0,n||$(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):$t(this,e,t,!0),t+2};p.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t|0,n||$(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):$t(this,e,t,!1),t+2};p.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t|0,n||$(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):qt(this,e,t,!0),t+4};p.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t|0,n||$(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):qt(this,e,t,!1),t+4};p.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t|0,!i){var o=Math.pow(2,8*n-1);$(this,e,t,n,o-1,-o)}var a=0,c=1,f=0;for(this[t]=e&255;++a<n&&(c*=256);)e<0&&f===0&&this[t+a-1]!==0&&(f=1),this[t+a]=(e/c>>0)-f&255;return t+n};p.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t|0,!i){var o=Math.pow(2,8*n-1);$(this,e,t,n,o-1,-o)}var a=n-1,c=1,f=0;for(this[t+a]=e&255;--a>=0&&(c*=256);)e<0&&f===0&&this[t+a+1]!==0&&(f=1),this[t+a]=(e/c>>0)-f&255;return t+n};p.prototype.writeInt8=function(e,t,n){return e=+e,t=t|0,n||$(this,e,t,1,127,-128),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1};p.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t|0,n||$(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):$t(this,e,t,!0),t+2};p.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t|0,n||$(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):$t(this,e,t,!1),t+2};p.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t|0,n||$(this,e,t,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):qt(this,e,t,!0),t+4};p.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t|0,n||$(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):qt(this,e,t,!1),t+4};p.prototype.writeFloatLE=function(e,t,n){return Ui(this,e,t,!0,n)};p.prototype.writeFloatBE=function(e,t,n){return Ui(this,e,t,!1,n)};p.prototype.writeDoubleLE=function(e,t,n){return Bi(this,e,t,!0,n)};p.prototype.writeDoubleBE=function(e,t,n){return Bi(this,e,t,!1,n)};p.prototype.copy=function(e,t,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<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),e.length-t<i-n&&(i=e.length-t+n);var o=i-n,a;if(this===e&&n<t&&t<i)for(a=o-1;a>=0;--a)e[a+t]=this[a+n];else if(o<1e3||!p.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)e[a+t]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o};p.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),e.length===1){var o=e.charCodeAt(0);o<256&&(e=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 e=="number"&&(e=e&255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if(typeof e=="number")for(a=t;a<n;++a)this[a]=e;else{var c=W(e)?e:Bt(new p(e,i).toString()),f=c.length;for(a=0;a<n-t;++a)this[a+t]=c[a%f]}return this};pc=/[^+\/0-9A-Za-z-_]/g});var u=Be(()=>{"use strict";_i()});var Di=d((Wd,Mi)=>{"use strict";s();u();var vc="Function.prototype.bind called on incompatible ",wc=Object.prototype.toString,xc=Math.max,Ac="[object Function]",ki=function(e,t){for(var n=[],i=0;i<e.length;i+=1)n[i]=e[i];for(var o=0;o<t.length;o+=1)n[o+e.length]=t[o];return n},Tc=function(e,t){for(var n=[],i=t||0,o=0;i<e.length;i+=1,o+=1)n[o]=e[i];return n},bc=function(r,e){for(var t="",n=0;n<r.length;n+=1)t+=r[n],n+1<r.length&&(t+=e);return t};Mi.exports=function(e){var t=this;if(typeof t!="function"||wc.apply(t)!==Ac)throw new TypeError(vc+t);for(var n=Tc(arguments,1),i,o=function(){if(this instanceof i){var g=t.apply(this,ki(n,arguments));return Object(g)===g?g:this}return t.apply(e,ki(n,arguments))},a=xc(0,t.length-n.length),c=[],f=0;f<a;f++)c[f]="$"+f;if(i=Function("binder","return function ("+bc(c,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var v=function(){};v.prototype=t.prototype,i.prototype=new v,v.prototype=null}return i}});var me=d((Yd,Li)=>{"use strict";s();u();var Ic=Di();Li.exports=Function.prototype.bind||Ic});var _r=d((Jd,Gi)=>{"use strict";s();u();Gi.exports=Error});var kr=d((Xd,Wi)=>{"use strict";s();u();Wi.exports=EvalError});var Mr=d((tm,Vi)=>{"use strict";s();u();Vi.exports=RangeError});var Dr=d((im,ji)=>{"use strict";s();u();ji.exports=ReferenceError});var kt=d((sm,Yi)=>{"use strict";s();u();Yi.exports=SyntaxError});var R=d((cm,zi)=>{"use strict";s();u();zi.exports=TypeError});var Lr=d((ym,Hi)=>{"use strict";s();u();Hi.exports=URIError});var Ki=d((mm,Ji)=>{"use strict";s();u();Ji.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==i||a.enumerable!==!0)return!1}return!0}});var Gr=d((wm,Xi)=>{"use strict";s();u();var Qi=typeof Symbol!="undefined"&&Symbol,Sc=Ki();Xi.exports=function(){return typeof Qi!="function"||typeof Symbol!="function"||typeof Qi("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Sc()}});var eo=d((Tm,Zi)=>{"use strict";s();u();var Wr={__proto__:null,foo:{}},Ec=Object;Zi.exports=function(){return{__proto__:Wr}.foo===Wr.foo&&!(Wr instanceof Ec)}});var Vr=d((Sm,to)=>{"use strict";s();u();var Pc=Function.prototype.call,Rc=Object.prototype.hasOwnProperty,Fc=me();to.exports=Fc.call(Pc,Rc)});var V=d((Rm,ao)=>{"use strict";s();u();var A,Nc=_r(),Oc=kr(),Uc=Mr(),Bc=Dr(),Me=kt(),ke=R(),$c=Lr(),oo=Function,jr=function(r){try{return oo('"use strict"; return ('+r+").constructor;")()}catch(e){}},ge=Object.getOwnPropertyDescriptor;if(ge)try{ge({},"")}catch(r){ge=null}var Yr=function(){throw new ke},qc=ge?function(){try{return arguments.callee,Yr}catch(r){try{return ge(arguments,"callee").get}catch(e){return Yr}}}():Yr,Ce=Gr()(),Cc=eo()(),N=Object.getPrototypeOf||(Cc?function(r){return r.__proto__}:null),_e={},_c=typeof Uint8Array=="undefined"||!N?A:N(Uint8Array),ve={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?A:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?A:ArrayBuffer,"%ArrayIteratorPrototype%":Ce&&N?N([][Symbol.iterator]()):A,"%AsyncFromSyncIteratorPrototype%":A,"%AsyncFunction%":_e,"%AsyncGenerator%":_e,"%AsyncGeneratorFunction%":_e,"%AsyncIteratorPrototype%":_e,"%Atomics%":typeof Atomics=="undefined"?A:Atomics,"%BigInt%":typeof BigInt=="undefined"?A:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?A:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?A:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?A:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Nc,"%eval%":eval,"%EvalError%":Oc,"%Float32Array%":typeof Float32Array=="undefined"?A:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?A:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?A:FinalizationRegistry,"%Function%":oo,"%GeneratorFunction%":_e,"%Int8Array%":typeof Int8Array=="undefined"?A:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?A:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?A:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ce&&N?N(N([][Symbol.iterator]())):A,"%JSON%":typeof JSON=="object"?JSON:A,"%Map%":typeof Map=="undefined"?A:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Ce||!N?A:N(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?A:Promise,"%Proxy%":typeof Proxy=="undefined"?A:Proxy,"%RangeError%":Uc,"%ReferenceError%":Bc,"%Reflect%":typeof Reflect=="undefined"?A:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?A:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Ce||!N?A:N(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?A:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ce&&N?N(""[Symbol.iterator]()):A,"%Symbol%":Ce?Symbol:A,"%SyntaxError%":Me,"%ThrowTypeError%":qc,"%TypedArray%":_c,"%TypeError%":ke,"%Uint8Array%":typeof Uint8Array=="undefined"?A:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?A:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?A:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?A:Uint32Array,"%URIError%":$c,"%WeakMap%":typeof WeakMap=="undefined"?A:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?A:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?A:WeakSet};if(N)try{null.error}catch(r){ro=N(N(r)),ve["%Error.prototype%"]=ro}var ro,kc=function r(e){var t;if(e==="%AsyncFunction%")t=jr("async function () {}");else if(e==="%GeneratorFunction%")t=jr("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=jr("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&N&&(t=N(i.prototype))}return ve[e]=t,t},no={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Xe=me(),Mt=Vr(),Mc=Xe.call(Function.call,Array.prototype.concat),Dc=Xe.call(Function.apply,Array.prototype.splice),io=Xe.call(Function.call,String.prototype.replace),Dt=Xe.call(Function.call,String.prototype.slice),Lc=Xe.call(Function.call,RegExp.prototype.exec),Gc=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Wc=/\\(\\)?/g,Vc=function(e){var t=Dt(e,0,1),n=Dt(e,-1);if(t==="%"&&n!=="%")throw new Me("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Me("invalid intrinsic syntax, expected opening `%`");var i=[];return io(e,Gc,function(o,a,c,f){i[i.length]=c?io(f,Wc,"$1"):a||o}),i},jc=function(e,t){var n=e,i;if(Mt(no,n)&&(i=no[n],n="%"+i[0]+"%"),Mt(ve,n)){var o=ve[n];if(o===_e&&(o=kc(n)),typeof o=="undefined"&&!t)throw new ke("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:o}}throw new Me("intrinsic "+e+" does not exist!")};ao.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new ke("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new ke('"allowMissing" argument must be a boolean');if(Lc(/^%?[^%]*%?$/,e)===null)throw new Me("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Vc(e),i=n.length>0?n[0]:"",o=jc("%"+i+"%",t),a=o.name,c=o.value,f=!1,v=o.alias;v&&(i=v[0],Dc(n,Mc([0,1],v)));for(var g=1,m=!0;g<n.length;g+=1){var w=n[g],x=Dt(w,0,1),I=Dt(w,-1);if((x==='"'||x==="'"||x==="`"||I==='"'||I==="'"||I==="`")&&x!==I)throw new Me("property names with quotes must have matching quotes");if((w==="constructor"||!m)&&(f=!0),i+="."+w,a="%"+i+"%",Mt(ve,a))c=ve[a];else if(c!=null){if(!(w in c)){if(!t)throw new ke("base intrinsic for "+e+" exists, but the property is not available.");return}if(ge&&g+1>=n.length){var P=ge(c,w);m=!!P,m&&"get"in P&&!("originalValue"in P.get)?c=P.get:c=c[w]}else m=Mt(c,w),c=c[w];m&&!f&&(ve[a]=c)}}return c}});var zr=d((Om,so)=>{"use strict";s();u();so.exports=Object});var po=d(($m,uo)=>{"use strict";s();u();uo.exports=Math.abs});var lo=d((_m,co)=>{"use strict";s();u();co.exports=Math.floor});var yo=d((Dm,fo)=>{"use strict";s();u();fo.exports=Math.max});var mo=d((Wm,ho)=>{"use strict";s();u();ho.exports=Math.min});var vo=d((Ym,go)=>{"use strict";s();u();go.exports=Math.pow});var xo=d((Jm,wo)=>{"use strict";s();u();wo.exports=Math.round});var To=d((Xm,Ao)=>{"use strict";s();u();Ao.exports=Number.isNaN||function(e){return e!==e}});var Io=d((tg,bo)=>{"use strict";s();u();var Yc=To();bo.exports=function(e){return Yc(e)||e===0?e:e<0?-1:1}});var Eo=d((ig,So)=>{"use strict";s();u();So.exports=Object.getOwnPropertyDescriptor});var Ze=d((sg,Po)=>{"use strict";s();u();var Lt=Eo();if(Lt)try{Lt([],"length")}catch(r){Lt=null}Po.exports=Lt});var Wt=d((cg,Ro)=>{"use strict";s();u();var Gt=Object.defineProperty||!1;if(Gt)try{Gt({},"a",{value:1})}catch(r){Gt=!1}Ro.exports=Gt});var Hr=d((yg,Fo)=>{"use strict";s();u();Fo.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(e,t);if(c.value!==i||c.enumerable!==!0)return!1}return!0}});var Uo=d((mg,Oo)=>{"use strict";s();u();var No=typeof Symbol!="undefined"&&Symbol,zc=Hr();Oo.exports=function(){return typeof No!="function"||typeof Symbol!="function"||typeof No("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:zc()}});var Jr=d((wg,Bo)=>{"use strict";s();u();Bo.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var Kr=d((Tg,$o)=>{"use strict";s();u();var Hc=zr();$o.exports=Hc.getPrototypeOf||null});var Vt=d((Sg,qo)=>{"use strict";s();u();qo.exports=Function.prototype.call});var Qr=d((Rg,Co)=>{"use strict";s();u();Co.exports=Function.prototype.apply});var ko=d((Og,_o)=>{"use strict";s();u();_o.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var Do=d(($g,Mo)=>{"use strict";s();u();var Jc=me(),Kc=Qr(),Qc=Vt(),Xc=ko();Mo.exports=Xc||Jc.call(Qc,Kc)});var Go=d((_g,Lo)=>{"use strict";s();u();var Zc=me(),el=R(),tl=Vt(),rl=Do();Lo.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new el("a function is required");return rl(Zc,tl,e)}});var Ho=d((Dg,zo)=>{"use strict";s();u();var nl=Go(),Wo=Ze(),jo;try{jo=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var Xr=!!jo&&Wo&&Wo(Object.prototype,"__proto__"),Yo=Object,Vo=Yo.getPrototypeOf;zo.exports=Xr&&typeof Xr.get=="function"?nl([Xr.get]):typeof Vo=="function"?function(e){return Vo(e==null?e:Yo(e))}:!1});var Zo=d((Wg,Xo)=>{"use strict";s();u();var Jo=Jr(),Ko=Kr(),Qo=Ho();Xo.exports=Jo?function(e){return Jo(e)}:Ko?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Ko(e)}:Qo?function(e){return Qo(e)}:null});var tn=d((Yg,oa)=>{"use strict";s();u();var T,il=zr(),ol=_r(),al=kr(),sl=Mr(),ul=Dr(),We=kt(),Ge=R(),pl=Lr(),cl=po(),ll=lo(),fl=yo(),yl=mo(),hl=vo(),dl=xo(),ml=Io(),na=Function,Zr=function(r){try{return na('"use strict"; return ('+r+").constructor;")()}catch(e){}},et=Ze(),gl=Wt(),en=function(){throw new Ge},vl=et?function(){try{return arguments.callee,en}catch(r){try{return et(arguments,"callee").get}catch(e){return en}}}():en,De=Uo()(),O=Zo(),wl=Kr(),xl=Jr(),ia=Qr(),tt=Vt(),Le={},Al=typeof Uint8Array=="undefined"||!O?T:O(Uint8Array),we={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?T:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?T:ArrayBuffer,"%ArrayIteratorPrototype%":De&&O?O([][Symbol.iterator]()):T,"%AsyncFromSyncIteratorPrototype%":T,"%AsyncFunction%":Le,"%AsyncGenerator%":Le,"%AsyncGeneratorFunction%":Le,"%AsyncIteratorPrototype%":Le,"%Atomics%":typeof Atomics=="undefined"?T:Atomics,"%BigInt%":typeof BigInt=="undefined"?T:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?T:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?T:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?T:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":ol,"%eval%":eval,"%EvalError%":al,"%Float32Array%":typeof Float32Array=="undefined"?T:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?T:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?T:FinalizationRegistry,"%Function%":na,"%GeneratorFunction%":Le,"%Int8Array%":typeof Int8Array=="undefined"?T:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?T:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?T:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":De&&O?O(O([][Symbol.iterator]())):T,"%JSON%":typeof JSON=="object"?JSON:T,"%Map%":typeof Map=="undefined"?T:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!De||!O?T:O(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":il,"%Object.getOwnPropertyDescriptor%":et,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?T:Promise,"%Proxy%":typeof Proxy=="undefined"?T:Proxy,"%RangeError%":sl,"%ReferenceError%":ul,"%Reflect%":typeof Reflect=="undefined"?T:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?T:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!De||!O?T:O(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?T:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":De&&O?O(""[Symbol.iterator]()):T,"%Symbol%":De?Symbol:T,"%SyntaxError%":We,"%ThrowTypeError%":vl,"%TypedArray%":Al,"%TypeError%":Ge,"%Uint8Array%":typeof Uint8Array=="undefined"?T:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?T:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?T:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?T:Uint32Array,"%URIError%":pl,"%WeakMap%":typeof WeakMap=="undefined"?T:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?T:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?T:WeakSet,"%Function.prototype.call%":tt,"%Function.prototype.apply%":ia,"%Object.defineProperty%":gl,"%Object.getPrototypeOf%":wl,"%Math.abs%":cl,"%Math.floor%":ll,"%Math.max%":fl,"%Math.min%":yl,"%Math.pow%":hl,"%Math.round%":dl,"%Math.sign%":ml,"%Reflect.getPrototypeOf%":xl};if(O)try{null.error}catch(r){ea=O(O(r)),we["%Error.prototype%"]=ea}var ea,Tl=function r(e){var t;if(e==="%AsyncFunction%")t=Zr("async function () {}");else if(e==="%GeneratorFunction%")t=Zr("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Zr("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&O&&(t=O(i.prototype))}return we[e]=t,t},ta={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},rt=me(),jt=Vr(),bl=rt.call(tt,Array.prototype.concat),Il=rt.call(ia,Array.prototype.splice),ra=rt.call(tt,String.prototype.replace),Yt=rt.call(tt,String.prototype.slice),Sl=rt.call(tt,RegExp.prototype.exec),El=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Pl=/\\(\\)?/g,Rl=function(e){var t=Yt(e,0,1),n=Yt(e,-1);if(t==="%"&&n!=="%")throw new We("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new We("invalid intrinsic syntax, expected opening `%`");var i=[];return ra(e,El,function(o,a,c,f){i[i.length]=c?ra(f,Pl,"$1"):a||o}),i},Fl=function(e,t){var n=e,i;if(jt(ta,n)&&(i=ta[n],n="%"+i[0]+"%"),jt(we,n)){var o=we[n];if(o===Le&&(o=Tl(n)),typeof o=="undefined"&&!t)throw new Ge("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:o}}throw new We("intrinsic "+e+" does not exist!")};oa.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Ge("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Ge('"allowMissing" argument must be a boolean');if(Sl(/^%?[^%]*%?$/,e)===null)throw new We("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Rl(e),i=n.length>0?n[0]:"",o=Fl("%"+i+"%",t),a=o.name,c=o.value,f=!1,v=o.alias;v&&(i=v[0],Il(n,bl([0,1],v)));for(var g=1,m=!0;g<n.length;g+=1){var w=n[g],x=Yt(w,0,1),I=Yt(w,-1);if((x==='"'||x==="'"||x==="`"||I==='"'||I==="'"||I==="`")&&x!==I)throw new We("property names with quotes must have matching quotes");if((w==="constructor"||!m)&&(f=!0),i+="."+w,a="%"+i+"%",jt(we,a))c=we[a];else if(c!=null){if(!(w in c)){if(!t)throw new Ge("base intrinsic for "+e+" exists, but the property is not available.");return}if(et&&g+1>=n.length){var P=et(c,w);m=!!P,m&&"get"in P&&!("originalValue"in P.get)?c=P.get:c=c[w]}else m=jt(c,w),c=c[w];m&&!f&&(we[a]=c)}}return c}});var rn=d((Jg,ua)=>{"use strict";s();u();var aa=Wt(),Nl=kt(),Ve=R(),sa=Ze();ua.exports=function(e,t,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Ve("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new Ve("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ve("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ve("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ve("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ve("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,c=arguments.length>6?arguments[6]:!1,f=!!sa&&sa(e,t);if(aa)aa(e,t,{configurable:a===null&&f?f.configurable:!a,enumerable:i===null&&f?f.enumerable:!i,value:n,writable:o===null&&f?f.writable:!o});else if(c||!i&&!o&&!a)e[t]=n;else throw new Nl("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var on=d((Xg,ca)=>{"use strict";s();u();var nn=Wt(),pa=function(){return!!nn};pa.hasArrayLengthDefineBug=function(){if(!nn)return null;try{return nn([],"length",{value:1}).length!==1}catch(e){return!0}};ca.exports=pa});var da=d((tv,ha)=>{"use strict";s();u();var Ol=tn(),la=rn(),Ul=on()(),fa=Ze(),ya=R(),Bl=Ol("%Math.floor%");ha.exports=function(e,t){if(typeof e!="function")throw new ya("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Bl(t)!==t)throw new ya("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&fa){var a=fa(e,"length");a&&!a.configurable&&(i=!1),a&&!a.writable&&(o=!1)}return(i||o||!n)&&(Ul?la(e,"length",t,!0,!0):la(e,"length",t)),e}});var ga=d((iv,ma)=>{"use strict";s();u();var $l=tn(),zt=$l("%Object.defineProperty%",!0)||!1;if(zt)try{zt({},"a",{value:1})}catch(r){zt=!1}ma.exports=zt});var Kt=d((sv,Ht)=>{"use strict";s();u();var an=me(),Jt=V(),ql=da(),Cl=R(),xa=Jt("%Function.prototype.apply%"),Aa=Jt("%Function.prototype.call%"),Ta=Jt("%Reflect.apply%",!0)||an.call(Aa,xa),va=ga(),_l=Jt("%Math.max%");Ht.exports=function(e){if(typeof e!="function")throw new Cl("a function is required");var t=Ta(an,Aa,arguments);return ql(t,1+_l(0,e.length-(arguments.length-1)),!0)};var wa=function(){return Ta(an,xa,arguments)};va?va(Ht.exports,"apply",{value:wa}):Ht.exports.apply=wa});var sn=d((cv,Ia)=>{"use strict";s();u();var ba=Object.prototype.toString;Ia.exports=function(e){var t=ba.call(e),n=t==="[object Arguments]";return n||(n=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&ba.call(e.callee)==="[object Function]"),n}});var Ba=d((yv,Ua)=>{"use strict";s();u();var Oa;Object.keys||(nt=Object.prototype.hasOwnProperty,un=Object.prototype.toString,Sa=sn(),pn=Object.prototype.propertyIsEnumerable,Ea=!pn.call({toString:null},"toString"),Pa=pn.call(function(){},"prototype"),it=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Qt=function(r){var e=r.constructor;return e&&e.prototype===r},Ra={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},Fa=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Ra["$"+r]&&nt.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Qt(window[r])}catch(e){return!0}}catch(e){return!0}return!1}(),Na=function(r){if(typeof window=="undefined"||!Fa)return Qt(r);try{return Qt(r)}catch(e){return!1}},Oa=function(e){var t=e!==null&&typeof e=="object",n=un.call(e)==="[object Function]",i=Sa(e),o=t&&un.call(e)==="[object String]",a=[];if(!t&&!n&&!i)throw new TypeError("Object.keys called on a non-object");var c=Pa&&n;if(o&&e.length>0&&!nt.call(e,0))for(var f=0;f<e.length;++f)a.push(String(f));if(i&&e.length>0)for(var v=0;v<e.length;++v)a.push(String(v));else for(var g in e)!(c&&g==="prototype")&&nt.call(e,g)&&a.push(String(g));if(Ea)for(var m=Na(e),w=0;w<it.length;++w)!(m&&it[w]==="constructor")&&nt.call(e,it[w])&&a.push(it[w]);return a});var nt,un,Sa,pn,Ea,Pa,it,Qt,Ra,Fa,Na;Ua.exports=Oa});var _a=d((mv,Ca)=>{"use strict";s();u();var kl=Array.prototype.slice,Ml=sn(),$a=Object.keys,Xt=$a?function(e){return $a(e)}:Ba(),qa=Object.keys;Xt.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(n){return Ml(n)?qa(kl.call(n)):qa(n)})}else Object.keys=Xt;return Object.keys||Xt};Ca.exports=Xt});var ot=d((wv,La)=>{"use strict";s();u();var Dl=_a(),Ll=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Gl=Object.prototype.toString,Wl=Array.prototype.concat,ka=rn(),Vl=function(r){return typeof r=="function"&&Gl.call(r)==="[object Function]"},Ma=on()(),jl=function(r,e,t,n){if(e in r){if(n===!0){if(r[e]===t)return}else if(!Vl(n)||!n())return}Ma?ka(r,e,t,!0):ka(r,e,t)},Da=function(r,e){var t=arguments.length>2?arguments[2]:{},n=Dl(e);Ll&&(n=Wl.call(n,Object.getOwnPropertySymbols(e)));for(var i=0;i<n.length;i+=1)jl(r,n[i],e[n[i]],t[n[i]])};Da.supportsDescriptors=!!Ma;La.exports=Da});var D=d((Tv,Va)=>{"use strict";s();u();var Ga=V(),Wa=Kt(),Yl=Wa(Ga("String.prototype.indexOf"));Va.exports=function(e,t){var n=Ga(e,!!t);return typeof n=="function"&&Yl(e,".prototype.")>-1?Wa(n):n}});var za=d((Sv,Ya)=>{"use strict";s();u();var zl=V(),ja=zl("%Array%"),Hl=!ja.isArray&&D()("Object.prototype.toString");Ya.exports=ja.isArray||function(e){return Hl(e)==="[object Array]"}});var cn=d((Rv,Ha)=>{"use strict";s();u();Ha.exports=za()});var Ka=d((Ov,Ja)=>{"use strict";s();u();var Jl=V(),Kl=D(),Ql=R(),Xl=cn(),Zl=Jl("%Reflect.apply%",!0)||Kl("Function.prototype.apply");Ja.exports=function(e,t){var n=arguments.length>2?arguments[2]:[];if(!Xl(n))throw new Ql("Assertion failed: optional `argumentsList`, if provided, must be a List");return Zl(e,t,n)}});function Qa(){throw new Error("setTimeout has not been defined")}function Xa(){throw new Error("clearTimeout has not been defined")}function Za(r){if(ue===setTimeout)return setTimeout(r,0);if((ue===Qa||!ue)&&setTimeout)return ue=setTimeout,setTimeout(r,0);try{return ue(r,0)}catch(e){try{return ue.call(null,r,0)}catch(t){return ue.call(this,r,0)}}}function ef(r){if(pe===clearTimeout)return clearTimeout(r);if((pe===Xa||!pe)&&clearTimeout)return pe=clearTimeout,clearTimeout(r);try{return pe(r)}catch(e){try{return pe.call(null,r)}catch(t){return pe.call(this,r)}}}function tf(){!Ye||!xe||(Ye=!1,xe.length?ee=xe.concat(ee):Zt=-1,ee.length&&es())}function es(){if(!Ye){var r=Za(tf);Ye=!0;for(var e=ee.length;e;){for(xe=ee,ee=[];++Zt<e;)xe&&xe[Zt].run();Zt=-1,e=ee.length}xe=null,Ye=!1,ef(r)}}function rf(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];ee.push(new ts(r,e)),ee.length===1&&!Ye&&Za(es)}function ts(r,e){this.fun=r,this.array=e}function Ae(){}function xf(r){throw new Error("process.binding is not supported")}function Af(){return"/"}function Tf(r){throw new Error("process.chdir is not supported")}function bf(){return 0}function Sf(r){var e=If.call(je)*.001,t=Math.floor(e),n=Math.floor(e%1*1e9);return r&&(t=t-r[0],n=n-r[1],n<0&&(t--,n+=1e9)),[t,n]}function Pf(){var r=new Date,e=r-Ef;return e/1e3}var ue,pe,ee,Ye,xe,Zt,nf,of,af,sf,uf,pf,cf,lf,ff,yf,hf,df,mf,gf,vf,wf,je,If,Ef,Rf,at,rs=Be(()=>{"use strict";s();u();ue=Qa,pe=Xa;typeof globalThis.setTimeout=="function"&&(ue=setTimeout);typeof globalThis.clearTimeout=="function"&&(pe=clearTimeout);ee=[],Ye=!1,Zt=-1;ts.prototype.run=function(){this.fun.apply(null,this.array)};nf="browser",of="browser",af=!0,sf={},uf=[],pf="",cf={},lf={},ff={};yf=Ae,hf=Ae,df=Ae,mf=Ae,gf=Ae,vf=Ae,wf=Ae;je=globalThis.performance||{},If=je.now||je.mozNow||je.msNow||je.oNow||je.webkitNow||function(){return new Date().getTime()};Ef=new Date;Rf={nextTick:rf,title:nf,browser:af,env:sf,argv:uf,version:pf,versions:cf,on:yf,addListener:hf,once:df,off:mf,removeListener:gf,removeAllListeners:vf,emit:wf,binding:xf,cwd:Af,chdir:Tf,umask:bf,hrtime:Sf,platform:of,release:lf,config:ff,uptime:Pf},at=Rf});var ln,fn,ns=Be(()=>{"use strict";s();u();typeof Object.create=="function"?ln=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:ln=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};fn=ln});var ls={};Ur(ls,{_extend:()=>An,debuglog:()=>is,default:()=>kf,deprecate:()=>gn,format:()=>nr,inherits:()=>fn,inspect:()=>Y,isArray:()=>vn,isBoolean:()=>ir,isBuffer:()=>us,isDate:()=>rr,isError:()=>ut,isFunction:()=>pt,isNull:()=>ct,isNullOrUndefined:()=>os,isNumber:()=>wn,isObject:()=>Te,isPrimitive:()=>ss,isRegExp:()=>st,isString:()=>lt,isSymbol:()=>as,isUndefined:()=>j,log:()=>ps});function nr(r){if(!lt(r)){for(var e=[],t=0;t<arguments.length;t++)e.push(Y(arguments[t]));return e.join(" ")}for(var t=1,n=arguments,i=n.length,o=String(r).replace(Ff,function(c){if(c==="%%")return"%";if(t>=i)return c;switch(c){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch(f){return"[Circular]"}default:return c}}),a=n[t];t<i;a=n[++t])ct(a)||!Te(a)?o+=" "+a:o+=" "+Y(a);return o}function gn(r,e){if(j(globalThis.process))return function(){return gn(r,e).apply(this,arguments)};if(at.noDeprecation===!0)return r;var t=!1;function n(){if(!t){if(at.throwDeprecation)throw new Error(e);at.traceDeprecation?console.trace(e):console.error(e),t=!0}return r.apply(this,arguments)}return n}function is(r){if(j(yn)&&(yn=at.env.NODE_DEBUG||""),r=r.toUpperCase(),!er[r])if(new RegExp("\\b"+r+"\\b","i").test(yn)){var e=0;er[r]=function(){var t=nr.apply(null,arguments);console.error("%s %d: %s",r,e,t)}}else er[r]=function(){};return er[r]}function Y(r,e){var t={seen:[],stylize:Of};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),ir(e)?t.showHidden=e:e&&An(t,e),j(t.showHidden)&&(t.showHidden=!1),j(t.depth)&&(t.depth=2),j(t.colors)&&(t.colors=!1),j(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=Nf),tr(t,r,t.depth)}function Nf(r,e){var t=Y.styles[e];return t?"\x1B["+Y.colors[t][0]+"m"+r+"\x1B["+Y.colors[t][1]+"m":r}function Of(r,e){return r}function Uf(r){var e={};return r.forEach(function(t,n){e[t]=!0}),e}function tr(r,e,t){if(r.customInspect&&e&&pt(e.inspect)&&e.inspect!==Y&&!(e.constructor&&e.constructor.prototype===e)){var n=e.inspect(t,r);return lt(n)||(n=tr(r,n,t)),n}var i=Bf(r,e);if(i)return i;var o=Object.keys(e),a=Uf(o);if(r.showHidden&&(o=Object.getOwnPropertyNames(e)),ut(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return hn(e);if(o.length===0){if(pt(e)){var c=e.name?": "+e.name:"";return r.stylize("[Function"+c+"]","special")}if(st(e))return r.stylize(RegExp.prototype.toString.call(e),"regexp");if(rr(e))return r.stylize(Date.prototype.toString.call(e),"date");if(ut(e))return hn(e)}var f="",v=!1,g=["{","}"];if(vn(e)&&(v=!0,g=["[","]"]),pt(e)){var m=e.name?": "+e.name:"";f=" [Function"+m+"]"}if(st(e)&&(f=" "+RegExp.prototype.toString.call(e)),rr(e)&&(f=" "+Date.prototype.toUTCString.call(e)),ut(e)&&(f=" "+hn(e)),o.length===0&&(!v||e.length==0))return g[0]+f+g[1];if(t<0)return st(e)?r.stylize(RegExp.prototype.toString.call(e),"regexp"):r.stylize("[Object]","special");r.seen.push(e);var w;return v?w=$f(r,e,t,a,o):w=o.map(function(x){return mn(r,e,t,a,x,v)}),r.seen.pop(),qf(w,f,g)}function Bf(r,e){if(j(e))return r.stylize("undefined","undefined");if(lt(e)){var t="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return r.stylize(t,"string")}if(wn(e))return r.stylize(""+e,"number");if(ir(e))return r.stylize(""+e,"boolean");if(ct(e))return r.stylize("null","null")}function hn(r){return"["+Error.prototype.toString.call(r)+"]"}function $f(r,e,t,n,i){for(var o=[],a=0,c=e.length;a<c;++a)cs(e,String(a))?o.push(mn(r,e,t,n,String(a),!0)):o.push("");return i.forEach(function(f){f.match(/^\d+$/)||o.push(mn(r,e,t,n,f,!0))}),o}function mn(r,e,t,n,i,o){var a,c,f;if(f=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},f.get?f.set?c=r.stylize("[Getter/Setter]","special"):c=r.stylize("[Getter]","special"):f.set&&(c=r.stylize("[Setter]","special")),cs(n,i)||(a="["+i+"]"),c||(r.seen.indexOf(f.value)<0?(ct(t)?c=tr(r,f.value,null):c=tr(r,f.value,t-1),c.indexOf(`
|
|
2
|
-
`)
|
|
3
|
-
`).
|
|
4
|
-
`).
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`)
|
|
8
|
-
`)>=0&&n++,o+a.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?t[0]+(e===""?"":e+`
|
|
9
|
-
`)+" "+r.join(`,
|
|
10
|
-
`)+" "+t[1]:t[0]+e+" "+r.join(", ")+" "+t[1]}function vn(r){return Array.isArray(r)}function ir(r){return typeof r=="boolean"}function ct(r){return r===null}function os(r){return r==null}function wn(r){return typeof r=="number"}function lt(r){return typeof r=="string"}function as(r){return typeof r=="symbol"}function j(r){return r===void 0}function st(r){return Te(r)&&xn(r)==="[object RegExp]"}function Te(r){return typeof r=="object"&&r!==null}function rr(r){return Te(r)&&xn(r)==="[object Date]"}function ut(r){return Te(r)&&(xn(r)==="[object Error]"||r instanceof Error)}function pt(r){return typeof r=="function"}function ss(r){return r===null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||typeof r=="symbol"||typeof r=="undefined"}function us(r){return p.isBuffer(r)}function xn(r){return Object.prototype.toString.call(r)}function dn(r){return r<10?"0"+r.toString(10):r.toString(10)}function _f(){var r=new Date,e=[dn(r.getHours()),dn(r.getMinutes()),dn(r.getSeconds())].join(":");return[r.getDate(),Cf[r.getMonth()],e].join(" ")}function ps(){console.log("%s - %s",_f(),nr.apply(null,arguments))}function An(r,e){if(!e||!Te(e))return r;for(var t=Object.keys(e),n=t.length;n--;)r[t[n]]=e[t[n]];return r}function cs(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var Ff,er,yn,Cf,kf,fs=Be(()=>{"use strict";s();u();rs();ns();Ff=/%[sdj%]/g;er={};Y.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};Y.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};Cf=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];kf={inherits:fn,_extend:An,log:ps,isBuffer:us,isPrimitive:ss,isFunction:pt,isError:ut,isDate:rr,isObject:Te,isRegExp:st,isUndefined:j,isSymbol:as,isString:lt,isNumber:wn,isNullOrUndefined:os,isNull:ct,isBoolean:ir,isArray:vn,inspect:Y,deprecate:gn,format:nr,debuglog:is}});var ys=d((Vv,or)=>{"use strict";s();u();var be=(fs(),hi(ls));if(be&&be.default){or.exports=be.default;for(let r in be)or.exports[r]=be[r]}else be&&(or.exports=be)});var ds=d((zv,hs)=>{"use strict";s();u();hs.exports=ys().inspect});var dt=d((Kv,qs)=>{"use strict";s();u();var On=typeof Map=="function"&&Map.prototype,Tn=Object.getOwnPropertyDescriptor&&On?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,sr=On&&Tn&&typeof Tn.get=="function"?Tn.get:null,ms=On&&Map.prototype.forEach,Un=typeof Set=="function"&&Set.prototype,bn=Object.getOwnPropertyDescriptor&&Un?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ur=Un&&bn&&typeof bn.get=="function"?bn.get:null,gs=Un&&Set.prototype.forEach,Mf=typeof WeakMap=="function"&&WeakMap.prototype,yt=Mf?WeakMap.prototype.has:null,Df=typeof WeakSet=="function"&&WeakSet.prototype,ht=Df?WeakSet.prototype.has:null,Lf=typeof WeakRef=="function"&&WeakRef.prototype,vs=Lf?WeakRef.prototype.deref:null,Gf=Boolean.prototype.valueOf,Wf=Object.prototype.toString,Vf=Function.prototype.toString,jf=String.prototype.match,Bn=String.prototype.slice,ce=String.prototype.replace,Yf=String.prototype.toUpperCase,ws=String.prototype.toLowerCase,Rs=RegExp.prototype.test,xs=Array.prototype.concat,z=Array.prototype.join,zf=Array.prototype.slice,As=Math.floor,En=typeof BigInt=="function"?BigInt.prototype.valueOf:null,In=Object.getOwnPropertySymbols,Pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ze=typeof Symbol=="function"&&typeof Symbol.iterator=="object",U=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ze||!0)?Symbol.toStringTag:null,Fs=Object.prototype.propertyIsEnumerable,Ts=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function bs(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Rs.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-As(-r):As(r);if(n!==r){var i=String(n),o=Bn.call(e,i.length+1);return ce.call(i,t,"$&_")+"."+ce.call(ce.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ce.call(e,t,"$&_")}var Rn=ds(),Is=Rn.custom,Ss=Us(Is)?Is:null,Ns={__proto__:null,double:'"',single:"'"},Hf={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};qs.exports=function r(e,t,n,i){var o=t||{};if(te(o,"quoteStyle")&&!te(Ns,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(te(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=te(o,"customInspect")?o.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(te(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(te(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var c=o.numericSeparator;if(typeof e=="undefined")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return $s(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var f=String(e);return c?bs(e,f):f}if(typeof e=="bigint"){var v=String(e)+"n";return c?bs(e,v):v}var g=typeof o.depth=="undefined"?5:o.depth;if(typeof n=="undefined"&&(n=0),n>=g&&g>0&&typeof e=="object")return Fn(e)?"[Array]":"[Object]";var m=fy(o,n);if(typeof i=="undefined")i=[];else if(Bs(i,e)>=0)return"[Circular]";function w(Ue,Ft,up){if(Ft&&(i=zf.call(i),i.push(Ft)),up){var si={depth:o.depth};return te(o,"quoteStyle")&&(si.quoteStyle=o.quoteStyle),r(Ue,si,n+1,i)}return r(Ue,o,n+1,i)}if(typeof e=="function"&&!Es(e)){var x=ny(e),I=ar(e,w);return"[Function"+(x?": "+x:" (anonymous)")+"]"+(I.length>0?" { "+z.call(I,", ")+" }":"")}if(Us(e)){var P=ze?ce.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Pn.call(e);return typeof e=="object"&&!ze?ft(P):P}if(py(e)){for(var B="<"+ws.call(String(e.nodeName)),C=e.attributes||[],Q=0;Q<C.length;Q++)B+=" "+C[Q].name+"="+Os(Jf(C[Q].value),"double",o);return B+=">",e.childNodes&&e.childNodes.length&&(B+="..."),B+="</"+ws.call(String(e.nodeName))+">",B}if(Fn(e)){if(e.length===0)return"[]";var fe=ar(e,w);return m&&!ly(fe)?"["+Nn(fe,m)+"]":"[ "+z.call(fe,", ")+" ]"}if(Qf(e)){var Ke=ar(e,w);return!("cause"in Error.prototype)&&"cause"in e&&!Fs.call(e,"cause")?"{ ["+String(e)+"] "+z.call(xs.call("[cause]: "+w(e.cause),Ke),", ")+" }":Ke.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+z.call(Ke,", ")+" }"}if(typeof e=="object"&&a){if(Ss&&typeof e[Ss]=="function"&&Rn)return Rn(e,{depth:g-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(iy(e)){var Rt=[];return ms&&ms.call(e,function(Ue,Ft){Rt.push(w(Ft,e,!0)+" => "+w(Ue,e))}),Ps("Map",sr.call(e),Rt,m)}if(sy(e)){var ii=[];return gs&&gs.call(e,function(Ue){ii.push(w(Ue,e))}),Ps("Set",ur.call(e),ii,m)}if(oy(e))return Sn("WeakMap");if(uy(e))return Sn("WeakSet");if(ay(e))return Sn("WeakRef");if(Zf(e))return ft(w(Number(e)));if(ty(e))return ft(w(En.call(e)));if(ey(e))return ft(Gf.call(e));if(Xf(e))return ft(w(String(e)));if(typeof window!="undefined"&&e===window)return"{ [object Window] }";if(typeof globalThis!="undefined"&&e===globalThis||typeof globalThis!="undefined"&&e===globalThis)return"{ [object globalThis] }";if(!Kf(e)&&!Es(e)){var Pr=ar(e,w),oi=Ts?Ts(e)===Object.prototype:e instanceof Object||e.constructor===Object,Rr=e instanceof Object?"":"null prototype",ai=!oi&&U&&Object(e)===e&&U in e?Bn.call(le(e),8,-1):Rr?"Object":"",sp=oi||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Fr=sp+(ai||Rr?"["+z.call(xs.call([],ai||[],Rr||[]),": ")+"] ":"");return Pr.length===0?Fr+"{}":m?Fr+"{"+Nn(Pr,m)+"}":Fr+"{ "+z.call(Pr,", ")+" }"}return String(e)};function Os(r,e,t){var n=t.quoteStyle||e,i=Ns[n];return i+r+i}function Jf(r){return ce.call(String(r),/"/g,""")}function Fn(r){return le(r)==="[object Array]"&&(!U||!(typeof r=="object"&&U in r))}function Kf(r){return le(r)==="[object Date]"&&(!U||!(typeof r=="object"&&U in r))}function Es(r){return le(r)==="[object RegExp]"&&(!U||!(typeof r=="object"&&U in r))}function Qf(r){return le(r)==="[object Error]"&&(!U||!(typeof r=="object"&&U in r))}function Xf(r){return le(r)==="[object String]"&&(!U||!(typeof r=="object"&&U in r))}function Zf(r){return le(r)==="[object Number]"&&(!U||!(typeof r=="object"&&U in r))}function ey(r){return le(r)==="[object Boolean]"&&(!U||!(typeof r=="object"&&U in r))}function Us(r){if(ze)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Pn)return!1;try{return Pn.call(r),!0}catch(e){}return!1}function ty(r){if(!r||typeof r!="object"||!En)return!1;try{return En.call(r),!0}catch(e){}return!1}var ry=Object.prototype.hasOwnProperty||function(r){return r in this};function te(r,e){return ry.call(r,e)}function le(r){return Wf.call(r)}function ny(r){if(r.name)return r.name;var e=jf.call(Vf.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function Bs(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return t;return-1}function iy(r){if(!sr||!r||typeof r!="object")return!1;try{sr.call(r);try{ur.call(r)}catch(e){return!0}return r instanceof Map}catch(e){}return!1}function oy(r){if(!yt||!r||typeof r!="object")return!1;try{yt.call(r,yt);try{ht.call(r,ht)}catch(e){return!0}return r instanceof WeakMap}catch(e){}return!1}function ay(r){if(!vs||!r||typeof r!="object")return!1;try{return vs.call(r),!0}catch(e){}return!1}function sy(r){if(!ur||!r||typeof r!="object")return!1;try{ur.call(r);try{sr.call(r)}catch(e){return!0}return r instanceof Set}catch(e){}return!1}function uy(r){if(!ht||!r||typeof r!="object")return!1;try{ht.call(r,ht);try{yt.call(r,yt)}catch(e){return!0}return r instanceof WeakSet}catch(e){}return!1}function py(r){return!r||typeof r!="object"?!1:typeof HTMLElement!="undefined"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function $s(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return $s(Bn.call(r,0,e.maxStringLength),e)+n}var i=Hf[e.quoteStyle||"single"];i.lastIndex=0;var o=ce.call(ce.call(r,i,"\\$1"),/[\x00-\x1f]/g,cy);return Os(o,"single",e)}function cy(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+Yf.call(e.toString(16))}function ft(r){return"Object("+r+")"}function Sn(r){return r+" { ? }"}function Ps(r,e,t,n){var i=n?Nn(t,n):z.call(t,", ");return r+" ("+e+") {"+i+"}"}function ly(r){for(var e=0;e<r.length;e++)if(Bs(r[e],`
|
|
11
|
-
`)>=0)return!1;return!0}function fy(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=z.call(Array(r.indent+1)," ");else return null;return{base:t,prev:z.call(Array(e+1),t)}}function Nn(r,e){if(r.length===0)return"";var t=`
|
|
12
|
-
`+e.prev+e.base;return t+z.call(r,","+t)+`
|
|
13
|
-
`+e.prev}function ar(r,e){var t=Fn(r),n=[];if(t){n.length=r.length;for(var i=0;i<r.length;i++)n[i]=te(r,i)?e(r[i],r):""}var o=typeof In=="function"?In(r):[],a;if(ze){a={};for(var c=0;c<o.length;c++)a["$"+o[c]]=o[c]}for(var f in r)te(r,f)&&(t&&String(Number(f))===f&&f<r.length||ze&&a["$"+f]instanceof Symbol||(Rs.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof In=="function")for(var v=0;v<o.length;v++)Fs.call(r,o[v])&&n.push("["+e(o[v])+"]: "+e(r[o[v]],r));return n}});var pr=d((Zv,Cs)=>{"use strict";s();u();Cs.exports=function(e){return typeof e=="string"||typeof e=="symbol"}});var ks=d((r0,_s)=>{"use strict";s();u();var yy=R(),hy=dt(),dy=pr();_s.exports=function(e,t){if(!dy(t))throw new yy("Assertion failed: IsPropertyKey(P) is not true, got "+hy(t));return e[t]}});var Gs=d((o0,Ls)=>{"use strict";s();u();var Ds=Function.prototype.toString,He=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,qn,cr;if(typeof He=="function"&&typeof Object.defineProperty=="function")try{qn=Object.defineProperty({},"length",{get:function(){throw cr}}),cr={},He(function(){throw 42},null,qn)}catch(r){r!==cr&&(He=null)}else He=null;var my=/^\s*class\b/,Cn=function(e){try{var t=Ds.call(e);return my.test(t)}catch(n){return!1}},$n=function(e){try{return Cn(e)?!1:(Ds.call(e),!0)}catch(t){return!1}},lr=Object.prototype.toString,gy="[object Object]",vy="[object Function]",wy="[object GeneratorFunction]",xy="[object HTMLAllCollection]",Ay="[object HTML document.all class]",Ty="[object HTMLCollection]",by=typeof Symbol=="function"&&!!Symbol.toStringTag,Iy=!(0 in[,]),_n=function(){return!1};typeof document=="object"&&(Ms=document.all,lr.call(Ms)===lr.call(document.all)&&(_n=function(e){if((Iy||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var t=lr.call(e);return(t===xy||t===Ay||t===Ty||t===gy)&&e("")==null}catch(n){}return!1}));var Ms;Ls.exports=He?function(e){if(_n(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{He(e,null,qn)}catch(t){if(t!==cr)return!1}return!Cn(e)&&$n(e)}:function(e){if(_n(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(by)return $n(e);if(Cn(e))return!1;var t=lr.call(e);return t!==vy&&t!==wy&&!/^\[object HTML/.test(t)?!1:$n(e)}});var kn=d((u0,Ws)=>{"use strict";s();u();Ws.exports=Gs()});var zs=d((l0,Ys)=>{"use strict";s();u();var Vs=R(),Sy=ks(),Ey=kn(),Py=pr(),js=dt();Ys.exports=function(e,t){if(!Py(t))throw new Vs("Assertion failed: IsPropertyKey(P) is not true");var n=Sy(e,t);if(n!=null){if(!Ey(n))throw new Vs(js(t)+" is not a function: "+js(n));return n}}});var Js=d((h0,Hs)=>{"use strict";s();u();var Ry=Hr();Hs.exports=function(){return Ry()&&!!Symbol.toStringTag}});var Gn=d((g0,Zs)=>{"use strict";s();u();var Mn=D(),Ks=Js()(),Qs,Xs,Dn,Ln;Ks&&(Qs=Mn("Object.prototype.hasOwnProperty"),Xs=Mn("RegExp.prototype.exec"),Dn={},fr=function(){throw Dn},Ln={toString:fr,valueOf:fr},typeof Symbol.toPrimitive=="symbol"&&(Ln[Symbol.toPrimitive]=fr));var fr,Fy=Mn("Object.prototype.toString"),Ny=Object.getOwnPropertyDescriptor,Oy="[object RegExp]";Zs.exports=Ks?function(e){if(!e||typeof e!="object")return!1;var t=Ny(e,"lastIndex"),n=t&&Qs(t,"value");if(!n)return!1;try{Xs(e,Ln)}catch(i){return i===Dn}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:Fy(e)===Oy}});var Wn=d((x0,eu)=>{"use strict";s();u();var Uy=D(),By=Gn(),$y=Uy("RegExp.prototype.exec"),qy=R();eu.exports=function(e){if(!By(e))throw new qy("`regex` must be a RegExp");return function(n){return $y(e,n)!==null}}});var ru=d((b0,tu)=>{"use strict";s();u();tu.exports=function(e,t){for(var n=0;n<e.length;n+=1)if(!t(e[n],n,e))return!1;return!0}});var iu=d((E0,nu)=>{"use strict";s();u();nu.exports=function(e){if(e===null)return"Null";if(typeof e=="undefined")return"Undefined";if(typeof e=="function"||typeof e=="object")return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"}});var Vn=d((F0,ou)=>{"use strict";s();u();var Cy=iu();ou.exports=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":Cy(e)}});var uu=d((U0,su)=>{"use strict";s();u();var au=R(),_y=dt(),ky=pr(),My=Vn();su.exports=function(e,t){if(My(e)!=="Object")throw new au("Assertion failed: Type(O) is not Object");if(!ky(t))throw new au("Assertion failed: IsPropertyKey(P) is not true, got "+_y(t));return e[t]}});var cu=d((q0,pu)=>{"use strict";s();u();var Dy=V();pu.exports=Dy("%Math.min%")});var jn=d((k0,lu)=>{"use strict";s();u();lu.exports=Number.isNaN||function(e){return e!==e}});var yu=d((L0,fu)=>{"use strict";s();u();var Ly=jn();fu.exports=function(r){return(typeof r=="number"||typeof r=="bigint")&&!Ly(r)&&r!==1/0&&r!==-1/0}});var yr=d((V0,du)=>{"use strict";s();u();var hu=V(),Gy=hu("%Math.abs%"),Wy=hu("%Math.floor%"),Vy=jn(),jy=yu();du.exports=function(e){if(typeof e!="number"||Vy(e)||!jy(e))return!1;var t=Gy(e);return Wy(t)===t}});var zn=d((z0,mu)=>{"use strict";s();u();var Yy=D(),Yn=R(),zy=yr(),Hy=Yy("String.prototype.slice");mu.exports=function(e,t,n){if(typeof e!="string")throw new Yn("Assertion failed: `string` must be a String");if(typeof t!="string")throw new Yn("Assertion failed: `searchValue` must be a String");if(!zy(n)||n<0)throw new Yn("Assertion failed: `fromIndex` must be a non-negative integer");var i=e.length;if(t===""&&n<=i)return n;for(var o=t.length,a=n;a<=i-o;a+=1){var c=Hy(e,a,a+o);if(c===t)return a}return-1}});var hr=d((K0,gu)=>{"use strict";s();u();var Jy=R();gu.exports=function(e){if(e==null)throw new Jy(arguments.length>0&&arguments[1]||"Cannot call method on "+e);return e}});var dr=d((Z0,vu)=>{"use strict";s();u();var Ky=V(),Qy=Ky("%String%"),Xy=R();vu.exports=function(e){if(typeof e=="symbol")throw new Xy("Cannot convert a Symbol value to a string");return Qy(e)}});var Hn=d((rw,Au)=>{"use strict";s();u();var Zy=hr(),eh=dr(),th=D(),wu=th("String.prototype.replace"),xu=/^\s$/.test("\u180E"),rh=xu?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,nh=xu?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;Au.exports=function(){var e=eh(Zy(this));return wu(wu(e,rh,""),nh,"")}});var Jn=d((ow,bu)=>{"use strict";s();u();var ih=Hn(),Tu="\u200B",Je="\u180E";bu.exports=function(){return String.prototype.trim&&Tu.trim()===Tu&&Je.trim()===Je&&("_"+Je).trim()==="_"+Je&&(Je+"_").trim()===Je+"_"?String.prototype.trim:ih}});var Su=d((uw,Iu)=>{"use strict";s();u();var oh=ot(),ah=Jn();Iu.exports=function(){var e=ah();return oh(String.prototype,{trim:e},{trim:function(){return String.prototype.trim!==e}}),e}});var Fu=d((lw,Ru)=>{"use strict";s();u();var sh=Kt(),uh=ot(),ph=hr(),ch=Hn(),Eu=Jn(),lh=Su(),fh=sh(Eu()),Pu=function(e){return ph(e),fh(e)};uh(Pu,{getPolyfill:Eu,implementation:ch,shim:lh});Ru.exports=Pu});var Bu=d((hw,Uu)=>{"use strict";s();u();var Qn=V(),Kn=Qn("%Number%"),yh=Qn("%RegExp%"),hh=R(),Nu=Qn("%parseInt%"),dh=D(),mr=Wn(),Ou=dh("String.prototype.slice"),mh=mr(/^0b[01]+$/i),gh=mr(/^0o[0-7]+$/i),vh=mr(/^[-+]0x[0-9a-f]+$/i),wh=["\x85","\u200B","\uFFFE"].join(""),xh=new yh("["+wh+"]","g"),Ah=mr(xh),Th=Fu();Uu.exports=function r(e){if(typeof e!="string")throw new hh("Assertion failed: `argument` is not a String");if(mh(e))return Kn(Nu(Ou(e,2),2));if(gh(e))return Kn(Nu(Ou(e,2),8));if(Ah(e)||vh(e))return NaN;var t=Th(e);return t!==e?r(t):Kn(e)}});var Cu=d((gw,qu)=>{"use strict";s();u();var bh=R(),$u=yr(),Ih=D(),Sh=Ih("String.prototype.slice");qu.exports=function(e,t,n){if(typeof e!="string"||!$u(t)||arguments.length>2&&!$u(n))throw new bh("`S` must be a String, and `inclusiveStart` and `exclusiveEnd` must be integers");return Sh(e,t,arguments.length>2?n:e.length)}});var ku=d((xw,_u)=>{"use strict";s();u();_u.exports=function(e){return typeof e=="string"||typeof e=="undefined"}});var Du=d((bw,Mu)=>{"use strict";s();u();var Eh=D()("String.prototype.slice");Mu.exports=function(e,t){return e===t?!0:e.length>t.length?!1:Eh(t,0,e.length)===e}});var ju=d((Ew,Vu)=>{"use strict";s();u();var re=R(),Wu=Wn(),Ph=ru(),Xn=dt(),Rh=uu(),Fh=cn(),Nh=cu(),Oh=zn(),Lu=Bu(),ne=Cu(),Uh=dr(),Gu=Vn(),Bh=yr(),$h=ku(),mt=Du(),qh=Wu(/^\$[0-9]/),Ch=Wu(/^\$[0-9][0-9]/);Vu.exports=function(e,t,n,i,o,a){if(typeof e!="string")throw new re("Assertion failed: `matched` must be a String");if(typeof t!="string")throw new re("Assertion failed: `str` must be a String");if(!Bh(n)||n<0)throw new re("Assertion failed: `position` must be a nonnegative integer, got "+Xn(n));if(!Fh(i)||!Ph(i,$h))throw new re("Assertion failed: `captures` must be a possibly-empty List of Strings or `undefined`, got "+Xn(i));if(typeof o!="undefined"&&Gu(o)!=="Object")throw new re("Assertion failed: `namedCaptures` must be `undefined` or an Object");if(typeof a!="string")throw new re("Assertion failed: `replacementTemplate` must be a String");var c=t.length;if(n>c)throw new re("Assertion failed: position > stringLength, got "+Xn(n));for(var f=a,v="";f!=="";){var g,m,w;if(mt("$$",f))g="$$",m="$";else if(mt("$`",f))g="$`",m=ne(t,0,n);else if(mt("$&",f))g="$&",m=e;else if(mt("$'",f)){g="$'";var x=e.length,I=n+x;m=ne(t,Nh(I,c))}else if(qh(f)){var P=Ch(f)?2:1,B=ne(f,1,1+P),C=Lu(B);if(C<0||C>99)throw new re("Assertion failed: `index` must be >= 0 and <= 99");var Q=i.length;C>Q&&P===2&&(P=1,B=ne(B,0,1),C=Lu(B)),g=ne(f,0,1+P),1<=C&&C<=Q?(w=i[C-1],typeof w=="undefined"?m="":m=w):m=g}else if(mt("$<",f)){var fe=Oh(f,">",0);if(fe===-1||typeof o=="undefined")g="$<",m=g;else{g=ne(f,0,fe+1);var Ke=ne(f,2,fe);if(Gu(o)!=="Object")throw new re("Assertion failed: Type(namedCaptures) is not Object");w=Rh(o,Ke),typeof w=="undefined"?m="":m=Uh(w)}}else g=ne(f,0,1),m=g;var Rt=g.length;f=ne(f,Rt),v+=m}return v}});var ei=d((Fw,Ju)=>{"use strict";s();u();var Yu=Ka(),_h=zs(),kh=ju(),Mh=kn(),Dh=hr(),gr=dr(),zu=zn(),Lh=V(),vr=D(),Gh=Gr()(),Wh=Gn(),Vh=Lh("%Math.max%"),Hu=R(),jh=vr("Array.prototype.push"),Zn=vr("String.prototype.slice"),Yh=vr("String.prototype.indexOf"),zh=vr("String.prototype.replace");Ju.exports=function(e,t){var n=Dh(this),i=Wh(e);if(i&&Yh(Zn(e,e.source.length+2),"g")===-1)throw new Hu("use .replace for a non-global regex. NOTE: this may be allowed in the future.");if(Gh&&Symbol.replace){if(e!=null){var o=_h(e,Symbol.replace);if(typeof o!="undefined")return Yu(o,e,[n,t])}}else if(i)return zh(n,e,t);var a=gr(n),c=gr(e),f=Mh(t);f||(t=gr(t));for(var v=c.length,g=Vh(1,v),m=[],w=zu(a,c,0);w!==-1;)jh(m,w),w=zu(a,c,w+g);for(var x=0,I="",P=0;P<m.length;P+=1){var B;if(f)B=gr(Yu(t,void 0,[c,m[P],a]));else{if(typeof t!="string")throw new Hu("Assertion failed: `replaceValue` should be a string at this point");var C=[];B=kh(c,a,m[P],C,void 0,t)}var Q=Zn(a,x,m[P]);I+=Q+B,x=m[P]+v}return x<a.length&&(I+=Zn(a,x)),I}});var ti=d((Uw,Ku)=>{"use strict";s();u();var Hh=ei();Ku.exports=function(){return String.prototype.replaceAll||Hh}});var Xu=d((qw,Qu)=>{"use strict";s();u();var Jh=ot(),Kh=ti();Qu.exports=function(){var e=Kh();return Jh(String.prototype,{replaceAll:e},{replaceAll:function(){return String.prototype.replaceAll!==e}}),e}});var rp=d((kw,tp)=>{"use strict";s();u();var Qh=Kt(),Xh=ot(),Zu=ei(),Zh=ti(),ed=Xu(),ep=Qh(Zu);Xh(ep,{getPolyfill:Zh,implementation:Zu,shim:ed});tp.exports=ep});var qd={};Ur(qd,{DynamicSnippetsGenerator:()=>Er});module.exports=hi(qd);s();u();var WI=dp(rp(),1);s();u();s();u();s();u();function E(r){throw new Error("Unexpected value: "+JSON.stringify(r))}s();u();function gt(r){return Object.keys(r)}s();u();s();u();var Ie=class{};s();u();s();u();var H=class extends Ie{constructor(t){super();h(this,"value");this.value=t}write(t){typeof this.value=="string"?t.write(this.value):this.value(t)}};var td=4,vt=class{constructor(){h(this,"buffer","");h(this,"indentLevel",0);h(this,"hasWrittenAnything",!1);h(this,"lastCharacterIsNewline",!1)}write(e){let t=e.length>0&&e.endsWith(`
|
|
14
|
-
`),n=t?e.substring(0,e.length-1):e,i=this.getIndentString(),o=n.replaceAll(`
|
|
1
|
+
"use strict";var be=Object.defineProperty,Kt=Object.defineProperties,Jt=Object.getOwnPropertyDescriptor,Xt=Object.getOwnPropertyDescriptors,Qt=Object.getOwnPropertyNames,Fe=Object.getOwnPropertySymbols;var Ke=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable;var ze=(n,t,e)=>t in n?be(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ut=(n,t)=>{for(var e in t||(t={}))Ke.call(t,e)&&ze(n,e,t[e]);if(Fe)for(var e of Fe(t))ct.call(t,e)&&ze(n,e,t[e]);return n},pt=(n,t)=>Kt(n,Xt(t));var lt=n=>typeof n=="symbol"?n:n+"",ft=(n,t)=>{var e={};for(var r in n)Ke.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&Fe)for(var r of Fe(n))t.indexOf(r)<0&&ct.call(n,r)&&(e[r]=n[r]);return e};var Pe=(n,t)=>()=>(n&&(t=n(n=0)),t);var ht=(n,t)=>{for(var e in t)be(n,e,{get:t[e],enumerable:!0})},Zt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qt(t))!Ke.call(n,i)&&i!==e&&be(n,i,{get:()=>t[i],enumerable:!(r=Jt(t,i))||r.enumerable});return n};var er=n=>Zt(be({},"__esModule",{value:!0}),n);var u=(n,t,e)=>ze(n,typeof t!="symbol"?t+"":t,e);function mt(){throw new Error("setTimeout has not been defined")}function yt(){throw new Error("clearTimeout has not been defined")}function gt(n){if(q===setTimeout)return setTimeout(n,0);if((q===mt||!q)&&setTimeout)return q=setTimeout,setTimeout(n,0);try{return q(n,0)}catch(t){try{return q.call(null,n,0)}catch(e){return q.call(this,n,0)}}}function tr(n){if(G===clearTimeout)return clearTimeout(n);if((G===yt||!G)&&clearTimeout)return G=clearTimeout,clearTimeout(n);try{return G(n)}catch(t){try{return G.call(null,n)}catch(e){return G.call(this,n)}}}function rr(){!ce||!j||(ce=!1,j.length?M=j.concat(M):ke=-1,M.length&&wt())}function wt(){if(!ce){var n=gt(rr);ce=!0;for(var t=M.length;t;){for(j=M,M=[];++ke<t;)j&&j[ke].run();ke=-1,t=M.length}j=null,ce=!1,tr(n)}}function nr(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];M.push(new xt(n,t)),M.length===1&&!ce&>(wt)}function xt(n,t){this.fun=n,this.array=t}function H(){}function vr(n){throw new Error("process.binding is not supported")}function Tr(){return"/"}function Ir(n){throw new Error("process.chdir is not supported")}function Rr(){return 0}function Ar(n){var t=Nr.call(ae)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function Fr(){var n=new Date,t=n-Er;return t/1e3}var q,G,M,ce,j,ke,ir,or,sr,ar,cr,ur,pr,lr,fr,hr,dr,mr,yr,gr,wr,xr,ae,Nr,Er,d,dt,p=Pe(()=>{"use strict";q=mt,G=yt;typeof globalThis.setTimeout=="function"&&(q=setTimeout);typeof globalThis.clearTimeout=="function"&&(G=clearTimeout);M=[],ce=!1,ke=-1;xt.prototype.run=function(){this.fun.apply(null,this.array)};ir="browser",or="browser",sr=!0,ar={},cr=[],ur="",pr={},lr={},fr={};hr=H,dr=H,mr=H,yr=H,gr=H,wr=H,xr=H;ae=globalThis.performance||{},Nr=ae.now||ae.mozNow||ae.msNow||ae.oNow||ae.webkitNow||function(){return new Date().getTime()};Er=new Date;d={nextTick:nr,title:ir,browser:sr,env:ar,argv:cr,version:ur,versions:pr,on:hr,addListener:dr,once:mr,off:yr,removeListener:gr,removeAllListeners:wr,emit:xr,binding:vr,cwd:Tr,chdir:Ir,umask:Rr,hrtime:Ar,platform:or,release:lr,config:fr,uptime:Fr},dt={};Object.keys(dt).forEach(n=>{let t=n.split("."),e=d;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=dt[n]:e=e[i]||(e[i]={})}})});function Rt(){Xe=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)C[t]=n[t],P[n.charCodeAt(t)]=t;P[45]=62,P[95]=63}function Pr(n){Xe||Rt();var t,e,r,i,o,s,f=n.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[f-2]==="="?2:n[f-1]==="="?1:0,s=new br(f*3/4-o),r=o>0?f-4:f;var h=0;for(t=0,e=0;t<r;t+=4,e+=3)i=P[n.charCodeAt(t)]<<18|P[n.charCodeAt(t+1)]<<12|P[n.charCodeAt(t+2)]<<6|P[n.charCodeAt(t+3)],s[h++]=i>>16&255,s[h++]=i>>8&255,s[h++]=i&255;return o===2?(i=P[n.charCodeAt(t)]<<2|P[n.charCodeAt(t+1)]>>4,s[h++]=i&255):o===1&&(i=P[n.charCodeAt(t)]<<10|P[n.charCodeAt(t+1)]<<4|P[n.charCodeAt(t+2)]>>2,s[h++]=i>>8&255,s[h++]=i&255),s}function kr(n){return C[n>>18&63]+C[n>>12&63]+C[n>>6&63]+C[n&63]}function Sr(n,t,e){for(var r,i=[],o=t;o<e;o+=3)r=(n[o]<<16)+(n[o+1]<<8)+n[o+2],i.push(kr(r));return i.join("")}function vt(n){Xe||Rt();for(var t,e=n.length,r=e%3,i="",o=[],s=16383,f=0,h=e-r;f<h;f+=s)o.push(Sr(n,f,f+s>h?h:f+s));return r===1?(t=n[e-1],i+=C[t>>2],i+=C[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=C[t>>10],i+=C[t>>4&63],i+=C[t<<2&63],i+="="),o.push(i),o.join("")}function Se(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function D(n,t){if(Se()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=c.prototype):(n===null&&(n=new c(t)),n.length=t),n}function c(n,t,e){if(!c.TYPED_ARRAY_SUPPORT&&!(this instanceof c))return new c(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Qe(this,n)}return Nt(this,n,t,e)}function Nt(n,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Br(n,t,e,r):typeof t=="string"?Ur(n,t,e):_r(n,t)}function At(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function Cr(n,t,e,r){return At(t),t<=0?D(n,t):e!==void 0?typeof r=="string"?D(n,t).fill(e,r):D(n,t).fill(e):D(n,t)}function Qe(n,t){if(At(t),n=D(n,t<0?0:Ze(t)|0),!c.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Ur(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!c.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Et(t,e)|0;n=D(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Je(n,t){var e=t.length<0?0:Ze(t.length)|0;n=D(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Br(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),c.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=c.prototype):n=Je(n,t),n}function _r(n,t){if(U(t)){var e=Ze(t.length)|0;return n=D(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||en(t.length)?D(n,0):Je(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Je(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Ze(n){if(n>=Se())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Se().toString(16)+" bytes");return n|0}function U(n){return!!(n!=null&&n._isBuffer)}function Et(n,t){if(U(n))return n.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var e=n.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Ce(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Ut(n).length;default:if(r)return Ce(n).length;t=(""+t).toLowerCase(),r=!0}}function Lr(n,t,e){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return jr(this,t,e);case"utf8":case"utf-8":return Pt(this,t,e);case"ascii":return Gr(this,t,e);case"latin1":case"binary":return Yr(this,t,e);case"base64":return Wr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Hr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function z(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Ft(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=c.from(t,r)),U(t))return t.length===0?-1:Tt(n,t,e,r,i);if(typeof t=="number")return t=t&255,c.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):Tt(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function Tt(n,t,e,r,i){var o=1,s=n.length,f=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;o=2,s/=2,f/=2,e/=2}function h(I,R){return o===1?I[R]:I.readUInt16BE(R*o)}var m;if(i){var y=-1;for(m=e;m<s;m++)if(h(n,m)===h(t,y===-1?0:m-y)){if(y===-1&&(y=m),m-y+1===f)return y*o}else y!==-1&&(m-=m-y),y=-1}else for(e+f>s&&(e=s-f),m=e;m>=0;m--){for(var g=!0,T=0;T<f;T++)if(h(n,m+T)!==h(t,T)){g=!1;break}if(g)return m}return-1}function Mr(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var f=parseInt(t.substr(s*2,2),16);if(isNaN(f))return s;n[e+s]=f}return s}function Dr(n,t,e,r){return _e(Ce(t,n.length-e),n,e,r)}function bt(n,t,e,r){return _e(Qr(t),n,e,r)}function $r(n,t,e,r){return bt(n,t,e,r)}function Or(n,t,e,r){return _e(Ut(t),n,e,r)}function Vr(n,t,e,r){return _e(Zr(t,n.length-e),n,e,r)}function Wr(n,t,e){return t===0&&e===n.length?vt(n):vt(n.slice(t,e))}function Pt(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],s=null,f=o>239?4:o>223?3:o>191?2:1;if(i+f<=e){var h,m,y,g;switch(f){case 1:o<128&&(s=o);break;case 2:h=n[i+1],(h&192)===128&&(g=(o&31)<<6|h&63,g>127&&(s=g));break;case 3:h=n[i+1],m=n[i+2],(h&192)===128&&(m&192)===128&&(g=(o&15)<<12|(h&63)<<6|m&63,g>2047&&(g<55296||g>57343)&&(s=g));break;case 4:h=n[i+1],m=n[i+2],y=n[i+3],(h&192)===128&&(m&192)===128&&(y&192)===128&&(g=(o&15)<<18|(h&63)<<12|(m&63)<<6|y&63,g>65535&&g<1114112&&(s=g))}}s===null?(s=65533,f=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=f}return qr(r)}function qr(n){var t=n.length;if(t<=It)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=It));return e}function Gr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function Yr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function jr(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",o=t;o<e;++o)i+=Xr(n[o]);return i}function Hr(n,t,e){for(var r=n.slice(t,e),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}function N(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function b(n,t,e,r,i,o){if(!U(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function Ue(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(n.length-e,2);i<o;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function Be(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(n.length-e,4);i<o;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function kt(n,t,e,r,i,o){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function St(n,t,e,r,i){return i||kt(n,t,e,4,34028234663852886e22,-34028234663852886e22),_t(n,t,e,r,23,4),e+4}function Ct(n,t,e,r,i){return i||kt(n,t,e,8,17976931348623157e292,-17976931348623157e292),_t(n,t,e,r,52,8),e+8}function Kr(n){if(n=Jr(n).replace(zr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Jr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Xr(n){return n<16?"0"+n.toString(16):n.toString(16)}function Ce(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],s=0;s<r;++s){if(e=n.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Qr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Zr(n,t){for(var e,r,i,o=[],s=0;s<n.length&&!((t-=2)<0);++s)e=n.charCodeAt(s),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function Ut(n){return Pr(Kr(n))}function _e(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function en(n){return n!==n}function tn(n){return n!=null&&(!!n._isBuffer||Bt(n)||rn(n))}function Bt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function rn(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&Bt(n.slice(0,0))}function Le(n,t,e,r,i){var o,s,f=i*8-r-1,h=(1<<f)-1,m=h>>1,y=-7,g=e?i-1:0,T=e?-1:1,I=n[t+g];for(g+=T,o=I&(1<<-y)-1,I>>=-y,y+=f;y>0;o=o*256+n[t+g],g+=T,y-=8);for(s=o&(1<<-y)-1,o>>=-y,y+=r;y>0;s=s*256+n[t+g],g+=T,y-=8);if(o===0)o=1-m;else{if(o===h)return s?NaN:(I?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-m}return(I?-1:1)*s*Math.pow(2,o-r)}function _t(n,t,e,r,i,o){var s,f,h,m=o*8-i-1,y=(1<<m)-1,g=y>>1,T=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=r?0:o-1,R=r?1:-1,Y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,s=y):(s=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-s))<1&&(s--,h*=2),s+g>=1?t+=T/h:t+=T*Math.pow(2,1-g),t*h>=2&&(s++,h/=2),s+g>=y?(f=0,s=y):s+g>=1?(f=(t*h-1)*Math.pow(2,i),s=s+g):(f=t*Math.pow(2,g-1)*Math.pow(2,i),s=0));i>=8;n[e+I]=f&255,I+=R,f/=256,i-=8);for(s=s<<i|f,m+=i;m>0;n[e+I]=s&255,I+=R,s/=256,m-=8);n[e+I-R]|=Y*128}var C,P,br,Xe,It,zr,Lt=Pe(()=>{"use strict";p();l();C=[],P=[],br=typeof Uint8Array!="undefined"?Uint8Array:Array,Xe=!1;c.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;c.poolSize=8192;c._augment=function(n){return n.__proto__=c.prototype,n};c.from=function(n,t,e){return Nt(null,n,t,e)};c.kMaxLength=Se();c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&c[Symbol.species]);c.alloc=function(n,t,e){return Cr(null,n,t,e)};c.allocUnsafe=function(n){return Qe(null,n)};c.allocUnsafeSlow=function(n){return Qe(null,n)};c.isBuffer=tn;c.compare=function(t,e){if(!U(t)||!U(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,s=Math.min(r,i);o<s;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};c.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}};c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return c.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=c.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!U(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i};c.byteLength=Et;c.prototype._isBuffer=!0;c.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)z(this,e,e+1);return this};c.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)z(this,e,e+3),z(this,e+1,e+2);return this};c.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)z(this,e,e+7),z(this,e+1,e+6),z(this,e+2,e+5),z(this,e+3,e+4);return this};c.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Pt(this,0,t):Lr.apply(this,arguments)};c.prototype.equals=function(t){if(!U(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:c.compare(this,t)===0};c.prototype.compare=function(t,e,r,i,o){if(!U(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,f=r-e,h=Math.min(s,f),m=this.slice(i,o),y=t.slice(e,r),g=0;g<h;++g)if(m[g]!==y[g]){s=m[g],f=y[g];break}return s<f?-1:f<s?1:0};c.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};c.prototype.indexOf=function(t,e,r){return Ft(this,t,e,r,!0)};c.prototype.lastIndexOf=function(t,e,r){return Ft(this,t,e,r,!1)};c.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return Mr(this,t,e,r);case"utf8":case"utf-8":return Dr(this,t,e,r);case"ascii":return bt(this,t,e,r);case"latin1":case"binary":return $r(this,t,e,r);case"base64":return Or(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vr(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};It=4096;c.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(c.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=c.prototype;else{var o=e-t;i=new c(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+t]}return i};c.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return i};c.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};c.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]};c.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8};c.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]};c.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};c.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};c.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};c.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||N(t,e,this.length);for(var i=e,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};c.prototype.readInt8=function(t,e){return e||N(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};c.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};c.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};c.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};c.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};c.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),Le(this,t,!0,23,4)};c.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),Le(this,t,!1,23,4)};c.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),Le(this,t,!0,52,8)};c.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),Le(this,t,!1,52,8)};c.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;b(this,t,e,r,o,0)}var s=1,f=0;for(this[e]=t&255;++f<r&&(s*=256);)this[e+f]=t/s&255;return e+r};c.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;b(this,t,e,r,o,0)}var s=r-1,f=1;for(this[e+s]=t&255;--s>=0&&(f*=256);)this[e+s]=t/f&255;return e+r};c.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||b(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||b(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Ue(this,t,e,!0),e+2};c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||b(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Ue(this,t,e,!1),e+2};c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||b(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Be(this,t,e,!0),e+4};c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||b(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Be(this,t,e,!1),e+4};c.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);b(this,t,e,r,o-1,-o)}var s=0,f=1,h=0;for(this[e]=t&255;++s<r&&(f*=256);)t<0&&h===0&&this[e+s-1]!==0&&(h=1),this[e+s]=(t/f>>0)-h&255;return e+r};c.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);b(this,t,e,r,o-1,-o)}var s=r-1,f=1,h=0;for(this[e+s]=t&255;--s>=0&&(f*=256);)t<0&&h===0&&this[e+s+1]!==0&&(h=1),this[e+s]=(t/f>>0)-h&255;return e+r};c.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||b(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};c.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||b(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Ue(this,t,e,!0),e+2};c.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||b(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Ue(this,t,e,!1),e+2};c.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||b(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Be(this,t,e,!0),e+4};c.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||b(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Be(this,t,e,!1),e+4};c.prototype.writeFloatLE=function(t,e,r){return St(this,t,e,!0,r)};c.prototype.writeFloatBE=function(t,e,r){return St(this,t,e,!1,r)};c.prototype.writeDoubleLE=function(t,e,r){return Ct(this,t,e,!0,r)};c.prototype.writeDoubleBE=function(t,e,r){return Ct(this,t,e,!1,r)};c.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r,s;if(this===t&&r<e&&e<i)for(s=o-1;s>=0;--s)t[s+e]=this[s+r];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};c.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var s;if(typeof t=="number")for(s=e;s<r;++s)this[s]=t;else{var f=U(t)?t:Ce(new c(t,i).toString()),h=f.length;for(s=0;s<r-e;++s)this[s+e]=f[s%h]}return this};zr=/[^+\/0-9A-Za-z-_]/g});var l=Pe(()=>{"use strict";Lt()});function Vt(n,t){for(var e=0,r=n.length-1;r>=0;r--){var i=n[r];i==="."?n.splice(r,1):i===".."?(n.splice(r,1),e++):e&&(n.splice(r,1),e--)}if(t)for(;e--;e)n.unshift("..");return n}function rt(){for(var n="",t=!1,e=arguments.length-1;e>=-1&&!t;e--){var r=e>=0?arguments[e]:"/";if(typeof r!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!r)continue;n=r+"/"+n,t=r.charAt(0)==="/"}return n=Vt(it(n.split("/"),function(i){return!!i}),!t).join("/"),(t?"/":"")+n||"."}function Wt(n){var t=qt(n),e=gn(n,-1)==="/";return n=Vt(it(n.split("/"),function(r){return!!r}),!t).join("/"),!n&&!t&&(n="."),n&&e&&(n+="/"),(t?"/":"")+n}function qt(n){return n.charAt(0)==="/"}function pn(){var n=Array.prototype.slice.call(arguments,0);return Wt(it(n,function(t,e){if(typeof t!="string")throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))}function ln(n,t){n=rt(n).substr(1),t=rt(t).substr(1);function e(m){for(var y=0;y<m.length&&m[y]==="";y++);for(var g=m.length-1;g>=0&&m[g]==="";g--);return y>g?[]:m.slice(y,g-y+1)}for(var r=e(n.split("/")),i=e(t.split("/")),o=Math.min(r.length,i.length),s=o,f=0;f<o;f++)if(r[f]!==i[f]){s=f;break}for(var h=[],f=s;f<r.length;f++)h.push("..");return h=h.concat(i.slice(s)),h.join("/")}function dn(n){var t=nt(n),e=t[0],r=t[1];return!e&&!r?".":(r&&(r=r.substr(0,r.length-1)),e+r)}function mn(n,t){var e=nt(n)[2];return t&&e.substr(-1*t.length)===t&&(e=e.substr(0,e.length-t.length)),e}function yn(n){return nt(n)[3]}function it(n,t){if(n.filter)return n.filter(t);for(var e=[],r=0;r<n.length;r++)t(n[r],r,n)&&e.push(n[r]);return e}var un,nt,fn,hn,Gt,gn,Yt=Pe(()=>{"use strict";p();l();un=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,nt=function(n){return un.exec(n).slice(1)};fn="/",hn=":";Gt={extname:yn,basename:mn,dirname:dn,sep:fn,delimiter:hn,relative:ln,join:pn,isAbsolute:qt,normalize:Wt,resolve:rt};gn="ab".substr(-1)==="b"?function(n,t,e){return n.substr(t,e)}:function(n,t,e){return t<0&&(t=n.length+t),n.substr(t,e)}});var ri={};ht(ri,{DynamicSnippetsGenerator:()=>He});module.exports=er(ri);p();l();p();l();p();l();p();l();function x(n){throw new Error("Unexpected value: "+JSON.stringify(n))}p();l();function fe(n){return Object.keys(n)}p();l();p();l();p();l();var Mt,Dt,he=(Dt=(Mt=d.env.FERN_STACK_TRACK)==null?void 0:Mt.toLowerCase())!=null?Dt:"",B=he!==""&&he!=="0"&&he!=="false",et=["single","multiline","box"].includes(he)?he:"single";B&&(Error.stackTraceLimit=50);var nn=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),on=new Set(["stacktrace"]);function De({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:o=!0,filterJs:s=!0,formatFilename:f=h=>h}={}){var m;if(!B)return[];r=[...r,...nn],e=[...e,...on],i=[...i,"runInteractiveTask"];let h=!1;return((m=new Error().stack)!=null?m:"").split(`
|
|
2
|
+
`).map(y=>{let g=y.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(g&&g.length===5){let[,T,I,R,Y]=g;if(!T||!I||!R||!Y)return;if(h||i.some(le=>T==null?void 0:T.includes(le))){h=!0;return}switch(T){case"Object.<anonymous>":T="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":T=`${T.substring(T.indexOf(".")+1)}()=> { ... }`;break}return{fn:T,path:f(I),position:`${R}:${Y}`}}}).filter(y=>{var g,T;return y&&!r.some(I=>y.fn.includes(I))&&!(o&&((g=y.path)!=null&&g.startsWith("node:")))&&!(s&&((T=y.path)!=null&&T.endsWith(".js")))&&!e.some(I=>y.path.includes(I))}).slice(t,t+n)}var Me=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:r=[],filterFunctions:i=[],stopOn:o=[],filterNode:s=!0,filterJs:f=!0,multiline:h=!1,formatFilename:m=y=>y}={}){u(this,"maxFrames");u(this,"skip");u(this,"filterPaths");u(this,"filterFunctions");u(this,"stopOn");u(this,"filterNode");u(this,"filterJs");u(this,"multiline");u(this,"formatFilename");u(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=r,this.filterFunctions=i,this.stopOn=o,this.filterNode=s,this.filterJs=f,this.multiline=h,this.formatFilename=m}tag(t){let e=this.tracking.get(t)||new Set;De({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>e.add(r)),this.tracking.set(t,e)}trace(t){if(!B)return"";let e=this.tracking.get(t);return e?[...e].map(r=>`${this.multiline?`
|
|
3
|
+
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},$;function $t({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:o=!0,filterJs:s=!0,multiline:f=!1,formatFilename:h=m=>m}={}){B&&($!=null||($=new Me({maxFrames:n,skip:t,filterPaths:e,filterFunctions:r,stopOn:i,filterNode:o,filterJs:s,multiline:f,formatFilename:h})))}function Ot(n){$==null||$.tag(n)}function tt(n){var t;return(t=$==null?void 0:$.frames(n))!=null?t:[]}var K=class{constructor(){Ot(this)}};p();l();var $e=class{formatMultiple(t){return Promise.all(t.map(e=>this.format(e)))}formatMultipleSync(t){return t.map(e=>this.formatSync(e))}},de=class extends $e{async format(t){return t}formatSync(t){return t}};p();l();p();l();p();l();var k=class extends K{constructor(e){super();u(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var sn=4;$t({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var me=class{constructor(){u(this,"lineBuffer",[]);u(this,"indentLevel",0);u(this,"hasWrittenAnything",!1);u(this,"lastCharacterIsSemicolon",!1);u(this,"lastCharacterIsNewline",!1);u(this,"nodeStackFrames",[])}get buffer(){return B&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
4
|
+
`),this.lineBuffer.join(`
|
|
5
|
+
`)+(this.lastCharacterIsNewline?`
|
|
6
|
+
`:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let r=e.length>0&&e.endsWith(`
|
|
7
|
+
`),i=r?e.substring(0,e.length-1):e,o=this.getIndentString(),s=i.replaceAll(`
|
|
15
8
|
`,`
|
|
16
|
-
${
|
|
17
|
-
`),this.writeInternal(
|
|
18
|
-
`)}writeNewLineIfLastLineNot(){this.
|
|
19
|
-
`)}
|
|
20
|
-
`)),this.buffer+=e}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*td)}};s();u();var wr=class{},wt=class extends wr{async format(e){return e}formatSync(e){return e}};s();u();function ri(r){return(r==null?void 0:r.name)!=null}s();u();s();u();s();u();var xt=class{constructor(){h(this,"reporter");h(this,"snippet");h(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:t}){(this.reporter==null||this.reporter.size()>e.errors.size())&&(this.reporter=e.errors.clone(),this.snippet=t)}getResponseOrThrow({endpoint:e}){var t;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(t=this.err)!=null?t:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}};var At=class{constructor(e){h(this,"context");this.context=e}async generate(e){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new xt;for(let i of t){let o=this.context.clone(),a=this.createSnippetGenerator(o);try{let c=await a.generateSnippet({endpoint:i,request:e});if(o.errors.empty())return{snippet:c,errors:void 0};n.update({context:o,snippet:c})}catch(c){n.err==null&&(n.err=c)}}return n.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new xt;for(let i of t){let o=this.context.clone(),a=this.createSnippetGenerator(o);try{let c=a.generateSnippetSync({endpoint:i,request:e});if(o.errors.empty())return{snippet:c,errors:void 0};n.update({context:o,snippet:c})}catch(c){n.err==null&&(n.err=c)}}return n.getResponseOrThrow({endpoint:e.endpoint})}};s();u();s();u();s();u();var Tt=class{constructor(){h(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let n=e.match(this.REFERENCE_REGEX);if(!(n==null||n[1]==null||n[2]==null))return{method:n[1],path:n[2]}}};s();u();var b={Critical:"CRITICAL",Warning:"WARNING"},bt=class r{constructor(){h(this,"errors");h(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(ci(pi({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(t=>t.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new r;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let t=[];for(let n of e){if(typeof n=="string"){t.push(n);continue}t[t.length-1]+=`[${n.index}]`}return t}};var It=class{constructor({ir:e,config:t}){h(this,"config");h(this,"errors");h(this,"_ir");h(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.errors=new bt,this.httpEndpointReferenceParser=new Tt}associateQueryParametersByWireValue({parameters:e,values:t}){let n=[];for(let[i,o]of Object.entries(t)){this.errors.scope(i);try{let a=e.find(f=>f.name.wireValue===i);if(a==null)throw this.newParameterNotRecognizedError(i);let c=this.isListTypeReference(a.typeReference)&&!Array.isArray(o)?[o]:o;n.push({name:a.name,typeReference:a.typeReference,value:c})}finally{this.errors.unscope()}}return n}associateByWireValue({parameters:e,values:t,ignoreMissingParameters:n}){let i=[];for(let[o,a]of Object.entries(t)){this.errors.scope(o);try{let c=e.find(f=>f.name.wireValue===o);if(c==null){if(n)continue;this.errors.add({severity:b.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:c.name,typeReference:c.typeReference,value:a})}finally{this.errors.unscope()}}return i}getSingleFileValue({property:e,record:t}){let n=t[e.wireValue];if(n!=null){if(typeof n!="string"){this.errors.add({severity:b.Critical,message:`Expected file value to be a string, got ${typeof n}`});return}return n}}getFileArrayValues({property:e,record:t}){let n=t[e.wireValue];if(n==null)return;if(!Array.isArray(n)){this.errors.add({severity:b.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:b.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}i.push(o)}return i}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:b.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let t=this._ir.types[e];if(t==null){this.errors.add({severity:b.Critical,message:`Type identified by "${e}" could not be found`});return}return t}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t}){let n=this.getRecord(t);if(n==null)return;let i=e.discriminant.wireValue,o=n[i];if(o==null){this.errors.add({severity:b.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:b.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let a=e.types[o];if(a==null){this.errors.add({severity:b.Critical,message:`No type found for discriminant value "${o}"`});return}let v=n,{[i]:c}=v,f=fi(v,[li(i)]);return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:f}}resolveEndpointOrThrow(e){let t=this.httpEndpointReferenceParser.tryParse(e);if(t==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(t)}resolveEndpointLocationOrThrow(e){let t=[];for(let n of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:n,parsedEndpoint:e})&&t.push(n);if(t.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return t}needsRequestParameter({request:e,inlinePathParameters:t,inlineFileProperties:n}){var i;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:t})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:n}):!((i=e.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:t}){var n,i;return t&&((i=(n=e.metadata)==null?void 0:n.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:E(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":{let n=t.environments.find(i=>i.id===e);return n==null?void 0:n.name}case"multipleBaseUrls":{let n=t.environments.find(i=>i.id===e);return n==null?void 0:n.name}default:E(t)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:b.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":return this.errors.add({severity:b.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let n=t.environments[0];if(n==null)return this.errors.add({severity:b.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(gt(n.urls));for(let o of gt(e))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:b.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${gt(n.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:b.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:b.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:b.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:t}){return new Error(`Expected auth type ${e.type}, got ${t.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:t}){return new Error(`Expected ${e}, got ${typeof t}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:t}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t});default:E(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t}){return this.fileUploadHasBodyProperties({fileUpload:e})||t&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:E(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:E(t)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:t}){return e.location.method===t.method&&e.location.path===t.path}};s();u();var J={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};s();u();s();u();function St(r,e){var n,i;let t=(n=r.split("/").pop())!=null?n:r;return e!=null&&e.stripExtension&&(i=t.split(".")[0])!=null?i:t}s();u();s();u();s();u();s();u();s();u();s();u();s();u();var rd=/[^0-9a-zA-Z_]/g,Se=class extends vt{constructor({packageName:t,rootImportPath:n,importPath:i,customConfig:o,formatter:a}){super();h(this,"packageName");h(this,"rootImportPath");h(this,"importPath");h(this,"customConfig");h(this,"formatter");h(this,"imports",{});this.packageName=t,this.rootImportPath=n,this.importPath=i,this.customConfig=o,this.formatter=a!=null?a:new wt}addImport(t){let n=this.imports[t];if(n!=null)return n;let i=new Set(Object.values(this.imports)),o=this.getValidAlias(St(t));for(;i.has(o);)o="_"+o;return this.imports[t]=o,o}getValidAlias(t){let n=t.split("-");return n[0]==null?t:n[0].replace(rd,"")}};var Et=class extends Se{constructor({packageName:e,rootImportPath:t,importPath:n,customConfig:i,formatter:o}){super({packageName:e,rootImportPath:t,importPath:n,customConfig:i,formatter:o})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format Go file: ${t}
|
|
21
|
-
|
|
22
|
-
${e}`)}return e}getContent(){let e=`package ${this.packageName}
|
|
9
|
+
${o}`);this.isAtStartOfLine()&&(s=o+s),r&&(s+=`
|
|
10
|
+
`),this.writeInternal(s)}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){B&&this.nodeStackFrames.push(...tt(t)),t.write(this),B&&et!=="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 k(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new k(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new k(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new k(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new k(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
|
+
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
13
|
+
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let o=1;o<t.length;o++){this.write(e);let s=t[o];s!=null&&r(s)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
|
|
14
|
+
`),this.lastCharacterIsSemicolon=t.endsWith(";");let r=t.split(`
|
|
15
|
+
`),i=B&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),i&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(r=>`${e?`(${e}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(De({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,et){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 sn}};p();l();p();l();p();l();var ye=class{constructor(){u(this,"reporter");u(this,"snippet");u(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 r,i;return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>((i=(r=this.snippet)==null?void 0:r.length)!=null?i:0)}};var ge=class{constructor(t){u(this,"context");this.context=t}async generate(t,e={}){let r=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i=new ye;for(let o of r){let s=this.context.clone(),f=this.createSnippetGenerator(s);try{let h=await f.generateSnippet({endpoint:o,request:t,options:e});if(s.errors.empty())return{snippet:h,errors:void 0};i.update({context:s,snippet:h})}catch(h){i.err==null&&(i.err=h)}}return i.getResponseOrThrow({endpoint:t.endpoint})}generateSync(t,e={}){let r=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i=new ye;for(let o of r){let s=this.context.clone(),f=this.createSnippetGenerator(s);try{let h=f.generateSnippetSync({endpoint:o,request:t,options:e});if(s.errors.empty())return{snippet:h,errors:void 0};i.update({context:s,snippet:h})}catch(h){i.err==null&&(i.err=h)}}return i.getResponseOrThrow({endpoint:t.endpoint})}};p();l();p();l();p();l();var we=class{constructor(){u(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let r=t.match(this.REFERENCE_REGEX);if(!(r==null||r[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};p();l();var v={Critical:"CRITICAL",Warning:"WARNING"},xe=class n{constructor(){u(this,"errors");u(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(pt(ut({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new n;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let r of t){if(typeof r=="string"){e.push(r);continue}e[e.length-1]+=`[${r.index}]`}return e}};var ve=class{constructor({ir:t,config:e,options:r={}}){u(this,"config");u(this,"options");u(this,"errors");u(this,"_ir");u(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=r,this.errors=new xe,this.httpEndpointReferenceParser=new we}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let s=t.find(h=>h.name.wireValue===i);if(s==null)throw this.newParameterNotRecognizedError(i);let f=this.isListTypeReference(s.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:s.name,typeReference:s.typeReference,value:f})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:t,values:e}){let r=[];for(let i of t){this.errors.scope(i.name.wireValue);try{let o=e[i.name.wireValue];if(o==null)if(i.typeReference.type==="primitive"&&i.typeReference.value==="STRING")o=`<${i.name.wireValue}>`;else{this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i.name.wireValue).message});continue}r.push({name:i.name,typeReference:i.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let i=[];for(let[o,s]of Object.entries(e)){this.errors.scope(o);try{let f=t.find(h=>h.name.wireValue===o);if(f==null){if(r)continue;this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:f.name,typeReference:f.typeReference,value:s})}finally{this.errors.unscope()}}return i}getExampleObjectProperties({parameters:t,snippetObject:e}){let r=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},i=[];for(let o of t){let s=r[o.name.wireValue];s==null?o.typeReference.type==="nullable"&&i.push({name:o.name,typeReference:o.typeReference,value:null}):i.push({name:o.name,typeReference:o.typeReference,value:s})}return i}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:v.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:t,record:e}){let r=e[t.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let i=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}i.push(o)}return i}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:v.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:v.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let r=this.getRecord(e);if(r==null)return;let i=t.discriminant.wireValue,o=r[i];if(o==null){this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let s=t.types[o];if(s==null){this.errors.add({severity:v.Critical,message:`No type found for discriminant value "${o}"`});return}let m=r,{[i]:f}=m,h=ft(m,[lt(i)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:h}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:t})&&e.push(r);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){var i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:r}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var r,i;return e&&((i=(r=t.metadata)==null?void 0:r.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:x(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}case"multipleBaseUrls":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}default:x(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=e.environments[0];if(r==null)return this.errors.add({severity:v.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(fe(r.urls));for(let o of fe(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: [${fe(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:x(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:x(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:x(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}};p();l();var _={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();l();p();l();function Te(n,t){var r,i;let e=(r=n.split("/").pop())!=null?r:n;return t!=null&&t.stripExtension&&(i=e.split(".")[0])!=null?i:e}p();l();p();l();p();l();p();l();var an=/[^0-9a-zA-Z_]/g,cn=["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],J=class extends me{constructor({packageName:e,rootImportPath:r,importPath:i,customConfig:o,formatter:s}){super();u(this,"packageName");u(this,"rootImportPath");u(this,"importPath");u(this,"customConfig");u(this,"formatter");u(this,"imports",{});this.packageName=e,this.rootImportPath=r,this.importPath=i,this.customConfig=o,this.formatter=s!=null?s:new de}addImport(e){let r=this.imports[e];if(r!=null)return r;if(e===this.rootImportPath&&this.customConfig.packageName!=null)return this.imports[e]=this.customConfig.packageName,this.customConfig.packageName;let i=new Set(Object.values(this.imports)),o=e.split("/");for(let f=1;f<=o.length;f++){let h=o.slice(-f),m=this.getValidAlias(h.join(""));if(!i.has(m))return this.imports[e]=m,m}let s=this.getValidAlias(Te(e));for(;i.has(s);)s="_"+s;return this.imports[e]=s,s}isValidAlias(e){return!cn.includes(e)}getValidAlias(e){let r=e.split("-");if(r[0]==null)return e;let i=r.map(o=>o.replace(an,"")).join("");return this.isValidAlias(i)?i:"_"+i}};var Ie=class extends J{constructor({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o}){super({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format Go file: ${e}
|
|
16
|
+
${t}`)}return t}toString(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(t)}catch(e){throw new Error(`Failed to format Go file: ${e}
|
|
17
|
+
${t}`)}return t}getContent(){let t=`package ${this.packageName}
|
|
23
18
|
|
|
24
|
-
`,
|
|
19
|
+
`,e=this.stringifyImports();return e.length>0?`${t}${e}
|
|
25
20
|
|
|
26
|
-
${this.buffer}`:
|
|
27
|
-
`);return
|
|
28
|
-
${
|
|
29
|
-
)`:""}};var
|
|
30
|
-
`).forEach(
|
|
31
|
-
`)?`\`${this.internalType.value}\``:`"${this.internalType.value}"`);break;case"struct":this.writeStruct({writer:t,struct:this.internalType});break;case"uuid":t.writeNode(gd({value:this.internalType.value}));break;default:E(this.internalType)}}static any(t){return new this({type:"any",value:t})}static bool(t){return new this({type:"bool",value:t})}static bytes(t){return new this({type:"bytes",value:t})}static date(t){return new this({type:"date",value:t})}static dateTime(t){return new this({type:"dateTime",value:t})}static enum(t){return new this({type:"enum",typeReference:t})}static float64(t){return new this({type:"float64",value:t})}static int(t){return new this({type:"int",value:t})}static int64(t){return new this({type:"int64",value:t})}static map({keyType:t,valueType:n,entries:i}){return new this({type:"map",keyType:t,valueType:n,entries:i})}static nil(){return new this({type:"nil"})}static nop(){return new this({type:"nop"})}static optional(t){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t})}static reference(t){return new this({type:"reference",value:t})}static slice({valueType:t,values:n}){return new this({type:"slice",valueType:t,values:n})}static string(t){return new this({type:"string",value:t})}static struct({typeReference:t,fields:n}){return new this({type:"struct",typeReference:t,fields:n})}static structPointer({typeReference:t,fields:n}){return new this({type:"optional",value:new this({type:"struct",typeReference:t,fields:n})})}static uuid(t){return new this({type:"uuid",value:t})}static isNop(t){return t.internalType.type==="optional"?this.isNop(t.internalType.value):t.internalType.type==="nop"}writeAny({writer:t,value:n}){switch(typeof n){case"boolean":t.write(n.toString());return;case"string":t.write(n.includes('"')?`\`${n}\``:`"${n}"`);return;case"number":t.write(n.toString());return;case"object":if(n==null){t.write("nil");return}if(Array.isArray(n)){this.writeAnyArray({writer:t,value:n});return}this.writeAnyObject({writer:t,value:n});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof n}`)}}writeAnyArray({writer:t,value:n}){if(t.write("[]interface{}"),n.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let i of n)t.writeNode(r.any(i)),t.writeLine(",");t.dedent(),t.write("}")}writeAnyObject({writer:t,value:n}){t.write("map[string]interface{}");let i=Object.entries(n);if(i.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let[o,a]of i)t.write(`"${o}": `),t.writeNode(r.any(a)),t.writeLine(",");t.dedent(),t.write("}")}writeMap({writer:t,map:n}){t.write("map["),t.writeNode(n.keyType),t.write("]"),t.writeNode(n.valueType);let i=vd({entries:n.entries});if(i.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of i)o.key.write(t),t.write(": "),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}writeOptional({writer:t,type:n}){if(yd.has(n.internalType.type)){t.writeNode(hd({writer:t,type:n}));return}if(np.has(n.internalType.type)){n.write(t);return}if(n.internalType.type==="enum"){t.writeNode(new oe({on:n.internalType.typeReference,method:"Ptr",arguments_:[]}));return}t.write("&"),n.write(t)}static isAlreadyOptional(t){return t.internalType.type==="optional"||np.has(t.internalType.type)}writeSlice({writer:t,slice:n}){t.write("[]"),t.writeNode(n.valueType);let i=xd({values:n.values});if(i.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of i)o.write(t),t.writeLine(",");t.dedent(),t.write("}")}writeStruct({writer:t,struct:n}){t.writeNode(n.typeReference);let i=wd({fields:n.fields});if(i.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of i)t.write(`${o.name}: `),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}};function hd({writer:r,type:e}){return new L({func:new q({name:dd({type:e}),importPath:r.rootImportPath}),arguments_:[e]})}function dd({type:r}){switch(r.internalType.type){case"bool":return"Bool";case"date":case"dateTime":return"Time";case"float64":return"Float64";case"int":return"Int";case"int64":return"Int64";case"string":return"String";case"uuid":return"UUID";default:return""}}function md({writer:r,type:e}){let t=e instanceof Date?"MustParseDate":"MustParseDateTime";return new L({func:new q({name:t,importPath:r.rootImportPath}),arguments_:[new K(`"${e.value}"`)]})}function gd({value:r}){return new L({func:new q({name:"MustParse",importPath:"github.com/google/uuid"}),arguments_:[new K(`"${r}"`)]})}function vd({entries:r}){return r.filter(e=>!M.isNop(e.key)&&!M.isNop(e.value))}function wd({fields:r}){return r.filter(e=>!M.isNop(e.value))}function xd({values:r}){return r.filter(e=>!M.isNop(e))}function xr({writer:r,arguments_:e}){let t=Td(e);if(t.length===0){r.write("()");return}r.writeLine("("),r.indent();for(let n of t)Ad({writer:r,argument:n}),r.writeLine(",");r.dedent(),r.write(")")}function Ad({writer:r,argument:e}){ri(e)?r.writeNodeOrString(e.assignment):e.write(r)}function Td(r){return r.filter(e=>!(e instanceof M&&M.isNop(e)))}var L=class extends S{constructor({func:t,arguments_:n}){super();h(this,"func");h(this,"arguments_");this.func=t,this.arguments_=n}write(t){t.writeNode(this.func),xr({writer:t,arguments_:this.arguments_})}};s();u();var Ne=class extends S{constructor({name:t,type:n,docs:i}){super();h(this,"name");h(this,"type");h(this,"docs");this.name=t,this.type=n,this.docs=i}write(t){t.writeNode(new k({docs:this.docs})),t.write(`${this.name} `),this.type.write(t)}};s();u();var Oe=class extends S{constructor({name:t,importPath:n,docs:i}){super();h(this,"name");h(this,"importPath");h(this,"docs");h(this,"fields",[]);h(this,"methods",[]);this.name=t,this.importPath=n,this.docs=i}addField(t){this.fields.push(t)}addMethod(t){this.methods.push(t)}write(t){if(t.writeNode(new k({docs:this.docs})),t.write(`type ${this.name} struct {`),this.fields.length===0)t.writeLine("}");else{t.newLine(),t.indent();for(let n of this.fields)t.writeNode(n),t.newLine();t.dedent(),t.writeLine("}")}if(this.methods.length>0){t.newLine();for(let n of this.methods)t.writeNode(n),t.newLine()}}};var y={};Ur(y,{AstNode:()=>S,CodeBlock:()=>K,Enum:()=>Ee,Field:()=>Pe,File:()=>Re,Func:()=>Fe,FuncInvocation:()=>L,Method:()=>ie,MethodInvocation:()=>oe,Parameter:()=>Ne,Struct:()=>Oe,Type:()=>Pt,TypeInstantiation:()=>M,TypeReference:()=>q,Writer:()=>Se,codeblock:()=>bd,enum_:()=>Id,field:()=>Sd,file:()=>Ed,func:()=>Pd,invokeFunc:()=>Rd,invokeMethod:()=>Fd,method:()=>Nd,parameter:()=>Od,struct:()=>Ud,typeReference:()=>Bd});s();u();function bd(r){return new K(r)}function Id(r){return new Ee(r)}function Sd(r){return new Pe(r)}function Ed(r={}){return new Re(r)}function Pd(r){return new Fe(r)}function Rd(r){return new L(r)}function Fd(r){return new oe(r)}function Nd(r){return new ie(r)}function Od(r){return new Ne(r)}function Ud(r){return new Oe(r)}function Bd(r){return new q(r)}var ip="example",op="fern",$d="do",ap="client",Ar=class{constructor({context:e,formatter:t}){h(this,"context");h(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t}){var i;return await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({packageName:ip,importPath:op,rootImportPath:this.context.rootImportPath,customConfig:(i=this.context.customConfig)!=null?i:{},formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t}){var i;return this.buildCodeBlock({endpoint:e,snippet:t}).toString({packageName:ip,importPath:op,rootImportPath:this.context.rootImportPath,customConfig:(i=this.context.customConfig)!=null?i:{},formatter:this.formatter})}buildCodeBlock({endpoint:e,snippet:t}){return y.func({name:$d,parameters:[],return_:[],body:y.codeblock(n=>{n.writeNode(this.constructClient({endpoint:e,snippet:t})),n.writeLine(),n.writeNode(this.callMethod({endpoint:e,snippet:t}))})})}constructClient({endpoint:e,snippet:t}){return y.codeblock(n=>{n.write(`${ap} := `),n.writeNode(this.getRootClientFuncInvocation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){return y.invokeMethod({on:y.codeblock(ap),method:this.getMethod({endpoint:e}),arguments_:[this.context.getContextTodoFunctionInvocation(),...this.getMethodArgs({endpoint:e,snippet:t})]})}getConstructorArgs({endpoint:e,snippet:t}){let n=[],i=this.getConstructorBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});return i!=null&&n.push(i),e.auth!=null&&(t.auth!=null?n.push(this.getConstructorAuthArg({auth:e.auth,values:t.auth})):this.context.errors.add({severity:b.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(J.Headers),this.context.ir.headers!=null&&t.headers!=null&&n.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),n}getConstructorAuthArg({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.context.errors.add({severity:b.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),y.TypeInstantiation.nop()):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.context.errors.add({severity:b.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),y.TypeInstantiation.nop()):this.getConstructorBearerAuthArg({auth:e,values:t});case"header":return t.type!=="header"?(this.context.errors.add({severity:b.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),y.TypeInstantiation.nop()):this.getConstructorHeaderAuthArg({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.context.errors.add({severity:b.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),y.TypeInstantiation.nop()):(this.context.errors.add({severity:b.Warning,message:"The Go SDK doesn't support OAuth client credentials yet"}),y.TypeInstantiation.nop());default:E(e)}}getConstructorBasicAuthArg({auth:e,values:t}){return y.codeblock(n=>{n.writeNode(y.invokeFunc({func:y.typeReference({name:"WithBasicAuth",importPath:this.context.getOptionImportPath()}),arguments_:[y.TypeInstantiation.string(t.username),y.TypeInstantiation.string(t.password)]}))})}getConstructorBaseUrlArg({baseUrl:e,environment:t}){let n=this.getBaseUrlArg({baseUrl:e,environment:t});if(n!=null)return y.codeblock(i=>{i.writeNode(y.invokeFunc({func:y.typeReference({name:"WithBaseURL",importPath:this.context.getOptionImportPath()}),arguments_:[n]}))})}getBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:b.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return y.TypeInstantiation.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let n=this.context.getEnvironmentTypeReferenceFromID(t);if(n==null){this.context.errors.add({severity:b.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return y.TypeInstantiation.reference(n)}this.context.isMultiEnvironmentValues(t)&&this.context.errors.add({severity:b.Warning,message:"The Go SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}}getConstructorBearerAuthArg({auth:e,values:t}){return y.codeblock(n=>{n.writeNode(y.invokeFunc({func:y.typeReference({name:`With${e.token.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[y.TypeInstantiation.string(t.token)]}))})}getConstructorHeaderAuthArg({auth:e,values:t}){return y.codeblock(n=>{n.writeNode(y.invokeFunc({func:y.typeReference({name:`With${e.header.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.header.typeReference,value:t.value})]}))})}getConstructorHeaderArgs({headers:e,values:t}){let n=[];for(let i of e){let o=this.getConstructorHeaderArg({header:i,value:t.value});o!=null&&n.push(o)}return n}getConstructorHeaderArg({header:e,value:t}){let n=this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.typeReference,value:t});if(!y.TypeInstantiation.isNop(n))return y.codeblock(i=>{i.writeNode(y.invokeFunc({func:y.typeReference({name:`With${e.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[n]}))})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:E(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var o,a;let n=[];this.context.errors.scope(J.PathParameters);let i=[...(o=this.context.ir.pathParameters)!=null?o:[],...(a=e.pathParameters)!=null?a:[]];return i.length>0&&n.push(...this.getPathParameters({namedParameters:i,snippet:t}).map(c=>c.value)),this.context.errors.unscope(),this.context.errors.scope(J.RequestBody),e.body!=null&&n.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),n}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.value,value:t});default:E(e)}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:b.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),y.TypeInstantiation.nop()):y.TypeInstantiation.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var v,g,m,w,x,I;let n=[],{inlinePathParameters:i,inlineFileProperties:o}={inlinePathParameters:(g=(v=this.context.customConfig)==null?void 0:v.inlinePathParameters)!=null?g:!1,inlineFileProperties:(w=(m=this.context.customConfig)==null?void 0:m.inlineFileProperties)!=null?w:!1};this.context.errors.scope(J.PathParameters);let a=[],c=[...(x=this.context.ir.pathParameters)!=null?x:[],...(I=e.pathParameters)!=null?I:[]];c.length>0&&a.push(...this.getPathParameters({namedParameters:c,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(J.RequestBody);let f=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:i})||n.push(...a.map(P=>P.value)),o||n.push(...f.fileFields.map(P=>P.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:i,inlineFileProperties:o})&&n.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:i})?a:[],filePropertyInfo:f})),n}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:n,filePropertyInfo:i}){var g,m,w,x;this.context.errors.scope(J.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(g=e.queryParameters)!=null?g:[],values:(m=t.queryParameters)!=null?m:{}}).map(I=>({name:I.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(I)}));this.context.errors.unscope(),this.context.errors.scope(J.Headers);let f=this.context.associateByWireValue({parameters:(w=e.headers)!=null?w:[],values:(x=t.headers)!=null?x:{}}).map(I=>({name:I.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(I)}));this.context.errors.unscope(),this.context.errors.scope(J.RequestBody);let v=e.body!=null?this.getInlinedRequestBodyStructFields({body:e.body,value:t.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),y.TypeInstantiation.structPointer({typeReference:y.typeReference({name:this.context.getMethodName(e.declaration.name),importPath:this.context.getImportPath(e.declaration.fernFilepath)}),fields:[...n,...a,...f,...v]})}getInlinedRequestBodyStructFields({body:e,value:t,filePropertyInfo:n}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyStructFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyStructField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyStructFields({filePropertyInfo:n});default:E(e)}}getFileUploadRequestBodyStructFields({filePropertyInfo:e}){var t;return(t=this.context.customConfig)!=null&&t.inlineFileProperties?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyStructField({body:e,value:t}){return{name:this.context.getTypeName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeInstantiation({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeInstantiation({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.value,value:t});default:E(e)}}getInlinedRequestBodyPropertyStructFields({parameters:e,value:t}){var o;let n=[],i=this.context.associateByWireValue({parameters:e,values:(o=this.context.getRecord(t))!=null?o:{}});for(let a of i)n.push({name:this.context.getTypeName(a.name.name),value:this.context.dynamicTypeInstantiationMapper.convert(a)});return n}getPathParameters({namedParameters:e,snippet:t}){var o;let n=[],i=this.context.associateByWireValue({parameters:e,values:(o=t.pathParameters)!=null?o:{}});for(let a of i)n.push({name:this.context.getTypeName(a.name.name),value:this.context.dynamicTypeInstantiationMapper.convert(a)});return n}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getRootClientFuncInvocation(e){return y.invokeFunc({func:y.typeReference({name:this.context.getClientConstructorName(),importPath:this.context.getClientImportPath()}),arguments_:e})}};s();u();s();u();var Tr=class{constructor({context:e}){h(this,"context");this.context=e}convert(e){if(e.value===null&&!this.context.isNullable(e.typeReference)&&this.context.errors.add({severity:b.Critical,message:"Expected non-null value, but got null"}),e.value==null)return y.TypeInstantiation.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return y.TypeInstantiation.nop();case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?y.TypeInstantiation.nop():this.convertNamed({named:t,value:e.value,as:e.as})}case"nullable":return y.TypeInstantiation.optional(this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as}));case"optional":return y.TypeInstantiation.optional(this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertList({list:e.typeReference.value,value:e.value});case"unknown":return this.convertUnknown({value:e.value});default:E(e.typeReference)}}convertList({list:e,value:t}){return Array.isArray(t)?y.TypeInstantiation.slice({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:e,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:b.Critical,message:`Expected array but got: ${typeof t}`}),y.TypeInstantiation.nop())}convertMap({map:e,value:t}){return typeof t!="object"||t==null?(this.context.errors.add({severity:b.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),y.TypeInstantiation.nop()):y.TypeInstantiation.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(t).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:e.key,value:n,as:"key"}),value:this.convert({typeReference:e.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:n}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:E(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let n=this.context.getGoTypeReferenceFromDeclaration({declaration:e.declaration}),i=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(i==null)return y.TypeInstantiation.nop();let o=i.singleDiscriminatedUnionType,a=this.getBaseFields({discriminatedUnionTypeInstance:i,singleDiscriminatedUnionType:o});switch(o.type){case"samePropertiesAsObject":{let c=this.context.resolveNamedType({typeId:o.typeId});return c==null?y.TypeInstantiation.nop():y.TypeInstantiation.structPointer({typeReference:n,fields:[{name:this.context.getTypeName(o.discriminantValue.name),value:this.convertNamed({named:c,value:i.value})},...a]})}case"singleProperty":{let c=this.context.getRecord(i.value);if(c==null)return y.TypeInstantiation.nop();try{return this.context.errors.scope(o.discriminantValue.wireValue),y.TypeInstantiation.structPointer({typeReference:n,fields:[{name:this.context.getTypeName(o.discriminantValue.name),value:this.convert({typeReference:o.typeReference,value:c[o.discriminantValue.wireValue]})},...a]})}finally{this.context.errors.unscope()}}case"noProperties":return y.TypeInstantiation.structPointer({typeReference:n,fields:[{name:this.context.getTypeName(i.discriminantValue.name),value:y.TypeInstantiation.string(o.discriminantValue.wireValue)},...a]});default:E(o)}}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t}){var i,o;return this.context.associateByWireValue({parameters:(i=t.properties)!=null?i:[],values:(o=this.context.getRecord(e.value))!=null?o:{},ignoreMissingParameters:!0}).map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getTypeName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}})}convertObject({object_:e,value:t}){var i;let n=this.context.associateByWireValue({parameters:e.properties,values:(i=this.context.getRecord(t))!=null?i:{}});return y.TypeInstantiation.structPointer({typeReference:y.typeReference({name:this.context.getTypeName(e.declaration.name),importPath:this.context.getImportPath(e.declaration.fernFilepath)}),fields:n.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getTypeName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:t}){let n=this.getEnumValueName({enum_:e,value:t});return n==null?y.TypeInstantiation.nop():y.TypeInstantiation.enum(y.typeReference({name:n,importPath:this.context.getImportPath(e.declaration.fernFilepath)}))}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:b.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let n=e.values.find(i=>i.wireValue===t);if(n==null){this.context.errors.add({severity:b.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return`${this.context.getTypeName(e.declaration.name)}${this.context.getTypeName(n.name)}`}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});if(n==null)return y.TypeInstantiation.nop();let i=this.getUndiscriminatedUnionFieldName({typeReference:n.valueTypeReference});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.structPointer({typeReference:this.context.getGoTypeReferenceFromDeclaration({declaration:e.declaration}),fields:[{name:i,value:n.typeInstantiation}]})}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){for(let n of e.types)try{let i=this.convert({typeReference:n,value:t});return{valueTypeReference:n,typeInstantiation:i}}catch(i){continue}this.context.errors.add({severity:b.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}getUndiscriminatedUnionFieldName({typeReference:e}){switch(e.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:e});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:e.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:e});case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t==null?void 0:this.context.getTypeName(t.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"nullable":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:e.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:e});case"unknown":return"Unknown";default:E(e)}}getUndiscriminatedUnionFieldNameForList({list:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`${t}List`}getUndiscriminatedUnionFieldNameForMap({map:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e.key});if(t==null)return;let n=this.getUndiscriminatedUnionFieldName({typeReference:e.value});if(n!=null)return`${t}${n}Map`}getUndiscriminatedUnionFieldNameForOptional({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`${t}Optional`}getUndiscriminatedUnionFieldNameForSet({set:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`${t}Set`}getUndiscriminatedUnionFieldNameForLiteral({literal:e}){switch(e.type){case"boolean":return e.value?"TrueLiteral":"FalseLiteral";case"string":return`${e.value}StringLiteral`;default:E(e)}}getUndiscriminatedUnionFieldNameForPrimitive({primitive:e}){switch(e){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:E(e)}}convertUnknown({value:e}){return y.TypeInstantiation.any(e)}convertPrimitive({primitive:e,value:t,as:n}){switch(e){case"INTEGER":case"UINT":{let i=this.getValueAsNumber({value:t,as:n});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.int(i)}case"LONG":case"UINT_64":{let i=this.getValueAsNumber({value:t,as:n});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.int64(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:t,as:n});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.float64(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:t,as:n});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.bool(i)}case"STRING":{let i=this.context.getValueAsString({value:t});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.string(i)}case"DATE":{let i=this.context.getValueAsString({value:t});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.date(i)}case"DATE_TIME":{let i=this.context.getValueAsString({value:t});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.dateTime(i)}case"UUID":{let i=this.context.getValueAsString({value:t});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.uuid(i)}case"BASE_64":{let i=this.context.getValueAsString({value:t});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.bytes(i)}case"BIG_INTEGER":{let i=this.context.getValueAsString({value:t});return i==null?y.TypeInstantiation.nop():y.TypeInstantiation.string(i)}default:E(e)}}getValueAsNumber({value:e,as:t}){let n=t==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:e,as:t}){let n=t==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:n})}};s();u();var br=class{constructor({context:e}){h(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return y.Type.slice(this.convert({typeReference:e.typeReference}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return y.Type.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t})}case"optional":return y.Type.optional(this.convert({typeReference:e.typeReference.value}));case"nullable":return y.Type.optional(this.convert({typeReference:e.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return y.Type.slice(this.convert({typeReference:e.typeReference}));case"unknown":return this.convertUnknown();default:E(e.typeReference)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return y.Type.bool();case"string":return y.Type.string()}}convertNamed({named:e}){let t=y.Type.reference(y.typeReference({name:this.context.getTypeName(e.declaration.name),importPath:this.context.getImportPath(e.declaration.fernFilepath)}));switch(e.type){case"alias":case"enum":return t;case"discriminatedUnion":case"object":case"undiscriminatedUnion":return y.Type.pointer(t);default:E(e)}}convertUnknown(){return y.Type.any()}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return y.Type.int();case"UINT":return y.Type.int();case"LONG":return y.Type.int64();case"UINT_64":return y.Type.int64();case"FLOAT":return y.Type.float64();case"DOUBLE":return y.Type.float64();case"BOOLEAN":return y.Type.bool();case"STRING":return y.Type.string();case"DATE":return y.Type.date();case"DATE_TIME":return y.Type.dateTime();case"UUID":return y.Type.uuid();case"BASE_64":return y.Type.bytes();case"BIG_INTEGER":return y.Type.string();default:E(e)}}};s();u();var Ir=class{constructor({context:e}){h(this,"context");this.context=e}getFilePropertyInfo({body:e,value:t}){var o;let n={fileFields:[],bodyPropertyFields:[]},i=(o=this.context.getRecord(t))!=null?o:{};for(let a of e.properties)switch(a.type){case"file":n.fileFields.push({name:this.context.getTypeName(a.name),value:this.getSingleFileProperty({property:a,record:i})});break;case"fileArray":n.fileFields.push({name:this.context.getTypeName(a.name),value:this.getArrayFileProperty({property:a,record:i})});break;case"bodyProperty":n.bodyPropertyFields.push({name:this.context.getTypeName(a.name.name),value:this.getBodyProperty({property:a,record:i})});break;default:E(a)}return n}getSingleFileProperty({property:e,record:t}){let n=this.context.getSingleFileValue({property:e,record:t});return n==null?y.TypeInstantiation.nop():y.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(n))}getArrayFileProperty({property:e,record:t}){let n=this.context.getFileArrayValues({property:e,record:t});return n==null?y.TypeInstantiation.nop():y.TypeInstantiation.slice({valueType:y.Type.reference(this.context.getIoReaderTypeReference()),values:n.map(i=>y.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(i)))})}getBodyProperty({property:e,record:t}){let n=t[e.name.wireValue];return n==null?y.TypeInstantiation.nop():this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.typeReference,value:n})}};var Sr=class r extends It{constructor({ir:t,config:n}){super({ir:t,config:n});h(this,"ir");h(this,"customConfig");h(this,"dynamicTypeMapper");h(this,"dynamicTypeInstantiationMapper");h(this,"filePropertyMapper");h(this,"rootImportPath");this.ir=t,this.customConfig=n.customConfig!=null?n.customConfig:void 0,this.dynamicTypeMapper=new br({context:this}),this.dynamicTypeInstantiationMapper=new Tr({context:this}),this.filePropertyMapper=new Ir({context:this}),this.rootImportPath=ni({config:n,customConfig:this.customConfig})}clone(){return new r({ir:this.ir,config:this.config})}getMethodName(t){return t.pascalCase.unsafeName}getTypeName(t){return t.pascalCase.unsafeName}getImportPath(t){let n=t.packagePath.map(i=>i.pascalCase.unsafeName.toLowerCase());return[this.rootImportPath,...n].join("/")}getContextTypeReference(){return y.typeReference({name:"Context",importPath:"context"})}getContextTodoFunctionInvocation(){return y.invokeFunc({func:y.typeReference({name:"TODO",importPath:"context"}),arguments_:[]})}getIoReaderTypeReference(){return y.typeReference({name:"Reader",importPath:"io"})}getNewStringsReaderFunctionInvocation(t){return y.invokeFunc({func:y.typeReference({name:"NewReader",importPath:"strings"}),arguments_:[y.TypeInstantiation.string(t)]})}getClientConstructorName(){var t,n;return((t=this.customConfig)==null?void 0:t.clientConstructorName)!=null?this.customConfig.clientConstructorName:((n=this.customConfig)==null?void 0:n.exportedClientName)!=null?`New${this.customConfig.exportedClientName}`:`New${this.getClientName()}`}getClientName(){var t;return((t=this.customConfig)==null?void 0:t.clientName)!=null?this.customConfig.clientName:"Client"}getClientImportPath(){var t;return((t=this.customConfig)==null?void 0:t.packageLayout)==="flat"?this.rootImportPath:`${this.rootImportPath}/client`}getOptionImportPath(){return`${this.rootImportPath}/option`}getGoTypeReferenceFromDeclaration({declaration:t}){return y.typeReference({name:t.name.pascalCase.unsafeName,importPath:this.getImportPath(t.fernFilepath)})}getEnvironmentTypeReferenceFromID(t){let n=this.resolveEnvironmentName(t);if(n!=null)return this.getEnvironmentTypeReference(n)}getEnvironmentTypeReference(t){return y.typeReference({name:`Environments.${this.getTypeName(t)}`,importPath:this.rootImportPath})}};var Er=class extends At{constructor({ir:t,config:n,formatter:i}){super(new Sr({ir:t,config:n}));h(this,"formatter");this.formatter=i}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}createSnippetGenerator(t){return new Ar({context:t,formatter:this.formatter})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
21
|
+
${this.buffer}`:t+this.buffer}stringifyImports(){let t=Object.entries(this.imports).filter(([e,r])=>e!==this.importPath).map(([e,r])=>` ${r} "${e}"`).join(`
|
|
22
|
+
`);return t?`import (
|
|
23
|
+
${t}
|
|
24
|
+
)`:""}};var a={};ht(a,{Alias:()=>X,AstNode:()=>w,CodeBlock:()=>L,Enum:()=>Q,Field:()=>Z,File:()=>ee,Func:()=>te,FuncInvocation:()=>S,IoReaderTypeReference:()=>ot,Method:()=>W,MethodInvocation:()=>V,MultiNode:()=>Re,Parameter:()=>re,Pointer:()=>ne,Selector:()=>ie,Struct:()=>oe,TimeTypeReference:()=>Oe,Type:()=>Ae,TypeDeclaration:()=>se,TypeInstantiation:()=>E,TypeReference:()=>F,UuidTypeReference:()=>Ve,Writer:()=>J,alias:()=>Pn,codeblock:()=>kn,enum_:()=>Sn,field:()=>Cn,file:()=>Un,func:()=>Bn,identifier:()=>_n,invokeFunc:()=>Ln,invokeMethod:()=>Mn,method:()=>Dn,parameter:()=>$n,pointer:()=>On,selector:()=>Vn,struct:()=>Wn,switch_:()=>qn,typeDeclaration:()=>Gn,typeReference:()=>Yn});p();l();p();l();p();l();p();l();p();l();var w=class extends K{async toStringAsync({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o}){let s=new Ie({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o});return this.write(s),s.toStringAsync()}toString({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o}){let s=new Ie({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o});return this.write(s),s.toString()}};var A=class extends w{constructor({docs:e}={}){super();u(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
|
|
25
|
+
`).forEach(r=>{e.writeLine(`// ${r}`)})}};var X=class extends w{constructor({name:e,type:r,docs:i}){super();u(this,"name");u(this,"type");u(this,"docs");this.name=e,this.type=r,this.docs=i}write(e){e.writeNode(new A({docs:this.docs})),e.write("type "),e.write(this.name),e.write(" = "),e.writeNode(this.type)}};p();l();var L=class extends w{constructor(e){super();u(this,"arg");this.arg=e}write(e){return new k(this.arg).write(e)}};p();l();p();l();var O=class extends w{constructor(e){super();u(this,"name");this.name=e}write(e){e.write(this.name)}};p();l();p();l();p();l();function ue({writer:n,arguments_:t,multiline:e=!0}){let r=t.map(i=>i instanceof E&&E.isNop(i)?E.nil():i);if(r.length===0){n.write("()");return}if(e){wn({writer:n,arguments_:r});return}xn({writer:n,arguments_:r})}function wn({writer:n,arguments_:t}){n.writeLine("("),n.indent();for(let e of t)e.write(n),n.writeLine(",");n.dedent(),n.write(")")}function xn({writer:n,arguments_:t}){n.write("("),t.forEach((e,r)=>{r>0&&n.write(", "),e.write(n)}),n.write(")")}var S=class extends w{constructor({func:e,arguments_:r,multiline:i=!0}){super();u(this,"func");u(this,"arguments_");u(this,"multiline");this.func=e,this.arguments_=r,this.multiline=i}write(e){e.writeNode(this.func),ue({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};p();l();p();l();function jt({writer:n,generics:t}){t.length!==0&&(n.write("["),t.forEach((e,r)=>{r>0&&n.write(", "),e!=null&&n.writeNode(e)}),n.write("]"))}var F=class extends w{constructor({name:e,importPath:r,generics:i}){super();u(this,"name");u(this,"importPath");u(this,"generics");this.name=e,this.importPath=r,this.generics=i}write(e){if(this.importPath==null||e.importPath===this.importPath){e.write(this.name);return}let r=e.addImport(this.importPath);e.write(`${r}.${this.name}`),this.generics!=null&&jt({writer:e,generics:this.generics})}};p();l();var V=class extends w{constructor({method:e,arguments_:r,on:i,multiline:o}){super();u(this,"on");u(this,"method");u(this,"arguments_");u(this,"multiline");this.on=i,this.method=e,this.arguments_=r,this.multiline=o}write(e){this.on.write(e),e.write("."),e.write(this.method),ue({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};var vn=new Set(["bool","date","dateTime","float64","int","int64","string","uuid"]),Ht=new Set(["any","bytes","map","slice"]),E=class n extends w{constructor(e){super();u(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"any":this.writeAny({writer:e,value:this.internalType.value});break;case"bool":e.write(this.internalType.value.toString());break;case"bytes":e.write(`[]byte("${this.internalType.value}")`);break;case"date":case"dateTime":e.writeNode(Rn({writer:e,type:this.internalType}));break;case"enum":e.writeNode(this.internalType.typeReference);break;case"float64":e.write(this.internalType.value.toString());break;case"int":case"int64":e.write(this.internalType.value.toString());break;case"map":this.writeMap({writer:e,map:this.internalType});break;case"nil":e.write("nil");break;case"nop":break;case"optional":this.writeOptional({writer:e,type:this.internalType.value});break;case"reference":e.writeNode(this.internalType.value);break;case"slice":this.writeSlice({writer:e,slice:this.internalType});break;case"string":e.write(this.internalType.value.includes('"')||this.internalType.value.includes(`
|
|
26
|
+
`)?`\`${this.internalType.value}\``:`"${this.internalType.value}"`);break;case"struct":this.writeStruct({writer:e,struct:this.internalType});break;case"uuid":e.writeNode(Nn({value:this.internalType.value}));break;default:x(this.internalType)}}static any(e){return new this({type:"any",value:e})}static bool(e){return new this({type:"bool",value:e})}static bytes(e){return new this({type:"bytes",value:e})}static date(e){return new this({type:"date",value:e})}static dateTime(e){return new this({type:"dateTime",value:e})}static enum(e){return new this({type:"enum",typeReference:e})}static float64(e){return new this({type:"float64",value:e})}static int(e){return new this({type:"int",value:e})}static int64(e){return new this({type:"int64",value:e})}static map({keyType:e,valueType:r,entries:i}){return new this({type:"map",keyType:e,valueType:r,entries:i})}static nil(){return new this({type:"nil"})}static nop(){return new this({type:"nop"})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static reference(e){return new this({type:"reference",value:e})}static slice({valueType:e,values:r}){return new this({type:"slice",valueType:e,values:r})}static string(e){return new this({type:"string",value:e})}static struct({typeReference:e,fields:r}){return new this({type:"struct",typeReference:e,fields:r})}static structPointer({typeReference:e,fields:r,generics:i}){return new this({type:"optional",value:new this({type:"struct",typeReference:e,fields:r,generics:i})})}static uuid(e){return new this({type:"uuid",value:e})}static isNop(e){return e.internalType.type==="optional"?this.isNop(e.internalType.value):e.internalType.type==="nop"}writeAny({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(r.includes('"')?`\`${r}\``:`"${r}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("nil");return}if(Array.isArray(r)){this.writeAnyArray({writer:e,value:r});return}this.writeAnyObject({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeAnyArray({writer:e,value:r}){if(e.write("[]any"),r.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let i of r)e.writeNode(n.any(i)),e.writeLine(",");e.dedent(),e.write("}")}writeAnyObject({writer:e,value:r}){e.write("map[string]any");let i=Object.entries(r);if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[o,s]of i)e.write(`"${o}": `),e.writeNode(n.any(s)),e.writeLine(",");e.dedent(),e.write("}")}writeMap({writer:e,map:r}){e.write("map["),e.writeNode(r.keyType),e.write("]"),e.writeNode(r.valueType);let i=An({entries:r.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("}")}writeOptional({writer:e,type:r}){if(vn.has(r.internalType.type)){e.writeNode(Tn({writer:e,type:r}));return}if(Ht.has(r.internalType.type)){r.write(e);return}if(r.internalType.type==="enum"){e.writeNode(new V({on:r.internalType.typeReference,method:"Ptr",arguments_:[]}));return}e.write("&"),r.write(e)}static isAlreadyOptional(e){return e.internalType.type==="optional"||Ht.has(e.internalType.type)}writeSlice({writer:e,slice:r}){e.write("[]"),e.writeNode(r.valueType);let i=Fn({values:r.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("}")}writeStruct({writer:e,struct:r}){e.writeNode(r.typeReference),r.generics!=null&&(e.write("["),r.generics.forEach((o,s)=>{s>0&&e.write(", "),e.writeNode(o)}),e.write("]"));let i=En({fields:r.fields});if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let o of i)e.write(`${o.name}: `),o.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}};function Tn({writer:n,type:t}){return new S({func:new F({name:In({type:t}),importPath:n.rootImportPath}),arguments_:[t]})}function In({type:n}){switch(n.internalType.type){case"bool":return"Bool";case"date":case"dateTime":return"Time";case"float64":return"Float64";case"int":return"Int";case"int64":return"Int64";case"string":return"String";case"uuid":return"UUID";default:return""}}function Rn({writer:n,type:t}){let e=t.type==="date"?"MustParseDate":"MustParseDateTime";return new S({func:new F({name:e,importPath:n.rootImportPath}),arguments_:[new L(`"${t.value}"`)]})}function Nn({value:n}){return new S({func:new F({name:"MustParse",importPath:"github.com/google/uuid"}),arguments_:[new L(`"${n}"`)]})}function An({entries:n}){return n.filter(t=>!E.isNop(t.key)&&!E.isNop(t.value))}function En({fields:n}){return n.filter(t=>!E.isNop(t.value))}function Fn({values:n}){return n.filter(t=>!E.isNop(t))}var Q=class n extends w{constructor({name:e,docs:r}){super();u(this,"name");u(this,"docs");u(this,"members",[]);u(this,"methods",[]);u(this,"constructor_");this.name=e,this.docs=r}addConstructor(e){this.constructor_=e}addMember(e){this.members.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeType({writer:e}),this.writeMembers({writer:e}),this.writeConstructor({writer:e}),this.writeMethods({writer:e})}writeType({writer:e}){e.writeNode(new A({docs:this.docs})),e.writeLine(`type ${this.name} string`)}writeMembers({writer:e}){if(this.members.length!==0){e.newLine(),e.writeLine("const ("),e.indent();for(let r of this.members)e.writeNode(new A({docs:r.docs})),e.writeNode(n.getMemberIdentifier({name:this.name,member:r})),e.write(" = "),e.writeNode(E.string(r.value)),e.newLine();e.dedent(),e.write(")")}}writeConstructor({writer:e}){this.constructor_!=null&&(e.newLine(),e.writeNode(this.constructor_))}writeMethods({writer:e}){e.newLine();for(let r of this.methods)e.newLine(),e.writeNode(r),e.newLine()}static getMemberIdentifier({name:e,member:r}){return new O(`${e}${r.name}`)}};p();l();var Z=class extends w{constructor({name:e,type:r,docs:i,tags:o}){super();u(this,"name");u(this,"type");u(this,"docs");u(this,"tags",[]);this.name=e,this.type=r,this.docs=i,this.tags=o!=null?o:[]}addTags(...e){this.tags.push(...e)}write(e){e.writeNode(new A({docs:this.docs})),e.write(`${this.name} `),this.type.write(e),this.writeTags({writer:e})}writeTags({writer:e}){this.tags.length!==0&&(e.write(" `"),this.tags.forEach((r,i)=>{i>0&&e.write(" "),e.write(`${r.name}:"${r.value}"`)}),e.write("`"))}};p();l();var ee=class extends w{constructor({nodes:e}={nodes:[]}){super();u(this,"nodes");this.nodes=e!=null?e:[]}add(...e){this.nodes.push(...e)}write(e){for(let r of this.nodes)r.write(e)}};p();l();p();l();var W=class extends w{constructor({name:e,parameters:r,return_:i,body:o,docs:s,typeReference:f,multiline:h,receiver:m,pointerReceiver:y}){super();u(this,"parameters");u(this,"return_");u(this,"name");u(this,"body");u(this,"docs");u(this,"typeReference");u(this,"multiline");u(this,"receiver");u(this,"pointerReceiver");this.name=e,this.parameters=r,this.return_=i,this.body=o,this.docs=s,this.typeReference=f,this.multiline=h,this.receiver=m,this.pointerReceiver=y}write(e){var r;e.writeNode(new A({docs:this.docs})),e.write("func"),this.typeReference!=null&&this.writeReceiver({writer:e,typeReference:this.typeReference,receiver:this.receiver}),this.name!=null&&e.write(` ${this.name}`),ue({writer:e,arguments_:this.parameters,multiline:this.multiline}),this.return_!=null&&(e.write(" "),this.return_.length>1&&e.write("("),this.return_.forEach((i,o)=>{o>0&&e.write(", "),e.writeNode(i)}),this.return_.length>1&&e.write(")")),e.writeLine("{"),e.indent(),(r=this.body)==null||r.write(e),e.dedent(),e.writeNewLineIfLastLineNot(),e.write("}")}writeReceiver({writer:e,typeReference:r,receiver:i}){e.write(` (${this.getReceiverName({typeReference:r,receiver:i})} `),this.pointerReceiver&&e.write("*"),r.write(e),e.write(")")}getReceiverName({typeReference:e,receiver:r}){return r!=null?r:e.name.charAt(0).toLowerCase()}};var te=class extends w{constructor({name:e,parameters:r,return_:i,body:o,docs:s,multiline:f}){super();u(this,"func");this.func=new W({name:e,parameters:r,return_:i,body:o,docs:s,multiline:f})}get parameters(){return this.func.parameters}get return_(){return this.func.return_}get name(){return this.func.name}get body(){return this.func.body}get docs(){return this.func.docs}write(e){e.writeNode(this.func)}};p();l();var Re=class extends w{constructor({nodes:e}){super();u(this,"nodes");this.nodes=e}write(e){for(let r of this.nodes)e.newLine(),r.write(e),e.newLine()}};p();l();var re=class extends w{constructor({name:e,type:r,docs:i}){super();u(this,"name");u(this,"type");u(this,"docs");this.name=e,this.type=r,this.docs=i}write(e){e.writeNode(new A({docs:this.docs})),e.write(`${this.name} `),this.type.write(e)}};p();l();var ne=class extends w{constructor({node:e}){super();u(this,"node");this.node=e}write(e){e.write("*"),this.node.write(e)}};p();l();var ie=class extends w{constructor({on:e,selector:r}){super();u(this,"on");u(this,"selector");this.on=e,this.selector=r}write(e){e.writeNode(this.on),e.write("."),e.writeNode(this.selector)}};p();l();var oe=class extends w{constructor({name:e,embeds:r,fields:i,docs:o}){super();u(this,"name");u(this,"embeds",[]);u(this,"fields",[]);u(this,"docs");u(this,"methods",[]);u(this,"constructor_");this.name=e,this.docs=o,this.embeds=r!=null?r:[],this.fields=i!=null?i:[]}addConstructor(e){this.constructor_=e}addField(...e){this.fields.push(...e)}addMethod(...e){this.methods.push(...e)}write(e){this.writeType({writer:e}),this.constructor_!=null&&(e.newLine(),e.newLine(),this.writeConstructor({writer:e,constructor:this.constructor_})),this.writeMethods({writer:e})}writeType({writer:e}){if(e.writeNode(new A({docs:this.docs})),this.name!=null?e.write(`type ${this.name} struct {`):e.write("struct{"),this.embeds.length===0&&this.fields.length===0){e.writeLine("}");return}e.newLine(),e.indent();for(let o of this.embeds)e.writeNode(o),e.newLine();let r=this.fields.filter(o=>this.isExported(o));for(let o of r)e.writeNode(o),e.newLine();let i=this.fields.filter(o=>!this.isExported(o));r.length>0&&i.length>0&&e.newLine();for(let o of i)e.writeNode(o),e.newLine();e.dedent(),e.write("}")}writeConstructor({writer:e,constructor:r}){r.name!=null?e.write(`func ${r.name}(`):e.write(`func New${this.name}(`),r.parameters.forEach((i,o)=>{o>0&&e.write(", "),e.writeNode(i)}),e.write(`) *${this.name} {`),e.newLine(),e.indent(),e.writeNode(r.body),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeMethods({writer:e}){if(this.methods.length!==0){e.writeNewLineIfLastLineNot();for(let r of this.methods)e.newLine(),e.writeNode(r),e.newLine()}}isExported(e){let r=e.name.charAt(0);return r===r.toUpperCase()}};p();l();var Ne=class extends w{constructor({on:e,cases:r,default:i}){super();u(this,"on");u(this,"cases");u(this,"default");this.on=e,this.cases=r,this.default=i}write(e){let r=this.cases;this.default!=null&&r.push({on:new O("default"),body:this.default}),e.write("switch "),e.writeNode(this.on),e.writeLine("{"),e.indent();for(let i of r)e.write("case "),e.writeNode(i.on),e.writeLine(":"),e.indent(),e.writeNode(i.body),e.dedent(),e.writeNewLineIfLastLineNot();e.dedent(),e.write("}")}};p();l();var bn=new Set(["any","bytes","map","slice"]),Ae=class n extends w{constructor(e){super();u(this,"internalType");this.internalType=e}write(e,{comment:r}={}){switch(this.internalType.type){case"any":e.write("any");break;case"bool":e.write("bool");break;case"bytes":e.write("[]byte");break;case"date":case"dateTime":e.writeNode(Oe);break;case"error":e.write("error");break;case"float64":e.write("float64");break;case"int":e.write("int");break;case"int64":e.write("int64");break;case"map":{e.write("map["),this.internalType.keyType.write(e),e.write("]"),this.internalType.valueType.write(e);break}case"optional":{e.write("*"),this.internalType.value.write(e);break}case"reference":e.writeNode(this.internalType.value);break;case"slice":e.write("[]"),this.internalType.value.write(e);break;case"string":e.write("string");break;case"uuid":e.writeNode(Ve);break;case"variadic":e.write("..."),this.internalType.value.write(e);break;default:x(this.internalType)}}isOptional(){return this.internalType.type==="optional"}isIterable(){return this.internalType.type==="slice"||this.internalType.type==="variadic"}iterableElement(){if(this.internalType.type==="slice"||this.internalType.type==="variadic")return this.internalType.value}underlying(){return this.internalType.type==="optional"?this.internalType.value:this}static any(){return new this({type:"any"})}static bool(){return new this({type:"bool"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static dereference(e){return e.internalType.type==="optional"?e.internalType.value:e}static error(){return new this({type:"error"})}static float64(){return new this({type:"float64"})}static int(){return new this({type:"int"})}static int64(){return new this({type:"int64"})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static pointer(e){return n.optional(e)}static reference(e){return new this({type:"reference",value:e})}static slice(e){return new this({type:"slice",value:e})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static variadic(e){return this.isAlreadyVariadic(e)?e:new this({type:"variadic",value:e})}static isAlreadyOptional(e){return e.internalType.type==="optional"||bn.has(e.internalType.type)}static isAlreadyVariadic(e){return e.internalType.type==="variadic"}},Oe=new F({importPath:"time",name:"Time"}),Ve=new F({importPath:"github.com/google/uuid",name:"UUID"}),ot=new F({importPath:"io",name:"Reader"});p();l();var se=class extends w{constructor({name:e,type:r,docs:i}){super();u(this,"name");u(this,"type");u(this,"docs");this.name=e,this.type=r,this.docs=i}write(e){e.writeNode(new A({docs:this.docs})),e.write("type "),e.write(this.name),e.write(" "),e.writeNode(this.type)}};function Pn(n){return new X(n)}function kn(n){return new L(n)}function Sn(n){return new Q(n)}function Cn(n){return new Z(n)}function Un(n={}){return new ee(n)}function Bn(n){return new te(n)}function _n(n){return new O(n)}function Ln(n){return new S(n)}function Mn(n){return new V(n)}function Dn(n){return new W(n)}function $n(n){return new re(n)}function On(n){return new ne(n)}function Vn(n){return new ie(n)}function Wn(n={}){return new oe(n)}function qn(n){return new Ne(n)}function Gn(n){return new se(n)}function Yn(n){return new F(n)}p();l();Yt();var jn="sdk";function st({config:n,customConfig:t}){let e=zn({config:n}),r=Hn({config:n,customConfig:t});return e!=null?Jn({importPath:r,majorVersion:e}):r}function Hn({config:n,customConfig:t,isModulePath:e=!1}){var i,o,s,f;let r=(s=(o=t==null?void 0:t.importPath)!=null?o:(i=t==null?void 0:t.module)==null?void 0:i.path)!=null?s:n.output.mode.type==="github"?Xn(n.output.mode.repoUrl,"https://"):jn;return e?r:Gt.join(r,(f=t==null?void 0:t.packagePath)!=null?f:"")}function zn({config:n}){let t=Kn({config:n});if(!(t==null||t==="v0"||t==="v1"))return`${t}`}function Kn({config:n}){let t=Qn(n);if(t==null)return;let e=t.split(".");if(e[0]==null)return;let r=e[0];return r.startsWith("v")?r:`v${r}`}function Jn({importPath:n,majorVersion:t}){return Te(n)===t?n:`${n}/${t}`}function Xn(n,t){return n.startsWith(t)?n.slice(t.length):n}function Qn(n){var e;let t=(e=n==null?void 0:n.output)==null?void 0:e.mode;if(t!=null)return t.type==="github"||t.type==="publish"?t.version:void 0}p();l();var We=class{constructor({context:t}){u(this,"context");this.context=t}convert(t){if(t.value===null&&!this.context.isNullable(t.typeReference)&&this.context.errors.add({severity:v.Critical,message:"Expected non-null value, but got null"}),t.value==null)return a.TypeInstantiation.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return a.TypeInstantiation.nop();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?a.TypeInstantiation.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"nullable":return a.TypeInstantiation.optional(this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as}));case"optional":return a.TypeInstantiation.optional(this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as}));case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"set":return this.convertList({list:t.typeReference.value,value:t.value});case"unknown":return this.convertUnknown({value:t.value});default:x(t.typeReference)}}convertToPointerIfPossible(t){let e=this.convert(t);switch(t.typeReference.type){case"named":{let r=this.context.resolveNamedType({typeId:t.typeReference.value});return(r==null?void 0:r.type)==="enum"?a.TypeInstantiation.reference(a.invokeMethod({on:e,method:"Ptr",arguments_:[]})):e}default:return e}}convertList({list:t,value:e}){return Array.isArray(e)?a.TypeInstantiation.slice({valueType:this.context.dynamicTypeMapper.convert({typeReference:t}),values:e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:v.Critical,message:`Expected array but got: ${typeof e}`}),a.TypeInstantiation.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}`}),a.TypeInstantiation.nop()):a.TypeInstantiation.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:t.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:t.value}),entries:Object.entries(e).map(([r,i])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:t.key,value:r,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:r}){switch(t.type){case"alias":return this.convertAlias({aliasType:t,value:e,as:r});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:x(t)}}convertAlias({aliasType:t,value:e,as:r}){switch(t.typeReference.type){case"literal":return a.TypeInstantiation.reference(a.invokeFunc({func:a.typeReference({name:this.context.getTypeName(t.declaration.name),importPath:this.context.getImportPath(t.declaration.fernFilepath)}),arguments_:[this.convertLiteralValue(t.typeReference.value)]}));default:return this.convert({typeReference:t.typeReference,value:e,as:r})}}convertLiteralValue(t){switch(t.type){case"boolean":return a.TypeInstantiation.bool(t.value);case"string":return a.TypeInstantiation.string(t.value);default:x(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let r=this.context.getGoTypeReferenceFromDeclaration({declaration:t.declaration}),i=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(i==null)return a.TypeInstantiation.nop();let o=i.singleDiscriminatedUnionType,s=this.getBaseFields({discriminatedUnionTypeInstance:i,singleDiscriminatedUnionType:o});switch(o.type){case"samePropertiesAsObject":{let f=this.context.resolveNamedType({typeId:o.typeId});return f==null?a.TypeInstantiation.nop():a.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(o.discriminantValue.name),value:this.convertNamed({named:f,value:i.value})},...s]})}case"singleProperty":{let f=this.context.getRecord(i.value);if(f==null)return a.TypeInstantiation.nop();try{return this.context.errors.scope(o.discriminantValue.wireValue),a.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(o.discriminantValue.name),value:this.convert({typeReference:o.typeReference,value:f[o.discriminantValue.wireValue]})},...s]})}finally{this.context.errors.unscope()}}case"noProperties":return a.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(i.discriminantValue.name),value:a.TypeInstantiation.string(o.discriminantValue.wireValue)},...s]});default:x(o)}}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(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getTypeName(s.name.name),value:this.convert(s)}}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e}){var i;let r=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return a.TypeInstantiation.structPointer({typeReference:a.typeReference({name:this.context.getTypeName(t.declaration.name),importPath:this.context.getImportPath(t.declaration.fernFilepath)}),fields:r.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getTypeName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:t,value:e}){let r=this.getEnumValueName({enum_:t,value:e});return r==null?a.TypeInstantiation.nop():a.TypeInstantiation.enum(a.typeReference({name:r,importPath:this.context.getImportPath(t.declaration.fernFilepath)}))}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 r=t.values.find(i=>i.wireValue===e);if(r==null){this.context.errors.add({severity:v.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return`${this.context.getTypeName(t.declaration.name)}${this.context.getTypeName(r.name)}`}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});if(r==null)return a.TypeInstantiation.nop();let i=this.getUndiscriminatedUnionFieldName({typeReference:r.valueTypeReference});return i==null?a.TypeInstantiation.nop():a.TypeInstantiation.structPointer({typeReference:this.context.getGoTypeReferenceFromDeclaration({declaration:t.declaration}),fields:[{name:i,value:r.typeInstantiation}]})}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let r of t.types)try{let i=this.convert({typeReference:r,value:e});return{valueTypeReference:r,typeInstantiation:i}}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`})}getUndiscriminatedUnionFieldName({typeReference:t}){switch(t.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:t});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:t.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:t});case"named":{let e=this.context.resolveNamedType({typeId:t.value});return e==null?void 0:this.context.getTypeName(e.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:t});case"nullable":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:t});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:t.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:t});case"unknown":return"Unknown";default:x(t)}}getUndiscriminatedUnionFieldNameForList({list:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`${e}List`}getUndiscriminatedUnionFieldNameForMap({map:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t.key});if(e==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:t.value});if(r!=null)return`${e}${r}Map`}getUndiscriminatedUnionFieldNameForOptional({typeReference:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`${e}Optional`}getUndiscriminatedUnionFieldNameForSet({set:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`${e}Set`}getUndiscriminatedUnionFieldNameForLiteral({literal:t}){switch(t.type){case"boolean":return t.value?"TrueLiteral":"FalseLiteral";case"string":return`${t.value}StringLiteral`;default:x(t)}}getUndiscriminatedUnionFieldNameForPrimitive({primitive:t}){switch(t){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:x(t)}}convertUnknown({value:t}){return a.TypeInstantiation.any(t)}convertPrimitive({primitive:t,value:e,as:r}){switch(t){case"INTEGER":case"UINT":{let i=this.getValueAsNumber({value:e,as:r});return i==null?a.TypeInstantiation.nop():a.TypeInstantiation.int(i)}case"LONG":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:r});return i==null?a.TypeInstantiation.nop():a.TypeInstantiation.int64(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e,as:r});return i==null?a.TypeInstantiation.nop():a.TypeInstantiation.float64(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:r});return i==null?a.TypeInstantiation.nop():a.TypeInstantiation.bool(i)}case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?a.TypeInstantiation.nop():a.TypeInstantiation.string(i)}case"DATE":{let i=this.context.getValueAsString({value:e});return i==null?a.TypeInstantiation.nop():a.TypeInstantiation.date(i)}case"DATE_TIME":{let i=this.context.getValueAsString({value:e});if(i==null)return a.TypeInstantiation.nop();let o=this.normalizeDateTimeString(i);return a.TypeInstantiation.dateTime(o)}case"UUID":{let i=this.context.getValueAsString({value:e});return i==null?a.TypeInstantiation.nop():a.TypeInstantiation.uuid(i)}case"BASE_64":{let i=this.context.getValueAsString({value:e});return i==null?a.TypeInstantiation.nop():a.TypeInstantiation.bytes(i)}case"BIG_INTEGER":{let i=this.context.getValueAsString({value:e});return i==null?a.TypeInstantiation.nop():a.TypeInstantiation.string(i)}default:x(t)}}getValueAsNumber({value:t,as:e}){let r=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:t,as:e}){let r=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:r})}normalizeDateTimeString(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?`${t}T00:00:00Z`:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(t)?`${t}Z`:t}};p();l();var qe=class{constructor({context:t}){u(this,"context");this.context=t}convert(t){switch(t.typeReference.type){case"list":return a.Type.slice(this.convert({typeReference:t.typeReference.value}));case"literal":return this.convertLiteral({literal:t.typeReference.value});case"map":return a.Type.map(this.convert({typeReference:t.typeReference.key}),this.convert({typeReference:t.typeReference.value}));case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?this.convertUnknown():this.convertNamed({named:e})}case"optional":return a.Type.optional(this.convert({typeReference:t.typeReference.value}));case"nullable":return a.Type.optional(this.convert({typeReference:t.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:t.typeReference.value});case"set":return a.Type.slice(this.convert({typeReference:t.typeReference}));case"unknown":return this.convertUnknown();default:x(t.typeReference)}}convertLiteral({literal:t}){switch(t.type){case"boolean":return a.Type.bool();case"string":return a.Type.string()}}convertNamed({named:t}){let e=a.Type.reference(a.typeReference({name:this.context.getTypeName(t.declaration.name),importPath:this.context.getImportPath(t.declaration.fernFilepath)}));switch(t.type){case"alias":case"enum":return e;case"discriminatedUnion":case"object":case"undiscriminatedUnion":return a.Type.pointer(e);default:x(t)}}convertUnknown(){return a.Type.any()}convertPrimitive({primitive:t}){switch(t){case"INTEGER":return a.Type.int();case"UINT":return a.Type.int();case"LONG":return a.Type.int64();case"UINT_64":return a.Type.int64();case"FLOAT":return a.Type.float64();case"DOUBLE":return a.Type.float64();case"BOOLEAN":return a.Type.bool();case"STRING":return a.Type.string();case"DATE":return a.Type.date();case"DATE_TIME":return a.Type.dateTime();case"UUID":return a.Type.uuid();case"BASE_64":return a.Type.bytes();case"BIG_INTEGER":return a.Type.string();default:x(t)}}};p();l();var Ge=class{constructor({context:t}){u(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){var o;let r={fileFields:[],bodyPropertyFields:[]},i=(o=this.context.getRecord(e))!=null?o:{};for(let s of t.properties)switch(s.type){case"file":r.fileFields.push({name:this.context.getTypeName(s.name),value:this.getSingleFileProperty({property:s,record:i})});break;case"fileArray":r.fileFields.push({name:this.context.getTypeName(s.name),value:this.getArrayFileProperty({property:s,record:i})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getTypeName(s.name.name),value:this.getBodyProperty({property:s,record:i})});break;default:x(s)}return r}getSingleFileProperty({property:t,record:e}){let r=this.context.getSingleFileValue({property:t,record:e})||"";return a.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(r))}getArrayFileProperty({property:t,record:e}){let r=this.context.getFileArrayValues({property:t,record:e});return r==null?a.TypeInstantiation.nop():a.TypeInstantiation.slice({valueType:a.Type.reference(this.context.getIoReaderTypeReference()),values:r.map(i=>a.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(i)))})}getBodyProperty({property:t,record:e}){let r=e[t.name.wireValue];return r==null?a.TypeInstantiation.nop():this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.typeReference,value:r})}};var Ye=class n extends ve{constructor({ir:e,config:r}){super({ir:e,config:r});u(this,"ir");u(this,"customConfig");u(this,"dynamicTypeMapper");u(this,"dynamicTypeInstantiationMapper");u(this,"filePropertyMapper");u(this,"rootImportPath");this.ir=e,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeMapper=new qe({context:this}),this.dynamicTypeInstantiationMapper=new We({context:this}),this.filePropertyMapper=new Ge({context:this}),this.rootImportPath=st({config:r,customConfig:this.customConfig})}clone(){return new n({ir:this.ir,config:this.config})}isOptional(e){switch(e.type){case"optional":case"map":return!0;case"nullable":case"list":case"set":return this.isOptional(e.value);case"named":case"literal":case"primitive":case"unknown":return!1;default:x(e)}}getMethodName(e){return e.pascalCase.unsafeName}getTestMethodName(e){return e.declaration.fernFilepath.allParts.map(r=>r.pascalCase.unsafeName).join("")+e.declaration.name.pascalCase.unsafeName}getTypeName(e){return e.pascalCase.unsafeName}getImportPath(e){let r=e.packagePath.map(i=>i.pascalCase.unsafeName.toLowerCase());return[this.rootImportPath,...r].join("/")}getImportPathForRequest(e){var r;return(r=this.customConfig)!=null&&r.exportAllRequestsAtRoot?this.rootImportPath:this.getImportPath(e)}getContextTypeReference(){return a.typeReference({name:"Context",importPath:"context"})}getContextTodoFunctionInvocation(){return a.invokeFunc({func:a.typeReference({name:"TODO",importPath:"context"}),arguments_:[]})}getIoReaderTypeReference(){return a.typeReference({name:"Reader",importPath:"io"})}getTestingTypeReference(){return a.typeReference({name:"T",importPath:"testing"})}getNewStringsReaderFunctionInvocation(e){return a.invokeFunc({func:a.typeReference({name:"NewReader",importPath:"strings"}),arguments_:[a.TypeInstantiation.string(e)]})}getClientConstructorName(){var e,r;return((e=this.customConfig)==null?void 0:e.clientConstructorName)!=null?this.customConfig.clientConstructorName:((r=this.customConfig)==null?void 0:r.exportedClientName)!=null?`New${this.customConfig.exportedClientName}`:`New${this.getClientName()}`}getClientName(){var e;return((e=this.customConfig)==null?void 0:e.clientName)!=null?this.customConfig.clientName:"Client"}getClientImportPath(){return`${this.rootImportPath}/client`}getOptionImportPath(){return`${this.rootImportPath}/option`}getGoTypeReferenceFromDeclaration({declaration:e}){return a.typeReference({name:e.name.pascalCase.unsafeName,importPath:this.getImportPath(e.fernFilepath)})}getEnvironmentTypeReferenceFromID(e){let r=this.resolveEnvironmentName(e);if(r!=null)return this.getEnvironmentTypeReference(r)}getEnvironmentTypeReference(e){return a.typeReference({name:`Environments.${this.getTypeName(e)}`,importPath:this.rootImportPath})}static chainMethods(e,...r){if(r.length===0)throw new Error("Must have methods to chain");let i=e;for(let o of r)i=a.invokeMethod({on:i,method:o.method,arguments_:o.arguments_,multiline:o.multiline});return i}};p();l();var zt="example",at="fern",Zn="do",Ee="client",pe=a.TypeInstantiation,ei="WireMockBaseURL",ti="WireMockClient",je=class{constructor({context:t,formatter:e}){u(this,"context");u(this,"formatter");this.context=t,this.formatter=e}async generateSnippet({endpoint:t,request:e,options:r}){var s,f,h;return((f=(s=r==null?void 0:r.config)==null?void 0:s.outputWiremockTests)!=null?f:!1)?this.generateWiremockTest({endpoint:t,snippet:e}):await this.buildCodeBlock({endpoint:t,snippet:e}).toStringAsync({packageName:zt,importPath:at,rootImportPath:this.context.rootImportPath,customConfig:(h=this.context.customConfig)!=null?h:{},formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e,options:r}){var s,f,h;return((f=(s=r==null?void 0:r.config)==null?void 0:s.outputWiremockTests)!=null?f:!1)?this.generateWiremockTest({endpoint:t,snippet:e}):this.buildCodeBlock({endpoint:t,snippet:e}).toString({packageName:zt,importPath:at,rootImportPath:this.context.rootImportPath,customConfig:(h=this.context.customConfig)!=null?h:{},formatter:this.formatter})}generateWiremockTest({endpoint:t,snippet:e}){var i;return this.buildWiremockTestCodeBlock({endpoint:t,snippet:e}).toString({packageName:"wiremock",importPath:at,rootImportPath:this.context.rootImportPath,customConfig:(i=this.context.customConfig)!=null?i:{},formatter:this.formatter})}buildCodeBlock({endpoint:t,snippet:e}){return a.codeblock(r=>{r.writeNode(a.func({name:Zn,parameters:[],return_:[],body:a.codeblock(i=>{i.writeNode(this.constructClient({endpoint:t,snippet:e})),i.writeLine(),i.writeNode(this.callMethod({endpoint:t,snippet:e}))})})),r.writeNewLineIfLastLineNot()})}buildWiremockTestCodeBlock({endpoint:t,snippet:e}){return a.codeblock(r=>{r.writeNode(a.func({name:"Test"+this.context.getTestMethodName(t)+"WithWireMock",parameters:[a.parameter({name:"t",type:a.Type.pointer(a.Type.reference(this.context.getTestingTypeReference()))})],return_:[],body:a.codeblock(i=>{for(let o of this.buildWiremockTestSetup({endpoint:t}))i.writeNode(o),i.writeLine();i.writeLine(),i.writeNode(this.constructWiremockTestClient({endpoint:t,snippet:e})),i.writeLine(),i.writeNode(this.callClientMethodAndAssert({endpoint:t,snippet:e}))})})),r.writeNewLineIfLastLineNot()})}constructClient({endpoint:t,snippet:e}){return a.codeblock(r=>{r.write(`${Ee} := `),r.writeNode(this.getRootClientFuncInvocation(this.getConstructorArgs({endpoint:t,snippet:e})))})}constructWiremockTestClient({endpoint:t,snippet:e}){return a.codeblock(r=>{r.write(`${Ee} := `),r.writeNode(this.getRootClientFuncInvocation(this.getWiremockTestConstructorArgs()))})}writeMethodInvocation({writer:t,endpoint:e,snippet:r}){let{otherArgs:i,requestArg:o}=this.getMethodArgs({endpoint:e,snippet:r});if(o!=null)if(o instanceof a.TypeInstantiation&&a.TypeInstantiation.isNop(o))t.writeNode(a.invokeMethod({on:a.codeblock(Ee),method:this.getMethod({endpoint:e}),arguments_:[this.context.getContextTodoFunctionInvocation(),...i,a.codeblock("nil")]}));else{t.write("request := "),t.writeNode(o),t.writeLine();let s=a.codeblock("request");t.writeNode(a.invokeMethod({on:a.codeblock(Ee),method:this.getMethod({endpoint:e}),arguments_:[this.context.getContextTodoFunctionInvocation(),...i,s]}))}else t.writeNode(a.invokeMethod({on:a.codeblock(Ee),method:this.getMethod({endpoint:e}),arguments_:[this.context.getContextTodoFunctionInvocation(),...i]}))}callMethod({endpoint:t,snippet:e}){return a.codeblock(r=>{this.writeMethodInvocation({writer:r,endpoint:t,snippet:e})})}getConstructorArgs({endpoint:t,snippet:e}){let r=[],i=this.getConstructorBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});return i!=null&&r.push(i),t.auth!=null&&(e.auth!=null?r.push(this.getConstructorAuthArg({auth:t.auth,values:e.auth})):this.context.errors.add({severity:v.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(_.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),r}getWiremockTestConstructorArgs(){return[a.codeblock(t=>{t.writeNode(a.invokeFunc({func:a.typeReference({name:"WithBaseURL",importPath:this.context.getOptionImportPath()}),arguments_:[a.codeblock(ei)]}))})]}getConstructorAuthArg({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),pe.nop();switch(t.type){case"basic":return e.type==="basic"?this.getConstructorBasicAuthArg({auth:t,values:e}):pe.nop();case"bearer":return e.type==="bearer"?this.getConstructorBearerAuthArg({auth:t,values:e}):pe.nop();case"header":return e.type==="header"?this.getConstructorHeaderAuthArg({auth:t,values:e}):pe.nop();case"oauth":return this.addWarning("The Go SDK doesn't support OAuth client credentials yet"),pe.nop();case"inferred":return this.addWarning("The Go SDK Generator does not support Inferred auth scheme yet"),pe.nop();default:x(t)}}addError(t){this.context.errors.add({severity:v.Critical,message:t})}addWarning(t){this.context.errors.add({severity:v.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:e}){return a.codeblock(r=>{r.writeNode(a.invokeFunc({func:a.typeReference({name:"WithBasicAuth",importPath:this.context.getOptionImportPath()}),arguments_:[a.TypeInstantiation.string(e.username),a.TypeInstantiation.string(e.password)]}))})}getConstructorBaseUrlArg({baseUrl:t,environment:e}){let r=this.getBaseUrlArg({baseUrl:t,environment:e});if(r!=null)return a.codeblock(i=>{i.writeNode(a.invokeFunc({func:a.typeReference({name:"WithBaseURL",importPath:this.context.getOptionImportPath()}),arguments_:[r]}))})}getBaseUrlArg({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:v.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return a.TypeInstantiation.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let r=this.context.getEnvironmentTypeReferenceFromID(e);if(r==null){this.context.errors.add({severity:v.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return a.TypeInstantiation.reference(r)}this.context.isMultiEnvironmentValues(e)&&this.context.errors.add({severity:v.Warning,message:"The Go SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}}getConstructorBearerAuthArg({auth:t,values:e}){return a.codeblock(r=>{r.writeNode(a.invokeFunc({func:a.typeReference({name:`With${t.token.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[a.TypeInstantiation.string(e.token)]}))})}getConstructorHeaderAuthArg({auth:t,values:e}){return a.codeblock(r=>{r.writeNode(a.invokeFunc({func:a.typeReference({name:`With${t.header.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.header.typeReference,value:e.value})]}))})}getConstructorHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let o=this.getConstructorHeaderArg({header:i,value:e.value});o!=null&&r.push(o)}return r}getConstructorHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.typeReference,value:e});if(!a.TypeInstantiation.isNop(r))return a.codeblock(i=>{i.writeNode(a.invokeFunc({func:a.typeReference({name:`With${t.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[r]}))})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:x(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var s,f;let r=[];this.context.errors.scope(_.PathParameters);let i=[...(s=this.context.ir.pathParameters)!=null?s:[],...(f=t.pathParameters)!=null?f:[]];i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:e}).map(h=>h.value)),this.context.errors.unscope(),this.context.errors.scope(_.RequestBody);let o=t.body!=null?this.getBodyRequestArg({body:t.body,value:e.requestBody}):void 0;return this.context.errors.unscope(),{otherArgs:r,requestArg:o}}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.value,value:e});default:x(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:v.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),a.TypeInstantiation.nop()):a.TypeInstantiation.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){var y,g,T,I,R,Y;let r=[],{inlinePathParameters:i,inlineFileProperties:o}={inlinePathParameters:(g=(y=this.context.customConfig)==null?void 0:y.inlinePathParameters)!=null?g:!0,inlineFileProperties:(I=(T=this.context.customConfig)==null?void 0:T.inlineFileProperties)!=null?I:!0};this.context.errors.scope(_.PathParameters);let s=[],f=[...(R=this.context.ir.pathParameters)!=null?R:[],...(Y=t.pathParameters)!=null?Y:[]];f.length>0&&s.push(...this.getPathParameters({namedParameters:f,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(_.RequestBody);let h=this.getFilePropertyInfo({request:t,snippet:e});this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...s.map(le=>le.value)),o||r.push(...h.fileFields.map(le=>le.value));let m=this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:o})?this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?s:[],filePropertyInfo:h}):void 0;return{otherArgs:r,requestArg:m}}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:i}){var y,g,T,I;this.context.errors.scope(_.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:(y=t.queryParameters)!=null?y:[],values:(g=e.queryParameters)!=null?g:{}}).map(R=>({name:R.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(R)}));this.context.errors.unscope(),this.context.errors.scope(_.Headers);let h=this.context.associateByWireValue({parameters:(T=t.headers)!=null?T:[],values:(I=e.headers)!=null?I:{}}).map(R=>({name:R.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(R)}));this.context.errors.unscope(),this.context.errors.scope(_.RequestBody);let m=t.body!=null?this.getInlinedRequestBodyStructFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),a.TypeInstantiation.structPointer({typeReference:a.typeReference({name:this.context.getMethodName(t.declaration.name),importPath:this.context.getImportPathForRequest(t.declaration.fernFilepath)}),fields:[...r,...s,...h,...m]})}getInlinedRequestBodyStructFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyStructFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyStructField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyStructFields({filePropertyInfo:r});default:x(t)}}getFileUploadRequestBodyStructFields({filePropertyInfo:t}){var e;return(e=this.context.customConfig)!=null&&e.inlineFileProperties?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyStructField({body:t,value:e}){return{name:this.context.getTypeName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeInstantiation({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.value,value:e});default:x(t)}}getInlinedRequestBodyPropertyStructFields({parameters:t,value:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=this.context.getRecord(e))!=null?o:{}});for(let s of i)r.push({name:this.context.getTypeName(s.name.name),value:this.context.dynamicTypeInstantiationMapper.convert(s)});return r}getPathParameters({namedParameters:t,snippet:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=e.pathParameters)!=null?o:{}});for(let s of i)r.push({name:this.context.getTypeName(s.name.name),value:this.context.dynamicTypeInstantiationMapper.convertToPointerIfPossible(s)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getMethodName(e)).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getRootClientFuncInvocation(t){return a.invokeFunc({func:a.typeReference({name:this.context.getClientConstructorName(),importPath:this.context.getClientImportPath()}),arguments_:t})}buildWiremockTestSetup({endpoint:t,errorCase:e}){let r="stub";return[]}callClientMethodAndAssert({endpoint:t,snippet:e}){return a.codeblock(r=>{this.writeMethodInvocation({writer:r,endpoint:t,snippet:e}),r.writeLine(),r.writeLine(),r.write("ok, countErr := "),r.writeNode(a.invokeMethod({on:a.codeblock(ti),method:"Verify",arguments_:[a.invokeMethod({on:a.codeblock("stub"),method:"Request",arguments_:[],multiline:!1}),a.codeblock("1")],multiline:!1})),r.writeLine(),r.writeNode(a.invokeFunc({func:a.typeReference({name:"NoError",importPath:"github.com/stretchr/testify/require"}),arguments_:[a.codeblock("t"),a.codeblock("countErr"),a.TypeInstantiation.string("Failed to verify WireMock request was matched")],multiline:!1})),r.writeLine(),r.writeNode(a.invokeFunc({func:a.typeReference({name:"True",importPath:"github.com/stretchr/testify/require"}),arguments_:[a.codeblock("t"),a.codeblock("ok"),a.TypeInstantiation.string("WireMock request was not matched")],multiline:!1})),r.writeLine()})}};var He=class extends ge{constructor({ir:e,config:r,formatter:i}){super(new Ye({ir:e,config:r}));u(this,"formatter");this.formatter=i}async generate(e,r){return super.generate(e,r)}generateSync(e,r){return super.generateSync(e,r)}createSnippetGenerator(e){return new je({context:e,formatter:this.formatter})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
32
27
|
/*! Bundled license information:
|
|
33
28
|
|
|
34
29
|
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
@@ -39,3 +34,4 @@ ${e}
|
|
|
39
34
|
* @license MIT
|
|
40
35
|
*)
|
|
41
36
|
*/
|
|
37
|
+
//# sourceMappingURL=index.cjs.map
|