@fern-api/swift-dynamic-snippets 0.35.15 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,28 +1,30 @@
1
- "use strict";var Ps=Object.create;var rt=Object.defineProperty;var ks=Object.getOwnPropertyDescriptor;var Us=Object.getOwnPropertyNames;var _s=Object.getPrototypeOf,Ds=Object.prototype.hasOwnProperty;var $s=(i,t,e)=>t in i?rt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Le=(i,t,e)=>()=>{if(e)throw e[0];try{return i&&(t=i(i=0)),t}catch(r){throw e=[r],r}};var ge=(i,t)=>()=>{try{return t||i((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},Fe=(i,t)=>{for(var e in t)rt(i,e,{get:t[e],enumerable:!0})},Ur=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Us(t))!Ds.call(i,s)&&s!==e&&rt(i,s,{get:()=>t[s],enumerable:!(r=ks(t,s))||r.enumerable});return i};var qs=(i,t,e)=>(e=i!=null?Ps(_s(i)):{},Ur(t||!i||!i.__esModule?rt(e,"default",{value:i,enumerable:!0}):e,i)),Ws=i=>Ur(rt({},"__esModule",{value:!0}),i);var d=(i,t,e)=>$s(i,typeof t!="symbol"?t+"":t,e);var u=Le(()=>{"use strict"});var y={};Fe(y,{_debugEnd:()=>Rn,_debugProcess:()=>Nn,_events:()=>Vn,_eventsCount:()=>jn,_exiting:()=>an,_fatalExceptions:()=>vn,_getActiveHandles:()=>cn,_getActiveRequests:()=>pn,_kill:()=>fn,_linkedBinding:()=>on,_maxListeners:()=>Wn,_preload_modules:()=>Dn,_rawDebug:()=>rn,_startProfilerIdleNotifier:()=>An,_stopProfilerIdleNotifier:()=>Cn,_tickCallback:()=>In,abort:()=>Mn,addListener:()=>zn,allowedNodeEnvironmentFlags:()=>bn,arch:()=>Wr,argv:()=>zr,argv0:()=>_n,assert:()=>Sn,binding:()=>Jr,browser:()=>tn,chdir:()=>Qr,config:()=>ln,cpuUsage:()=>St,cwd:()=>Xr,debugPort:()=>Un,default:()=>ei,dlopen:()=>un,domain:()=>sn,emit:()=>Jn,emitWarning:()=>Yr,env:()=>jr,execArgv:()=>Gr,execPath:()=>kn,exit:()=>gn,features:()=>wn,hasUncaughtExceptionCaptureCallback:()=>Tn,hrtime:()=>bt,kill:()=>yn,listeners:()=>Qn,memoryUsage:()=>hn,moduleLoadList:()=>nn,nextTick:()=>Dr,off:()=>Hn,on:()=>me,once:()=>Gn,openStdin:()=>xn,pid:()=>On,platform:()=>Vr,ppid:()=>Pn,prependListener:()=>Zn,prependOnceListener:()=>Xn,reallyExit:()=>mn,release:()=>en,removeAllListeners:()=>Yn,removeListener:()=>Kn,resourceUsage:()=>dn,setSourceMapsEnabled:()=>$n,setUncaughtExceptionCaptureCallback:()=>En,stderr:()=>Ln,stdin:()=>Fn,stdout:()=>Bn,title:()=>qr,umask:()=>Zr,uptime:()=>qn,version:()=>Hr,versions:()=>Kr});function rr(i){throw new Error("Node.js process "+i+" is not supported by JSPM core outside of Node.js")}function Vs(){!Me||!Te||(Me=!1,Te.length?ce=Te.concat(ce):xt=-1,ce.length&&_r())}function _r(){if(!Me){var i=setTimeout(Vs,0);Me=!0;for(var t=ce.length;t;){for(Te=ce,ce=[];++xt<t;)Te&&Te[xt].run();xt=-1,t=ce.length}Te=null,Me=!1,clearTimeout(i)}}function Dr(i){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];ce.push(new $r(i,t)),ce.length===1&&!Me&&setTimeout(_r,0)}function $r(i,t){this.fun=i,this.array=t}function G(){}function on(i){rr("_linkedBinding")}function un(i){rr("dlopen")}function pn(){return[]}function cn(){return[]}function Sn(i,t){if(!i)throw new Error(t||"assertion error")}function Tn(){return!1}function qn(){return xe.now()/1e3}function bt(i){var t=Math.floor((Date.now()-xe.now())*.001),e=xe.now()*.001,r=Math.floor(e)+t,s=Math.floor(e%1*1e9);return i&&(r=r-i[0],s=s-i[1],s<0&&(r--,s+=tr)),[r,s]}function me(){return ei}function Qn(i){return[]}var ce,Me,Te,xt,qr,Wr,Vr,jr,zr,Gr,Hr,Kr,Yr,Jr,Zr,Xr,Qr,en,tn,rn,nn,sn,an,ln,mn,fn,St,dn,hn,yn,gn,xn,bn,wn,vn,En,In,Nn,Rn,An,Cn,Bn,Ln,Fn,Mn,On,Pn,kn,Un,_n,Dn,$n,xe,er,tr,Wn,Vn,jn,zn,Gn,Hn,Kn,Yn,Jn,Zn,Xn,ei,ti=Le(()=>{"use strict";u();c();p();ce=[],Me=!1,xt=-1;$r.prototype.run=function(){this.fun.apply(null,this.array)};qr="browser",Wr="x64",Vr="browser",jr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},zr=["/usr/bin/node"],Gr=[],Hr="v16.8.0",Kr={},Yr=function(i,t){console.warn((t?t+": ":"")+i)},Jr=function(i){rr("binding")},Zr=function(i){return 0},Xr=function(){return"/"},Qr=function(i){},en={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};tn=!0,rn=G,nn=[];sn={},an=!1,ln={};mn=G,fn=G,St=function(){return{}},dn=St,hn=St,yn=G,gn=G,xn=G,bn={};wn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},vn=G,En=G;In=G,Nn=G,Rn=G,An=G,Cn=G,Bn=void 0,Ln=void 0,Fn=void 0,Mn=G,On=2,Pn=1,kn="/bin/usr/node",Un=9229,_n="node",Dn=[],$n=G,xe={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};xe.now===void 0&&(er=Date.now(),xe.timing&&xe.timing.navigationStart&&(er=xe.timing.navigationStart),xe.now=()=>Date.now()-er);tr=1e9;bt.bigint=function(i){var t=bt(i);return typeof BigInt>"u"?t[0]*tr+t[1]:BigInt(t[0]*tr)+BigInt(t[1])};Wn=10,Vn={},jn=0;zn=me,Gn=me,Hn=me,Kn=me,Yn=me,Jn=G,Zn=me,Xn=me;ei={version:Hr,versions:Kr,arch:Wr,platform:Vr,browser:tn,release:en,_rawDebug:rn,moduleLoadList:nn,binding:Jr,_linkedBinding:on,_events:Vn,_eventsCount:jn,_maxListeners:Wn,on:me,addListener:zn,once:Gn,off:Hn,removeListener:Kn,removeAllListeners:Yn,emit:Jn,prependListener:Zn,prependOnceListener:Xn,listeners:Qn,domain:sn,_exiting:an,config:ln,dlopen:un,uptime:qn,_getActiveRequests:pn,_getActiveHandles:cn,reallyExit:mn,_kill:fn,cpuUsage:St,resourceUsage:dn,memoryUsage:hn,kill:yn,exit:gn,openStdin:xn,allowedNodeEnvironmentFlags:bn,assert:Sn,features:wn,_fatalExceptions:vn,setUncaughtExceptionCaptureCallback:En,hasUncaughtExceptionCaptureCallback:Tn,emitWarning:Yr,nextTick:Dr,_tickCallback:In,_debugProcess:Nn,_debugEnd:Rn,_startProfilerIdleNotifier:An,_stopProfilerIdleNotifier:Cn,stdout:Bn,stdin:Fn,stderr:Ln,abort:Mn,umask:Zr,chdir:Qr,cwd:Xr,env:jr,title:qr,argv:zr,execArgv:Gr,pid:On,ppid:Pn,execPath:kn,debugPort:Un,hrtime:bt,argv0:_n,_preload_modules:Dn,setSourceMapsEnabled:$n}});var p=Le(()=>{"use strict";ti()});function js(){if(ri)return nt;ri=!0,nt.byteLength=b,nt.toByteArray=T,nt.fromByteArray=_;for(var i=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,m=r.length;s<m;++s)i[s]=r[s],t[r.charCodeAt(s)]=s;t[45]=62,t[95]=63;function l(N){var L=N.length;if(L%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var O=N.indexOf("=");O===-1&&(O=L);var V=O===L?0:4-O%4;return[O,V]}function b(N){var L=l(N),O=L[0],V=L[1];return(O+V)*3/4-V}function v(N,L,O){return(L+O)*3/4-O}function T(N){var L,O=l(N),V=O[0],J=O[1],W=new e(v(N,V,J)),Z=0,ee=J>0?V-4:V,Y;for(Y=0;Y<ee;Y+=4)L=t[N.charCodeAt(Y)]<<18|t[N.charCodeAt(Y+1)]<<12|t[N.charCodeAt(Y+2)]<<6|t[N.charCodeAt(Y+3)],W[Z++]=L>>16&255,W[Z++]=L>>8&255,W[Z++]=L&255;return J===2&&(L=t[N.charCodeAt(Y)]<<2|t[N.charCodeAt(Y+1)]>>4,W[Z++]=L&255),J===1&&(L=t[N.charCodeAt(Y)]<<10|t[N.charCodeAt(Y+1)]<<4|t[N.charCodeAt(Y+2)]>>2,W[Z++]=L>>8&255,W[Z++]=L&255),W}function I(N){return i[N>>18&63]+i[N>>12&63]+i[N>>6&63]+i[N&63]}function C(N,L,O){for(var V,J=[],W=L;W<O;W+=3)V=(N[W]<<16&16711680)+(N[W+1]<<8&65280)+(N[W+2]&255),J.push(I(V));return J.join("")}function _(N){for(var L,O=N.length,V=O%3,J=[],W=16383,Z=0,ee=O-V;Z<ee;Z+=W)J.push(C(N,Z,Z+W>ee?ee:Z+W));return V===1?(L=N[O-1],J.push(i[L>>2]+i[L<<4&63]+"==")):V===2&&(L=(N[O-2]<<8)+N[O-1],J.push(i[L>>10]+i[L>>4&63]+i[L<<2&63]+"=")),J.join("")}return nt}function zs(){if(ni)return wt;ni=!0;return wt.read=function(i,t,e,r,s){var m,l,b=s*8-r-1,v=(1<<b)-1,T=v>>1,I=-7,C=e?s-1:0,_=e?-1:1,N=i[t+C];for(C+=_,m=N&(1<<-I)-1,N>>=-I,I+=b;I>0;m=m*256+i[t+C],C+=_,I-=8);for(l=m&(1<<-I)-1,m>>=-I,I+=r;I>0;l=l*256+i[t+C],C+=_,I-=8);if(m===0)m=1-T;else{if(m===v)return l?NaN:(N?-1:1)*(1/0);l=l+Math.pow(2,r),m=m-T}return(N?-1:1)*l*Math.pow(2,m-r)},wt.write=function(i,t,e,r,s,m){var l,b,v,T=m*8-s-1,I=(1<<T)-1,C=I>>1,_=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=r?0:m-1,L=r?1:-1,O=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(b=isNaN(t)?1:0,l=I):(l=Math.floor(Math.log(t)/Math.LN2),t*(v=Math.pow(2,-l))<1&&(l--,v*=2),l+C>=1?t+=_/v:t+=_*Math.pow(2,1-C),t*v>=2&&(l++,v/=2),l+C>=I?(b=0,l=I):l+C>=1?(b=(t*v-1)*Math.pow(2,s),l=l+C):(b=t*Math.pow(2,C-1)*Math.pow(2,s),l=0));s>=8;i[e+N]=b&255,N+=L,b/=256,s-=8);for(l=l<<s|b,T+=s;T>0;i[e+N]=l&255,N+=L,l/=256,T-=8);i[e+N-L]|=O*128},wt}function oi(){if(ii)return Ie;ii=!0;let i=js(),t=zs(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ie.Buffer=l,Ie.SlowBuffer=J,Ie.INSPECT_MAX_BYTES=50;let r=2147483647;Ie.kMaxLength=r,l.TYPED_ARRAY_SUPPORT=s(),!l.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{let a=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(a,n),a.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function m(a){if(a>r)throw new RangeError('The value "'+a+'" is invalid for option "size"');let n=new Uint8Array(a);return Object.setPrototypeOf(n,l.prototype),n}function l(a,n,o){if(typeof a=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return I(a)}return b(a,n,o)}l.poolSize=8192;function b(a,n,o){if(typeof a=="string")return C(a,n);if(ArrayBuffer.isView(a))return N(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof a);if(ae(a,ArrayBuffer)||a&&ae(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ae(a,SharedArrayBuffer)||a&&ae(a.buffer,SharedArrayBuffer)))return L(a,n,o);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let f=a.valueOf&&a.valueOf();if(f!=null&&f!==a)return l.from(f,n,o);let h=O(a);if(h)return h;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return l.from(a[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof a)}l.from=function(a,n,o){return b(a,n,o)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function v(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function T(a,n,o){return v(a),a<=0?m(a):n!==void 0?typeof o=="string"?m(a).fill(n,o):m(a).fill(n):m(a)}l.alloc=function(a,n,o){return T(a,n,o)};function I(a){return v(a),m(a<0?0:V(a)|0)}l.allocUnsafe=function(a){return I(a)},l.allocUnsafeSlow=function(a){return I(a)};function C(a,n){if((typeof n!="string"||n==="")&&(n="utf8"),!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);let o=W(a,n)|0,f=m(o),h=f.write(a,n);return h!==o&&(f=f.slice(0,h)),f}function _(a){let n=a.length<0?0:V(a.length)|0,o=m(n);for(let f=0;f<n;f+=1)o[f]=a[f]&255;return o}function N(a){if(ae(a,Uint8Array)){let n=new Uint8Array(a);return L(n.buffer,n.byteOffset,n.byteLength)}return _(a)}function L(a,n,o){if(n<0||a.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');let f;return n===void 0&&o===void 0?f=new Uint8Array(a):o===void 0?f=new Uint8Array(a,n):f=new Uint8Array(a,n,o),Object.setPrototypeOf(f,l.prototype),f}function O(a){if(l.isBuffer(a)){let n=V(a.length)|0,o=m(n);return o.length===0||a.copy(o,0,0,n),o}if(a.length!==void 0)return typeof a.length!="number"||Qt(a.length)?m(0):_(a);if(a.type==="Buffer"&&Array.isArray(a.data))return _(a.data)}function V(a){if(a>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return a|0}function J(a){return+a!=a&&(a=0),l.alloc(+a)}l.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==l.prototype},l.compare=function(n,o){if(ae(n,Uint8Array)&&(n=l.from(n,n.offset,n.byteLength)),ae(o,Uint8Array)&&(o=l.from(o,o.offset,o.byteLength)),!l.isBuffer(n)||!l.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;let f=n.length,h=o.length;for(let w=0,E=Math.min(f,h);w<E;++w)if(n[w]!==o[w]){f=n[w],h=o[w];break}return f<h?-1:h<f?1:0},l.isEncoding=function(n){switch(String(n).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}},l.concat=function(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return l.alloc(0);let f;if(o===void 0)for(o=0,f=0;f<n.length;++f)o+=n[f].length;let h=l.allocUnsafe(o),w=0;for(f=0;f<n.length;++f){let E=n[f];if(ae(E,Uint8Array))w+E.length>h.length?(l.isBuffer(E)||(E=l.from(E)),E.copy(h,w)):Uint8Array.prototype.set.call(h,E,w);else if(l.isBuffer(E))E.copy(h,w);else throw new TypeError('"list" argument must be an Array of Buffers');w+=E.length}return h};function W(a,n){if(l.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||ae(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof a);let o=a.length,f=arguments.length>2&&arguments[2]===!0;if(!f&&o===0)return 0;let h=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Xt(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return kr(a).length;default:if(h)return f?-1:Xt(a).length;n=(""+n).toLowerCase(),h=!0}}l.byteLength=W;function Z(a,n,o){let f=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(a||(a="utf8");;)switch(a){case"hex":return Ns(this,n,o);case"utf8":case"utf-8":return Rr(this,n,o);case"ascii":return Ts(this,n,o);case"latin1":case"binary":return Is(this,n,o);case"base64":return vs(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rs(this,n,o);default:if(f)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),f=!0}}l.prototype._isBuffer=!0;function ee(a,n,o){let f=a[n];a[n]=a[o],a[o]=f}l.prototype.swap16=function(){let n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<n;o+=2)ee(this,o,o+1);return this},l.prototype.swap32=function(){let n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<n;o+=4)ee(this,o,o+3),ee(this,o+1,o+2);return this},l.prototype.swap64=function(){let n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<n;o+=8)ee(this,o,o+7),ee(this,o+1,o+6),ee(this,o+2,o+5),ee(this,o+3,o+4);return this},l.prototype.toString=function(){let n=this.length;return n===0?"":arguments.length===0?Rr(this,0,n):Z.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(n){if(!l.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:l.compare(this,n)===0},l.prototype.inspect=function(){let n="",o=Ie.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},e&&(l.prototype[e]=l.prototype.inspect),l.prototype.compare=function(n,o,f,h,w){if(ae(n,Uint8Array)&&(n=l.from(n,n.offset,n.byteLength)),!l.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(o===void 0&&(o=0),f===void 0&&(f=n?n.length:0),h===void 0&&(h=0),w===void 0&&(w=this.length),o<0||f>n.length||h<0||w>this.length)throw new RangeError("out of range index");if(h>=w&&o>=f)return 0;if(h>=w)return-1;if(o>=f)return 1;if(o>>>=0,f>>>=0,h>>>=0,w>>>=0,this===n)return 0;let E=w-h,F=f-o,D=Math.min(E,F),U=this.slice(h,w),$=n.slice(o,f);for(let P=0;P<D;++P)if(U[P]!==$[P]){E=U[P],F=$[P];break}return E<F?-1:F<E?1:0};function Y(a,n,o,f,h){if(a.length===0)return-1;if(typeof o=="string"?(f=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Qt(o)&&(o=h?0:a.length-1),o<0&&(o=a.length+o),o>=a.length){if(h)return-1;o=a.length-1}else if(o<0)if(h)o=0;else return-1;if(typeof n=="string"&&(n=l.from(n,f)),l.isBuffer(n))return n.length===0?-1:Nr(a,n,o,f,h);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?h?Uint8Array.prototype.indexOf.call(a,n,o):Uint8Array.prototype.lastIndexOf.call(a,n,o):Nr(a,[n],o,f,h);throw new TypeError("val must be string, number or Buffer")}function Nr(a,n,o,f,h){let w=1,E=a.length,F=n.length;if(f!==void 0&&(f=String(f).toLowerCase(),f==="ucs2"||f==="ucs-2"||f==="utf16le"||f==="utf-16le")){if(a.length<2||n.length<2)return-1;w=2,E/=2,F/=2,o/=2}function D($,P){return w===1?$[P]:$.readUInt16BE(P*w)}let U;if(h){let $=-1;for(U=o;U<E;U++)if(D(a,U)===D(n,$===-1?0:U-$)){if($===-1&&($=U),U-$+1===F)return $*w}else $!==-1&&(U-=U-$),$=-1}else for(o+F>E&&(o=E-F),U=o;U>=0;U--){let $=!0;for(let P=0;P<F;P++)if(D(a,U+P)!==D(n,P)){$=!1;break}if($)return U}return-1}l.prototype.includes=function(n,o,f){return this.indexOf(n,o,f)!==-1},l.prototype.indexOf=function(n,o,f){return Y(this,n,o,f,!0)},l.prototype.lastIndexOf=function(n,o,f){return Y(this,n,o,f,!1)};function gs(a,n,o,f){o=Number(o)||0;let h=a.length-o;f?(f=Number(f),f>h&&(f=h)):f=h;let w=n.length;f>w/2&&(f=w/2);let E;for(E=0;E<f;++E){let F=parseInt(n.substr(E*2,2),16);if(Qt(F))return E;a[o+E]=F}return E}function xs(a,n,o,f){return gt(Xt(n,a.length-o),a,o,f)}function bs(a,n,o,f){return gt(Ls(n),a,o,f)}function Ss(a,n,o,f){return gt(kr(n),a,o,f)}function ws(a,n,o,f){return gt(Fs(n,a.length-o),a,o,f)}l.prototype.write=function(n,o,f,h){if(o===void 0)h="utf8",f=this.length,o=0;else if(f===void 0&&typeof o=="string")h=o,f=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(f)?(f=f>>>0,h===void 0&&(h="utf8")):(h=f,f=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let w=this.length-o;if((f===void 0||f>w)&&(f=w),n.length>0&&(f<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");h||(h="utf8");let E=!1;for(;;)switch(h){case"hex":return gs(this,n,o,f);case"utf8":case"utf-8":return xs(this,n,o,f);case"ascii":case"latin1":case"binary":return bs(this,n,o,f);case"base64":return Ss(this,n,o,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ws(this,n,o,f);default:if(E)throw new TypeError("Unknown encoding: "+h);h=(""+h).toLowerCase(),E=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vs(a,n,o){return n===0&&o===a.length?i.fromByteArray(a):i.fromByteArray(a.slice(n,o))}function Rr(a,n,o){o=Math.min(a.length,o);let f=[],h=n;for(;h<o;){let w=a[h],E=null,F=w>239?4:w>223?3:w>191?2:1;if(h+F<=o){let D,U,$,P;switch(F){case 1:w<128&&(E=w);break;case 2:D=a[h+1],(D&192)===128&&(P=(w&31)<<6|D&63,P>127&&(E=P));break;case 3:D=a[h+1],U=a[h+2],(D&192)===128&&(U&192)===128&&(P=(w&15)<<12|(D&63)<<6|U&63,P>2047&&(P<55296||P>57343)&&(E=P));break;case 4:D=a[h+1],U=a[h+2],$=a[h+3],(D&192)===128&&(U&192)===128&&($&192)===128&&(P=(w&15)<<18|(D&63)<<12|(U&63)<<6|$&63,P>65535&&P<1114112&&(E=P))}}E===null?(E=65533,F=1):E>65535&&(E-=65536,f.push(E>>>10&1023|55296),E=56320|E&1023),f.push(E),h+=F}return Es(f)}let Ar=4096;function Es(a){let n=a.length;if(n<=Ar)return String.fromCharCode.apply(String,a);let o="",f=0;for(;f<n;)o+=String.fromCharCode.apply(String,a.slice(f,f+=Ar));return o}function Ts(a,n,o){let f="";o=Math.min(a.length,o);for(let h=n;h<o;++h)f+=String.fromCharCode(a[h]&127);return f}function Is(a,n,o){let f="";o=Math.min(a.length,o);for(let h=n;h<o;++h)f+=String.fromCharCode(a[h]);return f}function Ns(a,n,o){let f=a.length;(!n||n<0)&&(n=0),(!o||o<0||o>f)&&(o=f);let h="";for(let w=n;w<o;++w)h+=Ms[a[w]];return h}function Rs(a,n,o){let f=a.slice(n,o),h="";for(let w=0;w<f.length-1;w+=2)h+=String.fromCharCode(f[w]+f[w+1]*256);return h}l.prototype.slice=function(n,o){let f=this.length;n=~~n,o=o===void 0?f:~~o,n<0?(n+=f,n<0&&(n=0)):n>f&&(n=f),o<0?(o+=f,o<0&&(o=0)):o>f&&(o=f),o<n&&(o=n);let h=this.subarray(n,o);return Object.setPrototypeOf(h,l.prototype),h};function j(a,n,o){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+n>o)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(n,o,f){n=n>>>0,o=o>>>0,f||j(n,o,this.length);let h=this[n],w=1,E=0;for(;++E<o&&(w*=256);)h+=this[n+E]*w;return h},l.prototype.readUintBE=l.prototype.readUIntBE=function(n,o,f){n=n>>>0,o=o>>>0,f||j(n,o,this.length);let h=this[n+--o],w=1;for(;o>0&&(w*=256);)h+=this[n+--o]*w;return h},l.prototype.readUint8=l.prototype.readUInt8=function(n,o){return n=n>>>0,o||j(n,1,this.length),this[n]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||j(n,2,this.length),this[n]|this[n+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||j(n,2,this.length),this[n]<<8|this[n+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||j(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||j(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},l.prototype.readBigUInt64LE=ye(function(n){n=n>>>0,Be(n,"offset");let o=this[n],f=this[n+7];(o===void 0||f===void 0)&&tt(n,this.length-8);let h=o+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24,w=this[++n]+this[++n]*2**8+this[++n]*2**16+f*2**24;return BigInt(h)+(BigInt(w)<<BigInt(32))}),l.prototype.readBigUInt64BE=ye(function(n){n=n>>>0,Be(n,"offset");let o=this[n],f=this[n+7];(o===void 0||f===void 0)&&tt(n,this.length-8);let h=o*2**24+this[++n]*2**16+this[++n]*2**8+this[++n],w=this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+f;return(BigInt(h)<<BigInt(32))+BigInt(w)}),l.prototype.readIntLE=function(n,o,f){n=n>>>0,o=o>>>0,f||j(n,o,this.length);let h=this[n],w=1,E=0;for(;++E<o&&(w*=256);)h+=this[n+E]*w;return w*=128,h>=w&&(h-=Math.pow(2,8*o)),h},l.prototype.readIntBE=function(n,o,f){n=n>>>0,o=o>>>0,f||j(n,o,this.length);let h=o,w=1,E=this[n+--h];for(;h>0&&(w*=256);)E+=this[n+--h]*w;return w*=128,E>=w&&(E-=Math.pow(2,8*o)),E},l.prototype.readInt8=function(n,o){return n=n>>>0,o||j(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},l.prototype.readInt16LE=function(n,o){n=n>>>0,o||j(n,2,this.length);let f=this[n]|this[n+1]<<8;return f&32768?f|4294901760:f},l.prototype.readInt16BE=function(n,o){n=n>>>0,o||j(n,2,this.length);let f=this[n+1]|this[n]<<8;return f&32768?f|4294901760:f},l.prototype.readInt32LE=function(n,o){return n=n>>>0,o||j(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},l.prototype.readInt32BE=function(n,o){return n=n>>>0,o||j(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},l.prototype.readBigInt64LE=ye(function(n){n=n>>>0,Be(n,"offset");let o=this[n],f=this[n+7];(o===void 0||f===void 0)&&tt(n,this.length-8);let h=this[n+4]+this[n+5]*2**8+this[n+6]*2**16+(f<<24);return(BigInt(h)<<BigInt(32))+BigInt(o+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24)}),l.prototype.readBigInt64BE=ye(function(n){n=n>>>0,Be(n,"offset");let o=this[n],f=this[n+7];(o===void 0||f===void 0)&&tt(n,this.length-8);let h=(o<<24)+this[++n]*2**16+this[++n]*2**8+this[++n];return(BigInt(h)<<BigInt(32))+BigInt(this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+f)}),l.prototype.readFloatLE=function(n,o){return n=n>>>0,o||j(n,4,this.length),t.read(this,n,!0,23,4)},l.prototype.readFloatBE=function(n,o){return n=n>>>0,o||j(n,4,this.length),t.read(this,n,!1,23,4)},l.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||j(n,8,this.length),t.read(this,n,!0,52,8)},l.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||j(n,8,this.length),t.read(this,n,!1,52,8)};function X(a,n,o,f,h,w){if(!l.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>h||n<w)throw new RangeError('"value" argument is out of bounds');if(o+f>a.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(n,o,f,h){if(n=+n,o=o>>>0,f=f>>>0,!h){let F=Math.pow(2,8*f)-1;X(this,n,o,f,F,0)}let w=1,E=0;for(this[o]=n&255;++E<f&&(w*=256);)this[o+E]=n/w&255;return o+f},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(n,o,f,h){if(n=+n,o=o>>>0,f=f>>>0,!h){let F=Math.pow(2,8*f)-1;X(this,n,o,f,F,0)}let w=f-1,E=1;for(this[o+w]=n&255;--w>=0&&(E*=256);)this[o+w]=n/E&255;return o+f},l.prototype.writeUint8=l.prototype.writeUInt8=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,1,255,0),this[o]=n&255,o+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function Cr(a,n,o,f,h){Pr(n,f,h,a,o,7);let w=Number(n&BigInt(4294967295));a[o++]=w,w=w>>8,a[o++]=w,w=w>>8,a[o++]=w,w=w>>8,a[o++]=w;let E=Number(n>>BigInt(32)&BigInt(4294967295));return a[o++]=E,E=E>>8,a[o++]=E,E=E>>8,a[o++]=E,E=E>>8,a[o++]=E,o}function Br(a,n,o,f,h){Pr(n,f,h,a,o,7);let w=Number(n&BigInt(4294967295));a[o+7]=w,w=w>>8,a[o+6]=w,w=w>>8,a[o+5]=w,w=w>>8,a[o+4]=w;let E=Number(n>>BigInt(32)&BigInt(4294967295));return a[o+3]=E,E=E>>8,a[o+2]=E,E=E>>8,a[o+1]=E,E=E>>8,a[o]=E,o+8}l.prototype.writeBigUInt64LE=ye(function(n,o=0){return Cr(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=ye(function(n,o=0){return Br(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(n,o,f,h){if(n=+n,o=o>>>0,!h){let D=Math.pow(2,8*f-1);X(this,n,o,f,D-1,-D)}let w=0,E=1,F=0;for(this[o]=n&255;++w<f&&(E*=256);)n<0&&F===0&&this[o+w-1]!==0&&(F=1),this[o+w]=(n/E>>0)-F&255;return o+f},l.prototype.writeIntBE=function(n,o,f,h){if(n=+n,o=o>>>0,!h){let D=Math.pow(2,8*f-1);X(this,n,o,f,D-1,-D)}let w=f-1,E=1,F=0;for(this[o+w]=n&255;--w>=0&&(E*=256);)n<0&&F===0&&this[o+w+1]!==0&&(F=1),this[o+w]=(n/E>>0)-F&255;return o+f},l.prototype.writeInt8=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},l.prototype.writeInt16LE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},l.prototype.writeInt16BE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},l.prototype.writeInt32LE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},l.prototype.writeInt32BE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},l.prototype.writeBigInt64LE=ye(function(n,o=0){return Cr(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=ye(function(n,o=0){return Br(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Lr(a,n,o,f,h,w){if(o+f>a.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function Fr(a,n,o,f,h){return n=+n,o=o>>>0,h||Lr(a,n,o,4),t.write(a,n,o,f,23,4),o+4}l.prototype.writeFloatLE=function(n,o,f){return Fr(this,n,o,!0,f)},l.prototype.writeFloatBE=function(n,o,f){return Fr(this,n,o,!1,f)};function Mr(a,n,o,f,h){return n=+n,o=o>>>0,h||Lr(a,n,o,8),t.write(a,n,o,f,52,8),o+8}l.prototype.writeDoubleLE=function(n,o,f){return Mr(this,n,o,!0,f)},l.prototype.writeDoubleBE=function(n,o,f){return Mr(this,n,o,!1,f)},l.prototype.copy=function(n,o,f,h){if(!l.isBuffer(n))throw new TypeError("argument should be a Buffer");if(f||(f=0),!h&&h!==0&&(h=this.length),o>=n.length&&(o=n.length),o||(o=0),h>0&&h<f&&(h=f),h===f||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(f<0||f>=this.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("sourceEnd out of bounds");h>this.length&&(h=this.length),n.length-o<h-f&&(h=n.length-o+f);let w=h-f;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,f,h):Uint8Array.prototype.set.call(n,this.subarray(f,h),o),w},l.prototype.fill=function(n,o,f,h){if(typeof n=="string"){if(typeof o=="string"?(h=o,o=0,f=this.length):typeof f=="string"&&(h=f,f=this.length),h!==void 0&&typeof h!="string")throw new TypeError("encoding must be a string");if(typeof h=="string"&&!l.isEncoding(h))throw new TypeError("Unknown encoding: "+h);if(n.length===1){let E=n.charCodeAt(0);(h==="utf8"&&E<128||h==="latin1")&&(n=E)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<f)throw new RangeError("Out of range index");if(f<=o)return this;o=o>>>0,f=f===void 0?this.length:f>>>0,n||(n=0);let w;if(typeof n=="number")for(w=o;w<f;++w)this[w]=n;else{let E=l.isBuffer(n)?n:l.from(n,h),F=E.length;if(F===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(w=0;w<f-o;++w)this[w+o]=E[w%F]}return this};let Ce={};function Zt(a,n,o){Ce[a]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:n.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${a}]`,this.stack,delete this.name}get code(){return a}set code(h){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:h,writable:!0})}toString(){return`${this.name} [${a}]: ${this.message}`}}}Zt("ERR_BUFFER_OUT_OF_BOUNDS",function(a){return a?`${a} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Zt("ERR_INVALID_ARG_TYPE",function(a,n){return`The "${a}" argument must be of type number. Received type ${typeof n}`},TypeError),Zt("ERR_OUT_OF_RANGE",function(a,n,o){let f=`The value of "${a}" is out of range.`,h=o;return Number.isInteger(o)&&Math.abs(o)>2**32?h=Or(String(o)):typeof o=="bigint"&&(h=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(h=Or(h)),h+="n"),f+=` It must be ${n}. Received ${h}`,f},RangeError);function Or(a){let n="",o=a.length,f=a[0]==="-"?1:0;for(;o>=f+4;o-=3)n=`_${a.slice(o-3,o)}${n}`;return`${a.slice(0,o)}${n}`}function As(a,n,o){Be(n,"offset"),(a[n]===void 0||a[n+o]===void 0)&&tt(n,a.length-(o+1))}function Pr(a,n,o,f,h,w){if(a>o||a<n){let E=typeof n=="bigint"?"n":"",F;throw n===0||n===BigInt(0)?F=`>= 0${E} and < 2${E} ** ${(w+1)*8}${E}`:F=`>= -(2${E} ** ${(w+1)*8-1}${E}) and < 2 ** ${(w+1)*8-1}${E}`,new Ce.ERR_OUT_OF_RANGE("value",F,a)}As(f,h,w)}function Be(a,n){if(typeof a!="number")throw new Ce.ERR_INVALID_ARG_TYPE(n,"number",a)}function tt(a,n,o){throw Math.floor(a)!==a?(Be(a,o),new Ce.ERR_OUT_OF_RANGE("offset","an integer",a)):n<0?new Ce.ERR_BUFFER_OUT_OF_BOUNDS:new Ce.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${n}`,a)}let Cs=/[^+/0-9A-Za-z-_]/g;function Bs(a){if(a=a.split("=")[0],a=a.trim().replace(Cs,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function Xt(a,n){n=n||1/0;let o,f=a.length,h=null,w=[];for(let E=0;E<f;++E){if(o=a.charCodeAt(E),o>55295&&o<57344){if(!h){if(o>56319){(n-=3)>-1&&w.push(239,191,189);continue}else if(E+1===f){(n-=3)>-1&&w.push(239,191,189);continue}h=o;continue}if(o<56320){(n-=3)>-1&&w.push(239,191,189),h=o;continue}o=(h-55296<<10|o-56320)+65536}else h&&(n-=3)>-1&&w.push(239,191,189);if(h=null,o<128){if((n-=1)<0)break;w.push(o)}else if(o<2048){if((n-=2)<0)break;w.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;w.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;w.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return w}function Ls(a){let n=[];for(let o=0;o<a.length;++o)n.push(a.charCodeAt(o)&255);return n}function Fs(a,n){let o,f,h,w=[];for(let E=0;E<a.length&&!((n-=2)<0);++E)o=a.charCodeAt(E),f=o>>8,h=o%256,w.push(h),w.push(f);return w}function kr(a){return i.toByteArray(Bs(a))}function gt(a,n,o,f){let h;for(h=0;h<f&&!(h+o>=n.length||h>=a.length);++h)n[h+o]=a[h];return h}function ae(a,n){return a instanceof n||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===n.name}function Qt(a){return a!==a}let Ms=(function(){let a="0123456789abcdef",n=new Array(256);for(let o=0;o<16;++o){let f=o*16;for(let h=0;h<16;++h)n[f+h]=a[o]+a[h]}return n})();function ye(a){return typeof BigInt>"u"?Os:a}function Os(){throw new Error("BigInt not supported")}return Ie}var nt,ri,wt,ni,Ie,ii,si=Le(()=>{"use strict";u();c();p();nt={},ri=!1;wt={},ni=!1;Ie={},ii=!1});var Ne,g,tc,rc,ai=Le(()=>{"use strict";u();c();p();si();Ne=oi();Ne.Buffer;Ne.SlowBuffer;Ne.INSPECT_MAX_BYTES;Ne.kMaxLength;g=Ne.Buffer,tc=Ne.INSPECT_MAX_BYTES,rc=Ne.kMaxLength});var c=Le(()=>{"use strict";ai()});var mr=ge((vw,Ko)=>{"use strict";u();c();p();function Ku(i){return!(typeof i!="number"||i!==i||i===1/0||i===-1/0)}Ko.exports=Ku});var Jo=ge((Nw,Yo)=>{"use strict";u();c();p();var Yu=9007199254740991;Yo.exports=Yu});var fr=ge((Bw,Zo)=>{"use strict";u();c();p();var Ju=Jo();function Zu(i){return typeof i=="number"&&Math.abs(i)<=Ju}Zo.exports=Zu});var Qo=ge((Ow,Xo)=>{"use strict";u();c();p();var Xu=mr(),Qu=fr();function ep(i){var t=parseInt(i,10);if(!Xu(t))throw new TypeError("Not a finite number: "+i+" ("+typeof i+")");if(!Qu(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),s=r>=11&&r<=13,m=e.charAt(e.length-1);return e+(s?"th":m==="1"?"st":m==="2"?"nd":m==="3"?"rd":"th")}Xo.exports=ep});var dr=ge((_w,rs)=>{"use strict";u();c();p();var tp=/(hundred|thousand|(m|b|tr|quadr)illion)$/,rp=/teen$/,es=/y$/,ts=/(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)$/,np={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 ip(i){return tp.test(i)||rp.test(i)?i+"th":es.test(i)?i.replace(es,"ieth"):ts.test(i)?i.replace(ts,op):i}function op(i,t){return np[t]}rs.exports=ip});var wr=ge((Ww,os)=>{"use strict";u();c();p();var sp=dr(),ap=mr(),lp=fr(),ns=10,hr=100,yr=1e3,gr=1e6,xr=1e9,br=1e12,Sr=1e15,up=9007199254740992,is=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],pp=["zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function cp(i,t){var e,r=parseInt(i,10);if(!ap(r))throw new TypeError("Not a finite number: "+i+" ("+typeof i+")");if(!lp(r))throw new RangeError("Input is not a safe number, it\u2019s either too large or too small.");return e=Ee(r),t?sp(e):e}function Ee(i){var t,e,r=arguments[1];return i===0?r?r.join(" ").replace(/,$/,""):"zero":(r||(r=[]),i<0&&(r.push("minus"),i=Math.abs(i)),i<20?(t=0,e=is[i]):i<hr?(t=i%ns,e=pp[Math.floor(i/ns)],t&&(e+="-"+is[t],t=0)):i<yr?(t=i%hr,e=Ee(Math.floor(i/hr))+" hundred"):i<gr?(t=i%yr,e=Ee(Math.floor(i/yr))+" thousand,"):i<xr?(t=i%gr,e=Ee(Math.floor(i/gr))+" million,"):i<br?(t=i%xr,e=Ee(Math.floor(i/xr))+" billion,"):i<Sr?(t=i%br,e=Ee(Math.floor(i/br))+" trillion,"):i<=up&&(t=i%Sr,e=Ee(Math.floor(i/Sr))+" quadrillion,"),r.push(e),Ee(t,r))}os.exports=cp});var as=ge((Gw,ss)=>{"use strict";u();c();p();var mp=dr(),fp=wr();function dp(i){var t=fp(i);return mp(t)}ss.exports=dp});var us=ge((Jw,ls)=>{"use strict";u();c();p();ls.exports={toOrdinal:Qo(),toWords:wr(),toWordsOrdinal:as()}});var Wp={};Fe(Wp,{DynamicSnippetsGenerator:()=>Jt,EndpointSnippetGenerator:()=>et});module.exports=Ws(Wp);u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();var Gs=typeof global=="object"&&global&&global.Object===Object&&global,li=Gs;var Hs=typeof self=="object"&&self&&self.Object===Object&&self,Ks=li||Hs||Function("return this")(),be=Ks;var Ys=be.Symbol,fe=Ys;u();c();p();var ui=Object.prototype,Js=ui.hasOwnProperty,Zs=ui.toString,it=fe?fe.toStringTag:void 0;function Xs(i){var t=Js.call(i,it),e=i[it];try{i[it]=void 0;var r=!0}catch{}var s=Zs.call(i);return r&&(t?i[it]=e:delete i[it]),s}var pi=Xs;u();c();p();var Qs=Object.prototype,ea=Qs.toString;function ta(i){return ea.call(i)}var ci=ta;var ra="[object Null]",na="[object Undefined]",mi=fe?fe.toStringTag:void 0;function ia(i){return i==null?i===void 0?na:ra:mi&&mi in Object(i)?pi(i):ci(i)}var vt=ia;u();c();p();function oa(i){return i!=null&&typeof i=="object"}var fi=oa;var sa="[object Symbol]";function aa(i){return typeof i=="symbol"||fi(i)&&vt(i)==sa}var di=aa;u();c();p();u();c();p();function la(i,t){for(var e=-1,r=i==null?0:i.length,s=Array(r);++e<r;)s[e]=t(i[e],e,i);return s}var hi=la;u();c();p();var ua=Array.isArray,yi=ua;var pa=1/0,gi=fe?fe.prototype:void 0,xi=gi?gi.toString:void 0;function bi(i){if(typeof i=="string")return i;if(yi(i))return hi(i,bi)+"";if(di(i))return xi?xi.call(i):"";var t=i+"";return t=="0"&&1/i==-pa?"-0":t}var Si=bi;u();c();p();function ca(i){var t=typeof i;return i!=null&&(t=="object"||t=="function")}var Et=ca;u();c();p();u();c();p();u();c();p();var ma="[object AsyncFunction]",fa="[object Function]",da="[object GeneratorFunction]",ha="[object Proxy]";function ya(i){if(!Et(i))return!1;var t=vt(i);return t==fa||t==da||t==ma||t==ha}var wi=ya;u();c();p();u();c();p();var ga=be["__core-js_shared__"],Tt=ga;var vi=(function(){var i=/[^.]+$/.exec(Tt&&Tt.keys&&Tt.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function xa(i){return!!vi&&vi in i}var Ei=xa;u();c();p();var ba=Function.prototype,Sa=ba.toString;function wa(i){if(i!=null){try{return Sa.call(i)}catch{}try{return i+""}catch{}}return""}var Ti=wa;var va=/[\\^$.*+?()[\]{}|]/g,Ea=/^\[object .+?Constructor\]$/,Ta=Function.prototype,Ia=Object.prototype,Na=Ta.toString,Ra=Ia.hasOwnProperty,Aa=RegExp("^"+Na.call(Ra).replace(va,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ca(i){if(!Et(i)||Ei(i))return!1;var t=wi(i)?Aa:Ea;return t.test(Ti(i))}var Ii=Ca;u();c();p();function Ba(i,t){return i?.[t]}var Ni=Ba;function La(i,t){var e=Ni(i,t);return Ii(e)?e:void 0}var Oe=La;u();c();p();function Fa(){}var Ri=Fa;u();c();p();u();c();p();u();c();p();function Ma(i,t,e,r){for(var s=i.length,m=e+(r?1:-1);r?m--:++m<s;)if(t(i[m],m,i))return m;return-1}var Ai=Ma;u();c();p();function Oa(i){return i!==i}var Ci=Oa;u();c();p();function Pa(i,t,e){for(var r=e-1,s=i.length;++r<s;)if(i[r]===t)return r;return-1}var Bi=Pa;function ka(i,t,e){return t===t?Bi(i,t,e):Ai(i,Ci,e)}var Li=ka;function Ua(i,t){var e=i==null?0:i.length;return!!e&&Li(i,t,0)>-1}var Fi=Ua;u();c();p();function _a(i,t){return i===t||i!==i&&t!==t}var Mi=_a;u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();var Da=Oe(Object,"create"),de=Da;function $a(){this.__data__=de?de(null):{},this.size=0}var Oi=$a;u();c();p();function qa(i){var t=this.has(i)&&delete this.__data__[i];return this.size-=t?1:0,t}var Pi=qa;u();c();p();var Wa="__lodash_hash_undefined__",Va=Object.prototype,ja=Va.hasOwnProperty;function za(i){var t=this.__data__;if(de){var e=t[i];return e===Wa?void 0:e}return ja.call(t,i)?t[i]:void 0}var ki=za;u();c();p();var Ga=Object.prototype,Ha=Ga.hasOwnProperty;function Ka(i){var t=this.__data__;return de?t[i]!==void 0:Ha.call(t,i)}var Ui=Ka;u();c();p();var Ya="__lodash_hash_undefined__";function Ja(i,t){var e=this.__data__;return this.size+=this.has(i)?0:1,e[i]=de&&t===void 0?Ya:t,this}var _i=Ja;function Pe(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var r=i[t];this.set(r[0],r[1])}}Pe.prototype.clear=Oi;Pe.prototype.delete=Pi;Pe.prototype.get=ki;Pe.prototype.has=Ui;Pe.prototype.set=_i;var nr=Pe;u();c();p();u();c();p();function Za(){this.__data__=[],this.size=0}var Di=Za;u();c();p();u();c();p();function Xa(i,t){for(var e=i.length;e--;)if(Mi(i[e][0],t))return e;return-1}var Se=Xa;var Qa=Array.prototype,el=Qa.splice;function tl(i){var t=this.__data__,e=Se(t,i);if(e<0)return!1;var r=t.length-1;return e==r?t.pop():el.call(t,e,1),--this.size,!0}var $i=tl;u();c();p();function rl(i){var t=this.__data__,e=Se(t,i);return e<0?void 0:t[e][1]}var qi=rl;u();c();p();function nl(i){return Se(this.__data__,i)>-1}var Wi=nl;u();c();p();function il(i,t){var e=this.__data__,r=Se(e,i);return r<0?(++this.size,e.push([i,t])):e[r][1]=t,this}var Vi=il;function ke(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var r=i[t];this.set(r[0],r[1])}}ke.prototype.clear=Di;ke.prototype.delete=$i;ke.prototype.get=qi;ke.prototype.has=Wi;ke.prototype.set=Vi;var ji=ke;u();c();p();var ol=Oe(be,"Map"),zi=ol;function sl(){this.size=0,this.__data__={hash:new nr,map:new(zi||ji),string:new nr}}var Gi=sl;u();c();p();u();c();p();u();c();p();function al(i){var t=typeof i;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?i!=="__proto__":i===null}var Hi=al;function ll(i,t){var e=i.__data__;return Hi(t)?e[typeof t=="string"?"string":"hash"]:e.map}var we=ll;function ul(i){var t=we(this,i).delete(i);return this.size-=t?1:0,t}var Ki=ul;u();c();p();function pl(i){return we(this,i).get(i)}var Yi=pl;u();c();p();function cl(i){return we(this,i).has(i)}var Ji=cl;u();c();p();function ml(i,t){var e=we(this,i),r=e.size;return e.set(i,t),this.size+=e.size==r?0:1,this}var Zi=ml;function Ue(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var r=i[t];this.set(r[0],r[1])}}Ue.prototype.clear=Gi;Ue.prototype.delete=Ki;Ue.prototype.get=Yi;Ue.prototype.has=Ji;Ue.prototype.set=Zi;var Xi=Ue;u();c();p();function fl(i){return i==null?"":Si(i)}var ve=fl;u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();function dl(i,t,e){var r=-1,s=i.length;t<0&&(t=-t>s?0:s+t),e=e>s?s:e,e<0&&(e+=s),s=t>e?0:e-t>>>0,t>>>=0;for(var m=Array(s);++r<s;)m[r]=i[r+t];return m}var Qi=dl;function hl(i,t,e){var r=i.length;return e=e===void 0?r:e,!t&&e>=r?i:Qi(i,t,e)}var eo=hl;u();c();p();var yl="\\ud800-\\udfff",gl="\\u0300-\\u036f",xl="\\ufe20-\\ufe2f",bl="\\u20d0-\\u20ff",Sl=gl+xl+bl,wl="\\ufe0e\\ufe0f",vl="\\u200d",El=RegExp("["+vl+yl+Sl+wl+"]");function Tl(i){return El.test(i)}var It=Tl;u();c();p();u();c();p();function Il(i){return i.split("")}var to=Il;u();c();p();var ro="\\ud800-\\udfff",Nl="\\u0300-\\u036f",Rl="\\ufe20-\\ufe2f",Al="\\u20d0-\\u20ff",Cl=Nl+Rl+Al,Bl="\\ufe0e\\ufe0f",Ll="["+ro+"]",ir="["+Cl+"]",or="\\ud83c[\\udffb-\\udfff]",Fl="(?:"+ir+"|"+or+")",no="[^"+ro+"]",io="(?:\\ud83c[\\udde6-\\uddff]){2}",oo="[\\ud800-\\udbff][\\udc00-\\udfff]",Ml="\\u200d",so=Fl+"?",ao="["+Bl+"]?",Ol="(?:"+Ml+"(?:"+[no,io,oo].join("|")+")"+ao+so+")*",Pl=ao+so+Ol,kl="(?:"+[no+ir+"?",ir,io,oo,Ll].join("|")+")",Ul=RegExp(or+"(?="+or+")|"+kl+Pl,"g");function _l(i){return i.match(Ul)||[]}var lo=_l;function Dl(i){return It(i)?lo(i):to(i)}var uo=Dl;function $l(i){return function(t){t=ve(t);var e=It(t)?uo(t):void 0,r=e?e[0]:t.charAt(0),s=e?eo(e,1).join(""):t.slice(1);return r[i]()+s}}var po=$l;var ql=po("toUpperCase"),H=ql;function Wl(i){return H(ve(i).toLowerCase())}var co=Wl;u();c();p();u();c();p();function Vl(i,t,e,r){var s=-1,m=i==null?0:i.length;for(r&&m&&(e=i[++s]);++s<m;)e=t(e,i[s],s,i);return e}var mo=Vl;u();c();p();u();c();p();u();c();p();function jl(i){return function(t){return i?.[t]}}var fo=jl;var zl={\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"},Gl=fo(zl),ho=Gl;var Hl=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kl="\\u0300-\\u036f",Yl="\\ufe20-\\ufe2f",Jl="\\u20d0-\\u20ff",Zl=Kl+Yl+Jl,Xl="["+Zl+"]",Ql=RegExp(Xl,"g");function eu(i){return i=ve(i),i&&i.replace(Hl,ho).replace(Ql,"")}var yo=eu;u();c();p();u();c();p();var tu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ru(i){return i.match(tu)||[]}var go=ru;u();c();p();var nu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function iu(i){return nu.test(i)}var xo=iu;u();c();p();var Eo="\\ud800-\\udfff",ou="\\u0300-\\u036f",su="\\ufe20-\\ufe2f",au="\\u20d0-\\u20ff",lu=ou+su+au,To="\\u2700-\\u27bf",Io="a-z\\xdf-\\xf6\\xf8-\\xff",uu="\\xac\\xb1\\xd7\\xf7",pu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",cu="\\u2000-\\u206f",mu=" \\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",No="A-Z\\xc0-\\xd6\\xd8-\\xde",fu="\\ufe0e\\ufe0f",Ro=uu+pu+cu+mu,Ao="['\u2019]",bo="["+Ro+"]",du="["+lu+"]",Co="\\d+",hu="["+To+"]",Bo="["+Io+"]",Lo="[^"+Eo+Ro+Co+To+Io+No+"]",yu="\\ud83c[\\udffb-\\udfff]",gu="(?:"+du+"|"+yu+")",xu="[^"+Eo+"]",Fo="(?:\\ud83c[\\udde6-\\uddff]){2}",Mo="[\\ud800-\\udbff][\\udc00-\\udfff]",_e="["+No+"]",bu="\\u200d",So="(?:"+Bo+"|"+Lo+")",Su="(?:"+_e+"|"+Lo+")",wo="(?:"+Ao+"(?:d|ll|m|re|s|t|ve))?",vo="(?:"+Ao+"(?:D|LL|M|RE|S|T|VE))?",Oo=gu+"?",Po="["+fu+"]?",wu="(?:"+bu+"(?:"+[xu,Fo,Mo].join("|")+")"+Po+Oo+")*",vu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Eu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Tu=Po+Oo+wu,Iu="(?:"+[hu,Fo,Mo].join("|")+")"+Tu,Nu=RegExp([_e+"?"+Bo+"+"+wo+"(?="+[bo,_e,"$"].join("|")+")",Su+"+"+vo+"(?="+[bo,_e+So,"$"].join("|")+")",_e+"?"+So+"+"+wo,_e+"+"+vo,Eu,vu,Co,Iu].join("|"),"g");function Ru(i){return i.match(Nu)||[]}var ko=Ru;function Au(i,t,e){return i=ve(i),t=e?void 0:t,t===void 0?xo(i)?ko(i):go(i):i.match(t)||[]}var Uo=Au;var Cu="['\u2019]",Bu=RegExp(Cu,"g");function Lu(i){return function(t){return mo(Uo(yo(t).replace(Bu,"")),i,"")}}var _o=Lu;var Fu=_o(function(i,t,e){return t=t.toLowerCase(),i+(e?co(t):t)}),te=Fu;u();c();p();var Mu=Oe(be,"Set"),Nt=Mu;u();c();p();u();c();p();var Ou="__lodash_hash_undefined__";function Pu(i){return this.__data__.set(i,Ou),this}var Do=Pu;u();c();p();function ku(i){return this.__data__.has(i)}var $o=ku;function Rt(i){var t=-1,e=i==null?0:i.length;for(this.__data__=new Xi;++t<e;)this.add(i[t])}Rt.prototype.add=Rt.prototype.push=Do;Rt.prototype.has=$o;var qo=Rt;u();c();p();function Uu(i,t){return i.has(t)}var Wo=Uu;u();c();p();function _u(i){var t=-1,e=Array(i.size);return i.forEach(function(r){e[++t]=r}),e}var At=_u;u();c();p();function Du(i,t,e){for(var r=-1,s=i==null?0:i.length;++r<s;)if(e(t,i[r]))return!0;return!1}var Vo=Du;u();c();p();u();c();p();var $u=1/0,qu=Nt&&1/At(new Nt([,-0]))[1]==$u?function(i){return new Nt(i)}:Ri,jo=qu;var Wu=200;function Vu(i,t,e){var r=-1,s=Fi,m=i.length,l=!0,b=[],v=b;if(e)l=!1,s=Vo;else if(m>=Wu){var T=t?null:jo(i);if(T)return At(T);l=!1,s=Wo,v=new qo}else v=t?[]:b;e:for(;++r<m;){var I=i[r],C=t?t(I):I;if(I=e||I!==0?I:0,l&&C===C){for(var _=v.length;_--;)if(v[_]===C)continue e;t&&v.push(C),b.push(I)}else s(v,C,e)||(v!==b&&v.push(C),b.push(I))}return b}var zo=Vu;u();c();p();function ju(i,t){return t=typeof t=="function"?t:void 0,i&&i.length?zo(i,void 0,t):[]}var sr=ju;u();c();p();function ne(i,t){if(i===void 0)throw new Error(t??"Expected value to be defined but got undefined.")}function Q(i,t){if(i===null)throw new Error(t??"Expected value to be non-null but got null.")}function ar(i,t){if(typeof i!="string")throw new Error(t??`Expected value to be a string but got ${typeof i}.`)}function A(i){throw new Error("Unexpected value: "+JSON.stringify(i))}u();c();p();function K(){}u();c();p();function ot(i){return Object.keys(i)}u();c();p();function lr(i){return Object.entries(i)}u();c();p();var st=class st{constructor(t){d(this,"symbolSet");d(this,"symbolMap");d(this,"conflictResolutionStrategy");this.symbolSet=new Set(t?.reservedSymbolNames??st.defaultOptions.reservedSymbolNames),this.symbolMap=new Map,this.conflictResolutionStrategy=t?.conflictResolutionStrategy??st.defaultOptions.conflictResolutionStrategy}getSymbolNameByIdOrThrow(t){let e=this.getSymbolNameById(t);return ne(e,`Symbol with ID '${t}' not found for in registry.`),e}getSymbolNameById(t){return this.symbolMap.get(t)}registerSymbol(t,e){if(this.isSymbolIdRegistered(t))throw new Error(`Symbol with ID '${t}' is already registered.`);let s=this.getAvailableSymbolName(e);return this.symbolMap.set(t,s),this.symbolSet.add(s),s}getAvailableSymbolName(t){for(let s of t)if(!this.isSymbolNameRegistered(s))return s;let[e]=t,r=e;if(this.conflictResolutionStrategy==="numbered-suffix"){let s=2;for(;this.isSymbolNameRegistered(r);)r=`${e}${s++}`}else if(this.conflictResolutionStrategy==="underscore-suffix")for(;this.isSymbolNameRegistered(r);)r+="_";else A(this.conflictResolutionStrategy);return r}isSymbolNameRegistered(t){return this.symbolSet.has(t)}isSymbolIdRegistered(t){return this.symbolMap.has(t)}getAllSymbols(){return Array.from(this.symbolMap.entries()).map(([t,e])=>({id:t,name:e}))}};d(st,"defaultOptions",{reservedSymbolNames:[],conflictResolutionStrategy:"underscore-suffix"});var re=st;u();c();p();function ie(i,t="type"){return{_visit:e=>{let r=e[i[t]];return r!=null?r(i):(e._other==null&&A(i),e._other(i))}}}u();c();p();u();c();p();u();c();p();var at=y.env.FERN_STACK_TRACK?.toLowerCase()??"",le=at!==""&&at!=="0"&&at!=="false",ur=["single","multiline","box"].includes(at)?at:"single";le&&(Error.stackTraceLimit=50);var zu=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Gu=new Set(["stacktrace"]);function Bt({maxFrames:i=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:s=[],filterNode:m=!0,filterJs:l=!0,formatFilename:b=v=>v}={}){if(!le)return[];r=[...r,...zu],e=[...e,...Gu],s=[...s,"runInteractiveTask"];let v=!1;return(new Error().stack??"").split(`
2
- `).map(T=>{let I=T.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(I&&I.length===5){let[,C,_,N,L]=I;if(!C||!_||!N||!L)return;if(v||s.some(O=>C?.includes(O))){v=!0;return}switch(C){case"Object.<anonymous>":C="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":C=`${C.substring(C.indexOf(".")+1)}()=> { ... }`;break}return{fn:C,path:b(_),position:`${N}:${L}`}}}).filter(T=>T&&!r.some(I=>T.fn.includes(I))&&!(m&&T.path?.startsWith("node:"))&&!(l&&T.path?.endsWith(".js"))&&!e.some(I=>T.path.includes(I))).slice(t,t+i)}var Ct=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:r=[],filterFunctions:s=[],stopOn:m=[],filterNode:l=!0,filterJs:b=!0,multiline:v=!1,formatFilename:T=I=>I}={}){d(this,"maxFrames");d(this,"skip");d(this,"filterPaths");d(this,"filterFunctions");d(this,"stopOn");d(this,"filterNode");d(this,"filterJs");d(this,"multiline");d(this,"formatFilename");d(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=r,this.filterFunctions=s,this.stopOn=m,this.filterNode=l,this.filterJs=b,this.multiline=v,this.formatFilename=T}tag(t){let e=this.tracking.get(t)||new Set;Bt({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>e.add(r)),this.tracking.set(t,e)}trace(t){if(!le)return"";let e=this.tracking.get(t);return e?[...e].map(r=>`${this.multiline?`
3
- `:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},pr;function Go({maxFrames:i=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:s=[],filterNode:m=!0,filterJs:l=!0,multiline:b=!1,formatFilename:v=T=>T}={}){le&&(pr??(pr=new Ct({maxFrames:i,skip:t,filterPaths:e,filterFunctions:r,stopOn:s,filterNode:m,filterJs:l,multiline:b,formatFilename:v})))}function Ho(i){pr?.tag(i)}function cr(i){return pr?.frames(i)??[]}var Re=class{constructor(){Ho(this)}};u();c();p();u();c();p();u();c();p();var oe=class extends Re{constructor(e){super();d(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 Hu=4;Go({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var lt=class{constructor(){d(this,"lineBuffer",[]);d(this,"indentLevel",0);d(this,"hasWrittenAnything",!1);d(this,"lastCharacterIsSemicolon",!1);d(this,"lastCharacterIsNewline",!1);d(this,"nodeStackFrames",[])}get buffer(){return le&&this.nodeStackFrames.length>0&&this.writeInternal(`
1
+ "use strict";var Ps=Object.create;var rt=Object.defineProperty;var ks=Object.getOwnPropertyDescriptor;var Us=Object.getOwnPropertyNames;var _s=Object.getPrototypeOf,Ds=Object.prototype.hasOwnProperty;var $s=(i,t,e)=>t in i?rt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Le=(i,t,e)=>()=>{if(e)throw e[0];try{return i&&(t=i(i=0)),t}catch(r){throw e=[r],r}};var ge=(i,t)=>()=>{try{return t||i((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},Fe=(i,t)=>{for(var e in t)rt(i,e,{get:t[e],enumerable:!0})},Ur=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Us(t))!Ds.call(i,s)&&s!==e&&rt(i,s,{get:()=>t[s],enumerable:!(r=ks(t,s))||r.enumerable});return i};var qs=(i,t,e)=>(e=i!=null?Ps(_s(i)):{},Ur(t||!i||!i.__esModule?rt(e,"default",{value:i,enumerable:!0}):e,i)),Ws=i=>Ur(rt({},"__esModule",{value:!0}),i);var d=(i,t,e)=>$s(i,typeof t!="symbol"?t+"":t,e);var u=Le(()=>{"use strict"});var y={};Fe(y,{_debugEnd:()=>Rn,_debugProcess:()=>Nn,_events:()=>Vn,_eventsCount:()=>jn,_exiting:()=>an,_fatalExceptions:()=>vn,_getActiveHandles:()=>cn,_getActiveRequests:()=>pn,_kill:()=>fn,_linkedBinding:()=>on,_maxListeners:()=>Wn,_preload_modules:()=>Dn,_rawDebug:()=>rn,_startProfilerIdleNotifier:()=>An,_stopProfilerIdleNotifier:()=>Cn,_tickCallback:()=>In,abort:()=>Mn,addListener:()=>zn,allowedNodeEnvironmentFlags:()=>bn,arch:()=>Wr,argv:()=>zr,argv0:()=>_n,assert:()=>Sn,binding:()=>Jr,browser:()=>tn,chdir:()=>Qr,config:()=>ln,cpuUsage:()=>St,cwd:()=>Xr,debugPort:()=>Un,default:()=>ei,dlopen:()=>un,domain:()=>sn,emit:()=>Jn,emitWarning:()=>Yr,env:()=>jr,execArgv:()=>Gr,execPath:()=>kn,exit:()=>gn,features:()=>wn,hasUncaughtExceptionCaptureCallback:()=>Tn,hrtime:()=>bt,kill:()=>yn,listeners:()=>Qn,memoryUsage:()=>hn,moduleLoadList:()=>nn,nextTick:()=>Dr,off:()=>Hn,on:()=>me,once:()=>Gn,openStdin:()=>xn,pid:()=>On,platform:()=>Vr,ppid:()=>Pn,prependListener:()=>Zn,prependOnceListener:()=>Xn,reallyExit:()=>mn,release:()=>en,removeAllListeners:()=>Yn,removeListener:()=>Kn,resourceUsage:()=>dn,setSourceMapsEnabled:()=>$n,setUncaughtExceptionCaptureCallback:()=>En,stderr:()=>Ln,stdin:()=>Fn,stdout:()=>Bn,title:()=>qr,umask:()=>Zr,uptime:()=>qn,version:()=>Hr,versions:()=>Kr});function rr(i){throw new Error("Node.js process "+i+" is not supported by JSPM core outside of Node.js")}function Vs(){!Me||!Te||(Me=!1,Te.length?ce=Te.concat(ce):xt=-1,ce.length&&_r())}function _r(){if(!Me){var i=setTimeout(Vs,0);Me=!0;for(var t=ce.length;t;){for(Te=ce,ce=[];++xt<t;)Te&&Te[xt].run();xt=-1,t=ce.length}Te=null,Me=!1,clearTimeout(i)}}function Dr(i){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];ce.push(new $r(i,t)),ce.length===1&&!Me&&setTimeout(_r,0)}function $r(i,t){this.fun=i,this.array=t}function G(){}function on(i){rr("_linkedBinding")}function un(i){rr("dlopen")}function pn(){return[]}function cn(){return[]}function Sn(i,t){if(!i)throw new Error(t||"assertion error")}function Tn(){return!1}function qn(){return xe.now()/1e3}function bt(i){var t=Math.floor((Date.now()-xe.now())*.001),e=xe.now()*.001,r=Math.floor(e)+t,s=Math.floor(e%1*1e9);return i&&(r=r-i[0],s=s-i[1],s<0&&(r--,s+=tr)),[r,s]}function me(){return ei}function Qn(i){return[]}var ce,Me,Te,xt,qr,Wr,Vr,jr,zr,Gr,Hr,Kr,Yr,Jr,Zr,Xr,Qr,en,tn,rn,nn,sn,an,ln,mn,fn,St,dn,hn,yn,gn,xn,bn,wn,vn,En,In,Nn,Rn,An,Cn,Bn,Ln,Fn,Mn,On,Pn,kn,Un,_n,Dn,$n,xe,er,tr,Wn,Vn,jn,zn,Gn,Hn,Kn,Yn,Jn,Zn,Xn,ei,ti=Le(()=>{"use strict";u();c();p();ce=[],Me=!1,xt=-1;$r.prototype.run=function(){this.fun.apply(null,this.array)};qr="browser",Wr="x64",Vr="browser",jr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},zr=["/usr/bin/node"],Gr=[],Hr="v16.8.0",Kr={},Yr=function(i,t){console.warn((t?t+": ":"")+i)},Jr=function(i){rr("binding")},Zr=function(i){return 0},Xr=function(){return"/"},Qr=function(i){},en={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};tn=!0,rn=G,nn=[];sn={},an=!1,ln={};mn=G,fn=G,St=function(){return{}},dn=St,hn=St,yn=G,gn=G,xn=G,bn={};wn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},vn=G,En=G;In=G,Nn=G,Rn=G,An=G,Cn=G,Bn=void 0,Ln=void 0,Fn=void 0,Mn=G,On=2,Pn=1,kn="/bin/usr/node",Un=9229,_n="node",Dn=[],$n=G,xe={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};xe.now===void 0&&(er=Date.now(),xe.timing&&xe.timing.navigationStart&&(er=xe.timing.navigationStart),xe.now=()=>Date.now()-er);tr=1e9;bt.bigint=function(i){var t=bt(i);return typeof BigInt>"u"?t[0]*tr+t[1]:BigInt(t[0]*tr)+BigInt(t[1])};Wn=10,Vn={},jn=0;zn=me,Gn=me,Hn=me,Kn=me,Yn=me,Jn=G,Zn=me,Xn=me;ei={version:Hr,versions:Kr,arch:Wr,platform:Vr,browser:tn,release:en,_rawDebug:rn,moduleLoadList:nn,binding:Jr,_linkedBinding:on,_events:Vn,_eventsCount:jn,_maxListeners:Wn,on:me,addListener:zn,once:Gn,off:Hn,removeListener:Kn,removeAllListeners:Yn,emit:Jn,prependListener:Zn,prependOnceListener:Xn,listeners:Qn,domain:sn,_exiting:an,config:ln,dlopen:un,uptime:qn,_getActiveRequests:pn,_getActiveHandles:cn,reallyExit:mn,_kill:fn,cpuUsage:St,resourceUsage:dn,memoryUsage:hn,kill:yn,exit:gn,openStdin:xn,allowedNodeEnvironmentFlags:bn,assert:Sn,features:wn,_fatalExceptions:vn,setUncaughtExceptionCaptureCallback:En,hasUncaughtExceptionCaptureCallback:Tn,emitWarning:Yr,nextTick:Dr,_tickCallback:In,_debugProcess:Nn,_debugEnd:Rn,_startProfilerIdleNotifier:An,_stopProfilerIdleNotifier:Cn,stdout:Bn,stdin:Fn,stderr:Ln,abort:Mn,umask:Zr,chdir:Qr,cwd:Xr,env:jr,title:qr,argv:zr,execArgv:Gr,pid:On,ppid:Pn,execPath:kn,debugPort:Un,hrtime:bt,argv0:_n,_preload_modules:Dn,setSourceMapsEnabled:$n}});var p=Le(()=>{"use strict";ti()});function js(){if(ri)return nt;ri=!0,nt.byteLength=b,nt.toByteArray=T,nt.fromByteArray=_;for(var i=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,m=r.length;s<m;++s)i[s]=r[s],t[r.charCodeAt(s)]=s;t[45]=62,t[95]=63;function a(N){var L=N.length;if(L%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var O=N.indexOf("=");O===-1&&(O=L);var V=O===L?0:4-O%4;return[O,V]}function b(N){var L=a(N),O=L[0],V=L[1];return(O+V)*3/4-V}function v(N,L,O){return(L+O)*3/4-O}function T(N){var L,O=a(N),V=O[0],J=O[1],W=new e(v(N,V,J)),Z=0,ee=J>0?V-4:V,Y;for(Y=0;Y<ee;Y+=4)L=t[N.charCodeAt(Y)]<<18|t[N.charCodeAt(Y+1)]<<12|t[N.charCodeAt(Y+2)]<<6|t[N.charCodeAt(Y+3)],W[Z++]=L>>16&255,W[Z++]=L>>8&255,W[Z++]=L&255;return J===2&&(L=t[N.charCodeAt(Y)]<<2|t[N.charCodeAt(Y+1)]>>4,W[Z++]=L&255),J===1&&(L=t[N.charCodeAt(Y)]<<10|t[N.charCodeAt(Y+1)]<<4|t[N.charCodeAt(Y+2)]>>2,W[Z++]=L>>8&255,W[Z++]=L&255),W}function I(N){return i[N>>18&63]+i[N>>12&63]+i[N>>6&63]+i[N&63]}function C(N,L,O){for(var V,J=[],W=L;W<O;W+=3)V=(N[W]<<16&16711680)+(N[W+1]<<8&65280)+(N[W+2]&255),J.push(I(V));return J.join("")}function _(N){for(var L,O=N.length,V=O%3,J=[],W=16383,Z=0,ee=O-V;Z<ee;Z+=W)J.push(C(N,Z,Z+W>ee?ee:Z+W));return V===1?(L=N[O-1],J.push(i[L>>2]+i[L<<4&63]+"==")):V===2&&(L=(N[O-2]<<8)+N[O-1],J.push(i[L>>10]+i[L>>4&63]+i[L<<2&63]+"=")),J.join("")}return nt}function zs(){if(ni)return wt;ni=!0;return wt.read=function(i,t,e,r,s){var m,a,b=s*8-r-1,v=(1<<b)-1,T=v>>1,I=-7,C=e?s-1:0,_=e?-1:1,N=i[t+C];for(C+=_,m=N&(1<<-I)-1,N>>=-I,I+=b;I>0;m=m*256+i[t+C],C+=_,I-=8);for(a=m&(1<<-I)-1,m>>=-I,I+=r;I>0;a=a*256+i[t+C],C+=_,I-=8);if(m===0)m=1-T;else{if(m===v)return a?NaN:(N?-1:1)*(1/0);a=a+Math.pow(2,r),m=m-T}return(N?-1:1)*a*Math.pow(2,m-r)},wt.write=function(i,t,e,r,s,m){var a,b,v,T=m*8-s-1,I=(1<<T)-1,C=I>>1,_=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=r?0:m-1,L=r?1:-1,O=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(b=isNaN(t)?1:0,a=I):(a=Math.floor(Math.log(t)/Math.LN2),t*(v=Math.pow(2,-a))<1&&(a--,v*=2),a+C>=1?t+=_/v:t+=_*Math.pow(2,1-C),t*v>=2&&(a++,v/=2),a+C>=I?(b=0,a=I):a+C>=1?(b=(t*v-1)*Math.pow(2,s),a=a+C):(b=t*Math.pow(2,C-1)*Math.pow(2,s),a=0));s>=8;i[e+N]=b&255,N+=L,b/=256,s-=8);for(a=a<<s|b,T+=s;T>0;i[e+N]=a&255,N+=L,a/=256,T-=8);i[e+N-L]|=O*128},wt}function oi(){if(ii)return Ie;ii=!0;let i=js(),t=zs(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ie.Buffer=a,Ie.SlowBuffer=J,Ie.INSPECT_MAX_BYTES=50;let r=2147483647;Ie.kMaxLength=r,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{let l=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(l,n),l.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function m(l){if(l>r)throw new RangeError('The value "'+l+'" is invalid for option "size"');let n=new Uint8Array(l);return Object.setPrototypeOf(n,a.prototype),n}function a(l,n,o){if(typeof l=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return I(l)}return b(l,n,o)}a.poolSize=8192;function b(l,n,o){if(typeof l=="string")return C(l,n);if(ArrayBuffer.isView(l))return N(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(ae(l,ArrayBuffer)||l&&ae(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ae(l,SharedArrayBuffer)||l&&ae(l.buffer,SharedArrayBuffer)))return L(l,n,o);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let f=l.valueOf&&l.valueOf();if(f!=null&&f!==l)return a.from(f,n,o);let h=O(l);if(h)return h;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return a.from(l[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}a.from=function(l,n,o){return b(l,n,o)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function v(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function T(l,n,o){return v(l),l<=0?m(l):n!==void 0?typeof o=="string"?m(l).fill(n,o):m(l).fill(n):m(l)}a.alloc=function(l,n,o){return T(l,n,o)};function I(l){return v(l),m(l<0?0:V(l)|0)}a.allocUnsafe=function(l){return I(l)},a.allocUnsafeSlow=function(l){return I(l)};function C(l,n){if((typeof n!="string"||n==="")&&(n="utf8"),!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);let o=W(l,n)|0,f=m(o),h=f.write(l,n);return h!==o&&(f=f.slice(0,h)),f}function _(l){let n=l.length<0?0:V(l.length)|0,o=m(n);for(let f=0;f<n;f+=1)o[f]=l[f]&255;return o}function N(l){if(ae(l,Uint8Array)){let n=new Uint8Array(l);return L(n.buffer,n.byteOffset,n.byteLength)}return _(l)}function L(l,n,o){if(n<0||l.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');let f;return n===void 0&&o===void 0?f=new Uint8Array(l):o===void 0?f=new Uint8Array(l,n):f=new Uint8Array(l,n,o),Object.setPrototypeOf(f,a.prototype),f}function O(l){if(a.isBuffer(l)){let n=V(l.length)|0,o=m(n);return o.length===0||l.copy(o,0,0,n),o}if(l.length!==void 0)return typeof l.length!="number"||Qt(l.length)?m(0):_(l);if(l.type==="Buffer"&&Array.isArray(l.data))return _(l.data)}function V(l){if(l>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return l|0}function J(l){return+l!=l&&(l=0),a.alloc(+l)}a.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==a.prototype},a.compare=function(n,o){if(ae(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),ae(o,Uint8Array)&&(o=a.from(o,o.offset,o.byteLength)),!a.isBuffer(n)||!a.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;let f=n.length,h=o.length;for(let w=0,E=Math.min(f,h);w<E;++w)if(n[w]!==o[w]){f=n[w],h=o[w];break}return f<h?-1:h<f?1:0},a.isEncoding=function(n){switch(String(n).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}},a.concat=function(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return a.alloc(0);let f;if(o===void 0)for(o=0,f=0;f<n.length;++f)o+=n[f].length;let h=a.allocUnsafe(o),w=0;for(f=0;f<n.length;++f){let E=n[f];if(ae(E,Uint8Array))w+E.length>h.length?(a.isBuffer(E)||(E=a.from(E)),E.copy(h,w)):Uint8Array.prototype.set.call(h,E,w);else if(a.isBuffer(E))E.copy(h,w);else throw new TypeError('"list" argument must be an Array of Buffers');w+=E.length}return h};function W(l,n){if(a.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||ae(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);let o=l.length,f=arguments.length>2&&arguments[2]===!0;if(!f&&o===0)return 0;let h=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Xt(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return kr(l).length;default:if(h)return f?-1:Xt(l).length;n=(""+n).toLowerCase(),h=!0}}a.byteLength=W;function Z(l,n,o){let f=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(l||(l="utf8");;)switch(l){case"hex":return Ns(this,n,o);case"utf8":case"utf-8":return Rr(this,n,o);case"ascii":return Ts(this,n,o);case"latin1":case"binary":return Is(this,n,o);case"base64":return vs(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rs(this,n,o);default:if(f)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),f=!0}}a.prototype._isBuffer=!0;function ee(l,n,o){let f=l[n];l[n]=l[o],l[o]=f}a.prototype.swap16=function(){let n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<n;o+=2)ee(this,o,o+1);return this},a.prototype.swap32=function(){let n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<n;o+=4)ee(this,o,o+3),ee(this,o+1,o+2);return this},a.prototype.swap64=function(){let n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<n;o+=8)ee(this,o,o+7),ee(this,o+1,o+6),ee(this,o+2,o+5),ee(this,o+3,o+4);return this},a.prototype.toString=function(){let n=this.length;return n===0?"":arguments.length===0?Rr(this,0,n):Z.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(n){if(!a.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:a.compare(this,n)===0},a.prototype.inspect=function(){let n="",o=Ie.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},e&&(a.prototype[e]=a.prototype.inspect),a.prototype.compare=function(n,o,f,h,w){if(ae(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(o===void 0&&(o=0),f===void 0&&(f=n?n.length:0),h===void 0&&(h=0),w===void 0&&(w=this.length),o<0||f>n.length||h<0||w>this.length)throw new RangeError("out of range index");if(h>=w&&o>=f)return 0;if(h>=w)return-1;if(o>=f)return 1;if(o>>>=0,f>>>=0,h>>>=0,w>>>=0,this===n)return 0;let E=w-h,F=f-o,D=Math.min(E,F),U=this.slice(h,w),$=n.slice(o,f);for(let P=0;P<D;++P)if(U[P]!==$[P]){E=U[P],F=$[P];break}return E<F?-1:F<E?1:0};function Y(l,n,o,f,h){if(l.length===0)return-1;if(typeof o=="string"?(f=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Qt(o)&&(o=h?0:l.length-1),o<0&&(o=l.length+o),o>=l.length){if(h)return-1;o=l.length-1}else if(o<0)if(h)o=0;else return-1;if(typeof n=="string"&&(n=a.from(n,f)),a.isBuffer(n))return n.length===0?-1:Nr(l,n,o,f,h);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?h?Uint8Array.prototype.indexOf.call(l,n,o):Uint8Array.prototype.lastIndexOf.call(l,n,o):Nr(l,[n],o,f,h);throw new TypeError("val must be string, number or Buffer")}function Nr(l,n,o,f,h){let w=1,E=l.length,F=n.length;if(f!==void 0&&(f=String(f).toLowerCase(),f==="ucs2"||f==="ucs-2"||f==="utf16le"||f==="utf-16le")){if(l.length<2||n.length<2)return-1;w=2,E/=2,F/=2,o/=2}function D($,P){return w===1?$[P]:$.readUInt16BE(P*w)}let U;if(h){let $=-1;for(U=o;U<E;U++)if(D(l,U)===D(n,$===-1?0:U-$)){if($===-1&&($=U),U-$+1===F)return $*w}else $!==-1&&(U-=U-$),$=-1}else for(o+F>E&&(o=E-F),U=o;U>=0;U--){let $=!0;for(let P=0;P<F;P++)if(D(l,U+P)!==D(n,P)){$=!1;break}if($)return U}return-1}a.prototype.includes=function(n,o,f){return this.indexOf(n,o,f)!==-1},a.prototype.indexOf=function(n,o,f){return Y(this,n,o,f,!0)},a.prototype.lastIndexOf=function(n,o,f){return Y(this,n,o,f,!1)};function gs(l,n,o,f){o=Number(o)||0;let h=l.length-o;f?(f=Number(f),f>h&&(f=h)):f=h;let w=n.length;f>w/2&&(f=w/2);let E;for(E=0;E<f;++E){let F=parseInt(n.substr(E*2,2),16);if(Qt(F))return E;l[o+E]=F}return E}function xs(l,n,o,f){return gt(Xt(n,l.length-o),l,o,f)}function bs(l,n,o,f){return gt(Ls(n),l,o,f)}function Ss(l,n,o,f){return gt(kr(n),l,o,f)}function ws(l,n,o,f){return gt(Fs(n,l.length-o),l,o,f)}a.prototype.write=function(n,o,f,h){if(o===void 0)h="utf8",f=this.length,o=0;else if(f===void 0&&typeof o=="string")h=o,f=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(f)?(f=f>>>0,h===void 0&&(h="utf8")):(h=f,f=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let w=this.length-o;if((f===void 0||f>w)&&(f=w),n.length>0&&(f<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");h||(h="utf8");let E=!1;for(;;)switch(h){case"hex":return gs(this,n,o,f);case"utf8":case"utf-8":return xs(this,n,o,f);case"ascii":case"latin1":case"binary":return bs(this,n,o,f);case"base64":return Ss(this,n,o,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ws(this,n,o,f);default:if(E)throw new TypeError("Unknown encoding: "+h);h=(""+h).toLowerCase(),E=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vs(l,n,o){return n===0&&o===l.length?i.fromByteArray(l):i.fromByteArray(l.slice(n,o))}function Rr(l,n,o){o=Math.min(l.length,o);let f=[],h=n;for(;h<o;){let w=l[h],E=null,F=w>239?4:w>223?3:w>191?2:1;if(h+F<=o){let D,U,$,P;switch(F){case 1:w<128&&(E=w);break;case 2:D=l[h+1],(D&192)===128&&(P=(w&31)<<6|D&63,P>127&&(E=P));break;case 3:D=l[h+1],U=l[h+2],(D&192)===128&&(U&192)===128&&(P=(w&15)<<12|(D&63)<<6|U&63,P>2047&&(P<55296||P>57343)&&(E=P));break;case 4:D=l[h+1],U=l[h+2],$=l[h+3],(D&192)===128&&(U&192)===128&&($&192)===128&&(P=(w&15)<<18|(D&63)<<12|(U&63)<<6|$&63,P>65535&&P<1114112&&(E=P))}}E===null?(E=65533,F=1):E>65535&&(E-=65536,f.push(E>>>10&1023|55296),E=56320|E&1023),f.push(E),h+=F}return Es(f)}let Ar=4096;function Es(l){let n=l.length;if(n<=Ar)return String.fromCharCode.apply(String,l);let o="",f=0;for(;f<n;)o+=String.fromCharCode.apply(String,l.slice(f,f+=Ar));return o}function Ts(l,n,o){let f="";o=Math.min(l.length,o);for(let h=n;h<o;++h)f+=String.fromCharCode(l[h]&127);return f}function Is(l,n,o){let f="";o=Math.min(l.length,o);for(let h=n;h<o;++h)f+=String.fromCharCode(l[h]);return f}function Ns(l,n,o){let f=l.length;(!n||n<0)&&(n=0),(!o||o<0||o>f)&&(o=f);let h="";for(let w=n;w<o;++w)h+=Ms[l[w]];return h}function Rs(l,n,o){let f=l.slice(n,o),h="";for(let w=0;w<f.length-1;w+=2)h+=String.fromCharCode(f[w]+f[w+1]*256);return h}a.prototype.slice=function(n,o){let f=this.length;n=~~n,o=o===void 0?f:~~o,n<0?(n+=f,n<0&&(n=0)):n>f&&(n=f),o<0?(o+=f,o<0&&(o=0)):o>f&&(o=f),o<n&&(o=n);let h=this.subarray(n,o);return Object.setPrototypeOf(h,a.prototype),h};function j(l,n,o){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+n>o)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(n,o,f){n=n>>>0,o=o>>>0,f||j(n,o,this.length);let h=this[n],w=1,E=0;for(;++E<o&&(w*=256);)h+=this[n+E]*w;return h},a.prototype.readUintBE=a.prototype.readUIntBE=function(n,o,f){n=n>>>0,o=o>>>0,f||j(n,o,this.length);let h=this[n+--o],w=1;for(;o>0&&(w*=256);)h+=this[n+--o]*w;return h},a.prototype.readUint8=a.prototype.readUInt8=function(n,o){return n=n>>>0,o||j(n,1,this.length),this[n]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||j(n,2,this.length),this[n]|this[n+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||j(n,2,this.length),this[n]<<8|this[n+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||j(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||j(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},a.prototype.readBigUInt64LE=ye(function(n){n=n>>>0,Be(n,"offset");let o=this[n],f=this[n+7];(o===void 0||f===void 0)&&tt(n,this.length-8);let h=o+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24,w=this[++n]+this[++n]*2**8+this[++n]*2**16+f*2**24;return BigInt(h)+(BigInt(w)<<BigInt(32))}),a.prototype.readBigUInt64BE=ye(function(n){n=n>>>0,Be(n,"offset");let o=this[n],f=this[n+7];(o===void 0||f===void 0)&&tt(n,this.length-8);let h=o*2**24+this[++n]*2**16+this[++n]*2**8+this[++n],w=this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+f;return(BigInt(h)<<BigInt(32))+BigInt(w)}),a.prototype.readIntLE=function(n,o,f){n=n>>>0,o=o>>>0,f||j(n,o,this.length);let h=this[n],w=1,E=0;for(;++E<o&&(w*=256);)h+=this[n+E]*w;return w*=128,h>=w&&(h-=Math.pow(2,8*o)),h},a.prototype.readIntBE=function(n,o,f){n=n>>>0,o=o>>>0,f||j(n,o,this.length);let h=o,w=1,E=this[n+--h];for(;h>0&&(w*=256);)E+=this[n+--h]*w;return w*=128,E>=w&&(E-=Math.pow(2,8*o)),E},a.prototype.readInt8=function(n,o){return n=n>>>0,o||j(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},a.prototype.readInt16LE=function(n,o){n=n>>>0,o||j(n,2,this.length);let f=this[n]|this[n+1]<<8;return f&32768?f|4294901760:f},a.prototype.readInt16BE=function(n,o){n=n>>>0,o||j(n,2,this.length);let f=this[n+1]|this[n]<<8;return f&32768?f|4294901760:f},a.prototype.readInt32LE=function(n,o){return n=n>>>0,o||j(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},a.prototype.readInt32BE=function(n,o){return n=n>>>0,o||j(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},a.prototype.readBigInt64LE=ye(function(n){n=n>>>0,Be(n,"offset");let o=this[n],f=this[n+7];(o===void 0||f===void 0)&&tt(n,this.length-8);let h=this[n+4]+this[n+5]*2**8+this[n+6]*2**16+(f<<24);return(BigInt(h)<<BigInt(32))+BigInt(o+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24)}),a.prototype.readBigInt64BE=ye(function(n){n=n>>>0,Be(n,"offset");let o=this[n],f=this[n+7];(o===void 0||f===void 0)&&tt(n,this.length-8);let h=(o<<24)+this[++n]*2**16+this[++n]*2**8+this[++n];return(BigInt(h)<<BigInt(32))+BigInt(this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+f)}),a.prototype.readFloatLE=function(n,o){return n=n>>>0,o||j(n,4,this.length),t.read(this,n,!0,23,4)},a.prototype.readFloatBE=function(n,o){return n=n>>>0,o||j(n,4,this.length),t.read(this,n,!1,23,4)},a.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||j(n,8,this.length),t.read(this,n,!0,52,8)},a.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||j(n,8,this.length),t.read(this,n,!1,52,8)};function X(l,n,o,f,h,w){if(!a.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>h||n<w)throw new RangeError('"value" argument is out of bounds');if(o+f>l.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(n,o,f,h){if(n=+n,o=o>>>0,f=f>>>0,!h){let F=Math.pow(2,8*f)-1;X(this,n,o,f,F,0)}let w=1,E=0;for(this[o]=n&255;++E<f&&(w*=256);)this[o+E]=n/w&255;return o+f},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(n,o,f,h){if(n=+n,o=o>>>0,f=f>>>0,!h){let F=Math.pow(2,8*f)-1;X(this,n,o,f,F,0)}let w=f-1,E=1;for(this[o+w]=n&255;--w>=0&&(E*=256);)this[o+w]=n/E&255;return o+f},a.prototype.writeUint8=a.prototype.writeUInt8=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,1,255,0),this[o]=n&255,o+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function Cr(l,n,o,f,h){Pr(n,f,h,l,o,7);let w=Number(n&BigInt(4294967295));l[o++]=w,w=w>>8,l[o++]=w,w=w>>8,l[o++]=w,w=w>>8,l[o++]=w;let E=Number(n>>BigInt(32)&BigInt(4294967295));return l[o++]=E,E=E>>8,l[o++]=E,E=E>>8,l[o++]=E,E=E>>8,l[o++]=E,o}function Br(l,n,o,f,h){Pr(n,f,h,l,o,7);let w=Number(n&BigInt(4294967295));l[o+7]=w,w=w>>8,l[o+6]=w,w=w>>8,l[o+5]=w,w=w>>8,l[o+4]=w;let E=Number(n>>BigInt(32)&BigInt(4294967295));return l[o+3]=E,E=E>>8,l[o+2]=E,E=E>>8,l[o+1]=E,E=E>>8,l[o]=E,o+8}a.prototype.writeBigUInt64LE=ye(function(n,o=0){return Cr(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=ye(function(n,o=0){return Br(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(n,o,f,h){if(n=+n,o=o>>>0,!h){let D=Math.pow(2,8*f-1);X(this,n,o,f,D-1,-D)}let w=0,E=1,F=0;for(this[o]=n&255;++w<f&&(E*=256);)n<0&&F===0&&this[o+w-1]!==0&&(F=1),this[o+w]=(n/E>>0)-F&255;return o+f},a.prototype.writeIntBE=function(n,o,f,h){if(n=+n,o=o>>>0,!h){let D=Math.pow(2,8*f-1);X(this,n,o,f,D-1,-D)}let w=f-1,E=1,F=0;for(this[o+w]=n&255;--w>=0&&(E*=256);)n<0&&F===0&&this[o+w+1]!==0&&(F=1),this[o+w]=(n/E>>0)-F&255;return o+f},a.prototype.writeInt8=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},a.prototype.writeInt16LE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},a.prototype.writeInt16BE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},a.prototype.writeInt32LE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},a.prototype.writeInt32BE=function(n,o,f){return n=+n,o=o>>>0,f||X(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},a.prototype.writeBigInt64LE=ye(function(n,o=0){return Cr(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=ye(function(n,o=0){return Br(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Lr(l,n,o,f,h,w){if(o+f>l.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function Fr(l,n,o,f,h){return n=+n,o=o>>>0,h||Lr(l,n,o,4),t.write(l,n,o,f,23,4),o+4}a.prototype.writeFloatLE=function(n,o,f){return Fr(this,n,o,!0,f)},a.prototype.writeFloatBE=function(n,o,f){return Fr(this,n,o,!1,f)};function Mr(l,n,o,f,h){return n=+n,o=o>>>0,h||Lr(l,n,o,8),t.write(l,n,o,f,52,8),o+8}a.prototype.writeDoubleLE=function(n,o,f){return Mr(this,n,o,!0,f)},a.prototype.writeDoubleBE=function(n,o,f){return Mr(this,n,o,!1,f)},a.prototype.copy=function(n,o,f,h){if(!a.isBuffer(n))throw new TypeError("argument should be a Buffer");if(f||(f=0),!h&&h!==0&&(h=this.length),o>=n.length&&(o=n.length),o||(o=0),h>0&&h<f&&(h=f),h===f||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(f<0||f>=this.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("sourceEnd out of bounds");h>this.length&&(h=this.length),n.length-o<h-f&&(h=n.length-o+f);let w=h-f;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,f,h):Uint8Array.prototype.set.call(n,this.subarray(f,h),o),w},a.prototype.fill=function(n,o,f,h){if(typeof n=="string"){if(typeof o=="string"?(h=o,o=0,f=this.length):typeof f=="string"&&(h=f,f=this.length),h!==void 0&&typeof h!="string")throw new TypeError("encoding must be a string");if(typeof h=="string"&&!a.isEncoding(h))throw new TypeError("Unknown encoding: "+h);if(n.length===1){let E=n.charCodeAt(0);(h==="utf8"&&E<128||h==="latin1")&&(n=E)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<f)throw new RangeError("Out of range index");if(f<=o)return this;o=o>>>0,f=f===void 0?this.length:f>>>0,n||(n=0);let w;if(typeof n=="number")for(w=o;w<f;++w)this[w]=n;else{let E=a.isBuffer(n)?n:a.from(n,h),F=E.length;if(F===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(w=0;w<f-o;++w)this[w+o]=E[w%F]}return this};let Ce={};function Zt(l,n,o){Ce[l]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:n.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${l}]`,this.stack,delete this.name}get code(){return l}set code(h){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:h,writable:!0})}toString(){return`${this.name} [${l}]: ${this.message}`}}}Zt("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Zt("ERR_INVALID_ARG_TYPE",function(l,n){return`The "${l}" argument must be of type number. Received type ${typeof n}`},TypeError),Zt("ERR_OUT_OF_RANGE",function(l,n,o){let f=`The value of "${l}" is out of range.`,h=o;return Number.isInteger(o)&&Math.abs(o)>2**32?h=Or(String(o)):typeof o=="bigint"&&(h=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(h=Or(h)),h+="n"),f+=` It must be ${n}. Received ${h}`,f},RangeError);function Or(l){let n="",o=l.length,f=l[0]==="-"?1:0;for(;o>=f+4;o-=3)n=`_${l.slice(o-3,o)}${n}`;return`${l.slice(0,o)}${n}`}function As(l,n,o){Be(n,"offset"),(l[n]===void 0||l[n+o]===void 0)&&tt(n,l.length-(o+1))}function Pr(l,n,o,f,h,w){if(l>o||l<n){let E=typeof n=="bigint"?"n":"",F;throw n===0||n===BigInt(0)?F=`>= 0${E} and < 2${E} ** ${(w+1)*8}${E}`:F=`>= -(2${E} ** ${(w+1)*8-1}${E}) and < 2 ** ${(w+1)*8-1}${E}`,new Ce.ERR_OUT_OF_RANGE("value",F,l)}As(f,h,w)}function Be(l,n){if(typeof l!="number")throw new Ce.ERR_INVALID_ARG_TYPE(n,"number",l)}function tt(l,n,o){throw Math.floor(l)!==l?(Be(l,o),new Ce.ERR_OUT_OF_RANGE("offset","an integer",l)):n<0?new Ce.ERR_BUFFER_OUT_OF_BOUNDS:new Ce.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${n}`,l)}let Cs=/[^+/0-9A-Za-z-_]/g;function Bs(l){if(l=l.split("=")[0],l=l.trim().replace(Cs,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function Xt(l,n){n=n||1/0;let o,f=l.length,h=null,w=[];for(let E=0;E<f;++E){if(o=l.charCodeAt(E),o>55295&&o<57344){if(!h){if(o>56319){(n-=3)>-1&&w.push(239,191,189);continue}else if(E+1===f){(n-=3)>-1&&w.push(239,191,189);continue}h=o;continue}if(o<56320){(n-=3)>-1&&w.push(239,191,189),h=o;continue}o=(h-55296<<10|o-56320)+65536}else h&&(n-=3)>-1&&w.push(239,191,189);if(h=null,o<128){if((n-=1)<0)break;w.push(o)}else if(o<2048){if((n-=2)<0)break;w.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;w.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;w.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return w}function Ls(l){let n=[];for(let o=0;o<l.length;++o)n.push(l.charCodeAt(o)&255);return n}function Fs(l,n){let o,f,h,w=[];for(let E=0;E<l.length&&!((n-=2)<0);++E)o=l.charCodeAt(E),f=o>>8,h=o%256,w.push(h),w.push(f);return w}function kr(l){return i.toByteArray(Bs(l))}function gt(l,n,o,f){let h;for(h=0;h<f&&!(h+o>=n.length||h>=l.length);++h)n[h+o]=l[h];return h}function ae(l,n){return l instanceof n||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===n.name}function Qt(l){return l!==l}let Ms=(function(){let l="0123456789abcdef",n=new Array(256);for(let o=0;o<16;++o){let f=o*16;for(let h=0;h<16;++h)n[f+h]=l[o]+l[h]}return n})();function ye(l){return typeof BigInt>"u"?Os:l}function Os(){throw new Error("BigInt not supported")}return Ie}var nt,ri,wt,ni,Ie,ii,si=Le(()=>{"use strict";u();c();p();nt={},ri=!1;wt={},ni=!1;Ie={},ii=!1});var Ne,g,tc,rc,ai=Le(()=>{"use strict";u();c();p();si();Ne=oi();Ne.Buffer;Ne.SlowBuffer;Ne.INSPECT_MAX_BYTES;Ne.kMaxLength;g=Ne.Buffer,tc=Ne.INSPECT_MAX_BYTES,rc=Ne.kMaxLength});var c=Le(()=>{"use strict";ai()});var mr=ge((vw,Ko)=>{"use strict";u();c();p();function Ku(i){return!(typeof i!="number"||i!==i||i===1/0||i===-1/0)}Ko.exports=Ku});var Jo=ge((Nw,Yo)=>{"use strict";u();c();p();var Yu=9007199254740991;Yo.exports=Yu});var fr=ge((Bw,Zo)=>{"use strict";u();c();p();var Ju=Jo();function Zu(i){return typeof i=="number"&&Math.abs(i)<=Ju}Zo.exports=Zu});var Qo=ge((Ow,Xo)=>{"use strict";u();c();p();var Xu=mr(),Qu=fr();function ep(i){var t=parseInt(i,10);if(!Xu(t))throw new TypeError("Not a finite number: "+i+" ("+typeof i+")");if(!Qu(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),s=r>=11&&r<=13,m=e.charAt(e.length-1);return e+(s?"th":m==="1"?"st":m==="2"?"nd":m==="3"?"rd":"th")}Xo.exports=ep});var dr=ge((_w,rs)=>{"use strict";u();c();p();var tp=/(hundred|thousand|(m|b|tr|quadr)illion)$/,rp=/teen$/,es=/y$/,ts=/(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)$/,np={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 ip(i){return tp.test(i)||rp.test(i)?i+"th":es.test(i)?i.replace(es,"ieth"):ts.test(i)?i.replace(ts,op):i}function op(i,t){return np[t]}rs.exports=ip});var wr=ge((Ww,os)=>{"use strict";u();c();p();var sp=dr(),ap=mr(),lp=fr(),ns=10,hr=100,yr=1e3,gr=1e6,xr=1e9,br=1e12,Sr=1e15,up=9007199254740992,is=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],pp=["zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function cp(i,t){var e,r=parseInt(i,10);if(!ap(r))throw new TypeError("Not a finite number: "+i+" ("+typeof i+")");if(!lp(r))throw new RangeError("Input is not a safe number, it\u2019s either too large or too small.");return e=Ee(r),t?sp(e):e}function Ee(i){var t,e,r=arguments[1];return i===0?r?r.join(" ").replace(/,$/,""):"zero":(r||(r=[]),i<0&&(r.push("minus"),i=Math.abs(i)),i<20?(t=0,e=is[i]):i<hr?(t=i%ns,e=pp[Math.floor(i/ns)],t&&(e+="-"+is[t],t=0)):i<yr?(t=i%hr,e=Ee(Math.floor(i/hr))+" hundred"):i<gr?(t=i%yr,e=Ee(Math.floor(i/yr))+" thousand,"):i<xr?(t=i%gr,e=Ee(Math.floor(i/gr))+" million,"):i<br?(t=i%xr,e=Ee(Math.floor(i/xr))+" billion,"):i<Sr?(t=i%br,e=Ee(Math.floor(i/br))+" trillion,"):i<=up&&(t=i%Sr,e=Ee(Math.floor(i/Sr))+" quadrillion,"),r.push(e),Ee(t,r))}os.exports=cp});var as=ge((Gw,ss)=>{"use strict";u();c();p();var mp=dr(),fp=wr();function dp(i){var t=fp(i);return mp(t)}ss.exports=dp});var us=ge((Jw,ls)=>{"use strict";u();c();p();ls.exports={toOrdinal:Qo(),toWords:wr(),toWordsOrdinal:as()}});var Wp={};Fe(Wp,{DynamicSnippetsGenerator:()=>Jt,EndpointSnippetGenerator:()=>et});module.exports=Ws(Wp);u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();var Gs=typeof global=="object"&&global&&global.Object===Object&&global,li=Gs;var Hs=typeof self=="object"&&self&&self.Object===Object&&self,Ks=li||Hs||Function("return this")(),be=Ks;var Ys=be.Symbol,fe=Ys;u();c();p();var ui=Object.prototype,Js=ui.hasOwnProperty,Zs=ui.toString,it=fe?fe.toStringTag:void 0;function Xs(i){var t=Js.call(i,it),e=i[it];try{i[it]=void 0;var r=!0}catch{}var s=Zs.call(i);return r&&(t?i[it]=e:delete i[it]),s}var pi=Xs;u();c();p();var Qs=Object.prototype,ea=Qs.toString;function ta(i){return ea.call(i)}var ci=ta;var ra="[object Null]",na="[object Undefined]",mi=fe?fe.toStringTag:void 0;function ia(i){return i==null?i===void 0?na:ra:mi&&mi in Object(i)?pi(i):ci(i)}var vt=ia;u();c();p();function oa(i){return i!=null&&typeof i=="object"}var fi=oa;var sa="[object Symbol]";function aa(i){return typeof i=="symbol"||fi(i)&&vt(i)==sa}var di=aa;u();c();p();u();c();p();function la(i,t){for(var e=-1,r=i==null?0:i.length,s=Array(r);++e<r;)s[e]=t(i[e],e,i);return s}var hi=la;u();c();p();var ua=Array.isArray,yi=ua;var pa=1/0,gi=fe?fe.prototype:void 0,xi=gi?gi.toString:void 0;function bi(i){if(typeof i=="string")return i;if(yi(i))return hi(i,bi)+"";if(di(i))return xi?xi.call(i):"";var t=i+"";return t=="0"&&1/i==-pa?"-0":t}var Si=bi;u();c();p();function ca(i){var t=typeof i;return i!=null&&(t=="object"||t=="function")}var Et=ca;u();c();p();u();c();p();u();c();p();var ma="[object AsyncFunction]",fa="[object Function]",da="[object GeneratorFunction]",ha="[object Proxy]";function ya(i){if(!Et(i))return!1;var t=vt(i);return t==fa||t==da||t==ma||t==ha}var wi=ya;u();c();p();u();c();p();var ga=be["__core-js_shared__"],Tt=ga;var vi=(function(){var i=/[^.]+$/.exec(Tt&&Tt.keys&&Tt.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function xa(i){return!!vi&&vi in i}var Ei=xa;u();c();p();var ba=Function.prototype,Sa=ba.toString;function wa(i){if(i!=null){try{return Sa.call(i)}catch{}try{return i+""}catch{}}return""}var Ti=wa;var va=/[\\^$.*+?()[\]{}|]/g,Ea=/^\[object .+?Constructor\]$/,Ta=Function.prototype,Ia=Object.prototype,Na=Ta.toString,Ra=Ia.hasOwnProperty,Aa=RegExp("^"+Na.call(Ra).replace(va,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ca(i){if(!Et(i)||Ei(i))return!1;var t=wi(i)?Aa:Ea;return t.test(Ti(i))}var Ii=Ca;u();c();p();function Ba(i,t){return i?.[t]}var Ni=Ba;function La(i,t){var e=Ni(i,t);return Ii(e)?e:void 0}var Oe=La;u();c();p();function Fa(){}var Ri=Fa;u();c();p();u();c();p();u();c();p();function Ma(i,t,e,r){for(var s=i.length,m=e+(r?1:-1);r?m--:++m<s;)if(t(i[m],m,i))return m;return-1}var Ai=Ma;u();c();p();function Oa(i){return i!==i}var Ci=Oa;u();c();p();function Pa(i,t,e){for(var r=e-1,s=i.length;++r<s;)if(i[r]===t)return r;return-1}var Bi=Pa;function ka(i,t,e){return t===t?Bi(i,t,e):Ai(i,Ci,e)}var Li=ka;function Ua(i,t){var e=i==null?0:i.length;return!!e&&Li(i,t,0)>-1}var Fi=Ua;u();c();p();function _a(i,t){return i===t||i!==i&&t!==t}var Mi=_a;u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();var Da=Oe(Object,"create"),de=Da;function $a(){this.__data__=de?de(null):{},this.size=0}var Oi=$a;u();c();p();function qa(i){var t=this.has(i)&&delete this.__data__[i];return this.size-=t?1:0,t}var Pi=qa;u();c();p();var Wa="__lodash_hash_undefined__",Va=Object.prototype,ja=Va.hasOwnProperty;function za(i){var t=this.__data__;if(de){var e=t[i];return e===Wa?void 0:e}return ja.call(t,i)?t[i]:void 0}var ki=za;u();c();p();var Ga=Object.prototype,Ha=Ga.hasOwnProperty;function Ka(i){var t=this.__data__;return de?t[i]!==void 0:Ha.call(t,i)}var Ui=Ka;u();c();p();var Ya="__lodash_hash_undefined__";function Ja(i,t){var e=this.__data__;return this.size+=this.has(i)?0:1,e[i]=de&&t===void 0?Ya:t,this}var _i=Ja;function Pe(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var r=i[t];this.set(r[0],r[1])}}Pe.prototype.clear=Oi;Pe.prototype.delete=Pi;Pe.prototype.get=ki;Pe.prototype.has=Ui;Pe.prototype.set=_i;var nr=Pe;u();c();p();u();c();p();function Za(){this.__data__=[],this.size=0}var Di=Za;u();c();p();u();c();p();function Xa(i,t){for(var e=i.length;e--;)if(Mi(i[e][0],t))return e;return-1}var Se=Xa;var Qa=Array.prototype,el=Qa.splice;function tl(i){var t=this.__data__,e=Se(t,i);if(e<0)return!1;var r=t.length-1;return e==r?t.pop():el.call(t,e,1),--this.size,!0}var $i=tl;u();c();p();function rl(i){var t=this.__data__,e=Se(t,i);return e<0?void 0:t[e][1]}var qi=rl;u();c();p();function nl(i){return Se(this.__data__,i)>-1}var Wi=nl;u();c();p();function il(i,t){var e=this.__data__,r=Se(e,i);return r<0?(++this.size,e.push([i,t])):e[r][1]=t,this}var Vi=il;function ke(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var r=i[t];this.set(r[0],r[1])}}ke.prototype.clear=Di;ke.prototype.delete=$i;ke.prototype.get=qi;ke.prototype.has=Wi;ke.prototype.set=Vi;var ji=ke;u();c();p();var ol=Oe(be,"Map"),zi=ol;function sl(){this.size=0,this.__data__={hash:new nr,map:new(zi||ji),string:new nr}}var Gi=sl;u();c();p();u();c();p();u();c();p();function al(i){var t=typeof i;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?i!=="__proto__":i===null}var Hi=al;function ll(i,t){var e=i.__data__;return Hi(t)?e[typeof t=="string"?"string":"hash"]:e.map}var we=ll;function ul(i){var t=we(this,i).delete(i);return this.size-=t?1:0,t}var Ki=ul;u();c();p();function pl(i){return we(this,i).get(i)}var Yi=pl;u();c();p();function cl(i){return we(this,i).has(i)}var Ji=cl;u();c();p();function ml(i,t){var e=we(this,i),r=e.size;return e.set(i,t),this.size+=e.size==r?0:1,this}var Zi=ml;function Ue(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var r=i[t];this.set(r[0],r[1])}}Ue.prototype.clear=Gi;Ue.prototype.delete=Ki;Ue.prototype.get=Yi;Ue.prototype.has=Ji;Ue.prototype.set=Zi;var Xi=Ue;u();c();p();function fl(i){return i==null?"":Si(i)}var ve=fl;u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();u();c();p();function dl(i,t,e){var r=-1,s=i.length;t<0&&(t=-t>s?0:s+t),e=e>s?s:e,e<0&&(e+=s),s=t>e?0:e-t>>>0,t>>>=0;for(var m=Array(s);++r<s;)m[r]=i[r+t];return m}var Qi=dl;function hl(i,t,e){var r=i.length;return e=e===void 0?r:e,!t&&e>=r?i:Qi(i,t,e)}var eo=hl;u();c();p();var yl="\\ud800-\\udfff",gl="\\u0300-\\u036f",xl="\\ufe20-\\ufe2f",bl="\\u20d0-\\u20ff",Sl=gl+xl+bl,wl="\\ufe0e\\ufe0f",vl="\\u200d",El=RegExp("["+vl+yl+Sl+wl+"]");function Tl(i){return El.test(i)}var It=Tl;u();c();p();u();c();p();function Il(i){return i.split("")}var to=Il;u();c();p();var ro="\\ud800-\\udfff",Nl="\\u0300-\\u036f",Rl="\\ufe20-\\ufe2f",Al="\\u20d0-\\u20ff",Cl=Nl+Rl+Al,Bl="\\ufe0e\\ufe0f",Ll="["+ro+"]",ir="["+Cl+"]",or="\\ud83c[\\udffb-\\udfff]",Fl="(?:"+ir+"|"+or+")",no="[^"+ro+"]",io="(?:\\ud83c[\\udde6-\\uddff]){2}",oo="[\\ud800-\\udbff][\\udc00-\\udfff]",Ml="\\u200d",so=Fl+"?",ao="["+Bl+"]?",Ol="(?:"+Ml+"(?:"+[no,io,oo].join("|")+")"+ao+so+")*",Pl=ao+so+Ol,kl="(?:"+[no+ir+"?",ir,io,oo,Ll].join("|")+")",Ul=RegExp(or+"(?="+or+")|"+kl+Pl,"g");function _l(i){return i.match(Ul)||[]}var lo=_l;function Dl(i){return It(i)?lo(i):to(i)}var uo=Dl;function $l(i){return function(t){t=ve(t);var e=It(t)?uo(t):void 0,r=e?e[0]:t.charAt(0),s=e?eo(e,1).join(""):t.slice(1);return r[i]()+s}}var po=$l;var ql=po("toUpperCase"),H=ql;function Wl(i){return H(ve(i).toLowerCase())}var co=Wl;u();c();p();u();c();p();function Vl(i,t,e,r){var s=-1,m=i==null?0:i.length;for(r&&m&&(e=i[++s]);++s<m;)e=t(e,i[s],s,i);return e}var mo=Vl;u();c();p();u();c();p();u();c();p();function jl(i){return function(t){return i?.[t]}}var fo=jl;var zl={\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"},Gl=fo(zl),ho=Gl;var Hl=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kl="\\u0300-\\u036f",Yl="\\ufe20-\\ufe2f",Jl="\\u20d0-\\u20ff",Zl=Kl+Yl+Jl,Xl="["+Zl+"]",Ql=RegExp(Xl,"g");function eu(i){return i=ve(i),i&&i.replace(Hl,ho).replace(Ql,"")}var yo=eu;u();c();p();u();c();p();var tu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ru(i){return i.match(tu)||[]}var go=ru;u();c();p();var nu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function iu(i){return nu.test(i)}var xo=iu;u();c();p();var Eo="\\ud800-\\udfff",ou="\\u0300-\\u036f",su="\\ufe20-\\ufe2f",au="\\u20d0-\\u20ff",lu=ou+su+au,To="\\u2700-\\u27bf",Io="a-z\\xdf-\\xf6\\xf8-\\xff",uu="\\xac\\xb1\\xd7\\xf7",pu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",cu="\\u2000-\\u206f",mu=" \\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",No="A-Z\\xc0-\\xd6\\xd8-\\xde",fu="\\ufe0e\\ufe0f",Ro=uu+pu+cu+mu,Ao="['\u2019]",bo="["+Ro+"]",du="["+lu+"]",Co="\\d+",hu="["+To+"]",Bo="["+Io+"]",Lo="[^"+Eo+Ro+Co+To+Io+No+"]",yu="\\ud83c[\\udffb-\\udfff]",gu="(?:"+du+"|"+yu+")",xu="[^"+Eo+"]",Fo="(?:\\ud83c[\\udde6-\\uddff]){2}",Mo="[\\ud800-\\udbff][\\udc00-\\udfff]",_e="["+No+"]",bu="\\u200d",So="(?:"+Bo+"|"+Lo+")",Su="(?:"+_e+"|"+Lo+")",wo="(?:"+Ao+"(?:d|ll|m|re|s|t|ve))?",vo="(?:"+Ao+"(?:D|LL|M|RE|S|T|VE))?",Oo=gu+"?",Po="["+fu+"]?",wu="(?:"+bu+"(?:"+[xu,Fo,Mo].join("|")+")"+Po+Oo+")*",vu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Eu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Tu=Po+Oo+wu,Iu="(?:"+[hu,Fo,Mo].join("|")+")"+Tu,Nu=RegExp([_e+"?"+Bo+"+"+wo+"(?="+[bo,_e,"$"].join("|")+")",Su+"+"+vo+"(?="+[bo,_e+So,"$"].join("|")+")",_e+"?"+So+"+"+wo,_e+"+"+vo,Eu,vu,Co,Iu].join("|"),"g");function Ru(i){return i.match(Nu)||[]}var ko=Ru;function Au(i,t,e){return i=ve(i),t=e?void 0:t,t===void 0?xo(i)?ko(i):go(i):i.match(t)||[]}var Uo=Au;var Cu="['\u2019]",Bu=RegExp(Cu,"g");function Lu(i){return function(t){return mo(Uo(yo(t).replace(Bu,"")),i,"")}}var _o=Lu;var Fu=_o(function(i,t,e){return t=t.toLowerCase(),i+(e?co(t):t)}),te=Fu;u();c();p();var Mu=Oe(be,"Set"),Nt=Mu;u();c();p();u();c();p();var Ou="__lodash_hash_undefined__";function Pu(i){return this.__data__.set(i,Ou),this}var Do=Pu;u();c();p();function ku(i){return this.__data__.has(i)}var $o=ku;function Rt(i){var t=-1,e=i==null?0:i.length;for(this.__data__=new Xi;++t<e;)this.add(i[t])}Rt.prototype.add=Rt.prototype.push=Do;Rt.prototype.has=$o;var qo=Rt;u();c();p();function Uu(i,t){return i.has(t)}var Wo=Uu;u();c();p();function _u(i){var t=-1,e=Array(i.size);return i.forEach(function(r){e[++t]=r}),e}var At=_u;u();c();p();function Du(i,t,e){for(var r=-1,s=i==null?0:i.length;++r<s;)if(e(t,i[r]))return!0;return!1}var Vo=Du;u();c();p();u();c();p();var $u=1/0,qu=Nt&&1/At(new Nt([,-0]))[1]==$u?function(i){return new Nt(i)}:Ri,jo=qu;var Wu=200;function Vu(i,t,e){var r=-1,s=Fi,m=i.length,a=!0,b=[],v=b;if(e)a=!1,s=Vo;else if(m>=Wu){var T=t?null:jo(i);if(T)return At(T);a=!1,s=Wo,v=new qo}else v=t?[]:b;e:for(;++r<m;){var I=i[r],C=t?t(I):I;if(I=e||I!==0?I:0,a&&C===C){for(var _=v.length;_--;)if(v[_]===C)continue e;t&&v.push(C),b.push(I)}else s(v,C,e)||(v!==b&&v.push(C),b.push(I))}return b}var zo=Vu;u();c();p();function ju(i,t){return t=typeof t=="function"?t:void 0,i&&i.length?zo(i,void 0,t):[]}var sr=ju;u();c();p();function ne(i,t){if(i===void 0)throw new Error(t??"Expected value to be defined but got undefined.")}function Q(i,t){if(i===null)throw new Error(t??"Expected value to be non-null but got null.")}function ar(i,t){if(typeof i!="string")throw new Error(t??`Expected value to be a string but got ${typeof i}.`)}function A(i){throw new Error("Unexpected value: "+JSON.stringify(i))}u();c();p();function K(){}u();c();p();function ot(i){return Object.keys(i)}u();c();p();function lr(i){return Object.entries(i)}u();c();p();var st=class st{constructor(t){d(this,"symbolSet");d(this,"symbolMap");d(this,"conflictResolutionStrategy");this.symbolSet=new Set(t?.reservedSymbolNames??st.defaultOptions.reservedSymbolNames),this.symbolMap=new Map,this.conflictResolutionStrategy=t?.conflictResolutionStrategy??st.defaultOptions.conflictResolutionStrategy}getSymbolNameByIdOrThrow(t){let e=this.getSymbolNameById(t);return ne(e,`Symbol with ID '${t}' not found for in registry.`),e}getSymbolNameById(t){return this.symbolMap.get(t)}registerSymbol(t,e){if(this.isSymbolIdRegistered(t))throw new Error(`Symbol with ID '${t}' is already registered.`);let s=this.getAvailableSymbolName(e);return this.symbolMap.set(t,s),this.symbolSet.add(s),s}getAvailableSymbolName(t){for(let s of t)if(!this.isSymbolNameRegistered(s))return s;let[e]=t,r=e;if(this.conflictResolutionStrategy==="numbered-suffix"){let s=2;for(;this.isSymbolNameRegistered(r);)r=`${e}${s++}`}else if(this.conflictResolutionStrategy==="underscore-suffix")for(;this.isSymbolNameRegistered(r);)r+="_";else A(this.conflictResolutionStrategy);return r}isSymbolNameRegistered(t){return this.symbolSet.has(t)}isSymbolIdRegistered(t){return this.symbolMap.has(t)}getAllSymbols(){return Array.from(this.symbolMap.entries()).map(([t,e])=>({id:t,name:e}))}};d(st,"defaultOptions",{reservedSymbolNames:[],conflictResolutionStrategy:"underscore-suffix"});var re=st;u();c();p();function ie(i,t="type"){return{_visit:e=>{let r=e[i[t]];return r!=null?r(i):(e._other==null&&A(i),e._other(i))}}}u();c();p();u();c();p();u();c();p();var at=y.env.FERN_STACK_TRACK?.toLowerCase()??"",le=at!==""&&at!=="0"&&at!=="false",ur=["single","multiline","box"].includes(at)?at:"single";le&&(Error.stackTraceLimit=50);var zu=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Gu=new Set(["stacktrace"]);function Bt({maxFrames:i=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:s=[],filterNode:m=!0,filterJs:a=!0,formatFilename:b=v=>v}={}){if(!le)return[];r=[...r,...zu],e=[...e,...Gu],s=[...s,"runInteractiveTask"];let v=!1;return(new Error().stack??"").split(`
2
+ `).map(T=>{let I=T.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(I&&I.length===5){let[,C,_,N,L]=I;if(!C||!_||!N||!L)return;if(v||s.some(O=>C?.includes(O))){v=!0;return}switch(C){case"Object.<anonymous>":C="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":C=`${C.substring(C.indexOf(".")+1)}()=> { ... }`;break}return{fn:C,path:b(_),position:`${N}:${L}`}}}).filter(T=>T&&!r.some(I=>T.fn.includes(I))&&!(m&&T.path?.startsWith("node:"))&&!(a&&T.path?.endsWith(".js"))&&!e.some(I=>T.path.includes(I))).slice(t,t+i)}var Ct=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:r=[],filterFunctions:s=[],stopOn:m=[],filterNode:a=!0,filterJs:b=!0,multiline:v=!1,formatFilename:T=I=>I}={}){d(this,"maxFrames");d(this,"skip");d(this,"filterPaths");d(this,"filterFunctions");d(this,"stopOn");d(this,"filterNode");d(this,"filterJs");d(this,"multiline");d(this,"formatFilename");d(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=r,this.filterFunctions=s,this.stopOn=m,this.filterNode=a,this.filterJs=b,this.multiline=v,this.formatFilename=T}tag(t){let e=this.tracking.get(t)||new Set;Bt({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>e.add(r)),this.tracking.set(t,e)}trace(t){if(!le)return"";let e=this.tracking.get(t);return e?[...e].map(r=>`${this.multiline?`
3
+ `:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},pr;function Go({maxFrames:i=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:s=[],filterNode:m=!0,filterJs:a=!0,multiline:b=!1,formatFilename:v=T=>T}={}){le&&(pr??(pr=new Ct({maxFrames:i,skip:t,filterPaths:e,filterFunctions:r,stopOn:s,filterNode:m,filterJs:a,multiline:b,formatFilename:v})))}function Ho(i){pr?.tag(i)}function cr(i){return pr?.frames(i)??[]}var Re=class{constructor(){Ho(this)}};u();c();p();u();c();p();u();c();p();var oe=class extends Re{constructor(e){super();d(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 Hu=4;Go({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var lt=class{constructor(){d(this,"lineBuffer",[]);d(this,"indentLevel",0);d(this,"hasWrittenAnything",!1);d(this,"lastCharacterIsSemicolon",!1);d(this,"lastCharacterIsNewline",!1);d(this,"nodeStackFrames",[])}get buffer(){return le&&this.nodeStackFrames.length>0&&this.writeInternal(`
4
4
  `),this.lineBuffer.join(`
5
5
  `)+(this.lastCharacterIsNewline?`
6
6
  `:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let r=e.length>0&&e.endsWith(`
7
- `),s=r?e.substring(0,e.length-1):e,m=this.getIndentString(),l=s.replaceAll(`
7
+ `),s=r?e.substring(0,e.length-1):e,m=this.getIndentString(),a=s.replaceAll(`
8
8
  `,`
9
- ${m}`);this.isAtStartOfLine()&&(l=m+l),r&&(l+=`
10
- `),this.writeInternal(l)}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){le&&this.nodeStackFrames.push(...cr(t)),t.write(this),le&&ur!=="single"&&this.writeInternal(`
9
+ ${m}`);this.isAtStartOfLine()&&(a=m+a),r&&(a+=`
10
+ `),this.writeInternal(a)}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){le&&this.nodeStackFrames.push(...cr(t)),t.write(this),le&&ur!=="single"&&this.writeInternal(`
11
11
  `)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){this.writeNode(t),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new oe(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new oe(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new oe(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new oe(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new oe(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(...t){this.write(...t.length===0?[""]:t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
12
12
  `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
13
- `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let s=t[0];s!=null&&r(s);for(let m=1;m<t.length;m++){this.write(e);let l=t[m];l!=null&&r(l)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
13
+ `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let s=t[0];s!=null&&r(s);for(let m=1;m<t.length;m++){this.write(e);let a=t[m];a!=null&&r(a)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
14
14
  `),this.lastCharacterIsSemicolon=t.endsWith(";");let r=t.split(`
15
- `),s=le&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),s&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(r=>`${e?`(${e}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(Bt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,ur){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Hu}};u();c();p();u();c();p();u();c();p();var ut=class{constructor(){d(this,"reporter");d(this,"snippet");d(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw this.err??new Error(`Failed to generate snippet for endpoint "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>(this.snippet?.length??0)}};var pt=class{constructor(t){d(this,"context");this.context=t}async generate(t,e={}){let r=this.resolveEndpoints({request:t,options:e});if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let s=new ut;for(let m of r){let l=this.context.clone(),b=this.createSnippetGenerator(l);try{let v=await b.generateSnippet({endpoint:m,request:t,options:e});if(l.errors.empty())return{snippet:v,errors:void 0};s.update({context:l,snippet:v})}catch(v){s.err==null&&(s.err=v)}}return s.getResponseOrThrow({endpoint:t.endpoint})}async generateSnippetAst(t,e={}){let r=this.resolveEndpoints({request:t,options:e});if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let s;for(let m of r){let l=this.context.clone(),b=this.createSnippetGenerator(l);try{return await b.generateSnippetAst({endpoint:m,request:t,options:e})}catch(v){s=v}}throw s??new Error(`Failed to generate snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateSync(t,e={}){let r=this.resolveEndpoints({request:t,options:e});if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let s=new ut;for(let m of r){let l=this.context.clone(),b=this.createSnippetGenerator(l);try{let v=b.generateSnippetSync({endpoint:m,request:t,options:e});if(l.errors.empty())return{snippet:v,errors:void 0};s.update({context:l,snippet:v})}catch(v){s.err==null&&(s.err=v)}}return s.getResponseOrThrow({endpoint:t.endpoint})}resolveEndpoints({request:t,options:e}){if(e.endpointId!=null){let r=this.context.resolveEndpointById(e.endpointId);if(r==null)throw new Error(`No endpoint found with ID "${e.endpointId}"`);return[r]}return this.context.resolveEndpointLocationOrThrow(t.endpoint)}};u();c();p();u();c();p();u();c();p();var ct=class{constructor(){d(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(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[2]==null||r[3]==null))return{namespace:r[1],method:r[2],path:r[3]}}};u();c();p();var M={Critical:"CRITICAL",Warning:"WARNING"},mt=class i{constructor(){d(this,"errors");d(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push({...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}truncate(t){this.errors.length=t}clone(){let t=new i;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 ft=class{constructor({ir:t,config:e,options:r={}}){d(this,"config");d(this,"options");d(this,"errors");d(this,"_ir");d(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=r,this.errors=new mt,this.httpEndpointReferenceParser=new ct}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[s,m]of Object.entries(e))if(m!==void 0){this.errors.scope(s);try{let l=t.find(v=>v.name.wireValue===s);if(l==null)throw this.newParameterNotRecognizedError(s);let b=this.isListTypeReference(l.typeReference)&&!Array.isArray(m)?[m]:m;r.push({name:l.name,typeReference:l.typeReference,value:b})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:t,values:e}){let r=[];for(let s of t){this.errors.scope(s.name.wireValue);try{let m=e[s.name.wireValue];if(m==null)if(s.typeReference.type==="primitive"&&s.typeReference.value==="STRING")m=`<${s.name.wireValue}>`;else{this.errors.add({severity:M.Critical,message:this.newParameterNotRecognizedError(s.name.wireValue).message});continue}r.push({name:s.name,typeReference:s.typeReference,value:m})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let s=[],m=new Set;for(let l of t){let b=l.name.wireValue,v=e[b];if(v!==void 0){m.add(b),this.errors.scope(b);try{s.push({name:l.name,typeReference:l.typeReference,value:v})}finally{this.errors.unscope()}}}if(!r){for(let[l,b]of Object.entries(e))if(!(b===void 0||m.has(l))){this.errors.scope(l);try{this.errors.add({severity:M.Critical,message:this.newParameterNotRecognizedError(l).message})}finally{this.errors.unscope()}}}return s}getExampleObjectProperties({parameters:t,snippetObject:e}){let r=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},s=[];for(let m of t){let l=r[m.name.wireValue];l==null?m.typeReference.type==="nullable"&&s.push({name:m.name,typeReference:m.typeReference,value:null}):s.push({name:m.name,typeReference:m.typeReference,value:l})}return s}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:M.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:M.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let s=[];for(let m of r){if(typeof m!="string"){this.errors.add({severity:M.Critical,message:`Expected file array value to be an array of strings, got ${typeof m}`});return}s.push(m)}return s}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:M.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t??{}}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:M.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 s=t.discriminant.wireValue,m=r[s];if(m==null){this.errors.add({severity:M.Critical,message:this.newParameterNotRecognizedError(s).message});return}if(typeof m!="string"){this.errors.add({severity:M.Critical,message:`Expected discriminant value to be a string but got: ${typeof m}`});return}let l=t.types[m];if(l==null){this.errors.add({severity:M.Critical,message:`No type found for discriminant value "${m}"`});return}let{[s]:b,...v}=r;return{singleDiscriminatedUnionType:l,discriminantValue:l.discriminantValue,value:v}}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}resolveEndpointById(t){return this._ir.endpoints[t]}resolveEndpointByIdOrThrow(t){let e=this.resolveEndpointById(t);if(e==null)throw new Error(`Failed to find endpoint with ID "${t}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){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}):!t.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){return e&&(t.metadata?.includePathParameters??!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:A(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(s=>s.id===t);return r?.name}case"multipleBaseUrls":{let r=e.environments.find(s=>s.id===t);return r?.name}default:A(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:M.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:M.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:M.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let s=new Set(ot(r.urls));for(let m of ot(t))s.has(m)&&s.delete(m);return s.size>0?(this.errors.add({severity:M.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${ot(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:M.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:M.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:M.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:A(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:A(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:A(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};u();c();p();var he={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};u();c();p();u();c();p();u();c();p();var Ft={};Fe(Ft,{sanitizeForIdentifier:()=>vr,sanitizeToCamelCase:()=>yp,sanitizeToPascalCase:()=>hp});u();c();p();var ps=qs(us(),1);u();c();p();function Lt(i){return H(te(i))}function hp(i){let t=vr(i);return Lt(t)}function yp(i){let t=vr(i);return te(t)}function vr(i){if(i==="")return"empty";let t=i;if(/^\d/.test(t)){let r=gp(t);t=r.numberAsWords+H(r.rest)}return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)||(t=t.replace(/^[^a-zA-Z0-9]+/,""),t=te(t)),/^\d/.test(t)&&(t="value"+t),t===""?"value":t}function gp(i){let t=i.match(/^(\d+)/);if(!t||!t[1])return{numberAsWords:"",rest:i};let e=t[1],r=i.slice(e.length);try{return{numberAsWords:(0,ps.toWords)(parseInt(e,10)),rest:r}}catch{let s={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(l=>s[l]||l).join(""),rest:r}}}u();c();p();var Ae={};Fe(Ae,{generateEnumCaseLabel:()=>bp,generateName:()=>xp,sanitizeLiteralValue:()=>Er});u();c();p();function xp(i){let t=Er(i);return Lt(t)}function bp(i){let t=Er(i);return te(t)}function Er(i){if(i==="")return"empty";let t=i;return/^[a-zA-Z][a-zA-Z0-9]*$/.test(i)||(t=t.replace(/^[^a-zA-Z0-9]+/,""),t=te(t)),/^\d/.test(t)||t===""?"value":t}u();c();p();var Mt=class{constructor(t,e){d(this,"nameRegistry");d(this,"fromSymbol");this.nameRegistry=t,this.fromSymbol=e}referenceSwiftType(t){let e=this.nameRegistry.reference({fromSymbol:this.fromSymbol,toSymbol:S.Symbol.swiftType(t)});return S.TypeReference.symbol(e)}referenceFoundationType(t){let e=this.nameRegistry.reference({fromSymbol:this.fromSymbol,toSymbol:S.Symbol.foundationType(t)});return S.TypeReference.symbol(e)}referenceAsIsType(t){let e=this.nameRegistry.getAsIsSymbolOrThrow(t),r=this.nameRegistry.reference({fromSymbol:this.fromSymbol,toSymbol:e});return S.TypeReference.symbol(r)}referenceSourceTemplateType(t){let e=this.nameRegistry.getSourceTemplateSymbolOrThrow(t),r=this.nameRegistry.reference({fromSymbol:this.fromSymbol,toSymbol:e});return S.TypeReference.symbol(r)}referenceType(t){let e=this.nameRegistry.reference({fromSymbol:this.fromSymbol,toSymbol:t});return S.TypeReference.symbol(e)}resolveToSymbolIfSymbolType(t){let e=t.getReferenceIfSymbolType();return e===null?null:this.nameRegistry.resolveReference({fromSymbol:this.fromSymbol,reference:e})}resolvesToTheAsIsType(t,e){let r=this.resolveToSymbolIfSymbolType(t),s=this.nameRegistry.getAsIsSymbolOrThrow(e);return r?.id===s.id}resolvesToASwiftType(t){return this.resolveToSymbolIfSymbolType(t)?.isSwiftSymbol??!1}resolvesToTheSwiftType(t,e){return this.resolveToSymbolIfSymbolType(t)?.id===S.Symbol.swiftType(e).id}resolvesToAFoundationType(t){return this.resolveToSymbolIfSymbolType(t)?.isFoundationSymbol??!1}resolvesToTheFoundationType(t,e){return this.resolveToSymbolIfSymbolType(t)?.id===S.Symbol.foundationType(e).id}resolvesToACustomType(t){return this.resolveToSymbolIfSymbolType(t)?.isCustomSymbol??!1}resolvesToAnEnumWithRawValues(t){return this.resolveToSymbolIfSymbolType(t)?.shape.type==="enum-with-raw-values"}};u();c();p();var Ot={};Fe(Ot,{inferCaseNameForTypeReference:()=>ue});u();c();p();var Sp={String:"string",Bool:"bool",Int:"int",Int64:"int64",UInt:"uint",UInt64:"uint64",Float:"float",Double:"double",Void:"void",Encoder:"encoder",Decoder:"decoder",Any:"any"},wp={Data:"data",Date:"date",UUID:"uuid"};function ue(i,t,e){if(t.variant.type==="symbol"){let r=t.variant.symbol,s=e.resolveReference({fromSymbol:i,reference:r});Q(s,`Cannot find symbol ${r} for type reference ${t.variant.type}`);let m=s.name;return S.Symbol.isSwiftSymbol(s.id)&&S.Symbol.isSwiftSymbolName(m)?Sp[m]:S.Symbol.isFoundationSymbol(s.id)&&S.Symbol.isFoundationSymbolName(m)?wp[m]:te(m)}else if(t.variant.type==="generic"){let r=t.variant.arguments.map(s=>ue(i,s,e));return`${ue(i,t.variant.reference,e)}Of${H(r.join("And"))}`}else{if(t.variant.type==="array")return`${ue(i,t.variant.elementType,e)}Array`;if(t.variant.type==="dictionary"){let r=ue(i,t.variant.keyType,e),s=ue(i,t.variant.valueType,e);return`${r}To${H(s)}Dictionary`}else if(t.variant.type==="optional"){let r=ue(i,t.variant.valueType,e);return`optional${H(r)}`}else if(t.variant.type==="nullable"){let r=ue(i,t.variant.valueType,e);return`nullable${H(r)}`}else if(t.variant.type==="tuple"){let r=t.variant.elements.map(s=>ue(i,s,e));return`tuple${H(r.join("And"))}`}else{if(t.variant.type==="member-access")return`${ue(i,t.variant.target,e)}${H(t.variant.memberName)}`;A(t.variant)}}}u();c();p();u();c();p();var Pt=class{constructor(){d(this,"namespace");this.namespace=new re}getRequestTypeNameOrThrow(t,e){let r=this.requestTypeNameId(t,e);return this.namespace.getSymbolNameByIdOrThrow(r)}addRequestTypeSymbol(t,e,r){let s=this.requestTypeNameId(t,e);return this.namespace.registerSymbol(s,r)}requestTypeNameId(t,e){return`${t}_${e}`}};u();c();p();var kt=class{constructor(){d(this,"namespace");this.namespace=new re}addStaticSymbolName(t){let e=this.staticSymbolNameId(t);return this.namespace.registerSymbol(e,[t])}staticSymbolNameId(t){return`Static:${t}`}addRootClientSymbolName(t){let e=this.rootClientSymbolNameId();return this.namespace.registerSymbol(e,t)}getRootClientSymbolNameOrThrow(){return this.namespace.getSymbolNameByIdOrThrow(this.rootClientSymbolNameId())}rootClientSymbolNameId(){return"RootClientClass"}addEnvironmentSymbolName(t){let e=this.environmentSymbolNameId();return this.namespace.registerSymbol(e,t)}getEnvironmentSymbolNameOrThrow(){return this.namespace.getSymbolNameByIdOrThrow(this.environmentSymbolNameId())}environmentSymbolNameId(){return"EnvironmentEnum"}addErrorEnumSymbolName(t){let e=this.errorEnumSymbolNameId();return this.namespace.registerSymbol(e,t)}getErrorEnumSymbolNameOrThrow(){return this.namespace.getSymbolNameByIdOrThrow(this.errorEnumSymbolNameId())}errorEnumSymbolNameId(){return"ErrorEnum"}addRequestsContainerSymbolName(t){let e=this.requestsContainerSymbolNameId();return this.namespace.registerSymbol(e,t)}getRequestsContainerSymbolNameOrThrow(){return this.namespace.getSymbolNameByIdOrThrow(this.requestsContainerSymbolNameId())}requestsContainerSymbolNameId(){return"RequestsContainer"}addSubClientSymbolName(t,e){let r=this.subClientSymbolNameId(t);return this.namespace.registerSymbol(r,e)}getSubClientSymbolNameOrThrow(t){return this.namespace.getSymbolNameByIdOrThrow(this.subClientSymbolNameId(t))}subClientSymbolNameId(t){return`SubClient:${t}`}addSchemaTypeSymbolName(t,e){let r=this.schemaTypeSymbolNameId(t);return this.namespace.registerSymbol(r,e)}getSchemaTypeSymbolNameOrThrow(t){let e=this.schemaTypeSymbolNameId(t);return this.namespace.getSymbolNameByIdOrThrow(e)}schemaTypeSymbolNameId(t){return`SchemaType:${t}`}};u();c();p();var Ut=class{constructor(){d(this,"namespace");this.namespace=new re}asIsNameId(t){return`AsIs:${t}`}wireTestSuiteNameId(t){return`WireTestSuite:${t}`}addAsIsSymbol(t){let e=this.asIsNameId(t);this.namespace.registerSymbol(e,[t])}registerWireTestSuiteSymbol(t){return this.namespace.registerSymbol(this.wireTestSuiteNameId(t),[`${t}WireTests`,`${t}WireTestSuite`])}getWireTestSuiteNameOrThrow(t){return this.namespace.getSymbolNameByIdOrThrow(this.wireTestSuiteNameId(t))}};var _t=class i{constructor(){d(this,"symbolRegistry");d(this,"sourceModuleNamespace");d(this,"testModuleNamespace");d(this,"requestsNamespace");d(this,"sourceStaticSymbolsByName");d(this,"testStaticSymbolsByName");d(this,"requestTypeSymbols");d(this,"subClientSymbols");d(this,"nestedLiteralEnumSymbolsByParentSymbolId");d(this,"undiscriminatedUnionVariantsByParentSymbolId");this.symbolRegistry=S.SymbolRegistry.create(),this.sourceModuleNamespace=new kt,this.testModuleNamespace=new Ut,this.requestsNamespace=new Pt,this.sourceStaticSymbolsByName=new Map,this.testStaticSymbolsByName=new Map,this.requestTypeSymbols=[],this.subClientSymbols=[],this.nestedLiteralEnumSymbolsByParentSymbolId=new Map,this.undiscriminatedUnionVariantsByParentSymbolId=new Map}static create(){return new i}getAsIsSymbolOrThrow(t){let e=this.sourceStaticSymbolsByName.get(t);return ne(e,`As is symbol not found for name "${t}"`),e}getSourceTemplateSymbolOrThrow(t){switch(t){case"ClientError":return this.getErrorEnumSymbolOrThrow();case"HTTPClient":{let e=this.symbolRegistry.inferSymbolIdForSourceModuleType(t);return S.Symbol.create(e,t,{type:"class"})}case"ClientConfig":{let e=this.sourceStaticSymbolsByName.get(t);return ne(e,`Source template symbol not found for name "${t}"`),e}default:A(t)}}registerSourceModuleSymbol({configModuleName:t,apiNamePascalCase:e,asIsSymbols:r}){let s=[`${e}`,`${e}Api`,`${e}Module`];typeof t=="string"&&s.unshift(t);let l=new re({reservedSymbolNames:["Swift","Foundation"]}).registerSymbol("Module",s),b=this.symbolRegistry.registerSourceModule(l);return r.forEach(v=>{let T=v.name;this.registerSourceStaticSymbol(T,v.shape)}),b}getRegisteredSourceModuleSymbolOrThrow(){return this.symbolRegistry.getRegisteredSourceModuleSymbolOrThrow()}registerSourceStaticSymbol(t,e){this.symbolRegistry.registerSourceModuleType(t,e),this.sourceModuleNamespace.addStaticSymbolName(t);let r=this.symbolRegistry.inferSymbolIdForSourceModuleType(t),s=S.Symbol.create(r,t,e);this.sourceStaticSymbolsByName.set(t,s)}registerTestModuleSymbol({sourceModuleName:t,asIsSymbols:e}){let r=[`${t}Tests`,`${t}Test`,`${t}TestsModule`],s=(()=>{let l=new re;return l.registerSymbol("Swift",["Swift"]),l.registerSymbol("Foundation",["Foundation"]),l.registerSymbol(t,[t]),l.registerSymbol(`${t}Tests`,r)})(),m=this.symbolRegistry.registerTestModule(s);return e.forEach(l=>{let b=l.name;this.symbolRegistry.registerTestModuleType(b,l.shape),this.testModuleNamespace.addAsIsSymbol(b);let v=this.symbolRegistry.inferSymbolIdForTestModuleType(b),T=S.Symbol.create(v,b,l.shape);this.testStaticSymbolsByName.set(b,T)}),m}getRegisteredTestModuleSymbolOrThrow(){return this.symbolRegistry.getRegisteredTestModuleSymbolOrThrow()}registerRootClientSymbol({configClientClassName:t,registeredSourceModuleName:e}){let r=[`${e}Client`,`${e}ApiClient`,`${e}Service`];typeof t=="string"&&r.unshift(t);let s=this.sourceModuleNamespace.addRootClientSymbolName(r);return this.symbolRegistry.registerSourceModuleType(s,{type:"class"})}getRootClientSymbolOrThrow(){let t=this.sourceModuleNamespace.getRootClientSymbolNameOrThrow(),e=this.symbolRegistry.inferSymbolIdForSourceModuleType(t);return this.symbolRegistry.getSymbolByIdOrThrow(e)}registerEnvironmentSymbol({configEnvironmentEnumName:t,registeredSourceModuleName:e}){let r=[`${e}Environment`,`${e}Environ`,`${e}Env`];typeof t=="string"&&r.unshift(t);let s=this.sourceModuleNamespace.addEnvironmentSymbolName(r);return this.symbolRegistry.registerSourceModuleType(s,{type:"enum-with-raw-values"})}getEnvironmentSymbolOrThrow(){let t=this.sourceModuleNamespace.getEnvironmentSymbolNameOrThrow(),e=this.symbolRegistry.inferSymbolIdForSourceModuleType(t);return this.symbolRegistry.getSymbolByIdOrThrow(e)}registerErrorEnumSymbol(t){let e=[`${t}Error`,`${t}ClientError`],r=this.sourceModuleNamespace.addErrorEnumSymbolName(e);return this.symbolRegistry.registerSourceModuleType(r,{type:"enum-with-associated-values"})}getErrorEnumSymbolOrThrow(){let t=this.sourceModuleNamespace.getErrorEnumSymbolNameOrThrow(),e=this.symbolRegistry.inferSymbolIdForSourceModuleType(t);return this.symbolRegistry.getSymbolByIdOrThrow(e)}registerRequestsContainerSymbol(){let t=this.sourceModuleNamespace.addRequestsContainerSymbolName(["Requests","RequestTypes","InlineRequests"]);return this.symbolRegistry.registerSourceModuleType(t,{type:"enum-container"})}getRequestsContainerSymbolOrThrow(){let t=this.sourceModuleNamespace.getRequestsContainerSymbolNameOrThrow(),e=this.symbolRegistry.inferSymbolIdForSourceModuleType(t);return this.symbolRegistry.getSymbolByIdOrThrow(e)}registerRequestTypeSymbol({endpointId:t,requestNamePascalCase:e}){let r=[`${e}Type`];e.endsWith("Request")?r.push(`${e}Body`,`${e}BodyType`):r.push(`${e}Request`,`${e}RequestBody`,`${e}RequestBodyType`);let s=this.getRequestsContainerSymbolOrThrow(),m=this.requestsNamespace.addRequestTypeSymbol(t,e,[e,...r]),l=this.symbolRegistry.registerNestedType({parentSymbol:s,symbolName:m,shape:{type:"struct"}});return this.requestTypeSymbols.push(l),l}getRequestTypeSymbolOrThrow(t,e){let r=this.requestsNamespace.getRequestTypeNameOrThrow(t,e),s=this.getRequestsContainerSymbolOrThrow(),m=this.symbolRegistry.inferSymbolIdForNestedType(s.id,r);return this.symbolRegistry.getSymbolByIdOrThrow(m)}getAllRequestTypeSymbols(){return[...this.requestTypeSymbols]}registerSubClientSymbol({subpackageId:t,fernFilepathPartNamesPascalCase:e,subpackageNamePascalCase:r}){let s=e.toReversed();s.shift();let m=s.map((v,T)=>s.slice(0,T+1).reverse().join("")+r+"Client"),l=this.sourceModuleNamespace.addSubClientSymbolName(t,[`${r}Client`,...m]),b=this.symbolRegistry.registerSourceModuleType(l,{type:"class"});return this.subClientSymbols.push(b),b}getSubClientSymbolOrThrow(t){let e=this.sourceModuleNamespace.getSubClientSymbolNameOrThrow(t),r=this.symbolRegistry.inferSymbolIdForSourceModuleType(e);return this.symbolRegistry.getSymbolByIdOrThrow(r)}getAllSubClientSymbols(){return[...this.subClientSymbols]}registerSchemaTypeSymbol(t,e,r){let s=this.sourceModuleNamespace.addSchemaTypeSymbolName(t,[e,`${e}Type`,`${e}Model`,`${e}Schema`]);return this.symbolRegistry.registerSourceModuleType(s,r)}getSchemaTypeSymbolOrThrow(t){let e=this.sourceModuleNamespace.getSchemaTypeSymbolNameOrThrow(t),r=this.symbolRegistry.inferSymbolIdForSourceModuleType(e);return this.symbolRegistry.getSymbolByIdOrThrow(r)}registerNestedLiteralEnumSymbol({parentSymbol:t,literalValue:e}){let r=typeof t=="string"?t:t.id,s=this.nestedLiteralEnumSymbolsByParentSymbolId.get(r)??new Map,m=s.get(e);if(m)return m;let l=Array.from(s.values()),b=(()=>{let T=new re({reservedSymbolNames:["CodingKeys"]});l.forEach(C=>{T.registerSymbol(C.id,[C.name])});let I=Ae.generateName(e);return T.registerSymbol(e,[I,`${I}Literal`,`${I}Enum`,`${I}StringEnum`])})(),v=this.symbolRegistry.registerNestedType({parentSymbol:t,symbolName:b,shape:{type:"enum-with-raw-values"}});return s.set(e,v),this.nestedLiteralEnumSymbolsByParentSymbolId.set(r,s),v}getNestedLiteralEnumSymbolOrThrow(t,e){let r=typeof t=="string"?t:t.id,m=(this.nestedLiteralEnumSymbolsByParentSymbolId.get(r)??new Map).get(e);return ne(m,`Nested literal enum symbol not found for literal value "${e}" in parent symbol "${r}"`),m}getNestedLiteralEnumSymbol(t,e){let r=typeof t=="string"?t:t.id;return(this.nestedLiteralEnumSymbolsByParentSymbolId.get(r)??new Map).get(e)}getAllNestedLiteralEnumSymbolsOrThrow(t){let e=typeof t=="string"?t:t.id,r=this.nestedLiteralEnumSymbolsByParentSymbolId.get(e)??new Map;return Array.from(r.entries()).sort(([,s],[,m])=>s.name.localeCompare(m.name)).map(([s,m])=>({symbol:m,literalValue:s,caseLabel:Ae.generateEnumCaseLabel(s)}))}registerUndiscriminatedUnionVariants({parentSymbol:t,variants:e}){let r=typeof t=="string"?t:t.id,s=sr(e,(m,l)=>m.caseName===l.caseName);return this.undiscriminatedUnionVariantsByParentSymbolId.set(r,s),s}getAllUndiscriminatedUnionVariantsOrThrow(t){let e=typeof t=="string"?t:t.id;return this.undiscriminatedUnionVariantsByParentSymbolId.get(e)??[]}registerWireTestSuiteSymbol(t){let e=this.testModuleNamespace.registerWireTestSuiteSymbol(t);return this.symbolRegistry.registerTestModuleType(e,{type:"struct"})}getWireTestSuiteSymbolOrThrow(t){let e=this.testModuleNamespace.getWireTestSuiteNameOrThrow(t),r=this.symbolRegistry.inferSymbolIdForTestModuleType(e);return this.symbolRegistry.getSymbolByIdOrThrow(r)}referenceFromSourceModuleScope(t){let e=this.getRegisteredSourceModuleSymbolOrThrow();return this.symbolRegistry.reference({fromSymbol:e,toSymbol:t})}reference({fromSymbol:t,toSymbol:e}){return this.symbolRegistry.reference({fromSymbol:t,toSymbol:e})}resolveReference({fromSymbol:t,reference:e}){return this.symbolRegistry.resolveReference({fromSymbol:t,reference:e})}};var S={};Fe(S,{AccessLevel:()=>cs,Class:()=>$e,CodeBlock:()=>z,Comment:()=>qe,ComputedProperty:()=>Ve,DeclarationType:()=>ht,DocComment:()=>je,EnumWithAssociatedValues:()=>ze,EnumWithRawValues:()=>Ge,Expression:()=>pe,Extension:()=>He,FunctionArgument:()=>Ke,FunctionParameter:()=>Ye,Initializer:()=>Je,LineBreak:()=>qt,Method:()=>Ze,Pattern:()=>Wt,Property:()=>Xe,Protocol:()=>ms,SourceAsIsFileSpecs:()=>Np,SourceTemplateFileSpecs:()=>Rp,Statement:()=>We,Struct:()=>Qe,Symbol:()=>q,SymbolRegistry:()=>Tr,TypeReference:()=>Gt,class_:()=>Ap,codeBlock:()=>Cp,comment:()=>Bp,computedProperty:()=>Lp,docComment:()=>Fp,enumWithAssociatedValues:()=>Mp,enumWithRawValues:()=>Op,extension:()=>Pp,functionArgument:()=>kp,functionParameter:()=>Up,initializer:()=>_p,method:()=>Dp,property:()=>$p,struct:()=>qp});u();c();p();u();c();p();u();c();p();var cs={Open:"open",Public:"public",Package:"package",Internal:"internal",Fileprivate:"fileprivate",Private:"private"};u();c();p();u();c();p();function Dt(i){let t="";for(let e of i)switch(e){case"\\":t+="\\\\";break;case'"':t+='\\"';break;case`
16
- `:t+="\\n";break;case"\r":t+="\\r";break;case" ":t+="\\t";break;case"\0":t+="\\0";break;default:{let r=e.charCodeAt(0);r<32||r===127?t+=`\\u{${r.toString(16).toUpperCase()}}`:t+=e}}return t}u();c();p();var vp=["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"],Ep=new Set(vp);function Tp(i){return Ep.has(i)}function k(i){return Tp(i)?`\`${i}\``:i}function $t(i){return i.split(".").map(t=>k(t)).join(".")}function Ip(i){return i==="self"?"self_":i}function De(i){let t=Ip(i);return t.length>0&&/^[0-9]/.test(t)?`_${t}`:t}u();c();p();u();c();p();u();c();p();var dt=class extends lt{toString(){return this.buffer}};var B=class extends Re{toString(){let t=new dt;return this.write(t),t.toString()}toStringWithIndentation(t){let e=new dt;for(let r=1;r<t;r++)e.indent();this.write(e);for(let r=1;r<t;r++)e.dedent();return e.toString()}};var $e=class extends B{constructor({accessLevel:e,name:r,final:s,conformances:m,properties:l,initializers:b,methods:v,nestedTypes:T,docs:I}){super();d(this,"name");d(this,"final");d(this,"accessLevel");d(this,"conformances");d(this,"properties");d(this,"initializers");d(this,"methods");d(this,"nestedTypes");d(this,"docs");this.name=r,this.final=s,this.accessLevel=e,this.conformances=m??[],this.properties=l,this.initializers=b??[],this.methods=v??[],this.nestedTypes=T??[],this.docs=I}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 ${k(this.name)}`),this.conformances.forEach((r,s)=>{s===0?e.write(": "):s>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,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),this.methods.length>0&&(e.newLine(),this.methods.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),this.nestedTypes.length>0&&(e.newLine(),this.nestedTypes.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),e.dedent(),e.write("}")}};u();c();p();var z=class i extends B{constructor(e){super();d(this,"args");this.args=e}write(e){let r=new oe(this.args);e.write("{"),e.newLine(),e.indent(),r.write(e),e.dedent(),e.write("}")}static empty(){return new i(K)}static withStatements(e){return new i(r=>{e.forEach(s=>{s.write(r)})})}};u();c();p();var qe=class extends B{constructor({content:e}){super();d(this,"content");this.content=e}write(e){this.content.split(`
15
+ `),s=le&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),s&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(r=>`${e?`(${e}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(Bt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,ur){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Hu}};u();c();p();u();c();p();u();c();p();var ut=class{constructor(){d(this,"reporter");d(this,"snippet");d(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw this.err??new Error(`Failed to generate snippet for endpoint "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>(this.snippet?.length??0)}};var pt=class{constructor(t){d(this,"context");this.context=t}async generate(t,e={}){let r=this.resolveEndpoints({request:t,options:e});if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let s=new ut;for(let m of r){let a=this.context.clone(),b=this.createSnippetGenerator(a);try{let v=await b.generateSnippet({endpoint:m,request:t,options:e});if(a.errors.empty())return{snippet:v,errors:void 0};s.update({context:a,snippet:v})}catch(v){s.err==null&&(s.err=v)}}return s.getResponseOrThrow({endpoint:t.endpoint})}async generateSnippetAst(t,e={}){let r=this.resolveEndpoints({request:t,options:e});if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let s;for(let m of r){let a=this.context.clone(),b=this.createSnippetGenerator(a);try{return await b.generateSnippetAst({endpoint:m,request:t,options:e})}catch(v){s=v}}throw s??new Error(`Failed to generate snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateSync(t,e={}){let r=this.resolveEndpoints({request:t,options:e});if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let s=new ut;for(let m of r){let a=this.context.clone(),b=this.createSnippetGenerator(a);try{let v=b.generateSnippetSync({endpoint:m,request:t,options:e});if(a.errors.empty())return{snippet:v,errors:void 0};s.update({context:a,snippet:v})}catch(v){s.err==null&&(s.err=v)}}return s.getResponseOrThrow({endpoint:t.endpoint})}resolveEndpoints({request:t,options:e}){if(e.endpointId!=null){let r=this.context.resolveEndpointById(e.endpointId);if(r==null)throw new Error(`No endpoint found with ID "${e.endpointId}"`);return[r]}return this.context.resolveEndpointLocationOrThrow(t.endpoint)}};u();c();p();u();c();p();u();c();p();var ct=class{constructor(){d(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(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[2]==null||r[3]==null))return{namespace:r[1],method:r[2],path:r[3]}}};u();c();p();var M={Critical:"CRITICAL",Warning:"WARNING"},mt=class i{constructor(){d(this,"errors");d(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push({...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}truncate(t){this.errors.length=t}clone(){let t=new i;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 ft=class{constructor({ir:t,config:e,options:r={}}){d(this,"config");d(this,"options");d(this,"errors");d(this,"_ir");d(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=r,this.errors=new mt,this.httpEndpointReferenceParser=new ct}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[s,m]of Object.entries(e))if(m!==void 0){this.errors.scope(s);try{let a=t.find(v=>v.name.wireValue===s);if(a==null)throw this.newParameterNotRecognizedError(s);let b=this.isListTypeReference(a.typeReference)&&!Array.isArray(m)?[m]:m;r.push({name:a.name,typeReference:a.typeReference,value:b})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:t,values:e}){let r=[];for(let s of t){this.errors.scope(s.name.wireValue);try{let m=e[s.name.wireValue];if(m==null)if(s.typeReference.type==="primitive"&&s.typeReference.value==="STRING")m=`<${s.name.wireValue}>`;else{this.errors.add({severity:M.Critical,message:this.newParameterNotRecognizedError(s.name.wireValue).message});continue}r.push({name:s.name,typeReference:s.typeReference,value:m})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let s=[],m=new Set;for(let a of t){let b=a.name.wireValue,v=e[b];if(v!==void 0){m.add(b),this.errors.scope(b);try{s.push({name:a.name,typeReference:a.typeReference,value:v})}finally{this.errors.unscope()}}}if(!r){for(let[a,b]of Object.entries(e))if(!(b===void 0||m.has(a))){this.errors.scope(a);try{this.errors.add({severity:M.Critical,message:this.newParameterNotRecognizedError(a).message})}finally{this.errors.unscope()}}}return s}getExampleObjectProperties({parameters:t,snippetObject:e}){let r=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},s=[];for(let m of t){let a=r[m.name.wireValue];a==null?m.typeReference.type==="nullable"&&s.push({name:m.name,typeReference:m.typeReference,value:null}):s.push({name:m.name,typeReference:m.typeReference,value:a})}return s}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:M.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:M.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let s=[];for(let m of r){if(typeof m!="string"){this.errors.add({severity:M.Critical,message:`Expected file array value to be an array of strings, got ${typeof m}`});return}s.push(m)}return s}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:M.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t??{}}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:M.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 s=t.discriminant.wireValue,m=r[s];if(m==null){this.errors.add({severity:M.Critical,message:this.newParameterNotRecognizedError(s).message});return}if(typeof m!="string"){this.errors.add({severity:M.Critical,message:`Expected discriminant value to be a string but got: ${typeof m}`});return}let a=t.types[m];if(a==null){this.errors.add({severity:M.Critical,message:`No type found for discriminant value "${m}"`});return}let{[s]:b,...v}=r;return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:v}}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}resolveEndpointById(t){return this._ir.endpoints[t]}resolveEndpointByIdOrThrow(t){let e=this.resolveEndpointById(t);if(e==null)throw new Error(`Failed to find endpoint with ID "${t}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){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}):!t.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){return e&&(t.metadata?.includePathParameters??!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:A(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(s=>s.id===t);return r?.name}case"multipleBaseUrls":{let r=e.environments.find(s=>s.id===t);return r?.name}default:A(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:M.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:M.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:M.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let s=new Set(ot(r.urls));for(let m of ot(t))s.has(m)&&s.delete(m);return s.size>0?(this.errors.add({severity:M.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${ot(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:M.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:M.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:M.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:A(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:A(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:A(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};u();c();p();var he={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};u();c();p();u();c();p();u();c();p();var Ft={};Fe(Ft,{sanitizeForIdentifier:()=>vr,sanitizeToCamelCase:()=>yp,sanitizeToPascalCase:()=>hp});u();c();p();var ps=qs(us(),1);u();c();p();function Lt(i){return H(te(i))}function hp(i){let t=vr(i);return Lt(t)}function yp(i){let t=vr(i);return te(t)}function vr(i){if(i==="")return"empty";let t=i;if(/^\d/.test(t)){let r=gp(t);t=r.numberAsWords+H(r.rest)}return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)||(t=t.replace(/^[^a-zA-Z0-9]+/,""),t=te(t)),/^\d/.test(t)&&(t="value"+t),t===""?"value":t}function gp(i){let t=i.match(/^(\d+)/);if(!t||!t[1])return{numberAsWords:"",rest:i};let e=t[1],r=i.slice(e.length);try{return{numberAsWords:(0,ps.toWords)(parseInt(e,10)),rest:r}}catch{let s={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(a=>s[a]||a).join(""),rest:r}}}u();c();p();var Ae={};Fe(Ae,{generateEnumCaseLabel:()=>bp,generateName:()=>xp,sanitizeLiteralValue:()=>Er});u();c();p();function xp(i){let t=Er(i);return Lt(t)}function bp(i){let t=Er(i);return te(t)}function Er(i){if(i==="")return"empty";let t=i;return/^[a-zA-Z][a-zA-Z0-9]*$/.test(i)||(t=t.replace(/^[^a-zA-Z0-9]+/,""),t=te(t)),/^\d/.test(t)||t===""?"value":t}u();c();p();var Mt=class{constructor(t,e){d(this,"nameRegistry");d(this,"fromSymbol");this.nameRegistry=t,this.fromSymbol=e}referenceSwiftType(t){let e=this.nameRegistry.reference({fromSymbol:this.fromSymbol,toSymbol:S.Symbol.swiftType(t)});return S.TypeReference.symbol(e)}referenceFoundationType(t){let e=this.nameRegistry.reference({fromSymbol:this.fromSymbol,toSymbol:S.Symbol.foundationType(t)});return S.TypeReference.symbol(e)}referenceAsIsType(t){let e=this.nameRegistry.getAsIsSymbolOrThrow(t),r=this.nameRegistry.reference({fromSymbol:this.fromSymbol,toSymbol:e});return S.TypeReference.symbol(r)}referenceSourceTemplateType(t){let e=this.nameRegistry.getSourceTemplateSymbolOrThrow(t),r=this.nameRegistry.reference({fromSymbol:this.fromSymbol,toSymbol:e});return S.TypeReference.symbol(r)}referenceType(t){let e=this.nameRegistry.reference({fromSymbol:this.fromSymbol,toSymbol:t});return S.TypeReference.symbol(e)}resolveToSymbolIfSymbolType(t){let e=t.getReferenceIfSymbolType();return e===null?null:this.nameRegistry.resolveReference({fromSymbol:this.fromSymbol,reference:e})}resolvesToTheAsIsType(t,e){let r=this.resolveToSymbolIfSymbolType(t),s=this.nameRegistry.getAsIsSymbolOrThrow(e);return r?.id===s.id}resolvesToASwiftType(t){return this.resolveToSymbolIfSymbolType(t)?.isSwiftSymbol??!1}resolvesToTheSwiftType(t,e){return this.resolveToSymbolIfSymbolType(t)?.id===S.Symbol.swiftType(e).id}resolvesToAFoundationType(t){return this.resolveToSymbolIfSymbolType(t)?.isFoundationSymbol??!1}resolvesToTheFoundationType(t,e){return this.resolveToSymbolIfSymbolType(t)?.id===S.Symbol.foundationType(e).id}resolvesToACustomType(t){return this.resolveToSymbolIfSymbolType(t)?.isCustomSymbol??!1}resolvesToAnEnumWithRawValues(t){return this.resolveToSymbolIfSymbolType(t)?.shape.type==="enum-with-raw-values"}};u();c();p();var Ot={};Fe(Ot,{inferCaseNameForTypeReference:()=>ue});u();c();p();var Sp={String:"string",Bool:"bool",Int:"int",Int64:"int64",UInt:"uint",UInt64:"uint64",Float:"float",Double:"double",Void:"void",Encoder:"encoder",Decoder:"decoder",Any:"any"},wp={Data:"data",Date:"date",UUID:"uuid"};function ue(i,t,e){if(t.variant.type==="symbol"){let r=t.variant.symbol,s=e.resolveReference({fromSymbol:i,reference:r});Q(s,`Cannot find symbol ${r} for type reference ${t.variant.type}`);let m=s.name;return S.Symbol.isSwiftSymbol(s.id)&&S.Symbol.isSwiftSymbolName(m)?Sp[m]:S.Symbol.isFoundationSymbol(s.id)&&S.Symbol.isFoundationSymbolName(m)?wp[m]:te(m)}else if(t.variant.type==="generic"){let r=t.variant.arguments.map(s=>ue(i,s,e));return`${ue(i,t.variant.reference,e)}Of${H(r.join("And"))}`}else{if(t.variant.type==="array")return`${ue(i,t.variant.elementType,e)}Array`;if(t.variant.type==="dictionary"){let r=ue(i,t.variant.keyType,e),s=ue(i,t.variant.valueType,e);return`${r}To${H(s)}Dictionary`}else if(t.variant.type==="optional"){let r=ue(i,t.variant.valueType,e);return`optional${H(r)}`}else if(t.variant.type==="nullable"){let r=ue(i,t.variant.valueType,e);return`nullable${H(r)}`}else if(t.variant.type==="tuple"){let r=t.variant.elements.map(s=>ue(i,s,e));return`tuple${H(r.join("And"))}`}else{if(t.variant.type==="member-access")return`${ue(i,t.variant.target,e)}${H(t.variant.memberName)}`;A(t.variant)}}}u();c();p();u();c();p();var Pt=class{constructor(){d(this,"namespace");this.namespace=new re}getRequestTypeNameOrThrow(t,e){let r=this.requestTypeNameId(t,e);return this.namespace.getSymbolNameByIdOrThrow(r)}addRequestTypeSymbol(t,e,r){let s=this.requestTypeNameId(t,e);return this.namespace.registerSymbol(s,r)}requestTypeNameId(t,e){return`${t}_${e}`}};u();c();p();var kt=class{constructor(){d(this,"namespace");this.namespace=new re}addStaticSymbolName(t){let e=this.staticSymbolNameId(t);return this.namespace.registerSymbol(e,[t])}staticSymbolNameId(t){return`Static:${t}`}addRootClientSymbolName(t){let e=this.rootClientSymbolNameId();return this.namespace.registerSymbol(e,t)}getRootClientSymbolNameOrThrow(){return this.namespace.getSymbolNameByIdOrThrow(this.rootClientSymbolNameId())}rootClientSymbolNameId(){return"RootClientClass"}addEnvironmentSymbolName(t){let e=this.environmentSymbolNameId();return this.namespace.registerSymbol(e,t)}getEnvironmentSymbolNameOrThrow(){return this.namespace.getSymbolNameByIdOrThrow(this.environmentSymbolNameId())}environmentSymbolNameId(){return"EnvironmentEnum"}addErrorEnumSymbolName(t){let e=this.errorEnumSymbolNameId();return this.namespace.registerSymbol(e,t)}getErrorEnumSymbolNameOrThrow(){return this.namespace.getSymbolNameByIdOrThrow(this.errorEnumSymbolNameId())}errorEnumSymbolNameId(){return"ErrorEnum"}addRequestsContainerSymbolName(t){let e=this.requestsContainerSymbolNameId();return this.namespace.registerSymbol(e,t)}getRequestsContainerSymbolNameOrThrow(){return this.namespace.getSymbolNameByIdOrThrow(this.requestsContainerSymbolNameId())}requestsContainerSymbolNameId(){return"RequestsContainer"}addSubClientSymbolName(t,e){let r=this.subClientSymbolNameId(t);return this.namespace.registerSymbol(r,e)}getSubClientSymbolNameOrThrow(t){return this.namespace.getSymbolNameByIdOrThrow(this.subClientSymbolNameId(t))}subClientSymbolNameId(t){return`SubClient:${t}`}addSchemaTypeSymbolName(t,e){let r=this.schemaTypeSymbolNameId(t);return this.namespace.registerSymbol(r,e)}getSchemaTypeSymbolNameOrThrow(t){let e=this.schemaTypeSymbolNameId(t);return this.namespace.getSymbolNameByIdOrThrow(e)}schemaTypeSymbolNameId(t){return`SchemaType:${t}`}};u();c();p();var Ut=class{constructor(){d(this,"namespace");this.namespace=new re}asIsNameId(t){return`AsIs:${t}`}wireTestSuiteNameId(t){return`WireTestSuite:${t}`}addAsIsSymbol(t){let e=this.asIsNameId(t);this.namespace.registerSymbol(e,[t])}registerWireTestSuiteSymbol(t){return this.namespace.registerSymbol(this.wireTestSuiteNameId(t),[`${t}WireTests`,`${t}WireTestSuite`])}getWireTestSuiteNameOrThrow(t){return this.namespace.getSymbolNameByIdOrThrow(this.wireTestSuiteNameId(t))}};var _t=class i{constructor(){d(this,"symbolRegistry");d(this,"sourceModuleNamespace");d(this,"testModuleNamespace");d(this,"requestsNamespace");d(this,"sourceStaticSymbolsByName");d(this,"testStaticSymbolsByName");d(this,"requestTypeSymbols");d(this,"subClientSymbols");d(this,"nestedLiteralEnumSymbolsByParentSymbolId");d(this,"undiscriminatedUnionVariantsByParentSymbolId");this.symbolRegistry=S.SymbolRegistry.create(),this.sourceModuleNamespace=new kt,this.testModuleNamespace=new Ut,this.requestsNamespace=new Pt,this.sourceStaticSymbolsByName=new Map,this.testStaticSymbolsByName=new Map,this.requestTypeSymbols=[],this.subClientSymbols=[],this.nestedLiteralEnumSymbolsByParentSymbolId=new Map,this.undiscriminatedUnionVariantsByParentSymbolId=new Map}static create(){return new i}getAsIsSymbolOrThrow(t){let e=this.sourceStaticSymbolsByName.get(t);return ne(e,`As is symbol not found for name "${t}"`),e}getSourceTemplateSymbolOrThrow(t){switch(t){case"ClientError":return this.getErrorEnumSymbolOrThrow();case"HTTPClient":{let e=this.symbolRegistry.inferSymbolIdForSourceModuleType(t);return S.Symbol.create(e,t,{type:"class"})}case"ClientConfig":{let e=this.sourceStaticSymbolsByName.get(t);return ne(e,`Source template symbol not found for name "${t}"`),e}default:A(t)}}registerSourceModuleSymbol({configModuleName:t,apiNamePascalCase:e,asIsSymbols:r}){let s=[`${e}`,`${e}Api`,`${e}Module`];typeof t=="string"&&s.unshift(t);let a=new re({reservedSymbolNames:["Swift","Foundation"]}).registerSymbol("Module",s),b=this.symbolRegistry.registerSourceModule(a);return r.forEach(v=>{let T=v.name;this.registerSourceStaticSymbol(T,v.shape)}),b}getRegisteredSourceModuleSymbolOrThrow(){return this.symbolRegistry.getRegisteredSourceModuleSymbolOrThrow()}registerSourceStaticSymbol(t,e){this.symbolRegistry.registerSourceModuleType(t,e),this.sourceModuleNamespace.addStaticSymbolName(t);let r=this.symbolRegistry.inferSymbolIdForSourceModuleType(t),s=S.Symbol.create(r,t,e);this.sourceStaticSymbolsByName.set(t,s)}registerTestModuleSymbol({sourceModuleName:t,asIsSymbols:e}){let r=[`${t}Tests`,`${t}Test`,`${t}TestsModule`],s=(()=>{let a=new re;return a.registerSymbol("Swift",["Swift"]),a.registerSymbol("Foundation",["Foundation"]),a.registerSymbol(t,[t]),a.registerSymbol(`${t}Tests`,r)})(),m=this.symbolRegistry.registerTestModule(s);return e.forEach(a=>{let b=a.name;this.symbolRegistry.registerTestModuleType(b,a.shape),this.testModuleNamespace.addAsIsSymbol(b);let v=this.symbolRegistry.inferSymbolIdForTestModuleType(b),T=S.Symbol.create(v,b,a.shape);this.testStaticSymbolsByName.set(b,T)}),m}getRegisteredTestModuleSymbolOrThrow(){return this.symbolRegistry.getRegisteredTestModuleSymbolOrThrow()}registerRootClientSymbol({configClientClassName:t,registeredSourceModuleName:e}){let r=[`${e}Client`,`${e}ApiClient`,`${e}Service`];typeof t=="string"&&r.unshift(t);let s=this.sourceModuleNamespace.addRootClientSymbolName(r);return this.symbolRegistry.registerSourceModuleType(s,{type:"class"})}getRootClientSymbolOrThrow(){let t=this.sourceModuleNamespace.getRootClientSymbolNameOrThrow(),e=this.symbolRegistry.inferSymbolIdForSourceModuleType(t);return this.symbolRegistry.getSymbolByIdOrThrow(e)}registerEnvironmentSymbol({configEnvironmentEnumName:t,registeredSourceModuleName:e}){let r=[`${e}Environment`,`${e}Environ`,`${e}Env`];typeof t=="string"&&r.unshift(t);let s=this.sourceModuleNamespace.addEnvironmentSymbolName(r);return this.symbolRegistry.registerSourceModuleType(s,{type:"enum-with-raw-values"})}getEnvironmentSymbolOrThrow(){let t=this.sourceModuleNamespace.getEnvironmentSymbolNameOrThrow(),e=this.symbolRegistry.inferSymbolIdForSourceModuleType(t);return this.symbolRegistry.getSymbolByIdOrThrow(e)}registerErrorEnumSymbol(t){let e=[`${t}Error`,`${t}ClientError`],r=this.sourceModuleNamespace.addErrorEnumSymbolName(e);return this.symbolRegistry.registerSourceModuleType(r,{type:"enum-with-associated-values"})}getErrorEnumSymbolOrThrow(){let t=this.sourceModuleNamespace.getErrorEnumSymbolNameOrThrow(),e=this.symbolRegistry.inferSymbolIdForSourceModuleType(t);return this.symbolRegistry.getSymbolByIdOrThrow(e)}registerRequestsContainerSymbol(){let t=this.sourceModuleNamespace.addRequestsContainerSymbolName(["Requests","RequestTypes","InlineRequests"]);return this.symbolRegistry.registerSourceModuleType(t,{type:"enum-container"})}getRequestsContainerSymbolOrThrow(){let t=this.sourceModuleNamespace.getRequestsContainerSymbolNameOrThrow(),e=this.symbolRegistry.inferSymbolIdForSourceModuleType(t);return this.symbolRegistry.getSymbolByIdOrThrow(e)}registerRequestTypeSymbol({endpointId:t,requestNamePascalCase:e}){let r=[`${e}Type`];e.endsWith("Request")?r.push(`${e}Body`,`${e}BodyType`):r.push(`${e}Request`,`${e}RequestBody`,`${e}RequestBodyType`);let s=this.getRequestsContainerSymbolOrThrow(),m=this.requestsNamespace.addRequestTypeSymbol(t,e,[e,...r]),a=this.symbolRegistry.registerNestedType({parentSymbol:s,symbolName:m,shape:{type:"struct"}});return this.requestTypeSymbols.push(a),a}getRequestTypeSymbolOrThrow(t,e){let r=this.requestsNamespace.getRequestTypeNameOrThrow(t,e),s=this.getRequestsContainerSymbolOrThrow(),m=this.symbolRegistry.inferSymbolIdForNestedType(s.id,r);return this.symbolRegistry.getSymbolByIdOrThrow(m)}getAllRequestTypeSymbols(){return[...this.requestTypeSymbols]}registerSubClientSymbol({subpackageId:t,fernFilepathPartNamesPascalCase:e,subpackageNamePascalCase:r}){let s=e.toReversed();s.shift();let m=s.map((v,T)=>s.slice(0,T+1).reverse().join("")+r+"Client"),a=this.sourceModuleNamespace.addSubClientSymbolName(t,[`${r}Client`,...m]),b=this.symbolRegistry.registerSourceModuleType(a,{type:"class"});return this.subClientSymbols.push(b),b}getSubClientSymbolOrThrow(t){let e=this.sourceModuleNamespace.getSubClientSymbolNameOrThrow(t),r=this.symbolRegistry.inferSymbolIdForSourceModuleType(e);return this.symbolRegistry.getSymbolByIdOrThrow(r)}getAllSubClientSymbols(){return[...this.subClientSymbols]}registerSchemaTypeSymbol(t,e,r){let s=this.sourceModuleNamespace.addSchemaTypeSymbolName(t,[e,`${e}Type`,`${e}Model`,`${e}Schema`]);return this.symbolRegistry.registerSourceModuleType(s,r)}getSchemaTypeSymbolOrThrow(t){let e=this.sourceModuleNamespace.getSchemaTypeSymbolNameOrThrow(t),r=this.symbolRegistry.inferSymbolIdForSourceModuleType(e);return this.symbolRegistry.getSymbolByIdOrThrow(r)}registerNestedLiteralEnumSymbol({parentSymbol:t,literalValue:e}){let r=typeof t=="string"?t:t.id,s=this.nestedLiteralEnumSymbolsByParentSymbolId.get(r)??new Map,m=s.get(e);if(m)return m;let a=Array.from(s.values()),b=(()=>{let T=new re({reservedSymbolNames:["CodingKeys"]});a.forEach(C=>{T.registerSymbol(C.id,[C.name])});let I=Ae.generateName(e);return T.registerSymbol(e,[I,`${I}Literal`,`${I}Enum`,`${I}StringEnum`])})(),v=this.symbolRegistry.registerNestedType({parentSymbol:t,symbolName:b,shape:{type:"enum-with-raw-values"}});return s.set(e,v),this.nestedLiteralEnumSymbolsByParentSymbolId.set(r,s),v}getNestedLiteralEnumSymbolOrThrow(t,e){let r=typeof t=="string"?t:t.id,m=(this.nestedLiteralEnumSymbolsByParentSymbolId.get(r)??new Map).get(e);return ne(m,`Nested literal enum symbol not found for literal value "${e}" in parent symbol "${r}"`),m}getNestedLiteralEnumSymbol(t,e){let r=typeof t=="string"?t:t.id;return(this.nestedLiteralEnumSymbolsByParentSymbolId.get(r)??new Map).get(e)}getAllNestedLiteralEnumSymbolsOrThrow(t){let e=typeof t=="string"?t:t.id,r=this.nestedLiteralEnumSymbolsByParentSymbolId.get(e)??new Map;return Array.from(r.entries()).sort(([,s],[,m])=>s.name.localeCompare(m.name)).map(([s,m])=>({symbol:m,literalValue:s,caseLabel:Ae.generateEnumCaseLabel(s)}))}registerUndiscriminatedUnionVariants({parentSymbol:t,variants:e}){let r=typeof t=="string"?t:t.id,s=sr(e,(m,a)=>m.caseName===a.caseName);return this.undiscriminatedUnionVariantsByParentSymbolId.set(r,s),s}getAllUndiscriminatedUnionVariantsOrThrow(t){let e=typeof t=="string"?t:t.id;return this.undiscriminatedUnionVariantsByParentSymbolId.get(e)??[]}registerWireTestSuiteSymbol(t){let e=this.testModuleNamespace.registerWireTestSuiteSymbol(t);return this.symbolRegistry.registerTestModuleType(e,{type:"struct"})}getWireTestSuiteSymbolOrThrow(t){let e=this.testModuleNamespace.getWireTestSuiteNameOrThrow(t),r=this.symbolRegistry.inferSymbolIdForTestModuleType(e);return this.symbolRegistry.getSymbolByIdOrThrow(r)}referenceFromSourceModuleScope(t){let e=this.getRegisteredSourceModuleSymbolOrThrow();return this.symbolRegistry.reference({fromSymbol:e,toSymbol:t})}reference({fromSymbol:t,toSymbol:e}){return this.symbolRegistry.reference({fromSymbol:t,toSymbol:e})}resolveReference({fromSymbol:t,reference:e}){return this.symbolRegistry.resolveReference({fromSymbol:t,reference:e})}};var S={};Fe(S,{AccessLevel:()=>cs,Class:()=>$e,CodeBlock:()=>z,Comment:()=>qe,ComputedProperty:()=>Ve,DeclarationType:()=>ht,DocComment:()=>je,EnumWithAssociatedValues:()=>ze,EnumWithRawValues:()=>Ge,Expression:()=>pe,Extension:()=>He,FunctionArgument:()=>Ke,FunctionParameter:()=>Ye,Initializer:()=>Je,LineBreak:()=>qt,Method:()=>Ze,Pattern:()=>Wt,Property:()=>Xe,Protocol:()=>ms,SourceAsIsFileSpecs:()=>Np,SourceTemplateFileSpecs:()=>Rp,Statement:()=>We,Struct:()=>Qe,Symbol:()=>q,SymbolRegistry:()=>Tr,TypeReference:()=>Gt,class_:()=>Ap,codeBlock:()=>Cp,comment:()=>Bp,computedProperty:()=>Lp,docComment:()=>Fp,enumWithAssociatedValues:()=>Mp,enumWithRawValues:()=>Op,extension:()=>Pp,functionArgument:()=>kp,functionParameter:()=>Up,initializer:()=>_p,method:()=>Dp,property:()=>$p,struct:()=>qp});u();c();p();u();c();p();u();c();p();var cs={Open:"open",Public:"public",Package:"package",Internal:"internal",Fileprivate:"fileprivate",Private:"private"};u();c();p();u();c();p();function Dt(i){let t="";for(let e of i)switch(e){case"\\":t+="\\\\";break;case'"':t+='\\"';break;case`
16
+ `:t+="\\n";break;case"\r":t+="\\r";break;case" ":t+="\\t";break;case"\0":t+="\\0";break;default:{let r=e.charCodeAt(0);r<32||r===127?t+=`\\u{${r.toString(16).toUpperCase()}}`:t+=e}}return t}u();c();p();var vp=["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"],Ep=new Set(vp);function Tp(i){return Ep.has(i)}function k(i){return Tp(i)?`\`${i}\``:i}function $t(i){return i.split(".").map(t=>k(t)).join(".")}function Ip(i){return i==="self"?"self_":i}function De(i){let t=Ip(i);return t.length>0&&/^[0-9]/.test(t)?`_${t}`:t}u();c();p();u();c();p();u();c();p();var dt=class extends lt{toString(){return this.buffer}};var B=class extends Re{toString(){let t=new dt;return this.write(t),t.toString()}toStringWithIndentation(t){let e=new dt;for(let r=1;r<t;r++)e.indent();this.write(e);for(let r=1;r<t;r++)e.dedent();return e.toString()}};var $e=class extends B{constructor({accessLevel:e,name:r,final:s,conformances:m,properties:a,initializers:b,methods:v,nestedTypes:T,docs:I}){super();d(this,"name");d(this,"final");d(this,"accessLevel");d(this,"conformances");d(this,"properties");d(this,"initializers");d(this,"methods");d(this,"nestedTypes");d(this,"docs");this.name=r,this.final=s,this.accessLevel=e,this.conformances=m??[],this.properties=a,this.initializers=b??[],this.methods=v??[],this.nestedTypes=T??[],this.docs=I}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 ${k(this.name)}`),this.conformances.forEach((r,s)=>{s===0?e.write(": "):s>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,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),this.methods.length>0&&(e.newLine(),this.methods.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),this.nestedTypes.length>0&&(e.newLine(),this.nestedTypes.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),e.dedent(),e.write("}")}};u();c();p();var z=class i extends B{constructor(e){super();d(this,"args");this.args=e}write(e){let r=new oe(this.args);e.write("{"),e.newLine(),e.indent(),r.write(e),e.dedent(),e.write("}")}static empty(){return new i(K)}static withStatements(e){return new i(r=>{e.forEach(s=>{s.write(r)})})}};u();c();p();var qe=class extends B{constructor({content:e}){super();d(this,"content");this.content=e}write(e){this.content.split(`
17
17
  `).forEach(s=>{e.write(`// ${s}`),e.newLine()})}};u();c();p();u();c();p();var pe=class extends B{constructor(e){super();d(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(k(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:k(this.internalExpression.unsafeName),arguments_:this.internalExpression.arguments_,multiline:!!this.internalExpression.multiline});break;case"struct-initialization":this.writeCallableExpression({writer:e,target:k(this.internalExpression.unsafeName),arguments_:this.internalExpression.arguments_,multiline:!!this.internalExpression.multiline});break;case"class-initialization":this.writeCallableExpression({writer:e,target:k(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.escape?`"${Dt(this.internalExpression.value)}"`:`"${this.internalExpression.value}"`);break;case"raw-multi-line-string-literal":e.write(`#"""
18
18
  ${this.internalExpression.value}
19
- """#`);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:A(this.internalExpression)}}writeCallableExpression({writer:e,target:r,arguments_:s,multiline:m}){e.write(r),e.write("("),m&&(e.newLine(),e.indent()),s?.forEach((l,b)=>{b>0&&(e.write(","),m?e.newLine():e.write(" ")),l.write(e)}),m&&(e.newLine(),e.dedent()),e.write(")")}writeDictionaryLiteral(e,r){if(!r.entries||r.entries.length===0){e.write("[:]");return}e.write("[");let s=!!r.multiline;s&&(e.newLine(),e.indent()),r.entries?.forEach(([m,l],b)=>{b>0&&(e.write(", "),s&&e.newLine()),m.write(e),e.write(": "),l.write(e)}),s&&(e.newLine(),e.dedent()),e.write("]")}writeArrayLiteral(e,r){if(!r.elements||r.elements.length===0){e.write("[]");return}e.write("[");let s=!!r.multiline;s&&(e.newLine(),e.indent()),r.elements?.forEach((m,l)=>{l>0&&(e.write(","),s?e.newLine():e.write(" ")),m.write(e)}),s&&(e.newLine(),e.dedent()),e.write("]")}static reference(e){return new this({type:"reference",unsafeName:e})}static memberAccess(e){return new this({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({type:"function-call",...e})}static structInitialization(e){return new this({type:"struct-initialization",...e})}static classInitialization(e){return new this({type:"class-initialization",...e})}static stringLiteral(e){return new this({type:"string-literal",value:e})}static escapedStringLiteral(e){return new this({type:"string-literal",value:e,escape:!0})}static rawMultiLineStringLiteral(e){return new this({type:"raw-multi-line-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({type:"dictionary-literal",...e})}static arrayLiteral(e){return new this({type:"array-literal",...e})}static dataLiteral(e){return new this({type:"data-literal",value:e})}static methodCall(e){return new this({type:"method-call",...e})}static methodCallWithTrailingClosure(e){return new this({type:"method-call-with-trailing-closure",...e})}static contextualMethodCall(e){return new this({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"})}};u();c();p();u();c();p();var ht={Var:"var",Let:"let"};var We=class extends B{constructor(e){super();d(this,"internalStatement");this.internalStatement=e}write(e){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(ht.Let),e.write(" "),e.write(k(this.internalStatement.unsafeName)),e.write(" = "),this.internalStatement.value.write(e),this.internalStatement.noTrailingNewline||e.newLine();break;case"variable-declaration":e.write(ht.Var),e.write(" "),e.write(k(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(k(this.internalStatement.unsafeName)),e.write("("),this.internalStatement.parameters?.forEach((r,s)=>{s>0&&e.write(", "),r.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(" "),(this.internalStatement.body??z.empty()).write(e),e.newLine();break;case"variable-assignment":e.write(k(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 r of this.internalStatement.cases)if(e.write("case "),r.pattern.write(e),e.write(":"),e.newLine(),r.body.length>0){e.indent();for(let s of r.body)s.write(e);e.dedent()}if(this.internalStatement.defaultCase&&(e.write("default:"),e.newLine(),this.internalStatement.defaultCase.length>0)){e.indent();for(let r of this.internalStatement.defaultCase)r.write(e);e.dedent()}e.write("}"),e.newLine();break;case"if":{e.write("if "),this.internalStatement.condition.write(e),e.write(" "),z.withStatements(this.internalStatement.body).write(e);for(let r of this.internalStatement.elseIfs??[])e.write(" else if "),r.condition.write(e),e.write(" "),z.withStatements(r.body).write(e);this.internalStatement.else&&(e.write(" else "),z.withStatements(this.internalStatement.else).write(e)),e.newLine();break}case"raw":e.write(this.internalStatement.content),e.newLine();break;default:A(this.internalStatement)}}static typealiasDeclaration(e){return new this({type:"typealias-declaration",...e})}static constantDeclaration(e){return new this({type:"constant-declaration",...e})}static variableDeclaration(e){return new this({type:"variable-declaration",...e})}static functionDeclaration(e){return new this({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({type:"switch",...e})}static if(e){return new this({type:"if",...e})}static raw(e){return new this({type:"raw",content:e})}};var Ve=class extends B{constructor({unsafeName:e,accessLevel:r,type:s,body:m,docs:l}){super();d(this,"unsafeName");d(this,"accessLevel");d(this,"type");d(this,"body");d(this,"docs");this.unsafeName=e,this.accessLevel=r,this.type=s,this.body=m,this.docs=l}write(e){this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write("var "),e.write(k(this.unsafeName)),e.write(": "),this.type.write(e),e.write(" "),this.body instanceof z?this.body.write(e):this.body instanceof pe?z.withStatements([We.expressionStatement(this.body)]).write(e):A(this.body)}};u();c();p();var je=class i extends B{constructor({summary:e,description:r,parameters:s,returns:m,throws:l}){super();d(this,"summary");d(this,"description");d(this,"parameters");d(this,"returns");d(this,"throws");this.summary=i.sanitizeText(e),this.description=r!=null?i.sanitizeText(r):void 0,this.parameters=(s??[]).map(b=>({name:b.name,description:i.sanitizeText(b.description)})),this.returns=m!=null?i.sanitizeText(m):void 0,this.throws=(l??[]).map(b=>i.sanitizeText(b))}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(`
20
- `).forEach((m,l)=>{l===0?(e.write("/// - Parameter "),e.write(r.name),e.write(": "),e.write(m)):(e.write("/// "),e.write(m)),e.newLine()})}if(this.returns!=null&&this.returns.split(`
21
- `).forEach((s,m)=>{m===0?(e.write("/// - Returns: "),e.write(s)):(e.write("/// "),e.write(s)),e.newLine()}),this.throws.length>0)for(let r of this.throws)r.split(`
22
- `).forEach((m,l)=>{l===0?(e.write("/// - Throws: "),e.write(m)):(e.write("/// "),e.write(m)),e.newLine()})}writeMultilineText(e,r){let s=r.split(`
23
- `);for(let m of s)e.write("/// "),e.write(m),e.newLine()}static sanitizeText(e){return e=e.replace(/\r\n/g,`
19
+ """#`);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:A(this.internalExpression)}}writeCallableExpression({writer:e,target:r,arguments_:s,multiline:m}){e.write(r),e.write("("),m&&(e.newLine(),e.indent()),s?.forEach((a,b)=>{b>0&&(e.write(","),m?e.newLine():e.write(" ")),a.write(e)}),m&&(e.newLine(),e.dedent()),e.write(")")}writeDictionaryLiteral(e,r){if(!r.entries||r.entries.length===0){e.write("[:]");return}e.write("[");let s=!!r.multiline;s&&(e.newLine(),e.indent()),r.entries?.forEach(([m,a],b)=>{b>0&&(e.write(", "),s&&e.newLine()),m.write(e),e.write(": "),a.write(e)}),s&&(e.newLine(),e.dedent()),e.write("]")}writeArrayLiteral(e,r){if(!r.elements||r.elements.length===0){e.write("[]");return}e.write("[");let s=!!r.multiline;s&&(e.newLine(),e.indent()),r.elements?.forEach((m,a)=>{a>0&&(e.write(","),s?e.newLine():e.write(" ")),m.write(e)}),s&&(e.newLine(),e.dedent()),e.write("]")}static reference(e){return new this({type:"reference",unsafeName:e})}static memberAccess(e){return new this({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({type:"function-call",...e})}static structInitialization(e){return new this({type:"struct-initialization",...e})}static classInitialization(e){return new this({type:"class-initialization",...e})}static stringLiteral(e){return new this({type:"string-literal",value:e})}static escapedStringLiteral(e){return new this({type:"string-literal",value:e,escape:!0})}static rawMultiLineStringLiteral(e){return new this({type:"raw-multi-line-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({type:"dictionary-literal",...e})}static arrayLiteral(e){return new this({type:"array-literal",...e})}static dataLiteral(e){return new this({type:"data-literal",value:e})}static methodCall(e){return new this({type:"method-call",...e})}static methodCallWithTrailingClosure(e){return new this({type:"method-call-with-trailing-closure",...e})}static contextualMethodCall(e){return new this({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"})}};u();c();p();u();c();p();var ht={Var:"var",Let:"let"};var We=class extends B{constructor(e){super();d(this,"internalStatement");this.internalStatement=e}write(e){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(ht.Let),e.write(" "),e.write(k(this.internalStatement.unsafeName)),e.write(" = "),this.internalStatement.value.write(e),this.internalStatement.noTrailingNewline||e.newLine();break;case"variable-declaration":e.write(ht.Var),e.write(" "),e.write(k(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(k(this.internalStatement.unsafeName)),e.write("("),this.internalStatement.parameters?.forEach((r,s)=>{s>0&&e.write(", "),r.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(" "),(this.internalStatement.body??z.empty()).write(e),e.newLine();break;case"variable-assignment":e.write(k(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 r of this.internalStatement.cases)if(e.write("case "),r.pattern.write(e),e.write(":"),e.newLine(),r.body.length>0){e.indent();for(let s of r.body)s.write(e);e.dedent()}if(this.internalStatement.defaultCase&&(e.write("default:"),e.newLine(),this.internalStatement.defaultCase.length>0)){e.indent();for(let r of this.internalStatement.defaultCase)r.write(e);e.dedent()}e.write("}"),e.newLine();break;case"if":{e.write("if "),this.internalStatement.condition.write(e),e.write(" "),z.withStatements(this.internalStatement.body).write(e);for(let r of this.internalStatement.elseIfs??[])e.write(" else if "),r.condition.write(e),e.write(" "),z.withStatements(r.body).write(e);this.internalStatement.else&&(e.write(" else "),z.withStatements(this.internalStatement.else).write(e)),e.newLine();break}case"raw":e.write(this.internalStatement.content),e.newLine();break;default:A(this.internalStatement)}}static typealiasDeclaration(e){return new this({type:"typealias-declaration",...e})}static constantDeclaration(e){return new this({type:"constant-declaration",...e})}static variableDeclaration(e){return new this({type:"variable-declaration",...e})}static functionDeclaration(e){return new this({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({type:"switch",...e})}static if(e){return new this({type:"if",...e})}static raw(e){return new this({type:"raw",content:e})}};var Ve=class extends B{constructor({unsafeName:e,accessLevel:r,type:s,body:m,docs:a}){super();d(this,"unsafeName");d(this,"accessLevel");d(this,"type");d(this,"body");d(this,"docs");this.unsafeName=e,this.accessLevel=r,this.type=s,this.body=m,this.docs=a}write(e){this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write("var "),e.write(k(this.unsafeName)),e.write(": "),this.type.write(e),e.write(" "),this.body instanceof z?this.body.write(e):this.body instanceof pe?z.withStatements([We.expressionStatement(this.body)]).write(e):A(this.body)}};u();c();p();var je=class i extends B{constructor({summary:e,description:r,codeExample:s,parameters:m,returns:a,throws:b}){super();d(this,"summary");d(this,"description");d(this,"codeExample");d(this,"parameters");d(this,"returns");d(this,"throws");this.summary=e!=null?i.sanitizeText(e):void 0,this.description=r!=null?i.sanitizeText(r):void 0,this.codeExample=s!=null?i.sanitizeText(s):void 0,this.parameters=(m??[]).map(v=>({name:v.name,description:i.sanitizeText(v.description)})),this.returns=a!=null?i.sanitizeText(a):void 0,this.throws=(b??[]).map(v=>i.sanitizeText(v))}write(e){let r=!1;if(this.summary!=null&&(this.writeMultilineText(e,this.summary),r=!0),this.description!=null&&(r&&(e.write("///"),e.newLine()),this.writeMultilineText(e,this.description),r=!0),this.codeExample!=null&&(r&&(e.write("///"),e.newLine()),this.writeMultilineText(e,`\`\`\`swift
20
+ ${this.codeExample}
21
+ \`\`\``),r=!0),this.parameters.length>0){r&&(e.write("///"),e.newLine());for(let s of this.parameters)s.description.split(`
22
+ `).forEach((a,b)=>{b===0?(e.write("/// - Parameter "),e.write(s.name),e.write(": "),e.write(a)):(e.write("/// "),e.write(a)),e.newLine()})}if(this.returns!=null&&this.returns.split(`
23
+ `).forEach((m,a)=>{a===0?(e.write("/// - Returns: "),e.write(m)):(e.write("/// "),e.write(m)),e.newLine()}),this.throws.length>0)for(let s of this.throws)s.split(`
24
+ `).forEach((a,b)=>{b===0?(e.write("/// - Throws: "),e.write(a)):(e.write("/// "),e.write(a)),e.newLine()})}writeMultilineText(e,r){let s=r.split(`
25
+ `);for(let m of s)m===""?e.write("///"):(e.write("/// "),e.write(m)),e.newLine()}static sanitizeText(e){return e=e.replace(/\r\n/g,`
24
26
  `).replace(/\r/g,`
25
- `),e=e.replace(/\x00/g,""),e}};u();c();p();var ze=class extends B{constructor({accessLevel:e,indirect:r,name:s,conformances:m,cases:l,initializers:b,methods:v,nestedTypes:T,docs:I}){super();d(this,"name");d(this,"accessLevel");d(this,"indirect");d(this,"conformances");d(this,"cases");d(this,"initializers");d(this,"methods");d(this,"nestedTypes");d(this,"docs");this.name=s,this.indirect=r??!1,this.accessLevel=e,this.conformances=m??[],this.cases=l,this.initializers=b??[],this.methods=v??[],this.nestedTypes=T??[],this.docs=I}write(e){this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),this.indirect&&e.write("indirect "),e.write(`enum ${k(this.name)}`),this.conformances.forEach((r,s)=>{s===0?e.write(": "):s>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 "),e.write(k(r.unsafeName)),r.associatedValue!=null&&(e.write("("),r.associatedValue.forEach((s,m)=>{m>0&&e.write(", "),s.write(e)}),e.write(")")),e.newLine()}),this.initializers.length>0&&(e.newLine(),this.initializers.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),this.methods.length>0&&(e.newLine(),this.methods.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),this.nestedTypes.length>0&&(e.newLine(),this.nestedTypes.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),e.dedent(),e.write("}")}};u();c();p();var Ge=class extends B{constructor({accessLevel:e,name:r,conformances:s,cases:m,docs:l}){super();d(this,"name");d(this,"accessLevel");d(this,"conformances");d(this,"cases");d(this,"docs");this.name=r,this.accessLevel=e,this.conformances=s??[],this.cases=m,this.docs=l}write(e){if(this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write(`enum ${k(this.name)}`),this.conformances.forEach((r,s)=>{s===0?e.write(": "):s>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 "),e.write(k(r.unsafeName)),r.rawValue!==r.unsafeName&&(e.write(" = "),e.write(`"${Dt(r.rawValue)}"`)),e.newLine()}),e.dedent(),e.write("}")}};u();c();p();var He=class extends B{constructor({name:e,conformances:r,initializers:s,computedProperties:m,methods:l,nestedTypes:b,docs:v}){super();d(this,"name");d(this,"conformances");d(this,"initializers");d(this,"computedProperties");d(this,"methods");d(this,"nestedTypes");d(this,"docs");this.name=e,this.conformances=r??[],this.initializers=s??[],this.computedProperties=m??[],this.methods=l??[],this.nestedTypes=b??[],this.docs=v}write(e){this.docs!=null&&this.docs.write(e),e.write(`extension ${$t(this.name)}`),this.conformances.forEach((r,s)=>{s===0?e.write(": "):s>0&&e.write(", "),e.write(r)}),e.write(" {"),this.initializers.length>0&&(e.newLine(),e.indent(),this.initializers.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),this.computedProperties.length>0&&(e.newLine(),e.indent(),this.computedProperties.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),this.methods.length>0&&(e.newLine(),e.indent(),this.methods.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),this.nestedTypes.length>0&&(e.newLine(),e.indent(),this.nestedTypes.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),e.write("}")}};u();c();p();var Ke=class extends B{constructor({label:e,value:r}){super();d(this,"label");d(this,"value");this.label=e,this.value=r}write(e){this.label!=null&&(e.write(this.label),e.write(": ")),this.value.write(e)}};u();c();p();var Ye=class extends B{constructor({argumentLabel:e,unsafeName:r,escaping:s,type:m,defaultValue:l,docsContent:b}){super();d(this,"argumentLabel");d(this,"unsafeName");d(this,"escaping");d(this,"type");d(this,"defaultValue");d(this,"docsContent");this.argumentLabel=e,this.unsafeName=r,this.escaping=s,this.type=m,this.defaultValue=l,this.docsContent=b}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))}};u();c();p();var Je=class extends B{constructor({accessLevel:e,convenience:r,failable:s,throws:m,parameters:l,body:b,multiline:v,docs:T}){super();d(this,"accessLevel");d(this,"convenience");d(this,"failable");d(this,"throws");d(this,"parameters");d(this,"body");d(this,"multiline");d(this,"docs");this.accessLevel=e,this.convenience=r,this.failable=s,this.throws=m,this.parameters=l??[],this.body=b??z.empty(),this.multiline=v,this.docs=T}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,s)=>{s>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)}};u();c();p();var qt=class i extends B{constructor({count:e=1}={}){super();d(this,"count");this.count=e}write(e){for(let r=0;r<this.count;r++)e.newLine()}static single(){return new i({count:1})}static double(){return new i({count:2})}static multiple(e){return new i({count:e})}};u();c();p();var Ze=class extends B{constructor({attributes:e,unsafeName:r,accessLevel:s,static_:m,parameters:l,async:b,throws:v,returnType:T,body:I,docs:C}){super();d(this,"attributes");d(this,"unsafeName");d(this,"accessLevel");d(this,"static_");d(this,"parameters");d(this,"async");d(this,"throws");d(this,"returnType");d(this,"body");d(this,"docs");this.attributes=e??[],this.unsafeName=r,this.accessLevel=s,this.static_=m,this.parameters=l??[],this.async=b,this.throws=v,this.returnType=T,this.body=I??z.empty(),this.docs=C}write(e){this.docs!=null&&this.docs.write(e),this.attributes.forEach(r=>{r.arguments?.length?pe.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(k(this.unsafeName)),e.write("("),this.parameters.forEach((r,s)=>{s>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)}};u();c();p();var Wt=class extends B{constructor(e){super();d(this,"internalPattern");this.internalPattern=e}write(e){this.internalPattern.type==="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(")")):A(this.internalPattern.type)}static enumCaseValueBinding(e){return new this({type:"enum-case-value-binding",...e})}};u();c();p();var Xe=class extends B{constructor({unsafeName:e,accessLevel:r,static_:s,declarationType:m,type:l,indirect:b,defaultValue:v,docs:T}){super();d(this,"unsafeName");d(this,"accessLevel");d(this,"static_");d(this,"declarationType");d(this,"type");d(this,"indirect");d(this,"defaultValue");d(this,"docs");this.unsafeName=e,this.accessLevel=r,this.static_=s,this.declarationType=m,this.type=l,this.indirect=b,this.defaultValue=v,this.docs=T}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(" "),e.write(k(this.unsafeName)),e.write(": "),this.type.write(e),this.defaultValue!=null&&(e.write(" = "),this.defaultValue.write(e))}};u();c();p();var ms={CaseIterable:"CaseIterable",Codable:"Codable",CodingKey:"CodingKey",Decodable:"Decodable",Encodable:"Encodable",Equatable:"Equatable",Error:"Error",Hashable:"Hashable",Sendable:"Sendable",MultipartFormDataConvertible:"MultipartFormDataConvertible"};u();c();p();var Qe=class extends B{constructor({attributes:e,accessLevel:r,name:s,conformances:m,properties:l,initializers:b,methods:v,nestedTypes:T,docs:I}){super();d(this,"attributes");d(this,"name");d(this,"accessLevel");d(this,"conformances");d(this,"properties");d(this,"initializers");d(this,"methods");d(this,"nestedTypes");d(this,"docs");this.attributes=e??[],this.name=s,this.accessLevel=r,this.conformances=m??[],this.properties=l??[],this.initializers=b??[],this.methods=v??[],this.nestedTypes=T??[],this.docs=I}write(e){this.docs!=null&&this.docs.write(e),this.attributes.forEach(v=>{v.arguments?.length?pe.functionCall({unsafeName:`@${v.name}`,arguments_:v.arguments}).write(e):(e.write("@"),e.write(v.name)),e.write(" ")}),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write(`struct ${k(this.name)}`),this.conformances.forEach((v,T)=>{T===0?e.write(": "):T>0&&e.write(", "),e.write(v)}),e.write(" {"),e.newLine(),e.indent();let r=this.properties.length>0,s=this.initializers.length>0,m=this.methods.length>0,l=this.nestedTypes.length>0;this.properties.forEach(v=>{v.write(e),e.newLine()});let b=r;s&&(b&&e.newLine(),this.initializers.forEach((v,T)=>{T>0&&e.newLine(),v.write(e),e.newLine()}),b=!0),m&&(b&&e.newLine(),this.methods.forEach((v,T)=>{T>0&&e.newLine(),v.write(e),e.newLine()}),b=!0),l&&(b&&e.newLine(),this.nestedTypes.forEach((v,T)=>{T>0&&e.newLine(),v.write(e),e.newLine()})),e.dedent(),e.write("}")}};u();c();p();u();c();p();var Np={Http:{relativePathToDir:"Core/Networking",filenameWithoutExtension:"HTTP",symbols:[{name:"HTTP",shape:{type:"enum-container"}}]},MultipartFormData:{relativePathToDir:"Core/Networking",filenameWithoutExtension:"MultipartFormData",symbols:[{name:"MultipartFormData",shape:{type:"class"}}]},MultipartFormDataConvertible:{relativePathToDir:"Core/Networking",filenameWithoutExtension:"MultipartFormDataConvertible",symbols:[{name:"MultipartFormDataConvertible",shape:{type:"protocol"}}]},MultipartFormField:{relativePathToDir:"Core/Networking",filenameWithoutExtension:"MultipartFormField",symbols:[{name:"MultipartFormField",shape:{type:"enum-with-associated-values"}}]},QueryParameter:{relativePathToDir:"Core/Networking",filenameWithoutExtension:"QueryParameter",symbols:[{name:"QueryParameter",shape:{type:"enum-with-associated-values"}}]},DecoderPlusAdditionalProperties:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"Decoder+AdditionalProperties",symbols:[]},EncodableValue:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"EncodableValue",symbols:[{name:"EncodableValue",shape:{type:"struct"}}]},EncoderPlusAdditionalProperties:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"Encoder+AdditionalProperties",symbols:[]},JSONEncoderPlusEncodableValue:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"JSONEncoder+EncodableValue",symbols:[]},KeyedDecodingContainerPlusNullable:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"KeyedDecodingContainer+Nullable",symbols:[]},KeyedEncodingContainerPlusNullable:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"KeyedEncodingContainer+Nullable",symbols:[]},Serde:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"Serde",symbols:[{name:"Serde",shape:{type:"class"}}]},StringKey:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"StringKey",symbols:[{name:"StringKey",shape:{type:"struct"}}]},DataPlusString:{relativePathToDir:"Core",filenameWithoutExtension:"Data+String",symbols:[]},StringPlusUrlEncoding:{relativePathToDir:"Core",filenameWithoutExtension:"String+URLEncoding",symbols:[]},CalendarDate:{relativePathToDir:"Public",filenameWithoutExtension:"CalendarDate",symbols:[{name:"CalendarDate",shape:{type:"struct"}}]},FormFile:{relativePathToDir:"Public",filenameWithoutExtension:"FormFile",symbols:[{name:"FormFile",shape:{type:"struct"}}]},HTTPError:{relativePathToDir:"Public",filenameWithoutExtension:"HTTPError",symbols:[{name:"HTTPError",shape:{type:"struct"}}]},Indirect:{relativePathToDir:"Public",filenameWithoutExtension:"Indirect",symbols:[{name:"Indirect",shape:{type:"class"}}]},JsonValue:{relativePathToDir:"Public",filenameWithoutExtension:"JSONValue",symbols:[{name:"JSONValue",shape:{type:"enum-with-associated-values"}}]},Networking:{relativePathToDir:"Public",filenameWithoutExtension:"Networking",symbols:[{name:"Networking",shape:{type:"enum-container"}}]},Nullable:{relativePathToDir:"Public",filenameWithoutExtension:"Nullable",symbols:[{name:"Nullable",shape:{type:"enum-with-associated-values"}}]},RequestOptions:{relativePathToDir:"Public",filenameWithoutExtension:"RequestOptions",symbols:[{name:"RequestOptions",shape:{type:"struct"}}]}};u();c();p();var R=class R{constructor(t,e,r){d(this,"id");d(this,"name");d(this,"shape");this.id=t,this.name=e,this.shape=r}static isSwiftSymbol(t){return R.SWIFT_SYMBOL_ID===t||t.startsWith(`${R.SWIFT_SYMBOL_ID}.`)}static isSwiftSymbolName(t){return t in R.swiftTypeSymbolsByName}static isFoundationSymbol(t){return R.FOUNDATION_SYMBOL_ID===t||t.startsWith(`${R.FOUNDATION_SYMBOL_ID}.`)}static isFoundationSymbolName(t){return t in R.foundationTypeSymbolsByName}static isCustomSymbol(t){return!R.isSwiftSymbol(t)&&!R.isFoundationSymbol(t)}static create(t,e,r){return new R(t,e,r)}static swiftType(t){return R.create(`${R.SWIFT_SYMBOL_ID}.${t}`,t,{type:"system"})}static foundationType(t){return R.create(`${R.FOUNDATION_SYMBOL_ID}.${t}`,t,{type:"system"})}get isSwiftSymbol(){return R.isSwiftSymbol(this.id)}get isFoundationSymbol(){return R.isFoundationSymbol(this.id)}get isCustomSymbol(){return R.isCustomSymbol(this.id)}};d(R,"SWIFT_SYMBOL_NAME","Swift"),d(R,"SWIFT_SYMBOL_ID",R.SWIFT_SYMBOL_NAME),d(R,"swiftTypeSymbolsByName",{String:R.swiftType("String"),Bool:R.swiftType("Bool"),Int:R.swiftType("Int"),Int64:R.swiftType("Int64"),UInt:R.swiftType("UInt"),UInt64:R.swiftType("UInt64"),Float:R.swiftType("Float"),Double:R.swiftType("Double"),Void:R.swiftType("Void"),Encoder:R.swiftType("Encoder"),Decoder:R.swiftType("Decoder"),Any:R.swiftType("Any")}),d(R,"swiftTypeSymbols",Object.values(R.swiftTypeSymbolsByName)),d(R,"FOUNDATION_SYMBOL_NAME","Foundation"),d(R,"FOUNDATION_SYMBOL_ID",R.FOUNDATION_SYMBOL_NAME),d(R,"foundationTypeSymbolsByName",{Data:R.foundationType("Data"),Date:R.foundationType("Date"),UUID:R.foundationType("UUID")}),d(R,"foundationTypeSymbols",Object.values(R.foundationTypeSymbolsByName));var q=R;u();c();p();u();c();p();u();c();p();u();c();p();var Vt=class{constructor(t,e){d(this,"id");d(this,"name");d(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)}},jt=class extends Vt{constructor(e,r){super(e,r);d(this,"kind","module");d(this,"imports");d(this,"parent",null);this.imports=[]}addImport(e){this.imports.push(e)}get qualifiedPath(){return[this.name]}get qualifiedName(){return this.name}},zt=class extends Vt{constructor(e,r,s){super(r,e);d(this,"kind","type");d(this,"shape");d(this,"parent");this.parent=null,this.shape=s}getNearestModuleAncestorOrThrow(){let e=this.parent;for(;e!==null&&e.kind!=="module";)e=e.parent;return Q(e,`No module ancestor found for type symbol '${this.id}'`),e}get qualifiedPath(){return[...this.parent?.qualifiedPath??[],this.name]}get qualifiedName(){return this.qualifiedPath.join(".")}};var yt=class{constructor(){d(this,"symbolsById",new Map)}createModuleSymbol({symbolId:t,symbolName:e}){this.validateSymbolNotExists(t);let r=new jt(t,e);return this.symbolsById.set(t,r),r}createTypeSymbol({symbolId:t,symbolName:e,shape:r}){this.validateSymbolNotExists(t);let s=new zt(e,t,r);return this.symbolsById.set(t,s),s}addImportRelation({clientSymbolId:t,importedSymbolId:e}){let r=this.getSymbolByIdOrThrow(t),s=this.getSymbolByIdOrThrow(e);if(r.kind!=="module"||s.kind!=="module")throw new Error(`Client module '${r.id}' and imported module '${s.id}' must both be module symbols.`);r.addImport(s)}nestSymbol({parentSymbolId:t,childSymbolId:e}){let r=this.getSymbolByIdOrThrow(t),s=this.getSymbolByIdOrThrow(e);r.addChild(s),s.parent=r}reference({fromSymbolId:t,targetSymbolId:e}){let r=this.getSymbolByIdOrThrow(t),s=this.getSymbolByIdOrThrow(e),m=s.qualifiedPath;for(let l=1;l<=m.length;l++){let b=m.slice(m.length-l);if(this.resolvePath(r,b)?.id===s.id)return b.join(".")}return s.qualifiedName}resolveReference({fromSymbolId:t,reference:e}){let r=this.getSymbolByIdOrThrow(t),s=e.split(".").filter(m=>m.length>0);return this.resolvePath(r,s)}resolvePath(t,e){let[r,...s]=e;if(r===void 0)return null;let m=this.resolveFirstSegment(t,r);if(m===null)return null;let l=m;for(let b=0;b<s.length;b++){let v=s[b];if(ne(v),l=l.getChildByName(v)??null,l===null)return null}return l}resolveFirstSegment(t,e){let r=t;for(;r!==null;){let l=r.getChildByName(e);if(l)return l;r=r.parent}let s=t.kind==="module"?t:t.getNearestModuleAncestorOrThrow();if(s.name===e)return s;for(let l of s.imports)if(l.name===e)return l;let m=null;for(let l of s.imports){let b=l.getChildByName(e);if(b){if(m!=null&&m.id!==b.id)return null;m=b}}return m}getSymbolByIdOrThrow(t){let e=this.symbolsById.get(t);return ne(e,`A symbol with the ID '${t}' was not found in the registry.`),e}getSymbolById(t){return this.symbolsById.get(t)??null}validateSymbolNotExists(t){if(this.symbolsById.has(t))throw new Error(`A symbol with the ID '${t}' already exists in the registry.`)}};var Tr=class i{constructor(t,e,r){d(this,"graph");d(this,"swiftSymbol");d(this,"foundationSymbol");d(this,"registeredSourceModule");d(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}=i.createGraph();return new i(t,e,r)}static createGraph(){let t=new yt,e=()=>{let l=t.createModuleSymbol({symbolId:q.SWIFT_SYMBOL_ID,symbolName:q.SWIFT_SYMBOL_NAME});return q.swiftTypeSymbols.forEach(b=>{let v=t.createTypeSymbol({symbolId:b.id,symbolName:b.name,shape:{type:"system"}});t.nestSymbol({parentSymbolId:l.id,childSymbolId:v.id})}),l},r=()=>{let l=t.createModuleSymbol({symbolId:q.FOUNDATION_SYMBOL_ID,symbolName:q.FOUNDATION_SYMBOL_NAME});return q.foundationTypeSymbols.forEach(b=>{let v=t.createTypeSymbol({symbolId:b.id,symbolName:b.name,shape:{type:"system"}});t.nestSymbol({parentSymbolId:l.id,childSymbolId:v.id})}),l},s=e(),m=r();return{graph:t,swiftSymbol:s,foundationSymbol:m}}getRegisteredSourceModuleSymbolOrThrow(){return Q(this.registeredSourceModule,"Module symbol not found."),q.create(this.registeredSourceModule.id,this.registeredSourceModule.name,{type:"other"})}getRegisteredTestModuleSymbolOrThrow(){return Q(this.registeredTestModule,"Module symbol not found."),q.create(this.registeredTestModule.id,this.registeredTestModule.name,{type:"other"})}getSymbolByIdOrThrow(t){let e=this.graph.getSymbolById(t);return Q(e,`Symbol with ID '${t}' not found in registry.`),q.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,q.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),Q(this.registeredSourceModule,"Cannot register a test module before registering a source module."),r.addImport(this.registeredSourceModule),this.registeredTestModule=r,q.create(r.id,r.name,{type:"other"})}registerSourceModuleType(t,e){Q(this.registeredSourceModule,"Cannot register a type before registering a module.");let r=this.inferSymbolIdForSourceModuleType(t),s=this.graph.createTypeSymbol({symbolId:r,symbolName:t,shape:e});return this.graph.nestSymbol({parentSymbolId:this.registeredSourceModule.id,childSymbolId:s.id}),q.create(s.id,s.name,e)}registerTestModuleType(t,e){Q(this.registeredTestModule,"Cannot register a type before registering a module.");let r=this.inferSymbolIdForTestModuleType(t),s=this.graph.createTypeSymbol({symbolId:r,symbolName:t,shape:e});return this.graph.nestSymbol({parentSymbolId:this.registeredTestModule.id,childSymbolId:s.id}),q.create(s.id,s.name,e)}registerNestedType({parentSymbol:t,symbolName:e,shape:r}){let s=typeof t=="string"?t:t.id,m=this.inferSymbolIdForNestedType(s,e),l=this.graph.createTypeSymbol({symbolId:m,symbolName:e,shape:r});return this.graph.nestSymbol({parentSymbolId:s,childSymbolId:l.id}),q.create(l.id,l.name,r)}reference({fromSymbol:t,toSymbol:e}){let r=typeof t=="string"?t:t.id,s=typeof e=="string"?e:e.id;return this.graph.reference({fromSymbolId:r,targetSymbolId:s})}resolveReference({fromSymbol:t,reference:e}){let r=typeof t=="string"?t:t.id,s=this.graph.resolveReference({fromSymbolId:r,reference:e});return s?q.create(s.id,s.name,s.kind==="type"?s.shape:{type:"other"}):null}inferSymbolIdForSourceModuleType(t){return Q(this.registeredSourceModule,"Cannot get symbol id for a type before registering a module."),`${this.registeredSourceModule.id}.${t}`}inferSymbolIdForTestModuleType(t){return Q(this.registeredTestModule,"Cannot get symbol id for a type before registering a module."),`${this.registeredTestModule.id}.${t}`}inferSymbolIdForNestedType(t,e){return`${t}.${e}`}};u();c();p();var Rp={ClientError:{relativePath:"",filenameWithoutExtension:i=>(ar(i.errorEnumName),i.errorEnumName)},HTTPClient:{relativePath:"Core/Networking",filenameWithoutExtension:()=>"HTTPClient"},ClientConfig:{relativePath:"Public",filenameWithoutExtension:()=>"ClientConfig"}};var Gt=class i extends B{constructor(e){super();d(this,"variant");this.variant=e}nonOptional(){return i.nonOptional(this)}nonNullable(){return i.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(q.isSwiftSymbolName(r.symbol)||q.isFoundationSymbolName(r.symbol)?r.symbol:$t(r.symbol));break;case"generic":{r.reference.write(e),r.arguments.length>0&&(e.write("<"),r.arguments.forEach((s,m)=>{s.write(e),m<r.arguments.length-1&&e.write(", ")}),e.write(">"));break}case"tuple":e.write("("),r.elements.forEach((s,m)=>{m>0&&e.write(", "),s.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:A(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,s)=>e.variant.type==="generic"&&e.variant.arguments[s]&&r.equals(e.variant.arguments[s]));case"tuple":return e.variant.type==="tuple"&&this.variant.elements.every((r,s)=>e.variant.type==="tuple"&&e.variant.elements[s]&&r.equals(e.variant.elements[s]));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:A(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"?i.nonOptional(e.variant.valueType):e}static nonNullable(e){return e.variant.type==="nullable"?i.nonNullable(e.variant.valueType):e}static unqualifiedToSwiftType(e){return i.symbol(e)}static unqualifiedToFoundationType(e){return i.symbol(e)}};function Ap(i){return new $e(i)}function Cp(i){return new z(i)}function Bp(i){return new qe(i)}function Lp(i){return new Ve(i)}function Fp(i){return new je(i)}function Mp(i){return new ze(i)}function Op(i){return new Ge(i)}function Pp(i){return new He(i)}function kp(i){return new Ke(i)}function Up(i){return new Ye(i)}function _p(i){return new Je(i)}function Dp(i){return new Ze(i)}function $p(i){return new Xe(i)}function qp(i){return new Qe(i)}u();c();p();function fs(i){return H(te(i))}u();c();p();var Ht=class{constructor({context:t}){d(this,"context");this.context=t}convert(t){let{fromSymbol:e,typeReference:r,value:s,as:m}=t;switch(r.type){case"list":return this.convertList({fromSymbol:e,list:r.value,value:s});case"literal":{if(r.value.type==="string")return S.Expression.enumCaseShorthand(Ae.generateEnumCaseLabel(r.value.value));if(r.value.type==="boolean")return S.Expression.boolLiteral(r.value.value);A(r.value);break}case"map":return this.convertMap({fromSymbol:e,map:r,value:s});case"named":{let l=this.context.resolveNamedType({typeId:r.value});return l==null?S.Expression.nop():this.convertNamed({fromSymbol:e,typeId:r.value,named:l,value:s,as:m})}case"nullable":return this.context.customConfig?.nullableAsOptional?this.convert({fromSymbol:e,typeReference:r.value,value:s,as:m}):this.convertNullable({fromSymbol:e,nullable:r,value:s,as:m});case"optional":return this.convert({fromSymbol:e,typeReference:r.value,value:s,as:m});case"primitive":return this.convertPrimitive({primitive:r.value,value:s,as:m});case"set":return S.Expression.nop();case"unknown":return this.convertUnknown(s);default:A(r)}}convertList({fromSymbol:t,list:e,value:r}){return Array.isArray(r)?S.Expression.arrayLiteral({elements:r.map((s,m)=>{this.context.errors.scope({index:m});try{return this.convert({fromSymbol:t,typeReference:e,value:s})}finally{this.context.errors.unscope()}}),multiline:!0}):(this.context.errors.add({severity:M.Critical,message:`Expected array but got: ${typeof r}`}),S.Expression.nop())}convertMap({fromSymbol:t,map:e,value:r}){return typeof r!="object"||r==null?(this.context.errors.add({severity:M.Critical,message:`Expected object but got: ${r==null?"null":typeof r}`}),S.Expression.nop()):S.Expression.dictionaryLiteral({entries:Object.entries(r).map(([s,m])=>{this.context.errors.scope(s);try{return[this.convert({fromSymbol:t,typeReference:e.key,value:s,as:"mapKey"}),this.convert({fromSymbol:t,typeReference:e.value,value:m,as:"mapValue"})]}finally{this.context.errors.unscope()}}),multiline:!0})}convertNamed({fromSymbol:t,typeId:e,named:r,value:s,as:m}){switch(r.type){case"alias":return this.convert({fromSymbol:t,typeReference:r.typeReference,value:s,as:m});case"discriminatedUnion":{let l=this.context.nameRegistry.getSchemaTypeSymbolOrThrow(e);return this.convertDiscriminatedUnion({fromSymbol:t,unionSymbol:l,discriminatedUnion:r,value:s})}case"enum":return this.convertEnum({enum_:r,value:s});case"object":return this.convertObject({fromSymbol:t,typeId:e,object_:r,value:s});case"undiscriminatedUnion":{let l=this.context.nameRegistry.getSchemaTypeSymbolOrThrow(e);return this.convertUndiscriminatedUnion({fromSymbol:t,unionSymbol:l,undiscriminatedUnion:r,value:s})}default:A(r)}}convertNullable({fromSymbol:t,nullable:e,value:r,as:s}){return r==null?S.Expression.enumCaseShorthand("null"):S.Expression.contextualMethodCall({methodName:"value",arguments_:[S.functionArgument({value:this.convert({fromSymbol:t,typeReference:e.value,value:r,as:s})})]})}convertDiscriminatedUnion({fromSymbol:t,discriminatedUnion:e,unionSymbol:r,value:s}){let m=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:s});if(m==null)return S.Expression.nop();let l=m.singleDiscriminatedUnionType,b=Ft.sanitizeToCamelCase(l.discriminantValue.name.camelCase.unsafeName);switch(l.type){case"samePropertiesAsObject":{let v=this.context.resolveNamedType({typeId:l.typeId});if(v==null)return S.Expression.nop();let T=this.convertNamed({fromSymbol:t,typeId:l.typeId,named:v,value:m.value});return S.Expression.methodCall({target:S.Expression.reference(r.name),methodName:b,arguments_:[S.functionArgument({value:T})],multiline:!0})}case"singleProperty":try{this.context.errors.scope(l.discriminantValue.wireValue);let v=this.context.getRecord(m.value);if(v==null)return S.Expression.nop();let T=new Set((l.properties??[]).map(_=>_.name.wireValue)),I=Object.keys(v).find(_=>!T.has(_))??"value",C=this.convert({fromSymbol:t,typeReference:l.typeReference,value:v[I]});return S.Expression.methodCall({target:S.Expression.reference(r.name),methodName:b,arguments_:[S.functionArgument({value:C})],multiline:!0})}finally{this.context.errors.unscope()}case"noProperties":return S.Expression.memberAccess({target:S.Expression.reference(r.name),memberName:b});default:A(l)}}convertEnum({enum_:t,value:e}){let r=this.getEnumValue({enum_:t,value:e});return r==null?S.Expression.nop():S.Expression.enumCaseShorthand(r.name.camelCase.unsafeName)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:M.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let r=t.values.find(s=>s.wireValue===e);if(r==null){this.context.errors.add({severity:M.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return r}convertObject({fromSymbol:t,typeId:e,object_:r,value:s}){let m=this.context.nameRegistry.getSchemaTypeSymbolOrThrow(e),l=this.context.getExampleObjectProperties({parameters:r.properties,snippetObject:s}),b=new Map(l.map(T=>[T.name.wireValue,T])),v=r.properties.map(T=>{let I=b.get(T.name.wireValue);return I??(T.typeReference.type==="literal"?{name:T.name,typeReference:T.typeReference,value:void 0}:null)}).filter(T=>T!=null);return S.Expression.structInitialization({unsafeName:m.name,arguments_:v.map(T=>{let I=this.convert({fromSymbol:t,typeReference:T.typeReference,value:T.value});return I.isNop()?null:S.functionArgument({label:De(T.name.name.camelCase.unsafeName),value:I})}).filter(T=>T!=null),multiline:!0})}convertUndiscriminatedUnion({fromSymbol:t,unionSymbol:e,undiscriminatedUnion:r,value:s}){let m=this.findMatchingUndiscriminatedUnionType({fromSymbol:t,unionSymbol:e,undiscriminatedUnion:r,value:s});return m??S.Expression.nop()}findMatchingUndiscriminatedUnionType({fromSymbol:t,unionSymbol:e,undiscriminatedUnion:r,value:s}){let m=this.context.nameRegistry.getAllUndiscriminatedUnionVariantsOrThrow(e);for(let l of r.types){let b=this.context.errors.size();try{let v=this.convert({fromSymbol:t,typeReference:l,value:s}),T=this.context.getSwiftTypeReferenceFromScope(l,t),I=m.find(C=>C.swiftType.equals(T));if(I==null){this.context.errors.truncate(b);continue}return S.Expression.methodCall({target:S.Expression.reference(e.name),methodName:I.caseName,arguments_:[S.functionArgument({value:v})],multiline:!0})}catch{this.context.errors.truncate(b);continue}}this.context.errors.add({severity:M.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof s}" value`})}convertUnknown(t){switch(typeof t){case"boolean":return S.Expression.contextualMethodCall({methodName:"bool",arguments_:[S.functionArgument({value:S.Expression.boolLiteral(t)})]});case"string":return S.Expression.contextualMethodCall({methodName:"string",arguments_:[S.functionArgument({value:S.Expression.escapedStringLiteral(t)})]});case"number":return S.Expression.contextualMethodCall({methodName:"number",arguments_:[S.functionArgument({value:S.Expression.numberLiteral(t)})]});case"object":return t===null?S.Expression.enumCaseShorthand("null"):Array.isArray(t)?S.Expression.contextualMethodCall({methodName:"array",arguments_:[S.functionArgument({value:S.Expression.arrayLiteral({elements:t.map(e=>this.convertUnknown(e)),multiline:!0})})]}):S.Expression.contextualMethodCall({methodName:"object",arguments_:[S.functionArgument({value:S.Expression.dictionaryLiteral({entries:Object.entries(t).map(([e,r])=>[S.Expression.escapedStringLiteral(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 s=this.getValueAsNumber({value:e,as:r});return s==null?S.Expression.nop():S.Expression.numberLiteral(s)}case"BOOLEAN":{let s=this.getValueAsBoolean({value:e,as:r});return s==null?S.Expression.nop():S.Expression.boolLiteral(s)}case"STRING":{let s=this.context.getValueAsString({value:e});return s==null?S.Expression.nop():S.Expression.escapedStringLiteral(s)}case"DATE":{let s=this.context.getValueAsString({value:e});return s==null?S.Expression.nop():S.Expression.calendarDateLiteral(s)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let s=this.context.getValueAsString({value:e});if(s==null)return S.Expression.nop();let m=new Date(s).getTime(),l=Math.round(m/1e3),v=new Date(l*1e3).toISOString().replace(/\.\d{3}Z$/,"Z");return S.Expression.dateLiteral(v)}case"UUID":{let s=this.context.getValueAsString({value:e});return s==null?S.Expression.nop():S.Expression.uuidLiteral(s)}case"BASE_64":{let s=this.context.getValueAsString({value:e});return s==null?S.Expression.nop():S.Expression.escapedStringLiteral(s)}case"BIG_INTEGER":return this.context.getValueAsString({value:e})==null?S.Expression.nop():S.Expression.nop();default:A(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:A(e)}})();return this.context.getValueAsBoolean({value:r})}};u();c();p();var Kt=class{constructor({context:t}){d(this,"context");this.context=t}getFilePropertyInfo({fromSymbol:t,body:e,value:r}){let s={fileFields:[],bodyPropertyFields:[],orderedFields:[]},m=this.context.getRecord(r)??{};for(let l of e.properties)switch(l.type){case"file":{let b=S.functionArgument({label:De(l.name.camelCase.unsafeName),value:this.getSingleFileProperty({property:l,record:m})});s.fileFields.push(b),s.orderedFields.push(b);break}case"fileArray":{let b=S.functionArgument({label:De(l.name.camelCase.unsafeName),value:this.getArrayFileProperty({property:l,record:m})});s.fileFields.push(b),s.orderedFields.push(b);break}case"bodyProperty":{let b=S.functionArgument({label:De(l.name.name.camelCase.unsafeName),value:this.getBodyProperty({fromSymbol:t,property:l,record:m})});s.bodyPropertyFields.push(b),s.orderedFields.push(b);break}default:A(l)}return s}getSingleFileProperty({property:t,record:e}){let r=this.context.getSingleFileValue({property:t,record:e});return S.Expression.contextualMethodCall({methodName:"init",arguments_:[S.functionArgument({label:"data",value:S.Expression.dataLiteral(r??"")})]})}getArrayFileProperty({property:t,record:e}){let r=this.context.getFileArrayValues({property:t,record:e});return S.Expression.arrayLiteral({elements:(r??[]).map(s=>S.Expression.contextualMethodCall({methodName:"init",arguments_:[S.functionArgument({label:"data",value:S.Expression.dataLiteral(s)})]})),multiline:!0})}getBodyProperty({fromSymbol:t,property:e,record:r}){let s=r[e.name.wireValue];return s==null?S.Expression.nop():this.context.dynamicTypeLiteralMapper.convert({fromSymbol:t,typeReference:e.typeReference,value:s})}};u();c();p();function ds({parentSymbol:i,registry:t,namedType:e,context:r}){ie(e,"type")._visit({object:s=>{Ir({parentSymbol:i,registry:t,properties:s.properties})},discriminatedUnion:s=>{Object.values(s.types).forEach(m=>{ie(m,"type")._visit({noProperties:K,samePropertiesAsObject:K,singleProperty:l=>{se({parentSymbol:i,registry:t,typeReference:l.typeReference})},_other:K})})},undiscriminatedUnion:s=>{s.types.forEach(m=>{se({parentSymbol:i,registry:t,typeReference:m})})},alias:K,enum:K,_other:K})}function Ir({parentSymbol:i,registry:t,properties:e}){e.forEach(r=>{se({parentSymbol:i,registry:t,typeReference:r.typeReference})})}function se({parentSymbol:i,registry:t,typeReference:e}){ie(e,"type")._visit({list:r=>{se({parentSymbol:i,registry:t,typeReference:r.value})},literal:r=>{ie(r.value,"type")._visit({string:s=>{t.registerNestedLiteralEnumSymbol({parentSymbol:i,literalValue:s.value})},boolean:K,_other:K})},map:r=>{se({parentSymbol:i,registry:t,typeReference:r.key}),se({parentSymbol:i,registry:t,typeReference:r.value})},named:K,nullable:r=>{se({parentSymbol:i,registry:t,typeReference:r.value})},optional:r=>{se({parentSymbol:i,registry:t,typeReference:r.value})},primitive:K,set:r=>{se({parentSymbol:i,registry:t,typeReference:r.value})},unknown:K,_other:K})}u();c();p();function hs({parentSymbol:i,registry:t,namedType:e,context:r}){if(e.type==="undiscriminatedUnion"){let s=e.types.map(m=>{let l=r.getSwiftTypeReferenceFromScope(m,i);return{swiftType:l,caseName:Ot.inferCaseNameForTypeReference(i,l,t),docsContent:void 0}});t.registerUndiscriminatedUnionVariants({parentSymbol:i,variants:s})}}var Yt=class i extends ft{constructor({ir:e,config:r,options:s,sharedNameRegistry:m}){super({ir:e,config:r,options:s});d(this,"ir");d(this,"customConfig");d(this,"dynamicTypeLiteralMapper");d(this,"filePropertyMapper");d(this,"nameRegistry");this.ir=e,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeLiteralMapper=new Ht({context:this}),this.filePropertyMapper=new Kt({context:this}),m!=null?this.nameRegistry=m:(this.nameRegistry=_t.create(),this.registerSourceSymbols(this.nameRegistry,e))}registerSourceSymbols(e,r){let s=fs(this.config.workspaceName),m=e.registerSourceModuleSymbol({configModuleName:this.customConfig?.moduleName,apiNamePascalCase:s,asIsSymbols:Object.values(S.SourceAsIsFileSpecs).flatMap(b=>b.symbols)});return e.registerRootClientSymbol({configClientClassName:this.customConfig?.clientClassName,registeredSourceModuleName:m.name}),lr(S.SourceTemplateFileSpecs).forEach(([b])=>{switch(b){case"ClientError":e.registerErrorEnumSymbol(m.name);break;case"HTTPClient":e.registerSourceStaticSymbol(b,{type:"class"});break;case"ClientConfig":e.registerSourceStaticSymbol(b,{type:"class"});break;default:A(b)}}),e.registerEnvironmentSymbol({configEnvironmentEnumName:this.customConfig?.environmentEnumName,registeredSourceModuleName:m.name}),Object.entries(r.types).map(([b,v])=>{let T=ie(v,"type")._visit({alias:()=>({type:"struct"}),enum:()=>({type:"enum-with-raw-values"}),object:()=>({type:"struct"}),discriminatedUnion:()=>({type:"enum-with-associated-values"}),undiscriminatedUnion:()=>({type:"enum-with-associated-values"}),_other:()=>({type:"other"})}),I=e.registerSchemaTypeSymbol(b,v.declaration.name.pascalCase.unsafeName,T);return{namedType:v,registeredSymbol:I}}).forEach(({namedType:b,registeredSymbol:v})=>{ds({parentSymbol:v,registry:e,namedType:b,context:this}),hs({parentSymbol:v,registry:e,namedType:b,context:this})}),e.registerRequestsContainerSymbol(),Object.entries(r.endpoints).forEach(([b,v])=>{if(v.request.type==="inlined"){if(v.request.body?.type==="properties"){let T=e.registerRequestTypeSymbol({endpointId:b,requestNamePascalCase:v.request.declaration.name.pascalCase.unsafeName});Ir({parentSymbol:T,registry:e,properties:v.request.body.value})}v.request.body?.type==="fileUpload"&&e.registerRequestTypeSymbol({endpointId:b,requestNamePascalCase:v.request.declaration.name.pascalCase.unsafeName}),v.request.queryParameters?.forEach(T=>{se({parentSymbol:m,registry:e,typeReference:T.typeReference})})}}),e}getNamedTypeOrThrow(e){let r=this.ir.types[e];return ne(r,`Type declaration with the id '${e}' not found`),r}getPropertiesOfDiscriminatedUnionVariant(e){let r=this.getNamedTypeOrThrow(e);return ie(r,"type")._visit({alias:()=>[],enum:()=>[],object:s=>s.properties,discriminatedUnion:()=>[],undiscriminatedUnion:()=>[],_other:()=>[]})}getSwiftTypeReferenceFromScope(e,r){let s=this.createReferencer(r);return ie(e,"type")._visit({list:m=>S.TypeReference.array(this.getSwiftTypeReferenceFromScope(m.value,r)),literal:m=>ie(m.value,"type")._visit({boolean:()=>s.referenceSwiftType("Bool"),string:l=>{let b=this.nameRegistry.getNestedLiteralEnumSymbol(r,l.value);return b==null?s.referenceAsIsType("JSONValue"):s.referenceType(b)},_other:()=>s.referenceAsIsType("JSONValue")}),map:m=>S.TypeReference.dictionary(this.getSwiftTypeReferenceFromScope(m.key,r),this.getSwiftTypeReferenceFromScope(m.value,r)),named:m=>{let l=this.nameRegistry.getSchemaTypeSymbolOrThrow(m.value),b=this.nameRegistry.reference({fromSymbol:r,toSymbol:l});return S.TypeReference.symbol(b)},nullable:m=>this.customConfig?.nullableAsOptional?S.TypeReference.optional(this.getSwiftTypeReferenceFromScope(m.value,r)):S.TypeReference.nullable(this.getSwiftTypeReferenceFromScope(m.value,r)),optional:m=>S.TypeReference.optional(this.getSwiftTypeReferenceFromScope(m.value,r)),primitive:m=>ie(m,"value")._visit({STRING:()=>s.referenceSwiftType("String"),BOOLEAN:()=>s.referenceSwiftType("Bool"),INTEGER:()=>s.referenceSwiftType("Int"),UINT:()=>s.referenceSwiftType("UInt"),UINT_64:()=>s.referenceSwiftType("UInt64"),LONG:()=>s.referenceSwiftType("Int64"),FLOAT:()=>s.referenceSwiftType("Float"),DOUBLE:()=>s.referenceSwiftType("Double"),BIG_INTEGER:()=>s.referenceSwiftType("String"),DATE:()=>s.referenceAsIsType("CalendarDate"),DATE_TIME:()=>s.referenceFoundationType("Date"),DATE_TIME_RFC_2822:()=>s.referenceFoundationType("Date"),BASE_64:()=>s.referenceSwiftType("String"),UUID:()=>s.referenceFoundationType("UUID"),_other:()=>s.referenceAsIsType("JSONValue")}),set:()=>s.referenceAsIsType("JSONValue"),unknown:()=>s.referenceAsIsType("JSONValue"),_other:()=>s.referenceAsIsType("JSONValue")})}createReferencer(e){return new Mt(this.nameRegistry,e)}clone(){return new i({ir:this.ir,config:this.config,options:this.options,sharedNameRegistry:this.nameRegistry})}};u();c();p();var ys="client",et=class{constructor({context:t}){d(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e,options:r}){return this.buildCodeBlock({endpoint:t,snippetRequest:e,options:r})}generateSnippetSync({endpoint:t,request:e,options:r}){return this.buildCodeBlock({endpoint:t,snippetRequest:e,options:r})}async generateSnippetAst({endpoint:t,request:e,options:r}){throw new Error("Unsupported")}buildCodeBlock({endpoint:t,snippetRequest:e,options:r}){return[this.generateImportFoundationStatement(),this.generateImportModuleStatement(),S.LineBreak.single(),this.generateMainFunctionDeclarationWithEndpointSnippet({endpoint:t,snippet:e}),S.LineBreak.single(),this.generateMainFunctionInvocationStatement()].map(m=>m.toString()).join("")}generateImportFoundationStatement(){return S.Statement.import("Foundation")}generateImportModuleStatement(){let t=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();return S.Statement.import(t.name)}generateMainFunctionDeclarationWithEndpointSnippet({endpoint:t,snippet:e}){return S.Statement.functionDeclaration({unsafeName:"main",accessLevel:"private",async:!0,throws:!0,body:S.CodeBlock.withStatements([this.generateRootClientInitializationStatement({auth:t.auth,snippet:e}),S.LineBreak.single(),this.generateEndpointMethodCallStatement({endpoint:t,snippet:e})])})}generateRootClientInitializationStatement({auth:t,snippet:e,additionalArgs:r=[]}){let s=[],m=this.getRootClientBaseURLArg({snippet:e});m!=null&&s.push(m);let l=t?this.getRootClientAuthArgs({auth:t,snippet:e}):[];s.push(...l),this.context.ir.headers!=null&&e.headers!=null&&s.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:e.headers})),s.push(...r);let b=s.filter(T=>!T.value.isNop()),v=this.context.nameRegistry.getRootClientSymbolOrThrow();return S.Statement.constantDeclaration({unsafeName:ys,value:S.Expression.classInitialization({unsafeName:v.name,arguments_:b,multiline:b.length>1?!0:void 0})})}getRootClientHeaderArgs({headers:t,values:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow(),s=[];for(let m of t){let l=e[m.name.wireValue],b=this.getRootClientHeaderArg({moduleSymbol:r,header:m,value:l});b!=null&&s.push(b)}return s}getRootClientHeaderArg({moduleSymbol:t,header:e,value:r}){if(e.typeReference.type==="literal")return;let s=this.context.dynamicTypeLiteralMapper.convert({fromSymbol:t,typeReference:e.typeReference,value:r});if(!s.isNop())return S.functionArgument({label:e.name.name.camelCase.unsafeName,value:s})}getRootClientBaseURLArg({snippet:t}){return t.baseURL!=null&&t.environment!=null?(this.context.errors.add({severity:M.Critical,message:"Cannot specify both baseUrl and environment options"}),null):t.baseURL!=null?this.context.ir.environments?.environments.type==="multipleBaseUrls"?null:S.functionArgument({label:"baseURL",value:S.Expression.escapedStringLiteral(t.baseURL)}):null}getRootClientAuthArgs({auth:t,snippet:e}){let r=[],s=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow(),m=e.auth;if(m==null)return r;switch(t.type){case"basic":if(m.type!=="basic"){this.context.errors.add({severity:M.Critical,message:this.context.newAuthMismatchError({auth:t,values:m}).message});break}r.push(S.functionArgument({label:t.username.camelCase.unsafeName,value:S.Expression.escapedStringLiteral(m.username)}),S.functionArgument({label:t.password.camelCase.unsafeName,value:S.Expression.escapedStringLiteral(m.password)}));break;case"bearer":if(m.type!=="bearer")return this.context.errors.add({severity:M.Critical,message:this.context.newAuthMismatchError({auth:t,values:m}).message}),r;r.push(S.functionArgument({label:t.token.camelCase.unsafeName,value:S.Expression.escapedStringLiteral(m.token)}));break;case"header":if(m.type!=="header")return this.context.errors.add({severity:M.Critical,message:this.context.newAuthMismatchError({auth:t,values:m}).message}),r;r.push(S.functionArgument({label:t.header.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert({fromSymbol:s,typeReference:t.header.typeReference,value:m.value})}));break;case"oauth":return m.type!=="oauth"&&this.context.errors.add({severity:M.Critical,message:this.context.newAuthMismatchError({auth:t,values:m}).message}),r;case"inferred":return m.type!=="inferred"&&this.context.errors.add({severity:M.Critical,message:this.context.newAuthMismatchError({auth:t,values:m}).message}),r;default:A(t)}return r}generateEndpointMethodCallStatement({endpoint:t,snippet:e}){return S.Statement.discardAssignment(this.generateEndpointMethodCallExpression({endpoint:t,snippet:e}))}generateEndpointMethodCallExpression({endpoint:t,snippet:e,additionalArguments:r=[]}){let m=[...this.getEndpointMethodArguments({endpoint:t,snippet:e}).filter(l=>!l.value.isNop()),...r];return S.Expression.try(S.Expression.await(S.Expression.methodCall({target:S.Expression.rawValue(ys),methodName:this.getEndpointMethodName({endpoint:t}),arguments_:m,multiline:m.length>1?!0:void 0})))}generateMainFunctionInvocationStatement(){return S.Statement.expressionStatement(S.Expression.try(S.Expression.await(S.Expression.functionCall({unsafeName:"main"}))))}getEndpointMethodName({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${`${t.declaration.fernFilepath.allParts.map(r=>r.camelCase.unsafeName).join(".")}`}.${t.declaration.name.camelCase.unsafeName}`:t.declaration.name.camelCase.unsafeName}getEndpointMethodArguments({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getEndpointMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getEndpointMethodArgsForBodyRequest({request:t.request,snippet:e});default:A(t.request)}}getEndpointMethodArgsForInlinedRequest({request:t,snippet:e}){let r=[];this.context.errors.scope(he.PathParameters);let s=[...this.context.ir.pathParameters??[],...t.pathParameters??[]],m=[];s.length>0&&m.push(...this.getEndpointMethodPathParameters({namedParameters:s,snippet:e})),this.context.errors.unscope(),r.push(...m),this.context.errors.scope(he.Headers);let l=[];t.headers!=null&&l.push(...this.getEndpointMethodHeaderParameters({namedParameters:t.headers,snippet:e})),this.context.errors.unscope(),r.push(...l),this.context.errors.scope(he.QueryParameters);let b=[];t.queryParameters!=null&&b.push(...this.getEndpointMethodQueryParameters({namedParameters:t.queryParameters,snippet:e})),this.context.errors.unscope(),r.push(...b),this.context.errors.scope(he.RequestBody);let v=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),t.body!=null&&(t.body.type==="referenced"?r.push(S.functionArgument({label:"request",value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.body.bodyType,value:e.requestBody})})):r.push(S.functionArgument({label:"request",value:this.getInlinedRequestArg({request:t,snippet:e,filePropertyInfo:v})}))),r}getEndpointMethodPathParameters({namedParameters:t,snippet:e}){return this.context.getExampleObjectProperties({parameters:t,snippetObject:e.pathParameters??{}}).map(r=>S.functionArgument({label:r.name.name.camelCase.unsafeName,value:this.renderPathParameterValueAsSwiftString({value:r.value})}))}renderPathParameterValueAsSwiftString({value:t}){return typeof t=="string"?S.Expression.escapedStringLiteral(t):typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?S.Expression.escapedStringLiteral(String(t)):t==null?S.Expression.nop():S.Expression.escapedStringLiteral(JSON.stringify(t))}getEndpointMethodQueryParameters({namedParameters:t,snippet:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();return this.context.getExampleObjectProperties({parameters:t,snippetObject:e.queryParameters??{}}).map(s=>S.functionArgument({label:s.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert({fromSymbol:r,typeReference:s.typeReference,value:s.value})}))}getEndpointMethodHeaderParameters({namedParameters:t,snippet:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow(),s=this.context.createReferencer(r);return this.context.getExampleObjectProperties({parameters:t,snippetObject:e.headers??{}}).filter(m=>{let l=this.resolveAliasTypeReference(m.typeReference),b=this.context.getSwiftTypeReferenceFromScope(l,r);return s.resolvesToTheSwiftType(b.nonOptional(),"String")}).map(m=>S.functionArgument({label:m.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert({fromSymbol:r,typeReference:m.typeReference,value:m.value})}))}resolveAliasTypeReference(t){if(t.type==="named"){let e=this.context.ir.types[t.value];if(e!=null&&e.type==="alias")return this.resolveAliasTypeReference(e.typeReference)}return t}getFilePropertyInfo({request:t,snippet:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[],orderedFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({fromSymbol:r,body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,filePropertyInfo:r}){this.context.errors.scope(he.RequestBody);let s=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:r}):[];this.context.errors.unscope();let m=s.filter(l=>!l.value.isNop());return S.Expression.contextualMethodCall({methodName:"init",arguments_:m,multiline:m.length>1?!0:void 0})}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"fileUpload":return r.orderedFields;case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:t,value:e})];default:A(t)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();return this.context.getExampleObjectProperties({parameters:t,snippetObject:e}).map(s=>S.functionArgument({label:s.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert({fromSymbol:r,typeReference:s.typeReference,value:s.value})}))}getReferencedRequestBodyPropertyObjectField({body:t,value:e}){return S.functionArgument({label:t.bodyKey.camelCase.unsafeName,value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})})}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({fromSymbol:r,typeReference:t.value,value:e});default:A(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:M.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),S.Expression.dataLiteral("data")):S.Expression.dataLiteral(t)}getEndpointMethodArgsForBodyRequest({request:t,snippet:e}){let r=[];this.context.errors.scope(he.PathParameters);let s=[...this.context.ir.pathParameters??[],...t.pathParameters??[]];if(s.length>0&&r.push(...this.getEndpointMethodPathParameters({namedParameters:s,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(he.RequestBody),t.body!=null){let m=this.getEndpointMethodBodyRequestArg({body:t.body,value:e.requestBody});m.value.isNop()||r.push(m)}return this.context.errors.unscope(),r}getEndpointMethodBodyRequestArg({body:t,value:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();switch(t.type){case"bytes":return S.functionArgument({label:"request",value:this.getBytesBodyRequestArg({value:e})});case"typeReference":return t.value.type==="optional"&&e==null?S.functionArgument({label:"request",value:S.Expression.nop()}):S.functionArgument({label:"request",value:this.context.dynamicTypeLiteralMapper.convert({fromSymbol:r,typeReference:t.value,value:e})});default:A(t)}}};var Jt=class extends pt{constructor({ir:t,config:e,options:r={}}){super(new Yt({ir:t,config:e,options:r}))}async generate(t,e={}){return super.generate(t,e)}generateSync(t,e={}){return super.generateSync(t,e)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new et({context:t})}};0&&(module.exports={DynamicSnippetsGenerator,EndpointSnippetGenerator});
27
+ `),e=e.replace(/\x00/g,""),e}};u();c();p();var ze=class extends B{constructor({accessLevel:e,indirect:r,name:s,conformances:m,cases:a,initializers:b,methods:v,nestedTypes:T,docs:I}){super();d(this,"name");d(this,"accessLevel");d(this,"indirect");d(this,"conformances");d(this,"cases");d(this,"initializers");d(this,"methods");d(this,"nestedTypes");d(this,"docs");this.name=s,this.indirect=r??!1,this.accessLevel=e,this.conformances=m??[],this.cases=a,this.initializers=b??[],this.methods=v??[],this.nestedTypes=T??[],this.docs=I}write(e){this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),this.indirect&&e.write("indirect "),e.write(`enum ${k(this.name)}`),this.conformances.forEach((r,s)=>{s===0?e.write(": "):s>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 "),e.write(k(r.unsafeName)),r.associatedValue!=null&&(e.write("("),r.associatedValue.forEach((s,m)=>{m>0&&e.write(", "),s.write(e)}),e.write(")")),e.newLine()}),this.initializers.length>0&&(e.newLine(),this.initializers.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),this.methods.length>0&&(e.newLine(),this.methods.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),this.nestedTypes.length>0&&(e.newLine(),this.nestedTypes.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()})),e.dedent(),e.write("}")}};u();c();p();var Ge=class extends B{constructor({accessLevel:e,name:r,conformances:s,cases:m,docs:a}){super();d(this,"name");d(this,"accessLevel");d(this,"conformances");d(this,"cases");d(this,"docs");this.name=r,this.accessLevel=e,this.conformances=s??[],this.cases=m,this.docs=a}write(e){if(this.docs!=null&&this.docs.write(e),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write(`enum ${k(this.name)}`),this.conformances.forEach((r,s)=>{s===0?e.write(": "):s>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 "),e.write(k(r.unsafeName)),r.rawValue!==r.unsafeName&&(e.write(" = "),e.write(`"${Dt(r.rawValue)}"`)),e.newLine()}),e.dedent(),e.write("}")}};u();c();p();var He=class extends B{constructor({name:e,conformances:r,initializers:s,computedProperties:m,methods:a,nestedTypes:b,docs:v}){super();d(this,"name");d(this,"conformances");d(this,"initializers");d(this,"computedProperties");d(this,"methods");d(this,"nestedTypes");d(this,"docs");this.name=e,this.conformances=r??[],this.initializers=s??[],this.computedProperties=m??[],this.methods=a??[],this.nestedTypes=b??[],this.docs=v}write(e){this.docs!=null&&this.docs.write(e),e.write(`extension ${$t(this.name)}`),this.conformances.forEach((r,s)=>{s===0?e.write(": "):s>0&&e.write(", "),e.write(r)}),e.write(" {"),this.initializers.length>0&&(e.newLine(),e.indent(),this.initializers.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),this.computedProperties.length>0&&(e.newLine(),e.indent(),this.computedProperties.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),this.methods.length>0&&(e.newLine(),e.indent(),this.methods.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),this.nestedTypes.length>0&&(e.newLine(),e.indent(),this.nestedTypes.forEach((r,s)=>{s>0&&e.newLine(),r.write(e),e.newLine()}),e.dedent()),e.write("}")}};u();c();p();var Ke=class extends B{constructor({label:e,value:r}){super();d(this,"label");d(this,"value");this.label=e,this.value=r}write(e){this.label!=null&&(e.write(this.label),e.write(": ")),this.value.write(e)}};u();c();p();var Ye=class extends B{constructor({argumentLabel:e,unsafeName:r,escaping:s,type:m,defaultValue:a,docsContent:b}){super();d(this,"argumentLabel");d(this,"unsafeName");d(this,"escaping");d(this,"type");d(this,"defaultValue");d(this,"docsContent");this.argumentLabel=e,this.unsafeName=r,this.escaping=s,this.type=m,this.defaultValue=a,this.docsContent=b}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))}};u();c();p();var Je=class extends B{constructor({accessLevel:e,convenience:r,failable:s,throws:m,parameters:a,body:b,multiline:v,docs:T}){super();d(this,"accessLevel");d(this,"convenience");d(this,"failable");d(this,"throws");d(this,"parameters");d(this,"body");d(this,"multiline");d(this,"docs");this.accessLevel=e,this.convenience=r,this.failable=s,this.throws=m,this.parameters=a??[],this.body=b??z.empty(),this.multiline=v,this.docs=T}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,s)=>{s>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)}};u();c();p();var qt=class i extends B{constructor({count:e=1}={}){super();d(this,"count");this.count=e}write(e){for(let r=0;r<this.count;r++)e.newLine()}static single(){return new i({count:1})}static double(){return new i({count:2})}static multiple(e){return new i({count:e})}};u();c();p();var Ze=class extends B{constructor({attributes:e,unsafeName:r,accessLevel:s,static_:m,parameters:a,async:b,throws:v,returnType:T,body:I,docs:C}){super();d(this,"attributes");d(this,"unsafeName");d(this,"accessLevel");d(this,"static_");d(this,"parameters");d(this,"async");d(this,"throws");d(this,"returnType");d(this,"body");d(this,"docs");this.attributes=e??[],this.unsafeName=r,this.accessLevel=s,this.static_=m,this.parameters=a??[],this.async=b,this.throws=v,this.returnType=T,this.body=I??z.empty(),this.docs=C}write(e){this.docs!=null&&this.docs.write(e),this.attributes.forEach(r=>{r.arguments?.length?pe.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(k(this.unsafeName)),e.write("("),this.parameters.forEach((r,s)=>{s>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)}};u();c();p();var Wt=class extends B{constructor(e){super();d(this,"internalPattern");this.internalPattern=e}write(e){this.internalPattern.type==="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(")")):A(this.internalPattern.type)}static enumCaseValueBinding(e){return new this({type:"enum-case-value-binding",...e})}};u();c();p();var Xe=class extends B{constructor({unsafeName:e,accessLevel:r,static_:s,declarationType:m,type:a,indirect:b,defaultValue:v,docs:T}){super();d(this,"unsafeName");d(this,"accessLevel");d(this,"static_");d(this,"declarationType");d(this,"type");d(this,"indirect");d(this,"defaultValue");d(this,"docs");this.unsafeName=e,this.accessLevel=r,this.static_=s,this.declarationType=m,this.type=a,this.indirect=b,this.defaultValue=v,this.docs=T}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(" "),e.write(k(this.unsafeName)),e.write(": "),this.type.write(e),this.defaultValue!=null&&(e.write(" = "),this.defaultValue.write(e))}};u();c();p();var ms={CaseIterable:"CaseIterable",Codable:"Codable",CodingKey:"CodingKey",CodingKeyRepresentable:"CodingKeyRepresentable",Decodable:"Decodable",Encodable:"Encodable",Equatable:"Equatable",Error:"Error",Hashable:"Hashable",Sendable:"Sendable",MultipartFormDataConvertible:"MultipartFormDataConvertible"};u();c();p();var Qe=class extends B{constructor({attributes:e,accessLevel:r,name:s,conformances:m,properties:a,initializers:b,methods:v,nestedTypes:T,docs:I}){super();d(this,"attributes");d(this,"name");d(this,"accessLevel");d(this,"conformances");d(this,"properties");d(this,"initializers");d(this,"methods");d(this,"nestedTypes");d(this,"docs");this.attributes=e??[],this.name=s,this.accessLevel=r,this.conformances=m??[],this.properties=a??[],this.initializers=b??[],this.methods=v??[],this.nestedTypes=T??[],this.docs=I}write(e){this.docs!=null&&this.docs.write(e),this.attributes.forEach(v=>{v.arguments?.length?pe.functionCall({unsafeName:`@${v.name}`,arguments_:v.arguments}).write(e):(e.write("@"),e.write(v.name)),e.write(" ")}),this.accessLevel!=null&&(e.write(this.accessLevel),e.write(" ")),e.write(`struct ${k(this.name)}`),this.conformances.forEach((v,T)=>{T===0?e.write(": "):T>0&&e.write(", "),e.write(v)}),e.write(" {"),e.newLine(),e.indent();let r=this.properties.length>0,s=this.initializers.length>0,m=this.methods.length>0,a=this.nestedTypes.length>0;this.properties.forEach(v=>{v.write(e),e.newLine()});let b=r;s&&(b&&e.newLine(),this.initializers.forEach((v,T)=>{T>0&&e.newLine(),v.write(e),e.newLine()}),b=!0),m&&(b&&e.newLine(),this.methods.forEach((v,T)=>{T>0&&e.newLine(),v.write(e),e.newLine()}),b=!0),a&&(b&&e.newLine(),this.nestedTypes.forEach((v,T)=>{T>0&&e.newLine(),v.write(e),e.newLine()})),e.dedent(),e.write("}")}};u();c();p();u();c();p();var Np={Http:{relativePathToDir:"Core/Networking",filenameWithoutExtension:"HTTP",symbols:[{name:"HTTP",shape:{type:"enum-container"}}]},MultipartFormData:{relativePathToDir:"Core/Networking",filenameWithoutExtension:"MultipartFormData",symbols:[{name:"MultipartFormData",shape:{type:"class"}}]},MultipartFormDataConvertible:{relativePathToDir:"Core/Networking",filenameWithoutExtension:"MultipartFormDataConvertible",symbols:[{name:"MultipartFormDataConvertible",shape:{type:"protocol"}}]},MultipartFormField:{relativePathToDir:"Core/Networking",filenameWithoutExtension:"MultipartFormField",symbols:[{name:"MultipartFormField",shape:{type:"enum-with-associated-values"}}]},QueryParameter:{relativePathToDir:"Core/Networking",filenameWithoutExtension:"QueryParameter",symbols:[{name:"QueryParameter",shape:{type:"enum-with-associated-values"}}]},DecoderPlusAdditionalProperties:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"Decoder+AdditionalProperties",symbols:[]},EncodableValue:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"EncodableValue",symbols:[{name:"EncodableValue",shape:{type:"struct"}}]},EncoderPlusAdditionalProperties:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"Encoder+AdditionalProperties",symbols:[]},JSONEncoderPlusEncodableValue:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"JSONEncoder+EncodableValue",symbols:[]},KeyedDecodingContainerPlusNullable:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"KeyedDecodingContainer+Nullable",symbols:[]},KeyedEncodingContainerPlusNullable:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"KeyedEncodingContainer+Nullable",symbols:[]},Serde:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"Serde",symbols:[{name:"Serde",shape:{type:"class"}}]},StringKey:{relativePathToDir:"Core/Serde",filenameWithoutExtension:"StringKey",symbols:[{name:"StringKey",shape:{type:"struct"}}]},DataPlusString:{relativePathToDir:"Core",filenameWithoutExtension:"Data+String",symbols:[]},StringPlusUrlEncoding:{relativePathToDir:"Core",filenameWithoutExtension:"String+URLEncoding",symbols:[]},CalendarDate:{relativePathToDir:"Public",filenameWithoutExtension:"CalendarDate",symbols:[{name:"CalendarDate",shape:{type:"struct"}}]},FormFile:{relativePathToDir:"Public",filenameWithoutExtension:"FormFile",symbols:[{name:"FormFile",shape:{type:"struct"}}]},HTTPError:{relativePathToDir:"Public",filenameWithoutExtension:"HTTPError",symbols:[{name:"HTTPError",shape:{type:"struct"}}]},Indirect:{relativePathToDir:"Public",filenameWithoutExtension:"Indirect",symbols:[{name:"Indirect",shape:{type:"class"}}]},JsonValue:{relativePathToDir:"Public",filenameWithoutExtension:"JSONValue",symbols:[{name:"JSONValue",shape:{type:"enum-with-associated-values"}}]},Networking:{relativePathToDir:"Public",filenameWithoutExtension:"Networking",symbols:[{name:"Networking",shape:{type:"enum-container"}}]},Nullable:{relativePathToDir:"Public",filenameWithoutExtension:"Nullable",symbols:[{name:"Nullable",shape:{type:"enum-with-associated-values"}}]},RequestOptions:{relativePathToDir:"Public",filenameWithoutExtension:"RequestOptions",symbols:[{name:"RequestOptions",shape:{type:"struct"}}]}};u();c();p();var R=class R{constructor(t,e,r){d(this,"id");d(this,"name");d(this,"shape");this.id=t,this.name=e,this.shape=r}static isSwiftSymbol(t){return R.SWIFT_SYMBOL_ID===t||t.startsWith(`${R.SWIFT_SYMBOL_ID}.`)}static isSwiftSymbolName(t){return t in R.swiftTypeSymbolsByName}static isFoundationSymbol(t){return R.FOUNDATION_SYMBOL_ID===t||t.startsWith(`${R.FOUNDATION_SYMBOL_ID}.`)}static isFoundationSymbolName(t){return t in R.foundationTypeSymbolsByName}static isCustomSymbol(t){return!R.isSwiftSymbol(t)&&!R.isFoundationSymbol(t)}static create(t,e,r){return new R(t,e,r)}static swiftType(t){return R.create(`${R.SWIFT_SYMBOL_ID}.${t}`,t,{type:"system"})}static foundationType(t){return R.create(`${R.FOUNDATION_SYMBOL_ID}.${t}`,t,{type:"system"})}get isSwiftSymbol(){return R.isSwiftSymbol(this.id)}get isFoundationSymbol(){return R.isFoundationSymbol(this.id)}get isCustomSymbol(){return R.isCustomSymbol(this.id)}};d(R,"SWIFT_SYMBOL_NAME","Swift"),d(R,"SWIFT_SYMBOL_ID",R.SWIFT_SYMBOL_NAME),d(R,"swiftTypeSymbolsByName",{String:R.swiftType("String"),Bool:R.swiftType("Bool"),Int:R.swiftType("Int"),Int64:R.swiftType("Int64"),UInt:R.swiftType("UInt"),UInt64:R.swiftType("UInt64"),Float:R.swiftType("Float"),Double:R.swiftType("Double"),Void:R.swiftType("Void"),Encoder:R.swiftType("Encoder"),Decoder:R.swiftType("Decoder"),Any:R.swiftType("Any")}),d(R,"swiftTypeSymbols",Object.values(R.swiftTypeSymbolsByName)),d(R,"FOUNDATION_SYMBOL_NAME","Foundation"),d(R,"FOUNDATION_SYMBOL_ID",R.FOUNDATION_SYMBOL_NAME),d(R,"foundationTypeSymbolsByName",{Data:R.foundationType("Data"),Date:R.foundationType("Date"),UUID:R.foundationType("UUID")}),d(R,"foundationTypeSymbols",Object.values(R.foundationTypeSymbolsByName));var q=R;u();c();p();u();c();p();u();c();p();u();c();p();var Vt=class{constructor(t,e){d(this,"id");d(this,"name");d(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)}},jt=class extends Vt{constructor(e,r){super(e,r);d(this,"kind","module");d(this,"imports");d(this,"parent",null);this.imports=[]}addImport(e){this.imports.push(e)}get qualifiedPath(){return[this.name]}get qualifiedName(){return this.name}},zt=class extends Vt{constructor(e,r,s){super(r,e);d(this,"kind","type");d(this,"shape");d(this,"parent");this.parent=null,this.shape=s}getNearestModuleAncestorOrThrow(){let e=this.parent;for(;e!==null&&e.kind!=="module";)e=e.parent;return Q(e,`No module ancestor found for type symbol '${this.id}'`),e}get qualifiedPath(){return[...this.parent?.qualifiedPath??[],this.name]}get qualifiedName(){return this.qualifiedPath.join(".")}};var yt=class{constructor(){d(this,"symbolsById",new Map)}createModuleSymbol({symbolId:t,symbolName:e}){this.validateSymbolNotExists(t);let r=new jt(t,e);return this.symbolsById.set(t,r),r}createTypeSymbol({symbolId:t,symbolName:e,shape:r}){this.validateSymbolNotExists(t);let s=new zt(e,t,r);return this.symbolsById.set(t,s),s}addImportRelation({clientSymbolId:t,importedSymbolId:e}){let r=this.getSymbolByIdOrThrow(t),s=this.getSymbolByIdOrThrow(e);if(r.kind!=="module"||s.kind!=="module")throw new Error(`Client module '${r.id}' and imported module '${s.id}' must both be module symbols.`);r.addImport(s)}nestSymbol({parentSymbolId:t,childSymbolId:e}){let r=this.getSymbolByIdOrThrow(t),s=this.getSymbolByIdOrThrow(e);r.addChild(s),s.parent=r}reference({fromSymbolId:t,targetSymbolId:e}){let r=this.getSymbolByIdOrThrow(t),s=this.getSymbolByIdOrThrow(e),m=s.qualifiedPath;for(let a=1;a<=m.length;a++){let b=m.slice(m.length-a);if(this.resolvePath(r,b)?.id===s.id)return b.join(".")}return s.qualifiedName}resolveReference({fromSymbolId:t,reference:e}){let r=this.getSymbolByIdOrThrow(t),s=e.split(".").filter(m=>m.length>0);return this.resolvePath(r,s)}resolvePath(t,e){let[r,...s]=e;if(r===void 0)return null;let m=this.resolveFirstSegment(t,r);if(m===null)return null;let a=m;for(let b=0;b<s.length;b++){let v=s[b];if(ne(v),a=a.getChildByName(v)??null,a===null)return null}return a}resolveFirstSegment(t,e){let r=t;for(;r!==null;){let a=r.getChildByName(e);if(a)return a;r=r.parent}let s=t.kind==="module"?t:t.getNearestModuleAncestorOrThrow();if(s.name===e)return s;for(let a of s.imports)if(a.name===e)return a;let m=null;for(let a of s.imports){let b=a.getChildByName(e);if(b){if(m!=null&&m.id!==b.id)return null;m=b}}return m}getSymbolByIdOrThrow(t){let e=this.symbolsById.get(t);return ne(e,`A symbol with the ID '${t}' was not found in the registry.`),e}getSymbolById(t){return this.symbolsById.get(t)??null}validateSymbolNotExists(t){if(this.symbolsById.has(t))throw new Error(`A symbol with the ID '${t}' already exists in the registry.`)}};var Tr=class i{constructor(t,e,r){d(this,"graph");d(this,"swiftSymbol");d(this,"foundationSymbol");d(this,"registeredSourceModule");d(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}=i.createGraph();return new i(t,e,r)}static createGraph(){let t=new yt,e=()=>{let a=t.createModuleSymbol({symbolId:q.SWIFT_SYMBOL_ID,symbolName:q.SWIFT_SYMBOL_NAME});return q.swiftTypeSymbols.forEach(b=>{let v=t.createTypeSymbol({symbolId:b.id,symbolName:b.name,shape:{type:"system"}});t.nestSymbol({parentSymbolId:a.id,childSymbolId:v.id})}),a},r=()=>{let a=t.createModuleSymbol({symbolId:q.FOUNDATION_SYMBOL_ID,symbolName:q.FOUNDATION_SYMBOL_NAME});return q.foundationTypeSymbols.forEach(b=>{let v=t.createTypeSymbol({symbolId:b.id,symbolName:b.name,shape:{type:"system"}});t.nestSymbol({parentSymbolId:a.id,childSymbolId:v.id})}),a},s=e(),m=r();return{graph:t,swiftSymbol:s,foundationSymbol:m}}getRegisteredSourceModuleSymbolOrThrow(){return Q(this.registeredSourceModule,"Module symbol not found."),q.create(this.registeredSourceModule.id,this.registeredSourceModule.name,{type:"other"})}getRegisteredTestModuleSymbolOrThrow(){return Q(this.registeredTestModule,"Module symbol not found."),q.create(this.registeredTestModule.id,this.registeredTestModule.name,{type:"other"})}getSymbolByIdOrThrow(t){let e=this.graph.getSymbolById(t);return Q(e,`Symbol with ID '${t}' not found in registry.`),q.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,q.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),Q(this.registeredSourceModule,"Cannot register a test module before registering a source module."),r.addImport(this.registeredSourceModule),this.registeredTestModule=r,q.create(r.id,r.name,{type:"other"})}registerSourceModuleType(t,e){Q(this.registeredSourceModule,"Cannot register a type before registering a module.");let r=this.inferSymbolIdForSourceModuleType(t),s=this.graph.createTypeSymbol({symbolId:r,symbolName:t,shape:e});return this.graph.nestSymbol({parentSymbolId:this.registeredSourceModule.id,childSymbolId:s.id}),q.create(s.id,s.name,e)}registerTestModuleType(t,e){Q(this.registeredTestModule,"Cannot register a type before registering a module.");let r=this.inferSymbolIdForTestModuleType(t),s=this.graph.createTypeSymbol({symbolId:r,symbolName:t,shape:e});return this.graph.nestSymbol({parentSymbolId:this.registeredTestModule.id,childSymbolId:s.id}),q.create(s.id,s.name,e)}registerNestedType({parentSymbol:t,symbolName:e,shape:r}){let s=typeof t=="string"?t:t.id,m=this.inferSymbolIdForNestedType(s,e),a=this.graph.createTypeSymbol({symbolId:m,symbolName:e,shape:r});return this.graph.nestSymbol({parentSymbolId:s,childSymbolId:a.id}),q.create(a.id,a.name,r)}reference({fromSymbol:t,toSymbol:e}){let r=typeof t=="string"?t:t.id,s=typeof e=="string"?e:e.id;return this.graph.reference({fromSymbolId:r,targetSymbolId:s})}resolveReference({fromSymbol:t,reference:e}){let r=typeof t=="string"?t:t.id,s=this.graph.resolveReference({fromSymbolId:r,reference:e});return s?q.create(s.id,s.name,s.kind==="type"?s.shape:{type:"other"}):null}inferSymbolIdForSourceModuleType(t){return Q(this.registeredSourceModule,"Cannot get symbol id for a type before registering a module."),`${this.registeredSourceModule.id}.${t}`}inferSymbolIdForTestModuleType(t){return Q(this.registeredTestModule,"Cannot get symbol id for a type before registering a module."),`${this.registeredTestModule.id}.${t}`}inferSymbolIdForNestedType(t,e){return`${t}.${e}`}};u();c();p();var Rp={ClientError:{relativePath:"",filenameWithoutExtension:i=>(ar(i.errorEnumName),i.errorEnumName)},HTTPClient:{relativePath:"Core/Networking",filenameWithoutExtension:()=>"HTTPClient"},ClientConfig:{relativePath:"Public",filenameWithoutExtension:()=>"ClientConfig"}};var Gt=class i extends B{constructor(e){super();d(this,"variant");this.variant=e}nonOptional(){return i.nonOptional(this)}nonNullable(){return i.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(q.isSwiftSymbolName(r.symbol)||q.isFoundationSymbolName(r.symbol)?r.symbol:$t(r.symbol));break;case"generic":{r.reference.write(e),r.arguments.length>0&&(e.write("<"),r.arguments.forEach((s,m)=>{s.write(e),m<r.arguments.length-1&&e.write(", ")}),e.write(">"));break}case"tuple":e.write("("),r.elements.forEach((s,m)=>{m>0&&e.write(", "),s.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:A(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,s)=>e.variant.type==="generic"&&e.variant.arguments[s]&&r.equals(e.variant.arguments[s]));case"tuple":return e.variant.type==="tuple"&&this.variant.elements.every((r,s)=>e.variant.type==="tuple"&&e.variant.elements[s]&&r.equals(e.variant.elements[s]));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:A(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"?i.nonOptional(e.variant.valueType):e}static nonNullable(e){return e.variant.type==="nullable"?i.nonNullable(e.variant.valueType):e}static unqualifiedToSwiftType(e){return i.symbol(e)}static unqualifiedToFoundationType(e){return i.symbol(e)}};function Ap(i){return new $e(i)}function Cp(i){return new z(i)}function Bp(i){return new qe(i)}function Lp(i){return new Ve(i)}function Fp(i){return new je(i)}function Mp(i){return new ze(i)}function Op(i){return new Ge(i)}function Pp(i){return new He(i)}function kp(i){return new Ke(i)}function Up(i){return new Ye(i)}function _p(i){return new Je(i)}function Dp(i){return new Ze(i)}function $p(i){return new Xe(i)}function qp(i){return new Qe(i)}u();c();p();function fs(i){return H(te(i))}u();c();p();var Ht=class{constructor({context:t}){d(this,"context");this.context=t}convert(t){let{fromSymbol:e,typeReference:r,value:s,as:m}=t;switch(r.type){case"list":return this.convertList({fromSymbol:e,list:r.value,value:s});case"literal":{if(r.value.type==="string")return S.Expression.enumCaseShorthand(Ae.generateEnumCaseLabel(r.value.value));if(r.value.type==="boolean")return S.Expression.boolLiteral(r.value.value);A(r.value);break}case"map":return this.convertMap({fromSymbol:e,map:r,value:s});case"named":{let a=this.context.resolveNamedType({typeId:r.value});return a==null?S.Expression.nop():this.convertNamed({fromSymbol:e,typeId:r.value,named:a,value:s,as:m})}case"nullable":return this.context.customConfig?.nullableAsOptional?this.convert({fromSymbol:e,typeReference:r.value,value:s,as:m}):this.convertNullable({fromSymbol:e,nullable:r,value:s,as:m});case"optional":return this.convert({fromSymbol:e,typeReference:r.value,value:s,as:m});case"primitive":return this.convertPrimitive({primitive:r.value,value:s,as:m});case"set":return s===void 0?S.Expression.nop():this.convertUnknown(s);case"unknown":return this.convertUnknown(s);default:A(r)}}convertList({fromSymbol:t,list:e,value:r}){return Array.isArray(r)?S.Expression.arrayLiteral({elements:r.map((s,m)=>{this.context.errors.scope({index:m});try{return this.convert({fromSymbol:t,typeReference:e,value:s})}finally{this.context.errors.unscope()}}),multiline:!0}):r==null?(this.context.errors.add({severity:M.Critical,message:`Expected array but got: ${typeof r}`}),S.Expression.nop()):this.convertList({fromSymbol:t,list:e,value:[r]})}convertMap({fromSymbol:t,map:e,value:r}){return typeof r!="object"||r==null?(this.context.errors.add({severity:M.Critical,message:`Expected object but got: ${r==null?"null":typeof r}`}),S.Expression.nop()):S.Expression.dictionaryLiteral({entries:Object.entries(r).map(([s,m])=>{this.context.errors.scope(s);try{return[this.convert({fromSymbol:t,typeReference:e.key,value:s,as:"mapKey"}),this.convert({fromSymbol:t,typeReference:e.value,value:m,as:"mapValue"})]}finally{this.context.errors.unscope()}}),multiline:!0})}convertNamed({fromSymbol:t,typeId:e,named:r,value:s,as:m}){switch(r.type){case"alias":return this.convert({fromSymbol:t,typeReference:r.typeReference,value:s,as:m});case"discriminatedUnion":{let a=this.context.nameRegistry.getSchemaTypeSymbolOrThrow(e);return this.convertDiscriminatedUnion({fromSymbol:t,unionSymbol:a,discriminatedUnion:r,value:s})}case"enum":return this.convertEnum({enum_:r,value:s});case"object":return this.convertObject({fromSymbol:t,typeId:e,object_:r,value:s});case"undiscriminatedUnion":{let a=this.context.nameRegistry.getSchemaTypeSymbolOrThrow(e);return this.convertUndiscriminatedUnion({fromSymbol:t,unionSymbol:a,undiscriminatedUnion:r,value:s})}default:A(r)}}convertNullable({fromSymbol:t,nullable:e,value:r,as:s}){return r==null?S.Expression.enumCaseShorthand("null"):S.Expression.contextualMethodCall({methodName:"value",arguments_:[S.functionArgument({value:this.convert({fromSymbol:t,typeReference:e.value,value:r,as:s})})]})}convertDiscriminatedUnion({fromSymbol:t,discriminatedUnion:e,unionSymbol:r,value:s}){let m=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:s});if(m==null)return S.Expression.nop();let a=m.singleDiscriminatedUnionType,b=Ft.sanitizeToCamelCase(a.discriminantValue.name.camelCase.unsafeName);switch(a.type){case"samePropertiesAsObject":{let v=this.context.resolveNamedType({typeId:a.typeId});if(v==null)return S.Expression.nop();let T=this.convertNamed({fromSymbol:t,typeId:a.typeId,named:v,value:m.value});return S.Expression.methodCall({target:S.Expression.reference(r.name),methodName:b,arguments_:[S.functionArgument({value:T})],multiline:!0})}case"singleProperty":try{this.context.errors.scope(a.discriminantValue.wireValue);let v=this.context.getRecord(m.value);if(v==null)return S.Expression.nop();let T=new Set((a.properties??[]).map(_=>_.name.wireValue)),I=Object.keys(v).find(_=>!T.has(_))??"value",C=this.convert({fromSymbol:t,typeReference:a.typeReference,value:v[I]});return S.Expression.methodCall({target:S.Expression.reference(r.name),methodName:b,arguments_:[S.functionArgument({value:C})],multiline:!0})}finally{this.context.errors.unscope()}case"noProperties":return S.Expression.memberAccess({target:S.Expression.reference(r.name),memberName:b});default:A(a)}}convertEnum({enum_:t,value:e}){let r=this.getEnumValue({enum_:t,value:e});return r==null?S.Expression.nop():S.Expression.enumCaseShorthand(r.name.camelCase.unsafeName)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:M.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let r=t.values.find(s=>s.wireValue===e);if(r==null){this.context.errors.add({severity:M.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return r}convertObject({fromSymbol:t,typeId:e,object_:r,value:s}){let m=this.context.nameRegistry.getSchemaTypeSymbolOrThrow(e),a=this.context.getExampleObjectProperties({parameters:r.properties,snippetObject:s}),b=new Map(a.map(T=>[T.name.wireValue,T])),v=r.properties.map(T=>{let I=b.get(T.name.wireValue);return I??(T.typeReference.type==="literal"?{name:T.name,typeReference:T.typeReference,value:void 0}:null)}).filter(T=>T!=null);return S.Expression.structInitialization({unsafeName:m.name,arguments_:v.map(T=>{let I=this.convert({fromSymbol:t,typeReference:T.typeReference,value:T.value});return I.isNop()?null:S.functionArgument({label:De(T.name.name.camelCase.unsafeName),value:I})}).filter(T=>T!=null),multiline:!0})}convertUndiscriminatedUnion({fromSymbol:t,unionSymbol:e,undiscriminatedUnion:r,value:s}){let m=this.findMatchingUndiscriminatedUnionType({fromSymbol:t,unionSymbol:e,undiscriminatedUnion:r,value:s});return m??S.Expression.nop()}findMatchingUndiscriminatedUnionType({fromSymbol:t,unionSymbol:e,undiscriminatedUnion:r,value:s}){let m=this.context.nameRegistry.getAllUndiscriminatedUnionVariantsOrThrow(e);for(let a of r.types){let b=this.context.errors.size();try{let v=this.convert({fromSymbol:t,typeReference:a,value:s}),T=this.context.getSwiftTypeReferenceFromScope(a,t),I=m.find(C=>C.swiftType.equals(T));if(I==null){this.context.errors.truncate(b);continue}return S.Expression.methodCall({target:S.Expression.reference(e.name),methodName:I.caseName,arguments_:[S.functionArgument({value:v})],multiline:!0})}catch{this.context.errors.truncate(b);continue}}this.context.errors.add({severity:M.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof s}" value`})}convertUnknown(t){switch(typeof t){case"boolean":return S.Expression.contextualMethodCall({methodName:"bool",arguments_:[S.functionArgument({value:S.Expression.boolLiteral(t)})]});case"string":return S.Expression.contextualMethodCall({methodName:"string",arguments_:[S.functionArgument({value:S.Expression.escapedStringLiteral(t)})]});case"number":return S.Expression.contextualMethodCall({methodName:"number",arguments_:[S.functionArgument({value:S.Expression.numberLiteral(t)})]});case"object":return t===null?S.Expression.enumCaseShorthand("null"):Array.isArray(t)?S.Expression.contextualMethodCall({methodName:"array",arguments_:[S.functionArgument({value:S.Expression.arrayLiteral({elements:t.map(e=>this.convertUnknown(e)),multiline:!0})})]}):S.Expression.contextualMethodCall({methodName:"object",arguments_:[S.functionArgument({value:S.Expression.dictionaryLiteral({entries:Object.entries(t).map(([e,r])=>[S.Expression.escapedStringLiteral(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 s=this.getValueAsNumber({value:e,as:r});return s==null?S.Expression.nop():S.Expression.numberLiteral(s)}case"BOOLEAN":{let s=this.getValueAsBoolean({value:e,as:r});return s==null?S.Expression.nop():S.Expression.boolLiteral(s)}case"STRING":{let s=this.context.getValueAsString({value:e});return s==null?S.Expression.nop():S.Expression.escapedStringLiteral(s)}case"DATE":{let s=this.context.getValueAsString({value:e});return s==null?S.Expression.nop():S.Expression.calendarDateLiteral(s)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let s=this.context.getValueAsString({value:e});if(s==null)return S.Expression.nop();let m=new Date(s).getTime(),a=Math.round(m/1e3),v=new Date(a*1e3).toISOString().replace(/\.\d{3}Z$/,"Z");return S.Expression.dateLiteral(v)}case"UUID":{let s=this.context.getValueAsString({value:e});return s==null?S.Expression.nop():S.Expression.uuidLiteral(s)}case"BASE_64":{let s=this.context.getValueAsString({value:e});return s==null?S.Expression.nop():S.Expression.escapedStringLiteral(s)}case"BIG_INTEGER":{let s=this.context.getValueAsString({value:e});return s==null?S.Expression.nop():S.Expression.escapedStringLiteral(s)}default:A(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:A(e)}})();return this.context.getValueAsBoolean({value:r})}};u();c();p();var Kt=class{constructor({context:t}){d(this,"context");this.context=t}getFilePropertyInfo({fromSymbol:t,body:e,value:r}){let s={fileFields:[],bodyPropertyFields:[],orderedFields:[]},m=this.context.getRecord(r)??{};for(let a of e.properties)switch(a.type){case"file":{let b=S.functionArgument({label:De(a.name.camelCase.unsafeName),value:this.getSingleFileProperty({property:a,record:m})});s.fileFields.push(b),s.orderedFields.push(b);break}case"fileArray":{let b=S.functionArgument({label:De(a.name.camelCase.unsafeName),value:this.getArrayFileProperty({property:a,record:m})});s.fileFields.push(b),s.orderedFields.push(b);break}case"bodyProperty":{let b=S.functionArgument({label:De(a.name.name.camelCase.unsafeName),value:this.getBodyProperty({fromSymbol:t,property:a,record:m})});s.bodyPropertyFields.push(b),s.orderedFields.push(b);break}default:A(a)}return s}getSingleFileProperty({property:t,record:e}){let r=this.context.getSingleFileValue({property:t,record:e});return S.Expression.contextualMethodCall({methodName:"init",arguments_:[S.functionArgument({label:"data",value:S.Expression.dataLiteral(r??"")})]})}getArrayFileProperty({property:t,record:e}){let r=this.context.getFileArrayValues({property:t,record:e});return S.Expression.arrayLiteral({elements:(r??[]).map(s=>S.Expression.contextualMethodCall({methodName:"init",arguments_:[S.functionArgument({label:"data",value:S.Expression.dataLiteral(s)})]})),multiline:!0})}getBodyProperty({fromSymbol:t,property:e,record:r}){let s=r[e.name.wireValue];return s==null?S.Expression.nop():this.context.dynamicTypeLiteralMapper.convert({fromSymbol:t,typeReference:e.typeReference,value:s})}};u();c();p();function ds({parentSymbol:i,registry:t,namedType:e,context:r}){ie(e,"type")._visit({object:s=>{Ir({parentSymbol:i,registry:t,properties:s.properties})},discriminatedUnion:s=>{Object.values(s.types).forEach(m=>{ie(m,"type")._visit({noProperties:K,samePropertiesAsObject:K,singleProperty:a=>{se({parentSymbol:i,registry:t,typeReference:a.typeReference})},_other:K})})},undiscriminatedUnion:s=>{s.types.forEach(m=>{se({parentSymbol:i,registry:t,typeReference:m})})},alias:K,enum:K,_other:K})}function Ir({parentSymbol:i,registry:t,properties:e}){e.forEach(r=>{se({parentSymbol:i,registry:t,typeReference:r.typeReference})})}function se({parentSymbol:i,registry:t,typeReference:e}){ie(e,"type")._visit({list:r=>{se({parentSymbol:i,registry:t,typeReference:r.value})},literal:r=>{ie(r.value,"type")._visit({string:s=>{t.registerNestedLiteralEnumSymbol({parentSymbol:i,literalValue:s.value})},boolean:K,_other:K})},map:r=>{se({parentSymbol:i,registry:t,typeReference:r.key}),se({parentSymbol:i,registry:t,typeReference:r.value})},named:K,nullable:r=>{se({parentSymbol:i,registry:t,typeReference:r.value})},optional:r=>{se({parentSymbol:i,registry:t,typeReference:r.value})},primitive:K,set:r=>{se({parentSymbol:i,registry:t,typeReference:r.value})},unknown:K,_other:K})}u();c();p();function hs({parentSymbol:i,registry:t,namedType:e,context:r}){if(e.type==="undiscriminatedUnion"){let s=e.types.map(m=>{let a=r.getSwiftTypeReferenceFromScope(m,i);return{swiftType:a,caseName:Ot.inferCaseNameForTypeReference(i,a,t),docsContent:void 0}});t.registerUndiscriminatedUnionVariants({parentSymbol:i,variants:s})}}var Yt=class i extends ft{constructor({ir:e,config:r,options:s,sharedNameRegistry:m}){super({ir:e,config:r,options:s});d(this,"ir");d(this,"customConfig");d(this,"dynamicTypeLiteralMapper");d(this,"filePropertyMapper");d(this,"nameRegistry");this.ir=e,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeLiteralMapper=new Ht({context:this}),this.filePropertyMapper=new Kt({context:this}),m!=null?this.nameRegistry=m:(this.nameRegistry=_t.create(),this.registerSourceSymbols(this.nameRegistry,e))}registerSourceSymbols(e,r){let s=fs(this.config.workspaceName),m=e.registerSourceModuleSymbol({configModuleName:this.customConfig?.moduleName,apiNamePascalCase:s,asIsSymbols:Object.values(S.SourceAsIsFileSpecs).flatMap(b=>b.symbols)});return e.registerRootClientSymbol({configClientClassName:this.customConfig?.clientClassName,registeredSourceModuleName:m.name}),lr(S.SourceTemplateFileSpecs).forEach(([b])=>{switch(b){case"ClientError":e.registerErrorEnumSymbol(m.name);break;case"HTTPClient":e.registerSourceStaticSymbol(b,{type:"class"});break;case"ClientConfig":e.registerSourceStaticSymbol(b,{type:"class"});break;default:A(b)}}),e.registerEnvironmentSymbol({configEnvironmentEnumName:this.customConfig?.environmentEnumName,registeredSourceModuleName:m.name}),Object.entries(r.types).map(([b,v])=>{let T=ie(v,"type")._visit({alias:()=>({type:"struct"}),enum:()=>({type:"enum-with-raw-values"}),object:()=>({type:"struct"}),discriminatedUnion:()=>({type:"enum-with-associated-values"}),undiscriminatedUnion:()=>({type:"enum-with-associated-values"}),_other:()=>({type:"other"})}),I=e.registerSchemaTypeSymbol(b,v.declaration.name.pascalCase.unsafeName,T);return{namedType:v,registeredSymbol:I}}).forEach(({namedType:b,registeredSymbol:v})=>{ds({parentSymbol:v,registry:e,namedType:b,context:this}),hs({parentSymbol:v,registry:e,namedType:b,context:this})}),e.registerRequestsContainerSymbol(),Object.entries(r.endpoints).forEach(([b,v])=>{if(v.request.type==="inlined"){if(v.request.body?.type==="properties"){let T=e.registerRequestTypeSymbol({endpointId:b,requestNamePascalCase:v.request.declaration.name.pascalCase.unsafeName});Ir({parentSymbol:T,registry:e,properties:v.request.body.value})}v.request.body?.type==="fileUpload"&&e.registerRequestTypeSymbol({endpointId:b,requestNamePascalCase:v.request.declaration.name.pascalCase.unsafeName}),v.request.queryParameters?.forEach(T=>{se({parentSymbol:m,registry:e,typeReference:T.typeReference})})}}),e}getNamedTypeOrThrow(e){let r=this.ir.types[e];return ne(r,`Type declaration with the id '${e}' not found`),r}getPropertiesOfDiscriminatedUnionVariant(e){let r=this.getNamedTypeOrThrow(e);return ie(r,"type")._visit({alias:()=>[],enum:()=>[],object:s=>s.properties,discriminatedUnion:()=>[],undiscriminatedUnion:()=>[],_other:()=>[]})}getSwiftTypeReferenceFromScope(e,r){let s=this.createReferencer(r);return ie(e,"type")._visit({list:m=>S.TypeReference.array(this.getSwiftTypeReferenceFromScope(m.value,r)),literal:m=>ie(m.value,"type")._visit({boolean:()=>s.referenceSwiftType("Bool"),string:a=>{let b=this.nameRegistry.getNestedLiteralEnumSymbol(r,a.value);return b==null?s.referenceAsIsType("JSONValue"):s.referenceType(b)},_other:()=>s.referenceAsIsType("JSONValue")}),map:m=>S.TypeReference.dictionary(this.getSwiftTypeReferenceFromScope(m.key,r),this.getSwiftTypeReferenceFromScope(m.value,r)),named:m=>{let a=this.nameRegistry.getSchemaTypeSymbolOrThrow(m.value),b=this.nameRegistry.reference({fromSymbol:r,toSymbol:a});return S.TypeReference.symbol(b)},nullable:m=>this.customConfig?.nullableAsOptional?S.TypeReference.optional(this.getSwiftTypeReferenceFromScope(m.value,r)):S.TypeReference.nullable(this.getSwiftTypeReferenceFromScope(m.value,r)),optional:m=>S.TypeReference.optional(this.getSwiftTypeReferenceFromScope(m.value,r)),primitive:m=>ie(m,"value")._visit({STRING:()=>s.referenceSwiftType("String"),BOOLEAN:()=>s.referenceSwiftType("Bool"),INTEGER:()=>s.referenceSwiftType("Int"),UINT:()=>s.referenceSwiftType("UInt"),UINT_64:()=>s.referenceSwiftType("UInt64"),LONG:()=>s.referenceSwiftType("Int64"),FLOAT:()=>s.referenceSwiftType("Float"),DOUBLE:()=>s.referenceSwiftType("Double"),BIG_INTEGER:()=>s.referenceSwiftType("String"),DATE:()=>s.referenceAsIsType("CalendarDate"),DATE_TIME:()=>s.referenceFoundationType("Date"),DATE_TIME_RFC_2822:()=>s.referenceFoundationType("Date"),BASE_64:()=>s.referenceSwiftType("String"),UUID:()=>s.referenceFoundationType("UUID"),_other:()=>s.referenceAsIsType("JSONValue")}),set:()=>s.referenceAsIsType("JSONValue"),unknown:()=>s.referenceAsIsType("JSONValue"),_other:()=>s.referenceAsIsType("JSONValue")})}createReferencer(e){return new Mt(this.nameRegistry,e)}clone(){return new i({ir:this.ir,config:this.config,options:this.options,sharedNameRegistry:this.nameRegistry})}};u();c();p();var ys="client",et=class{constructor({context:t}){d(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e,options:r}){return this.buildCodeBlock({endpoint:t,snippetRequest:e,options:r})}generateSnippetSync({endpoint:t,request:e,options:r}){return this.buildCodeBlock({endpoint:t,snippetRequest:e,options:r})}async generateSnippetAst({endpoint:t,request:e,options:r}){throw new Error("Unsupported")}buildCodeBlock({endpoint:t,snippetRequest:e,options:r}){return[this.generateImportFoundationStatement(),this.generateImportModuleStatement(),S.LineBreak.single(),this.generateMainFunctionDeclarationWithEndpointSnippet({endpoint:t,snippet:e}),S.LineBreak.single(),this.generateMainFunctionInvocationStatement()].map(m=>m.toString()).join("")}generateImportFoundationStatement(){return S.Statement.import("Foundation")}generateImportModuleStatement(){let t=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();return S.Statement.import(t.name)}generateMainFunctionDeclarationWithEndpointSnippet({endpoint:t,snippet:e}){return S.Statement.functionDeclaration({unsafeName:"main",accessLevel:"private",async:!0,throws:!0,body:S.CodeBlock.withStatements([this.generateRootClientInitializationStatement({auth:t.auth,snippet:e}),S.LineBreak.single(),this.generateEndpointMethodCallStatement({endpoint:t,snippet:e})])})}generateRootClientInitializationStatement({auth:t,snippet:e,additionalArgs:r=[]}){let s=[],m=this.getRootClientBaseURLArg({snippet:e});m!=null&&s.push(m);let a=t?this.getRootClientAuthArgs({auth:t,snippet:e}):[];s.push(...a),this.context.ir.headers!=null&&e.headers!=null&&s.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:e.headers})),s.push(...r);let b=s.filter(T=>!T.value.isNop()),v=this.context.nameRegistry.getRootClientSymbolOrThrow();return S.Statement.constantDeclaration({unsafeName:ys,value:S.Expression.classInitialization({unsafeName:v.name,arguments_:b,multiline:b.length>1?!0:void 0})})}getRootClientHeaderArgs({headers:t,values:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow(),s=[];for(let m of t){let a=e[m.name.wireValue],b=this.getRootClientHeaderArg({moduleSymbol:r,header:m,value:a});b!=null&&s.push(b)}return s}getRootClientHeaderArg({moduleSymbol:t,header:e,value:r}){if(e.typeReference.type==="literal")return;let s=this.context.dynamicTypeLiteralMapper.convert({fromSymbol:t,typeReference:e.typeReference,value:r});if(!s.isNop())return S.functionArgument({label:e.name.name.camelCase.unsafeName,value:s})}getRootClientBaseURLArg({snippet:t}){return t.baseURL!=null&&t.environment!=null?(this.context.errors.add({severity:M.Critical,message:"Cannot specify both baseUrl and environment options"}),null):t.baseURL!=null?this.context.ir.environments?.environments.type==="multipleBaseUrls"?null:S.functionArgument({label:"baseURL",value:S.Expression.escapedStringLiteral(t.baseURL)}):null}getRootClientAuthArgs({auth:t,snippet:e}){let r=[],s=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow(),m=e.auth;if(m==null)return r;switch(t.type){case"basic":if(m.type!=="basic"){this.context.errors.add({severity:M.Critical,message:this.context.newAuthMismatchError({auth:t,values:m}).message});break}r.push(S.functionArgument({label:t.username.camelCase.unsafeName,value:S.Expression.escapedStringLiteral(m.username)}),S.functionArgument({label:t.password.camelCase.unsafeName,value:S.Expression.escapedStringLiteral(m.password)}));break;case"bearer":if(m.type!=="bearer")return this.context.errors.add({severity:M.Critical,message:this.context.newAuthMismatchError({auth:t,values:m}).message}),r;r.push(S.functionArgument({label:t.token.camelCase.unsafeName,value:S.Expression.escapedStringLiteral(m.token)}));break;case"header":if(m.type!=="header")return this.context.errors.add({severity:M.Critical,message:this.context.newAuthMismatchError({auth:t,values:m}).message}),r;r.push(S.functionArgument({label:t.header.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert({fromSymbol:s,typeReference:t.header.typeReference,value:m.value})}));break;case"oauth":return m.type!=="oauth"&&this.context.errors.add({severity:M.Critical,message:this.context.newAuthMismatchError({auth:t,values:m}).message}),r;case"inferred":return m.type!=="inferred"&&this.context.errors.add({severity:M.Critical,message:this.context.newAuthMismatchError({auth:t,values:m}).message}),r;default:A(t)}return r}generateEndpointMethodCallStatement({endpoint:t,snippet:e}){return S.Statement.discardAssignment(this.generateEndpointMethodCallExpression({endpoint:t,snippet:e}))}generateEndpointMethodCallExpression({endpoint:t,snippet:e,additionalArguments:r=[]}){let m=[...this.getEndpointMethodArguments({endpoint:t,snippet:e}).filter(a=>!a.value.isNop()),...r];return S.Expression.try(S.Expression.await(S.Expression.methodCall({target:S.Expression.rawValue(ys),methodName:this.getEndpointMethodName({endpoint:t}),arguments_:m,multiline:m.length>1?!0:void 0})))}generateMainFunctionInvocationStatement(){return S.Statement.expressionStatement(S.Expression.try(S.Expression.await(S.Expression.functionCall({unsafeName:"main"}))))}getEndpointMethodName({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${`${t.declaration.fernFilepath.allParts.map(r=>r.camelCase.unsafeName).join(".")}`}.${t.declaration.name.camelCase.unsafeName}`:t.declaration.name.camelCase.unsafeName}getEndpointMethodArguments({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getEndpointMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getEndpointMethodArgsForBodyRequest({request:t.request,snippet:e});default:A(t.request)}}getEndpointMethodArgsForInlinedRequest({request:t,snippet:e}){let r=[];this.context.errors.scope(he.PathParameters);let s=[...this.context.ir.pathParameters??[],...t.pathParameters??[]],m=[];s.length>0&&m.push(...this.getEndpointMethodPathParameters({namedParameters:s,snippet:e})),this.context.errors.unscope(),r.push(...m),this.context.errors.scope(he.Headers);let a=[];t.headers!=null&&a.push(...this.getEndpointMethodHeaderParameters({namedParameters:t.headers,snippet:e})),this.context.errors.unscope(),r.push(...a),this.context.errors.scope(he.QueryParameters);let b=[];t.queryParameters!=null&&b.push(...this.getEndpointMethodQueryParameters({namedParameters:t.queryParameters,snippet:e})),this.context.errors.unscope(),r.push(...b),this.context.errors.scope(he.RequestBody);let v=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),t.body!=null&&(t.body.type==="referenced"?r.push(S.functionArgument({label:"request",value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.body.bodyType,value:e.requestBody})})):r.push(S.functionArgument({label:"request",value:this.getInlinedRequestArg({request:t,snippet:e,filePropertyInfo:v})}))),r}getEndpointMethodPathParameters({namedParameters:t,snippet:e}){return this.context.associateByWireValueOrDefault({parameters:t,values:e.pathParameters??{}}).map(r=>S.functionArgument({label:r.name.name.camelCase.unsafeName,value:this.renderPathParameterValueAsSwiftString({value:r.value})}))}renderPathParameterValueAsSwiftString({value:t}){return typeof t=="string"?S.Expression.escapedStringLiteral(t):typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?S.Expression.escapedStringLiteral(String(t)):t==null?S.Expression.nop():S.Expression.escapedStringLiteral(JSON.stringify(t))}getEndpointMethodQueryParameters({namedParameters:t,snippet:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();return this.context.getExampleObjectProperties({parameters:t,snippetObject:e.queryParameters??{}}).map(s=>S.functionArgument({label:s.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert({fromSymbol:r,typeReference:s.typeReference,value:s.value})}))}getEndpointMethodHeaderParameters({namedParameters:t,snippet:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow(),s=this.context.createReferencer(r);return this.context.getExampleObjectProperties({parameters:t,snippetObject:e.headers??{}}).filter(m=>{let a=this.resolveAliasTypeReference(m.typeReference),b=this.context.getSwiftTypeReferenceFromScope(a,r);return s.resolvesToTheSwiftType(b.nonOptional(),"String")}).map(m=>S.functionArgument({label:m.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert({fromSymbol:r,typeReference:m.typeReference,value:m.value})}))}resolveAliasTypeReference(t){if(t.type==="named"){let e=this.context.ir.types[t.value];if(e!=null&&e.type==="alias")return this.resolveAliasTypeReference(e.typeReference)}return t}getFilePropertyInfo({request:t,snippet:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[],orderedFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({fromSymbol:r,body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,filePropertyInfo:r}){this.context.errors.scope(he.RequestBody);let s=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:r}):[];this.context.errors.unscope();let m=s.filter(a=>!a.value.isNop());return S.Expression.contextualMethodCall({methodName:"init",arguments_:m,multiline:m.length>1?!0:void 0})}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"fileUpload":return r.orderedFields;case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:t,value:e})];default:A(t)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();return this.context.getExampleObjectProperties({parameters:t,snippetObject:e}).map(s=>S.functionArgument({label:s.name.name.camelCase.unsafeName,value:this.context.dynamicTypeLiteralMapper.convert({fromSymbol:r,typeReference:s.typeReference,value:s.value})}))}getReferencedRequestBodyPropertyObjectField({body:t,value:e}){return S.functionArgument({label:t.bodyKey.camelCase.unsafeName,value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})})}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({fromSymbol:r,typeReference:t.value,value:e});default:A(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:M.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),S.Expression.dataLiteral("data")):S.Expression.dataLiteral(t)}getEndpointMethodArgsForBodyRequest({request:t,snippet:e}){let r=[];this.context.errors.scope(he.PathParameters);let s=[...this.context.ir.pathParameters??[],...t.pathParameters??[]];if(s.length>0&&r.push(...this.getEndpointMethodPathParameters({namedParameters:s,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(he.RequestBody),t.body!=null){let m=this.getEndpointMethodBodyRequestArg({body:t.body,value:e.requestBody});m.value.isNop()||r.push(m)}return this.context.errors.unscope(),r}getEndpointMethodBodyRequestArg({body:t,value:e}){let r=this.context.nameRegistry.getRegisteredSourceModuleSymbolOrThrow();switch(t.type){case"bytes":return S.functionArgument({label:"request",value:this.getBytesBodyRequestArg({value:e})});case"typeReference":return t.value.type==="optional"&&e==null?S.functionArgument({label:"request",value:S.Expression.nop()}):S.functionArgument({label:"request",value:this.context.dynamicTypeLiteralMapper.convert({fromSymbol:r,typeReference:t.value,value:e})});default:A(t)}}};var Jt=class extends pt{constructor({ir:t,config:e,options:r={}}){super(new Yt({ir:t,config:e,options:r}))}async generate(t,e={}){return super.generate(t,e)}generateSync(t,e={}){return super.generateSync(t,e)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new et({context:t})}};0&&(module.exports={DynamicSnippetsGenerator,EndpointSnippetGenerator});
26
28
  /*! Bundled license information:
27
29
 
28
30
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js: