@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 X=Object.defineProperty,Hr=Object.defineProperties,Zr=Object.getOwnPropertyDescriptor,Jr=Object.getOwnPropertyDescriptors,Kr=Object.getOwnPropertyNames,K=Object.getOwnPropertySymbols;var pe=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable;var fe=(t,e,r)=>e in t?X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ve=(t,e)=>{for(var r in e||(e={}))pe.call(e,r)&&fe(t,r,e[r]);if(K)for(var r of K(e))we.call(e,r)&&fe(t,r,e[r]);return t},Ee=(t,e)=>Hr(t,Jr(e));var Re=t=>typeof t=="symbol"?t:t+"",Te=(t,e)=>{var r={};for(var n in t)pe.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&K)for(var n of K(t))e.indexOf(n)<0&&we.call(t,n)&&(r[n]=t[n]);return r};var le=(t,e)=>()=>(t&&(e=t(t=0)),e);var Xr=(t,e)=>{for(var r in e)X(t,r,{get:e[r],enumerable:!0})},Qr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Kr(e))!pe.call(t,o)&&o!==r&&X(t,o,{get:()=>e[o],enumerable:!(n=Zr(e,o))||n.enumerable});return t};var et=t=>Qr(X({},"__esModule",{value:!0}),t);var g=(t,e,r)=>fe(t,typeof e!="symbol"?e+"":e,r);function be(){throw new Error("setTimeout has not been defined")}function Ie(){throw new Error("clearTimeout has not been defined")}function Se(t){if(B===setTimeout)return setTimeout(t,0);if((B===be||!B)&&setTimeout)return B=setTimeout,setTimeout(t,0);try{return B(t,0)}catch(e){try{return B.call(null,t,0)}catch(r){return B.call(this,t,0)}}}function rt(t){if(M===clearTimeout)return clearTimeout(t);if((M===Ie||!M)&&clearTimeout)return M=clearTimeout,clearTimeout(t);try{return M(t)}catch(e){try{return M.call(null,t)}catch(r){return M.call(this,t)}}}function tt(){!V||!_||(V=!1,_.length?C=_.concat(C):Q=-1,C.length&&Ue())}function Ue(){if(!V){var t=Se(tt);V=!0;for(var e=C.length;e;){for(_=C,C=[];++Q<e;)_&&_[Q].run();Q=-1,e=C.length}_=null,V=!1,rt(t)}}function nt(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];C.push(new Ce(t,e)),C.length===1&&!V&&Se(Ue)}function Ce(t,e){this.fun=t,this.array=e}function L(){}function vt(t){throw new Error("process.binding is not supported")}function Et(){return"/"}function Rt(t){throw new Error("process.chdir is not supported")}function Tt(){return 0}function bt(t){var e=At.call(O)*.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 St(){var t=new Date,e=t-It;return e/1e3}var B,M,C,V,_,Q,ot,it,at,st,ut,ft,pt,lt,ct,mt,dt,xt,ht,yt,gt,wt,O,At,It,m,Ae,u=le(()=>{"use strict";B=be,M=Ie;typeof globalThis.setTimeout=="function"&&(B=setTimeout);typeof globalThis.clearTimeout=="function"&&(M=clearTimeout);C=[],V=!1,Q=-1;Ce.prototype.run=function(){this.fun.apply(null,this.array)};ot="browser",it="browser",at=!0,st={},ut=[],ft="",pt={},lt={},ct={};mt=L,dt=L,xt=L,ht=L,yt=L,gt=L,wt=L;O=globalThis.performance||{},At=O.now||O.mozNow||O.msNow||O.oNow||O.webkitNow||function(){return new Date().getTime()};It=new Date;m={nextTick:nt,title:ot,browser:at,env:st,argv:ut,version:ft,versions:pt,on:mt,addListener:dt,once:xt,off:ht,removeListener:yt,removeAllListeners:gt,emit:wt,binding:vt,cwd:Et,chdir:Rt,umask:Tt,hrtime:bt,platform:it,release:lt,config:ct,uptime:St},Ae={};Object.keys(Ae).forEach(t=>{let e=t.split("."),r=m;for(let n=0;n<e.length;n++){let o=e[n];n===e.length-1?r[o]=Ae[t]:r=r[o]||(r[o]={})}})});function Me(){me=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)S[e]=t[e],b[t.charCodeAt(e)]=e;b[45]=62,b[95]=63}function Ct(t){me||Me();var e,r,n,o,i,a,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i=t[p-2]==="="?2:t[p-1]==="="?1:0,a=new Ut(p*3/4-i),n=i>0?p-4:p;var c=0;for(e=0,r=0;e<n;e+=4,r+=3)o=b[t.charCodeAt(e)]<<18|b[t.charCodeAt(e+1)]<<12|b[t.charCodeAt(e+2)]<<6|b[t.charCodeAt(e+3)],a[c++]=o>>16&255,a[c++]=o>>8&255,a[c++]=o&255;return i===2?(o=b[t.charCodeAt(e)]<<2|b[t.charCodeAt(e+1)]>>4,a[c++]=o&255):i===1&&(o=b[t.charCodeAt(e)]<<10|b[t.charCodeAt(e+1)]<<4|b[t.charCodeAt(e+2)]>>2,a[c++]=o>>8&255,a[c++]=o&255),a}function Nt(t){return S[t>>18&63]+S[t>>12&63]+S[t>>6&63]+S[t&63]}function Pt(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16)+(t[i+1]<<8)+t[i+2],o.push(Nt(n));return o.join("")}function Ne(t){me||Me();for(var e,r=t.length,n=r%3,o="",i=[],a=16383,p=0,c=r-n;p<c;p+=a)i.push(Pt(t,p,p+a>c?c:p+a));return n===1?(e=t[r-1],o+=S[e>>2],o+=S[e<<4&63],o+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],o+=S[e>>10],o+=S[e>>4&63],o+=S[e<<2&63],o+="="),i.push(o),i.join("")}function ee(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function N(t,e){if(ee()<e)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=s.prototype):(t===null&&(t=new s(e)),t.length=e),t}function s(t,e,r){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(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 de(this,t)}return De(this,t,e,r)}function De(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?Dt(t,e,r,n):typeof e=="string"?Mt(t,e,r):_t(t,e)}function _e(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 Bt(t,e,r,n){return _e(e),e<=0?N(t,e):r!==void 0?typeof n=="string"?N(t,e).fill(r,n):N(t,e).fill(r):N(t,e)}function de(t,e){if(_e(e),t=N(t,e<0?0:xe(e)|0),!s.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function Mt(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!s.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=Le(e,r)|0;t=N(t,n);var o=t.write(e,r);return o!==n&&(t=t.slice(0,o)),t}function ce(t,e){var r=e.length<0?0:xe(e.length)|0;t=N(t,r);for(var n=0;n<r;n+=1)t[n]=e[n]&255;return t}function Dt(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),s.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=s.prototype):t=ce(t,e),t}function _t(t,e){if(U(e)){var r=xe(e.length)|0;return t=N(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"||en(e.length)?N(t,0):ce(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return ce(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function xe(t){if(t>=ee())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ee().toString(16)+" bytes");return t|0}function U(t){return!!(t!=null&&t._isBuffer)}function Le(t,e){if(U(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 re(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 re(t).length;e=(""+e).toLowerCase(),n=!0}}function Lt(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 $t(this,e,r);case"utf8":case"utf-8":return Oe(this,e,r);case"ascii":return zt(this,e,r);case"latin1":case"binary":return Gt(this,e,r);case"base64":return jt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qt(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function F(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Fe(t,e,r,n,o){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=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),U(e))return e.length===0?-1:Pe(t,e,r,n,o);if(typeof e=="number")return e=e&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Pe(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Pe(t,e,r,n,o){var i=1,a=t.length,p=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;i=2,a/=2,p/=2,r/=2}function c(A,k){return i===1?A[k]:A.readUInt16BE(k*i)}var x;if(o){var h=-1;for(x=r;x<a;x++)if(c(t,x)===c(e,h===-1?0:x-h)){if(h===-1&&(h=x),x-h+1===p)return h*i}else h!==-1&&(x-=x-h),h=-1}else for(r+p>a&&(r=a-p),x=r;x>=0;x--){for(var d=!0,I=0;I<p;I++)if(c(t,x+I)!==c(e,I)){d=!1;break}if(d)return x}return-1}function Ft(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var i=e.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var p=parseInt(e.substr(a*2,2),16);if(isNaN(p))return a;t[r+a]=p}return a}function kt(t,e,r,n){return oe(re(e,t.length-r),t,r,n)}function ke(t,e,r,n){return oe(Xt(e),t,r,n)}function Ot(t,e,r,n){return ke(t,e,r,n)}function Vt(t,e,r,n){return oe(Ye(e),t,r,n)}function Wt(t,e,r,n){return oe(Qt(e,t.length-r),t,r,n)}function jt(t,e,r){return e===0&&r===t.length?Ne(t):Ne(t.slice(e,r))}function Oe(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i=t[o],a=null,p=i>239?4:i>223?3:i>191?2:1;if(o+p<=r){var c,x,h,d;switch(p){case 1:i<128&&(a=i);break;case 2:c=t[o+1],(c&192)===128&&(d=(i&31)<<6|c&63,d>127&&(a=d));break;case 3:c=t[o+1],x=t[o+2],(c&192)===128&&(x&192)===128&&(d=(i&15)<<12|(c&63)<<6|x&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:c=t[o+1],x=t[o+2],h=t[o+3],(c&192)===128&&(x&192)===128&&(h&192)===128&&(d=(i&15)<<18|(c&63)<<12|(x&63)<<6|h&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,p=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),o+=p}return Yt(n)}function Yt(t){var e=t.length;if(e<=Be)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Be));return r}function zt(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]&127);return n}function Gt(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function $t(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=Kt(t[i]);return o}function qt(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}function E(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 T(t,e,r,n,o,i){if(!U(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function te(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}function ne(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>(n?o:3-o)*8&255}function Ve(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function We(t,e,r,n,o){return o||Ve(t,e,r,4,34028234663852886e22,-34028234663852886e22),Ge(t,e,r,n,23,4),r+4}function je(t,e,r,n,o){return o||Ve(t,e,r,8,17976931348623157e292,-17976931348623157e292),Ge(t,e,r,n,52,8),r+8}function Zt(t){if(t=Jt(t).replace(Ht,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Jt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Kt(t){return t<16?"0"+t.toString(16):t.toString(16)}function re(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}function Xt(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Qt(t,e){for(var r,n,o,i=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function Ye(t){return Ct(Zt(t))}function oe(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function en(t){return t!==t}function rn(t){return t!=null&&(!!t._isBuffer||ze(t)||tn(t))}function ze(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function tn(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ze(t.slice(0,0))}function ie(t,e,r,n,o){var i,a,p=o*8-n-1,c=(1<<p)-1,x=c>>1,h=-7,d=r?o-1:0,I=r?-1:1,A=t[e+d];for(d+=I,i=A&(1<<-h)-1,A>>=-h,h+=p;h>0;i=i*256+t[e+d],d+=I,h-=8);for(a=i&(1<<-h)-1,i>>=-h,h+=n;h>0;a=a*256+t[e+d],d+=I,h-=8);if(i===0)i=1-x;else{if(i===c)return a?NaN:(A?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-x}return(A?-1:1)*a*Math.pow(2,i-n)}function Ge(t,e,r,n,o,i){var a,p,c,x=i*8-o-1,h=(1<<x)-1,d=h>>1,I=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:i-1,k=n?1:-1,qr=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+d>=1?e+=I/c:e+=I*Math.pow(2,1-d),e*c>=2&&(a++,c/=2),a+d>=h?(p=0,a=h):a+d>=1?(p=(e*c-1)*Math.pow(2,o),a=a+d):(p=e*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[r+A]=p&255,A+=k,p/=256,o-=8);for(a=a<<o|p,x+=o;x>0;t[r+A]=a&255,A+=k,a/=256,x-=8);t[r+A-k]|=qr*128}var S,b,Ut,me,Be,Ht,$e=le(()=>{"use strict";u();f();S=[],b=[],Ut=typeof Uint8Array!="undefined"?Uint8Array:Array,me=!1;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};s.from=function(t,e,r){return De(null,t,e,r)};s.kMaxLength=ee();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&s[Symbol.species]);s.alloc=function(t,e,r){return Bt(null,t,e,r)};s.allocUnsafe=function(t){return de(null,t)};s.allocUnsafeSlow=function(t){return de(null,t)};s.isBuffer=rn;s.compare=function(e,r){if(!U(e)||!U(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,o=r.length,i=0,a=Math.min(n,o);i<a;++i)if(e[i]!==r[i]){n=e[i],o=r[i];break}return n<o?-1:o<n?1:0};s.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}};s.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var o=s.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!U(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};s.byteLength=Le;s.prototype._isBuffer=!0;s.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)F(this,r,r+1);return this};s.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)F(this,r,r+3),F(this,r+1,r+2);return this};s.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)F(this,r,r+7),F(this,r+1,r+6),F(this,r+2,r+5),F(this,r+3,r+4);return this};s.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?Oe(this,0,e):Lt.apply(this,arguments)};s.prototype.equals=function(e){if(!U(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0};s.prototype.compare=function(e,r,n,o,i){if(!U(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),r<0||n>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===e)return 0;for(var a=i-o,p=n-r,c=Math.min(a,p),x=this.slice(o,i),h=e.slice(r,n),d=0;d<c;++d)if(x[d]!==h[d]){a=x[d],p=h[d];break}return a<p?-1:p<a?1:0};s.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};s.prototype.indexOf=function(e,r,n){return Fe(this,e,r,n,!0)};s.prototype.lastIndexOf=function(e,r,n){return Fe(this,e,r,n,!1)};s.prototype.write=function(e,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-r;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var a=!1;;)switch(o){case"hex":return Ft(this,e,r,n);case"utf8":case"utf-8":return kt(this,e,r,n);case"ascii":return ke(this,e,r,n);case"latin1":case"binary":return Ot(this,e,r,n);case"base64":return Vt(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wt(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Be=4096;s.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 o;if(s.TYPED_ARRAY_SUPPORT)o=this.subarray(e,r),o.__proto__=s.prototype;else{var i=r-e;o=new s(i,void 0);for(var a=0;a<i;++a)o[a]=this[a+e]}return o};s.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||E(e,r,this.length);for(var o=this[e],i=1,a=0;++a<r&&(i*=256);)o+=this[e+a]*i;return o};s.prototype.readUIntBE=function(e,r,n){e=e|0,r=r|0,n||E(e,r,this.length);for(var o=this[e+--r],i=1;r>0&&(i*=256);)o+=this[e+--r]*i;return o};s.prototype.readUInt8=function(e,r){return r||E(e,1,this.length),this[e]};s.prototype.readUInt16LE=function(e,r){return r||E(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUInt16BE=function(e,r){return r||E(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUInt32LE=function(e,r){return r||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};s.prototype.readUInt32BE=function(e,r){return r||E(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};s.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||E(e,r,this.length);for(var o=this[e],i=1,a=0;++a<r&&(i*=256);)o+=this[e+a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o};s.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||E(e,r,this.length);for(var o=r,i=1,a=this[e+--o];o>0&&(i*=256);)a+=this[e+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*r)),a};s.prototype.readInt8=function(e,r){return r||E(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,r){r||E(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(e,r){r||E(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(e,r){return r||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};s.prototype.readInt32BE=function(e,r){return r||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};s.prototype.readFloatLE=function(e,r){return r||E(e,4,this.length),ie(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,r){return r||E(e,4,this.length),ie(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,r){return r||E(e,8,this.length),ie(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,r){return r||E(e,8,this.length),ie(this,e,!1,52,8)};s.prototype.writeUIntLE=function(e,r,n,o){if(e=+e,r=r|0,n=n|0,!o){var i=Math.pow(2,8*n)-1;T(this,e,r,n,i,0)}var a=1,p=0;for(this[r]=e&255;++p<n&&(a*=256);)this[r+p]=e/a&255;return r+n};s.prototype.writeUIntBE=function(e,r,n,o){if(e=+e,r=r|0,n=n|0,!o){var i=Math.pow(2,8*n)-1;T(this,e,r,n,i,0)}var a=n-1,p=1;for(this[r+a]=e&255;--a>=0&&(p*=256);)this[r+a]=e/p&255;return r+n};s.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};s.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):te(this,e,r,!0),r+2};s.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):te(this,e,r,!1),r+2};s.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):ne(this,e,r,!0),r+4};s.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):ne(this,e,r,!1),r+4};s.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r|0,!o){var i=Math.pow(2,8*n-1);T(this,e,r,n,i-1,-i)}var a=0,p=1,c=0;for(this[r]=e&255;++a<n&&(p*=256);)e<0&&c===0&&this[r+a-1]!==0&&(c=1),this[r+a]=(e/p>>0)-c&255;return r+n};s.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r|0,!o){var i=Math.pow(2,8*n-1);T(this,e,r,n,i-1,-i)}var a=n-1,p=1,c=0;for(this[r+a]=e&255;--a>=0&&(p*=256);)e<0&&c===0&&this[r+a+1]!==0&&(c=1),this[r+a]=(e/p>>0)-c&255;return r+n};s.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1};s.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):te(this,e,r,!0),r+2};s.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):te(this,e,r,!1),r+2};s.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):ne(this,e,r,!0),r+4};s.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):ne(this,e,r,!1),r+4};s.prototype.writeFloatLE=function(e,r,n){return We(this,e,r,!0,n)};s.prototype.writeFloatBE=function(e,r,n){return We(this,e,r,!1,n)};s.prototype.writeDoubleLE=function(e,r,n){return je(this,e,r,!0,n)};s.prototype.writeDoubleBE=function(e,r,n){return je(this,e,r,!1,n)};s.prototype.copy=function(e,r,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<n&&(o=n),o===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(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);var i=o-n,a;if(this===e&&n<r&&r<o)for(a=i-1;a>=0;--a)e[a+r]=this[a+n];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a<i;++a)e[a+r]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+i),r);return i};s.prototype.fill=function(e,r,n,o){if(typeof e=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),e.length===1){var i=e.charCodeAt(0);i<256&&(e=i)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}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 p=U(e)?e:re(new s(e,o).toString()),c=p.length;for(a=0;a<n-r;++a)this[a+r]=p[a%c]}return this};Ht=/[^+\/0-9A-Za-z-_]/g});var f=le(()=>{"use strict";$e()});var zo={};Xr(zo,{DynamicSnippetsGeneratorContext:()=>ge});module.exports=et(zo);u();f();u();f();u();f();function v(t){throw new Error("Unexpected value: "+JSON.stringify(t))}u();f();u();f();u();f();u();f();u();f();u();f();var nn=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,qe=nn;var on=typeof self=="object"&&self&&self.Object===Object&&self,an=qe||on||Function("return this")(),He=an;var sn=He.Symbol,P=sn;u();f();var Ze=Object.prototype,un=Ze.hasOwnProperty,fn=Ze.toString,Y=P?P.toStringTag:void 0;function pn(t){var e=un.call(t,Y),r=t[Y];try{t[Y]=void 0;var n=!0}catch(i){}var o=fn.call(t);return n&&(e?t[Y]=r:delete t[Y]),o}var Je=pn;u();f();var ln=Object.prototype,cn=ln.toString;function mn(t){return cn.call(t)}var Ke=mn;var dn="[object Null]",xn="[object Undefined]",Xe=P?P.toStringTag:void 0;function hn(t){return t==null?t===void 0?xn:dn:Xe&&Xe in Object(t)?Je(t):Ke(t)}var Qe=hn;u();f();function yn(t){return t!=null&&typeof t=="object"}var er=yn;var gn="[object Symbol]";function wn(t){return typeof t=="symbol"||er(t)&&Qe(t)==gn}var rr=wn;u();f();u();f();function vn(t,e){for(var r=-1,n=t==null?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}var tr=vn;u();f();var En=Array.isArray,nr=En;var Rn=1/0,or=P?P.prototype:void 0,ir=or?or.toString:void 0;function ar(t){if(typeof t=="string")return t;if(nr(t))return tr(t,ar)+"";if(rr(t))return ir?ir.call(t):"";var e=t+"";return e=="0"&&1/t==-Rn?"-0":e}var sr=ar;u();f();function Tn(t){return t==null?"":sr(t)}var D=Tn;u();f();u();f();u();f();u();f();u();f();u();f();function An(t,e,r){var n=-1,o=t.length;e<0&&(e=-e>o?0:o+e),r=r>o?o:r,r<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n<o;)i[n]=t[n+e];return i}var ur=An;function bn(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:ur(t,e,r)}var fr=bn;u();f();var In="\\ud800-\\udfff",Sn="\\u0300-\\u036f",Un="\\ufe20-\\ufe2f",Cn="\\u20d0-\\u20ff",Nn=Sn+Un+Cn,Pn="\\ufe0e\\ufe0f",Bn="\\u200d",Mn=RegExp("["+Bn+In+Nn+Pn+"]");function Dn(t){return Mn.test(t)}var ae=Dn;u();f();u();f();function _n(t){return t.split("")}var pr=_n;u();f();var lr="\\ud800-\\udfff",Ln="\\u0300-\\u036f",Fn="\\ufe20-\\ufe2f",kn="\\u20d0-\\u20ff",On=Ln+Fn+kn,Vn="\\ufe0e\\ufe0f",Wn="["+lr+"]",he="["+On+"]",ye="\\ud83c[\\udffb-\\udfff]",jn="(?:"+he+"|"+ye+")",cr="[^"+lr+"]",mr="(?:\\ud83c[\\udde6-\\uddff]){2}",dr="[\\ud800-\\udbff][\\udc00-\\udfff]",Yn="\\u200d",xr=jn+"?",hr="["+Vn+"]?",zn="(?:"+Yn+"(?:"+[cr,mr,dr].join("|")+")"+hr+xr+")*",Gn=hr+xr+zn,$n="(?:"+[cr+he+"?",he,mr,dr,Wn].join("|")+")",qn=RegExp(ye+"(?="+ye+")|"+$n+Gn,"g");function Hn(t){return t.match(qn)||[]}var yr=Hn;function Zn(t){return ae(t)?yr(t):pr(t)}var gr=Zn;function Jn(t){return function(e){e=D(e);var r=ae(e)?gr(e):void 0,n=r?r[0]:e.charAt(0),o=r?fr(r,1).join(""):e.slice(1);return n[t]()+o}}var wr=Jn;var Kn=wr("toUpperCase"),z=Kn;function Xn(t){return z(D(t).toLowerCase())}var vr=Xn;u();f();u();f();function Qn(t,e,r,n){var o=-1,i=t==null?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}var Er=Qn;u();f();u();f();u();f();function eo(t){return function(e){return t==null?void 0:t[e]}}var Rr=eo;var ro={\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"},to=Rr(ro),Tr=to;var no=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,oo="\\u0300-\\u036f",io="\\ufe20-\\ufe2f",ao="\\u20d0-\\u20ff",so=oo+io+ao,uo="["+so+"]",fo=RegExp(uo,"g");function po(t){return t=D(t),t&&t.replace(no,Tr).replace(fo,"")}var Ar=po;u();f();u();f();var lo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function co(t){return t.match(lo)||[]}var br=co;u();f();var mo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function xo(t){return mo.test(t)}var Ir=xo;u();f();var Pr="\\ud800-\\udfff",ho="\\u0300-\\u036f",yo="\\ufe20-\\ufe2f",go="\\u20d0-\\u20ff",wo=ho+yo+go,Br="\\u2700-\\u27bf",Mr="a-z\\xdf-\\xf6\\xf8-\\xff",vo="\\xac\\xb1\\xd7\\xf7",Eo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ro="\\u2000-\\u206f",To=" \\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",Dr="A-Z\\xc0-\\xd6\\xd8-\\xde",Ao="\\ufe0e\\ufe0f",_r=vo+Eo+Ro+To,Lr="['\u2019]",Sr="["+_r+"]",bo="["+wo+"]",Fr="\\d+",Io="["+Br+"]",kr="["+Mr+"]",Or="[^"+Pr+_r+Fr+Br+Mr+Dr+"]",So="\\ud83c[\\udffb-\\udfff]",Uo="(?:"+bo+"|"+So+")",Co="[^"+Pr+"]",Vr="(?:\\ud83c[\\udde6-\\uddff]){2}",Wr="[\\ud800-\\udbff][\\udc00-\\udfff]",W="["+Dr+"]",No="\\u200d",Ur="(?:"+kr+"|"+Or+")",Po="(?:"+W+"|"+Or+")",Cr="(?:"+Lr+"(?:d|ll|m|re|s|t|ve))?",Nr="(?:"+Lr+"(?:D|LL|M|RE|S|T|VE))?",jr=Uo+"?",Yr="["+Ao+"]?",Bo="(?:"+No+"(?:"+[Co,Vr,Wr].join("|")+")"+Yr+jr+")*",Mo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Do="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",_o=Yr+jr+Bo,Lo="(?:"+[Io,Vr,Wr].join("|")+")"+_o,Fo=RegExp([W+"?"+kr+"+"+Cr+"(?="+[Sr,W,"$"].join("|")+")",Po+"+"+Nr+"(?="+[Sr,W+Ur,"$"].join("|")+")",W+"?"+Ur+"+"+Cr,W+"+"+Nr,Do,Mo,Fr,Lo].join("|"),"g");function ko(t){return t.match(Fo)||[]}var zr=ko;function Oo(t,e,r){return t=D(t),e=r?void 0:e,e===void 0?Ir(t)?zr(t):br(t):t.match(e)||[]}var Gr=Oo;var Vo="['\u2019]",Wo=RegExp(Vo,"g");function jo(t){return function(e){return Er(Gr(Ar(e).replace(Wo,"")),t,"")}}var $r=jo;var Yo=$r(function(t,e,r){return e=e.toLowerCase(),t+(r?vr(e):e)}),G=Yo;u();f();function $(t){return Object.keys(t)}u();f();u();f();u();f();u();f();var q=class{constructor(){g(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let n=e.match(this.REFERENCE_REGEX);if(!(n==null||n[1]==null||n[2]==null))return{method:n[1],path:n[2]}}};u();f();var y={Critical:"CRITICAL",Warning:"WARNING"},H=class t{constructor(){g(this,"errors");g(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(Ee(ve({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new t;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let n of e){if(typeof n=="string"){r.push(n);continue}r[r.length-1]+=`[${n.index}]`}return r}};var Z=class{constructor({ir:e,config:r,options:n={}}){g(this,"config");g(this,"options");g(this,"errors");g(this,"_ir");g(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.options=n,this.errors=new H,this.httpEndpointReferenceParser=new q}associateQueryParametersByWireValue({parameters:e,values:r}){let n=[];for(let[o,i]of Object.entries(r)){this.errors.scope(o);try{let a=e.find(c=>c.name.wireValue===o);if(a==null)throw this.newParameterNotRecognizedError(o);let p=this.isListTypeReference(a.typeReference)&&!Array.isArray(i)?[i]:i;n.push({name:a.name,typeReference:a.typeReference,value:p})}finally{this.errors.unscope()}}return n}associateByWireValueOrDefault({parameters:e,values:r}){let n=[];for(let o of e){this.errors.scope(o.name.wireValue);try{let i=r[o.name.wireValue];if(i==null)if(o.typeReference.type==="primitive"&&o.typeReference.value==="STRING")i=`<${o.name.wireValue}>`;else{this.errors.add({severity:y.Critical,message:this.newParameterNotRecognizedError(o.name.wireValue).message});continue}n.push({name:o.name,typeReference:o.typeReference,value:i})}finally{this.errors.unscope()}}return n}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:n}){let o=[];for(let[i,a]of Object.entries(r)){this.errors.scope(i);try{let p=e.find(c=>c.name.wireValue===i);if(p==null){if(n)continue;this.errors.add({severity:y.Critical,message:this.newParameterNotRecognizedError(i).message});continue}o.push({name:p.name,typeReference:p.typeReference,value:a})}finally{this.errors.unscope()}}return o}getExampleObjectProperties({parameters:e,snippetObject:r}){let n=typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{},o=[];for(let i of e){let a=n[i.name.wireValue];a==null?i.typeReference.type==="nullable"&&o.push({name:i.name,typeReference:i.typeReference,value:null}):o.push({name:i.name,typeReference:i.typeReference,value:a})}return o}getSingleFileValue({property:e,record:r}){let n=r[e.wireValue];if(n!=null){if(typeof n!="string"){this.errors.add({severity:y.Critical,message:`Expected file value to be a string, got ${typeof n}`});return}return n}}getFileArrayValues({property:e,record:r}){let n=r[e.wireValue];if(n==null)return;if(!Array.isArray(n)){this.errors.add({severity:y.Critical,message:`Expected file array value to be an array of strings, got ${typeof n}`});return}let o=[];for(let i of n){if(typeof i!="string"){this.errors.add({severity:y.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}o.push(i)}return o}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:y.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:y.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let n=this.getRecord(r);if(n==null)return;let o=e.discriminant.wireValue,i=n[o];if(i==null){this.errors.add({severity:y.Critical,message:this.newParameterNotRecognizedError(o).message});return}if(typeof i!="string"){this.errors.add({severity:y.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let a=e.types[i];if(a==null){this.errors.add({severity:y.Critical,message:`No type found for discriminant value "${i}"`});return}let x=n,{[o]:p}=x,c=Te(x,[Re(o)]);return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:c}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocation(e){let r=[];for(let n of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:n,parsedEndpoint:e})&&r.push(n);return r}resolveEndpointLocationOrThrow(e){let r=this.resolveEndpointLocation(e);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:n}){var o;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:n}):!((o=e.metadata)!=null&&o.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var n,o;return r&&((o=(n=e.metadata)==null?void 0:n.includePathParameters)!=null?o:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:v(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let n=r.environments.find(o=>o.id===e);return n==null?void 0:n.name}case"multipleBaseUrls":{let n=r.environments.find(o=>o.id===e);return n==null?void 0:n.name}default:v(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:y.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:y.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let n=r.environments[0];if(n==null)return this.errors.add({severity:y.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let o=new Set($(n.urls));for(let i of $(e))o.has(i)&&o.delete(i);return o.size>0?(this.errors.add({severity:y.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${$(n.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:y.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:y.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:y.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:v(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:v(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:v(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};u();f();function J(t){return z(G(t))}u();f();var l=require("@fern-api/swift-codegen");u();f();var w=require("@fern-api/swift-codegen");var j=class{constructor({context:e}){g(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return w.swift.Type.array(this.convert({typeReference:e.typeReference.value}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return w.swift.Type.dictionary(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let r=this.context.resolveNamedType({typeId:e.typeReference.value});return r==null?this.convertUnknown():this.convertNamed({named:r})}case"optional":return w.swift.Type.optional(this.convert({typeReference:e.typeReference.value}));case"nullable":return w.swift.Type.nullable(this.convert({typeReference:e.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return w.swift.Type.jsonValue();case"unknown":return this.convertUnknown();default:v(e.typeReference)}}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return w.swift.Type.custom(e.declaration.name.pascalCase.unsafeName);default:v(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return w.swift.Type.bool();case"string":return w.swift.Type.custom(J(e.value))}}convertUnknown(){return w.swift.Type.jsonValue()}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return w.swift.Type.int();case"UINT":return w.swift.Type.int();case"LONG":return w.swift.Type.int64();case"UINT_64":return w.swift.Type.uint64();case"FLOAT":return w.swift.Type.float();case"DOUBLE":return w.swift.Type.double();case"BOOLEAN":return w.swift.Type.bool();case"STRING":return w.swift.Type.string();case"DATE":return w.swift.Type.date();case"DATE_TIME":return w.swift.Type.date();case"UUID":return w.swift.Type.uuid();case"BASE_64":return w.swift.Type.string();case"BIG_INTEGER":return w.swift.Type.string();default:v(e)}}};var se=class{constructor({context:e}){g(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":{if(e.typeReference.value.type==="string")return l.swift.Expression.enumCaseShorthand(l.LiteralEnum.generateEnumCaseLabel(e.typeReference.value.value));if(e.typeReference.value.type==="boolean")return l.swift.Expression.nop();v(e.typeReference.value);break}case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let r=this.context.resolveNamedType({typeId:e.typeReference.value});return r==null?l.swift.Expression.nop():this.convertNamed({named:r,value:e.value,as:e.as})}case"nullable":return this.convertNullable({nullable:e.typeReference,value:e.value,as:e.as});case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return l.swift.Expression.nop();case"unknown":return this.convertUnknown(e.value);default:v(e.typeReference)}}convertList({list:e,value:r}){return Array.isArray(r)?l.swift.Expression.arrayLiteral({elements:r.map((n,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:n})}finally{this.context.errors.unscope()}}),multiline:!0}):(this.context.errors.add({severity:y.Critical,message:`Expected array but got: ${typeof r}`}),l.swift.Expression.nop())}convertMap({map:e,value:r}){return typeof r!="object"||r==null?(this.context.errors.add({severity:y.Critical,message:`Expected object but got: ${r==null?"null":typeof r}`}),l.swift.Expression.nop()):l.swift.Expression.dictionaryLiteral({entries:Object.entries(r).map(([n,o])=>{this.context.errors.scope(n);try{return[this.convert({typeReference:e.key,value:n,as:"mapKey"}),this.convert({typeReference:e.value,value:o,as:"mapValue"})]}finally{this.context.errors.unscope()}}),multiline:!0})}convertNamed({named:e,value:r,as:n}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:r,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:r});case"enum":return this.convertEnum({enum_:e,value:r});case"object":return this.convertObject({object_:e,value:r,as:n});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:r});default:v(e)}}convertNullable({nullable:e,value:r,as:n}){return r==null?l.swift.Expression.enumCaseShorthand("null"):l.swift.Expression.contextualMethodCall({methodName:"value",arguments_:[l.swift.functionArgument({value:this.convert({typeReference:e.value,value:r,as:n})})]})}convertDiscriminatedUnion({discriminatedUnion:e,value:r}){let n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r});if(n==null)return l.swift.Expression.nop();let o=n.singleDiscriminatedUnionType,i=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:n,unionVariant:o});return i==null?l.swift.Expression.nop():l.swift.Expression.methodCall({target:l.swift.Expression.reference(e.declaration.name.pascalCase.unsafeName),methodName:l.EnumWithAssociatedValues.sanitizeToCamelCase(o.discriminantValue.name.camelCase.unsafeName),arguments_:[l.swift.functionArgument({value:l.swift.Expression.contextualMethodCall({methodName:"init",arguments_:i,multiline:!0})})],multiline:!0})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:e,unionVariant:r}){var o;let n=this.getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:r});switch(r.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:r.typeId});if(i==null)return;let a=this.convertNamed({named:i,value:e.value});if(!a.isStructInitialization()){this.context.errors.add({severity:y.Critical,message:"Internal error; expected union value to be a struct"});return}let p=a.asStructInitializationOrThrow();return[...n,...(o=p.arguments_)!=null?o:[]]}case"singleProperty":try{this.context.errors.scope(r.discriminantValue.wireValue);let i=this.context.getRecord(e.value);return i==null?[...n]:[...n,l.swift.functionArgument({label:(0,l.sanitizeSelf)(l.EnumWithAssociatedValues.sanitizeToCamelCase(r.discriminantValue.name.camelCase.unsafeName)),value:this.convert({typeReference:r.typeReference,value:i[r.discriminantValue.wireValue]})})]}finally{this.context.errors.unscope()}case"noProperties":return n;default:v(r)}}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:r}){var o;return this.context.getExampleObjectProperties({parameters:(o=r.properties)!=null?o:[],snippetObject:e.value}).map(i=>{this.context.errors.scope(i.name.wireValue);try{return l.swift.functionArgument({label:(0,l.sanitizeSelf)(i.name.name.camelCase.unsafeName),value:this.convert(i)})}finally{this.context.errors.unscope()}})}convertEnum({enum_:e,value:r}){let n=this.getEnumValue({enum_:e,value:r});return n==null?l.swift.Expression.nop():l.swift.Expression.enumCaseShorthand(n.name.camelCase.unsafeName)}getEnumValue({enum_:e,value:r}){if(typeof r!="string"){this.context.errors.add({severity:y.Critical,message:`Expected enum value string, got: ${typeof r}`});return}let n=e.values.find(o=>o.wireValue===r);if(n==null){this.context.errors.add({severity:y.Critical,message:`An enum value named "${r}" does not exist in this context`});return}return n}convertObject({object_:e,value:r,as:n}){return l.swift.Expression.structInitialization({unsafeName:e.declaration.name.pascalCase.unsafeName,arguments_:this.context.getExampleObjectProperties({parameters:e.properties,snippetObject:r}).map(o=>this.convert(o).isNop()?null:l.swift.functionArgument({label:(0,l.sanitizeSelf)(o.name.name.camelCase.unsafeName),value:this.convert(o)})).filter(o=>o!=null),multiline:!0})}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:r}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:r});return n==null?l.swift.Expression.nop():n}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:r}){for(let n of e.types)try{let o=this.convert({typeReference:n,value:r}),a=new j({context:this.context}).convert({typeReference:n});return l.swift.Expression.methodCall({target:l.swift.Expression.reference(e.declaration.name.pascalCase.unsafeName),methodName:a.toCaseName(),arguments_:[l.swift.functionArgument({value:o})],multiline:!0})}catch(o){continue}this.context.errors.add({severity:y.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof r}" value`})}convertUnknown(e){switch(typeof e){case"boolean":return l.swift.Expression.contextualMethodCall({methodName:"bool",arguments_:[l.swift.functionArgument({value:l.swift.Expression.boolLiteral(e)})]});case"string":return l.swift.Expression.contextualMethodCall({methodName:"string",arguments_:[l.swift.functionArgument({value:l.swift.Expression.stringLiteral(e)})]});case"number":return l.swift.Expression.contextualMethodCall({methodName:"number",arguments_:[l.swift.functionArgument({value:l.swift.Expression.numberLiteral(e)})]});case"object":return e===null?l.swift.Expression.enumCaseShorthand("null"):Array.isArray(e)?l.swift.Expression.contextualMethodCall({methodName:"array",arguments_:[l.swift.functionArgument({value:l.swift.Expression.arrayLiteral({elements:e.map(r=>this.convertUnknown(r)),multiline:!0})})]}):l.swift.Expression.contextualMethodCall({methodName:"object",arguments_:[l.swift.functionArgument({value:l.swift.Expression.dictionaryLiteral({entries:Object.entries(e).map(([r,n])=>[l.swift.Expression.stringLiteral(r),this.convertUnknown(n)]),multiline:!0})})]});default:throw new Error(`Internal error; unsupported unknown type: ${typeof e}`)}}convertPrimitive({primitive:e,value:r,as:n}){switch(e){case"INTEGER":case"UINT":case"LONG":case"UINT_64":case"FLOAT":case"DOUBLE":{let o=this.getValueAsNumber({value:r,as:n});return o==null?l.swift.Expression.nop():l.swift.Expression.numberLiteral(o)}case"BOOLEAN":{let o=this.getValueAsBoolean({value:r,as:n});return o==null?l.swift.Expression.nop():l.swift.Expression.boolLiteral(o)}case"STRING":{let o=this.context.getValueAsString({value:r});return o==null?l.swift.Expression.nop():l.swift.Expression.stringLiteral(o)}case"DATE":{let o=this.context.getValueAsString({value:r});return o==null?l.swift.Expression.nop():l.swift.Expression.calendarDateLiteral(o)}case"DATE_TIME":{let o=this.context.getValueAsString({value:r});if(o==null)return l.swift.Expression.nop();let i=new Date(o).getTime(),a=Math.round(i/1e3),c=new Date(a*1e3).toISOString().replace(/\.\d{3}Z$/,"Z");return l.swift.Expression.dateLiteral(c)}case"UUID":{let o=this.context.getValueAsString({value:r});return o==null?l.swift.Expression.nop():l.swift.Expression.uuidLiteral(o)}case"BASE_64":{let o=this.context.getValueAsString({value:r});return o==null?l.swift.Expression.nop():l.swift.Expression.stringLiteral(o)}case"BIG_INTEGER":return this.context.getValueAsString({value:r})==null?l.swift.Expression.nop():l.swift.Expression.nop();default:v(e)}}getValueAsNumber({value:e,as:r}){let n=r==="mapKey"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:e,as:r}){let n=(()=>{switch(r){case"mapKey":return e==="true"?!0:e==="false"?!1:e;case"mapValue":case void 0:return e;default:v(r)}})();return this.context.getValueAsBoolean({value:n})}};u();f();var R=require("@fern-api/swift-codegen");var ue=class{constructor({context:e}){g(this,"context");this.context=e}getFilePropertyInfo({body:e,value:r}){var i;let n={fileFields:[],bodyPropertyFields:[]},o=(i=this.context.getRecord(r))!=null?i:{};for(let a of e.properties)switch(a.type){case"file":{let p=R.swift.functionArgument({label:(0,R.sanitizeSelf)(a.name.camelCase.unsafeName),value:this.getSingleFileProperty({property:a,record:o})});n.fileFields.push(p);break}case"fileArray":{let p=R.swift.functionArgument({label:(0,R.sanitizeSelf)(a.name.camelCase.unsafeName),value:this.getArrayFileProperty({property:a,record:o})});n.fileFields.push(p);break}case"bodyProperty":{let p=R.swift.functionArgument({label:(0,R.sanitizeSelf)(a.name.name.camelCase.unsafeName),value:this.getBodyProperty({property:a,record:o})});n.bodyPropertyFields.push(p);break}default:v(a)}return n}getSingleFileProperty({property:e,record:r}){let n=this.context.getSingleFileValue({property:e,record:r});return R.swift.Expression.contextualMethodCall({methodName:"init",arguments_:[R.swift.functionArgument({label:"data",value:R.swift.Expression.dataLiteral(n!=null?n:"")})]})}getArrayFileProperty({property:e,record:r}){let n=this.context.getFileArrayValues({property:e,record:r});return R.swift.Expression.arrayLiteral({elements:(n!=null?n:[]).map(o=>R.swift.Expression.contextualMethodCall({methodName:"init",arguments_:[R.swift.functionArgument({label:"data",value:R.swift.Expression.dataLiteral(o)})]})),multiline:!0})}getBodyProperty({property:e,record:r}){let n=r[e.name.wireValue];return n==null?R.swift.Expression.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:n})}};var ge=class t extends Z{constructor({ir:r,config:n,options:o}){super({ir:r,config:n,options:o});g(this,"ir");g(this,"customConfig");g(this,"dynamicTypeMapper");g(this,"dynamicTypeLiteralMapper");g(this,"filePropertyMapper");this.ir=r,this.customConfig=n.customConfig!=null?n.customConfig:void 0,this.dynamicTypeMapper=new j({context:this}),this.dynamicTypeLiteralMapper=new se({context:this}),this.filePropertyMapper=new ue({context:this})}clone(){return new t({ir:this.ir,config:this.config,options:this.options})}getModuleName(){var r,n;return(n=(r=this.customConfig)==null?void 0:r.moduleName)!=null?n:J(this.getApiName())}getRootClientClassName(){var r,n;return(n=(r=this.customConfig)==null?void 0:r.clientClassName)!=null?n:`${J(this.getApiName())}Client`}getApiName(){return G(this.config.workspaceName)}};0&&(module.exports={DynamicSnippetsGeneratorContext});
1
+ "use strict";var Tn=Object.create;var ge=Object.defineProperty,En=Object.defineProperties,Sn=Object.getOwnPropertyDescriptor,Nn=Object.getOwnPropertyDescriptors,An=Object.getOwnPropertyNames,Ce=Object.getOwnPropertySymbols,In=Object.getPrototypeOf,it=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable;var nt=(n,t,e)=>t in n?ge(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,T=(n,t)=>{for(var e in t||(t={}))it.call(t,e)&&nt(n,e,t[e]);if(Ce)for(var e of Ce(t))At.call(t,e)&&nt(n,e,t[e]);return n},It=(n,t)=>En(n,Nn(t));var Rt=n=>typeof n=="symbol"?n:n+"",Lt=(n,t)=>{var e={};for(var r in n)it.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&Ce)for(var r of Ce(n))t.indexOf(r)<0&&At.call(n,r)&&(e[r]=n[r]);return e};var at=(n,t)=>()=>(n&&(t=n(n=0)),t);var $=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),ke=(n,t)=>{for(var e in t)ge(n,e,{get:t[e],enumerable:!0})},Ct=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of An(t))!it.call(n,i)&&i!==e&&ge(n,i,{get:()=>t[i],enumerable:!(r=Sn(t,i))||r.enumerable});return n};var Rn=(n,t,e)=>(e=n!=null?Tn(In(n)):{},Ct(t||!n||!n.__esModule?ge(e,"default",{value:n,enumerable:!0}):e,n)),Ln=n=>Ct(ge({},"__esModule",{value:!0}),n);var f=(n,t,e)=>nt(n,typeof t!="symbol"?t+"":t,e);function Ut(){throw new Error("setTimeout has not been defined")}function Mt(){throw new Error("clearTimeout has not been defined")}function Bt(n){if(z===setTimeout)return setTimeout(n,0);if((z===Ut||!z)&&setTimeout)return z=setTimeout,setTimeout(n,0);try{return z(n,0)}catch(t){try{return z.call(null,n,0)}catch(e){return z.call(this,n,0)}}}function Cn(n){if(j===clearTimeout)return clearTimeout(n);if((j===Mt||!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 kn(){!te||!H||(te=!1,H.length?_=H.concat(_):Ue=-1,_.length&&Dt())}function Dt(){if(!te){var n=Bt(kn);te=!0;for(var t=_.length;t;){for(H=_,_=[];++Ue<t;)H&&H[Ue].run();Ue=-1,t=_.length}H=null,te=!1,Cn(n)}}function Un(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];_.push(new Ot(n,t)),_.length===1&&!te&&Bt(Dt)}function Ot(n,t){this.fun=n,this.array=t}function K(){}function Kn(n){throw new Error("process.binding is not supported")}function Zn(){return"/"}function Jn(n){throw new Error("process.chdir is not supported")}function Xn(){return 0}function ei(n){var t=Qn.call(ee)*.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 ri(){var n=new Date,t=n-ti;return t/1e3}var z,j,_,te,H,Ue,Mn,Bn,Dn,On,Fn,Pn,_n,Wn,Vn,$n,zn,jn,Yn,qn,Gn,Hn,ee,Qn,ti,m,kt,o=at(()=>{"use strict";z=Ut,j=Mt;typeof globalThis.setTimeout=="function"&&(z=setTimeout);typeof globalThis.clearTimeout=="function"&&(j=clearTimeout);_=[],te=!1,Ue=-1;Ot.prototype.run=function(){this.fun.apply(null,this.array)};Mn="browser",Bn="browser",Dn=!0,On={},Fn=[],Pn="",_n={},Wn={},Vn={};$n=K,zn=K,jn=K,Yn=K,qn=K,Gn=K,Hn=K;ee=globalThis.performance||{},Qn=ee.now||ee.mozNow||ee.msNow||ee.oNow||ee.webkitNow||function(){return new Date().getTime()};ti=new Date;m={nextTick:Un,title:Mn,browser:Dn,env:On,argv:Fn,version:Pn,versions:_n,on:$n,addListener:zn,once:jn,off:Yn,removeListener:qn,removeAllListeners:Gn,emit:Hn,binding:Kn,cwd:Zn,chdir:Jn,umask:Xn,hrtime:ei,platform:Bn,release:Wn,config:Vn,uptime:ri},kt={};Object.keys(kt).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]=kt[n]:e=e[i]||(e[i]={})}})});function Wt(){ot=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)O[t]=n[t],k[n.charCodeAt(t)]=t;k[45]=62,k[95]=63}function ii(n){ot||Wt();var t,e,r,i,a,s,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,s=new ni(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=k[n.charCodeAt(t)]<<18|k[n.charCodeAt(t+1)]<<12|k[n.charCodeAt(t+2)]<<6|k[n.charCodeAt(t+3)],s[c++]=i>>16&255,s[c++]=i>>8&255,s[c++]=i&255;return a===2?(i=k[n.charCodeAt(t)]<<2|k[n.charCodeAt(t+1)]>>4,s[c++]=i&255):a===1&&(i=k[n.charCodeAt(t)]<<10|k[n.charCodeAt(t+1)]<<4|k[n.charCodeAt(t+2)]>>2,s[c++]=i>>8&255,s[c++]=i&255),s}function ai(n){return O[n>>18&63]+O[n>>12&63]+O[n>>6&63]+O[n&63]}function si(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(ai(r));return i.join("")}function Ft(n){ot||Wt();for(var t,e=n.length,r=e%3,i="",a=[],s=16383,p=0,c=e-r;p<c;p+=s)a.push(si(n,p,p+s>c?c:p+s));return r===1?(t=n[e-1],i+=O[t>>2],i+=O[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=O[t>>10],i+=O[t>>4&63],i+=O[t<<2&63],i+="="),a.push(i),a.join("")}function Me(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function W(n,t){if(Me()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=u.prototype):(n===null&&(n=new u(t)),n.length=t),n}function u(n,t,e){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(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 lt(this,n)}return Vt(this,n,t,e)}function Vt(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?ui(n,t,e,r):typeof t=="string"?li(n,t,e):fi(n,t)}function $t(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 oi(n,t,e,r){return $t(t),t<=0?W(n,t):e!==void 0?typeof r=="string"?W(n,t).fill(e,r):W(n,t).fill(e):W(n,t)}function lt(n,t){if($t(t),n=W(n,t<0?0:ut(t)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function li(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=zt(t,e)|0;n=W(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function st(n,t){var e=t.length<0?0:ut(t.length)|0;n=W(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function ui(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),u.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=u.prototype):n=st(n,t),n}function fi(n,t){if(F(t)){var e=ut(t.length)|0;return n=W(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"||Li(t.length)?W(n,0):st(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return st(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ut(n){if(n>=Me())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Me().toString(16)+" bytes");return n|0}function F(n){return!!(n!=null&&n._isBuffer)}function zt(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 Be(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Zt(n).length;default:if(r)return Be(n).length;t=(""+t).toLowerCase(),r=!0}}function pi(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 bi(this,t,e);case"utf8":case"utf-8":return qt(this,t,e);case"ascii":return gi(this,t,e);case"latin1":case"binary":return vi(this,t,e);case"base64":return xi(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ti(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function Z(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function jt(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=u.from(t,r)),F(t))return t.length===0?-1:Pt(n,t,e,r,i);if(typeof t=="number")return t=t&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):Pt(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function Pt(n,t,e,r,i){var a=1,s=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,s/=2,p/=2,e/=2}function c(C,Q){return a===1?C[Q]:C.readUInt16BE(Q*a)}var h;if(i){var x=-1;for(h=e;h<s;h++)if(c(n,h)===c(t,x===-1?0:h-x)){if(x===-1&&(x=h),h-x+1===p)return x*a}else x!==-1&&(h-=h-x),x=-1}else for(e+p>s&&(e=s-p),h=e;h>=0;h--){for(var g=!0,M=0;M<p;M++)if(c(n,h+M)!==c(t,M)){g=!1;break}if(g)return h}return-1}function ci(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 s=0;s<r;++s){var p=parseInt(t.substr(s*2,2),16);if(isNaN(p))return s;n[e+s]=p}return s}function mi(n,t,e,r){return Fe(Be(t,n.length-e),n,e,r)}function Yt(n,t,e,r){return Fe(Ii(t),n,e,r)}function di(n,t,e,r){return Yt(n,t,e,r)}function hi(n,t,e,r){return Fe(Zt(t),n,e,r)}function yi(n,t,e,r){return Fe(Ri(t,n.length-e),n,e,r)}function xi(n,t,e){return t===0&&e===n.length?Ft(n):Ft(n.slice(t,e))}function qt(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var a=n[i],s=null,p=a>239?4:a>223?3:a>191?2:1;if(i+p<=e){var c,h,x,g;switch(p){case 1:a<128&&(s=a);break;case 2:c=n[i+1],(c&192)===128&&(g=(a&31)<<6|c&63,g>127&&(s=g));break;case 3:c=n[i+1],h=n[i+2],(c&192)===128&&(h&192)===128&&(g=(a&15)<<12|(c&63)<<6|h&63,g>2047&&(g<55296||g>57343)&&(s=g));break;case 4:c=n[i+1],h=n[i+2],x=n[i+3],(c&192)===128&&(h&192)===128&&(x&192)===128&&(g=(a&15)<<18|(c&63)<<12|(h&63)<<6|x&63,g>65535&&g<1114112&&(s=g))}}s===null?(s=65533,p=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=p}return wi(r)}function wi(n){var t=n.length;if(t<=_t)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=_t));return e}function gi(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 vi(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 bi(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+=Ai(n[a]);return i}function Ti(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 S(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function R(n,t,e,r,i,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 De(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 Oe(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 Gt(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 Ht(n,t,e,r,i){return i||Gt(n,t,e,4,34028234663852886e22,-34028234663852886e22),Xt(n,t,e,r,23,4),e+4}function Kt(n,t,e,r,i){return i||Gt(n,t,e,8,17976931348623157e292,-17976931348623157e292),Xt(n,t,e,r,52,8),e+8}function Si(n){if(n=Ni(n).replace(Ei,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Ni(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Ai(n){return n<16?"0"+n.toString(16):n.toString(16)}function Be(n,t){t=t||1/0;for(var e,r=n.length,i=null,a=[],s=0;s<r;++s){if(e=n.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(s+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 Ii(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Ri(n,t){for(var e,r,i,a=[],s=0;s<n.length&&!((t-=2)<0);++s)e=n.charCodeAt(s),r=e>>8,i=e%256,a.push(i),a.push(r);return a}function Zt(n){return ii(Si(n))}function Fe(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 Li(n){return n!==n}function Ci(n){return n!=null&&(!!n._isBuffer||Jt(n)||ki(n))}function Jt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function ki(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&Jt(n.slice(0,0))}function Pe(n,t,e,r,i){var a,s,p=i*8-r-1,c=(1<<p)-1,h=c>>1,x=-7,g=e?i-1:0,M=e?-1:1,C=n[t+g];for(g+=M,a=C&(1<<-x)-1,C>>=-x,x+=p;x>0;a=a*256+n[t+g],g+=M,x-=8);for(s=a&(1<<-x)-1,a>>=-x,x+=r;x>0;s=s*256+n[t+g],g+=M,x-=8);if(a===0)a=1-h;else{if(a===c)return s?NaN:(C?-1:1)*(1/0);s=s+Math.pow(2,r),a=a-h}return(C?-1:1)*s*Math.pow(2,a-r)}function Xt(n,t,e,r,i,a){var s,p,c,h=a*8-i-1,x=(1<<h)-1,g=x>>1,M=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=r?0:a-1,Q=r?1:-1,bn=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(p=isNaN(t)?1:0,s=x):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+g>=1?t+=M/c:t+=M*Math.pow(2,1-g),t*c>=2&&(s++,c/=2),s+g>=x?(p=0,s=x):s+g>=1?(p=(t*c-1)*Math.pow(2,i),s=s+g):(p=t*Math.pow(2,g-1)*Math.pow(2,i),s=0));i>=8;n[e+C]=p&255,C+=Q,p/=256,i-=8);for(s=s<<i|p,h+=i;h>0;n[e+C]=s&255,C+=Q,s/=256,h-=8);n[e+C-Q]|=bn*128}var O,k,ni,ot,_t,Ei,Qt=at(()=>{"use strict";o();l();O=[],k=[],ni=typeof Uint8Array!="undefined"?Uint8Array:Array,ot=!1;u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;u.poolSize=8192;u._augment=function(n){return n.__proto__=u.prototype,n};u.from=function(n,t,e){return Vt(null,n,t,e)};u.kMaxLength=Me();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&u[Symbol.species]);u.alloc=function(n,t,e){return oi(null,n,t,e)};u.allocUnsafe=function(n){return lt(null,n)};u.allocUnsafeSlow=function(n){return lt(null,n)};u.isBuffer=Ci;u.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,s=Math.min(r,i);a<s;++a)if(t[a]!==e[a]){r=t[a],i=e[a];break}return r<i?-1:i<r?1:0};u.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}};u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return u.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=u.allocUnsafe(e),a=0;for(r=0;r<t.length;++r){var s=t[r];if(!F(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,a),a+=s.length}return i};u.byteLength=zt;u.prototype._isBuffer=!0;u.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Z(this,e,e+1);return this};u.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Z(this,e,e+3),Z(this,e+1,e+2);return this};u.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Z(this,e,e+7),Z(this,e+1,e+6),Z(this,e+2,e+5),Z(this,e+3,e+4);return this};u.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?qt(this,0,t):pi.apply(this,arguments)};u.prototype.equals=function(t){if(!F(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:u.compare(this,t)===0};u.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 s=a-i,p=r-e,c=Math.min(s,p),h=this.slice(i,a),x=t.slice(e,r),g=0;g<c;++g)if(h[g]!==x[g]){s=h[g],p=x[g];break}return s<p?-1:p<s?1:0};u.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};u.prototype.indexOf=function(t,e,r){return jt(this,t,e,r,!0)};u.prototype.lastIndexOf=function(t,e,r){return jt(this,t,e,r,!1)};u.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 s=!1;;)switch(i){case"hex":return ci(this,t,e,r);case"utf8":case"utf-8":return mi(this,t,e,r);case"ascii":return Yt(this,t,e,r);case"latin1":case"binary":return di(this,t,e,r);case"base64":return hi(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yi(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};_t=4096;u.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(u.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=u.prototype;else{var a=e-t;i=new u(a,void 0);for(var s=0;s<a;++s)i[s]=this[s+t]}return i};u.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||S(t,e,this.length);for(var i=this[t],a=1,s=0;++s<e&&(a*=256);)i+=this[t+s]*a;return i};u.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||S(t,e,this.length);for(var i=this[t+--e],a=1;e>0&&(a*=256);)i+=this[t+--e]*a;return i};u.prototype.readUInt8=function(t,e){return e||S(t,1,this.length),this[t]};u.prototype.readUInt16LE=function(t,e){return e||S(t,2,this.length),this[t]|this[t+1]<<8};u.prototype.readUInt16BE=function(t,e){return e||S(t,2,this.length),this[t]<<8|this[t+1]};u.prototype.readUInt32LE=function(t,e){return e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};u.prototype.readUInt32BE=function(t,e){return e||S(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};u.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||S(t,e,this.length);for(var i=this[t],a=1,s=0;++s<e&&(a*=256);)i+=this[t+s]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};u.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||S(t,e,this.length);for(var i=e,a=1,s=this[t+--i];i>0&&(a*=256);)s+=this[t+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*e)),s};u.prototype.readInt8=function(t,e){return e||S(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};u.prototype.readInt16LE=function(t,e){e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};u.prototype.readInt16BE=function(t,e){e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};u.prototype.readInt32LE=function(t,e){return e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};u.prototype.readInt32BE=function(t,e){return e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};u.prototype.readFloatLE=function(t,e){return e||S(t,4,this.length),Pe(this,t,!0,23,4)};u.prototype.readFloatBE=function(t,e){return e||S(t,4,this.length),Pe(this,t,!1,23,4)};u.prototype.readDoubleLE=function(t,e){return e||S(t,8,this.length),Pe(this,t,!0,52,8)};u.prototype.readDoubleBE=function(t,e){return e||S(t,8,this.length),Pe(this,t,!1,52,8)};u.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;R(this,t,e,r,a,0)}var s=1,p=0;for(this[e]=t&255;++p<r&&(s*=256);)this[e+p]=t/s&255;return e+r};u.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;R(this,t,e,r,a,0)}var s=r-1,p=1;for(this[e+s]=t&255;--s>=0&&(p*=256);)this[e+s]=t/p&255;return e+r};u.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):De(this,t,e,!0),e+2};u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):De(this,t,e,!1),e+2};u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Oe(this,t,e,!0),e+4};u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Oe(this,t,e,!1),e+4};u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var a=Math.pow(2,8*r-1);R(this,t,e,r,a-1,-a)}var s=0,p=1,c=0;for(this[e]=t&255;++s<r&&(p*=256);)t<0&&c===0&&this[e+s-1]!==0&&(c=1),this[e+s]=(t/p>>0)-c&255;return e+r};u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var a=Math.pow(2,8*r-1);R(this,t,e,r,a-1,-a)}var s=r-1,p=1,c=0;for(this[e+s]=t&255;--s>=0&&(p*=256);)t<0&&c===0&&this[e+s+1]!==0&&(c=1),this[e+s]=(t/p>>0)-c&255;return e+r};u.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};u.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):De(this,t,e,!0),e+2};u.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):De(this,t,e,!1),e+2};u.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Oe(this,t,e,!0),e+4};u.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Oe(this,t,e,!1),e+4};u.prototype.writeFloatLE=function(t,e,r){return Ht(this,t,e,!0,r)};u.prototype.writeFloatBE=function(t,e,r){return Ht(this,t,e,!1,r)};u.prototype.writeDoubleLE=function(t,e,r){return Kt(this,t,e,!0,r)};u.prototype.writeDoubleBE=function(t,e,r){return Kt(this,t,e,!1,r)};u.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,s;if(this===t&&r<e&&e<i)for(s=a-1;s>=0;--s)t[s+e]=this[s+r];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(s=0;s<a;++s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a};u.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"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var s;if(typeof t=="number")for(s=e;s<r;++s)this[s]=t;else{var p=F(t)?t:Be(new u(t,i).toString()),c=p.length;for(s=0;s<r-e;++s)this[s+e]=p[s%c]}return this};Ei=/[^+\/0-9A-Za-z-_]/g});var l=at(()=>{"use strict";Qt()});var mt=$((pp,en)=>{"use strict";o();l();function gs(n){return!(typeof n!="number"||n!==n||n===1/0||n===-1/0)}en.exports=gs});var rn=$((dp,tn)=>{"use strict";o();l();var vs=9007199254740991;tn.exports=vs});var dt=$((xp,nn)=>{"use strict";o();l();var bs=rn();function Ts(n){return typeof n=="number"&&Math.abs(n)<=bs}nn.exports=Ts});var sn=$((vp,an)=>{"use strict";o();l();var Es=mt(),Ss=dt();function Ns(n){var t=parseInt(n,10);if(!Es(t))throw new TypeError("Not a finite number: "+n+" ("+typeof n+")");if(!Ss(t))throw new RangeError("Input is not a safe number, it\u2019s either too large or too small.");var e=String(t),r=Math.abs(t%100),i=r>=11&&r<=13,a=e.charAt(e.length-1);return e+(i?"th":a==="1"?"st":a==="2"?"nd":a==="3"?"rd":"th")}an.exports=Ns});var ht=$((Ep,un)=>{"use strict";o();l();var As=/(hundred|thousand|(m|b|tr|quadr)illion)$/,Is=/teen$/,on=/y$/,ln=/(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)$/,Rs={zero:"zeroth",one:"first",two:"second",three:"third",four:"fourth",five:"fifth",six:"sixth",seven:"seventh",eight:"eighth",nine:"ninth",ten:"tenth",eleven:"eleventh",twelve:"twelfth"};function Ls(n){return As.test(n)||Is.test(n)?n+"th":on.test(n)?n.replace(on,"ieth"):ln.test(n)?n.replace(ln,Cs):n}function Cs(n,t){return Rs[t]}un.exports=Ls});var Tt=$((Ap,cn)=>{"use strict";o();l();var ks=ht(),Us=mt(),Ms=dt(),fn=10,yt=100,xt=1e3,wt=1e6,gt=1e9,vt=1e12,bt=1e15,Bs=9007199254740992,pn=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],Ds=["zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function Os(n,t){var e,r=parseInt(n,10);if(!Us(r))throw new TypeError("Not a finite number: "+n+" ("+typeof n+")");if(!Ms(r))throw new RangeError("Input is not a safe number, it\u2019s either too large or too small.");return e=q(r),t?ks(e):e}function q(n){var t,e,r=arguments[1];return n===0?r?r.join(" ").replace(/,$/,""):"zero":(r||(r=[]),n<0&&(r.push("minus"),n=Math.abs(n)),n<20?(t=0,e=pn[n]):n<yt?(t=n%fn,e=Ds[Math.floor(n/fn)],t&&(e+="-"+pn[t],t=0)):n<xt?(t=n%yt,e=q(Math.floor(n/yt))+" hundred"):n<wt?(t=n%xt,e=q(Math.floor(n/xt))+" thousand,"):n<gt?(t=n%wt,e=q(Math.floor(n/wt))+" million,"):n<vt?(t=n%gt,e=q(Math.floor(n/gt))+" billion,"):n<bt?(t=n%vt,e=q(Math.floor(n/vt))+" trillion,"):n<=Bs&&(t=n%bt,e=q(Math.floor(n/bt))+" quadrillion,"),r.push(e),q(t,r))}cn.exports=Os});var dn=$((Lp,mn)=>{"use strict";o();l();var Fs=ht(),Ps=Tt();function _s(n){var t=Ps(n);return Fs(t)}mn.exports=_s});var yn=$((Up,hn)=>{"use strict";o();l();hn.exports={toOrdinal:sn(),toWords:Tt(),toWordsOrdinal:dn()}});var oo={};ke(oo,{DynamicSnippetsGeneratorContext:()=>Nt});module.exports=Ln(oo);o();l();o();l();o();l();function _e(n,t){if(n===void 0)throw new Error(t!=null?t:"Expected value to be defined but got undefined.")}function U(n,t){if(n===null)throw new Error(t!=null?t:"Expected value to be non-null but got null.")}function v(n){throw new Error("Unexpected value: "+JSON.stringify(n))}o();l();o();l();o();l();o();l();o();l();o();l();var Ui=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,er=Ui;var Mi=typeof self=="object"&&self&&self.Object===Object&&self,Bi=er||Mi||Function("return this")(),tr=Bi;var Di=tr.Symbol,V=Di;o();l();var rr=Object.prototype,Oi=rr.hasOwnProperty,Fi=rr.toString,ve=V?V.toStringTag:void 0;function Pi(n){var t=Oi.call(n,ve),e=n[ve];try{n[ve]=void 0;var r=!0}catch(a){}var i=Fi.call(n);return r&&(t?n[ve]=e:delete n[ve]),i}var nr=Pi;o();l();var _i=Object.prototype,Wi=_i.toString;function Vi(n){return Wi.call(n)}var ir=Vi;var $i="[object Null]",zi="[object Undefined]",ar=V?V.toStringTag:void 0;function ji(n){return n==null?n===void 0?zi:$i:ar&&ar in Object(n)?nr(n):ir(n)}var sr=ji;o();l();function Yi(n){return n!=null&&typeof n=="object"}var or=Yi;var qi="[object Symbol]";function Gi(n){return typeof n=="symbol"||or(n)&&sr(n)==qi}var lr=Gi;o();l();o();l();function Hi(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 ur=Hi;o();l();var Ki=Array.isArray,fr=Ki;var Zi=1/0,pr=V?V.prototype:void 0,cr=pr?pr.toString:void 0;function mr(n){if(typeof n=="string")return n;if(fr(n))return ur(n,mr)+"";if(lr(n))return cr?cr.call(n):"";var t=n+"";return t=="0"&&1/n==-Zi?"-0":t}var dr=mr;o();l();function Ji(n){return n==null?"":dr(n)}var Y=Ji;o();l();o();l();o();l();o();l();o();l();o();l();function Xi(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 hr=Xi;function Qi(n,t,e){var r=n.length;return e=e===void 0?r:e,!t&&e>=r?n:hr(n,t,e)}var yr=Qi;o();l();var ea="\\ud800-\\udfff",ta="\\u0300-\\u036f",ra="\\ufe20-\\ufe2f",na="\\u20d0-\\u20ff",ia=ta+ra+na,aa="\\ufe0e\\ufe0f",sa="\\u200d",oa=RegExp("["+sa+ea+ia+aa+"]");function la(n){return oa.test(n)}var We=la;o();l();o();l();function ua(n){return n.split("")}var xr=ua;o();l();var wr="\\ud800-\\udfff",fa="\\u0300-\\u036f",pa="\\ufe20-\\ufe2f",ca="\\u20d0-\\u20ff",ma=fa+pa+ca,da="\\ufe0e\\ufe0f",ha="["+wr+"]",ft="["+ma+"]",pt="\\ud83c[\\udffb-\\udfff]",ya="(?:"+ft+"|"+pt+")",gr="[^"+wr+"]",vr="(?:\\ud83c[\\udde6-\\uddff]){2}",br="[\\ud800-\\udbff][\\udc00-\\udfff]",xa="\\u200d",Tr=ya+"?",Er="["+da+"]?",wa="(?:"+xa+"(?:"+[gr,vr,br].join("|")+")"+Er+Tr+")*",ga=Er+Tr+wa,va="(?:"+[gr+ft+"?",ft,vr,br,ha].join("|")+")",ba=RegExp(pt+"(?="+pt+")|"+va+ga,"g");function Ta(n){return n.match(ba)||[]}var Sr=Ta;function Ea(n){return We(n)?Sr(n):xr(n)}var Nr=Ea;function Sa(n){return function(t){t=Y(t);var e=We(t)?Nr(t):void 0,r=e?e[0]:t.charAt(0),i=e?yr(e,1).join(""):t.slice(1);return r[n]()+i}}var Ve=Sa;var Na=Ve("toUpperCase"),A=Na;function Aa(n){return A(Y(n).toLowerCase())}var Ar=Aa;o();l();o();l();function Ia(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 Ir=Ia;o();l();o();l();o();l();function Ra(n){return function(t){return n==null?void 0:n[t]}}var Rr=Ra;var La={\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"},Ca=Rr(La),Lr=Ca;var ka=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ua="\\u0300-\\u036f",Ma="\\ufe20-\\ufe2f",Ba="\\u20d0-\\u20ff",Da=Ua+Ma+Ba,Oa="["+Da+"]",Fa=RegExp(Oa,"g");function Pa(n){return n=Y(n),n&&n.replace(ka,Lr).replace(Fa,"")}var Cr=Pa;o();l();o();l();var _a=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Wa(n){return n.match(_a)||[]}var kr=Wa;o();l();var Va=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function $a(n){return Va.test(n)}var Ur=$a;o();l();var Fr="\\ud800-\\udfff",za="\\u0300-\\u036f",ja="\\ufe20-\\ufe2f",Ya="\\u20d0-\\u20ff",qa=za+ja+Ya,Pr="\\u2700-\\u27bf",_r="a-z\\xdf-\\xf6\\xf8-\\xff",Ga="\\xac\\xb1\\xd7\\xf7",Ha="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ka="\\u2000-\\u206f",Za=" \\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",Wr="A-Z\\xc0-\\xd6\\xd8-\\xde",Ja="\\ufe0e\\ufe0f",Vr=Ga+Ha+Ka+Za,$r="['\u2019]",Mr="["+Vr+"]",Xa="["+qa+"]",zr="\\d+",Qa="["+Pr+"]",jr="["+_r+"]",Yr="[^"+Fr+Vr+zr+Pr+_r+Wr+"]",es="\\ud83c[\\udffb-\\udfff]",ts="(?:"+Xa+"|"+es+")",rs="[^"+Fr+"]",qr="(?:\\ud83c[\\udde6-\\uddff]){2}",Gr="[\\ud800-\\udbff][\\udc00-\\udfff]",re="["+Wr+"]",ns="\\u200d",Br="(?:"+jr+"|"+Yr+")",is="(?:"+re+"|"+Yr+")",Dr="(?:"+$r+"(?:d|ll|m|re|s|t|ve))?",Or="(?:"+$r+"(?:D|LL|M|RE|S|T|VE))?",Hr=ts+"?",Kr="["+Ja+"]?",as="(?:"+ns+"(?:"+[rs,qr,Gr].join("|")+")"+Kr+Hr+")*",ss="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",os="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ls=Kr+Hr+as,us="(?:"+[Qa,qr,Gr].join("|")+")"+ls,fs=RegExp([re+"?"+jr+"+"+Dr+"(?="+[Mr,re,"$"].join("|")+")",is+"+"+Or+"(?="+[Mr,re+Br,"$"].join("|")+")",re+"?"+Br+"+"+Dr,re+"+"+Or,os,ss,zr,us].join("|"),"g");function ps(n){return n.match(fs)||[]}var Zr=ps;function cs(n,t,e){return n=Y(n),t=e?void 0:t,t===void 0?Ur(n)?Zr(n):kr(n):n.match(t)||[]}var Jr=cs;var ms="['\u2019]",ds=RegExp(ms,"g");function hs(n){return function(t){return Ir(Jr(Cr(t).replace(ds,"")),n,"")}}var Xr=hs;var ys=Xr(function(n,t,e){return t=t.toLowerCase(),n+(e?Ar(t):t)}),I=ys;o();l();var xs=Ve("toLowerCase"),$e=xs;o();l();function ct(){}o();l();function be(n){return Object.keys(n)}o();l();function ze(n){return Object.values(n)}o();l();o();l();var J=class{};o();l();o();l();var B=class extends J{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 ws=4,Qr=!!m.env.FERN_STACK_TRACK;Qr&&(Error.stackTraceLimit=50);var Te=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(),s=i.replaceAll(`
3
+ `,`
4
+ ${a}`);this.isAtStartOfLine()&&(s=a+s),r&&(s+=`
5
+ `),this.writeInternal(s)}else this.writeNode(e)}writeStatement(...t){this.write(...t),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){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 s=t[a];s!=null&&r(s)}}}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,Qr&&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 ws}stacktrace(t=50){var r;let e=!1;return((r=new Error().stack)!=null?r:"").split(`
12
+ `).map(i=>{var s;let a=i.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(a&&a.length===5){let[,p,c,h,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:(s=c==null?void 0:c.replace(/^.*?fern.*?\//,""))!=null?s:"",position:`${h}:${x}`}}}).filter(i=>{var a,s,p,c,h,x,g;return i&&!((a=i.path)!=null&&a.startsWith("node:"))&&!((s=i.path)!=null&&s.endsWith(".js"))&&!((p=i.path)!=null&&p.includes("AbstractWriter"))&&!((c=i.fn)!=null&&c.includes("stacktrace"))&&!((h=i.fn)!=null&&h.includes("stackLine"))&&!((x=i.fn)!=null&&x.includes("SdkGeneratorCLI"))&&!((g=i.fn)!=null&&g.includes("runCli"))}).slice(0,t)}};o();l();o();l();o();l();o();l();var Ee=class{constructor(){f(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let r=t.match(this.REFERENCE_REGEX);if(!(r==null||r[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};o();l();var b={Critical:"CRITICAL",Warning:"WARNING"},Se=class n{constructor(){f(this,"errors");f(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(It(T({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new n;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let r of t){if(typeof r=="string"){e.push(r);continue}e[e.length-1]+=`[${r.index}]`}return e}};var Ne=class{constructor({ir:t,config:e,options:r={}}){f(this,"config");f(this,"options");f(this,"errors");f(this,"_ir");f(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=r,this.errors=new Se,this.httpEndpointReferenceParser=new Ee}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[i,a]of Object.entries(e)){this.errors.scope(i);try{let s=t.find(c=>c.name.wireValue===i);if(s==null)throw this.newParameterNotRecognizedError(i);let p=this.isListTypeReference(s.typeReference)&&!Array.isArray(a)?[a]:a;r.push({name:s.name,typeReference:s.typeReference,value:p})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:t,values:e}){let r=[];for(let i of t){this.errors.scope(i.name.wireValue);try{let a=e[i.name.wireValue];if(a==null)if(i.typeReference.type==="primitive"&&i.typeReference.value==="STRING")a=`<${i.name.wireValue}>`;else{this.errors.add({severity:b.Critical,message:this.newParameterNotRecognizedError(i.name.wireValue).message});continue}r.push({name:i.name,typeReference:i.typeReference,value:a})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let i=[];for(let[a,s]of Object.entries(e)){this.errors.scope(a);try{let p=t.find(c=>c.name.wireValue===a);if(p==null){if(r)continue;this.errors.add({severity:b.Critical,message:this.newParameterNotRecognizedError(a).message});continue}i.push({name:p.name,typeReference:p.typeReference,value:s})}finally{this.errors.unscope()}}return i}getExampleObjectProperties({parameters:t,snippetObject:e}){let r=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},i=[];for(let a of t){let s=r[a.name.wireValue];s==null?a.typeReference.type==="nullable"&&i.push({name:a.name,typeReference:a.typeReference,value:null}):i.push({name:a.name,typeReference:a.typeReference,value:s})}return i}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:b.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:t,record:e}){let r=e[t.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:b.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let i=[];for(let a of r){if(typeof a!="string"){this.errors.add({severity:b.Critical,message:`Expected file array value to be an array of strings, got ${typeof a}`});return}i.push(a)}return i}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:b.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:b.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let r=this.getRecord(e);if(r==null)return;let i=t.discriminant.wireValue,a=r[i];if(a==null){this.errors.add({severity:b.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof a!="string"){this.errors.add({severity:b.Critical,message:`Expected discriminant value to be a string but got: ${typeof a}`});return}let s=t.types[a];if(s==null){this.errors.add({severity:b.Critical,message:`No type found for discriminant value "${a}"`});return}let h=r,{[i]:p}=h,c=Lt(h,[Rt(i)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:c}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:t})&&e.push(r);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){var i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:r}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var r,i;return e&&((i=(r=t.metadata)==null?void 0:r.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:v(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}case"multipleBaseUrls":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}default:v(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:b.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:b.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=e.environments[0];if(r==null)return this.errors.add({severity:b.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(be(r.urls));for(let a of be(t))i.has(a)&&i.delete(a);return i.size>0?(this.errors.add({severity:b.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${be(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:b.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:b.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:b.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:v(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:v(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:v(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};o();l();function Ae(n){return A(I(n))}o();l();o();l();o();l();var ne={};ke(ne,{sanitizeForIdentifier:()=>Et,sanitizeToCamelCase:()=>Vs,sanitizeToPascalCase:()=>Ws});o();l();var xn=Rn(yn(),1);o();l();function je(n){return A(I(n))}function Ws(n){let t=Et(n);return je(t)}function Vs(n){let t=Et(n);return I(t)}function Et(n){if(n==="")return"empty";let t=n;if(/^\d/.test(t)){let r=$s(t);t=r.numberAsWords+A(r.rest)}return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)||(t=t.replace(/^[^a-zA-Z0-9]+/,""),t=I(t)),/^\d/.test(t)&&(t="value"+t),t===""?"value":t}function $s(n){let t=n.match(/^(\d+)/);if(!t||!t[1])return{numberAsWords:"",rest:n};let e=t[1],r=n.slice(e.length);try{return{numberAsWords:(0,xn.toWords)(parseInt(e,10)),rest:r}}catch(i){let a={0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"};return{numberAsWords:e.split("").map(p=>a[p]||p).join(""),rest:r}}}o();l();var Ie={};ke(Ie,{generateEnumCaseLabel:()=>js,generateName:()=>zs,sanitizeLiteralValue:()=>St});o();l();function zs(n){let t=St(n);return je(t)}function js(n){let t=St(n);return I(t)}function St(n){if(n==="")return"empty";let t=n;return/^[a-zA-Z][a-zA-Z0-9]*$/.test(n)||(t=t.replace(/^[^a-zA-Z0-9]+/,""),t=I(t)),/^\d/.test(t)||t===""?"value":t}var d={};ke(d,{AccessLevel:()=>wn,Class:()=>ie,CodeBlock:()=>N,Comment:()=>ae,ComputedProperty:()=>oe,DeclarationType:()=>Re,DocComment:()=>le,EnumWithAssociatedValues:()=>ue,EnumWithRawValues:()=>fe,Expression:()=>P,Extension:()=>pe,FunctionArgument:()=>ce,FunctionParameter:()=>me,Initializer:()=>de,LineBreak:()=>qe,Method:()=>he,Pattern:()=>Ge,Property:()=>ye,Protocol:()=>vn,Statement:()=>se,Struct:()=>xe,Symbol:()=>E,SymbolRegistry:()=>et,Type:()=>Ke,TypeReference:()=>Ze,class_:()=>Gs,codeBlock:()=>Hs,comment:()=>Ks,computedProperty:()=>Zs,docComment:()=>Js,enumWithAssociatedValues:()=>Xs,enumWithRawValues:()=>Qs,extension:()=>eo,functionArgument:()=>to,functionParameter:()=>ro,initializer:()=>no,method:()=>io,property:()=>ao,struct:()=>so});o();l();o();l();o();l();var wn={Open:"open",Public:"public",Package:"package",Internal:"internal",Fileprivate:"fileprivate",Private:"private"};o();l();o();l();o();l();o();l();var Ye=class extends Te{toString(){return this.buffer}};var w=class extends J{toString(){let t=new Ye;return this.write(t),t.toString()}};var ie=class extends w{constructor({accessLevel:e,name:r,final:i,conformances:a,properties:s,initializers:p,methods:c,docs:h}){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=s,this.initializers=p!=null?p:[],this.methods=c!=null?c:[],this.docs=h}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("}")}};o();l();var N=class n extends w{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(ct)}static withStatements(e){return new n(r=>{e.forEach(i=>{i.write(r)})})}};o();l();var ae=class extends w{constructor({content:e}){super();f(this,"content");this.content=e}write(e){this.content.split(`
13
+ `).forEach(i=>{e.write(`// ${i}`),e.newLine()})}};o();l();o();l();function gn(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"),'\\"')}o();l();var Ys=["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"],qs=new Set(Ys);function X(n){return qs.has(n)}function L(n){return X(n)?`\`${n}\``:n}function G(n){return n==="self"?"self_":n}o();l();var P=class extends w{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(L(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:L(this.internalExpression.unsafeName),arguments_:this.internalExpression.arguments_,multiline:!!this.internalExpression.multiline});break;case"struct-initialization":this.writeCallableExpression({writer:e,target:L(this.internalExpression.unsafeName),arguments_:this.internalExpression.arguments_,multiline:!!this.internalExpression.multiline});break;case"class-initialization":this.writeCallableExpression({writer:e,target:L(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:v(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((s,p)=>{p>0&&(e.write(","),a?e.newLine():e.write(" ")),s.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(([s,p],c)=>{c>0&&(e.write(", "),i&&e.newLine()),s.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((s,p)=>{p>0&&(e.write(","),i?e.newLine():e.write(" ")),s.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(T({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(T({type:"function-call"},e))}static structInitialization(e){return new this(T({type:"struct-initialization"},e))}static classInitialization(e){return new this(T({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(T({type:"dictionary-literal"},e))}static arrayLiteral(e){return new this(T({type:"array-literal"},e))}static dataLiteral(e){return new this({type:"data-literal",value:e})}static methodCall(e){return new this(T({type:"method-call"},e))}static methodCallWithTrailingClosure(e){return new this(T({type:"method-call-with-trailing-closure"},e))}static contextualMethodCall(e){return new this(T({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"})}};o();l();o();l();var Re={Var:"var",Let:"let"};var se=class extends w{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(Re.Let),e.write(" "),e.write(L(this.internalStatement.unsafeName)),e.write(" = "),this.internalStatement.value.write(e),this.internalStatement.noTrailingNewline||e.newLine();break;case"variable-declaration":e.write(Re.Var),e.write(" "),e.write(L(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(L(this.internalStatement.unsafeName)),e.write("("),(r=this.internalStatement.parameters)==null||r.forEach((s,p)=>{p>0&&e.write(", "),s.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:N.empty()).write(e),e.newLine();break;case"variable-assignment":e.write(L(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 s of this.internalStatement.cases)if(e.write("case "),s.pattern.write(e),e.write(":"),e.newLine(),s.body.length>0){e.indent();for(let p of s.body)p.write(e);e.dedent()}if(this.internalStatement.defaultCase&&(e.write("default:"),e.newLine(),this.internalStatement.defaultCase.length>0)){e.indent();for(let s of this.internalStatement.defaultCase)s.write(e);e.dedent()}e.write("}"),e.newLine();break;case"if":{e.write("if "),this.internalStatement.condition.write(e),e.write(" "),N.withStatements(this.internalStatement.body).write(e);for(let s of(a=this.internalStatement.elseIfs)!=null?a:[])e.write(" else if "),s.condition.write(e),e.write(" "),N.withStatements(s.body).write(e);this.internalStatement.else&&(e.write(" else "),N.withStatements(this.internalStatement.else).write(e)),e.newLine();break}case"raw":e.write(this.internalStatement.content),e.newLine();break;default:v(this.internalStatement)}}static typealiasDeclaration(e){return new this(T({type:"typealias-declaration"},e))}static constantDeclaration(e){return new this(T({type:"constant-declaration"},e))}static variableDeclaration(e){return new this(T({type:"variable-declaration"},e))}static functionDeclaration(e){return new this(T({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(T({type:"switch"},e))}static if(e){return new this(T({type:"if"},e))}static raw(e){return new this({type:"raw",content:e})}};var oe=class extends w{constructor({unsafeName:e,accessLevel:r,type:i,body:a,docs:s}){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=s}write(e){this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write("var "),e.write(L(this.unsafeName)),e.write(": "),this.type.write(e),e.write(" "),this.body instanceof N?this.body.write(e):this.body instanceof P?N.withStatements([se.expressionStatement(this.body)]).write(e):v(this.body)}};o();l();var le=class n extends w{constructor({summary:e,description:r,parameters:i,returns:a,throws:s}){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=(s!=null?s:[]).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,s)=>{s===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,s)=>{s===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}};o();l();var ue=class extends w{constructor({accessLevel:e,name:r,conformances:i,cases:a,initializers:s,methods:p,nestedTypes:c,docs:h}){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=s!=null?s:[],this.methods=p!=null?p:[],this.nestedTypes=c!=null?c:[],this.docs=h}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 "),X(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("}")}};o();l();var fe=class extends w{constructor({accessLevel:e,name:r,conformances:i,cases:a,docs:s}){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=s}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 "),X(r.unsafeName)?e.write(`\`${r.unsafeName}\``):e.write(r.unsafeName),r.rawValue!==r.unsafeName&&(e.write(" = "),e.write(`"${gn(r.rawValue)}"`)),e.newLine()}),e.dedent(),e.write("}")}};o();l();var pe=class extends w{constructor({name:e,conformances:r,initializers:i,computedProperties:a,methods:s,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=s!=null?s:[],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("}")}};o();l();var ce=class extends w{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)}};o();l();var me=class extends w{constructor({argumentLabel:e,unsafeName:r,escaping:i,type:a,defaultValue:s,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=s,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))}};o();l();var de=class extends w{constructor({accessLevel:e,convenience:r,failable:i,throws:a,parameters:s,body:p,multiline:c,docs:h}){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=s!=null?s:[],this.body=p!=null?p:N.empty(),this.multiline=c,this.docs=h}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)}};o();l();var qe=class n extends w{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})}};o();l();var he=class extends w{constructor({attributes:e,unsafeName:r,accessLevel:i,static_:a,parameters:s,async:p,throws:c,returnType:h,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=s!=null?s:[],this.async=p,this.throws=c,this.returnType=h,this.body=x!=null?x:N.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?P.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(L(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)}};o();l();var Ge=class extends w{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:v(this.internalPattern.type)}}static enumCaseValueBinding(e){return new this(T({type:"enum-case-value-binding"},e))}};o();l();var ye=class extends w{constructor({unsafeName:e,accessLevel:r,static_:i,declarationType:a,type:s,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=s,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(" "),X(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))}};o();l();var vn={CaseIterable:"CaseIterable",Codable:"Codable",CodingKey:"CodingKey",Decodable:"Decodable",Encodable:"Encodable",Equatable:"Equatable",Error:"Error",Hashable:"Hashable",Sendable:"Sendable",MultipartFormDataConvertible:"MultipartFormDataConvertible"};o();l();var xe=class extends w{constructor({attributes:e,accessLevel:r,name:i,conformances:a,properties:s,initializers:p,methods:c,nestedTypes:h,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=s!=null?s:[],this.initializers=p!=null?p:[],this.methods=c!=null?c:[],this.nestedTypes=h!=null?h:[],this.docs=x}write(e){this.docs!=null&&this.docs.write(e),this.attributes.forEach(c=>{var h;(h=c.arguments)!=null&&h.length?P.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,h)=>{h===0?e.write(": "):h>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,s=this.nestedTypes.length>0;this.properties.forEach(c=>{c.write(e),e.newLine()});let p=r;i&&(p&&e.newLine(),this.initializers.forEach((c,h)=>{h>0&&e.newLine(),c.write(e),e.newLine()}),p=!0),a&&(p&&e.newLine(),this.methods.forEach((c,h)=>{h>0&&e.newLine(),c.write(e),e.newLine()}),p=!0),s&&(p&&e.newLine(),this.nestedTypes.forEach((c,h)=>{h>0&&e.newLine(),c.write(e),e.newLine()})),e.dedent(),e.write("}")}};o();l();var D={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"}},He={Data:{type:"data",symbolName:"Data"},Date:{type:"date",symbolName:"Date"},UUID:{type:"uuid",symbolName:"UUID"}},Ke=class n extends w{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:v(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${A(r)}`}case"array":return`${$e(n.toCaseName(e.internalType.elementType))}Array`;case"dictionary":{let r=$e(n.toCaseName(e.internalType.keyType)),i=A(n.toCaseName(e.internalType.valueType));return`${r}To${i}Dictionary`}case"optional":return`optional${A(n.toCaseName(e.internalType.valueType))}`;case"nullable":return`nullable${A(n.toCaseName(e.internalType.valueType))}`;case"custom":return I(e.internalType.name);case"existential-any":return`any${A(e.internalType.protocolName)}`;case"calendar-date":return"calendarDate";case"json-value":return"json";default:v(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:v(this.internalType)}}static primitiveSymbolNames(){return ze(D).map(e=>e.symbolName)}static foundationSymbolNames(){return ze(He).map(e=>e.symbolName)}static string(){return new this(D.String)}static bool(){return new this(D.Bool)}static int(){return new this(D.Int)}static uint(){return new this(D.UInt)}static uint64(){return new this(D.UInt64)}static int64(){return new this(D.Int64)}static float(){return new this(D.Float)}static double(){return new this(D.Double)}static void(){return new this(D.Void)}static any(){return new this(D.Any)}static data(){return new this(He.Data)}static date(){return new this(He.Date)}static uuid(){return new this(He.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"})}};o();l();var Ze=class n extends w{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:v(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:v(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)}};o();l();o();l();var y=class y{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 y.SWIFT_SYMBOL_ID===t||t.startsWith(`${y.SWIFT_SYMBOL_ID}.`)}static isSwiftSymbolName(t){return t in y.swiftTypeSymbolsByName}static isFoundationSymbol(t){return y.FOUNDATION_SYMBOL_ID===t||t.startsWith(`${y.FOUNDATION_SYMBOL_ID}.`)}static isFoundationSymbolName(t){return t in y.foundationTypeSymbolsByName}static isCustomSymbol(t){return!y.isSwiftSymbol(t)&&!y.isFoundationSymbol(t)}static create(t,e,r){return new y(t,e,r)}static swiftType(t){return y.create(`${y.SWIFT_SYMBOL_ID}.${t}`,t,{type:"system"})}static foundationType(t){return y.create(`${y.FOUNDATION_SYMBOL_ID}.${t}`,t,{type:"system"})}get isSwiftSymbol(){return y.isSwiftSymbol(this.id)}get isFoundationSymbol(){return y.isFoundationSymbol(this.id)}get isCustomSymbol(){return y.isCustomSymbol(this.id)}};f(y,"SWIFT_SYMBOL_NAME","Swift"),f(y,"SWIFT_SYMBOL_ID",y.SWIFT_SYMBOL_NAME),f(y,"swiftTypeSymbolsByName",{String:y.swiftType("String"),Bool:y.swiftType("Bool"),Int:y.swiftType("Int"),Int64:y.swiftType("Int64"),UInt:y.swiftType("UInt"),UInt64:y.swiftType("UInt64"),Float:y.swiftType("Float"),Double:y.swiftType("Double"),Void:y.swiftType("Void"),Encoder:y.swiftType("Encoder"),Decoder:y.swiftType("Decoder"),Any:y.swiftType("Any")}),f(y,"swiftTypeSymbols",Object.values(y.swiftTypeSymbolsByName)),f(y,"FOUNDATION_SYMBOL_NAME","Foundation"),f(y,"FOUNDATION_SYMBOL_ID",y.FOUNDATION_SYMBOL_NAME),f(y,"foundationTypeSymbolsByName",{Data:y.foundationType("Data"),Date:y.foundationType("Date"),URLSession:y.foundationType("URLSession"),UUID:y.foundationType("UUID")}),f(y,"foundationTypeSymbols",Object.values(y.foundationTypeSymbolsByName));var E=y;o();l();o();l();o();l();o();l();var Je=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)}},Xe=class extends Je{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 Je{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 U(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 Le=class{constructor(){f(this,"symbolsById",new Map)}createModuleSymbol({symbolId:t,symbolName:e}){this.validateSymbolNotExists(t);let r=new Xe(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 s=1;s<=a.length;s++){let p=a.slice(a.length-s),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 s=a;for(let c=0;c<i.length;c++){let h=i[c];if(_e(h),s=(p=s.getChildByName(h))!=null?p:null,s===null)return null}return s}resolveFirstSegment(t,e){let r=t;for(;r!==null;){let s=r.getChildByName(e);if(s)return s;r=r.parent}let i=t.kind==="module"?t:t.getNearestModuleAncestorOrThrow();if(i.name===e)return i;for(let s of i.imports)if(s.name===e)return s;let a=null;for(let s of i.imports){let p=s.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 _e(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 et=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 Le,e=()=>{let s=t.createModuleSymbol({symbolId:E.SWIFT_SYMBOL_ID,symbolName:E.SWIFT_SYMBOL_NAME});return E.swiftTypeSymbols.forEach(p=>{let c=t.createTypeSymbol({symbolId:p.id,symbolName:p.name,shape:{type:"system"}});t.nestSymbol({parentSymbolId:s.id,childSymbolId:c.id})}),s},r=()=>{let s=t.createModuleSymbol({symbolId:E.FOUNDATION_SYMBOL_ID,symbolName:E.FOUNDATION_SYMBOL_NAME});return E.foundationTypeSymbols.forEach(p=>{let c=t.createTypeSymbol({symbolId:p.id,symbolName:p.name,shape:{type:"system"}});t.nestSymbol({parentSymbolId:s.id,childSymbolId:c.id})}),s},i=e(),a=r();return{graph:t,swiftSymbol:i,foundationSymbol:a}}getRegisteredSourceModuleSymbolOrThrow(){return U(this.registeredSourceModule,"Module symbol not found."),E.create(this.registeredSourceModule.id,this.registeredSourceModule.name,{type:"other"})}getRegisteredTestModuleSymbolOrThrow(){return U(this.registeredTestModule,"Module symbol not found."),E.create(this.registeredTestModule.id,this.registeredTestModule.name,{type:"other"})}getSymbolByIdOrThrow(t){let e=this.graph.getSymbolById(t);return U(e,`Symbol with ID '${t}' not found in registry.`),E.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,E.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),U(this.registeredSourceModule,"Cannot register a test module before registering a source module."),r.addImport(this.registeredSourceModule),this.registeredTestModule=r,E.create(r.id,r.name,{type:"other"})}registerSourceModuleType(t,e){U(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}),E.create(i.id,i.name,e)}registerTestModuleType(t,e){U(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}),E.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),s=this.graph.createTypeSymbol({symbolId:a,symbolName:e,shape:r});return this.graph.nestSymbol({parentSymbolId:i,childSymbolId:s.id}),E.create(s.id,s.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?E.create(i.id,i.name,i.kind==="type"?i.shape:{type:"other"}):null}inferSymbolIdForSourceModuleType(t){return U(this.registeredSourceModule,"Cannot get symbol id for a type before registering a module."),`${this.registeredSourceModule.id}.${t}`}inferSymbolIdForTestModuleType(t){return U(this.registeredTestModule,"Cannot get symbol id for a type before registering a module."),`${this.registeredTestModule.id}.${t}`}inferSymbolIdForNestedType(t,e){return`${t}.${e}`}};function Gs(n){return new ie(n)}function Hs(n){return new N(n)}function Ks(n){return new ae(n)}function Zs(n){return new oe(n)}function Js(n){return new le(n)}function Xs(n){return new ue(n)}function Qs(n){return new fe(n)}function eo(n){return new pe(n)}function to(n){return new ce(n)}function ro(n){return new me(n)}function no(n){return new de(n)}function io(n){return new he(n)}function ao(n){return new ye(n)}function so(n){return new xe(n)}o();l();var we=class{constructor({context:t}){f(this,"context");this.context=t}convert(t){switch(t.typeReference.type){case"list":return d.Type.array(this.convert({typeReference:t.typeReference.value}));case"literal":return this.convertLiteral({literal:t.typeReference.value});case"map":return d.Type.dictionary(this.convert({typeReference:t.typeReference.key}),this.convert({typeReference:t.typeReference.value}));case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?this.convertUnknown():this.convertNamed({named:e})}case"optional":return d.Type.optional(this.convert({typeReference:t.typeReference.value}));case"nullable":return d.Type.nullable(this.convert({typeReference:t.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:t.typeReference.value});case"set":return d.Type.jsonValue();case"unknown":return this.convertUnknown();default:v(t.typeReference)}}convertNamed({named:t}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return d.Type.custom(t.declaration.name.pascalCase.unsafeName);default:v(t)}}convertLiteral({literal:t}){switch(t.type){case"boolean":return d.Type.bool();case"string":return d.Type.custom(Ae(t.value))}}convertUnknown(){return d.Type.jsonValue()}convertPrimitive({primitive:t}){switch(t){case"INTEGER":return d.Type.int();case"UINT":return d.Type.int();case"LONG":return d.Type.int64();case"UINT_64":return d.Type.uint64();case"FLOAT":return d.Type.float();case"DOUBLE":return d.Type.double();case"BOOLEAN":return d.Type.bool();case"STRING":return d.Type.string();case"DATE":return d.Type.date();case"DATE_TIME":return d.Type.date();case"UUID":return d.Type.uuid();case"BASE_64":return d.Type.string();case"BIG_INTEGER":return d.Type.string();default:v(t)}}};var tt=class{constructor({context:t}){f(this,"context");this.context=t}convert(t){switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":{if(t.typeReference.value.type==="string")return d.Expression.enumCaseShorthand(Ie.generateEnumCaseLabel(t.typeReference.value.value));if(t.typeReference.value.type==="boolean")return d.Expression.nop();v(t.typeReference.value);break}case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?d.Expression.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"nullable":return this.convertNullable({nullable:t.typeReference,value:t.value,as:t.as});case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"set":return d.Expression.nop();case"unknown":return this.convertUnknown(t.value);default:v(t.typeReference)}}convertList({list:t,value:e}){return Array.isArray(e)?d.Expression.arrayLiteral({elements:e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}}),multiline:!0}):(this.context.errors.add({severity:b.Critical,message:`Expected array but got: ${typeof e}`}),d.Expression.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:b.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),d.Expression.nop()):d.Expression.dictionaryLiteral({entries:Object.entries(e).map(([r,i])=>{this.context.errors.scope(r);try{return[this.convert({typeReference:t.key,value:r,as:"mapKey"}),this.convert({typeReference:t.value,value:i,as:"mapValue"})]}finally{this.context.errors.unscope()}}),multiline:!0})}convertNamed({named:t,value:e,as:r}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:r});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"object":return this.convertObject({object_:t,value:e,as:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:v(t)}}convertNullable({nullable:t,value:e,as:r}){return e==null?d.Expression.enumCaseShorthand("null"):d.Expression.contextualMethodCall({methodName:"value",arguments_:[d.functionArgument({value:this.convert({typeReference:t.value,value:e,as:r})})]})}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let r=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(r==null)return d.Expression.nop();let i=r.singleDiscriminatedUnionType,a=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:r,unionVariant:i});return a==null?d.Expression.nop():d.Expression.methodCall({target:d.Expression.reference(t.declaration.name.pascalCase.unsafeName),methodName:ne.sanitizeToCamelCase(i.discriminantValue.name.camelCase.unsafeName),arguments_:[d.functionArgument({value:d.Expression.contextualMethodCall({methodName:"init",arguments_:a,multiline:!0})})],multiline:!0})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){var i;let r=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});switch(e.type){case"samePropertiesAsObject":{let a=this.context.resolveNamedType({typeId:e.typeId});if(a==null)return;let s=this.convertNamed({named:a,value:t.value});if(!s.isStructInitialization()){this.context.errors.add({severity:b.Critical,message:"Internal error; expected union value to be a struct"});return}let p=s.asStructInitializationOrThrow();return[...r,...(i=p.arguments_)!=null?i:[]]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let a=this.context.getRecord(t.value);return a==null?[...r]:[...r,d.functionArgument({label:G(ne.sanitizeToCamelCase(e.discriminantValue.name.camelCase.unsafeName)),value:this.convert({typeReference:e.typeReference,value:a[e.discriminantValue.wireValue]})})]}finally{this.context.errors.unscope()}case"noProperties":return r;default:v(e)}}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){var i;return this.context.getExampleObjectProperties({parameters:(i=e.properties)!=null?i:[],snippetObject:t.value}).map(a=>{this.context.errors.scope(a.name.wireValue);try{return d.functionArgument({label:G(a.name.name.camelCase.unsafeName),value:this.convert(a)})}finally{this.context.errors.unscope()}})}convertEnum({enum_:t,value:e}){let r=this.getEnumValue({enum_:t,value:e});return r==null?d.Expression.nop():d.Expression.enumCaseShorthand(r.name.camelCase.unsafeName)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:b.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let r=t.values.find(i=>i.wireValue===e);if(r==null){this.context.errors.add({severity:b.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return r}convertObject({object_:t,value:e,as:r}){return d.Expression.structInitialization({unsafeName:t.declaration.name.pascalCase.unsafeName,arguments_:this.context.getExampleObjectProperties({parameters:t.properties,snippetObject:e}).map(i=>this.convert(i).isNop()?null:d.functionArgument({label:G(i.name.name.camelCase.unsafeName),value:this.convert(i)})).filter(i=>i!=null),multiline:!0})}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return r==null?d.Expression.nop():r}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let r of t.types)try{let i=this.convert({typeReference:r,value:e}),s=new we({context:this.context}).convert({typeReference:r});return d.Expression.methodCall({target:d.Expression.reference(t.declaration.name.pascalCase.unsafeName),methodName:s.toCaseName(),arguments_:[d.functionArgument({value:i})],multiline:!0})}catch(i){continue}this.context.errors.add({severity:b.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown(t){switch(typeof t){case"boolean":return d.Expression.contextualMethodCall({methodName:"bool",arguments_:[d.functionArgument({value:d.Expression.boolLiteral(t)})]});case"string":return d.Expression.contextualMethodCall({methodName:"string",arguments_:[d.functionArgument({value:d.Expression.stringLiteral(t)})]});case"number":return d.Expression.contextualMethodCall({methodName:"number",arguments_:[d.functionArgument({value:d.Expression.numberLiteral(t)})]});case"object":return t===null?d.Expression.enumCaseShorthand("null"):Array.isArray(t)?d.Expression.contextualMethodCall({methodName:"array",arguments_:[d.functionArgument({value:d.Expression.arrayLiteral({elements:t.map(e=>this.convertUnknown(e)),multiline:!0})})]}):d.Expression.contextualMethodCall({methodName:"object",arguments_:[d.functionArgument({value:d.Expression.dictionaryLiteral({entries:Object.entries(t).map(([e,r])=>[d.Expression.stringLiteral(e),this.convertUnknown(r)]),multiline:!0})})]});default:throw new Error(`Internal error; unsupported unknown type: ${typeof t}`)}}convertPrimitive({primitive:t,value:e,as:r}){switch(t){case"INTEGER":case"UINT":case"LONG":case"UINT_64":case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e,as:r});return i==null?d.Expression.nop():d.Expression.numberLiteral(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:r});return i==null?d.Expression.nop():d.Expression.boolLiteral(i)}case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?d.Expression.nop():d.Expression.stringLiteral(i)}case"DATE":{let i=this.context.getValueAsString({value:e});return i==null?d.Expression.nop():d.Expression.calendarDateLiteral(i)}case"DATE_TIME":{let i=this.context.getValueAsString({value:e});if(i==null)return d.Expression.nop();let a=new Date(i).getTime(),s=Math.round(a/1e3),c=new Date(s*1e3).toISOString().replace(/\.\d{3}Z$/,"Z");return d.Expression.dateLiteral(c)}case"UUID":{let i=this.context.getValueAsString({value:e});return i==null?d.Expression.nop():d.Expression.uuidLiteral(i)}case"BASE_64":{let i=this.context.getValueAsString({value:e});return i==null?d.Expression.nop():d.Expression.stringLiteral(i)}case"BIG_INTEGER":return this.context.getValueAsString({value:e})==null?d.Expression.nop():d.Expression.nop();default:v(t)}}getValueAsNumber({value:t,as:e}){let r=e==="mapKey"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:t,as:e}){let r=(()=>{switch(e){case"mapKey":return t==="true"?!0:t==="false"?!1:t;case"mapValue":case void 0:return t;default:v(e)}})();return this.context.getValueAsBoolean({value:r})}};o();l();var rt=class{constructor({context:t}){f(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){var a;let r={fileFields:[],bodyPropertyFields:[]},i=(a=this.context.getRecord(e))!=null?a:{};for(let s of t.properties)switch(s.type){case"file":{let p=d.functionArgument({label:G(s.name.camelCase.unsafeName),value:this.getSingleFileProperty({property:s,record:i})});r.fileFields.push(p);break}case"fileArray":{let p=d.functionArgument({label:G(s.name.camelCase.unsafeName),value:this.getArrayFileProperty({property:s,record:i})});r.fileFields.push(p);break}case"bodyProperty":{let p=d.functionArgument({label:G(s.name.name.camelCase.unsafeName),value:this.getBodyProperty({property:s,record:i})});r.bodyPropertyFields.push(p);break}default:v(s)}return r}getSingleFileProperty({property:t,record:e}){let r=this.context.getSingleFileValue({property:t,record:e});return d.Expression.contextualMethodCall({methodName:"init",arguments_:[d.functionArgument({label:"data",value:d.Expression.dataLiteral(r!=null?r:"")})]})}getArrayFileProperty({property:t,record:e}){let r=this.context.getFileArrayValues({property:t,record:e});return d.Expression.arrayLiteral({elements:(r!=null?r:[]).map(i=>d.Expression.contextualMethodCall({methodName:"init",arguments_:[d.functionArgument({label:"data",value:d.Expression.dataLiteral(i)})]})),multiline:!0})}getBodyProperty({property:t,record:e}){let r=e[t.name.wireValue];return r==null?d.Expression.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:r})}};var Nt=class n extends Ne{constructor({ir:e,config:r,options:i}){super({ir:e,config:r,options:i});f(this,"ir");f(this,"customConfig");f(this,"dynamicTypeMapper");f(this,"dynamicTypeLiteralMapper");f(this,"filePropertyMapper");this.ir=e,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeMapper=new we({context:this}),this.dynamicTypeLiteralMapper=new tt({context:this}),this.filePropertyMapper=new rt({context:this})}clone(){return new n({ir:this.ir,config:this.config,options:this.options})}getModuleName(){var e,r;return(r=(e=this.customConfig)==null?void 0:e.moduleName)!=null?r:Ae(this.getApiName())}getRootClientClassName(){var e,r;return(r=(e=this.customConfig)==null?void 0:e.clientClassName)!=null?r:`${Ae(this.getApiName())}Client`}getApiName(){return I(this.config.workspaceName)}};0&&(module.exports={DynamicSnippetsGeneratorContext});
2
20
  /*! Bundled license information:
3
21
 
4
22
  @esbuild-plugins/node-globals-polyfill/Buffer.js: