@fern-api/go-dynamic-snippets 0.0.14 → 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.
Files changed (69) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +18 -10
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.d.cts +7 -5
  4. package/cjs/{DynamicSnippetsGeneratorContext-lz2pTZw3.d.cts → DynamicSnippetsGeneratorContext-BusKoNq4.d.cts} +12 -2
  5. package/cjs/EndpointSnippetGenerator.cjs +19 -11
  6. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  7. package/cjs/EndpointSnippetGenerator.d.cts +15 -4
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +18 -10
  9. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
  10. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  11. package/cjs/context/DynamicTypeInstantiationMapper.cjs +19 -11
  12. package/cjs/context/DynamicTypeInstantiationMapper.cjs.map +1 -0
  13. package/cjs/context/DynamicTypeInstantiationMapper.d.cts +1 -1
  14. package/cjs/context/DynamicTypeMapper.cjs +18 -10
  15. package/cjs/context/DynamicTypeMapper.cjs.map +1 -0
  16. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  17. package/cjs/context/FilePropertyMapper.cjs +18 -10
  18. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  19. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  20. package/cjs/index.cjs +24 -28
  21. package/cjs/index.cjs.map +1 -0
  22. package/cjs/index.d.cts +2 -1
  23. package/esm/DynamicSnippetsGenerator.d.ts +7 -5
  24. package/esm/DynamicSnippetsGenerator.js +2 -1
  25. package/esm/DynamicSnippetsGenerator.js.map +1 -0
  26. package/esm/{DynamicSnippetsGeneratorContext-lz2pTZw3.d.ts → DynamicSnippetsGeneratorContext-BusKoNq4.d.ts} +12 -2
  27. package/esm/EndpointSnippetGenerator.d.ts +15 -4
  28. package/esm/EndpointSnippetGenerator.js +2 -1
  29. package/esm/EndpointSnippetGenerator.js.map +1 -0
  30. package/esm/chunk-2YRGTA73.js +2 -0
  31. package/esm/chunk-2YRGTA73.js.map +1 -0
  32. package/esm/chunk-BI26DLZ5.js +2 -0
  33. package/esm/chunk-BI26DLZ5.js.map +1 -0
  34. package/esm/chunk-D6NMQKNQ.js +2 -0
  35. package/esm/chunk-D6NMQKNQ.js.map +1 -0
  36. package/esm/chunk-FD44EP2P.js +2 -0
  37. package/esm/chunk-FD44EP2P.js.map +1 -0
  38. package/esm/chunk-GUJUKQKZ.js +37 -0
  39. package/esm/chunk-GUJUKQKZ.js.map +1 -0
  40. package/esm/chunk-Q6YO7G6Y.js +2 -0
  41. package/esm/chunk-Q6YO7G6Y.js.map +1 -0
  42. package/esm/chunk-UZEM7EUP.js +2 -0
  43. package/esm/chunk-UZEM7EUP.js.map +1 -0
  44. package/esm/chunk-VCNL2JWU.js +2 -0
  45. package/esm/chunk-VCNL2JWU.js.map +1 -0
  46. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  47. package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
  48. package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
  49. package/esm/context/DynamicTypeInstantiationMapper.d.ts +1 -1
  50. package/esm/context/DynamicTypeInstantiationMapper.js +2 -1
  51. package/esm/context/DynamicTypeInstantiationMapper.js.map +1 -0
  52. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  53. package/esm/context/DynamicTypeMapper.js +2 -1
  54. package/esm/context/DynamicTypeMapper.js.map +1 -0
  55. package/esm/context/FilePropertyMapper.d.ts +1 -1
  56. package/esm/context/FilePropertyMapper.js +2 -1
  57. package/esm/context/FilePropertyMapper.js.map +1 -0
  58. package/esm/index.d.ts +2 -1
  59. package/esm/index.js +2 -13
  60. package/esm/index.js.map +1 -0
  61. package/package.json +1 -1
  62. package/esm/chunk-5HP3T45N.js +0 -1
  63. package/esm/chunk-D3UUM672.js +0 -1
  64. package/esm/chunk-I3VUX77R.js +0 -1
  65. package/esm/chunk-J745U74Q.js +0 -1
  66. package/esm/chunk-SS6XZXHU.js +0 -1
  67. package/esm/chunk-TUE3DOHS.js +0 -29
  68. package/esm/chunk-X7QP3WH3.js +0 -1
  69. package/esm/chunk-YAGEU3HO.js +0 -1
package/cjs/index.cjs CHANGED
@@ -1,34 +1,29 @@
1
- "use strict";var Ls=Object.create;var We=Object.defineProperty,Gs=Object.defineProperties,Ws=Object.getOwnPropertyDescriptor,Vs=Object.getOwnPropertyDescriptors,Ys=Object.getOwnPropertyNames,vt=Object.getOwnPropertySymbols,js=Object.getPrototypeOf,hr=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable;var yr=(r,e,t)=>e in r?We(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$n=(r,e)=>{for(var t in e||(e={}))hr.call(e,t)&&yr(r,t,e[t]);if(vt)for(var t of vt(e))Bn.call(e,t)&&yr(r,t,e[t]);return r},Cn=(r,e)=>Gs(r,Vs(e));var _n=r=>typeof r=="symbol"?r:r+"",qn=(r,e)=>{var t={};for(var n in r)hr.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&vt)for(var n of vt(r))e.indexOf(n)<0&&Bn.call(r,n)&&(t[n]=r[n]);return t};var Pe=(r,e)=>()=>(r&&(e=r(r=0)),e);var v=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),dr=(r,e)=>{for(var t in e)We(r,t,{get:e[t],enumerable:!0})},kn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ys(e))!hr.call(r,i)&&i!==t&&We(r,i,{get:()=>e[i],enumerable:!(n=Ws(e,i))||n.enumerable});return r};var zs=(r,e,t)=>(t=r!=null?Ls(js(r)):{},kn(e||!r||!r.__esModule?We(t,"default",{value:r,enumerable:!0}):t,r)),Mn=r=>kn(We({},"__esModule",{value:!0}),r);var h=(r,e,t)=>yr(r,typeof e!="symbol"?e+"":e,t);function Ln(){throw new Error("setTimeout has not been defined")}function Gn(){throw new Error("clearTimeout has not been defined")}function Wn(r){if(ne===setTimeout)return setTimeout(r,0);if((ne===Ln||!ne)&&setTimeout)return ne=setTimeout,setTimeout(r,0);try{return ne(r,0)}catch(e){try{return ne.call(null,r,0)}catch(t){return ne.call(this,r,0)}}}function Hs(r){if(ie===clearTimeout)return clearTimeout(r);if((ie===Gn||!ie)&&clearTimeout)return ie=clearTimeout,clearTimeout(r);try{return ie(r)}catch(e){try{return ie.call(null,r)}catch(t){return ie.call(this,r)}}}function Js(){!Ne||!le||(Ne=!1,le.length?J=le.concat(J):wt=-1,J.length&&Vn())}function Vn(){if(!Ne){var r=Wn(Js);Ne=!0;for(var e=J.length;e;){for(le=J,J=[];++wt<e;)le&&le[wt].run();wt=-1,e=J.length}le=null,Ne=!1,Hs(r)}}function Ks(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];J.push(new Yn(r,e)),J.length===1&&!Ne&&Wn(Vn)}function Yn(r,e){this.fun=r,this.array=e}function fe(){}function yu(r){throw new Error("process.binding is not supported")}function hu(){return"/"}function du(r){throw new Error("process.chdir is not supported")}function mu(){return 0}function vu(r){var e=gu.call(Fe)*.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 xu(){var r=new Date,e=r-wu;return e/1e3}var ne,ie,J,Ne,le,wt,Qs,Xs,Zs,eu,tu,ru,nu,iu,ou,au,su,uu,cu,pu,lu,fu,Fe,gu,wu,y,Dn,s=Pe(()=>{"use strict";ne=Ln,ie=Gn;typeof globalThis.setTimeout=="function"&&(ne=setTimeout);typeof globalThis.clearTimeout=="function"&&(ie=clearTimeout);J=[],Ne=!1,wt=-1;Yn.prototype.run=function(){this.fun.apply(null,this.array)};Qs="browser",Xs="browser",Zs=!0,eu={},tu=[],ru="",nu={},iu={},ou={};au=fe,su=fe,uu=fe,cu=fe,pu=fe,lu=fe,fu=fe;Fe=globalThis.performance||{},gu=Fe.now||Fe.mozNow||Fe.msNow||Fe.oNow||Fe.webkitNow||function(){return new Date().getTime()};wu=new Date;y={nextTick:Ks,title:Qs,browser:Zs,env:eu,argv:tu,version:ru,versions:nu,on:au,addListener:su,once:uu,off:cu,removeListener:pu,removeAllListeners:lu,emit:fu,binding:yu,cwd:hu,chdir:du,umask:mu,hrtime:vu,platform:Xs,release:iu,config:ou,uptime:xu},Dn={};Object.keys(Dn).forEach(r=>{let e=r.split("."),t=y;for(let n=0;n<e.length;n++){let i=e[n];n===e.length-1?t[i]=Dn[r]:t=t[i]||(t[i]={})}})});function Jn(){gr=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)L[e]=r[e],_[r.charCodeAt(e)]=e;_[45]=62,_[95]=63}function Iu(r){gr||Jn();var e,t,n,i,o,a,p=r.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=r[p-2]==="="?2:r[p-1]==="="?1:0,a=new Tu(p*3/4-o),n=o>0?p-4:p;var l=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[l++]=i>>16&255,a[l++]=i>>8&255,a[l++]=i&255;return o===2?(i=_[r.charCodeAt(e)]<<2|_[r.charCodeAt(e+1)]>>4,a[l++]=i&255):o===1&&(i=_[r.charCodeAt(e)]<<10|_[r.charCodeAt(e+1)]<<4|_[r.charCodeAt(e+2)]>>2,a[l++]=i>>8&255,a[l++]=i&255),a}function Au(r){return L[r>>18&63]+L[r>>12&63]+L[r>>6&63]+L[r&63]}function bu(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(Au(n));return i.join("")}function jn(r){gr||Jn();for(var e,t=r.length,n=t%3,i="",o=[],a=16383,p=0,l=t-n;p<l;p+=a)o.push(bu(r,p,p+a>l?l:p+a));return n===1?(e=r[t-1],i+=L[e>>2],i+=L[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=L[e>>10],i+=L[e>>4&63],i+=L[e<<2&63],i+="="),o.push(i),o.join("")}function xt(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function K(r,e){if(xt()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=c.prototype):(r===null&&(r=new c(e)),r.length=e),r}function c(r,e,t){if(!c.TYPED_ARRAY_SUPPORT&&!(this instanceof c))return new c(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 vr(this,r)}return Kn(this,r,e,t)}function Kn(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?Ru(r,e,t,n):typeof e=="string"?Eu(r,e,t):Pu(r,e)}function Qn(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 Su(r,e,t,n){return Qn(e),e<=0?K(r,e):t!==void 0?typeof n=="string"?K(r,e).fill(t,n):K(r,e).fill(t):K(r,e)}function vr(r,e){if(Qn(e),r=K(r,e<0?0:wr(e)|0),!c.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)r[t]=0;return r}function Eu(r,e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!c.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=Xn(e,t)|0;r=K(r,n);var i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function mr(r,e){var t=e.length<0?0:wr(e.length)|0;r=K(r,t);for(var n=0;n<t;n+=1)r[n]=e[n]&255;return r}function Ru(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),c.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=c.prototype):r=mr(r,e),r}function Pu(r,e){if(G(e)){var t=wr(e.length)|0;return r=K(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"||zu(e.length)?K(r,0):mr(r,e);if(e.type==="Buffer"&&Array.isArray(e.data))return mr(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function wr(r){if(r>=xt())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+xt().toString(16)+" bytes");return r|0}function G(r){return!!(r!=null&&r._isBuffer)}function Xn(r,e){if(G(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 Tt(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return oi(r).length;default:if(n)return Tt(r).length;e=(""+e).toLowerCase(),n=!0}}function Fu(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 Mu(this,e,t);case"utf8":case"utf-8":return ti(this,e,t);case"ascii":return qu(this,e,t);case"latin1":case"binary":return ku(this,e,t);case"base64":return Cu(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Du(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function ye(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}function Zn(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=c.from(e,n)),G(e))return e.length===0?-1:zn(r,e,t,n,i);if(typeof e=="number")return e=e&255,c.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):zn(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function zn(r,e,t,n,i){var o=1,a=r.length,p=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,p/=2,t/=2}function l(I,S){return o===1?I[S]:I.readUInt16BE(S*o)}var m;if(i){var g=-1;for(m=t;m<a;m++)if(l(r,m)===l(e,g===-1?0:m-g)){if(g===-1&&(g=m),m-g+1===p)return g*o}else g!==-1&&(m-=m-g),g=-1}else for(t+p>a&&(t=a-p),m=t;m>=0;m--){for(var d=!0,w=0;w<p;w++)if(l(r,m+w)!==l(e,w)){d=!1;break}if(d)return m}return-1}function Nu(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 p=parseInt(e.substr(a*2,2),16);if(isNaN(p))return a;r[t+a]=p}return a}function Uu(r,e,t,n){return bt(Tt(e,r.length-t),r,t,n)}function ei(r,e,t,n){return bt(Yu(e),r,t,n)}function Ou(r,e,t,n){return ei(r,e,t,n)}function Bu(r,e,t,n){return bt(oi(e),r,t,n)}function $u(r,e,t,n){return bt(ju(e,r.length-t),r,t,n)}function Cu(r,e,t){return e===0&&t===r.length?jn(r):jn(r.slice(e,t))}function ti(r,e,t){t=Math.min(r.length,t);for(var n=[],i=e;i<t;){var o=r[i],a=null,p=o>239?4:o>223?3:o>191?2:1;if(i+p<=t){var l,m,g,d;switch(p){case 1:o<128&&(a=o);break;case 2:l=r[i+1],(l&192)===128&&(d=(o&31)<<6|l&63,d>127&&(a=d));break;case 3:l=r[i+1],m=r[i+2],(l&192)===128&&(m&192)===128&&(d=(o&15)<<12|(l&63)<<6|m&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:l=r[i+1],m=r[i+2],g=r[i+3],(l&192)===128&&(m&192)===128&&(g&192)===128&&(d=(o&15)<<18|(l&63)<<12|(m&63)<<6|g&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,p=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=p}return _u(n)}function _u(r){var e=r.length;if(e<=Hn)return String.fromCharCode.apply(String,r);for(var t="",n=0;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Hn));return t}function qu(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 ku(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 Mu(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+=Vu(r[o]);return i}function Du(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 R(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 O(r,e,t,n,i,o){if(!G(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 It(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 At(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 ri(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 ni(r,e,t,n,i){return i||ri(r,e,t,4,34028234663852886e22,-34028234663852886e22),si(r,e,t,n,23,4),t+4}function ii(r,e,t,n,i){return i||ri(r,e,t,8,17976931348623157e292,-17976931348623157e292),si(r,e,t,n,52,8),t+8}function Gu(r){if(r=Wu(r).replace(Lu,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Wu(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Vu(r){return r<16?"0"+r.toString(16):r.toString(16)}function Tt(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 Yu(r){for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function ju(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 oi(r){return Iu(Gu(r))}function bt(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 zu(r){return r!==r}function Hu(r){return r!=null&&(!!r._isBuffer||ai(r)||Ju(r))}function ai(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Ju(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&ai(r.slice(0,0))}function St(r,e,t,n,i){var o,a,p=i*8-n-1,l=(1<<p)-1,m=l>>1,g=-7,d=t?i-1:0,w=t?-1:1,I=r[e+d];for(d+=w,o=I&(1<<-g)-1,I>>=-g,g+=p;g>0;o=o*256+r[e+d],d+=w,g-=8);for(a=o&(1<<-g)-1,o>>=-g,g+=n;g>0;a=a*256+r[e+d],d+=w,g-=8);if(o===0)o=1-m;else{if(o===l)return a?NaN:(I?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-m}return(I?-1:1)*a*Math.pow(2,o-n)}function si(r,e,t,n,i,o){var a,p,l,m=o*8-i-1,g=(1<<m)-1,d=g>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=n?0:o-1,S=n?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,a=g):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+d>=1?e+=w/l:e+=w*Math.pow(2,1-d),e*l>=2&&(a++,l/=2),a+d>=g?(p=0,a=g):a+d>=1?(p=(e*l-1)*Math.pow(2,i),a=a+d):(p=e*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;r[t+I]=p&255,I+=S,p/=256,i-=8);for(a=a<<i|p,m+=i;m>0;r[t+I]=a&255,I+=S,a/=256,m-=8);r[t+I-S]|=E*128}var L,_,Tu,gr,Hn,Lu,ui=Pe(()=>{"use strict";s();u();L=[],_=[],Tu=typeof Uint8Array!="undefined"?Uint8Array:Array,gr=!1;c.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;c.poolSize=8192;c._augment=function(r){return r.__proto__=c.prototype,r};c.from=function(r,e,t){return Kn(null,r,e,t)};c.kMaxLength=xt();c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&c[Symbol.species]);c.alloc=function(r,e,t){return Su(null,r,e,t)};c.allocUnsafe=function(r){return vr(null,r)};c.allocUnsafeSlow=function(r){return vr(null,r)};c.isBuffer=Hu;c.compare=function(e,t){if(!G(e)||!G(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};c.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}};c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return c.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=c.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var a=e[n];if(!G(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};c.byteLength=Xn;c.prototype._isBuffer=!0;c.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)ye(this,t,t+1);return this};c.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)ye(this,t,t+3),ye(this,t+1,t+2);return this};c.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)ye(this,t,t+7),ye(this,t+1,t+6),ye(this,t+2,t+5),ye(this,t+3,t+4);return this};c.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?ti(this,0,e):Fu.apply(this,arguments)};c.prototype.equals=function(e){if(!G(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:c.compare(this,e)===0};c.prototype.compare=function(e,t,n,i,o){if(!G(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,p=n-t,l=Math.min(a,p),m=this.slice(i,o),g=e.slice(t,n),d=0;d<l;++d)if(m[d]!==g[d]){a=m[d],p=g[d];break}return a<p?-1:p<a?1:0};c.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};c.prototype.indexOf=function(e,t,n){return Zn(this,e,t,n,!0)};c.prototype.lastIndexOf=function(e,t,n){return Zn(this,e,t,n,!1)};c.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 Nu(this,e,t,n);case"utf8":case"utf-8":return Uu(this,e,t,n);case"ascii":return ei(this,e,t,n);case"latin1":case"binary":return Ou(this,e,t,n);case"base64":return Bu(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $u(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Hn=4096;c.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(c.TYPED_ARRAY_SUPPORT)i=this.subarray(e,t),i.__proto__=c.prototype;else{var o=t-e;i=new c(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+e]}return i};c.prototype.readUIntLE=function(e,t,n){e=e|0,t=t|0,n||R(e,t,this.length);for(var i=this[e],o=1,a=0;++a<t&&(o*=256);)i+=this[e+a]*o;return i};c.prototype.readUIntBE=function(e,t,n){e=e|0,t=t|0,n||R(e,t,this.length);for(var i=this[e+--t],o=1;t>0&&(o*=256);)i+=this[e+--t]*o;return i};c.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]};c.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8};c.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]};c.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};c.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};c.prototype.readIntLE=function(e,t,n){e=e|0,t=t|0,n||R(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};c.prototype.readIntBE=function(e,t,n){e=e|0,t=t|0,n||R(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};c.prototype.readInt8=function(e,t){return t||R(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};c.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};c.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};c.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};c.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};c.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),St(this,e,!0,23,4)};c.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),St(this,e,!1,23,4)};c.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),St(this,e,!0,52,8)};c.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),St(this,e,!1,52,8)};c.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;O(this,e,t,n,o,0)}var a=1,p=0;for(this[t]=e&255;++p<n&&(a*=256);)this[t+p]=e/a&255;return t+n};c.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;O(this,e,t,n,o,0)}var a=n-1,p=1;for(this[t+a]=e&255;--a>=0&&(p*=256);)this[t+a]=e/p&255;return t+n};c.prototype.writeUInt8=function(e,t,n){return e=+e,t=t|0,n||O(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t|0,n||O(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):It(this,e,t,!0),t+2};c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t|0,n||O(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):It(this,e,t,!1),t+2};c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t|0,n||O(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):At(this,e,t,!0),t+4};c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t|0,n||O(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):At(this,e,t,!1),t+4};c.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t|0,!i){var o=Math.pow(2,8*n-1);O(this,e,t,n,o-1,-o)}var a=0,p=1,l=0;for(this[t]=e&255;++a<n&&(p*=256);)e<0&&l===0&&this[t+a-1]!==0&&(l=1),this[t+a]=(e/p>>0)-l&255;return t+n};c.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t|0,!i){var o=Math.pow(2,8*n-1);O(this,e,t,n,o-1,-o)}var a=n-1,p=1,l=0;for(this[t+a]=e&255;--a>=0&&(p*=256);)e<0&&l===0&&this[t+a+1]!==0&&(l=1),this[t+a]=(e/p>>0)-l&255;return t+n};c.prototype.writeInt8=function(e,t,n){return e=+e,t=t|0,n||O(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1};c.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t|0,n||O(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):It(this,e,t,!0),t+2};c.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t|0,n||O(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):It(this,e,t,!1),t+2};c.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t|0,n||O(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):At(this,e,t,!0),t+4};c.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t|0,n||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):At(this,e,t,!1),t+4};c.prototype.writeFloatLE=function(e,t,n){return ni(this,e,t,!0,n)};c.prototype.writeFloatBE=function(e,t,n){return ni(this,e,t,!1,n)};c.prototype.writeDoubleLE=function(e,t,n){return ii(this,e,t,!0,n)};c.prototype.writeDoubleBE=function(e,t,n){return ii(this,e,t,!1,n)};c.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||!c.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};c.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"&&!c.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 p=G(e)?e:Tt(new c(e,i).toString()),l=p.length;for(a=0;a<n-t;++a)this[a+t]=p[a%l]}return this};Lu=/[^+\/0-9A-Za-z-_]/g});var u=Pe(()=>{"use strict";ui()});var li=v((qy,pi)=>{"use strict";s();u();var Ku="Function.prototype.bind called on incompatible ",Qu=Object.prototype.toString,Xu=Math.max,Zu="[object Function]",ci=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},ec=function(e,t){for(var n=[],i=t||0,o=0;i<e.length;i+=1,o+=1)n[o]=e[i];return n},tc=function(r,e){for(var t="",n=0;n<r.length;n+=1)t+=r[n],n+1<r.length&&(t+=e);return t};pi.exports=function(e){var t=this;if(typeof t!="function"||Qu.apply(t)!==Zu)throw new TypeError(Ku+t);for(var n=ec(arguments,1),i,o=function(){if(this instanceof i){var g=t.apply(this,ci(n,arguments));return Object(g)===g?g:this}return t.apply(e,ci(n,arguments))},a=Xu(0,t.length-n.length),p=[],l=0;l<a;l++)p[l]="$"+l;if(i=Function("binder","return function ("+tc(p,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var m=function(){};m.prototype=t.prototype,i.prototype=new m,m.prototype=null}return i}});var Et=v((Dy,fi)=>{"use strict";s();u();var rc=li();fi.exports=Function.prototype.bind||rc});var hi=v((Wy,yi)=>{"use strict";s();u();yi.exports=Error});var mi=v((jy,di)=>{"use strict";s();u();di.exports=EvalError});var vi=v((Jy,gi)=>{"use strict";s();u();gi.exports=RangeError});var xi=v((Xy,wi)=>{"use strict";s();u();wi.exports=ReferenceError});var xr=v((th,Ti)=>{"use strict";s();u();Ti.exports=SyntaxError});var F=v((ih,Ii)=>{"use strict";s();u();Ii.exports=TypeError});var bi=v((sh,Ai)=>{"use strict";s();u();Ai.exports=URIError});var Tr=v((ph,Si)=>{"use strict";s();u();Si.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 Ir=v((yh,Ri)=>{"use strict";s();u();var Ei=typeof Symbol!="undefined"&&Symbol,nc=Tr();Ri.exports=function(){return typeof Ei!="function"||typeof Symbol!="function"||typeof Ei("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:nc()}});var Fi=v((mh,Pi)=>{"use strict";s();u();var Ar={__proto__:null,foo:{}},ic=Object;Pi.exports=function(){return{__proto__:Ar}.foo===Ar.foo&&!(Ar instanceof ic)}});var Ui=v((wh,Ni)=>{"use strict";s();u();var oc=Function.prototype.call,ac=Object.prototype.hasOwnProperty,sc=Et();Ni.exports=sc.call(oc,ac)});var C=v((Ih,_i)=>{"use strict";s();u();var x,uc=hi(),cc=mi(),pc=vi(),lc=xi(),$e=xr(),Be=F(),fc=bi(),Ci=Function,br=function(r){try{return Ci('"use strict"; return ('+r+").constructor;")()}catch(e){}},he=Object.getOwnPropertyDescriptor;if(he)try{he({},"")}catch(r){he=null}var Sr=function(){throw new Be},yc=he?function(){try{return arguments.callee,Sr}catch(r){try{return he(arguments,"callee").get}catch(e){return Sr}}}():Sr,Ue=Ir()(),hc=Fi()(),P=Object.getPrototypeOf||(hc?function(r){return r.__proto__}:null),Oe={},dc=typeof Uint8Array=="undefined"||!P?x:P(Uint8Array),de={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?x:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?x:ArrayBuffer,"%ArrayIteratorPrototype%":Ue&&P?P([][Symbol.iterator]()):x,"%AsyncFromSyncIteratorPrototype%":x,"%AsyncFunction%":Oe,"%AsyncGenerator%":Oe,"%AsyncGeneratorFunction%":Oe,"%AsyncIteratorPrototype%":Oe,"%Atomics%":typeof Atomics=="undefined"?x:Atomics,"%BigInt%":typeof BigInt=="undefined"?x:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?x:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?x:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?x:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":uc,"%eval%":eval,"%EvalError%":cc,"%Float32Array%":typeof Float32Array=="undefined"?x:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?x:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?x:FinalizationRegistry,"%Function%":Ci,"%GeneratorFunction%":Oe,"%Int8Array%":typeof Int8Array=="undefined"?x:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?x:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?x:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ue&&P?P(P([][Symbol.iterator]())):x,"%JSON%":typeof JSON=="object"?JSON:x,"%Map%":typeof Map=="undefined"?x:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Ue||!P?x:P(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?x:Promise,"%Proxy%":typeof Proxy=="undefined"?x:Proxy,"%RangeError%":pc,"%ReferenceError%":lc,"%Reflect%":typeof Reflect=="undefined"?x:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?x:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Ue||!P?x:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?x:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ue&&P?P(""[Symbol.iterator]()):x,"%Symbol%":Ue?Symbol:x,"%SyntaxError%":$e,"%ThrowTypeError%":yc,"%TypedArray%":dc,"%TypeError%":Be,"%Uint8Array%":typeof Uint8Array=="undefined"?x:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?x:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?x:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?x:Uint32Array,"%URIError%":fc,"%WeakMap%":typeof WeakMap=="undefined"?x:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?x:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?x:WeakSet};if(P)try{null.error}catch(r){Oi=P(P(r)),de["%Error.prototype%"]=Oi}var Oi,mc=function r(e){var t;if(e==="%AsyncFunction%")t=br("async function () {}");else if(e==="%GeneratorFunction%")t=br("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=br("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&P&&(t=P(i.prototype))}return de[e]=t,t},Bi={__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"]},Ve=Et(),Rt=Ui(),gc=Ve.call(Function.call,Array.prototype.concat),vc=Ve.call(Function.apply,Array.prototype.splice),$i=Ve.call(Function.call,String.prototype.replace),Pt=Ve.call(Function.call,String.prototype.slice),wc=Ve.call(Function.call,RegExp.prototype.exec),xc=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Tc=/\\(\\)?/g,Ic=function(e){var t=Pt(e,0,1),n=Pt(e,-1);if(t==="%"&&n!=="%")throw new $e("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new $e("invalid intrinsic syntax, expected opening `%`");var i=[];return $i(e,xc,function(o,a,p,l){i[i.length]=p?$i(l,Tc,"$1"):a||o}),i},Ac=function(e,t){var n=e,i;if(Rt(Bi,n)&&(i=Bi[n],n="%"+i[0]+"%"),Rt(de,n)){var o=de[n];if(o===Oe&&(o=mc(n)),typeof o=="undefined"&&!t)throw new Be("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:o}}throw new $e("intrinsic "+e+" does not exist!")};_i.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Be("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Be('"allowMissing" argument must be a boolean');if(wc(/^%?[^%]*%?$/,e)===null)throw new $e("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Ic(e),i=n.length>0?n[0]:"",o=Ac("%"+i+"%",t),a=o.name,p=o.value,l=!1,m=o.alias;m&&(i=m[0],vc(n,gc([0,1],m)));for(var g=1,d=!0;g<n.length;g+=1){var w=n[g],I=Pt(w,0,1),S=Pt(w,-1);if((I==='"'||I==="'"||I==="`"||S==='"'||S==="'"||S==="`")&&I!==S)throw new $e("property names with quotes must have matching quotes");if((w==="constructor"||!d)&&(l=!0),i+="."+w,a="%"+i+"%",Rt(de,a))p=de[a];else if(p!=null){if(!(w in p)){if(!t)throw new Be("base intrinsic for "+e+" exists, but the property is not available.");return}if(he&&g+1>=n.length){var E=he(p,w);d=!!E,d&&"get"in E&&!("originalValue"in E.get)?p=E.get:p=p[w]}else d=Rt(p,w),p=p[w];d&&!l&&(de[a]=p)}}return p}});var Nt=v((Sh,qi)=>{"use strict";s();u();var bc=C(),Ft=bc("%Object.defineProperty%",!0)||!1;if(Ft)try{Ft({},"a",{value:1})}catch(r){Ft=!1}qi.exports=Ft});var Er=v((Ph,ki)=>{"use strict";s();u();var Sc=C(),Ut=Sc("%Object.getOwnPropertyDescriptor%",!0);if(Ut)try{Ut([],"length")}catch(r){Ut=null}ki.exports=Ut});var Rr=v((Uh,Li)=>{"use strict";s();u();var Mi=Nt(),Ec=xr(),Ce=F(),Di=Er();Li.exports=function(e,t,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Ce("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new Ce("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ce("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ce("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ce("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ce("`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,p=arguments.length>6?arguments[6]:!1,l=!!Di&&Di(e,t);if(Mi)Mi(e,t,{configurable:a===null&&l?l.configurable:!a,enumerable:i===null&&l?l.enumerable:!i,value:n,writable:o===null&&l?l.writable:!o});else if(p||!i&&!o&&!a)e[t]=n;else throw new Ec("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Fr=v(($h,Wi)=>{"use strict";s();u();var Pr=Nt(),Gi=function(){return!!Pr};Gi.hasArrayLengthDefineBug=function(){if(!Pr)return null;try{return Pr([],"length",{value:1}).length!==1}catch(e){return!0}};Wi.exports=Gi});var Hi=v((qh,zi)=>{"use strict";s();u();var Rc=C(),Vi=Rr(),Pc=Fr()(),Yi=Er(),ji=F(),Fc=Rc("%Math.floor%");zi.exports=function(e,t){if(typeof e!="function")throw new ji("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Fc(t)!==t)throw new ji("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&Yi){var a=Yi(e,"length");a&&!a.configurable&&(i=!1),a&&!a.writable&&(o=!1)}return(i||o||!n)&&(Pc?Vi(e,"length",t,!0,!0):Vi(e,"length",t)),e}});var $t=v((Dh,Ot)=>{"use strict";s();u();var Nr=Et(),Bt=C(),Nc=Hi(),Uc=F(),Qi=Bt("%Function.prototype.apply%"),Xi=Bt("%Function.prototype.call%"),Zi=Bt("%Reflect.apply%",!0)||Nr.call(Xi,Qi),Ji=Nt(),Oc=Bt("%Math.max%");Ot.exports=function(e){if(typeof e!="function")throw new Uc("a function is required");var t=Zi(Nr,Xi,arguments);return Nc(t,1+Oc(0,e.length-(arguments.length-1)),!0)};var Ki=function(){return Zi(Nr,Qi,arguments)};Ji?Ji(Ot.exports,"apply",{value:Ki}):Ot.exports.apply=Ki});var Ur=v((Wh,to)=>{"use strict";s();u();var eo=Object.prototype.toString;to.exports=function(e){var t=eo.call(e),n=t==="[object Arguments]";return n||(n=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&eo.call(e.callee)==="[object Function]"),n}});var po=v((jh,co)=>{"use strict";s();u();var uo;Object.keys||(Ye=Object.prototype.hasOwnProperty,Or=Object.prototype.toString,ro=Ur(),Br=Object.prototype.propertyIsEnumerable,no=!Br.call({toString:null},"toString"),io=Br.call(function(){},"prototype"),je=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ct=function(r){var e=r.constructor;return e&&e.prototype===r},oo={$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},ao=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!oo["$"+r]&&Ye.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Ct(window[r])}catch(e){return!0}}catch(e){return!0}return!1}(),so=function(r){if(typeof window=="undefined"||!ao)return Ct(r);try{return Ct(r)}catch(e){return!1}},uo=function(e){var t=e!==null&&typeof e=="object",n=Or.call(e)==="[object Function]",i=ro(e),o=t&&Or.call(e)==="[object String]",a=[];if(!t&&!n&&!i)throw new TypeError("Object.keys called on a non-object");var p=io&&n;if(o&&e.length>0&&!Ye.call(e,0))for(var l=0;l<e.length;++l)a.push(String(l));if(i&&e.length>0)for(var m=0;m<e.length;++m)a.push(String(m));else for(var g in e)!(p&&g==="prototype")&&Ye.call(e,g)&&a.push(String(g));if(no)for(var d=so(e),w=0;w<je.length;++w)!(d&&je[w]==="constructor")&&Ye.call(e,je[w])&&a.push(je[w]);return a});var Ye,Or,ro,Br,no,io,je,Ct,oo,ao,so;co.exports=uo});var ho=v((Jh,yo)=>{"use strict";s();u();var Bc=Array.prototype.slice,$c=Ur(),lo=Object.keys,_t=lo?function(e){return lo(e)}:po(),fo=Object.keys;_t.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 $c(n)?fo(Bc.call(n)):fo(n)})}else Object.keys=_t;return Object.keys||_t};yo.exports=_t});var ze=v((Xh,wo)=>{"use strict";s();u();var Cc=ho(),_c=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",qc=Object.prototype.toString,kc=Array.prototype.concat,mo=Rr(),Mc=function(r){return typeof r=="function"&&qc.call(r)==="[object Function]"},go=Fr()(),Dc=function(r,e,t,n){if(e in r){if(n===!0){if(r[e]===t)return}else if(!Mc(n)||!n())return}go?mo(r,e,t,!0):mo(r,e,t)},vo=function(r,e){var t=arguments.length>2?arguments[2]:{},n=Cc(e);_c&&(n=kc.call(n,Object.getOwnPropertySymbols(e)));for(var i=0;i<n.length;i+=1)Dc(r,n[i],e[n[i]],t[n[i]])};vo.supportsDescriptors=!!go;wo.exports=vo});var M=v((td,Io)=>{"use strict";s();u();var xo=C(),To=$t(),Lc=To(xo("String.prototype.indexOf"));Io.exports=function(e,t){var n=xo(e,!!t);return typeof n=="function"&&Lc(e,".prototype.")>-1?To(n):n}});var So=v((id,bo)=>{"use strict";s();u();var Gc=C(),Ao=Gc("%Array%"),Wc=!Ao.isArray&&M()("Object.prototype.toString");bo.exports=Ao.isArray||function(e){return Wc(e)==="[object Array]"}});var $r=v((sd,Eo)=>{"use strict";s();u();Eo.exports=So()});var Po=v((pd,Ro)=>{"use strict";s();u();var Vc=C(),Yc=M(),jc=F(),zc=$r(),Hc=Vc("%Reflect.apply%",!0)||Yc("Function.prototype.apply");Ro.exports=function(e,t){var n=arguments.length>2?arguments[2]:[];if(!zc(n))throw new jc("Assertion failed: optional `argumentsList`, if provided, must be a List");return Hc(e,t,n)}});function Fo(){throw new Error("setTimeout has not been defined")}function No(){throw new Error("clearTimeout has not been defined")}function Uo(r){if(oe===setTimeout)return setTimeout(r,0);if((oe===Fo||!oe)&&setTimeout)return oe=setTimeout,setTimeout(r,0);try{return oe(r,0)}catch(e){try{return oe.call(null,r,0)}catch(t){return oe.call(this,r,0)}}}function Jc(r){if(ae===clearTimeout)return clearTimeout(r);if((ae===No||!ae)&&clearTimeout)return ae=clearTimeout,clearTimeout(r);try{return ae(r)}catch(e){try{return ae.call(null,r)}catch(t){return ae.call(this,r)}}}function Kc(){!qe||!me||(qe=!1,me.length?Q=me.concat(Q):qt=-1,Q.length&&Oo())}function Oo(){if(!qe){var r=Uo(Kc);qe=!0;for(var e=Q.length;e;){for(me=Q,Q=[];++qt<e;)me&&me[qt].run();qt=-1,e=Q.length}me=null,qe=!1,Jc(r)}}function Qc(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];Q.push(new Bo(r,e)),Q.length===1&&!qe&&Uo(Oo)}function Bo(r,e){this.fun=r,this.array=e}function ge(){}function hp(r){throw new Error("process.binding is not supported")}function dp(){return"/"}function mp(r){throw new Error("process.chdir is not supported")}function gp(){return 0}function wp(r){var e=vp.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 Tp(){var r=new Date,e=r-xp;return e/1e3}var oe,ae,Q,qe,me,qt,Xc,Zc,ep,tp,rp,np,ip,op,ap,sp,up,cp,pp,lp,fp,yp,_e,vp,xp,Ip,He,$o=Pe(()=>{"use strict";s();u();oe=Fo,ae=No;typeof globalThis.setTimeout=="function"&&(oe=setTimeout);typeof globalThis.clearTimeout=="function"&&(ae=clearTimeout);Q=[],qe=!1,qt=-1;Bo.prototype.run=function(){this.fun.apply(null,this.array)};Xc="browser",Zc="browser",ep=!0,tp={},rp=[],np="",ip={},op={},ap={};sp=ge,up=ge,cp=ge,pp=ge,lp=ge,fp=ge,yp=ge;_e=globalThis.performance||{},vp=_e.now||_e.mozNow||_e.msNow||_e.oNow||_e.webkitNow||function(){return new Date().getTime()};xp=new Date;Ip={nextTick:Qc,title:Xc,browser:ep,env:tp,argv:rp,version:np,versions:ip,on:sp,addListener:up,once:cp,off:pp,removeListener:lp,removeAllListeners:fp,emit:yp,binding:hp,cwd:dp,chdir:mp,umask:gp,hrtime:wp,platform:Zc,release:op,config:ap,uptime:Tp},He=Ip});var Cr,_r,Co=Pe(()=>{"use strict";s();u();typeof Object.create=="function"?Cr=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:Cr=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};_r=Cr});var Wo={};dr(Wo,{_extend:()=>Yr,debuglog:()=>_o,default:()=>Op,deprecate:()=>Lr,format:()=>Lt,inherits:()=>_r,inspect:()=>V,isArray:()=>Gr,isBoolean:()=>Gt,isBuffer:()=>Do,isDate:()=>Dt,isError:()=>Ke,isFunction:()=>Qe,isNull:()=>Xe,isNullOrUndefined:()=>qo,isNumber:()=>Wr,isObject:()=>ve,isPrimitive:()=>Mo,isRegExp:()=>Je,isString:()=>Ze,isSymbol:()=>ko,isUndefined:()=>W,log:()=>Lo});function Lt(r){if(!Ze(r)){for(var e=[],t=0;t<arguments.length;t++)e.push(V(arguments[t]));return e.join(" ")}for(var t=1,n=arguments,i=n.length,o=String(r).replace(Ap,function(p){if(p==="%%")return"%";if(t>=i)return p;switch(p){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch(l){return"[Circular]"}default:return p}}),a=n[t];t<i;a=n[++t])Xe(a)||!ve(a)?o+=" "+a:o+=" "+V(a);return o}function Lr(r,e){if(W(globalThis.process))return function(){return Lr(r,e).apply(this,arguments)};if(He.noDeprecation===!0)return r;var t=!1;function n(){if(!t){if(He.throwDeprecation)throw new Error(e);He.traceDeprecation?console.trace(e):console.error(e),t=!0}return r.apply(this,arguments)}return n}function _o(r){if(W(qr)&&(qr=He.env.NODE_DEBUG||""),r=r.toUpperCase(),!kt[r])if(new RegExp("\\b"+r+"\\b","i").test(qr)){var e=0;kt[r]=function(){var t=Lt.apply(null,arguments);console.error("%s %d: %s",r,e,t)}}else kt[r]=function(){};return kt[r]}function V(r,e){var t={seen:[],stylize:Sp};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),Gt(e)?t.showHidden=e:e&&Yr(t,e),W(t.showHidden)&&(t.showHidden=!1),W(t.depth)&&(t.depth=2),W(t.colors)&&(t.colors=!1),W(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=bp),Mt(t,r,t.depth)}function bp(r,e){var t=V.styles[e];return t?"\x1B["+V.colors[t][0]+"m"+r+"\x1B["+V.colors[t][1]+"m":r}function Sp(r,e){return r}function Ep(r){var e={};return r.forEach(function(t,n){e[t]=!0}),e}function Mt(r,e,t){if(r.customInspect&&e&&Qe(e.inspect)&&e.inspect!==V&&!(e.constructor&&e.constructor.prototype===e)){var n=e.inspect(t,r);return Ze(n)||(n=Mt(r,n,t)),n}var i=Rp(r,e);if(i)return i;var o=Object.keys(e),a=Ep(o);if(r.showHidden&&(o=Object.getOwnPropertyNames(e)),Ke(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return kr(e);if(o.length===0){if(Qe(e)){var p=e.name?": "+e.name:"";return r.stylize("[Function"+p+"]","special")}if(Je(e))return r.stylize(RegExp.prototype.toString.call(e),"regexp");if(Dt(e))return r.stylize(Date.prototype.toString.call(e),"date");if(Ke(e))return kr(e)}var l="",m=!1,g=["{","}"];if(Gr(e)&&(m=!0,g=["[","]"]),Qe(e)){var d=e.name?": "+e.name:"";l=" [Function"+d+"]"}if(Je(e)&&(l=" "+RegExp.prototype.toString.call(e)),Dt(e)&&(l=" "+Date.prototype.toUTCString.call(e)),Ke(e)&&(l=" "+kr(e)),o.length===0&&(!m||e.length==0))return g[0]+l+g[1];if(t<0)return Je(e)?r.stylize(RegExp.prototype.toString.call(e),"regexp"):r.stylize("[Object]","special");r.seen.push(e);var w;return m?w=Pp(r,e,t,a,o):w=o.map(function(I){return Dr(r,e,t,a,I,m)}),r.seen.pop(),Fp(w,l,g)}function Rp(r,e){if(W(e))return r.stylize("undefined","undefined");if(Ze(e)){var t="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return r.stylize(t,"string")}if(Wr(e))return r.stylize(""+e,"number");if(Gt(e))return r.stylize(""+e,"boolean");if(Xe(e))return r.stylize("null","null")}function kr(r){return"["+Error.prototype.toString.call(r)+"]"}function Pp(r,e,t,n,i){for(var o=[],a=0,p=e.length;a<p;++a)Go(e,String(a))?o.push(Dr(r,e,t,n,String(a),!0)):o.push("");return i.forEach(function(l){l.match(/^\d+$/)||o.push(Dr(r,e,t,n,l,!0))}),o}function Dr(r,e,t,n,i,o){var a,p,l;if(l=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},l.get?l.set?p=r.stylize("[Getter/Setter]","special"):p=r.stylize("[Getter]","special"):l.set&&(p=r.stylize("[Setter]","special")),Go(n,i)||(a="["+i+"]"),p||(r.seen.indexOf(l.value)<0?(Xe(t)?p=Mt(r,l.value,null):p=Mt(r,l.value,t-1),p.indexOf(`
2
- `)>-1&&(o?p=p.split(`
3
- `).map(function(m){return" "+m}).join(`
4
- `).substr(2):p=`
5
- `+p.split(`
6
- `).map(function(m){return" "+m}).join(`
7
- `))):p=r.stylize("[Circular]","special")),W(a)){if(o&&i.match(/^\d+$/))return p;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=r.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=r.stylize(a,"string"))}return a+": "+p}function Fp(r,e,t){var n=0,i=r.reduce(function(o,a){return n++,a.indexOf(`
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 Gr(r){return Array.isArray(r)}function Gt(r){return typeof r=="boolean"}function Xe(r){return r===null}function qo(r){return r==null}function Wr(r){return typeof r=="number"}function Ze(r){return typeof r=="string"}function ko(r){return typeof r=="symbol"}function W(r){return r===void 0}function Je(r){return ve(r)&&Vr(r)==="[object RegExp]"}function ve(r){return typeof r=="object"&&r!==null}function Dt(r){return ve(r)&&Vr(r)==="[object Date]"}function Ke(r){return ve(r)&&(Vr(r)==="[object Error]"||r instanceof Error)}function Qe(r){return typeof r=="function"}function Mo(r){return r===null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||typeof r=="symbol"||typeof r=="undefined"}function Do(r){return c.isBuffer(r)}function Vr(r){return Object.prototype.toString.call(r)}function Mr(r){return r<10?"0"+r.toString(10):r.toString(10)}function Up(){var r=new Date,e=[Mr(r.getHours()),Mr(r.getMinutes()),Mr(r.getSeconds())].join(":");return[r.getDate(),Np[r.getMonth()],e].join(" ")}function Lo(){console.log("%s - %s",Up(),Lt.apply(null,arguments))}function Yr(r,e){if(!e||!ve(e))return r;for(var t=Object.keys(e),n=t.length;n--;)r[t[n]]=e[t[n]];return r}function Go(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var Ap,kt,qr,Np,Op,Vo=Pe(()=>{"use strict";s();u();$o();Co();Ap=/%[sdj%]/g;kt={};V.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]};V.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};Np=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Op={inherits:_r,_extend:Yr,log:Lo,isBuffer:Do,isPrimitive:Mo,isFunction:Qe,isError:Ke,isDate:Dt,isObject:ve,isRegExp:Je,isUndefined:W,isSymbol:ko,isString:Ze,isNumber:Wr,isNullOrUndefined:qo,isNull:Xe,isBoolean:Gt,isArray:Gr,inspect:V,deprecate:Lr,format:Lt,debuglog:_o}});var Yo=v((Ad,Wt)=>{"use strict";s();u();var we=(Vo(),Mn(Wo));if(we&&we.default){Wt.exports=we.default;for(let r in we)Wt.exports[r]=we[r]}else we&&(Wt.exports=we)});var zo=v((Ed,jo)=>{"use strict";s();u();jo.exports=Yo().inspect});var nt=v((Fd,ya)=>{"use strict";s();u();var tn=typeof Map=="function"&&Map.prototype,jr=Object.getOwnPropertyDescriptor&&tn?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Yt=tn&&jr&&typeof jr.get=="function"?jr.get:null,Ho=tn&&Map.prototype.forEach,rn=typeof Set=="function"&&Set.prototype,zr=Object.getOwnPropertyDescriptor&&rn?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,jt=rn&&zr&&typeof zr.get=="function"?zr.get:null,Jo=rn&&Set.prototype.forEach,Bp=typeof WeakMap=="function"&&WeakMap.prototype,tt=Bp?WeakMap.prototype.has:null,$p=typeof WeakSet=="function"&&WeakSet.prototype,rt=$p?WeakSet.prototype.has:null,Cp=typeof WeakRef=="function"&&WeakRef.prototype,Ko=Cp?WeakRef.prototype.deref:null,_p=Boolean.prototype.valueOf,qp=Object.prototype.toString,kp=Function.prototype.toString,Mp=String.prototype.match,nn=String.prototype.slice,se=String.prototype.replace,Dp=String.prototype.toUpperCase,Qo=String.prototype.toLowerCase,aa=RegExp.prototype.test,Xo=Array.prototype.concat,Y=Array.prototype.join,Lp=Array.prototype.slice,Zo=Math.floor,Kr=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Hr=Object.getOwnPropertySymbols,Qr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ke=typeof Symbol=="function"&&typeof Symbol.iterator=="object",N=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ke||!0)?Symbol.toStringTag:null,sa=Object.prototype.propertyIsEnumerable,ea=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function ta(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||aa.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-Zo(-r):Zo(r);if(n!==r){var i=String(n),o=nn.call(e,i.length+1);return se.call(i,t,"$&_")+"."+se.call(se.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return se.call(e,t,"$&_")}var Xr=zo(),ra=Xr.custom,na=pa(ra)?ra:null,ua={__proto__:null,double:'"',single:"'"},Gp={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};ya.exports=function r(e,t,n,i){var o=t||{};if(X(o,"quoteStyle")&&!X(ua,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(X(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=X(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(X(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(X(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var p=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 fa(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return p?ta(e,l):l}if(typeof e=="bigint"){var m=String(e)+"n";return p?ta(e,m):m}var g=typeof o.depth=="undefined"?5:o.depth;if(typeof n=="undefined"&&(n=0),n>=g&&g>0&&typeof e=="object")return Zr(e)?"[Array]":"[Object]";var d=al(o,n);if(typeof i=="undefined")i=[];else if(la(i,e)>=0)return"[Circular]";function w(Re,gt,Ds){if(gt&&(i=Lp.call(i),i.push(gt)),Ds){var On={depth:o.depth};return X(o,"quoteStyle")&&(On.quoteStyle=o.quoteStyle),r(Re,On,n+1,i)}return r(Re,o,n+1,i)}if(typeof e=="function"&&!ia(e)){var I=Qp(e),S=Vt(e,w);return"[Function"+(I?": "+I:" (anonymous)")+"]"+(S.length>0?" { "+Y.call(S,", ")+" }":"")}if(pa(e)){var E=ke?se.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Qr.call(e);return typeof e=="object"&&!ke?et(E):E}if(nl(e)){for(var U="<"+Qo.call(String(e.nodeName)),$=e.attributes||[],H=0;H<$.length;H++)U+=" "+$[H].name+"="+ca(Wp($[H].value),"double",o);return U+=">",e.childNodes&&e.childNodes.length&&(U+="..."),U+="</"+Qo.call(String(e.nodeName))+">",U}if(Zr(e)){if(e.length===0)return"[]";var pe=Vt(e,w);return d&&!ol(pe)?"["+en(pe,d)+"]":"[ "+Y.call(pe,", ")+" ]"}if(Yp(e)){var Ge=Vt(e,w);return!("cause"in Error.prototype)&&"cause"in e&&!sa.call(e,"cause")?"{ ["+String(e)+"] "+Y.call(Xo.call("[cause]: "+w(e.cause),Ge),", ")+" }":Ge.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Y.call(Ge,", ")+" }"}if(typeof e=="object"&&a){if(na&&typeof e[na]=="function"&&Xr)return Xr(e,{depth:g-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Xp(e)){var mt=[];return Ho&&Ho.call(e,function(Re,gt){mt.push(w(gt,e,!0)+" => "+w(Re,e))}),oa("Map",Yt.call(e),mt,d)}if(tl(e)){var Fn=[];return Jo&&Jo.call(e,function(Re){Fn.push(w(Re,e))}),oa("Set",jt.call(e),Fn,d)}if(Zp(e))return Jr("WeakMap");if(rl(e))return Jr("WeakSet");if(el(e))return Jr("WeakRef");if(zp(e))return et(w(Number(e)));if(Jp(e))return et(w(Kr.call(e)));if(Hp(e))return et(_p.call(e));if(jp(e))return et(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(!Vp(e)&&!ia(e)){var pr=Vt(e,w),Nn=ea?ea(e)===Object.prototype:e instanceof Object||e.constructor===Object,lr=e instanceof Object?"":"null prototype",Un=!Nn&&N&&Object(e)===e&&N in e?nn.call(ue(e),8,-1):lr?"Object":"",Ms=Nn||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",fr=Ms+(Un||lr?"["+Y.call(Xo.call([],Un||[],lr||[]),": ")+"] ":"");return pr.length===0?fr+"{}":d?fr+"{"+en(pr,d)+"}":fr+"{ "+Y.call(pr,", ")+" }"}return String(e)};function ca(r,e,t){var n=t.quoteStyle||e,i=ua[n];return i+r+i}function Wp(r){return se.call(String(r),/"/g,"&quot;")}function Zr(r){return ue(r)==="[object Array]"&&(!N||!(typeof r=="object"&&N in r))}function Vp(r){return ue(r)==="[object Date]"&&(!N||!(typeof r=="object"&&N in r))}function ia(r){return ue(r)==="[object RegExp]"&&(!N||!(typeof r=="object"&&N in r))}function Yp(r){return ue(r)==="[object Error]"&&(!N||!(typeof r=="object"&&N in r))}function jp(r){return ue(r)==="[object String]"&&(!N||!(typeof r=="object"&&N in r))}function zp(r){return ue(r)==="[object Number]"&&(!N||!(typeof r=="object"&&N in r))}function Hp(r){return ue(r)==="[object Boolean]"&&(!N||!(typeof r=="object"&&N in r))}function pa(r){if(ke)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Qr)return!1;try{return Qr.call(r),!0}catch(e){}return!1}function Jp(r){if(!r||typeof r!="object"||!Kr)return!1;try{return Kr.call(r),!0}catch(e){}return!1}var Kp=Object.prototype.hasOwnProperty||function(r){return r in this};function X(r,e){return Kp.call(r,e)}function ue(r){return qp.call(r)}function Qp(r){if(r.name)return r.name;var e=Mp.call(kp.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function la(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 Xp(r){if(!Yt||!r||typeof r!="object")return!1;try{Yt.call(r);try{jt.call(r)}catch(e){return!0}return r instanceof Map}catch(e){}return!1}function Zp(r){if(!tt||!r||typeof r!="object")return!1;try{tt.call(r,tt);try{rt.call(r,rt)}catch(e){return!0}return r instanceof WeakMap}catch(e){}return!1}function el(r){if(!Ko||!r||typeof r!="object")return!1;try{return Ko.call(r),!0}catch(e){}return!1}function tl(r){if(!jt||!r||typeof r!="object")return!1;try{jt.call(r);try{Yt.call(r)}catch(e){return!0}return r instanceof Set}catch(e){}return!1}function rl(r){if(!rt||!r||typeof r!="object")return!1;try{rt.call(r,rt);try{tt.call(r,tt)}catch(e){return!0}return r instanceof WeakSet}catch(e){}return!1}function nl(r){return!r||typeof r!="object"?!1:typeof HTMLElement!="undefined"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function fa(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return fa(nn.call(r,0,e.maxStringLength),e)+n}var i=Gp[e.quoteStyle||"single"];i.lastIndex=0;var o=se.call(se.call(r,i,"\\$1"),/[\x00-\x1f]/g,il);return ca(o,"single",e)}function il(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":"")+Dp.call(e.toString(16))}function et(r){return"Object("+r+")"}function Jr(r){return r+" { ? }"}function oa(r,e,t,n){var i=n?en(t,n):Y.call(t,", ");return r+" ("+e+") {"+i+"}"}function ol(r){for(var e=0;e<r.length;e++)if(la(r[e],`
11
- `)>=0)return!1;return!0}function al(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=Y.call(Array(r.indent+1)," ");else return null;return{base:t,prev:Y.call(Array(e+1),t)}}function en(r,e){if(r.length===0)return"";var t=`
12
- `+e.prev+e.base;return t+Y.call(r,","+t)+`
13
- `+e.prev}function Vt(r,e){var t=Zr(r),n=[];if(t){n.length=r.length;for(var i=0;i<r.length;i++)n[i]=X(r,i)?e(r[i],r):""}var o=typeof Hr=="function"?Hr(r):[],a;if(ke){a={};for(var p=0;p<o.length;p++)a["$"+o[p]]=o[p]}for(var l in r)X(r,l)&&(t&&String(Number(l))===l&&l<r.length||ke&&a["$"+l]instanceof Symbol||(aa.call(/[^\w$]/,l)?n.push(e(l,r)+": "+e(r[l],r)):n.push(l+": "+e(r[l],r))));if(typeof Hr=="function")for(var m=0;m<o.length;m++)sa.call(r,o[m])&&n.push("["+e(o[m])+"]: "+e(r[o[m]],r));return n}});var zt=v((Od,ha)=>{"use strict";s();u();ha.exports=function(e){return typeof e=="string"||typeof e=="symbol"}});var ma=v((Cd,da)=>{"use strict";s();u();var sl=F(),ul=nt(),cl=zt();da.exports=function(e,t){if(!cl(t))throw new sl("Assertion failed: IsPropertyKey(P) is not true, got "+ul(t));return e[t]}});var xa=v((kd,wa)=>{"use strict";s();u();var va=Function.prototype.toString,Me=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,an,Ht;if(typeof Me=="function"&&typeof Object.defineProperty=="function")try{an=Object.defineProperty({},"length",{get:function(){throw Ht}}),Ht={},Me(function(){throw 42},null,an)}catch(r){r!==Ht&&(Me=null)}else Me=null;var pl=/^\s*class\b/,sn=function(e){try{var t=va.call(e);return pl.test(t)}catch(n){return!1}},on=function(e){try{return sn(e)?!1:(va.call(e),!0)}catch(t){return!1}},Jt=Object.prototype.toString,ll="[object Object]",fl="[object Function]",yl="[object GeneratorFunction]",hl="[object HTMLAllCollection]",dl="[object HTML document.all class]",ml="[object HTMLCollection]",gl=typeof Symbol=="function"&&!!Symbol.toStringTag,vl=!(0 in[,]),un=function(){return!1};typeof document=="object"&&(ga=document.all,Jt.call(ga)===Jt.call(document.all)&&(un=function(e){if((vl||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var t=Jt.call(e);return(t===hl||t===dl||t===ml||t===ll)&&e("")==null}catch(n){}return!1}));var ga;wa.exports=Me?function(e){if(un(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Me(e,null,an)}catch(t){if(t!==Ht)return!1}return!sn(e)&&on(e)}:function(e){if(un(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(gl)return on(e);if(sn(e))return!1;var t=Jt.call(e);return t!==fl&&t!==yl&&!/^\[object HTML/.test(t)?!1:on(e)}});var cn=v((Ld,Ta)=>{"use strict";s();u();Ta.exports=xa()});var Sa=v((Vd,ba)=>{"use strict";s();u();var Ia=F(),wl=ma(),xl=cn(),Tl=zt(),Aa=nt();ba.exports=function(e,t){if(!Tl(t))throw new Ia("Assertion failed: IsPropertyKey(P) is not true");var n=wl(e,t);if(n!=null){if(!xl(n))throw new Ia(Aa(t)+" is not a function: "+Aa(n));return n}}});var Ra=v((zd,Ea)=>{"use strict";s();u();var Il=Tr();Ea.exports=function(){return Il()&&!!Symbol.toStringTag}});var yn=v((Kd,Ua)=>{"use strict";s();u();var pn=M(),Pa=Ra()(),Fa,Na,ln,fn;Pa&&(Fa=pn("Object.prototype.hasOwnProperty"),Na=pn("RegExp.prototype.exec"),ln={},Kt=function(){throw ln},fn={toString:Kt,valueOf:Kt},typeof Symbol.toPrimitive=="symbol"&&(fn[Symbol.toPrimitive]=Kt));var Kt,Al=pn("Object.prototype.toString"),bl=Object.getOwnPropertyDescriptor,Sl="[object RegExp]";Ua.exports=Pa?function(e){if(!e||typeof e!="object")return!1;var t=bl(e,"lastIndex"),n=t&&Fa(t,"value");if(!n)return!1;try{Na(e,fn)}catch(i){return i===ln}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:Al(e)===Sl}});var hn=v((Zd,Oa)=>{"use strict";s();u();var El=M(),Rl=yn(),Pl=El("RegExp.prototype.exec"),Fl=F();Oa.exports=function(e){if(!Rl(e))throw new Fl("`regex` must be a RegExp");return function(n){return Pl(e,n)!==null}}});var $a=v((rm,Ba)=>{"use strict";s();u();Ba.exports=function(e,t){for(var n=0;n<e.length;n+=1)if(!t(e[n],n,e))return!1;return!0}});var _a=v((om,Ca)=>{"use strict";s();u();Ca.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 dn=v((um,qa)=>{"use strict";s();u();var Nl=_a();qa.exports=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":Nl(e)}});var Da=v((lm,Ma)=>{"use strict";s();u();var ka=F(),Ul=nt(),Ol=zt(),Bl=dn();Ma.exports=function(e,t){if(Bl(e)!=="Object")throw new ka("Assertion failed: Type(O) is not Object");if(!Ol(t))throw new ka("Assertion failed: IsPropertyKey(P) is not true, got "+Ul(t));return e[t]}});var Ga=v((hm,La)=>{"use strict";s();u();var $l=C();La.exports=$l("%Math.min%")});var mn=v((gm,Wa)=>{"use strict";s();u();Wa.exports=Number.isNaN||function(e){return e!==e}});var Ya=v((xm,Va)=>{"use strict";s();u();var Cl=mn();Va.exports=function(r){return(typeof r=="number"||typeof r=="bigint")&&!Cl(r)&&r!==1/0&&r!==-1/0}});var Qt=v((Am,za)=>{"use strict";s();u();var ja=C(),_l=ja("%Math.abs%"),ql=ja("%Math.floor%"),kl=mn(),Ml=Ya();za.exports=function(e){if(typeof e!="number"||kl(e)||!Ml(e))return!1;var t=_l(e);return ql(t)===t}});var vn=v((Em,Ha)=>{"use strict";s();u();var Dl=M(),gn=F(),Ll=Qt(),Gl=Dl("String.prototype.slice");Ha.exports=function(e,t,n){if(typeof e!="string")throw new gn("Assertion failed: `string` must be a String");if(typeof t!="string")throw new gn("Assertion failed: `searchValue` must be a String");if(!Ll(n)||n<0)throw new gn("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 p=Gl(e,a,a+o);if(p===t)return a}return-1}});var Xt=v((Fm,Ja)=>{"use strict";s();u();var Wl=F();Ja.exports=function(e){if(e==null)throw new Wl(arguments.length>0&&arguments[1]||"Cannot call method on "+e);return e}});var Zt=v((Om,Ka)=>{"use strict";s();u();var Vl=C(),Yl=Vl("%String%"),jl=F();Ka.exports=function(e){if(typeof e=="symbol")throw new jl("Cannot convert a Symbol value to a string");return Yl(e)}});var wn=v((Cm,Za)=>{"use strict";s();u();var zl=Xt(),Hl=Zt(),Jl=M(),Qa=Jl("String.prototype.replace"),Xa=/^\s$/.test("\u180E"),Kl=Xa?/^[\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]+/,Ql=Xa?/[\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]+$/;Za.exports=function(){var e=Hl(zl(this));return Qa(Qa(e,Kl,""),Ql,"")}});var xn=v((km,ts)=>{"use strict";s();u();var Xl=wn(),es="\u200B",De="\u180E";ts.exports=function(){return String.prototype.trim&&es.trim()===es&&De.trim()===De&&("_"+De).trim()==="_"+De&&(De+"_").trim()===De+"_"?String.prototype.trim:Xl}});var ns=v((Lm,rs)=>{"use strict";s();u();var Zl=ze(),ef=xn();rs.exports=function(){var e=ef();return Zl(String.prototype,{trim:e},{trim:function(){return String.prototype.trim!==e}}),e}});var ss=v((Vm,as)=>{"use strict";s();u();var tf=$t(),rf=ze(),nf=Xt(),of=wn(),is=xn(),af=ns(),sf=tf(is()),os=function(e){return nf(e),sf(e)};rf(os,{getPolyfill:is,implementation:of,shim:af});as.exports=os});var ls=v((zm,ps)=>{"use strict";s();u();var In=C(),Tn=In("%Number%"),uf=In("%RegExp%"),cf=F(),us=In("%parseInt%"),pf=M(),er=hn(),cs=pf("String.prototype.slice"),lf=er(/^0b[01]+$/i),ff=er(/^0o[0-7]+$/i),yf=er(/^[-+]0x[0-9a-f]+$/i),hf=["\x85","\u200B","\uFFFE"].join(""),df=new uf("["+hf+"]","g"),mf=er(df),gf=ss();ps.exports=function r(e){if(typeof e!="string")throw new cf("Assertion failed: `argument` is not a String");if(lf(e))return Tn(us(cs(e,2),2));if(ff(e))return Tn(us(cs(e,2),8));if(mf(e)||yf(e))return NaN;var t=gf(e);return t!==e?r(t):Tn(e)}});var hs=v((Km,ys)=>{"use strict";s();u();var vf=F(),fs=Qt(),wf=M(),xf=wf("String.prototype.slice");ys.exports=function(e,t,n){if(typeof e!="string"||!fs(t)||arguments.length>2&&!fs(n))throw new vf("`S` must be a String, and `inclusiveStart` and `exclusiveEnd` must be integers");return xf(e,t,arguments.length>2?n:e.length)}});var ms=v((Zm,ds)=>{"use strict";s();u();ds.exports=function(e){return typeof e=="string"||typeof e=="undefined"}});var vs=v((rg,gs)=>{"use strict";s();u();var Tf=M()("String.prototype.slice");gs.exports=function(e,t){return e===t?!0:e.length>t.length?!1:Tf(t,0,e.length)===e}});var As=v((og,Is)=>{"use strict";s();u();var Z=F(),Ts=hn(),If=$a(),An=nt(),Af=Da(),bf=$r(),Sf=Ga(),Ef=vn(),ws=ls(),ee=hs(),Rf=Zt(),xs=dn(),Pf=Qt(),Ff=ms(),it=vs(),Nf=Ts(/^\$[0-9]/),Uf=Ts(/^\$[0-9][0-9]/);Is.exports=function(e,t,n,i,o,a){if(typeof e!="string")throw new Z("Assertion failed: `matched` must be a String");if(typeof t!="string")throw new Z("Assertion failed: `str` must be a String");if(!Pf(n)||n<0)throw new Z("Assertion failed: `position` must be a nonnegative integer, got "+An(n));if(!bf(i)||!If(i,Ff))throw new Z("Assertion failed: `captures` must be a possibly-empty List of Strings or `undefined`, got "+An(i));if(typeof o!="undefined"&&xs(o)!=="Object")throw new Z("Assertion failed: `namedCaptures` must be `undefined` or an Object");if(typeof a!="string")throw new Z("Assertion failed: `replacementTemplate` must be a String");var p=t.length;if(n>p)throw new Z("Assertion failed: position > stringLength, got "+An(n));for(var l=a,m="";l!=="";){var g,d,w;if(it("$$",l))g="$$",d="$";else if(it("$`",l))g="$`",d=ee(t,0,n);else if(it("$&",l))g="$&",d=e;else if(it("$'",l)){g="$'";var I=e.length,S=n+I;d=ee(t,Sf(S,p))}else if(Nf(l)){var E=Uf(l)?2:1,U=ee(l,1,1+E),$=ws(U);if($<0||$>99)throw new Z("Assertion failed: `index` must be >= 0 and <= 99");var H=i.length;$>H&&E===2&&(E=1,U=ee(U,0,1),$=ws(U)),g=ee(l,0,1+E),1<=$&&$<=H?(w=i[$-1],typeof w=="undefined"?d="":d=w):d=g}else if(it("$<",l)){var pe=Ef(l,">",0);if(pe===-1||typeof o=="undefined")g="$<",d=g;else{g=ee(l,0,pe+1);var Ge=ee(l,2,pe);if(xs(o)!=="Object")throw new Z("Assertion failed: Type(namedCaptures) is not Object");w=Af(o,Ge),typeof w=="undefined"?d="":d=Rf(w)}}else g=ee(l,0,1),d=g;var mt=g.length;l=ee(l,mt),m+=d}return m}});var Sn=v((ug,Rs)=>{"use strict";s();u();var bs=Po(),Of=Sa(),Bf=As(),$f=cn(),Cf=Xt(),tr=Zt(),Ss=vn(),_f=C(),rr=M(),qf=Ir()(),kf=yn(),Mf=_f("%Math.max%"),Es=F(),Df=rr("Array.prototype.push"),bn=rr("String.prototype.slice"),Lf=rr("String.prototype.indexOf"),Gf=rr("String.prototype.replace");Rs.exports=function(e,t){var n=Cf(this),i=kf(e);if(i&&Lf(bn(e,e.source.length+2),"g")===-1)throw new Es("use .replace for a non-global regex. NOTE: this may be allowed in the future.");if(qf&&Symbol.replace){if(e!=null){var o=Of(e,Symbol.replace);if(typeof o!="undefined")return bs(o,e,[n,t])}}else if(i)return Gf(n,e,t);var a=tr(n),p=tr(e),l=$f(t);l||(t=tr(t));for(var m=p.length,g=Mf(1,m),d=[],w=Ss(a,p,0);w!==-1;)Df(d,w),w=Ss(a,p,w+g);for(var I=0,S="",E=0;E<d.length;E+=1){var U;if(l)U=tr(bs(t,void 0,[p,d[E],a]));else{if(typeof t!="string")throw new Es("Assertion failed: `replaceValue` should be a string at this point");var $=[];U=Bf(p,a,d[E],$,void 0,t)}var H=bn(a,I,d[E]);S+=H+U,I=d[E]+m}return I<a.length&&(S+=bn(a,I)),S}});var En=v((lg,Ps)=>{"use strict";s();u();var Wf=Sn();Ps.exports=function(){return String.prototype.replaceAll||Wf}});var Ns=v((hg,Fs)=>{"use strict";s();u();var Vf=ze(),Yf=En();Fs.exports=function(){var e=Yf();return Vf(String.prototype,{replaceAll:e},{replaceAll:function(){return String.prototype.replaceAll!==e}}),e}});var $s=v((gg,Bs)=>{"use strict";s();u();var jf=$t(),zf=ze(),Us=Sn(),Hf=En(),Jf=Ns(),Os=jf(Us);zf(Os,{getPolyfill:Hf,implementation:Us,shim:Jf});Bs.exports=Os});var Fy={};dr(Fy,{DynamicSnippetsGenerator:()=>cr});module.exports=Mn(Fy);s();u();var mT=zs($s(),1);s();u();s();u();s();u();function A(r){throw new Error("Unexpected value: "+JSON.stringify(r))}s();u();function ot(r){return Object.keys(r)}s();u();s();u();var xe=class{};s();u();s();u();var ce=class extends xe{constructor(t){super();h(this,"value");this.value=t}write(t){typeof this.value=="string"?t.write(this.value):this.value(t)}};var Kf=4,at=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&&gt(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
- ${i}`);this.isAtStartOfLine()&&(o=i+o),t&&(o+=`
17
- `),this.writeInternal(o)}writeNoIndent(e){let t=this.indentLevel;this.indentLevel=0,this.write(e),this.indentLevel=t}writeNode(e){e.write(this)}writeNodeStatement(e){e.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(e){new ce(e).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(e,t){new ce(e).write(this),this.write(" ("),this.writeNode(t),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}openBlock(e,t="{",n,i="}"){let o=e.filter(a=>a!==void 0).join(" ");o?this.write(`${o} ${t!=null?t:""}`):this.write(t!=null?t:"");try{this.indent(),n(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(e=""){this.write(e),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
18
- `)}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
19
- `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:e,delimiter:t,writeFunction:n}){if(e.length>0){let i=e[0];i!=null&&n(i);for(let o=1;o<e.length;o++){this.write(t);let a=e[o];a!=null&&n(a)}}}toString(){return this.buffer}writeInternal(e){return e.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=e.endsWith(`
20
- `)),this.buffer+=e}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Kf)}};s();u();var nr=class{},st=class extends nr{async format(e){return e}formatSync(e){return e}};s();u();function Rn(r){return(r==null?void 0:r.name)!=null}s();u();s();u();var ut=class{constructor(e){h(this,"context");this.context=e}};s();u();s();u();s();u();var ct=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 T={Critical:"CRITICAL",Warning:"WARNING"},pt=class r{constructor(){h(this,"errors");h(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(Cn($n({},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 lt=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 pt,this.httpEndpointReferenceParser=new ct}associateQueryParametersByWireValue({parameters:e,values:t}){let n=[];for(let[i,o]of Object.entries(t)){this.errors.scope(i);try{let a=e.find(l=>l.name.wireValue===i);if(a==null)throw this.newParameterNotRecognizedError(i);let p=this.isListTypeReference(a.typeReference)&&!Array.isArray(o)?[o]:o;n.push({name:a.name,typeReference:a.typeReference,value:p})}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 p=e.find(l=>l.name.wireValue===o);if(p==null){if(n)continue;this.errors.add({severity:T.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:p.name,typeReference:p.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:T.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:T.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:T.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:T.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:T.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:T.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:T.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:T.Critical,message:`No type found for discriminant value "${o}"`});return}let m=n,{[i]:p}=m,l=qn(m,[_n(i)]);return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:l}}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:A(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:A(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:T.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:T.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:T.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(ot(n.urls));for(let o of ot(e))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:T.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${ot(n.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:T.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:T.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:T.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:A(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:A(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:A(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 Le=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}"`)}};s();u();var j={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};s();u();s();u();function ft(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 Qf=/[^0-9a-zA-Z_]/g,Te=class extends at{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 st}addImport(t){let n=this.imports[t];if(n!=null)return n;let i=this.getValidAlias(ft(t));for(;i in this.imports;)i="_"+i;return this.imports[t]=i,i}getValidAlias(t){let n=t.split("-");return n[0]==null?t:n[0].replace(Qf,"")}};var yt=class extends Te{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
- ${e}`)}return e}toString(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(e)}catch(t){throw new Error(`Failed to format Go file: ${t}
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
- `,t=this.stringifyImports();return t.length>0?`${e}${t}
19
+ `,e=this.stringifyImports();return e.length>0?`${t}${e}
25
20
 
26
- ${this.buffer}`:e+this.buffer}stringifyImports(){let e=Object.entries(this.imports).filter(([t,n])=>t!==this.importPath).map(([t,n])=>` ${n} "${t}"`).join(`
27
- `);return e?`import (
28
- ${e}
29
- )`:""}};var b=class extends xe{async toStringAsync({packageName:e,rootImportPath:t,importPath:n,customConfig:i,formatter:o}){let a=new yt({packageName:e,rootImportPath:t,importPath:n,customConfig:i,formatter:o});return this.write(a),a.toStringAsync()}toString({packageName:e,rootImportPath:t,importPath:n,customConfig:i,formatter:o}){let a=new yt({packageName:e,rootImportPath:t,importPath:n,customConfig:i,formatter:o});return this.write(a),a.toString()}};var B=class extends b{constructor({name:t,importPath:n}){super();h(this,"name");h(this,"importPath");this.name=t,this.importPath=n}write(t){if(t.importPath===this.importPath){t.write(this.name);return}let n=t.addImport(this.importPath);t.write(`${n}.${this.name}`)}};var Xf=new Set(["any","bytes","map","slice"]),ht=class r extends b{constructor(t){super();h(this,"internalType");this.internalType=t}write(t,{comment:n}={}){switch(this.internalType.type){case"any":t.write("interface{}");break;case"bool":t.write("bool");break;case"bytes":t.write("[]byte");break;case"date":case"dateTime":t.writeNode(Zf);break;case"float64":t.write("float64");break;case"int":t.write("int");break;case"int64":t.write("int64");break;case"map":{t.write("map["),this.internalType.keyType.write(t),t.write("]"),this.internalType.valueType.write(t);break}case"optional":{t.write("*"),this.internalType.value.write(t);break}case"reference":t.writeNode(this.internalType.value);break;case"slice":t.write("[]"),this.internalType.value.write(t);break;case"string":t.write("string");break;case"uuid":t.writeNode(ey);break;default:A(this.internalType)}}isOptional(){return this.internalType.type==="optional"}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 float64(){return new this({type:"float64"})}static int(){return new this({type:"int"})}static int64(){return new this({type:"int64"})}static map(t,n){return new this({type:"map",keyType:t,valueType:n})}static optional(t){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t})}static pointer(t){return r.optional(t)}static reference(t){return new this({type:"reference",value:t})}static slice(t){return new this({type:"slice",value:t})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static isAlreadyOptional(t){return t.internalType.type==="optional"||Xf.has(t.internalType.type)}},Zf=new B({importPath:"time",name:"Time"}),ey=new B({importPath:"github.com/google/uuid",name:"UUID"});s();u();var ty="sdk";function Pn({config:r,customConfig:e}){let t=ny({config:r}),n=ry({config:r,customConfig:e});return t!=null?oy({importPath:n,majorVersion:t}):n}function ry({config:r,customConfig:e}){var t,n,i;return(i=(n=e==null?void 0:e.importPath)!=null?n:(t=e==null?void 0:e.module)==null?void 0:t.path)!=null?i:r.output.mode.type==="github"?ay(r.output.mode.repoUrl,"https://"):ty}function ny({config:r}){let e=iy({config:r});if(!(e==null||e==="v0"||e==="v1"))return`${e}`}function iy({config:r}){let e=sy(r);if(e==null)return;let t=e.split(".");if(t[0]==null)return;let n=t[0];return n.startsWith("v")?n:`v${n}`}function oy({importPath:r,majorVersion:e}){return ft(r)===e?r:`${r}/${e}`}function ay(r,e){return r.startsWith(e)?r.slice(e.length):r}function sy(r){var t;let e=(t=r==null?void 0:r.output)==null?void 0:t.mode;if(e!=null)return e.type==="github"||e.type==="publish"?e.version:void 0}s();u();s();u();var z=class extends b{constructor(t){super();h(this,"arg");this.arg=t}write(t){return new ce(this.arg).write(t)}};s();u();s();u();var q=class extends b{constructor({docs:t}={}){super();h(this,"docs");this.docs=t}write(t){this.docs!=null&&this.docs.split(`
30
- `).forEach(n=>{t.writeLine(`// ${n}`)})}};var Ie=class extends b{constructor({name:t,docs:n}){super();h(this,"name");h(this,"docs");h(this,"members",[]);this.name=t,this.docs=n}addMember(t){this.members.push(t)}write(t){t.writeNode(new q({docs:this.docs})),t.write(`type ${this.name} string`)}};s();u();var Ae=class extends b{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 q({docs:this.docs})),t.write(`${this.name} `),this.type.write(t)}};s();u();s();u();var te=class extends b{constructor({name:t,parameters:n,return_:i,body:o,docs:a,typeReference:p}){super();h(this,"name");h(this,"parameters");h(this,"return_");h(this,"body");h(this,"docs");h(this,"typeReference");this.name=t,this.parameters=n,this.return_=i,this.body=o,this.docs=a,this.typeReference=p}write(t){var n;if(t.writeNode(new q({docs:this.docs})),t.write("func "),this.typeReference!=null&&this.writeReceiver({writer:t,typeReference:this.typeReference}),t.write(`${this.name}`),this.parameters.length===0)t.write("() ");else{t.writeLine("(");for(let i of this.parameters)t.writeNode(i),t.writeLine(",");t.write(")")}this.return_!=null&&(t.write("("),this.return_.forEach((i,o)=>{o>0&&t.write(", "),t.writeNode(i)}),t.write(")")),t.writeLine(" {"),t.indent(),(n=this.body)==null||n.write(t),t.dedent(),t.writeNewLineIfLastLineNot(),t.writeLine("}")}writeReceiver({writer:t,typeReference:n}){t.write(`(${this.getReceiverName(n.name)} `),n.write(t),t.write(") ")}getReceiverName(t){return t.charAt(0).toLowerCase()}};var be=class extends b{constructor({name:t,parameters:n,return_:i,body:o,docs:a}){super();h(this,"func");this.func=new te({name:t,parameters:n,return_:i,body:o,docs:a})}get name(){return this.func.name}get parameters(){return this.func.parameters}get return_(){return this.func.return_}get body(){return this.func.body}get docs(){return this.func.docs}write(t){t.writeNode(this.func)}};s();u();s();u();s();u();s();u();var re=class extends b{constructor({method:t,arguments_:n,on:i}){super();h(this,"on");h(this,"method");h(this,"arguments_");this.on=i,this.method=t,this.arguments_=n}write(t){this.on.write(t),t.write("."),t.write(this.method),ir({writer:t,arguments_:this.arguments_})}};var uy=new Set(["bool","date","dateTime","float64","int","int64","string","uuid"]),Cs=new Set(["any","bytes","map","slice"]),k=class r extends b{constructor(t){super();h(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"any":this.writeAny({writer:t,value:this.internalType.value});break;case"bool":t.write(this.internalType.value.toString());break;case"bytes":t.write(`[]byte("${this.internalType.value}")`);break;case"date":case"dateTime":t.writeNode(ly({writer:t,type:this.internalType}));break;case"enum":t.writeNode(this.internalType.typeReference);break;case"float64":t.write(this.internalType.value.toString());break;case"int":case"int64":t.write(this.internalType.value.toString());break;case"map":this.writeMap({writer:t,map:this.internalType});break;case"nil":t.write("nil");break;case"nop":break;case"optional":this.writeOptional({writer:t,type:this.internalType.value});break;case"reference":t.writeNode(this.internalType.value);break;case"slice":this.writeSlice({writer:t,slice:this.internalType});break;case"string":t.write(this.internalType.value.includes('"')||this.internalType.value.includes(`
31
- `)?`\`${this.internalType.value}\``:`"${this.internalType.value}"`);break;case"struct":this.writeStruct({writer:t,struct:this.internalType});break;case"uuid":t.writeNode(fy({value:this.internalType.value}));break;default:A(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=yy({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(uy.has(n.internalType.type)){t.writeNode(cy({writer:t,type:n}));return}if(Cs.has(n.internalType.type)){n.write(t);return}if(n.internalType.type==="enum"){t.writeNode(new re({on:n.internalType.typeReference,method:"Ptr",arguments_:[]}));return}t.write("&"),n.write(t)}static isAlreadyOptional(t){return t.internalType.type==="optional"||Cs.has(t.internalType.type)}writeSlice({writer:t,slice:n}){t.write("[]"),t.writeNode(n.valueType);let i=dy({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=hy({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 cy({writer:r,type:e}){return new D({func:new B({name:py({type:e}),importPath:r.rootImportPath}),arguments_:[e]})}function py({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 ly({writer:r,type:e}){let t=e instanceof Date?"MustParseDate":"MustParseDateTime";return new D({func:new B({name:t,importPath:r.rootImportPath}),arguments_:[new z(`"${e.value}"`)]})}function fy({value:r}){return new D({func:new B({name:"MustParse",importPath:"github.com/google/uuid"}),arguments_:[new z(`"${r}"`)]})}function yy({entries:r}){return r.filter(e=>!k.isNop(e.key)&&!k.isNop(e.value))}function hy({fields:r}){return r.filter(e=>!k.isNop(e.value))}function dy({values:r}){return r.filter(e=>!k.isNop(e))}function ir({writer:r,arguments_:e}){let t=gy(e);if(t.length===0){r.write("()");return}r.writeLine("("),r.indent();for(let n of t)my({writer:r,argument:n}),r.writeLine(",");r.dedent(),r.write(")")}function my({writer:r,argument:e}){Rn(e)?e.assignment.write(r):e.write(r)}function gy(r){return r.filter(e=>!(e instanceof k&&k.isNop(e)))}var D=class extends b{constructor({func:t,arguments_:n}){super();h(this,"func");h(this,"arguments_");this.func=t,this.arguments_=n}write(t){t.writeNode(this.func),ir({writer:t,arguments_:this.arguments_})}};s();u();var Se=class extends b{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 q({docs:this.docs})),t.write(`${this.name} `),this.type.write(t)}};s();u();var Ee=class extends b{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 q({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("}")}(this.constructor!=null||this.methods.length>0)&&t.newLine();for(let n of this.methods)t.writeNode(n),t.newLine()}};var f={};dr(f,{AstNode:()=>b,CodeBlock:()=>z,Enum:()=>Ie,Field:()=>Ae,Func:()=>be,FuncInvocation:()=>D,Method:()=>te,MethodInvocation:()=>re,Parameter:()=>Se,Struct:()=>Ee,Type:()=>ht,TypeInstantiation:()=>k,TypeReference:()=>B,Writer:()=>Te,codeblock:()=>vy,enum_:()=>wy,field:()=>xy,func:()=>Ty,invokeFunc:()=>Iy,invokeMethod:()=>Ay,method:()=>by,parameter:()=>Sy,struct:()=>Ey,typeReference:()=>Ry});s();u();function vy(r){return new z(r)}function wy(r){return new Ie(r)}function xy(r){return new Ae(r)}function Ty(r){return new be(r)}function Iy(r){return new D(r)}function Ay(r){return new re(r)}function by(r){return new te(r)}function Sy(r){return new Se(r)}function Ey(r){return new Ee(r)}function Ry(r){return new B(r)}var _s="example",qs="fern",Py="do",ks="client",dt=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:_s,importPath:qs,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:_s,importPath:qs,rootImportPath:this.context.rootImportPath,customConfig:(i=this.context.customConfig)!=null?i:{},formatter:this.formatter})}buildCodeBlock({endpoint:e,snippet:t}){return f.func({name:Py,parameters:[],return_:[],body:f.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 f.codeblock(n=>{n.write(`${ks} := `),n.writeNode(this.getRootClientFuncInvocation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){return f.invokeMethod({on:f.codeblock(ks),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:T.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:T.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),f.TypeInstantiation.nop()):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.context.errors.add({severity:T.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),f.TypeInstantiation.nop()):this.getConstructorBearerAuthArg({auth:e,values:t});case"header":return t.type!=="header"?(this.context.errors.add({severity:T.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),f.TypeInstantiation.nop()):this.getConstructorHeaderAuthArg({auth:e,values:t});default:A(e)}}getConstructorBasicAuthArg({auth:e,values:t}){return f.codeblock(n=>{n.writeNode(f.invokeFunc({func:f.typeReference({name:"WithBasicAuth",importPath:this.context.getOptionImportPath()}),arguments_:[f.TypeInstantiation.string(t.username),f.TypeInstantiation.string(t.password)]}))})}getConstructorBaseUrlArg({baseUrl:e,environment:t}){let n=this.getBaseUrlArg({baseUrl:e,environment:t});if(n!=null)return f.codeblock(i=>{i.writeNode(f.invokeFunc({func:f.typeReference({name:"WithBaseURL",importPath:this.context.getOptionImportPath()}),arguments_:[n]}))})}getBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:T.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return f.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:T.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return f.TypeInstantiation.reference(n)}this.context.isMultiEnvironmentValues(t)&&this.context.errors.add({severity:T.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 f.codeblock(n=>{n.writeNode(f.invokeFunc({func:f.typeReference({name:`With${e.token.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[f.TypeInstantiation.string(t.token)]}))})}getConstructorHeaderAuthArg({auth:e,values:t}){return f.codeblock(n=>{n.writeNode(f.invokeFunc({func:f.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(!f.TypeInstantiation.isNop(n))return f.codeblock(i=>{i.writeNode(f.invokeFunc({func:f.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:A(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let n=[];if(this.context.errors.scope(j.PathParameters),e.pathParameters!=null){let i=this.getPathParameters({namedParameters:e.pathParameters,snippet:t});n.push(...i.map(o=>o.value))}return 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:A(e)}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:T.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),f.TypeInstantiation.nop()):f.TypeInstantiation.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var l,m,g,d;let n=[],{inlinePathParameters:i,inlineFileProperties:o}={inlinePathParameters:(m=(l=this.context.customConfig)==null?void 0:l.inlinePathParameters)!=null?m:!1,inlineFileProperties:(d=(g=this.context.customConfig)==null?void 0:g.inlineFileProperties)!=null?d:!1};this.context.errors.scope(j.PathParameters);let a=[];e.pathParameters!=null&&a.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(j.RequestBody);let p=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:i})||n.push(...a.map(w=>w.value)),o||n.push(...p.fileFields.map(w=>w.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:p})),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,d,w,I;this.context.errors.scope(j.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(g=e.queryParameters)!=null?g:[],values:(d=t.queryParameters)!=null?d:{}}).map(S=>({name:S.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(S)}));this.context.errors.unscope(),this.context.errors.scope(j.Headers);let l=this.context.associateByWireValue({parameters:(w=e.headers)!=null?w:[],values:(I=t.headers)!=null?I:{}}).map(S=>({name:S.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(S)}));this.context.errors.unscope(),this.context.errors.scope(j.RequestBody);let m=e.body!=null?this.getInlinedRequestBodyStructFields({body:e.body,value:t.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),f.TypeInstantiation.structPointer({typeReference:f.typeReference({name:this.context.getMethodName(e.declaration.name),importPath:this.context.getImportPath(e.declaration.fernFilepath)}),fields:[...n,...a,...l,...m]})}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:A(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:A(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 f.invokeFunc({func:f.typeReference({name:this.context.getClientConstructorName(),importPath:this.context.getClientImportPath()}),arguments_:e})}};s();u();s();u();var or=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:T.Critical,message:"Expected non-null value, but got null"}),e.value==null)return f.TypeInstantiation.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return f.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?f.TypeInstantiation.nop():this.convertNamed({named:t,value:e.value,as:e.as})}case"nullable":return f.TypeInstantiation.optional(this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as}));case"optional":return f.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:A(e.typeReference)}}convertList({list:e,value:t}){return Array.isArray(t)?f.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:T.Critical,message:`Expected array but got: ${typeof t}`}),f.TypeInstantiation.nop())}convertMap({map:e,value:t}){return typeof t!="object"||t==null?(this.context.errors.add({severity:T.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),f.TypeInstantiation.nop()):f.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.convertUndicriminatedUnion({undicriminatedUnion:e,value:t});default:A(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 f.TypeInstantiation.nop();let o=i.singleDiscriminatedUnionType,a=this.getBaseFields({discriminatedUnionTypeInstance:i,singleDiscriminatedUnionType:o});switch(o.type){case"samePropertiesAsObject":{let p=this.context.resolveNamedType({typeId:o.typeId});return p==null?f.TypeInstantiation.nop():f.TypeInstantiation.structPointer({typeReference:n,fields:[{name:this.context.getTypeName(o.discriminantValue.name),value:this.convertNamed({named:p,value:i.value})},...a]})}case"singleProperty":{let p=this.context.getRecord(i.value);if(p==null)return f.TypeInstantiation.nop();try{return this.context.errors.scope(o.discriminantValue.wireValue),f.TypeInstantiation.structPointer({typeReference:n,fields:[{name:this.context.getTypeName(o.discriminantValue.name),value:this.convert({typeReference:o.typeReference,value:p[o.discriminantValue.wireValue]})},...a]})}finally{this.context.errors.unscope()}}case"noProperties":return f.TypeInstantiation.structPointer({typeReference:n,fields:[{name:this.context.getTypeName(i.discriminantValue.name),value:f.TypeInstantiation.string(o.discriminantValue.wireValue)},...a]});default:A(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 f.TypeInstantiation.structPointer({typeReference:f.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?f.TypeInstantiation.nop():f.TypeInstantiation.enum(f.typeReference({name:n,importPath:this.context.getImportPath(e.declaration.fernFilepath)}))}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:T.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:T.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)}`}convertUndicriminatedUnion({undicriminatedUnion:e,value:t}){let n=this.findMatchingUndiscriminatedUnionType({undicriminatedUnion:e,value:t});if(n==null)return f.TypeInstantiation.nop();let i=this.getUndiscriminatedUnionFieldName({typeReference:n.valueTypeReference});return i==null?f.TypeInstantiation.nop():f.TypeInstantiation.structPointer({typeReference:this.context.getGoTypeReferenceFromDeclaration({declaration:e.declaration}),fields:[{name:i,value:n.typeInstantiation}]})}findMatchingUndiscriminatedUnionType({undicriminatedUnion: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:T.Critical,message:`None of the types in the undicriminated 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:A(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:A(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:A(e)}}convertUnknown({value:e}){return f.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?f.TypeInstantiation.nop():f.TypeInstantiation.int(i)}case"LONG":case"UINT_64":{let i=this.getValueAsNumber({value:t,as:n});return i==null?f.TypeInstantiation.nop():f.TypeInstantiation.int64(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:t,as:n});return i==null?f.TypeInstantiation.nop():f.TypeInstantiation.float64(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:t,as:n});return i==null?f.TypeInstantiation.nop():f.TypeInstantiation.bool(i)}case"STRING":{let i=this.context.getValueAsString({value:t});return i==null?f.TypeInstantiation.nop():f.TypeInstantiation.string(i)}case"DATE":{let i=this.context.getValueAsString({value:t});return i==null?f.TypeInstantiation.nop():f.TypeInstantiation.date(i)}case"DATE_TIME":{let i=this.context.getValueAsString({value:t});return i==null?f.TypeInstantiation.nop():f.TypeInstantiation.dateTime(i)}case"UUID":{let i=this.context.getValueAsString({value:t});return i==null?f.TypeInstantiation.nop():f.TypeInstantiation.uuid(i)}case"BASE_64":{let i=this.context.getValueAsString({value:t});return i==null?f.TypeInstantiation.nop():f.TypeInstantiation.bytes(i)}case"BIG_INTEGER":{let i=this.context.getValueAsString({value:t});return i==null?f.TypeInstantiation.nop():f.TypeInstantiation.string(i)}default:A(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 ar=class{constructor({context:e}){h(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return f.Type.slice(this.convert({typeReference:e.typeReference}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return f.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 f.Type.optional(this.convert({typeReference:e.typeReference.value}));case"nullable":return f.Type.optional(this.convert({typeReference:e.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return f.Type.slice(this.convert({typeReference:e.typeReference}));case"unknown":return this.convertUnknown();default:A(e.typeReference)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return f.Type.bool();case"string":return f.Type.string()}}convertNamed({named:e}){let t=f.Type.reference(f.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 f.Type.pointer(t);default:A(e)}}convertUnknown(){return f.Type.any()}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return f.Type.int();case"UINT":return f.Type.int();case"LONG":return f.Type.int64();case"UINT_64":return f.Type.int64();case"FLOAT":return f.Type.float64();case"DOUBLE":return f.Type.float64();case"BOOLEAN":return f.Type.bool();case"STRING":return f.Type.string();case"DATE":return f.Type.date();case"DATE_TIME":return f.Type.dateTime();case"UUID":return f.Type.uuid();case"BASE_64":return f.Type.bytes();case"BIG_INTEGER":return f.Type.string();default:A(e)}}};s();u();var sr=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:A(a)}return n}getSingleFileProperty({property:e,record:t}){let n=this.context.getSingleFileValue({property:e,record:t});return n==null?f.TypeInstantiation.nop():f.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(n))}getArrayFileProperty({property:e,record:t}){let n=this.context.getFileArrayValues({property:e,record:t});return n==null?f.TypeInstantiation.nop():f.TypeInstantiation.slice({valueType:f.Type.reference(this.context.getIoReaderTypeReference()),values:n.map(i=>f.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(i)))})}getBodyProperty({property:e,record:t}){let n=t[e.name.wireValue];return n==null?f.TypeInstantiation.nop():this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.typeReference,value:n})}};var ur=class r extends lt{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 ar({context:this}),this.dynamicTypeInstantiationMapper=new or({context:this}),this.filePropertyMapper=new sr({context:this}),this.rootImportPath=Pn({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 f.typeReference({name:"Context",importPath:"context"})}getContextTodoFunctionInvocation(){return f.invokeFunc({func:f.typeReference({name:"TODO",importPath:"context"}),arguments_:[]})}getIoReaderTypeReference(){return f.typeReference({name:"Reader",importPath:"io"})}getNewStringsReaderFunctionInvocation(t){return f.invokeFunc({func:f.typeReference({name:"NewReader",importPath:"strings"}),arguments_:[f.TypeInstantiation.string(t)]})}getClientConstructorName(){var t;return((t=this.customConfig)==null?void 0:t.exportedClientName)!=null?`New${this.customConfig.exportedClientName}`:"NewClient"}getClientImportPath(){return`${this.rootImportPath}/client`}getOptionImportPath(){return`${this.rootImportPath}/option`}getGoTypeReferenceFromDeclaration({declaration:t}){return f.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 f.typeReference({name:`Environments.${this.getTypeName(t)}`,importPath:this.rootImportPath})}};var cr=class extends ut{constructor({ir:t,config:n,formatter:i}){super(new ur({ir:t,config:n}));h(this,"formatter");this.formatter=i}async generate(t){let n=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i=new Le;for(let o of n){let a=this.context.clone(),p=new dt({context:a,formatter:this.formatter});try{let l=await p.generateSnippet({endpoint:o,request:t});if(a.errors.empty())return{snippet:l,errors:void 0};i.update({context:a,snippet:l})}catch(l){i.err==null&&(i.err=l)}}return i.getResponseOrThrow({endpoint:t.endpoint})}generateSync(t){let n=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i=new Le;for(let o of n){let a=this.context.clone(),p=new dt({context:a,formatter:this.formatter});try{let l=p.generateSnippetSync({endpoint:o,request:t});if(a.errors.empty())return{snippet:l,errors:void 0};i.update({context:a,snippet:l})}catch(l){i.err==null&&(i.err=l)}}return i.getResponseOrThrow({endpoint:t.endpoint})}};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