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

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 (78) hide show
  1. package/cjs/Config.cjs +1 -0
  2. package/cjs/Config.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.cjs +25 -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-DGzYoCz3.d.cts} +19 -6
  7. package/cjs/EndpointSnippetGenerator.cjs +15 -7
  8. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  9. package/cjs/EndpointSnippetGenerator.d.cts +4 -1
  10. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +25 -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 +21 -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 +15 -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 +15 -7
  20. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  21. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  22. package/cjs/index.cjs +23 -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-DGzYoCz3.d.ts} +19 -6
  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-2U3YQWRZ.js +12 -0
  35. package/esm/chunk-2U3YQWRZ.js.map +1 -0
  36. package/esm/chunk-3X524Y2I.js +23 -0
  37. package/esm/chunk-3X524Y2I.js.map +1 -0
  38. package/esm/chunk-5CTXVUPZ.js +8 -0
  39. package/esm/chunk-5CTXVUPZ.js.map +1 -0
  40. package/esm/chunk-EOZMORS3.js +2 -0
  41. package/esm/chunk-EOZMORS3.js.map +1 -0
  42. package/esm/chunk-JFD4YVTW.js +15 -0
  43. package/esm/chunk-JFD4YVTW.js.map +1 -0
  44. package/esm/chunk-KQE3JYZ2.js +2 -0
  45. package/esm/chunk-KQE3JYZ2.js.map +1 -0
  46. package/esm/chunk-N3AIOPEV.js +2 -0
  47. package/esm/chunk-N3AIOPEV.js.map +1 -0
  48. package/esm/chunk-PBNDQMXA.js +2 -0
  49. package/esm/chunk-PBNDQMXA.js.map +1 -0
  50. package/esm/chunk-QH22Z5KY.js +2 -0
  51. package/esm/chunk-QH22Z5KY.js.map +1 -0
  52. package/esm/{chunk-452HWDL4.js → chunk-VYJE6STI.js} +2 -1
  53. package/esm/chunk-VYJE6STI.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 +2 -13
  68. package/esm/index.js.map +1 -0
  69. package/package.json +1 -1
  70. package/esm/chunk-2AZXIWKY.js +0 -11
  71. package/esm/chunk-7CY27UU7.js +0 -1
  72. package/esm/chunk-AASPH6YC.js +0 -15
  73. package/esm/chunk-BKM7JFLZ.js +0 -1
  74. package/esm/chunk-HN67B7VQ.js +0 -1
  75. package/esm/chunk-JSEUWNSK.js +0 -1
  76. package/esm/chunk-N3DIPQCT.js +0 -14
  77. package/esm/chunk-TTNRR5YY.js +0 -1
  78. package/esm/chunk-WFKWXM7L.js +0 -1
@@ -1,18 +1,31 @@
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 Tt=Object.defineProperty,fa=Object.defineProperties,pa=Object.getOwnPropertyDescriptor,da=Object.getOwnPropertyDescriptors,ma=Object.getOwnPropertyNames,bt=Object.getOwnPropertySymbols;var Ht=Object.prototype.hasOwnProperty,xr=Object.prototype.propertyIsEnumerable;var Yt=(n,e,t)=>e in n?Tt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,m=(n,e)=>{for(var t in e||(e={}))Ht.call(e,t)&&Yt(n,t,e[t]);if(bt)for(var t of bt(e))xr.call(e,t)&&Yt(n,t,e[t]);return n},_=(n,e)=>fa(n,da(e));var vr=n=>typeof n=="symbol"?n:n+"",wr=(n,e)=>{var t={};for(var r in n)Ht.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&bt)for(var r of bt(n))e.indexOf(r)<0&&xr.call(n,r)&&(t[r]=n[r]);return t};var Jt=(n,e)=>()=>(n&&(e=n(n=0)),e);var Kt=(n,e)=>{for(var t in e)Tt(n,t,{get:e[t],enumerable:!0})},ha=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ma(e))!Ht.call(n,a)&&a!==t&&Tt(n,a,{get:()=>e[a],enumerable:!(r=pa(e,a))||r.enumerable});return n};var ya=n=>ha(Tt({},"__esModule",{value:!0}),n);var g=(n,e,t)=>Yt(n,typeof e!="symbol"?e+"":e,t);function Tr(){throw new Error("setTimeout has not been defined")}function _r(){throw new Error("clearTimeout has not been defined")}function kr(n){if(pe===setTimeout)return setTimeout(n,0);if((pe===Tr||!pe)&&setTimeout)return pe=setTimeout,setTimeout(n,0);try{return pe(n,0)}catch(e){try{return pe.call(null,n,0)}catch(t){return pe.call(this,n,0)}}}function ga(n){if(de===clearTimeout)return clearTimeout(n);if((de===_r||!de)&&clearTimeout)return de=clearTimeout,clearTimeout(n);try{return de(n)}catch(e){try{return de.call(null,n)}catch(t){return de.call(this,n)}}}function xa(){!He||!we||(He=!1,we.length?ae=we.concat(ae):_t=-1,ae.length&&Rr())}function Rr(){if(!He){var n=kr(xa);He=!0;for(var e=ae.length;e;){for(we=ae,ae=[];++_t<e;)we&&we[_t].run();_t=-1,e=ae.length}we=null,He=!1,ga(n)}}function va(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];ae.push(new Nr(n,e)),ae.length===1&&!He&&kr(Rr)}function Nr(n,e){this.fun=n,this.array=e}function be(){}function Ba(n){throw new Error("process.binding is not supported")}function Ua(){return"/"}function ja(n){throw new Error("process.chdir is not supported")}function Ma(){return 0}function $a(n){var e=Da.call(Ye)*.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 qa(){var n=new Date,e=n-Va;return e/1e3}var pe,de,ae,He,we,_t,wa,ba,Ta,_a,ka,Ra,Na,Ia,Aa,Sa,Ea,Ca,Pa,La,Fa,Oa,Ye,Da,Va,x,br,c=Jt(()=>{"use strict";pe=Tr,de=_r;typeof globalThis.setTimeout=="function"&&(pe=setTimeout);typeof globalThis.clearTimeout=="function"&&(de=clearTimeout);ae=[],He=!1,_t=-1;Nr.prototype.run=function(){this.fun.apply(null,this.array)};wa="browser",ba="browser",Ta=!0,_a={},ka=[],Ra="",Na={},Ia={},Aa={};Sa=be,Ea=be,Ca=be,Pa=be,La=be,Fa=be,Oa=be;Ye=globalThis.performance||{},Da=Ye.now||Ye.mozNow||Ye.msNow||Ye.oNow||Ye.webkitNow||function(){return new Date().getTime()};Va=new Date;x={nextTick:va,title:wa,browser:Ta,env:_a,argv:ka,version:Ra,versions:Na,on:Sa,addListener:Ea,once:Ca,off:Pa,removeListener:La,removeAllListeners:Fa,emit:Oa,binding:Ba,cwd:Ua,chdir:ja,umask:Ma,hrtime:$a,platform:ba,release:Ia,config:Aa,uptime:qa},br={};Object.keys(br).forEach(n=>{let e=n.split("."),t=x;for(let r=0;r<e.length;r++){let a=e[r];r===e.length-1?t[a]=br[n]:t=t[a]||(t[a]={})}})});function Er(){Xt=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=n.length;e<t;++e)Q[e]=n[e],W[n.charCodeAt(e)]=e;W[45]=62,W[95]=63}function za(n){Xt||Er();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 Wa(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=W[n.charCodeAt(e)]<<18|W[n.charCodeAt(e+1)]<<12|W[n.charCodeAt(e+2)]<<6|W[n.charCodeAt(e+3)],s[f++]=a>>16&255,s[f++]=a>>8&255,s[f++]=a&255;return i===2?(a=W[n.charCodeAt(e)]<<2|W[n.charCodeAt(e+1)]>>4,s[f++]=a&255):i===1&&(a=W[n.charCodeAt(e)]<<10|W[n.charCodeAt(e+1)]<<4|W[n.charCodeAt(e+2)]>>2,s[f++]=a>>8&255,s[f++]=a&255),s}function Za(n){return Q[n>>18&63]+Q[n>>12&63]+Q[n>>6&63]+Q[n&63]}function Ga(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(Za(r));return a.join("")}function Ir(n){Xt||Er();for(var e,t=n.length,r=t%3,a="",i=[],s=16383,o=0,f=t-r;o<f;o+=s)i.push(Ga(n,o,o+s>f?f:o+s));return r===1?(e=n[t-1],a+=Q[e>>2],a+=Q[e<<4&63],a+="=="):r===2&&(e=(n[t-2]<<8)+n[t-1],a+=Q[e>>10],a+=Q[e>>4&63],a+=Q[e<<2&63],a+="="),i.push(a),i.join("")}function kt(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ie(n,e){if(kt()<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 er(this,n)}return Cr(this,n,e,t)}function Cr(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?Ja(n,e,t,r):typeof e=="string"?Ha(n,e,t):Ka(n,e)}function Pr(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 Ya(n,e,t,r){return Pr(e),e<=0?ie(n,e):t!==void 0?typeof r=="string"?ie(n,e).fill(t,r):ie(n,e).fill(t):ie(n,e)}function er(n,e){if(Pr(e),n=ie(n,e<0?0:tr(e)|0),!u.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)n[t]=0;return n}function Ha(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=Lr(e,t)|0;n=ie(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:tr(e.length)|0;n=ie(n,t);for(var r=0;r<t;r+=1)n[r]=e[r]&255;return n}function Ja(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 Ka(n,e){if(X(e)){var t=tr(e.length)|0;return n=ie(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"||yi(e.length)?ie(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 tr(n){if(n>=kt())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kt().toString(16)+" bytes");return n|0}function X(n){return!!(n!=null&&n._isBuffer)}function Lr(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 Rt(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Dr(n).length;default:if(r)return Rt(n).length;e=(""+e).toLowerCase(),r=!0}}function Qa(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 ui(this,e,t);case"utf8":case"utf-8":return Br(this,e,t);case"ascii":return si(this,e,t);case"latin1":case"binary":return oi(this,e,t);case"base64":return ai(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ci(this,e,t);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function Te(n,e,t){var r=n[e];n[e]=n[t],n[t]=r}function Fr(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:Ar(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):Ar(n,[e],t,r,a);throw new TypeError("val must be string, number or Buffer")}function Ar(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(F,q){return i===1?F[q]:F.readUInt16BE(q*i)}var d;if(a){var h=-1;for(d=t;d<s;d++)if(f(n,d)===f(e,h===-1?0:d-h)){if(h===-1&&(h=d),d-h+1===o)return h*i}else h!==-1&&(d-=d-h),h=-1}else for(t+o>s&&(t=s-o),d=t;d>=0;d--){for(var b=!0,C=0;C<o;C++)if(f(n,d+C)!==f(e,C)){b=!1;break}if(b)return d}return-1}function Xa(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 ei(n,e,t,r){return At(Rt(e,n.length-t),n,t,r)}function Or(n,e,t,r){return At(mi(e),n,t,r)}function ti(n,e,t,r){return Or(n,e,t,r)}function ri(n,e,t,r){return At(Dr(e),n,t,r)}function ni(n,e,t,r){return At(hi(e,n.length-t),n,t,r)}function ai(n,e,t){return e===0&&t===n.length?Ir(n):Ir(n.slice(e,t))}function Br(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,h,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],h=n[a+3],(f&192)===128&&(d&192)===128&&(h&192)===128&&(b=(i&15)<<18|(f&63)<<12|(d&63)<<6|h&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 ii(r)}function ii(n){var e=n.length;if(e<=Sr)return String.fromCharCode.apply(String,n);for(var t="",r=0;r<e;)t+=String.fromCharCode.apply(String,n.slice(r,r+=Sr));return t}function si(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 oi(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 ui(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+=di(n[i]);return a}function ci(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 B(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 Nt(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 It(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 Ur(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 jr(n,e,t,r,a){return a||Ur(n,e,t,4,34028234663852886e22,-34028234663852886e22),Vr(n,e,t,r,23,4),t+4}function Mr(n,e,t,r,a){return a||Ur(n,e,t,8,17976931348623157e292,-17976931348623157e292),Vr(n,e,t,r,52,8),t+8}function fi(n){if(n=pi(n).replace(li,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function pi(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function di(n){return n<16?"0"+n.toString(16):n.toString(16)}function Rt(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 mi(n){for(var e=[],t=0;t<n.length;++t)e.push(n.charCodeAt(t)&255);return e}function hi(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 Dr(n){return za(fi(n))}function At(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 yi(n){return n!==n}function gi(n){return n!=null&&(!!n._isBuffer||$r(n)||xi(n))}function $r(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function xi(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&$r(n.slice(0,0))}function St(n,e,t,r,a){var i,s,o=a*8-r-1,f=(1<<o)-1,d=f>>1,h=-7,b=t?a-1:0,C=t?-1:1,F=n[e+b];for(b+=C,i=F&(1<<-h)-1,F>>=-h,h+=o;h>0;i=i*256+n[e+b],b+=C,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=r;h>0;s=s*256+n[e+b],b+=C,h-=8);if(i===0)i=1-d;else{if(i===f)return s?NaN:(F?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-d}return(F?-1:1)*s*Math.pow(2,i-r)}function Vr(n,e,t,r,a,i){var s,o,f,d=i*8-a-1,h=(1<<d)-1,b=h>>1,C=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,F=r?0:i-1,q=r?1:-1,ve=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=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-s))<1&&(s--,f*=2),s+b>=1?e+=C/f:e+=C*Math.pow(2,1-b),e*f>=2&&(s++,f/=2),s+b>=h?(o=0,s=h):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+F]=o&255,F+=q,o/=256,a-=8);for(s=s<<a|o,d+=a;d>0;n[t+F]=s&255,F+=q,s/=256,d-=8);n[t+F-q]|=ve*128}var Q,W,Wa,Xt,Sr,li,qr=Jt(()=>{"use strict";c();l();Q=[],W=[],Wa=typeof Uint8Array!="undefined"?Uint8Array:Array,Xt=!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 Cr(null,n,e,t)};u.kMaxLength=kt();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 Ya(null,n,e,t)};u.allocUnsafe=function(n){return er(null,n)};u.allocUnsafeSlow=function(n){return er(null,n)};u.isBuffer=gi;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=Lr;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)Te(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)Te(this,t,t+3),Te(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)Te(this,t,t+7),Te(this,t+1,t+6),Te(this,t+2,t+5),Te(this,t+3,t+4);return this};u.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?Br(this,0,e):Qa.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),h=e.slice(t,r),b=0;b<f;++b)if(d[b]!==h[b]){s=d[b],o=h[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 Fr(this,e,t,r,!0)};u.prototype.lastIndexOf=function(e,t,r){return Fr(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 Xa(this,e,t,r);case"utf8":case"utf-8":return ei(this,e,t,r);case"ascii":return Or(this,e,t,r);case"latin1":case"binary":return ti(this,e,t,r);case"base64":return ri(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ni(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)}};Sr=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||B(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||B(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||B(e,1,this.length),this[e]};u.prototype.readUInt16LE=function(e,t){return t||B(e,2,this.length),this[e]|this[e+1]<<8};u.prototype.readUInt16BE=function(e,t){return t||B(e,2,this.length),this[e]<<8|this[e+1]};u.prototype.readUInt32LE=function(e,t){return t||B(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||B(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||B(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||B(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||B(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};u.prototype.readInt16LE=function(e,t){t||B(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||B(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||B(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||B(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||B(e,4,this.length),St(this,e,!0,23,4)};u.prototype.readFloatBE=function(e,t){return t||B(e,4,this.length),St(this,e,!1,23,4)};u.prototype.readDoubleLE=function(e,t){return t||B(e,8,this.length),St(this,e,!0,52,8)};u.prototype.readDoubleBE=function(e,t){return t||B(e,8,this.length),St(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):Nt(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):Nt(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):It(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):It(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):Nt(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):Nt(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):It(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):It(this,e,t,!1),t+4};u.prototype.writeFloatLE=function(e,t,r){return jr(this,e,t,!0,r)};u.prototype.writeFloatBE=function(e,t,r){return jr(this,e,t,!1,r)};u.prototype.writeDoubleLE=function(e,t,r){return Mr(this,e,t,!0,r)};u.prototype.writeDoubleBE=function(e,t,r){return Mr(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:Rt(new u(e,a).toString()),f=o.length;for(s=0;s<r-t;++s)this[s+t]=o[s%f]}return this};li=/[^+\/0-9A-Za-z-_]/g});var l=Jt(()=>{"use strict";qr()});var Gu={};Kt(Gu,{DynamicSnippetsGenerator:()=>mr});module.exports=ya(Gu);c();l();c();l();c();l();function S(n){throw new Error("Unexpected value: "+JSON.stringify(n))}c();l();c();l();c();l();c();l();c();l();c();l();var vi=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,Wr=vi;var wi=typeof self=="object"&&self&&self.Object===Object&&self,bi=Wr||wi||Function("return this")(),zr=bi;var Ti=zr.Symbol,se=Ti;c();l();var Zr=Object.prototype,_i=Zr.hasOwnProperty,ki=Zr.toString,it=se?se.toStringTag:void 0;function Ri(n){var e=_i.call(n,it),t=n[it];try{n[it]=void 0;var r=!0}catch(i){}var a=ki.call(n);return r&&(e?n[it]=t:delete n[it]),a}var Gr=Ri;c();l();var Ni=Object.prototype,Ii=Ni.toString;function Ai(n){return Ii.call(n)}var Yr=Ai;var Si="[object Null]",Ei="[object Undefined]",Hr=se?se.toStringTag:void 0;function Ci(n){return n==null?n===void 0?Ei:Si:Hr&&Hr in Object(n)?Gr(n):Yr(n)}var Jr=Ci;c();l();function Pi(n){return n!=null&&typeof n=="object"}var Kr=Pi;var Li="[object Symbol]";function Fi(n){return typeof n=="symbol"||Kr(n)&&Jr(n)==Li}var Qr=Fi;c();l();c();l();function Oi(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 Xr=Oi;c();l();var Bi=Array.isArray,en=Bi;var Ui=1/0,tn=se?se.prototype:void 0,rn=tn?tn.toString:void 0;function nn(n){if(typeof n=="string")return n;if(en(n))return Xr(n,nn)+"";if(Qr(n))return rn?rn.call(n):"";var e=n+"";return e=="0"&&1/n==-Ui?"-0":e}var an=nn;c();l();function ji(n){return n==null?"":an(n)}var me=ji;c();l();c();l();c();l();c();l();c();l();c();l();function Mi(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 sn=Mi;function Di(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:sn(n,e,t)}var on=Di;c();l();var $i="\\ud800-\\udfff",Vi="\\u0300-\\u036f",qi="\\ufe20-\\ufe2f",Wi="\\u20d0-\\u20ff",zi=Vi+qi+Wi,Zi="\\ufe0e\\ufe0f",Gi="\\u200d",Yi=RegExp("["+Gi+$i+zi+Zi+"]");function Hi(n){return Yi.test(n)}var Et=Hi;c();l();c();l();function Ji(n){return n.split("")}var un=Ji;c();l();var cn="\\ud800-\\udfff",Ki="\\u0300-\\u036f",Qi="\\ufe20-\\ufe2f",Xi="\\u20d0-\\u20ff",es=Ki+Qi+Xi,ts="\\ufe0e\\ufe0f",rs="["+cn+"]",rr="["+es+"]",nr="\\ud83c[\\udffb-\\udfff]",ns="(?:"+rr+"|"+nr+")",ln="[^"+cn+"]",fn="(?:\\ud83c[\\udde6-\\uddff]){2}",pn="[\\ud800-\\udbff][\\udc00-\\udfff]",as="\\u200d",dn=ns+"?",mn="["+ts+"]?",is="(?:"+as+"(?:"+[ln,fn,pn].join("|")+")"+mn+dn+")*",ss=mn+dn+is,os="(?:"+[ln+rr+"?",rr,fn,pn,rs].join("|")+")",us=RegExp(nr+"(?="+nr+")|"+os+ss,"g");function cs(n){return n.match(us)||[]}var hn=cs;function ls(n){return Et(n)?hn(n):un(n)}var yn=ls;function fs(n){return function(e){e=me(e);var t=Et(e)?yn(e):void 0,r=t?t[0]:e.charAt(0),a=t?on(t,1).join(""):e.slice(1);return r[n]()+a}}var gn=fs;var ps=gn("toUpperCase"),xn=ps;function ds(n){return xn(me(n).toLowerCase())}var vn=ds;c();l();c();l();function ms(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 wn=ms;c();l();c();l();c();l();function hs(n){return function(e){return n==null?void 0:n[e]}}var bn=hs;var ys={\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"},gs=bn(ys),Tn=gs;var xs=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vs="\\u0300-\\u036f",ws="\\ufe20-\\ufe2f",bs="\\u20d0-\\u20ff",Ts=vs+ws+bs,_s="["+Ts+"]",ks=RegExp(_s,"g");function Rs(n){return n=me(n),n&&n.replace(xs,Tn).replace(ks,"")}var _n=Rs;c();l();c();l();var Ns=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Is(n){return n.match(Ns)||[]}var kn=Is;c();l();var As=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Ss(n){return As.test(n)}var Rn=Ss;c();l();var En="\\ud800-\\udfff",Es="\\u0300-\\u036f",Cs="\\ufe20-\\ufe2f",Ps="\\u20d0-\\u20ff",Ls=Es+Cs+Ps,Cn="\\u2700-\\u27bf",Pn="a-z\\xdf-\\xf6\\xf8-\\xff",Fs="\\xac\\xb1\\xd7\\xf7",Os="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Bs="\\u2000-\\u206f",Us=" \\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",Ln="A-Z\\xc0-\\xd6\\xd8-\\xde",js="\\ufe0e\\ufe0f",Fn=Fs+Os+Bs+Us,On="['\u2019]",Nn="["+Fn+"]",Ms="["+Ls+"]",Bn="\\d+",Ds="["+Cn+"]",Un="["+Pn+"]",jn="[^"+En+Fn+Bn+Cn+Pn+Ln+"]",$s="\\ud83c[\\udffb-\\udfff]",Vs="(?:"+Ms+"|"+$s+")",qs="[^"+En+"]",Mn="(?:\\ud83c[\\udde6-\\uddff]){2}",Dn="[\\ud800-\\udbff][\\udc00-\\udfff]",Je="["+Ln+"]",Ws="\\u200d",In="(?:"+Un+"|"+jn+")",zs="(?:"+Je+"|"+jn+")",An="(?:"+On+"(?:d|ll|m|re|s|t|ve))?",Sn="(?:"+On+"(?:D|LL|M|RE|S|T|VE))?",$n=Vs+"?",Vn="["+js+"]?",Zs="(?:"+Ws+"(?:"+[qs,Mn,Dn].join("|")+")"+Vn+$n+")*",Gs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ys="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Hs=Vn+$n+Zs,Js="(?:"+[Ds,Mn,Dn].join("|")+")"+Hs,Ks=RegExp([Je+"?"+Un+"+"+An+"(?="+[Nn,Je,"$"].join("|")+")",zs+"+"+Sn+"(?="+[Nn,Je+In,"$"].join("|")+")",Je+"?"+In+"+"+An,Je+"+"+Sn,Ys,Gs,Bn,Js].join("|"),"g");function Qs(n){return n.match(Ks)||[]}var qn=Qs;function Xs(n,e,t){return n=me(n),e=t?void 0:e,e===void 0?Rn(n)?qn(n):kn(n):n.match(e)||[]}var Wn=Xs;var eo="['\u2019]",to=RegExp(eo,"g");function ro(n){return function(e){return wn(Wn(_n(e).replace(to,"")),n,"")}}var zn=ro;var no=zn(function(n,e,t){return e=e.toLowerCase(),n+(t?vn(e):e)}),ar=no;c();l();function st(n){return Object.keys(n)}c();l();c();l();c();l();var Zn,Gn,ot=(Gn=(Zn=x.env.FERN_STACK_TRACK)==null?void 0:Zn.toLowerCase())!=null?Gn:"",ee=ot!==""&&ot!=="0"&&ot!=="false",ir=["single","multiline","box"].includes(ot)?ot:"single";ee&&(Error.stackTraceLimit=50);var ao=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),io=new Set(["stacktrace"]);function Pt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:i=!0,filterJs:s=!0,formatFilename:o=f=>f}={}){var d;if(!ee)return[];r=[...r,...ao],t=[...t,...io],a=[...a,"runInteractiveTask"];let f=!1;return((d=new Error().stack)!=null?d:"").split(`
2
+ `).map(h=>{let b=h.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(b&&b.length===5){let[,C,F,q,ve]=b;if(!C||!F||!q||!ve)return;if(f||a.some(wt=>C==null?void 0:C.includes(wt))){f=!0;return}switch(C){case"Object.<anonymous>":C="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":C=`${C.substring(C.indexOf(".")+1)}()=> { ... }`;break}return{fn:C,path:o(F),position:`${q}:${ve}`}}}).filter(h=>{var b,C;return h&&!r.some(F=>h.fn.includes(F))&&!(i&&((b=h.path)!=null&&b.startsWith("node:")))&&!(s&&((C=h.path)!=null&&C.endsWith(".js")))&&!t.some(F=>h.path.includes(F))}).slice(e,e+n)}var Ct=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:i=[],filterNode:s=!0,filterJs:o=!0,multiline:f=!1,formatFilename:d=h=>h}={}){g(this,"maxFrames");g(this,"skip");g(this,"filterPaths");g(this,"filterFunctions");g(this,"stopOn");g(this,"filterNode");g(this,"filterJs");g(this,"multiline");g(this,"formatFilename");g(this,"tracking",new WeakMap);this.maxFrames=e,this.skip=t,this.filterPaths=r,this.filterFunctions=a,this.stopOn=i,this.filterNode=s,this.filterJs=o,this.multiline=f,this.formatFilename=d}tag(e){let t=this.tracking.get(e)||new Set;Pt({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>t.add(r)),this.tracking.set(e,t)}trace(e){if(!ee)return"";let t=this.tracking.get(e);return t?[...t].map(r=>`${this.multiline?`
3
+ `:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(e){let t=this.tracking.get(e);return t?[...t]:[]}free(e){this.tracking.delete(e)}clear(){this.tracking=new WeakMap}},oe;function Yn({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:i=!0,filterJs:s=!0,multiline:o=!1,formatFilename:f=d=>d}={}){ee&&(oe!=null||(oe=new Ct({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:i,filterJs:s,multiline:o,formatFilename:f})))}function Hn(n){oe==null||oe.tag(n)}function sr(n){var e;return(e=oe==null?void 0:oe.frames(n))!=null?e:[]}var _e=class{constructor(){Hn(this)}};c();l();var Lt=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}},ut=class extends Lt{async format(e){return e}formatSync(e){return e}};c();l();c();l();c();l();var J=class extends _e{constructor(t){super();g(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 so=4;Yn({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var ct=class{constructor(){g(this,"lineBuffer",[]);g(this,"indentLevel",0);g(this,"hasWrittenAnything",!1);g(this,"lastCharacterIsSemicolon",!1);g(this,"lastCharacterIsNewline",!1);g(this,"nodeStackFrames",[])}get buffer(){return ee&&this.nodeStackFrames.length>0&&this.writeInternal(`
4
+ `),this.lineBuffer.join(`
5
+ `)+(this.lastCharacterIsNewline?`
6
+ `:"")}write(...e){for(let t of e)if(t!=null)if(typeof t=="string"){let r=t.length>0&&t.endsWith(`
7
+ `),a=r?t.substring(0,t.length-1):t,i=this.getIndentString(),s=a.replaceAll(`
3
8
  `,`
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(`
9
+ ${i}`);this.isAtStartOfLine()&&(s=i+s),r&&(s+=`
10
+ `),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){ee&&this.nodeStackFrames.push(...sr(e)),e.write(this),ee&&ir!=="single"&&this.writeInternal(`
11
+ `)}writeNodeOrString(e){if(typeof e=="string"){this.write(e);return}this.writeNode(e)}writeNodeStatement(e){this.writeNode(e),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(e){new J(e).write(this),e.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(e,t){new J(e).write(this),this.write(" (",t,")"),this.pushScope()}controlFlowWithoutStatement(e){new J(e).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(e,t){this.dedent(),this.write("} "),new J(e).write(this),this.write(" (",t,")"),this.pushScope()}alternativeControlFlow(e){this.dedent(),this.write("} "),new J(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.length===0?[""]:e),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
12
  `)}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};
13
+ `)}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)return;let t=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=e.endsWith(`
14
+ `),this.lastCharacterIsSemicolon=e.endsWith(";");let r=e.split(`
15
+ `),a=ee&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;t&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),a&&this.appendTrackingComment()}set lastLine(e){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=e:this.lineBuffer.push(e)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(e){return!1}formatStack(e,t=""){return e.map(r=>`${t?`(${t}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(e){return e.filter(t=>!t.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let e=[...this.formatStack(this.filterStack(Pt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,ir){case"single":return this.singleLineTrackingComment(e);case"multiline":return this.multiLineTrackingComment(e);case"box":return this.boxTrackingComment(e)}}singleLineTrackingComment(e){this.lastLine=`${this.lastLine} // ${e.join(" ")}`}multiLineTrackingComment(e){this.lineBuffer.push(...e.map(t=>` // ${t}`))}boxTrackingComment(e){this.lineBuffer.push("/*",...e.map(t=>` ${t}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return so}};c();l();function or(n){return(n==null?void 0:n.name)!=null&&(n==null?void 0:n.assignment)!=null}c();l();c();l();c();l();var lt=class{constructor(){g(this,"reporter");g(this,"snippet");g(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 ft=class{constructor(e){g(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 lt;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 lt;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 pt=class{constructor(){g(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let 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 E={Critical:"CRITICAL",Warning:"WARNING"},dt=class n{constructor(){g(this,"errors");g(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 mt=class{constructor({ir:e,config:t,options:r={}}){g(this,"config");g(this,"options");g(this,"errors");g(this,"_ir");g(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new dt,this.httpEndpointReferenceParser=new pt}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:E.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:E.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:E.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:E.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:E.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:E.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:E.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:E.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof i!="string"){this.errors.add({severity:E.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:E.Critical,message:`No type found for discriminant value "${i}"`});return}let d=r,{[a]:o}=d,f=wr(d,[vr(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:S(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:S(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:E.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:E.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:E.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(st(r.urls));for(let i of st(e))a.has(i)&&a.delete(i);return a.size>0?(this.errors.add({severity:E.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${st(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:E.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:E.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:E.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:S(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:S(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:S(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 ke;(function(n){n.Concise="concise",n.Full="full"})(ke||(ke={}));c();l();var z={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};c();l();c();l();c();l();c();l();var Re=class extends ct{constructor({packageName:t,customConfig:r,formatter:a}){super();g(this,"packageName");g(this,"customConfig");g(this,"formatter");g(this,"imports",new Set);this.packageName=t,this.customConfig=r,this.formatter=a!=null?a:new ut}addImport(t){this.imports.add(t)}getImports(){return new Set(this.imports)}};var ht=class extends Re{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}
16
+ ${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}
17
+ ${e}`)}return e}getContent(){let e=`package ${this.packageName};
11
18
 
12
- `,e=this.stringifyImports();return e.length>0?`${t}${e}
19
+ `,t=this.stringifyImports();return t.length>0?`${e}${t}
13
20
 
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});
21
+ ${this.buffer}`:e+this.buffer}stringifyImports(){return Array.from(this.imports).filter(e=>e!==this.packageName).map(e=>`import ${e};`).sort().join(`
22
+ `)}};c();l();c();l();var P={};Kt(P,{BRAND:()=>Lo,DIRTY:()=>Ne,EMPTY_PATH:()=>lo,INVALID:()=>k,NEVER:()=>gu,OK:()=>j,ParseStatus:()=>U,Schema:()=>I,ZodAny:()=>ge,ZodArray:()=>fe,ZodBigInt:()=>Ae,ZodBoolean:()=>Se,ZodBranded:()=>gt,ZodCatch:()=>De,ZodDate:()=>Ee,ZodDefault:()=>Me,ZodDiscriminatedUnion:()=>Bt,ZodEffects:()=>Y,ZodEnum:()=>Ue,ZodError:()=>D,ZodFirstPartyTypeKind:()=>R,ZodFunction:()=>jt,ZodIntersection:()=>Fe,ZodIssueCode:()=>y,ZodLazy:()=>Oe,ZodLiteral:()=>Be,ZodMap:()=>rt,ZodNaN:()=>at,ZodNativeEnum:()=>je,ZodNever:()=>K,ZodNull:()=>Pe,ZodNullable:()=>ne,ZodNumber:()=>Ie,ZodObject:()=>$,ZodOptional:()=>Z,ZodParsedType:()=>w,ZodPipeline:()=>xt,ZodPromise:()=>xe,ZodReadonly:()=>$e,ZodRecord:()=>Ut,ZodSchema:()=>I,ZodSet:()=>nt,ZodString:()=>ye,ZodSymbol:()=>et,ZodTransformer:()=>Y,ZodTuple:()=>re,ZodType:()=>I,ZodUndefined:()=>Ce,ZodUnion:()=>Le,ZodUnknown:()=>le,ZodVoid:()=>tt,addIssueToContext:()=>v,any:()=>Vo,array:()=>Zo,bigint:()=>Uo,boolean:()=>sa,coerce:()=>yu,custom:()=>na,date:()=>jo,datetimeRegex:()=>ta,defaultErrorMap:()=>ue,discriminatedUnion:()=>Jo,effect:()=>uu,enum:()=>iu,function:()=>ru,getErrorMap:()=>Ke,getParsedType:()=>te,instanceof:()=>Oo,intersection:()=>Ko,isAborted:()=>Ft,isAsync:()=>Qe,isDirty:()=>Ot,isValid:()=>he,late:()=>Fo,lazy:()=>nu,literal:()=>au,makeIssue:()=>yt,map:()=>eu,nan:()=>Bo,nativeEnum:()=>su,never:()=>Wo,null:()=>$o,nullable:()=>lu,number:()=>ia,object:()=>Go,objectUtil:()=>ur,oboolean:()=>hu,onumber:()=>mu,optional:()=>cu,ostring:()=>du,pipeline:()=>pu,preprocess:()=>fu,promise:()=>ou,quotelessJson:()=>oo,record:()=>Xo,set:()=>tu,setErrorMap:()=>co,strictObject:()=>Yo,string:()=>aa,symbol:()=>Mo,transformer:()=>uu,tuple:()=>Qo,undefined:()=>Do,union:()=>Ho,unknown:()=>qo,util:()=>A,void:()=>zo});c();l();c();l();c();l();c();l();c();l();var A;(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})(A||(A={}));var ur;(function(n){n.mergeShapes=(e,t)=>m(m({},e),t)})(ur||(ur={}));var w=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),te=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 y=A.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"]),oo=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,A.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 uo=(n,e)=>{let t;switch(n.code){case y.invalid_type:n.received===w.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case y.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,A.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:t=`Unrecognized key(s) in object: ${A.joinValues(n.keys,", ")}`;break;case y.invalid_union:t="Invalid input";break;case y.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${A.joinValues(n.options)}`;break;case y.invalid_enum_value:t=`Invalid enum value. Expected ${A.joinValues(n.options)}, received '${n.received}'`;break;case y.invalid_arguments:t="Invalid function arguments";break;case y.invalid_return_type:t="Invalid function return type";break;case y.invalid_date:t="Invalid date";break;case y.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}"`:A.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case y.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 y.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 y.custom:t="Invalid input";break;case y.invalid_intersection_types:t="Intersection results could not be merged";break;case y.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case y.not_finite:t="Number must be finite";break;default:t=e.defaultError,A.assertNever(n)}return{message:t}},ue=uo;var Jn=ue;function co(n){Jn=n}function Ke(){return Jn}c();l();var yt=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})},lo=[];function v(n,e){let t=Ke(),r=yt({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===ue?void 0:ue].filter(a=>!!a)});n.common.issues.push(r)}var U=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"}),Ne=n=>({status:"dirty",value:n}),j=n=>({status:"valid",value:n}),Ft=n=>n.status==="aborted",Ot=n=>n.status==="dirty",he=n=>n.status==="valid",Qe=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 G=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}},Kn=(n,e)=>{if(he(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,h;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:(h=f!=null?f:t)!=null?h:o.defaultError}},description:a}}var I=class{get description(){return this._def.description}_getType(e){return te(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:te(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new U,ctx:{common:e.parent.common,data:e.data,parsedType:te(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Qe(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:te(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Kn(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:te(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:t});return he(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=>he(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:te(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(Qe(a)?a:Promise.resolve(a));return Kn(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:y.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 Y({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 ne.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fe.create(this)}promise(){return xe.create(this,this._def)}or(e){return Le.create([this,e],this._def)}and(e){return Fe.create(this,e,this._def)}transform(e){return new Y(_(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 Me(_(m({},N(this._def)),{innerType:this,defaultValue:t,typeName:R.ZodDefault}))}brand(){return new gt(m({typeName:R.ZodBranded,type:this},N(this._def)))}catch(e){let t=typeof e=="function"?e:()=>e;return new De(_(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 xt.create(this,e)}readonly(){return $e.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},fo=/^c[^\s-]{8,}$/i,po=/^[0-9a-z]+$/,mo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ho=/^[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,yo=/^[a-z0-9_-]{21}$/i,go=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,xo=/^[-+]?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)?)??$/,vo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",cr,bo=/^(?:(?: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])$/,To=/^(?:(?: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])$/,_o=/^(([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]))$/,ko=/^(([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])$/,Ro=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,No=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Xn="((\\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])))",Io=new RegExp(`^${Xn}$`);function ea(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 Ao(n){return new RegExp(`^${ea(n)}$`)}function ta(n){let e=`${Xn}T${ea(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 So(n,e){return!!((e==="v4"||!e)&&bo.test(n)||(e==="v6"||!e)&&_o.test(n))}function Eo(n,e){if(!go.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 Co(n,e){return!!((e==="v4"||!e)&&To.test(n)||(e==="v6"||!e)&&ko.test(n))}var ye=class n extends I{_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:y.invalid_type,expected:w.string,received:i.parsedType}),k}let r=new U,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:y.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:y.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:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&v(a,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")vo.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"email",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")cr||(cr=new RegExp(wo,"u")),cr.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"emoji",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")ho.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"uuid",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")yo.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"nanoid",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")fo.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cuid",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")po.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cuid2",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")mo.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"ulid",code:y.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:y.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:y.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:y.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:y.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:y.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?ta(i).test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:y.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Io.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:y.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Ao(i).test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:y.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?xo.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"duration",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?So(e.data,i.version)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"ip",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Eo(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"jwt",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Co(e.data,i.version)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cidr",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Ro.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"base64",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?No.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"base64url",code:y.invalid_string,message:i.message}),r.dirty()):A.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),m({validation:t,code:y.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}};ye.create=n=>{var e;return new ye(m({checks:[],typeName:R.ZodString,coerce:(e=n==null?void 0:n.coerce)!=null?e:!1},N(n)))};function Po(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 Ie=class n extends I{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:y.invalid_type,expected:w.number,received:i.parsedType}),k}let r,a=new U;for(let i of this._def.checks)i.kind==="int"?A.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),v(r,{code:y.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:y.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:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?Po(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),v(r,{code:y.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:y.not_finite,message:i.message}),a.dirty()):A.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"&&A.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)}};Ie.create=n=>new Ie(m({checks:[],typeName:R.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1},N(n)));var Ae=class n extends I{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 U;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:y.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:y.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:y.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):A.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return v(t,{code:y.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}};Ae.create=n=>{var e;return new Ae(m({checks:[],typeName:R.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!=null?e:!1},N(n)))};var Se=class extends I{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==w.boolean){let r=this._getOrReturnCtx(e);return v(r,{code:y.invalid_type,expected:w.boolean,received:r.parsedType}),k}return j(e.data)}};Se.create=n=>new Se(m({typeName:R.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1},N(n)));var Ee=class n extends I{_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:y.invalid_type,expected:w.date,received:i.parsedType}),k}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return v(i,{code:y.invalid_date}),k}let r=new U,a;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:y.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:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):A.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}};Ee.create=n=>new Ee(m({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:R.ZodDate},N(n)));var et=class extends I{_parse(e){if(this._getType(e)!==w.symbol){let r=this._getOrReturnCtx(e);return v(r,{code:y.invalid_type,expected:w.symbol,received:r.parsedType}),k}return j(e.data)}};et.create=n=>new et(m({typeName:R.ZodSymbol},N(n)));var Ce=class extends I{_parse(e){if(this._getType(e)!==w.undefined){let r=this._getOrReturnCtx(e);return v(r,{code:y.invalid_type,expected:w.undefined,received:r.parsedType}),k}return j(e.data)}};Ce.create=n=>new Ce(m({typeName:R.ZodUndefined},N(n)));var Pe=class extends I{_parse(e){if(this._getType(e)!==w.null){let r=this._getOrReturnCtx(e);return v(r,{code:y.invalid_type,expected:w.null,received:r.parsedType}),k}return j(e.data)}};Pe.create=n=>new Pe(m({typeName:R.ZodNull},N(n)));var ge=class extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}};ge.create=n=>new ge(m({typeName:R.ZodAny},N(n)));var le=class extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}};le.create=n=>new le(m({typeName:R.ZodUnknown},N(n)));var K=class extends I{_parse(e){let t=this._getOrReturnCtx(e);return v(t,{code:y.invalid_type,expected:w.never,received:t.parsedType}),k}};K.create=n=>new K(m({typeName:R.ZodNever},N(n)));var tt=class extends I{_parse(e){if(this._getType(e)!==w.undefined){let r=this._getOrReturnCtx(e);return v(r,{code:y.invalid_type,expected:w.void,received:r.parsedType}),k}return j(e.data)}};tt.create=n=>new tt(m({typeName:R.ZodVoid},N(n)));var fe=class n extends I{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==w.array)return v(t,{code:y.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?y.too_big:y.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:y.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:y.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 G(t,s,t.path,o)))).then(s=>U.mergeArray(r,s));let i=[...t.data].map((s,o)=>a.type._parseSync(new G(t,s,t.path,o)));return U.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)}};fe.create=(n,e)=>new fe(m({type:n,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray},N(e)));function Xe(n){if(n instanceof $){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=Z.create(Xe(r))}return new $(_(m({},n._def),{shape:()=>e}))}else return n instanceof fe?new fe(_(m({},n._def),{type:Xe(n.element)})):n instanceof Z?Z.create(Xe(n.unwrap())):n instanceof ne?ne.create(Xe(n.unwrap())):n instanceof re?re.create(n.items.map(e=>Xe(e))):n}var $=class n extends I{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=A.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:y.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 K&&this._def.unknownKeys==="strip"))for(let d in a.data)s.includes(d)||o.push(d);let f=[];for(let d of s){let h=i[d],b=a.data[d];f.push({key:{status:"valid",value:d},value:h._parse(new G(a,b,a.path,d)),alwaysSet:d in a.data})}if(this._def.catchall instanceof K){let d=this._def.unknownKeys;if(d==="passthrough")for(let h of o)f.push({key:{status:"valid",value:h},value:{status:"valid",value:a.data[h]}});else if(d==="strict")o.length>0&&(v(a,{code:y.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 h of o){let b=a.data[h];f.push({key:{status:"valid",value:h},value:d._parse(new G(a,b,a.path,h)),alwaysSet:h in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let d=[];for(let h of f){let b=await h.key,C=await h.value;d.push({key:b,value:C,alwaysSet:h.alwaysSet})}return d}).then(d=>U.mergeObjectSync(r,d)):U.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 A.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 A.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n(_(m({},this._def),{shape:()=>t}))}deepPartial(){return Xe(this)}partial(e){let t={};for(let r of A.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 A.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 ra(A.objectKeys(this.shape))}};$.create=(n,e)=>new $(m({shape:()=>n,unknownKeys:"strip",catchall:K.create(),typeName:R.ZodObject},N(e)));$.strictCreate=(n,e)=>new $(m({shape:()=>n,unknownKeys:"strict",catchall:K.create(),typeName:R.ZodObject},N(e)));$.lazycreate=(n,e)=>new $(m({shape:n,unknownKeys:"strip",catchall:K.create(),typeName:R.ZodObject},N(e)));var Le=class extends I{_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:y.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}),h=f._parseSync({data:t.data,path:t.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,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:y.invalid_union,unionErrors:o}),k}}get options(){return this._def.options}};Le.create=(n,e)=>new Le(m({options:n,typeName:R.ZodUnion},N(e)));var ce=n=>n instanceof Oe?ce(n.schema):n instanceof Y?ce(n.innerType()):n instanceof Be?[n.value]:n instanceof Ue?n.options:n instanceof je?A.objectValues(n.enum):n instanceof Me?ce(n._def.innerType):n instanceof Ce?[void 0]:n instanceof Pe?[null]:n instanceof Z?[void 0,...ce(n.unwrap())]:n instanceof ne?[null,...ce(n.unwrap())]:n instanceof gt||n instanceof $e?ce(n.unwrap()):n instanceof De?ce(n._def.innerType):[],Bt=class n extends I{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.object)return v(t,{code:y.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:y.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=ce(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 lr(n,e){let t=te(n),r=te(e);if(n===e)return{valid:!0,data:n};if(t===w.object&&r===w.object){let a=A.objectKeys(e),i=A.objectKeys(n).filter(o=>a.indexOf(o)!==-1),s=m(m({},n),e);for(let o of i){let f=lr(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=lr(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 Fe=class extends I{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(i,s)=>{if(Ft(i)||Ft(s))return k;let o=lr(i.value,s.value);return o.valid?((Ot(i)||Ot(s))&&t.dirty(),{status:t.value,value:o.data}):(v(r,{code:y.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}))}};Fe.create=(n,e,t)=>new Fe(m({left:n,right:e,typeName:R.ZodIntersection},N(t)));var re=class n extends I{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.array)return v(r,{code:y.invalid_type,expected:w.array,received:r.parsedType}),k;if(r.data.length<this._def.items.length)return v(r,{code:y.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:y.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 G(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>U.mergeArray(t,s)):U.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new n(_(m({},this._def),{rest:e}))}};re.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new re(m({items:n,typeName:R.ZodTuple,rest:null},N(e)))};var Ut=class n extends I{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:y.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 G(r,o,r.path,o)),value:s._parse(new G(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?U.mergeObjectAsync(t,a):U.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof I?new n(m({keyType:e,valueType:t,typeName:R.ZodRecord},N(r))):new n(m({keyType:ye.create(),valueType:e,typeName:R.ZodRecord},N(t)))}},rt=class extends I{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:y.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 G(r,o,r.path,[d,"key"])),value:i._parse(new G(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,h=await f.value;if(d.status==="aborted"||h.status==="aborted")return k;(d.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(d.value,h.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let f of s){let d=f.key,h=f.value;if(d.status==="aborted"||h.status==="aborted")return k;(d.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(d.value,h.value)}return{status:t.value,value:o}}}};rt.create=(n,e,t)=>new rt(m({valueType:e,keyType:n,typeName:R.ZodMap},N(t)));var nt=class n extends I{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.set)return v(r,{code:y.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:y.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:y.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 h of f){if(h.status==="aborted")return k;h.status==="dirty"&&t.dirty(),d.add(h.value)}return{status:t.value,value:d}}let o=[...r.data.values()].map((f,d)=>i._parse(new G(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)}};nt.create=(n,e)=>new nt(m({valueType:n,minSize:null,maxSize:null,typeName:R.ZodSet},N(e)));var jt=class n extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.function)return v(t,{code:y.invalid_type,expected:w.function,received:t.parsedType}),k;function r(o,f){return yt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ke(),ue].filter(d=>!!d),issueData:{code:y.invalid_arguments,argumentsError:f}})}function a(o,f){return yt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ke(),ue].filter(d=>!!d),issueData:{code:y.invalid_return_type,returnTypeError:f}})}let i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof xe){let o=this;return j(async function(...f){let d=new D([]),h=await o._def.args.parseAsync(f,i).catch(F=>{throw d.addIssue(r(f,F)),d}),b=await Reflect.apply(s,this,h);return await o._def.returns._def.type.parseAsync(b,i).catch(F=>{throw d.addIssue(a(b,F)),d})})}else{let o=this;return j(function(...f){let d=o._def.args.safeParse(f,i);if(!d.success)throw new D([r(f,d.error)]);let h=Reflect.apply(s,this,d.data),b=o._def.returns.safeParse(h,i);if(!b.success)throw new D([a(h,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n(_(m({},this._def),{args:re.create(e).rest(le.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||re.create([]).rest(le.create()),returns:t||le.create(),typeName:R.ZodFunction},N(r)))}},Oe=class extends I{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})}};Oe.create=(n,e)=>new Oe(m({getter:n,typeName:R.ZodLazy},N(e)));var Be=class extends I{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:y.invalid_literal,expected:this._def.value}),k}return{status:"valid",value:e.data}}get value(){return this._def.value}};Be.create=(n,e)=>new Be(m({value:n,typeName:R.ZodLiteral},N(e)));function ra(n,e){return new Ue(m({values:n,typeName:R.ZodEnum},N(e)))}var Ue=class n extends I{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return v(t,{expected:A.joinValues(r),received:t.parsedType,code:y.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:y.invalid_enum_value,options:r}),k}return j(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))}};Ue.create=ra;var je=class extends I{_parse(e){let t=A.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==w.string&&r.parsedType!==w.number){let a=A.objectValues(t);return v(r,{expected:A.joinValues(a),received:r.parsedType,code:y.invalid_type}),k}if(this._cache||(this._cache=new Set(A.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=A.objectValues(t);return v(r,{received:r.data,code:y.invalid_enum_value,options:a}),k}return j(e.data)}get enum(){return this._def.values}};je.create=(n,e)=>new je(m({values:n,typeName:R.ZodNativeEnum},N(e)));var xe=class extends I{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:y.invalid_type,expected:w.promise,received:t.parsedType}),k;let r=t.parsedType===w.promise?t.data:Promise.resolve(t.data);return j(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};xe.create=(n,e)=>new xe(m({type:n,typeName:R.ZodPromise},N(e)));var Y=class extends I{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"?Ne(f.value):t.value==="dirty"?Ne(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"?Ne(o.value):t.value==="dirty"?Ne(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(!he(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=>he(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:t.value,value:o})):k);A.assertNever(a)}};Y.create=(n,e,t)=>new Y(m({schema:n,typeName:R.ZodEffects,effect:e},N(t)));Y.createWithPreprocess=(n,e,t)=>new Y(m({schema:e,effect:{type:"preprocess",transform:n},typeName:R.ZodEffects},N(t)));var Z=class extends I{_parse(e){return this._getType(e)===w.undefined?j(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 ne=class extends I{_parse(e){return this._getType(e)===w.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ne.create=(n,e)=>new ne(m({innerType:n,typeName:R.ZodNullable},N(e)));var Me=class extends I{_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}};Me.create=(n,e)=>new Me(m({innerType:n,typeName:R.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},N(e)));var De=class extends I{_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 Qe(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}};De.create=(n,e)=>new De(m({innerType:n,typeName:R.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},N(e)));var at=class extends I{_parse(e){if(this._getType(e)!==w.nan){let r=this._getOrReturnCtx(e);return v(r,{code:y.invalid_type,expected:w.nan,received:r.parsedType}),k}return{status:"valid",value:e.data}}};at.create=n=>new at(m({typeName:R.ZodNaN},N(n)));var Lo=Symbol("zod_brand"),gt=class extends I{_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}},xt=class n extends I{_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(),Ne(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})}},$e=class extends I{_parse(e){let t=this._def.innerType._parse(e),r=a=>(he(a)&&(a.value=Object.freeze(a.value)),a);return Qe(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};$e.create=(n,e)=>new $e(m({innerType:n,typeName:R.ZodReadonly},N(e)));function Qn(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function na(n,e={},t){return n?ge.create().superRefine((r,a)=>{var s,o;let i=n(r);if(i instanceof Promise)return i.then(f=>{var d,h;if(!f){let b=Qn(e,r),C=(h=(d=b.fatal)!=null?d:t)!=null?h:!0;a.addIssue(_(m({code:"custom"},b),{fatal:C}))}});if(!i){let f=Qn(e,r),d=(o=(s=f.fatal)!=null?s:t)!=null?o:!0;a.addIssue(_(m({code:"custom"},f),{fatal:d}))}}):ge.create()}var Fo={object:$.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 Oo=(n,e={message:`Input not instance of ${n.name}`})=>na(t=>t instanceof n,e),aa=ye.create,ia=Ie.create,Bo=at.create,Uo=Ae.create,sa=Se.create,jo=Ee.create,Mo=et.create,Do=Ce.create,$o=Pe.create,Vo=ge.create,qo=le.create,Wo=K.create,zo=tt.create,Zo=fe.create,Go=$.create,Yo=$.strictCreate,Ho=Le.create,Jo=Bt.create,Ko=Fe.create,Qo=re.create,Xo=Ut.create,eu=rt.create,tu=nt.create,ru=jt.create,nu=Oe.create,au=Be.create,iu=Ue.create,su=je.create,ou=xe.create,uu=Y.create,cu=Z.create,lu=ne.create,fu=Y.createWithPreprocess,pu=xt.create,du=()=>aa().optional(),mu=()=>ia().optional(),hu=()=>sa().optional(),yu={string:(n=>ye.create(_(m({},n),{coerce:!0}))),number:(n=>Ie.create(_(m({},n),{coerce:!0}))),boolean:(n=>Se.create(_(m({},n),{coerce:!0}))),bigint:(n=>Ae.create(_(m({},n),{coerce:!0}))),date:(n=>Ee.create(_(m({},n),{coerce:!0})))};var gu=k;c();l();var oa=P.strictObject({title:P.string(),content:P.string()});var fr=P.object({"base-api-exception-class-name":P.string().optional(),"base-exception-class-name":P.string().optional(),"client-class-name":P.string().optional(),"inline-file-properties":P.boolean().optional(),"inline-path-parameters":P.boolean().optional(),"package-layout":P.enum(["flat","nested"]).optional(),"package-prefix":P.string().optional(),"custom-dependencies":P.array(P.string()).optional(),"disable-required-property-builder-checks":P.boolean().optional(),"enable-forward-compatible-enums":P.boolean().optional(),"enable-inline-types":P.boolean().optional(),"enable-public-constructors":P.boolean().optional(),"generate-unknown-as-json-node":P.boolean().optional(),"json-include":P.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":P.boolean().optional(),"use-default-request-parameter-values":P.boolean().optional(),"enable-wire-tests":P.boolean().default(!1),"collapse-optional-nullable":P.boolean().optional(),"custom-readme-sections":P.array(oa).optional(),"custom-pager-name":P.string().optional(),"wrapped-aliases":P.boolean().optional()});var p={};Kt(p,{Access:()=>pr,AstNode:()=>O,Class:()=>Ve,ClassInstantiation:()=>qe,ClassReference:()=>L,CodeBlock:()=>We,Method:()=>ze,MethodInvocation:()=>Ze,Parameter:()=>Ge,Type:()=>vt,TypeLiteral:()=>V,Writer:()=>Re,classReference:()=>Uu,class_:()=>Bu,codeblock:()=>Ou,instantiateClass:()=>ju,invokeMethod:()=>Mu,method:()=>Du,parameter:()=>$u});c();l();c();l();c();l();var pr={Public:"public",Protected:"protected",Private:"private"};c();l();c();l();var O=class extends _e{async toStringAsync({packageName:e,customConfig:t,formatter:r}){let a=new ht({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toStringAsync()}toString({packageName:e,customConfig:t,formatter:r}){let a=new ht({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toString()}};var Ve=class extends O{constructor({name:t,access:r}){super();g(this,"name");g(this,"access");g(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 L=class extends O{constructor({name:t,packageName:r,fullyQualified:a}){super();g(this,"name");g(this,"packageName");g(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 vt=class extends O{constructor(t){super();g(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(xu);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.write("String");break;case"dateTime":t.writeNode(bu);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(ku);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(_u);break;case"void":t.write("Void");break;default:S(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(vu),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(wu),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Mt),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(Mt),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(Tu),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Dt=new L({name:"Arrays",packageName:"java.util"}),xu=new L({name:"BigInteger",packageName:"java.math"}),Xm=new L({name:"HashMap",packageName:"java.util"}),vu=new L({name:"List",packageName:"java.util"}),wu=new L({name:"Map",packageName:"java.util"}),bu=new L({name:"OffsetDateTime",packageName:"java.time"}),Mt=new L({name:"Optional",packageName:"java.util"}),Tu=new L({name:"Set",packageName:"java.util"}),_u=new L({name:"UUID",packageName:"java.util"}),ku=new L({name:"InputStream",packageName:"java.io"});var V=class n extends O{constructor(t){super();g(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 O?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:S(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:S(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(p.instantiateClass({classReference:Ru,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(Eu({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.some(a=>!a.value.isOptional()&&!this.isCollection(a.value))?t.sort((a,i)=>{let s=this.isNonRequired(a.value),o=this.isNonRequired(i.value);return s&&!o?1:!s&&o?-1:0}):t.sort((a,i)=>{let s=a.value.isOptional(),o=i.value.isOptional();return s&&!o?1:!s&&o?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=Su({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:Iu,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=Cu({entries:r.entries});if(a.length===0){t.write("new "),t.writeNode($t),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode($t),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:Mt,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"?dr:Nu,i=Pu({values:r.values});if(r.type==="list"&&r.isParameter&&i.length>0){t.writeNode(p.invokeMethod({on:Dt,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:Dt,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(dr),t.write("<Object>()");return}t.write("new "),t.writeNode(dr),t.write("<Object>("),t.writeNode(p.invokeMethod({on:Dt,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($t),t.write("<String, Object>()");return}t.writeLine("new "),t.writeNode($t),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:Au,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"}},dr=new L({name:"ArrayList",packageName:"java.util"}),Ru=new L({name:"BigInteger",packageName:"java.math"}),$t=new L({name:"HashMap",packageName:"java.util"}),Nu=new L({name:"HashSet",packageName:"java.util"}),ch=new L({name:"List",packageName:"java.util"}),lh=new L({name:"Map",packageName:"java.util"}),Iu=new L({name:"OffsetDateTime",packageName:"java.time"}),fh=new L({name:"Set",packageName:"java.util"}),Au=new L({name:"UUID",packageName:"java.util"});function Su({parameters:n}){return n.filter(e=>!V.isNop(e.value))}function Eu({parameters:n}){return n.filter(e=>!V.isNop(e.value))}function Cu({entries:n}){return n.filter(e=>!V.isNop(e.key)&&!V.isNop(e.value))}function Pu({values:n}){return n.filter(e=>!V.isNop(e))}function Vt({writer:n,arguments_:e}){let t=Fu(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof V&&!a.shouldWriteInLine())){Lu({writer:n,arguments_:t});return}n.write("("),t.forEach((a,i)=>{i>0&&n.write(", "),ua({writer:n,argument:a})}),n.write(")")}function Lu({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),ua({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function ua({writer:n,argument:e}){or(e)?n.writeNodeOrString(e.assignment):e.write(n)}function Fu(n){return n.filter(e=>!(e instanceof V&&V.isNop(e)))}var qe=class extends O{constructor({classReference:t,arguments_:r}){super();g(this,"classReference");g(this,"arguments_");this.classReference=t,this.arguments_=r}write(t){t.writeNode(this.classReference),Vt({writer:t,arguments_:this.arguments_})}};c();l();var We=class extends O{constructor(t){super();g(this,"arg");this.arg=t}write(t){return new J(this.arg).write(t)}};c();l();var ze=class extends O{constructor({name:t,access:r,parameters:a,body:i,static_:s,return_:o}){super();g(this,"name");g(this,"access");g(this,"parameters");g(this,"body");g(this,"return_");g(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 Ze=class extends O{constructor({method:t,arguments_:r,on:a}){super();g(this,"on");g(this,"method");g(this,"arguments_");this.on=a,this.method=t,this.arguments_=r}write(t){this.on.write(t),t.write("."),t.write(this.method),Vt({writer:t,arguments_:this.arguments_})}};c();l();var Ge=class extends O{constructor({name:t,type:r}){super();g(this,"name");g(this,"type");this.name=t,this.type=r}write(t){t.writeNode(this.type),t.write(` ${this.name}`)}};function Ou(n){return new We(n)}function Bu(n){return new Ve(n)}function Uu(n){return new L(n)}function ju(n){return new qe(n)}function Mu(n){return new Ze(n)}function Du(n){return new ze(n)}function $u(n){return new Ge(n)}c();l();var qt=class{constructor({context:e}){g(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:E.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,as:e.as});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,as:e.as});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,as:e.as});case"unknown":return this.convertUnknown({value:e.value});default:S(e.typeReference)}}convertList({list:e,value:t,as:r}){if(!Array.isArray(t))return this.context.errors.add({severity:E.Critical,message:`Expected array but got: ${typeof t}`}),p.TypeLiteral.nop();let a=e.type==="optional"||e.type==="nullable";return p.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((i,s)=>{this.context.errors.scope({index:s});try{if(a){let o=this.convert({typeReference:e.value,value:i,as:r});return this.wrapInOptionalIfNotNop(o,!0)}return this.convert({typeReference:e,value:i,as:r})}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:S(e)}}convertSet({set:e,value:t,as:r}){return Array.isArray(t)?p.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((a,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:e,value:a,as:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:E.Critical,message:`Expected array but got: ${typeof t}`}),p.TypeLiteral.nop())}convertMap({map:e,value:t,as:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:E.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(([a,i])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"mapKey"}),value:this.convert({typeReference:e.value,value:i,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:S(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:S(i)}}convertObject({object_:e,value:t,as:r}){var s;let a=this.context.associateByWireValue({parameters:e.properties,values:(s=this.context.getRecord(t))!=null?s:{}}),i=r==="request"?a.filter(o=>!this.context.isDirectLiteral(o.typeReference)):a;return p.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),parameters:i.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_: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:E.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:E.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}){var o;let r=[],a=[];for(let f of e.types)try{r.push(JSON.stringify(f));let d=this.convert({typeReference:f,value:t,inUndiscriminatedUnion:!0});return{valueTypeReference:f,typeInstantiation:d}}catch(d){a.push(`Type ${JSON.stringify(f)}: ${d instanceof Error?d.message:String(d)}`);continue}this.context.errors.add({severity:E.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value. Tried ${r.length} variants. Errors: ${a.join("; ")}`});let i=(o=e.declaration.name)!=null?o:"UnknownUnion",s=a.map((f,d)=>` ${d+1}. ${f}`).join(`
23
+ `);throw new Error(`Failed to match undiscriminated union "${i}" for ${typeof t} value.
24
+ Value: ${JSON.stringify(t)}
25
+ Attempted ${r.length} variants:
26
+ ${s}
27
+
28
+ This prevents invalid snippet code generation that would cause formatter errors.`)}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:S(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:S(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:S(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 Wt=class{constructor({context:e}){g(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:S(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:S(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:S(e)}}};c();l();var zt=class{constructor({context:e}){g(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:S(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 Vu=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch","getClass"]),Zt=class n extends mt{constructor({ir:t,config:r,options:a}){var i;super({ir:t,config:r,options:a});g(this,"ir");g(this,"customConfig");g(this,"dynamicTypeMapper");g(this,"dynamicTypeLiteralMapper");g(this,"filePropertyMapper");this.ir=t,this.customConfig=fr.parse((i=r.customConfig)!=null?i:{}),this.dynamicTypeMapper=new Wt({context:this}),this.dynamicTypeLiteralMapper=new qt({context:this}),this.filePropertyMapper=new zt({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:S(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:S(t)}}isDirectLiteral(t){return t.type==="literal"}sortTypeInstancesByRequiredFirst(t,r){let a=new Map;r.forEach((o,f)=>{a.set(o.name.wireValue,f)});let i=[],s=[];for(let o of t)this.isOptional(o.typeReference)?s.push(o):i.push(o);return i.sort((o,f)=>{var d,h;return((d=a.get(o.name.wireValue))!=null?d:0)-((h=a.get(f.name.wireValue))!=null?h:0)}),[...i,...s]}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 ar(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 Vu.has(t)}};c();l();var ca="com.example.usage",qu="Example",Wu="main",zu="args",la="client",Zu={type:"primitive",value:"STRING"},Gt=class{constructor({context:e,formatter:t}){g(this,"context");g(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:ca,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:ca,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 ke.Concise:return a;case ke.Full:return this.buildFullCodeBlock({body:a,options:r});default:S(i)}}constructClient({endpoint:e,snippet:t}){return p.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${la} = `),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:qu,access:p.Access.Public}),i=p.parameter({name:zu,type:p.Type.array(p.Type.string())});return a.addMethod(p.method({name:Wu,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:E.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(z.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 h=d.name.camelCase.unsafeName;r.push({name:h,value:p.TypeLiteral.string(`YOUR_${d.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(z.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let d=this.context.ir.pathParameters.filter(h=>h.variable==null);d.length>0&&r.push(...this.getPathParameters({namedParameters:d,snippet:t}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:e,environment:t}){var r;if(e!=null&&t!=null){this.context.errors.add({severity:E.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:E.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:E.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:Zu,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:S(e)}}addError(e){this.context.errors.add({severity:E.Critical,message:e})}addWarning(e){this.context.errors.add({severity:E.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(la),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:S(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var s;let r=[];this.context.errors.scope(z.PathParameters);let a=((s=e.pathParameters)!=null?s:[]).filter(o=>o.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(o=>o.value)),this.context.errors.unscope(),this.context.errors.scope(z.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope();let i=this.getRequestOptionsArg({request:e,snippet:t});return i!=null&&r.push(i),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":{if(e.value.type==="optional"){if(t==null)return p.TypeLiteral.reference(p.invokeMethod({on:p.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t,as:"request"});return r.toString({packageName:"com.example",customConfig:this.context.customConfig}).includes("Optional.empty()")?r:p.TypeLiteral.optional({value:r,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:S(e)}}getBytesBodyRequestArg({value:e}){return e==null?p.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:E.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 d;let r=[],{inlinePathParameters:a,inlineFileProperties:i}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(z.PathParameters);let s=[],o=((d=e.pathParameters)!=null?d:[]).filter(h=>h.variable==null);o.length>0&&s.push(...this.getPathParameters({namedParameters:o,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(z.RequestBody);let f=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...s.map(h=>h.value)),i||r.push(...f.fileFields.map(h=>h.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?s:[],filePropertyInfo:f})),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 q,ve,wt,hr,yr,gr;this.context.errors.scope(z.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:(q=e.queryParameters)!=null?q:[],values:(ve=t.queryParameters)!=null?ve:{}}).filter(H=>!this.context.isDirectLiteral(H.typeReference)),f=this.context.sortTypeInstancesByRequiredFirst(s,(wt=e.queryParameters)!=null?wt:[]).map(H=>({name:this.context.getMethodName(H.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:H.typeReference,value:H.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(z.Headers);let h=this.context.associateByWireValue({parameters:(hr=e.headers)!=null?hr:[],values:(yr=t.headers)!=null?yr:{}}).filter(H=>!this.context.isDirectLiteral(H.typeReference)),C=this.context.sortTypeInstancesByRequiredFirst(h,(gr=e.headers)!=null?gr:[]).map(H=>({name:this.context.getMethodName(H.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:H.typeReference,value:H.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(z.RequestBody);let F=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,...C,...f,...F]})}getRequestOptionsArg({request:e,snippet:t}){var f,d,h;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(z.Headers);let a=this.context.associateByWireValue({parameters:r,values:(h=t.headers)!=null?h:{}});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:S(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,as:"request"});default:S(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t}){var s;let a=this.context.associateByWireValue({parameters:e,values:(s=this.context.getRecord(t))!=null?s:{}}).filter(o=>!this.context.isDirectLiteral(o.typeReference));return this.context.sortTypeInstancesByRequiredFirst(a,e).map(o=>({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:o.typeReference,value:o.value,as:"request"})}))}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:ke.Full}getConfig(e){var t,r;return(r=(t=e.config)!=null?t:this.context.options.config)!=null?r:{}}};var mr=class extends ft{constructor({ir:t,config:r,options:a={}}){super(new Zt({ir:t,config:r,options:a}));g(this,"formatter")}async generate(t,r={}){return super.generate(t,r)}generateSync(t,r={}){return super.generateSync(t,r)}createSnippetGenerator(t){return new Gt({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
16
29
  /*! Bundled license information:
17
30
 
18
31
  @esbuild-plugins/node-globals-polyfill/Buffer.js:
@@ -34,3 +47,4 @@ lodash-es/lodash.js:
34
47
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
35
48
  *)
36
49
  */
50
+ //# sourceMappingURL=DynamicSnippetsGenerator.cjs.map