@fern-api/swift-dynamic-snippets 0.1.0 → 0.1.1

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 (65) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +19 -1
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
  3. package/cjs/EndpointSnippetGenerator.cjs +30 -1
  4. package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
  5. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +19 -1
  6. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
  7. package/cjs/context/DynamicTypeLiteralMapper.cjs +19 -1
  8. package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -1
  9. package/cjs/context/DynamicTypeMapper.cjs +19 -1
  10. package/cjs/context/DynamicTypeMapper.cjs.map +1 -1
  11. package/cjs/context/FilePropertyMapper.cjs +30 -1
  12. package/cjs/context/FilePropertyMapper.cjs.map +1 -1
  13. package/cjs/context/index.cjs +19 -1
  14. package/cjs/context/index.cjs.map +1 -1
  15. package/cjs/index.cjs +29 -11
  16. package/cjs/index.cjs.map +1 -1
  17. package/esm/Config.js +1 -1
  18. package/esm/DynamicSnippetsGenerator.js +1 -1
  19. package/esm/EndpointSnippetGenerator.js +1 -1
  20. package/esm/{chunk-4YR7VIA5.js → chunk-2M2RBZK2.js} +2 -2
  21. package/esm/chunk-6DFEQNIA.js +2 -0
  22. package/esm/{chunk-NEAKFXXW.js.map → chunk-6DFEQNIA.js.map} +1 -1
  23. package/esm/chunk-7RC2HH3P.js +2 -0
  24. package/esm/{chunk-JBDWOK23.js.map → chunk-7RC2HH3P.js.map} +1 -1
  25. package/esm/chunk-FX6IFKZ7.js +2 -0
  26. package/esm/chunk-HTU5V5TT.js +2 -0
  27. package/esm/chunk-IHG2VZKL.js +2 -0
  28. package/esm/chunk-IHG2VZKL.js.map +1 -0
  29. package/esm/chunk-JFTYS7SI.js +20 -0
  30. package/esm/chunk-JFTYS7SI.js.map +1 -0
  31. package/esm/chunk-KIHSBETU.js +2 -0
  32. package/esm/{chunk-QKXS634U.js.map → chunk-KIHSBETU.js.map} +1 -1
  33. package/esm/chunk-PJTPV2D6.js +15 -0
  34. package/esm/chunk-PJTPV2D6.js.map +1 -0
  35. package/esm/{chunk-PKOEJ7HU.js → chunk-PYMG6Y4R.js} +2 -2
  36. package/esm/{chunk-P4BOVZKM.js → chunk-WG3NZOM6.js} +2 -2
  37. package/esm/chunk-WXHVUJ6D.js +2 -0
  38. package/esm/{chunk-T6A4SG7G.js.map → chunk-WXHVUJ6D.js.map} +1 -1
  39. package/esm/chunk-ZIQ5ITTV.js +2 -0
  40. package/esm/{chunk-F6NGJ242.js.map → chunk-ZIQ5ITTV.js.map} +1 -1
  41. package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
  42. package/esm/context/DynamicTypeLiteralMapper.js +1 -1
  43. package/esm/context/DynamicTypeMapper.js +1 -1
  44. package/esm/context/FilePropertyMapper.js +1 -1
  45. package/esm/context/index.js +1 -1
  46. package/esm/index.js +1 -1
  47. package/esm/index.js.map +1 -1
  48. package/esm/util/pascal-case.js +1 -1
  49. package/package.json +1 -1
  50. package/esm/chunk-243PMR4C.js +0 -2
  51. package/esm/chunk-7GLUP3NF.js +0 -2
  52. package/esm/chunk-7GLUP3NF.js.map +0 -1
  53. package/esm/chunk-BGT34OGK.js +0 -15
  54. package/esm/chunk-BGT34OGK.js.map +0 -1
  55. package/esm/chunk-F6NGJ242.js +0 -2
  56. package/esm/chunk-JBDWOK23.js +0 -2
  57. package/esm/chunk-NEAKFXXW.js +0 -2
  58. package/esm/chunk-NH2Q3QVN.js +0 -2
  59. package/esm/chunk-QKXS634U.js +0 -2
  60. package/esm/chunk-T6A4SG7G.js +0 -2
  61. /package/esm/{chunk-4YR7VIA5.js.map → chunk-2M2RBZK2.js.map} +0 -0
  62. /package/esm/{chunk-NH2Q3QVN.js.map → chunk-FX6IFKZ7.js.map} +0 -0
  63. /package/esm/{chunk-243PMR4C.js.map → chunk-HTU5V5TT.js.map} +0 -0
  64. /package/esm/{chunk-PKOEJ7HU.js.map → chunk-PYMG6Y4R.js.map} +0 -0
  65. /package/esm/{chunk-P4BOVZKM.js.map → chunk-WG3NZOM6.js.map} +0 -0
@@ -1,4 +1,22 @@
1
- "use strict";var k=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Te=Object.prototype.hasOwnProperty;var Se=(t,e,r)=>e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var z=(t,e)=>()=>(t&&(e=t(t=0)),e);var Be=(t,e)=>{for(var r in e)k(t,r,{get:e[r],enumerable:!0})},Pe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ie(e))!Te.call(t,i)&&i!==r&&k(t,i,{get:()=>e[i],enumerable:!(n=ve(e,i))||n.enumerable});return t};var Fe=t=>Pe(k({},"__esModule",{value:!0}),t);var Q=(t,e,r)=>Se(t,typeof e!="symbol"?e+"":e,r);function Z(){throw new Error("setTimeout has not been defined")}function ee(){throw new Error("clearTimeout has not been defined")}function re(t){if(S===setTimeout)return setTimeout(t,0);if((S===Z||!S)&&setTimeout)return S=setTimeout,setTimeout(t,0);try{return S(t,0)}catch(e){try{return S.call(null,t,0)}catch(r){return S.call(this,t,0)}}}function _e(t){if(B===clearTimeout)return clearTimeout(t);if((B===ee||!B)&&clearTimeout)return B=clearTimeout,clearTimeout(t);try{return B(t)}catch(e){try{return B.call(null,t)}catch(r){return B.call(this,t)}}}function Ue(){!q||!_||(q=!1,_.length?v=_.concat(v):D=-1,v.length&&te())}function te(){if(!q){var t=re(Ue);q=!0;for(var e=v.length;e;){for(_=v,v=[];++D<e;)_&&_[D].run();D=-1,e=v.length}_=null,q=!1,_e(t)}}function Ce(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];v.push(new ne(t,e)),v.length===1&&!q&&re(te)}function ne(t,e){this.fun=t,this.array=e}function U(){}function He(t){throw new Error("process.binding is not supported")}function je(){return"/"}function Xe(t){throw new Error("process.chdir is not supported")}function Ke(){return 0}function er(t){var e=Ze.call(b)*.001,r=Math.floor(e),n=Math.floor(e%1*1e9);return t&&(r=r-t[0],n=n-t[1],n<0&&(r--,n+=1e9)),[r,n]}function tr(){var t=new Date,e=t-rr;return e/1e3}var S,B,v,q,_,D,Ne,Me,be,qe,ke,De,Le,Ye,Oe,We,Ve,Ge,ze,Qe,Je,$e,b,Ze,rr,P,K,x=z(()=>{"use strict";S=Z,B=ee;typeof globalThis.setTimeout=="function"&&(S=setTimeout);typeof globalThis.clearTimeout=="function"&&(B=clearTimeout);v=[],q=!1,D=-1;ne.prototype.run=function(){this.fun.apply(null,this.array)};Ne="browser",Me="browser",be=!0,qe={},ke=[],De="",Le={},Ye={},Oe={};We=U,Ve=U,Ge=U,ze=U,Qe=U,Je=U,$e=U;b=globalThis.performance||{},Ze=b.now||b.mozNow||b.msNow||b.oNow||b.webkitNow||function(){return new Date().getTime()};rr=new Date;P={nextTick:Ce,title:Ne,browser:be,env:qe,argv:ke,version:De,versions:Le,on:We,addListener:Ve,once:Ge,off:ze,removeListener:Qe,removeAllListeners:Je,emit:$e,binding:He,cwd:je,chdir:Xe,umask:Ke,hrtime:er,platform:Me,release:Ye,config:Oe,uptime:tr},K={};Object.keys(K).forEach(t=>{let e=t.split("."),r=P;for(let n=0;n<e.length;n++){let i=e[n];n===e.length-1?r[i]=K[t]:r=r[i]||(r[i]={})}})});function ue(){$=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)A[e]=t[e],g[t.charCodeAt(e)]=e;g[45]=62,g[95]=63}function ir(t){$||ue();var e,r,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[s-2]==="="?2:t[s-1]==="="?1:0,a=new nr(s*3/4-o),n=o>0?s-4:s;var f=0;for(e=0,r=0;e<n;e+=4,r+=3)i=g[t.charCodeAt(e)]<<18|g[t.charCodeAt(e+1)]<<12|g[t.charCodeAt(e+2)]<<6|g[t.charCodeAt(e+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=i&255;return o===2?(i=g[t.charCodeAt(e)]<<2|g[t.charCodeAt(e+1)]>>4,a[f++]=i&255):o===1&&(i=g[t.charCodeAt(e)]<<10|g[t.charCodeAt(e+1)]<<4|g[t.charCodeAt(e+2)]>>2,a[f++]=i>>8&255,a[f++]=i&255),a}function or(t){return A[t>>18&63]+A[t>>12&63]+A[t>>6&63]+A[t&63]}function ar(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(or(n));return i.join("")}function ie(t){$||ue();for(var e,r=t.length,n=r%3,i="",o=[],a=16383,s=0,f=r-n;s<f;s+=a)o.push(ar(t,s,s+a>f?f:s+a));return n===1?(e=t[r-1],i+=A[e>>2],i+=A[e<<4&63],i+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],i+=A[e>>10],i+=A[e>>4&63],i+=A[e<<2&63],i+="="),o.push(i),o.join("")}function L(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function I(t,e){if(L()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=u.prototype):(t===null&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return H(this,t)}return se(this,t,e,r)}function se(t,e,r,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&e instanceof ArrayBuffer?fr(t,e,r,n):typeof e=="string"?sr(t,e,r):pr(t,e)}function fe(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ur(t,e,r,n){return fe(e),e<=0?I(t,e):r!==void 0?typeof n=="string"?I(t,e).fill(r,n):I(t,e).fill(r):I(t,e)}function H(t,e){if(fe(e),t=I(t,e<0?0:j(e)|0),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function sr(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=pe(e,r)|0;t=I(t,n);var i=t.write(e,r);return i!==n&&(t=t.slice(0,i)),t}function J(t,e){var r=e.length<0?0:j(e.length)|0;t=I(t,r);for(var n=0;n<r;n+=1)t[n]=e[n]&255;return t}function fr(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return r===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,r):e=new Uint8Array(e,r,n),u.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=u.prototype):t=J(t,e),t}function pr(t,e){if(R(e)){var r=j(e.length)|0;return t=I(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer!="undefined"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Fr(e.length)?I(t,0):J(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return J(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function j(t){if(t>=L())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+L().toString(16)+" bytes");return t|0}function R(t){return!!(t!=null&&t._isBuffer)}function pe(t,e){if(R(t))return t.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ye(t).length;default:if(n)return Y(t).length;e=(""+e).toLowerCase(),n=!0}}function cr(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ar(this,e,r);case"utf8":case"utf-8":return he(this,e,r);case"ascii":return gr(this,e,r);case"latin1":case"binary":return Er(this,e,r);case"base64":return yr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rr(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function C(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function ce(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=u.from(e,n)),R(e))return e.length===0?-1:oe(t,e,r,n,i);if(typeof e=="number")return e=e&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):oe(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function oe(t,e,r,n,i){var o=1,a=t.length,s=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,a/=2,s/=2,r/=2}function f(w,M){return o===1?w[M]:w.readUInt16BE(M*o)}var l;if(i){var h=-1;for(l=r;l<a;l++)if(f(t,l)===f(e,h===-1?0:l-h)){if(h===-1&&(h=l),l-h+1===s)return h*o}else h!==-1&&(l-=l-h),h=-1}else for(r+s>a&&(r=a-s),l=r;l>=0;l--){for(var c=!0,E=0;E<s;E++)if(f(t,l+E)!==f(e,E)){c=!1;break}if(c)return l}return-1}function lr(t,e,r,n){r=Number(r)||0;var i=t.length-r;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 s=parseInt(e.substr(a*2,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function hr(t,e,r,n){return V(Y(e,t.length-r),t,r,n)}function le(t,e,r,n){return V(Br(e),t,r,n)}function mr(t,e,r,n){return le(t,e,r,n)}function xr(t,e,r,n){return V(ye(e),t,r,n)}function dr(t,e,r,n){return V(Pr(e,t.length-r),t,r,n)}function yr(t,e,r){return e===0&&r===t.length?ie(t):ie(t.slice(e,r))}function he(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=r){var f,l,h,c;switch(s){case 1:o<128&&(a=o);break;case 2:f=t[i+1],(f&192)===128&&(c=(o&31)<<6|f&63,c>127&&(a=c));break;case 3:f=t[i+1],l=t[i+2],(f&192)===128&&(l&192)===128&&(c=(o&15)<<12|(f&63)<<6|l&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:f=t[i+1],l=t[i+2],h=t[i+3],(f&192)===128&&(l&192)===128&&(h&192)===128&&(c=(o&15)<<18|(f&63)<<12|(l&63)<<6|h&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=s}return wr(n)}function wr(t){var e=t.length;if(e<=ae)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=ae));return r}function gr(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function Er(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Ar(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Sr(t[o]);return i}function Rr(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}function m(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function y(t,e,r,n,i,o){if(!R(t))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(r+n>t.length)throw new RangeError("Index out of range")}function O(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function W(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>(n?i:3-i)*8&255}function me(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function xe(t,e,r,n,i){return i||me(t,e,r,4,34028234663852886e22,-34028234663852886e22),ge(t,e,r,n,23,4),r+4}function de(t,e,r,n,i){return i||me(t,e,r,8,17976931348623157e292,-17976931348623157e292),ge(t,e,r,n,52,8),r+8}function Ir(t){if(t=Tr(t).replace(vr,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Tr(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Sr(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>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=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function Br(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Pr(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function ye(t){return ir(Ir(t))}function V(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Fr(t){return t!==t}function _r(t){return t!=null&&(!!t._isBuffer||we(t)||Ur(t))}function we(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Ur(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&we(t.slice(0,0))}function G(t,e,r,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,l=f>>1,h=-7,c=r?i-1:0,E=r?-1:1,w=t[e+c];for(c+=E,o=w&(1<<-h)-1,w>>=-h,h+=s;h>0;o=o*256+t[e+c],c+=E,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[e+c],c+=E,h-=8);if(o===0)o=1-l;else{if(o===f)return a?NaN:(w?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(w?-1:1)*a*Math.pow(2,o-n)}function ge(t,e,r,n,i,o){var a,s,f,l=o*8-i-1,h=(1<<l)-1,c=h>>1,E=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:o-1,M=n?1:-1,Re=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+c>=1?e+=E/f:e+=E*Math.pow(2,1-c),e*f>=2&&(a++,f/=2),a+c>=h?(s=0,a=h):a+c>=1?(s=(e*f-1)*Math.pow(2,i),a=a+c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+w]=s&255,w+=M,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;t[r+w]=a&255,w+=M,a/=256,l-=8);t[r+w-M]|=Re*128}var A,g,nr,$,ae,vr,Ee=z(()=>{"use strict";x();d();A=[],g=[],nr=typeof Uint8Array!="undefined"?Uint8Array:Array,$=!1;u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};u.from=function(t,e,r){return se(null,t,e,r)};u.kMaxLength=L();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&u[Symbol.species]);u.alloc=function(t,e,r){return ur(null,t,e,r)};u.allocUnsafe=function(t){return H(null,t)};u.allocUnsafeSlow=function(t){return H(null,t)};u.isBuffer=_r;u.compare=function(e,r){if(!R(e)||!R(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,a=Math.min(n,i);o<a;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};u.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}};u.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return u.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=u.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var a=e[n];if(!R(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};u.byteLength=pe;u.prototype._isBuffer=!0;u.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 r=0;r<e;r+=2)C(this,r,r+1);return this};u.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 r=0;r<e;r+=4)C(this,r,r+3),C(this,r+1,r+2);return this};u.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 r=0;r<e;r+=8)C(this,r,r+7),C(this,r+1,r+6),C(this,r+2,r+5),C(this,r+3,r+4);return this};u.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?he(this,0,e):cr.apply(this,arguments)};u.prototype.equals=function(e){if(!R(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:u.compare(this,e)===0};u.prototype.compare=function(e,r,n,i,o){if(!R(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var a=o-i,s=n-r,f=Math.min(a,s),l=this.slice(i,o),h=e.slice(r,n),c=0;c<f;++c)if(l[c]!==h[c]){a=l[c],s=h[c];break}return a<s?-1:s<a?1:0};u.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};u.prototype.indexOf=function(e,r,n){return ce(this,e,r,n,!0)};u.prototype.lastIndexOf=function(e,r,n){return ce(this,e,r,n,!1)};u.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r|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-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return lr(this,e,r,n);case"utf8":case"utf-8":return hr(this,e,r,n);case"ascii":return le(this,e,r,n);case"latin1":case"binary":return mr(this,e,r,n);case"base64":return xr(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dr(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};ae=4096;u.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i;if(u.TYPED_ARRAY_SUPPORT)i=this.subarray(e,r),i.__proto__=u.prototype;else{var o=r-e;i=new u(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+e]}return i};u.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||m(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return i};u.prototype.readUIntBE=function(e,r,n){e=e|0,r=r|0,n||m(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};u.prototype.readUInt8=function(e,r){return r||m(e,1,this.length),this[e]};u.prototype.readUInt16LE=function(e,r){return r||m(e,2,this.length),this[e]|this[e+1]<<8};u.prototype.readUInt16BE=function(e,r){return r||m(e,2,this.length),this[e]<<8|this[e+1]};u.prototype.readUInt32LE=function(e,r){return r||m(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};u.prototype.readUInt32BE=function(e,r){return r||m(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};u.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||m(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};u.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||m(e,r,this.length);for(var i=r,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*r)),a};u.prototype.readInt8=function(e,r){return r||m(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};u.prototype.readInt16LE=function(e,r){r||m(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(e,r){r||m(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(e,r){return r||m(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};u.prototype.readInt32BE=function(e,r){return r||m(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};u.prototype.readFloatLE=function(e,r){return r||m(e,4,this.length),G(this,e,!0,23,4)};u.prototype.readFloatBE=function(e,r){return r||m(e,4,this.length),G(this,e,!1,23,4)};u.prototype.readDoubleLE=function(e,r){return r||m(e,8,this.length),G(this,e,!0,52,8)};u.prototype.readDoubleBE=function(e,r){return r||m(e,8,this.length),G(this,e,!1,52,8)};u.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;y(this,e,r,n,o,0)}var a=1,s=0;for(this[r]=e&255;++s<n&&(a*=256);)this[r+s]=e/a&255;return r+n};u.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;y(this,e,r,n,o,0)}var a=n-1,s=1;for(this[r+a]=e&255;--a>=0&&(s*=256);)this[r+a]=e/s&255;return r+n};u.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};u.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):O(this,e,r,!0),r+2};u.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):O(this,e,r,!1),r+2};u.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):W(this,e,r,!0),r+4};u.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):W(this,e,r,!1),r+4};u.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);y(this,e,r,n,o-1,-o)}var a=0,s=1,f=0;for(this[r]=e&255;++a<n&&(s*=256);)e<0&&f===0&&this[r+a-1]!==0&&(f=1),this[r+a]=(e/s>>0)-f&255;return r+n};u.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);y(this,e,r,n,o-1,-o)}var a=n-1,s=1,f=0;for(this[r+a]=e&255;--a>=0&&(s*=256);)e<0&&f===0&&this[r+a+1]!==0&&(f=1),this[r+a]=(e/s>>0)-f&255;return r+n};u.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1};u.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):O(this,e,r,!0),r+2};u.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):O(this,e,r,!1),r+2};u.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):W(this,e,r,!0),r+4};u.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):W(this,e,r,!1),r+4};u.prototype.writeFloatLE=function(e,r,n){return xe(this,e,r,!0,n)};u.prototype.writeFloatBE=function(e,r,n){return xe(this,e,r,!1,n)};u.prototype.writeDoubleLE=function(e,r,n){return de(this,e,r,!0,n)};u.prototype.writeDoubleBE=function(e,r,n){return de(this,e,r,!1,n)};u.prototype.copy=function(e,r,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<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-r<i-n&&(i=e.length-r+n);var o=i-n,a;if(this===e&&n<r&&r<i)for(a=o-1;a>=0;--a)e[a+r]=this[a+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)e[a+r]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),r);return o};u.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=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"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if(typeof e=="number")for(a=r;a<n;++a)this[a]=e;else{var s=R(e)?e:Y(new u(e,i).toString()),f=s.length;for(a=0;a<n-r;++a)this[a+r]=s[a%f]}return this};vr=/[^+\/0-9A-Za-z-_]/g});var d=z(()=>{"use strict";Ee()});var Cr={};Be(Cr,{EndpointSnippetGenerator:()=>X});module.exports=Fe(Cr);x();d();x();d();x();d();function N(t){throw new Error("Unexpected value: "+JSON.stringify(t))}x();d();x();d();var T={Critical:"CRITICAL",Warning:"WARNING"};x();d();var F={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};var p=require("@fern-api/swift-codegen");var Ae="client",X=class{constructor({context:e}){Q(this,"context");this.context=e}async generateSnippet({endpoint:e,request:r,options:n}){return this.buildCodeBlock({endpoint:e,snippetRequest:r,options:n})}generateSnippetSync({endpoint:e,request:r,options:n}){return this.buildCodeBlock({endpoint:e,snippetRequest:r,options:n})}buildCodeBlock({endpoint:e,snippetRequest:r,options:n}){return[this.generateImportFoundationStatement(),this.generateImportModuleStatement(),p.swift.LineBreak.single(),this.generateMainFunctionDeclarationWithEndpointSnippet({endpoint:e,snippet:r}),p.swift.LineBreak.single(),this.generateMainFunctionInvocationStatement()].map(o=>o.toString()).join("")}generateImportFoundationStatement(){return p.swift.Statement.import("Foundation")}generateImportModuleStatement(){return p.swift.Statement.import(this.context.getModuleName())}generateMainFunctionDeclarationWithEndpointSnippet({endpoint:e,snippet:r}){return p.swift.Statement.functionDeclaration({unsafeName:"main",accessLevel:"private",async:!0,throws:!0,body:p.swift.CodeBlock.withStatements([this.generateRootClientInitializationStatement({auth:e.auth,snippet:r}),p.swift.LineBreak.single(),this.generateEndpointMethodCallStatement({endpoint:e,snippet:r})])})}generateRootClientInitializationStatement({auth:e,snippet:r,additionalArgs:n=[]}){let i=[],o=this.getRootClientBaseURLArg({snippet:r});o!=null&&i.push(o);let a=e?this.getRootClientAuthArgs({auth:e,snippet:r}):[];i.push(...a),i.push(...n);let s=i.filter(f=>!f.value.isNop());return p.swift.Statement.constantDeclaration({unsafeName:Ae,value:p.swift.Expression.classInitialization({unsafeName:this.context.getRootClientClassName(),arguments_:s,multiline:s.length>1?!0:void 0})})}getRootClientBaseURLArg({snippet:e}){var r;return e.baseURL!=null&&e.environment!=null?(this.context.errors.add({severity:T.Critical,message:"Cannot specify both baseUrl and environment options"}),null):e.baseURL!=null?((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"?null:p.swift.functionArgument({label:"baseURL",value:p.swift.Expression.stringLiteral(e.baseURL)}):null}getRootClientAuthArgs({auth:e,snippet:r}){let n=[],i=r.auth;if(i==null)return n;switch(e.type){case"basic":if(i.type!=="basic"){this.context.errors.add({severity:T.Critical,message:this.context.newAuthMismatchError({auth:e,values:i}).message});break}n.push(p.swift.functionArgument({label:e.username.camelCase.unsafeName,value:p.swift.Expression.stringLiteral(i.username)}),p.swift.functionArgument({label:e.password.camelCase.unsafeName,value:p.swift.Expression.stringLiteral(i.password)}));break;case"bearer":if(i.type!=="bearer")return this.context.errors.add({severity:T.Critical,message:this.context.newAuthMismatchError({auth:e,values:i}).message}),n;n.push(p.swift.functionArgument({label:e.token.camelCase.unsafeName,value:p.swift.Expression.stringLiteral(i.token)}));break;case"header":if(i.type!=="header")return this.context.errors.add({severity:T.Critical,message:this.context.newAuthMismatchError({auth:e,values:i}).message}),n;n.push(p.swift.functionArgument({label:e.header.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:i.value})}));break;case"oauth":return i.type!=="oauth"&&this.context.errors.add({severity:T.Critical,message:this.context.newAuthMismatchError({auth:e,values:i}).message}),n;case"inferred":return i.type!=="inferred"&&this.context.errors.add({severity:T.Critical,message:this.context.newAuthMismatchError({auth:e,values:i}).message}),n;default:N(e)}return n}generateEndpointMethodCallStatement({endpoint:e,snippet:r}){return p.swift.Statement.discardAssignment(this.generateEndpointMethodCallExpression({endpoint:e,snippet:r}))}generateEndpointMethodCallExpression({endpoint:e,snippet:r}){let n=this.getMethodArguments({endpoint:e,snippet:r}).filter(i=>!i.value.isNop());return p.swift.Expression.try(p.swift.Expression.await(p.swift.Expression.methodCall({target:p.swift.Expression.rawValue(Ae),methodName:this.getMethodName({endpoint:e}),arguments_:n,multiline:n.length>1?!0:void 0})))}generateMainFunctionInvocationStatement(){return p.swift.Statement.expressionStatement(p.swift.Expression.try(p.swift.Expression.await(p.swift.Expression.functionCall({unsafeName:"main"}))))}getMethodName({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${`${e.declaration.fernFilepath.allParts.map(n=>n.camelCase.unsafeName).join(".")}`}.${e.declaration.name.camelCase.unsafeName}`:e.declaration.name.camelCase.unsafeName}getMethodArguments({endpoint:e,snippet:r}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:r});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:r});default:N(e.request)}}getMethodArgsForInlinedRequest({request:e,snippet:r}){let n=[];this.context.errors.scope(F.PathParameters);let i=[];e.pathParameters!=null&&i.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:r})),this.context.errors.unscope(),n.push(...i),this.context.errors.scope(F.QueryParameters);let o=[];e.queryParameters!=null&&o.push(...this.getQueryParameters({namedParameters:e.queryParameters,snippet:r})),this.context.errors.unscope(),n.push(...o),this.context.errors.scope(F.RequestBody);let a=this.getFilePropertyInfo({request:e,snippet:r});return this.context.errors.unscope(),e.body!=null&&n.push(p.swift.functionArgument({label:"request",value:this.getInlinedRequestArg({request:e,snippet:r,filePropertyInfo:a})})),n}getPathParameters({namedParameters:e,snippet:r}){var n;return this.context.getExampleObjectProperties({parameters:e,snippetObject:(n=r.pathParameters)!=null?n:{}}).map(i=>p.swift.functionArgument({label:i.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert(i)}))}getQueryParameters({namedParameters:e,snippet:r}){var n;return this.context.getExampleObjectProperties({parameters:e,snippetObject:(n=r.queryParameters)!=null?n:{}}).map(i=>p.swift.functionArgument({label:i.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert(i)}))}getFilePropertyInfo({request:e,snippet:r}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:r.requestBody})}getInlinedRequestArg({request:e,snippet:r,filePropertyInfo:n}){this.context.errors.scope(F.RequestBody);let i=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:r.requestBody,filePropertyInfo:n}):[];this.context.errors.unscope();let o=i.filter(a=>!a.value.isNop());return p.swift.Expression.contextualMethodCall({methodName:"init",arguments_:o,multiline:o.length>1?!0:void 0})}getInlinedRequestBodyObjectFields({body:e,value:r,filePropertyInfo:n}){switch(e.type){case"fileUpload":return[...n.fileFields,...n.bodyPropertyFields];case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:r});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:e,value:r})];default:N(e)}}getInlinedRequestBodyPropertyObjectFields({parameters:e,value:r}){return this.context.getExampleObjectProperties({parameters:e,snippetObject:r}).map(n=>p.swift.functionArgument({label:n.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert(n)}))}getReferencedRequestBodyPropertyObjectField({body:e,value:r}){return p.swift.functionArgument({label:e.bodyKey.camelCase.unsafeName,value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:r})})}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:r}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:r});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:r});default:N(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}`}),p.swift.Expression.dataLiteral("data")):p.swift.Expression.dataLiteral(e)}getMethodArgsForBodyRequest({request:e,snippet:r}){var o,a;let n=[];this.context.errors.scope(F.PathParameters);let i=[...(o=this.context.ir.pathParameters)!=null?o:[],...(a=e.pathParameters)!=null?a:[]];return i.length>0&&n.push(...this.getPathParameters({namedParameters:i,snippet:r})),this.context.errors.unscope(),this.context.errors.scope(F.RequestBody),e.body!=null&&n.push(this.getBodyRequestArg({body:e.body,value:r.requestBody})),this.context.errors.unscope(),n}getBodyRequestArg({body:e,value:r}){switch(e.type){case"bytes":return p.swift.functionArgument({label:"request",value:this.getBytesBodyRequestArg({value:r})});case"typeReference":return p.swift.functionArgument({label:"request",value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:r})});default:N(e)}}};0&&(module.exports={EndpointSnippetGenerator});
1
+ "use strict";var ge=Object.defineProperty;var Rr=Object.getOwnPropertyDescriptor;var Cr=Object.getOwnPropertyNames,Qe=Object.getOwnPropertySymbols;var Xe=Object.prototype.hasOwnProperty,Br=Object.prototype.propertyIsEnumerable;var Ye=(n,t,e)=>t in n?ge(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,v=(n,t)=>{for(var e in t||(t={}))Xe.call(t,e)&&Ye(n,e,t[e]);if(Qe)for(var e of Qe(t))Br.call(t,e)&&Ye(n,e,t[e]);return n};var je=(n,t)=>()=>(n&&(t=n(n=0)),t);var et=(n,t)=>{for(var e in t)ge(n,e,{get:t[e],enumerable:!0})},kr=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Cr(t))!Xe.call(n,i)&&i!==e&&ge(n,i,{get:()=>t[i],enumerable:!(r=Rr(t,i))||r.enumerable});return n};var Mr=n=>kr(ge({},"__esModule",{value:!0}),n);var f=(n,t,e)=>Ye(n,typeof t!="symbol"?t+"":t,e);function rt(){throw new Error("setTimeout has not been defined")}function nt(){throw new Error("clearTimeout has not been defined")}function it(n){if(Y===setTimeout)return setTimeout(n,0);if((Y===rt||!Y)&&setTimeout)return Y=setTimeout,setTimeout(n,0);try{return Y(n,0)}catch(t){try{return Y.call(null,n,0)}catch(e){return Y.call(this,n,0)}}}function Fr(n){if(j===clearTimeout)return clearTimeout(n);if((j===nt||!j)&&clearTimeout)return j=clearTimeout,clearTimeout(n);try{return j(n)}catch(t){try{return j.call(null,n)}catch(e){return j.call(this,n)}}}function Or(){!Q||!z||(Q=!1,z.length?P=z.concat(P):we=-1,P.length&&at())}function at(){if(!Q){var n=it(Or);Q=!0;for(var t=P.length;t;){for(z=P,P=[];++we<t;)z&&z[we].run();we=-1,t=P.length}z=null,Q=!1,Fr(n)}}function Pr(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];P.push(new ot(n,t)),P.length===1&&!Q&&it(at)}function ot(n,t){this.fun=n,this.array=t}function V(){}function Xr(n){throw new Error("process.binding is not supported")}function en(){return"/"}function tn(n){throw new Error("process.chdir is not supported")}function rn(){return 0}function an(n){var t=nn.call(Z)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function sn(){var n=new Date,t=n-on;return t/1e3}var Y,j,P,Q,z,we,Ur,Dr,qr,Wr,Yr,jr,$r,_r,zr,Vr,Kr,Gr,Hr,Jr,Zr,Qr,Z,nn,on,m,tt,l=je(()=>{"use strict";Y=rt,j=nt;typeof globalThis.setTimeout=="function"&&(Y=setTimeout);typeof globalThis.clearTimeout=="function"&&(j=clearTimeout);P=[],Q=!1,we=-1;ot.prototype.run=function(){this.fun.apply(null,this.array)};Ur="browser",Dr="browser",qr=!0,Wr={},Yr=[],jr="",$r={},_r={},zr={};Vr=V,Kr=V,Gr=V,Hr=V,Jr=V,Zr=V,Qr=V;Z=globalThis.performance||{},nn=Z.now||Z.mozNow||Z.msNow||Z.oNow||Z.webkitNow||function(){return new Date().getTime()};on=new Date;m={nextTick:Pr,title:Ur,browser:qr,env:Wr,argv:Yr,version:jr,versions:$r,on:Vr,addListener:Kr,once:Gr,off:Hr,removeListener:Jr,removeAllListeners:Zr,emit:Qr,binding:Xr,cwd:en,chdir:tn,umask:rn,hrtime:an,platform:Dr,release:_r,config:zr,uptime:sn},tt={};Object.keys(tt).forEach(n=>{let t=n.split("."),e=m;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=tt[n]:e=e[i]||(e[i]={})}})});function ft(){_e=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)M[t]=n[t],L[n.charCodeAt(t)]=t;L[45]=62,L[95]=63}function un(n){_e||ft();var t,e,r,i,a,o,p=n.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=n[p-2]==="="?2:n[p-1]==="="?1:0,o=new ln(p*3/4-a),r=a>0?p-4:p;var c=0;for(t=0,e=0;t<r;t+=4,e+=3)i=L[n.charCodeAt(t)]<<18|L[n.charCodeAt(t+1)]<<12|L[n.charCodeAt(t+2)]<<6|L[n.charCodeAt(t+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=i&255;return a===2?(i=L[n.charCodeAt(t)]<<2|L[n.charCodeAt(t+1)]>>4,o[c++]=i&255):a===1&&(i=L[n.charCodeAt(t)]<<10|L[n.charCodeAt(t+1)]<<4|L[n.charCodeAt(t+2)]>>2,o[c++]=i>>8&255,o[c++]=i&255),o}function fn(n){return M[n>>18&63]+M[n>>12&63]+M[n>>6&63]+M[n&63]}function pn(n,t,e){for(var r,i=[],a=t;a<e;a+=3)r=(n[a]<<16)+(n[a+1]<<8)+n[a+2],i.push(fn(r));return i.join("")}function st(n){_e||ft();for(var t,e=n.length,r=e%3,i="",a=[],o=16383,p=0,c=e-r;p<c;p+=o)a.push(pn(n,p,p+o>c?c:p+o));return r===1?(t=n[e-1],i+=M[t>>2],i+=M[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=M[t>>10],i+=M[t>>4&63],i+=M[t<<2&63],i+="="),a.push(i),a.join("")}function be(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(n,t){if(be()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=s.prototype):(n===null&&(n=new s(t)),n.length=t),n}function s(n,t,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(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 ze(this,n)}return pt(this,n,t,e)}function pt(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?dn(n,t,e,r):typeof t=="string"?mn(n,t,e):hn(n,t)}function ct(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 cn(n,t,e,r){return ct(t),t<=0?U(n,t):e!==void 0?typeof r=="string"?U(n,t).fill(e,r):U(n,t).fill(e):U(n,t)}function ze(n,t){if(ct(t),n=U(n,t<0?0:Ve(t)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function mn(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=mt(t,e)|0;n=U(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function $e(n,t){var e=t.length<0?0:Ve(t.length)|0;n=U(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function dn(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),s.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=s.prototype):n=$e(n,t),n}function hn(n,t){if(F(t)){var e=Ve(t.length)|0;return n=U(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"||Fn(t.length)?U(n,0):$e(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return $e(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Ve(n){if(n>=be())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+be().toString(16)+" bytes");return n|0}function F(n){return!!(n!=null&&n._isBuffer)}function mt(n,t){if(F(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 ve(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return bt(n).length;default:if(r)return ve(n).length;t=(""+t).toLowerCase(),r=!0}}function xn(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 An(this,t,e);case"utf8":case"utf-8":return xt(this,t,e);case"ascii":return En(this,t,e);case"latin1":case"binary":return In(this,t,e);case"base64":return Sn(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Nn(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function K(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function dt(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=s.from(t,r)),F(t))return t.length===0?-1:lt(n,t,e,r,i);if(typeof t=="number")return t=t&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):lt(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function lt(n,t,e,r,i){var a=1,o=n.length,p=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;a=2,o/=2,p/=2,e/=2}function c(N,J){return a===1?N[J]:N.readUInt16BE(J*a)}var d;if(i){var x=-1;for(d=e;d<o;d++)if(c(n,d)===c(t,x===-1?0:d-x)){if(x===-1&&(x=d),d-x+1===p)return x*a}else x!==-1&&(d-=d-x),x=-1}else for(e+p>o&&(e=o-p),d=e;d>=0;d--){for(var g=!0,C=0;C<p;C++)if(c(n,d+C)!==c(t,C)){g=!1;break}if(g)return d}return-1}function yn(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var a=t.length;if(a%2!==0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o<r;++o){var p=parseInt(t.substr(o*2,2),16);if(isNaN(p))return o;n[e+o]=p}return o}function gn(n,t,e,r){return Ee(ve(t,n.length-e),n,e,r)}function ht(n,t,e,r){return Ee(kn(t),n,e,r)}function wn(n,t,e,r){return ht(n,t,e,r)}function bn(n,t,e,r){return Ee(bt(t),n,e,r)}function vn(n,t,e,r){return Ee(Mn(t,n.length-e),n,e,r)}function Sn(n,t,e){return t===0&&e===n.length?st(n):st(n.slice(t,e))}function xt(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var a=n[i],o=null,p=a>239?4:a>223?3:a>191?2:1;if(i+p<=e){var c,d,x,g;switch(p){case 1:a<128&&(o=a);break;case 2:c=n[i+1],(c&192)===128&&(g=(a&31)<<6|c&63,g>127&&(o=g));break;case 3:c=n[i+1],d=n[i+2],(c&192)===128&&(d&192)===128&&(g=(a&15)<<12|(c&63)<<6|d&63,g>2047&&(g<55296||g>57343)&&(o=g));break;case 4:c=n[i+1],d=n[i+2],x=n[i+3],(c&192)===128&&(d&192)===128&&(x&192)===128&&(g=(a&15)<<18|(c&63)<<12|(d&63)<<6|x&63,g>65535&&g<1114112&&(o=g))}}o===null?(o=65533,p=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=p}return Tn(r)}function Tn(n){var t=n.length;if(t<=ut)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=ut));return e}function En(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 In(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 An(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",a=t;a<e;++a)i+=Bn(n[a]);return i}function Nn(n,t,e){for(var r=n.slice(t,e),i="",a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+r[a+1]*256);return i}function T(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 I(n,t,e,r,i,a){if(!F(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function Se(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(n.length-e,2);i<a;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function Te(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(n.length-e,4);i<a;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function yt(n,t,e,r,i,a){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function gt(n,t,e,r,i){return i||yt(n,t,e,4,34028234663852886e22,-34028234663852886e22),St(n,t,e,r,23,4),e+4}function wt(n,t,e,r,i){return i||yt(n,t,e,8,17976931348623157e292,-17976931348623157e292),St(n,t,e,r,52,8),e+8}function Rn(n){if(n=Cn(n).replace(Ln,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Cn(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Bn(n){return n<16?"0"+n.toString(16):n.toString(16)}function ve(n,t){t=t||1/0;for(var e,r=n.length,i=null,a=[],o=0;o<r;++o){if(e=n.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&a.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;a.push(e)}else if(e<2048){if((t-=2)<0)break;a.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;a.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;a.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return a}function kn(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Mn(n,t){for(var e,r,i,a=[],o=0;o<n.length&&!((t-=2)<0);++o)e=n.charCodeAt(o),r=e>>8,i=e%256,a.push(i),a.push(r);return a}function bt(n){return un(Rn(n))}function Ee(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 Fn(n){return n!==n}function On(n){return n!=null&&(!!n._isBuffer||vt(n)||Pn(n))}function vt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Pn(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&vt(n.slice(0,0))}function Ie(n,t,e,r,i){var a,o,p=i*8-r-1,c=(1<<p)-1,d=c>>1,x=-7,g=e?i-1:0,C=e?-1:1,N=n[t+g];for(g+=C,a=N&(1<<-x)-1,N>>=-x,x+=p;x>0;a=a*256+n[t+g],g+=C,x-=8);for(o=a&(1<<-x)-1,a>>=-x,x+=r;x>0;o=o*256+n[t+g],g+=C,x-=8);if(a===0)a=1-d;else{if(a===c)return o?NaN:(N?-1:1)*(1/0);o=o+Math.pow(2,r),a=a-d}return(N?-1:1)*o*Math.pow(2,a-r)}function St(n,t,e,r,i,a){var o,p,c,d=a*8-i-1,x=(1<<d)-1,g=x>>1,C=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=r?0:a-1,J=r?1:-1,Lr=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(p=isNaN(t)?1:0,o=x):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+g>=1?t+=C/c:t+=C*Math.pow(2,1-g),t*c>=2&&(o++,c/=2),o+g>=x?(p=0,o=x):o+g>=1?(p=(t*c-1)*Math.pow(2,i),o=o+g):(p=t*Math.pow(2,g-1)*Math.pow(2,i),o=0));i>=8;n[e+N]=p&255,N+=J,p/=256,i-=8);for(o=o<<i|p,d+=i;d>0;n[e+N]=o&255,N+=J,o/=256,d-=8);n[e+N-J]|=Lr*128}var M,L,ln,_e,ut,Ln,Tt=je(()=>{"use strict";l();u();M=[],L=[],ln=typeof Uint8Array!="undefined"?Uint8Array:Array,_e=!1;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;s.poolSize=8192;s._augment=function(n){return n.__proto__=s.prototype,n};s.from=function(n,t,e){return pt(null,n,t,e)};s.kMaxLength=be();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&s[Symbol.species]);s.alloc=function(n,t,e){return cn(null,n,t,e)};s.allocUnsafe=function(n){return ze(null,n)};s.allocUnsafeSlow=function(n){return ze(null,n)};s.isBuffer=On;s.compare=function(t,e){if(!F(t)||!F(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,a=0,o=Math.min(r,i);a<o;++a)if(t[a]!==e[a]){r=t[a],i=e[a];break}return r<i?-1:i<r?1:0};s.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}};s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return s.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=s.allocUnsafe(e),a=0;for(r=0;r<t.length;++r){var o=t[r];if(!F(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,a),a+=o.length}return i};s.byteLength=mt;s.prototype._isBuffer=!0;s.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)K(this,e,e+1);return this};s.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)K(this,e,e+3),K(this,e+1,e+2);return this};s.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)K(this,e,e+7),K(this,e+1,e+6),K(this,e+2,e+5),K(this,e+3,e+4);return this};s.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?xt(this,0,t):xn.apply(this,arguments)};s.prototype.equals=function(t){if(!F(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:s.compare(this,t)===0};s.prototype.compare=function(t,e,r,i,a){if(!F(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),a===void 0&&(a=this.length),e<0||r>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&e>=r)return 0;if(i>=a)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,a>>>=0,this===t)return 0;for(var o=a-i,p=r-e,c=Math.min(o,p),d=this.slice(i,a),x=t.slice(e,r),g=0;g<c;++g)if(d[g]!==x[g]){o=d[g],p=x[g];break}return o<p?-1:p<o?1:0};s.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};s.prototype.indexOf=function(t,e,r){return dt(this,t,e,r,!0)};s.prototype.lastIndexOf=function(t,e,r){return dt(this,t,e,r,!1)};s.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 a=this.length-e;if((r===void 0||r>a)&&(r=a),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return yn(this,t,e,r);case"utf8":case"utf-8":return gn(this,t,e,r);case"ascii":return ht(this,t,e,r);case"latin1":case"binary":return wn(this,t,e,r);case"base64":return bn(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vn(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};ut=4096;s.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(s.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=s.prototype;else{var a=e-t;i=new s(a,void 0);for(var o=0;o<a;++o)i[o]=this[o+t]}return i};s.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t],a=1,o=0;++o<e&&(a*=256);)i+=this[t+o]*a;return i};s.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t+--e],a=1;e>0&&(a*=256);)i+=this[t+--e]*a;return i};s.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]};s.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8};s.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]};s.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};s.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};s.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t],a=1,o=0;++o<e&&(a*=256);)i+=this[t+o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};s.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=e,a=1,o=this[t+--i];i>0&&(a*=256);)o+=this[t+--i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*e)),o};s.prototype.readInt8=function(t,e){return e||T(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};s.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};s.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};s.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};s.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};s.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),Ie(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),Ie(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),Ie(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),Ie(this,t,!1,52,8)};s.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var a=Math.pow(2,8*r)-1;I(this,t,e,r,a,0)}var o=1,p=0;for(this[e]=t&255;++p<r&&(o*=256);)this[e+p]=t/o&255;return e+r};s.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var a=Math.pow(2,8*r)-1;I(this,t,e,r,a,0)}var o=r-1,p=1;for(this[e+o]=t&255;--o>=0&&(p*=256);)this[e+o]=t/p&255;return e+r};s.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Se(this,t,e,!0),e+2};s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Se(this,t,e,!1),e+2};s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Te(this,t,e,!0),e+4};s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Te(this,t,e,!1),e+4};s.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var a=Math.pow(2,8*r-1);I(this,t,e,r,a-1,-a)}var o=0,p=1,c=0;for(this[e]=t&255;++o<r&&(p*=256);)t<0&&c===0&&this[e+o-1]!==0&&(c=1),this[e+o]=(t/p>>0)-c&255;return e+r};s.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var a=Math.pow(2,8*r-1);I(this,t,e,r,a-1,-a)}var o=r-1,p=1,c=0;for(this[e+o]=t&255;--o>=0&&(p*=256);)t<0&&c===0&&this[e+o+1]!==0&&(c=1),this[e+o]=(t/p>>0)-c&255;return e+r};s.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};s.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Se(this,t,e,!0),e+2};s.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Se(this,t,e,!1),e+2};s.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Te(this,t,e,!0),e+4};s.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Te(this,t,e,!1),e+4};s.prototype.writeFloatLE=function(t,e,r){return gt(this,t,e,!0,r)};s.prototype.writeFloatBE=function(t,e,r){return gt(this,t,e,!1,r)};s.prototype.writeDoubleLE=function(t,e,r){return wt(this,t,e,!0,r)};s.prototype.writeDoubleBE=function(t,e,r){return wt(this,t,e,!1,r)};s.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 a=i-r,o;if(this===t&&r<e&&e<i)for(o=a-1;o>=0;--o)t[o+e]=this[o+r];else if(a<1e3||!s.TYPED_ARRAY_SUPPORT)for(o=0;o<a;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a};s.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 a=t.charCodeAt(0);a<256&&(t=a)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var o;if(typeof t=="number")for(o=e;o<r;++o)this[o]=t;else{var p=F(t)?t:ve(new s(t,i).toString()),c=p.length;for(o=0;o<r-e;++o)this[o+e]=p[o%c]}return this};Ln=/[^+\/0-9A-Za-z-_]/g});var u=je(()=>{"use strict";Tt()});var Wa={};et(Wa,{EndpointSnippetGenerator:()=>Ze});module.exports=Mr(Wa);l();u();l();u();l();u();function Ae(n,t){if(n===void 0)throw new Error(t!=null?t:"Expected value to be defined but got undefined.")}function R(n,t){if(n===null)throw new Error(t!=null?t:"Expected value to be non-null but got null.")}function b(n){throw new Error("Unexpected value: "+JSON.stringify(n))}l();u();l();u();l();u();l();u();l();u();l();u();var Un=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,Et=Un;var Dn=typeof self=="object"&&self&&self.Object===Object&&self,qn=Et||Dn||Function("return this")(),It=qn;var Wn=It.Symbol,D=Wn;l();u();var At=Object.prototype,Yn=At.hasOwnProperty,jn=At.toString,de=D?D.toStringTag:void 0;function $n(n){var t=Yn.call(n,de),e=n[de];try{n[de]=void 0;var r=!0}catch(a){}var i=jn.call(n);return r&&(t?n[de]=e:delete n[de]),i}var Nt=$n;l();u();var _n=Object.prototype,zn=_n.toString;function Vn(n){return zn.call(n)}var Lt=Vn;var Kn="[object Null]",Gn="[object Undefined]",Rt=D?D.toStringTag:void 0;function Hn(n){return n==null?n===void 0?Gn:Kn:Rt&&Rt in Object(n)?Nt(n):Lt(n)}var Ct=Hn;l();u();function Jn(n){return n!=null&&typeof n=="object"}var Bt=Jn;var Zn="[object Symbol]";function Qn(n){return typeof n=="symbol"||Bt(n)&&Ct(n)==Zn}var kt=Qn;l();u();l();u();function Xn(n,t){for(var e=-1,r=n==null?0:n.length,i=Array(r);++e<r;)i[e]=t(n[e],e,n);return i}var Mt=Xn;l();u();var ei=Array.isArray,Ft=ei;var ti=1/0,Ot=D?D.prototype:void 0,Pt=Ot?Ot.toString:void 0;function Ut(n){if(typeof n=="string")return n;if(Ft(n))return Mt(n,Ut)+"";if(kt(n))return Pt?Pt.call(n):"";var t=n+"";return t=="0"&&1/n==-ti?"-0":t}var Dt=Ut;l();u();function ri(n){return n==null?"":Dt(n)}var $=ri;l();u();l();u();l();u();l();u();l();u();l();u();function ni(n,t,e){var r=-1,i=n.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=n[r+t];return a}var qt=ni;function ii(n,t,e){var r=n.length;return e=e===void 0?r:e,!t&&e>=r?n:qt(n,t,e)}var Wt=ii;l();u();var ai="\\ud800-\\udfff",oi="\\u0300-\\u036f",si="\\ufe20-\\ufe2f",li="\\u20d0-\\u20ff",ui=oi+si+li,fi="\\ufe0e\\ufe0f",pi="\\u200d",ci=RegExp("["+pi+ai+ui+fi+"]");function mi(n){return ci.test(n)}var Ne=mi;l();u();l();u();function di(n){return n.split("")}var Yt=di;l();u();var jt="\\ud800-\\udfff",hi="\\u0300-\\u036f",xi="\\ufe20-\\ufe2f",yi="\\u20d0-\\u20ff",gi=hi+xi+yi,wi="\\ufe0e\\ufe0f",bi="["+jt+"]",Ke="["+gi+"]",Ge="\\ud83c[\\udffb-\\udfff]",vi="(?:"+Ke+"|"+Ge+")",$t="[^"+jt+"]",_t="(?:\\ud83c[\\udde6-\\uddff]){2}",zt="[\\ud800-\\udbff][\\udc00-\\udfff]",Si="\\u200d",Vt=vi+"?",Kt="["+wi+"]?",Ti="(?:"+Si+"(?:"+[$t,_t,zt].join("|")+")"+Kt+Vt+")*",Ei=Kt+Vt+Ti,Ii="(?:"+[$t+Ke+"?",Ke,_t,zt,bi].join("|")+")",Ai=RegExp(Ge+"(?="+Ge+")|"+Ii+Ei,"g");function Ni(n){return n.match(Ai)||[]}var Gt=Ni;function Li(n){return Ne(n)?Gt(n):Yt(n)}var Ht=Li;function Ri(n){return function(t){t=$(t);var e=Ne(t)?Ht(t):void 0,r=e?e[0]:t.charAt(0),i=e?Wt(e,1).join(""):t.slice(1);return r[n]()+i}}var Le=Ri;var Ci=Le("toUpperCase"),q=Ci;function Bi(n){return q($(n).toLowerCase())}var Jt=Bi;l();u();l();u();function ki(n,t,e,r){var i=-1,a=n==null?0:n.length;for(r&&a&&(e=n[++i]);++i<a;)e=t(e,n[i],i,n);return e}var Zt=ki;l();u();l();u();l();u();function Mi(n){return function(t){return n==null?void 0:n[t]}}var Qt=Mi;var Fi={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Oi=Qt(Fi),Xt=Oi;var Pi=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ui="\\u0300-\\u036f",Di="\\ufe20-\\ufe2f",qi="\\u20d0-\\u20ff",Wi=Ui+Di+qi,Yi="["+Wi+"]",ji=RegExp(Yi,"g");function $i(n){return n=$(n),n&&n.replace(Pi,Xt).replace(ji,"")}var er=$i;l();u();l();u();var _i=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function zi(n){return n.match(_i)||[]}var tr=zi;l();u();var Vi=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Ki(n){return Vi.test(n)}var rr=Ki;l();u();var sr="\\ud800-\\udfff",Gi="\\u0300-\\u036f",Hi="\\ufe20-\\ufe2f",Ji="\\u20d0-\\u20ff",Zi=Gi+Hi+Ji,lr="\\u2700-\\u27bf",ur="a-z\\xdf-\\xf6\\xf8-\\xff",Qi="\\xac\\xb1\\xd7\\xf7",Xi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ea="\\u2000-\\u206f",ta=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",fr="A-Z\\xc0-\\xd6\\xd8-\\xde",ra="\\ufe0e\\ufe0f",pr=Qi+Xi+ea+ta,cr="['\u2019]",nr="["+pr+"]",na="["+Zi+"]",mr="\\d+",ia="["+lr+"]",dr="["+ur+"]",hr="[^"+sr+pr+mr+lr+ur+fr+"]",aa="\\ud83c[\\udffb-\\udfff]",oa="(?:"+na+"|"+aa+")",sa="[^"+sr+"]",xr="(?:\\ud83c[\\udde6-\\uddff]){2}",yr="[\\ud800-\\udbff][\\udc00-\\udfff]",X="["+fr+"]",la="\\u200d",ir="(?:"+dr+"|"+hr+")",ua="(?:"+X+"|"+hr+")",ar="(?:"+cr+"(?:d|ll|m|re|s|t|ve))?",or="(?:"+cr+"(?:D|LL|M|RE|S|T|VE))?",gr=oa+"?",wr="["+ra+"]?",fa="(?:"+la+"(?:"+[sa,xr,yr].join("|")+")"+wr+gr+")*",pa="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ca="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ma=wr+gr+fa,da="(?:"+[ia,xr,yr].join("|")+")"+ma,ha=RegExp([X+"?"+dr+"+"+ar+"(?="+[nr,X,"$"].join("|")+")",ua+"+"+or+"(?="+[nr,X+ir,"$"].join("|")+")",X+"?"+ir+"+"+ar,X+"+"+or,ca,pa,mr,da].join("|"),"g");function xa(n){return n.match(ha)||[]}var br=xa;function ya(n,t,e){return n=$(n),t=e?void 0:t,t===void 0?rr(n)?br(n):tr(n):n.match(t)||[]}var vr=ya;var ga="['\u2019]",wa=RegExp(ga,"g");function ba(n){return function(t){return Zt(vr(er(t).replace(wa,"")),n,"")}}var Sr=ba;var va=Sr(function(n,t,e){return t=t.toLowerCase(),n+(e?Jt(t):t)}),He=va;l();u();var Sa=Le("toLowerCase"),Re=Sa;l();u();function Je(){}l();u();function Ce(n){return Object.values(n)}l();u();l();u();var G=class{};l();u();l();u();var B=class extends G{constructor(e){super();f(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 Ta=4,Tr=!!m.env.FERN_STACK_TRACK;Tr&&(Error.stackTraceLimit=50);var he=class{constructor(){f(this,"buffer","");f(this,"indentLevel",0);f(this,"hasWrittenAnything",!1);f(this,"lastCharacterIsSemicolon",!1);f(this,"lastCharacterIsNewline",!1)}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let r=e.length>0&&e.endsWith(`
2
+ `),i=r?e.substring(0,e.length-1):e,a=this.getIndentString(),o=i.replaceAll(`
3
+ `,`
4
+ ${a}`);this.isAtStartOfLine()&&(o=a+o),r&&(o+=`
5
+ `),this.writeInternal(o)}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){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new B(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new B(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new B(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new B(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new B(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),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
+ `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
+ `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let a=1;a<t.length;a++){this.write(e);let o=t[a];o!=null&&r(o)}}}toString(){return this.buffer}writeInternal(t){if(t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
+ `),this.lastCharacterIsSemicolon=t.endsWith(";")),this.buffer+=t,Tr&&this.buffer.endsWith(`
9
+ `)&&!this.buffer.endsWith(`"""
10
+ `)){let e=this.stacktrace(15).map(r=>`${r.fn} - ${r.path}:${r.position}`).join(" ");e&&(this.buffer=this.buffer.slice(0,-1),this.buffer+=`//@@ ${e}
11
+ `)}return this.buffer}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Ta}stacktrace(t=50){var r;let e=!1;return((r=new Error().stack)!=null?r:"").split(`
12
+ `).map(i=>{var o;let a=i.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(a&&a.length===5){let[,p,c,d,x]=a;if(e||p!=null&&p.includes("runInteractiveTask")){e=!0;return}switch(p){case"Object.<anonymous>":p="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":p=`${p.substring(p.indexOf(".")+1)}()=> { ... }`;break}return{fn:p,path:(o=c==null?void 0:c.replace(/^.*?fern.*?\//,""))!=null?o:"",position:`${d}:${x}`}}}).filter(i=>{var a,o,p,c,d,x,g;return i&&!((a=i.path)!=null&&a.startsWith("node:"))&&!((o=i.path)!=null&&o.endsWith(".js"))&&!((p=i.path)!=null&&p.includes("AbstractWriter"))&&!((c=i.fn)!=null&&c.includes("stacktrace"))&&!((d=i.fn)!=null&&d.includes("stackLine"))&&!((x=i.fn)!=null&&x.includes("SdkGeneratorCLI"))&&!((g=i.fn)!=null&&g.includes("runCli"))}).slice(0,t)}};l();u();l();u();var W={Critical:"CRITICAL",Warning:"WARNING"};l();u();var _={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};l();u();var w={};et(w,{AccessLevel:()=>Er,Class:()=>ee,CodeBlock:()=>E,Comment:()=>te,ComputedProperty:()=>ne,DeclarationType:()=>xe,DocComment:()=>ie,EnumWithAssociatedValues:()=>ae,EnumWithRawValues:()=>oe,Expression:()=>O,Extension:()=>se,FunctionArgument:()=>le,FunctionParameter:()=>ue,Initializer:()=>fe,LineBreak:()=>ke,Method:()=>pe,Pattern:()=>Me,Property:()=>ce,Protocol:()=>Ar,Statement:()=>re,Struct:()=>me,Symbol:()=>S,SymbolRegistry:()=>We,Type:()=>Oe,TypeReference:()=>Pe,class_:()=>Aa,codeBlock:()=>Na,comment:()=>La,computedProperty:()=>Ra,docComment:()=>Ca,enumWithAssociatedValues:()=>Ba,enumWithRawValues:()=>ka,extension:()=>Ma,functionArgument:()=>Fa,functionParameter:()=>Oa,initializer:()=>Pa,method:()=>Ua,property:()=>Da,struct:()=>qa});l();u();l();u();l();u();var Er={Open:"open",Public:"public",Package:"package",Internal:"internal",Fileprivate:"fileprivate",Private:"private"};l();u();l();u();l();u();l();u();var Be=class extends he{toString(){return this.buffer}};var y=class extends G{toString(){let t=new Be;return this.write(t),t.toString()}};var ee=class extends y{constructor({accessLevel:e,name:r,final:i,conformances:a,properties:o,initializers:p,methods:c,docs:d}){super();f(this,"name");f(this,"final");f(this,"accessLevel");f(this,"conformances");f(this,"properties");f(this,"initializers");f(this,"methods");f(this,"docs");this.name=r,this.final=i,this.accessLevel=e,this.conformances=a!=null?a:[],this.properties=o,this.initializers=p!=null?p:[],this.methods=c!=null?c:[],this.docs=d}write(e){this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),this.final&&e.write("final "),e.write(`class ${this.name}`),this.conformances.forEach((r,i)=>{i===0?e.write(": "):i>0&&e.write(", "),e.write(r)}),e.write(" {"),e.newLine(),e.indent(),this.properties.forEach(r=>{r.write(e),e.newLine()}),this.initializers.length>0&&(e.newLine(),this.initializers.forEach((r,i)=>{i>0&&e.newLine(),r.write(e),e.newLine()})),this.methods.length>0&&(e.newLine(),this.methods.forEach((r,i)=>{i>0&&e.newLine(),r.write(e),e.newLine()})),e.dedent(),e.write("}")}};l();u();var E=class n extends y{constructor(e){super();f(this,"args");this.args=e}write(e){let r=new B(this.args);e.write("{"),e.newLine(),e.indent(),r.write(e),e.dedent(),e.write("}")}static empty(){return new n(Je)}static withStatements(e){return new n(r=>{e.forEach(i=>{i.write(r)})})}};l();u();var te=class extends y{constructor({content:e}){super();f(this,"content");this.content=e}write(e){this.content.split(`
13
+ `).forEach(i=>{e.write(`// ${i}`),e.newLine()})}};l();u();l();u();function Ir(n){return n.replace(/\\u([0-9a-fA-F]{4})/g,"\\u{$1}").replace(new RegExp("(?<!\\\\)\\\\f","g"),"\\u{000C}").replace(new RegExp("(?<!\\\\)\\\\v","g"),"\\u{000B}").replace(new RegExp("(?<!\\\\)\\\\0","g"),"\\u{0000}").replace(new RegExp('(?<!\\\\)"',"g"),'\\"')}l();u();var Ea=["Any","as","associatedtype","break","case","catch","class","continue","default","defer","deinit","do","else","fallthrough","false","for","guard","enum","extension","fileprivate","func","if","import","in","init","inout","internal","is","let","nil","operator","private","precedencegroup","Protocol","protocol","public","repeat","rethrows","return","Self","self","static","struct","subscript","super","switch","throw","throws","true","try","Type","typealias","var","where","while"],Ia=new Set(Ea);function H(n){return Ia.has(n)}function A(n){return H(n)?`\`${n}\``:n}l();u();var O=class extends y{constructor(e){super();f(this,"internalExpression");this.internalExpression=e}isNop(){return this.internalExpression.type==="nop"}isStructInitialization(){return this.internalExpression.type==="struct-initialization"}asStructInitializationOrThrow(){if(this.internalExpression.type!=="struct-initialization")throw new Error("Internal error; swift.Expression is not a struct initialization");return this.internalExpression}write(e){switch(this.internalExpression.type){case"reference":e.write(A(this.internalExpression.unsafeName));break;case"member-access":this.internalExpression.target.write(e),this.internalExpression.optionalChain&&e.write("?"),e.write("."),e.write(this.internalExpression.memberName);break;case"equals":this.internalExpression.left.write(e),e.write(" == "),this.internalExpression.right.write(e);break;case"enum-case-shorthand":e.write("."),e.write(this.internalExpression.caseName);break;case"function-call":this.writeCallableExpression({writer:e,target:A(this.internalExpression.unsafeName),arguments_:this.internalExpression.arguments_,multiline:!!this.internalExpression.multiline});break;case"struct-initialization":this.writeCallableExpression({writer:e,target:A(this.internalExpression.unsafeName),arguments_:this.internalExpression.arguments_,multiline:!!this.internalExpression.multiline});break;case"class-initialization":this.writeCallableExpression({writer:e,target:A(this.internalExpression.unsafeName),arguments_:this.internalExpression.arguments_,multiline:!!this.internalExpression.multiline});break;case"method-call":this.internalExpression.target.write(e),e.write("."),this.writeCallableExpression({writer:e,target:this.internalExpression.methodName,arguments_:this.internalExpression.arguments_,multiline:!!this.internalExpression.multiline});break;case"method-call-with-trailing-closure":this.internalExpression.target.write(e),e.write("."),e.write(this.internalExpression.methodName),e.write(" {"),this.internalExpression.multiline?(e.newLine(),e.indent()):e.write(" "),this.internalExpression.closureBody.write(e),this.internalExpression.multiline?(e.newLine(),e.dedent()):e.write(" "),e.write("}");break;case"contextual-method-call":e.write("."),this.writeCallableExpression({writer:e,target:this.internalExpression.methodName,arguments_:this.internalExpression.arguments_,multiline:!!this.internalExpression.multiline});break;case"try":e.write("try "),this.internalExpression.expression.write(e);break;case"optional-try":e.write("try? "),this.internalExpression.expression.write(e);break;case"force-try":e.write("try! "),this.internalExpression.expression.write(e);break;case"await":e.write("await "),this.internalExpression.expression.write(e);break;case"string-literal":e.write(`"${this.internalExpression.value}"`);break;case"number-literal":e.write(this.internalExpression.value.toString());break;case"bool-literal":e.write(this.internalExpression.value?"true":"false");break;case"date-literal":e.write(`try! Date("${this.internalExpression.isoString}", strategy: .iso8601)`);break;case"calendar-date-literal":e.write(`CalendarDate("${this.internalExpression.isoString}")!`);break;case"uuid-literal":e.write(`UUID(uuidString: "${this.internalExpression.value}")!`);break;case"dictionary-literal":this.writeDictionaryLiteral(e,this.internalExpression);break;case"array-literal":this.writeArrayLiteral(e,this.internalExpression);break;case"data-literal":e.write(`Data("${this.internalExpression.value}".utf8)`);break;case"raw-value":e.write(this.internalExpression.value);break;case"nop":break;default:b(this.internalExpression)}}writeCallableExpression({writer:e,target:r,arguments_:i,multiline:a}){e.write(r),e.write("("),a&&(e.newLine(),e.indent()),i==null||i.forEach((o,p)=>{p>0&&(e.write(","),a?e.newLine():e.write(" ")),o.write(e)}),a&&(e.newLine(),e.dedent()),e.write(")")}writeDictionaryLiteral(e,r){var a;if(!r.entries||r.entries.length===0){e.write("[:]");return}e.write("[");let i=!!r.multiline;i&&(e.newLine(),e.indent()),(a=r.entries)==null||a.forEach(([o,p],c)=>{c>0&&(e.write(", "),i&&e.newLine()),o.write(e),e.write(": "),p.write(e)}),i&&(e.newLine(),e.dedent()),e.write("]")}writeArrayLiteral(e,r){var a;if(!r.elements||r.elements.length===0){e.write("[]");return}e.write("[");let i=!!r.multiline;i&&(e.newLine(),e.indent()),(a=r.elements)==null||a.forEach((o,p)=>{p>0&&(e.write(","),i?e.newLine():e.write(" ")),o.write(e)}),i&&(e.newLine(),e.dedent()),e.write("]")}static reference(e){return new this({type:"reference",unsafeName:e})}static memberAccess(e){return new this(v({type:"member-access"},e))}static equals(e,r){return new this({type:"equals",left:e,right:r})}static enumCaseShorthand(e){return new this({type:"enum-case-shorthand",caseName:e})}static functionCall(e){return new this(v({type:"function-call"},e))}static structInitialization(e){return new this(v({type:"struct-initialization"},e))}static classInitialization(e){return new this(v({type:"class-initialization"},e))}static stringLiteral(e){return new this({type:"string-literal",value:e})}static numberLiteral(e){return new this({type:"number-literal",value:e})}static boolLiteral(e){return new this({type:"bool-literal",value:e})}static dateLiteral(e){return new this({type:"date-literal",isoString:e})}static calendarDateLiteral(e){return new this({type:"calendar-date-literal",isoString:e})}static uuidLiteral(e){return new this({type:"uuid-literal",value:e})}static dictionaryLiteral(e){return new this(v({type:"dictionary-literal"},e))}static arrayLiteral(e){return new this(v({type:"array-literal"},e))}static dataLiteral(e){return new this({type:"data-literal",value:e})}static methodCall(e){return new this(v({type:"method-call"},e))}static methodCallWithTrailingClosure(e){return new this(v({type:"method-call-with-trailing-closure"},e))}static contextualMethodCall(e){return new this(v({type:"contextual-method-call"},e))}static try(e){return new this({type:"try",expression:e})}static optionalTry(e){return new this({type:"optional-try",expression:e})}static forceTry(e){return new this({type:"force-try",expression:e})}static await(e){return new this({type:"await",expression:e})}static rawValue(e){return new this({type:"raw-value",value:e})}static nop(){return new this({type:"nop"})}static nil(){return new this({type:"raw-value",value:"nil"})}static self(){return new this({type:"raw-value",value:"self"})}};l();u();l();u();var xe={Var:"var",Let:"let"};var re=class extends y{constructor(e){super();f(this,"internalStatement");this.internalStatement=e}write(e){var r,i,a;switch(this.internalStatement.type){case"typealias-declaration":this.internalStatement.docs!=null&&this.internalStatement.docs.write(e),this.internalStatement.accessLevel&&(e.write(this.internalStatement.accessLevel),e.write(" ")),e.write("typealias "),e.write(this.internalStatement.unsafeName),e.write(" = "),this.internalStatement.aliasedType.write(e),e.newLine();break;case"constant-declaration":e.write(xe.Let),e.write(" "),e.write(A(this.internalStatement.unsafeName)),e.write(" = "),this.internalStatement.value.write(e),this.internalStatement.noTrailingNewline||e.newLine();break;case"variable-declaration":e.write(xe.Var),e.write(" "),e.write(A(this.internalStatement.unsafeName)),e.write(" = "),this.internalStatement.value.write(e),this.internalStatement.noTrailingNewline||e.newLine();break;case"function-declaration":this.internalStatement.docs!=null&&this.internalStatement.docs.write(e),this.internalStatement.accessLevel!=null&&(e.write(this.internalStatement.accessLevel),e.write(" ")),e.write("func "),e.write(A(this.internalStatement.unsafeName)),e.write("("),(r=this.internalStatement.parameters)==null||r.forEach((o,p)=>{p>0&&e.write(", "),o.write(e)}),e.write(")"),this.internalStatement.async&&e.write(" async"),this.internalStatement.throws&&e.write(" throws"),this.internalStatement.returnType&&(e.write(" -> "),this.internalStatement.returnType.write(e)),e.write(" "),((i=this.internalStatement.body)!=null?i:E.empty()).write(e),e.newLine();break;case"variable-assignment":e.write(A(this.internalStatement.unsafeName)),e.write(" = "),this.internalStatement.value.write(e),e.newLine();break;case"self-assignment":e.write("self = "),e.write(this.internalStatement.value.toString()),e.newLine();break;case"property-assignment":e.write("self."),e.write(this.internalStatement.unsafeName),e.write(" = "),this.internalStatement.value.write(e),e.newLine();break;case"discard-assignment":e.write("_ = "),this.internalStatement.value.write(e),e.newLine();break;case"return":e.write("return "),this.internalStatement.expression.write(e),e.newLine();break;case"throw":e.write("throw "),this.internalStatement.expression.write(e),e.newLine();break;case"expression-statement":this.internalStatement.expression.write(e),e.newLine();break;case"import":e.write("import "),e.write(this.internalStatement.moduleName),e.newLine();break;case"switch":e.write("switch "),this.internalStatement.target.write(e),e.write(" {"),e.newLine();for(let o of this.internalStatement.cases)if(e.write("case "),o.pattern.write(e),e.write(":"),e.newLine(),o.body.length>0){e.indent();for(let p of o.body)p.write(e);e.dedent()}if(this.internalStatement.defaultCase&&(e.write("default:"),e.newLine(),this.internalStatement.defaultCase.length>0)){e.indent();for(let o of this.internalStatement.defaultCase)o.write(e);e.dedent()}e.write("}"),e.newLine();break;case"if":{e.write("if "),this.internalStatement.condition.write(e),e.write(" "),E.withStatements(this.internalStatement.body).write(e);for(let o of(a=this.internalStatement.elseIfs)!=null?a:[])e.write(" else if "),o.condition.write(e),e.write(" "),E.withStatements(o.body).write(e);this.internalStatement.else&&(e.write(" else "),E.withStatements(this.internalStatement.else).write(e)),e.newLine();break}case"raw":e.write(this.internalStatement.content),e.newLine();break;default:b(this.internalStatement)}}static typealiasDeclaration(e){return new this(v({type:"typealias-declaration"},e))}static constantDeclaration(e){return new this(v({type:"constant-declaration"},e))}static variableDeclaration(e){return new this(v({type:"variable-declaration"},e))}static functionDeclaration(e){return new this(v({type:"function-declaration"},e))}static variableAssignment(e,r){return new this({type:"variable-assignment",unsafeName:e,value:r})}static selfAssignment(e){return new this({type:"self-assignment",value:e})}static propertyAssignment(e,r){return new this({type:"property-assignment",unsafeName:e,value:r})}static discardAssignment(e){return new this({type:"discard-assignment",value:e})}static return(e){return new this({type:"return",expression:e})}static throw(e){return new this({type:"throw",expression:e})}static expressionStatement(e){return new this({type:"expression-statement",expression:e})}static import(e){return new this({type:"import",moduleName:e})}static switch(e){return new this(v({type:"switch"},e))}static if(e){return new this(v({type:"if"},e))}static raw(e){return new this({type:"raw",content:e})}};var ne=class extends y{constructor({unsafeName:e,accessLevel:r,type:i,body:a,docs:o}){super();f(this,"unsafeName");f(this,"accessLevel");f(this,"type");f(this,"body");f(this,"docs");this.unsafeName=e,this.accessLevel=r,this.type=i,this.body=a,this.docs=o}write(e){this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write("var "),e.write(A(this.unsafeName)),e.write(": "),this.type.write(e),e.write(" "),this.body instanceof E?this.body.write(e):this.body instanceof O?E.withStatements([re.expressionStatement(this.body)]).write(e):b(this.body)}};l();u();var ie=class n extends y{constructor({summary:e,description:r,parameters:i,returns:a,throws:o}){super();f(this,"summary");f(this,"description");f(this,"parameters");f(this,"returns");f(this,"throws");this.summary=n.sanitizeText(e),this.description=r!=null?n.sanitizeText(r):void 0,this.parameters=(i!=null?i:[]).map(p=>({name:p.name,description:n.sanitizeText(p.description)})),this.returns=a!=null?n.sanitizeText(a):void 0,this.throws=(o!=null?o:[]).map(p=>n.sanitizeText(p))}write(e){if(this.writeMultilineText(e,this.summary),this.description!=null&&(e.write("///"),e.newLine(),this.writeMultilineText(e,this.description)),this.parameters.length>0){e.write("///"),e.newLine();for(let r of this.parameters)r.description.split(`
14
+ `).forEach((a,o)=>{o===0?(e.write("/// - Parameter "),e.write(r.name),e.write(": "),e.write(a)):(e.write("/// "),e.write(a)),e.newLine()})}if(this.returns!=null&&this.returns.split(`
15
+ `).forEach((i,a)=>{a===0?(e.write("/// - Returns: "),e.write(i)):(e.write("/// "),e.write(i)),e.newLine()}),this.throws.length>0)for(let r of this.throws)r.split(`
16
+ `).forEach((a,o)=>{o===0?(e.write("/// - Throws: "),e.write(a)):(e.write("/// "),e.write(a)),e.newLine()})}writeMultilineText(e,r){let i=r.split(`
17
+ `);for(let a of i)e.write("/// "),e.write(a),e.newLine()}static sanitizeText(e){return e=e.replace(/\r\n/g,`
18
+ `).replace(/\r/g,`
19
+ `),e=e.replace(/\x00/g,""),e}};l();u();var ae=class extends y{constructor({accessLevel:e,name:r,conformances:i,cases:a,initializers:o,methods:p,nestedTypes:c,docs:d}){super();f(this,"name");f(this,"accessLevel");f(this,"conformances");f(this,"cases");f(this,"initializers");f(this,"methods");f(this,"nestedTypes");f(this,"docs");this.name=r,this.accessLevel=e,this.conformances=i!=null?i:[],this.cases=a,this.initializers=o!=null?o:[],this.methods=p!=null?p:[],this.nestedTypes=c!=null?c:[],this.docs=d}write(e){this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write(`enum ${this.name}`),this.conformances.forEach((r,i)=>{i===0?e.write(": "):i>0&&e.write(", "),e.write(r)}),e.write(" {"),e.newLine(),e.indent(),this.cases.forEach(r=>{r.docs!=null&&r.docs.write(e),e.write("case "),H(r.unsafeName)?e.write(`\`${r.unsafeName}\``):e.write(r.unsafeName),e.write("("),r.associatedValue.forEach((i,a)=>{a>0&&e.write(", "),i.write(e)}),e.write(")"),e.newLine()}),this.initializers.length>0&&(e.newLine(),this.initializers.forEach((r,i)=>{i>0&&e.newLine(),r.write(e),e.newLine()})),this.methods.length>0&&(e.newLine(),this.methods.forEach((r,i)=>{i>0&&e.newLine(),r.write(e),e.newLine()})),this.nestedTypes.length>0&&(e.newLine(),this.nestedTypes.forEach((r,i)=>{i>0&&e.newLine(),r.write(e),e.newLine()})),e.dedent(),e.write("}")}};l();u();var oe=class extends y{constructor({accessLevel:e,name:r,conformances:i,cases:a,docs:o}){super();f(this,"name");f(this,"accessLevel");f(this,"conformances");f(this,"cases");f(this,"docs");this.name=r,this.accessLevel=e,this.conformances=i!=null?i:[],this.cases=a,this.docs=o}write(e){if(this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write(`enum ${this.name}`),this.conformances.forEach((r,i)=>{i===0?e.write(": "):i>0&&e.write(", "),e.write(r)}),this.cases.length===0){e.write(" {}");return}e.write(" {"),e.newLine(),e.indent(),this.cases.forEach(r=>{r.docs!=null&&r.docs.write(e),e.write("case "),H(r.unsafeName)?e.write(`\`${r.unsafeName}\``):e.write(r.unsafeName),r.rawValue!==r.unsafeName&&(e.write(" = "),e.write(`"${Ir(r.rawValue)}"`)),e.newLine()}),e.dedent(),e.write("}")}};l();u();var se=class extends y{constructor({name:e,conformances:r,initializers:i,computedProperties:a,methods:o,nestedTypes:p,docs:c}){super();f(this,"name");f(this,"conformances");f(this,"initializers");f(this,"computedProperties");f(this,"methods");f(this,"nestedTypes");f(this,"docs");this.name=e,this.conformances=r!=null?r:[],this.initializers=i!=null?i:[],this.computedProperties=a!=null?a:[],this.methods=o!=null?o:[],this.nestedTypes=p!=null?p:[],this.docs=c}write(e){this.docs!=null&&this.docs.write(e),e.write(`extension ${this.name}`),this.conformances.forEach((r,i)=>{i===0?e.write(": "):i>0&&e.write(", "),e.write(r)}),e.write(" {"),this.initializers.length>0&&(e.newLine(),e.indent(),this.initializers.forEach((r,i)=>{i>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),this.computedProperties.length>0&&(e.newLine(),e.indent(),this.computedProperties.forEach((r,i)=>{i>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),this.methods.length>0&&(e.newLine(),e.indent(),this.methods.forEach((r,i)=>{i>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),this.nestedTypes.length>0&&(e.newLine(),e.indent(),this.nestedTypes.forEach((r,i)=>{i>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),e.write("}")}};l();u();var le=class extends y{constructor({label:e,value:r}){super();f(this,"label");f(this,"value");this.label=e,this.value=r}write(e){this.label!=null&&(e.write(this.label),e.write(": ")),this.value.write(e)}};l();u();var ue=class extends y{constructor({argumentLabel:e,unsafeName:r,escaping:i,type:a,defaultValue:o,docsContent:p}){super();f(this,"argumentLabel");f(this,"unsafeName");f(this,"escaping");f(this,"type");f(this,"defaultValue");f(this,"docsContent");this.argumentLabel=e,this.unsafeName=r,this.escaping=i,this.type=a,this.defaultValue=o,this.docsContent=p}write(e){this.argumentLabel==null?e.write("_ "):this.argumentLabel!==this.unsafeName&&(e.write(this.argumentLabel),e.write(" ")),e.write(this.unsafeName),e.write(": "),this.escaping&&e.write("@escaping "),this.type.write(e),this.defaultValue!=null&&(e.write(" = "),this.defaultValue.write(e))}};l();u();var fe=class extends y{constructor({accessLevel:e,convenience:r,failable:i,throws:a,parameters:o,body:p,multiline:c,docs:d}){super();f(this,"accessLevel");f(this,"convenience");f(this,"failable");f(this,"throws");f(this,"parameters");f(this,"body");f(this,"multiline");f(this,"docs");this.accessLevel=e,this.convenience=r,this.failable=i,this.throws=a,this.parameters=o!=null?o:[],this.body=p!=null?p:E.empty(),this.multiline=c,this.docs=d}write(e){this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),this.convenience&&e.write("convenience "),e.write("init"),this.failable&&e.write("?"),e.write("("),this.multiline&&(e.newLine(),e.indent()),this.parameters.forEach((r,i)=>{i>0&&(e.write(","),this.multiline?e.newLine():e.write(" ")),r.write(e)}),this.multiline&&(e.newLine(),e.dedent()),e.write(") "),this.throws&&e.write("throws "),this.body.write(e)}};l();u();var ke=class n extends y{constructor({count:e=1}={}){super();f(this,"count");this.count=e}write(e){for(let r=0;r<this.count;r++)e.newLine()}static single(){return new n({count:1})}static double(){return new n({count:2})}static multiple(e){return new n({count:e})}};l();u();var pe=class extends y{constructor({attributes:e,unsafeName:r,accessLevel:i,static_:a,parameters:o,async:p,throws:c,returnType:d,body:x,docs:g}){super();f(this,"attributes");f(this,"unsafeName");f(this,"accessLevel");f(this,"static_");f(this,"parameters");f(this,"async");f(this,"throws");f(this,"returnType");f(this,"body");f(this,"docs");this.attributes=e!=null?e:[],this.unsafeName=r,this.accessLevel=i,this.static_=a,this.parameters=o!=null?o:[],this.async=p,this.throws=c,this.returnType=d,this.body=x!=null?x:E.empty(),this.docs=g}write(e){this.docs!=null&&this.docs.write(e),this.attributes.forEach(r=>{var i;(i=r.arguments)!=null&&i.length?O.functionCall({unsafeName:`@${r.name}`,arguments_:r.arguments}).write(e):(e.write("@"),e.write(r.name)),e.write(" ")}),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),this.static_&&e.write("static "),e.write("func "),e.write(A(this.unsafeName)),e.write("("),this.parameters.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write(")"),this.async&&e.write(" async"),this.throws&&e.write(" throws"),e.write(" -> "),this.returnType.write(e),e.write(" "),this.body.write(e)}};l();u();var Me=class extends y{constructor(e){super();f(this,"internalPattern");this.internalPattern=e}write(e){switch(this.internalPattern.type){case"enum-case-value-binding":e.write("."),e.write(this.internalPattern.caseName),e.write("("),e.write(this.internalPattern.declarationType),e.write(" "),e.write(this.internalPattern.referenceName),e.write(")");break;default:b(this.internalPattern.type)}}static enumCaseValueBinding(e){return new this(v({type:"enum-case-value-binding"},e))}};l();u();var ce=class extends y{constructor({unsafeName:e,accessLevel:r,static_:i,declarationType:a,type:o,defaultValue:p,docs:c}){super();f(this,"unsafeName");f(this,"accessLevel");f(this,"static_");f(this,"declarationType");f(this,"type");f(this,"defaultValue");f(this,"docs");this.unsafeName=e,this.accessLevel=r,this.static_=i,this.declarationType=a,this.type=o,this.defaultValue=p,this.docs=c}write(e){this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),this.static_&&e.write("static "),e.write(this.declarationType),e.write(" "),H(this.unsafeName)?e.write(`\`${this.unsafeName}\``):e.write(this.unsafeName),e.write(": "),this.type.write(e),this.defaultValue!=null&&(e.write(" = "),this.defaultValue.write(e))}};l();u();var Ar={CaseIterable:"CaseIterable",Codable:"Codable",CodingKey:"CodingKey",Decodable:"Decodable",Encodable:"Encodable",Equatable:"Equatable",Error:"Error",Hashable:"Hashable",Sendable:"Sendable",MultipartFormDataConvertible:"MultipartFormDataConvertible"};l();u();var me=class extends y{constructor({attributes:e,accessLevel:r,name:i,conformances:a,properties:o,initializers:p,methods:c,nestedTypes:d,docs:x}){super();f(this,"attributes");f(this,"name");f(this,"accessLevel");f(this,"conformances");f(this,"properties");f(this,"initializers");f(this,"methods");f(this,"nestedTypes");f(this,"docs");this.attributes=e!=null?e:[],this.name=i,this.accessLevel=r,this.conformances=a!=null?a:[],this.properties=o!=null?o:[],this.initializers=p!=null?p:[],this.methods=c!=null?c:[],this.nestedTypes=d!=null?d:[],this.docs=x}write(e){this.docs!=null&&this.docs.write(e),this.attributes.forEach(c=>{var d;(d=c.arguments)!=null&&d.length?O.functionCall({unsafeName:`@${c.name}`,arguments_:c.arguments}).write(e):(e.write("@"),e.write(c.name)),e.write(" ")}),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write(`struct ${this.name}`),this.conformances.forEach((c,d)=>{d===0?e.write(": "):d>0&&e.write(", "),e.write(c)}),e.write(" {"),e.newLine(),e.indent();let r=this.properties.length>0,i=this.initializers.length>0,a=this.methods.length>0,o=this.nestedTypes.length>0;this.properties.forEach(c=>{c.write(e),e.newLine()});let p=r;i&&(p&&e.newLine(),this.initializers.forEach((c,d)=>{d>0&&e.newLine(),c.write(e),e.newLine()}),p=!0),a&&(p&&e.newLine(),this.methods.forEach((c,d)=>{d>0&&e.newLine(),c.write(e),e.newLine()}),p=!0),o&&(p&&e.newLine(),this.nestedTypes.forEach((c,d)=>{d>0&&e.newLine(),c.write(e),e.newLine()})),e.dedent(),e.write("}")}};l();u();var k={String:{type:"string",symbolName:"String"},Bool:{type:"bool",symbolName:"Bool"},Int:{type:"int",symbolName:"Int"},Int64:{type:"int64",symbolName:"Int64"},UInt:{type:"uint",symbolName:"UInt"},UInt64:{type:"uint64",symbolName:"UInt64"},Float:{type:"float",symbolName:"Float"},Double:{type:"double",symbolName:"Double"},Void:{type:"void",symbolName:"Void"},Any:{type:"any",symbolName:"Any"}},Fe={Data:{type:"data",symbolName:"Data"},Date:{type:"date",symbolName:"Date"},UUID:{type:"uuid",symbolName:"UUID"}},Oe=class n extends y{constructor(e){super();f(this,"internalType");this.internalType=e}get type(){return this.internalType.type}get nonOptionalType(){return this.internalType.type==="optional"?this.internalType.valueType.nonOptionalType:this.internalType.type}get nonNullableType(){return this.internalType.type==="nullable"?this.internalType.valueType.nonNullableType:this.internalType.type}get isOptional(){return this.internalType.type==="optional"}get isNullable(){return this.internalType.type==="nullable"}get isOptionalNullable(){return this.isOptional&&this.nonOptional().isNullable}nonOptional(){return n.nonOptional(this)}nonNullable(){return n.nonNullable(this)}equals(e){switch(this.internalType.type){case"string":case"bool":case"int":case"int64":case"uint":case"uint64":case"float":case"double":case"void":case"any":case"data":case"date":case"uuid":case"json-value":return this.internalType.type===e.internalType.type;case"tuple":{if(e.internalType.type!=="tuple"||this.internalType.elements.length!==e.internalType.elements.length)return!1;for(let r=0;r<this.internalType.elements.length;r++){let i=this.internalType.elements[r],a=e.internalType.elements[r];if(!i||!a||!i.equals(a))return!1}return!0}case"array":return e.internalType.type==="array"&&this.internalType.elementType.equals(e.internalType.elementType);case"dictionary":return e.internalType.type==="dictionary"&&this.internalType.keyType.equals(e.internalType.keyType)&&this.internalType.valueType.equals(e.internalType.valueType);case"optional":return e.internalType.type=="optional"&&this.internalType.valueType.equals(e.internalType.valueType);case"nullable":return e.internalType.type==="nullable"&&this.internalType.valueType.equals(e.internalType.valueType);case"custom":return e.internalType.type==="custom"&&this.internalType.name===e.internalType.name;case"existential-any":return e.internalType.type==="existential-any"&&this.internalType.protocolName===e.internalType.protocolName;case"calendar-date":return e.internalType.type==="calendar-date";default:b(this.internalType)}}toCaseName(){return n.toCaseName(this)}static toCaseName(e){switch(e.internalType.type){case"string":return"string";case"bool":return"bool";case"int":return"int";case"int64":return"int64";case"uint":return"uint";case"uint64":return"uint64";case"float":return"float";case"double":return"double";case"void":return"void";case"any":return"any";case"data":return"data";case"date":return"date";case"uuid":return"uuid";case"tuple":{let r=e.internalType.elements.map(i=>n.toCaseName(i)).join("And");return`tuple${q(r)}`}case"array":return`${Re(n.toCaseName(e.internalType.elementType))}Array`;case"dictionary":{let r=Re(n.toCaseName(e.internalType.keyType)),i=q(n.toCaseName(e.internalType.valueType));return`${r}To${i}Dictionary`}case"optional":return`optional${q(n.toCaseName(e.internalType.valueType))}`;case"nullable":return`nullable${q(n.toCaseName(e.internalType.valueType))}`;case"custom":return He(e.internalType.name);case"existential-any":return`any${q(e.internalType.protocolName)}`;case"calendar-date":return"calendarDate";case"json-value":return"json";default:b(e.internalType)}}write(e){switch(this.internalType.type){case"string":e.write("String");break;case"bool":e.write("Bool");break;case"int":e.write("Int");break;case"int64":e.write("Int64");break;case"uint":e.write("UInt");break;case"uint64":e.write("UInt64");break;case"float":e.write("Float");break;case"double":e.write("Double");break;case"void":e.write("Void");break;case"any":e.write("Any");break;case"data":e.write("Data");break;case"date":e.write("Date");break;case"uuid":e.write("UUID");break;case"tuple":e.write("("),this.internalType.elements.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write(")");break;case"array":e.write("["),this.internalType.elementType.write(e),e.write("]");break;case"dictionary":e.write("["),this.internalType.keyType.write(e),e.write(": "),this.internalType.valueType.write(e),e.write("]");break;case"optional":this.internalType.valueType.write(e),e.write("?");break;case"nullable":e.write("Nullable<"),this.internalType.valueType.write(e),e.write(">");break;case"custom":e.write(this.internalType.name);break;case"existential-any":e.write("any "),e.write(this.internalType.protocolName);break;case"calendar-date":e.write("CalendarDate");break;case"json-value":e.write("JSONValue");break;default:b(this.internalType)}}static primitiveSymbolNames(){return Ce(k).map(e=>e.symbolName)}static foundationSymbolNames(){return Ce(Fe).map(e=>e.symbolName)}static string(){return new this(k.String)}static bool(){return new this(k.Bool)}static int(){return new this(k.Int)}static uint(){return new this(k.UInt)}static uint64(){return new this(k.UInt64)}static int64(){return new this(k.Int64)}static float(){return new this(k.Float)}static double(){return new this(k.Double)}static void(){return new this(k.Void)}static any(){return new this(k.Any)}static data(){return new this(Fe.Data)}static date(){return new this(Fe.Date)}static uuid(){return new this(Fe.UUID)}static tuple(e){return new this({type:"tuple",elements:e})}static array(e){return new this({type:"array",elementType:e})}static dictionary(e,r){return new this({type:"dictionary",keyType:e,valueType:r})}static optional(e){return e.internalType.type==="optional"?e:new this({type:"optional",valueType:e})}static nullable(e){return new this({type:"nullable",valueType:e})}static nonOptional(e){return e.internalType.type==="optional"?n.nonOptional(e.internalType.valueType):e}static nonNullable(e){return e.internalType.type==="nullable"?n.nonNullable(e.internalType.valueType):e}static custom(e){return new this({type:"custom",name:e})}static existentialAny(e){return new this({type:"existential-any",protocolName:e})}static calendarDate(){return new this({type:"calendar-date"})}static jsonValue(){return new this({type:"json-value"})}};l();u();var Pe=class n extends y{constructor(e){super();f(this,"variant");this.variant=e}nonOptional(){return n.nonOptional(this)}nonNullable(){return n.nonNullable(this)}getReferenceIfSymbolType(){return this.variant.type==="symbol"?this.variant.symbol:null}write(e){let{variant:r}=this;switch(r.type){case"symbol":e.write(r.symbol);break;case"generic":{r.reference.write(e),r.arguments.length>0&&(e.write("<"),r.arguments.forEach((i,a)=>{i.write(e),a<r.arguments.length-1&&e.write(", ")}),e.write(">"));break}case"tuple":e.write("("),r.elements.forEach((i,a)=>{a>0&&e.write(", "),i.write(e)}),e.write(")");break;case"array":e.write("["),r.elementType.write(e),e.write("]");break;case"dictionary":e.write("["),r.keyType.write(e),e.write(": "),r.valueType.write(e),e.write("]");break;case"optional":r.valueType.write(e),e.write("?");break;case"nullable":e.write("Nullable<"),r.valueType.write(e),e.write(">");break;case"member-access":r.target.write(e),e.write("."),e.write(r.memberName);break;default:b(r)}}equals(e){switch(this.variant.type){case"symbol":return e.variant.type==="symbol"&&this.variant.symbol===e.variant.symbol;case"generic":return e.variant.type==="generic"&&this.variant.reference.equals(e.variant.reference)&&this.variant.arguments.every((r,i)=>e.variant.type==="generic"&&e.variant.arguments[i]&&r.equals(e.variant.arguments[i]));case"tuple":return e.variant.type==="tuple"&&this.variant.elements.every((r,i)=>e.variant.type==="tuple"&&e.variant.elements[i]&&r.equals(e.variant.elements[i]));case"array":return e.variant.type==="array"&&this.variant.elementType.equals(e.variant.elementType);case"dictionary":return e.variant.type==="dictionary"&&this.variant.keyType.equals(e.variant.keyType)&&this.variant.valueType.equals(e.variant.valueType);case"optional":return e.variant.type=="optional"&&this.variant.valueType.equals(e.variant.valueType);case"nullable":return e.variant.type==="nullable"&&this.variant.valueType.equals(e.variant.valueType);case"member-access":return e.variant.type==="member-access"&&this.variant.target.equals(e.variant.target)&&this.variant.memberName===e.variant.memberName;default:b(this.variant)}}static symbol(e){return new this({type:"symbol",symbol:e})}static generic(e,r){return new this({type:"generic",reference:e,arguments:r})}static tuple(e){return new this({type:"tuple",elements:e})}static array(e){return new this({type:"array",elementType:e})}static dictionary(e,r){return new this({type:"dictionary",keyType:e,valueType:r})}static optional(e){return e.variant.type==="optional"?e:new this({type:"optional",valueType:e})}static nullable(e){return e.variant.type==="nullable"?e:new this({type:"nullable",valueType:e})}static memberAccess(e,r){return new this({type:"member-access",target:e,memberName:r})}static nonOptional(e){return e.variant.type==="optional"?n.nonOptional(e.variant.valueType):e}static nonNullable(e){return e.variant.type==="nullable"?n.nonNullable(e.variant.valueType):e}static unqualifiedToSwiftType(e){return n.symbol(e)}static unqualifiedToFoundationType(e){return n.symbol(e)}};l();u();l();u();var h=class h{constructor(t,e,r){f(this,"id");f(this,"name");f(this,"shape");this.id=t,this.name=e,this.shape=r}static isSwiftSymbol(t){return h.SWIFT_SYMBOL_ID===t||t.startsWith(`${h.SWIFT_SYMBOL_ID}.`)}static isSwiftSymbolName(t){return t in h.swiftTypeSymbolsByName}static isFoundationSymbol(t){return h.FOUNDATION_SYMBOL_ID===t||t.startsWith(`${h.FOUNDATION_SYMBOL_ID}.`)}static isFoundationSymbolName(t){return t in h.foundationTypeSymbolsByName}static isCustomSymbol(t){return!h.isSwiftSymbol(t)&&!h.isFoundationSymbol(t)}static create(t,e,r){return new h(t,e,r)}static swiftType(t){return h.create(`${h.SWIFT_SYMBOL_ID}.${t}`,t,{type:"system"})}static foundationType(t){return h.create(`${h.FOUNDATION_SYMBOL_ID}.${t}`,t,{type:"system"})}get isSwiftSymbol(){return h.isSwiftSymbol(this.id)}get isFoundationSymbol(){return h.isFoundationSymbol(this.id)}get isCustomSymbol(){return h.isCustomSymbol(this.id)}};f(h,"SWIFT_SYMBOL_NAME","Swift"),f(h,"SWIFT_SYMBOL_ID",h.SWIFT_SYMBOL_NAME),f(h,"swiftTypeSymbolsByName",{String:h.swiftType("String"),Bool:h.swiftType("Bool"),Int:h.swiftType("Int"),Int64:h.swiftType("Int64"),UInt:h.swiftType("UInt"),UInt64:h.swiftType("UInt64"),Float:h.swiftType("Float"),Double:h.swiftType("Double"),Void:h.swiftType("Void"),Encoder:h.swiftType("Encoder"),Decoder:h.swiftType("Decoder"),Any:h.swiftType("Any")}),f(h,"swiftTypeSymbols",Object.values(h.swiftTypeSymbolsByName)),f(h,"FOUNDATION_SYMBOL_NAME","Foundation"),f(h,"FOUNDATION_SYMBOL_ID",h.FOUNDATION_SYMBOL_NAME),f(h,"foundationTypeSymbolsByName",{Data:h.foundationType("Data"),Date:h.foundationType("Date"),URLSession:h.foundationType("URLSession"),UUID:h.foundationType("UUID")}),f(h,"foundationTypeSymbols",Object.values(h.foundationTypeSymbolsByName));var S=h;l();u();l();u();l();u();l();u();var Ue=class{constructor(t,e){f(this,"id");f(this,"name");f(this,"childrenByName");this.id=t,this.name=e,this.childrenByName=new Map}get children(){return Array.from(this.childrenByName.values())}addChild(t){if(this.childrenByName.has(t.name))throw new Error(`A child with the name '${t.name}' already exists in module '${this.name}'.`);this.childrenByName.set(t.name,t)}getChildByName(t){return this.childrenByName.get(t)}},De=class extends Ue{constructor(e,r){super(e,r);f(this,"kind","module");f(this,"imports");f(this,"parent",null);this.imports=[]}addImport(e){this.imports.push(e)}get qualifiedPath(){return[this.name]}get qualifiedName(){return this.name}},qe=class extends Ue{constructor(e,r,i){super(r,e);f(this,"kind","type");f(this,"shape");f(this,"parent");this.parent=null,this.shape=i}getNearestModuleAncestorOrThrow(){let e=this.parent;for(;e!==null&&e.kind!=="module";)e=e.parent;return R(e,`No module ancestor found for type symbol '${this.id}'`),e}get qualifiedPath(){var e,r;return[...(r=(e=this.parent)==null?void 0:e.qualifiedPath)!=null?r:[],this.name]}get qualifiedName(){return this.qualifiedPath.join(".")}};var ye=class{constructor(){f(this,"symbolsById",new Map)}createModuleSymbol({symbolId:t,symbolName:e}){this.validateSymbolNotExists(t);let r=new De(t,e);return this.symbolsById.set(t,r),r}createTypeSymbol({symbolId:t,symbolName:e,shape:r}){this.validateSymbolNotExists(t);let i=new qe(e,t,r);return this.symbolsById.set(t,i),i}addImportRelation({clientSymbolId:t,importedSymbolId:e}){let r=this.getSymbolByIdOrThrow(t),i=this.getSymbolByIdOrThrow(e);if(r.kind!=="module"||i.kind!=="module")throw new Error(`Client module '${r.id}' and imported module '${i.id}' must both be module symbols.`);r.addImport(i)}nestSymbol({parentSymbolId:t,childSymbolId:e}){let r=this.getSymbolByIdOrThrow(t),i=this.getSymbolByIdOrThrow(e);r.addChild(i),i.parent=r}reference({fromSymbolId:t,targetSymbolId:e}){let r=this.getSymbolByIdOrThrow(t),i=this.getSymbolByIdOrThrow(e),a=i.qualifiedPath;for(let o=1;o<=a.length;o++){let p=a.slice(a.length-o),c=this.resolvePath(r,p);if((c==null?void 0:c.id)===i.id)return p.join(".")}return i.qualifiedName}resolveReference({fromSymbolId:t,reference:e}){let r=this.getSymbolByIdOrThrow(t),i=e.split(".").filter(a=>a.length>0);return this.resolvePath(r,i)}resolvePath(t,e){var p;let[r,...i]=e;if(r===void 0)return null;let a=this.resolveFirstSegment(t,r);if(a===null)return null;let o=a;for(let c=0;c<i.length;c++){let d=i[c];if(Ae(d),o=(p=o.getChildByName(d))!=null?p:null,o===null)return null}return o}resolveFirstSegment(t,e){let r=t;for(;r!==null;){let o=r.getChildByName(e);if(o)return o;r=r.parent}let i=t.kind==="module"?t:t.getNearestModuleAncestorOrThrow();if(i.name===e)return i;for(let o of i.imports)if(o.name===e)return o;let a=null;for(let o of i.imports){let p=o.getChildByName(e);if(p){if(a!=null&&a.id!==p.id)return null;a=p}}return a}getSymbolByIdOrThrow(t){let e=this.symbolsById.get(t);return Ae(e,`A symbol with the ID '${t}' was not found in the registry.`),e}getSymbolById(t){var e;return(e=this.symbolsById.get(t))!=null?e:null}validateSymbolNotExists(t){if(this.symbolsById.has(t))throw new Error(`A symbol with the ID '${t}' already exists in the registry.`)}};var We=class n{constructor(t,e,r){f(this,"graph");f(this,"swiftSymbol");f(this,"foundationSymbol");f(this,"registeredSourceModule");f(this,"registeredTestModule");this.graph=t,this.swiftSymbol=e,this.foundationSymbol=r,this.registeredSourceModule=null,this.registeredTestModule=null}static create(){let{graph:t,swiftSymbol:e,foundationSymbol:r}=n.createGraph();return new n(t,e,r)}static createGraph(){let t=new ye,e=()=>{let o=t.createModuleSymbol({symbolId:S.SWIFT_SYMBOL_ID,symbolName:S.SWIFT_SYMBOL_NAME});return S.swiftTypeSymbols.forEach(p=>{let c=t.createTypeSymbol({symbolId:p.id,symbolName:p.name,shape:{type:"system"}});t.nestSymbol({parentSymbolId:o.id,childSymbolId:c.id})}),o},r=()=>{let o=t.createModuleSymbol({symbolId:S.FOUNDATION_SYMBOL_ID,symbolName:S.FOUNDATION_SYMBOL_NAME});return S.foundationTypeSymbols.forEach(p=>{let c=t.createTypeSymbol({symbolId:p.id,symbolName:p.name,shape:{type:"system"}});t.nestSymbol({parentSymbolId:o.id,childSymbolId:c.id})}),o},i=e(),a=r();return{graph:t,swiftSymbol:i,foundationSymbol:a}}getRegisteredSourceModuleSymbolOrThrow(){return R(this.registeredSourceModule,"Module symbol not found."),S.create(this.registeredSourceModule.id,this.registeredSourceModule.name,{type:"other"})}getRegisteredTestModuleSymbolOrThrow(){return R(this.registeredTestModule,"Module symbol not found."),S.create(this.registeredTestModule.id,this.registeredTestModule.name,{type:"other"})}getSymbolByIdOrThrow(t){let e=this.graph.getSymbolById(t);return R(e,`Symbol with ID '${t}' not found in registry.`),S.create(e.id,e.name,e.kind==="type"?e.shape:{type:"other"})}registerSourceModule(t){let e=t,r=this.graph.createModuleSymbol({symbolId:e,symbolName:t});return r.addImport(this.swiftSymbol),r.addImport(this.foundationSymbol),this.registeredSourceModule=r,S.create(r.id,r.name,{type:"other"})}registerTestModule(t){let e=t,r=this.graph.createModuleSymbol({symbolId:e,symbolName:t});return r.addImport(this.swiftSymbol),r.addImport(this.foundationSymbol),R(this.registeredSourceModule,"Cannot register a test module before registering a source module."),r.addImport(this.registeredSourceModule),this.registeredTestModule=r,S.create(r.id,r.name,{type:"other"})}registerSourceModuleType(t,e){R(this.registeredSourceModule,"Cannot register a type before registering a module.");let r=this.inferSymbolIdForSourceModuleType(t),i=this.graph.createTypeSymbol({symbolId:r,symbolName:t,shape:e});return this.graph.nestSymbol({parentSymbolId:this.registeredSourceModule.id,childSymbolId:i.id}),S.create(i.id,i.name,e)}registerTestModuleType(t,e){R(this.registeredTestModule,"Cannot register a type before registering a module.");let r=this.inferSymbolIdForTestModuleType(t),i=this.graph.createTypeSymbol({symbolId:r,symbolName:t,shape:e});return this.graph.nestSymbol({parentSymbolId:this.registeredTestModule.id,childSymbolId:i.id}),S.create(i.id,i.name,e)}registerNestedType({parentSymbol:t,symbolName:e,shape:r}){let i=typeof t=="string"?t:t.id,a=this.inferSymbolIdForNestedType(i,e),o=this.graph.createTypeSymbol({symbolId:a,symbolName:e,shape:r});return this.graph.nestSymbol({parentSymbolId:i,childSymbolId:o.id}),S.create(o.id,o.name,r)}reference({fromSymbol:t,toSymbol:e}){let r=typeof t=="string"?t:t.id,i=typeof e=="string"?e:e.id;return this.graph.reference({fromSymbolId:r,targetSymbolId:i})}resolveReference({fromSymbol:t,reference:e}){let r=typeof t=="string"?t:t.id,i=this.graph.resolveReference({fromSymbolId:r,reference:e});return i?S.create(i.id,i.name,i.kind==="type"?i.shape:{type:"other"}):null}inferSymbolIdForSourceModuleType(t){return R(this.registeredSourceModule,"Cannot get symbol id for a type before registering a module."),`${this.registeredSourceModule.id}.${t}`}inferSymbolIdForTestModuleType(t){return R(this.registeredTestModule,"Cannot get symbol id for a type before registering a module."),`${this.registeredTestModule.id}.${t}`}inferSymbolIdForNestedType(t,e){return`${t}.${e}`}};function Aa(n){return new ee(n)}function Na(n){return new E(n)}function La(n){return new te(n)}function Ra(n){return new ne(n)}function Ca(n){return new ie(n)}function Ba(n){return new ae(n)}function ka(n){return new oe(n)}function Ma(n){return new se(n)}function Fa(n){return new le(n)}function Oa(n){return new ue(n)}function Pa(n){return new fe(n)}function Ua(n){return new pe(n)}function Da(n){return new ce(n)}function qa(n){return new me(n)}var Nr="client",Ze=class{constructor({context:t}){f(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e,options:r}){return this.buildCodeBlock({endpoint:t,snippetRequest:e,options:r})}generateSnippetSync({endpoint:t,request:e,options:r}){return this.buildCodeBlock({endpoint:t,snippetRequest:e,options:r})}buildCodeBlock({endpoint:t,snippetRequest:e,options:r}){return[this.generateImportFoundationStatement(),this.generateImportModuleStatement(),w.LineBreak.single(),this.generateMainFunctionDeclarationWithEndpointSnippet({endpoint:t,snippet:e}),w.LineBreak.single(),this.generateMainFunctionInvocationStatement()].map(a=>a.toString()).join("")}generateImportFoundationStatement(){return w.Statement.import("Foundation")}generateImportModuleStatement(){return w.Statement.import(this.context.getModuleName())}generateMainFunctionDeclarationWithEndpointSnippet({endpoint:t,snippet:e}){return w.Statement.functionDeclaration({unsafeName:"main",accessLevel:"private",async:!0,throws:!0,body:w.CodeBlock.withStatements([this.generateRootClientInitializationStatement({auth:t.auth,snippet:e}),w.LineBreak.single(),this.generateEndpointMethodCallStatement({endpoint:t,snippet:e})])})}generateRootClientInitializationStatement({auth:t,snippet:e,additionalArgs:r=[]}){let i=[],a=this.getRootClientBaseURLArg({snippet:e});a!=null&&i.push(a);let o=t?this.getRootClientAuthArgs({auth:t,snippet:e}):[];i.push(...o),i.push(...r);let p=i.filter(c=>!c.value.isNop());return w.Statement.constantDeclaration({unsafeName:Nr,value:w.Expression.classInitialization({unsafeName:this.context.getRootClientClassName(),arguments_:p,multiline:p.length>1?!0:void 0})})}getRootClientBaseURLArg({snippet:t}){var e;return t.baseURL!=null&&t.environment!=null?(this.context.errors.add({severity:W.Critical,message:"Cannot specify both baseUrl and environment options"}),null):t.baseURL!=null?((e=this.context.ir.environments)==null?void 0:e.environments.type)==="multipleBaseUrls"?null:w.functionArgument({label:"baseURL",value:w.Expression.stringLiteral(t.baseURL)}):null}getRootClientAuthArgs({auth:t,snippet:e}){let r=[],i=e.auth;if(i==null)return r;switch(t.type){case"basic":if(i.type!=="basic"){this.context.errors.add({severity:W.Critical,message:this.context.newAuthMismatchError({auth:t,values:i}).message});break}r.push(w.functionArgument({label:t.username.camelCase.unsafeName,value:w.Expression.stringLiteral(i.username)}),w.functionArgument({label:t.password.camelCase.unsafeName,value:w.Expression.stringLiteral(i.password)}));break;case"bearer":if(i.type!=="bearer")return this.context.errors.add({severity:W.Critical,message:this.context.newAuthMismatchError({auth:t,values:i}).message}),r;r.push(w.functionArgument({label:t.token.camelCase.unsafeName,value:w.Expression.stringLiteral(i.token)}));break;case"header":if(i.type!=="header")return this.context.errors.add({severity:W.Critical,message:this.context.newAuthMismatchError({auth:t,values:i}).message}),r;r.push(w.functionArgument({label:t.header.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:i.value})}));break;case"oauth":return i.type!=="oauth"&&this.context.errors.add({severity:W.Critical,message:this.context.newAuthMismatchError({auth:t,values:i}).message}),r;case"inferred":return i.type!=="inferred"&&this.context.errors.add({severity:W.Critical,message:this.context.newAuthMismatchError({auth:t,values:i}).message}),r;default:b(t)}return r}generateEndpointMethodCallStatement({endpoint:t,snippet:e}){return w.Statement.discardAssignment(this.generateEndpointMethodCallExpression({endpoint:t,snippet:e}))}generateEndpointMethodCallExpression({endpoint:t,snippet:e}){let r=this.getMethodArguments({endpoint:t,snippet:e}).filter(i=>!i.value.isNop());return w.Expression.try(w.Expression.await(w.Expression.methodCall({target:w.Expression.rawValue(Nr),methodName:this.getMethodName({endpoint:t}),arguments_:r,multiline:r.length>1?!0:void 0})))}generateMainFunctionInvocationStatement(){return w.Statement.expressionStatement(w.Expression.try(w.Expression.await(w.Expression.functionCall({unsafeName:"main"}))))}getMethodName({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${`${t.declaration.fernFilepath.allParts.map(r=>r.camelCase.unsafeName).join(".")}`}.${t.declaration.name.camelCase.unsafeName}`:t.declaration.name.camelCase.unsafeName}getMethodArguments({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:b(t.request)}}getMethodArgsForInlinedRequest({request:t,snippet:e}){let r=[];this.context.errors.scope(_.PathParameters);let i=[];t.pathParameters!=null&&i.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),r.push(...i),this.context.errors.scope(_.QueryParameters);let a=[];t.queryParameters!=null&&a.push(...this.getQueryParameters({namedParameters:t.queryParameters,snippet:e})),this.context.errors.unscope(),r.push(...a),this.context.errors.scope(_.RequestBody);let o=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),t.body!=null&&r.push(w.functionArgument({label:"request",value:this.getInlinedRequestArg({request:t,snippet:e,filePropertyInfo:o})})),r}getPathParameters({namedParameters:t,snippet:e}){var r;return this.context.getExampleObjectProperties({parameters:t,snippetObject:(r=e.pathParameters)!=null?r:{}}).map(i=>w.functionArgument({label:i.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert(i)}))}getQueryParameters({namedParameters:t,snippet:e}){var r;return this.context.getExampleObjectProperties({parameters:t,snippetObject:(r=e.queryParameters)!=null?r:{}}).map(i=>w.functionArgument({label:i.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert(i)}))}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,filePropertyInfo:r}){this.context.errors.scope(_.RequestBody);let i=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:r}):[];this.context.errors.unscope();let a=i.filter(o=>!o.value.isNop());return w.Expression.contextualMethodCall({methodName:"init",arguments_:a,multiline:a.length>1?!0:void 0})}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"fileUpload":return[...r.fileFields,...r.bodyPropertyFields];case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:t,value:e})];default:b(t)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){return this.context.getExampleObjectProperties({parameters:t,snippetObject:e}).map(r=>w.functionArgument({label:r.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert(r)}))}getReferencedRequestBodyPropertyObjectField({body:t,value:e}){return w.functionArgument({label:t.bodyKey.camelCase.unsafeName,value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})})}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:b(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:W.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),w.Expression.dataLiteral("data")):w.Expression.dataLiteral(t)}getMethodArgsForBodyRequest({request:t,snippet:e}){var a,o;let r=[];this.context.errors.scope(_.PathParameters);let i=[...(a=this.context.ir.pathParameters)!=null?a:[],...(o=t.pathParameters)!=null?o:[]];return i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(_.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return w.functionArgument({label:"request",value:this.getBytesBodyRequestArg({value:e})});case"typeReference":return w.functionArgument({label:"request",value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e})});default:b(t)}}};0&&(module.exports={EndpointSnippetGenerator});
2
20
  /*! Bundled license information:
3
21
 
4
22
  @esbuild-plugins/node-globals-polyfill/Buffer.js:
@@ -8,5 +26,16 @@
8
26
  * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
9
27
  * @license MIT
10
28
  *)
29
+
30
+ lodash-es/lodash.js:
31
+ (**
32
+ * @license
33
+ * Lodash (Custom Build) <https://lodash.com/>
34
+ * Build: `lodash modularize exports="es" -o ./`
35
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
36
+ * Released under MIT license <https://lodash.com/license>
37
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
38
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
39
+ *)
11
40
  */
12
41
  //# sourceMappingURL=EndpointSnippetGenerator.cjs.map