@fern-api/python-dynamic-snippets 4.46.9 → 4.46.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var He=Object.defineProperty;var Si=Object.getOwnPropertyDescriptor;var Bi=Object.getOwnPropertyNames;var Pi=Object.prototype.hasOwnProperty;var Fi=(p,t,e)=>t in p?He(p,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):p[t]=e;var we=(p,t)=>()=>(p&&(t=p(p=0)),t);var dt=(p,t)=>{for(var e in t)He(p,e,{get:t[e],enumerable:!0})},Ci=(p,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Bi(t))!Pi.call(p,a)&&a!==e&&He(p,a,{get:()=>t[a],enumerable:!(i=Si(t,a))||i.enumerable});return p};var ki=p=>Ci(He({},"__esModule",{value:!0}),p);var y=(p,t,e)=>Fi(p,typeof t!="symbol"?t+"":t,e);var c=we(()=>{"use strict"});var w={};dt(w,{_debugEnd:()=>Tr,_debugProcess:()=>Er,_events:()=>Vr,_eventsCount:()=>$r,_exiting:()=>ir,_fatalExceptions:()=>wr,_getActiveHandles:()=>ur,_getActiveRequests:()=>sr,_kill:()=>lr,_linkedBinding:()=>rr,_maxListeners:()=>Dr,_preload_modules:()=>Mr,_rawDebug:()=>er,_startProfilerIdleNotifier:()=>Rr,_stopProfilerIdleNotifier:()=>Ar,_tickCallback:()=>br,abort:()=>Pr,addListener:()=>jr,allowedNodeEnvironmentFlags:()=>yr,arch:()=>Vt,argv:()=>Wt,argv0:()=>Ur,assert:()=>gr,binding:()=>Qt,browser:()=>Xt,chdir:()=>Jt,config:()=>or,cpuUsage:()=>Ze,cwd:()=>Zt,debugPort:()=>Lr,default:()=>Jr,dlopen:()=>ar,domain:()=>nr,emit:()=>Hr,emitWarning:()=>Ht,env:()=>jt,execArgv:()=>qt,execPath:()=>kr,exit:()=>mr,features:()=>xr,hasUncaughtExceptionCaptureCallback:()=>Ir,hrtime:()=>Ye,kill:()=>dr,listeners:()=>Zr,memoryUsage:()=>cr,moduleLoadList:()=>tr,nextTick:()=>Ot,off:()=>qr,on:()=>te,once:()=>Wr,openStdin:()=>hr,pid:()=>Fr,platform:()=>$t,ppid:()=>Cr,prependListener:()=>Qr,prependOnceListener:()=>Yr,reallyExit:()=>pr,release:()=>Kt,removeAllListeners:()=>zr,removeListener:()=>Gr,resourceUsage:()=>fr,setSourceMapsEnabled:()=>Or,setUncaughtExceptionCaptureCallback:()=>vr,stderr:()=>Sr,stdin:()=>Br,stdout:()=>Nr,title:()=>Dt,umask:()=>Yt,uptime:()=>_r,version:()=>Gt,versions:()=>zt});function yt(p){throw new Error("Node.js process "+p+" is not supported by JSPM core outside of Node.js")}function Li(){!ve||!de||(ve=!1,de.length?ee=de.concat(ee):Qe=-1,ee.length&&Mt())}function Mt(){if(!ve){var p=setTimeout(Li,0);ve=!0;for(var t=ee.length;t;){for(de=ee,ee=[];++Qe<t;)de&&de[Qe].run();Qe=-1,t=ee.length}de=null,ve=!1,clearTimeout(p)}}function Ot(p){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];ee.push(new _t(p,t)),ee.length===1&&!ve&&setTimeout(Mt,0)}function _t(p,t){this.fun=p,this.array=t}function j(){}function rr(p){yt("_linkedBinding")}function ar(p){yt("dlopen")}function sr(){return[]}function ur(){return[]}function gr(p,t){if(!p)throw new Error(t||"assertion error")}function Ir(){return!1}function _r(){return oe.now()/1e3}function Ye(p){var t=Math.floor((Date.now()-oe.now())*.001),e=oe.now()*.001,i=Math.floor(e)+t,a=Math.floor(e%1*1e9);return p&&(i=i-p[0],a=a-p[1],a<0&&(i--,a+=ht)),[i,a]}function te(){return Jr}function Zr(p){return[]}var ee,ve,de,Qe,Dt,Vt,$t,jt,Wt,qt,Gt,zt,Ht,Qt,Yt,Zt,Jt,Kt,Xt,er,tr,nr,ir,or,pr,lr,Ze,fr,cr,dr,mr,hr,yr,xr,wr,vr,br,Er,Tr,Rr,Ar,Nr,Sr,Br,Pr,Fr,Cr,kr,Lr,Ur,Mr,Or,oe,mt,ht,Dr,Vr,$r,jr,Wr,qr,Gr,zr,Hr,Qr,Yr,Jr,Kr=we(()=>{"use strict";c();m();d();ee=[],ve=!1,Qe=-1;_t.prototype.run=function(){this.fun.apply(null,this.array)};Dt="browser",Vt="x64",$t="browser",jt={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Wt=["/usr/bin/node"],qt=[],Gt="v16.8.0",zt={},Ht=function(p,t){console.warn((t?t+": ":"")+p)},Qt=function(p){yt("binding")},Yt=function(p){return 0},Zt=function(){return"/"},Jt=function(p){},Kt={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Xt=!0,er=j,tr=[];nr={},ir=!1,or={};pr=j,lr=j,Ze=function(){return{}},fr=Ze,cr=Ze,dr=j,mr=j,hr=j,yr={};xr={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},wr=j,vr=j;br=j,Er=j,Tr=j,Rr=j,Ar=j,Nr=void 0,Sr=void 0,Br=void 0,Pr=j,Fr=2,Cr=1,kr="/bin/usr/node",Lr=9229,Ur="node",Mr=[],Or=j,oe={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};oe.now===void 0&&(mt=Date.now(),oe.timing&&oe.timing.navigationStart&&(mt=oe.timing.navigationStart),oe.now=()=>Date.now()-mt);ht=1e9;Ye.bigint=function(p){var t=Ye(p);return typeof BigInt>"u"?t[0]*ht+t[1]:BigInt(t[0]*ht)+BigInt(t[1])};Dr=10,Vr={},$r=0;jr=te,Wr=te,qr=te,Gr=te,zr=te,Hr=j,Qr=te,Yr=te;Jr={version:Gt,versions:zt,arch:Vt,platform:$t,browser:Xt,release:Kt,_rawDebug:er,moduleLoadList:tr,binding:Qt,_linkedBinding:rr,_events:Vr,_eventsCount:$r,_maxListeners:Dr,on:te,addListener:jr,once:Wr,off:qr,removeListener:Gr,removeAllListeners:zr,emit:Hr,prependListener:Qr,prependOnceListener:Yr,listeners:Zr,domain:nr,_exiting:ir,config:or,dlopen:ar,uptime:_r,_getActiveRequests:sr,_getActiveHandles:ur,reallyExit:pr,_kill:lr,cpuUsage:Ze,resourceUsage:fr,memoryUsage:cr,kill:dr,exit:mr,openStdin:hr,allowedNodeEnvironmentFlags:yr,assert:gr,features:xr,_fatalExceptions:wr,setUncaughtExceptionCaptureCallback:vr,hasUncaughtExceptionCaptureCallback:Ir,emitWarning:Ht,nextTick:Ot,_tickCallback:br,_debugProcess:Er,_debugEnd:Tr,_startProfilerIdleNotifier:Rr,_stopProfilerIdleNotifier:Ar,stdout:Nr,stdin:Br,stderr:Sr,abort:Pr,umask:Yt,chdir:Jt,cwd:Zt,env:jt,title:Dt,argv:Wt,execArgv:qt,pid:Fr,ppid:Cr,execPath:kr,debugPort:Lr,hrtime:Ye,argv0:Ur,_preload_modules:Mr,setSourceMapsEnabled:Or}});var d=we(()=>{"use strict";Kr()});function Ui(){if(Xr)return Ue;Xr=!0,Ue.byteLength=E,Ue.toByteArray=A,Ue.fromByteArray=V;for(var p=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=i.length;a<l;++a)p[a]=i[a],t[i.charCodeAt(a)]=a;t[45]=62,t[95]=63;function s(T){var N=T.length;if(N%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=T.indexOf("=");k===-1&&(k=N);var M=k===N?0:4-k%4;return[k,M]}function E(T){var N=s(T),k=N[0],M=N[1];return(k+M)*3/4-M}function b(T,N,k){return(N+k)*3/4-k}function A(T){var N,k=s(T),M=k[0],q=k[1],D=new e(b(T,M,q)),G=0,H=q>0?M-4:M,W;for(W=0;W<H;W+=4)N=t[T.charCodeAt(W)]<<18|t[T.charCodeAt(W+1)]<<12|t[T.charCodeAt(W+2)]<<6|t[T.charCodeAt(W+3)],D[G++]=N>>16&255,D[G++]=N>>8&255,D[G++]=N&255;return q===2&&(N=t[T.charCodeAt(W)]<<2|t[T.charCodeAt(W+1)]>>4,D[G++]=N&255),q===1&&(N=t[T.charCodeAt(W)]<<10|t[T.charCodeAt(W+1)]<<4|t[T.charCodeAt(W+2)]>>2,D[G++]=N>>8&255,D[G++]=N&255),D}function R(T){return p[T>>18&63]+p[T>>12&63]+p[T>>6&63]+p[T&63]}function F(T,N,k){for(var M,q=[],D=N;D<k;D+=3)M=(T[D]<<16&16711680)+(T[D+1]<<8&65280)+(T[D+2]&255),q.push(R(M));return q.join("")}function V(T){for(var N,k=T.length,M=k%3,q=[],D=16383,G=0,H=k-M;G<H;G+=D)q.push(F(T,G,G+D>H?H:G+D));return M===1?(N=T[k-1],q.push(p[N>>2]+p[N<<4&63]+"==")):M===2&&(N=(T[k-2]<<8)+T[k-1],q.push(p[N>>10]+p[N>>4&63]+p[N<<2&63]+"=")),q.join("")}return Ue}function Mi(){if(en)return Je;en=!0;return Je.read=function(p,t,e,i,a){var l,s,E=a*8-i-1,b=(1<<E)-1,A=b>>1,R=-7,F=e?a-1:0,V=e?-1:1,T=p[t+F];for(F+=V,l=T&(1<<-R)-1,T>>=-R,R+=E;R>0;l=l*256+p[t+F],F+=V,R-=8);for(s=l&(1<<-R)-1,l>>=-R,R+=i;R>0;s=s*256+p[t+F],F+=V,R-=8);if(l===0)l=1-A;else{if(l===b)return s?NaN:(T?-1:1)*(1/0);s=s+Math.pow(2,i),l=l-A}return(T?-1:1)*s*Math.pow(2,l-i)},Je.write=function(p,t,e,i,a,l){var s,E,b,A=l*8-a-1,R=(1<<A)-1,F=R>>1,V=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:l-1,N=i?1:-1,k=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(E=isNaN(t)?1:0,s=R):(s=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-s))<1&&(s--,b*=2),s+F>=1?t+=V/b:t+=V*Math.pow(2,1-F),t*b>=2&&(s++,b/=2),s+F>=R?(E=0,s=R):s+F>=1?(E=(t*b-1)*Math.pow(2,a),s=s+F):(E=t*Math.pow(2,F-1)*Math.pow(2,a),s=0));a>=8;p[e+T]=E&255,T+=N,E/=256,a-=8);for(s=s<<a|E,A+=a;A>0;p[e+T]=s&255,T+=N,s/=256,A-=8);p[e+T-N]|=k*128},Je}function rn(){if(tn)return me;tn=!0;let p=Ui(),t=Mi(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;me.Buffer=s,me.SlowBuffer=q,me.INSPECT_MAX_BYTES=50;let i=2147483647;me.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let o=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(o,r),o.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function l(o){if(o>i)throw new RangeError('The value "'+o+'" is invalid for option "size"');let r=new Uint8Array(o);return Object.setPrototypeOf(r,s.prototype),r}function s(o,r,n){if(typeof o=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return R(o)}return E(o,r,n)}s.poolSize=8192;function E(o,r,n){if(typeof o=="string")return F(o,r);if(ArrayBuffer.isView(o))return T(o);if(o==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o);if(J(o,ArrayBuffer)||o&&J(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(J(o,SharedArrayBuffer)||o&&J(o.buffer,SharedArrayBuffer)))return N(o,r,n);if(typeof o=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let u=o.valueOf&&o.valueOf();if(u!=null&&u!==o)return s.from(u,r,n);let f=k(o);if(f)return f;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]=="function")return s.from(o[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o)}s.from=function(o,r,n){return E(o,r,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function b(o){if(typeof o!="number")throw new TypeError('"size" argument must be of type number');if(o<0)throw new RangeError('The value "'+o+'" is invalid for option "size"')}function A(o,r,n){return b(o),o<=0?l(o):r!==void 0?typeof n=="string"?l(o).fill(r,n):l(o).fill(r):l(o)}s.alloc=function(o,r,n){return A(o,r,n)};function R(o){return b(o),l(o<0?0:M(o)|0)}s.allocUnsafe=function(o){return R(o)},s.allocUnsafeSlow=function(o){return R(o)};function F(o,r){if((typeof r!="string"||r==="")&&(r="utf8"),!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let n=D(o,r)|0,u=l(n),f=u.write(o,r);return f!==n&&(u=u.slice(0,f)),u}function V(o){let r=o.length<0?0:M(o.length)|0,n=l(r);for(let u=0;u<r;u+=1)n[u]=o[u]&255;return n}function T(o){if(J(o,Uint8Array)){let r=new Uint8Array(o);return N(r.buffer,r.byteOffset,r.byteLength)}return V(o)}function N(o,r,n){if(r<0||o.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(o.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let u;return r===void 0&&n===void 0?u=new Uint8Array(o):n===void 0?u=new Uint8Array(o,r):u=new Uint8Array(o,r,n),Object.setPrototypeOf(u,s.prototype),u}function k(o){if(s.isBuffer(o)){let r=M(o.length)|0,n=l(r);return n.length===0||o.copy(n,0,0,r),n}if(o.length!==void 0)return typeof o.length!="number"||ct(o.length)?l(0):V(o);if(o.type==="Buffer"&&Array.isArray(o.data))return V(o.data)}function M(o){if(o>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return o|0}function q(o){return+o!=o&&(o=0),s.alloc(+o)}s.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==s.prototype},s.compare=function(r,n){if(J(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),J(n,Uint8Array)&&(n=s.from(n,n.offset,n.byteLength)),!s.isBuffer(r)||!s.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let u=r.length,f=n.length;for(let h=0,g=Math.min(u,f);h<g;++h)if(r[h]!==n[h]){u=r[h],f=n[h];break}return u<f?-1:f<u?1:0},s.isEncoding=function(r){switch(String(r).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(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);let u;if(n===void 0)for(n=0,u=0;u<r.length;++u)n+=r[u].length;let f=s.allocUnsafe(n),h=0;for(u=0;u<r.length;++u){let g=r[u];if(J(g,Uint8Array))h+g.length>f.length?(s.isBuffer(g)||(g=s.from(g)),g.copy(f,h)):Uint8Array.prototype.set.call(f,g,h);else if(s.isBuffer(g))g.copy(f,h);else throw new TypeError('"list" argument must be an Array of Buffers');h+=g.length}return f};function D(o,r){if(s.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||J(o,ArrayBuffer))return o.byteLength;if(typeof o!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof o);let n=o.length,u=arguments.length>2&&arguments[2]===!0;if(!u&&n===0)return 0;let f=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ft(o).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Ut(o).length;default:if(f)return u?-1:ft(o).length;r=(""+r).toLowerCase(),f=!0}}s.byteLength=D;function G(o,r,n){let u=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(o||(o="utf8");;)switch(o){case"hex":return wi(this,r,n);case"utf8":case"utf-8":return At(this,r,n);case"ascii":return gi(this,r,n);case"latin1":case"binary":return xi(this,r,n);case"base64":return hi(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vi(this,r,n);default:if(u)throw new TypeError("Unknown encoding: "+o);o=(o+"").toLowerCase(),u=!0}}s.prototype._isBuffer=!0;function H(o,r,n){let u=o[r];o[r]=o[n],o[n]=u}s.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<r;n+=2)H(this,n,n+1);return this},s.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<r;n+=4)H(this,n,n+3),H(this,n+1,n+2);return this},s.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<r;n+=8)H(this,n,n+7),H(this,n+1,n+6),H(this,n+2,n+5),H(this,n+3,n+4);return this},s.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?At(this,0,r):G.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(r){if(!s.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0},s.prototype.inspect=function(){let r="",n=me.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},e&&(s.prototype[e]=s.prototype.inspect),s.prototype.compare=function(r,n,u,f,h){if(J(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),u===void 0&&(u=r?r.length:0),f===void 0&&(f=0),h===void 0&&(h=this.length),n<0||u>r.length||f<0||h>this.length)throw new RangeError("out of range index");if(f>=h&&n>=u)return 0;if(f>=h)return-1;if(n>=u)return 1;if(n>>>=0,u>>>=0,f>>>=0,h>>>=0,this===r)return 0;let g=h-f,B=u-n,O=Math.min(g,B),U=this.slice(f,h),_=r.slice(n,u);for(let L=0;L<O;++L)if(U[L]!==_[L]){g=U[L],B=_[L];break}return g<B?-1:B<g?1:0};function W(o,r,n,u,f){if(o.length===0)return-1;if(typeof n=="string"?(u=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ct(n)&&(n=f?0:o.length-1),n<0&&(n=o.length+n),n>=o.length){if(f)return-1;n=o.length-1}else if(n<0)if(f)n=0;else return-1;if(typeof r=="string"&&(r=s.from(r,u)),s.isBuffer(r))return r.length===0?-1:Rt(o,r,n,u,f);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(o,r,n):Uint8Array.prototype.lastIndexOf.call(o,r,n):Rt(o,[r],n,u,f);throw new TypeError("val must be string, number or Buffer")}function Rt(o,r,n,u,f){let h=1,g=o.length,B=r.length;if(u!==void 0&&(u=String(u).toLowerCase(),u==="ucs2"||u==="ucs-2"||u==="utf16le"||u==="utf-16le")){if(o.length<2||r.length<2)return-1;h=2,g/=2,B/=2,n/=2}function O(_,L){return h===1?_[L]:_.readUInt16BE(L*h)}let U;if(f){let _=-1;for(U=n;U<g;U++)if(O(o,U)===O(r,_===-1?0:U-_)){if(_===-1&&(_=U),U-_+1===B)return _*h}else _!==-1&&(U-=U-_),_=-1}else for(n+B>g&&(n=g-B),U=n;U>=0;U--){let _=!0;for(let L=0;L<B;L++)if(O(o,U+L)!==O(r,L)){_=!1;break}if(_)return U}return-1}s.prototype.includes=function(r,n,u){return this.indexOf(r,n,u)!==-1},s.prototype.indexOf=function(r,n,u){return W(this,r,n,u,!0)},s.prototype.lastIndexOf=function(r,n,u){return W(this,r,n,u,!1)};function li(o,r,n,u){n=Number(n)||0;let f=o.length-n;u?(u=Number(u),u>f&&(u=f)):u=f;let h=r.length;u>h/2&&(u=h/2);let g;for(g=0;g<u;++g){let B=parseInt(r.substr(g*2,2),16);if(ct(B))return g;o[n+g]=B}return g}function fi(o,r,n,u){return ze(ft(r,o.length-n),o,n,u)}function ci(o,r,n,u){return ze(Ti(r),o,n,u)}function di(o,r,n,u){return ze(Ut(r),o,n,u)}function mi(o,r,n,u){return ze(Ri(r,o.length-n),o,n,u)}s.prototype.write=function(r,n,u,f){if(n===void 0)f="utf8",u=this.length,n=0;else if(u===void 0&&typeof n=="string")f=n,u=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(u)?(u=u>>>0,f===void 0&&(f="utf8")):(f=u,u=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-n;if((u===void 0||u>h)&&(u=h),r.length>0&&(u<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");let g=!1;for(;;)switch(f){case"hex":return li(this,r,n,u);case"utf8":case"utf-8":return fi(this,r,n,u);case"ascii":case"latin1":case"binary":return ci(this,r,n,u);case"base64":return di(this,r,n,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mi(this,r,n,u);default:if(g)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),g=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function hi(o,r,n){return r===0&&n===o.length?p.fromByteArray(o):p.fromByteArray(o.slice(r,n))}function At(o,r,n){n=Math.min(o.length,n);let u=[],f=r;for(;f<n;){let h=o[f],g=null,B=h>239?4:h>223?3:h>191?2:1;if(f+B<=n){let O,U,_,L;switch(B){case 1:h<128&&(g=h);break;case 2:O=o[f+1],(O&192)===128&&(L=(h&31)<<6|O&63,L>127&&(g=L));break;case 3:O=o[f+1],U=o[f+2],(O&192)===128&&(U&192)===128&&(L=(h&15)<<12|(O&63)<<6|U&63,L>2047&&(L<55296||L>57343)&&(g=L));break;case 4:O=o[f+1],U=o[f+2],_=o[f+3],(O&192)===128&&(U&192)===128&&(_&192)===128&&(L=(h&15)<<18|(O&63)<<12|(U&63)<<6|_&63,L>65535&&L<1114112&&(g=L))}}g===null?(g=65533,B=1):g>65535&&(g-=65536,u.push(g>>>10&1023|55296),g=56320|g&1023),u.push(g),f+=B}return yi(u)}let Nt=4096;function yi(o){let r=o.length;if(r<=Nt)return String.fromCharCode.apply(String,o);let n="",u=0;for(;u<r;)n+=String.fromCharCode.apply(String,o.slice(u,u+=Nt));return n}function gi(o,r,n){let u="";n=Math.min(o.length,n);for(let f=r;f<n;++f)u+=String.fromCharCode(o[f]&127);return u}function xi(o,r,n){let u="";n=Math.min(o.length,n);for(let f=r;f<n;++f)u+=String.fromCharCode(o[f]);return u}function wi(o,r,n){let u=o.length;(!r||r<0)&&(r=0),(!n||n<0||n>u)&&(n=u);let f="";for(let h=r;h<n;++h)f+=Ai[o[h]];return f}function vi(o,r,n){let u=o.slice(r,n),f="";for(let h=0;h<u.length-1;h+=2)f+=String.fromCharCode(u[h]+u[h+1]*256);return f}s.prototype.slice=function(r,n){let u=this.length;r=~~r,n=n===void 0?u:~~n,r<0?(r+=u,r<0&&(r=0)):r>u&&(r=u),n<0?(n+=u,n<0&&(n=0)):n>u&&(n=u),n<r&&(n=r);let f=this.subarray(r,n);return Object.setPrototypeOf(f,s.prototype),f};function $(o,r,n){if(o%1!==0||o<0)throw new RangeError("offset is not uint");if(o+r>n)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(r,n,u){r=r>>>0,n=n>>>0,u||$(r,n,this.length);let f=this[r],h=1,g=0;for(;++g<n&&(h*=256);)f+=this[r+g]*h;return f},s.prototype.readUintBE=s.prototype.readUIntBE=function(r,n,u){r=r>>>0,n=n>>>0,u||$(r,n,this.length);let f=this[r+--n],h=1;for(;n>0&&(h*=256);)f+=this[r+--n]*h;return f},s.prototype.readUint8=s.prototype.readUInt8=function(r,n){return r=r>>>0,n||$(r,1,this.length),this[r]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||$(r,2,this.length),this[r]|this[r+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||$(r,2,this.length),this[r]<<8|this[r+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||$(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||$(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},s.prototype.readBigUInt64LE=ie(function(r){r=r>>>0,xe(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&Le(r,this.length-8);let f=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,h=this[++r]+this[++r]*2**8+this[++r]*2**16+u*2**24;return BigInt(f)+(BigInt(h)<<BigInt(32))}),s.prototype.readBigUInt64BE=ie(function(r){r=r>>>0,xe(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&Le(r,this.length-8);let f=n*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],h=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+u;return(BigInt(f)<<BigInt(32))+BigInt(h)}),s.prototype.readIntLE=function(r,n,u){r=r>>>0,n=n>>>0,u||$(r,n,this.length);let f=this[r],h=1,g=0;for(;++g<n&&(h*=256);)f+=this[r+g]*h;return h*=128,f>=h&&(f-=Math.pow(2,8*n)),f},s.prototype.readIntBE=function(r,n,u){r=r>>>0,n=n>>>0,u||$(r,n,this.length);let f=n,h=1,g=this[r+--f];for(;f>0&&(h*=256);)g+=this[r+--f]*h;return h*=128,g>=h&&(g-=Math.pow(2,8*n)),g},s.prototype.readInt8=function(r,n){return r=r>>>0,n||$(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},s.prototype.readInt16LE=function(r,n){r=r>>>0,n||$(r,2,this.length);let u=this[r]|this[r+1]<<8;return u&32768?u|4294901760:u},s.prototype.readInt16BE=function(r,n){r=r>>>0,n||$(r,2,this.length);let u=this[r+1]|this[r]<<8;return u&32768?u|4294901760:u},s.prototype.readInt32LE=function(r,n){return r=r>>>0,n||$(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},s.prototype.readInt32BE=function(r,n){return r=r>>>0,n||$(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},s.prototype.readBigInt64LE=ie(function(r){r=r>>>0,xe(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&Le(r,this.length-8);let f=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(u<<24);return(BigInt(f)<<BigInt(32))+BigInt(n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),s.prototype.readBigInt64BE=ie(function(r){r=r>>>0,xe(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&Le(r,this.length-8);let f=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(f)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+u)}),s.prototype.readFloatLE=function(r,n){return r=r>>>0,n||$(r,4,this.length),t.read(this,r,!0,23,4)},s.prototype.readFloatBE=function(r,n){return r=r>>>0,n||$(r,4,this.length),t.read(this,r,!1,23,4)},s.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||$(r,8,this.length),t.read(this,r,!0,52,8)},s.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||$(r,8,this.length),t.read(this,r,!1,52,8)};function z(o,r,n,u,f,h){if(!s.isBuffer(o))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>f||r<h)throw new RangeError('"value" argument is out of bounds');if(n+u>o.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(r,n,u,f){if(r=+r,n=n>>>0,u=u>>>0,!f){let B=Math.pow(2,8*u)-1;z(this,r,n,u,B,0)}let h=1,g=0;for(this[n]=r&255;++g<u&&(h*=256);)this[n+g]=r/h&255;return n+u},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(r,n,u,f){if(r=+r,n=n>>>0,u=u>>>0,!f){let B=Math.pow(2,8*u)-1;z(this,r,n,u,B,0)}let h=u-1,g=1;for(this[n+h]=r&255;--h>=0&&(g*=256);)this[n+h]=r/g&255;return n+u},s.prototype.writeUint8=s.prototype.writeUInt8=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,1,255,0),this[n]=r&255,n+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4};function St(o,r,n,u,f){Lt(r,u,f,o,n,7);let h=Number(r&BigInt(4294967295));o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h;let g=Number(r>>BigInt(32)&BigInt(4294967295));return o[n++]=g,g=g>>8,o[n++]=g,g=g>>8,o[n++]=g,g=g>>8,o[n++]=g,n}function Bt(o,r,n,u,f){Lt(r,u,f,o,n,7);let h=Number(r&BigInt(4294967295));o[n+7]=h,h=h>>8,o[n+6]=h,h=h>>8,o[n+5]=h,h=h>>8,o[n+4]=h;let g=Number(r>>BigInt(32)&BigInt(4294967295));return o[n+3]=g,g=g>>8,o[n+2]=g,g=g>>8,o[n+1]=g,g=g>>8,o[n]=g,n+8}s.prototype.writeBigUInt64LE=ie(function(r,n=0){return St(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=ie(function(r,n=0){return Bt(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(r,n,u,f){if(r=+r,n=n>>>0,!f){let O=Math.pow(2,8*u-1);z(this,r,n,u,O-1,-O)}let h=0,g=1,B=0;for(this[n]=r&255;++h<u&&(g*=256);)r<0&&B===0&&this[n+h-1]!==0&&(B=1),this[n+h]=(r/g>>0)-B&255;return n+u},s.prototype.writeIntBE=function(r,n,u,f){if(r=+r,n=n>>>0,!f){let O=Math.pow(2,8*u-1);z(this,r,n,u,O-1,-O)}let h=u-1,g=1,B=0;for(this[n+h]=r&255;--h>=0&&(g*=256);)r<0&&B===0&&this[n+h+1]!==0&&(B=1),this[n+h]=(r/g>>0)-B&255;return n+u},s.prototype.writeInt8=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},s.prototype.writeInt16LE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},s.prototype.writeInt16BE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},s.prototype.writeInt32LE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},s.prototype.writeInt32BE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},s.prototype.writeBigInt64LE=ie(function(r,n=0){return St(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=ie(function(r,n=0){return Bt(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pt(o,r,n,u,f,h){if(n+u>o.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Ft(o,r,n,u,f){return r=+r,n=n>>>0,f||Pt(o,r,n,4),t.write(o,r,n,u,23,4),n+4}s.prototype.writeFloatLE=function(r,n,u){return Ft(this,r,n,!0,u)},s.prototype.writeFloatBE=function(r,n,u){return Ft(this,r,n,!1,u)};function Ct(o,r,n,u,f){return r=+r,n=n>>>0,f||Pt(o,r,n,8),t.write(o,r,n,u,52,8),n+8}s.prototype.writeDoubleLE=function(r,n,u){return Ct(this,r,n,!0,u)},s.prototype.writeDoubleBE=function(r,n,u){return Ct(this,r,n,!1,u)},s.prototype.copy=function(r,n,u,f){if(!s.isBuffer(r))throw new TypeError("argument should be a Buffer");if(u||(u=0),!f&&f!==0&&(f=this.length),n>=r.length&&(n=r.length),n||(n=0),f>0&&f<u&&(f=u),f===u||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(u<0||u>=this.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),r.length-n<f-u&&(f=r.length-n+u);let h=f-u;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,u,f):Uint8Array.prototype.set.call(r,this.subarray(u,f),n),h},s.prototype.fill=function(r,n,u,f){if(typeof r=="string"){if(typeof n=="string"?(f=n,n=0,u=this.length):typeof u=="string"&&(f=u,u=this.length),f!==void 0&&typeof f!="string")throw new TypeError("encoding must be a string");if(typeof f=="string"&&!s.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(r.length===1){let g=r.charCodeAt(0);(f==="utf8"&&g<128||f==="latin1")&&(r=g)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<u)throw new RangeError("Out of range index");if(u<=n)return this;n=n>>>0,u=u===void 0?this.length:u>>>0,r||(r=0);let h;if(typeof r=="number")for(h=n;h<u;++h)this[h]=r;else{let g=s.isBuffer(r)?r:s.from(r,f),B=g.length;if(B===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(h=0;h<u-n;++h)this[h+n]=g[h%B]}return this};let ge={};function lt(o,r,n){ge[o]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${o}]`,this.stack,delete this.name}get code(){return o}set code(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${o}]: ${this.message}`}}}lt("ERR_BUFFER_OUT_OF_BOUNDS",function(o){return o?`${o} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),lt("ERR_INVALID_ARG_TYPE",function(o,r){return`The "${o}" argument must be of type number. Received type ${typeof r}`},TypeError),lt("ERR_OUT_OF_RANGE",function(o,r,n){let u=`The value of "${o}" is out of range.`,f=n;return Number.isInteger(n)&&Math.abs(n)>2**32?f=kt(String(n)):typeof n=="bigint"&&(f=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(f=kt(f)),f+="n"),u+=` It must be ${r}. Received ${f}`,u},RangeError);function kt(o){let r="",n=o.length,u=o[0]==="-"?1:0;for(;n>=u+4;n-=3)r=`_${o.slice(n-3,n)}${r}`;return`${o.slice(0,n)}${r}`}function Ii(o,r,n){xe(r,"offset"),(o[r]===void 0||o[r+n]===void 0)&&Le(r,o.length-(n+1))}function Lt(o,r,n,u,f,h){if(o>n||o<r){let g=typeof r=="bigint"?"n":"",B;throw r===0||r===BigInt(0)?B=`>= 0${g} and < 2${g} ** ${(h+1)*8}${g}`:B=`>= -(2${g} ** ${(h+1)*8-1}${g}) and < 2 ** ${(h+1)*8-1}${g}`,new ge.ERR_OUT_OF_RANGE("value",B,o)}Ii(u,f,h)}function xe(o,r){if(typeof o!="number")throw new ge.ERR_INVALID_ARG_TYPE(r,"number",o)}function Le(o,r,n){throw Math.floor(o)!==o?(xe(o,n),new ge.ERR_OUT_OF_RANGE("offset","an integer",o)):r<0?new ge.ERR_BUFFER_OUT_OF_BOUNDS:new ge.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${r}`,o)}let bi=/[^+/0-9A-Za-z-_]/g;function Ei(o){if(o=o.split("=")[0],o=o.trim().replace(bi,""),o.length<2)return"";for(;o.length%4!==0;)o=o+"=";return o}function ft(o,r){r=r||1/0;let n,u=o.length,f=null,h=[];for(let g=0;g<u;++g){if(n=o.charCodeAt(g),n>55295&&n<57344){if(!f){if(n>56319){(r-=3)>-1&&h.push(239,191,189);continue}else if(g+1===u){(r-=3)>-1&&h.push(239,191,189);continue}f=n;continue}if(n<56320){(r-=3)>-1&&h.push(239,191,189),f=n;continue}n=(f-55296<<10|n-56320)+65536}else f&&(r-=3)>-1&&h.push(239,191,189);if(f=null,n<128){if((r-=1)<0)break;h.push(n)}else if(n<2048){if((r-=2)<0)break;h.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;h.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;h.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return h}function Ti(o){let r=[];for(let n=0;n<o.length;++n)r.push(o.charCodeAt(n)&255);return r}function Ri(o,r){let n,u,f,h=[];for(let g=0;g<o.length&&!((r-=2)<0);++g)n=o.charCodeAt(g),u=n>>8,f=n%256,h.push(f),h.push(u);return h}function Ut(o){return p.toByteArray(Ei(o))}function ze(o,r,n,u){let f;for(f=0;f<u&&!(f+n>=r.length||f>=o.length);++f)r[f+n]=o[f];return f}function J(o,r){return o instanceof r||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===r.name}function ct(o){return o!==o}let Ai=(function(){let o="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){let u=n*16;for(let f=0;f<16;++f)r[u+f]=o[n]+o[f]}return r})();function ie(o){return typeof BigInt>"u"?Ni:o}function Ni(){throw new Error("BigInt not supported")}return me}var Ue,Xr,Je,en,me,tn,nn=we(()=>{"use strict";c();m();d();Ue={},Xr=!1;Je={},en=!1;me={},tn=!1});var he,v,fs,cs,on=we(()=>{"use strict";c();m();d();nn();he=rn();he.Buffer;he.SlowBuffer;he.INSPECT_MAX_BYTES;he.kMaxLength;v=he.Buffer,fs=he.INSPECT_MAX_BYTES,cs=he.kMaxLength});var m=we(()=>{"use strict";on()});var Ka={};dt(Ka,{DynamicSnippetsGenerator:()=>pt});module.exports=ki(Ka);c();m();d();c();m();d();c();m();d();c();m();d();function C(p){throw new Error("Unexpected value: "+JSON.stringify(p))}c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();var Oi=typeof global=="object"&&global&&global.Object===Object&&global,an=Oi;var _i=typeof self=="object"&&self&&self.Object===Object&&self,Di=an||_i||Function("return this")(),sn=Di;var Vi=sn.Symbol,re=Vi;c();m();d();var un=Object.prototype,$i=un.hasOwnProperty,ji=un.toString,Me=re?re.toStringTag:void 0;function Wi(p){var t=$i.call(p,Me),e=p[Me];try{p[Me]=void 0;var i=!0}catch{}var a=ji.call(p);return i&&(t?p[Me]=e:delete p[Me]),a}var pn=Wi;c();m();d();var qi=Object.prototype,Gi=qi.toString;function zi(p){return Gi.call(p)}var ln=zi;var Hi="[object Null]",Qi="[object Undefined]",fn=re?re.toStringTag:void 0;function Yi(p){return p==null?p===void 0?Qi:Hi:fn&&fn in Object(p)?pn(p):ln(p)}var cn=Yi;c();m();d();function Zi(p){return p!=null&&typeof p=="object"}var dn=Zi;var Ji="[object Symbol]";function Ki(p){return typeof p=="symbol"||dn(p)&&cn(p)==Ji}var mn=Ki;c();m();d();c();m();d();function Xi(p,t){for(var e=-1,i=p==null?0:p.length,a=Array(i);++e<i;)a[e]=t(p[e],e,p);return a}var hn=Xi;c();m();d();var eo=Array.isArray,yn=eo;var to=1/0,gn=re?re.prototype:void 0,xn=gn?gn.toString:void 0;function wn(p){if(typeof p=="string")return p;if(yn(p))return hn(p,wn)+"";if(mn(p))return xn?xn.call(p):"";var t=p+"";return t=="0"&&1/p==-to?"-0":t}var vn=wn;c();m();d();function ro(p){return p==null?"":vn(p)}var ae=ro;c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();c();m();d();function no(p,t,e){var i=-1,a=p.length;t<0&&(t=-t>a?0:a+t),e=e>a?a:e,e<0&&(e+=a),a=t>e?0:e-t>>>0,t>>>=0;for(var l=Array(a);++i<a;)l[i]=p[i+t];return l}var In=no;function io(p,t,e){var i=p.length;return e=e===void 0?i:e,!t&&e>=i?p:In(p,t,e)}var bn=io;c();m();d();var oo="\\ud800-\\udfff",ao="\\u0300-\\u036f",so="\\ufe20-\\ufe2f",uo="\\u20d0-\\u20ff",po=ao+so+uo,lo="\\ufe0e\\ufe0f",fo="\\u200d",co=RegExp("["+fo+oo+po+lo+"]");function mo(p){return co.test(p)}var Ke=mo;c();m();d();c();m();d();function ho(p){return p.split("")}var En=ho;c();m();d();var Tn="\\ud800-\\udfff",yo="\\u0300-\\u036f",go="\\ufe20-\\ufe2f",xo="\\u20d0-\\u20ff",wo=yo+go+xo,vo="\\ufe0e\\ufe0f",Io="["+Tn+"]",gt="["+wo+"]",xt="\\ud83c[\\udffb-\\udfff]",bo="(?:"+gt+"|"+xt+")",Rn="[^"+Tn+"]",An="(?:\\ud83c[\\udde6-\\uddff]){2}",Nn="[\\ud800-\\udbff][\\udc00-\\udfff]",Eo="\\u200d",Sn=bo+"?",Bn="["+vo+"]?",To="(?:"+Eo+"(?:"+[Rn,An,Nn].join("|")+")"+Bn+Sn+")*",Ro=Bn+Sn+To,Ao="(?:"+[Rn+gt+"?",gt,An,Nn,Io].join("|")+")",No=RegExp(xt+"(?="+xt+")|"+Ao+Ro,"g");function So(p){return p.match(No)||[]}var Pn=So;function Bo(p){return Ke(p)?Pn(p):En(p)}var Fn=Bo;function Po(p){return function(t){t=ae(t);var e=Ke(t)?Fn(t):void 0,i=e?e[0]:t.charAt(0),a=e?bn(e,1).join(""):t.slice(1);return i[p]()+a}}var Cn=Po;var Fo=Cn("toUpperCase"),kn=Fo;function Co(p){return kn(ae(p).toLowerCase())}var Ln=Co;c();m();d();c();m();d();function ko(p,t,e,i){var a=-1,l=p==null?0:p.length;for(i&&l&&(e=p[++a]);++a<l;)e=t(e,p[a],a,p);return e}var Un=ko;c();m();d();c();m();d();c();m();d();function Lo(p){return function(t){return p?.[t]}}var Mn=Lo;var Uo={\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"},Mo=Mn(Uo),On=Mo;var Oo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_o="\\u0300-\\u036f",Do="\\ufe20-\\ufe2f",Vo="\\u20d0-\\u20ff",$o=_o+Do+Vo,jo="["+$o+"]",Wo=RegExp(jo,"g");function qo(p){return p=ae(p),p&&p.replace(Oo,On).replace(Wo,"")}var _n=qo;c();m();d();c();m();d();var Go=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function zo(p){return p.match(Go)||[]}var Dn=zo;c();m();d();var Ho=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Qo(p){return Ho.test(p)}var Vn=Qo;c();m();d();var Gn="\\ud800-\\udfff",Yo="\\u0300-\\u036f",Zo="\\ufe20-\\ufe2f",Jo="\\u20d0-\\u20ff",Ko=Yo+Zo+Jo,zn="\\u2700-\\u27bf",Hn="a-z\\xdf-\\xf6\\xf8-\\xff",Xo="\\xac\\xb1\\xd7\\xf7",ea="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ta="\\u2000-\\u206f",ra=" \\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",Qn="A-Z\\xc0-\\xd6\\xd8-\\xde",na="\\ufe0e\\ufe0f",Yn=Xo+ea+ta+ra,Zn="['\u2019]",$n="["+Yn+"]",ia="["+Ko+"]",Jn="\\d+",oa="["+zn+"]",Kn="["+Hn+"]",Xn="[^"+Gn+Yn+Jn+zn+Hn+Qn+"]",aa="\\ud83c[\\udffb-\\udfff]",sa="(?:"+ia+"|"+aa+")",ua="[^"+Gn+"]",ei="(?:\\ud83c[\\udde6-\\uddff]){2}",ti="[\\ud800-\\udbff][\\udc00-\\udfff]",Ie="["+Qn+"]",pa="\\u200d",jn="(?:"+Kn+"|"+Xn+")",la="(?:"+Ie+"|"+Xn+")",Wn="(?:"+Zn+"(?:d|ll|m|re|s|t|ve))?",qn="(?:"+Zn+"(?:D|LL|M|RE|S|T|VE))?",ri=sa+"?",ni="["+na+"]?",fa="(?:"+pa+"(?:"+[ua,ei,ti].join("|")+")"+ni+ri+")*",ca="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",da="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ma=ni+ri+fa,ha="(?:"+[oa,ei,ti].join("|")+")"+ma,ya=RegExp([Ie+"?"+Kn+"+"+Wn+"(?="+[$n,Ie,"$"].join("|")+")",la+"+"+qn+"(?="+[$n,Ie+jn,"$"].join("|")+")",Ie+"?"+jn+"+"+Wn,Ie+"+"+qn,da,ca,Jn,ha].join("|"),"g");function ga(p){return p.match(ya)||[]}var ii=ga;function xa(p,t,e){return p=ae(p),t=e?void 0:t,t===void 0?Vn(p)?ii(p):Dn(p):p.match(t)||[]}var oi=xa;var wa="['\u2019]",va=RegExp(wa,"g");function Ia(p){return function(t){return Un(oi(_n(t).replace(va,"")),p,"")}}var Xe=Ia;var ba=Xe(function(p,t,e){return t=t.toLowerCase(),p+(e?Ln(t):t)}),wt=ba;c();m();d();var Ea=Xe(function(p,t,e){return p+(e?"_":"")+t.toLowerCase()}),vt=Ea;c();m();d();function Oe(p){return Object.keys(p)}c();m();d();c();m();d();c();m();d();var _e=w.env.FERN_STACK_TRACK?.toLowerCase()??"",K=_e!==""&&_e!=="0"&&_e!=="false",It=["single","multiline","box"].includes(_e)?_e:"single";K&&(Error.stackTraceLimit=50);var Ta=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Ra=new Set(["stacktrace"]);function tt({maxFrames:p=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:a=[],filterNode:l=!0,filterJs:s=!0,formatFilename:E=b=>b}={}){if(!K)return[];i=[...i,...Ta],e=[...e,...Ra],a=[...a,"runInteractiveTask"];let b=!1;return(new Error().stack??"").split(`
|
|
1
|
+
"use strict";var He=Object.defineProperty;var Si=Object.getOwnPropertyDescriptor;var Bi=Object.getOwnPropertyNames;var Pi=Object.prototype.hasOwnProperty;var Fi=(p,t,e)=>t in p?He(p,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):p[t]=e;var we=(p,t)=>()=>(p&&(t=p(p=0)),t);var dt=(p,t)=>{for(var e in t)He(p,e,{get:t[e],enumerable:!0})},Ci=(p,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Bi(t))!Pi.call(p,a)&&a!==e&&He(p,a,{get:()=>t[a],enumerable:!(i=Si(t,a))||i.enumerable});return p};var ki=p=>Ci(He({},"__esModule",{value:!0}),p);var y=(p,t,e)=>Fi(p,typeof t!="symbol"?t+"":t,e);var f=we(()=>{"use strict"});var w={};dt(w,{_debugEnd:()=>Tr,_debugProcess:()=>Er,_events:()=>Vr,_eventsCount:()=>$r,_exiting:()=>ir,_fatalExceptions:()=>wr,_getActiveHandles:()=>ur,_getActiveRequests:()=>sr,_kill:()=>lr,_linkedBinding:()=>rr,_maxListeners:()=>Dr,_preload_modules:()=>Mr,_rawDebug:()=>er,_startProfilerIdleNotifier:()=>Rr,_stopProfilerIdleNotifier:()=>Ar,_tickCallback:()=>br,abort:()=>Pr,addListener:()=>jr,allowedNodeEnvironmentFlags:()=>yr,arch:()=>Vt,argv:()=>Wt,argv0:()=>Ur,assert:()=>gr,binding:()=>Qt,browser:()=>Xt,chdir:()=>Jt,config:()=>or,cpuUsage:()=>Ze,cwd:()=>Zt,debugPort:()=>Lr,default:()=>Jr,dlopen:()=>ar,domain:()=>nr,emit:()=>Hr,emitWarning:()=>Ht,env:()=>jt,execArgv:()=>qt,execPath:()=>kr,exit:()=>mr,features:()=>xr,hasUncaughtExceptionCaptureCallback:()=>Ir,hrtime:()=>Ye,kill:()=>dr,listeners:()=>Zr,memoryUsage:()=>fr,moduleLoadList:()=>tr,nextTick:()=>Ot,off:()=>qr,on:()=>te,once:()=>Wr,openStdin:()=>hr,pid:()=>Fr,platform:()=>$t,ppid:()=>Cr,prependListener:()=>Qr,prependOnceListener:()=>Yr,reallyExit:()=>pr,release:()=>Kt,removeAllListeners:()=>zr,removeListener:()=>Gr,resourceUsage:()=>cr,setSourceMapsEnabled:()=>Or,setUncaughtExceptionCaptureCallback:()=>vr,stderr:()=>Sr,stdin:()=>Br,stdout:()=>Nr,title:()=>Dt,umask:()=>Yt,uptime:()=>_r,version:()=>Gt,versions:()=>zt});function yt(p){throw new Error("Node.js process "+p+" is not supported by JSPM core outside of Node.js")}function Li(){!ve||!de||(ve=!1,de.length?ee=de.concat(ee):Qe=-1,ee.length&&Mt())}function Mt(){if(!ve){var p=setTimeout(Li,0);ve=!0;for(var t=ee.length;t;){for(de=ee,ee=[];++Qe<t;)de&&de[Qe].run();Qe=-1,t=ee.length}de=null,ve=!1,clearTimeout(p)}}function Ot(p){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];ee.push(new _t(p,t)),ee.length===1&&!ve&&setTimeout(Mt,0)}function _t(p,t){this.fun=p,this.array=t}function j(){}function rr(p){yt("_linkedBinding")}function ar(p){yt("dlopen")}function sr(){return[]}function ur(){return[]}function gr(p,t){if(!p)throw new Error(t||"assertion error")}function Ir(){return!1}function _r(){return oe.now()/1e3}function Ye(p){var t=Math.floor((Date.now()-oe.now())*.001),e=oe.now()*.001,i=Math.floor(e)+t,a=Math.floor(e%1*1e9);return p&&(i=i-p[0],a=a-p[1],a<0&&(i--,a+=ht)),[i,a]}function te(){return Jr}function Zr(p){return[]}var ee,ve,de,Qe,Dt,Vt,$t,jt,Wt,qt,Gt,zt,Ht,Qt,Yt,Zt,Jt,Kt,Xt,er,tr,nr,ir,or,pr,lr,Ze,cr,fr,dr,mr,hr,yr,xr,wr,vr,br,Er,Tr,Rr,Ar,Nr,Sr,Br,Pr,Fr,Cr,kr,Lr,Ur,Mr,Or,oe,mt,ht,Dr,Vr,$r,jr,Wr,qr,Gr,zr,Hr,Qr,Yr,Jr,Kr=we(()=>{"use strict";f();m();d();ee=[],ve=!1,Qe=-1;_t.prototype.run=function(){this.fun.apply(null,this.array)};Dt="browser",Vt="x64",$t="browser",jt={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Wt=["/usr/bin/node"],qt=[],Gt="v16.8.0",zt={},Ht=function(p,t){console.warn((t?t+": ":"")+p)},Qt=function(p){yt("binding")},Yt=function(p){return 0},Zt=function(){return"/"},Jt=function(p){},Kt={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Xt=!0,er=j,tr=[];nr={},ir=!1,or={};pr=j,lr=j,Ze=function(){return{}},cr=Ze,fr=Ze,dr=j,mr=j,hr=j,yr={};xr={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},wr=j,vr=j;br=j,Er=j,Tr=j,Rr=j,Ar=j,Nr=void 0,Sr=void 0,Br=void 0,Pr=j,Fr=2,Cr=1,kr="/bin/usr/node",Lr=9229,Ur="node",Mr=[],Or=j,oe={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};oe.now===void 0&&(mt=Date.now(),oe.timing&&oe.timing.navigationStart&&(mt=oe.timing.navigationStart),oe.now=()=>Date.now()-mt);ht=1e9;Ye.bigint=function(p){var t=Ye(p);return typeof BigInt>"u"?t[0]*ht+t[1]:BigInt(t[0]*ht)+BigInt(t[1])};Dr=10,Vr={},$r=0;jr=te,Wr=te,qr=te,Gr=te,zr=te,Hr=j,Qr=te,Yr=te;Jr={version:Gt,versions:zt,arch:Vt,platform:$t,browser:Xt,release:Kt,_rawDebug:er,moduleLoadList:tr,binding:Qt,_linkedBinding:rr,_events:Vr,_eventsCount:$r,_maxListeners:Dr,on:te,addListener:jr,once:Wr,off:qr,removeListener:Gr,removeAllListeners:zr,emit:Hr,prependListener:Qr,prependOnceListener:Yr,listeners:Zr,domain:nr,_exiting:ir,config:or,dlopen:ar,uptime:_r,_getActiveRequests:sr,_getActiveHandles:ur,reallyExit:pr,_kill:lr,cpuUsage:Ze,resourceUsage:cr,memoryUsage:fr,kill:dr,exit:mr,openStdin:hr,allowedNodeEnvironmentFlags:yr,assert:gr,features:xr,_fatalExceptions:wr,setUncaughtExceptionCaptureCallback:vr,hasUncaughtExceptionCaptureCallback:Ir,emitWarning:Ht,nextTick:Ot,_tickCallback:br,_debugProcess:Er,_debugEnd:Tr,_startProfilerIdleNotifier:Rr,_stopProfilerIdleNotifier:Ar,stdout:Nr,stdin:Br,stderr:Sr,abort:Pr,umask:Yt,chdir:Jt,cwd:Zt,env:jt,title:Dt,argv:Wt,execArgv:qt,pid:Fr,ppid:Cr,execPath:kr,debugPort:Lr,hrtime:Ye,argv0:Ur,_preload_modules:Mr,setSourceMapsEnabled:Or}});var d=we(()=>{"use strict";Kr()});function Ui(){if(Xr)return Ue;Xr=!0,Ue.byteLength=E,Ue.toByteArray=A,Ue.fromByteArray=V;for(var p=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=i.length;a<l;++a)p[a]=i[a],t[i.charCodeAt(a)]=a;t[45]=62,t[95]=63;function s(T){var N=T.length;if(N%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=T.indexOf("=");k===-1&&(k=N);var M=k===N?0:4-k%4;return[k,M]}function E(T){var N=s(T),k=N[0],M=N[1];return(k+M)*3/4-M}function b(T,N,k){return(N+k)*3/4-k}function A(T){var N,k=s(T),M=k[0],q=k[1],D=new e(b(T,M,q)),G=0,H=q>0?M-4:M,W;for(W=0;W<H;W+=4)N=t[T.charCodeAt(W)]<<18|t[T.charCodeAt(W+1)]<<12|t[T.charCodeAt(W+2)]<<6|t[T.charCodeAt(W+3)],D[G++]=N>>16&255,D[G++]=N>>8&255,D[G++]=N&255;return q===2&&(N=t[T.charCodeAt(W)]<<2|t[T.charCodeAt(W+1)]>>4,D[G++]=N&255),q===1&&(N=t[T.charCodeAt(W)]<<10|t[T.charCodeAt(W+1)]<<4|t[T.charCodeAt(W+2)]>>2,D[G++]=N>>8&255,D[G++]=N&255),D}function R(T){return p[T>>18&63]+p[T>>12&63]+p[T>>6&63]+p[T&63]}function F(T,N,k){for(var M,q=[],D=N;D<k;D+=3)M=(T[D]<<16&16711680)+(T[D+1]<<8&65280)+(T[D+2]&255),q.push(R(M));return q.join("")}function V(T){for(var N,k=T.length,M=k%3,q=[],D=16383,G=0,H=k-M;G<H;G+=D)q.push(F(T,G,G+D>H?H:G+D));return M===1?(N=T[k-1],q.push(p[N>>2]+p[N<<4&63]+"==")):M===2&&(N=(T[k-2]<<8)+T[k-1],q.push(p[N>>10]+p[N>>4&63]+p[N<<2&63]+"=")),q.join("")}return Ue}function Mi(){if(en)return Je;en=!0;return Je.read=function(p,t,e,i,a){var l,s,E=a*8-i-1,b=(1<<E)-1,A=b>>1,R=-7,F=e?a-1:0,V=e?-1:1,T=p[t+F];for(F+=V,l=T&(1<<-R)-1,T>>=-R,R+=E;R>0;l=l*256+p[t+F],F+=V,R-=8);for(s=l&(1<<-R)-1,l>>=-R,R+=i;R>0;s=s*256+p[t+F],F+=V,R-=8);if(l===0)l=1-A;else{if(l===b)return s?NaN:(T?-1:1)*(1/0);s=s+Math.pow(2,i),l=l-A}return(T?-1:1)*s*Math.pow(2,l-i)},Je.write=function(p,t,e,i,a,l){var s,E,b,A=l*8-a-1,R=(1<<A)-1,F=R>>1,V=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:l-1,N=i?1:-1,k=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(E=isNaN(t)?1:0,s=R):(s=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-s))<1&&(s--,b*=2),s+F>=1?t+=V/b:t+=V*Math.pow(2,1-F),t*b>=2&&(s++,b/=2),s+F>=R?(E=0,s=R):s+F>=1?(E=(t*b-1)*Math.pow(2,a),s=s+F):(E=t*Math.pow(2,F-1)*Math.pow(2,a),s=0));a>=8;p[e+T]=E&255,T+=N,E/=256,a-=8);for(s=s<<a|E,A+=a;A>0;p[e+T]=s&255,T+=N,s/=256,A-=8);p[e+T-N]|=k*128},Je}function rn(){if(tn)return me;tn=!0;let p=Ui(),t=Mi(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;me.Buffer=s,me.SlowBuffer=q,me.INSPECT_MAX_BYTES=50;let i=2147483647;me.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let o=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(o,r),o.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function l(o){if(o>i)throw new RangeError('The value "'+o+'" is invalid for option "size"');let r=new Uint8Array(o);return Object.setPrototypeOf(r,s.prototype),r}function s(o,r,n){if(typeof o=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return R(o)}return E(o,r,n)}s.poolSize=8192;function E(o,r,n){if(typeof o=="string")return F(o,r);if(ArrayBuffer.isView(o))return T(o);if(o==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o);if(J(o,ArrayBuffer)||o&&J(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(J(o,SharedArrayBuffer)||o&&J(o.buffer,SharedArrayBuffer)))return N(o,r,n);if(typeof o=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let u=o.valueOf&&o.valueOf();if(u!=null&&u!==o)return s.from(u,r,n);let c=k(o);if(c)return c;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]=="function")return s.from(o[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o)}s.from=function(o,r,n){return E(o,r,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function b(o){if(typeof o!="number")throw new TypeError('"size" argument must be of type number');if(o<0)throw new RangeError('The value "'+o+'" is invalid for option "size"')}function A(o,r,n){return b(o),o<=0?l(o):r!==void 0?typeof n=="string"?l(o).fill(r,n):l(o).fill(r):l(o)}s.alloc=function(o,r,n){return A(o,r,n)};function R(o){return b(o),l(o<0?0:M(o)|0)}s.allocUnsafe=function(o){return R(o)},s.allocUnsafeSlow=function(o){return R(o)};function F(o,r){if((typeof r!="string"||r==="")&&(r="utf8"),!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let n=D(o,r)|0,u=l(n),c=u.write(o,r);return c!==n&&(u=u.slice(0,c)),u}function V(o){let r=o.length<0?0:M(o.length)|0,n=l(r);for(let u=0;u<r;u+=1)n[u]=o[u]&255;return n}function T(o){if(J(o,Uint8Array)){let r=new Uint8Array(o);return N(r.buffer,r.byteOffset,r.byteLength)}return V(o)}function N(o,r,n){if(r<0||o.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(o.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let u;return r===void 0&&n===void 0?u=new Uint8Array(o):n===void 0?u=new Uint8Array(o,r):u=new Uint8Array(o,r,n),Object.setPrototypeOf(u,s.prototype),u}function k(o){if(s.isBuffer(o)){let r=M(o.length)|0,n=l(r);return n.length===0||o.copy(n,0,0,r),n}if(o.length!==void 0)return typeof o.length!="number"||ft(o.length)?l(0):V(o);if(o.type==="Buffer"&&Array.isArray(o.data))return V(o.data)}function M(o){if(o>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return o|0}function q(o){return+o!=o&&(o=0),s.alloc(+o)}s.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==s.prototype},s.compare=function(r,n){if(J(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),J(n,Uint8Array)&&(n=s.from(n,n.offset,n.byteLength)),!s.isBuffer(r)||!s.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let u=r.length,c=n.length;for(let h=0,g=Math.min(u,c);h<g;++h)if(r[h]!==n[h]){u=r[h],c=n[h];break}return u<c?-1:c<u?1:0},s.isEncoding=function(r){switch(String(r).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(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);let u;if(n===void 0)for(n=0,u=0;u<r.length;++u)n+=r[u].length;let c=s.allocUnsafe(n),h=0;for(u=0;u<r.length;++u){let g=r[u];if(J(g,Uint8Array))h+g.length>c.length?(s.isBuffer(g)||(g=s.from(g)),g.copy(c,h)):Uint8Array.prototype.set.call(c,g,h);else if(s.isBuffer(g))g.copy(c,h);else throw new TypeError('"list" argument must be an Array of Buffers');h+=g.length}return c};function D(o,r){if(s.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||J(o,ArrayBuffer))return o.byteLength;if(typeof o!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof o);let n=o.length,u=arguments.length>2&&arguments[2]===!0;if(!u&&n===0)return 0;let c=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ct(o).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Ut(o).length;default:if(c)return u?-1:ct(o).length;r=(""+r).toLowerCase(),c=!0}}s.byteLength=D;function G(o,r,n){let u=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(o||(o="utf8");;)switch(o){case"hex":return wi(this,r,n);case"utf8":case"utf-8":return At(this,r,n);case"ascii":return gi(this,r,n);case"latin1":case"binary":return xi(this,r,n);case"base64":return hi(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vi(this,r,n);default:if(u)throw new TypeError("Unknown encoding: "+o);o=(o+"").toLowerCase(),u=!0}}s.prototype._isBuffer=!0;function H(o,r,n){let u=o[r];o[r]=o[n],o[n]=u}s.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<r;n+=2)H(this,n,n+1);return this},s.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<r;n+=4)H(this,n,n+3),H(this,n+1,n+2);return this},s.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<r;n+=8)H(this,n,n+7),H(this,n+1,n+6),H(this,n+2,n+5),H(this,n+3,n+4);return this},s.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?At(this,0,r):G.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(r){if(!s.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0},s.prototype.inspect=function(){let r="",n=me.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},e&&(s.prototype[e]=s.prototype.inspect),s.prototype.compare=function(r,n,u,c,h){if(J(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),u===void 0&&(u=r?r.length:0),c===void 0&&(c=0),h===void 0&&(h=this.length),n<0||u>r.length||c<0||h>this.length)throw new RangeError("out of range index");if(c>=h&&n>=u)return 0;if(c>=h)return-1;if(n>=u)return 1;if(n>>>=0,u>>>=0,c>>>=0,h>>>=0,this===r)return 0;let g=h-c,B=u-n,O=Math.min(g,B),U=this.slice(c,h),_=r.slice(n,u);for(let L=0;L<O;++L)if(U[L]!==_[L]){g=U[L],B=_[L];break}return g<B?-1:B<g?1:0};function W(o,r,n,u,c){if(o.length===0)return-1;if(typeof n=="string"?(u=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ft(n)&&(n=c?0:o.length-1),n<0&&(n=o.length+n),n>=o.length){if(c)return-1;n=o.length-1}else if(n<0)if(c)n=0;else return-1;if(typeof r=="string"&&(r=s.from(r,u)),s.isBuffer(r))return r.length===0?-1:Rt(o,r,n,u,c);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?c?Uint8Array.prototype.indexOf.call(o,r,n):Uint8Array.prototype.lastIndexOf.call(o,r,n):Rt(o,[r],n,u,c);throw new TypeError("val must be string, number or Buffer")}function Rt(o,r,n,u,c){let h=1,g=o.length,B=r.length;if(u!==void 0&&(u=String(u).toLowerCase(),u==="ucs2"||u==="ucs-2"||u==="utf16le"||u==="utf-16le")){if(o.length<2||r.length<2)return-1;h=2,g/=2,B/=2,n/=2}function O(_,L){return h===1?_[L]:_.readUInt16BE(L*h)}let U;if(c){let _=-1;for(U=n;U<g;U++)if(O(o,U)===O(r,_===-1?0:U-_)){if(_===-1&&(_=U),U-_+1===B)return _*h}else _!==-1&&(U-=U-_),_=-1}else for(n+B>g&&(n=g-B),U=n;U>=0;U--){let _=!0;for(let L=0;L<B;L++)if(O(o,U+L)!==O(r,L)){_=!1;break}if(_)return U}return-1}s.prototype.includes=function(r,n,u){return this.indexOf(r,n,u)!==-1},s.prototype.indexOf=function(r,n,u){return W(this,r,n,u,!0)},s.prototype.lastIndexOf=function(r,n,u){return W(this,r,n,u,!1)};function li(o,r,n,u){n=Number(n)||0;let c=o.length-n;u?(u=Number(u),u>c&&(u=c)):u=c;let h=r.length;u>h/2&&(u=h/2);let g;for(g=0;g<u;++g){let B=parseInt(r.substr(g*2,2),16);if(ft(B))return g;o[n+g]=B}return g}function ci(o,r,n,u){return ze(ct(r,o.length-n),o,n,u)}function fi(o,r,n,u){return ze(Ti(r),o,n,u)}function di(o,r,n,u){return ze(Ut(r),o,n,u)}function mi(o,r,n,u){return ze(Ri(r,o.length-n),o,n,u)}s.prototype.write=function(r,n,u,c){if(n===void 0)c="utf8",u=this.length,n=0;else if(u===void 0&&typeof n=="string")c=n,u=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(u)?(u=u>>>0,c===void 0&&(c="utf8")):(c=u,u=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-n;if((u===void 0||u>h)&&(u=h),r.length>0&&(u<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");let g=!1;for(;;)switch(c){case"hex":return li(this,r,n,u);case"utf8":case"utf-8":return ci(this,r,n,u);case"ascii":case"latin1":case"binary":return fi(this,r,n,u);case"base64":return di(this,r,n,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mi(this,r,n,u);default:if(g)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),g=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function hi(o,r,n){return r===0&&n===o.length?p.fromByteArray(o):p.fromByteArray(o.slice(r,n))}function At(o,r,n){n=Math.min(o.length,n);let u=[],c=r;for(;c<n;){let h=o[c],g=null,B=h>239?4:h>223?3:h>191?2:1;if(c+B<=n){let O,U,_,L;switch(B){case 1:h<128&&(g=h);break;case 2:O=o[c+1],(O&192)===128&&(L=(h&31)<<6|O&63,L>127&&(g=L));break;case 3:O=o[c+1],U=o[c+2],(O&192)===128&&(U&192)===128&&(L=(h&15)<<12|(O&63)<<6|U&63,L>2047&&(L<55296||L>57343)&&(g=L));break;case 4:O=o[c+1],U=o[c+2],_=o[c+3],(O&192)===128&&(U&192)===128&&(_&192)===128&&(L=(h&15)<<18|(O&63)<<12|(U&63)<<6|_&63,L>65535&&L<1114112&&(g=L))}}g===null?(g=65533,B=1):g>65535&&(g-=65536,u.push(g>>>10&1023|55296),g=56320|g&1023),u.push(g),c+=B}return yi(u)}let Nt=4096;function yi(o){let r=o.length;if(r<=Nt)return String.fromCharCode.apply(String,o);let n="",u=0;for(;u<r;)n+=String.fromCharCode.apply(String,o.slice(u,u+=Nt));return n}function gi(o,r,n){let u="";n=Math.min(o.length,n);for(let c=r;c<n;++c)u+=String.fromCharCode(o[c]&127);return u}function xi(o,r,n){let u="";n=Math.min(o.length,n);for(let c=r;c<n;++c)u+=String.fromCharCode(o[c]);return u}function wi(o,r,n){let u=o.length;(!r||r<0)&&(r=0),(!n||n<0||n>u)&&(n=u);let c="";for(let h=r;h<n;++h)c+=Ai[o[h]];return c}function vi(o,r,n){let u=o.slice(r,n),c="";for(let h=0;h<u.length-1;h+=2)c+=String.fromCharCode(u[h]+u[h+1]*256);return c}s.prototype.slice=function(r,n){let u=this.length;r=~~r,n=n===void 0?u:~~n,r<0?(r+=u,r<0&&(r=0)):r>u&&(r=u),n<0?(n+=u,n<0&&(n=0)):n>u&&(n=u),n<r&&(n=r);let c=this.subarray(r,n);return Object.setPrototypeOf(c,s.prototype),c};function $(o,r,n){if(o%1!==0||o<0)throw new RangeError("offset is not uint");if(o+r>n)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(r,n,u){r=r>>>0,n=n>>>0,u||$(r,n,this.length);let c=this[r],h=1,g=0;for(;++g<n&&(h*=256);)c+=this[r+g]*h;return c},s.prototype.readUintBE=s.prototype.readUIntBE=function(r,n,u){r=r>>>0,n=n>>>0,u||$(r,n,this.length);let c=this[r+--n],h=1;for(;n>0&&(h*=256);)c+=this[r+--n]*h;return c},s.prototype.readUint8=s.prototype.readUInt8=function(r,n){return r=r>>>0,n||$(r,1,this.length),this[r]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||$(r,2,this.length),this[r]|this[r+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||$(r,2,this.length),this[r]<<8|this[r+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||$(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||$(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},s.prototype.readBigUInt64LE=ie(function(r){r=r>>>0,xe(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&Le(r,this.length-8);let c=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,h=this[++r]+this[++r]*2**8+this[++r]*2**16+u*2**24;return BigInt(c)+(BigInt(h)<<BigInt(32))}),s.prototype.readBigUInt64BE=ie(function(r){r=r>>>0,xe(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&Le(r,this.length-8);let c=n*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],h=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+u;return(BigInt(c)<<BigInt(32))+BigInt(h)}),s.prototype.readIntLE=function(r,n,u){r=r>>>0,n=n>>>0,u||$(r,n,this.length);let c=this[r],h=1,g=0;for(;++g<n&&(h*=256);)c+=this[r+g]*h;return h*=128,c>=h&&(c-=Math.pow(2,8*n)),c},s.prototype.readIntBE=function(r,n,u){r=r>>>0,n=n>>>0,u||$(r,n,this.length);let c=n,h=1,g=this[r+--c];for(;c>0&&(h*=256);)g+=this[r+--c]*h;return h*=128,g>=h&&(g-=Math.pow(2,8*n)),g},s.prototype.readInt8=function(r,n){return r=r>>>0,n||$(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},s.prototype.readInt16LE=function(r,n){r=r>>>0,n||$(r,2,this.length);let u=this[r]|this[r+1]<<8;return u&32768?u|4294901760:u},s.prototype.readInt16BE=function(r,n){r=r>>>0,n||$(r,2,this.length);let u=this[r+1]|this[r]<<8;return u&32768?u|4294901760:u},s.prototype.readInt32LE=function(r,n){return r=r>>>0,n||$(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},s.prototype.readInt32BE=function(r,n){return r=r>>>0,n||$(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},s.prototype.readBigInt64LE=ie(function(r){r=r>>>0,xe(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&Le(r,this.length-8);let c=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(u<<24);return(BigInt(c)<<BigInt(32))+BigInt(n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),s.prototype.readBigInt64BE=ie(function(r){r=r>>>0,xe(r,"offset");let n=this[r],u=this[r+7];(n===void 0||u===void 0)&&Le(r,this.length-8);let c=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(c)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+u)}),s.prototype.readFloatLE=function(r,n){return r=r>>>0,n||$(r,4,this.length),t.read(this,r,!0,23,4)},s.prototype.readFloatBE=function(r,n){return r=r>>>0,n||$(r,4,this.length),t.read(this,r,!1,23,4)},s.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||$(r,8,this.length),t.read(this,r,!0,52,8)},s.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||$(r,8,this.length),t.read(this,r,!1,52,8)};function z(o,r,n,u,c,h){if(!s.isBuffer(o))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>c||r<h)throw new RangeError('"value" argument is out of bounds');if(n+u>o.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(r,n,u,c){if(r=+r,n=n>>>0,u=u>>>0,!c){let B=Math.pow(2,8*u)-1;z(this,r,n,u,B,0)}let h=1,g=0;for(this[n]=r&255;++g<u&&(h*=256);)this[n+g]=r/h&255;return n+u},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(r,n,u,c){if(r=+r,n=n>>>0,u=u>>>0,!c){let B=Math.pow(2,8*u)-1;z(this,r,n,u,B,0)}let h=u-1,g=1;for(this[n+h]=r&255;--h>=0&&(g*=256);)this[n+h]=r/g&255;return n+u},s.prototype.writeUint8=s.prototype.writeUInt8=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,1,255,0),this[n]=r&255,n+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4};function St(o,r,n,u,c){Lt(r,u,c,o,n,7);let h=Number(r&BigInt(4294967295));o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h;let g=Number(r>>BigInt(32)&BigInt(4294967295));return o[n++]=g,g=g>>8,o[n++]=g,g=g>>8,o[n++]=g,g=g>>8,o[n++]=g,n}function Bt(o,r,n,u,c){Lt(r,u,c,o,n,7);let h=Number(r&BigInt(4294967295));o[n+7]=h,h=h>>8,o[n+6]=h,h=h>>8,o[n+5]=h,h=h>>8,o[n+4]=h;let g=Number(r>>BigInt(32)&BigInt(4294967295));return o[n+3]=g,g=g>>8,o[n+2]=g,g=g>>8,o[n+1]=g,g=g>>8,o[n]=g,n+8}s.prototype.writeBigUInt64LE=ie(function(r,n=0){return St(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=ie(function(r,n=0){return Bt(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(r,n,u,c){if(r=+r,n=n>>>0,!c){let O=Math.pow(2,8*u-1);z(this,r,n,u,O-1,-O)}let h=0,g=1,B=0;for(this[n]=r&255;++h<u&&(g*=256);)r<0&&B===0&&this[n+h-1]!==0&&(B=1),this[n+h]=(r/g>>0)-B&255;return n+u},s.prototype.writeIntBE=function(r,n,u,c){if(r=+r,n=n>>>0,!c){let O=Math.pow(2,8*u-1);z(this,r,n,u,O-1,-O)}let h=u-1,g=1,B=0;for(this[n+h]=r&255;--h>=0&&(g*=256);)r<0&&B===0&&this[n+h+1]!==0&&(B=1),this[n+h]=(r/g>>0)-B&255;return n+u},s.prototype.writeInt8=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},s.prototype.writeInt16LE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},s.prototype.writeInt16BE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},s.prototype.writeInt32LE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},s.prototype.writeInt32BE=function(r,n,u){return r=+r,n=n>>>0,u||z(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},s.prototype.writeBigInt64LE=ie(function(r,n=0){return St(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=ie(function(r,n=0){return Bt(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pt(o,r,n,u,c,h){if(n+u>o.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Ft(o,r,n,u,c){return r=+r,n=n>>>0,c||Pt(o,r,n,4),t.write(o,r,n,u,23,4),n+4}s.prototype.writeFloatLE=function(r,n,u){return Ft(this,r,n,!0,u)},s.prototype.writeFloatBE=function(r,n,u){return Ft(this,r,n,!1,u)};function Ct(o,r,n,u,c){return r=+r,n=n>>>0,c||Pt(o,r,n,8),t.write(o,r,n,u,52,8),n+8}s.prototype.writeDoubleLE=function(r,n,u){return Ct(this,r,n,!0,u)},s.prototype.writeDoubleBE=function(r,n,u){return Ct(this,r,n,!1,u)},s.prototype.copy=function(r,n,u,c){if(!s.isBuffer(r))throw new TypeError("argument should be a Buffer");if(u||(u=0),!c&&c!==0&&(c=this.length),n>=r.length&&(n=r.length),n||(n=0),c>0&&c<u&&(c=u),c===u||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(u<0||u>=this.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),r.length-n<c-u&&(c=r.length-n+u);let h=c-u;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,u,c):Uint8Array.prototype.set.call(r,this.subarray(u,c),n),h},s.prototype.fill=function(r,n,u,c){if(typeof r=="string"){if(typeof n=="string"?(c=n,n=0,u=this.length):typeof u=="string"&&(c=u,u=this.length),c!==void 0&&typeof c!="string")throw new TypeError("encoding must be a string");if(typeof c=="string"&&!s.isEncoding(c))throw new TypeError("Unknown encoding: "+c);if(r.length===1){let g=r.charCodeAt(0);(c==="utf8"&&g<128||c==="latin1")&&(r=g)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<u)throw new RangeError("Out of range index");if(u<=n)return this;n=n>>>0,u=u===void 0?this.length:u>>>0,r||(r=0);let h;if(typeof r=="number")for(h=n;h<u;++h)this[h]=r;else{let g=s.isBuffer(r)?r:s.from(r,c),B=g.length;if(B===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(h=0;h<u-n;++h)this[h+n]=g[h%B]}return this};let ge={};function lt(o,r,n){ge[o]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${o}]`,this.stack,delete this.name}get code(){return o}set code(c){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:c,writable:!0})}toString(){return`${this.name} [${o}]: ${this.message}`}}}lt("ERR_BUFFER_OUT_OF_BOUNDS",function(o){return o?`${o} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),lt("ERR_INVALID_ARG_TYPE",function(o,r){return`The "${o}" argument must be of type number. Received type ${typeof r}`},TypeError),lt("ERR_OUT_OF_RANGE",function(o,r,n){let u=`The value of "${o}" is out of range.`,c=n;return Number.isInteger(n)&&Math.abs(n)>2**32?c=kt(String(n)):typeof n=="bigint"&&(c=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(c=kt(c)),c+="n"),u+=` It must be ${r}. Received ${c}`,u},RangeError);function kt(o){let r="",n=o.length,u=o[0]==="-"?1:0;for(;n>=u+4;n-=3)r=`_${o.slice(n-3,n)}${r}`;return`${o.slice(0,n)}${r}`}function Ii(o,r,n){xe(r,"offset"),(o[r]===void 0||o[r+n]===void 0)&&Le(r,o.length-(n+1))}function Lt(o,r,n,u,c,h){if(o>n||o<r){let g=typeof r=="bigint"?"n":"",B;throw r===0||r===BigInt(0)?B=`>= 0${g} and < 2${g} ** ${(h+1)*8}${g}`:B=`>= -(2${g} ** ${(h+1)*8-1}${g}) and < 2 ** ${(h+1)*8-1}${g}`,new ge.ERR_OUT_OF_RANGE("value",B,o)}Ii(u,c,h)}function xe(o,r){if(typeof o!="number")throw new ge.ERR_INVALID_ARG_TYPE(r,"number",o)}function Le(o,r,n){throw Math.floor(o)!==o?(xe(o,n),new ge.ERR_OUT_OF_RANGE("offset","an integer",o)):r<0?new ge.ERR_BUFFER_OUT_OF_BOUNDS:new ge.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${r}`,o)}let bi=/[^+/0-9A-Za-z-_]/g;function Ei(o){if(o=o.split("=")[0],o=o.trim().replace(bi,""),o.length<2)return"";for(;o.length%4!==0;)o=o+"=";return o}function ct(o,r){r=r||1/0;let n,u=o.length,c=null,h=[];for(let g=0;g<u;++g){if(n=o.charCodeAt(g),n>55295&&n<57344){if(!c){if(n>56319){(r-=3)>-1&&h.push(239,191,189);continue}else if(g+1===u){(r-=3)>-1&&h.push(239,191,189);continue}c=n;continue}if(n<56320){(r-=3)>-1&&h.push(239,191,189),c=n;continue}n=(c-55296<<10|n-56320)+65536}else c&&(r-=3)>-1&&h.push(239,191,189);if(c=null,n<128){if((r-=1)<0)break;h.push(n)}else if(n<2048){if((r-=2)<0)break;h.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;h.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;h.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return h}function Ti(o){let r=[];for(let n=0;n<o.length;++n)r.push(o.charCodeAt(n)&255);return r}function Ri(o,r){let n,u,c,h=[];for(let g=0;g<o.length&&!((r-=2)<0);++g)n=o.charCodeAt(g),u=n>>8,c=n%256,h.push(c),h.push(u);return h}function Ut(o){return p.toByteArray(Ei(o))}function ze(o,r,n,u){let c;for(c=0;c<u&&!(c+n>=r.length||c>=o.length);++c)r[c+n]=o[c];return c}function J(o,r){return o instanceof r||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===r.name}function ft(o){return o!==o}let Ai=(function(){let o="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){let u=n*16;for(let c=0;c<16;++c)r[u+c]=o[n]+o[c]}return r})();function ie(o){return typeof BigInt>"u"?Ni:o}function Ni(){throw new Error("BigInt not supported")}return me}var Ue,Xr,Je,en,me,tn,nn=we(()=>{"use strict";f();m();d();Ue={},Xr=!1;Je={},en=!1;me={},tn=!1});var he,v,cs,fs,on=we(()=>{"use strict";f();m();d();nn();he=rn();he.Buffer;he.SlowBuffer;he.INSPECT_MAX_BYTES;he.kMaxLength;v=he.Buffer,cs=he.INSPECT_MAX_BYTES,fs=he.kMaxLength});var m=we(()=>{"use strict";on()});var Ka={};dt(Ka,{DynamicSnippetsGenerator:()=>pt});module.exports=ki(Ka);f();m();d();f();m();d();f();m();d();f();m();d();function C(p){throw new Error("Unexpected value: "+JSON.stringify(p))}f();m();d();f();m();d();f();m();d();f();m();d();f();m();d();f();m();d();var Oi=typeof global=="object"&&global&&global.Object===Object&&global,an=Oi;var _i=typeof self=="object"&&self&&self.Object===Object&&self,Di=an||_i||Function("return this")(),sn=Di;var Vi=sn.Symbol,re=Vi;f();m();d();var un=Object.prototype,$i=un.hasOwnProperty,ji=un.toString,Me=re?re.toStringTag:void 0;function Wi(p){var t=$i.call(p,Me),e=p[Me];try{p[Me]=void 0;var i=!0}catch{}var a=ji.call(p);return i&&(t?p[Me]=e:delete p[Me]),a}var pn=Wi;f();m();d();var qi=Object.prototype,Gi=qi.toString;function zi(p){return Gi.call(p)}var ln=zi;var Hi="[object Null]",Qi="[object Undefined]",cn=re?re.toStringTag:void 0;function Yi(p){return p==null?p===void 0?Qi:Hi:cn&&cn in Object(p)?pn(p):ln(p)}var fn=Yi;f();m();d();function Zi(p){return p!=null&&typeof p=="object"}var dn=Zi;var Ji="[object Symbol]";function Ki(p){return typeof p=="symbol"||dn(p)&&fn(p)==Ji}var mn=Ki;f();m();d();f();m();d();function Xi(p,t){for(var e=-1,i=p==null?0:p.length,a=Array(i);++e<i;)a[e]=t(p[e],e,p);return a}var hn=Xi;f();m();d();var eo=Array.isArray,yn=eo;var to=1/0,gn=re?re.prototype:void 0,xn=gn?gn.toString:void 0;function wn(p){if(typeof p=="string")return p;if(yn(p))return hn(p,wn)+"";if(mn(p))return xn?xn.call(p):"";var t=p+"";return t=="0"&&1/p==-to?"-0":t}var vn=wn;f();m();d();function ro(p){return p==null?"":vn(p)}var ae=ro;f();m();d();f();m();d();f();m();d();f();m();d();f();m();d();f();m();d();function no(p,t,e){var i=-1,a=p.length;t<0&&(t=-t>a?0:a+t),e=e>a?a:e,e<0&&(e+=a),a=t>e?0:e-t>>>0,t>>>=0;for(var l=Array(a);++i<a;)l[i]=p[i+t];return l}var In=no;function io(p,t,e){var i=p.length;return e=e===void 0?i:e,!t&&e>=i?p:In(p,t,e)}var bn=io;f();m();d();var oo="\\ud800-\\udfff",ao="\\u0300-\\u036f",so="\\ufe20-\\ufe2f",uo="\\u20d0-\\u20ff",po=ao+so+uo,lo="\\ufe0e\\ufe0f",co="\\u200d",fo=RegExp("["+co+oo+po+lo+"]");function mo(p){return fo.test(p)}var Ke=mo;f();m();d();f();m();d();function ho(p){return p.split("")}var En=ho;f();m();d();var Tn="\\ud800-\\udfff",yo="\\u0300-\\u036f",go="\\ufe20-\\ufe2f",xo="\\u20d0-\\u20ff",wo=yo+go+xo,vo="\\ufe0e\\ufe0f",Io="["+Tn+"]",gt="["+wo+"]",xt="\\ud83c[\\udffb-\\udfff]",bo="(?:"+gt+"|"+xt+")",Rn="[^"+Tn+"]",An="(?:\\ud83c[\\udde6-\\uddff]){2}",Nn="[\\ud800-\\udbff][\\udc00-\\udfff]",Eo="\\u200d",Sn=bo+"?",Bn="["+vo+"]?",To="(?:"+Eo+"(?:"+[Rn,An,Nn].join("|")+")"+Bn+Sn+")*",Ro=Bn+Sn+To,Ao="(?:"+[Rn+gt+"?",gt,An,Nn,Io].join("|")+")",No=RegExp(xt+"(?="+xt+")|"+Ao+Ro,"g");function So(p){return p.match(No)||[]}var Pn=So;function Bo(p){return Ke(p)?Pn(p):En(p)}var Fn=Bo;function Po(p){return function(t){t=ae(t);var e=Ke(t)?Fn(t):void 0,i=e?e[0]:t.charAt(0),a=e?bn(e,1).join(""):t.slice(1);return i[p]()+a}}var Cn=Po;var Fo=Cn("toUpperCase"),kn=Fo;function Co(p){return kn(ae(p).toLowerCase())}var Ln=Co;f();m();d();f();m();d();function ko(p,t,e,i){var a=-1,l=p==null?0:p.length;for(i&&l&&(e=p[++a]);++a<l;)e=t(e,p[a],a,p);return e}var Un=ko;f();m();d();f();m();d();f();m();d();function Lo(p){return function(t){return p?.[t]}}var Mn=Lo;var Uo={\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"},Mo=Mn(Uo),On=Mo;var Oo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_o="\\u0300-\\u036f",Do="\\ufe20-\\ufe2f",Vo="\\u20d0-\\u20ff",$o=_o+Do+Vo,jo="["+$o+"]",Wo=RegExp(jo,"g");function qo(p){return p=ae(p),p&&p.replace(Oo,On).replace(Wo,"")}var _n=qo;f();m();d();f();m();d();var Go=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function zo(p){return p.match(Go)||[]}var Dn=zo;f();m();d();var Ho=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Qo(p){return Ho.test(p)}var Vn=Qo;f();m();d();var Gn="\\ud800-\\udfff",Yo="\\u0300-\\u036f",Zo="\\ufe20-\\ufe2f",Jo="\\u20d0-\\u20ff",Ko=Yo+Zo+Jo,zn="\\u2700-\\u27bf",Hn="a-z\\xdf-\\xf6\\xf8-\\xff",Xo="\\xac\\xb1\\xd7\\xf7",ea="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ta="\\u2000-\\u206f",ra=" \\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",Qn="A-Z\\xc0-\\xd6\\xd8-\\xde",na="\\ufe0e\\ufe0f",Yn=Xo+ea+ta+ra,Zn="['\u2019]",$n="["+Yn+"]",ia="["+Ko+"]",Jn="\\d+",oa="["+zn+"]",Kn="["+Hn+"]",Xn="[^"+Gn+Yn+Jn+zn+Hn+Qn+"]",aa="\\ud83c[\\udffb-\\udfff]",sa="(?:"+ia+"|"+aa+")",ua="[^"+Gn+"]",ei="(?:\\ud83c[\\udde6-\\uddff]){2}",ti="[\\ud800-\\udbff][\\udc00-\\udfff]",Ie="["+Qn+"]",pa="\\u200d",jn="(?:"+Kn+"|"+Xn+")",la="(?:"+Ie+"|"+Xn+")",Wn="(?:"+Zn+"(?:d|ll|m|re|s|t|ve))?",qn="(?:"+Zn+"(?:D|LL|M|RE|S|T|VE))?",ri=sa+"?",ni="["+na+"]?",ca="(?:"+pa+"(?:"+[ua,ei,ti].join("|")+")"+ni+ri+")*",fa="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",da="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ma=ni+ri+ca,ha="(?:"+[oa,ei,ti].join("|")+")"+ma,ya=RegExp([Ie+"?"+Kn+"+"+Wn+"(?="+[$n,Ie,"$"].join("|")+")",la+"+"+qn+"(?="+[$n,Ie+jn,"$"].join("|")+")",Ie+"?"+jn+"+"+Wn,Ie+"+"+qn,da,fa,Jn,ha].join("|"),"g");function ga(p){return p.match(ya)||[]}var ii=ga;function xa(p,t,e){return p=ae(p),t=e?void 0:t,t===void 0?Vn(p)?ii(p):Dn(p):p.match(t)||[]}var oi=xa;var wa="['\u2019]",va=RegExp(wa,"g");function Ia(p){return function(t){return Un(oi(_n(t).replace(va,"")),p,"")}}var Xe=Ia;var ba=Xe(function(p,t,e){return t=t.toLowerCase(),p+(e?Ln(t):t)}),wt=ba;f();m();d();var Ea=Xe(function(p,t,e){return p+(e?"_":"")+t.toLowerCase()}),vt=Ea;f();m();d();function Oe(p){return Object.keys(p)}f();m();d();f();m();d();f();m();d();var _e=w.env.FERN_STACK_TRACK?.toLowerCase()??"",K=_e!==""&&_e!=="0"&&_e!=="false",It=["single","multiline","box"].includes(_e)?_e:"single";K&&(Error.stackTraceLimit=50);var Ta=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Ra=new Set(["stacktrace"]);function tt({maxFrames:p=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:a=[],filterNode:l=!0,filterJs:s=!0,formatFilename:E=b=>b}={}){if(!K)return[];i=[...i,...Ta],e=[...e,...Ra],a=[...a,"runInteractiveTask"];let b=!1;return(new Error().stack??"").split(`
|
|
2
2
|
`).map(A=>{let R=A.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(R&&R.length===5){let[,F,V,T,N]=R;if(!F||!V||!T||!N)return;if(b||a.some(k=>F?.includes(k))){b=!0;return}switch(F){case"Object.<anonymous>":F="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":F=`${F.substring(F.indexOf(".")+1)}()=> { ... }`;break}return{fn:F,path:E(V),position:`${T}:${N}`}}}).filter(A=>A&&!i.some(R=>A.fn.includes(R))&&!(l&&A.path?.startsWith("node:"))&&!(s&&A.path?.endsWith(".js"))&&!e.some(R=>A.path.includes(R))).slice(t,t+p)}var et=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:i=[],filterFunctions:a=[],stopOn:l=[],filterNode:s=!0,filterJs:E=!0,multiline:b=!1,formatFilename:A=R=>R}={}){y(this,"maxFrames");y(this,"skip");y(this,"filterPaths");y(this,"filterFunctions");y(this,"stopOn");y(this,"filterNode");y(this,"filterJs");y(this,"multiline");y(this,"formatFilename");y(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=i,this.filterFunctions=a,this.stopOn=l,this.filterNode=s,this.filterJs=E,this.multiline=b,this.formatFilename=A}tag(t){let e=this.tracking.get(t)||new Set;tt({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(i=>e.add(i)),this.tracking.set(t,e)}trace(t){if(!K)return"";let e=this.tracking.get(t);return e?[...e].map(i=>`${this.multiline?`
|
|
3
|
-
`:""}${i.fn} - ${i.path}:${i.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},bt;function ai({maxFrames:p=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:a=[],filterNode:l=!0,filterJs:s=!0,multiline:E=!1,formatFilename:b=A=>A}={}){K&&(bt??(bt=new et({maxFrames:p,skip:t,filterPaths:e,filterFunctions:i,stopOn:a,filterNode:l,filterJs:s,multiline:E,formatFilename:b})))}function si(p){bt?.tag(p)}function Et(p){return bt?.frames(p)??[]}var ye=class{constructor(){si(this)}};
|
|
3
|
+
`:""}${i.fn} - ${i.path}:${i.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},bt;function ai({maxFrames:p=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:a=[],filterNode:l=!0,filterJs:s=!0,multiline:E=!1,formatFilename:b=A=>A}={}){K&&(bt??(bt=new et({maxFrames:p,skip:t,filterPaths:e,filterFunctions:i,stopOn:a,filterNode:l,filterJs:s,multiline:E,formatFilename:b})))}function si(p){bt?.tag(p)}function Et(p){return bt?.frames(p)??[]}var ye=class{constructor(){si(this)}};f();m();d();f();m();d();f();m();d();var Y=class extends ye{constructor(e){super();y(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var Aa=4;ai({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var De=class{constructor(){y(this,"lineBuffer",[]);y(this,"indentLevel",0);y(this,"hasWrittenAnything",!1);y(this,"lastCharacterIsSemicolon",!1);y(this,"lastCharacterIsNewline",!1);y(this,"nodeStackFrames",[])}get buffer(){return K&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
4
4
|
`),this.lineBuffer.join(`
|
|
5
5
|
`)+(this.lastCharacterIsNewline?`
|
|
6
6
|
`:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let i=e.length>0&&e.endsWith(`
|
|
@@ -12,12 +12,12 @@ ${l}`);this.isAtStartOfLine()&&(s=l+s),i&&(s+=`
|
|
|
12
12
|
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
13
13
|
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:i}){if(t.length>0){let a=t[0];a!=null&&i(a);for(let l=1;l<t.length;l++){this.write(e);let s=t[l];s!=null&&i(s)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
|
|
14
14
|
`),this.lastCharacterIsSemicolon=t.endsWith(";");let i=t.split(`
|
|
15
|
-
`),a=K&&!this.shouldSkipTracking(i)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${i.shift()||""}`),this.lastCharacterIsNewline&&i.pop(),this.lineBuffer.push(...i),a&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(i=>`${e?`(${e}) `:""} ${i.fn} - ${i.path} : ${i.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(tt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,It){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Aa}};c();m();d();c();m();d();c();m();d();var Ve=class{constructor(){y(this,"reporter");y(this,"snippet");y(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw this.err??new Error(`Failed to generate snippet for endpoint "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>(this.snippet?.length??0)}};var $e=class{constructor(t){y(this,"context");this.context=t}async generate(t,e={}){let i=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(i.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let a=new Ve;for(let l of i){let s=this.context.clone(),E=this.createSnippetGenerator(s);try{let b=await E.generateSnippet({endpoint:l,request:t,options:e});if(s.errors.empty())return{snippet:b,errors:void 0};a.update({context:s,snippet:b})}catch(b){a.err==null&&(a.err=b)}}return a.getResponseOrThrow({endpoint:t.endpoint})}async generateSnippetAst(t,e={}){let i=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(i.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let a;for(let l of i){let s=this.context.clone(),E=this.createSnippetGenerator(s);try{return await E.generateSnippetAst({endpoint:l,request:t,options:e})}catch(b){a=b}}throw a??new Error(`Failed to generate snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateSync(t,e={}){let i=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(i.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let a=new Ve;for(let l of i){let s=this.context.clone(),E=this.createSnippetGenerator(s);try{let b=E.generateSnippetSync({endpoint:l,request:t,options:e});if(s.errors.empty())return{snippet:b,errors:void 0};a.update({context:s,snippet:b})}catch(b){a.err==null&&(a.err=b)}}return a.getResponseOrThrow({endpoint:t.endpoint})}};c();m();d();c();m();d();c();m();d();var je=class{constructor(){y(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let i=t.match(this.REFERENCE_REGEX);if(!(i==null||i[1]==null||i[2]==null))return{method:i[1],path:i[2]}}};c();m();d();var P={Critical:"CRITICAL",Warning:"WARNING"},We=class p{constructor(){y(this,"errors");y(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push({...t,path:[...this.path]})}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new p;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 i of t){if(typeof i=="string"){e.push(i);continue}e[e.length-1]+=`[${i.index}]`}return e}};var qe=class{constructor({ir:t,config:e,options:i={}}){y(this,"config");y(this,"options");y(this,"errors");y(this,"_ir");y(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=i,this.errors=new We,this.httpEndpointReferenceParser=new je}associateQueryParametersByWireValue({parameters:t,values:e}){let i=[];for(let[a,l]of Object.entries(e)){this.errors.scope(a);try{let s=t.find(b=>b.name.wireValue===a);if(s==null)throw this.newParameterNotRecognizedError(a);let E=this.isListTypeReference(s.typeReference)&&!Array.isArray(l)?[l]:l;i.push({name:s.name,typeReference:s.typeReference,value:E})}finally{this.errors.unscope()}}return i}associateByWireValueOrDefault({parameters:t,values:e}){let i=[];for(let a of t){this.errors.scope(a.name.wireValue);try{let l=e[a.name.wireValue];if(l==null)if(a.typeReference.type==="primitive"&&a.typeReference.value==="STRING")l=`<${a.name.wireValue}>`;else{this.errors.add({severity:P.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}i.push({name:a.name,typeReference:a.typeReference,value:l})}finally{this.errors.unscope()}}return i}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:i}){let a=[];for(let[l,s]of Object.entries(e)){this.errors.scope(l);try{let E=t.find(b=>b.name.wireValue===l);if(E==null){if(i)continue;this.errors.add({severity:P.Critical,message:this.newParameterNotRecognizedError(l).message});continue}a.push({name:E.name,typeReference:E.typeReference,value:s})}finally{this.errors.unscope()}}return a}getExampleObjectProperties({parameters:t,snippetObject:e}){let i=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},a=[];for(let l of t){let s=i[l.name.wireValue];s==null?l.typeReference.type==="nullable"&&a.push({name:l.name,typeReference:l.typeReference,value:null}):a.push({name:l.name,typeReference:l.typeReference,value:s})}return a}getSingleFileValue({property:t,record:e}){let i=e[t.wireValue];if(i!=null){if(typeof i!="string"){this.errors.add({severity:P.Critical,message:`Expected file value to be a string, got ${typeof i}`});return}return i}}getFileArrayValues({property:t,record:e}){let i=e[t.wireValue];if(i==null)return;if(!Array.isArray(i)){this.errors.add({severity:P.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}let a=[];for(let l of i){if(typeof l!="string"){this.errors.add({severity:P.Critical,message:`Expected file array value to be an array of strings, got ${typeof l}`});return}a.push(l)}return a}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:P.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t??{}}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:P.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let i=this.getRecord(e);if(i==null)return;let a=t.discriminant.wireValue,l=i[a];if(l==null){this.errors.add({severity:P.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof l!="string"){this.errors.add({severity:P.Critical,message:`Expected discriminant value to be a string but got: ${typeof l}`});return}let s=t.types[l];if(s==null){this.errors.add({severity:P.Critical,message:`No type found for discriminant value "${l}"`});return}let{[a]:E,...b}=i;return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:b}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let i of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:i,parsedEndpoint:t})&&e.push(i);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties: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:i}):!t.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){return e&&(t.metadata?.includePathParameters??!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:C(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let i=e.environments.find(a=>a.id===t);return i?.name}case"multipleBaseUrls":{let i=e.environments.find(a=>a.id===t);return i?.name}default:C(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:P.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:P.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let i=e.environments[0];if(i==null)return this.errors.add({severity:P.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(Oe(i.urls));for(let l of Oe(t))a.has(l)&&a.delete(l);return a.size>0?(this.errors.add({severity:P.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${Oe(i.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:P.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:P.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:P.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:C(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:C(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:C(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}};c();m();d();var Z={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};c();m();d();c();m();d();var x={};dt(x,{AccessAttribute:()=>be,AstNode:()=>S,Class:()=>se,ClassInstantiation:()=>Te,CodeBlock:()=>ne,Comment:()=>Re,Decorator:()=>Ae,Field:()=>ue,Lambda:()=>Ne,LambdaParameter:()=>Se,Method:()=>le,MethodArgument:()=>Pe,MethodInvocation:()=>Fe,Operator:()=>Ce,Parameter:()=>pe,PythonFile:()=>ke,Reference:()=>Q,StarImport:()=>fe,Type:()=>nt,TypeInstantiation:()=>ce,accessAttribute:()=>Ba,assign:()=>Pa,class_:()=>Ca,codeBlock:()=>_a,comment:()=>Da,decorator:()=>La,field:()=>Oa,file:()=>Fa,instantiateClass:()=>ka,invokeFunction:()=>Wa,invokeMethod:()=>qa,lambda:()=>Va,lambdaParameter:()=>$a,method:()=>ja,methodArgument:()=>za,operator:()=>Ha,parameter:()=>Ga,reference:()=>Ua,starImport:()=>Ma});c();m();d();c();m();d();c();m();d();c();m();d();var Ge=class extends De{constructor(){super(...arguments);y(this,"fullyQualifiedModulePathsToImportedNames",{})}setRefNameOverrides(e){this.fullyQualifiedModulePathsToImportedNames=e}unsetRefNameOverrides(){this.fullyQualifiedModulePathsToImportedNames={}}getRefNameOverride(e){let i=this.fullyQualifiedModulePathsToImportedNames[e.getFullyQualifiedModulePath()];return i||{name:e.alias??e.name,isAlias:!!e.alias}}toString(){return this.buffer}async toStringFormatted(e){return e.format(this.buffer)}};var S=class extends ye{constructor(){super(...arguments);y(this,"references",[])}addReference(e){this.references.push(e)}inheritReferences(e){e!==void 0&&e.references.forEach(i=>{this.references.includes(i)||this.addReference(i)})}getReferences(){return this.references}toString(){let e=new Ge;return this.write(e),e.toString()}async toStringFormatted(e){let i=new Ge;return this.write(i),i.toStringFormatted(e)}};var be=class extends S{constructor({lhs:e,rhs:i}){super();y(this,"lhs");y(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=i,this.inheritReferences(i)}write(e){this.lhs.write(e),e.write("."),this.rhs.write(e)}};c();m();d();var rt=class extends S{constructor({lhs:e,rhs:i}){super();y(this,"lhs");y(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=i,this.inheritReferences(i)}write(e){this.lhs.write(e),e.write(" = "),this.rhs.write(e)}};c();m();d();var Ee=class extends S{constructor({reference:e,arguments_:i,multiline:a}){super();y(this,"reference");y(this,"arguments");y(this,"multiline");this.reference=e,this.arguments=i,this.multiline=a??!1,this.inheritReferences(e),this.arguments.forEach(l=>{this.inheritReferences(l)})}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((i,a)=>{i.write(e),a<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};c();m();d();var se=class extends S{constructor({docs:e,name:i,extends_:a,decorators:l}){super();y(this,"name");y(this,"extends_");y(this,"decorators");y(this,"fields",[]);y(this,"docs");y(this,"statements",[]);this.name=i,this.extends_=a??[],this.decorators=l??[],this.docs=e,this.extends_.forEach(s=>{this.inheritReferences(s)}),this.decorators.forEach(s=>{this.inheritReferences(s)})}write(e){this.decorators.forEach(i=>{i.write(e)}),e.write(`class ${this.name}`),this.extends_.length>0&&(e.write("("),this.extends_.forEach((i,a)=>{a>0&&e.write(", "),i.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(i=>{i.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((i,a)=>{i.write(e),e.writeNewLineIfLastLineNot()})}addField(e){this.add(e)}};c();m();d();var Te=class extends Ee{constructor({classReference:t,...e}){super({reference:t,...e})}};c();m();d();var ne=class extends S{constructor(e){super();y(this,"arg");this.arg=e}write(e){return new Y(this.arg).write(e)}};c();m();d();var Re=class extends S{constructor({docs:e}){super();y(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
|
|
16
|
-
`).forEach(i=>{e.writeLine(`# ${i}`)})}};c();m();d();var Ae=class extends S{constructor({callable:e}){super();y(this,"callable");this.callable=e,this.inheritReferences(e)}write(e){e.write("@"),this.callable.write(e),e.newLine()}};c();m();d();var ue=class extends S{constructor({name:e,type:i,initializer:a,docs:l}){super();y(this,"name");y(this,"type");y(this,"initializer");y(this,"docs");this.name=e,this.type=i,this.initializer=a,this.docs=l,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();m();d();var Ne=class extends S{constructor({parameters:e,body:i}){super();y(this,"parameters");y(this,"body");this.parameters=e??[],this.body=i,this.inheritReferences(i)}write(e){e.write("lambda"),this.parameters&&this.parameters.length&&(e.write(" "),this.parameters.forEach((i,a)=>{i.write(e),a<this.parameters.length-1&&e.write(", ")})),e.write(": "),this.body.write(e)}};c();m();d();c();m();d();var pe=class extends S{constructor({name:e,type:i,initializer:a}){super();y(this,"name");y(this,"initializer");y(this,"type");this.name=e,this.type=i,this.initializer=a}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 Se=class extends pe{constructor({name:t,initializer:e}){super({name:t,initializer:e,type:void 0})}};c();m();d();var Be;(function(p){p[p.STATIC=0]="STATIC",p[p.INSTANCE=1]="INSTANCE",p[p.CLASS=2]="CLASS"})(Be||(Be={}));var le=class extends S{constructor({static_:e,name:i,parameters:a,return_:l,docstring:s,type:E,decorators:b}){super();y(this,"name");y(this,"return");y(this,"docstring");y(this,"type");y(this,"parameters");y(this,"decorators");y(this,"statements",[]);y(this,"static_");this.name=i,this.parameters=a??[],this.return=l,this.docstring=s,this.type=E,this.decorators=b??[],this.static_=e??!1,this.parameters.forEach(A=>{this.inheritReferences(A)}),this.inheritReferences(this.return),this.decorators.forEach(A=>{this.inheritReferences(A)}),this.statements.forEach(A=>{this.inheritReferences(A)})}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){this.static_&&this.decorators.push(x.decorator({callable:x.codeBlock("staticmethod")})),this.decorators.forEach(l=>{l.write(e)}),this.type===Be.CLASS?x.decorator({callable:new ne("classmethod")}).write(e):this.type===Be.STATIC&&x.decorator({callable:new ne("staticmethod")}).write(e),e.write(`def ${this.name}(`);let a=this.parameters.length>3;a&&(e.newLine(),e.indent()),this.type===Be.INSTANCE?(e.write("self"),this.parameters.length>0&&(e.write(a?",":", "),a&&e.newLine())):this.type===Be.CLASS&&(e.write("cls"),this.parameters.length>0&&(e.write(a?",":", "),a&&e.newLine())),this.parameters.forEach((l,s)=>{l.write(e),s<this.parameters.length-1&&(e.write(a?",":", "),a&&e.newLine())}),a&&(e.write(","),e.dedent(),e.newLine()),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((l,s)=>{l.write(e),s<this.statements.length-1&&e.newLine()}),e.dedent()):(e.indent(),e.write("pass"),e.dedent()),e.newLine()}};c();m();d();var Pe=class extends S{constructor({name:e,value:i}){super();y(this,"name");y(this,"value");this.name=e,this.value=i,this.inheritReferences(this.value)}write(e){this.name!==void 0&&(e.write(this.name),e.write("=")),this.value.write(e)}};c();m();d();var Fe=class extends S{constructor({on:e,method:i,arguments_:a,multiline:l}){super();y(this,"on");y(this,"method");y(this,"arguments");y(this,"multiline");this.on=e,this.method=i,this.arguments=a,this.multiline=l??!1,this.inheritReferences(e),this.arguments.forEach(s=>{this.inheritReferences(s)})}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((i,a)=>{i.write(e),a<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};c();m();d();c();m();d();var X={Or:"or",And:"and",Add:"add",Subtract:"subtract",Multiply:"multiple",Divide:"divide",Modulo:"modulo",LeftShift:"leftShift",RightShift:"rightShift"};var Ce=class extends S{constructor({operator:e,lhs:i,rhs:a}){super();y(this,"operator");y(this,"lhs");y(this,"rhs");this.operator=e,this.lhs=i,this.inheritReferences(i),this.rhs=a,this.inheritReferences(a)}getOperatorString(){switch(this.operator){case X.Or:return"or";case X.And:return"and";case X.Add:return"+";case X.Subtract:return"-";case X.Multiply:return"*";case X.Divide:return"/";case X.Modulo:return"%";case X.LeftShift:return"<<";case X.RightShift:return">>";default:C(this.operator)}}write(e){this.lhs.write(e),e.write(" "),e.write(this.getOperatorString()),e.write(" "),this.rhs.write(e)}};c();m();d();c();m();d();function ui(p){if(!p)return"Class";let t=p.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(i=>i.length>0).map(i=>i.split(/(?<=\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\d)/).filter(a=>a.length>0)).flat().map((i,a)=>a===0&&/^\d/.test(i)?"Class"+i.charAt(0).toUpperCase()+i.slice(1).toLowerCase():i.length>1&&i===i.toUpperCase()&&!/^\d+$/.test(i)?i:i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(""))}c();m();d();c();m();d();var Q=class extends S{constructor({name:e,modulePath:i,genericTypes:a,alias:l,attribute:s}){super();y(this,"name");y(this,"modulePath");y(this,"genericTypes");y(this,"alias");y(this,"attribute");this.name=e,this.modulePath=i??[],this.genericTypes=a??[],this.alias=l,this.attribute=s??[],this.references.push(this),this.genericTypes.forEach(E=>{this.inheritReferences(E)})}write(e){let i=e.getRefNameOverride(this);e.write(i.name),this.genericTypes.length>0&&(e.write("["),this.genericTypes.forEach((a,l)=>{l>0&&e.write(", "),a.write(e)}),e.write("]")),this.attribute.length>0&&(e.write("."),this.attribute.forEach((a,l)=>{l>0&&e.write("."),e.write(a)}))}getFullyQualifiedPath(){return this.modulePath.join(".")}getFullyQualifiedModulePath(){return`${this.getFullyQualifiedPath()}.${this.name}`}};var fe=class extends Q{constructor({modulePath:e}){super({name:"*",modulePath:e});y(this,"docs")}write(e){throw new Error("Not intended to be written outside the context of a PythonFile.")}};var ke=class extends S{constructor({path:e,statements:i,isInitFile:a=!1,comments:l,imports:s}){super();y(this,"path");y(this,"isInitFile");y(this,"statements",[]);y(this,"comments");this.path=e,this.isInitFile=a,i?.forEach(E=>this.addStatement(E)),this.comments=l??[],s?.forEach(E=>this.addReference(E))}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){let i=this.deduplicateReferences();this.updateWriterRefNameOverrides({writer:e,uniqueReferences:i}),this.writeComments(e),this.writeImports({writer:e,uniqueReferences:i}),this.statements.forEach((a,l)=>{a.write(e),e.newLine(),l<this.statements.length-1&&e.newLine()}),e.unsetRefNameOverrides()}updateWriterRefNameOverrides({writer:e,uniqueReferences:i}){let a=new Map(i),l={},s=this.getInitialUsedNames(),E=this.path.join("."),b=i.get(E);if(b){let{references:R}=b;R.forEach(F=>{let V=F.getFullyQualifiedModulePath(),T=F.name;l[V]={name:T,isAlias:!1},s.add(F.name)}),a.delete(E)}Array.from(a.values()).flatMap(({references:R})=>R).forEach(R=>{if(R instanceof fe)return;let F=R.alias??R.name,V=R.getFullyQualifiedModulePath(),T=F,N=R.modulePath.length-1,k=!!R.alias;for(;s.has(T);){k=!0;let M=R.modulePath[N];N<0||!M?T=`_${T}`:T=`${ui(M)}${T}`,N--}s.add(T),l[V]={name:T,isAlias:k}}),e.setRefNameOverrides(l)}getInitialUsedNames(){let e=new Set;return this.statements.forEach(i=>{(i instanceof se||i instanceof le||i instanceof ue)&&e.add(i.name)}),e}deduplicateReferences(){let e=new Map;for(let i of this.references){let a=i.name,l=i.getFullyQualifiedPath();if(l==="")continue;let s=e.get(l);s?s.referenceNames.has(a)||(s.references.push(i),s.referenceNames.add(a)):e.set(l,{modulePath:i.modulePath,references:[i],referenceNames:new Set([a])})}return e}writeComments(e){this.comments.forEach(i=>{i.write(e)}),this.comments.length>0&&e.newLine()}getImportName({writer:e,reference:i}){let a=e.getRefNameOverride(i),l=i.name,s=a.isAlias?a.name:void 0;return`${l}${s?` as ${s}`:""}`}writeImports({writer:e,uniqueReferences:i}){if(i.size!==0){for(let[a,{modulePath:l,references:s}]of i){let E=l;if(!this.isDefinedInFile(E)){if(E[0]===this.path[0]){let b=0;for(;b<this.path.length&&b<E.length&&this.path[b]===E[b];)b++;let A=this.path.length-b;this.isInitFile&&A++;let R=A>0?".".repeat(A):".";R+=E.slice(b).join("."),e.write(`from ${R} import ${s.map(F=>this.getImportName({writer:e,reference:F})).join(", ")}`)}else e.write(`from ${a} import ${s.map(b=>this.getImportName({writer:e,reference:b})).join(", ")}`);e.newLine()}}e.newLine()}}isDefinedInFile(e){return e.length===this.path.length&&e.every((i,a)=>i===this.path[a])}};c();m();d();var nt=class extends S{constructor(e){super();y(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((i,a)=>{a>0&&e.write(", "),i.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((i,a)=>{a>0&&e.write(", "),i.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:C(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 i=new this({type:"list",value:e});return i.addReference(x.reference({name:"List",modulePath:["typing"]})),i.inheritReferences(e),i}static set(e){let i=new this({type:"set",value:e});return i.addReference(x.reference({name:"Set",modulePath:["typing"]})),i.inheritReferences(e),i}static tuple(e){let i=new this({type:"tuple",values:e});return i.addReference(x.reference({name:"Tuple",modulePath:["typing"]})),e.forEach(a=>i.inheritReferences(a)),i}static dict(e,i){let a=new this({type:"dict",keyType:e,valueType:i});return a.addReference(x.reference({name:"Dict",modulePath:["typing"]})),a.inheritReferences(e),a.inheritReferences(i),a}static none(){return new this({type:"none"})}static uuid(){let e=new this({type:"uuid"});return e.addReference(x.reference({name:"UUID",modulePath:["uuid"]})),e}static optional(e){if(this.isAlreadyOptional(e))return e;let i=new this({type:"optional",value:e});return i.addReference(x.reference({name:"Optional",modulePath:["typing"]})),i.inheritReferences(e),i}static union(e){let i=new this({type:"union",values:e});return i.addReference(x.reference({name:"Union",modulePath:["typing"]})),e.forEach(a=>i.inheritReferences(a)),i}static any(){let e=new this({type:"any"});return e.addReference(x.reference({name:"Any",modulePath:["typing"]})),e}static datetime(){let e=new this({type:"datetime"});return e.addReference(x.reference({name:"datetime",modulePath:["datetime"]})),e}static reference(e){let i=new this({type:"reference",value:e});return i.addReference(e),i}static literal(e){let i=new this({type:"literal",value:e});return i.addReference(x.reference({name:"Literal",modulePath:["typing"]})),i}static isAlreadyOptional(e){return e.internalType.type==="optional"}};c();m();d();var ce=class p extends S{constructor(e){super();y(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,i={multiline:!1,startOnNewLine:!1,endWithNewLine:!1}){return new this({type:"str",value:e,config:i})}static bytes(e){return new this({type:"bytes",value:e})}static list(e,i={endWithComma:!1}){let a=new this({type:"list",values:e,config:i});return e.forEach(l=>a.inheritReferences(l)),a}static set(e,i={endWithComma:!1}){let a=new this({type:"set",values:e,config:i});return e.forEach(l=>a.inheritReferences(l)),a}static tuple(e,i={endWithComma:!1}){let a=new this({type:"tuple",values:e,config:i});return e.forEach(l=>a.inheritReferences(l)),a}static typedDict(e,i={endWithComma:!1}){let a=new this({type:"typedDict",entries:e,config:i});return e.forEach(l=>a.inheritReferences(l.value)),a}static date(e){let i=new this({type:"date",value:e});return i.addReference(new Q({name:"date",modulePath:["datetime"]})),i}static datetime(e){let i=new this({type:"datetime",value:e});return i.addReference(new Q({name:"datetime",modulePath:["datetime"]})),i}static dict(e,i={endWithComma:!1}){let a=new this({type:"dict",entries:e,config:i});return e.forEach(l=>{a.inheritReferences(l.key),a.inheritReferences(l.value)}),a}static reference(e){let i=new this({type:"reference",value:e});return i.inheritReferences(e),i}static none(){return new this({type:"none"})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){let i=new this({type:"uuid",value:e});return i.addReference(new Q({name:"UUID",modulePath:["uuid"]})),i}static nop(){return new this({type:"nop"})}static isNop(e){return e instanceof p&&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){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(this.internalType.config?.multiline){let{startOnNewLine:i,endWithNewLine:a}=this.internalType.config;this.writeStringWithTripleQuotes({writer:e,value:this.internalType.value,startOnNewLine:i,endWithNewLine:a})}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 i=this.internalType,a=Tt({values:i.values});if(a.length===0){e.write("[]");break}e.write("["),i.config?.multiline&&(e.newLine(),e.indent()),a.forEach((l,s)=>{s>0&&(e.write(","),i.config?.multiline?e.newLine():e.write(" ")),l.write(e),s===a.length-1&&i.config?.endWithComma&&e.write(",")}),i.config?.multiline&&(e.newLine(),e.dedent()),e.write("]");break}case"set":{let i=this.internalType,a=Tt({values:i.values});if(a.length===0){e.write("{}");break}e.write("{"),i.config?.multiline&&(e.newLine(),e.indent()),a.forEach((l,s)=>{s>0&&(e.write(","),i.config?.multiline?e.newLine():e.write(" ")),l.write(e),s===a.length-1&&i.config?.endWithComma&&e.write(",")}),i.config?.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"tuple":{let i=this.internalType,a=Tt({values:i.values});if(a.length===0){e.write("()");break}e.write("("),i.config?.multiline&&(e.newLine(),e.indent()),a.forEach((l,s)=>{s>0&&(e.write(","),i.config?.multiline?e.newLine():e.write(" ")),l.write(e),(a.length===1||s===a.length-1&&i.config?.endWithComma)&&e.write(",")}),i.config?.multiline&&(e.newLine(),e.dedent()),e.write(")");break}case"dict":{let i=this.internalType,a=Na({entries:i.entries});if(a.length===0){e.write("{}");break}e.write("{"),i.config?.multiline&&(e.newLine(),e.indent()),a.forEach((l,s)=>{s>0&&(e.write(","),i.config?.multiline?e.newLine():e.write(" ")),l.key.write(e),e.write(": "),l.value.write(e),s===a.length-1&&i.config?.endWithComma&&e.write(",")}),i.config?.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"typedDict":{let i=this.internalType,a=Sa({entries:i.entries});if(a.length===0){e.write("{}");break}e.write("{"),i.config?.multiline&&(e.writeLine(),e.indent()),a.forEach((l,s)=>{s>0&&(e.write(","),i.config?.multiline?e.newLine():e.write(" ")),e.write(`"${l.name}": `),l.value.write(e)}),i.config?.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:C(this.internalType)}}writeStringWithTripleQuotes({writer:e,value:i,startOnNewLine:a,endWithNewLine:l}){e.write('"""');let s=i.split(`
|
|
15
|
+
`),a=K&&!this.shouldSkipTracking(i)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${i.shift()||""}`),this.lastCharacterIsNewline&&i.pop(),this.lineBuffer.push(...i),a&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(i=>`${e?`(${e}) `:""} ${i.fn} - ${i.path} : ${i.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(tt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,It){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Aa}};f();m();d();f();m();d();f();m();d();var Ve=class{constructor(){y(this,"reporter");y(this,"snippet");y(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:t,snippet:e}){this.shouldUpdate({snippet:e,reporter:t.errors})&&(this.reporter=t.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:t}){if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw this.err??new Error(`Failed to generate snippet for endpoint "${t.method} ${t.path}"`)}shouldUpdate({snippet:t,reporter:e}){return this.reporter==null||this.reporter.size()>0&&e.size()===0?!0:t.length>(this.snippet?.length??0)}};var $e=class{constructor(t){y(this,"context");this.context=t}async generate(t,e={}){let i=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(i.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let a=new Ve;for(let l of i){let s=this.context.clone(),E=this.createSnippetGenerator(s);try{let b=await E.generateSnippet({endpoint:l,request:t,options:e});if(s.errors.empty())return{snippet:b,errors:void 0};a.update({context:s,snippet:b})}catch(b){a.err==null&&(a.err=b)}}return a.getResponseOrThrow({endpoint:t.endpoint})}async generateSnippetAst(t,e={}){let i=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(i.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let a;for(let l of i){let s=this.context.clone(),E=this.createSnippetGenerator(s);try{return await E.generateSnippetAst({endpoint:l,request:t,options:e})}catch(b){a=b}}throw a??new Error(`Failed to generate snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateSync(t,e={}){let i=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(i.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let a=new Ve;for(let l of i){let s=this.context.clone(),E=this.createSnippetGenerator(s);try{let b=E.generateSnippetSync({endpoint:l,request:t,options:e});if(s.errors.empty())return{snippet:b,errors:void 0};a.update({context:s,snippet:b})}catch(b){a.err==null&&(a.err=b)}}return a.getResponseOrThrow({endpoint:t.endpoint})}};f();m();d();f();m();d();f();m();d();var je=class{constructor(){y(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(t){return this.REFERENCE_REGEX.test(t)?{type:"valid"}:{type:"invalid"}}tryParse(t){if(this.validate(t).type==="invalid")return;let i=t.match(this.REFERENCE_REGEX);if(!(i==null||i[1]==null||i[2]==null))return{method:i[1],path:i[2]}}};f();m();d();var P={Critical:"CRITICAL",Warning:"WARNING"},We=class p{constructor(){y(this,"errors");y(this,"path");this.errors=[],this.path=[]}add(t){this.errors.push({...t,path:[...this.path]})}scope(t){this.path.push(t)}unscope(){this.path.pop()}getBySeverity(t){return this.errors.filter(e=>e.severity===t)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let t=new p;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 i of t){if(typeof i=="string"){e.push(i);continue}e[e.length-1]+=`[${i.index}]`}return e}};var qe=class{constructor({ir:t,config:e,options:i={}}){y(this,"config");y(this,"options");y(this,"errors");y(this,"_ir");y(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=i,this.errors=new We,this.httpEndpointReferenceParser=new je}associateQueryParametersByWireValue({parameters:t,values:e}){let i=[];for(let[a,l]of Object.entries(e)){this.errors.scope(a);try{let s=t.find(b=>b.name.wireValue===a);if(s==null)throw this.newParameterNotRecognizedError(a);let E=this.isListTypeReference(s.typeReference)&&!Array.isArray(l)?[l]:l;i.push({name:s.name,typeReference:s.typeReference,value:E})}finally{this.errors.unscope()}}return i}associateByWireValueOrDefault({parameters:t,values:e}){let i=[];for(let a of t){this.errors.scope(a.name.wireValue);try{let l=e[a.name.wireValue];if(l==null)if(a.typeReference.type==="primitive"&&a.typeReference.value==="STRING")l=`<${a.name.wireValue}>`;else{this.errors.add({severity:P.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}i.push({name:a.name,typeReference:a.typeReference,value:l})}finally{this.errors.unscope()}}return i}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:i}){let a=[];for(let[l,s]of Object.entries(e)){this.errors.scope(l);try{let E=t.find(b=>b.name.wireValue===l);if(E==null){if(i)continue;this.errors.add({severity:P.Critical,message:this.newParameterNotRecognizedError(l).message});continue}a.push({name:E.name,typeReference:E.typeReference,value:s})}finally{this.errors.unscope()}}return a}getExampleObjectProperties({parameters:t,snippetObject:e}){let i=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},a=[];for(let l of t){let s=i[l.name.wireValue];s==null?l.typeReference.type==="nullable"&&a.push({name:l.name,typeReference:l.typeReference,value:null}):a.push({name:l.name,typeReference:l.typeReference,value:s})}return a}getSingleFileValue({property:t,record:e}){let i=e[t.wireValue];if(i!=null){if(typeof i!="string"){this.errors.add({severity:P.Critical,message:`Expected file value to be a string, got ${typeof i}`});return}return i}}getFileArrayValues({property:t,record:e}){let i=e[t.wireValue];if(i==null)return;if(!Array.isArray(i)){this.errors.add({severity:P.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}let a=[];for(let l of i){if(typeof l!="string"){this.errors.add({severity:P.Critical,message:`Expected file array value to be an array of strings, got ${typeof l}`});return}a.push(l)}return a}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:P.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(t)?"array":typeof t}`});return}return t??{}}resolveNamedType({typeId:t}){let e=this._ir.types[t];if(e==null){this.errors.add({severity:P.Critical,message:`Type identified by "${t}" could not be found`});return}return e}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e}){let i=this.getRecord(e);if(i==null)return;let a=t.discriminant.wireValue,l=i[a];if(l==null){this.errors.add({severity:P.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof l!="string"){this.errors.add({severity:P.Critical,message:`Expected discriminant value to be a string but got: ${typeof l}`});return}let s=t.types[l];if(s==null){this.errors.add({severity:P.Critical,message:`No type found for discriminant value "${l}"`});return}let{[a]:E,...b}=i;return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:b}}resolveEndpointOrThrow(t){let e=this.httpEndpointReferenceParser.tryParse(t);if(e==null)throw new Error(`Failed to parse endpoint reference "${t}"`);return this.resolveEndpointLocationOrThrow(e)}resolveEndpointLocation(t){let e=[];for(let i of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:i,parsedEndpoint:t})&&e.push(i);return e}resolveEndpointLocationOrThrow(t){let e=this.resolveEndpointLocation(t);if(e.length===0)throw new Error(`Failed to find endpoint identified by "${t.method} ${t.path}"`);return e}resolveEndpointById(t){return this._ir.endpoints[t]}resolveEndpointByIdOrThrow(t){let e=this.resolveEndpointById(t);if(e==null)throw new Error(`Failed to find endpoint with ID "${t}"`);return e}needsRequestParameter({request:t,inlinePathParameters:e,inlineFileProperties: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:i}):!t.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:t,inlinePathParameters:e}){return e&&(t.metadata?.includePathParameters??!1)}isFileUploadRequestBody(t){switch(t.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:C(t)}}resolveEnvironmentName(t){if(this._ir.environments==null)return;let e=this._ir.environments.environments;switch(e.type){case"singleBaseUrl":{let i=e.environments.find(a=>a.id===t);return i?.name}case"multipleBaseUrls":{let i=e.environments.find(a=>a.id===t);return i?.name}default:C(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:P.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:P.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let i=e.environments[0];if(i==null)return this.errors.add({severity:P.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(Oe(i.urls));for(let l of Oe(t))a.has(l)&&a.delete(l);return a.size>0?(this.errors.add({severity:P.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${Oe(i.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:P.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:P.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:P.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:C(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:C(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:C(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}};f();m();d();var Z={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};f();m();d();f();m();d();var x={};dt(x,{AccessAttribute:()=>be,AstNode:()=>S,Class:()=>se,ClassInstantiation:()=>Te,CodeBlock:()=>ne,Comment:()=>Re,Decorator:()=>Ae,Field:()=>ue,Lambda:()=>Ne,LambdaParameter:()=>Se,Method:()=>le,MethodArgument:()=>Pe,MethodInvocation:()=>Fe,Operator:()=>Ce,Parameter:()=>pe,PythonFile:()=>ke,Reference:()=>Q,StarImport:()=>ce,Type:()=>nt,TypeInstantiation:()=>fe,accessAttribute:()=>Ba,assign:()=>Pa,class_:()=>Ca,codeBlock:()=>_a,comment:()=>Da,decorator:()=>La,field:()=>Oa,file:()=>Fa,instantiateClass:()=>ka,invokeFunction:()=>Wa,invokeMethod:()=>qa,lambda:()=>Va,lambdaParameter:()=>$a,method:()=>ja,methodArgument:()=>za,operator:()=>Ha,parameter:()=>Ga,reference:()=>Ua,starImport:()=>Ma});f();m();d();f();m();d();f();m();d();f();m();d();var Ge=class extends De{constructor(){super(...arguments);y(this,"fullyQualifiedModulePathsToImportedNames",{})}setRefNameOverrides(e){this.fullyQualifiedModulePathsToImportedNames=e}unsetRefNameOverrides(){this.fullyQualifiedModulePathsToImportedNames={}}getRefNameOverride(e){let i=this.fullyQualifiedModulePathsToImportedNames[e.getFullyQualifiedModulePath()];return i||{name:e.alias??e.name,isAlias:!!e.alias}}toString(){return this.buffer}async toStringFormatted(e){return e.format(this.buffer)}};var S=class extends ye{constructor(){super(...arguments);y(this,"references",[])}addReference(e){this.references.push(e)}inheritReferences(e){e!==void 0&&e.references.forEach(i=>{this.references.includes(i)||this.addReference(i)})}getReferences(){return this.references}toString(){let e=new Ge;return this.write(e),e.toString()}async toStringFormatted(e){let i=new Ge;return this.write(i),i.toStringFormatted(e)}};var be=class extends S{constructor({lhs:e,rhs:i}){super();y(this,"lhs");y(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=i,this.inheritReferences(i)}write(e){this.lhs.write(e),e.write("."),this.rhs.write(e)}};f();m();d();var rt=class extends S{constructor({lhs:e,rhs:i}){super();y(this,"lhs");y(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=i,this.inheritReferences(i)}write(e){this.lhs.write(e),e.write(" = "),this.rhs.write(e)}};f();m();d();var Ee=class extends S{constructor({reference:e,arguments_:i,multiline:a}){super();y(this,"reference");y(this,"arguments");y(this,"multiline");this.reference=e,this.arguments=i,this.multiline=a??!1,this.inheritReferences(e),this.arguments.forEach(l=>{this.inheritReferences(l)})}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((i,a)=>{i.write(e),a<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};f();m();d();var se=class extends S{constructor({docs:e,name:i,extends_:a,decorators:l}){super();y(this,"name");y(this,"extends_");y(this,"decorators");y(this,"fields",[]);y(this,"docs");y(this,"statements",[]);this.name=i,this.extends_=a??[],this.decorators=l??[],this.docs=e,this.extends_.forEach(s=>{this.inheritReferences(s)}),this.decorators.forEach(s=>{this.inheritReferences(s)})}write(e){this.decorators.forEach(i=>{i.write(e)}),e.write(`class ${this.name}`),this.extends_.length>0&&(e.write("("),this.extends_.forEach((i,a)=>{a>0&&e.write(", "),i.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(i=>{i.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((i,a)=>{i.write(e),e.writeNewLineIfLastLineNot()})}addField(e){this.add(e)}};f();m();d();var Te=class extends Ee{constructor({classReference:t,...e}){super({reference:t,...e})}};f();m();d();var ne=class extends S{constructor(e){super();y(this,"arg");this.arg=e}write(e){return new Y(this.arg).write(e)}};f();m();d();var Re=class extends S{constructor({docs:e}){super();y(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
|
|
16
|
+
`).forEach(i=>{e.writeLine(`# ${i}`)})}};f();m();d();var Ae=class extends S{constructor({callable:e}){super();y(this,"callable");this.callable=e,this.inheritReferences(e)}write(e){e.write("@"),this.callable.write(e),e.newLine()}};f();m();d();var ue=class extends S{constructor({name:e,type:i,initializer:a,docs:l}){super();y(this,"name");y(this,"type");y(this,"initializer");y(this,"docs");this.name=e,this.type=i,this.initializer=a,this.docs=l,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('"""'))}};f();m();d();var Ne=class extends S{constructor({parameters:e,body:i}){super();y(this,"parameters");y(this,"body");this.parameters=e??[],this.body=i,this.inheritReferences(i)}write(e){e.write("lambda"),this.parameters&&this.parameters.length&&(e.write(" "),this.parameters.forEach((i,a)=>{i.write(e),a<this.parameters.length-1&&e.write(", ")})),e.write(": "),this.body.write(e)}};f();m();d();f();m();d();var pe=class extends S{constructor({name:e,type:i,initializer:a}){super();y(this,"name");y(this,"initializer");y(this,"type");this.name=e,this.type=i,this.initializer=a}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 Se=class extends pe{constructor({name:t,initializer:e}){super({name:t,initializer:e,type:void 0})}};f();m();d();var Be;(function(p){p[p.STATIC=0]="STATIC",p[p.INSTANCE=1]="INSTANCE",p[p.CLASS=2]="CLASS"})(Be||(Be={}));var le=class extends S{constructor({static_:e,name:i,parameters:a,return_:l,docstring:s,type:E,decorators:b}){super();y(this,"name");y(this,"return");y(this,"docstring");y(this,"type");y(this,"parameters");y(this,"decorators");y(this,"statements",[]);y(this,"static_");this.name=i,this.parameters=a??[],this.return=l,this.docstring=s,this.type=E,this.decorators=b??[],this.static_=e??!1,this.parameters.forEach(A=>{this.inheritReferences(A)}),this.inheritReferences(this.return),this.decorators.forEach(A=>{this.inheritReferences(A)}),this.statements.forEach(A=>{this.inheritReferences(A)})}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){this.static_&&this.decorators.push(x.decorator({callable:x.codeBlock("staticmethod")})),this.decorators.forEach(l=>{l.write(e)}),this.type===Be.CLASS?x.decorator({callable:new ne("classmethod")}).write(e):this.type===Be.STATIC&&x.decorator({callable:new ne("staticmethod")}).write(e),e.write(`def ${this.name}(`);let a=this.parameters.length>3;a&&(e.newLine(),e.indent()),this.type===Be.INSTANCE?(e.write("self"),this.parameters.length>0&&(e.write(a?",":", "),a&&e.newLine())):this.type===Be.CLASS&&(e.write("cls"),this.parameters.length>0&&(e.write(a?",":", "),a&&e.newLine())),this.parameters.forEach((l,s)=>{l.write(e),s<this.parameters.length-1&&(e.write(a?",":", "),a&&e.newLine())}),a&&(e.write(","),e.dedent(),e.newLine()),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((l,s)=>{l.write(e),s<this.statements.length-1&&e.newLine()}),e.dedent()):(e.indent(),e.write("pass"),e.dedent()),e.newLine()}};f();m();d();var Pe=class extends S{constructor({name:e,value:i}){super();y(this,"name");y(this,"value");this.name=e,this.value=i,this.inheritReferences(this.value)}write(e){this.name!==void 0&&(e.write(this.name),e.write("=")),this.value.write(e)}};f();m();d();var Fe=class extends S{constructor({on:e,method:i,arguments_:a,multiline:l}){super();y(this,"on");y(this,"method");y(this,"arguments");y(this,"multiline");this.on=e,this.method=i,this.arguments=a,this.multiline=l??!1,this.inheritReferences(e),this.arguments.forEach(s=>{this.inheritReferences(s)})}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((i,a)=>{i.write(e),a<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};f();m();d();f();m();d();var X={Or:"or",And:"and",Add:"add",Subtract:"subtract",Multiply:"multiple",Divide:"divide",Modulo:"modulo",LeftShift:"leftShift",RightShift:"rightShift"};var Ce=class extends S{constructor({operator:e,lhs:i,rhs:a}){super();y(this,"operator");y(this,"lhs");y(this,"rhs");this.operator=e,this.lhs=i,this.inheritReferences(i),this.rhs=a,this.inheritReferences(a)}getOperatorString(){switch(this.operator){case X.Or:return"or";case X.And:return"and";case X.Add:return"+";case X.Subtract:return"-";case X.Multiply:return"*";case X.Divide:return"/";case X.Modulo:return"%";case X.LeftShift:return"<<";case X.RightShift:return">>";default:C(this.operator)}}write(e){this.lhs.write(e),e.write(" "),e.write(this.getOperatorString()),e.write(" "),this.rhs.write(e)}};f();m();d();f();m();d();function ui(p){if(!p)return"Class";let t=p.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(i=>i.length>0).map(i=>i.split(/(?<=\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\d)/).filter(a=>a.length>0)).flat().map((i,a)=>a===0&&/^\d/.test(i)?"Class"+i.charAt(0).toUpperCase()+i.slice(1).toLowerCase():i.length>1&&i===i.toUpperCase()&&!/^\d+$/.test(i)?i:i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(""))}f();m();d();f();m();d();var Q=class extends S{constructor({name:e,modulePath:i,genericTypes:a,alias:l,attribute:s}){super();y(this,"name");y(this,"modulePath");y(this,"genericTypes");y(this,"alias");y(this,"attribute");this.name=e,this.modulePath=i??[],this.genericTypes=a??[],this.alias=l,this.attribute=s??[],this.references.push(this),this.genericTypes.forEach(E=>{this.inheritReferences(E)})}write(e){let i=e.getRefNameOverride(this);e.write(i.name),this.genericTypes.length>0&&(e.write("["),this.genericTypes.forEach((a,l)=>{l>0&&e.write(", "),a.write(e)}),e.write("]")),this.attribute.length>0&&(e.write("."),this.attribute.forEach((a,l)=>{l>0&&e.write("."),e.write(a)}))}getFullyQualifiedPath(){return this.modulePath.join(".")}getFullyQualifiedModulePath(){return`${this.getFullyQualifiedPath()}.${this.name}`}};var ce=class extends Q{constructor({modulePath:e}){super({name:"*",modulePath:e});y(this,"docs")}write(e){throw new Error("Not intended to be written outside the context of a PythonFile.")}};var ke=class extends S{constructor({path:e,statements:i,isInitFile:a=!1,comments:l,imports:s}){super();y(this,"path");y(this,"isInitFile");y(this,"statements",[]);y(this,"comments");this.path=e,this.isInitFile=a,i?.forEach(E=>this.addStatement(E)),this.comments=l??[],s?.forEach(E=>this.addReference(E))}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){let i=this.deduplicateReferences();this.updateWriterRefNameOverrides({writer:e,uniqueReferences:i}),this.writeComments(e),this.writeImports({writer:e,uniqueReferences:i}),this.statements.forEach((a,l)=>{a.write(e),e.newLine(),l<this.statements.length-1&&e.newLine()}),e.unsetRefNameOverrides()}updateWriterRefNameOverrides({writer:e,uniqueReferences:i}){let a=new Map(i),l={},s=this.getInitialUsedNames(),E=this.path.join("."),b=i.get(E);if(b){let{references:R}=b;R.forEach(F=>{let V=F.getFullyQualifiedModulePath(),T=F.name;l[V]={name:T,isAlias:!1},s.add(F.name)}),a.delete(E)}Array.from(a.values()).flatMap(({references:R})=>R).forEach(R=>{if(R instanceof ce)return;let F=R.alias??R.name,V=R.getFullyQualifiedModulePath(),T=F,N=R.modulePath.length-1,k=!!R.alias;for(;s.has(T);){k=!0;let M=R.modulePath[N];N<0||!M?T=`_${T}`:T=`${ui(M)}${T}`,N--}s.add(T),l[V]={name:T,isAlias:k}}),e.setRefNameOverrides(l)}getInitialUsedNames(){let e=new Set;return this.statements.forEach(i=>{(i instanceof se||i instanceof le||i instanceof ue)&&e.add(i.name)}),e}deduplicateReferences(){let e=new Map;for(let i of this.references){let a=i.name,l=i.getFullyQualifiedPath();if(l==="")continue;let s=e.get(l);s?s.referenceNames.has(a)||(s.references.push(i),s.referenceNames.add(a)):e.set(l,{modulePath:i.modulePath,references:[i],referenceNames:new Set([a])})}return e}writeComments(e){this.comments.forEach(i=>{i.write(e)}),this.comments.length>0&&e.newLine()}getImportName({writer:e,reference:i}){let a=e.getRefNameOverride(i),l=i.name,s=a.isAlias?a.name:void 0;return`${l}${s?` as ${s}`:""}`}writeImports({writer:e,uniqueReferences:i}){if(i.size!==0){for(let[a,{modulePath:l,references:s}]of i){let E=l;if(!this.isDefinedInFile(E)){if(E[0]===this.path[0]){let b=0;for(;b<this.path.length&&b<E.length&&this.path[b]===E[b];)b++;let A=this.path.length-b;this.isInitFile&&A++;let R=A>0?".".repeat(A):".";R+=E.slice(b).join("."),e.write(`from ${R} import ${s.map(F=>this.getImportName({writer:e,reference:F})).join(", ")}`)}else e.write(`from ${a} import ${s.map(b=>this.getImportName({writer:e,reference:b})).join(", ")}`);e.newLine()}}e.newLine()}}isDefinedInFile(e){return e.length===this.path.length&&e.every((i,a)=>i===this.path[a])}};f();m();d();var nt=class extends S{constructor(e){super();y(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((i,a)=>{a>0&&e.write(", "),i.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((i,a)=>{a>0&&e.write(", "),i.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:C(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 i=new this({type:"list",value:e});return i.addReference(x.reference({name:"List",modulePath:["typing"]})),i.inheritReferences(e),i}static set(e){let i=new this({type:"set",value:e});return i.addReference(x.reference({name:"Set",modulePath:["typing"]})),i.inheritReferences(e),i}static tuple(e){let i=new this({type:"tuple",values:e});return i.addReference(x.reference({name:"Tuple",modulePath:["typing"]})),e.forEach(a=>i.inheritReferences(a)),i}static dict(e,i){let a=new this({type:"dict",keyType:e,valueType:i});return a.addReference(x.reference({name:"Dict",modulePath:["typing"]})),a.inheritReferences(e),a.inheritReferences(i),a}static none(){return new this({type:"none"})}static uuid(){let e=new this({type:"uuid"});return e.addReference(x.reference({name:"UUID",modulePath:["uuid"]})),e}static optional(e){if(this.isAlreadyOptional(e))return e;let i=new this({type:"optional",value:e});return i.addReference(x.reference({name:"Optional",modulePath:["typing"]})),i.inheritReferences(e),i}static union(e){let i=new this({type:"union",values:e});return i.addReference(x.reference({name:"Union",modulePath:["typing"]})),e.forEach(a=>i.inheritReferences(a)),i}static any(){let e=new this({type:"any"});return e.addReference(x.reference({name:"Any",modulePath:["typing"]})),e}static datetime(){let e=new this({type:"datetime"});return e.addReference(x.reference({name:"datetime",modulePath:["datetime"]})),e}static reference(e){let i=new this({type:"reference",value:e});return i.addReference(e),i}static literal(e){let i=new this({type:"literal",value:e});return i.addReference(x.reference({name:"Literal",modulePath:["typing"]})),i}static isAlreadyOptional(e){return e.internalType.type==="optional"}};f();m();d();var fe=class p extends S{constructor(e){super();y(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,i={multiline:!1,startOnNewLine:!1,endWithNewLine:!1}){return new this({type:"str",value:e,config:i})}static bytes(e){return new this({type:"bytes",value:e})}static list(e,i={endWithComma:!1}){let a=new this({type:"list",values:e,config:i});return e.forEach(l=>a.inheritReferences(l)),a}static set(e,i={endWithComma:!1}){let a=new this({type:"set",values:e,config:i});return e.forEach(l=>a.inheritReferences(l)),a}static tuple(e,i={endWithComma:!1}){let a=new this({type:"tuple",values:e,config:i});return e.forEach(l=>a.inheritReferences(l)),a}static typedDict(e,i={endWithComma:!1}){let a=new this({type:"typedDict",entries:e,config:i});return e.forEach(l=>a.inheritReferences(l.value)),a}static date(e){let i=new this({type:"date",value:e});return i.addReference(new Q({name:"date",modulePath:["datetime"]})),i}static datetime(e){let i=new this({type:"datetime",value:e});return i.addReference(new Q({name:"datetime",modulePath:["datetime"]})),i}static dict(e,i={endWithComma:!1}){let a=new this({type:"dict",entries:e,config:i});return e.forEach(l=>{a.inheritReferences(l.key),a.inheritReferences(l.value)}),a}static reference(e){let i=new this({type:"reference",value:e});return i.inheritReferences(e),i}static none(){return new this({type:"none"})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){let i=new this({type:"uuid",value:e});return i.addReference(new Q({name:"UUID",modulePath:["uuid"]})),i}static nop(){return new this({type:"nop"})}static isNop(e){return e instanceof p&&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){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(this.internalType.config?.multiline){let{startOnNewLine:i,endWithNewLine:a}=this.internalType.config;this.writeStringWithTripleQuotes({writer:e,value:this.internalType.value,startOnNewLine:i,endWithNewLine:a})}else e.write(`"${this.escapeString(this.internalType.value)}"`);break;case"date":e.write(`date.fromisoformat("${this.internalType.value}")`);break;case"datetime":{let i=this.internalType.value.replace(/Z$/,"+00:00");e.write(`datetime.fromisoformat("${i}")`);break}case"bytes":e.write(`b"${this.internalType.value}"`);break;case"list":{let i=this.internalType,a=Tt({values:i.values});if(a.length===0){e.write("[]");break}e.write("["),i.config?.multiline&&(e.newLine(),e.indent()),a.forEach((l,s)=>{s>0&&(e.write(","),i.config?.multiline?e.newLine():e.write(" ")),l.write(e),s===a.length-1&&i.config?.endWithComma&&e.write(",")}),i.config?.multiline&&(e.newLine(),e.dedent()),e.write("]");break}case"set":{let i=this.internalType,a=Tt({values:i.values});if(a.length===0){e.write("{}");break}e.write("{"),i.config?.multiline&&(e.newLine(),e.indent()),a.forEach((l,s)=>{s>0&&(e.write(","),i.config?.multiline?e.newLine():e.write(" ")),l.write(e),s===a.length-1&&i.config?.endWithComma&&e.write(",")}),i.config?.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"tuple":{let i=this.internalType,a=Tt({values:i.values});if(a.length===0){e.write("()");break}e.write("("),i.config?.multiline&&(e.newLine(),e.indent()),a.forEach((l,s)=>{s>0&&(e.write(","),i.config?.multiline?e.newLine():e.write(" ")),l.write(e),(a.length===1||s===a.length-1&&i.config?.endWithComma)&&e.write(",")}),i.config?.multiline&&(e.newLine(),e.dedent()),e.write(")");break}case"dict":{let i=this.internalType,a=Na({entries:i.entries});if(a.length===0){e.write("{}");break}e.write("{"),i.config?.multiline&&(e.newLine(),e.indent()),a.forEach((l,s)=>{s>0&&(e.write(","),i.config?.multiline?e.newLine():e.write(" ")),l.key.write(e),e.write(": "),l.value.write(e),s===a.length-1&&i.config?.endWithComma&&e.write(",")}),i.config?.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"typedDict":{let i=this.internalType,a=Sa({entries:i.entries});if(a.length===0){e.write("{}");break}e.write("{"),i.config?.multiline&&(e.writeLine(),e.indent()),a.forEach((l,s)=>{s>0&&(e.write(","),i.config?.multiline?e.newLine():e.write(" ")),e.write(`"${l.name}": `),l.value.write(e)}),i.config?.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:C(this.internalType)}}writeStringWithTripleQuotes({writer:e,value:i,startOnNewLine:a,endWithNewLine:l}){e.write('"""');let s=i.split(`
|
|
17
17
|
`);if(s.length<=1){e.write(this.escapeString(s[0]??"")),e.write('"""');return}a&&e.writeNoIndent(`\\
|
|
18
18
|
`),s.forEach((E,b)=>{e.writeNoIndent(this.escapeString(E)),b===s.length-1?l&&e.writeNoIndent(`\\
|
|
19
19
|
`):e.writeNoIndent(`
|
|
20
|
-
`)}),e.writeNoIndent('"""')}escapeString(e){let i=/(?<!\\)(["'\\\t\n\r])/g,a={'"':'\\"',"'":"\\'","\\":"\\\\"," ":"\\t","\n":"\\n","\r":"\\r"};return e.replace(i,l=>a[l]??l)}writeUnknown({writer:e,value:i}){switch(typeof i){case"boolean":e.write(i?"True":"False");return;case"string":e.write(`"${this.escapeString(i)}"`);return;case"number":e.write(i.toString());return;case"object":if(i==null){e.write("None");return}if(Array.isArray(i)){this.writeUnknownArray({writer:e,value:i});return}this.writeUnknownObject({writer:e,value:i});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof i}`)}}writeUnknownArray({writer:e,value:i}){if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let a of i)e.writeNode(p.unknown(a)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:i}){let a=Object.entries(i);if(a.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[l,s]of a)e.write(`"${l}": `),e.writeNode(p.unknown(s)),e.writeLine(",");e.dedent(),e.write("}")}};function Na({entries:p}){return p.filter(t=>!ce.isNop(t.key)&&!ce.isNop(t.value))}function Sa({entries:p}){return p.filter(t=>!ce.isNop(t.value))}function Tt({values:p}){return p.filter(t=>!ce.isNop(t))}function Ba(p){return new be(p)}function Pa(p){return new rt(p)}function Fa(p){return new ke(p)}function Ca(p){return new se(p)}function ka(p){return new Te(p)}function La(p){return new Ae(p)}function Ua(p){return new Q(p)}function Ma(p){return new fe(p)}function Oa(p){return new ue(p)}function _a(p){return new ne(p)}function Da(p){return new Re(p)}function Va(p){return new Ne(p)}function $a(p){return new Se(p)}function ja(p){return new le(p)}function Wa(p){return new Ee(p)}function qa(p){return new Fe(p)}function Ga(p){return new pe(p)}function za(p){return new Pe(p)}function Ha(p){return new Ce(p)}c();m();d();var Qa="value",it=class{constructor({context:t}){y(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?x.TypeInstantiation.none():(this.context.errors.add({severity:P.Critical,message:"Expected non-null value, but got null"}),x.TypeInstantiation.nop());if(t.value===void 0)return x.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?x.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 x.TypeInstantiation.unknown(t.value);default:C(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let i=this.context.getValueAsBoolean({value:e});return i==null?x.TypeInstantiation.nop():x.TypeInstantiation.bool(i)}case"string":{let i=this.context.getValueAsString({value:e});return i==null?x.TypeInstantiation.nop():x.TypeInstantiation.str(i)}default:C(t)}}convertList({list:t,value:e}){return Array.isArray(e)?x.TypeInstantiation.list(e.map((i,a)=>{this.context.errors.scope({index:a});try{return this.convert({typeReference:t,value:i})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:P.Critical,message:`Expected array but got: ${typeof e}`}),x.TypeInstantiation.nop())}convertSet({set:t,value:e}){return Array.isArray(e)?x.TypeInstantiation.list(e.map((i,a)=>{this.context.errors.scope({index:a});try{return this.convert({typeReference:t,value:i})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:P.Critical,message:`Expected array but got: ${typeof e}`}),x.TypeInstantiation.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:P.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),x.TypeInstantiation.nop()):x.TypeInstantiation.dict(Object.entries(e).map(([i,a])=>{this.context.errors.scope(i);try{return{key:this.convert({typeReference:t.key,value:i,as:"key"}),value:this.convert({typeReference:t.value,value:a})}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertNamed({named:t,value:e,as:i}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:i});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:C(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let i=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(i==null)return x.TypeInstantiation.nop();let a=i.singleDiscriminatedUnionType,l=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:i,unionVariant:a});if(l==null)return x.TypeInstantiation.nop();let s={name:this.context.getPropertyName(t.discriminant.name),value:x.TypeInstantiation.str(a.discriminantValue.wireValue)};return x.TypeInstantiation.typedDict([s,...l],{multiline:!0})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){let i=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});switch(e.type){case"samePropertiesAsObject":{let a=this.context.resolveNamedType({typeId:e.typeId});if(a==null)return;let l=this.convertNamed({named:a,value:t.value});if(!l.isTypedDict()){this.context.errors.add({severity:P.Critical,message:"Internal error; expected union value to be an object"});return}let s=l.asTypedDictOrThrow();return[...i,...s.entries]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let a=this.context.getRecord(t.value);return a==null?[...i,{name:Qa,value:this.convert({typeReference:e.typeReference,value:t.value})}]:[...i,{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:a[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return i;default:C(e)}}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){return this.context.associateByWireValue({parameters:e.properties??[],values:this.context.getRecord(t.value)??{},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}){let i=this.context.associateByWireValue({parameters:t.properties,values:this.context.getRecord(e)??{}});return x.TypeInstantiation.typedDict(i.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()}}),{multiline:!0})}convertEnum({enum_:t,value:e}){let i=this.getEnumValue({enum_:t,value:e});return i==null?x.TypeInstantiation.nop():x.TypeInstantiation.str(i)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:P.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(a=>a.wireValue===e)==null){this.context.errors.add({severity:P.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return e}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let i=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return i??x.TypeInstantiation.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let i of t.types)try{return this.convert({typeReference:i,value:e})}catch{continue}this.context.errors.add({severity:P.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertPrimitive({primitive:t,value:e,as:i}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let a=this.getValueAsNumber({value:e,as:i});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.int(a)}case"FLOAT":case"DOUBLE":{let a=this.getValueAsNumber({value:e});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.float(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:e,as:i});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.bool(a)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let a=this.context.getValueAsString({value:e});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.str(a)}case"UUID":{let a=this.context.getValueAsString({value:e});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.uuid(a)}case"DATE":{let a=this.context.getValueAsString({value:e});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.date(a)}case"DATE_TIME":{let a=this.context.getValueAsString({value:e});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.datetime(a)}default:C(t)}}getValueAsNumber({value:t,as:e}){let i=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:t,as:e}){let i=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:i})}};c();m();d();var ot=class{constructor({context:t}){y(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){let i={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(e)??{};for(let l of t.properties)switch(l.type){case"file":{let s=this.getSingleFileProperty({property:l,record:a});if(x.TypeInstantiation.isNop(s))break;i.fileFields.push({name:this.context.getPropertyName(l.name),value:s});break}case"fileArray":{let s=this.getArrayFileProperty({property:l,record:a});if(x.TypeInstantiation.isNop(s))break;i.fileFields.push({name:this.context.getPropertyName(l.name),value:s});break}case"bodyProperty":{let s=this.getBodyProperty({property:l,record:a});if(x.TypeInstantiation.isNop(s))break;i.bodyPropertyFields.push({name:this.context.getPropertyName(l.name.name),value:s});break}default:C(l)}return i}getSingleFileProperty({property:t,record:e}){let i=this.context.getSingleFileValue({property:t,record:e});return i==null&&(i=`example_${t.wireValue??"file"}`),this.context.getFileFromString(i)}getArrayFileProperty({property:t,record:e}){let i=this.context.getFileArrayValues({property:t,record:e});return i==null?x.TypeInstantiation.nop():x.TypeInstantiation.list(i.map(a=>this.context.getFileFromString(a)))}getBodyProperty({property:t,record:e}){let i=e[t.name.wireValue];return i==null?x.TypeInstantiation.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:i})}};var Ya=["list","set"],at=class p extends qe{constructor({ir:e,config:i}){super({ir:e,config:i});y(this,"ir");y(this,"customConfig");y(this,"dynamicTypeLiteralMapper");y(this,"filePropertyMapper");this.ir=e,this.customConfig=i.customConfig??{},this.dynamicTypeLiteralMapper=new it({context:this}),this.filePropertyMapper=new ot({context:this})}clone(){return new p({ir:this.ir,config:this.config})}getClassName(e){let i=e.pascalCase.safeName,a=this.getRootClientClassName();return i===a?`${a}Model`:i}getTypedDictClassName(e){return`${this.getClassName(e)}Params`}getPropertyName(e){let i=e.snakeCase.safeName;return i.startsWith("_")?"f_"+i.substring(i.lastIndexOf("_")+1):i}getMethodName(e){return Ya.includes(e.snakeCase.unsafeName)?e.snakeCase.unsafeName:e.snakeCase.safeName}getRootClientClassReference(){return x.reference({name:this.getRootClientClassName(),modulePath:this.getRootModulePath()})}getRootClientClassName(){return this.customConfig.client?.exported_class_name!=null?this.customConfig.client.exported_class_name:this.customConfig.client_class_name!=null?this.customConfig.client_class_name:this.customConfig.client?.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 i=this.resolveEnvironmentName(e);if(i!=null)return x.accessAttribute({lhs:this.getEnvironmentClassReference(),rhs:x.codeBlock(this.getEnvironmentEnumName(i))})}getEnvironmentClassReference(){return x.reference({name:this.getEnvironmentClassName(),modulePath:this.getEnvironmentModulePath()})}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 i=this.resolveNamedType({typeId:e.value});if(i==null)return!1;switch(i.type){case"alias":return this.isPrimitive(i.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:C(i)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:C(e)}}getFileFromString(e){return x.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")}getEnvironmentModulePath(){return this.getRootModulePath().concat("environment")}shouldInlinePathParameters(){return!0}cleanOrganizationName(){return this.config.organization.replace(/[^a-zA-Z0-9]/g,"_")}getApiName(){return vt(this.config.workspaceName)}pascalCase(e){let i=wt(e);return i.charAt(0).toUpperCase()+i.slice(1)}};c();m();d();var Za={type:"primitive",value:"STRING"},Ja=["example"],pi="client",st="request",ut=class{constructor({context:t}){y(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()}async generateSnippetAst({endpoint:t,request:e}){return this.buildPythonFile({endpoint:t,snippet:e})}generateMethodCallSnippetAst({endpoint:t,request:e}){return this.callMethod({endpoint:t,snippet:e})}buildPythonFile({endpoint:t,snippet:e}){return x.file({path:Ja,statements:[this.constructClient({endpoint:t,snippet:e}),this.callMethod({endpoint:t,snippet:e})]})}constructClient({endpoint:t,snippet:e}){return x.assign({lhs:x.reference({name:pi}),rhs:x.instantiateClass({classReference:this.context.getRootClientClassReference(),arguments_:this.getConstructorArgs({endpoint:t,snippet:e}).map(i=>x.methodArgument({name:i.name,value:i.value})),multiline:!0})})}getConstructorArgs({endpoint:t,snippet:e}){let i=[],a=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return a.length>0&&i.push(...a),t.auth!=null&&(e.auth!=null?i.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:P.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(Z.PathParameters),this.context.ir.pathParameters!=null&&i.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(Z.Headers),this.context.ir.headers!=null&&e.headers!=null&&i.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),i}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let i=this.getEnvironmentValue({baseUrl:t,environment:e});return i==null?[]:e!=null&&this.context.isMultiEnvironmentValues(e)?[{name:"environment",value:i}]:[{name:this.getEnvironmentOptionName({environment:e}),value:i}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:P.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return x.TypeInstantiation.str(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let i=this.context.getEnvironmentTypeReferenceFromID(e);if(i==null){this.context.errors.add({severity:P.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return x.TypeInstantiation.reference(i)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?x.TypeInstantiation.reference(x.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.entries(e).map(([i,a])=>({name:i,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Za,value:a})})).map(i=>x.methodArgument({name:i.name,value:i.value})),multiline:!0})):void 0}}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBasicAuthArg({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.addAuthMismatchError(t,e),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.addAuthMismatchError(t,e),[]):this.getConstructorOAuthArgs({auth:t,values:e});case"inferred":return e.type!=="inferred"?(this.addAuthMismatchError(t,e),[]):(this.addWarning("The Python SDK Generator does not support Inferred auth scheme yet"),[]);default:C(t)}}addAuthMismatchError(t,e){this.context.errors.add({severity:P.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message})}addWarning(t){this.context.errors.add({severity:P.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:x.TypeInstantiation.str(e.username)},{name:this.context.getPropertyName(t.password),value:x.TypeInstantiation.str(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:x.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:x.TypeInstantiation.str(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:x.TypeInstantiation.str(e.clientSecret)}]}getConstructorHeaderArgs({headers:t,values:e}){let i=[];for(let a of t){let l=this.getConstructorHeaderArg({header:a,value:e.value});l!=null&&i.push(l)}return i}getConstructorHeaderArg({header:t,value:e}){let i=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!x.TypeInstantiation.isNop(i))return{name:this.context.getPropertyName(t.name.name),value:i}}callMethod({endpoint:t,snippet:e}){return x.invokeMethod({on:x.reference({name:pi}),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}).filter(i=>!x.TypeInstantiation.isNop(i.value)).map(i=>x.methodArgument({name:i.name,value:i.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:C(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){let i=[];this.context.errors.scope(Z.PathParameters);let a=[...this.context.ir.pathParameters??[],...t.pathParameters??[]],l=new Set;if(t.body!=null){let s=this.getBodyRequestArgs({body:t.body,value:e.requestBody});if(l=new Set(s.map(E=>E.name)),t.body.type==="typeReference"){let E=t.body.value;if(E.type==="named"){let b=this.context.resolveNamedType({typeId:E.value});if(b!=null&&b.type==="object")for(let A of b.properties)this.resolvesToLiteralType(A.typeReference)||l.add(this.context.getPropertyName(A.name.name))}}}if(a.length>0){let E=this.getPathParameters({namedParameters:a,snippet:e}).map(b=>l.has(b.name)?{...b,name:b.name+"_"}:b);i.push(...E)}return this.context.errors.unscope(),this.context.errors.scope(Z.RequestBody),t.body!=null&&i.push(...this.getBodyRequestArgs({body:t.body,value:e.requestBody})),this.context.errors.unscope(),i}getBodyRequestArgs({body:t,value:e}){switch(t.type){case"bytes":return[{name:st,value:this.getBytesBodyRequestTypeInstantiation({value:e})}];case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:e});default:C(t)}}getBodyRequestArgsForTypeReference({typeReference:t,value:e}){switch(t.type){case"named":{let i=this.context.resolveNamedType({typeId:t.value});return i==null?[]:this.getBodyRequestArgsForNamedTypeReference({typeReference:t,named:i,value:e})}case"nullable":case"optional":{let i=t.value;return i.type==="named"&&this.context.resolveNamedType({typeId:i.value})?.type==="object"?[{name:st,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:i,value:e})}]:this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:e})}case"list":case"map":case"set":case"literal":case"primitive":case"unknown":return[{name:st,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:e})}];default:C(t)}}getBodyRequestArgsForNamedTypeReference({typeReference:t,named:e,value:i}){switch(e.type){case"alias":return this.getBodyRequestArgsForTypeReference({typeReference:e.typeReference,value:i});case"enum":case"discriminatedUnion":case"undiscriminatedUnion":return[{name:st,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:i})}];case"object":return this.context.associateByWireValue({parameters:e.properties,values:this.context.getRecord(i)??{}}).filter(s=>!this.resolvesToLiteralType(s.typeReference)).map(s=>({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)}));default:C(e)}}resolvesToLiteralType(t){switch(t.type){case"literal":return!0;case"optional":case"nullable":return this.resolvesToLiteralType(t.value);case"named":{let e=this.context.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.resolvesToLiteralType(e.typeReference):!1}case"list":case"map":case"set":case"primitive":case"unknown":return!1;default:C(t)}}getBodyRequestArgsForBytes({body:t,value:e}){let i=this.getBytesBodyRequestTypeInstantiation({value:e});return x.TypeInstantiation.isNop(i)?[]:[{name:this.context.getPropertyName(t.bodyKey),value:i}]}getBytesBodyRequestTypeInstantiation({value:t}){return typeof t!="string"?(this.context.errors.add({severity:P.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),x.TypeInstantiation.nop()):x.TypeInstantiation.bytes(t)}getBodyPropertyNamesForInlinedRequest(t){if(t.body==null)return new Set;switch(t.body.type){case"referenced":{let e=t.body.bodyType;if(e.type!=="typeReference")return new Set;let i=e.value;if(i.type!=="named")return new Set;let a=this.context.resolveNamedType({typeId:i.value});if(a==null||a.type!=="object")return new Set;let l=new Set;for(let s of a.properties)this.resolvesToLiteralType(s.typeReference)||l.add(this.context.getPropertyName(s.name.name));return l}case"properties":return new Set(t.body.value.filter(e=>!this.resolvesToLiteralType(e.typeReference)).map(e=>this.context.getPropertyName(e.name.name)));case"fileUpload":return new Set(t.body.properties.filter(e=>e.type==="bodyProperty").map(e=>this.context.getPropertyName(e.name.name)));default:C(t.body)}}getMethodArgsForInlinedRequest({request:t,snippet:e}){let i=[],a=this.context.shouldInlinePathParameters();this.context.errors.scope(Z.PathParameters);let l=[];t.pathParameters!=null&&l.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(Z.RequestBody);let s=this.getFilePropertyInfo({request:t,snippet:e});this.context.errors.unscope();let E=this.getBodyPropertyNamesForInlinedRequest(t),b=l.map(A=>E.has(A.name)?{...A,name:`${A.name}_`}:A);return this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})||i.push(...b),this.context.needsRequestParameter({request:t,inlinePathParameters:a,inlineFileProperties:!0})&&i.push(...this.getInlinedRequestArgs({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})?b:[],filePropertyInfo:s})),i}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:i,filePropertyInfo:a}){this.context.errors.scope(Z.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:t.queryParameters??[],values:e.queryParameters??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert(R)}));this.context.errors.unscope(),this.context.errors.scope(Z.Headers);let b=this.context.associateByWireValue({parameters:t.headers??[],values:e.headers??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert(R)}));this.context.errors.unscope(),this.context.errors.scope(Z.RequestBody);let A=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),[...i,...s,...b,...A]}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:i}){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:i});default:C(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:e}){let i=t.bodyType;switch(i.type){case"bytes":return this.getBodyRequestArgsForBytes({body:t,value:e});case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:i.value,value:e});default:C(i)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){let i=[],l=this.context.associateByWireValue({parameters:t,values:this.context.getRecord(e)??{}}).filter(s=>!this.resolvesToLiteralType(s.typeReference));for(let s of l)i.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return i}getPathParameters({namedParameters:t,snippet:e}){let i=[],a=t.filter(s=>!this.resolvesToLiteralType(s.typeReference)),l=this.context.associateByWireValue({parameters:a,values:e.pathParameters??{},ignoreMissingParameters:!0});for(let s of l)i.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return i}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"}};var pt=class extends $e{constructor({ir:t,config:e}){super(new at({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}async generateSnippetAst(t){return super.generateSnippetAst(t)}generateMethodCallSnippetAst(t){let e=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(e.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i;for(let a of e){let l=this.context.clone(),s=this.createSnippetGenerator(l);try{return s.generateMethodCallSnippetAst({endpoint:a,request:t})}catch(E){i=E}}throw i??new Error(`Failed to generate method call snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}createSnippetGenerator(t){return new ut({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
20
|
+
`)}),e.writeNoIndent('"""')}escapeString(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/'/g,"\\'").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}writeUnknown({writer:e,value:i}){switch(typeof i){case"boolean":e.write(i?"True":"False");return;case"string":e.write(`"${this.escapeString(i)}"`);return;case"number":e.write(i.toString());return;case"object":if(i==null){e.write("None");return}if(Array.isArray(i)){this.writeUnknownArray({writer:e,value:i});return}this.writeUnknownObject({writer:e,value:i});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof i}`)}}writeUnknownArray({writer:e,value:i}){if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let a of i)e.writeNode(p.unknown(a)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:i}){let a=Object.entries(i);if(a.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[l,s]of a)e.write(`"${l}": `),e.writeNode(p.unknown(s)),e.writeLine(",");e.dedent(),e.write("}")}};function Na({entries:p}){return p.filter(t=>!fe.isNop(t.key)&&!fe.isNop(t.value))}function Sa({entries:p}){return p.filter(t=>!fe.isNop(t.value))}function Tt({values:p}){return p.filter(t=>!fe.isNop(t))}function Ba(p){return new be(p)}function Pa(p){return new rt(p)}function Fa(p){return new ke(p)}function Ca(p){return new se(p)}function ka(p){return new Te(p)}function La(p){return new Ae(p)}function Ua(p){return new Q(p)}function Ma(p){return new ce(p)}function Oa(p){return new ue(p)}function _a(p){return new ne(p)}function Da(p){return new Re(p)}function Va(p){return new Ne(p)}function $a(p){return new Se(p)}function ja(p){return new le(p)}function Wa(p){return new Ee(p)}function qa(p){return new Fe(p)}function Ga(p){return new pe(p)}function za(p){return new Pe(p)}function Ha(p){return new Ce(p)}f();m();d();var Qa="value",it=class{constructor({context:t}){y(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?x.TypeInstantiation.none():(this.context.errors.add({severity:P.Critical,message:"Expected non-null value, but got null"}),x.TypeInstantiation.nop());if(t.value===void 0)return x.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?x.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 x.TypeInstantiation.unknown(t.value);default:C(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let i=this.context.getValueAsBoolean({value:e});return i==null?x.TypeInstantiation.nop():x.TypeInstantiation.bool(i)}case"string":{let i=this.context.getValueAsString({value:e});return i==null?x.TypeInstantiation.nop():x.TypeInstantiation.str(i)}default:C(t)}}convertList({list:t,value:e}){return Array.isArray(e)?x.TypeInstantiation.list(e.map((i,a)=>{this.context.errors.scope({index:a});try{return this.convert({typeReference:t,value:i})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:P.Critical,message:`Expected array but got: ${typeof e}`}),x.TypeInstantiation.nop())}convertSet({set:t,value:e}){return Array.isArray(e)?x.TypeInstantiation.list(e.map((i,a)=>{this.context.errors.scope({index:a});try{return this.convert({typeReference:t,value:i})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:P.Critical,message:`Expected array but got: ${typeof e}`}),x.TypeInstantiation.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:P.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),x.TypeInstantiation.nop()):x.TypeInstantiation.dict(Object.entries(e).map(([i,a])=>{this.context.errors.scope(i);try{return{key:this.convert({typeReference:t.key,value:i,as:"key"}),value:this.convert({typeReference:t.value,value:a})}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertNamed({named:t,value:e,as:i}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:e,as:i});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:C(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let i=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(i==null)return x.TypeInstantiation.nop();let a=i.singleDiscriminatedUnionType,l=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:i,unionVariant:a});if(l==null)return x.TypeInstantiation.nop();let s={name:this.context.getPropertyName(t.discriminant.name),value:x.TypeInstantiation.str(a.discriminantValue.wireValue)};return x.TypeInstantiation.typedDict([s,...l],{multiline:!0})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){let i=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});switch(e.type){case"samePropertiesAsObject":{let a=this.context.resolveNamedType({typeId:e.typeId});if(a==null)return;let l=this.convertNamed({named:a,value:t.value});if(!l.isTypedDict()){this.context.errors.add({severity:P.Critical,message:"Internal error; expected union value to be an object"});return}let s=l.asTypedDictOrThrow();return[...i,...s.entries]}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let a=this.context.getRecord(t.value);return a==null?[...i,{name:Qa,value:this.convert({typeReference:e.typeReference,value:t.value})}]:[...i,{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:a[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return i;default:C(e)}}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e}){return this.context.associateByWireValue({parameters:e.properties??[],values:this.context.getRecord(t.value)??{},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}){let i=this.context.associateByWireValue({parameters:t.properties,values:this.context.getRecord(e)??{}});return x.TypeInstantiation.typedDict(i.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()}}),{multiline:!0})}convertEnum({enum_:t,value:e}){let i=this.getEnumValue({enum_:t,value:e});return i==null?x.TypeInstantiation.nop():x.TypeInstantiation.str(i)}getEnumValue({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:P.Critical,message:`Expected enum value string, got: ${typeof e}`});return}if(t.values.find(a=>a.wireValue===e)==null){this.context.errors.add({severity:P.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return e}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let i=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return i??x.TypeInstantiation.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e}){for(let i of t.types)try{return this.convert({typeReference:i,value:e})}catch{continue}this.context.errors.add({severity:P.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertPrimitive({primitive:t,value:e,as:i}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let a=this.getValueAsNumber({value:e,as:i});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.int(a)}case"FLOAT":case"DOUBLE":{let a=this.getValueAsNumber({value:e});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.float(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:e,as:i});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.bool(a)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let a=this.context.getValueAsString({value:e});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.str(a)}case"UUID":{let a=this.context.getValueAsString({value:e});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.uuid(a)}case"DATE":{let a=this.context.getValueAsString({value:e});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.date(a)}case"DATE_TIME":{let a=this.context.getValueAsString({value:e});return a==null?x.TypeInstantiation.nop():x.TypeInstantiation.datetime(a)}default:C(t)}}getValueAsNumber({value:t,as:e}){let i=e==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:t,as:e}){let i=e==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:i})}};f();m();d();var ot=class{constructor({context:t}){y(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){let i={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(e)??{};for(let l of t.properties)switch(l.type){case"file":{let s=this.getSingleFileProperty({property:l,record:a});if(x.TypeInstantiation.isNop(s))break;i.fileFields.push({name:this.context.getPropertyName(l.name),value:s});break}case"fileArray":{let s=this.getArrayFileProperty({property:l,record:a});if(x.TypeInstantiation.isNop(s))break;i.fileFields.push({name:this.context.getPropertyName(l.name),value:s});break}case"bodyProperty":{let s=this.getBodyProperty({property:l,record:a});if(x.TypeInstantiation.isNop(s))break;i.bodyPropertyFields.push({name:this.context.getPropertyName(l.name.name),value:s});break}default:C(l)}return i}getSingleFileProperty({property:t,record:e}){let i=this.context.getSingleFileValue({property:t,record:e});return i==null&&(i=`example_${t.wireValue??"file"}`),this.context.getFileFromString(i)}getArrayFileProperty({property:t,record:e}){let i=this.context.getFileArrayValues({property:t,record:e});return i==null?x.TypeInstantiation.nop():x.TypeInstantiation.list(i.map(a=>this.context.getFileFromString(a)))}getBodyProperty({property:t,record:e}){let i=e[t.name.wireValue];return i==null?x.TypeInstantiation.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:i})}};var Ya=["list","set"],at=class p extends qe{constructor({ir:e,config:i}){super({ir:e,config:i});y(this,"ir");y(this,"customConfig");y(this,"dynamicTypeLiteralMapper");y(this,"filePropertyMapper");this.ir=e,this.customConfig=i.customConfig??{},this.dynamicTypeLiteralMapper=new it({context:this}),this.filePropertyMapper=new ot({context:this})}clone(){return new p({ir:this.ir,config:this.config})}getClassName(e){let i=e.pascalCase.safeName,a=this.getRootClientClassName();return i===a?`${a}Model`:i}getTypedDictClassName(e){return`${this.getClassName(e)}Params`}getPropertyName(e){let i=e.snakeCase.safeName;return i.startsWith("_")?"f_"+i.substring(i.lastIndexOf("_")+1):i}getMethodName(e){return Ya.includes(e.snakeCase.unsafeName)?e.snakeCase.unsafeName:e.snakeCase.safeName}getRootClientClassReference(){return x.reference({name:this.getRootClientClassName(),modulePath:this.getRootModulePath()})}getRootClientClassName(){return this.customConfig.client?.exported_class_name!=null?this.customConfig.client.exported_class_name:this.customConfig.client_class_name!=null?this.customConfig.client_class_name:this.customConfig.client?.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 i=this.resolveEnvironmentName(e);if(i!=null)return x.accessAttribute({lhs:this.getEnvironmentClassReference(),rhs:x.codeBlock(this.getEnvironmentEnumName(i))})}getEnvironmentClassReference(){return x.reference({name:this.getEnvironmentClassName(),modulePath:this.getEnvironmentModulePath()})}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 i=this.resolveNamedType({typeId:e.value});if(i==null)return!1;switch(i.type){case"alias":return this.isPrimitive(i.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:C(i)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:C(e)}}getFileFromString(e){return x.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")}getEnvironmentModulePath(){return this.getRootModulePath().concat("environment")}shouldInlinePathParameters(){return!0}cleanOrganizationName(){return this.config.organization.replace(/[^a-zA-Z0-9]/g,"_")}getApiName(){return vt(this.config.workspaceName)}pascalCase(e){let i=wt(e);return i.charAt(0).toUpperCase()+i.slice(1)}};f();m();d();var Za={type:"primitive",value:"STRING"},Ja=["example"],pi="client",st="request",ut=class{constructor({context:t}){y(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()}async generateSnippetAst({endpoint:t,request:e}){return this.buildPythonFile({endpoint:t,snippet:e})}generateMethodCallSnippetAst({endpoint:t,request:e}){return this.callMethod({endpoint:t,snippet:e})}buildPythonFile({endpoint:t,snippet:e}){return x.file({path:Ja,statements:[this.constructClient({endpoint:t,snippet:e}),this.callMethod({endpoint:t,snippet:e})]})}constructClient({endpoint:t,snippet:e}){return x.assign({lhs:x.reference({name:pi}),rhs:x.instantiateClass({classReference:this.context.getRootClientClassReference(),arguments_:this.getConstructorArgs({endpoint:t,snippet:e}).map(i=>x.methodArgument({name:i.name,value:i.value})),multiline:!0})})}getConstructorArgs({endpoint:t,snippet:e}){let i=[],a=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return a.length>0&&i.push(...a),t.auth!=null&&(e.auth!=null?i.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:P.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(Z.PathParameters),this.context.ir.pathParameters!=null&&i.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(Z.Headers),this.context.ir.headers!=null&&e.headers!=null&&i.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),i}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let i=this.getEnvironmentValue({baseUrl:t,environment:e});return i==null?[]:e!=null&&this.context.isMultiEnvironmentValues(e)?[{name:"environment",value:i}]:[{name:this.getEnvironmentOptionName({environment:e}),value:i}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:P.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return x.TypeInstantiation.str(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let i=this.context.getEnvironmentTypeReferenceFromID(e);if(i==null){this.context.errors.add({severity:P.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return x.TypeInstantiation.reference(i)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?x.TypeInstantiation.reference(x.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.entries(e).map(([i,a])=>({name:i,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Za,value:a})})).map(i=>x.methodArgument({name:i.name,value:i.value})),multiline:!0})):void 0}}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBasicAuthArg({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.addAuthMismatchError(t,e),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.addAuthMismatchError(t,e),[]):this.getConstructorOAuthArgs({auth:t,values:e});case"inferred":return e.type!=="inferred"?(this.addAuthMismatchError(t,e),[]):(this.addWarning("The Python SDK Generator does not support Inferred auth scheme yet"),[]);default:C(t)}}addAuthMismatchError(t,e){this.context.errors.add({severity:P.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message})}addWarning(t){this.context.errors.add({severity:P.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:x.TypeInstantiation.str(e.username)},{name:this.context.getPropertyName(t.password),value:x.TypeInstantiation.str(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:x.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:x.TypeInstantiation.str(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:x.TypeInstantiation.str(e.clientSecret)}]}getConstructorHeaderArgs({headers:t,values:e}){let i=[];for(let a of t){let l=this.getConstructorHeaderArg({header:a,value:e.value});l!=null&&i.push(l)}return i}getConstructorHeaderArg({header:t,value:e}){let i=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!x.TypeInstantiation.isNop(i))return{name:this.context.getPropertyName(t.name.name),value:i}}callMethod({endpoint:t,snippet:e}){return x.invokeMethod({on:x.reference({name:pi}),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}).filter(i=>!x.TypeInstantiation.isNop(i.value)).map(i=>x.methodArgument({name:i.name,value:i.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:C(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){let i=[];this.context.errors.scope(Z.PathParameters);let a=[...this.context.ir.pathParameters??[],...t.pathParameters??[]],l=new Set;if(t.body!=null){let s=this.getBodyRequestArgs({body:t.body,value:e.requestBody});if(l=new Set(s.map(E=>E.name)),t.body.type==="typeReference"){let E=t.body.value;if(E.type==="named"){let b=this.context.resolveNamedType({typeId:E.value});if(b!=null&&b.type==="object")for(let A of b.properties)this.resolvesToLiteralType(A.typeReference)||l.add(this.context.getPropertyName(A.name.name))}}}if(a.length>0){let E=this.getPathParameters({namedParameters:a,snippet:e}).map(b=>l.has(b.name)?{...b,name:b.name+"_"}:b);i.push(...E)}return this.context.errors.unscope(),this.context.errors.scope(Z.RequestBody),t.body!=null&&i.push(...this.getBodyRequestArgs({body:t.body,value:e.requestBody})),this.context.errors.unscope(),i}getBodyRequestArgs({body:t,value:e}){switch(t.type){case"bytes":return[{name:st,value:this.getBytesBodyRequestTypeInstantiation({value:e})}];case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:e});default:C(t)}}getBodyRequestArgsForTypeReference({typeReference:t,value:e}){switch(t.type){case"named":{let i=this.context.resolveNamedType({typeId:t.value});return i==null?[]:this.getBodyRequestArgsForNamedTypeReference({typeReference:t,named:i,value:e})}case"nullable":case"optional":{let i=t.value;return i.type==="named"&&this.context.resolveNamedType({typeId:i.value})?.type==="object"?[{name:st,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:i,value:e})}]:this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:e})}case"list":case"map":case"set":case"literal":case"primitive":case"unknown":return[{name:st,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:e})}];default:C(t)}}getBodyRequestArgsForNamedTypeReference({typeReference:t,named:e,value:i}){switch(e.type){case"alias":return this.getBodyRequestArgsForTypeReference({typeReference:e.typeReference,value:i});case"enum":case"discriminatedUnion":case"undiscriminatedUnion":return[{name:st,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:i})}];case"object":return this.context.associateByWireValue({parameters:e.properties,values:this.context.getRecord(i)??{}}).filter(s=>!this.resolvesToLiteralType(s.typeReference)).map(s=>({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)}));default:C(e)}}resolvesToLiteralType(t){switch(t.type){case"literal":return!0;case"optional":case"nullable":return this.resolvesToLiteralType(t.value);case"named":{let e=this.context.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.resolvesToLiteralType(e.typeReference):!1}case"list":case"map":case"set":case"primitive":case"unknown":return!1;default:C(t)}}getBodyRequestArgsForBytes({body:t,value:e}){let i=this.getBytesBodyRequestTypeInstantiation({value:e});return x.TypeInstantiation.isNop(i)?[]:[{name:this.context.getPropertyName(t.bodyKey),value:i}]}getBytesBodyRequestTypeInstantiation({value:t}){return typeof t!="string"?(this.context.errors.add({severity:P.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),x.TypeInstantiation.nop()):x.TypeInstantiation.bytes(t)}getBodyPropertyNamesForInlinedRequest(t){if(t.body==null)return new Set;switch(t.body.type){case"referenced":{let e=t.body.bodyType;if(e.type!=="typeReference")return new Set;let i=e.value;if(i.type!=="named")return new Set;let a=this.context.resolveNamedType({typeId:i.value});if(a==null||a.type!=="object")return new Set;let l=new Set;for(let s of a.properties)this.resolvesToLiteralType(s.typeReference)||l.add(this.context.getPropertyName(s.name.name));return l}case"properties":return new Set(t.body.value.filter(e=>!this.resolvesToLiteralType(e.typeReference)).map(e=>this.context.getPropertyName(e.name.name)));case"fileUpload":return new Set(t.body.properties.filter(e=>e.type==="bodyProperty").map(e=>this.context.getPropertyName(e.name.name)));default:C(t.body)}}getMethodArgsForInlinedRequest({request:t,snippet:e}){let i=[],a=this.context.shouldInlinePathParameters();this.context.errors.scope(Z.PathParameters);let l=[];t.pathParameters!=null&&l.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(Z.RequestBody);let s=this.getFilePropertyInfo({request:t,snippet:e});this.context.errors.unscope();let E=this.getBodyPropertyNamesForInlinedRequest(t),b=l.map(A=>E.has(A.name)?{...A,name:`${A.name}_`}:A);return this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})||i.push(...b),this.context.needsRequestParameter({request:t,inlinePathParameters:a,inlineFileProperties:!0})&&i.push(...this.getInlinedRequestArgs({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})?b:[],filePropertyInfo:s})),i}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:i,filePropertyInfo:a}){this.context.errors.scope(Z.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:t.queryParameters??[],values:e.queryParameters??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert(R)}));this.context.errors.unscope(),this.context.errors.scope(Z.Headers);let b=this.context.associateByWireValue({parameters:t.headers??[],values:e.headers??{}}).map(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert(R)}));this.context.errors.unscope(),this.context.errors.scope(Z.RequestBody);let A=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),[...i,...s,...b,...A]}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:i}){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:i});default:C(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:e}){let i=t.bodyType;switch(i.type){case"bytes":return this.getBodyRequestArgsForBytes({body:t,value:e});case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:i.value,value:e});default:C(i)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){let i=[],l=this.context.associateByWireValue({parameters:t,values:this.context.getRecord(e)??{}}).filter(s=>!this.resolvesToLiteralType(s.typeReference));for(let s of l)i.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return i}getPathParameters({namedParameters:t,snippet:e}){let i=[],a=t.filter(s=>!this.resolvesToLiteralType(s.typeReference)),l=this.context.associateByWireValue({parameters:a,values:e.pathParameters??{},ignoreMissingParameters:!0});for(let s of l)i.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return i}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"}};var pt=class extends $e{constructor({ir:t,config:e}){super(new at({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}async generateSnippetAst(t){return super.generateSnippetAst(t)}generateMethodCallSnippetAst(t){let e=this.context.resolveEndpointLocationOrThrow(t.endpoint);if(e.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i;for(let a of e){let l=this.context.clone(),s=this.createSnippetGenerator(l);try{return s.generateMethodCallSnippetAst({endpoint:a,request:t})}catch(E){i=E}}throw i??new Error(`Failed to generate method call snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}generateMethodCallSnippetAstById({endpointId:t,request:e}){let i=this.context.resolveEndpointByIdOrThrow(t),a=this.context.clone();return this.createSnippetGenerator(a).generateMethodCallSnippetAst({endpoint:i,request:e})}createSnippetGenerator(t){return new ut({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
21
21
|
/*! Bundled license information:
|
|
22
22
|
|
|
23
23
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|