@fern-api/python-dynamic-snippets 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DynamicSnippetsGenerator.cjs +34 -0
- package/cjs/DynamicSnippetsGenerator.d.cts +18 -0
- package/cjs/DynamicSnippetsGeneratorContext-aXWxVpwD.d.cts +86 -0
- package/cjs/EndpointSnippetGenerator.cjs +23 -0
- package/cjs/EndpointSnippetGenerator.d.cts +52 -0
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +34 -0
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +5 -0
- package/cjs/context/DynamicTypeLiteralMapper.cjs +23 -0
- package/cjs/context/DynamicTypeLiteralMapper.d.cts +5 -0
- package/cjs/context/FilePropertyMapper.cjs +23 -0
- package/cjs/context/FilePropertyMapper.d.cts +5 -0
- package/cjs/index.cjs +46 -0
- package/cjs/index.d.cts +7 -0
- package/esm/DynamicSnippetsGenerator.d.ts +18 -0
- package/esm/DynamicSnippetsGenerator.js +1 -0
- package/esm/DynamicSnippetsGeneratorContext-aXWxVpwD.d.ts +86 -0
- package/esm/EndpointSnippetGenerator.d.ts +52 -0
- package/esm/EndpointSnippetGenerator.js +1 -0
- package/esm/chunk-BVS32MTY.js +1 -0
- package/esm/chunk-EX7EKKG4.js +1 -0
- package/esm/chunk-IM4ZUKD4.js +1 -0
- package/esm/chunk-LKHXBDU2.js +1 -0
- package/esm/chunk-NPWTXI2T.js +23 -0
- package/esm/chunk-OCJMJMBV.js +14 -0
- package/esm/chunk-ZMJ4WKFB.js +1 -0
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +5 -0
- package/esm/context/DynamicSnippetsGeneratorContext.js +1 -0
- package/esm/context/DynamicTypeLiteralMapper.d.ts +5 -0
- package/esm/context/DynamicTypeLiteralMapper.js +1 -0
- package/esm/context/FilePropertyMapper.d.ts +5 -0
- package/esm/context/FilePropertyMapper.js +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +13 -0
- package/package.json +27 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";var be=Object.defineProperty,Ur=Object.defineProperties,Br=Object.getOwnPropertyDescriptor,kr=Object.getOwnPropertyDescriptors,Mr=Object.getOwnPropertyNames,Ae=Object.getOwnPropertySymbols;var Ye=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable;var $e=(n,t,e)=>t in n?be(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ne=(n,t)=>{for(var e in t||(t={}))Ye.call(t,e)&&$e(n,e,t[e]);if(Ae)for(var e of Ae(t))it.call(t,e)&&$e(n,e,t[e]);return n},ot=(n,t)=>Ur(n,kr(t));var at=n=>typeof n=="symbol"?n:n+"",Pe=(n,t)=>{var e={};for(var r in n)Ye.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&Ae)for(var r of Ae(n))t.indexOf(r)<0&&it.call(n,r)&&(e[r]=n[r]);return e};var ze=(n,t)=>()=>(n&&(t=n(n=0)),t);var st=(n,t)=>{for(var e in t)be(n,e,{get:t[e],enumerable:!0})},_r=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Mr(t))!Ye.call(n,i)&&i!==e&&be(n,i,{get:()=>t[i],enumerable:!(r=Br(t,i))||r.enumerable});return n};var Or=n=>_r(be({},"__esModule",{value:!0}),n);var p=(n,t,e)=>$e(n,typeof t!="symbol"?t+"":t,e);function ft(){throw new Error("setTimeout has not been defined")}function pt(){throw new Error("clearTimeout has not been defined")}function lt(n){if(q===setTimeout)return setTimeout(n,0);if((q===ft||!q)&&setTimeout)return q=setTimeout,setTimeout(n,0);try{return q(n,0)}catch(t){try{return q.call(null,n,0)}catch(e){return q.call(this,n,0)}}}function Dr(n){if(j===clearTimeout)return clearTimeout(n);if((j===pt||!j)&&clearTimeout)return j=clearTimeout,clearTimeout(n);try{return j(n)}catch(t){try{return j.call(null,n)}catch(e){return j.call(this,n)}}}function Vr(){!re||!J||(re=!1,J.length?O=J.concat(O):Se=-1,O.length&&ct())}function ct(){if(!re){var n=lt(Vr);re=!0;for(var t=O.length;t;){for(J=O,O=[];++Se<t;)J&&J[Se].run();Se=-1,t=O.length}J=null,re=!1,Dr(n)}}function Wr(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];O.push(new dt(n,t)),O.length===1&&!re&<(ct)}function dt(n,t){this.fun=n,this.array=t}function K(){}function on(n){throw new Error("process.binding is not supported")}function an(){return"/"}function sn(n){throw new Error("process.chdir is not supported")}function un(){return 0}function pn(n){var t=fn.call(te)*.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 cn(){var n=new Date,t=n-ln;return t/1e3}var q,j,O,re,J,Se,qr,jr,$r,Yr,zr,Gr,Hr,Qr,Zr,Jr,Kr,Xr,en,tn,rn,nn,te,fn,ln,m,ut,u=ze(()=>{"use strict";q=ft,j=pt;typeof globalThis.setTimeout=="function"&&(q=setTimeout);typeof globalThis.clearTimeout=="function"&&(j=clearTimeout);O=[],re=!1,Se=-1;dt.prototype.run=function(){this.fun.apply(null,this.array)};qr="browser",jr="browser",$r=!0,Yr={},zr=[],Gr="",Hr={},Qr={},Zr={};Jr=K,Kr=K,Xr=K,en=K,tn=K,rn=K,nn=K;te=globalThis.performance||{},fn=te.now||te.mozNow||te.msNow||te.oNow||te.webkitNow||function(){return new Date().getTime()};ln=new Date;m={nextTick:Wr,title:qr,browser:$r,env:Yr,argv:zr,version:Gr,versions:Hr,on:Jr,addListener:Kr,once:Xr,off:en,removeListener:tn,removeAllListeners:rn,emit:nn,binding:on,cwd:an,chdir:sn,umask:un,hrtime:pn,platform:jr,release:Qr,config:Zr,uptime:cn},ut={};Object.keys(ut).forEach(n=>{let t=n.split("."),e=m;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=ut[n]:e=e[i]||(e[i]={})}})});function xt(){He=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)k[t]=n[t],C[n.charCodeAt(t)]=t;C[45]=62,C[95]=63}function mn(n){He||xt();var t,e,r,i,o,a,l=n.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[l-2]==="="?2:n[l-1]==="="?1:0,a=new dn(l*3/4-o),r=o>0?l-4:l;var d=0;for(t=0,e=0;t<r;t+=4,e+=3)i=C[n.charCodeAt(t)]<<18|C[n.charCodeAt(t+1)]<<12|C[n.charCodeAt(t+2)]<<6|C[n.charCodeAt(t+3)],a[d++]=i>>16&255,a[d++]=i>>8&255,a[d++]=i&255;return o===2?(i=C[n.charCodeAt(t)]<<2|C[n.charCodeAt(t+1)]>>4,a[d++]=i&255):o===1&&(i=C[n.charCodeAt(t)]<<10|C[n.charCodeAt(t+1)]<<4|C[n.charCodeAt(t+2)]>>2,a[d++]=i>>8&255,a[d++]=i&255),a}function hn(n){return k[n>>18&63]+k[n>>12&63]+k[n>>6&63]+k[n&63]}function yn(n,t,e){for(var r,i=[],o=t;o<e;o+=3)r=(n[o]<<16)+(n[o+1]<<8)+n[o+2],i.push(hn(r));return i.join("")}function mt(n){He||xt();for(var t,e=n.length,r=e%3,i="",o=[],a=16383,l=0,d=e-r;l<d;l+=a)o.push(yn(n,l,l+a>d?d:l+a));return r===1?(t=n[e-1],i+=k[t>>2],i+=k[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=k[t>>10],i+=k[t>>4&63],i+=k[t<<2&63],i+="="),o.push(i),o.join("")}function Ce(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function D(n,t){if(Ce()<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 Qe(this,n)}return gt(this,n,t,e)}function gt(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?wn(n,t,e,r):typeof t=="string"?gn(n,t,e):vn(n,t)}function wt(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 xn(n,t,e,r){return wt(t),t<=0?D(n,t):e!==void 0?typeof r=="string"?D(n,t).fill(e,r):D(n,t).fill(e):D(n,t)}function Qe(n,t){if(wt(t),n=D(n,t<0?0:Ze(t)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function gn(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=vt(t,e)|0;n=D(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Ge(n,t){var e=t.length<0?0:Ze(t.length)|0;n=D(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function wn(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=Ge(n,t),n}function vn(n,t){if(M(t)){var e=Ze(t.length)|0;return n=D(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"||Dn(t.length)?D(n,0):Ge(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ge(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Ze(n){if(n>=Ce())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ce().toString(16)+" bytes");return n|0}function M(n){return!!(n!=null&&n._isBuffer)}function vt(n,t){if(M(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 Fe(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Nt(n).length;default:if(r)return Fe(n).length;t=(""+t).toLowerCase(),r=!0}}function Rn(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 Fn(this,t,e);case"utf8":case"utf-8":return It(this,t,e);case"ascii":return Sn(this,t,e);case"latin1":case"binary":return Cn(this,t,e);case"base64":return Nn(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ln(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function X(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Rt(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=s.from(t,r)),M(t))return t.length===0?-1:ht(n,t,e,r,i);if(typeof t=="number")return t=t&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):ht(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function ht(n,t,e,r,i){var o=1,a=n.length,l=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;o=2,a/=2,l/=2,e/=2}function d(T,g){return o===1?T[g]:T.readUInt16BE(g*o)}var h;if(i){var y=-1;for(h=e;h<a;h++)if(d(n,h)===d(t,y===-1?0:h-y)){if(y===-1&&(y=h),h-y+1===l)return y*o}else y!==-1&&(h-=h-y),y=-1}else for(e+l>a&&(e=a-l),h=e;h>=0;h--){for(var x=!0,E=0;E<l;E++)if(d(n,h+E)!==d(t,E)){x=!1;break}if(x)return h}return-1}function Tn(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var l=parseInt(t.substr(a*2,2),16);if(isNaN(l))return a;n[e+a]=l}return a}function In(n,t,e,r){return Be(Fe(t,n.length-e),n,e,r)}function Tt(n,t,e,r){return Be(_n(t),n,e,r)}function En(n,t,e,r){return Tt(n,t,e,r)}function An(n,t,e,r){return Be(Nt(t),n,e,r)}function bn(n,t,e,r){return Be(On(t,n.length-e),n,e,r)}function Nn(n,t,e){return t===0&&e===n.length?mt(n):mt(n.slice(t,e))}function It(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],a=null,l=o>239?4:o>223?3:o>191?2:1;if(i+l<=e){var d,h,y,x;switch(l){case 1:o<128&&(a=o);break;case 2:d=n[i+1],(d&192)===128&&(x=(o&31)<<6|d&63,x>127&&(a=x));break;case 3:d=n[i+1],h=n[i+2],(d&192)===128&&(h&192)===128&&(x=(o&15)<<12|(d&63)<<6|h&63,x>2047&&(x<55296||x>57343)&&(a=x));break;case 4:d=n[i+1],h=n[i+2],y=n[i+3],(d&192)===128&&(h&192)===128&&(y&192)===128&&(x=(o&15)<<18|(d&63)<<12|(h&63)<<6|y&63,x>65535&&x<1114112&&(a=x))}}a===null?(a=65533,l=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=l}return Pn(r)}function Pn(n){var t=n.length;if(t<=yt)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=yt));return e}function Sn(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function Cn(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function Fn(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",o=t;o<e;++o)i+=Mn(n[o]);return i}function Ln(n,t,e){for(var r=n.slice(t,e),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}function A(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 S(n,t,e,r,i,o){if(!M(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function Le(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(n.length-e,2);i<o;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function Ue(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(n.length-e,4);i<o;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function Et(n,t,e,r,i,o){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function At(n,t,e,r,i){return i||Et(n,t,e,4,34028234663852886e22,-34028234663852886e22),St(n,t,e,r,23,4),e+4}function bt(n,t,e,r,i){return i||Et(n,t,e,8,17976931348623157e292,-17976931348623157e292),St(n,t,e,r,52,8),e+8}function Bn(n){if(n=kn(n).replace(Un,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function kn(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Mn(n){return n<16?"0"+n.toString(16):n.toString(16)}function Fe(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],a=0;a<r;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function _n(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function On(n,t){for(var e,r,i,o=[],a=0;a<n.length&&!((t-=2)<0);++a)e=n.charCodeAt(a),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function Nt(n){return mn(Bn(n))}function Be(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function Dn(n){return n!==n}function Vn(n){return n!=null&&(!!n._isBuffer||Pt(n)||Wn(n))}function Pt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Wn(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&Pt(n.slice(0,0))}function ke(n,t,e,r,i){var o,a,l=i*8-r-1,d=(1<<l)-1,h=d>>1,y=-7,x=e?i-1:0,E=e?-1:1,T=n[t+x];for(x+=E,o=T&(1<<-y)-1,T>>=-y,y+=l;y>0;o=o*256+n[t+x],x+=E,y-=8);for(a=o&(1<<-y)-1,o>>=-y,y+=r;y>0;a=a*256+n[t+x],x+=E,y-=8);if(o===0)o=1-h;else{if(o===d)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,r),o=o-h}return(T?-1:1)*a*Math.pow(2,o-r)}function St(n,t,e,r,i,o){var a,l,d,h=o*8-i-1,y=(1<<h)-1,x=y>>1,E=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=r?0:o-1,g=r?1:-1,I=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,a=y):(a=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+x>=1?t+=E/d:t+=E*Math.pow(2,1-x),t*d>=2&&(a++,d/=2),a+x>=y?(l=0,a=y):a+x>=1?(l=(t*d-1)*Math.pow(2,i),a=a+x):(l=t*Math.pow(2,x-1)*Math.pow(2,i),a=0));i>=8;n[e+T]=l&255,T+=g,l/=256,i-=8);for(a=a<<i|l,h+=i;h>0;n[e+T]=a&255,T+=g,a/=256,h-=8);n[e+T-g]|=I*128}var k,C,dn,He,yt,Un,Ct=ze(()=>{"use strict";u();f();k=[],C=[],dn=typeof Uint8Array!="undefined"?Uint8Array:Array,He=!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 gt(null,n,t,e)};s.kMaxLength=Ce();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 xn(null,n,t,e)};s.allocUnsafe=function(n){return Qe(null,n)};s.allocUnsafeSlow=function(n){return Qe(null,n)};s.isBuffer=Vn;s.compare=function(t,e){if(!M(t)||!M(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,a=Math.min(r,i);o<a;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<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 i=s.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var a=t[r];if(!M(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};s.byteLength=vt;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)X(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)X(this,e,e+3),X(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)X(this,e,e+7),X(this,e+1,e+6),X(this,e+2,e+5),X(this,e+3,e+4);return this};s.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?It(this,0,t):Rn.apply(this,arguments)};s.prototype.equals=function(t){if(!M(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,i,o){if(!M(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var a=o-i,l=r-e,d=Math.min(a,l),h=this.slice(i,o),y=t.slice(e,r),x=0;x<d;++x)if(h[x]!==y[x]){a=h[x],l=y[x];break}return a<l?-1:l<a?1:0};s.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};s.prototype.indexOf=function(t,e,r){return Rt(this,t,e,r,!0)};s.prototype.lastIndexOf=function(t,e,r){return Rt(this,t,e,r,!1)};s.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Tn(this,t,e,r);case"utf8":case"utf-8":return In(this,t,e,r);case"ascii":return Tt(this,t,e,r);case"latin1":case"binary":return En(this,t,e,r);case"base64":return An(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bn(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};yt=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 i;if(s.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=s.prototype;else{var o=e-t;i=new s(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+t]}return i};s.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||A(t,e,this.length);for(var i=this[t],o=1,a=0;++a<e&&(o*=256);)i+=this[t+a]*o;return i};s.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||A(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};s.prototype.readUInt8=function(t,e){return e||A(t,1,this.length),this[t]};s.prototype.readUInt16LE=function(t,e){return e||A(t,2,this.length),this[t]|this[t+1]<<8};s.prototype.readUInt16BE=function(t,e){return e||A(t,2,this.length),this[t]<<8|this[t+1]};s.prototype.readUInt32LE=function(t,e){return e||A(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||A(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||A(t,e,this.length);for(var i=this[t],o=1,a=0;++a<e&&(o*=256);)i+=this[t+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};s.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||A(t,e,this.length);for(var i=e,o=1,a=this[t+--i];i>0&&(o*=256);)a+=this[t+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};s.prototype.readInt8=function(t,e){return e||A(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};s.prototype.readInt16LE=function(t,e){e||A(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||A(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||A(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||A(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||A(t,4,this.length),ke(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,e){return e||A(t,4,this.length),ke(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,e){return e||A(t,8,this.length),ke(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,e){return e||A(t,8,this.length),ke(this,t,!1,52,8)};s.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;S(this,t,e,r,o,0)}var a=1,l=0;for(this[e]=t&255;++l<r&&(a*=256);)this[e+l]=t/a&255;return e+r};s.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;S(this,t,e,r,o,0)}var a=r-1,l=1;for(this[e+a]=t&255;--a>=0&&(l*=256);)this[e+a]=t/l&255;return e+r};s.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||S(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||S(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Le(this,t,e,!0),e+2};s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Le(this,t,e,!1),e+2};s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||S(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):Ue(this,t,e,!0),e+4};s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||S(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):Ue(this,t,e,!1),e+4};s.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);S(this,t,e,r,o-1,-o)}var a=0,l=1,d=0;for(this[e]=t&255;++a<r&&(l*=256);)t<0&&d===0&&this[e+a-1]!==0&&(d=1),this[e+a]=(t/l>>0)-d&255;return e+r};s.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);S(this,t,e,r,o-1,-o)}var a=r-1,l=1,d=0;for(this[e+a]=t&255;--a>=0&&(l*=256);)t<0&&d===0&&this[e+a+1]!==0&&(d=1),this[e+a]=(t/l>>0)-d&255;return e+r};s.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||S(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||S(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Le(this,t,e,!0),e+2};s.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Le(this,t,e,!1),e+2};s.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||S(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):Ue(this,t,e,!0),e+4};s.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||S(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):Ue(this,t,e,!1),e+4};s.prototype.writeFloatLE=function(t,e,r){return At(this,t,e,!0,r)};s.prototype.writeFloatBE=function(t,e,r){return At(this,t,e,!1,r)};s.prototype.writeDoubleLE=function(t,e,r){return bt(this,t,e,!0,r)};s.prototype.writeDoubleBE=function(t,e,r){return bt(this,t,e,!1,r)};s.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r,a;if(this===t&&r<e&&e<i)for(a=o-1;a>=0;--a)t[a+e]=this[a+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};s.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var a;if(typeof t=="number")for(a=e;a<r;++a)this[a]=t;else{var l=M(t)?t:Fe(new s(t,i).toString()),d=l.length;for(a=0;a<r-e;++a)this[a+e]=l[a%d]}return this};Un=/[^+\/0-9A-Za-z-_]/g});var f=ze(()=>{"use strict";Ct()});var ta={};st(ta,{DynamicSnippetsGenerator:()=>nt});module.exports=Or(ta);u();f();u();f();u();f();function R(n){throw new Error("Unexpected value: "+JSON.stringify(n))}u();f();function ye(n){return Object.keys(n)}u();f();u();f();u();f();u();f();u();f();u();f();var qn=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,Ft=qn;var jn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Ft||jn||Function("return this")(),Lt=$n;var Yn=Lt.Symbol,V=Yn;u();f();var Ut=Object.prototype,zn=Ut.hasOwnProperty,Gn=Ut.toString,xe=V?V.toStringTag:void 0;function Hn(n){var t=zn.call(n,xe),e=n[xe];try{n[xe]=void 0;var r=!0}catch(o){}var i=Gn.call(n);return r&&(t?n[xe]=e:delete n[xe]),i}var Bt=Hn;u();f();var Qn=Object.prototype,Zn=Qn.toString;function Jn(n){return Zn.call(n)}var kt=Jn;var Kn="[object Null]",Xn="[object Undefined]",Mt=V?V.toStringTag:void 0;function ei(n){return n==null?n===void 0?Xn:Kn:Mt&&Mt in Object(n)?Bt(n):kt(n)}var _t=ei;u();f();function ti(n){return n!=null&&typeof n=="object"}var Ot=ti;var ri="[object Symbol]";function ni(n){return typeof n=="symbol"||Ot(n)&&_t(n)==ri}var Dt=ni;u();f();u();f();function ii(n,t){for(var e=-1,r=n==null?0:n.length,i=Array(r);++e<r;)i[e]=t(n[e],e,n);return i}var Vt=ii;u();f();var oi=Array.isArray,Wt=oi;var ai=1/0,qt=V?V.prototype:void 0,jt=qt?qt.toString:void 0;function $t(n){if(typeof n=="string")return n;if(Wt(n))return Vt(n,$t)+"";if(Dt(n))return jt?jt.call(n):"";var t=n+"";return t=="0"&&1/n==-ai?"-0":t}var Yt=$t;u();f();function si(n){return n==null?"":Yt(n)}var $=si;u();f();u();f();u();f();u();f();u();f();u();f();function ui(n,t,e){var r=-1,i=n.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=n[r+t];return o}var zt=ui;function fi(n,t,e){var r=n.length;return e=e===void 0?r:e,!t&&e>=r?n:zt(n,t,e)}var Gt=fi;u();f();var pi="\\ud800-\\udfff",li="\\u0300-\\u036f",ci="\\ufe20-\\ufe2f",di="\\u20d0-\\u20ff",mi=li+ci+di,hi="\\ufe0e\\ufe0f",yi="\\u200d",xi=RegExp("["+yi+pi+mi+hi+"]");function gi(n){return xi.test(n)}var Me=gi;u();f();u();f();function wi(n){return n.split("")}var Ht=wi;u();f();var Qt="\\ud800-\\udfff",vi="\\u0300-\\u036f",Ri="\\ufe20-\\ufe2f",Ti="\\u20d0-\\u20ff",Ii=vi+Ri+Ti,Ei="\\ufe0e\\ufe0f",Ai="["+Qt+"]",Je="["+Ii+"]",Ke="\\ud83c[\\udffb-\\udfff]",bi="(?:"+Je+"|"+Ke+")",Zt="[^"+Qt+"]",Jt="(?:\\ud83c[\\udde6-\\uddff]){2}",Kt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ni="\\u200d",Xt=bi+"?",er="["+Ei+"]?",Pi="(?:"+Ni+"(?:"+[Zt,Jt,Kt].join("|")+")"+er+Xt+")*",Si=er+Xt+Pi,Ci="(?:"+[Zt+Je+"?",Je,Jt,Kt,Ai].join("|")+")",Fi=RegExp(Ke+"(?="+Ke+")|"+Ci+Si,"g");function Li(n){return n.match(Fi)||[]}var tr=Li;function Ui(n){return Me(n)?tr(n):Ht(n)}var rr=Ui;function Bi(n){return function(t){t=$(t);var e=Me(t)?rr(t):void 0,r=e?e[0]:t.charAt(0),i=e?Gt(e,1).join(""):t.slice(1);return r[n]()+i}}var nr=Bi;var ki=nr("toUpperCase"),ir=ki;function Mi(n){return ir($(n).toLowerCase())}var or=Mi;u();f();u();f();function _i(n,t,e,r){var i=-1,o=n==null?0:n.length;for(r&&o&&(e=n[++i]);++i<o;)e=t(e,n[i],i,n);return e}var ar=_i;u();f();u();f();u();f();function Oi(n){return function(t){return n==null?void 0:n[t]}}var sr=Oi;var Di={\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"},Vi=sr(Di),ur=Vi;var Wi=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,qi="\\u0300-\\u036f",ji="\\ufe20-\\ufe2f",$i="\\u20d0-\\u20ff",Yi=qi+ji+$i,zi="["+Yi+"]",Gi=RegExp(zi,"g");function Hi(n){return n=$(n),n&&n.replace(Wi,ur).replace(Gi,"")}var fr=Hi;u();f();u();f();var Qi=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Zi(n){return n.match(Qi)||[]}var pr=Zi;u();f();var Ji=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Ki(n){return Ji.test(n)}var lr=Ki;u();f();var yr="\\ud800-\\udfff",Xi="\\u0300-\\u036f",eo="\\ufe20-\\ufe2f",to="\\u20d0-\\u20ff",ro=Xi+eo+to,xr="\\u2700-\\u27bf",gr="a-z\\xdf-\\xf6\\xf8-\\xff",no="\\xac\\xb1\\xd7\\xf7",io="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",oo="\\u2000-\\u206f",ao=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",wr="A-Z\\xc0-\\xd6\\xd8-\\xde",so="\\ufe0e\\ufe0f",vr=no+io+oo+ao,Rr="['\u2019]",cr="["+vr+"]",uo="["+ro+"]",Tr="\\d+",fo="["+xr+"]",Ir="["+gr+"]",Er="[^"+yr+vr+Tr+xr+gr+wr+"]",po="\\ud83c[\\udffb-\\udfff]",lo="(?:"+uo+"|"+po+")",co="[^"+yr+"]",Ar="(?:\\ud83c[\\udde6-\\uddff]){2}",br="[\\ud800-\\udbff][\\udc00-\\udfff]",ne="["+wr+"]",mo="\\u200d",dr="(?:"+Ir+"|"+Er+")",ho="(?:"+ne+"|"+Er+")",mr="(?:"+Rr+"(?:d|ll|m|re|s|t|ve))?",hr="(?:"+Rr+"(?:D|LL|M|RE|S|T|VE))?",Nr=lo+"?",Pr="["+so+"]?",yo="(?:"+mo+"(?:"+[co,Ar,br].join("|")+")"+Pr+Nr+")*",xo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",go="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",wo=Pr+Nr+yo,vo="(?:"+[fo,Ar,br].join("|")+")"+wo,Ro=RegExp([ne+"?"+Ir+"+"+mr+"(?="+[cr,ne,"$"].join("|")+")",ho+"+"+hr+"(?="+[cr,ne+dr,"$"].join("|")+")",ne+"?"+dr+"+"+mr,ne+"+"+hr,go,xo,Tr,vo].join("|"),"g");function To(n){return n.match(Ro)||[]}var Sr=To;function Io(n,t,e){return n=$(n),t=e?void 0:t,t===void 0?lr(n)?Sr(n):pr(n):n.match(t)||[]}var Cr=Io;var Eo="['\u2019]",Ao=RegExp(Eo,"g");function bo(n){return function(t){return ar(Cr(fr(t).replace(Ao,"")),n,"")}}var _e=bo;var No=_e(function(n,t,e){return t=t.toLowerCase(),n+(e?or(t):t)}),Xe=No;u();f();var Po=_e(function(n,t,e){return n+(e?"_":"")+t.toLowerCase()}),et=Po;u();f();u();f();var ee=class{};u();f();u();f();var U=class extends ee{constructor(e){super();p(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var So=4,ge=class{constructor(){p(this,"buffer","");p(this,"indentLevel",0);p(this,"hasWrittenAnything",!1);p(this,"lastCharacterIsSemicolon",!1);p(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
|
|
2
|
+
`),r=e?t.substring(0,t.length-1):t,i=this.getIndentString(),o=r.replaceAll(`
|
|
3
|
+
`,`
|
|
4
|
+
${i}`);this.isAtStartOfLine()&&(o=i+o),e&&(o+=`
|
|
5
|
+
`),this.writeInternal(o)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new U(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new U(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}controlFlowWithoutStatement(t){new U(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new U(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new U(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}openBlock(t,e="{",r,i="}"){let o=t.filter(a=>a!==void 0).join(" ");o?this.write(`${o} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),r(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
6
|
+
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
7
|
+
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let o=1;o<t.length;o++){this.write(e);let a=t[o];a!=null&&r(a)}}}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*So)}};u();f();u();f();u();f();var we=class{constructor(){p(this,"reporter");p(this,"snippet");p(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,i;return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>((i=(r=this.snippet)==null?void 0:r.length)!=null?i:0)}};var ve=class{constructor(t){p(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 i=new we;for(let o of r){let a=this.context.clone(),l=this.createSnippetGenerator(a);try{let d=await l.generateSnippet({endpoint:o,request:t,options:e});if(a.errors.empty())return{snippet:d,errors:void 0};i.update({context:a,snippet:d})}catch(d){i.err==null&&(i.err=d)}}return i.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 i=new we;for(let o of r){let a=this.context.clone(),l=this.createSnippetGenerator(a);try{let d=l.generateSnippetSync({endpoint:o,request:t,options:e});if(a.errors.empty())return{snippet:d,errors:void 0};i.update({context:a,snippet:d})}catch(d){i.err==null&&(i.err=d)}}return i.getResponseOrThrow({endpoint:t.endpoint})}};u();f();u();f();u();f();var Re=class{constructor(){p(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();f();var v={Critical:"CRITICAL",Warning:"WARNING"},Te=class n{constructor(){p(this,"errors");p(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push(ot(Ne({},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 Ie=class{constructor({ir:t,config:e,options:r={}}){p(this,"config");p(this,"options");p(this,"errors");p(this,"_ir");p(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=r,this.errors=new Te,this.httpEndpointReferenceParser=new Re}associateQueryParametersByWireValue({parameters:t,values:e}){let r=[];for(let[i,o]of Object.entries(e)){this.errors.scope(i);try{let a=t.find(d=>d.name.wireValue===i);if(a==null)throw this.newParameterNotRecognizedError(i);let l=this.isListTypeReference(a.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:a.name,typeReference:a.typeReference,value:l})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:r}){let i=[];for(let[o,a]of Object.entries(e)){this.errors.scope(o);try{let l=t.find(d=>d.name.wireValue===o);if(l==null){if(r)continue;this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(o).message});continue}i.push({name:l.name,typeReference:l.typeReference,value:a})}finally{this.errors.unscope()}}return i}getSingleFileValue({property:t,record:e}){let r=e[t.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:v.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:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let i=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}i.push(o)}return i}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:v.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:v.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let r=this.getRecord(e);if(r==null)return;let i=t.discriminant.wireValue,o=r[i];if(o==null){this.errors.add({severity:v.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof o!="string"){this.errors.add({severity:v.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let a=t.types[o];if(a==null){this.errors.add({severity:v.Critical,message:`No type found for discriminant value "${o}"`});return}let h=r,{[i]:l}=h,d=Pe(h,[at(i)]);return{singleDiscriminatedUnionType:a,discriminantValue:a.discriminantValue,value:d}}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 i;return this.includePathParametersInWrappedRequest({request:t,inlinePathParameters:e})||t.queryParameters!=null&&t.queryParameters.length>0||t.headers!=null&&t.headers.length>0?!0:t.body!=null?this.includeRequestBodyInWrappedRequest({body:t.body,inlineFileProperties:r}):!((i=t.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){var r,i;return e&&((i=(r=t.metadata)==null?void 0:r.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:R(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}case"multipleBaseUrls":{let r=e.environments.find(i=>i.id===t);return r==null?void 0:r.name}default:R(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:v.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:v.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:v.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(ye(r.urls));for(let o of ye(t))i.has(o)&&i.delete(o);return i.size>0?(this.errors.add({severity:v.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${ye(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:v.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:v.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:R(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:R(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:R(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();f();var B={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};u();f();u();f();var c={};st(c,{AccessAttribute:()=>ie,AstNode:()=>w,Class:()=>Y,ClassInstantiation:()=>ae,CodeBlock:()=>W,Comment:()=>se,Decorator:()=>ue,Field:()=>z,Lambda:()=>fe,LambdaParameter:()=>pe,Method:()=>H,MethodArgument:()=>ce,MethodInvocation:()=>de,Operator:()=>me,Parameter:()=>G,PythonFile:()=>he,Reference:()=>F,StarImport:()=>Q,Type:()=>De,TypeInstantiation:()=>Z,accessAttribute:()=>Lo,assign:()=>Uo,class_:()=>ko,codeBlock:()=>Wo,comment:()=>qo,decorator:()=>_o,field:()=>Vo,file:()=>Bo,instantiateClass:()=>Mo,invokeFunction:()=>zo,invokeMethod:()=>Go,lambda:()=>jo,lambdaParameter:()=>$o,method:()=>Yo,methodArgument:()=>Qo,operator:()=>Zo,parameter:()=>Ho,reference:()=>Oo,starImport:()=>Do});u();f();u();f();u();f();u();f();var Ee=class extends ge{constructor(){super(...arguments);p(this,"fullyQualifiedModulePathsToImportedNames",{})}setRefNameOverrides(e){this.fullyQualifiedModulePathsToImportedNames=e}unsetRefNameOverrides(){this.fullyQualifiedModulePathsToImportedNames={}}getRefNameOverride(e){var i;let r=this.fullyQualifiedModulePathsToImportedNames[e.getFullyQualifiedModulePath()];return r||{name:(i=e.alias)!=null?i:e.name,isAlias:!!e.alias}}toString(){return this.buffer}async toStringFormatted(e){return e.format(this.buffer)}};var w=class extends ee{constructor(){super(...arguments);p(this,"references",[])}addReference(e){this.references.push(e)}inheritReferences(e){e!==void 0&&e.references.forEach(r=>{this.references.includes(r)||this.addReference(r)})}getReferences(){return this.references}toString(){let e=new Ee;return this.write(e),e.toString()}async toStringFormatted(e){let r=new Ee;return this.write(r),r.toStringFormatted(e)}};var ie=class extends w{constructor({lhs:e,rhs:r}){super();p(this,"lhs");p(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=r,this.inheritReferences(r)}write(e){this.lhs.write(e),e.write("."),this.rhs.write(e)}};u();f();var Oe=class extends w{constructor({lhs:e,rhs:r}){super();p(this,"lhs");p(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=r,this.inheritReferences(r)}write(e){this.lhs.write(e),e.write(" = "),this.rhs.write(e)}};u();f();var oe=class extends w{constructor({reference:e,arguments_:r,multiline:i}){super();p(this,"reference");p(this,"arguments");p(this,"multiline");this.reference=e,this.arguments=r,this.multiline=i!=null?i:!1,this.inheritReferences(e),this.arguments.forEach(o=>{this.inheritReferences(o)})}write(e){if(this.reference.write(e),this.arguments.length===0){e.write("()");return}e.write("("),this.multiline&&(e.newLine(),e.indent()),this.arguments.forEach((r,i)=>{r.write(e),i<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};u();f();var Y=class extends w{constructor({docs:e,name:r,extends_:i,decorators:o}){super();p(this,"name");p(this,"extends_");p(this,"decorators");p(this,"fields",[]);p(this,"docs");p(this,"statements",[]);this.name=r,this.extends_=i!=null?i:[],this.decorators=o!=null?o:[],this.docs=e,this.extends_.forEach(a=>{this.inheritReferences(a)}),this.decorators.forEach(a=>{this.inheritReferences(a)})}write(e){this.decorators.forEach(r=>{r.write(e)}),e.write(`class ${this.name}`),this.extends_.length>0&&(e.write("("),this.extends_.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write(")")),e.write(":"),e.newLine(),e.indent(),this.docs!=null&&(e.write('"""'),e.write(this.docs),e.write('"""')),e.writeNewLineIfLastLineNot(),this.fields.forEach(r=>{r.write(e),e.writeNewLineIfLastLineNot()}),e.dedent(),e.indent(),this.statements.length?this.writeStatements({writer:e}):e.write("pass"),e.dedent()}add(e){this.statements.push(e),this.inheritReferences(e)}writeStatements({writer:e}){this.statements.forEach((r,i)=>{r.write(e),e.writeNewLineIfLastLineNot()})}addField(e){this.add(e)}};u();f();var ae=class extends oe{constructor(r){var i=r,{classReference:t}=i,e=Pe(i,["classReference"]);super(Ne({reference:t},e))}};u();f();var W=class extends w{constructor(e){super();p(this,"arg");this.arg=e}write(e){return new U(this.arg).write(e)}};u();f();var se=class extends w{constructor({docs:e}){super();p(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
|
|
9
|
+
`).forEach(r=>{e.writeLine(`# ${r}`)})}};u();f();var ue=class extends w{constructor({callable:e}){super();p(this,"callable");this.callable=e,this.inheritReferences(e)}write(e){e.write("@"),this.callable.write(e),e.newLine()}};u();f();var z=class extends w{constructor({name:e,type:r,initializer:i,docs:o}){super();p(this,"name");p(this,"type");p(this,"initializer");p(this,"docs");this.name=e,this.type=r,this.initializer=i,this.docs=o,this.inheritReferences(this.type),this.inheritReferences(this.initializer)}write(e){e.write(this.name),this.type!==void 0&&(e.write(": "),this.type.write(e)),this.initializer!==void 0&&(e.write(" = "),this.initializer.write(e)),this.docs!=null&&(e.newLine(),e.write('"""'),e.newLine(),e.write(this.docs),e.newLine(),e.write('"""'))}};u();f();var fe=class extends w{constructor({parameters:e,body:r}){super();p(this,"parameters");p(this,"body");this.parameters=e!=null?e:[],this.body=r,this.inheritReferences(r)}write(e){e.write("lambda"),this.parameters&&this.parameters.length&&(e.write(" "),this.parameters.forEach((r,i)=>{r.write(e),i<this.parameters.length-1&&e.write(", ")})),e.write(": "),this.body.write(e)}};u();f();u();f();var G=class extends w{constructor({name:e,type:r,initializer:i}){super();p(this,"name");p(this,"initializer");p(this,"type");this.name=e,this.type=r,this.initializer=i}write(e){e.write(this.name),this.type&&(e.write(": "),this.type.write(e)),this.initializer!==void 0&&(e.write(" = "),this.initializer.write(e))}};var pe=class extends G{constructor({name:t,initializer:e}){super({name:t,initializer:e,type:void 0})}};u();f();var le;(function(n){n[n.STATIC=0]="STATIC",n[n.INSTANCE=1]="INSTANCE",n[n.CLASS=2]="CLASS"})(le||(le={}));var H=class extends w{constructor({static_:e,name:r,parameters:i,return_:o,docstring:a,type:l,decorators:d}){super();p(this,"name");p(this,"return");p(this,"docstring");p(this,"type");p(this,"parameters");p(this,"decorators");p(this,"statements",[]);p(this,"static_");this.name=r,this.parameters=i!=null?i:[],this.return=o,this.docstring=a,this.type=l,this.decorators=d!=null?d:[],this.static_=e!=null?e:!1,this.parameters.forEach(h=>{this.inheritReferences(h)}),this.inheritReferences(this.return),this.decorators.forEach(h=>{this.inheritReferences(h)}),this.statements.forEach(h=>{this.inheritReferences(h)})}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){this.static_&&this.decorators.push(c.decorator({callable:c.codeBlock("staticmethod")})),this.decorators.forEach(r=>{r.write(e)}),this.type===le.CLASS?c.decorator({callable:new W("classmethod")}).write(e):this.type===le.STATIC&&c.decorator({callable:new W("staticmethod")}).write(e),e.write(`def ${this.name}(`),this.type===le.INSTANCE?(e.write("self"),this.parameters.length>0&&e.write(", ")):this.type===le.CLASS&&(e.write("cls"),this.parameters.length>0&&e.write(", ")),this.parameters.forEach((r,i)=>{r.write(e),i<this.parameters.length-1&&e.write(", ")}),e.write(")"),this.return&&(e.write(" -> "),this.return.write(e)),e.write(":"),e.newLine(),this.docstring&&(e.indent(),e.write('"""'),e.write(this.docstring),e.write('"""'),e.newLine(),e.dedent()),this.statements.length?(e.indent(),this.statements.forEach((r,i)=>{r.write(e),i<this.statements.length-1&&e.newLine()}),e.dedent()):(e.indent(),e.write("pass"),e.dedent()),e.newLine()}};u();f();var ce=class extends w{constructor({name:e,value:r}){super();p(this,"name");p(this,"value");this.name=e,this.value=r,this.inheritReferences(this.value)}write(e){this.name!==void 0&&(e.write(this.name),e.write("=")),this.value.write(e)}};u();f();var de=class extends w{constructor({on:e,method:r,arguments_:i,multiline:o}){super();p(this,"on");p(this,"method");p(this,"arguments");p(this,"multiline");this.on=e,this.method=r,this.arguments=i,this.multiline=o!=null?o:!1,this.inheritReferences(e),this.arguments.forEach(a=>{this.inheritReferences(a)})}write(e){if(this.on.write(e),e.write("."),e.write(this.method),this.arguments.length===0){e.write("()");return}e.write("("),this.multiline&&(e.newLine(),e.indent()),this.arguments.forEach((r,i)=>{r.write(e),i<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};u();f();u();f();var _={Or:"or",And:"and",Add:"add",Subtract:"subtract",Multiply:"multiple",Divide:"divide",Modulo:"modulo",LeftShift:"leftShift",RightShift:"rightShift"};var me=class extends w{constructor({operator:e,lhs:r,rhs:i}){super();p(this,"operator");p(this,"lhs");p(this,"rhs");this.operator=e,this.lhs=r,this.inheritReferences(r),this.rhs=i,this.inheritReferences(i)}getOperatorString(){switch(this.operator){case _.Or:return"or";case _.And:return"and";case _.Add:return"+";case _.Subtract:return"-";case _.Multiply:return"*";case _.Divide:return"/";case _.Modulo:return"%";case _.LeftShift:return"<<";case _.RightShift:return">>";default:R(this.operator)}}write(e){this.lhs.write(e),e.write(" "),e.write(this.getOperatorString()),e.write(" "),this.rhs.write(e)}};u();f();u();f();u();f();var F=class extends w{constructor({name:e,modulePath:r,genericTypes:i,alias:o,attribute:a}){super();p(this,"name");p(this,"modulePath");p(this,"genericTypes");p(this,"alias");p(this,"attribute");this.name=e,this.modulePath=r!=null?r:[],this.genericTypes=i!=null?i:[],this.alias=o,this.attribute=a!=null?a:[],this.references.push(this),this.genericTypes.forEach(l=>{this.inheritReferences(l)})}write(e){let r=e.getRefNameOverride(this);e.write(r.name),this.genericTypes.length>0&&(e.write("["),this.genericTypes.forEach((i,o)=>{o>0&&e.write(", "),i.write(e)}),e.write("]")),this.attribute.length>0&&(e.write("."),this.attribute.forEach((i,o)=>{o>0&&e.write("."),e.write(i)}))}getFullyQualifiedPath(){return this.modulePath.join(".")}getFullyQualifiedModulePath(){return`${this.getFullyQualifiedPath()}.${this.name}`}};var Q=class extends F{constructor({modulePath:e}){super({name:"*",modulePath:e});p(this,"docs")}write(e){throw new Error("Not intended to be written outside the context of a PythonFile.")}};u();f();function Fr(n){if(!n)return"Class";let t=n.replace(/[^a-zA-Z0-9\s_-]/g," ").replace(/[-_\s]+/g," ").trim();return!t||/^\d+$/.test(t)?"Class"+(t||""):(/^\d/.test(t)&&(t="Class"+t),t.split(/(?=[A-Z])|[-_\s]+/).filter(r=>r.length>0).map(r=>r.split(new RegExp("(?<=\\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\\d)")).filter(i=>i.length>0)).flat().map((r,i)=>i===0&&/^\d/.test(r)?"Class"+r.charAt(0).toUpperCase()+r.slice(1).toLowerCase():r.length>1&&r===r.toUpperCase()&&!/^\d+$/.test(r)?r:r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(""))}var he=class extends w{constructor({path:e,statements:r,isInitFile:i=!1,comments:o,imports:a}){super();p(this,"path");p(this,"isInitFile");p(this,"statements",[]);p(this,"comments");this.path=e,this.isInitFile=i,r==null||r.forEach(l=>this.addStatement(l)),this.comments=o!=null?o:[],a==null||a.forEach(l=>this.addReference(l))}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){let r=this.deduplicateReferences();this.updateWriterRefNameOverrides({writer:e,uniqueReferences:r}),this.writeComments(e),this.writeImports({writer:e,uniqueReferences:r}),this.statements.forEach((i,o)=>{i.write(e),e.newLine(),o<this.statements.length-1&&e.newLine()}),e.unsetRefNameOverrides()}updateWriterRefNameOverrides({writer:e,uniqueReferences:r}){let i=new Map(r),o={},a=this.getInitialUsedNames(),l=this.path.join("."),d=r.get(l);if(d){let{references:y}=d;y.forEach(x=>{let E=x.getFullyQualifiedModulePath(),T=x.name;o[E]={name:T,isAlias:!1},a.add(x.name)}),i.delete(l)}Array.from(i.values()).flatMap(({references:y})=>y).forEach(y=>{var N;if(y instanceof Q)return;let x=(N=y.alias)!=null?N:y.name,E=y.getFullyQualifiedModulePath(),T=x,g=y.modulePath.length-1,I=!!y.alias;for(;a.has(T);){I=!0;let b=y.modulePath[g];g<0||!b?T=`_${T}`:T=`${Fr(b)}${T}`,g--}a.add(T),o[E]={name:T,isAlias:I}}),e.setRefNameOverrides(o)}getInitialUsedNames(){let e=new Set;return this.statements.forEach(r=>{(r instanceof Y||r instanceof H||r instanceof z)&&e.add(r.name)}),e}deduplicateReferences(){let e=new Map;for(let r of this.references){let i=r.name,o=r.getFullyQualifiedPath();if(o==="")continue;let a=e.get(o);a?a.referenceNames.has(i)||(a.references.push(r),a.referenceNames.add(i)):e.set(o,{modulePath:r.modulePath,references:[r],referenceNames:new Set([i])})}return e}writeComments(e){this.comments.forEach(r=>{r.write(e)}),this.comments.length>0&&e.newLine()}getImportName({writer:e,reference:r}){let i=e.getRefNameOverride(r),o=r.name,a=i.isAlias?i.name:void 0;return`${o}${a?` as ${a}`:""}`}writeImports({writer:e,uniqueReferences:r}){if(r.size!==0){for(let[i,{modulePath:o,references:a}]of r){let l=o;if(!this.isDefinedInFile(l)){if(l[0]===this.path[0]){let d=0;for(;d<this.path.length&&d<l.length&&this.path[d]===l[d];)d++;let h=this.path.length-d;this.isInitFile&&h++;let y=h>0?".".repeat(h):".";y+=l.slice(d).join("."),e.write(`from ${y} import ${a.map(x=>this.getImportName({writer:e,reference:x})).join(", ")}`)}else e.write(`from ${i} import ${a.map(d=>this.getImportName({writer:e,reference:d})).join(", ")}`);e.newLine()}}e.newLine()}}isDefinedInFile(e){return e.length===this.path.length&&e.every((r,i)=>r===this.path[i])}};u();f();var De=class extends w{constructor(e){super();p(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"int":e.write("int");break;case"float":e.write("float");break;case"bool":e.write("bool");break;case"str":e.write("str");break;case"bytes":e.write("bytes");break;case"list":e.write("List["),this.internalType.value.write(e),e.write("]");break;case"set":e.write("Set["),this.internalType.value.write(e),e.write("]");break;case"tuple":e.write("Tuple["),this.internalType.values.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]");break;case"dict":e.write("Dict["),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write("]");break;case"none":e.write("None");break;case"uuid":e.write("UUID");break;case"optional":e.write("Optional["),this.internalType.value.write(e),e.write("]");break;case"union":e.write("Union["),this.internalType.values.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]");break;case"any":e.write("Any");break;case"reference":this.internalType.value.write(e);break;case"datetime":e.write("datetime");break;case"literal":typeof this.internalType.value=="string"?e.write(`Literal["${this.internalType.value}"]`):e.write(`Literal[${this.internalType.value}]`);break;default:R(this.internalType)}}static int(){return new this({type:"int"})}static float(){return new this({type:"float"})}static bool(){return new this({type:"bool"})}static str(){return new this({type:"str"})}static bytes(){return new this({type:"bytes"})}static list(e){let r=new this({type:"list",value:e});return r.addReference(c.reference({name:"List",modulePath:["typing"]})),r.inheritReferences(e),r}static set(e){let r=new this({type:"set",value:e});return r.addReference(c.reference({name:"Set",modulePath:["typing"]})),r.inheritReferences(e),r}static tuple(e){let r=new this({type:"tuple",values:e});return r.addReference(c.reference({name:"Tuple",modulePath:["typing"]})),e.forEach(i=>r.inheritReferences(i)),r}static dict(e,r){let i=new this({type:"dict",keyType:e,valueType:r});return i.addReference(c.reference({name:"Dict",modulePath:["typing"]})),i.inheritReferences(e),i.inheritReferences(r),i}static none(){return new this({type:"none"})}static uuid(){let e=new this({type:"uuid"});return e.addReference(c.reference({name:"UUID",modulePath:["uuid"]})),e}static optional(e){if(this.isAlreadyOptional(e))return e;let r=new this({type:"optional",value:e});return r.addReference(c.reference({name:"Optional",modulePath:["typing"]})),r.inheritReferences(e),r}static union(e){let r=new this({type:"union",values:e});return r.addReference(c.reference({name:"Union",modulePath:["typing"]})),e.forEach(i=>r.inheritReferences(i)),r}static any(){let e=new this({type:"any"});return e.addReference(c.reference({name:"Any",modulePath:["typing"]})),e}static datetime(){let e=new this({type:"datetime"});return e.addReference(c.reference({name:"datetime",modulePath:["datetime"]})),e}static reference(e){let r=new this({type:"reference",value:e});return r.addReference(e),r}static literal(e){let r=new this({type:"literal",value:e});return r.addReference(c.reference({name:"Literal",modulePath:["typing"]})),r}static isAlreadyOptional(e){return e.internalType.type==="optional"}};u();f();var Z=class n extends w{constructor(e){super();p(this,"internalType");this.internalType=e}static int(e){return new this({type:"int",value:e})}static float(e){return new this({type:"float",value:e})}static bool(e){return new this({type:"bool",value:e})}static str(e,r={multiline:!1,startOnNewLine:!1,endWithNewLine:!1}){return new this({type:"str",value:e,config:r})}static bytes(e){return new this({type:"bytes",value:e})}static list(e,r={endWithComma:!1}){let i=new this({type:"list",values:e,config:r});return e.forEach(o=>i.inheritReferences(o)),i}static set(e,r={endWithComma:!1}){let i=new this({type:"set",values:e,config:r});return e.forEach(o=>i.inheritReferences(o)),i}static tuple(e,r={endWithComma:!1}){let i=new this({type:"tuple",values:e,config:r});return e.forEach(o=>i.inheritReferences(o)),i}static typedDict(e,r={endWithComma:!1}){let i=new this({type:"typedDict",entries:e,config:r});return e.forEach(o=>i.inheritReferences(o.value)),i}static date(e){let r=new this({type:"date",value:e});return r.addReference(new F({name:"date",modulePath:["datetime"]})),r}static datetime(e){let r=new this({type:"datetime",value:e});return r.addReference(new F({name:"datetime",modulePath:["datetime"]})),r}static dict(e,r={endWithComma:!1}){let i=new this({type:"dict",entries:e,config:r});return e.forEach(o=>{i.inheritReferences(o.key),i.inheritReferences(o.value)}),i}static reference(e){let r=new this({type:"reference",value:e});return r.inheritReferences(e),r}static none(){return new this({type:"none"})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){let r=new this({type:"uuid",value:e});return r.addReference(new F({name:"UUID",modulePath:["uuid"]})),r}static nop(){return new this({type:"nop"})}static isNop(e){return e instanceof n&&e.internalType.type==="nop"}isTypedDict(){return this.internalType.type==="typedDict"}asTypedDictOrThrow(){if(this.isTypedDict())return this.internalType;throw new Error("Internal error; python.TypeInstantiation is not a TypedDict")}write(e){var r,i,o,a,l,d,h,y,x,E,T;switch(this.internalType.type){case"int":e.write(this.internalType.value.toString());break;case"float":e.write(this.internalType.value.toString());break;case"bool":this.internalType.value?e.write("True"):e.write("False");break;case"str":if((r=this.internalType.config)!=null&&r.multiline){let{startOnNewLine:g,endWithNewLine:I}=this.internalType.config;this.writeStringWithTripleQuotes({writer:e,value:this.internalType.value,startOnNewLine:g,endWithNewLine:I})}else e.write(`"${this.escapeString(this.internalType.value)}"`);break;case"date":e.write(`date.fromisoformat("${this.internalType.value}")`);break;case"datetime":e.write(`datetime.fromisoformat("${this.internalType.value}")`);break;case"bytes":e.write(`b"${this.internalType.value}"`);break;case"list":{let g=this.internalType,I=tt({values:g.values});if(I.length===0){e.write("[]");break}e.write("["),(i=g.config)!=null&&i.multiline&&(e.newLine(),e.indent()),I.forEach((N,b)=>{var P,L;b>0&&(e.write(","),(P=g.config)!=null&&P.multiline?e.newLine():e.write(" ")),N.write(e),b===I.length-1&&((L=g.config)!=null&&L.endWithComma)&&e.write(",")}),(o=g.config)!=null&&o.multiline&&(e.newLine(),e.dedent()),e.write("]");break}case"set":{let g=this.internalType,I=tt({values:g.values});if(I.length===0){e.write("{}");break}e.write("{"),(a=g.config)!=null&&a.multiline&&(e.newLine(),e.indent()),I.forEach((N,b)=>{var P,L;b>0&&(e.write(","),(P=g.config)!=null&&P.multiline?e.newLine():e.write(" ")),N.write(e),b===I.length-1&&((L=g.config)!=null&&L.endWithComma)&&e.write(",")}),(l=g.config)!=null&&l.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"tuple":{let g=this.internalType,I=tt({values:g.values});if(I.length===0){e.write("()");break}e.write("("),(d=g.config)!=null&&d.multiline&&(e.newLine(),e.indent()),I.forEach((N,b)=>{var P,L;b>0&&(e.write(","),(P=g.config)!=null&&P.multiline?e.newLine():e.write(" ")),N.write(e),(I.length===1||b===I.length-1&&((L=g.config)!=null&&L.endWithComma))&&e.write(",")}),(h=g.config)!=null&&h.multiline&&(e.newLine(),e.dedent()),e.write(")");break}case"dict":{let g=this.internalType,I=Co({entries:g.entries});if(I.length===0){e.write("{}");break}e.write("{"),(y=g.config)!=null&&y.multiline&&(e.newLine(),e.indent()),I.forEach((N,b)=>{var P,L;b>0&&(e.write(","),(P=g.config)!=null&&P.multiline?e.newLine():e.write(" ")),N.key.write(e),e.write(": "),N.value.write(e),b===I.length-1&&((L=g.config)!=null&&L.endWithComma)&&e.write(",")}),(x=g.config)!=null&&x.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"typedDict":{let g=this.internalType,I=Fo({entries:g.entries});if(I.length===0){e.write("{}");break}e.write("{"),(E=g.config)!=null&&E.multiline&&(e.writeLine(),e.indent()),I.forEach((N,b)=>{var P;b>0&&(e.write(","),(P=g.config)!=null&&P.multiline?e.newLine():e.write(" ")),e.write(`"${N.name}": `),N.value.write(e)}),(T=g.config)!=null&&T.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"reference":{this.internalType.value.write(e);break}case"none":e.write("None");break;case"unknown":this.writeUnknown({writer:e,value:this.internalType.value});break;case"uuid":e.write(`UUID("${this.internalType.value}")`);break;case"nop":break;default:R(this.internalType)}}writeStringWithTripleQuotes({writer:e,value:r,startOnNewLine:i,endWithNewLine:o}){var l;e.write('"""');let a=r.split(`
|
|
10
|
+
`);if(a.length<=1){e.write(this.escapeString((l=a[0])!=null?l:"")),e.write('"""');return}i&&e.writeNoIndent(`\\
|
|
11
|
+
`),a.forEach((d,h)=>{e.writeNoIndent(this.escapeString(d)),h===a.length-1?o&&e.writeNoIndent(`\\
|
|
12
|
+
`):e.writeNoIndent(`
|
|
13
|
+
`)}),e.writeNoIndent('"""')}escapeString(e){let r=new RegExp(`(?<!\\\\)(["'\\\\\\t\\n\\r])`,"g"),i={'"':'\\"',"'":"\\'","\\":"\\\\"," ":"\\t","\n":"\\n","\r":"\\r"};return e.replace(r,o=>{var a;return(a=i[o])!=null?a:o})}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r?"True":"False");return;case"string":e.write(`"${this.escapeString(r)}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("None");return}if(Array.isArray(r)){this.writeUnknownArray({writer:e,value:r});return}this.writeUnknownObject({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:e,value:r}){if(r.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of r)e.writeNode(n.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[o,a]of i)e.write(`"${o}": `),e.writeNode(n.unknown(a)),e.writeLine(",");e.dedent(),e.write("}")}};function Co({entries:n}){return n.filter(t=>!Z.isNop(t.key)&&!Z.isNop(t.value))}function Fo({entries:n}){return n.filter(t=>!Z.isNop(t.value))}function tt({values:n}){return n.filter(t=>!Z.isNop(t))}function Lo(n){return new ie(n)}function Uo(n){return new Oe(n)}function Bo(n){return new he(n)}function ko(n){return new Y(n)}function Mo(n){return new ae(n)}function _o(n){return new ue(n)}function Oo(n){return new F(n)}function Do(n){return new Q(n)}function Vo(n){return new z(n)}function Wo(n){return new W(n)}function qo(n){return new se(n)}function jo(n){return new fe(n)}function $o(n){return new pe(n)}function Yo(n){return new H(n)}function zo(n){return new oe(n)}function Go(n){return new de(n)}function Ho(n){return new G(n)}function Qo(n){return new ce(n)}function Zo(n){return new me(n)}var Jo={type:"primitive",value:"STRING"},Ko=["example"],Lr="client",rt="request",Ve=class{constructor({context:t}){p(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){return this.buildPythonFile({endpoint:t,snippet:e}).toString()}generateSnippetSync({endpoint:t,request:e}){return this.buildPythonFile({endpoint:t,snippet:e}).toString()}buildPythonFile({endpoint:t,snippet:e}){return c.file({path:Ko,statements:[this.constructClient({endpoint:t,snippet:e}),this.callMethod({endpoint:t,snippet:e})]})}constructClient({endpoint:t,snippet:e}){return c.assign({lhs:c.reference({name:Lr}),rhs:c.instantiateClass({classReference:this.context.getRootClientClassReference(),arguments_:this.getConstructorArgs({endpoint:t,snippet:e}).map(r=>c.methodArgument({name:r.name,value:r.value})),multiline:!0})})}getConstructorArgs({endpoint:t,snippet:e}){let r=[],i=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return i.length>0&&r.push(...i),t.auth!=null&&(e.auth!=null?r.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:v.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(B.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(B.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),r}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let r=this.getEnvironmentValue({baseUrl:t,environment:e});return r==null?[]:[{name:this.getEnvironmentOptionName({environment:e}),value:r}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:v.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return c.TypeInstantiation.str(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let r=this.context.getEnvironmentTypeReferenceFromID(e);if(r==null){this.context.errors.add({severity:v.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return c.TypeInstantiation.reference(r)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?c.TypeInstantiation.reference(c.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.entries(e).map(([r,i])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Jo,value:i})})).map(r=>c.methodArgument({name:r.name,value:r.value})),multiline:!0})):void 0}}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.context.errors.add({severity:v.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBasicAuthArg({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.context.errors.add({severity:v.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.context.errors.add({severity:v.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.context.errors.add({severity:v.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorOAuthArgs({auth:t,values:e});default:R(t)}}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:c.TypeInstantiation.str(e.username)},{name:this.context.getPropertyName(t.password),value:c.TypeInstantiation.str(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:c.TypeInstantiation.str(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorOAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.clientId),value:c.TypeInstantiation.str(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:c.TypeInstantiation.str(e.clientSecret)}]}getConstructorHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let o=this.getConstructorHeaderArg({header:i,value:e.value});o!=null&&r.push(o)}return r}getConstructorHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!c.TypeInstantiation.isNop(r))return{name:this.context.getPropertyName(t.name.name),value:r}}callMethod({endpoint:t,snippet:e}){return c.invokeMethod({on:c.reference({name:Lr}),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}).map(r=>c.methodArgument({name:r.name,value:r.value})),multiline:!0})}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:R(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var o,a;let r=[];this.context.errors.scope(B.PathParameters);let i=[...(o=this.context.ir.pathParameters)!=null?o:[],...(a=t.pathParameters)!=null?a:[]];return i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(B.RequestBody),t.body!=null&&r.push(...this.getBodyRequestArgs({body:t.body,value:e.requestBody})),this.context.errors.unscope(),r}getBodyRequestArgs({body:t,value:e}){switch(t.type){case"bytes":return[{name:rt,value:this.getBytesBodyRequestTypeInstantiation({value:e})}];case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:e});default:R(t)}}getBodyRequestArgsForTypeReference({typeReference:t,value:e}){switch(t.type){case"named":{let r=this.context.resolveNamedType({typeId:t.value});return r==null?[]:this.getBodyRequestArgsForNamedTypeReference({typeReference:t,named:r,value:e})}case"nullable":case"optional":return this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:e});case"list":case"map":case"set":case"literal":case"primitive":case"unknown":return[{name:rt,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:e})}];default:R(t)}}getBodyRequestArgsForNamedTypeReference({typeReference:t,named:e,value:r}){var i;switch(e.type){case"alias":return this.getBodyRequestArgsForTypeReference({typeReference:e.typeReference,value:r});case"enum":case"discriminatedUnion":case"undiscriminatedUnion":return[{name:rt,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:r})}];case"object":return this.context.associateByWireValue({parameters:e.properties,values:(i=this.context.getRecord(r))!=null?i:{}}).map(a=>({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)}));default:R(e)}}getBodyRequestArgsForBytes({body:t,value:e}){let r=this.getBytesBodyRequestTypeInstantiation({value:e});return c.TypeInstantiation.isNop(r)?[]:[{name:this.context.getPropertyName(t.bodyKey),value:r}]}getBytesBodyRequestTypeInstantiation({value:t}){return typeof t!="string"?(this.context.errors.add({severity:v.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),c.TypeInstantiation.nop()):c.TypeInstantiation.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){let r=[],i=this.context.shouldInlinePathParameters();this.context.errors.scope(B.PathParameters);let o=[];t.pathParameters!=null&&o.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(B.RequestBody);let a=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...o),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:!0})&&r.push(...this.getInlinedRequestArgs({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?o:[],filePropertyInfo:a})),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})}getInlinedRequestArgs({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:i}){var y,x,E,T;this.context.errors.scope(B.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(y=t.queryParameters)!=null?y:[],values:(x=e.queryParameters)!=null?x:{}}).map(g=>({name:this.context.getPropertyName(g.name.name),value:this.context.dynamicTypeLiteralMapper.convert(g)}));this.context.errors.unscope(),this.context.errors.scope(B.Headers);let d=this.context.associateByWireValue({parameters:(E=t.headers)!=null?E:[],values:(T=e.headers)!=null?T:{}}).map(g=>({name:this.context.getPropertyName(g.name.name),value:this.context.dynamicTypeLiteralMapper.convert(g)}));this.context.errors.unscope(),this.context.errors.scope(B.RequestBody);let h=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),[...r,...a,...d,...h]}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return this.getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:e});case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:R(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:e}){let r=t.bodyType;switch(r.type){case"bytes":return this.getBodyRequestArgsForBytes({body:t,value:e});case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:r.value,value:e});default:R(r)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=this.context.getRecord(e))!=null?o:{}});for(let a of i)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getPathParameters({namedParameters:t,snippet:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=e.pathParameters)!=null?o:{},ignoreMissingParameters:!0});for(let a of i)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});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)}getEnvironmentOptionName({environment:t}){return t!=null?"environment":"base_url"}};u();f();u();f();var Xo="value",We=class{constructor({context:t}){p(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?c.TypeInstantiation.none():(this.context.errors.add({severity:v.Critical,message:"Expected non-null value, but got null"}),c.TypeInstantiation.nop());if(t.value===void 0)return c.TypeInstantiation.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?c.TypeInstantiation.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"set":return this.convertSet({set:t.typeReference.value,value:t.value});case"unknown":return c.TypeInstantiation.unknown(t.value);default:R(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let r=this.context.getValueAsBoolean({value:e});return r==null?c.TypeInstantiation.nop():c.TypeInstantiation.bool(r)}case"string":{let r=this.context.getValueAsString({value:e});return r==null?c.TypeInstantiation.nop():c.TypeInstantiation.str(r)}default:R(t)}}convertList({list:t,value:e}){return Array.isArray(e)?c.TypeInstantiation.list(e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:v.Critical,message:`Expected array but got: ${typeof e}`}),c.TypeInstantiation.nop())}convertSet({set:t,value:e}){return Array.isArray(e)?c.TypeInstantiation.set(e.map((r,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:r})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:v.Critical,message:`Expected array but got: ${typeof e}`}),c.TypeInstantiation.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:v.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),c.TypeInstantiation.nop()):c.TypeInstantiation.dict(Object.entries(e).map(([r,i])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:t.key,value:r,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertNamed({named:t,value:e,as:r}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:r});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:e});case"enum":return this.convertEnum({enum_:t,value:e});case"object":return this.convertObject({object_:t,value:e});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e});default:R(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let r=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(r==null)return c.TypeInstantiation.nop();let i=r.singleDiscriminatedUnionType,o=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:r,unionVariant:i});if(o==null)return c.TypeInstantiation.nop();let a={name:this.context.getPropertyName(t.discriminant.name),value:c.TypeInstantiation.str(i.discriminantValue.wireValue)};return c.TypeInstantiation.typedDict([a,...o],{multiline:!0})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){let r=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});switch(e.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:e.typeId});if(i==null)return;let o=this.convertNamed({named:i,value:t.value});if(!o.isTypedDict()){this.context.errors.add({severity:v.Critical,message:"Internal error; expected union value to be an object"});return}let a=o.asTypedDictOrThrow();return[...r,...a.entries]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let i=this.context.getRecord(t.value);return i==null?[...r,{name:Xo,value:this.convert({typeReference:e.typeReference,value:t.value})}]:[...r,{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:i[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return r;default:R(e)}}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){var i,o;return this.context.associateByWireValue({parameters:(i=e.properties)!=null?i:[],values:(o=this.context.getRecord(t.value))!=null?o:{},ignoreMissingParameters:!0}).map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getPropertyName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}})}convertObject({object_:t,value:e}){var i;let r=this.context.associateByWireValue({parameters:t.properties,values:(i=this.context.getRecord(e))!=null?i:{}});return c.TypeInstantiation.typedDict(r.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertEnum({enum_:t,value:e}){let r=this.getEnumValue({enum_:t,value:e});return r==null?c.TypeInstantiation.nop():c.TypeInstantiation.str(r)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:v.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(i=>i.wireValue===e)==null){this.context.errors.add({severity:v.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return e}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return r==null?c.TypeInstantiation.nop():r}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let r of t.types)try{return this.convert({typeReference:r,value:e})}catch(i){continue}this.context.errors.add({severity:v.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertPrimitive({primitive:t,value:e,as:r}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:e,as:r});return i==null?c.TypeInstantiation.nop():c.TypeInstantiation.int(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:e});return i==null?c.TypeInstantiation.nop():c.TypeInstantiation.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:e,as:r});return i==null?c.TypeInstantiation.nop():c.TypeInstantiation.bool(i)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:e});return i==null?c.TypeInstantiation.nop():c.TypeInstantiation.str(i)}case"UUID":{let i=this.context.getValueAsString({value:e});return i==null?c.TypeInstantiation.nop():c.TypeInstantiation.uuid(i)}case"DATE":{let i=this.context.getValueAsString({value:e});return i==null?c.TypeInstantiation.nop():c.TypeInstantiation.date(i)}case"DATE_TIME":{let i=this.context.getValueAsString({value:e});return i==null?c.TypeInstantiation.nop():c.TypeInstantiation.datetime(i)}default:R(t)}}getValueAsNumber({value:t,as:e}){let r=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:t,as:e}){let r=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:r})}};u();f();var qe=class{constructor({context:t}){p(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){var o;let r={fileFields:[],bodyPropertyFields:[]},i=(o=this.context.getRecord(e))!=null?o:{};for(let a of t.properties)switch(a.type){case"file":{let l=this.getSingleFileProperty({property:a,record:i});if(c.TypeInstantiation.isNop(l))break;r.fileFields.push({name:this.context.getPropertyName(a.name),value:l});break}case"fileArray":{let l=this.getArrayFileProperty({property:a,record:i});if(c.TypeInstantiation.isNop(l))break;r.fileFields.push({name:this.context.getPropertyName(a.name),value:l});break}case"bodyProperty":{let l=this.getBodyProperty({property:a,record:i});if(c.TypeInstantiation.isNop(l))break;r.bodyPropertyFields.push({name:this.context.getPropertyName(a.name.name),value:l});break}default:R(a)}return r}getSingleFileProperty({property:t,record:e}){let r=this.context.getSingleFileValue({property:t,record:e});return r==null?c.TypeInstantiation.nop():this.context.getFileFromString(r)}getArrayFileProperty({property:t,record:e}){let r=this.context.getFileArrayValues({property:t,record:e});return r==null?c.TypeInstantiation.nop():c.TypeInstantiation.list(r.map(i=>this.context.getFileFromString(i)))}getBodyProperty({property:t,record:e}){let r=e[t.name.wireValue];return r==null?c.TypeInstantiation.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:r})}};var ea=["list","set"],je=class n extends Ie{constructor({ir:e,config:r}){var i;super({ir:e,config:r});p(this,"ir");p(this,"customConfig");p(this,"dynamicTypeLiteralMapper");p(this,"filePropertyMapper");this.ir=e,this.customConfig=(i=r.customConfig)!=null?i:{},this.dynamicTypeLiteralMapper=new We({context:this}),this.filePropertyMapper=new qe({context:this})}clone(){return new n({ir:this.ir,config:this.config})}getClassName(e){let r=e.pascalCase.safeName,i=this.getRootClientClassName();return r===i?`${i}Model`:r}getTypedDictClassName(e){return`${this.getClassName(e)}Params`}getPropertyName(e){let r=e.snakeCase.safeName;return r.startsWith("_")?"f_"+r.substring(r.lastIndexOf("_")+1):r}getMethodName(e){return ea.includes(e.snakeCase.unsafeName)?e.snakeCase.unsafeName:e.snakeCase.safeName}getRootClientClassReference(){return c.reference({name:this.getRootClientClassName(),modulePath:this.getRootModulePath()})}getRootClientClassName(){var e,r;return((e=this.customConfig.client)==null?void 0:e.exported_class_name)!=null?this.customConfig.client.exported_class_name:this.customConfig.client_class_name!=null?this.customConfig.client_class_name:((r=this.customConfig.client)==null?void 0:r.class_name)!=null?this.customConfig.client.class_name:this.pascalCase(this.config.organization)+this.pascalCase(this.config.workspaceName)}getEnvironmentClassName(){return`${this.getRootClientClassName()}Environment`}getEnvironmentTypeReferenceFromID(e){let r=this.resolveEnvironmentName(e);if(r!=null)return c.accessAttribute({lhs:this.getEnvironmentClassReference(),rhs:c.codeBlock(this.getEnvironmentEnumName(r))})}getEnvironmentClassReference(){return c.reference({name:this.getEnvironmentClassName(),modulePath:this.getRootModulePath()})}getEnvironmentEnumName(e){return e.screamingSnakeCase.safeName}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:R(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:R(e)}}getFileFromString(e){return c.TypeInstantiation.str(e)}getRootModulePath(){if(this.customConfig.package_name!=null)return[this.customConfig.package_name];let e=this.cleanOrganizationName();return this.customConfig.use_api_name_in_package?[e,this.getApiName()]:[e]}getCoreModulePath(){return this.getRootModulePath().concat("core")}shouldInlinePathParameters(){return!0}cleanOrganizationName(){return this.config.organization.replace(/[^a-zA-Z0-9]/g,"_")}getApiName(){return et(this.config.workspaceName)}pascalCase(e){let r=Xe(e);return r.charAt(0).toUpperCase()+r.slice(1)}};var nt=class extends ve{constructor({ir:t,config:e}){super(new je({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}createSnippetGenerator(t){return new Ve({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
14
|
+
/*! Bundled license information:
|
|
15
|
+
|
|
16
|
+
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
17
|
+
(*!
|
|
18
|
+
* The buffer module from node.js, for the browser.
|
|
19
|
+
*
|
|
20
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
21
|
+
* @license MIT
|
|
22
|
+
*)
|
|
23
|
+
|
|
24
|
+
lodash-es/lodash.js:
|
|
25
|
+
(**
|
|
26
|
+
* @license
|
|
27
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
28
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
29
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
30
|
+
* Released under MIT license <https://lodash.com/license>
|
|
31
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
32
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
33
|
+
*)
|
|
34
|
+
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
+
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
+
import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.cjs';
|
|
4
|
+
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-aXWxVpwD.cjs';
|
|
5
|
+
import '@fern-api/python-ast';
|
|
6
|
+
import '@fern-api/python-browser-compatible-base';
|
|
7
|
+
|
|
8
|
+
declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
|
|
9
|
+
constructor({ ir, config }: {
|
|
10
|
+
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
11
|
+
config: FernGeneratorExec.GeneratorConfig;
|
|
12
|
+
});
|
|
13
|
+
generate(request: FernIr.dynamic.EndpointSnippetRequest): Promise<FernIr.dynamic.EndpointSnippetResponse>;
|
|
14
|
+
generateSync(request: FernIr.dynamic.EndpointSnippetRequest): FernIr.dynamic.EndpointSnippetResponse;
|
|
15
|
+
protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { DynamicSnippetsGenerator };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { AbstractDynamicSnippetsGeneratorContext, FernGeneratorExec } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
+
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
+
import { python } from '@fern-api/python-ast';
|
|
4
|
+
import { BasePythonCustomConfigSchema } from '@fern-api/python-browser-compatible-base';
|
|
5
|
+
|
|
6
|
+
declare namespace DynamicTypeLiteralMapper {
|
|
7
|
+
interface Args {
|
|
8
|
+
typeReference: FernIr.dynamic.TypeReference;
|
|
9
|
+
value: unknown;
|
|
10
|
+
as?: ConvertedAs;
|
|
11
|
+
}
|
|
12
|
+
type ConvertedAs = "key";
|
|
13
|
+
}
|
|
14
|
+
declare class DynamicTypeLiteralMapper {
|
|
15
|
+
private context;
|
|
16
|
+
constructor({ context }: {
|
|
17
|
+
context: DynamicSnippetsGeneratorContext;
|
|
18
|
+
});
|
|
19
|
+
convert(args: DynamicTypeLiteralMapper.Args): python.TypeInstantiation;
|
|
20
|
+
private convertLiteral;
|
|
21
|
+
private convertList;
|
|
22
|
+
private convertSet;
|
|
23
|
+
private convertMap;
|
|
24
|
+
private convertNamed;
|
|
25
|
+
private convertDiscriminatedUnion;
|
|
26
|
+
private convertDiscriminatedUnionProperties;
|
|
27
|
+
private getBaseFields;
|
|
28
|
+
private convertObject;
|
|
29
|
+
private convertEnum;
|
|
30
|
+
private getEnumValue;
|
|
31
|
+
private convertUndiscriminatedUnion;
|
|
32
|
+
private findMatchingUndiscriminatedUnionType;
|
|
33
|
+
private convertPrimitive;
|
|
34
|
+
private getValueAsNumber;
|
|
35
|
+
private getValueAsBoolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface FilePropertyInfo {
|
|
39
|
+
fileFields: python.NamedValue[];
|
|
40
|
+
bodyPropertyFields: python.NamedValue[];
|
|
41
|
+
}
|
|
42
|
+
declare class FilePropertyMapper {
|
|
43
|
+
private context;
|
|
44
|
+
constructor({ context }: {
|
|
45
|
+
context: DynamicSnippetsGeneratorContext;
|
|
46
|
+
});
|
|
47
|
+
getFilePropertyInfo({ body, value }: {
|
|
48
|
+
body: FernIr.dynamic.FileUploadRequestBody;
|
|
49
|
+
value: unknown;
|
|
50
|
+
}): FilePropertyInfo;
|
|
51
|
+
private getSingleFileProperty;
|
|
52
|
+
private getArrayFileProperty;
|
|
53
|
+
private getBodyProperty;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGeneratorContext {
|
|
57
|
+
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
58
|
+
customConfig: BasePythonCustomConfigSchema;
|
|
59
|
+
dynamicTypeLiteralMapper: DynamicTypeLiteralMapper;
|
|
60
|
+
filePropertyMapper: FilePropertyMapper;
|
|
61
|
+
constructor({ ir, config }: {
|
|
62
|
+
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
63
|
+
config: FernGeneratorExec.GeneratorConfig;
|
|
64
|
+
});
|
|
65
|
+
clone(): DynamicSnippetsGeneratorContext;
|
|
66
|
+
getClassName(name: FernIr.Name): string;
|
|
67
|
+
getTypedDictClassName(name: FernIr.Name): string;
|
|
68
|
+
getPropertyName(name: FernIr.Name): string;
|
|
69
|
+
getMethodName(name: FernIr.Name): string;
|
|
70
|
+
getRootClientClassReference(): python.Reference;
|
|
71
|
+
getRootClientClassName(): string;
|
|
72
|
+
getEnvironmentClassName(): string;
|
|
73
|
+
getEnvironmentTypeReferenceFromID(environmentID: string): python.AstNode | undefined;
|
|
74
|
+
getEnvironmentClassReference(): python.Reference;
|
|
75
|
+
getEnvironmentEnumName(name: FernIr.Name): string;
|
|
76
|
+
isPrimitive(typeReference: FernIr.dynamic.TypeReference): boolean;
|
|
77
|
+
getFileFromString(content: string): python.TypeInstantiation;
|
|
78
|
+
getRootModulePath(): string[];
|
|
79
|
+
getCoreModulePath(): string[];
|
|
80
|
+
shouldInlinePathParameters(): boolean;
|
|
81
|
+
private cleanOrganizationName;
|
|
82
|
+
private getApiName;
|
|
83
|
+
private pascalCase;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { DynamicSnippetsGeneratorContext as D, type FilePropertyInfo as F, DynamicTypeLiteralMapper as a, FilePropertyMapper as b };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";var ye=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames,de=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable;var Ne=(n,t,e)=>t in n?ye(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Se=(n,t)=>{for(var e in t||(t={}))Pe.call(t,e)&&Ne(n,e,t[e]);if(de)for(var e of de(t))Me.call(t,e)&&Ne(n,e,t[e]);return n};var De=(n,t)=>{var e={};for(var r in n)Pe.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&de)for(var r of de(n))t.indexOf(r)<0&&Me.call(n,r)&&(e[r]=n[r]);return e};var Be=(n,t)=>()=>(n&&(t=n(n=0)),t);var qe=(n,t)=>{for(var e in t)ye(n,e,{get:t[e],enumerable:!0})},pt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lt(t))!Pe.call(n,i)&&i!==e&&ye(n,i,{get:()=>t[i],enumerable:!(r=ft(t,i))||r.enumerable});return n};var mt=n=>pt(ye({},"__esModule",{value:!0}),n);var h=(n,t,e)=>Ne(n,typeof t!="symbol"?t+"":t,e);function Ve(){throw new Error("setTimeout has not been defined")}function Ye(){throw new Error("clearTimeout has not been defined")}function We(n){if(V===setTimeout)return setTimeout(n,0);if((V===Ve||!V)&&setTimeout)return V=setTimeout,setTimeout(n,0);try{return V(n,0)}catch(t){try{return V.call(null,n,0)}catch(e){return V.call(this,n,0)}}}function dt(n){if(Y===clearTimeout)return clearTimeout(n);if((Y===Ye||!Y)&&clearTimeout)return Y=clearTimeout,clearTimeout(n);try{return Y(n)}catch(t){try{return Y.call(null,n)}catch(e){return Y.call(this,n)}}}function yt(){!ee||!j||(ee=!1,j.length?D=j.concat(D):we=-1,D.length&&$e())}function $e(){if(!ee){var n=We(yt);ee=!0;for(var t=D.length;t;){for(j=D,D=[];++we<t;)j&&j[we].run();we=-1,t=D.length}j=null,ee=!1,dt(n)}}function wt(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];D.push(new Qe(n,t)),D.length===1&&!ee&&We($e)}function Qe(n,t){this.fun=n,this.array=t}function J(){}function Ct(n){throw new Error("process.binding is not supported")}function Ut(){return"/"}function _t(n){throw new Error("process.chdir is not supported")}function Mt(){return 0}function qt(n){var t=Dt.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 Vt(){var n=new Date,t=n-Ot;return t/1e3}var V,Y,D,ee,j,we,xt,gt,Rt,vt,At,It,Tt,Et,Nt,Pt,St,Bt,Lt,Ft,bt,kt,K,Dt,Ot,g,Oe,c=Be(()=>{"use strict";V=Ve,Y=Ye;typeof globalThis.setTimeout=="function"&&(V=setTimeout);typeof globalThis.clearTimeout=="function"&&(Y=clearTimeout);D=[],ee=!1,we=-1;Qe.prototype.run=function(){this.fun.apply(null,this.array)};xt="browser",gt="browser",Rt=!0,vt={},At=[],It="",Tt={},Et={},Nt={};Pt=J,St=J,Bt=J,Lt=J,Ft=J,bt=J,kt=J;K=globalThis.performance||{},Dt=K.now||K.mozNow||K.msNow||K.oNow||K.webkitNow||function(){return new Date().getTime()};Ot=new Date;g={nextTick:wt,title:xt,browser:Rt,env:vt,argv:At,version:It,versions:Tt,on:Pt,addListener:St,once:Bt,off:Lt,removeListener:Ft,removeAllListeners:bt,emit:kt,binding:Ct,cwd:Ut,chdir:_t,umask:Mt,hrtime:qt,platform:gt,release:Et,config:Nt,uptime:Vt},Oe={};Object.keys(Oe).forEach(n=>{let t=n.split("."),e=g;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Oe[n]:e=e[i]||(e[i]={})}})});function je(){Fe=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)C[t]=n[t],B[n.charCodeAt(t)]=t;B[45]=62,B[95]=63}function Wt(n){Fe||je();var t,e,r,i,s,o,u=n.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=n[u-2]==="="?2:n[u-1]==="="?1:0,o=new Yt(u*3/4-s),r=s>0?u-4:u;var l=0;for(t=0,e=0;t<r;t+=4,e+=3)i=B[n.charCodeAt(t)]<<18|B[n.charCodeAt(t+1)]<<12|B[n.charCodeAt(t+2)]<<6|B[n.charCodeAt(t+3)],o[l++]=i>>16&255,o[l++]=i>>8&255,o[l++]=i&255;return s===2?(i=B[n.charCodeAt(t)]<<2|B[n.charCodeAt(t+1)]>>4,o[l++]=i&255):s===1&&(i=B[n.charCodeAt(t)]<<10|B[n.charCodeAt(t+1)]<<4|B[n.charCodeAt(t+2)]>>2,o[l++]=i>>8&255,o[l++]=i&255),o}function $t(n){return C[n>>18&63]+C[n>>12&63]+C[n>>6&63]+C[n&63]}function Qt(n,t,e){for(var r,i=[],s=t;s<e;s+=3)r=(n[s]<<16)+(n[s+1]<<8)+n[s+2],i.push($t(r));return i.join("")}function ze(n){Fe||je();for(var t,e=n.length,r=e%3,i="",s=[],o=16383,u=0,l=e-r;u<l;u+=o)s.push(Qt(n,u,u+o>l?l:u+o));return r===1?(t=n[e-1],i+=C[t>>2],i+=C[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=C[t>>10],i+=C[t>>4&63],i+=C[t<<2&63],i+="="),s.push(i),s.join("")}function xe(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function q(n,t){if(xe()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=a.prototype):(n===null&&(n=new a(t)),n.length=t),n}function a(n,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return be(this,n)}return Je(this,n,t,e)}function Je(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?Gt(n,t,e,r):typeof t=="string"?Ht(n,t,e):jt(n,t)}function Ze(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function zt(n,t,e,r){return Ze(t),t<=0?q(n,t):e!==void 0?typeof r=="string"?q(n,t).fill(e,r):q(n,t).fill(e):q(n,t)}function be(n,t){if(Ze(t),n=q(n,t<0?0:ke(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function Ht(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=Xe(t,e)|0;n=q(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Le(n,t){var e=t.length<0?0:ke(t.length)|0;n=q(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function Gt(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),a.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=a.prototype):n=Le(n,t),n}function jt(n,t){if(U(t)){var e=ke(t.length)|0;return n=q(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"||mr(t.length)?q(n,0):Le(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Le(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ke(n){if(n>=xe())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+xe().toString(16)+" bytes");return n|0}function U(n){return!!(n!=null&&n._isBuffer)}function Xe(n,t){if(U(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 ge(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return st(n).length;default:if(r)return ge(n).length;t=(""+t).toLowerCase(),r=!0}}function Jt(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 or(this,t,e);case"utf8":case"utf-8":return tt(this,t,e);case"ascii":return ir(this,t,e);case"latin1":case"binary":return sr(this,t,e);case"base64":return rr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ar(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function Z(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function Ke(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,r)),U(t))return t.length===0?-1:He(n,t,e,r,i);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):He(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function He(n,t,e,r,i){var s=1,o=n.length,u=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;s=2,o/=2,u/=2,e/=2}function l(R,y){return s===1?R[y]:R.readUInt16BE(y*s)}var m;if(i){var p=-1;for(m=e;m<o;m++)if(l(n,m)===l(t,p===-1?0:m-p)){if(p===-1&&(p=m),m-p+1===u)return p*s}else p!==-1&&(m-=m-p),p=-1}else for(e+u>o&&(e=o-u),m=e;m>=0;m--){for(var d=!0,A=0;A<u;A++)if(l(n,m+A)!==l(t,A)){d=!1;break}if(d)return m}return-1}function Zt(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var u=parseInt(t.substr(o*2,2),16);if(isNaN(u))return o;n[e+o]=u}return o}function Xt(n,t,e,r){return Ae(ge(t,n.length-e),n,e,r)}function et(n,t,e,r){return Ae(lr(t),n,e,r)}function Kt(n,t,e,r){return et(n,t,e,r)}function er(n,t,e,r){return Ae(st(t),n,e,r)}function tr(n,t,e,r){return Ae(pr(t,n.length-e),n,e,r)}function rr(n,t,e){return t===0&&e===n.length?ze(n):ze(n.slice(t,e))}function tt(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var s=n[i],o=null,u=s>239?4:s>223?3:s>191?2:1;if(i+u<=e){var l,m,p,d;switch(u){case 1:s<128&&(o=s);break;case 2:l=n[i+1],(l&192)===128&&(d=(s&31)<<6|l&63,d>127&&(o=d));break;case 3:l=n[i+1],m=n[i+2],(l&192)===128&&(m&192)===128&&(d=(s&15)<<12|(l&63)<<6|m&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:l=n[i+1],m=n[i+2],p=n[i+3],(l&192)===128&&(m&192)===128&&(p&192)===128&&(d=(s&15)<<18|(l&63)<<12|(m&63)<<6|p&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=u}return nr(r)}function nr(n){var t=n.length;if(t<=Ge)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Ge));return e}function ir(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function sr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function or(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",s=t;s<e;++s)i+=fr(n[s]);return i}function ar(n,t,e){for(var r=n.slice(t,e),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+r[s+1]*256);return i}function I(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 S(n,t,e,r,i,s){if(!U(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function Re(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(n.length-e,2);i<s;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function ve(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(n.length-e,4);i<s;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function rt(n,t,e,r,i,s){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function nt(n,t,e,r,i){return i||rt(n,t,e,4,34028234663852886e22,-34028234663852886e22),at(n,t,e,r,23,4),e+4}function it(n,t,e,r,i){return i||rt(n,t,e,8,17976931348623157e292,-17976931348623157e292),at(n,t,e,r,52,8),e+8}function ur(n){if(n=cr(n).replace(hr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function cr(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function fr(n){return n<16?"0"+n.toString(16):n.toString(16)}function ge(n,t){t=t||1/0;for(var e,r=n.length,i=null,s=[],o=0;o<r;++o){if(e=n.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function lr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function pr(n,t){for(var e,r,i,s=[],o=0;o<n.length&&!((t-=2)<0);++o)e=n.charCodeAt(o),r=e>>8,i=e%256,s.push(i),s.push(r);return s}function st(n){return Wt(ur(n))}function Ae(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function mr(n){return n!==n}function dr(n){return n!=null&&(!!n._isBuffer||ot(n)||yr(n))}function ot(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function yr(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&ot(n.slice(0,0))}function Ie(n,t,e,r,i){var s,o,u=i*8-r-1,l=(1<<u)-1,m=l>>1,p=-7,d=e?i-1:0,A=e?-1:1,R=n[t+d];for(d+=A,s=R&(1<<-p)-1,R>>=-p,p+=u;p>0;s=s*256+n[t+d],d+=A,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=r;p>0;o=o*256+n[t+d],d+=A,p-=8);if(s===0)s=1-m;else{if(s===l)return o?NaN:(R?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-m}return(R?-1:1)*o*Math.pow(2,s-r)}function at(n,t,e,r,i,s){var o,u,l,m=s*8-i-1,p=(1<<m)-1,d=p>>1,A=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=r?0:s-1,y=r?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=p):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=A/l:t+=A*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=p?(u=0,o=p):o+d>=1?(u=(t*l-1)*Math.pow(2,i),o=o+d):(u=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;n[e+R]=u&255,R+=y,u/=256,i-=8);for(o=o<<i|u,m+=i;m>0;n[e+R]=o&255,R+=y,o/=256,m-=8);n[e+R-y]|=v*128}var C,B,Yt,Fe,Ge,hr,ht=Be(()=>{"use strict";c();f();C=[],B=[],Yt=typeof Uint8Array!="undefined"?Uint8Array:Array,Fe=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(n){return n.__proto__=a.prototype,n};a.from=function(n,t,e){return Je(null,n,t,e)};a.kMaxLength=xe();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(n,t,e){return zt(null,n,t,e)};a.allocUnsafe=function(n){return be(null,n)};a.allocUnsafeSlow=function(n){return be(null,n)};a.isBuffer=dr;a.compare=function(t,e){if(!U(t)||!U(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,s=0,o=Math.min(r,i);s<o;++s)if(t[s]!==e[s]){r=t[s],i=e[s];break}return r<i?-1:i<r?1:0};a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),s=0;for(r=0;r<t.length;++r){var o=t[r];if(!U(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,s),s+=o.length}return i};a.byteLength=Xe;a.prototype._isBuffer=!0;a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Z(this,e,e+1);return this};a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Z(this,e,e+3),Z(this,e+1,e+2);return this};a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Z(this,e,e+7),Z(this,e+1,e+6),Z(this,e+2,e+5),Z(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?tt(this,0,t):Jt.apply(this,arguments)};a.prototype.equals=function(t){if(!U(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,i,s){if(!U(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||r>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=r)return 0;if(i>=s)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,u=r-e,l=Math.min(o,u),m=this.slice(i,s),p=t.slice(e,r),d=0;d<l;++d)if(m[d]!==p[d]){o=m[d],u=p[d];break}return o<u?-1:u<o?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return Ke(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return Ke(this,t,e,r,!1)};a.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-e;if((r===void 0||r>s)&&(r=s),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return Zt(this,t,e,r);case"utf8":case"utf-8":return Xt(this,t,e,r);case"ascii":return et(this,t,e,r);case"latin1":case"binary":return Kt(this,t,e,r);case"base64":return er(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tr(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ge=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var s=e-t;i=new a(s,void 0);for(var o=0;o<s;++o)i[o]=this[o+t]}return i};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||I(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return i};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||I(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};a.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||I(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||I(t,e,this.length);for(var i=e,s=1,o=this[t+--i];i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};a.prototype.readInt8=function(t,e){return e||I(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),Ie(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),Ie(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),Ie(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),Ie(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;S(this,t,e,r,s,0)}var o=1,u=0;for(this[e]=t&255;++u<r&&(o*=256);)this[e+u]=t/o&255;return e+r};a.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;S(this,t,e,r,s,0)}var o=r-1,u=1;for(this[e+o]=t&255;--o>=0&&(u*=256);)this[e+o]=t/u&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Re(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Re(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):ve(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ve(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);S(this,t,e,r,s-1,-s)}var o=0,u=1,l=0;for(this[e]=t&255;++o<r&&(u*=256);)t<0&&l===0&&this[e+o-1]!==0&&(l=1),this[e+o]=(t/u>>0)-l&255;return e+r};a.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);S(this,t,e,r,s-1,-s)}var o=r-1,u=1,l=0;for(this[e+o]=t&255;--o>=0&&(u*=256);)t<0&&l===0&&this[e+o+1]!==0&&(l=1),this[e+o]=(t/u>>0)-l&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Re(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Re(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ve(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ve(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,r){return nt(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return nt(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return it(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return it(this,t,e,!1,r)};a.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var s=i-r,o;if(this===t&&r<e&&e<i)for(o=s-1;o>=0;--o)t[o+e]=this[o+r];else if(s<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s};a.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var s=t.charCodeAt(0);s<256&&(t=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var o;if(typeof t=="number")for(o=e;o<r;++o)this[o]=t;else{var u=U(t)?t:ge(new a(t,i).toString()),l=u.length;for(o=0;o<r-e;++o)this[o+e]=u[o%l]}return this};hr=/[^+\/0-9A-Za-z-_]/g});var f=Be(()=>{"use strict";ht()});var Vr={};qe(Vr,{EndpointSnippetGenerator:()=>_e});module.exports=mt(Vr);c();f();c();f();c();f();function E(n){throw new Error("Unexpected value: "+JSON.stringify(n))}c();f();c();f();var X=class{};c();f();c();f();var b=class extends X{constructor(e){super();h(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var wr=4,pe=class{constructor(){h(this,"buffer","");h(this,"indentLevel",0);h(this,"hasWrittenAnything",!1);h(this,"lastCharacterIsSemicolon",!1);h(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
|
|
2
|
+
`),r=e?t.substring(0,t.length-1):t,i=this.getIndentString(),s=r.replaceAll(`
|
|
3
|
+
`,`
|
|
4
|
+
${i}`);this.isAtStartOfLine()&&(s=i+s),e&&(s+=`
|
|
5
|
+
`),this.writeInternal(s)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new b(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new b(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}controlFlowWithoutStatement(t){new b(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new b(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new b(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}openBlock(t,e="{",r,i="}"){let s=t.filter(o=>o!==void 0).join(" ");s?this.write(`${s} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),r(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
6
|
+
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
7
|
+
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let s=1;s<t.length;s++){this.write(e);let o=t[s];o!=null&&r(o)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
|
|
8
|
+
`),this.lastCharacterIsSemicolon=t.endsWith(";")),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*wr)}};c();f();c();f();var _={Critical:"CRITICAL",Warning:"WARNING"};c();f();var k={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};c();f();var w={};qe(w,{AccessAttribute:()=>te,AstNode:()=>x,Class:()=>W,ClassInstantiation:()=>ne,CodeBlock:()=>O,Comment:()=>ie,Decorator:()=>se,Field:()=>$,Lambda:()=>oe,LambdaParameter:()=>ae,Method:()=>z,MethodArgument:()=>ue,MethodInvocation:()=>ce,Operator:()=>fe,Parameter:()=>Q,PythonFile:()=>le,Reference:()=>L,StarImport:()=>H,Type:()=>Ee,TypeInstantiation:()=>G,accessAttribute:()=>Rr,assign:()=>vr,class_:()=>Ir,codeBlock:()=>Br,comment:()=>Lr,decorator:()=>Er,field:()=>Sr,file:()=>Ar,instantiateClass:()=>Tr,invokeFunction:()=>Cr,invokeMethod:()=>Ur,lambda:()=>Fr,lambdaParameter:()=>br,method:()=>kr,methodArgument:()=>Mr,operator:()=>Dr,parameter:()=>_r,reference:()=>Nr,starImport:()=>Pr});c();f();c();f();c();f();c();f();var me=class extends pe{constructor(){super(...arguments);h(this,"fullyQualifiedModulePathsToImportedNames",{})}setRefNameOverrides(e){this.fullyQualifiedModulePathsToImportedNames=e}unsetRefNameOverrides(){this.fullyQualifiedModulePathsToImportedNames={}}getRefNameOverride(e){var i;let r=this.fullyQualifiedModulePathsToImportedNames[e.getFullyQualifiedModulePath()];return r||{name:(i=e.alias)!=null?i:e.name,isAlias:!!e.alias}}toString(){return this.buffer}async toStringFormatted(e){return e.format(this.buffer)}};var x=class extends X{constructor(){super(...arguments);h(this,"references",[])}addReference(e){this.references.push(e)}inheritReferences(e){e!==void 0&&e.references.forEach(r=>{this.references.includes(r)||this.addReference(r)})}getReferences(){return this.references}toString(){let e=new me;return this.write(e),e.toString()}async toStringFormatted(e){let r=new me;return this.write(r),r.toStringFormatted(e)}};var te=class extends x{constructor({lhs:e,rhs:r}){super();h(this,"lhs");h(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=r,this.inheritReferences(r)}write(e){this.lhs.write(e),e.write("."),this.rhs.write(e)}};c();f();var Te=class extends x{constructor({lhs:e,rhs:r}){super();h(this,"lhs");h(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=r,this.inheritReferences(r)}write(e){this.lhs.write(e),e.write(" = "),this.rhs.write(e)}};c();f();var re=class extends x{constructor({reference:e,arguments_:r,multiline:i}){super();h(this,"reference");h(this,"arguments");h(this,"multiline");this.reference=e,this.arguments=r,this.multiline=i!=null?i:!1,this.inheritReferences(e),this.arguments.forEach(s=>{this.inheritReferences(s)})}write(e){if(this.reference.write(e),this.arguments.length===0){e.write("()");return}e.write("("),this.multiline&&(e.newLine(),e.indent()),this.arguments.forEach((r,i)=>{r.write(e),i<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};c();f();var W=class extends x{constructor({docs:e,name:r,extends_:i,decorators:s}){super();h(this,"name");h(this,"extends_");h(this,"decorators");h(this,"fields",[]);h(this,"docs");h(this,"statements",[]);this.name=r,this.extends_=i!=null?i:[],this.decorators=s!=null?s:[],this.docs=e,this.extends_.forEach(o=>{this.inheritReferences(o)}),this.decorators.forEach(o=>{this.inheritReferences(o)})}write(e){this.decorators.forEach(r=>{r.write(e)}),e.write(`class ${this.name}`),this.extends_.length>0&&(e.write("("),this.extends_.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write(")")),e.write(":"),e.newLine(),e.indent(),this.docs!=null&&(e.write('"""'),e.write(this.docs),e.write('"""')),e.writeNewLineIfLastLineNot(),this.fields.forEach(r=>{r.write(e),e.writeNewLineIfLastLineNot()}),e.dedent(),e.indent(),this.statements.length?this.writeStatements({writer:e}):e.write("pass"),e.dedent()}add(e){this.statements.push(e),this.inheritReferences(e)}writeStatements({writer:e}){this.statements.forEach((r,i)=>{r.write(e),e.writeNewLineIfLastLineNot()})}addField(e){this.add(e)}};c();f();var ne=class extends re{constructor(r){var i=r,{classReference:t}=i,e=De(i,["classReference"]);super(Se({reference:t},e))}};c();f();var O=class extends x{constructor(e){super();h(this,"arg");this.arg=e}write(e){return new b(this.arg).write(e)}};c();f();var ie=class extends x{constructor({docs:e}){super();h(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
|
|
9
|
+
`).forEach(r=>{e.writeLine(`# ${r}`)})}};c();f();var se=class extends x{constructor({callable:e}){super();h(this,"callable");this.callable=e,this.inheritReferences(e)}write(e){e.write("@"),this.callable.write(e),e.newLine()}};c();f();var $=class extends x{constructor({name:e,type:r,initializer:i,docs:s}){super();h(this,"name");h(this,"type");h(this,"initializer");h(this,"docs");this.name=e,this.type=r,this.initializer=i,this.docs=s,this.inheritReferences(this.type),this.inheritReferences(this.initializer)}write(e){e.write(this.name),this.type!==void 0&&(e.write(": "),this.type.write(e)),this.initializer!==void 0&&(e.write(" = "),this.initializer.write(e)),this.docs!=null&&(e.newLine(),e.write('"""'),e.newLine(),e.write(this.docs),e.newLine(),e.write('"""'))}};c();f();var oe=class extends x{constructor({parameters:e,body:r}){super();h(this,"parameters");h(this,"body");this.parameters=e!=null?e:[],this.body=r,this.inheritReferences(r)}write(e){e.write("lambda"),this.parameters&&this.parameters.length&&(e.write(" "),this.parameters.forEach((r,i)=>{r.write(e),i<this.parameters.length-1&&e.write(", ")})),e.write(": "),this.body.write(e)}};c();f();c();f();var Q=class extends x{constructor({name:e,type:r,initializer:i}){super();h(this,"name");h(this,"initializer");h(this,"type");this.name=e,this.type=r,this.initializer=i}write(e){e.write(this.name),this.type&&(e.write(": "),this.type.write(e)),this.initializer!==void 0&&(e.write(" = "),this.initializer.write(e))}};var ae=class extends Q{constructor({name:t,initializer:e}){super({name:t,initializer:e,type:void 0})}};c();f();var he;(function(n){n[n.STATIC=0]="STATIC",n[n.INSTANCE=1]="INSTANCE",n[n.CLASS=2]="CLASS"})(he||(he={}));var z=class extends x{constructor({static_:e,name:r,parameters:i,return_:s,docstring:o,type:u,decorators:l}){super();h(this,"name");h(this,"return");h(this,"docstring");h(this,"type");h(this,"parameters");h(this,"decorators");h(this,"statements",[]);h(this,"static_");this.name=r,this.parameters=i!=null?i:[],this.return=s,this.docstring=o,this.type=u,this.decorators=l!=null?l:[],this.static_=e!=null?e:!1,this.parameters.forEach(m=>{this.inheritReferences(m)}),this.inheritReferences(this.return),this.decorators.forEach(m=>{this.inheritReferences(m)}),this.statements.forEach(m=>{this.inheritReferences(m)})}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){this.static_&&this.decorators.push(w.decorator({callable:w.codeBlock("staticmethod")})),this.decorators.forEach(r=>{r.write(e)}),this.type===he.CLASS?w.decorator({callable:new O("classmethod")}).write(e):this.type===he.STATIC&&w.decorator({callable:new O("staticmethod")}).write(e),e.write(`def ${this.name}(`),this.type===he.INSTANCE?(e.write("self"),this.parameters.length>0&&e.write(", ")):this.type===he.CLASS&&(e.write("cls"),this.parameters.length>0&&e.write(", ")),this.parameters.forEach((r,i)=>{r.write(e),i<this.parameters.length-1&&e.write(", ")}),e.write(")"),this.return&&(e.write(" -> "),this.return.write(e)),e.write(":"),e.newLine(),this.docstring&&(e.indent(),e.write('"""'),e.write(this.docstring),e.write('"""'),e.newLine(),e.dedent()),this.statements.length?(e.indent(),this.statements.forEach((r,i)=>{r.write(e),i<this.statements.length-1&&e.newLine()}),e.dedent()):(e.indent(),e.write("pass"),e.dedent()),e.newLine()}};c();f();var ue=class extends x{constructor({name:e,value:r}){super();h(this,"name");h(this,"value");this.name=e,this.value=r,this.inheritReferences(this.value)}write(e){this.name!==void 0&&(e.write(this.name),e.write("=")),this.value.write(e)}};c();f();var ce=class extends x{constructor({on:e,method:r,arguments_:i,multiline:s}){super();h(this,"on");h(this,"method");h(this,"arguments");h(this,"multiline");this.on=e,this.method=r,this.arguments=i,this.multiline=s!=null?s:!1,this.inheritReferences(e),this.arguments.forEach(o=>{this.inheritReferences(o)})}write(e){if(this.on.write(e),e.write("."),e.write(this.method),this.arguments.length===0){e.write("()");return}e.write("("),this.multiline&&(e.newLine(),e.indent()),this.arguments.forEach((r,i)=>{r.write(e),i<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};c();f();c();f();var M={Or:"or",And:"and",Add:"add",Subtract:"subtract",Multiply:"multiple",Divide:"divide",Modulo:"modulo",LeftShift:"leftShift",RightShift:"rightShift"};var fe=class extends x{constructor({operator:e,lhs:r,rhs:i}){super();h(this,"operator");h(this,"lhs");h(this,"rhs");this.operator=e,this.lhs=r,this.inheritReferences(r),this.rhs=i,this.inheritReferences(i)}getOperatorString(){switch(this.operator){case M.Or:return"or";case M.And:return"and";case M.Add:return"+";case M.Subtract:return"-";case M.Multiply:return"*";case M.Divide:return"/";case M.Modulo:return"%";case M.LeftShift:return"<<";case M.RightShift:return">>";default:E(this.operator)}}write(e){this.lhs.write(e),e.write(" "),e.write(this.getOperatorString()),e.write(" "),this.rhs.write(e)}};c();f();c();f();c();f();var L=class extends x{constructor({name:e,modulePath:r,genericTypes:i,alias:s,attribute:o}){super();h(this,"name");h(this,"modulePath");h(this,"genericTypes");h(this,"alias");h(this,"attribute");this.name=e,this.modulePath=r!=null?r:[],this.genericTypes=i!=null?i:[],this.alias=s,this.attribute=o!=null?o:[],this.references.push(this),this.genericTypes.forEach(u=>{this.inheritReferences(u)})}write(e){let r=e.getRefNameOverride(this);e.write(r.name),this.genericTypes.length>0&&(e.write("["),this.genericTypes.forEach((i,s)=>{s>0&&e.write(", "),i.write(e)}),e.write("]")),this.attribute.length>0&&(e.write("."),this.attribute.forEach((i,s)=>{s>0&&e.write("."),e.write(i)}))}getFullyQualifiedPath(){return this.modulePath.join(".")}getFullyQualifiedModulePath(){return`${this.getFullyQualifiedPath()}.${this.name}`}};var H=class extends L{constructor({modulePath:e}){super({name:"*",modulePath:e});h(this,"docs")}write(e){throw new Error("Not intended to be written outside the context of a PythonFile.")}};c();f();function ut(n){if(!n)return"Class";let t=n.replace(/[^a-zA-Z0-9\s_-]/g," ").replace(/[-_\s]+/g," ").trim();return!t||/^\d+$/.test(t)?"Class"+(t||""):(/^\d/.test(t)&&(t="Class"+t),t.split(/(?=[A-Z])|[-_\s]+/).filter(r=>r.length>0).map(r=>r.split(new RegExp("(?<=\\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\\d)")).filter(i=>i.length>0)).flat().map((r,i)=>i===0&&/^\d/.test(r)?"Class"+r.charAt(0).toUpperCase()+r.slice(1).toLowerCase():r.length>1&&r===r.toUpperCase()&&!/^\d+$/.test(r)?r:r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(""))}var le=class extends x{constructor({path:e,statements:r,isInitFile:i=!1,comments:s,imports:o}){super();h(this,"path");h(this,"isInitFile");h(this,"statements",[]);h(this,"comments");this.path=e,this.isInitFile=i,r==null||r.forEach(u=>this.addStatement(u)),this.comments=s!=null?s:[],o==null||o.forEach(u=>this.addReference(u))}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){let r=this.deduplicateReferences();this.updateWriterRefNameOverrides({writer:e,uniqueReferences:r}),this.writeComments(e),this.writeImports({writer:e,uniqueReferences:r}),this.statements.forEach((i,s)=>{i.write(e),e.newLine(),s<this.statements.length-1&&e.newLine()}),e.unsetRefNameOverrides()}updateWriterRefNameOverrides({writer:e,uniqueReferences:r}){let i=new Map(r),s={},o=this.getInitialUsedNames(),u=this.path.join("."),l=r.get(u);if(l){let{references:p}=l;p.forEach(d=>{let A=d.getFullyQualifiedModulePath(),R=d.name;s[A]={name:R,isAlias:!1},o.add(d.name)}),i.delete(u)}Array.from(i.values()).flatMap(({references:p})=>p).forEach(p=>{var N;if(p instanceof H)return;let d=(N=p.alias)!=null?N:p.name,A=p.getFullyQualifiedModulePath(),R=d,y=p.modulePath.length-1,v=!!p.alias;for(;o.has(R);){v=!0;let T=p.modulePath[y];y<0||!T?R=`_${R}`:R=`${ut(T)}${R}`,y--}o.add(R),s[A]={name:R,isAlias:v}}),e.setRefNameOverrides(s)}getInitialUsedNames(){let e=new Set;return this.statements.forEach(r=>{(r instanceof W||r instanceof z||r instanceof $)&&e.add(r.name)}),e}deduplicateReferences(){let e=new Map;for(let r of this.references){let i=r.name,s=r.getFullyQualifiedPath();if(s==="")continue;let o=e.get(s);o?o.referenceNames.has(i)||(o.references.push(r),o.referenceNames.add(i)):e.set(s,{modulePath:r.modulePath,references:[r],referenceNames:new Set([i])})}return e}writeComments(e){this.comments.forEach(r=>{r.write(e)}),this.comments.length>0&&e.newLine()}getImportName({writer:e,reference:r}){let i=e.getRefNameOverride(r),s=r.name,o=i.isAlias?i.name:void 0;return`${s}${o?` as ${o}`:""}`}writeImports({writer:e,uniqueReferences:r}){if(r.size!==0){for(let[i,{modulePath:s,references:o}]of r){let u=s;if(!this.isDefinedInFile(u)){if(u[0]===this.path[0]){let l=0;for(;l<this.path.length&&l<u.length&&this.path[l]===u[l];)l++;let m=this.path.length-l;this.isInitFile&&m++;let p=m>0?".".repeat(m):".";p+=u.slice(l).join("."),e.write(`from ${p} import ${o.map(d=>this.getImportName({writer:e,reference:d})).join(", ")}`)}else e.write(`from ${i} import ${o.map(l=>this.getImportName({writer:e,reference:l})).join(", ")}`);e.newLine()}}e.newLine()}}isDefinedInFile(e){return e.length===this.path.length&&e.every((r,i)=>r===this.path[i])}};c();f();var Ee=class extends x{constructor(e){super();h(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"int":e.write("int");break;case"float":e.write("float");break;case"bool":e.write("bool");break;case"str":e.write("str");break;case"bytes":e.write("bytes");break;case"list":e.write("List["),this.internalType.value.write(e),e.write("]");break;case"set":e.write("Set["),this.internalType.value.write(e),e.write("]");break;case"tuple":e.write("Tuple["),this.internalType.values.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]");break;case"dict":e.write("Dict["),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write("]");break;case"none":e.write("None");break;case"uuid":e.write("UUID");break;case"optional":e.write("Optional["),this.internalType.value.write(e),e.write("]");break;case"union":e.write("Union["),this.internalType.values.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]");break;case"any":e.write("Any");break;case"reference":this.internalType.value.write(e);break;case"datetime":e.write("datetime");break;case"literal":typeof this.internalType.value=="string"?e.write(`Literal["${this.internalType.value}"]`):e.write(`Literal[${this.internalType.value}]`);break;default:E(this.internalType)}}static int(){return new this({type:"int"})}static float(){return new this({type:"float"})}static bool(){return new this({type:"bool"})}static str(){return new this({type:"str"})}static bytes(){return new this({type:"bytes"})}static list(e){let r=new this({type:"list",value:e});return r.addReference(w.reference({name:"List",modulePath:["typing"]})),r.inheritReferences(e),r}static set(e){let r=new this({type:"set",value:e});return r.addReference(w.reference({name:"Set",modulePath:["typing"]})),r.inheritReferences(e),r}static tuple(e){let r=new this({type:"tuple",values:e});return r.addReference(w.reference({name:"Tuple",modulePath:["typing"]})),e.forEach(i=>r.inheritReferences(i)),r}static dict(e,r){let i=new this({type:"dict",keyType:e,valueType:r});return i.addReference(w.reference({name:"Dict",modulePath:["typing"]})),i.inheritReferences(e),i.inheritReferences(r),i}static none(){return new this({type:"none"})}static uuid(){let e=new this({type:"uuid"});return e.addReference(w.reference({name:"UUID",modulePath:["uuid"]})),e}static optional(e){if(this.isAlreadyOptional(e))return e;let r=new this({type:"optional",value:e});return r.addReference(w.reference({name:"Optional",modulePath:["typing"]})),r.inheritReferences(e),r}static union(e){let r=new this({type:"union",values:e});return r.addReference(w.reference({name:"Union",modulePath:["typing"]})),e.forEach(i=>r.inheritReferences(i)),r}static any(){let e=new this({type:"any"});return e.addReference(w.reference({name:"Any",modulePath:["typing"]})),e}static datetime(){let e=new this({type:"datetime"});return e.addReference(w.reference({name:"datetime",modulePath:["datetime"]})),e}static reference(e){let r=new this({type:"reference",value:e});return r.addReference(e),r}static literal(e){let r=new this({type:"literal",value:e});return r.addReference(w.reference({name:"Literal",modulePath:["typing"]})),r}static isAlreadyOptional(e){return e.internalType.type==="optional"}};c();f();var G=class n extends x{constructor(e){super();h(this,"internalType");this.internalType=e}static int(e){return new this({type:"int",value:e})}static float(e){return new this({type:"float",value:e})}static bool(e){return new this({type:"bool",value:e})}static str(e,r={multiline:!1,startOnNewLine:!1,endWithNewLine:!1}){return new this({type:"str",value:e,config:r})}static bytes(e){return new this({type:"bytes",value:e})}static list(e,r={endWithComma:!1}){let i=new this({type:"list",values:e,config:r});return e.forEach(s=>i.inheritReferences(s)),i}static set(e,r={endWithComma:!1}){let i=new this({type:"set",values:e,config:r});return e.forEach(s=>i.inheritReferences(s)),i}static tuple(e,r={endWithComma:!1}){let i=new this({type:"tuple",values:e,config:r});return e.forEach(s=>i.inheritReferences(s)),i}static typedDict(e,r={endWithComma:!1}){let i=new this({type:"typedDict",entries:e,config:r});return e.forEach(s=>i.inheritReferences(s.value)),i}static date(e){let r=new this({type:"date",value:e});return r.addReference(new L({name:"date",modulePath:["datetime"]})),r}static datetime(e){let r=new this({type:"datetime",value:e});return r.addReference(new L({name:"datetime",modulePath:["datetime"]})),r}static dict(e,r={endWithComma:!1}){let i=new this({type:"dict",entries:e,config:r});return e.forEach(s=>{i.inheritReferences(s.key),i.inheritReferences(s.value)}),i}static reference(e){let r=new this({type:"reference",value:e});return r.inheritReferences(e),r}static none(){return new this({type:"none"})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){let r=new this({type:"uuid",value:e});return r.addReference(new L({name:"UUID",modulePath:["uuid"]})),r}static nop(){return new this({type:"nop"})}static isNop(e){return e instanceof n&&e.internalType.type==="nop"}isTypedDict(){return this.internalType.type==="typedDict"}asTypedDictOrThrow(){if(this.isTypedDict())return this.internalType;throw new Error("Internal error; python.TypeInstantiation is not a TypedDict")}write(e){var r,i,s,o,u,l,m,p,d,A,R;switch(this.internalType.type){case"int":e.write(this.internalType.value.toString());break;case"float":e.write(this.internalType.value.toString());break;case"bool":this.internalType.value?e.write("True"):e.write("False");break;case"str":if((r=this.internalType.config)!=null&&r.multiline){let{startOnNewLine:y,endWithNewLine:v}=this.internalType.config;this.writeStringWithTripleQuotes({writer:e,value:this.internalType.value,startOnNewLine:y,endWithNewLine:v})}else e.write(`"${this.escapeString(this.internalType.value)}"`);break;case"date":e.write(`date.fromisoformat("${this.internalType.value}")`);break;case"datetime":e.write(`datetime.fromisoformat("${this.internalType.value}")`);break;case"bytes":e.write(`b"${this.internalType.value}"`);break;case"list":{let y=this.internalType,v=Ce({values:y.values});if(v.length===0){e.write("[]");break}e.write("["),(i=y.config)!=null&&i.multiline&&(e.newLine(),e.indent()),v.forEach((N,T)=>{var P,F;T>0&&(e.write(","),(P=y.config)!=null&&P.multiline?e.newLine():e.write(" ")),N.write(e),T===v.length-1&&((F=y.config)!=null&&F.endWithComma)&&e.write(",")}),(s=y.config)!=null&&s.multiline&&(e.newLine(),e.dedent()),e.write("]");break}case"set":{let y=this.internalType,v=Ce({values:y.values});if(v.length===0){e.write("{}");break}e.write("{"),(o=y.config)!=null&&o.multiline&&(e.newLine(),e.indent()),v.forEach((N,T)=>{var P,F;T>0&&(e.write(","),(P=y.config)!=null&&P.multiline?e.newLine():e.write(" ")),N.write(e),T===v.length-1&&((F=y.config)!=null&&F.endWithComma)&&e.write(",")}),(u=y.config)!=null&&u.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"tuple":{let y=this.internalType,v=Ce({values:y.values});if(v.length===0){e.write("()");break}e.write("("),(l=y.config)!=null&&l.multiline&&(e.newLine(),e.indent()),v.forEach((N,T)=>{var P,F;T>0&&(e.write(","),(P=y.config)!=null&&P.multiline?e.newLine():e.write(" ")),N.write(e),(v.length===1||T===v.length-1&&((F=y.config)!=null&&F.endWithComma))&&e.write(",")}),(m=y.config)!=null&&m.multiline&&(e.newLine(),e.dedent()),e.write(")");break}case"dict":{let y=this.internalType,v=xr({entries:y.entries});if(v.length===0){e.write("{}");break}e.write("{"),(p=y.config)!=null&&p.multiline&&(e.newLine(),e.indent()),v.forEach((N,T)=>{var P,F;T>0&&(e.write(","),(P=y.config)!=null&&P.multiline?e.newLine():e.write(" ")),N.key.write(e),e.write(": "),N.value.write(e),T===v.length-1&&((F=y.config)!=null&&F.endWithComma)&&e.write(",")}),(d=y.config)!=null&&d.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"typedDict":{let y=this.internalType,v=gr({entries:y.entries});if(v.length===0){e.write("{}");break}e.write("{"),(A=y.config)!=null&&A.multiline&&(e.writeLine(),e.indent()),v.forEach((N,T)=>{var P;T>0&&(e.write(","),(P=y.config)!=null&&P.multiline?e.newLine():e.write(" ")),e.write(`"${N.name}": `),N.value.write(e)}),(R=y.config)!=null&&R.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"reference":{this.internalType.value.write(e);break}case"none":e.write("None");break;case"unknown":this.writeUnknown({writer:e,value:this.internalType.value});break;case"uuid":e.write(`UUID("${this.internalType.value}")`);break;case"nop":break;default:E(this.internalType)}}writeStringWithTripleQuotes({writer:e,value:r,startOnNewLine:i,endWithNewLine:s}){var u;e.write('"""');let o=r.split(`
|
|
10
|
+
`);if(o.length<=1){e.write(this.escapeString((u=o[0])!=null?u:"")),e.write('"""');return}i&&e.writeNoIndent(`\\
|
|
11
|
+
`),o.forEach((l,m)=>{e.writeNoIndent(this.escapeString(l)),m===o.length-1?s&&e.writeNoIndent(`\\
|
|
12
|
+
`):e.writeNoIndent(`
|
|
13
|
+
`)}),e.writeNoIndent('"""')}escapeString(e){let r=new RegExp(`(?<!\\\\)(["'\\\\\\t\\n\\r])`,"g"),i={'"':'\\"',"'":"\\'","\\":"\\\\"," ":"\\t","\n":"\\n","\r":"\\r"};return e.replace(r,s=>{var o;return(o=i[s])!=null?o:s})}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r?"True":"False");return;case"string":e.write(`"${this.escapeString(r)}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("None");return}if(Array.isArray(r)){this.writeUnknownArray({writer:e,value:r});return}this.writeUnknownObject({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:e,value:r}){if(r.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of r)e.writeNode(n.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[s,o]of i)e.write(`"${s}": `),e.writeNode(n.unknown(o)),e.writeLine(",");e.dedent(),e.write("}")}};function xr({entries:n}){return n.filter(t=>!G.isNop(t.key)&&!G.isNop(t.value))}function gr({entries:n}){return n.filter(t=>!G.isNop(t.value))}function Ce({values:n}){return n.filter(t=>!G.isNop(t))}function Rr(n){return new te(n)}function vr(n){return new Te(n)}function Ar(n){return new le(n)}function Ir(n){return new W(n)}function Tr(n){return new ne(n)}function Er(n){return new se(n)}function Nr(n){return new L(n)}function Pr(n){return new H(n)}function Sr(n){return new $(n)}function Br(n){return new O(n)}function Lr(n){return new ie(n)}function Fr(n){return new oe(n)}function br(n){return new ae(n)}function kr(n){return new z(n)}function Cr(n){return new re(n)}function Ur(n){return new ce(n)}function _r(n){return new Q(n)}function Mr(n){return new ue(n)}function Dr(n){return new fe(n)}var qr={type:"primitive",value:"STRING"},Or=["example"],ct="client",Ue="request",_e=class{constructor({context:t}){h(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){return this.buildPythonFile({endpoint:t,snippet:e}).toString()}generateSnippetSync({endpoint:t,request:e}){return this.buildPythonFile({endpoint:t,snippet:e}).toString()}buildPythonFile({endpoint:t,snippet:e}){return w.file({path:Or,statements:[this.constructClient({endpoint:t,snippet:e}),this.callMethod({endpoint:t,snippet:e})]})}constructClient({endpoint:t,snippet:e}){return w.assign({lhs:w.reference({name:ct}),rhs:w.instantiateClass({classReference:this.context.getRootClientClassReference(),arguments_:this.getConstructorArgs({endpoint:t,snippet:e}).map(r=>w.methodArgument({name:r.name,value:r.value})),multiline:!0})})}getConstructorArgs({endpoint:t,snippet:e}){let r=[],i=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return i.length>0&&r.push(...i),t.auth!=null&&(e.auth!=null?r.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:_.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(k.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(k.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),r}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let r=this.getEnvironmentValue({baseUrl:t,environment:e});return r==null?[]:[{name:this.getEnvironmentOptionName({environment:e}),value:r}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:_.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return w.TypeInstantiation.str(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let r=this.context.getEnvironmentTypeReferenceFromID(e);if(r==null){this.context.errors.add({severity:_.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return w.TypeInstantiation.reference(r)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?w.TypeInstantiation.reference(w.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.entries(e).map(([r,i])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:qr,value:i})})).map(r=>w.methodArgument({name:r.name,value:r.value})),multiline:!0})):void 0}}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.context.errors.add({severity:_.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBasicAuthArg({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.context.errors.add({severity:_.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.context.errors.add({severity:_.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.context.errors.add({severity:_.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message}),[]):this.getConstructorOAuthArgs({auth:t,values:e});default:E(t)}}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:w.TypeInstantiation.str(e.username)},{name:this.context.getPropertyName(t.password),value:w.TypeInstantiation.str(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:w.TypeInstantiation.str(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorOAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.clientId),value:w.TypeInstantiation.str(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:w.TypeInstantiation.str(e.clientSecret)}]}getConstructorHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let s=this.getConstructorHeaderArg({header:i,value:e.value});s!=null&&r.push(s)}return r}getConstructorHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!w.TypeInstantiation.isNop(r))return{name:this.context.getPropertyName(t.name.name),value:r}}callMethod({endpoint:t,snippet:e}){return w.invokeMethod({on:w.reference({name:ct}),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}).map(r=>w.methodArgument({name:r.name,value:r.value})),multiline:!0})}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:E(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var s,o;let r=[];this.context.errors.scope(k.PathParameters);let i=[...(s=this.context.ir.pathParameters)!=null?s:[],...(o=t.pathParameters)!=null?o:[]];return i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(k.RequestBody),t.body!=null&&r.push(...this.getBodyRequestArgs({body:t.body,value:e.requestBody})),this.context.errors.unscope(),r}getBodyRequestArgs({body:t,value:e}){switch(t.type){case"bytes":return[{name:Ue,value:this.getBytesBodyRequestTypeInstantiation({value:e})}];case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:e});default:E(t)}}getBodyRequestArgsForTypeReference({typeReference:t,value:e}){switch(t.type){case"named":{let r=this.context.resolveNamedType({typeId:t.value});return r==null?[]:this.getBodyRequestArgsForNamedTypeReference({typeReference:t,named:r,value:e})}case"nullable":case"optional":return this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:e});case"list":case"map":case"set":case"literal":case"primitive":case"unknown":return[{name:Ue,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:e})}];default:E(t)}}getBodyRequestArgsForNamedTypeReference({typeReference:t,named:e,value:r}){var i;switch(e.type){case"alias":return this.getBodyRequestArgsForTypeReference({typeReference:e.typeReference,value:r});case"enum":case"discriminatedUnion":case"undiscriminatedUnion":return[{name:Ue,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:r})}];case"object":return this.context.associateByWireValue({parameters:e.properties,values:(i=this.context.getRecord(r))!=null?i:{}}).map(o=>({name:this.context.getPropertyName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)}));default:E(e)}}getBodyRequestArgsForBytes({body:t,value:e}){let r=this.getBytesBodyRequestTypeInstantiation({value:e});return w.TypeInstantiation.isNop(r)?[]:[{name:this.context.getPropertyName(t.bodyKey),value:r}]}getBytesBodyRequestTypeInstantiation({value:t}){return typeof t!="string"?(this.context.errors.add({severity:_.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),w.TypeInstantiation.nop()):w.TypeInstantiation.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){let r=[],i=this.context.shouldInlinePathParameters();this.context.errors.scope(k.PathParameters);let s=[];t.pathParameters!=null&&s.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(k.RequestBody);let o=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...s),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:!0})&&r.push(...this.getInlinedRequestArgs({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?s:[],filePropertyInfo:o})),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})}getInlinedRequestArgs({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:i}){var p,d,A,R;this.context.errors.scope(k.QueryParameters);let o=this.context.associateQueryParametersByWireValue({parameters:(p=t.queryParameters)!=null?p:[],values:(d=e.queryParameters)!=null?d:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(k.Headers);let l=this.context.associateByWireValue({parameters:(A=t.headers)!=null?A:[],values:(R=e.headers)!=null?R:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(k.RequestBody);let m=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),[...r,...o,...l,...m]}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return this.getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:e});case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:E(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:e}){let r=t.bodyType;switch(r.type){case"bytes":return this.getBodyRequestArgsForBytes({body:t,value:e});case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:r.value,value:e});default:E(r)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){var s;let r=[],i=this.context.associateByWireValue({parameters:t,values:(s=this.context.getRecord(e))!=null?s:{}});for(let o of i)r.push({name:this.context.getPropertyName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});return r}getPathParameters({namedParameters:t,snippet:e}){var s;let r=[],i=this.context.associateByWireValue({parameters:t,values:(s=e.pathParameters)!=null?s:{},ignoreMissingParameters:!0});for(let o of i)r.push({name:this.context.getPropertyName(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)}getEnvironmentOptionName({environment:t}){return t!=null?"environment":"base_url"}};0&&(module.exports={EndpointSnippetGenerator});
|
|
14
|
+
/*! Bundled license information:
|
|
15
|
+
|
|
16
|
+
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
17
|
+
(*!
|
|
18
|
+
* The buffer module from node.js, for the browser.
|
|
19
|
+
*
|
|
20
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
21
|
+
* @license MIT
|
|
22
|
+
*)
|
|
23
|
+
*/
|