@fern-api/php-dynamic-snippets 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +16 -15
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
  4. package/cjs/EndpointSnippetGenerator.cjs +27 -15
  5. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  6. package/cjs/EndpointSnippetGenerator.d.cts +2 -0
  7. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +15 -14
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
  9. package/cjs/context/DynamicTypeLiteralMapper.cjs +26 -14
  10. package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -0
  11. package/cjs/context/FilePropertyMapper.cjs +26 -14
  12. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  13. package/cjs/index.cjs +28 -27
  14. package/cjs/index.cjs.map +1 -0
  15. package/cjs/index.d.cts +1 -1
  16. package/esm/DynamicSnippetsGenerator.d.ts +1 -1
  17. package/esm/DynamicSnippetsGenerator.js +2 -1
  18. package/esm/DynamicSnippetsGenerator.js.map +1 -0
  19. package/esm/EndpointSnippetGenerator.d.ts +2 -0
  20. package/esm/EndpointSnippetGenerator.js +2 -1
  21. package/esm/EndpointSnippetGenerator.js.map +1 -0
  22. package/esm/{chunk-KF5FVQY4.js → chunk-625QSFAH.js} +2 -1
  23. package/esm/chunk-625QSFAH.js.map +1 -0
  24. package/esm/chunk-7MI6WLZG.js +2 -0
  25. package/esm/chunk-7MI6WLZG.js.map +1 -0
  26. package/esm/chunk-BYNT7UJT.js +2 -0
  27. package/esm/chunk-BYNT7UJT.js.map +1 -0
  28. package/esm/chunk-J4Y3S6QS.js +40 -0
  29. package/esm/chunk-J4Y3S6QS.js.map +1 -0
  30. package/esm/{chunk-OBW623PQ.js → chunk-KU3OGJUU.js} +2 -1
  31. package/esm/chunk-KU3OGJUU.js.map +1 -0
  32. package/esm/chunk-YKXTGZL6.js +4 -0
  33. package/esm/chunk-YKXTGZL6.js.map +1 -0
  34. package/esm/chunk-ZYT6M32A.js +2 -0
  35. package/esm/chunk-ZYT6M32A.js.map +1 -0
  36. package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
  37. package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
  38. package/esm/context/DynamicTypeLiteralMapper.js +2 -1
  39. package/esm/context/DynamicTypeLiteralMapper.js.map +1 -0
  40. package/esm/context/FilePropertyMapper.js +2 -1
  41. package/esm/context/FilePropertyMapper.js.map +1 -0
  42. package/esm/index.d.ts +1 -1
  43. package/esm/index.js +12 -11
  44. package/esm/index.js.map +1 -0
  45. package/package.json +1 -1
  46. package/esm/chunk-4GDAMWPH.js +0 -1
  47. package/esm/chunk-LVYU2VDV.js +0 -28
  48. package/esm/chunk-MKUTGATJ.js +0 -1
  49. package/esm/chunk-RLJ7N42G.js +0 -3
  50. package/esm/chunk-TSABAZOR.js +0 -14
@@ -1,21 +1,21 @@
1
- "use strict";var me=Object.defineProperty,ft=Object.defineProperties,ht=Object.getOwnPropertyDescriptor,mt=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertyNames,Se=Object.getOwnPropertySymbols;var _e=Object.prototype.hasOwnProperty,yt=Object.prototype.propertyIsEnumerable;var Ee=(n,t,e)=>t in n?me(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ue=(n,t)=>{for(var e in t||(t={}))_e.call(t,e)&&Ee(n,e,t[e]);if(Se)for(var e of Se(t))yt.call(t,e)&&Ee(n,e,t[e]);return n},le=(n,t)=>ft(n,mt(t));var Le=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ue=(n,t)=>{for(var e in t)me(n,e,{get:t[e],enumerable:!0})},wt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dt(t))!_e.call(n,i)&&i!==e&&me(n,i,{get:()=>t[i],enumerable:!(r=ht(t,i))||r.enumerable});return n};var xt=n=>wt(me({},"__esModule",{value:!0}),n);var c=(n,t,e)=>Ee(n,typeof t!="symbol"?t+"":t,e);function Pe(){throw new Error("setTimeout has not been defined")}function Me(){throw new Error("clearTimeout has not been defined")}function De(n){if(V===setTimeout)return setTimeout(n,0);if((V===Pe||!V)&&setTimeout)return V=setTimeout,setTimeout(n,0);try{return V(n,0)}catch(t){try{return V.call(null,n,0)}catch(e){return V.call(this,n,0)}}}function Tt(n){if(W===clearTimeout)return clearTimeout(n);if((W===Me||!W)&&clearTimeout)return W=clearTimeout,clearTimeout(n);try{return W(n)}catch(t){try{return W.call(null,n)}catch(e){return W.call(this,n)}}}function gt(){!ae||!J||(ae=!1,J.length?B=J.concat(B):de=-1,B.length&&Fe())}function Fe(){if(!ae){var n=De(gt);ae=!0;for(var t=B.length;t;){for(J=B,B=[];++de<t;)J&&J[de].run();de=-1,t=B.length}J=null,ae=!1,Tt(n)}}function vt(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];B.push(new $e(n,t)),B.length===1&&!ae&&De(Fe)}function $e(n,t){this.fun=n,this.array=t}function H(){}function Ft(n){throw new Error("process.binding is not supported")}function $t(){return"/"}function Ot(n){throw new Error("process.chdir is not supported")}function Yt(){return 0}function Wt(n){var t=Vt.call(oe)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function zt(){var n=new Date,t=n-Gt;return t/1e3}var V,W,B,ae,J,de,At,Et,Lt,Nt,Rt,It,bt,Ct,kt,St,_t,Ut,Bt,Pt,Mt,Dt,oe,Vt,Gt,m,Be,l=Le(()=>{"use strict";V=Pe,W=Me;typeof globalThis.setTimeout=="function"&&(V=setTimeout);typeof globalThis.clearTimeout=="function"&&(W=clearTimeout);B=[],ae=!1,de=-1;$e.prototype.run=function(){this.fun.apply(null,this.array)};At="browser",Et="browser",Lt=!0,Nt={},Rt=[],It="",bt={},Ct={},kt={};St=H,_t=H,Ut=H,Bt=H,Pt=H,Mt=H,Dt=H;oe=globalThis.performance||{},Vt=oe.now||oe.mozNow||oe.msNow||oe.oNow||oe.webkitNow||function(){return new Date().getTime()};Gt=new Date;m={nextTick:vt,title:At,browser:Lt,env:Nt,argv:Rt,version:It,versions:bt,on:St,addListener:_t,once:Ut,off:Bt,removeListener:Pt,removeAllListeners:Mt,emit:Dt,binding:Ft,cwd:$t,chdir:Ot,umask:Yt,hrtime:Wt,platform:Et,release:Ct,config:kt,uptime:zt},Be={};Object.keys(Be).forEach(n=>{let t=n.split("."),e=m;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Be[n]:e=e[i]||(e[i]={})}})});function We(){Re=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)C[t]=n[t],N[n.charCodeAt(t)]=t;N[45]=62,N[95]=63}function qt(n){Re||We();var t,e,r,i,s,o,u=n.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=n[u-2]==="="?2:n[u-1]==="="?1:0,o=new jt(u*3/4-s),r=s>0?u-4:u;var f=0;for(t=0,e=0;t<r;t+=4,e+=3)i=N[n.charCodeAt(t)]<<18|N[n.charCodeAt(t+1)]<<12|N[n.charCodeAt(t+2)]<<6|N[n.charCodeAt(t+3)],o[f++]=i>>16&255,o[f++]=i>>8&255,o[f++]=i&255;return s===2?(i=N[n.charCodeAt(t)]<<2|N[n.charCodeAt(t+1)]>>4,o[f++]=i&255):s===1&&(i=N[n.charCodeAt(t)]<<10|N[n.charCodeAt(t+1)]<<4|N[n.charCodeAt(t+2)]>>2,o[f++]=i>>8&255,o[f++]=i&255),o}function Jt(n){return C[n>>18&63]+C[n>>12&63]+C[n>>6&63]+C[n&63]}function Ht(n,t,e){for(var r,i=[],s=t;s<e;s+=3)r=(n[s]<<16)+(n[s+1]<<8)+n[s+2],i.push(Jt(r));return i.join("")}function Oe(n){Re||We();for(var t,e=n.length,r=e%3,i="",s=[],o=16383,u=0,f=e-r;u<f;u+=o)s.push(Ht(n,u,u+o>f?f:u+o));return r===1?(t=n[e-1],i+=C[t>>2],i+=C[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=C[t>>10],i+=C[t>>4&63],i+=C[t<<2&63],i+="="),s.push(i),s.join("")}function ye(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function P(n,t){if(ye()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=a.prototype):(n===null&&(n=new a(t)),n.length=t),n}function a(n,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Ie(this,n)}return Ge(this,n,t,e)}function Ge(n,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Zt(n,t,e,r):typeof t=="string"?Xt(n,t,e):Kt(n,t)}function ze(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function Qt(n,t,e,r){return ze(t),t<=0?P(n,t):e!==void 0?typeof r=="string"?P(n,t).fill(e,r):P(n,t).fill(e):P(n,t)}function Ie(n,t){if(ze(t),n=P(n,t<0?0:be(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Xt(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=je(t,e)|0;n=P(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Ne(n,t){var e=t.length<0?0:be(t.length)|0;n=P(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Zt(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),a.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=a.prototype):n=Ne(n,t),n}function Kt(n,t){if(k(t)){var e=be(t.length)|0;return n=P(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||xr(t.length)?P(n,0):Ne(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ne(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function be(n){if(n>=ye())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ye().toString(16)+" bytes");return n|0}function k(n){return!!(n!=null&&n._isBuffer)}function je(n,t){if(k(n))return n.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var e=n.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return we(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Ke(n).length;default:if(r)return we(n).length;t=(""+t).toLowerCase(),r=!0}}function er(n,t,e){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return lr(this,t,e);case"utf8":case"utf-8":return He(this,t,e);case"ascii":return cr(this,t,e);case"latin1":case"binary":return ur(this,t,e);case"base64":return or(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function Q(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function qe(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,r)),k(t))return t.length===0?-1:Ye(n,t,e,r,i);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):Ye(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function Ye(n,t,e,r,i){var s=1,o=n.length,u=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;s=2,o/=2,u/=2,e/=2}function f(E,se){return s===1?E[se]:E.readUInt16BE(se*s)}var y;if(i){var w=-1;for(y=e;y<o;y++)if(f(n,y)===f(t,w===-1?0:y-w)){if(w===-1&&(w=y),y-w+1===u)return w*s}else w!==-1&&(y-=y-w),w=-1}else for(e+u>o&&(e=o-u),y=e;y>=0;y--){for(var x=!0,I=0;I<u;I++)if(f(n,y+I)!==f(t,I)){x=!1;break}if(x)return y}return-1}function tr(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var u=parseInt(t.substr(o*2,2),16);if(isNaN(u))return o;n[e+o]=u}return o}function rr(n,t,e,r){return ge(we(t,n.length-e),n,e,r)}function Je(n,t,e,r){return ge(yr(t),n,e,r)}function nr(n,t,e,r){return Je(n,t,e,r)}function ir(n,t,e,r){return ge(Ke(t),n,e,r)}function sr(n,t,e,r){return ge(wr(t,n.length-e),n,e,r)}function or(n,t,e){return t===0&&e===n.length?Oe(n):Oe(n.slice(t,e))}function He(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var s=n[i],o=null,u=s>239?4:s>223?3:s>191?2:1;if(i+u<=e){var f,y,w,x;switch(u){case 1:s<128&&(o=s);break;case 2:f=n[i+1],(f&192)===128&&(x=(s&31)<<6|f&63,x>127&&(o=x));break;case 3:f=n[i+1],y=n[i+2],(f&192)===128&&(y&192)===128&&(x=(s&15)<<12|(f&63)<<6|y&63,x>2047&&(x<55296||x>57343)&&(o=x));break;case 4:f=n[i+1],y=n[i+2],w=n[i+3],(f&192)===128&&(y&192)===128&&(w&192)===128&&(x=(s&15)<<18|(f&63)<<12|(y&63)<<6|w&63,x>65535&&x<1114112&&(o=x))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=u}return ar(r)}function ar(n){var t=n.length;if(t<=Ve)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Ve));return e}function cr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function ur(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function lr(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",s=t;s<e;++s)i+=dr(n[s]);return i}function pr(n,t,e){for(var r=n.slice(t,e),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+r[s+1]*256);return i}function T(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function A(n,t,e,r,i,s){if(!k(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function xe(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(n.length-e,2);i<s;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function Te(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(n.length-e,4);i<s;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function Qe(n,t,e,r,i,s){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Xe(n,t,e,r,i){return i||Qe(n,t,e,4,34028234663852886e22,-34028234663852886e22),tt(n,t,e,r,23,4),e+4}function Ze(n,t,e,r,i){return i||Qe(n,t,e,8,17976931348623157e292,-17976931348623157e292),tt(n,t,e,r,52,8),e+8}function hr(n){if(n=mr(n).replace(fr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function mr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function dr(n){return n<16?"0"+n.toString(16):n.toString(16)}function we(n,t){t=t||1/0;for(var e,r=n.length,i=null,s=[],o=0;o<r;++o){if(e=n.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function yr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function wr(n,t){for(var e,r,i,s=[],o=0;o<n.length&&!((t-=2)<0);++o)e=n.charCodeAt(o),r=e>>8,i=e%256,s.push(i),s.push(r);return s}function Ke(n){return qt(hr(n))}function ge(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function xr(n){return n!==n}function Tr(n){return n!=null&&(!!n._isBuffer||et(n)||gr(n))}function et(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function gr(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&et(n.slice(0,0))}function ve(n,t,e,r,i){var s,o,u=i*8-r-1,f=(1<<u)-1,y=f>>1,w=-7,x=e?i-1:0,I=e?-1:1,E=n[t+x];for(x+=I,s=E&(1<<-w)-1,E>>=-w,w+=u;w>0;s=s*256+n[t+x],x+=I,w-=8);for(o=s&(1<<-w)-1,s>>=-w,w+=r;w>0;o=o*256+n[t+x],x+=I,w-=8);if(s===0)s=1-y;else{if(s===f)return o?NaN:(E?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-y}return(E?-1:1)*o*Math.pow(2,s-r)}function tt(n,t,e,r,i,s){var o,u,f,y=s*8-i-1,w=(1<<y)-1,x=w>>1,I=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=r?0:s-1,se=r?1:-1,pt=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=w):(o=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+x>=1?t+=I/f:t+=I*Math.pow(2,1-x),t*f>=2&&(o++,f/=2),o+x>=w?(u=0,o=w):o+x>=1?(u=(t*f-1)*Math.pow(2,i),o=o+x):(u=t*Math.pow(2,x-1)*Math.pow(2,i),o=0));i>=8;n[e+E]=u&255,E+=se,u/=256,i-=8);for(o=o<<i|u,y+=i;y>0;n[e+E]=o&255,E+=se,o/=256,y-=8);n[e+E-se]|=pt*128}var C,N,jt,Re,Ve,fr,rt=Le(()=>{"use strict";l();p();C=[],N=[],jt=typeof Uint8Array!="undefined"?Uint8Array:Array,Re=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(n){return n.__proto__=a.prototype,n};a.from=function(n,t,e){return Ge(null,n,t,e)};a.kMaxLength=ye();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(n,t,e){return Qt(null,n,t,e)};a.allocUnsafe=function(n){return Ie(null,n)};a.allocUnsafeSlow=function(n){return Ie(null,n)};a.isBuffer=Tr;a.compare=function(t,e){if(!k(t)||!k(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,s=0,o=Math.min(r,i);s<o;++s)if(t[s]!==e[s]){r=t[s],i=e[s];break}return r<i?-1:i<r?1:0};a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),s=0;for(r=0;r<t.length;++r){var o=t[r];if(!k(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,s),s+=o.length}return i};a.byteLength=je;a.prototype._isBuffer=!0;a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Q(this,e,e+1);return this};a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Q(this,e,e+3),Q(this,e+1,e+2);return this};a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Q(this,e,e+7),Q(this,e+1,e+6),Q(this,e+2,e+5),Q(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?He(this,0,t):er.apply(this,arguments)};a.prototype.equals=function(t){if(!k(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,i,s){if(!k(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||r>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=r)return 0;if(i>=s)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,u=r-e,f=Math.min(o,u),y=this.slice(i,s),w=t.slice(e,r),x=0;x<f;++x)if(y[x]!==w[x]){o=y[x],u=w[x];break}return o<u?-1:u<o?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return qe(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return qe(this,t,e,r,!1)};a.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-e;if((r===void 0||r>s)&&(r=s),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return tr(this,t,e,r);case"utf8":case"utf-8":return rr(this,t,e,r);case"ascii":return Je(this,t,e,r);case"latin1":case"binary":return nr(this,t,e,r);case"base64":return ir(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sr(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ve=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var s=e-t;i=new a(s,void 0);for(var o=0;o<s;++o)i[o]=this[o+t]}return i};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return i};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};a.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||T(t,e,this.length);for(var i=e,s=1,o=this[t+--i];i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};a.prototype.readInt8=function(t,e){return e||T(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),ve(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),ve(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),ve(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),ve(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;A(this,t,e,r,s,0)}var o=1,u=0;for(this[e]=t&255;++u<r&&(o*=256);)this[e+u]=t/o&255;return e+r};a.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;A(this,t,e,r,s,0)}var o=r-1,u=1;for(this[e+o]=t&255;--o>=0&&(u*=256);)this[e+o]=t/u&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):xe(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):xe(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Te(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Te(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);A(this,t,e,r,s-1,-s)}var o=0,u=1,f=0;for(this[e]=t&255;++o<r&&(u*=256);)t<0&&f===0&&this[e+o-1]!==0&&(f=1),this[e+o]=(t/u>>0)-f&255;return e+r};a.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);A(this,t,e,r,s-1,-s)}var o=r-1,u=1,f=0;for(this[e+o]=t&255;--o>=0&&(u*=256);)t<0&&f===0&&this[e+o+1]!==0&&(f=1),this[e+o]=(t/u>>0)-f&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):xe(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):xe(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Te(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Te(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,r){return Xe(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return Xe(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return Ze(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return Ze(this,t,e,!1,r)};a.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var s=i-r,o;if(this===t&&r<e&&e<i)for(o=s-1;o>=0;--o)t[o+e]=this[o+r];else if(s<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s};a.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var s=t.charCodeAt(0);s<256&&(t=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var o;if(typeof t=="number")for(o=e;o<r;++o)this[o]=t;else{var u=k(t)?t:we(new a(t,i).toString()),f=u.length;for(o=0;o<r-e;++o)this[o+e]=u[o%f]}return this};fr=/[^+\/0-9A-Za-z-_]/g});var p=Le(()=>{"use strict";rt()});var Jr={};Ue(Jr,{DynamicTypeLiteralMapper:()=>ke});module.exports=xt(Jr);l();p();l();p();l();p();function R(n){throw new Error("Unexpected value: "+JSON.stringify(n))}l();p();l();p();var M=class{};l();p();l();p();var S=class extends M{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var vr=4,pe=class{constructor(){c(this,"buffer","");c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
2
- `),r=e?t.substring(0,t.length-1):t,i=this.getIndentString(),s=r.replaceAll(`
1
+ "use strict";var We=Object.defineProperty,Wn=Object.defineProperties,Yn=Object.getOwnPropertyDescriptor,Gn=Object.getOwnPropertyDescriptors,zn=Object.getOwnPropertyNames,Pt=Object.getOwnPropertySymbols;var Ut=Object.prototype.hasOwnProperty,qn=Object.prototype.propertyIsEnumerable;var xt=(r,t,e)=>t in r?We(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Pe=(r,t)=>{for(var e in t||(t={}))Ut.call(t,e)&&xt(r,e,t[e]);if(Pt)for(var e of Pt(t))qn.call(t,e)&&xt(r,e,t[e]);return r},Ue=(r,t)=>Wn(r,Gn(t));var yt=(r,t)=>()=>(r&&(t=r(r=0)),t);var Bt=(r,t)=>{for(var e in t)We(r,e,{get:t[e],enumerable:!0})},Vn=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zn(t))!Ut.call(r,i)&&i!==e&&We(r,i,{get:()=>t[i],enumerable:!(n=Yn(t,i))||n.enumerable});return r};var Hn=r=>Vn(We({},"__esModule",{value:!0}),r);var c=(r,t,e)=>xt(r,typeof t!="symbol"?t+"":t,e);function Mt(){throw new Error("setTimeout has not been defined")}function Dt(){throw new Error("clearTimeout has not been defined")}function Ft(r){if(ee===setTimeout)return setTimeout(r,0);if((ee===Mt||!ee)&&setTimeout)return ee=setTimeout,setTimeout(r,0);try{return ee(r,0)}catch(t){try{return ee.call(null,r,0)}catch(e){return ee.call(this,r,0)}}}function Kn(r){if(te===clearTimeout)return clearTimeout(r);if((te===Dt||!te)&&clearTimeout)return te=clearTimeout,clearTimeout(r);try{return te(r)}catch(t){try{return te.call(null,r)}catch(e){return te.call(this,r)}}}function Jn(){!Ie||!ce||(Ie=!1,ce.length?j=ce.concat(j):Ye=-1,j.length&&jt())}function jt(){if(!Ie){var r=Ft(Jn);Ie=!0;for(var t=j.length;t;){for(ce=j,j=[];++Ye<t;)ce&&ce[Ye].run();Ye=-1,t=j.length}ce=null,Ie=!1,Kn(r)}}function Qn(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];j.push(new $t(r,t)),j.length===1&&!Ie&&Ft(jt)}function $t(r,t){this.fun=r,this.array=t}function me(){}function di(r){throw new Error("process.binding is not supported")}function hi(){return"/"}function xi(r){throw new Error("process.chdir is not supported")}function yi(){return 0}function gi(r){var t=wi.call(Ee)*.001,e=Math.floor(t),n=Math.floor(t%1*1e9);return r&&(e=e-r[0],n=n-r[1],n<0&&(e--,n+=1e9)),[e,n]}function vi(){var r=new Date,t=r-Ti;return t/1e3}var ee,te,j,Ie,ce,Ye,Xn,Zn,ei,ti,ri,ni,ii,oi,ai,si,fi,pi,ui,li,ci,mi,Ee,wi,Ti,u,kt,a=yt(()=>{"use strict";ee=Mt,te=Dt;typeof globalThis.setTimeout=="function"&&(ee=setTimeout);typeof globalThis.clearTimeout=="function"&&(te=clearTimeout);j=[],Ie=!1,Ye=-1;$t.prototype.run=function(){this.fun.apply(null,this.array)};Xn="browser",Zn="browser",ei=!0,ti={},ri=[],ni="",ii={},oi={},ai={};si=me,fi=me,pi=me,ui=me,li=me,ci=me,mi=me;Ee=globalThis.performance||{},wi=Ee.now||Ee.mozNow||Ee.msNow||Ee.oNow||Ee.webkitNow||function(){return new Date().getTime()};Ti=new Date;u={nextTick:Qn,title:Xn,browser:ei,env:ti,argv:ri,version:ni,versions:ii,on:si,addListener:fi,once:pi,off:ui,removeListener:li,removeAllListeners:ci,emit:mi,binding:di,cwd:hi,chdir:xi,umask:yi,hrtime:gi,platform:Zn,release:oi,config:ai,uptime:vi},kt={};Object.keys(kt).forEach(r=>{let t=r.split("."),e=u;for(let n=0;n<t.length;n++){let i=t[n];n===t.length-1?e[i]=kt[r]:e=e[i]||(e[i]={})}})});function zt(){gt=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=r.length;t<e;++t)k[t]=r[t],R[r.charCodeAt(t)]=t;R[45]=62,R[95]=63}function bi(r){gt||zt();var t,e,n,i,o,p,l=r.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=r[l-2]==="="?2:r[l-1]==="="?1:0,p=new Ai(l*3/4-o),n=o>0?l-4:l;var m=0;for(t=0,e=0;t<n;t+=4,e+=3)i=R[r.charCodeAt(t)]<<18|R[r.charCodeAt(t+1)]<<12|R[r.charCodeAt(t+2)]<<6|R[r.charCodeAt(t+3)],p[m++]=i>>16&255,p[m++]=i>>8&255,p[m++]=i&255;return o===2?(i=R[r.charCodeAt(t)]<<2|R[r.charCodeAt(t+1)]>>4,p[m++]=i&255):o===1&&(i=R[r.charCodeAt(t)]<<10|R[r.charCodeAt(t+1)]<<4|R[r.charCodeAt(t+2)]>>2,p[m++]=i>>8&255,p[m++]=i&255),p}function _i(r){return k[r>>18&63]+k[r>>12&63]+k[r>>6&63]+k[r&63]}function Ei(r,t,e){for(var n,i=[],o=t;o<e;o+=3)n=(r[o]<<16)+(r[o+1]<<8)+r[o+2],i.push(_i(n));return i.join("")}function Wt(r){gt||zt();for(var t,e=r.length,n=e%3,i="",o=[],p=16383,l=0,m=e-n;l<m;l+=p)o.push(Ei(r,l,l+p>m?m:l+p));return n===1?(t=r[e-1],i+=k[t>>2],i+=k[t<<4&63],i+="=="):n===2&&(t=(r[e-2]<<8)+r[e-1],i+=k[t>>10],i+=k[t>>4&63],i+=k[t<<2&63],i+="="),o.push(i),o.join("")}function Ge(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function $(r,t){if(Ge()<t)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t),r.__proto__=f.prototype):(r===null&&(r=new f(t)),r.length=t),r}function f(r,t,e){if(!f.TYPED_ARRAY_SUPPORT&&!(this instanceof f))return new f(r,t,e);if(typeof r=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Tt(this,r)}return qt(this,r,t,e)}function qt(r,t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Ni(r,t,e,n):typeof t=="string"?Li(r,t,e):Si(r,t)}function Vt(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function Ii(r,t,e,n){return Vt(t),t<=0?$(r,t):e!==void 0?typeof n=="string"?$(r,t).fill(e,n):$(r,t).fill(e):$(r,t)}function Tt(r,t){if(Vt(t),r=$(r,t<0?0:vt(t)|0),!f.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)r[e]=0;return r}function Li(r,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!f.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Ht(t,e)|0;r=$(r,n);var i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function wt(r,t){var e=t.length<0?0:vt(t.length)|0;r=$(r,e);for(var n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Ni(r,t,e,n){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?t=new Uint8Array(t):n===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,n),f.TYPED_ARRAY_SUPPORT?(r=t,r.__proto__=f.prototype):r=wt(r,t),r}function Si(r,t){if(M(t)){var e=vt(t.length)|0;return r=$(r,e),r.length===0||t.copy(r,0,0,e),r}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||Hi(t.length)?$(r,0):wt(r,t);if(t.type==="Buffer"&&Array.isArray(t.data))return wt(r,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function vt(r){if(r>=Ge())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ge().toString(16)+" bytes");return r|0}function M(r){return!!(r!=null&&r._isBuffer)}function Ht(r,t){if(M(r))return r.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var e=r.length;if(e===0)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return ze(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return tr(r).length;default:if(n)return ze(r).length;t=(""+t).toLowerCase(),n=!0}}function Ci(r,t,e){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return ji(this,t,e);case"utf8":case"utf-8":return Qt(this,t,e);case"ascii":return Di(this,t,e);case"latin1":case"binary":return Fi(this,t,e);case"base64":return ki(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $i(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function de(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}function Kt(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=f.from(t,n)),M(t))return t.length===0?-1:Yt(r,t,e,n,i);if(typeof t=="number")return t=t&255,f.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Yt(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Yt(r,t,e,n,i){var o=1,p=r.length,l=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;o=2,p/=2,l/=2,e/=2}function m(v,A){return o===1?v[A]:v.readUInt16BE(A*o)}var d;if(i){var h=-1;for(d=e;d<p;d++)if(m(r,d)===m(t,h===-1?0:d-h)){if(h===-1&&(h=d),d-h+1===l)return h*o}else h!==-1&&(d-=d-h),h=-1}else for(e+l>p&&(e=p-l),d=e;d>=0;d--){for(var x=!0,g=0;g<l;g++)if(m(r,d+g)!==m(t,g)){x=!1;break}if(x)return d}return-1}function Ri(r,t,e,n){e=Number(e)||0;var i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var p=0;p<n;++p){var l=parseInt(t.substr(p*2,2),16);if(isNaN(l))return p;r[e+p]=l}return p}function Oi(r,t,e,n){return He(ze(t,r.length-e),r,e,n)}function Jt(r,t,e,n){return He(qi(t),r,e,n)}function Pi(r,t,e,n){return Jt(r,t,e,n)}function Ui(r,t,e,n){return He(tr(t),r,e,n)}function Bi(r,t,e,n){return He(Vi(t,r.length-e),r,e,n)}function ki(r,t,e){return t===0&&e===r.length?Wt(r):Wt(r.slice(t,e))}function Qt(r,t,e){e=Math.min(r.length,e);for(var n=[],i=t;i<e;){var o=r[i],p=null,l=o>239?4:o>223?3:o>191?2:1;if(i+l<=e){var m,d,h,x;switch(l){case 1:o<128&&(p=o);break;case 2:m=r[i+1],(m&192)===128&&(x=(o&31)<<6|m&63,x>127&&(p=x));break;case 3:m=r[i+1],d=r[i+2],(m&192)===128&&(d&192)===128&&(x=(o&15)<<12|(m&63)<<6|d&63,x>2047&&(x<55296||x>57343)&&(p=x));break;case 4:m=r[i+1],d=r[i+2],h=r[i+3],(m&192)===128&&(d&192)===128&&(h&192)===128&&(x=(o&15)<<18|(m&63)<<12|(d&63)<<6|h&63,x>65535&&x<1114112&&(p=x))}}p===null?(p=65533,l=1):p>65535&&(p-=65536,n.push(p>>>10&1023|55296),p=56320|p&1023),n.push(p),i+=l}return Mi(n)}function Mi(r){var t=r.length;if(t<=Gt)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=Gt));return e}function Di(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function Fi(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function ji(r,t,e){var n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=t;o<e;++o)i+=zi(r[o]);return i}function $i(r,t,e){for(var n=r.slice(t,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}function b(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}function L(r,t,e,n,i,o){if(!M(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}function qe(r,t,e,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(r.length-e,2);i<o;++i)r[e+i]=(t&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function Ve(r,t,e,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(r.length-e,4);i<o;++i)r[e+i]=t>>>(n?i:3-i)*8&255}function Xt(r,t,e,n,i,o){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Zt(r,t,e,n,i){return i||Xt(r,t,e,4,34028234663852886e22,-34028234663852886e22),nr(r,t,e,n,23,4),e+4}function er(r,t,e,n,i){return i||Xt(r,t,e,8,17976931348623157e292,-17976931348623157e292),nr(r,t,e,n,52,8),e+8}function Yi(r){if(r=Gi(r).replace(Wi,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Gi(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function zi(r){return r<16?"0"+r.toString(16):r.toString(16)}function ze(r,t){t=t||1/0;for(var e,n=r.length,i=null,o=[],p=0;p<n;++p){if(e=r.charCodeAt(p),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(p+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function qi(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function Vi(r,t){for(var e,n,i,o=[],p=0;p<r.length&&!((t-=2)<0);++p)e=r.charCodeAt(p),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function tr(r){return bi(Yi(r))}function He(r,t,e,n){for(var i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function Hi(r){return r!==r}function Ki(r){return r!=null&&(!!r._isBuffer||rr(r)||Ji(r))}function rr(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Ji(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&rr(r.slice(0,0))}function Ke(r,t,e,n,i){var o,p,l=i*8-n-1,m=(1<<l)-1,d=m>>1,h=-7,x=e?i-1:0,g=e?-1:1,v=r[t+x];for(x+=g,o=v&(1<<-h)-1,v>>=-h,h+=l;h>0;o=o*256+r[t+x],x+=g,h-=8);for(p=o&(1<<-h)-1,o>>=-h,h+=n;h>0;p=p*256+r[t+x],x+=g,h-=8);if(o===0)o=1-d;else{if(o===m)return p?NaN:(v?-1:1)*(1/0);p=p+Math.pow(2,n),o=o-d}return(v?-1:1)*p*Math.pow(2,o-n)}function nr(r,t,e,n,i,o){var p,l,m,d=o*8-i-1,h=(1<<d)-1,x=h>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:o-1,A=n?1:-1,N=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,p=h):(p=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-p))<1&&(p--,m*=2),p+x>=1?t+=g/m:t+=g*Math.pow(2,1-x),t*m>=2&&(p++,m/=2),p+x>=h?(l=0,p=h):p+x>=1?(l=(t*m-1)*Math.pow(2,i),p=p+x):(l=t*Math.pow(2,x-1)*Math.pow(2,i),p=0));i>=8;r[e+v]=l&255,v+=A,l/=256,i-=8);for(p=p<<i|l,d+=i;d>0;r[e+v]=p&255,v+=A,p/=256,d-=8);r[e+v-A]|=N*128}var k,R,Ai,gt,Gt,Wi,ir=yt(()=>{"use strict";a();s();k=[],R=[],Ai=typeof Uint8Array!="undefined"?Uint8Array:Array,gt=!1;f.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;f.poolSize=8192;f._augment=function(r){return r.__proto__=f.prototype,r};f.from=function(r,t,e){return qt(null,r,t,e)};f.kMaxLength=Ge();f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&f[Symbol.species]);f.alloc=function(r,t,e){return Ii(null,r,t,e)};f.allocUnsafe=function(r){return Tt(null,r)};f.allocUnsafeSlow=function(r){return Tt(null,r)};f.isBuffer=Ki;f.compare=function(t,e){if(!M(t)||!M(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,o=0,p=Math.min(n,i);o<p;++o)if(t[o]!==e[o]){n=t[o],i=e[o];break}return n<i?-1:i<n?1:0};f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};f.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return f.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=f.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var p=t[n];if(!M(p))throw new TypeError('"list" argument must be an Array of Buffers');p.copy(i,o),o+=p.length}return i};f.byteLength=Ht;f.prototype._isBuffer=!0;f.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)de(this,e,e+1);return this};f.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)de(this,e,e+3),de(this,e+1,e+2);return this};f.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)de(this,e,e+7),de(this,e+1,e+6),de(this,e+2,e+5),de(this,e+3,e+4);return this};f.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?Qt(this,0,t):Ci.apply(this,arguments)};f.prototype.equals=function(t){if(!M(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:f.compare(this,t)===0};f.prototype.compare=function(t,e,n,i,o){if(!M(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var p=o-i,l=n-e,m=Math.min(p,l),d=this.slice(i,o),h=t.slice(e,n),x=0;x<m;++x)if(d[x]!==h[x]){p=d[x],l=h[x];break}return p<l?-1:l<p?1:0};f.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};f.prototype.indexOf=function(t,e,n){return Kt(this,t,e,n,!0)};f.prototype.lastIndexOf=function(t,e,n){return Kt(this,t,e,n,!1)};f.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((n===void 0||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var p=!1;;)switch(i){case"hex":return Ri(this,t,e,n);case"utf8":case"utf-8":return Oi(this,t,e,n);case"ascii":return Jt(this,t,e,n);case"latin1":case"binary":return Pi(this,t,e,n);case"base64":return Ui(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bi(this,t,e,n);default:if(p)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),p=!0}};f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Gt=4096;f.prototype.slice=function(t,e){var n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var i;if(f.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=f.prototype;else{var o=e-t;i=new f(o,void 0);for(var p=0;p<o;++p)i[p]=this[p+t]}return i};f.prototype.readUIntLE=function(t,e,n){t=t|0,e=e|0,n||b(t,e,this.length);for(var i=this[t],o=1,p=0;++p<e&&(o*=256);)i+=this[t+p]*o;return i};f.prototype.readUIntBE=function(t,e,n){t=t|0,e=e|0,n||b(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};f.prototype.readUInt8=function(t,e){return e||b(t,1,this.length),this[t]};f.prototype.readUInt16LE=function(t,e){return e||b(t,2,this.length),this[t]|this[t+1]<<8};f.prototype.readUInt16BE=function(t,e){return e||b(t,2,this.length),this[t]<<8|this[t+1]};f.prototype.readUInt32LE=function(t,e){return e||b(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};f.prototype.readUInt32BE=function(t,e){return e||b(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};f.prototype.readIntLE=function(t,e,n){t=t|0,e=e|0,n||b(t,e,this.length);for(var i=this[t],o=1,p=0;++p<e&&(o*=256);)i+=this[t+p]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};f.prototype.readIntBE=function(t,e,n){t=t|0,e=e|0,n||b(t,e,this.length);for(var i=e,o=1,p=this[t+--i];i>0&&(o*=256);)p+=this[t+--i]*o;return o*=128,p>=o&&(p-=Math.pow(2,8*e)),p};f.prototype.readInt8=function(t,e){return e||b(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};f.prototype.readInt16LE=function(t,e){e||b(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};f.prototype.readInt16BE=function(t,e){e||b(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};f.prototype.readInt32LE=function(t,e){return e||b(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};f.prototype.readInt32BE=function(t,e){return e||b(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};f.prototype.readFloatLE=function(t,e){return e||b(t,4,this.length),Ke(this,t,!0,23,4)};f.prototype.readFloatBE=function(t,e){return e||b(t,4,this.length),Ke(this,t,!1,23,4)};f.prototype.readDoubleLE=function(t,e){return e||b(t,8,this.length),Ke(this,t,!0,52,8)};f.prototype.readDoubleBE=function(t,e){return e||b(t,8,this.length),Ke(this,t,!1,52,8)};f.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;L(this,t,e,n,o,0)}var p=1,l=0;for(this[e]=t&255;++l<n&&(p*=256);)this[e+l]=t/p&255;return e+n};f.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;L(this,t,e,n,o,0)}var p=n-1,l=1;for(this[e+p]=t&255;--p>=0&&(l*=256);)this[e+p]=t/l&255;return e+n};f.prototype.writeUInt8=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};f.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):qe(this,t,e,!0),e+2};f.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):qe(this,t,e,!1),e+2};f.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Ve(this,t,e,!0),e+4};f.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Ve(this,t,e,!1),e+4};f.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*n-1);L(this,t,e,n,o-1,-o)}var p=0,l=1,m=0;for(this[e]=t&255;++p<n&&(l*=256);)t<0&&m===0&&this[e+p-1]!==0&&(m=1),this[e+p]=(t/l>>0)-m&255;return e+n};f.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*n-1);L(this,t,e,n,o-1,-o)}var p=n-1,l=1,m=0;for(this[e+p]=t&255;--p>=0&&(l*=256);)t<0&&m===0&&this[e+p+1]!==0&&(m=1),this[e+p]=(t/l>>0)-m&255;return e+n};f.prototype.writeInt8=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};f.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):qe(this,t,e,!0),e+2};f.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):qe(this,t,e,!1),e+2};f.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Ve(this,t,e,!0),e+4};f.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e|0,n||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Ve(this,t,e,!1),e+4};f.prototype.writeFloatLE=function(t,e,n){return Zt(this,t,e,!0,n)};f.prototype.writeFloatBE=function(t,e,n){return Zt(this,t,e,!1,n)};f.prototype.writeDoubleLE=function(t,e,n){return er(this,t,e,!0,n)};f.prototype.writeDoubleBE=function(t,e,n){return er(this,t,e,!1,n)};f.prototype.copy=function(t,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);var o=i-n,p;if(this===t&&n<e&&e<i)for(p=o-1;p>=0;--p)t[p+e]=this[p+n];else if(o<1e3||!f.TYPED_ARRAY_SUPPORT)for(p=0;p<o;++p)t[p+e]=this[p+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o};f.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!f.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var p;if(typeof t=="number")for(p=e;p<n;++p)this[p]=t;else{var l=M(t)?t:ze(new f(t,i).toString()),m=l.length;for(p=0;p<n-e;++p)this[p+e]=l[p%m]}return this};Wi=/[^+\/0-9A-Za-z-_]/g});var s=yt(()=>{"use strict";ir()});var ep={};Bt(ep,{DynamicTypeLiteralMapper:()=>Rt});module.exports=Hn(ep);a();s();a();s();a();s();function S(r){throw new Error("Unexpected value: "+JSON.stringify(r))}a();s();a();s();a();s();a();s();a();s();var Qi=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,Je=Qi;var Xi=typeof self=="object"&&self&&self.Object===Object&&self,Zi=Je||Xi||Function("return this")(),_=Zi;var eo=_.Symbol,W=eo;a();s();var or=Object.prototype,to=or.hasOwnProperty,ro=or.toString,Be=W?W.toStringTag:void 0;function no(r){var t=to.call(r,Be),e=r[Be];try{r[Be]=void 0;var n=!0}catch(o){}var i=ro.call(r);return n&&(t?r[Be]=e:delete r[Be]),i}var ar=no;a();s();var io=Object.prototype,oo=io.toString;function ao(r){return oo.call(r)}var sr=ao;var so="[object Null]",fo="[object Undefined]",fr=W?W.toStringTag:void 0;function po(r){return r==null?r===void 0?fo:so:fr&&fr in Object(r)?ar(r):sr(r)}var Y=po;a();s();function uo(r){return r!=null&&typeof r=="object"}var G=uo;a();s();var lo=Array.isArray,he=lo;a();s();function co(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}var Qe=co;a();s();a();s();a();s();a();s();var mo="[object AsyncFunction]",ho="[object Function]",xo="[object GeneratorFunction]",yo="[object Proxy]";function wo(r){if(!Qe(r))return!1;var t=Y(r);return t==ho||t==xo||t==mo||t==yo}var Xe=wo;a();s();a();s();var go=_["__core-js_shared__"],Ze=go;var pr=(function(){var r=/[^.]+$/.exec(Ze&&Ze.keys&&Ze.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function To(r){return!!pr&&pr in r}var ur=To;a();s();var vo=Function.prototype,Ao=vo.toString;function bo(r){if(r!=null){try{return Ao.call(r)}catch(t){}try{return r+""}catch(t){}}return""}var z=bo;var _o=/[\\^$.*+?()[\]{}|]/g,Eo=/^\[object .+?Constructor\]$/,Io=Function.prototype,Lo=Object.prototype,No=Io.toString,So=Lo.hasOwnProperty,Co=RegExp("^"+No.call(So).replace(_o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ro(r){if(!Qe(r)||ur(r))return!1;var t=Xe(r)?Co:Eo;return t.test(z(r))}var lr=Ro;a();s();function Oo(r,t){return r==null?void 0:r[t]}var cr=Oo;function Po(r,t){var e=cr(r,t);return lr(e)?e:void 0}var O=Po;var Uo=O(_,"WeakMap"),et=Uo;a();s();function Bo(){}var mr=Bo;a();s();a();s();a();s();function ko(r,t,e,n){for(var i=r.length,o=e+(n?1:-1);n?o--:++o<i;)if(t(r[o],o,r))return o;return-1}var dr=ko;a();s();function Mo(r){return r!==r}var hr=Mo;a();s();function Do(r,t,e){for(var n=e-1,i=r.length;++n<i;)if(r[n]===t)return n;return-1}var xr=Do;function Fo(r,t,e){return t===t?xr(r,t,e):dr(r,hr,e)}var yr=Fo;function jo(r,t){var e=r==null?0:r.length;return!!e&&yr(r,t,0)>-1}var wr=jo;a();s();var $o=9007199254740991,Wo=/^(?:0|[1-9]\d*)$/;function Yo(r,t){var e=typeof r;return t=t==null?$o:t,!!t&&(e=="number"||e!="symbol"&&Wo.test(r))&&r>-1&&r%1==0&&r<t}var gr=Yo;a();s();function Go(r,t){return r===t||r!==r&&t!==t}var tt=Go;a();s();a();s();var zo=9007199254740991;function qo(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=zo}var rt=qo;function Vo(r){return r!=null&&rt(r.length)&&!Xe(r)}var Tr=Vo;a();s();var Ho=Object.prototype;function Ko(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||Ho;return r===e}var vr=Ko;a();s();a();s();a();s();function Jo(r,t){for(var e=-1,n=Array(r);++e<r;)n[e]=t(e);return n}var Ar=Jo;a();s();a();s();var Qo="[object Arguments]";function Xo(r){return G(r)&&Y(r)==Qo}var At=Xo;var br=Object.prototype,Zo=br.hasOwnProperty,ea=br.propertyIsEnumerable,ta=At((function(){return arguments})())?At:function(r){return G(r)&&Zo.call(r,"callee")&&!ea.call(r,"callee")},_r=ta;a();s();a();s();function ra(){return!1}var Er=ra;var Nr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ir=Nr&&typeof module=="object"&&module&&!module.nodeType&&module,na=Ir&&Ir.exports===Nr,Lr=na?_.Buffer:void 0,ia=Lr?Lr.isBuffer:void 0,oa=ia||Er,ke=oa;a();s();a();s();var aa="[object Arguments]",sa="[object Array]",fa="[object Boolean]",pa="[object Date]",ua="[object Error]",la="[object Function]",ca="[object Map]",ma="[object Number]",da="[object Object]",ha="[object RegExp]",xa="[object Set]",ya="[object String]",wa="[object WeakMap]",ga="[object ArrayBuffer]",Ta="[object DataView]",va="[object Float32Array]",Aa="[object Float64Array]",ba="[object Int8Array]",_a="[object Int16Array]",Ea="[object Int32Array]",Ia="[object Uint8Array]",La="[object Uint8ClampedArray]",Na="[object Uint16Array]",Sa="[object Uint32Array]",T={};T[va]=T[Aa]=T[ba]=T[_a]=T[Ea]=T[Ia]=T[La]=T[Na]=T[Sa]=!0;T[aa]=T[sa]=T[ga]=T[fa]=T[Ta]=T[pa]=T[ua]=T[la]=T[ca]=T[ma]=T[da]=T[ha]=T[xa]=T[ya]=T[wa]=!1;function Ca(r){return G(r)&&rt(r.length)&&!!T[Y(r)]}var Sr=Ca;a();s();function Ra(r){return function(t){return r(t)}}var Cr=Ra;a();s();var Rr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Me=Rr&&typeof module=="object"&&module&&!module.nodeType&&module,Oa=Me&&Me.exports===Rr,bt=Oa&&Je.process,Pa=(function(){try{var r=Me&&Me.require&&Me.require("util").types;return r||bt&&bt.binding&&bt.binding("util")}catch(t){}})(),_t=Pa;var Or=_t&&_t.isTypedArray,Ua=Or?Cr(Or):Sr,nt=Ua;var Ba=Object.prototype,ka=Ba.hasOwnProperty;function Ma(r,t){var e=he(r),n=!e&&_r(r),i=!e&&!n&&ke(r),o=!e&&!n&&!i&&nt(r),p=e||n||i||o,l=p?Ar(r.length,String):[],m=l.length;for(var d in r)(t||ka.call(r,d))&&!(p&&(d=="length"||i&&(d=="offset"||d=="parent")||o&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||gr(d,m)))&&l.push(d);return l}var Pr=Ma;a();s();a();s();a();s();function Da(r,t){return function(e){return r(t(e))}}var Ur=Da;var Fa=Ur(Object.keys,Object),Br=Fa;var ja=Object.prototype,$a=ja.hasOwnProperty;function Wa(r){if(!vr(r))return Br(r);var t=[];for(var e in Object(r))$a.call(r,e)&&e!="constructor"&&t.push(e);return t}var kr=Wa;function Ya(r){return Tr(r)?Pr(r):kr(r)}var Mr=Ya;a();s();a();s();a();s();a();s();a();s();var Ga=O(Object,"create"),q=Ga;function za(){this.__data__=q?q(null):{},this.size=0}var Dr=za;a();s();function qa(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}var Fr=qa;a();s();var Va="__lodash_hash_undefined__",Ha=Object.prototype,Ka=Ha.hasOwnProperty;function Ja(r){var t=this.__data__;if(q){var e=t[r];return e===Va?void 0:e}return Ka.call(t,r)?t[r]:void 0}var jr=Ja;a();s();var Qa=Object.prototype,Xa=Qa.hasOwnProperty;function Za(r){var t=this.__data__;return q?t[r]!==void 0:Xa.call(t,r)}var $r=Za;a();s();var es="__lodash_hash_undefined__";function ts(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=q&&t===void 0?es:t,this}var Wr=ts;function Le(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}Le.prototype.clear=Dr;Le.prototype.delete=Fr;Le.prototype.get=jr;Le.prototype.has=$r;Le.prototype.set=Wr;var Et=Le;a();s();a();s();function rs(){this.__data__=[],this.size=0}var Yr=rs;a();s();a();s();function ns(r,t){for(var e=r.length;e--;)if(tt(r[e][0],t))return e;return-1}var re=ns;var is=Array.prototype,os=is.splice;function as(r){var t=this.__data__,e=re(t,r);if(e<0)return!1;var n=t.length-1;return e==n?t.pop():os.call(t,e,1),--this.size,!0}var Gr=as;a();s();function ss(r){var t=this.__data__,e=re(t,r);return e<0?void 0:t[e][1]}var zr=ss;a();s();function fs(r){return re(this.__data__,r)>-1}var qr=fs;a();s();function ps(r,t){var e=this.__data__,n=re(e,r);return n<0?(++this.size,e.push([r,t])):e[n][1]=t,this}var Vr=ps;function Ne(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}Ne.prototype.clear=Yr;Ne.prototype.delete=Gr;Ne.prototype.get=zr;Ne.prototype.has=qr;Ne.prototype.set=Vr;var ne=Ne;a();s();var us=O(_,"Map"),ie=us;function ls(){this.size=0,this.__data__={hash:new Et,map:new(ie||ne),string:new Et}}var Hr=ls;a();s();a();s();a();s();function cs(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}var Kr=cs;function ms(r,t){var e=r.__data__;return Kr(t)?e[typeof t=="string"?"string":"hash"]:e.map}var oe=ms;function ds(r){var t=oe(this,r).delete(r);return this.size-=t?1:0,t}var Jr=ds;a();s();function hs(r){return oe(this,r).get(r)}var Qr=hs;a();s();function xs(r){return oe(this,r).has(r)}var Xr=xs;a();s();function ys(r,t){var e=oe(this,r),n=e.size;return e.set(r,t),this.size+=e.size==n?0:1,this}var Zr=ys;function Se(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var n=r[t];this.set(n[0],n[1])}}Se.prototype.clear=Hr;Se.prototype.delete=Jr;Se.prototype.get=Qr;Se.prototype.has=Xr;Se.prototype.set=Zr;var it=Se;a();s();function ws(r,t){for(var e=-1,n=t.length,i=r.length;++e<n;)r[i+e]=t[e];return r}var en=ws;a();s();a();s();function gs(){this.__data__=new ne,this.size=0}var tn=gs;a();s();function Ts(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}var rn=Ts;a();s();function vs(r){return this.__data__.get(r)}var nn=vs;a();s();function As(r){return this.__data__.has(r)}var on=As;a();s();var bs=200;function _s(r,t){var e=this.__data__;if(e instanceof ne){var n=e.__data__;if(!ie||n.length<bs-1)return n.push([r,t]),this.size=++e.size,this;e=this.__data__=new it(n)}return e.set(r,t),this.size=e.size,this}var an=_s;function Ce(r){var t=this.__data__=new ne(r);this.size=t.size}Ce.prototype.clear=tn;Ce.prototype.delete=rn;Ce.prototype.get=nn;Ce.prototype.has=on;Ce.prototype.set=an;var ot=Ce;a();s();a();s();function Es(r,t){for(var e=-1,n=r==null?0:r.length,i=0,o=[];++e<n;){var p=r[e];t(p,e,r)&&(o[i++]=p)}return o}var sn=Es;a();s();function Is(){return[]}var fn=Is;var Ls=Object.prototype,Ns=Ls.propertyIsEnumerable,pn=Object.getOwnPropertySymbols,Ss=pn?function(r){return r==null?[]:(r=Object(r),sn(pn(r),function(t){return Ns.call(r,t)}))}:fn,un=Ss;a();s();a();s();function Cs(r,t,e){var n=t(r);return he(r)?n:en(n,e(r))}var ln=Cs;function Rs(r){return ln(r,Mr,un)}var It=Rs;a();s();a();s();var Os=O(_,"DataView"),at=Os;a();s();var Ps=O(_,"Promise"),st=Ps;a();s();var Us=O(_,"Set"),ae=Us;var cn="[object Map]",Bs="[object Object]",mn="[object Promise]",dn="[object Set]",hn="[object WeakMap]",xn="[object DataView]",ks=z(at),Ms=z(ie),Ds=z(st),Fs=z(ae),js=z(et),xe=Y;(at&&xe(new at(new ArrayBuffer(1)))!=xn||ie&&xe(new ie)!=cn||st&&xe(st.resolve())!=mn||ae&&xe(new ae)!=dn||et&&xe(new et)!=hn)&&(xe=function(r){var t=Y(r),e=t==Bs?r.constructor:void 0,n=e?z(e):"";if(n)switch(n){case ks:return xn;case Ms:return cn;case Ds:return mn;case Fs:return dn;case js:return hn}return t});var Lt=xe;a();s();var $s=_.Uint8Array,Nt=$s;a();s();a();s();a();s();a();s();a();s();var Ws="__lodash_hash_undefined__";function Ys(r){return this.__data__.set(r,Ws),this}var yn=Ys;a();s();function Gs(r){return this.__data__.has(r)}var wn=Gs;function ft(r){var t=-1,e=r==null?0:r.length;for(this.__data__=new it;++t<e;)this.add(r[t])}ft.prototype.add=ft.prototype.push=yn;ft.prototype.has=wn;var pt=ft;a();s();function zs(r,t){for(var e=-1,n=r==null?0:r.length;++e<n;)if(t(r[e],e,r))return!0;return!1}var gn=zs;a();s();function qs(r,t){return r.has(t)}var ut=qs;var Vs=1,Hs=2;function Ks(r,t,e,n,i,o){var p=e&Vs,l=r.length,m=t.length;if(l!=m&&!(p&&m>l))return!1;var d=o.get(r),h=o.get(t);if(d&&h)return d==t&&h==r;var x=-1,g=!0,v=e&Hs?new pt:void 0;for(o.set(r,t),o.set(t,r);++x<l;){var A=r[x],N=t[x];if(n)var Z=p?n(N,A,x,t,r,o):n(A,N,x,r,t,o);if(Z!==void 0){if(Z)continue;g=!1;break}if(v){if(!gn(t,function(ue,le){if(!ut(v,le)&&(A===ue||i(A,ue,e,n,o)))return v.push(le)})){g=!1;break}}else if(!(A===N||i(A,N,e,n,o))){g=!1;break}}return o.delete(r),o.delete(t),g}var lt=Ks;a();s();a();s();function Js(r){var t=-1,e=Array(r.size);return r.forEach(function(n,i){e[++t]=[i,n]}),e}var Tn=Js;a();s();function Qs(r){var t=-1,e=Array(r.size);return r.forEach(function(n){e[++t]=n}),e}var Re=Qs;var Xs=1,Zs=2,ef="[object Boolean]",tf="[object Date]",rf="[object Error]",nf="[object Map]",of="[object Number]",af="[object RegExp]",sf="[object Set]",ff="[object String]",pf="[object Symbol]",uf="[object ArrayBuffer]",lf="[object DataView]",vn=W?W.prototype:void 0,St=vn?vn.valueOf:void 0;function cf(r,t,e,n,i,o,p){switch(e){case lf:if(r.byteLength!=t.byteLength||r.byteOffset!=t.byteOffset)return!1;r=r.buffer,t=t.buffer;case uf:return!(r.byteLength!=t.byteLength||!o(new Nt(r),new Nt(t)));case ef:case tf:case of:return tt(+r,+t);case rf:return r.name==t.name&&r.message==t.message;case af:case ff:return r==t+"";case nf:var l=Tn;case sf:var m=n&Xs;if(l||(l=Re),r.size!=t.size&&!m)return!1;var d=p.get(r);if(d)return d==t;n|=Zs,p.set(r,t);var h=lt(l(r),l(t),n,i,o,p);return p.delete(r),h;case pf:if(St)return St.call(r)==St.call(t)}return!1}var An=cf;a();s();var mf=1,df=Object.prototype,hf=df.hasOwnProperty;function xf(r,t,e,n,i,o){var p=e&mf,l=It(r),m=l.length,d=It(t),h=d.length;if(m!=h&&!p)return!1;for(var x=m;x--;){var g=l[x];if(!(p?g in t:hf.call(t,g)))return!1}var v=o.get(r),A=o.get(t);if(v&&A)return v==t&&A==r;var N=!0;o.set(r,t),o.set(t,r);for(var Z=p;++x<m;){g=l[x];var ue=r[g],le=t[g];if(n)var Ot=p?n(le,ue,g,t,r,o):n(ue,le,g,r,t,o);if(!(Ot===void 0?ue===le||i(ue,le,e,n,o):Ot)){N=!1;break}Z||(Z=g=="constructor")}if(N&&!Z){var je=r.constructor,$e=t.constructor;je!=$e&&"constructor"in r&&"constructor"in t&&!(typeof je=="function"&&je instanceof je&&typeof $e=="function"&&$e instanceof $e)&&(N=!1)}return o.delete(r),o.delete(t),N}var bn=xf;var yf=1,_n="[object Arguments]",En="[object Array]",ct="[object Object]",wf=Object.prototype,In=wf.hasOwnProperty;function gf(r,t,e,n,i,o){var p=he(r),l=he(t),m=p?En:Lt(r),d=l?En:Lt(t);m=m==_n?ct:m,d=d==_n?ct:d;var h=m==ct,x=d==ct,g=m==d;if(g&&ke(r)){if(!ke(t))return!1;p=!0,h=!1}if(g&&!h)return o||(o=new ot),p||nt(r)?lt(r,t,e,n,i,o):An(r,t,m,e,n,i,o);if(!(e&yf)){var v=h&&In.call(r,"__wrapped__"),A=x&&In.call(t,"__wrapped__");if(v||A){var N=v?r.value():r,Z=A?t.value():t;return o||(o=new ot),i(N,Z,e,n,o)}}return g?(o||(o=new ot),bn(r,t,e,n,i,o)):!1}var Ln=gf;function Nn(r,t,e,n,i){return r===t?!0:r==null||t==null||!G(r)&&!G(t)?r!==r&&t!==t:Ln(r,t,e,n,Nn,i)}var Sn=Nn;a();s();function Tf(r,t,e){for(var n=-1,i=r==null?0:r.length;++n<i;)if(e(t,r[n]))return!0;return!1}var Cn=Tf;a();s();function vf(r,t){return Sn(r,t)}var mt=vf;a();s();a();s();var Af=1/0,bf=ae&&1/Re(new ae([,-0]))[1]==Af?function(r){return new ae(r)}:mr,Rn=bf;var _f=200;function Ef(r,t,e){var n=-1,i=wr,o=r.length,p=!0,l=[],m=l;if(e)p=!1,i=Cn;else if(o>=_f){var d=t?null:Rn(r);if(d)return Re(d);p=!1,i=ut,m=new pt}else m=t?[]:l;e:for(;++n<o;){var h=r[n],x=t?t(h):h;if(h=e||h!==0?h:0,p&&x===x){for(var g=m.length;g--;)if(m[g]===x)continue e;t&&m.push(x),l.push(h)}else i(m,x,e)||(m!==l&&m.push(x),l.push(h))}return l}var On=Ef;a();s();function If(r,t){return t=typeof t=="function"?t:void 0,r&&r.length?On(r,void 0,t):[]}var dt=If;a();s();a();s();var V=class{};a();s();a();s();var P=class extends V{constructor(e){super();c(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 Lf=4,De=class{constructor(){c(this,"buffer","");c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsSemicolon",!1);c(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
2
+ `),n=e?t.substring(0,t.length-1):t,i=this.getIndentString(),o=n.replaceAll(`
3
3
  `,`
4
- ${i}`);this.isAtStartOfLine()&&(s=i+s),e&&(s+=`
5
- `),this.writeInternal(s)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new S(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new S(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new S(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new S(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}openBlock(t,e="{",r,i="}"){let s=t.filter(o=>o!==void 0).join(" ");s?this.write(`${s} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),r(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
- `)}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
- `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let s=1;s<t.length;s++){this.write(e);let o=t[s];o!=null&&r(o)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
- `)),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*vr)}};l();p();function Ce(n){return(n==null?void 0:n.name)!=null}l();p();var fe=class extends M{constructor({condition:e,true_:r,false_:i}){super();c(this,"condition");c(this,"true_");c(this,"false_");this.condition=e,this.true_=r,this.false_=i}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};l();p();l();p();var D={Critical:"CRITICAL",Warning:"WARNING"};l();p();l();p();var he="",nt="self",it="static";var h={};Ue(h,{Access:()=>G,Array:()=>X,AstNode:()=>d,Attribute:()=>Z,Class:()=>F,ClassInstantiation:()=>U,ClassReference:()=>g,CodeBlock:()=>v,DataClass:()=>ee,Enum:()=>te,Field:()=>re,Map:()=>ne,Method:()=>O,MethodInvocation:()=>Y,Parameter:()=>$,Trait:()=>K,Type:()=>b,TypeLiteral:()=>q,Writer:()=>_,array:()=>Cr,assignVariable:()=>Wr,attribute:()=>kr,classReference:()=>Ur,class_:()=>Sr,codeblock:()=>ie,dataClass:()=>Br,enum_:()=>Pr,field:()=>Mr,instantiateClass:()=>lt,invokeMethod:()=>Dr,map:()=>$r,mergeArrays:()=>jr,method:()=>Or,parameter:()=>Yr,string:()=>zr,ternary:()=>Vr,this_:()=>qr,throwException:()=>Fr,trait:()=>_r,variable:()=>Gr});l();p();l();p();l();p();var G={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};l();p();l();p();l();p();function st(n){return{namespace:n.substring(0,n.lastIndexOf("\\")),name:n.substring(n.lastIndexOf("\\")+1)}}var _=class extends pe{constructor({namespace:e,rootNamespace:r,customConfig:i}){super();c(this,"namespace");c(this,"rootNamespace");c(this,"customConfig");c(this,"references",{});this.namespace=e,this.rootNamespace=r,this.customConfig=i}addReference(e){var o,u;if(e.namespace==null)return;if(Object.keys(this.references).filter(f=>{let y=st(f);return y.namespace!==e.namespace&&y.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===he?e.name:`${e.namespace}\\${e.name}`;((u=(o=this.references)[i])!=null?u:o[i]=[]).push(e)}toString(){let e=`namespace ${this.namespace};`,r=this.stringifyImports();return r.length>0?`${e}
4
+ ${i}`);this.isAtStartOfLine()&&(o=i+o),e&&(o+=`
5
+ `),this.writeInternal(o)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new P(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new P(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}controlFlowWithoutStatement(t){new P(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new P(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new P(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
+ `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
+ `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:n}){if(t.length>0){let i=t[0];i!=null&&n(i);for(let o=1;o<t.length;o++){this.write(e);let p=t[o];p!=null&&n(p)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
+ `),this.lastCharacterIsSemicolon=t.endsWith(";")),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Lf}};a();s();function Ct(r){return(r==null?void 0:r.name)!=null}a();s();var Fe=class extends V{constructor({condition:e,true_:n,false_:i}){super();c(this,"condition");c(this,"true_");c(this,"false_");this.condition=e,this.true_=n,this.false_=i}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};a();s();a();s();var H={Critical:"CRITICAL",Warning:"WARNING"};a();s();a();s();var Pn="self",Un="static";var y={};Bt(y,{Access:()=>se,Array:()=>ye,AstNode:()=>w,Attribute:()=>we,Class:()=>K,ClassInstantiation:()=>F,ClassReference:()=>E,CodeBlock:()=>I,DataClass:()=>ge,Enum:()=>Te,Field:()=>ve,Map:()=>Ae,Method:()=>X,MethodInvocation:()=>Q,Parameter:()=>J,Trait:()=>be,Type:()=>B,TypeLiteral:()=>U,Writer:()=>D,array:()=>Bf,assignVariable:()=>Kf,attribute:()=>kf,classReference:()=>Ff,class_:()=>Mf,codeblock:()=>_e,dataClass:()=>jf,enum_:()=>$f,field:()=>Wf,instantiateClass:()=>$n,invokeMethod:()=>Yf,map:()=>zf,mergeArrays:()=>Xf,method:()=>qf,parameter:()=>Vf,string:()=>Qf,ternary:()=>Hf,this_:()=>Zf,throwException:()=>Gf,trait:()=>Df,variable:()=>Jf});a();s();a();s();a();s();var se={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};a();s();a();s();a();s();function Bn(r){return{namespace:r.substring(0,r.lastIndexOf("\\")),name:r.substring(r.lastIndexOf("\\")+1)}}var D=class extends De{constructor({namespace:e,rootNamespace:n,customConfig:i}){super();c(this,"namespace");c(this,"rootNamespace");c(this,"customConfig");c(this,"references",{});this.namespace=e,this.rootNamespace=n,this.customConfig=i}addReference(e){var p,l;if(e.namespace==null)return;if(Object.keys(this.references).filter(m=>{let d=Bn(m);return d.namespace!==e.namespace&&d.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===""?e.name:`${e.namespace}\\${e.name}`;((l=(p=this.references)[i])!=null?l:p[i]=[]).push(e)}toString(e=!1){if(e)return this.buffer;let n=`namespace ${this.namespace};`,i=this.stringifyImports();return i.length>0?`${n}
9
9
 
10
- ${r}
10
+ ${i}
11
11
 
12
- ${this.buffer}`:e+`
12
+ ${this.buffer}`:n+`
13
13
 
14
- `+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(r=>st(r).namespace!==this.namespace).map(r=>`use ${r};`).join(`
15
- `)}};var d=class extends M{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:r,customConfig:i}=t,s=new _({namespace:e,rootNamespace:r,customConfig:i});return this.write(s),s.toString()}async toStringAsync({namespace:t,rootNamespace:e,customConfig:r}){let i=new _({namespace:t,rootNamespace:e,customConfig:r});return this.write(i),i.toString()}};var X=class extends d{constructor({entries:e}){super();c(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]")}};l();p();var Z=class extends d{constructor(e){var r;super();c(this,"reference");c(this,"arguments");this.reference=e.reference,this.arguments=(r=e.arguments)!=null?r:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((r,i)=>{i>0&&e.write(","),typeof r=="string"?e.write(r):r.write(e)}),e.write(")"))}};l();p();l();p();var g=class extends d{constructor({name:e,namespace:r,generics:i}){super();c(this,"name");c(this,"namespace");c(this,"generics");c(this,"fullyQualified");this.name=e,this.namespace=r,this.generics=i,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let r=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${r}`)}};l();p();l();p();function z(n){return n.startsWith("$")?n:`$${n}`}var L=class extends d{constructor({docs:e}={}){super();c(this,"docs");c(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(le(ue({},e),{name:e.name!=null?z(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
16
- `).forEach(r=>{e.writeLine(` * ${r}`)}),this.tags.length>0&&e.writeLine(" *"));for(let r of this.tags)this.writeTag({writer:e,tag:r});e.writeLine(" */")}writeTag({writer:e,tag:r}){let i=r.docs!=null?r.docs.split(`
17
- `):void 0;i!=null&&i.length>1&&(i.forEach(s=>{e.writeLine(` * ${s}`)}),e.writeLine(" *")),e.write(` * @${r.tagType} `),r.type.write(e,{comment:!0}),r.name!=null&&e.write(` ${r.name}`),i!=null&&i.length===1&&e.write(` ${i[0]}`),e.newLine()}};l();p();function j(n){return Ar(n,[G.Public,G.PublicReadonly,G.Protected,G.Private])}function Ar(n,t){return t.reduce((e,r)=>[...e,...n.filter(i=>i.access===r)],[])}var F=class extends d{constructor({name:e,namespace:r,abstract:i,docs:s,parentClassReference:o,traits:u}){super();c(this,"name");c(this,"namespace");c(this,"abstract");c(this,"docs");c(this,"parentClassReference");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);c(this,"constructor_");this.name=e,this.namespace=r,this.abstract=i!=null?i:!1,this.docs=s,this.parentClassReference=o,this.traits=u!=null?u:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addMethods(e){this.methods.push(...e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new g({name:this.name,namespace:this.namespace})),this.abstract&&e.write("abstract "),this.writeComment(e),e.write(`class ${this.name} `),this.parentClassReference!=null&&(e.write("extends "),this.parentClassReference.write(e)),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((r,i)=>{i>0&&e.write(","),e.writeNode(r)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:j(this.fields)}),(this.constructor!=null||this.methods.length>0)&&e.newLine(),this.constructor_!=null&&(this.writeConstructor({writer:e,constructor:this.constructor_}),this.methods.length>0&&e.newLine()),this.writeMethods({writer:e,methods:j(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new L({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:r}){var i;this.writeConstructorComment({writer:e,constructor:r}),r.access!=null&&e.write(`${r.access} `),e.write("function __construct("),e.indent(),r.parameters.forEach((s,o)=>{o===0&&e.newLine(),s.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(i=r.body)==null||i.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:r}){if(r.parameters.length===0)return;let i=new L;for(let s of r.parameters)i.addTag(s.getCommentTag());i.write(e)}writeFields({writer:e,fields:r}){r.filter(i=>!i.inherited).forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:r}){r.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};l();p();var K=class extends d{constructor({name:e,namespace:r,docs:i,traits:s}){super();c(this,"name");c(this,"namespace");c(this,"docs");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);this.name=e,this.namespace=r,this.docs=i,this.traits=s!=null?s:[]}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeComment(e),e.write(`trait ${this.name} `),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((r,i)=>{i>0&&e.write(","),e.writeNode(r)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:j(this.fields)}),this.fields.length>0&&this.methods.length>0&&e.newLine(),this.writeMethods({writer:e,methods:j(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){let r=new L({docs:this.docs});for(let i of this.fields)r.addTag({tagType:"property",type:i.type,name:i.name});r.write(e)}writeFields({writer:e,fields:r}){r.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:r}){r.forEach((i,s)=>{s>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};l();p();l();p();function ce({writer:n,arguments_:t,multiline:e}){if(t.length===0){n.write("()");return}if(e){Er({writer:n,arguments_:t});return}Lr({writer:n,arguments_:t})}function Er({writer:n,arguments_:t}){n.writeLine("("),n.indent();for(let e of t)ot({writer:n,argument:e,writeCompact:!1}),n.writeLine(",");n.dedent(),n.write(")")}function Lr({writer:n,arguments_:t}){n.write("("),t.forEach((e,r)=>{r>0&&n.write(", "),ot({writer:n,argument:e,writeCompact:!0})}),n.write(")")}function ot({writer:n,argument:t,writeCompact:e}){Ce(t)?(t.docs&&(e?n.write(`/* ${t.docs} */ `):n.writeLine(`/* ${t.docs} */`)),n.write(`${t.name}: `),n.writeNodeOrString(t.assignment)):t.write(n)}var U=class extends d{constructor({classReference:e,arguments_:r,multiline:i}){super();c(this,"classReference");c(this,"arguments_");c(this,"multiline");this.classReference=e,this.arguments_=r,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),ce({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};l();p();var v=class extends d{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new S(this.arg).write(e)}};l();p();l();p();var $=class extends d{constructor({name:e,type:r,docs:i,initializer:s,access:o,readonly_:u}){super();c(this,"name");c(this,"type");c(this,"docs");c(this,"initializer");c(this,"access");c(this,"readonly_");this.name=z(e),this.type=r,this.docs=i,this.initializer=s,this.access=o,this.readonly_=u!=null?u:!1}getCommentTag(){return{tagType:"param",type:this.type,name:this.name,docs:this.docs}}write(e){this.access!=null&&e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null?(e.write(" = "),this.initializer.write(e)):this.type.isOptional()&&e.write(" = null")}};l();p();var b=class n extends d{constructor(e){super();c(this,"internalType");this.internalType=e}write(e,{comment:r}={}){switch(this.internalType.type){case"int":e.write("int");break;case"string":e.write("string");break;case"bool":e.write("bool");break;case"float":e.write("float");break;case"date":e.addReference(at),e.write("DateTime");break;case"dateTime":e.addReference(at),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!r){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:r}),e.write(">");break;case"map":{if(!r){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:r}),e.write(", "),this.internalType.valueType.write(e,{comment:r}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!r){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");let i=this.internalType.entries.filter(u=>!u.valueType.isOptional()),s=this.internalType.entries.filter(u=>u.valueType.isOptional()),o=[...i,...s];for(let u of o)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:u,comment:r}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((i,s)=>{s>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:i,comment:r})}),e.write("}");break}case"union":{let i=this.getUniqueTypes({types:this.internalType.types,comment:r,writer:e}),s=i.filter(o=>o.underlyingType().internalType.type==="mixed").length>0;if(s&&!r){e.write("mixed");break}i.length>0&&r?(e.writeLine("("),i.forEach((o,u)=>{u>0?e.write(" * |"):e.write(" * "),s&&(o=o.underlyingType()),o.write(e,{comment:r}),e.writeLine(),u++}),e.write(" * )")):i.forEach((o,u)=>{u>0&&e.write("|"),s&&(o=o.underlyingType()),o.write(e,{comment:r}),u++});break}case"optional":{let i=this.internalType.value.internalType.type==="mixed",s=this.internalType.value.internalType.type==="union";!s&&!i&&e.write("?"),this.internalType.value.write(e,{comment:r}),s&&(e.write("|"),e.writeNode(n.null()));break}case"reference":if(r){e.writeNode(this.internalType.value);let i=this.internalType.value.generics;i&&i.length>0&&(e.write("<"),i.forEach((s,o)=>{o>0&&e.write(", "),s.write(e,{comment:r})}),e.write(">"))}else e.writeNode(this.internalType.value);break;case"enumString":r?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;default:R(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:n.optional(this)}underlyingTypeIfOptional(){if(this.internalType.type==="optional")return this.internalType.value}underlyingType(){var e;return(e=this.underlyingTypeIfOptional())!=null?e:this}isOptional(){return this.internalType.type==="optional"}getClassReference(){switch(this.internalType.type){case"date":case"dateTime":return new g({name:"DateTime",namespace:he});case"enumString":case"reference":return this.internalType.value;case"int":case"string":case"bool":case"float":case"object":case"map":case"array":case"null":case"mixed":case"optional":case"typeDict":case"union":throw new Error("Cannot get class reference for "+this.internalType.type);default:R(this.internalType)}}static int(){return new this({type:"int"})}static string(){return new this({type:"string"})}static bool(){return new this({type:"bool"})}static float(){return new this({type:"float"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static mixed(){return new this({type:"mixed"})}static object(){return new this({type:"object"})}static array(e){return new this({type:"array",value:e})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static typeDict(e,{multiline:r}={}){return new this({type:"typeDict",entries:e,multiline:r})}static union(e){return new this({type:"union",types:e})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static null(){return new this({type:"null"})}static reference(e){return new this({type:"reference",value:e})}static enumString(e){return new this({type:"enumString",value:e})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeTypeDictEntry({writer:e,entry:r,comment:i}){e.write(r.key),r.optional&&e.write("?"),e.write(": "),r.valueType.write(e,{comment:i})}getUniqueTypes({writer:e,types:r,comment:i}){let s=new Set;return r.filter(o=>{let u=o.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig,comment:i});return s.has(u)?!1:(s.add(u),!0)})}toString({namespace:e,rootNamespace:r,customConfig:i,comment:s}){let o=new _({namespace:e,rootNamespace:r,customConfig:i});return this.write(o,{comment:s!=null?s:!1}),o.toString()}},at=new g({namespace:he,name:"DateTime"});l();p();function ct(n){return n.startsWith("$")?n.slice(1):n}var ut="values",ee=class extends d{constructor({name:e,namespace:r,abstract:i,docs:s,parentClassReference:o,traits:u}){super();c(this,"name");c(this,"namespace");c(this,"class_");this.name=e,this.namespace=r,this.class_=new F({name:e,namespace:r,abstract:i,docs:s,parentClassReference:o,traits:u})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let r=j(this.class_.fields).map(i=>le(ue({},i),{name:ct(i.name)}));r.length>0&&this.class_.addConstructor({access:"public",parameters:this.getConstructorParameters({orderedFields:r}),body:h.codeblock(i=>{for(let s of r)i.write(`$this->${s.name} = $${ut}['${s.name}']`),s.type.isOptional()&&i.write(" ?? null"),i.write(";")})}),this.class_.write(e)}allFieldsAreOptional(){return this.class_.fields.every(e=>e.type.isOptional())}getConstructorParameters({orderedFields:e}){return[new $({name:ut,type:b.typeDict(e.map(r=>({key:r.name,valueType:r.type,optional:r.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new v("[]"):void 0})]}};l();p();l();p();var O=class extends d{constructor({name:e,access:r,parameters:i,throws:s,return_:o,body:u,docs:f,classReference:y,static_:w}){super();c(this,"name");c(this,"access");c(this,"parameters");c(this,"throws");c(this,"return_");c(this,"body");c(this,"docs");c(this,"classReference");c(this,"static_");this.name=e,this.access=r,this.parameters=i,this.throws=s!=null?s:[],this.return_=o,this.body=u,this.docs=f,this.classReference=y,this.static_=w!=null?w:!1}write(e){var o;this.writeComment(e),e.write(`${this.access}${this.static_?" static":""} function ${this.name}(`);let r=this.parameters.filter(u=>!u.type.isOptional()),i=this.parameters.filter(u=>u.type.isOptional());[...r,...i].forEach((u,f)=>{f>0&&e.write(", "),u.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),(o=this.body)==null||o.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let r=new L({docs:this.docs});for(let i of this.parameters)r.addTag({tagType:"param",type:i.type,name:i.name,docs:i.docs});this.return_!=null&&this.return_!==nt&&this.return_!==it&&r.addTag({tagType:"return",type:this.return_});for(let i of this.throws)r.addTag({tagType:"throws",type:b.reference(i)});e.writeNode(r)}};var te=class extends d{constructor({name:e,namespace:r,backing:i,docs:s,serializable:o}){super();c(this,"name");c(this,"namespace");c(this,"backing");c(this,"docs");c(this,"members",[]);c(this,"serializable");this.name=e,this.namespace=r,this.backing=i,this.docs=s,this.serializable=o!=null?o:!1}addMember(e){this.members.push(e)}write(e){this.writeComment(e),e.write("enum "),e.writeLine(`${this.name}`),this.backing!=null&&e.write(` : ${this.backing}`),this.serializable&&(e.addReference(new g({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let r of this.members)e.write(`case ${r.name}`),r.value!=null&&(typeof r.value=="string"?e.write(` = "${r.value}"`):e.write(` = ${r.value}`)),e.writeTextStatement("");this.serializable&&(e.newLine(),e.writeNode(new O({name:"jsonSerialize",return_:b.string(),access:"public",parameters:[],body:new v("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new L({docs:this.docs}).write(e)}};l();p();var re=class extends d{constructor({name:e,type:r,access:i,readonly_:s,initializer:o,docs:u,inlineDocs:f,attributes:y,inherited:w}){super();c(this,"name");c(this,"type");c(this,"access");c(this,"readonly_");c(this,"initializer");c(this,"docs");c(this,"inlineDocs");c(this,"attributes");c(this,"inherited");this.name=z(e),this.type=r,this.access=i,this.readonly_=s!=null?s:!1,this.initializer=o,this.docs=u,this.inlineDocs=f,this.attributes=y!=null?y:[],this.inherited=w!=null?w:!1}write(e){this.writeComment(e),this.writeAttributesIfPresent(e),e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null&&(e.write(" = "),this.initializer.write(e)),e.write(";"),this.inlineDocs!=null&&e.write(` // ${this.inlineDocs}`),e.newLine()}writeComment(e){let r=new L;r.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),r.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.writeLine("]"))}};l();p();var ne=class extends d{constructor({entries:e,multiline:r}){super();c(this,"entries");c(this,"multiline");this.entries=e!=null?e:[],this.multiline=r!=null?r:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:r,value:i}of this.entries)r.write(e),e.write(" => "),i.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[r,{key:i,value:s}]of this.entries.entries())r>0&&e.write(", "),i.write(e),e.write(" => "),s.write(e);e.write("]")}};l();p();var Y=class extends d{constructor({method:e,arguments_:r,static_:i,multiline:s,on:o}){super();c(this,"method");c(this,"arguments_");c(this,"multiline");c(this,"static_");c(this,"on");this.method=e,this.arguments_=r,this.static_=i!=null?i:!1,this.multiline=s!=null?s:!1,this.on=o}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),ce({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};l();p();l();p();var q=class n extends d{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"list":{this.writeList({writer:e,list:this.internalType});break}case"boolean":{e.write(this.internalType.value.toString());break}case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"file":{e.writeNode(Rr({writer:e,value:this.internalType.value}));break}case"float":{e.write(this.internalType.value.toString());break}case"number":{e.write(this.internalType.value.toString());break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"datetime":{e.writeNode(Nr({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
18
- `)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}e.write(`'${this.internalType.value.replaceAll("'","\\'")}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:R(this.internalType)}}isClass(){return this.internalType.type==="class"}asClassOrThrow(){if(this.isClass())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a class")}writeStringWithHeredoc({writer:e,value:r}){e.writeLine("<<<EOT"),e.writeNoIndent(r),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:r}){e.writeNode(new U({classReference:r.reference,arguments_:[n.map({entries:r.fields.map(i=>({key:n.string(i.name),value:i.value}))})]}))}writeList({writer:e,list:r}){let i=br({values:r.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let s of i)s.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:r}){let i=Ir({entries:r.entries});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let s of i)s.key.write(e),e.write(" => "),s.value.write(e),e.writeLine(",");e.dedent(),e.write("]")}static list({values:e}){return new this({type:"list",values:e})}static boolean(e){return new this({type:"boolean",value:e})}static class_({reference:e,fields:r}){return new this({type:"class",reference:e,fields:r})}static file(e){return new this({type:"file",value:e})}static float(e){return new this({type:"float",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static map({entries:e}){return new this({type:"map",entries:e})}static reference(e){return new this({type:"reference",value:e})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(r.includes('"')?`\`${r}\``:`"${r}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:e,value:r});return}this.writeUnknownMap({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:e,value:r}){if(r.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of r)e.writeNode(n.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[s,o]of i)e.write(`'${s}' => `),e.writeNode(n.unknown(o)),e.writeLine(",");e.dedent(),e.write("]")}};function Nr({writer:n,value:t}){return new U({classReference:new g({name:"DateTime",namespace:""}),arguments_:[new v(`'${t}'`)]})}function Rr({writer:n,value:t}){return new Y({on:new g({name:"File",namespace:`${n.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new v(`"${t}"`)]})}function Ir({entries:n}){return n.filter(t=>!q.isNop(t.key)&&!q.isNop(t.value))}function br({values:n}){return n.filter(t=>!q.isNop(t))}l();p();var Ae=class extends d{constructor(e){super();c(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),ce({writer:e,arguments_:this.arrays.map(r=>ie(i=>{if(typeof r=="string"||r instanceof d){i.writeNodeOrString(r);return}i.writeNodeOrString(r.ref),r.fallback&&(i.write(" ?? "),i.writeNodeOrString(r.fallback))}))})}};function Cr(n){return new X(n)}function kr(n){return new Z(n)}function Sr(n){return new F(n)}function _r(n){return new K(n)}function Ur(n){return new g(n)}function ie(n){return new v(n)}function Br(n){return new ee(n)}function Pr(n){return new te(n)}function Mr(n){return new re(n)}function lt(n){return new U(n)}function Dr(n){return new Y(n)}function Fr(n){return ie(t=>{t.write("throw "),t.writeNode(lt(n))})}function $r(n){return new ne(n)}function Or(n){return new O(n)}function Yr(n){return new $(n)}function Vr(n){return new fe(n)}function Wr(n,t){return ie(e=>{e.writeNodeOrString(n),e.write(" = "),e.writeNodeOrString(t)})}function Gr(n){return ie(z(n))}function zr(n){return ie(`"${n}"`)}function jr(...n){return new Ae(n)}function qr(){return new v(n=>{n.write("$this")})}var ke=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?h.TypeLiteral.null():(this.context.errors.add({severity:D.Critical,message:"Expected non-null value, but got null"}),h.TypeLiteral.nop());if(t.value===void 0)return h.TypeLiteral.nop();switch(t.typeReference.type){case"list":case"set":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?h.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"unknown":return this.convertUnknown({value:t.value});default:R(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let r=this.context.getValueAsBoolean({value:e});return r==null?h.TypeLiteral.nop():h.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:e});return r==null?h.TypeLiteral.nop():h.TypeLiteral.string(r)}default:R(t)}}convertList({list:t,value:e}){return Array.isArray(e)?h.TypeLiteral.list({values:e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:D.Critical,message:`Expected array but got: ${typeof e}`}),h.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:D.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),h.TypeLiteral.nop()):h.TypeLiteral.map({entries:Object.entries(e).map(([r,i])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:t.key,value:r,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:r}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:r});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"object":return this.convertObject({object_:t,value:e});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:R(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let r=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(r==null)return h.TypeLiteral.nop();let i=r.singleDiscriminatedUnionType,s=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:r,unionVariant:i});return s==null?h.TypeLiteral.nop():h.TypeLiteral.reference(h.codeblock(o=>{o.writeNode(h.invokeMethod({on:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),method:this.context.getMethodName(i.discriminantValue.name),arguments_:this.convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:r,unionVariant:i,unionProperties:s}),static_:!0}))}))}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){switch(e.type){case"samePropertiesAsObject":{let r=this.context.resolveNamedType({typeId:e.typeId});if(r==null)return;let i=this.convertNamed({named:r,value:t.value});if(!i.isClass()){this.context.errors.add({severity:D.Critical,message:"Internal error; expected union value to be an object"});return}return i.asClassOrThrow().fields}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let r=this.context.getRecord(t.value);return r==null?[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:t.value})}]:[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:r[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return[];default:R(e)}}convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:r}){let i=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});if(e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&r.length===1)return[...i,this.convert({typeReference:e.typeReference,value:t.value})];if(e.type==="samePropertiesAsObject"){let s=this.context.resolveNamedType({typeId:e.typeId});return s==null?[]:[...i,h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(s.declaration.name),namespace:this.context.getTypesNamespace(s.declaration.fernFilepath)}),fields:r})]}return i}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){var i,s;return this.context.associateByWireValue({parameters:(i=e.properties)!=null?i:[],values:(s=this.context.getRecord(t.value))!=null?s:{},ignoreMissingParameters:!0}).map(o=>{this.context.errors.scope(o.name.wireValue);try{return this.convert(o)}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e}){var i;let r=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return h.TypeLiteral.class_({reference:h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),fields:r.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyName(s.name.name),value:this.convert(s)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:t,value:e}){let r=this.getEnumValueName({enum_:t,value:e});return r==null?h.TypeLiteral.nop():h.TypeLiteral.reference(h.codeblock(i=>{i.writeNode(h.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)})),i.write("::"),i.write(r),i.write("->value")}))}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:D.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let r=t.values.find(i=>i.wireValue===e);if(r==null){this.context.errors.add({severity:D.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return this.context.getClassName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return r==null?h.TypeLiteral.nop():r}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let r of t.types)try{return this.convert({typeReference:r,value:e})}catch(i){continue}this.context.errors.add({severity:D.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t}){return h.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:r}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:r});return i==null?h.TypeLiteral.nop():h.TypeLiteral.number(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:r});return i==null?h.TypeLiteral.nop():h.TypeLiteral.boolean(i)}case"DATE":case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.datetime(i)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?h.TypeLiteral.nop():h.TypeLiteral.string(i)}default:R(t)}}getValueAsNumber({value:t,as:e}){let r=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:t,as:e}){let r=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:r})}};0&&(module.exports={DynamicTypeLiteralMapper});
14
+ `+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(n=>Bn(n).namespace!==this.namespace).map(n=>`use ${n};`).join(`
15
+ `)}};var w=class extends V{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:n,customConfig:i,skipImports:o=!1}=t,p=new D({namespace:e,rootNamespace:n,customConfig:i});return this.write(p),p.toString(o)}async toStringAsync({namespace:t,rootNamespace:e,customConfig:n}){let i=new D({namespace:t,rootNamespace:e,customConfig:n});return this.write(i),i.toString()}};var ye=class extends w{constructor({entries:e}){super();c(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((n,i)=>{i>0&&e.write(", "),n.write(e)}),e.write("]")}};a();s();var we=class extends w{constructor(e){var n;super();c(this,"reference");c(this,"arguments");this.reference=e.reference,this.arguments=(n=e.arguments)!=null?n:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((n,i)=>{i>0&&e.write(","),typeof n=="string"?e.write(n):n.write(e)}),e.write(")"))}};a();s();a();s();var E=class extends w{constructor({name:e,namespace:n,generics:i}){super();c(this,"name");c(this,"namespace");c(this,"generics");c(this,"fullyQualified");this.name=e,this.namespace=n,this.generics=i,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let n=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${n}`)}};a();s();a();s();function fe(r){return r.startsWith("$")?r:`$${r}`}var C=class extends w{constructor({docs:e}={}){super();c(this,"docs");c(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(Ue(Pe({},e),{name:e.name!=null?fe(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
16
+ `).forEach(n=>{e.writeLine(` * ${n}`)}),this.tags.length>0&&e.writeLine(" *"));for(let n of this.tags)this.writeTag({writer:e,tag:n});e.writeLine(" */")}writeTag({writer:e,tag:n}){let i=n.docs!=null?n.docs.split(`
17
+ `):void 0;i!=null&&i.length>1&&(i.forEach(o=>{e.writeLine(` * ${o}`)}),e.writeLine(" *")),e.write(` * @${n.tagType} `),n.type.write(e,{comment:!0}),n.name!=null&&e.write(` ${n.name}`),i!=null&&i.length===1&&e.write(` ${i[0]}`),e.newLine()}};a();s();function pe(r){return Nf(r,[se.Public,se.PublicReadonly,se.Protected,se.Private])}function Nf(r,t){return t.reduce((e,n)=>[...e,...r.filter(i=>i.access===n)],[])}var K=class extends w{constructor({name:e,namespace:n,abstract:i,docs:o,parentClassReference:p,traits:l}){super();c(this,"name");c(this,"namespace");c(this,"abstract");c(this,"docs");c(this,"parentClassReference");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);c(this,"constructor_");this.name=e,this.namespace=n,this.abstract=i!=null?i:!1,this.docs=o,this.parentClassReference=p,this.traits=l!=null?l:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addMethods(e){this.methods.push(...e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new E({name:this.name,namespace:this.namespace})),this.abstract&&e.write("abstract "),this.writeComment(e),e.write(`class ${this.name} `),this.parentClassReference!=null&&(e.write("extends "),this.parentClassReference.write(e)),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((n,i)=>{i>0&&e.write(","),e.writeNode(n)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:pe(this.fields)}),(this.constructor!=null||this.methods.length>0)&&e.newLine(),this.constructor_!=null&&(this.writeConstructor({writer:e,constructor:this.constructor_}),this.methods.length>0&&e.newLine()),this.writeMethods({writer:e,methods:pe(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new C({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:n}){var i;this.writeConstructorComment({writer:e,constructor:n}),n.access!=null&&e.write(`${n.access} `),e.write("function __construct("),e.indent(),n.parameters.forEach((o,p)=>{p===0&&e.newLine(),o.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(i=n.body)==null||i.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:n}){if(n.parameters.length===0)return;let i=new C;for(let o of n.parameters)i.addTag(o.getCommentTag());i.write(e)}writeFields({writer:e,fields:n}){n.filter(i=>!i.inherited).forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};a();s();a();s();function Oe({writer:r,arguments_:t,multiline:e}){if(t.length===0){r.write("()");return}if(e){Sf({writer:r,arguments_:t});return}Cf({writer:r,arguments_:t})}function Sf({writer:r,arguments_:t}){r.writeLine("("),r.indent();for(let e of t)Mn({writer:r,argument:e,writeCompact:!1}),r.writeLine(",");r.dedent(),r.write(")")}function Cf({writer:r,arguments_:t}){r.write("("),t.forEach((e,n)=>{n>0&&r.write(", "),Mn({writer:r,argument:e,writeCompact:!0})}),r.write(")")}function Mn({writer:r,argument:t,writeCompact:e}){Ct(t)?(t.docs&&(e?r.write(`/* ${t.docs} */ `):r.writeLine(`/* ${t.docs} */`)),r.write(`${t.name}: `),r.writeNodeOrString(t.assignment)):t.write(r)}var F=class extends w{constructor({classReference:e,arguments_:n,multiline:i}){super();c(this,"classReference");c(this,"arguments_");c(this,"multiline");this.classReference=e,this.arguments_=n,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),Oe({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};a();s();var I=class extends w{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new P(this.arg).write(e)}};a();s();a();s();var J=class extends w{constructor({name:e,type:n,docs:i,initializer:o,access:p,readonly_:l}){super();c(this,"name");c(this,"type");c(this,"docs");c(this,"initializer");c(this,"access");c(this,"readonly_");this.name=fe(e),this.type=n,this.docs=i,this.initializer=o,this.access=p,this.readonly_=l!=null?l:!1}getCommentTag(){return{tagType:"param",type:this.type,name:this.name,docs:this.docs}}write(e){this.access!=null&&e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null?(e.write(" = "),this.initializer.write(e)):this.type.isOptional()&&e.write(" = null")}};a();s();a();s();a();s();a();s();var Q=class extends w{constructor({method:e,arguments_:n,static_:i,multiline:o,on:p}){super();c(this,"method");c(this,"arguments_");c(this,"multiline");c(this,"static_");c(this,"on");this.method=e,this.arguments_=n,this.static_=i!=null?i:!1,this.multiline=o!=null?o:!1,this.on=p}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),Oe({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};var U=class r extends w{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"list":{this.writeList({writer:e,list:this.internalType});break}case"boolean":{e.write(this.internalType.value.toString());break}case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"file":{e.writeNode(Of({writer:e,value:this.internalType.value}));break}case"float":{e.write(this.internalType.value.toString());break}case"number":{e.write(this.internalType.value.toString());break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"datetime":{e.writeNode(Rf({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
18
+ `)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}if(this.internalType.value.includes("'")){e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}e.write(`'${this.internalType.value}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:S(this.internalType)}}isClass(){return this.internalType.type==="class"}asClassOrThrow(){if(this.isClass())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a class")}writeStringWithHeredoc({writer:e,value:n}){e.writeLine("<<<EOT"),e.writeNoIndent(n),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:n}){e.writeNode(new F({classReference:n.reference,arguments_:[r.map({entries:n.fields.map(i=>({key:r.string(i.name),value:i.value}))})]}))}writeList({writer:e,list:n}){let i=Uf({values:n.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:n}){let i=Pf({entries:n.entries});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.key.write(e),e.write(" => "),o.value.write(e),e.writeLine(",");e.dedent(),e.write("]")}static list({values:e}){return new this({type:"list",values:e})}static boolean(e){return new this({type:"boolean",value:e})}static class_({reference:e,fields:n}){return new this({type:"class",reference:e,fields:n})}static file(e){return new this({type:"file",value:e})}static float(e){return new this({type:"float",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static map({entries:e}){return new this({type:"map",entries:e})}static reference(e){return new this({type:"reference",value:e})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:n}){switch(typeof n){case"boolean":e.write(n.toString());return;case"string":e.write(n.includes('"')?`\`${n}\``:`"${n}"`);return;case"number":e.write(n.toString());return;case"object":if(n==null){e.write("null");return}if(Array.isArray(n)){this.writeUnknownArray({writer:e,value:n});return}this.writeUnknownMap({writer:e,value:n});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof n}`)}}writeUnknownArray({writer:e,value:n}){if(n.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of n)e.writeNode(r.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:n}){let i=Object.entries(n);if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[o,p]of i)e.write(`'${o}' => `),e.writeNode(r.unknown(p)),e.writeLine(",");e.dedent(),e.write("]")}};function Rf({writer:r,value:t}){return new F({classReference:new E({name:"DateTime",namespace:""}),arguments_:[new I(`'${t}'`)]})}function Of({writer:r,value:t}){return new Q({on:new E({name:"File",namespace:`${r.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new I(`"${t}"`)]})}function Pf({entries:r}){return r.filter(t=>!U.isNop(t.key)&&!U.isNop(t.value))}function Uf({values:r}){return r.filter(t=>!U.isNop(t))}var B=class r extends w{constructor(e){super();c(this,"internalType");this.internalType=e}write(e,{comment:n}={}){switch(this.internalType.type){case"int":e.write("int");break;case"string":e.write("string");break;case"bool":e.write("bool");break;case"float":e.write("float");break;case"date":e.addReference(Dn),e.write("DateTime");break;case"dateTime":e.addReference(Dn),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!n){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:n}),e.write(">");break;case"map":{if(!n){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:n}),e.write(", "),this.internalType.valueType.write(e,{comment:n}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!n){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");let i=this.internalType.entries.filter(l=>!l.valueType.isOptional()),o=this.internalType.entries.filter(l=>l.valueType.isOptional()),p=[...i,...o];for(let l of p)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:l,comment:n}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((i,o)=>{o>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:i,comment:n})}),e.write("}");break}case"union":{this.writeUnion({writer:e,unionTypes:this.internalType.types,comment:n});break}case"optional":{let i=this.internalType.value.internalType,o=i.type==="mixed",p=i.type==="union";!p&&!o&&e.write("?"),this.internalType.value.write(e,{comment:n}),p&&!this.unionHasOptional(i.types)&&(e.write("|"),e.writeNode(r.null()));break}case"reference":if(n){e.writeNode(this.internalType.value);let i=this.internalType.value.generics;i&&i.length>0&&(e.write("<"),i.forEach((o,p)=>{p>0&&e.write(", "),o.write(e,{comment:n})}),e.write(">"))}else e.writeNode(this.internalType.value);break;case"enumString":n?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;case"literal":if(n)e.writeNode(this.internalType.value);else switch(this.internalType.value.internalType.type){case"string":e.write("string");break;case"boolean":e.write("bool");break;default:S(this.internalType.value.internalType)}break;default:S(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:r.optional(this)}underlyingTypeIfOptional(){if(this.internalType.type==="optional")return this.internalType.value}underlyingType(){var e;return(e=this.underlyingTypeIfOptional())!=null?e:this}isOptional(){return this.internalType.type==="optional"}getClassReference(){switch(this.internalType.type){case"date":case"dateTime":return new E({name:"DateTime",namespace:""});case"enumString":case"reference":return this.internalType.value;case"int":case"string":case"bool":case"float":case"object":case"map":case"array":case"null":case"mixed":case"optional":case"typeDict":case"union":case"literal":throw new Error("Cannot get class reference for "+this.internalType.type);default:S(this.internalType)}}static int(){return new this({type:"int"})}static string(){return new this({type:"string"})}static bool(){return new this({type:"bool"})}static float(){return new this({type:"float"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static mixed(){return new this({type:"mixed"})}static object(){return new this({type:"object"})}static array(e){return new this({type:"array",value:e})}static map(e,n){return new this({type:"map",keyType:e,valueType:n})}static typeDict(e,{multiline:n}={}){return new this({type:"typeDict",entries:e,multiline:n})}static union(e){let n=this.flattenUnionTypes(e),i=dt(n,mt);return new this({type:"union",types:i})}static flattenUnionTypes(e){let n=[];for(let i of e)i.internalType.type==="union"?n.push(...this.flattenUnionTypes(i.internalType.types)):n.push(i);return n}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static null(){return new this({type:"null"})}static reference(e){return new this({type:"reference",value:e})}static enumString(e){return new this({type:"enumString",value:e})}static literalString(e){return new this({type:"literal",value:U.string(e)})}static literalBoolean(e){return new this({type:"literal",value:U.boolean(e)})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeUnion({writer:e,unionTypes:n,comment:i}){let o=this.getUniqueTypes({types:n,comment:i,writer:e}),p=this.unwrapOptionalTypes(o),l=p.filter(m=>m.underlyingType().internalType.type==="mixed").length>0;if(l&&!i){e.write("mixed");return}if(p.length>0&&i){e.writeLine("("),p.forEach((m,d)=>{d>0?e.write(" * |"):e.write(" * "),l&&(m=m.underlyingType()),m.write(e,{comment:i}),e.writeLine(),d++}),e.write(" * )");return}p.forEach((m,d)=>{d>0&&e.write("|"),l&&(m=m.underlyingType()),m.write(e,{comment:i}),d++})}writeTypeDictEntry({writer:e,entry:n,comment:i}){e.write(n.key),n.optional&&e.write("?"),e.write(": "),n.valueType.write(e,{comment:i})}getUniqueTypes({writer:e,types:n,comment:i}){let o=dt(n,mt),p=new Set;return o.filter(l=>{let m=l.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig,comment:i});return p.has(m)?!1:(p.add(m),!0)})}unwrapOptionalTypes(e){let n=!1,i=e.map(o=>o.internalType.type==="optional"?(n=!0,o.internalType.value):o);return n&&i.push(r.null()),i}unionHasOptional(e){return e.filter(n=>n.internalType.type==="optional").length>0}toString({namespace:e,rootNamespace:n,customConfig:i,comment:o}){let p=new D({namespace:e,rootNamespace:n,customConfig:i});return this.write(p,{comment:o!=null?o:!1}),p.toString()}},Dn=new E({namespace:"",name:"DateTime"});a();s();function Fn(r){return r.startsWith("$")?r.slice(1):r}var jn="values",ge=class extends w{constructor({name:e,namespace:n,abstract:i,docs:o,parentClassReference:p,traits:l,constructorAccess:m}){super();c(this,"name");c(this,"namespace");c(this,"constructorAccess");c(this,"class_");this.name=e,this.namespace=n,this.constructorAccess=m!=null?m:"public",this.class_=new K({name:e,namespace:n,abstract:i,docs:o,parentClassReference:p,traits:l})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let n=pe(this.class_.fields).map(i=>Ue(Pe({},i),{name:Fn(i.name)}));n.length>0&&this.class_.addConstructor({access:this.constructorAccess,parameters:this.getConstructorParameters({orderedFields:n}),body:y.codeblock(i=>{for(let o of n)i.write(`$this->${o.name} = $${jn}['${o.name}']`),o.type.isOptional()&&i.write(" ?? null"),i.write(";")})}),this.class_.write(e)}allFieldsAreOptional(){return this.class_.fields.every(e=>e.type.isOptional())}getConstructorParameters({orderedFields:e}){return[new J({name:jn,type:B.typeDict(e.map(n=>({key:n.name,valueType:n.type,optional:n.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new I("[]"):void 0})]}};a();s();a();s();var X=class extends w{constructor({name:e,access:n,parameters:i,throws:o,return_:p,body:l,docs:m,classReference:d,static_:h}){super();c(this,"name");c(this,"access");c(this,"parameters");c(this,"throws");c(this,"return_");c(this,"body");c(this,"docs");c(this,"classReference");c(this,"static_");this.name=e,this.access=n,this.parameters=i,this.throws=o!=null?o:[],this.return_=p,this.body=l,this.docs=m,this.classReference=d,this.static_=h!=null?h:!1}write(e){var p;this.writeComment(e),e.write(`${this.access}${this.static_?" static":""} function ${this.name}(`);let n=this.parameters.filter(l=>!l.type.isOptional()),i=this.parameters.filter(l=>l.type.isOptional());[...n,...i].forEach((l,m)=>{m>0&&e.write(", "),l.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),(p=this.body)==null||p.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let n=new C({docs:this.docs});for(let i of this.parameters)n.addTag({tagType:"param",type:i.type,name:i.name,docs:i.docs});this.return_!=null&&this.return_!==Pn&&this.return_!==Un&&n.addTag({tagType:"return",type:this.return_});for(let i of this.throws)n.addTag({tagType:"throws",type:B.reference(i)});e.writeNode(n)}};var Te=class extends w{constructor({name:e,namespace:n,backing:i,docs:o,serializable:p}){super();c(this,"name");c(this,"namespace");c(this,"backing");c(this,"docs");c(this,"members",[]);c(this,"serializable");this.name=e,this.namespace=n,this.backing=i,this.docs=o,this.serializable=p!=null?p:!1}addMember(e){this.members.push(e)}write(e){this.writeComment(e),e.write("enum "),e.writeLine(`${this.name}`),this.backing!=null&&e.write(` : ${this.backing}`),this.serializable&&(e.addReference(new E({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let n of this.members)e.write(`case ${n.name}`),n.value!=null&&(typeof n.value=="string"?e.write(` = "${n.value}"`):e.write(` = ${n.value}`)),e.writeTextStatement("");this.serializable&&(e.newLine(),e.writeNode(new X({name:"jsonSerialize",return_:B.string(),access:"public",parameters:[],body:new I("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new C({docs:this.docs}).write(e)}};a();s();var ve=class extends w{constructor({name:e,type:n,access:i,readonly_:o,initializer:p,docs:l,inlineDocs:m,attributes:d,inherited:h}){super();c(this,"name");c(this,"type");c(this,"access");c(this,"readonly_");c(this,"initializer");c(this,"docs");c(this,"inlineDocs");c(this,"attributes");c(this,"inherited");this.name=fe(e),this.type=n,this.access=i,this.readonly_=o!=null?o:!1,this.initializer=p,this.docs=l,this.inlineDocs=m,this.attributes=d!=null?d:[],this.inherited=h!=null?h:!1}write(e){this.writeComment(e),this.writeAttributesIfPresent(e),e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null&&(e.write(" = "),this.initializer.write(e)),e.write(";"),this.inlineDocs!=null&&e.write(` // ${this.inlineDocs}`),e.newLine()}writeComment(e){let n=new C;n.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),n.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((n,i)=>{i>0&&e.write(", "),n.write(e)}),e.writeLine("]"))}};a();s();var Ae=class extends w{constructor({entries:e,multiline:n}){super();c(this,"entries");c(this,"multiline");this.entries=e!=null?e:[],this.multiline=n!=null?n:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:n,value:i}of this.entries)n.write(e),e.write(" => "),i.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[n,{key:i,value:o}]of this.entries.entries())n>0&&e.write(", "),i.write(e),e.write(" => "),o.write(e);e.write("]")}};a();s();var be=class extends w{constructor({name:e,namespace:n,docs:i,traits:o}){super();c(this,"name");c(this,"namespace");c(this,"docs");c(this,"traits");c(this,"fields",[]);c(this,"methods",[]);this.name=e,this.namespace=n,this.docs=i,this.traits=o!=null?o:[]}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeComment(e),e.write(`trait ${this.name} `),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((n,i)=>{i>0&&e.write(","),e.writeNode(n)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:pe(this.fields)}),this.fields.length>0&&this.methods.length>0&&e.newLine(),this.writeMethods({writer:e,methods:pe(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){let n=new C({docs:this.docs});for(let i of this.fields)n.addTag({tagType:"property",type:i.type,name:i.name});n.write(e)}writeFields({writer:e,fields:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};a();s();var ht=class extends w{constructor(e){super();c(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),Oe({writer:e,arguments_:this.arrays.map(n=>_e(i=>{if(typeof n=="string"||n instanceof w){i.writeNodeOrString(n);return}i.writeNodeOrString(n.ref),n.fallback&&(i.write(" ?? "),i.writeNodeOrString(n.fallback))}))})}};function Bf(r){return new ye(r)}function kf(r){return new we(r)}function Mf(r){return new K(r)}function Df(r){return new be(r)}function Ff(r){return new E(r)}function _e(r){return new I(r)}function jf(r){return new ge(r)}function $f(r){return new Te(r)}function Wf(r){return new ve(r)}function $n(r){return new F(r)}function Yf(r){return new Q(r)}function Gf(r){return _e(t=>{t.write("throw "),t.writeNode($n(r))})}function zf(r){return new Ae(r)}function qf(r){return new X(r)}function Vf(r){return new J(r)}function Hf(r){return new Fe(r)}function Kf(r,t){return _e(e=>{e.writeNodeOrString(r),e.write(" = "),e.writeNodeOrString(t)})}function Jf(r){return _e(fe(r))}function Qf(r){return _e(`"${r}"`)}function Xf(...r){return new ht(r)}function Zf(){return new I(r=>{r.write("$this")})}var Rt=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?y.TypeLiteral.null():(this.context.errors.add({severity:H.Critical,message:"Expected non-null value, but got null"}),y.TypeLiteral.nop());if(t.value===void 0)return y.TypeLiteral.nop();switch(t.typeReference.type){case"list":case"set":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?y.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"unknown":return this.convertUnknown({value:t.value});default:S(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let n=this.context.getValueAsBoolean({value:e});return n==null?y.TypeLiteral.nop():y.TypeLiteral.boolean(n)}case"string":{let n=this.context.getValueAsString({value:e});return n==null?y.TypeLiteral.nop():y.TypeLiteral.string(n)}default:S(t)}}convertList({list:t,value:e}){return Array.isArray(e)?y.TypeLiteral.list({values:e.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:H.Critical,message:`Expected array but got: ${typeof e}`}),y.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:H.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),y.TypeLiteral.nop()):y.TypeLiteral.map({entries:Object.entries(e).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:t.key,value:n,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:t,value:e,as:n}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"object":return this.convertObject({object_:t,value:e});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:S(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(n==null)return y.TypeLiteral.nop();let i=n.singleDiscriminatedUnionType,o=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:n,unionVariant:i});return o==null?y.TypeLiteral.nop():y.TypeLiteral.reference(y.codeblock(p=>{p.writeNode(y.invokeMethod({on:y.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),method:this.context.getMethodName(i.discriminantValue.name),arguments_:this.convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:n,unionVariant:i,unionProperties:o}),static_:!0}))}))}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){switch(e.type){case"samePropertiesAsObject":{let n=this.context.resolveNamedType({typeId:e.typeId});if(n==null)return;let i=this.convertNamed({named:n,value:t.value});if(!i.isClass()){this.context.errors.add({severity:H.Critical,message:"Internal error; expected union value to be an object"});return}return i.asClassOrThrow().fields}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let n=this.context.getRecord(t.value);return n==null?[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:t.value})}]:[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:n[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return[];default:S(e)}}convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:n}){let i=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});if(e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&n.length===1)return[...i,this.convert({typeReference:e.typeReference,value:t.value})];if(e.type==="samePropertiesAsObject"){let o=this.context.resolveNamedType({typeId:e.typeId});return o==null?[]:[...i,y.TypeLiteral.class_({reference:y.classReference({name:this.context.getClassName(o.declaration.name),namespace:this.context.getTypesNamespace(o.declaration.fernFilepath)}),fields:n})]}return i}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){var i,o;return this.context.associateByWireValue({parameters:(i=e.properties)!=null?i:[],values:(o=this.context.getRecord(t.value))!=null?o:{},ignoreMissingParameters:!0}).map(p=>{this.context.errors.scope(p.name.wireValue);try{return this.convert(p)}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e}){var i;let n=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return y.TypeLiteral.class_({reference:y.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),fields:n.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:t,value:e}){let n=this.getEnumValueName({enum_:t,value:e});return n==null?y.TypeLiteral.nop():y.TypeLiteral.reference(y.codeblock(i=>{i.writeNode(y.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)})),i.write("::"),i.write(n),i.write("->value")}))}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:H.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let n=t.values.find(i=>i.wireValue===e);if(n==null){this.context.errors.add({severity:H.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return this.context.getClassName(n.name)}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return n==null?y.TypeLiteral.nop():n}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let n of t.types)try{return this.convert({typeReference:n,value:e})}catch(i){continue}this.context.errors.add({severity:H.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t}){return y.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:n}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:n});return i==null?y.TypeLiteral.nop():y.TypeLiteral.number(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:n});return i==null?y.TypeLiteral.nop():y.TypeLiteral.boolean(i)}case"DATE":case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.datetime(i)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?y.TypeLiteral.nop():y.TypeLiteral.string(i)}default:S(t)}}getValueAsNumber({value:t,as:e}){let n=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:t,as:e}){let n=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:n})}};0&&(module.exports={DynamicTypeLiteralMapper});
19
19
  /*! Bundled license information:
20
20
 
21
21
  @esbuild-plugins/node-globals-polyfill/Buffer.js:
@@ -25,4 +25,16 @@ ${this.buffer}`:e+`
25
25
  * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
26
26
  * @license MIT
27
27
  *)
28
+
29
+ lodash-es/lodash.js:
30
+ (**
31
+ * @license
32
+ * Lodash (Custom Build) <https://lodash.com/>
33
+ * Build: `lodash modularize exports="es" -o ./`
34
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
35
+ * Released under MIT license <https://lodash.com/license>
36
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
37
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
38
+ *)
28
39
  */
40
+ //# sourceMappingURL=DynamicTypeLiteralMapper.cjs.map