@fern-api/java-dynamic-snippets 0.0.3 → 0.0.4

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 (76) hide show
  1. package/cjs/Config.cjs +1 -0
  2. package/cjs/Config.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.cjs +16 -11
  4. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
  5. package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
  6. package/cjs/{DynamicSnippetsGeneratorContext-B2BA5MLv.d.cts → DynamicSnippetsGeneratorContext-FbVOZ8Go.d.cts} +8 -5
  7. package/cjs/EndpointSnippetGenerator.cjs +12 -7
  8. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  9. package/cjs/EndpointSnippetGenerator.d.cts +4 -1
  10. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +16 -11
  11. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
  12. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  13. package/cjs/context/DynamicTypeLiteralMapper.cjs +12 -7
  14. package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -0
  15. package/cjs/context/DynamicTypeLiteralMapper.d.cts +1 -1
  16. package/cjs/context/DynamicTypeMapper.cjs +12 -7
  17. package/cjs/context/DynamicTypeMapper.cjs.map +1 -0
  18. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  19. package/cjs/context/FilePropertyMapper.cjs +12 -7
  20. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  21. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  22. package/cjs/index.cjs +26 -21
  23. package/cjs/index.cjs.map +1 -0
  24. package/cjs/index.d.cts +2 -2
  25. package/esm/Config.js +2 -1
  26. package/esm/Config.js.map +1 -0
  27. package/esm/DynamicSnippetsGenerator.d.ts +1 -1
  28. package/esm/DynamicSnippetsGenerator.js +2 -1
  29. package/esm/DynamicSnippetsGenerator.js.map +1 -0
  30. package/esm/{DynamicSnippetsGeneratorContext-B2BA5MLv.d.ts → DynamicSnippetsGeneratorContext-FbVOZ8Go.d.ts} +8 -5
  31. package/esm/EndpointSnippetGenerator.d.ts +4 -1
  32. package/esm/EndpointSnippetGenerator.js +2 -1
  33. package/esm/EndpointSnippetGenerator.js.map +1 -0
  34. package/esm/chunk-3JSOCWNQ.js +20 -0
  35. package/esm/chunk-3JSOCWNQ.js.map +1 -0
  36. package/esm/chunk-3LOINSB3.js +2 -0
  37. package/esm/chunk-3LOINSB3.js.map +1 -0
  38. package/esm/chunk-6YM2QG7U.js +2 -0
  39. package/esm/chunk-6YM2QG7U.js.map +1 -0
  40. package/esm/{chunk-2AZXIWKY.js → chunk-E6GFFTKW.js} +2 -1
  41. package/esm/chunk-E6GFFTKW.js.map +1 -0
  42. package/esm/chunk-JZ2FDMYI.js +15 -0
  43. package/esm/chunk-JZ2FDMYI.js.map +1 -0
  44. package/esm/{chunk-452HWDL4.js → chunk-JZBCQWQN.js} +2 -1
  45. package/esm/chunk-JZBCQWQN.js.map +1 -0
  46. package/esm/{chunk-7CY27UU7.js → chunk-PUPEW5QI.js} +2 -1
  47. package/esm/chunk-PUPEW5QI.js.map +1 -0
  48. package/esm/chunk-SQKACQJK.js +2 -0
  49. package/esm/chunk-SQKACQJK.js.map +1 -0
  50. package/esm/chunk-WBGWLNLI.js +2 -0
  51. package/esm/chunk-WBGWLNLI.js.map +1 -0
  52. package/esm/chunk-ZYVZJBJN.js +2 -0
  53. package/esm/chunk-ZYVZJBJN.js.map +1 -0
  54. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  55. package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
  56. package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
  57. package/esm/context/DynamicTypeLiteralMapper.d.ts +1 -1
  58. package/esm/context/DynamicTypeLiteralMapper.js +2 -1
  59. package/esm/context/DynamicTypeLiteralMapper.js.map +1 -0
  60. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  61. package/esm/context/DynamicTypeMapper.js +2 -1
  62. package/esm/context/DynamicTypeMapper.js.map +1 -0
  63. package/esm/context/FilePropertyMapper.d.ts +1 -1
  64. package/esm/context/FilePropertyMapper.js +2 -1
  65. package/esm/context/FilePropertyMapper.js.map +1 -0
  66. package/esm/index.d.ts +2 -2
  67. package/esm/index.js +12 -11
  68. package/esm/index.js.map +1 -0
  69. package/package.json +1 -1
  70. package/esm/chunk-AASPH6YC.js +0 -15
  71. package/esm/chunk-BKM7JFLZ.js +0 -1
  72. package/esm/chunk-HN67B7VQ.js +0 -1
  73. package/esm/chunk-JSEUWNSK.js +0 -1
  74. package/esm/chunk-N3DIPQCT.js +0 -14
  75. package/esm/chunk-TTNRR5YY.js +0 -1
  76. package/esm/chunk-WFKWXM7L.js +0 -1
@@ -1,18 +1,22 @@
1
- "use strict";var ce=Object.defineProperty,Ar=Object.defineProperties,Ir=Object.getOwnPropertyDescriptor,Er=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertyNames,fe=Object.getOwnPropertySymbols;var Le=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var Pe=(n,t,e)=>t in n?ce(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ye=(n,t)=>{for(var e in t||(t={}))Le.call(t,e)&&Pe(n,e,t[e]);if(fe)for(var e of fe(t))Ge.call(t,e)&&Pe(n,e,t[e]);return n},ze=(n,t)=>Ar(n,Er(t));var He=n=>typeof n=="symbol"?n:n+"",Je=(n,t)=>{var e={};for(var r in n)Le.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&fe)for(var r of fe(n))t.indexOf(r)<0&&Ge.call(n,r)&&(e[r]=n[r]);return e};var ke=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ze=(n,t)=>{for(var e in t)ce(n,e,{get:t[e],enumerable:!0})},Pr=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Cr(t))!Le.call(n,a)&&a!==e&&ce(n,a,{get:()=>t[a],enumerable:!(r=Ir(t,a))||r.enumerable});return n};var Lr=n=>Pr(ce({},"__esModule",{value:!0}),n);var c=(n,t,e)=>Pe(n,typeof t!="symbol"?t+"":t,e);function Xe(){throw new Error("setTimeout has not been defined")}function Qe(){throw new Error("clearTimeout has not been defined")}function et(n){if(M===setTimeout)return setTimeout(n,0);if((M===Xe||!M)&&setTimeout)return M=setTimeout,setTimeout(n,0);try{return M(n,0)}catch(t){try{return M.call(null,n,0)}catch(e){return M.call(this,n,0)}}}function kr(n){if(O===clearTimeout)return clearTimeout(n);if((O===Qe||!O)&&clearTimeout)return O=clearTimeout,clearTimeout(n);try{return O(n)}catch(t){try{return O.call(null,n)}catch(e){return O.call(this,n)}}}function Sr(){!X||!_||(X=!1,_.length?F=_.concat(F):de=-1,F.length&&tt())}function tt(){if(!X){var n=et(Sr);X=!0;for(var t=F.length;t;){for(_=F,F=[];++de<t;)_&&_[de].run();de=-1,t=F.length}_=null,X=!1,kr(n)}}function Fr(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];F.push(new rt(n,t)),F.length===1&&!X&&et(tt)}function rt(n,t){this.fun=n,this.array=t}function D(){}function Zr(n){throw new Error("process.binding is not supported")}function Kr(){return"/"}function Xr(n){throw new Error("process.chdir is not supported")}function Qr(){return 0}function tn(n){var t=en.call(K)*.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 nn(){var n=new Date,t=n-rn;return t/1e3}var M,O,F,X,_,de,Ur,Br,Mr,Or,jr,_r,Dr,Vr,Wr,$r,qr,Gr,Yr,zr,Hr,Jr,K,en,rn,d,Ke,u=ke(()=>{"use strict";M=Xe,O=Qe;typeof globalThis.setTimeout=="function"&&(M=setTimeout);typeof globalThis.clearTimeout=="function"&&(O=clearTimeout);F=[],X=!1,de=-1;rt.prototype.run=function(){this.fun.apply(null,this.array)};Ur="browser",Br="browser",Mr=!0,Or={},jr=[],_r="",Dr={},Vr={},Wr={};$r=D,qr=D,Gr=D,Yr=D,zr=D,Hr=D,Jr=D;K=globalThis.performance||{},en=K.now||K.mozNow||K.msNow||K.oNow||K.webkitNow||function(){return new Date().getTime()};rn=new Date;d={nextTick:Fr,title:Ur,browser:Mr,env:Or,argv:jr,version:_r,versions:Dr,on:$r,addListener:qr,once:Gr,off:Yr,removeListener:zr,removeAllListeners:Hr,emit:Jr,binding:Zr,cwd:Kr,chdir:Xr,umask:Qr,hrtime:tn,platform:Br,release:Vr,config:Wr,uptime:nn},Ke={};Object.keys(Ke).forEach(n=>{let t=n.split("."),e=d;for(let r=0;r<t.length;r++){let a=t[r];r===t.length-1?e[a]=Ke[n]:e=e[a]||(e[a]={})}})});function ot(){Fe=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)P[t]=n[t],C[n.charCodeAt(t)]=t;C[45]=62,C[95]=63}function on(n){Fe||ot();var t,e,r,a,i,o,f=n.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i=n[f-2]==="="?2:n[f-1]==="="?1:0,o=new an(f*3/4-i),r=i>0?f-4:f;var m=0;for(t=0,e=0;t<r;t+=4,e+=3)a=C[n.charCodeAt(t)]<<18|C[n.charCodeAt(t+1)]<<12|C[n.charCodeAt(t+2)]<<6|C[n.charCodeAt(t+3)],o[m++]=a>>16&255,o[m++]=a>>8&255,o[m++]=a&255;return i===2?(a=C[n.charCodeAt(t)]<<2|C[n.charCodeAt(t+1)]>>4,o[m++]=a&255):i===1&&(a=C[n.charCodeAt(t)]<<10|C[n.charCodeAt(t+1)]<<4|C[n.charCodeAt(t+2)]>>2,o[m++]=a>>8&255,o[m++]=a&255),o}function sn(n){return P[n>>18&63]+P[n>>12&63]+P[n>>6&63]+P[n&63]}function un(n,t,e){for(var r,a=[],i=t;i<e;i+=3)r=(n[i]<<16)+(n[i+1]<<8)+n[i+2],a.push(sn(r));return a.join("")}function nt(n){Fe||ot();for(var t,e=n.length,r=e%3,a="",i=[],o=16383,f=0,m=e-r;f<m;f+=o)i.push(un(n,f,f+o>m?m:f+o));return r===1?(t=n[e-1],a+=P[t>>2],a+=P[t<<4&63],a+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],a+=P[t>>10],a+=P[t>>4&63],a+=P[t<<2&63],a+="="),i.push(a),i.join("")}function me(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(n,t){if(me()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=s.prototype):(n===null&&(n=new s(t)),n.length=t),n}function s(n,t,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Ue(this,n)}return st(this,n,t,e)}function st(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?fn(n,t,e,r):typeof t=="string"?pn(n,t,e):cn(n,t)}function ut(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 ln(n,t,e,r){return ut(t),t<=0?U(n,t):e!==void 0?typeof r=="string"?U(n,t).fill(e,r):U(n,t).fill(e):U(n,t)}function Ue(n,t){if(ut(t),n=U(n,t<0?0:Be(t)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function pn(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=lt(t,e)|0;n=U(n,r);var a=n.write(t,e);return a!==r&&(n=n.slice(0,a)),n}function Se(n,t){var e=t.length<0?0:Be(t.length)|0;n=U(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function fn(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),s.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=s.prototype):n=Se(n,t),n}function cn(n,t){if(L(t)){var e=Be(t.length)|0;return n=U(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||kn(t.length)?U(n,0):Se(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Se(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Be(n){if(n>=me())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+me().toString(16)+" bytes");return n|0}function L(n){return!!(n!=null&&n._isBuffer)}function lt(n,t){if(L(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 he(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return yt(n).length;default:if(r)return he(n).length;t=(""+t).toLowerCase(),r=!0}}function dn(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 Nn(this,t,e);case"utf8":case"utf-8":return ct(this,t,e);case"ascii":return Tn(this,t,e);case"latin1":case"binary":return Rn(this,t,e);case"base64":return vn(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bn(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function V(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function pt(n,t,e,r,a){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=a?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(a)return-1;e=n.length-1}else if(e<0)if(a)e=0;else return-1;if(typeof t=="string"&&(t=s.from(t,r)),L(t))return t.length===0?-1:at(n,t,e,r,a);if(typeof t=="number")return t=t&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):at(n,[t],e,r,a);throw new TypeError("val must be string, number or Buffer")}function at(n,t,e,r,a){var i=1,o=n.length,f=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;i=2,o/=2,f/=2,e/=2}function m(N,E){return i===1?N[E]:N.readUInt16BE(E*i)}var y;if(a){var v=-1;for(y=e;y<o;y++)if(m(n,y)===m(t,v===-1?0:y-v)){if(v===-1&&(v=y),y-v+1===f)return v*i}else v!==-1&&(y-=y-v),v=-1}else for(e+f>o&&(e=o-f),y=e;y>=0;y--){for(var h=!0,b=0;b<f;b++)if(m(n,y+b)!==m(t,b)){h=!1;break}if(h)return y}return-1}function mn(n,t,e,r){e=Number(e)||0;var a=n.length-e;r?(r=Number(r),r>a&&(r=a)):r=a;var i=t.length;if(i%2!==0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var o=0;o<r;++o){var f=parseInt(t.substr(o*2,2),16);if(isNaN(f))return o;n[e+o]=f}return o}function hn(n,t,e,r){return ge(he(t,n.length-e),n,e,r)}function ft(n,t,e,r){return ge(Pn(t),n,e,r)}function yn(n,t,e,r){return ft(n,t,e,r)}function xn(n,t,e,r){return ge(yt(t),n,e,r)}function gn(n,t,e,r){return ge(Ln(t,n.length-e),n,e,r)}function vn(n,t,e){return t===0&&e===n.length?nt(n):nt(n.slice(t,e))}function ct(n,t,e){e=Math.min(n.length,e);for(var r=[],a=t;a<e;){var i=n[a],o=null,f=i>239?4:i>223?3:i>191?2:1;if(a+f<=e){var m,y,v,h;switch(f){case 1:i<128&&(o=i);break;case 2:m=n[a+1],(m&192)===128&&(h=(i&31)<<6|m&63,h>127&&(o=h));break;case 3:m=n[a+1],y=n[a+2],(m&192)===128&&(y&192)===128&&(h=(i&15)<<12|(m&63)<<6|y&63,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:m=n[a+1],y=n[a+2],v=n[a+3],(m&192)===128&&(y&192)===128&&(v&192)===128&&(h=(i&15)<<18|(m&63)<<12|(y&63)<<6|v&63,h>65535&&h<1114112&&(o=h))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),a+=f}return wn(r)}function wn(n){var t=n.length;if(t<=it)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=it));return e}function Tn(n,t,e){var r="";e=Math.min(n.length,e);for(var a=t;a<e;++a)r+=String.fromCharCode(n[a]&127);return r}function Rn(n,t,e){var r="";e=Math.min(n.length,e);for(var a=t;a<e;++a)r+=String.fromCharCode(n[a]);return r}function Nn(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var a="",i=t;i<e;++i)a+=Cn(n[i]);return a}function bn(n,t,e){for(var r=n.slice(t,e),a="",i=0;i<r.length;i+=2)a+=String.fromCharCode(r[i]+r[i+1]*256);return a}function R(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,a,i){if(!L(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||t<i)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function ye(n,t,e,r){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(n.length-e,2);a<i;++a)n[e+a]=(t&255<<8*(r?a:1-a))>>>(r?a:1-a)*8}function xe(n,t,e,r){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(n.length-e,4);a<i;++a)n[e+a]=t>>>(r?a:3-a)*8&255}function dt(n,t,e,r,a,i){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function mt(n,t,e,r,a){return a||dt(n,t,e,4,34028234663852886e22,-34028234663852886e22),gt(n,t,e,r,23,4),e+4}function ht(n,t,e,r,a){return a||dt(n,t,e,8,17976931348623157e292,-17976931348623157e292),gt(n,t,e,r,52,8),e+8}function In(n){if(n=En(n).replace(An,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function En(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Cn(n){return n<16?"0"+n.toString(16):n.toString(16)}function he(n,t){t=t||1/0;for(var e,r=n.length,a=null,i=[],o=0;o<r;++o){if(e=n.charCodeAt(o),e>55295&&e<57344){if(!a){if(e>56319){(t-=3)>-1&&i.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&i.push(239,191,189);continue}a=e;continue}if(e<56320){(t-=3)>-1&&i.push(239,191,189),a=e;continue}e=(a-55296<<10|e-56320)+65536}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,e<128){if((t-=1)<0)break;i.push(e)}else if(e<2048){if((t-=2)<0)break;i.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;i.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return i}function Pn(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Ln(n,t){for(var e,r,a,i=[],o=0;o<n.length&&!((t-=2)<0);++o)e=n.charCodeAt(o),r=e>>8,a=e%256,i.push(a),i.push(r);return i}function yt(n){return on(In(n))}function ge(n,t,e,r){for(var a=0;a<r&&!(a+e>=t.length||a>=n.length);++a)t[a+e]=n[a];return a}function kn(n){return n!==n}function Sn(n){return n!=null&&(!!n._isBuffer||xt(n)||Fn(n))}function xt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Fn(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&xt(n.slice(0,0))}function ve(n,t,e,r,a){var i,o,f=a*8-r-1,m=(1<<f)-1,y=m>>1,v=-7,h=e?a-1:0,b=e?-1:1,N=n[t+h];for(h+=b,i=N&(1<<-v)-1,N>>=-v,v+=f;v>0;i=i*256+n[t+h],h+=b,v-=8);for(o=i&(1<<-v)-1,i>>=-v,v+=r;v>0;o=o*256+n[t+h],h+=b,v-=8);if(i===0)i=1-y;else{if(i===m)return o?NaN:(N?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-y}return(N?-1:1)*o*Math.pow(2,i-r)}function gt(n,t,e,r,a,i){var o,f,m,y=i*8-a-1,v=(1<<y)-1,h=v>>1,b=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=r?0:i-1,E=r?1:-1,br=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,o=v):(o=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-o))<1&&(o--,m*=2),o+h>=1?t+=b/m:t+=b*Math.pow(2,1-h),t*m>=2&&(o++,m/=2),o+h>=v?(f=0,o=v):o+h>=1?(f=(t*m-1)*Math.pow(2,a),o=o+h):(f=t*Math.pow(2,h-1)*Math.pow(2,a),o=0));a>=8;n[e+N]=f&255,N+=E,f/=256,a-=8);for(o=o<<a|f,y+=a;y>0;n[e+N]=o&255,N+=E,o/=256,y-=8);n[e+N-E]|=br*128}var P,C,an,Fe,it,An,vt=ke(()=>{"use strict";u();l();P=[],C=[],an=typeof Uint8Array!="undefined"?Uint8Array:Array,Fe=!1;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;s.poolSize=8192;s._augment=function(n){return n.__proto__=s.prototype,n};s.from=function(n,t,e){return st(null,n,t,e)};s.kMaxLength=me();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&s[Symbol.species]);s.alloc=function(n,t,e){return ln(null,n,t,e)};s.allocUnsafe=function(n){return Ue(null,n)};s.allocUnsafeSlow=function(n){return Ue(null,n)};s.isBuffer=Sn;s.compare=function(t,e){if(!L(t)||!L(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,a=e.length,i=0,o=Math.min(r,a);i<o;++i)if(t[i]!==e[i]){r=t[i],a=e[i];break}return r<a?-1:a<r?1:0};s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return s.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var a=s.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!L(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,i),i+=o.length}return a};s.byteLength=lt;s.prototype._isBuffer=!0;s.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)V(this,e,e+1);return this};s.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)V(this,e,e+3),V(this,e+1,e+2);return this};s.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)V(this,e,e+7),V(this,e+1,e+6),V(this,e+2,e+5),V(this,e+3,e+4);return this};s.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?ct(this,0,t):dn.apply(this,arguments)};s.prototype.equals=function(t){if(!L(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:s.compare(this,t)===0};s.prototype.compare=function(t,e,r,a,i){if(!L(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),a===void 0&&(a=0),i===void 0&&(i=this.length),e<0||r>t.length||a<0||i>this.length)throw new RangeError("out of range index");if(a>=i&&e>=r)return 0;if(a>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,a>>>=0,i>>>=0,this===t)return 0;for(var o=i-a,f=r-e,m=Math.min(o,f),y=this.slice(a,i),v=t.slice(e,r),h=0;h<m;++h)if(y[h]!==v[h]){o=y[h],f=v[h];break}return o<f?-1:f<o?1:0};s.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};s.prototype.indexOf=function(t,e,r){return pt(this,t,e,r,!0)};s.prototype.lastIndexOf=function(t,e,r){return pt(this,t,e,r,!1)};s.prototype.write=function(t,e,r,a){if(e===void 0)a="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")a=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,a===void 0&&(a="utf8")):(a=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-e;if((r===void 0||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var o=!1;;)switch(a){case"hex":return mn(this,t,e,r);case"utf8":case"utf-8":return hn(this,t,e,r);case"ascii":return ft(this,t,e,r);case"latin1":case"binary":return yn(this,t,e,r);case"base64":return xn(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gn(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};it=4096;s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var a;if(s.TYPED_ARRAY_SUPPORT)a=this.subarray(t,e),a.__proto__=s.prototype;else{var i=e-t;a=new s(i,void 0);for(var o=0;o<i;++o)a[o]=this[o+t]}return a};s.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var a=this[t],i=1,o=0;++o<e&&(i*=256);)a+=this[t+o]*i;return a};s.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var a=this[t+--e],i=1;e>0&&(i*=256);)a+=this[t+--e]*i;return a};s.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]};s.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8};s.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]};s.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};s.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};s.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var a=this[t],i=1,o=0;++o<e&&(i*=256);)a+=this[t+o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a};s.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var a=e,i=1,o=this[t+--a];a>0&&(i*=256);)o+=this[t+--a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o};s.prototype.readInt8=function(t,e){return e||R(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};s.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};s.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};s.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};s.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};s.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),ve(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),ve(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),ve(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),ve(this,t,!1,52,8)};s.prototype.writeUIntLE=function(t,e,r,a){if(t=+t,e=e|0,r=r|0,!a){var i=Math.pow(2,8*r)-1;A(this,t,e,r,i,0)}var o=1,f=0;for(this[e]=t&255;++f<r&&(o*=256);)this[e+f]=t/o&255;return e+r};s.prototype.writeUIntBE=function(t,e,r,a){if(t=+t,e=e|0,r=r|0,!a){var i=Math.pow(2,8*r)-1;A(this,t,e,r,i,0)}var o=r-1,f=1;for(this[e+o]=t&255;--o>=0&&(f*=256);)this[e+o]=t/f&255;return e+r};s.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ye(this,t,e,!0),e+2};s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ye(this,t,e,!1),e+2};s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):xe(this,t,e,!0),e+4};s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):xe(this,t,e,!1),e+4};s.prototype.writeIntLE=function(t,e,r,a){if(t=+t,e=e|0,!a){var i=Math.pow(2,8*r-1);A(this,t,e,r,i-1,-i)}var o=0,f=1,m=0;for(this[e]=t&255;++o<r&&(f*=256);)t<0&&m===0&&this[e+o-1]!==0&&(m=1),this[e+o]=(t/f>>0)-m&255;return e+r};s.prototype.writeIntBE=function(t,e,r,a){if(t=+t,e=e|0,!a){var i=Math.pow(2,8*r-1);A(this,t,e,r,i-1,-i)}var o=r-1,f=1,m=0;for(this[e+o]=t&255;--o>=0&&(f*=256);)t<0&&m===0&&this[e+o+1]!==0&&(m=1),this[e+o]=(t/f>>0)-m&255;return e+r};s.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};s.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ye(this,t,e,!0),e+2};s.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ye(this,t,e,!1),e+2};s.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||A(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):xe(this,t,e,!0),e+4};s.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),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):xe(this,t,e,!1),e+4};s.prototype.writeFloatLE=function(t,e,r){return mt(this,t,e,!0,r)};s.prototype.writeFloatBE=function(t,e,r){return mt(this,t,e,!1,r)};s.prototype.writeDoubleLE=function(t,e,r){return ht(this,t,e,!0,r)};s.prototype.writeDoubleBE=function(t,e,r){return ht(this,t,e,!1,r)};s.prototype.copy=function(t,e,r,a){if(r||(r=0),!a&&a!==0&&(a=this.length),e>=t.length&&(e=t.length),e||(e=0),a>0&&a<r&&(a=r),a===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(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),t.length-e<a-r&&(a=t.length-e+r);var i=a-r,o;if(this===t&&r<e&&e<a)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i};s.prototype.fill=function(t,e,r,a){if(typeof t=="string"){if(typeof e=="string"?(a=e,e=0,r=this.length):typeof r=="string"&&(a=r,r=this.length),t.length===1){var i=t.charCodeAt(0);i<256&&(t=i)}if(a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!s.isEncoding(a))throw new TypeError("Unknown encoding: "+a)}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 f=L(t)?t:he(new s(t,a).toString()),m=f.length;for(o=0;o<r-e;++o)this[o+e]=f[o%m]}return this};An=/[^+\/0-9A-Za-z-_]/g});var l=ke(()=>{"use strict";vt()});var zi={};Ze(zi,{DynamicSnippetsGenerator:()=>qe});module.exports=Lr(zi);u();l();u();l();u();l();function x(n){throw new Error("Unexpected value: "+JSON.stringify(n))}u();l();function ee(n){return Object.keys(n)}u();l();u();l();u();l();u();l();u();l();u();l();var Un=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,wt=Un;var Bn=typeof self=="object"&&self&&self.Object===Object&&self,Mn=wt||Bn||Function("return this")(),Tt=Mn;var On=Tt.Symbol,B=On;u();l();var Rt=Object.prototype,jn=Rt.hasOwnProperty,_n=Rt.toString,te=B?B.toStringTag:void 0;function Dn(n){var t=jn.call(n,te),e=n[te];try{n[te]=void 0;var r=!0}catch(i){}var a=_n.call(n);return r&&(t?n[te]=e:delete n[te]),a}var Nt=Dn;u();l();var Vn=Object.prototype,Wn=Vn.toString;function $n(n){return Wn.call(n)}var bt=$n;var qn="[object Null]",Gn="[object Undefined]",At=B?B.toStringTag:void 0;function Yn(n){return n==null?n===void 0?Gn:qn:At&&At in Object(n)?Nt(n):bt(n)}var It=Yn;u();l();function zn(n){return n!=null&&typeof n=="object"}var Et=zn;var Hn="[object Symbol]";function Jn(n){return typeof n=="symbol"||Et(n)&&It(n)==Hn}var Ct=Jn;u();l();u();l();function Zn(n,t){for(var e=-1,r=n==null?0:n.length,a=Array(r);++e<r;)a[e]=t(n[e],e,n);return a}var Pt=Zn;u();l();var Kn=Array.isArray,Lt=Kn;var Xn=1/0,kt=B?B.prototype:void 0,St=kt?kt.toString:void 0;function Ft(n){if(typeof n=="string")return n;if(Lt(n))return Pt(n,Ft)+"";if(Ct(n))return St?St.call(n):"";var t=n+"";return t=="0"&&1/n==-Xn?"-0":t}var Ut=Ft;u();l();function Qn(n){return n==null?"":Ut(n)}var j=Qn;u();l();u();l();u();l();u();l();u();l();u();l();function ea(n,t,e){var r=-1,a=n.length;t<0&&(t=-t>a?0:a+t),e=e>a?a:e,e<0&&(e+=a),a=t>e?0:e-t>>>0,t>>>=0;for(var i=Array(a);++r<a;)i[r]=n[r+t];return i}var Bt=ea;function ta(n,t,e){var r=n.length;return e=e===void 0?r:e,!t&&e>=r?n:Bt(n,t,e)}var Mt=ta;u();l();var ra="\\ud800-\\udfff",na="\\u0300-\\u036f",aa="\\ufe20-\\ufe2f",ia="\\u20d0-\\u20ff",oa=na+aa+ia,sa="\\ufe0e\\ufe0f",ua="\\u200d",la=RegExp("["+ua+ra+oa+sa+"]");function pa(n){return la.test(n)}var we=pa;u();l();u();l();function fa(n){return n.split("")}var Ot=fa;u();l();var jt="\\ud800-\\udfff",ca="\\u0300-\\u036f",da="\\ufe20-\\ufe2f",ma="\\u20d0-\\u20ff",ha=ca+da+ma,ya="\\ufe0e\\ufe0f",xa="["+jt+"]",Me="["+ha+"]",Oe="\\ud83c[\\udffb-\\udfff]",ga="(?:"+Me+"|"+Oe+")",_t="[^"+jt+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Vt="[\\ud800-\\udbff][\\udc00-\\udfff]",va="\\u200d",Wt=ga+"?",$t="["+ya+"]?",wa="(?:"+va+"(?:"+[_t,Dt,Vt].join("|")+")"+$t+Wt+")*",Ta=$t+Wt+wa,Ra="(?:"+[_t+Me+"?",Me,Dt,Vt,xa].join("|")+")",Na=RegExp(Oe+"(?="+Oe+")|"+Ra+Ta,"g");function ba(n){return n.match(Na)||[]}var qt=ba;function Aa(n){return we(n)?qt(n):Ot(n)}var Gt=Aa;function Ia(n){return function(t){t=j(t);var e=we(t)?Gt(t):void 0,r=e?e[0]:t.charAt(0),a=e?Mt(e,1).join(""):t.slice(1);return r[n]()+a}}var Yt=Ia;var Ea=Yt("toUpperCase"),zt=Ea;function Ca(n){return zt(j(n).toLowerCase())}var Ht=Ca;u();l();u();l();function Pa(n,t,e,r){var a=-1,i=n==null?0:n.length;for(r&&i&&(e=n[++a]);++a<i;)e=t(e,n[a],a,n);return e}var Jt=Pa;u();l();u();l();u();l();function La(n){return function(t){return n==null?void 0:n[t]}}var Zt=La;var ka={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Sa=Zt(ka),Kt=Sa;var Fa=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ua="\\u0300-\\u036f",Ba="\\ufe20-\\ufe2f",Ma="\\u20d0-\\u20ff",Oa=Ua+Ba+Ma,ja="["+Oa+"]",_a=RegExp(ja,"g");function Da(n){return n=j(n),n&&n.replace(Fa,Kt).replace(_a,"")}var Xt=Da;u();l();u();l();var Va=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Wa(n){return n.match(Va)||[]}var Qt=Wa;u();l();var $a=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function qa(n){return $a.test(n)}var er=qa;u();l();var ir="\\ud800-\\udfff",Ga="\\u0300-\\u036f",Ya="\\ufe20-\\ufe2f",za="\\u20d0-\\u20ff",Ha=Ga+Ya+za,or="\\u2700-\\u27bf",sr="a-z\\xdf-\\xf6\\xf8-\\xff",Ja="\\xac\\xb1\\xd7\\xf7",Za="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ka="\\u2000-\\u206f",Xa=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ur="A-Z\\xc0-\\xd6\\xd8-\\xde",Qa="\\ufe0e\\ufe0f",lr=Ja+Za+Ka+Xa,pr="['\u2019]",tr="["+lr+"]",ei="["+Ha+"]",fr="\\d+",ti="["+or+"]",cr="["+sr+"]",dr="[^"+ir+lr+fr+or+sr+ur+"]",ri="\\ud83c[\\udffb-\\udfff]",ni="(?:"+ei+"|"+ri+")",ai="[^"+ir+"]",mr="(?:\\ud83c[\\udde6-\\uddff]){2}",hr="[\\ud800-\\udbff][\\udc00-\\udfff]",Q="["+ur+"]",ii="\\u200d",rr="(?:"+cr+"|"+dr+")",oi="(?:"+Q+"|"+dr+")",nr="(?:"+pr+"(?:d|ll|m|re|s|t|ve))?",ar="(?:"+pr+"(?:D|LL|M|RE|S|T|VE))?",yr=ni+"?",xr="["+Qa+"]?",si="(?:"+ii+"(?:"+[ai,mr,hr].join("|")+")"+xr+yr+")*",ui="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",li="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",pi=xr+yr+si,fi="(?:"+[ti,mr,hr].join("|")+")"+pi,ci=RegExp([Q+"?"+cr+"+"+nr+"(?="+[tr,Q,"$"].join("|")+")",oi+"+"+ar+"(?="+[tr,Q+rr,"$"].join("|")+")",Q+"?"+rr+"+"+nr,Q+"+"+ar,li,ui,fr,fi].join("|"),"g");function di(n){return n.match(ci)||[]}var gr=di;function mi(n,t,e){return n=j(n),t=e?void 0:t,t===void 0?er(n)?gr(n):Qt(n):n.match(t)||[]}var vr=mi;var hi="['\u2019]",yi=RegExp(hi,"g");function xi(n){return function(t){return Jt(vr(Xt(t).replace(yi,"")),n,"")}}var wr=xi;var gi=wr(function(n,t,e){return t=t.toLowerCase(),n+(e?Ht(t):t)}),je=gi;u();l();u();l();var W=class{};u();l();u();l();var k=class extends W{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var vi=4,re=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
- `),r=e?t.substring(0,t.length-1):t,a=this.getIndentString(),i=r.replaceAll(`
1
+ "use strict";var yt=Object.defineProperty,Jn=Object.defineProperties,Kn=Object.getOwnPropertyDescriptor,Xn=Object.getOwnPropertyDescriptors,Qn=Object.getOwnPropertyNames,ht=Object.getOwnPropertySymbols;var Vt=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable;var Dt=(n,e,t)=>e in n?yt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,m=(n,e)=>{for(var t in e||(e={}))Vt.call(e,t)&&Dt(n,t,e[t]);if(ht)for(var t of ht(e))ir.call(e,t)&&Dt(n,t,e[t]);return n},_=(n,e)=>Jn(n,Xn(e));var sr=n=>typeof n=="symbol"?n:n+"",or=(n,e)=>{var t={};for(var r in n)Vt.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&ht)for(var r of ht(n))e.indexOf(r)<0&&ir.call(n,r)&&(t[r]=n[r]);return t};var $t=(n,e)=>()=>(n&&(e=n(n=0)),e);var Wt=(n,e)=>{for(var t in e)yt(n,t,{get:e[t],enumerable:!0})},ea=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Qn(e))!Vt.call(n,a)&&a!==t&&yt(n,a,{get:()=>e[a],enumerable:!(r=Kn(e,a))||r.enumerable});return n};var ta=n=>ea(yt({},"__esModule",{value:!0}),n);var x=(n,e,t)=>Dt(n,typeof e!="symbol"?e+"":e,t);function cr(){throw new Error("setTimeout has not been defined")}function lr(){throw new Error("clearTimeout has not been defined")}function fr(n){if(ce===setTimeout)return setTimeout(n,0);if((ce===cr||!ce)&&setTimeout)return ce=setTimeout,setTimeout(n,0);try{return ce(n,0)}catch(e){try{return ce.call(null,n,0)}catch(t){return ce.call(this,n,0)}}}function ra(n){if(le===clearTimeout)return clearTimeout(n);if((le===lr||!le)&&clearTimeout)return le=clearTimeout,clearTimeout(n);try{return le(n)}catch(e){try{return le.call(null,n)}catch(t){return le.call(this,n)}}}function na(){!ze||!ye||(ze=!1,ye.length?re=ye.concat(re):gt=-1,re.length&&pr())}function pr(){if(!ze){var n=fr(na);ze=!0;for(var e=re.length;e;){for(ye=re,re=[];++gt<e;)ye&&ye[gt].run();gt=-1,e=re.length}ye=null,ze=!1,ra(n)}}function aa(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];re.push(new dr(n,e)),re.length===1&&!ze&&fr(pr)}function dr(n,e){this.fun=n,this.array=e}function ge(){}function ba(n){throw new Error("process.binding is not supported")}function Ta(){return"/"}function _a(n){throw new Error("process.chdir is not supported")}function ka(){return 0}function Na(n){var e=Ra.call(qe)*.001,t=Math.floor(e),r=Math.floor(e%1*1e9);return n&&(t=t-n[0],r=r-n[1],r<0&&(t--,r+=1e9)),[t,r]}function Ia(){var n=new Date,e=n-Aa;return e/1e3}var ce,le,re,ze,ye,gt,ia,sa,oa,ua,ca,la,fa,pa,da,ma,ha,ya,ga,xa,va,wa,qe,Ra,Aa,g,ur,c=$t(()=>{"use strict";ce=cr,le=lr;typeof globalThis.setTimeout=="function"&&(ce=setTimeout);typeof globalThis.clearTimeout=="function"&&(le=clearTimeout);re=[],ze=!1,gt=-1;dr.prototype.run=function(){this.fun.apply(null,this.array)};ia="browser",sa="browser",oa=!0,ua={},ca=[],la="",fa={},pa={},da={};ma=ge,ha=ge,ya=ge,ga=ge,xa=ge,va=ge,wa=ge;qe=globalThis.performance||{},Ra=qe.now||qe.mozNow||qe.msNow||qe.oNow||qe.webkitNow||function(){return new Date().getTime()};Aa=new Date;g={nextTick:aa,title:ia,browser:oa,env:ua,argv:ca,version:la,versions:fa,on:ma,addListener:ha,once:ya,off:ga,removeListener:xa,removeAllListeners:va,emit:wa,binding:ba,cwd:Ta,chdir:_a,umask:ka,hrtime:Na,platform:sa,release:pa,config:da,uptime:Ia},ur={};Object.keys(ur).forEach(n=>{let e=n.split("."),t=g;for(let r=0;r<e.length;r++){let a=e[r];r===e.length-1?t[a]=ur[n]:t=t[a]||(t[a]={})}})});function gr(){zt=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=n.length;e<t;++e)K[e]=n[e],q[n.charCodeAt(e)]=e;q[45]=62,q[95]=63}function Sa(n){zt||gr();var e,t,r,a,i,s,o=n.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i=n[o-2]==="="?2:n[o-1]==="="?1:0,s=new Ea(o*3/4-i),r=i>0?o-4:o;var f=0;for(e=0,t=0;e<r;e+=4,t+=3)a=q[n.charCodeAt(e)]<<18|q[n.charCodeAt(e+1)]<<12|q[n.charCodeAt(e+2)]<<6|q[n.charCodeAt(e+3)],s[f++]=a>>16&255,s[f++]=a>>8&255,s[f++]=a&255;return i===2?(a=q[n.charCodeAt(e)]<<2|q[n.charCodeAt(e+1)]>>4,s[f++]=a&255):i===1&&(a=q[n.charCodeAt(e)]<<10|q[n.charCodeAt(e+1)]<<4|q[n.charCodeAt(e+2)]>>2,s[f++]=a>>8&255,s[f++]=a&255),s}function Ca(n){return K[n>>18&63]+K[n>>12&63]+K[n>>6&63]+K[n&63]}function Pa(n,e,t){for(var r,a=[],i=e;i<t;i+=3)r=(n[i]<<16)+(n[i+1]<<8)+n[i+2],a.push(Ca(r));return a.join("")}function mr(n){zt||gr();for(var e,t=n.length,r=t%3,a="",i=[],s=16383,o=0,f=t-r;o<f;o+=s)i.push(Pa(n,o,o+s>f?f:o+s));return r===1?(e=n[t-1],a+=K[e>>2],a+=K[e<<4&63],a+="=="):r===2&&(e=(n[t-2]<<8)+n[t-1],a+=K[e>>10],a+=K[e>>4&63],a+=K[e<<2&63],a+="="),i.push(a),i.join("")}function xt(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ne(n,e){if(xt()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(e),n.__proto__=u.prototype):(n===null&&(n=new u(e)),n.length=e),n}function u(n,e,t){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(n,e,t);if(typeof n=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return Zt(this,n)}return xr(this,n,e,t)}function xr(n,e,t,r){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&e instanceof ArrayBuffer?Oa(n,e,t,r):typeof e=="string"?Fa(n,e,t):Ua(n,e)}function vr(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 La(n,e,t,r){return vr(e),e<=0?ne(n,e):t!==void 0?typeof r=="string"?ne(n,e).fill(t,r):ne(n,e).fill(t):ne(n,e)}function Zt(n,e){if(vr(e),n=ne(n,e<0?0:Gt(e)|0),!u.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)n[t]=0;return n}function Fa(n,e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!u.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var r=wr(e,t)|0;n=ne(n,r);var a=n.write(e,t);return a!==r&&(n=n.slice(0,a)),n}function qt(n,e){var t=e.length<0?0:Gt(e.length)|0;n=ne(n,t);for(var r=0;r<t;r+=1)n[r]=e[r]&255;return n}function Oa(n,e,t,r){if(e.byteLength,t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(r||0))throw new RangeError("'length' is out of bounds");return t===void 0&&r===void 0?e=new Uint8Array(e):r===void 0?e=new Uint8Array(e,t):e=new Uint8Array(e,t,r),u.TYPED_ARRAY_SUPPORT?(n=e,n.__proto__=u.prototype):n=qt(n,e),n}function Ua(n,e){if(X(e)){var t=Gt(e.length)|0;return n=ne(n,t),n.length===0||e.copy(n,0,0,t),n}if(e){if(typeof ArrayBuffer!="undefined"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||ti(e.length)?ne(n,0):qt(n,e);if(e.type==="Buffer"&&Array.isArray(e.data))return qt(n,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Gt(n){if(n>=xt())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+xt().toString(16)+" bytes");return n|0}function X(n){return!!(n!=null&&n._isBuffer)}function wr(n,e){if(X(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 t=n.length;if(t===0)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return vt(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ar(n).length;default:if(r)return vt(n).length;e=(""+e).toLowerCase(),r=!0}}function ja(n,e,t){var r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(n||(n="utf8");;)switch(n){case"hex":return Ga(this,e,t);case"utf8":case"utf-8":return _r(this,e,t);case"ascii":return za(this,e,t);case"latin1":case"binary":return Za(this,e,t);case"base64":return Wa(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ya(this,e,t);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function xe(n,e,t){var r=n[e];n[e]=n[t],n[t]=r}function br(n,e,t,r,a){if(n.length===0)return-1;if(typeof t=="string"?(r=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=a?0:n.length-1),t<0&&(t=n.length+t),t>=n.length){if(a)return-1;t=n.length-1}else if(t<0)if(a)t=0;else return-1;if(typeof e=="string"&&(e=u.from(e,r)),X(e))return e.length===0?-1:hr(n,e,t,r,a);if(typeof e=="number")return e=e&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(n,e,t):Uint8Array.prototype.lastIndexOf.call(n,e,t):hr(n,[e],t,r,a);throw new TypeError("val must be string, number or Buffer")}function hr(n,e,t,r,a){var i=1,s=n.length,o=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||e.length<2)return-1;i=2,s/=2,o/=2,t/=2}function f(O,W){return i===1?O[W]:O.readUInt16BE(W*i)}var d;if(a){var y=-1;for(d=t;d<s;d++)if(f(n,d)===f(e,y===-1?0:d-y)){if(y===-1&&(y=d),d-y+1===o)return y*i}else y!==-1&&(d-=d-y),y=-1}else for(t+o>s&&(t=s-o),d=t;d>=0;d--){for(var b=!0,L=0;L<o;L++)if(f(n,d+L)!==f(e,L)){b=!1;break}if(b)return d}return-1}function Ba(n,e,t,r){t=Number(t)||0;var a=n.length-t;r?(r=Number(r),r>a&&(r=a)):r=a;var i=e.length;if(i%2!==0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;s<r;++s){var o=parseInt(e.substr(s*2,2),16);if(isNaN(o))return s;n[t+s]=o}return s}function Ma(n,e,t,r){return Tt(vt(e,n.length-t),n,t,r)}function Tr(n,e,t,r){return Tt(Qa(e),n,t,r)}function Da(n,e,t,r){return Tr(n,e,t,r)}function Va(n,e,t,r){return Tt(Ar(e),n,t,r)}function $a(n,e,t,r){return Tt(ei(e,n.length-t),n,t,r)}function Wa(n,e,t){return e===0&&t===n.length?mr(n):mr(n.slice(e,t))}function _r(n,e,t){t=Math.min(n.length,t);for(var r=[],a=e;a<t;){var i=n[a],s=null,o=i>239?4:i>223?3:i>191?2:1;if(a+o<=t){var f,d,y,b;switch(o){case 1:i<128&&(s=i);break;case 2:f=n[a+1],(f&192)===128&&(b=(i&31)<<6|f&63,b>127&&(s=b));break;case 3:f=n[a+1],d=n[a+2],(f&192)===128&&(d&192)===128&&(b=(i&15)<<12|(f&63)<<6|d&63,b>2047&&(b<55296||b>57343)&&(s=b));break;case 4:f=n[a+1],d=n[a+2],y=n[a+3],(f&192)===128&&(d&192)===128&&(y&192)===128&&(b=(i&15)<<18|(f&63)<<12|(d&63)<<6|y&63,b>65535&&b<1114112&&(s=b))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),a+=o}return qa(r)}function qa(n){var e=n.length;if(e<=yr)return String.fromCharCode.apply(String,n);for(var t="",r=0;r<e;)t+=String.fromCharCode.apply(String,n.slice(r,r+=yr));return t}function za(n,e,t){var r="";t=Math.min(n.length,t);for(var a=e;a<t;++a)r+=String.fromCharCode(n[a]&127);return r}function Za(n,e,t){var r="";t=Math.min(n.length,t);for(var a=e;a<t;++a)r+=String.fromCharCode(n[a]);return r}function Ga(n,e,t){var r=n.length;(!e||e<0)&&(e=0),(!t||t<0||t>r)&&(t=r);for(var a="",i=e;i<t;++i)a+=Xa(n[i]);return a}function Ya(n,e,t){for(var r=n.slice(e,t),a="",i=0;i<r.length;i+=2)a+=String.fromCharCode(r[i]+r[i+1]*256);return a}function U(n,e,t){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+e>t)throw new RangeError("Trying to access beyond buffer length")}function M(n,e,t,r,a,i){if(!X(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||e<i)throw new RangeError('"value" argument is out of bounds');if(t+r>n.length)throw new RangeError("Index out of range")}function wt(n,e,t,r){e<0&&(e=65535+e+1);for(var a=0,i=Math.min(n.length-t,2);a<i;++a)n[t+a]=(e&255<<8*(r?a:1-a))>>>(r?a:1-a)*8}function bt(n,e,t,r){e<0&&(e=4294967295+e+1);for(var a=0,i=Math.min(n.length-t,4);a<i;++a)n[t+a]=e>>>(r?a:3-a)*8&255}function kr(n,e,t,r,a,i){if(t+r>n.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Rr(n,e,t,r,a){return a||kr(n,e,t,4,34028234663852886e22,-34028234663852886e22),Er(n,e,t,r,23,4),t+4}function Nr(n,e,t,r,a){return a||kr(n,e,t,8,17976931348623157e292,-17976931348623157e292),Er(n,e,t,r,52,8),t+8}function Ja(n){if(n=Ka(n).replace(Ha,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Ka(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Xa(n){return n<16?"0"+n.toString(16):n.toString(16)}function vt(n,e){e=e||1/0;for(var t,r=n.length,a=null,i=[],s=0;s<r;++s){if(t=n.charCodeAt(s),t>55295&&t<57344){if(!a){if(t>56319){(e-=3)>-1&&i.push(239,191,189);continue}else if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}a=t;continue}if(t<56320){(e-=3)>-1&&i.push(239,191,189),a=t;continue}t=(a-55296<<10|t-56320)+65536}else a&&(e-=3)>-1&&i.push(239,191,189);if(a=null,t<128){if((e-=1)<0)break;i.push(t)}else if(t<2048){if((e-=2)<0)break;i.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;i.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;i.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return i}function Qa(n){for(var e=[],t=0;t<n.length;++t)e.push(n.charCodeAt(t)&255);return e}function ei(n,e){for(var t,r,a,i=[],s=0;s<n.length&&!((e-=2)<0);++s)t=n.charCodeAt(s),r=t>>8,a=t%256,i.push(a),i.push(r);return i}function Ar(n){return Sa(Ja(n))}function Tt(n,e,t,r){for(var a=0;a<r&&!(a+t>=e.length||a>=n.length);++a)e[a+t]=n[a];return a}function ti(n){return n!==n}function ri(n){return n!=null&&(!!n._isBuffer||Ir(n)||ni(n))}function Ir(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function ni(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&Ir(n.slice(0,0))}function _t(n,e,t,r,a){var i,s,o=a*8-r-1,f=(1<<o)-1,d=f>>1,y=-7,b=t?a-1:0,L=t?-1:1,O=n[e+b];for(b+=L,i=O&(1<<-y)-1,O>>=-y,y+=o;y>0;i=i*256+n[e+b],b+=L,y-=8);for(s=i&(1<<-y)-1,i>>=-y,y+=r;y>0;s=s*256+n[e+b],b+=L,y-=8);if(i===0)i=1-d;else{if(i===f)return s?NaN:(O?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-d}return(O?-1:1)*s*Math.pow(2,i-r)}function Er(n,e,t,r,a,i){var s,o,f,d=i*8-a-1,y=(1<<d)-1,b=y>>1,L=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=r?0:i-1,W=r?1:-1,Hn=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=y):(s=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-s))<1&&(s--,f*=2),s+b>=1?e+=L/f:e+=L*Math.pow(2,1-b),e*f>=2&&(s++,f/=2),s+b>=y?(o=0,s=y):s+b>=1?(o=(e*f-1)*Math.pow(2,a),s=s+b):(o=e*Math.pow(2,b-1)*Math.pow(2,a),s=0));a>=8;n[t+O]=o&255,O+=W,o/=256,a-=8);for(s=s<<a|o,d+=a;d>0;n[t+O]=s&255,O+=W,s/=256,d-=8);n[t+O-W]|=Hn*128}var K,q,Ea,zt,yr,Ha,Sr=$t(()=>{"use strict";c();l();K=[],q=[],Ea=typeof Uint8Array!="undefined"?Uint8Array:Array,zt=!1;u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;u.poolSize=8192;u._augment=function(n){return n.__proto__=u.prototype,n};u.from=function(n,e,t){return xr(null,n,e,t)};u.kMaxLength=xt();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&u[Symbol.species]);u.alloc=function(n,e,t){return La(null,n,e,t)};u.allocUnsafe=function(n){return Zt(null,n)};u.allocUnsafeSlow=function(n){return Zt(null,n)};u.isBuffer=ri;u.compare=function(e,t){if(!X(e)||!X(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,a=t.length,i=0,s=Math.min(r,a);i<s;++i)if(e[i]!==t[i]){r=e[i],a=t[i];break}return r<a?-1:a<r?1:0};u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return u.alloc(0);var r;if(t===void 0)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var a=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!X(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(a,i),i+=s.length}return a};u.byteLength=wr;u.prototype._isBuffer=!0;u.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)xe(this,t,t+1);return this};u.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)xe(this,t,t+3),xe(this,t+1,t+2);return this};u.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)xe(this,t,t+7),xe(this,t+1,t+6),xe(this,t+2,t+5),xe(this,t+3,t+4);return this};u.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?_r(this,0,e):ja.apply(this,arguments)};u.prototype.equals=function(e){if(!X(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:u.compare(this,e)===0};u.prototype.compare=function(e,t,r,a,i){if(!X(e))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),r===void 0&&(r=e?e.length:0),a===void 0&&(a=0),i===void 0&&(i=this.length),t<0||r>e.length||a<0||i>this.length)throw new RangeError("out of range index");if(a>=i&&t>=r)return 0;if(a>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,a>>>=0,i>>>=0,this===e)return 0;for(var s=i-a,o=r-t,f=Math.min(s,o),d=this.slice(a,i),y=e.slice(t,r),b=0;b<f;++b)if(d[b]!==y[b]){s=d[b],o=y[b];break}return s<o?-1:o<s?1:0};u.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1};u.prototype.indexOf=function(e,t,r){return br(this,e,t,r,!0)};u.prototype.lastIndexOf=function(e,t,r){return br(this,e,t,r,!1)};u.prototype.write=function(e,t,r,a){if(t===void 0)a="utf8",r=this.length,t=0;else if(r===void 0&&typeof t=="string")a=t,r=this.length,t=0;else if(isFinite(t))t=t|0,isFinite(r)?(r=r|0,a===void 0&&(a="utf8")):(a=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-t;if((r===void 0||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var s=!1;;)switch(a){case"hex":return Ba(this,e,t,r);case"utf8":case"utf-8":return Ma(this,e,t,r);case"ascii":return Tr(this,e,t,r);case"latin1":case"binary":return Da(this,e,t,r);case"base64":return Va(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $a(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),s=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};yr=4096;u.prototype.slice=function(e,t){var r=this.length;e=~~e,t=t===void 0?r:~~t,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),t<e&&(t=e);var a;if(u.TYPED_ARRAY_SUPPORT)a=this.subarray(e,t),a.__proto__=u.prototype;else{var i=t-e;a=new u(i,void 0);for(var s=0;s<i;++s)a[s]=this[s+e]}return a};u.prototype.readUIntLE=function(e,t,r){e=e|0,t=t|0,r||U(e,t,this.length);for(var a=this[e],i=1,s=0;++s<t&&(i*=256);)a+=this[e+s]*i;return a};u.prototype.readUIntBE=function(e,t,r){e=e|0,t=t|0,r||U(e,t,this.length);for(var a=this[e+--t],i=1;t>0&&(i*=256);)a+=this[e+--t]*i;return a};u.prototype.readUInt8=function(e,t){return t||U(e,1,this.length),this[e]};u.prototype.readUInt16LE=function(e,t){return t||U(e,2,this.length),this[e]|this[e+1]<<8};u.prototype.readUInt16BE=function(e,t){return t||U(e,2,this.length),this[e]<<8|this[e+1]};u.prototype.readUInt32LE=function(e,t){return t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};u.prototype.readUInt32BE=function(e,t){return t||U(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};u.prototype.readIntLE=function(e,t,r){e=e|0,t=t|0,r||U(e,t,this.length);for(var a=this[e],i=1,s=0;++s<t&&(i*=256);)a+=this[e+s]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a};u.prototype.readIntBE=function(e,t,r){e=e|0,t=t|0,r||U(e,t,this.length);for(var a=t,i=1,s=this[e+--a];a>0&&(i*=256);)s+=this[e+--a]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s};u.prototype.readInt8=function(e,t){return t||U(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};u.prototype.readInt16LE=function(e,t){t||U(e,2,this.length);var r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};u.prototype.readInt16BE=function(e,t){t||U(e,2,this.length);var r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};u.prototype.readInt32LE=function(e,t){return t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};u.prototype.readInt32BE=function(e,t){return t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};u.prototype.readFloatLE=function(e,t){return t||U(e,4,this.length),_t(this,e,!0,23,4)};u.prototype.readFloatBE=function(e,t){return t||U(e,4,this.length),_t(this,e,!1,23,4)};u.prototype.readDoubleLE=function(e,t){return t||U(e,8,this.length),_t(this,e,!0,52,8)};u.prototype.readDoubleBE=function(e,t){return t||U(e,8,this.length),_t(this,e,!1,52,8)};u.prototype.writeUIntLE=function(e,t,r,a){if(e=+e,t=t|0,r=r|0,!a){var i=Math.pow(2,8*r)-1;M(this,e,t,r,i,0)}var s=1,o=0;for(this[t]=e&255;++o<r&&(s*=256);)this[t+o]=e/s&255;return t+r};u.prototype.writeUIntBE=function(e,t,r,a){if(e=+e,t=t|0,r=r|0,!a){var i=Math.pow(2,8*r)-1;M(this,e,t,r,i,0)}var s=r-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+r};u.prototype.writeUInt8=function(e,t,r){return e=+e,t=t|0,r||M(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=t|0,r||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):wt(this,e,t,!0),t+2};u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=t|0,r||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):wt(this,e,t,!1),t+2};u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=t|0,r||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):bt(this,e,t,!0),t+4};u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=t|0,r||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):bt(this,e,t,!1),t+4};u.prototype.writeIntLE=function(e,t,r,a){if(e=+e,t=t|0,!a){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var s=0,o=1,f=0;for(this[t]=e&255;++s<r&&(o*=256);)e<0&&f===0&&this[t+s-1]!==0&&(f=1),this[t+s]=(e/o>>0)-f&255;return t+r};u.prototype.writeIntBE=function(e,t,r,a){if(e=+e,t=t|0,!a){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var s=r-1,o=1,f=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&f===0&&this[t+s+1]!==0&&(f=1),this[t+s]=(e/o>>0)-f&255;return t+r};u.prototype.writeInt8=function(e,t,r){return e=+e,t=t|0,r||M(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1};u.prototype.writeInt16LE=function(e,t,r){return e=+e,t=t|0,r||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):wt(this,e,t,!0),t+2};u.prototype.writeInt16BE=function(e,t,r){return e=+e,t=t|0,r||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):wt(this,e,t,!1),t+2};u.prototype.writeInt32LE=function(e,t,r){return e=+e,t=t|0,r||M(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):bt(this,e,t,!0),t+4};u.prototype.writeInt32BE=function(e,t,r){return e=+e,t=t|0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):bt(this,e,t,!1),t+4};u.prototype.writeFloatLE=function(e,t,r){return Rr(this,e,t,!0,r)};u.prototype.writeFloatBE=function(e,t,r){return Rr(this,e,t,!1,r)};u.prototype.writeDoubleLE=function(e,t,r){return Nr(this,e,t,!0,r)};u.prototype.writeDoubleBE=function(e,t,r){return Nr(this,e,t,!1,r)};u.prototype.copy=function(e,t,r,a){if(r||(r=0),!a&&a!==0&&(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a<r&&(a=r),a===r||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t<a-r&&(a=e.length-t+r);var i=a-r,s;if(this===e&&r<t&&t<a)for(s=i-1;s>=0;--s)e[s+t]=this[s+r];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(s=0;s<i;++s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i};u.prototype.fill=function(e,t,r,a){if(typeof e=="string"){if(typeof t=="string"?(a=t,t=0,r=this.length):typeof r=="string"&&(a=r,r=this.length),e.length===1){var i=e.charCodeAt(0);i<256&&(e=i)}if(a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!u.isEncoding(a))throw new TypeError("Unknown encoding: "+a)}else typeof e=="number"&&(e=e&255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;t=t>>>0,r=r===void 0?this.length:r>>>0,e||(e=0);var s;if(typeof e=="number")for(s=t;s<r;++s)this[s]=e;else{var o=X(e)?e:vt(new u(e,a).toString()),f=o.length;for(s=0;s<r-t;++s)this[s+t]=o[s%f]}return this};Ha=/[^+\/0-9A-Za-z-_]/g});var l=$t(()=>{"use strict";Sr()});var Su={};Wt(Su,{DynamicSnippetsGenerator:()=>ar});module.exports=ta(Su);c();l();c();l();c();l();function E(n){throw new Error("Unexpected value: "+JSON.stringify(n))}c();l();c();l();c();l();c();l();c();l();c();l();var ai=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,Cr=ai;var ii=typeof self=="object"&&self&&self.Object===Object&&self,si=Cr||ii||Function("return this")(),Pr=si;var oi=Pr.Symbol,ae=oi;c();l();var Lr=Object.prototype,ui=Lr.hasOwnProperty,ci=Lr.toString,tt=ae?ae.toStringTag:void 0;function li(n){var e=ui.call(n,tt),t=n[tt];try{n[tt]=void 0;var r=!0}catch(i){}var a=ci.call(n);return r&&(e?n[tt]=t:delete n[tt]),a}var Fr=li;c();l();var fi=Object.prototype,pi=fi.toString;function di(n){return pi.call(n)}var Or=di;var mi="[object Null]",hi="[object Undefined]",Ur=ae?ae.toStringTag:void 0;function yi(n){return n==null?n===void 0?hi:mi:Ur&&Ur in Object(n)?Fr(n):Or(n)}var jr=yi;c();l();function gi(n){return n!=null&&typeof n=="object"}var Br=gi;var xi="[object Symbol]";function vi(n){return typeof n=="symbol"||Br(n)&&jr(n)==xi}var Mr=vi;c();l();c();l();function wi(n,e){for(var t=-1,r=n==null?0:n.length,a=Array(r);++t<r;)a[t]=e(n[t],t,n);return a}var Dr=wi;c();l();var bi=Array.isArray,Vr=bi;var Ti=1/0,$r=ae?ae.prototype:void 0,Wr=$r?$r.toString:void 0;function qr(n){if(typeof n=="string")return n;if(Vr(n))return Dr(n,qr)+"";if(Mr(n))return Wr?Wr.call(n):"";var e=n+"";return e=="0"&&1/n==-Ti?"-0":e}var zr=qr;c();l();function _i(n){return n==null?"":zr(n)}var fe=_i;c();l();c();l();c();l();c();l();c();l();c();l();function ki(n,e,t){var r=-1,a=n.length;e<0&&(e=-e>a?0:a+e),t=t>a?a:t,t<0&&(t+=a),a=e>t?0:t-e>>>0,e>>>=0;for(var i=Array(a);++r<a;)i[r]=n[r+e];return i}var Zr=ki;function Ri(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Zr(n,e,t)}var Gr=Ri;c();l();var Ni="\\ud800-\\udfff",Ai="\\u0300-\\u036f",Ii="\\ufe20-\\ufe2f",Ei="\\u20d0-\\u20ff",Si=Ai+Ii+Ei,Ci="\\ufe0e\\ufe0f",Pi="\\u200d",Li=RegExp("["+Pi+Ni+Si+Ci+"]");function Fi(n){return Li.test(n)}var kt=Fi;c();l();c();l();function Oi(n){return n.split("")}var Yr=Oi;c();l();var Hr="\\ud800-\\udfff",Ui="\\u0300-\\u036f",ji="\\ufe20-\\ufe2f",Bi="\\u20d0-\\u20ff",Mi=Ui+ji+Bi,Di="\\ufe0e\\ufe0f",Vi="["+Hr+"]",Yt="["+Mi+"]",Ht="\\ud83c[\\udffb-\\udfff]",$i="(?:"+Yt+"|"+Ht+")",Jr="[^"+Hr+"]",Kr="(?:\\ud83c[\\udde6-\\uddff]){2}",Xr="[\\ud800-\\udbff][\\udc00-\\udfff]",Wi="\\u200d",Qr=$i+"?",en="["+Di+"]?",qi="(?:"+Wi+"(?:"+[Jr,Kr,Xr].join("|")+")"+en+Qr+")*",zi=en+Qr+qi,Zi="(?:"+[Jr+Yt+"?",Yt,Kr,Xr,Vi].join("|")+")",Gi=RegExp(Ht+"(?="+Ht+")|"+Zi+zi,"g");function Yi(n){return n.match(Gi)||[]}var tn=Yi;function Hi(n){return kt(n)?tn(n):Yr(n)}var rn=Hi;function Ji(n){return function(e){e=fe(e);var t=kt(e)?rn(e):void 0,r=t?t[0]:e.charAt(0),a=t?Gr(t,1).join(""):e.slice(1);return r[n]()+a}}var nn=Ji;var Ki=nn("toUpperCase"),an=Ki;function Xi(n){return an(fe(n).toLowerCase())}var sn=Xi;c();l();c();l();function Qi(n,e,t,r){var a=-1,i=n==null?0:n.length;for(r&&i&&(t=n[++a]);++a<i;)t=e(t,n[a],a,n);return t}var on=Qi;c();l();c();l();c();l();function es(n){return function(e){return n==null?void 0:n[e]}}var un=es;var ts={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},rs=un(ts),cn=rs;var ns=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,as="\\u0300-\\u036f",is="\\ufe20-\\ufe2f",ss="\\u20d0-\\u20ff",os=as+is+ss,us="["+os+"]",cs=RegExp(us,"g");function ls(n){return n=fe(n),n&&n.replace(ns,cn).replace(cs,"")}var ln=ls;c();l();c();l();var fs=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ps(n){return n.match(fs)||[]}var fn=ps;c();l();var ds=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function ms(n){return ds.test(n)}var pn=ms;c();l();var gn="\\ud800-\\udfff",hs="\\u0300-\\u036f",ys="\\ufe20-\\ufe2f",gs="\\u20d0-\\u20ff",xs=hs+ys+gs,xn="\\u2700-\\u27bf",vn="a-z\\xdf-\\xf6\\xf8-\\xff",vs="\\xac\\xb1\\xd7\\xf7",ws="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",bs="\\u2000-\\u206f",Ts=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",wn="A-Z\\xc0-\\xd6\\xd8-\\xde",_s="\\ufe0e\\ufe0f",bn=vs+ws+bs+Ts,Tn="['\u2019]",dn="["+bn+"]",ks="["+xs+"]",_n="\\d+",Rs="["+xn+"]",kn="["+vn+"]",Rn="[^"+gn+bn+_n+xn+vn+wn+"]",Ns="\\ud83c[\\udffb-\\udfff]",As="(?:"+ks+"|"+Ns+")",Is="[^"+gn+"]",Nn="(?:\\ud83c[\\udde6-\\uddff]){2}",An="[\\ud800-\\udbff][\\udc00-\\udfff]",Ze="["+wn+"]",Es="\\u200d",mn="(?:"+kn+"|"+Rn+")",Ss="(?:"+Ze+"|"+Rn+")",hn="(?:"+Tn+"(?:d|ll|m|re|s|t|ve))?",yn="(?:"+Tn+"(?:D|LL|M|RE|S|T|VE))?",In=As+"?",En="["+_s+"]?",Cs="(?:"+Es+"(?:"+[Is,Nn,An].join("|")+")"+En+In+")*",Ps="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ls="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Fs=En+In+Cs,Os="(?:"+[Rs,Nn,An].join("|")+")"+Fs,Us=RegExp([Ze+"?"+kn+"+"+hn+"(?="+[dn,Ze,"$"].join("|")+")",Ss+"+"+yn+"(?="+[dn,Ze+mn,"$"].join("|")+")",Ze+"?"+mn+"+"+hn,Ze+"+"+yn,Ls,Ps,_n,Os].join("|"),"g");function js(n){return n.match(Us)||[]}var Sn=js;function Bs(n,e,t){return n=fe(n),e=t?void 0:e,e===void 0?pn(n)?Sn(n):fn(n):n.match(e)||[]}var Cn=Bs;var Ms="['\u2019]",Ds=RegExp(Ms,"g");function Vs(n){return function(e){return on(Cn(ln(e).replace(Ds,"")),n,"")}}var Pn=Vs;var $s=Pn(function(n,e,t){return e=e.toLowerCase(),n+(t?sn(e):e)}),Jt=$s;c();l();function rt(n){return Object.keys(n)}c();l();c();l();var ve=class{};c();l();var Rt=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}},nt=class extends Rt{async format(e){return e}formatSync(e){return e}};c();l();c();l();var Y=class extends ve{constructor(t){super();x(this,"value");this.value=t}write(t){typeof this.value=="string"?t.write(this.value):typeof this.value=="function"?this.value(t):this.value.write(t)}};var Ws=4,Ln=!!g.env.FERN_STACK_TRACK;Ln&&(Error.stackTraceLimit=50);var at=class{constructor(){x(this,"buffer","");x(this,"indentLevel",0);x(this,"hasWrittenAnything",!1);x(this,"lastCharacterIsSemicolon",!1);x(this,"lastCharacterIsNewline",!1)}write(...e){for(let t of e)if(t!=null)if(typeof t=="string"){let r=t.length>0&&t.endsWith(`
2
+ `),a=r?t.substring(0,t.length-1):t,i=this.getIndentString(),s=a.replaceAll(`
3
3
  `,`
4
- ${a}`);this.isAtStartOfLine()&&(i=a+i),e&&(i+=`
5
- `),this.writeInternal(i)}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 k(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new k(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 k(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new k(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}openBlock(t,e="{",r,a="}"){let i=t.filter(o=>o!==void 0).join(" ");i?this.write(`${i} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),r(),this.dedent()}finally{this.write(a!=null?a:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
4
+ ${i}`);this.isAtStartOfLine()&&(s=i+s),r&&(s+=`
5
+ `),this.writeInternal(s)}else this.writeNode(t)}writeStatement(...e){this.write(...e),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(e){let t=this.indentLevel;this.indentLevel=0,this.write(e),this.indentLevel=t}writeNode(e){e.write(this)}writeNodeOrString(e){if(typeof e=="string"){this.write(e);return}this.writeNode(e)}writeNodeStatement(e){e.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(e){new Y(e).write(this),e.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(e,t){new Y(e).write(this),this.write(" (",t,")"),this.pushScope()}controlFlowWithoutStatement(e){new Y(e).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(e,t){this.dedent(),this.write("} "),new Y(e).write(this),this.write(" (",t,")"),this.pushScope()}alternativeControlFlow(e){this.dedent(),this.write("} "),new Y(e).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(e=!0){this.dedent(),this.writeNewLineIfLastLineNot(),e?this.writeLine("}"):this.write("}")}writeLine(e=""){this.write(e),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
6
  `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
- `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let a=t[0];a!=null&&r(a);for(let i=1;i<t.length;i++){this.write(e);let o=t[i];o!=null&&r(o)}}}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*vi)}};u();l();var Te=class{},ne=class extends Te{async format(t){return t}formatSync(t){return t}};u();l();function _e(n){return(n==null?void 0:n.name)!=null}u();l();u();l();u();l();var ae=class{constructor(){c(this,"reporter");c(this,"snippet");c(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){var e;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(e=this.err)!=null?e:new Error(`Failed to generate snippet for endpoint "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){var r,a;return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>((a=(r=this.snippet)==null?void 0:r.length)!=null?a:0)}};var ie=class{constructor(t){c(this,"context");this.context=t}async generate(t,e={}){let r=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let a=new ae;for(let i of r){let o=this.context.clone(),f=this.createSnippetGenerator(o);try{let m=await f.generateSnippet({endpoint:i,request:t,options:e});if(o.errors.empty())return{snippet:m,errors:void 0};a.update({context:o,snippet:m})}catch(m){a.err==null&&(a.err=m)}}return a.getResponseOrThrow({endpoint:t.endpoint})}generateSync(t,e={}){let r=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let a=new ae;for(let i of r){let o=this.context.clone(),f=this.createSnippetGenerator(o);try{let m=f.generateSnippetSync({endpoint:i,request:t,options:e});if(o.errors.empty())return{snippet:m,errors:void 0};a.update({context:o,snippet:m})}catch(m){a.err==null&&(a.err=m)}}return a.getResponseOrThrow({endpoint:t.endpoint})}};u();l();u();l();u();l();var oe=class{constructor(){c(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let r=t.match(this.REFERENCE_REGEX);if(!(r==null||r[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};u();l();var g={Critical:"CRITICAL",Warning:"WARNING"},se=class n{constructor(){c(this,"errors");c(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(ze(Ye({},t),{path:[...this.path]}))}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new n;return t.errors=[...this.errors],t.path=[...this.path],t}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(t=>({severity:t.severity,path:t.path!=null?this.pathToStringArray(t.path):void 0,message:t.message}))}pathToStringArray(t){let e=[];for(let r of t){if(typeof r=="string"){e.push(r);continue}e[e.length-1]+=`[${r.index}]`}return e}};var ue=class{constructor({ir:t,config:e,options:r={}}){c(this,"config");c(this,"options");c(this,"errors");c(this,"_ir");c(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=r,this.errors=new se,this.httpEndpointReferenceParser=new oe}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[a,i]of Object.entries(e)){this.errors.scope(a);try{let o=t.find(m=>m.name.wireValue===a);if(o==null)throw this.newParameterNotRecognizedError(a);let f=this.isListTypeReference(o.typeReference)&&!Array.isArray(i)?[i]:i;r.push({name:o.name,typeReference:o.typeReference,value:f})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let a=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let f=t.find(m=>m.name.wireValue===i);if(f==null){if(r)continue;this.errors.add({severity:g.Critical,message:this.newParameterNotRecognizedError(i).message});continue}a.push({name:f.name,typeReference:f.typeReference,value:o})}finally{this.errors.unscope()}}return a}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:g.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:t,record:e}){let r=e[t.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:g.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let a=[];for(let i of r){if(typeof i!="string"){this.errors.add({severity:g.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}a.push(i)}return a}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:g.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t==null?{}:t}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:g.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let r=this.getRecord(e);if(r==null)return;let a=t.discriminant.wireValue,i=r[a];if(i==null){this.errors.add({severity:g.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof i!="string"){this.errors.add({severity:g.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let o=t.types[i];if(o==null){this.errors.add({severity:g.Critical,message:`No type found for discriminant value "${i}"`});return}let y=r,{[a]:f}=y,m=Je(y,[He(a)]);return{singleDiscriminatedUnionType:o,discriminantValue:o.discriminantValue,value:m}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocationOrThrow(t){let e=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:t})&&e.push(r);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties:r}){var a;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:r}):!((a=t.metadata)!=null&&a.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var r,a;return e&&((a=(r=t.metadata)==null?void 0:r.includePathParameters)!=null?a:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:x(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(a=>a.id===t);return r==null?void 0:r.name}case"multipleBaseUrls":{let r=e.environments.find(a=>a.id===t);return r==null?void 0:r.name}default:x(e)}}isSingleEnvironmentID(t){return typeof t=="string"}isMultiEnvironmentValues(t){return typeof t=="object"}validateMultiEnvironmentUrlValues(t){if(this._ir.environments==null)return this.errors.add({severity:g.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":return this.errors.add({severity:g.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=e.environments[0];if(r==null)return this.errors.add({severity:g.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(ee(r.urls));for(let i of ee(t))a.has(i)&&a.delete(i);return a.size>0?(this.errors.add({severity:g.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${ee(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:g.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:g.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:g.Critical,message:this.newTypeMismatchError({expected:"string",value:t}).message});return}return t}isOptional(t){switch(t.type){case"nullable":return this.isOptional(t.value);case"optional":return!0;case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}isNullable(t){switch(t.type){case"nullable":return!0;case"optional":return this.isNullable(t.value);case"named":{let e=this.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.isNullable(e.typeReference):!1}}return!1}newAuthMismatchError({auth:t,values:e}){return new Error(`Expected auth type ${t.type}, got ${e.type}`)}newParameterNotRecognizedError(t){return new Error(`"${t}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:t,value:e}){return new Error(`Expected ${t}, got ${typeof e}`)}includeRequestBodyInWrappedRequest({body:t,inlineFileProperties:e}){switch(t.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e});default:x(t)}}includeFileUploadBodyInWrappedRequest({fileUpload:t,inlineFileProperties:e}){return this.fileUploadHasBodyProperties({fileUpload:t})||e&&this.fileUploadHasFileProperties({fileUpload:t})}fileUploadHasBodyProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:x(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:x(e)}})}isListTypeReference(t){return t.type==="optional"?this.isListTypeReference(t.value):t.type==="list"||t.type==="set"}parsedEndpointMatches({endpoint:t,parsedEndpoint:e}){return t.location.method===e.method&&t.location.path===e.path}};u();l();var $;(function(n){n.Concise="concise",n.Full="full"})($||($={}));u();l();var S={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};u();l();u();l();var p={};Ze(p,{Access:()=>De,AstNode:()=>T,Class:()=>G,ClassInstantiation:()=>Y,ClassReference:()=>w,CodeBlock:()=>z,Method:()=>H,MethodInvocation:()=>J,Parameter:()=>Z,Type:()=>pe,TypeLiteral:()=>I,Writer:()=>q,classReference:()=>ji,class_:()=>Oi,codeblock:()=>Mi,instantiateClass:()=>_i,invokeMethod:()=>Di,method:()=>Vi,parameter:()=>Wi});u();l();u();l();u();l();var De={Public:"public",Protected:"protected",Private:"private"};u();l();u();l();u();l();var q=class extends re{constructor({packageName:e,customConfig:r,formatter:a}){super();c(this,"packageName");c(this,"customConfig");c(this,"formatter");c(this,"imports",new Set);this.packageName=e,this.customConfig=r,this.formatter=a!=null?a:new ne}addImport(e){this.imports.add(e)}};var le=class extends q{constructor({packageName:t,customConfig:e,formatter:r}){super({packageName:t,customConfig:e,formatter:r})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format Java file: ${e}
9
- ${t}`)}return t}toString(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(t)}catch(e){throw new Error(`Failed to format Java file: ${e}
10
- ${t}`)}return t}getContent(){let t=`package ${this.packageName};
7
+ `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:e,delimiter:t,writeFunction:r}){if(e.length>0){let a=e[0];a!=null&&r(a);for(let i=1;i<e.length;i++){this.write(t);let s=e[i];s!=null&&r(s)}}}toString(){return this.buffer}writeInternal(e){if(e.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=e.endsWith(`
8
+ `),this.lastCharacterIsSemicolon=e.endsWith(";")),this.buffer+=e,Ln&&this.buffer.endsWith(`
9
+ `)&&!this.buffer.endsWith(`"""
10
+ `)){let t=this.stacktrace(15).map(r=>`${r.fn} - ${r.path}:${r.position}`).join(" ");t&&(this.buffer=this.buffer.slice(0,-1),this.buffer+=`//@@ ${t}
11
+ `)}return this.buffer}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Ws}stacktrace(e=50){var r;let t=!1;return((r=new Error().stack)!=null?r:"").split(`
12
+ `).map(a=>{var s;let i=a.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(i&&i.length===5){let[,o,f,d,y]=i;if(t||o!=null&&o.includes("runInteractiveTask")){t=!0;return}switch(o){case"Object.<anonymous>":o="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":o=`${o.substring(o.indexOf(".")+1)}()=> { ... }`;break}return{fn:o,path:(s=f==null?void 0:f.replace(/^.*?fern.*?\//,""))!=null?s:"",position:`${d}:${y}`}}}).filter(a=>{var i,s,o,f,d,y,b;return a&&!((i=a.path)!=null&&i.startsWith("node:"))&&!((s=a.path)!=null&&s.endsWith(".js"))&&!((o=a.path)!=null&&o.includes("AbstractWriter"))&&!((f=a.fn)!=null&&f.includes("stacktrace"))&&!((d=a.fn)!=null&&d.includes("stackLine"))&&!((y=a.fn)!=null&&y.includes("SdkGeneratorCLI"))&&!((b=a.fn)!=null&&b.includes("runCli"))}).slice(0,e)}};c();l();function Kt(n){return(n==null?void 0:n.name)!=null}c();l();c();l();c();l();var it=class{constructor(){x(this,"reporter");x(this,"snippet");x(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:t}){this.shouldUpdate({snippet:t,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=t)}getResponseOrThrow({endpoint:e}){var t;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(t=this.err)!=null?t:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:t}){var r,a;return this.reporter==null||this.reporter.size()>0&&t.size()===0?!0:e.length>((a=(r=this.snippet)==null?void 0:r.length)!=null?a:0)}};var st=class{constructor(e){x(this,"context");this.context=e}async generate(e,t={}){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new it;for(let i of r){let s=this.context.clone(),o=this.createSnippetGenerator(s);try{let f=await o.generateSnippet({endpoint:i,request:e,options:t});if(s.errors.empty())return{snippet:f,errors:void 0};a.update({context:s,snippet:f})}catch(f){a.err==null&&(a.err=f)}}return a.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e,t={}){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new it;for(let i of r){let s=this.context.clone(),o=this.createSnippetGenerator(s);try{let f=o.generateSnippetSync({endpoint:i,request:e,options:t});if(s.errors.empty())return{snippet:f,errors:void 0};a.update({context:s,snippet:f})}catch(f){a.err==null&&(a.err=f)}}return a.getResponseOrThrow({endpoint:e.endpoint})}};c();l();c();l();c();l();var ot=class{constructor(){x(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let r=e.match(this.REFERENCE_REGEX);if(!(r==null||r[1]==null||r[2]==null))return{method:r[1],path:r[2]}}};c();l();var S={Critical:"CRITICAL",Warning:"WARNING"},ut=class n{constructor(){x(this,"errors");x(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(_(m({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(t=>t.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new n;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let t=[];for(let r of e){if(typeof r=="string"){t.push(r);continue}t[t.length-1]+=`[${r.index}]`}return t}};var ct=class{constructor({ir:e,config:t,options:r={}}){x(this,"config");x(this,"options");x(this,"errors");x(this,"_ir");x(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new ut,this.httpEndpointReferenceParser=new ot}associateQueryParametersByWireValue({parameters:e,values:t}){let r=[];for(let[a,i]of Object.entries(t)){this.errors.scope(a);try{let s=e.find(f=>f.name.wireValue===a);if(s==null)throw this.newParameterNotRecognizedError(a);let o=this.isListTypeReference(s.typeReference)&&!Array.isArray(i)?[i]:i;r.push({name:s.name,typeReference:s.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:e,values:t}){let r=[];for(let a of e){this.errors.scope(a.name.wireValue);try{let i=t[a.name.wireValue];if(i==null)if(a.typeReference.type==="primitive"&&a.typeReference.value==="STRING")i=`<${a.name.wireValue}>`;else{this.errors.add({severity:S.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}r.push({name:a.name,typeReference:a.typeReference,value:i})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:e,values:t,ignoreMissingParameters:r}){let a=[];for(let[i,s]of Object.entries(t)){this.errors.scope(i);try{let o=e.find(f=>f.name.wireValue===i);if(o==null){if(r)continue;this.errors.add({severity:S.Critical,message:this.newParameterNotRecognizedError(i).message});continue}a.push({name:o.name,typeReference:o.typeReference,value:s})}finally{this.errors.unscope()}}return a}getExampleObjectProperties({parameters:e,snippetObject:t}){let r=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},a=[];for(let i of e){let s=r[i.name.wireValue];s==null?i.typeReference.type==="nullable"&&a.push({name:i.name,typeReference:i.typeReference,value:null}):a.push({name:i.name,typeReference:i.typeReference,value:s})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:S.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:e,record:t}){let r=t[e.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:S.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let a=[];for(let i of r){if(typeof i!="string"){this.errors.add({severity:S.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}a.push(i)}return a}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:S.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let t=this._ir.types[e];if(t==null){this.errors.add({severity:S.Critical,message:`Type identified by "${e}" could not be found`});return}return t}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t}){let r=this.getRecord(t);if(r==null)return;let a=e.discriminant.wireValue,i=r[a];if(i==null){this.errors.add({severity:S.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof i!="string"){this.errors.add({severity:S.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let s=e.types[i];if(s==null){this.errors.add({severity:S.Critical,message:`No type found for discriminant value "${i}"`});return}let d=r,{[a]:o}=d,f=or(d,[sr(a)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:f}}resolveEndpointOrThrow(e){let t=this.httpEndpointReferenceParser.tryParse(e);if(t==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(t)}resolveEndpointLocation(e){let t=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:e})&&t.push(r);return t}resolveEndpointLocationOrThrow(e){let t=this.resolveEndpointLocation(e);if(t.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return t}needsRequestParameter({request:e,inlinePathParameters:t,inlineFileProperties:r}){var a;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:t})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:r}):!((a=e.metadata)!=null&&a.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:t}){var r,a;return t&&((a=(r=e.metadata)==null?void 0:r.includePathParameters)!=null?a:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:E(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":{let r=t.environments.find(a=>a.id===e);return r==null?void 0:r.name}case"multipleBaseUrls":{let r=t.environments.find(a=>a.id===e);return r==null?void 0:r.name}default:E(t)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:S.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":return this.errors.add({severity:S.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=t.environments[0];if(r==null)return this.errors.add({severity:S.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(rt(r.urls));for(let i of rt(e))a.has(i)&&a.delete(i);return a.size>0?(this.errors.add({severity:S.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${rt(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:S.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:S.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:S.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:t}){return new Error(`Expected auth type ${e.type}, got ${t.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:t}){return new Error(`Expected ${e}, got ${typeof t}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:t}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t});default:E(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t}){return this.fileUploadHasBodyProperties({fileUpload:e})||t&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:E(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:E(t)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:t}){return e.location.method===t.method&&e.location.path===t.path}};c();l();var we;(function(n){n.Concise="concise",n.Full="full"})(we||(we={}));c();l();var H={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};c();l();c();l();c();l();c();l();var be=class extends at{constructor({packageName:t,customConfig:r,formatter:a}){super();x(this,"packageName");x(this,"customConfig");x(this,"formatter");x(this,"imports",new Set);this.packageName=t,this.customConfig=r,this.formatter=a!=null?a:new nt}addImport(t){this.imports.add(t)}getImports(){return new Set(this.imports)}};var lt=class extends be{constructor({packageName:e,customConfig:t,formatter:r}){super({packageName:e,customConfig:t,formatter:r})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format Java file: ${t}
13
+ ${e}`)}return e}toString(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(e)}catch(t){throw new Error(`Failed to format Java file: ${t}
14
+ ${e}`)}return e}getContent(){let e=`package ${this.packageName};
11
15
 
12
- `,e=this.stringifyImports();return e.length>0?`${t}${e}
16
+ `,t=this.stringifyImports();return t.length>0?`${e}${t}
13
17
 
14
- ${this.buffer}`:t+this.buffer}stringifyImports(){return Array.from(this.imports).filter(t=>t!==this.packageName).map(t=>`import ${t};`).sort().join(`
15
- `)}};var T=class extends W{async toStringAsync({packageName:t,customConfig:e,formatter:r}){let a=new le({packageName:t,customConfig:e,formatter:r});return this.write(a),a.toStringAsync()}toString({packageName:t,customConfig:e,formatter:r}){let a=new le({packageName:t,customConfig:e,formatter:r});return this.write(a),a.toString()}};u();l();var G=class extends T{constructor({name:e,access:r}){super();c(this,"name");c(this,"access");c(this,"methods",[]);this.name=e,this.access=r}write(e){if(e.write(`${this.access} class ${this.name}`),this.isEmpty()){e.writeLine(" {}");return}e.writeLine(" {"),e.indent();for(let r of this.methods)e.writeNode(r),e.newLine();e.dedent(),e.write("}")}addMethod(e){this.methods.push(e)}isEmpty(){return this.methods.length===0}};u();l();var w=class extends T{constructor({name:e,packageName:r,fullyQualified:a}){super();c(this,"name");c(this,"packageName");c(this,"fullyQualified");this.name=e,this.packageName=r,this.fullyQualified=a!=null?a:!1}write(e){if(e.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){e.write(`${this.packageName}.${this.name}`);return}e.write(this.name)}};u();l();u();l();u();l();u();l();var pe=class extends T{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"bigInteger":e.writeNode(wi);break;case"boolean":e.write("Boolean");break;case"bytes":e.write("byte[]");break;case"float":e.write("Float");break;case"date":e.write("String");break;case"dateTime":e.writeNode(Ni);break;case"double":e.write("Double");break;case"integer":e.write("Integer");break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write("Long");break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"object":{e.write("Object");break}case"optional":{this.writeOptional({writer:e,optional:this.internalType});break}case"reference":e.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:e,set:this.internalType});break}case"string":e.write("String");break;case"uuid":e.writeNode(Ai);break;default:x(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(e){return new this({type:"list",value:e})}static long(){return new this({type:"long"})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static object(){return new this({type:"object"})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static reference(e){return new this({type:"reference",value:e})}static set(e){return new this({type:"set",value:e})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}writeList({writer:e,list:r}){e.writeNode(Ti),e.write("<"),r.value.write(e),e.write(">")}writeMap({writer:e,map:r}){e.writeNode(Ri),e.write("<"),r.keyType.write(e),e.write(", "),r.valueType.write(e),e.write(">")}writeOptional({writer:e,optional:r}){e.writeNode(We),e.write("<"),r.value.write(e),e.write(">")}writeSet({writer:e,set:r}){e.writeNode(bi),e.write("<"),r.value.write(e),e.write(">")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},Ve=new w({name:"Arrays",packageName:"java.util"}),wi=new w({name:"BigInteger",packageName:"java.math"}),Fp=new w({name:"HashMap",packageName:"java.util"}),Ti=new w({name:"List",packageName:"java.util"}),Ri=new w({name:"Map",packageName:"java.util"}),Ni=new w({name:"OffsetDateTime",packageName:"java.time"}),We=new w({name:"Optional",packageName:"java.util"}),bi=new w({name:"Set",packageName:"java.util"}),Ai=new w({name:"UUID",packageName:"java.util"});var I=class n extends T{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:e,bigInteger:this.internalType});break;case"boolean":e.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:e,builder:this.internalType});break;case"bytes":e.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"date":e.write(`"${this.internalType.value}"`);break;case"dateTime":this.writeDateTime({writer:e,dateTime:this.internalType});break;case"double":e.write(this.internalType.value.toString());break;case"enum":this.writeEnum({writer:e,enum_:this.internalType});break;case"float":e.write(`${this.internalType.value}f`);break;case"integer":e.write(this.internalType.value.toString());break;case"list":{this.writeList({writer:e,list:this.internalType});break}case"long":{e.write(`${this.internalType.value}L`);break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"optional":{this.writeOptional({writer:e,optional:this.internalType});break}case"raw":{e.write(this.internalType.value);break}case"reference":e.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:e,set:this.internalType});break}case"string":e.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:e,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:e,uuid:this.internalType});break;case"nop":break;default:x(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(e){return new this({type:"bigInteger",value:e})}static boolean(e){return new this({type:"boolean",value:e})}static builder({classReference:e,parameters:r}){return new this({type:"builder",classReference:e,parameters:r})}static bytes(e){return new this({type:"bytes",value:e})}static class_({reference:e,parameters:r}){return new this({type:"class",reference:e,parameters:r})}static date(e){return new this({type:"date",value:e})}static dateTime(e){return new this({type:"dateTime",value:e})}static double(e){return new this({type:"double",value:e})}static enum_({classReference:e,value:r}){return new this({type:"enum",classReference:e,value:r})}static float(e){return new this({type:"float",value:e})}static integer(e){return new this({type:"integer",value:e})}static list({valueType:e,values:r}){return new this({type:"list",valueType:e,values:r})}static long(e){return new this({type:"long",value:e})}static map({keyType:e,valueType:r,entries:a}){return new this({type:"map",keyType:e,valueType:r,entries:a})}static optional({value:e,useOf:r}){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e,useOf:r})}static raw(e){return new this({type:"raw",value:e})}static reference(e){return new this({type:"reference",value:e})}static set({valueType:e,values:r}){return new this({type:"set",valueType:e,values:r})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){return new this({type:"uuid",value:e})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:x(this.internalType)}}writeBigInteger({writer:e,bigInteger:r}){e.write("new "),e.writeNode(p.instantiateClass({classReference:Ii,arguments_:[n.string(r.value)]}))}writeBuilder({writer:e,builder:r}){e.writeNode(r.classReference),e.writeNewLineIfLastLineNot(),e.indent(),this.writeBuilderParameters({writer:e,parameters:this.orderBuilderParameters(ki({parameters:r.parameters}))}),e.dedent()}writeBuilderParameters({writer:e,parameters:r}){e.writeLine(".builder()");for(let a of r)e.write(`.${a.name}(`),a.value.shouldWriteInLine()||e.newLine(),e.indent(),e.writeNode(a.value),e.dedent(),a.value.shouldWriteInLine()||e.newLine(),e.writeLine(")");e.writeNewLineIfLastLineNot(),e.write(".build()")}orderBuilderParameters(e){return e.sort((r,a)=>r.value.isOptional()&&!a.value.isOptional()?1:!r.value.isOptional()&&a.value.isOptional()?-1:0)}writeClass({writer:e,class_:r}){let a=Li({parameters:r.parameters});e.writeNode(p.instantiateClass({classReference:r.reference,arguments_:a.map(i=>i.value)}))}writeDateTime({writer:e,dateTime:r}){e.writeNode(p.invokeMethod({on:Ci,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:e,enum_:r}){e.writeNode(r.classReference),e.write("."+r.value)}writeList({writer:e,list:r}){this.writeIterable({writer:e,iterable:r})}writeMap({writer:e,map:r}){let a=Si({entries:r.entries});if(a.length===0){e.write("new "),e.writeNode(Re),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(Re),e.write("<"),e.writeNode(r.keyType),e.write(", "),e.writeNode(r.valueType),e.writeLine(">() {{"),e.indent();for(let i of a)e.write("put("),e.writeNode(i.key),e.write(", "),e.writeNode(i.value),e.writeLine(");");e.dedent(),e.write("}}")}writeOptional({writer:e,optional:r}){if(!r.useOf){e.writeNode(r.value);return}e.writeNode(p.invokeMethod({on:We,method:"of",arguments_:[r.value]}))}writeSet({writer:e,set:r}){this.writeIterable({writer:e,iterable:r})}writeIterable({writer:e,iterable:r}){let a=r.type==="list"?$e:Ei,i=Fi({values:r.values});if(i.length===0){e.write(`new ${a.name}<`),e.writeNode(r.valueType),e.write(">()");return}e.write("new "),e.writeNode(a),e.write("<"),e.writeNode(r.valueType),e.writeLine(">("),e.indent(),e.writeNode(p.invokeMethod({on:Ve,method:"asList",arguments_:i})),e.writeNewLineIfLastLineNot(),e.dedent(),e.write(")")}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(`"${this.escapeString(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("new"),e.writeNode($e),e.write("<Object>()");return}e.writeLine("new"),e.writeNode($e),e.write("<Object>() {"),e.indent(),e.writeNode(p.invokeMethod({on:Ve,method:"asList",arguments_:r.map(a=>n.unknown(a))})),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("}")}writeUnknownMap({writer:e,value:r}){let a=Object.entries(r);if(a.length===0){e.write("new "),e.writeNode(Re),e.write("<String, Object>()");return}e.writeLine("new "),e.writeNode(Re),e.write("<String, Object>() {{"),e.indent();for(let[i,o]of a)e.write(`put("${i}", `),e.writeNode(n.unknown(o)),e.writeLine(");");e.dedent(),e.write("}}")}writeUUID({writer:e,uuid:r}){e.writeNode(p.invokeMethod({on:Pi,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(e){return e.internalType.type==="optional"}},$e=new w({name:"ArrayList",packageName:"java.util"}),Ii=new w({name:"BigInteger",packageName:"java.math"}),Re=new w({name:"HashMap",packageName:"java.util"}),Ei=new w({name:"HashSet",packageName:"java.util"}),$p=new w({name:"List",packageName:"java.util"}),qp=new w({name:"Map",packageName:"java.util"}),Ci=new w({name:"OffsetDateTime",packageName:"java.time"}),Gp=new w({name:"Set",packageName:"java.util"}),Pi=new w({name:"UUID",packageName:"java.util"});function Li({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function ki({parameters:n}){return n.filter(t=>!I.isNop(t.value))}function Si({entries:n}){return n.filter(t=>!I.isNop(t.key)&&!I.isNop(t.value))}function Fi({values:n}){return n.filter(t=>!I.isNop(t))}function Ne({writer:n,arguments_:t}){let e=Bi(t);if(e.length===0){n.write("()");return}if(e.some(a=>a instanceof I&&!a.shouldWriteInLine())){Ui({writer:n,arguments_:e});return}n.write("("),e.forEach((a,i)=>{i>0&&n.write(", "),Tr({writer:n,argument:a})}),n.write(")")}function Ui({writer:n,arguments_:t}){n.writeLine("("),n.indent(),t.forEach((e,r)=>{r>0&&n.writeLine(","),Tr({writer:n,argument:e})}),n.dedent(),t.length>0&&n.newLine(),n.write(")")}function Tr({writer:n,argument:t}){_e(t)?n.writeNodeOrString(t.assignment):t.write(n)}function Bi(n){return n.filter(t=>!(t instanceof I&&I.isNop(t)))}var Y=class extends T{constructor({classReference:e,arguments_:r}){super();c(this,"classReference");c(this,"arguments_");this.classReference=e,this.arguments_=r}write(e){e.writeNode(this.classReference),Ne({writer:e,arguments_:this.arguments_})}};u();l();var z=class extends T{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new k(this.arg).write(e)}};u();l();var H=class extends T{constructor({name:e,access:r,parameters:a,body:i,static_:o,return_:f}){super();c(this,"name");c(this,"access");c(this,"parameters");c(this,"body");c(this,"return_");c(this,"static_");this.name=e,this.access=r,this.parameters=a,this.body=i,this.return_=f,this.static_=o!=null?o:!1}write(e){if(e.write(`${this.access} `),this.static_&&e.write("static "),this.return_!=null?e.writeNode(this.return_):e.write("void"),e.write(` ${this.name}`),this.parameters.length===0?e.write("()"):(e.writeLine("("),e.indent(),this.parameters.forEach((r,a)=>{a>0&&e.writeLine(", "),e.writeNode(r)}),e.dedent(),e.write(")")),this.body==null){e.write(";");return}e.writeLine(" {"),e.indent(),e.writeNode(this.body),e.writeNewLineIfLastLineNot(),e.dedent(),e.write("}")}};u();l();var J=class extends T{constructor({method:e,arguments_:r,on:a}){super();c(this,"on");c(this,"method");c(this,"arguments_");this.on=a,this.method=e,this.arguments_=r}write(e){this.on.write(e),e.write("."),e.write(this.method),Ne({writer:e,arguments_:this.arguments_})}};u();l();var Z=class extends T{constructor({name:e,type:r}){super();c(this,"name");c(this,"type");this.name=e,this.type=r}write(e){e.writeNode(this.type),e.write(` ${this.name}`)}};function Mi(n){return new z(n)}function Oi(n){return new G(n)}function ji(n){return new w(n)}function _i(n){return new Y(n)}function Di(n){return new J(n)}function Vi(n){return new H(n)}function Wi(n){return new Z(n)}var Rr="com.example.usage",$i="Example",qi="run",Nr="client",Gi={type:"primitive",value:"STRING"},be=class{constructor({context:t,formatter:e}){c(this,"context");c(this,"formatter");this.context=t,this.formatter=e}async generateSnippet({endpoint:t,request:e,options:r}){var o,f;let a=this.getConfig(r);return await this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toStringAsync({packageName:(o=a.fullStylePackageName)!=null?o:Rr,customConfig:(f=this.context.customConfig)!=null?f:{},formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e,options:r}){var o,f;let a=this.getConfig(r);return this.buildCodeBlock({endpoint:t,snippet:e,options:r}).toString({packageName:(o=a.fullStylePackageName)!=null?o:Rr,customConfig:(f=this.context.customConfig)!=null?f:{},formatter:this.formatter})}buildCodeBlock({endpoint:t,snippet:e,options:r}){let a=p.codeblock(o=>{o.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),o.newLine(),o.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))}),i=this.getStyle(r);switch(i){case $.Concise:return a;case $.Full:return this.buildFullCodeBlock({body:a,options:r});default:x(i)}}constructClient({endpoint:t,snippet:e}){return p.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${Nr} = `),r.writeNode(p.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:t,snippet:e})}))})}buildFullCodeBlock({body:t,options:e}){var i;let r=this.getConfig(e),a=p.class_({name:(i=r.fullStyleClassName)!=null?i:$i,access:p.Access.Public});return a.addMethod(p.method({name:qi,access:p.Access.Public,static_:!0,parameters:[],body:t})),a}getRootClientBuilderArgs({endpoint:t,snippet:e}){let r=[];t.auth!=null&&(e.auth!=null?r.push(...this.getRootClientAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:g.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});return a!=null&&r.push(a),this.context.errors.scope(S.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:t,environment:e}){var r;if(t!=null&&e!=null){this.context.errors.add({severity:g.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null){if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"){this.context.errors.add({severity:g.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:p.TypeLiteral.string(t)}}if(e!=null){if(this.context.isSingleEnvironmentID(e)){let a=this.context.getEnvironmentTypeReferenceFromID(e);if(a==null){this.context.errors.add({severity:g.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return{name:"environment",value:p.TypeLiteral.reference(a)}}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?{name:"environment",value:p.TypeLiteral.reference(p.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(e).map(a=>this.context.dynamicTypeLiteralMapper.convert({typeReference:Gi,value:a}))}))}:void 0}}getRootClientAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.context.errors.add({severity:g.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getRootClientBasicAuthArgs({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.context.errors.add({severity:g.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getRootClientBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.context.errors.add({severity:g.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getRootClientHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.context.errors.add({severity:g.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getRootClientOAuthArgs({auth:t,values:e});default:x(t)}}getRootClientBasicAuthArgs({auth:t,values:e}){return[{name:"credentials",value:p.TypeLiteral.raw(`"${e.username}", "${e.password}"`)}]}getRootClientBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.token),value:p.TypeLiteral.string(e.token)}]}getRootClientHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getRootClientOAuthArgs({auth:t,values:e}){return[{name:this.context.getMethodName(t.clientId),value:p.TypeLiteral.string(e.clientId)},{name:this.context.getMethodName(t.clientSecret),value:p.TypeLiteral.string(e.clientSecret)}]}getRootClientHeaderArgs({headers:t,values:e}){let r=[];for(let a of t){let i=this.getRootClientHeaderArg({header:a,value:e.value});i!=null&&r.push({name:this.context.getMethodName(a.name.name),value:i})}return r}getRootClientHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!p.TypeLiteral.isNop(r))return r}callMethod({endpoint:t,snippet:e}){return p.invokeMethod({on:p.codeblock(Nr),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e})})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:x(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var i,o;let r=[];this.context.errors.scope(S.PathParameters);let a=[...(i=this.context.ir.pathParameters)!=null?i:[],...(o=t.pathParameters)!=null?o:[]];return a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:e}).map(f=>f.value)),this.context.errors.unscope(),this.context.errors.scope(S.RequestBody),t.body!=null&&r.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return t.value.type==="optional"?p.TypeLiteral.optional({value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value.value,value:e}),useOf:!0}):this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:x(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:g.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),p.TypeLiteral.nop()):p.TypeLiteral.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){let r=[],{inlinePathParameters:a,inlineFileProperties:i}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(S.PathParameters);let o=[];t.pathParameters!=null&&o.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(S.RequestBody);let f=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})||r.push(...o.map(m=>m.value)),i||r.push(...f.fileFields.map(m=>m.value)),r.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})?o:[],filePropertyInfo:f})),r}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:a}){var v,h,b,N;this.context.errors.scope(S.QueryParameters);let o=this.context.associateQueryParametersByWireValue({parameters:(v=t.queryParameters)!=null?v:[],values:(h=e.queryParameters)!=null?h:{}}).map(E=>({name:this.context.getMethodName(E.name.name),value:this.context.dynamicTypeLiteralMapper.convert(E)}));this.context.errors.unscope(),this.context.errors.scope(S.Headers);let m=this.context.associateByWireValue({parameters:(b=t.headers)!=null?b:[],values:(N=e.headers)!=null?N:{}}).map(E=>({name:this.context.getMethodName(E.name.name),value:this.context.dynamicTypeLiteralMapper.convert(E)}));this.context.errors.unscope(),this.context.errors.scope(S.RequestBody);let y=t.body!=null?this.getInlinedRequestBodyBuilderParameters({body:t.body,value:e.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),p.TypeLiteral.builder({classReference:p.classReference({name:this.context.getClassName(t.declaration.name),packageName:this.context.getRequestsPackageName(t.declaration.fernFilepath)}),parameters:[...r,...m,...o,...y]})}getInlinedRequestBodyBuilderParameters({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:x(t)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:t}){return this.context.shouldInlineFileProperties()?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:t,value:e}){return{name:this.context.getMethodName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:x(t)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:t,value:e}){var i;let r=[],a=this.context.associateByWireValue({parameters:t,values:(i=this.context.getRecord(e))!=null?i:{}});for(let o of a)r.push({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});return r}getPathParameters({namedParameters:t,snippet:e}){var i;let r=[],a=this.context.associateByWireValue({parameters:t,values:(i=e.pathParameters)!=null?i:{}});for(let o of a)r.push({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>`${this.context.getMethodName(e)}()`).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getStyle(t){var e,r;return(r=(e=t.style)!=null?e:this.context.options.style)!=null?r:$.Full}getConfig(t){var e,r;return(r=(e=t.config)!=null?e:this.context.options.config)!=null?r:{}}};u();l();u();l();var Ae=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:g.Critical,message:"Expected non-null value, but got null"}),p.TypeLiteral.nop());if(t.value===void 0)return p.TypeLiteral.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literal: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?p.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"nullable":case"optional":return p.TypeLiteral.optional({value:this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as}),useOf:t.as==="mapValue"});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"set":return this.convertSet({set:t.typeReference.value,value:t.value});case"unknown":return this.convertUnknown({value:t.value});default:x(t.typeReference)}}convertList({list:t,value:e}){return Array.isArray(e)?p.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:t}),values:e.map((r,a)=>{this.context.errors.scope({index:a});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:g.Critical,message:`Expected array but got: ${typeof e}`}),p.TypeLiteral.nop())}convertLiteral({literal:t,value:e}){switch(t.type){case"boolean":{let r=this.context.getValueAsBoolean({value:e});return r==null?p.TypeLiteral.nop():p.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:e});return r==null?p.TypeLiteral.nop():p.TypeLiteral.string(r)}default:x(t)}}convertSet({set:t,value:e}){return Array.isArray(e)?p.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:t}),values:e.map((r,a)=>{this.context.errors.scope({index:a});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:g.Critical,message:`Expected array but got: ${typeof e}`}),p.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:g.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),p.TypeLiteral.nop()):p.TypeLiteral.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:t.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:t.value}),entries:Object.entries(e).map(([r,a])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:t.key,value:r,as:"mapKey"}),value:this.convert({typeReference:t.value,value:a,as:"mapValue"})}}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,as:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:x(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let r=this.context.getJavaClassReferenceFromDeclaration({declaration:t.declaration}),a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(a==null)return p.TypeLiteral.nop();let i=a.singleDiscriminatedUnionType;switch(i.type){case"samePropertiesAsObject":{let o=this.context.resolveNamedType({typeId:i.typeId});return o==null?p.TypeLiteral.nop():p.TypeLiteral.reference(p.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[this.convertNamed({named:o,value:a.value})]}))}case"singleProperty":{let o=this.context.getRecord(a.value);if(o==null)return p.TypeLiteral.nop();try{return this.context.errors.scope(i.discriminantValue.wireValue),p.TypeLiteral.reference(p.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[this.convert({typeReference:i.typeReference,value:o[i.discriminantValue.wireValue]})]}))}finally{this.context.errors.unscope()}}case"noProperties":return p.TypeLiteral.reference(p.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[]}));default:x(i)}}convertObject({object_:t,value:e,as:r}){var i;let a=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return p.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:t.declaration}),parameters:a.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getMethodName(o.name.name),value:this.convert({typeReference:o.typeReference,value:o.value,as:r})}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:t,value:e}){let r=this.getEnumValueName({enum_:t,value:e});return r==null?p.TypeLiteral.nop():p.TypeLiteral.enum_({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:t.declaration}),value:r})}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:g.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let r=t.values.find(a=>a.wireValue===e);if(r==null){this.context.errors.add({severity:g.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return this.context.getEnumName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});if(r==null)return p.TypeLiteral.nop();if(this.context.isPrimitive(r.valueTypeReference))return p.TypeLiteral.reference(p.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:t.declaration}),method:"of",arguments_:[r.typeInstantiation]}));let a=this.getUndiscriminatedUnionFieldName({typeReference:r.valueTypeReference});return a==null?p.TypeLiteral.nop():p.TypeLiteral.reference(p.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:t.declaration}),method:`of${a}`,arguments_:[r.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let r of t.types)try{let a=this.convert({typeReference:r,value:e});return{valueTypeReference:r,typeInstantiation:a}}catch(a){continue}this.context.errors.add({severity:g.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}getUndiscriminatedUnionFieldName({typeReference:t}){switch(t.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:t});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:t.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:t});case"named":{let e=this.context.resolveNamedType({typeId:t.value});return e==null?void 0:this.context.getClassName(e.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:t});case"nullable":return this.getUndiscriminatedUnionFieldNameForNullable({typeReference:t});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:t.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:t});case"unknown":return"Unknown";default:x(t)}}getUndiscriminatedUnionFieldNameForList({list:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`ListOf${e}`}getUndiscriminatedUnionFieldNameForMap({map:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t.key});if(e==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:t.value});if(r!=null)return`MapOf${e}To${r}`}getUndiscriminatedUnionFieldNameForOptional({typeReference:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`Optional${e}`}getUndiscriminatedUnionFieldNameForNullable({typeReference:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`Nullable${e}`}getUndiscriminatedUnionFieldNameForSet({set:t}){let e=this.getUndiscriminatedUnionFieldName({typeReference:t});if(e!=null)return`SetOf${e}`}getUndiscriminatedUnionFieldNameForLiteral({literal:t}){}getUndiscriminatedUnionFieldNameForPrimitive({primitive:t}){switch(t){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":return"Float";case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":return"BigInteger";case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:x(t)}}convertUnknown({value:t}){return p.TypeLiteral.unknown(t)}convertPrimitive({primitive:t,value:e,as:r}){switch(t){case"INTEGER":case"UINT":{let a=this.getValueAsNumber({value:e,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.integer(a)}case"LONG":case"UINT_64":{let a=this.getValueAsNumber({value:e,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.long(a)}case"FLOAT":{let a=this.getValueAsNumber({value:e,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.float(a)}case"DOUBLE":{let a=this.getValueAsNumber({value:e,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.double(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:e,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.boolean(a)}case"STRING":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.string(a)}case"DATE":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.string(a)}case"DATE_TIME":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.dateTime(a)}case"UUID":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.uuid(a)}case"BASE_64":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.bytes(a)}case"BIG_INTEGER":{let a=this.context.getValueAsString({value:e});return a==null?p.TypeLiteral.nop():p.TypeLiteral.bigInteger(a)}default:x(t)}}getValueAsNumber({value:t,as:e}){let r=e==="mapKey"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:t,as:e}){let r=e==="mapKey"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:r})}};u();l();var Ie=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){switch(t.typeReference.type){case"list":return p.Type.list(this.convert({typeReference:t.typeReference}));case"literal":return this.convertLiteral({literal:t.typeReference.value});case"map":return p.Type.map(this.convert({typeReference:t.typeReference.key}),this.convert({typeReference:t.typeReference.value}));case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?this.convertUnknown():this.convertNamed({named:e})}case"optional":case"nullable":return p.Type.optional(this.convert({typeReference:t.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:t.typeReference.value});case"set":return p.Type.set(this.convert({typeReference:t.typeReference}));case"unknown":return this.convertUnknown();default:x(t.typeReference)}}convertNamed({named:t}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return p.Type.reference(p.classReference({name:this.context.getClassName(t.declaration.name),packageName:this.context.getTypesPackageName(t.declaration.fernFilepath)}));default:x(t)}}convertLiteral({literal:t}){switch(t.type){case"boolean":return p.Type.boolean();case"string":return p.Type.string()}}convertUnknown(){return p.Type.object()}convertPrimitive({primitive:t}){switch(t){case"INTEGER":return p.Type.integer();case"UINT":return p.Type.integer();case"LONG":return p.Type.long();case"UINT_64":return p.Type.long();case"FLOAT":return p.Type.float();case"DOUBLE":return p.Type.double();case"BOOLEAN":return p.Type.boolean();case"STRING":return p.Type.string();case"DATE":return p.Type.date();case"DATE_TIME":return p.Type.dateTime();case"UUID":return p.Type.uuid();case"BASE_64":return p.Type.bytes();case"BIG_INTEGER":return p.Type.bigInteger();default:x(t)}}};u();l();var Ee=class{constructor({context:t}){c(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){var i;let r={fileFields:[],bodyPropertyFields:[]},a=(i=this.context.getRecord(e))!=null?i:{};for(let o of t.properties)switch(o.type){case"file":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getMethodName(o.name.name),value:this.getBodyProperty({property:o,record:a})});break;default:x(o)}return r}getSingleFileProperty({property:t,record:e}){let r=this.context.getSingleFileValue({property:t,record:e});return r==null?p.TypeLiteral.nop():p.TypeLiteral.reference(this.context.getFileStreamFromString(r))}getArrayFileProperty({property:t,record:e}){let r=this.context.getFileArrayValues({property:t,record:e});if(r==null)return p.TypeLiteral.nop();for(let a of r)return p.TypeLiteral.reference(this.context.getFileStreamFromString(a));return p.TypeLiteral.nop()}getBodyProperty({property:t,record:e}){let r=e[t.name.wireValue];return r==null?p.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:r})}};var Yi=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch","getClass"]),Ce=class n extends ue{constructor({ir:e,config:r,options:a}){super({ir:e,config:r,options:a});c(this,"ir");c(this,"customConfig");c(this,"dynamicTypeMapper");c(this,"dynamicTypeLiteralMapper");c(this,"filePropertyMapper");this.ir=e,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeMapper=new Ie({context:this}),this.dynamicTypeLiteralMapper=new Ae({context:this}),this.filePropertyMapper=new Ee({context:this})}clone(){return new n({ir:this.ir,config:this.config,options:this.options})}getClassName(e){return this.getName(e.pascalCase.safeName)}getEnumName(e){return this.getName(e.screamingSnakeCase.safeName)}getPropertyName(e){return this.getName(e.camelCase.safeName)}getMethodName(e){return this.getName(e.camelCase.safeName)}getRootClientClassReference(){return p.classReference({name:this.getRootClientClassName(),packageName:this.getRootPackageName()})}getRootClientClassName(){var e,r;return(r=(e=this.customConfig)==null?void 0:e["client-class-name"])!=null?r:`${this.getBaseNamePrefix()}Client`}getEnvironmentClassName(){return"Environment"}getEnvironmentTypeReferenceFromID(e){let r=this.resolveEnvironmentName(e);if(r!=null)return p.codeblock(a=>{a.writeNode(this.getEnvironmentClassReference()),a.write("."),a.write(this.getEnumName(r))})}getEnvironmentClassReference(){return p.classReference({name:this.getEnvironmentClassName(),packageName:this.getCorePackageName()})}getJavaClassReferenceFromDeclaration({declaration:e}){return p.classReference({name:e.name.pascalCase.unsafeName,packageName:this.getTypesPackageName(e.fernFilepath)})}getNullableClassReference(){return p.classReference({name:"Nullable",packageName:this.getCorePackageName()})}getNullableOfNull(){return p.TypeLiteral.reference(p.invokeMethod({on:this.getNullableClassReference(),method:"ofNull",arguments_:[]}))}getFileStreamFromString(e){return p.TypeLiteral.reference(p.codeblock(r=>{r.write("new "),r.writeNode(this.getFileStreamClassReference()),r.write("("),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(p.TypeLiteral.string(e)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getFileStreamClassReference(){return p.classReference({name:"FileStream",packageName:this.getCorePackageName()})}getByteArrayInputStreamClassReference(){return p.classReference({name:"ByteArrayInputStream",packageName:"java.io"})}getStandardCharsetsClassReference(){return p.classReference({name:"StandardCharsets",packageName:"java.nio.charset"})}isPrimitive(e){switch(e.type){case"primitive":return!0;case"optional":case"nullable":return this.isPrimitive(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});if(r==null)return!1;switch(r.type){case"alias":return this.isPrimitive(r.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:x(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:x(e)}}getRootPackageName(){let e=this.getPackagePrefixTokens();return this.joinPackageTokens(e)}getCorePackageName(){let e=this.getPackagePrefixTokens();return e.push("core"),this.joinPackageTokens(e)}getTypesPackageName(e){return this.getResourcesPackage(e,"types")}getRequestsPackageName(e){return this.getPackageLayout()==="flat"?this.getTypesPackageName(e):this.getResourcesPackage(e,"requests")}getResourcesPackage(e,r){let a=this.getPackagePrefixTokens();switch(this.getPackageLayout()){case"flat":e!=null&&a.push(...e.packagePath.map(i=>this.getPackageNameSegment(i)));break;case"nested":default:e!=null&&e.allParts.length>0&&a.push("resources"),e!=null&&a.push(...e.allParts.map(i=>this.getPackageNameSegment(i)))}return r!=null&&a.push(r),this.joinPackageTokens(a)}getPackageName(e,r){let a=this.getPackageNameSegments(e);return a=r!=null?[...a,r]:a,[...this.getPackagePrefixTokens(),...a].join(".")}getPackageLayout(){var e,r;return(r=(e=this.customConfig)==null?void 0:e["package-layout"])!=null?r:"nested"}shouldInlinePathParameters(){var e,r;return(r=(e=this.customConfig)==null?void 0:e["inline-path-parameters"])!=null?r:!1}shouldInlineFileProperties(){var e,r;return(r=(e=this.customConfig)==null?void 0:e["inline-file-properties"])!=null?r:!1}getPackageNameSegments(e){return e.packagePath.map(r=>this.getPackageNameSegment(r))}getPackageNameSegment(e){return e.camelCase.safeName.toLowerCase()}getPackagePrefixTokens(){var r;if(((r=this.customConfig)==null?void 0:r["package-prefix"])!=null)return this.customConfig["package-prefix"].split(".");let e=[];return e.push("com"),e.push(...this.splitOnNonAlphaNumericChar(this.config.organization)),e.push(...this.splitOnNonAlphaNumericChar(this.getApiName())),e}getBaseNamePrefix(){return this.convertKebabCaseToUpperCamelCase(this.config.organization)+this.convertKebabCaseToUpperCamelCase(this.getApiName())}getApiName(){return je(this.config.workspaceName)}startsWithNumber(e){return/^\d/.test(e)}splitOnNonAlphaNumericChar(e){return e.split(/[^a-zA-Z0-9]/)}convertKebabCaseToUpperCamelCase(e){return e.replace(/-([a-z])/g,(r,a)=>a.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}joinPackageTokens(e){return e.map(a=>this.startsWithNumber(a)?"_"+a:a).join(".")}getName(e){return this.isReservedName(e)?"_"+e:e}isReservedName(e){return Yi.has(e)}};var qe=class extends ie{constructor({ir:e,config:r,options:a={}}){super(new Ce({ir:e,config:r,options:a}));c(this,"formatter")}async generate(e,r={}){return super.generate(e,r)}generateSync(e,r={}){return super.generateSync(e,r)}createSnippetGenerator(e){return new be({context:e})}};0&&(module.exports={DynamicSnippetsGenerator});
18
+ ${this.buffer}`:e+this.buffer}stringifyImports(){return Array.from(this.imports).filter(e=>e!==this.packageName).map(e=>`import ${e};`).sort().join(`
19
+ `)}};c();l();c();l();var C={};Wt(C,{BRAND:()=>yo,DIRTY:()=>Te,EMPTY_PATH:()=>Gs,INVALID:()=>k,NEVER:()=>eu,OK:()=>B,ParseStatus:()=>j,Schema:()=>A,ZodAny:()=>me,ZodArray:()=>ue,ZodBigInt:()=>ke,ZodBoolean:()=>Re,ZodBranded:()=>pt,ZodCatch:()=>Ue,ZodDate:()=>Ne,ZodDefault:()=>Oe,ZodDiscriminatedUnion:()=>It,ZodEffects:()=>G,ZodEnum:()=>Le,ZodError:()=>D,ZodFirstPartyTypeKind:()=>R,ZodFunction:()=>St,ZodIntersection:()=>Se,ZodIssueCode:()=>h,ZodLazy:()=>Ce,ZodLiteral:()=>Pe,ZodMap:()=>Xe,ZodNaN:()=>et,ZodNativeEnum:()=>Fe,ZodNever:()=>J,ZodNull:()=>Ie,ZodNullable:()=>te,ZodNumber:()=>_e,ZodObject:()=>V,ZodOptional:()=>z,ZodParsedType:()=>w,ZodPipeline:()=>dt,ZodPromise:()=>he,ZodReadonly:()=>je,ZodRecord:()=>Et,ZodSchema:()=>A,ZodSet:()=>Qe,ZodString:()=>de,ZodSymbol:()=>Je,ZodTransformer:()=>G,ZodTuple:()=>ee,ZodType:()=>A,ZodUndefined:()=>Ae,ZodUnion:()=>Ee,ZodUnknown:()=>oe,ZodVoid:()=>Ke,addIssueToContext:()=>v,any:()=>Ro,array:()=>Eo,bigint:()=>wo,boolean:()=>qn,coerce:()=>Qo,custom:()=>Vn,date:()=>bo,datetimeRegex:()=>Mn,defaultErrorMap:()=>ie,discriminatedUnion:()=>Lo,effect:()=>zo,enum:()=>$o,function:()=>Mo,getErrorMap:()=>Ge,getParsedType:()=>Q,instanceof:()=>xo,intersection:()=>Fo,isAborted:()=>Nt,isAsync:()=>Ye,isDirty:()=>At,isValid:()=>pe,late:()=>go,lazy:()=>Do,literal:()=>Vo,makeIssue:()=>ft,map:()=>jo,nan:()=>vo,nativeEnum:()=>Wo,never:()=>Ao,null:()=>ko,nullable:()=>Go,number:()=>Wn,object:()=>So,objectUtil:()=>Xt,oboolean:()=>Xo,onumber:()=>Ko,optional:()=>Zo,ostring:()=>Jo,pipeline:()=>Ho,preprocess:()=>Yo,promise:()=>qo,quotelessJson:()=>qs,record:()=>Uo,set:()=>Bo,setErrorMap:()=>Zs,strictObject:()=>Co,string:()=>$n,symbol:()=>To,transformer:()=>zo,tuple:()=>Oo,undefined:()=>_o,union:()=>Po,unknown:()=>No,util:()=>I,void:()=>Io});c();l();c();l();c();l();c();l();c();l();var I;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let i={};for(let s of a)i[s]=s;return i},n.getValidEnumValues=a=>{let i=n.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(let o of i)s[o]=a[o];return n.objectValues(s)},n.objectValues=a=>n.objectKeys(a).map(function(i){return a[i]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let i=[];for(let s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},n.find=(a,i)=>{for(let s of a)if(i(s))return s},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}n.joinValues=r,n.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(I||(I={}));var Xt;(function(n){n.mergeShapes=(e,t)=>m(m({},e),t)})(Xt||(Xt={}));var w=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Q=n=>{switch(typeof n){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(n)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":return Array.isArray(n)?w.array:n===null?w.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?w.promise:typeof Map!="undefined"&&n instanceof Map?w.map:typeof Set!="undefined"&&n instanceof Set?w.set:typeof Date!="undefined"&&n instanceof Date?w.date:w.object;default:return w.unknown}};var h=I.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),qs=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),D=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},r={_errors:[]},a=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let o=r,f=0;for(;f<s.path.length;){let d=s.path[f];f===s.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(s))):o[d]=o[d]||{_errors:[]},o=o[d],f++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,I.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let i=a.path[0];t[i]=t[i]||[],t[i].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};D.create=n=>new D(n);var zs=(n,e)=>{let t;switch(n.code){case h.invalid_type:n.received===w.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case h.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,I.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:t=`Unrecognized key(s) in object: ${I.joinValues(n.keys,", ")}`;break;case h.invalid_union:t="Invalid input";break;case h.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${I.joinValues(n.options)}`;break;case h.invalid_enum_value:t=`Invalid enum value. Expected ${I.joinValues(n.options)}, received '${n.received}'`;break;case h.invalid_arguments:t="Invalid function arguments";break;case h.invalid_return_type:t="Invalid function return type";break;case h.invalid_date:t="Invalid date";break;case h.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:I.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case h.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case h.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case h.custom:t="Invalid input";break;case h.invalid_intersection_types:t="Intersection results could not be merged";break;case h.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case h.not_finite:t="Number must be finite";break;default:t=e.defaultError,I.assertNever(n)}return{message:t}},ie=zs;var Fn=ie;function Zs(n){Fn=n}function Ge(){return Fn}c();l();var ft=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,i=[...t,...a.path||[]],s=_(m({},a),{path:i});if(a.message!==void 0)return _(m({},a),{path:i,message:a.message});let o="",f=r.filter(d=>!!d).slice().reverse();for(let d of f)o=d(s,{data:e,defaultError:o}).message;return _(m({},a),{path:i,message:o})},Gs=[];function v(n,e){let t=Ge(),r=ft({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===ie?void 0:ie].filter(a=>!!a)});n.common.issues.push(r)}var j=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return k;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let i=await a.key,s=await a.value;r.push({key:i,value:s})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return k;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:e.value,value:r}}},k=Object.freeze({status:"aborted"}),Te=n=>({status:"dirty",value:n}),B=n=>({status:"valid",value:n}),Nt=n=>n.status==="aborted",At=n=>n.status==="dirty",pe=n=>n.status==="valid",Ye=n=>typeof Promise!="undefined"&&n instanceof Promise;c();l();c();l();var T;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(T||(T={}));var Z=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},On=(n,e)=>{if(pe(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new D(n.common.issues);return this._error=t,this._error}}};function N(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(s,o)=>{var d,y;let{message:f}=n;return s.code==="invalid_enum_value"?{message:f!=null?f:o.defaultError}:typeof o.data=="undefined"?{message:(d=f!=null?f:r)!=null?d:o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:(y=f!=null?f:t)!=null?y:o.defaultError}},description:a}}var A=class{get description(){return this._def.description}_getType(e){return Q(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new j,ctx:{common:e.parent.common,data:e.data,parsedType:Q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ye(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var i;let r={common:{issues:[],async:(i=t==null?void 0:t.async)!=null?i:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Q(e)},a=this._parseSync({data:e,path:r.path,parent:r});return On(r,a)}"~validate"(e){var r,a;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Q(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:t});return pe(i)?{value:i.value}:{issues:t.common.issues}}catch(i){(a=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(i=>pe(i)?{value:i.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Q(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(Ye(a)?a:Promise.resolve(a));return On(r,i)}refine(e,t){let r=a=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,i)=>{let s=e(a),o=()=>i.addIssue(m({code:h.custom},r(a)));return typeof Promise!="undefined"&&s instanceof Promise?s.then(f=>f?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new G({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return z.create(this,this._def)}nullable(){return te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ue.create(this)}promise(){return he.create(this,this._def)}or(e){return Ee.create([this,e],this._def)}and(e){return Se.create(this,e,this._def)}transform(e){return new G(_(m({},N(this._def)),{schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){let t=typeof e=="function"?e:()=>e;return new Oe(_(m({},N(this._def)),{innerType:this,defaultValue:t,typeName:R.ZodDefault}))}brand(){return new pt(m({typeName:R.ZodBranded,type:this},N(this._def)))}catch(e){let t=typeof e=="function"?e:()=>e;return new Ue(_(m({},N(this._def)),{innerType:this,catchValue:t,typeName:R.ZodCatch}))}describe(e){let t=this.constructor;return new t(_(m({},this._def),{description:e}))}pipe(e){return dt.create(this,e)}readonly(){return je.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ys=/^c[^\s-]{8,}$/i,Hs=/^[0-9a-z]+$/,Js=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ks=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Xs=/^[a-z0-9_-]{21}$/i,Qs=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,eo=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,to=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ro="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Qt,no=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ao=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,io=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,so=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,oo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,uo=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jn="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",co=new RegExp(`^${jn}$`);function Bn(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function lo(n){return new RegExp(`^${Bn(n)}$`)}function Mn(n){let e=`${jn}T${Bn(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function fo(n,e){return!!((e==="v4"||!e)&&no.test(n)||(e==="v6"||!e)&&io.test(n))}function po(n,e){if(!Qs.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch(t){return!1}}function mo(n,e){return!!((e==="v4"||!e)&&ao.test(n)||(e==="v6"||!e)&&so.test(n))}var de=class n extends A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==w.string){let i=this._getOrReturnCtx(e);return v(i,{code:h.invalid_type,expected:w.string,received:i.parsedType}),k}let r=new j,a;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,o=e.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(e,a),s?v(a,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&v(a,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")to.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"email",code:h.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Qt||(Qt=new RegExp(ro,"u")),Qt.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"emoji",code:h.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Ks.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"uuid",code:h.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Xs.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"nanoid",code:h.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Ys.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cuid",code:h.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Hs.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cuid2",code:h.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Js.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"ulid",code:h.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch(s){a=this._getOrReturnCtx(e,a),v(a,{validation:"url",code:h.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"regex",code:h.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Mn(i).test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?co.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?lo(i).test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?eo.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"duration",code:h.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?fo(e.data,i.version)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"ip",code:h.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?po(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"jwt",code:h.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?mo(e.data,i.version)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cidr",code:h.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?oo.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"base64",code:h.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?uo.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"base64url",code:h.invalid_string,message:i.message}),r.dirty()):I.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),m({validation:t,code:h.invalid_string},T.errToObj(r)))}_addCheck(e){return new n(_(m({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(m({kind:"email"},T.errToObj(e)))}url(e){return this._addCheck(m({kind:"url"},T.errToObj(e)))}emoji(e){return this._addCheck(m({kind:"emoji"},T.errToObj(e)))}uuid(e){return this._addCheck(m({kind:"uuid"},T.errToObj(e)))}nanoid(e){return this._addCheck(m({kind:"nanoid"},T.errToObj(e)))}cuid(e){return this._addCheck(m({kind:"cuid"},T.errToObj(e)))}cuid2(e){return this._addCheck(m({kind:"cuid2"},T.errToObj(e)))}ulid(e){return this._addCheck(m({kind:"ulid"},T.errToObj(e)))}base64(e){return this._addCheck(m({kind:"base64"},T.errToObj(e)))}base64url(e){return this._addCheck(m({kind:"base64url"},T.errToObj(e)))}jwt(e){return this._addCheck(m({kind:"jwt"},T.errToObj(e)))}ip(e){return this._addCheck(m({kind:"ip"},T.errToObj(e)))}cidr(e){return this._addCheck(m({kind:"cidr"},T.errToObj(e)))}datetime(e){var t,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(m({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null?t:!1,local:(r=e==null?void 0:e.local)!=null?r:!1},T.errToObj(e==null?void 0:e.message)))}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck(m({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision},T.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(m({kind:"duration"},T.errToObj(e)))}regex(e,t){return this._addCheck(m({kind:"regex",regex:e},T.errToObj(t)))}includes(e,t){return this._addCheck(m({kind:"includes",value:e,position:t==null?void 0:t.position},T.errToObj(t==null?void 0:t.message)))}startsWith(e,t){return this._addCheck(m({kind:"startsWith",value:e},T.errToObj(t)))}endsWith(e,t){return this._addCheck(m({kind:"endsWith",value:e},T.errToObj(t)))}min(e,t){return this._addCheck(m({kind:"min",value:e},T.errToObj(t)))}max(e,t){return this._addCheck(m({kind:"max",value:e},T.errToObj(t)))}length(e,t){return this._addCheck(m({kind:"length",value:e},T.errToObj(t)))}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new n(_(m({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new n(_(m({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new n(_(m({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};de.create=n=>{var e;return new de(m({checks:[],typeName:R.ZodString,coerce:(e=n==null?void 0:n.coerce)!=null?e:!1},N(n)))};function ho(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,i=Number.parseInt(n.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return i%s/10**a}var _e=class n extends A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==w.number){let i=this._getOrReturnCtx(e);return v(i,{code:h.invalid_type,expected:w.number,received:i.parsedType}),k}let r,a=new j;for(let i of this._def.checks)i.kind==="int"?I.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),v(r,{code:h.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),v(r,{code:h.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),v(r,{code:h.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?ho(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),v(r,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),v(r,{code:h.not_finite,message:i.message}),a.dirty()):I.assertNever(i);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,r,a){return new n(_(m({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:T.toString(a)}]}))}_addCheck(e){return new n(_(m({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&I.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};_e.create=n=>new _e(m({checks:[],typeName:R.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1},N(n)));var ke=class n extends A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(i){return this._getInvalidInput(e)}if(this._getType(e)!==w.bigint)return this._getInvalidInput(e);let r,a=new j;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),v(r,{code:h.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),v(r,{code:h.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),v(r,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):I.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:w.bigint,received:t.parsedType}),k}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,r,a){return new n(_(m({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:T.toString(a)}]}))}_addCheck(e){return new n(_(m({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};ke.create=n=>{var e;return new ke(m({checks:[],typeName:R.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!=null?e:!1},N(n)))};var Re=class extends A{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==w.boolean){let r=this._getOrReturnCtx(e);return v(r,{code:h.invalid_type,expected:w.boolean,received:r.parsedType}),k}return B(e.data)}};Re.create=n=>new Re(m({typeName:R.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1},N(n)));var Ne=class n extends A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==w.date){let i=this._getOrReturnCtx(e);return v(i,{code:h.invalid_type,expected:w.date,received:i.parsedType}),k}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return v(i,{code:h.invalid_date}),k}let r=new j,a;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:h.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:h.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):I.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n(_(m({},this._def),{checks:[...this._def.checks,e]}))}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:T.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Ne.create=n=>new Ne(m({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:R.ZodDate},N(n)));var Je=class extends A{_parse(e){if(this._getType(e)!==w.symbol){let r=this._getOrReturnCtx(e);return v(r,{code:h.invalid_type,expected:w.symbol,received:r.parsedType}),k}return B(e.data)}};Je.create=n=>new Je(m({typeName:R.ZodSymbol},N(n)));var Ae=class extends A{_parse(e){if(this._getType(e)!==w.undefined){let r=this._getOrReturnCtx(e);return v(r,{code:h.invalid_type,expected:w.undefined,received:r.parsedType}),k}return B(e.data)}};Ae.create=n=>new Ae(m({typeName:R.ZodUndefined},N(n)));var Ie=class extends A{_parse(e){if(this._getType(e)!==w.null){let r=this._getOrReturnCtx(e);return v(r,{code:h.invalid_type,expected:w.null,received:r.parsedType}),k}return B(e.data)}};Ie.create=n=>new Ie(m({typeName:R.ZodNull},N(n)));var me=class extends A{constructor(){super(...arguments),this._any=!0}_parse(e){return B(e.data)}};me.create=n=>new me(m({typeName:R.ZodAny},N(n)));var oe=class extends A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return B(e.data)}};oe.create=n=>new oe(m({typeName:R.ZodUnknown},N(n)));var J=class extends A{_parse(e){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:w.never,received:t.parsedType}),k}};J.create=n=>new J(m({typeName:R.ZodNever},N(n)));var Ke=class extends A{_parse(e){if(this._getType(e)!==w.undefined){let r=this._getOrReturnCtx(e);return v(r,{code:h.invalid_type,expected:w.void,received:r.parsedType}),k}return B(e.data)}};Ke.create=n=>new Ke(m({typeName:R.ZodVoid},N(n)));var ue=class n extends A{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==w.array)return v(t,{code:h.invalid_type,expected:w.array,received:t.parsedType}),k;if(a.exactLength!==null){let s=t.data.length>a.exactLength.value,o=t.data.length<a.exactLength.value;(s||o)&&(v(t,{code:s?h.too_big:h.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(v(t,{code:h.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(v(t,{code:h.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((s,o)=>a.type._parseAsync(new Z(t,s,t.path,o)))).then(s=>j.mergeArray(r,s));let i=[...t.data].map((s,o)=>a.type._parseSync(new Z(t,s,t.path,o)));return j.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new n(_(m({},this._def),{minLength:{value:e,message:T.toString(t)}}))}max(e,t){return new n(_(m({},this._def),{maxLength:{value:e,message:T.toString(t)}}))}length(e,t){return new n(_(m({},this._def),{exactLength:{value:e,message:T.toString(t)}}))}nonempty(e){return this.min(1,e)}};ue.create=(n,e)=>new ue(m({type:n,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray},N(e)));function He(n){if(n instanceof V){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=z.create(He(r))}return new V(_(m({},n._def),{shape:()=>e}))}else return n instanceof ue?new ue(_(m({},n._def),{type:He(n.element)})):n instanceof z?z.create(He(n.unwrap())):n instanceof te?te.create(He(n.unwrap())):n instanceof ee?ee.create(n.items.map(e=>He(e))):n}var V=class n extends A{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=I.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==w.object){let d=this._getOrReturnCtx(e);return v(d,{code:h.invalid_type,expected:w.object,received:d.parsedType}),k}let{status:r,ctx:a}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(let d in a.data)s.includes(d)||o.push(d);let f=[];for(let d of s){let y=i[d],b=a.data[d];f.push({key:{status:"valid",value:d},value:y._parse(new Z(a,b,a.path,d)),alwaysSet:d in a.data})}if(this._def.catchall instanceof J){let d=this._def.unknownKeys;if(d==="passthrough")for(let y of o)f.push({key:{status:"valid",value:y},value:{status:"valid",value:a.data[y]}});else if(d==="strict")o.length>0&&(v(a,{code:h.unrecognized_keys,keys:o}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let y of o){let b=a.data[y];f.push({key:{status:"valid",value:y},value:d._parse(new Z(a,b,a.path,y)),alwaysSet:y in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let d=[];for(let y of f){let b=await y.key,L=await y.value;d.push({key:b,value:L,alwaysSet:y.alwaysSet})}return d}).then(d=>j.mergeObjectSync(r,d)):j.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new n(m(_(m({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(t,r)=>{var i,s,o,f;let a=(o=(s=(i=this._def).errorMap)==null?void 0:s.call(i,t,r).message)!=null?o:r.defaultError;return t.code==="unrecognized_keys"?{message:(f=T.errToObj(e).message)!=null?f:a}:{message:a}}}:{}))}strip(){return new n(_(m({},this._def),{unknownKeys:"strip"}))}passthrough(){return new n(_(m({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new n(_(m({},this._def),{shape:()=>m(m({},this._def.shape()),e)}))}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>m(m({},this._def.shape()),e._def.shape()),typeName:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n(_(m({},this._def),{catchall:e}))}pick(e){let t={};for(let r of I.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n(_(m({},this._def),{shape:()=>t}))}omit(e){let t={};for(let r of I.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n(_(m({},this._def),{shape:()=>t}))}deepPartial(){return He(this)}partial(e){let t={};for(let r of I.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n(_(m({},this._def),{shape:()=>t}))}required(e){let t={};for(let r of I.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof z;)i=i._def.innerType;t[r]=i}return new n(_(m({},this._def),{shape:()=>t}))}keyof(){return Dn(I.objectKeys(this.shape))}};V.create=(n,e)=>new V(m({shape:()=>n,unknownKeys:"strip",catchall:J.create(),typeName:R.ZodObject},N(e)));V.strictCreate=(n,e)=>new V(m({shape:()=>n,unknownKeys:"strict",catchall:J.create(),typeName:R.ZodObject},N(e)));V.lazycreate=(n,e)=>new V(m({shape:n,unknownKeys:"strip",catchall:J.create(),typeName:R.ZodObject},N(e)));var Ee=class extends A{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map(o=>new D(o.ctx.common.issues));return v(t,{code:h.invalid_union,unionErrors:s}),k}if(t.common.async)return Promise.all(r.map(async i=>{let s=_(m({},t),{common:_(m({},t.common),{issues:[]}),parent:null});return{result:await i._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(a);{let i,s=[];for(let f of r){let d=_(m({},t),{common:_(m({},t.common),{issues:[]}),parent:null}),y=f._parseSync({data:t.data,path:t.path,parent:d});if(y.status==="valid")return y;y.status==="dirty"&&!i&&(i={result:y,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(f=>new D(f));return v(t,{code:h.invalid_union,unionErrors:o}),k}}get options(){return this._def.options}};Ee.create=(n,e)=>new Ee(m({options:n,typeName:R.ZodUnion},N(e)));var se=n=>n instanceof Ce?se(n.schema):n instanceof G?se(n.innerType()):n instanceof Pe?[n.value]:n instanceof Le?n.options:n instanceof Fe?I.objectValues(n.enum):n instanceof Oe?se(n._def.innerType):n instanceof Ae?[void 0]:n instanceof Ie?[null]:n instanceof z?[void 0,...se(n.unwrap())]:n instanceof te?[null,...se(n.unwrap())]:n instanceof pt||n instanceof je?se(n.unwrap()):n instanceof Ue?se(n._def.innerType):[],It=class n extends A{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.object)return v(t,{code:h.invalid_type,expected:w.object,received:t.parsedType}),k;let r=this.discriminator,a=t.data[r],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(v(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),k)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let i of t){let s=se(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,i)}}return new n(m({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a},N(r)))}};function er(n,e){let t=Q(n),r=Q(e);if(n===e)return{valid:!0,data:n};if(t===w.object&&r===w.object){let a=I.objectKeys(e),i=I.objectKeys(n).filter(o=>a.indexOf(o)!==-1),s=m(m({},n),e);for(let o of i){let f=er(n[o],e[o]);if(!f.valid)return{valid:!1};s[o]=f.data}return{valid:!0,data:s}}else if(t===w.array&&r===w.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let i=0;i<n.length;i++){let s=n[i],o=e[i],f=er(s,o);if(!f.valid)return{valid:!1};a.push(f.data)}return{valid:!0,data:a}}else return t===w.date&&r===w.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Se=class extends A{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(i,s)=>{if(Nt(i)||Nt(s))return k;let o=er(i.value,s.value);return o.valid?((At(i)||At(s))&&t.dirty(),{status:t.value,value:o.data}):(v(r,{code:h.invalid_intersection_types}),k)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Se.create=(n,e,t)=>new Se(m({left:n,right:e,typeName:R.ZodIntersection},N(t)));var ee=class n extends A{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.array)return v(r,{code:h.invalid_type,expected:w.array,received:r.parsedType}),k;if(r.data.length<this._def.items.length)return v(r,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),k;!this._def.rest&&r.data.length>this._def.items.length&&(v(r,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...r.data].map((s,o)=>{let f=this._def.items[o]||this._def.rest;return f?f._parse(new Z(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>j.mergeArray(t,s)):j.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new n(_(m({},this._def),{rest:e}))}};ee.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ee(m({items:n,typeName:R.ZodTuple,rest:null},N(e)))};var Et=class n extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.object)return v(r,{code:h.invalid_type,expected:w.object,received:r.parsedType}),k;let a=[],i=this._def.keyType,s=this._def.valueType;for(let o in r.data)a.push({key:i._parse(new Z(r,o,r.path,o)),value:s._parse(new Z(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?j.mergeObjectAsync(t,a):j.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof A?new n(m({keyType:e,valueType:t,typeName:R.ZodRecord},N(r))):new n(m({keyType:de.create(),valueType:e,typeName:R.ZodRecord},N(t)))}},Xe=class extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.map)return v(r,{code:h.invalid_type,expected:w.map,received:r.parsedType}),k;let a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,f],d)=>({key:a._parse(new Z(r,o,r.path,[d,"key"])),value:i._parse(new Z(r,f,r.path,[d,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let f of s){let d=await f.key,y=await f.value;if(d.status==="aborted"||y.status==="aborted")return k;(d.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(d.value,y.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let f of s){let d=f.key,y=f.value;if(d.status==="aborted"||y.status==="aborted")return k;(d.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(d.value,y.value)}return{status:t.value,value:o}}}};Xe.create=(n,e,t)=>new Xe(m({valueType:e,keyType:n,typeName:R.ZodMap},N(t)));var Qe=class n extends A{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.set)return v(r,{code:h.invalid_type,expected:w.set,received:r.parsedType}),k;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(v(r,{code:h.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(v(r,{code:h.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let i=this._def.valueType;function s(f){let d=new Set;for(let y of f){if(y.status==="aborted")return k;y.status==="dirty"&&t.dirty(),d.add(y.value)}return{status:t.value,value:d}}let o=[...r.data.values()].map((f,d)=>i._parse(new Z(r,f,r.path,d)));return r.common.async?Promise.all(o).then(f=>s(f)):s(o)}min(e,t){return new n(_(m({},this._def),{minSize:{value:e,message:T.toString(t)}}))}max(e,t){return new n(_(m({},this._def),{maxSize:{value:e,message:T.toString(t)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Qe.create=(n,e)=>new Qe(m({valueType:n,minSize:null,maxSize:null,typeName:R.ZodSet},N(e)));var St=class n extends A{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.function)return v(t,{code:h.invalid_type,expected:w.function,received:t.parsedType}),k;function r(o,f){return ft({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ge(),ie].filter(d=>!!d),issueData:{code:h.invalid_arguments,argumentsError:f}})}function a(o,f){return ft({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ge(),ie].filter(d=>!!d),issueData:{code:h.invalid_return_type,returnTypeError:f}})}let i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof he){let o=this;return B(async function(...f){let d=new D([]),y=await o._def.args.parseAsync(f,i).catch(O=>{throw d.addIssue(r(f,O)),d}),b=await Reflect.apply(s,this,y);return await o._def.returns._def.type.parseAsync(b,i).catch(O=>{throw d.addIssue(a(b,O)),d})})}else{let o=this;return B(function(...f){let d=o._def.args.safeParse(f,i);if(!d.success)throw new D([r(f,d.error)]);let y=Reflect.apply(s,this,d.data),b=o._def.returns.safeParse(y,i);if(!b.success)throw new D([a(y,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n(_(m({},this._def),{args:ee.create(e).rest(oe.create())}))}returns(e){return new n(_(m({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n(m({args:e||ee.create([]).rest(oe.create()),returns:t||oe.create(),typeName:R.ZodFunction},N(r)))}},Ce=class extends A{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ce.create=(n,e)=>new Ce(m({getter:n,typeName:R.ZodLazy},N(e)));var Pe=class extends A{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),k}return{status:"valid",value:e.data}}get value(){return this._def.value}};Pe.create=(n,e)=>new Pe(m({value:n,typeName:R.ZodLiteral},N(e)));function Dn(n,e){return new Le(m({values:n,typeName:R.ZodEnum},N(e)))}var Le=class n extends A{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return v(t,{expected:I.joinValues(r),received:t.parsedType,code:h.invalid_type}),k}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return v(t,{received:t.data,code:h.invalid_enum_value,options:r}),k}return B(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,m(m({},this._def),t))}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),m(m({},this._def),t))}};Le.create=Dn;var Fe=class extends A{_parse(e){let t=I.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==w.string&&r.parsedType!==w.number){let a=I.objectValues(t);return v(r,{expected:I.joinValues(a),received:r.parsedType,code:h.invalid_type}),k}if(this._cache||(this._cache=new Set(I.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=I.objectValues(t);return v(r,{received:r.data,code:h.invalid_enum_value,options:a}),k}return B(e.data)}get enum(){return this._def.values}};Fe.create=(n,e)=>new Fe(m({values:n,typeName:R.ZodNativeEnum},N(e)));var he=class extends A{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.promise&&t.common.async===!1)return v(t,{code:h.invalid_type,expected:w.promise,received:t.parsedType}),k;let r=t.parsedType===w.promise?t.data:Promise.resolve(t.data);return B(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};he.create=(n,e)=>new he(m({type:n,typeName:R.ZodPromise},N(e)));var G=class extends A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:s=>{v(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let s=a.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async o=>{if(t.value==="aborted")return k;let f=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return f.status==="aborted"?k:f.status==="dirty"?Te(f.value):t.value==="dirty"?Te(f.value):f});{if(t.value==="aborted")return k;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?k:o.status==="dirty"?Te(o.value):t.value==="dirty"?Te(o.value):o}}if(a.type==="refinement"){let s=o=>{let f=a.refinement(o,i);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?k:(o.status==="dirty"&&t.dirty(),s(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?k:(o.status==="dirty"&&t.dirty(),s(o.value).then(()=>({status:t.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!pe(s))return k;let o=a.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>pe(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:t.value,value:o})):k);I.assertNever(a)}};G.create=(n,e,t)=>new G(m({schema:n,typeName:R.ZodEffects,effect:e},N(t)));G.createWithPreprocess=(n,e,t)=>new G(m({schema:e,effect:{type:"preprocess",transform:n},typeName:R.ZodEffects},N(t)));var z=class extends A{_parse(e){return this._getType(e)===w.undefined?B(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};z.create=(n,e)=>new z(m({innerType:n,typeName:R.ZodOptional},N(e)));var te=class extends A{_parse(e){return this._getType(e)===w.null?B(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};te.create=(n,e)=>new te(m({innerType:n,typeName:R.ZodNullable},N(e)));var Oe=class extends A{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===w.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Oe.create=(n,e)=>new Oe(m({innerType:n,typeName:R.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},N(e)));var Ue=class extends A{_parse(e){let{ctx:t}=this._processInputParams(e),r=_(m({},t),{common:_(m({},t.common),{issues:[]})}),a=this._def.innerType._parse({data:r.data,path:r.path,parent:m({},r)});return Ye(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new D(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new D(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Ue.create=(n,e)=>new Ue(m({innerType:n,typeName:R.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},N(e)));var et=class extends A{_parse(e){if(this._getType(e)!==w.nan){let r=this._getOrReturnCtx(e);return v(r,{code:h.invalid_type,expected:w.nan,received:r.parsedType}),k}return{status:"valid",value:e.data}}};et.create=n=>new et(m({typeName:R.ZodNaN},N(n)));var yo=Symbol("zod_brand"),pt=class extends A{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},dt=class n extends A{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?k:i.status==="dirty"?(t.dirty(),Te(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?k:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:R.ZodPipeline})}},je=class extends A{_parse(e){let t=this._def.innerType._parse(e),r=a=>(pe(a)&&(a.value=Object.freeze(a.value)),a);return Ye(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};je.create=(n,e)=>new je(m({innerType:n,typeName:R.ZodReadonly},N(e)));function Un(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Vn(n,e={},t){return n?me.create().superRefine((r,a)=>{var s,o;let i=n(r);if(i instanceof Promise)return i.then(f=>{var d,y;if(!f){let b=Un(e,r),L=(y=(d=b.fatal)!=null?d:t)!=null?y:!0;a.addIssue(_(m({code:"custom"},b),{fatal:L}))}});if(!i){let f=Un(e,r),d=(o=(s=f.fatal)!=null?s:t)!=null?o:!0;a.addIssue(_(m({code:"custom"},f),{fatal:d}))}}):me.create()}var go={object:V.lazycreate},R;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(R||(R={}));var xo=(n,e={message:`Input not instance of ${n.name}`})=>Vn(t=>t instanceof n,e),$n=de.create,Wn=_e.create,vo=et.create,wo=ke.create,qn=Re.create,bo=Ne.create,To=Je.create,_o=Ae.create,ko=Ie.create,Ro=me.create,No=oe.create,Ao=J.create,Io=Ke.create,Eo=ue.create,So=V.create,Co=V.strictCreate,Po=Ee.create,Lo=It.create,Fo=Se.create,Oo=ee.create,Uo=Et.create,jo=Xe.create,Bo=Qe.create,Mo=St.create,Do=Ce.create,Vo=Pe.create,$o=Le.create,Wo=Fe.create,qo=he.create,zo=G.create,Zo=z.create,Go=te.create,Yo=G.createWithPreprocess,Ho=dt.create,Jo=()=>$n().optional(),Ko=()=>Wn().optional(),Xo=()=>qn().optional(),Qo={string:(n=>de.create(_(m({},n),{coerce:!0}))),number:(n=>_e.create(_(m({},n),{coerce:!0}))),boolean:(n=>Re.create(_(m({},n),{coerce:!0}))),bigint:(n=>ke.create(_(m({},n),{coerce:!0}))),date:(n=>Ne.create(_(m({},n),{coerce:!0})))};var eu=k;c();l();var zn=C.strictObject({title:C.string(),content:C.string()});var tr=C.object({"base-api-exception-class-name":C.string().optional(),"base-exception-class-name":C.string().optional(),"client-class-name":C.string().optional(),"inline-file-properties":C.boolean().optional(),"inline-path-parameters":C.boolean().optional(),"package-layout":C.enum(["flat","nested"]).optional(),"package-prefix":C.string().optional(),"custom-dependencies":C.array(C.string()).optional(),"disable-required-property-builder-checks":C.boolean().optional(),"enable-forward-compatible-enums":C.boolean().optional(),"enable-inline-types":C.boolean().optional(),"enable-public-constructors":C.boolean().optional(),"generate-unknown-as-json-node":C.boolean().optional(),"json-include":C.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":C.boolean().optional(),"use-default-request-parameter-values":C.boolean().optional(),"enable-wire-tests":C.boolean().default(!0),"custom-readme-sections":C.array(zn).optional(),"wrapped-aliases":C.boolean().optional()});var p={};Wt(p,{Access:()=>rr,AstNode:()=>F,Class:()=>Be,ClassInstantiation:()=>Me,ClassReference:()=>P,CodeBlock:()=>De,Method:()=>Ve,MethodInvocation:()=>$e,Parameter:()=>We,Type:()=>mt,TypeLiteral:()=>$,Writer:()=>be,classReference:()=>wu,class_:()=>vu,codeblock:()=>xu,instantiateClass:()=>bu,invokeMethod:()=>Tu,method:()=>_u,parameter:()=>ku});c();l();c();l();c();l();var rr={Public:"public",Protected:"protected",Private:"private"};c();l();c();l();var F=class extends ve{async toStringAsync({packageName:e,customConfig:t,formatter:r}){let a=new lt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toStringAsync()}toString({packageName:e,customConfig:t,formatter:r}){let a=new lt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toString()}};var Be=class extends F{constructor({name:t,access:r}){super();x(this,"name");x(this,"access");x(this,"methods",[]);this.name=t,this.access=r}write(t){if(t.write(`${this.access} class ${this.name}`),this.isEmpty()){t.writeLine(" {}");return}t.writeLine(" {"),t.indent();for(let r of this.methods)t.writeNode(r),t.newLine();t.dedent(),t.write("}")}addMethod(t){this.methods.push(t)}isEmpty(){return this.methods.length===0}};c();l();c();l();c();l();c();l();var P=class extends F{constructor({name:t,packageName:r,fullyQualified:a}){super();x(this,"name");x(this,"packageName");x(this,"fullyQualified");this.name=t,this.packageName=r,this.fullyQualified=a!=null?a:!1}write(t){if(t.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){t.write(`${this.packageName}.${this.name}`);return}t.write(this.name)}};c();l();var mt=class extends F{constructor(t){super();x(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"array":t.writeNode(this.internalType.value),t.write("[]");break;case"bigInteger":t.writeNode(tu);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.write("String");break;case"dateTime":t.writeNode(au);break;case"double":t.write("Double");break;case"float":t.write("Float");break;case"generic":t.writeNode(this.internalType.value),t.write("<");for(let[r,a]of this.internalType.parameters.entries())t.writeNode(a),r<this.internalType.parameters.length-1&&t.write(", ");t.write(">");break;case"inputStream":t.writeNode(ou);break;case"integer":t.write("Integer");break;case"iterable":this.writeIterable({writer:t,iterable:this.internalType});break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write("Long");break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"object":{t.write("Object");break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write("String");break;case"uuid":t.writeNode(su);break;case"void":t.write("Void");break;default:E(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(t){return new this({type:"array",value:t})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(t){return new this({type:"list",value:t})}static long(){return new this({type:"long"})}static map(t,r){return new this({type:"map",keyType:t,valueType:r})}static object(){return new this({type:"object"})}static optional(t){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t})}static reference(t){return new this({type:"reference",value:t})}static generic(t,r){return new this({type:"generic",value:t,parameters:r})}static set(t){return new this({type:"set",value:t})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(t){return new this({type:"iterable",value:t})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:t,list:r}){t.writeNode(ru),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(nu),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Ct),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(Ct),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(iu),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Pt=new P({name:"Arrays",packageName:"java.util"}),tu=new P({name:"BigInteger",packageName:"java.math"}),xm=new P({name:"HashMap",packageName:"java.util"}),ru=new P({name:"List",packageName:"java.util"}),nu=new P({name:"Map",packageName:"java.util"}),au=new P({name:"OffsetDateTime",packageName:"java.time"}),Ct=new P({name:"Optional",packageName:"java.util"}),iu=new P({name:"Set",packageName:"java.util"}),su=new P({name:"UUID",packageName:"java.util"}),ou=new P({name:"InputStream",packageName:"java.io"});var $=class n extends F{constructor(t){super();x(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:t,bigInteger:this.internalType});break;case"boolean":t.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:t,builder:this.internalType});break;case"bytes":t.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:t,class_:this.internalType});break}case"date":t.write(`"${this.internalType.value}"`);break;case"dateTime":this.writeDateTime({writer:t,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?t.write(`${r}.0`):t.write(r);break}case"enum":this.writeEnum({writer:t,enum_:this.internalType});break;case"float":t.write(`${this.internalType.value}f`);break;case"integer":t.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"raw":{this.internalType.value instanceof F?t.writeNode(this.internalType.value):t.write(this.internalType.value);break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:t,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:t,uuid:this.internalType});break;case"nop":break;default:E(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(t){return new this({type:"bigInteger",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static builder({classReference:t,parameters:r}){return new this({type:"builder",classReference:t,parameters:r})}static bytes(t){return new this({type:"bytes",value:t})}static class_({reference:t,parameters:r}){return new this({type:"class",reference:t,parameters:r})}static date(t){return new this({type:"date",value:t})}static dateTime(t){return new this({type:"dateTime",value:t})}static double(t){return new this({type:"double",value:t})}static enum_({classReference:t,value:r}){return new this({type:"enum",classReference:t,value:r})}static float(t){return new this({type:"float",value:t})}static integer(t){return new this({type:"integer",value:t})}static list({valueType:t,values:r,isParameter:a}){return new this({type:"list",valueType:t,values:r,isParameter:a})}static long(t){return new this({type:"long",value:t})}static map({keyType:t,valueType:r,entries:a}){return new this({type:"map",keyType:t,valueType:r,entries:a})}static optional({value:t,useOf:r}){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t,useOf:r})}static raw(t){return new this({type:"raw",value:t})}static reference(t){return new this({type:"reference",value:t})}static set({valueType:t,values:r}){return new this({type:"set",valueType:t,values:r})}static string(t){return new this({type:"string",value:t})}static unknown(t){return new this({type:"unknown",value:t})}static uuid(t){return new this({type:"uuid",value:t})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:E(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(p.instantiateClass({classReference:uu,arguments_:[n.string(r.value)]}))}writeBuilder({writer:t,builder:r}){t.writeNode(r.classReference),t.writeNewLineIfLastLineNot(),t.indent(),this.writeBuilderParameters({writer:t,parameters:this.orderBuilderParameters(du({parameters:r.parameters}))}),t.dedent()}writeBuilderParameters({writer:t,parameters:r}){t.writeLine(".builder()");for(let a of r)t.write(`.${a.name}(`),a.value.shouldWriteInLine()||t.newLine(),t.indent(),t.writeNode(a.value),t.dedent(),a.value.shouldWriteInLine()||t.newLine(),t.writeLine(")");t.writeNewLineIfLastLineNot(),t.write(".build()")}orderBuilderParameters(t){return t.sort((r,a)=>r.value.isOptional()&&!a.value.isOptional()?1:!r.value.isOptional()&&a.value.isOptional()?-1:0)}writeClass({writer:t,class_:r}){let a=pu({parameters:r.parameters});t.writeNode(p.instantiateClass({classReference:r.reference,arguments_:a.map(i=>i.value)}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(p.invokeMethod({on:lu,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:t,enum_:r}){t.writeNode(r.classReference),t.write("."+r.value)}writeList({writer:t,list:r}){this.writeIterable({writer:t,iterable:r})}writeMap({writer:t,map:r}){let a=mu({entries:r.entries});if(a.length===0){t.write("new "),t.writeNode(Lt),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(Lt),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.writeLine(">() {{"),t.indent();for(let i of a)t.write("put("),t.writeNode(i.key),t.write(", "),t.writeNode(i.value),t.writeLine(");");t.dedent(),t.write("}}")}writeOptional({writer:t,optional:r}){if(!r.useOf){t.writeNode(r.value);return}t.writeNode(p.invokeMethod({on:Ct,method:"of",arguments_:[r.value]}))}writeSet({writer:t,set:r}){this.writeIterable({writer:t,iterable:r})}writeIterable({writer:t,iterable:r}){let a=r.type==="list"?nr:cu,i=hu({values:r.values});if(r.type==="list"&&r.isParameter&&i.length>0){t.writeNode(p.invokeMethod({on:Pt,method:"asList",arguments_:i}));return}if(i.length===0){t.write(`new ${a.name}<`),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.writeLine(">("),t.indent(),t.writeNode(p.invokeMethod({on:Pt,method:"asList",arguments_:i})),t.writeNewLineIfLastLineNot(),t.dedent(),t.write(")")}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(`"${this.escapeString(r)}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownMap({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("new "),t.writeNode(nr),t.write("<Object>()");return}t.write("new "),t.writeNode(nr),t.write("<Object>("),t.writeNode(p.invokeMethod({on:Pt,method:"asList",arguments_:r.map(a=>n.unknown(a))})),t.write(")")}writeUnknownMap({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("new "),t.writeNode(Lt),t.write("<String, Object>()");return}t.writeLine("new "),t.writeNode(Lt),t.write("<String, Object>() {{"),t.indent();for(let[i,s]of a)t.write(`put("${i}", `),t.writeNode(n.unknown(s)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(p.invokeMethod({on:fu,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},nr=new P({name:"ArrayList",packageName:"java.util"}),uu=new P({name:"BigInteger",packageName:"java.math"}),Lt=new P({name:"HashMap",packageName:"java.util"}),cu=new P({name:"HashSet",packageName:"java.util"}),Im=new P({name:"List",packageName:"java.util"}),Em=new P({name:"Map",packageName:"java.util"}),lu=new P({name:"OffsetDateTime",packageName:"java.time"}),Sm=new P({name:"Set",packageName:"java.util"}),fu=new P({name:"UUID",packageName:"java.util"});function pu({parameters:n}){return n.filter(e=>!$.isNop(e.value))}function du({parameters:n}){return n.filter(e=>!$.isNop(e.value))}function mu({entries:n}){return n.filter(e=>!$.isNop(e.key)&&!$.isNop(e.value))}function hu({values:n}){return n.filter(e=>!$.isNop(e))}function Ft({writer:n,arguments_:e}){let t=gu(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof $&&!a.shouldWriteInLine())){yu({writer:n,arguments_:t});return}n.write("("),t.forEach((a,i)=>{i>0&&n.write(", "),Zn({writer:n,argument:a})}),n.write(")")}function yu({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Zn({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Zn({writer:n,argument:e}){Kt(e)?n.writeNodeOrString(e.assignment):e.write(n)}function gu(n){return n.filter(e=>!(e instanceof $&&$.isNop(e)))}var Me=class extends F{constructor({classReference:t,arguments_:r}){super();x(this,"classReference");x(this,"arguments_");this.classReference=t,this.arguments_=r}write(t){t.writeNode(this.classReference),Ft({writer:t,arguments_:this.arguments_})}};c();l();var De=class extends F{constructor(t){super();x(this,"arg");this.arg=t}write(t){return new Y(this.arg).write(t)}};c();l();var Ve=class extends F{constructor({name:t,access:r,parameters:a,body:i,static_:s,return_:o}){super();x(this,"name");x(this,"access");x(this,"parameters");x(this,"body");x(this,"return_");x(this,"static_");this.name=t,this.access=r,this.parameters=a,this.body=i,this.return_=o,this.static_=s!=null?s:!1}write(t){if(t.write(`${this.access} `),this.static_&&t.write("static "),this.return_!=null?t.writeNode(this.return_):t.write("void"),t.write(` ${this.name}`),this.parameters.length===0)t.write("()");else if(this.parameters.length===1){if(t.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);t.writeNode(this.parameters[0]),t.write(")")}else t.writeLine("("),t.indent(),this.parameters.forEach((r,a)=>{a>0&&t.writeLine(", "),t.writeNode(r)}),t.dedent(),t.write(")");if(this.body==null){t.write(";");return}t.writeLine(" {"),t.indent(),t.writeNode(this.body),t.writeNewLineIfLastLineNot(),t.dedent(),t.write("}")}};c();l();var $e=class extends F{constructor({method:t,arguments_:r,on:a}){super();x(this,"on");x(this,"method");x(this,"arguments_");this.on=a,this.method=t,this.arguments_=r}write(t){this.on.write(t),t.write("."),t.write(this.method),Ft({writer:t,arguments_:this.arguments_})}};c();l();var We=class extends F{constructor({name:t,type:r}){super();x(this,"name");x(this,"type");this.name=t,this.type=r}write(t){t.writeNode(this.type),t.write(` ${this.name}`)}};function xu(n){return new De(n)}function vu(n){return new Be(n)}function wu(n){return new P(n)}function bu(n){return new Me(n)}function Tu(n){return new $e(n)}function _u(n){return new Ve(n)}function ku(n){return new We(n)}c();l();var Ot=class{constructor({context:e}){x(this,"context");this.context=e}isNopTypeLiteral(e){var r;return((r=e.internalType)==null?void 0:r.type)==="nop"}wrapInOptionalIfNotNop(e,t=!1){return this.isNopTypeLiteral(e)?e:p.TypeLiteral.optional({value:e,useOf:t})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:S.Critical,message:"Expected non-null value, but got null"}),p.TypeLiteral.nop());if(e.value===void 0)return p.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?p.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion})}case"nullable":case"optional":{if(e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&e.typeReference.value.type==="named")return p.TypeLiteral.reference(p.invokeMethod({on:p.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(e.typeReference.value.type==="list"){let a=this.convertList({list:e.typeReference.value.value,value:e.value});return this.wrapInOptionalIfNotNop(a,!0)}let t=this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion}),r=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapInOptionalIfNotNop(t,r)}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value});case"unknown":return this.convertUnknown({value:e.value});default:E(e.typeReference)}}convertList({list:e,value:t}){if(!Array.isArray(t))return this.context.errors.add({severity:S.Critical,message:`Expected array but got: ${typeof t}`}),p.TypeLiteral.nop();let r=e.type==="optional"||e.type==="nullable";return p.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((a,i)=>{this.context.errors.scope({index:i});try{if(r){let s=this.convert({typeReference:e.value,value:a});return this.wrapInOptionalIfNotNop(s,!0)}return this.convert({typeReference:e,value:a})}finally{this.context.errors.unscope()}}),isParameter:!0})}convertLiteral({literal:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?p.TypeLiteral.nop():p.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?p.TypeLiteral.nop():p.TypeLiteral.string(r)}default:E(e)}}convertSet({set:e,value:t}){return Array.isArray(t)?p.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((r,a)=>{this.context.errors.scope({index:a});try{return this.convert({typeReference:e,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:S.Critical,message:`Expected array but got: ${typeof t}`}),p.TypeLiteral.nop())}convertMap({map:e,value:t}){return typeof t!="object"||t==null?(this.context.errors.add({severity:S.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),p.TypeLiteral.nop()):p.TypeLiteral.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(t).map(([r,a])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:e.key,value:r,as:"mapKey"}),value:this.convert({typeReference:e.value,value:a,as:"mapValue"})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t,as:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:E(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let r=this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return p.TypeLiteral.nop();let i=a.singleDiscriminatedUnionType;switch(i.type){case"samePropertiesAsObject":{let s=this.context.resolveNamedType({typeId:i.typeId});return s==null?p.TypeLiteral.nop():p.TypeLiteral.reference(p.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[this.convertNamed({named:s,value:a.value})]}))}case"singleProperty":{let s=this.context.getRecord(a.value);if(s==null)return p.TypeLiteral.nop();try{return this.context.errors.scope(i.discriminantValue.wireValue),p.TypeLiteral.reference(p.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[this.convert({typeReference:i.typeReference,value:s[i.discriminantValue.wireValue]})]}))}finally{this.context.errors.unscope()}}case"noProperties":return p.TypeLiteral.reference(p.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[]}));default:E(i)}}convertObject({object_:e,value:t,as:r}){var i;let a=this.context.associateByWireValue({parameters:e.properties,values:(i=this.context.getRecord(t))!=null?i:{}});return p.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),parameters:a.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getMethodName(s.name.name),value:this.convert({typeReference:s.typeReference,value:s.value,as:r})}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:t}){let r=this.getEnumValueName({enum_:e,value:t});return r==null?p.TypeLiteral.nop():p.TypeLiteral.enum_({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:r})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:S.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let r=e.values.find(a=>a.wireValue===t);if(r==null){this.context.errors.add({severity:S.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return this.context.getEnumName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return r==null?p.TypeLiteral.nop():this.context.isPrimitive(r.valueTypeReference)?p.TypeLiteral.reference(p.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]})):p.TypeLiteral.reference(p.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){for(let r of e.types)try{let a=this.convert({typeReference:r,value:t,inUndiscriminatedUnion:!0});return{valueTypeReference:r,typeInstantiation:a}}catch(a){continue}this.context.errors.add({severity:S.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}getUndiscriminatedUnionFieldName({typeReference:e}){switch(e.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:e});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:e.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:e});case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t==null?void 0:this.context.getClassName(t.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"nullable":return this.getUndiscriminatedUnionFieldNameForNullable({typeReference:e});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:e.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:e});case"unknown":return"Unknown";default:E(e)}}getUndiscriminatedUnionFieldNameForList({list:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`ListOf${t}`}getUndiscriminatedUnionFieldNameForMap({map:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e.key});if(t==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:e.value});if(r!=null)return`MapOf${t}To${r}`}getUndiscriminatedUnionFieldNameForOptional({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Optional${t}`}getUndiscriminatedUnionFieldNameForNullable({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Nullable${t}`}getUndiscriminatedUnionFieldNameForSet({set:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`SetOf${t}`}getUndiscriminatedUnionFieldNameForLiteral({literal:e}){}getUndiscriminatedUnionFieldNameForPrimitive({primitive:e}){switch(e){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":return"Float";case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":return"BigInteger";case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:E(e)}}convertUnknown({value:e}){return p.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:r}){switch(e){case"INTEGER":case"UINT":{let a=this.getValueAsNumber({value:t,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.integer(a)}case"LONG":case"UINT_64":{let a=this.getValueAsNumber({value:t,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.long(a)}case"FLOAT":{let a=this.getValueAsNumber({value:t,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.float(a)}case"DOUBLE":{let a=this.getValueAsNumber({value:t,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.double(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:t,as:r});return a==null?p.TypeLiteral.nop():p.TypeLiteral.boolean(a)}case"STRING":{let a=this.context.getValueAsString({value:t});return a==null?p.TypeLiteral.nop():p.TypeLiteral.string(a)}case"DATE":{let a=this.context.getValueAsString({value:t});return a==null?p.TypeLiteral.nop():p.TypeLiteral.string(a)}case"DATE_TIME":{let a=this.context.getValueAsString({value:t});return a==null?p.TypeLiteral.nop():p.TypeLiteral.dateTime(a)}case"UUID":{let a=this.context.getValueAsString({value:t});return a==null?p.TypeLiteral.nop():p.TypeLiteral.uuid(a)}case"BASE_64":{let a=this.context.getValueAsString({value:t});return a==null?p.TypeLiteral.nop():p.TypeLiteral.bytes(a)}case"BIG_INTEGER":{let a=this.context.getValueAsString({value:t});return a==null?p.TypeLiteral.nop():p.TypeLiteral.bigInteger(a)}default:E(e)}}getValueAsNumber({value:e,as:t}){let r=t==="mapKey"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:t}){let r=t==="mapKey"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};c();l();var Ut=class{constructor({context:e}){x(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return p.Type.list(this.convert({typeReference:e.typeReference}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return p.Type.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t})}case"optional":case"nullable":return p.Type.optional(this.convert({typeReference:e.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return p.Type.set(this.convert({typeReference:e.typeReference}));case"unknown":return this.convertUnknown();default:E(e.typeReference)}}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return p.Type.reference(p.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getTypesPackageName(e.declaration.fernFilepath)}));default:E(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return p.Type.boolean();case"string":return p.Type.string()}}convertUnknown(){return p.Type.object()}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return p.Type.integer();case"UINT":return p.Type.integer();case"LONG":return p.Type.long();case"UINT_64":return p.Type.long();case"FLOAT":return p.Type.float();case"DOUBLE":return p.Type.double();case"BOOLEAN":return p.Type.boolean();case"STRING":return p.Type.string();case"DATE":return p.Type.date();case"DATE_TIME":return p.Type.dateTime();case"UUID":return p.Type.uuid();case"BASE_64":return p.Type.bytes();case"BIG_INTEGER":return p.Type.bigInteger();default:E(e)}}};c();l();var jt=class{constructor({context:e}){x(this,"context");this.context=e}getFilePropertyInfo({body:e,value:t}){var i;let r={fileFields:[],bodyPropertyFields:[]},a=(i=this.context.getRecord(t))!=null?i:{};for(let s of e.properties)switch(s.type){case"file":r.fileFields.push({name:this.context.getMethodName(s.name),value:this.getSingleFileProperty({property:s,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getMethodName(s.name),value:this.getArrayFileProperty({property:s,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getMethodName(s.name.name),value:this.getBodyProperty({property:s,record:a})});break;default:E(s)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return r==null?p.TypeLiteral.nop():p.TypeLiteral.reference(this.context.getFileStreamFromString(r))}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});if(r==null)return p.TypeLiteral.nop();for(let a of r)return p.TypeLiteral.reference(this.context.getFileStreamFromString(a));return p.TypeLiteral.nop()}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?p.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var Ru=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch","getClass"]),Bt=class n extends ct{constructor({ir:t,config:r,options:a}){var i;super({ir:t,config:r,options:a});x(this,"ir");x(this,"customConfig");x(this,"dynamicTypeMapper");x(this,"dynamicTypeLiteralMapper");x(this,"filePropertyMapper");this.ir=t,this.customConfig=tr.parse((i=r.customConfig)!=null?i:{}),this.dynamicTypeMapper=new Ut({context:this}),this.dynamicTypeLiteralMapper=new Ot({context:this}),this.filePropertyMapper=new jt({context:this})}clone(){return new n({ir:this.ir,config:this.config,options:this.options})}getClassName(t){return this.getName(t.pascalCase.safeName)}getEnumName(t){return this.getName(t.screamingSnakeCase.safeName)}getPropertyName(t){return this.getName(t.camelCase.safeName)}getMethodName(t){return this.getName(t.camelCase.safeName)}getRootClientClassReference(){return p.classReference({name:this.getRootClientClassName(),packageName:this.getRootPackageName()})}getRootClientClassName(){var t,r;return(r=(t=this.customConfig)==null?void 0:t["client-class-name"])!=null?r:`${this.getBaseNamePrefix()}Client`}getEnvironmentClassName(){return"Environment"}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return p.codeblock(a=>{a.writeNode(this.getEnvironmentClassReference()),a.write("."),a.write(this.getEnumName(r))})}getEnvironmentClassReference(){return p.classReference({name:this.getEnvironmentClassName(),packageName:this.getCorePackageName()})}getJavaClassReferenceFromDeclaration({declaration:t}){return p.classReference({name:t.name.pascalCase.unsafeName,packageName:this.getTypesPackageName(t.fernFilepath)})}getNullableClassReference(){return p.classReference({name:"Nullable",packageName:this.getCorePackageName()})}getNullableOfNull(){return p.TypeLiteral.reference(p.invokeMethod({on:this.getNullableClassReference(),method:"ofNull",arguments_:[]}))}getFileStreamFromString(t){return p.TypeLiteral.reference(p.codeblock(r=>{r.write("new "),r.writeNode(this.getFileStreamClassReference()),r.write("("),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(p.TypeLiteral.string(t)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getFileStreamClassReference(){return p.classReference({name:"FileStream",packageName:this.getCorePackageName()})}getByteArrayInputStreamClassReference(){return p.classReference({name:"ByteArrayInputStream",packageName:"java.io"})}getStandardCharsetsClassReference(){return p.classReference({name:"StandardCharsets",packageName:"java.nio.charset"})}isPrimitive(t){switch(t.type){case"primitive":return!0;case"optional":case"nullable":return this.isPrimitive(t.value);case"named":{let r=this.resolveNamedType({typeId:t.value});if(r==null)return!1;switch(r.type){case"alias":return this.isPrimitive(r.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:E(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:E(t)}}getRootPackageName(){let t=this.getPackagePrefixTokens();return this.joinPackageTokens(t)}getCorePackageName(){let t=this.getPackagePrefixTokens();return t.push("core"),this.joinPackageTokens(t)}getTypesPackageName(t){return this.getResourcesPackage(t,"types")}getRequestsPackageName(t){return this.getPackageLayout()==="flat"?this.getTypesPackageName(t):this.getResourcesPackage(t,"requests")}getResourcesPackage(t,r){let a=this.getPackagePrefixTokens();switch(this.getPackageLayout()){case"flat":t!=null&&a.push(...t.packagePath.map(i=>this.getPackageNameSegment(i)));break;case"nested":default:t!=null&&t.allParts.length>0&&a.push("resources"),t!=null&&a.push(...t.allParts.map(i=>this.getPackageNameSegment(i)))}return r!=null&&a.push(r),this.joinPackageTokens(a)}getPackageName(t,r){let a=this.getPackageNameSegments(t);return a=r!=null?[...a,r]:a,[...this.getPackagePrefixTokens(),...a].join(".")}getPackageLayout(){var t,r;return(r=(t=this.customConfig)==null?void 0:t["package-layout"])!=null?r:"nested"}shouldInlinePathParameters(){var t,r;return(r=(t=this.customConfig)==null?void 0:t["inline-path-parameters"])!=null?r:!1}shouldInlineFileProperties(){var t,r;return(r=(t=this.customConfig)==null?void 0:t["inline-file-properties"])!=null?r:!1}getPackageNameSegments(t){return t.packagePath.map(r=>this.getPackageNameSegment(r))}getPackageNameSegment(t){return t.camelCase.safeName.toLowerCase()}getPackagePrefixTokens(){var r;if(((r=this.customConfig)==null?void 0:r["package-prefix"])!=null)return this.customConfig["package-prefix"].split(".");let t=[];return t.push("com"),t.push(...this.splitOnNonAlphaNumericChar(this.config.organization)),t.push(...this.splitOnNonAlphaNumericChar(this.getApiName())),t}getBaseNamePrefix(){return this.convertKebabCaseToUpperCamelCase(this.config.organization)+this.convertKebabCaseToUpperCamelCase(this.getApiName())}getApiName(){return Jt(this.config.workspaceName)}startsWithNumber(t){return/^\d/.test(t)}splitOnNonAlphaNumericChar(t){return t.split(/[^a-zA-Z0-9]/)}convertKebabCaseToUpperCamelCase(t){return t.replace(/-([a-z])/g,(r,a)=>a.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}joinPackageTokens(t){return t.map(a=>this.startsWithNumber(a)?"_"+a:a).join(".")}getName(t){return this.isReservedName(t)?"_"+t:t}isReservedName(t){return Ru.has(t)}};c();l();var Gn="com.example.usage",Nu="Example",Au="main",Iu="args",Yn="client",Eu={type:"primitive",value:"STRING"},Mt=class{constructor({context:e,formatter:t}){x(this,"context");x(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t,options:r}){var s;let a=this.getConfig(r);return await this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toStringAsync({packageName:(s=a.fullStylePackageName)!=null?s:Gn,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t,options:r}){var s;let a=this.getConfig(r);return this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toString({packageName:(s=a.fullStylePackageName)!=null?s:Gn,customConfig:this.context.customConfig,formatter:this.formatter})}buildCodeBlock({endpoint:e,snippet:t,options:r}){let a=p.codeblock(s=>{s.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),s.newLine(),s.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),i=this.getStyle(r);switch(i){case we.Concise:return a;case we.Full:return this.buildFullCodeBlock({body:a,options:r});default:E(i)}}constructClient({endpoint:e,snippet:t}){return p.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${Yn} = `),r.writeNode(p.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:e,snippet:t})}))})}buildFullCodeBlock({body:e,options:t}){var s;let r=this.getConfig(t),a=p.class_({name:(s=r.fullStyleClassName)!=null?s:Nu,access:p.Access.Public}),i=p.parameter({name:Iu,type:p.Type.array(p.Type.string())});return a.addMethod(p.method({name:Au,access:p.Access.Public,static_:!0,parameters:[i],body:e})),a}getRootClientBuilderArgs({endpoint:e,snippet:t}){var o,f;let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getRootClientAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:S.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(H.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let i=new Set;if([...(o=this.context.ir.pathParameters)!=null?o:[],...(f=e.request.pathParameters)!=null?f:[]].forEach(d=>{d.variable!=null&&i.add(d.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let d of this.context.ir.variables)if(i.has(d.id)){let y=d.name.camelCase.unsafeName;r.push({name:y,value:p.TypeLiteral.string(`YOUR_${d.name.screamingSnakeCase.unsafeName}`)})}}return r}getRootClientBaseUrlArg({baseUrl:e,environment:t}){var r;if(e!=null&&t!=null){this.context.errors.add({severity:S.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null){if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"){this.context.errors.add({severity:S.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:p.TypeLiteral.string(e)}}if(t!=null){if(this.context.isSingleEnvironmentID(t)){let a=this.context.getEnvironmentTypeReferenceFromID(t);if(a==null){this.context.errors.add({severity:S.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return{name:"environment",value:p.TypeLiteral.reference(a)}}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?{name:"environment",value:p.TypeLiteral.reference(p.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(t).map(a=>this.context.dynamicTypeLiteralMapper.convert({typeReference:Eu,value:a}))}))}:void 0}}getRootClientAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getRootClientBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getRootClientBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getRootClientHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getRootClientOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:E(e)}}addError(e){this.context.errors.add({severity:S.Critical,message:e})}addWarning(e){this.context.errors.add({severity:S.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){return[{name:"credentials",value:p.TypeLiteral.raw(`"${t.username}", "${t.password}"`)}]}getRootClientBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.token),value:p.TypeLiteral.string(t.token)}]}getRootClientHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getRootClientOAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.clientId),value:p.TypeLiteral.string(t.clientId)},{name:this.context.getMethodName(e.clientSecret),value:p.TypeLiteral.string(t.clientSecret)}]}getRootClientHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let i=this.getRootClientHeaderArg({header:a,value:t.value});i!=null&&r.push({name:this.context.getMethodName(a.name.name),value:i})}return r}getRootClientHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!p.TypeLiteral.isNop(r))return r}callMethod({endpoint:e,snippet:t}){return p.invokeMethod({on:p.codeblock(Yn),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:E(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var o,f;let r=[];this.context.errors.scope(H.PathParameters);let i=[...(o=this.context.ir.pathParameters)!=null?o:[],...(f=e.pathParameters)!=null?f:[]].filter(d=>d.variable==null);i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:t}).map(d=>d.value)),this.context.errors.unscope(),this.context.errors.scope(H.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope();let s=this.getRequestOptionsArg({request:e,snippet:t});return s!=null&&r.push(s),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return e.value.type==="optional"?t==null?p.TypeLiteral.reference(p.invokeMethod({on:p.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]})):p.TypeLiteral.optional({value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t}),useOf:!0}):this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:E(e)}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:S.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),p.TypeLiteral.nop()):p.TypeLiteral.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var y,b;let r=[],{inlinePathParameters:a,inlineFileProperties:i}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(H.PathParameters);let s=[],f=[...(y=this.context.ir.pathParameters)!=null?y:[],...(b=e.pathParameters)!=null?b:[]].filter(L=>L.variable==null);f.length>0&&s.push(...this.getPathParameters({namedParameters:f,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(H.RequestBody);let d=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...s.map(L=>L.value)),i||r.push(...d.fileFields.map(L=>L.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?s:[],filePropertyInfo:d})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:a}){var y,b,L,O;this.context.errors.scope(H.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:(y=e.queryParameters)!=null?y:[],values:(b=t.queryParameters)!=null?b:{}}).map(W=>({name:this.context.getMethodName(W.name.name),value:this.context.dynamicTypeLiteralMapper.convert(W)}));this.context.errors.unscope(),this.context.errors.scope(H.Headers);let f=this.context.associateByWireValue({parameters:(L=e.headers)!=null?L:[],values:(O=t.headers)!=null?O:{}}).map(W=>({name:this.context.getMethodName(W.name.name),value:this.context.dynamicTypeLiteralMapper.convert(W)}));this.context.errors.unscope(),this.context.errors.scope(H.RequestBody);let d=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),p.TypeLiteral.builder({classReference:p.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)}),parameters:[...r,...f,...s,...d]})}getRequestOptionsArg({request:e,snippet:t}){var f,d,y;let r="headers"in e?(f=e.headers)!=null?f:[]:[];if(r.length===0||Object.keys((d=t.headers)!=null?d:{}).length===0)return;this.context.errors.scope(H.Headers);let a=this.context.associateByWireValue({parameters:r,values:(y=t.headers)!=null?y:{}});if(this.context.errors.unscope(),a.length===0)return;let i=p.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),s=p.invokeMethod({on:i,method:"builder",arguments_:[]});for(let b of a)s=p.invokeMethod({on:s,method:"addHeader",arguments_:[p.TypeLiteral.string(b.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(b)]});let o=p.invokeMethod({on:s,method:"build",arguments_:[]});return p.TypeLiteral.reference(o)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:E(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t}){return{name:this.context.getMethodName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:E(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t}){var i;let r=[],a=this.context.associateByWireValue({parameters:e,values:(i=this.context.getRecord(t))!=null?i:{}});for(let s of a)r.push({name:this.context.getMethodName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return r}getPathParameters({namedParameters:e,snippet:t}){var i;let r=[],a=this.context.associateByWireValue({parameters:e,values:(i=t.pathParameters)!=null?i:{}});for(let s of a)r.push({name:this.context.getMethodName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>`${this.context.getMethodName(t)}()`).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getStyle(e){var t,r;return(r=(t=e.style)!=null?t:this.context.options.style)!=null?r:we.Full}getConfig(e){var t,r;return(r=(t=e.config)!=null?t:this.context.options.config)!=null?r:{}}};var ar=class extends st{constructor({ir:t,config:r,options:a={}}){super(new Bt({ir:t,config:r,options:a}));x(this,"formatter")}async generate(t,r={}){return super.generate(t,r)}generateSync(t,r={}){return super.generateSync(t,r)}createSnippetGenerator(t){return new Mt({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
16
20
  /*! Bundled license information:
17
21
 
18
22
  @esbuild-plugins/node-globals-polyfill/Buffer.js:
@@ -34,3 +38,4 @@ lodash-es/lodash.js:
34
38
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
35
39
  *)
36
40
  */
41
+ //# sourceMappingURL=DynamicSnippetsGenerator.cjs.map