@fern-api/php-dynamic-snippets 1.25.0 → 1.25.2
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 +44 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +164 -0
- package/dist/index.d.ts +164 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/package.json +11 -12
- package/cjs/DynamicSnippetsGenerator.cjs +0 -49
- package/cjs/DynamicSnippetsGenerator.cjs.map +0 -1
- package/cjs/DynamicSnippetsGenerator.d.cts +0 -18
- package/cjs/DynamicSnippetsGeneratorContext-CwkDTYOI.d.cts +0 -83
- package/cjs/EndpointSnippetGenerator.cjs +0 -49
- package/cjs/EndpointSnippetGenerator.cjs.map +0 -1
- package/cjs/EndpointSnippetGenerator.d.cts +0 -76
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +0 -47
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +0 -1
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +0 -4
- package/cjs/context/DynamicTypeLiteralMapper.cjs +0 -47
- package/cjs/context/DynamicTypeLiteralMapper.cjs.map +0 -1
- package/cjs/context/DynamicTypeLiteralMapper.d.cts +0 -4
- package/cjs/context/FilePropertyMapper.cjs +0 -47
- package/cjs/context/FilePropertyMapper.cjs.map +0 -1
- package/cjs/context/FilePropertyMapper.d.cts +0 -4
- package/cjs/index.cjs +0 -49
- package/cjs/index.cjs.map +0 -1
- package/cjs/index.d.cts +0 -6
- package/esm/DynamicSnippetsGenerator.d.ts +0 -18
- package/esm/DynamicSnippetsGenerator.js +0 -2
- package/esm/DynamicSnippetsGenerator.js.map +0 -1
- package/esm/DynamicSnippetsGeneratorContext-CwkDTYOI.d.ts +0 -83
- package/esm/EndpointSnippetGenerator.d.ts +0 -76
- package/esm/EndpointSnippetGenerator.js +0 -2
- package/esm/EndpointSnippetGenerator.js.map +0 -1
- package/esm/chunk-34WVNBJS.js +0 -47
- package/esm/chunk-34WVNBJS.js.map +0 -1
- package/esm/chunk-BN32SYGE.js +0 -2
- package/esm/chunk-BN32SYGE.js.map +0 -1
- package/esm/chunk-F7LTKJMT.js +0 -2
- package/esm/chunk-F7LTKJMT.js.map +0 -1
- package/esm/chunk-MZ7AWQF7.js +0 -2
- package/esm/chunk-MZ7AWQF7.js.map +0 -1
- package/esm/chunk-P7HYTUQU.js +0 -4
- package/esm/chunk-P7HYTUQU.js.map +0 -1
- package/esm/chunk-Q7QB5SA5.js +0 -2
- package/esm/chunk-Q7QB5SA5.js.map +0 -1
- package/esm/chunk-U6JJRNQH.js +0 -2
- package/esm/chunk-U6JJRNQH.js.map +0 -1
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +0 -4
- package/esm/context/DynamicSnippetsGeneratorContext.js +0 -2
- package/esm/context/DynamicSnippetsGeneratorContext.js.map +0 -1
- package/esm/context/DynamicTypeLiteralMapper.d.ts +0 -4
- package/esm/context/DynamicTypeLiteralMapper.js +0 -2
- package/esm/context/DynamicTypeLiteralMapper.js.map +0 -1
- package/esm/context/FilePropertyMapper.d.ts +0 -4
- package/esm/context/FilePropertyMapper.js +0 -2
- package/esm/context/FilePropertyMapper.js.map +0 -1
- package/esm/index.d.ts +0 -6
- package/esm/index.js +0 -2
- package/esm/index.js.map +0 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var Br=Object.defineProperty;var Qa=(r,t,e)=>t in r?Br(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var ze=(r,t)=>()=>(r&&(t=r(r=0)),t);var Pr=(r,t)=>{for(var e in t)Br(r,e,{get:t[e],enumerable:!0})};var x=(r,t,e)=>Qa(r,typeof t!="symbol"?t+"":t,e);var s=ze(()=>{"use strict"});var h={};Pr(h,{_debugEnd:()=>Tn,_debugProcess:()=>bn,_events:()=>Mn,_eventsCount:()=>Dn,_exiting:()=>tn,_fatalExceptions:()=>gn,_getActiveHandles:()=>an,_getActiveRequests:()=>on,_kill:()=>un,_linkedBinding:()=>Qr,_maxListeners:()=>On,_preload_modules:()=>Fn,_rawDebug:()=>Zr,_startProfilerIdleNotifier:()=>An,_stopProfilerIdleNotifier:()=>En,_tickCallback:()=>vn,abort:()=>Rn,addListener:()=>$n,allowedNodeEnvironmentFlags:()=>mn,arch:()=>Or,argv:()=>$r,argv0:()=>_n,assert:()=>hn,binding:()=>Gr,browser:()=>Jr,chdir:()=>Kr,config:()=>rn,cpuUsage:()=>vt,cwd:()=>Hr,debugPort:()=>Pn,default:()=>Yn,dlopen:()=>nn,domain:()=>en,emit:()=>Gn,emitWarning:()=>Wr,env:()=>Dr,execArgv:()=>jr,execPath:()=>Bn,exit:()=>cn,features:()=>yn,hasUncaughtExceptionCaptureCallback:()=>wn,hrtime:()=>wt,kill:()=>fn,listeners:()=>Kn,memoryUsage:()=>ln,moduleLoadList:()=>Xr,nextTick:()=>Fr,off:()=>qn,on:()=>ce,once:()=>jn,openStdin:()=>dn,pid:()=>Sn,platform:()=>Mr,ppid:()=>Ln,prependListener:()=>zn,prependOnceListener:()=>Hn,reallyExit:()=>sn,release:()=>Yr,removeAllListeners:()=>Wn,removeListener:()=>Vn,resourceUsage:()=>pn,setSourceMapsEnabled:()=>kn,setUncaughtExceptionCaptureCallback:()=>xn,stderr:()=>Cn,stdin:()=>Nn,stdout:()=>In,title:()=>Ur,umask:()=>zr,uptime:()=>Un,version:()=>qr,versions:()=>Vr});function tr(r){throw new Error("Node.js process "+r+" is not supported by JSPM core outside of Node.js")}function es(){!He||!Pe||(He=!1,Pe.length?fe=Pe.concat(fe):xt=-1,fe.length&&_r())}function _r(){if(!He){var r=setTimeout(es,0);He=!0;for(var t=fe.length;t;){for(Pe=fe,fe=[];++xt<t;)Pe&&Pe[xt].run();xt=-1,t=fe.length}Pe=null,He=!1,clearTimeout(r)}}function Fr(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];fe.push(new kr(r,t)),fe.length===1&&!He&&setTimeout(_r,0)}function kr(r,t){this.fun=r,this.array=t}function Y(){}function Qr(r){tr("_linkedBinding")}function nn(r){tr("dlopen")}function on(){return[]}function an(){return[]}function hn(r,t){if(!r)throw new Error(t||"assertion error")}function wn(){return!1}function Un(){return Te.now()/1e3}function wt(r){var t=Math.floor((Date.now()-Te.now())*.001),e=Te.now()*.001,i=Math.floor(e)+t,a=Math.floor(e%1*1e9);return r&&(i=i-r[0],a=a-r[1],a<0&&(i--,a+=er)),[i,a]}function ce(){return Yn}function Kn(r){return[]}var fe,He,Pe,xt,Ur,Or,Mr,Dr,$r,jr,qr,Vr,Wr,Gr,zr,Hr,Kr,Yr,Jr,Zr,Xr,en,tn,rn,sn,un,vt,pn,ln,fn,cn,dn,mn,yn,gn,xn,vn,bn,Tn,An,En,In,Cn,Nn,Rn,Sn,Ln,Bn,Pn,_n,Fn,kn,Te,Qt,er,On,Mn,Dn,$n,jn,qn,Vn,Wn,Gn,zn,Hn,Yn,Jn=ze(()=>{"use strict";s();p();u();fe=[],He=!1,xt=-1;kr.prototype.run=function(){this.fun.apply(null,this.array)};Ur="browser",Or="x64",Mr="browser",Dr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},$r=["/usr/bin/node"],jr=[],qr="v16.8.0",Vr={},Wr=function(r,t){console.warn((t?t+": ":"")+r)},Gr=function(r){tr("binding")},zr=function(r){return 0},Hr=function(){return"/"},Kr=function(r){},Yr={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Jr=!0,Zr=Y,Xr=[];en={},tn=!1,rn={};sn=Y,un=Y,vt=function(){return{}},pn=vt,ln=vt,fn=Y,cn=Y,dn=Y,mn={};yn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},gn=Y,xn=Y;vn=Y,bn=Y,Tn=Y,An=Y,En=Y,In=void 0,Cn=void 0,Nn=void 0,Rn=Y,Sn=2,Ln=1,Bn="/bin/usr/node",Pn=9229,_n="node",Fn=[],kn=Y,Te={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Te.now===void 0&&(Qt=Date.now(),Te.timing&&Te.timing.navigationStart&&(Qt=Te.timing.navigationStart),Te.now=()=>Date.now()-Qt);er=1e9;wt.bigint=function(r){var t=wt(r);return typeof BigInt>"u"?t[0]*er+t[1]:BigInt(t[0]*er)+BigInt(t[1])};On=10,Mn={},Dn=0;$n=ce,jn=ce,qn=ce,Vn=ce,Wn=ce,Gn=Y,zn=ce,Hn=ce;Yn={version:qr,versions:Vr,arch:Or,platform:Mr,browser:Jr,release:Yr,_rawDebug:Zr,moduleLoadList:Xr,binding:Gr,_linkedBinding:Qr,_events:Mn,_eventsCount:Dn,_maxListeners:On,on:ce,addListener:$n,once:jn,off:qn,removeListener:Vn,removeAllListeners:Wn,emit:Gn,prependListener:zn,prependOnceListener:Hn,listeners:Kn,domain:en,_exiting:tn,config:rn,dlopen:nn,uptime:Un,_getActiveRequests:on,_getActiveHandles:an,reallyExit:sn,_kill:un,cpuUsage:vt,resourceUsage:pn,memoryUsage:ln,kill:fn,exit:cn,openStdin:dn,allowedNodeEnvironmentFlags:mn,assert:hn,features:yn,_fatalExceptions:gn,setUncaughtExceptionCaptureCallback:xn,hasUncaughtExceptionCaptureCallback:wn,emitWarning:Wr,nextTick:Fr,_tickCallback:vn,_debugProcess:bn,_debugEnd:Tn,_startProfilerIdleNotifier:An,_stopProfilerIdleNotifier:En,stdout:In,stdin:Nn,stderr:Cn,abort:Rn,umask:zr,chdir:Kr,cwd:Hr,env:Dr,title:Ur,argv:$r,execArgv:jr,pid:Sn,ppid:Ln,execPath:Bn,debugPort:Pn,hrtime:wt,argv0:_n,_preload_modules:Fn,setSourceMapsEnabled:kn}});var u=ze(()=>{"use strict";Jn()});function ts(){if(Zn)return nt;Zn=!0,nt.byteLength=v,nt.toByteArray=E,nt.fromByteArray=P;for(var r=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,d=i.length;a<d;++a)r[a]=i[a],t[i.charCodeAt(a)]=a;t[45]=62,t[95]=63;function f(C){var N=C.length;if(N%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var L=C.indexOf("=");L===-1&&(L=N);var F=L===N?0:4-L%4;return[L,F]}function v(C){var N=f(C),L=N[0],F=N[1];return(L+F)*3/4-F}function T(C,N,L){return(N+L)*3/4-L}function E(C){var N,L=f(C),F=L[0],$=L[1],k=new e(T(C,F,$)),H=0,W=$>0?F-4:F,V;for(V=0;V<W;V+=4)N=t[C.charCodeAt(V)]<<18|t[C.charCodeAt(V+1)]<<12|t[C.charCodeAt(V+2)]<<6|t[C.charCodeAt(V+3)],k[H++]=N>>16&255,k[H++]=N>>8&255,k[H++]=N&255;return $===2&&(N=t[C.charCodeAt(V)]<<2|t[C.charCodeAt(V+1)]>>4,k[H++]=N&255),$===1&&(N=t[C.charCodeAt(V)]<<10|t[C.charCodeAt(V+1)]<<4|t[C.charCodeAt(V+2)]>>2,k[H++]=N>>8&255,k[H++]=N&255),k}function I(C){return r[C>>18&63]+r[C>>12&63]+r[C>>6&63]+r[C&63]}function R(C,N,L){for(var F,$=[],k=N;k<L;k+=3)F=(C[k]<<16&16711680)+(C[k+1]<<8&65280)+(C[k+2]&255),$.push(I(F));return $.join("")}function P(C){for(var N,L=C.length,F=L%3,$=[],k=16383,H=0,W=L-F;H<W;H+=k)$.push(R(C,H,H+k>W?W:H+k));return F===1?(N=C[L-1],$.push(r[N>>2]+r[N<<4&63]+"==")):F===2&&(N=(C[L-2]<<8)+C[L-1],$.push(r[N>>10]+r[N>>4&63]+r[N<<2&63]+"=")),$.join("")}return nt}function rs(){if(Xn)return bt;Xn=!0;return bt.read=function(r,t,e,i,a){var d,f,v=a*8-i-1,T=(1<<v)-1,E=T>>1,I=-7,R=e?a-1:0,P=e?-1:1,C=r[t+R];for(R+=P,d=C&(1<<-I)-1,C>>=-I,I+=v;I>0;d=d*256+r[t+R],R+=P,I-=8);for(f=d&(1<<-I)-1,d>>=-I,I+=i;I>0;f=f*256+r[t+R],R+=P,I-=8);if(d===0)d=1-E;else{if(d===T)return f?NaN:(C?-1:1)*(1/0);f=f+Math.pow(2,i),d=d-E}return(C?-1:1)*f*Math.pow(2,d-i)},bt.write=function(r,t,e,i,a,d){var f,v,T,E=d*8-a-1,I=(1<<E)-1,R=I>>1,P=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=i?0:d-1,N=i?1:-1,L=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(v=isNaN(t)?1:0,f=I):(f=Math.floor(Math.log(t)/Math.LN2),t*(T=Math.pow(2,-f))<1&&(f--,T*=2),f+R>=1?t+=P/T:t+=P*Math.pow(2,1-R),t*T>=2&&(f++,T/=2),f+R>=I?(v=0,f=I):f+R>=1?(v=(t*T-1)*Math.pow(2,a),f=f+R):(v=t*Math.pow(2,R-1)*Math.pow(2,a),f=0));a>=8;r[e+C]=v&255,C+=N,v/=256,a-=8);for(f=f<<a|v,E+=a;E>0;r[e+C]=f&255,C+=N,f/=256,E-=8);r[e+C-N]|=L*128},bt}function ei(){if(Qn)return _e;Qn=!0;let r=ts(),t=rs(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;_e.Buffer=f,_e.SlowBuffer=$,_e.INSPECT_MAX_BYTES=50;let i=2147483647;_e.kMaxLength=i,f.TYPED_ARRAY_SUPPORT=a(),!f.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 l=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(l,n),l.foo()===42}catch{return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.byteOffset}});function d(l){if(l>i)throw new RangeError('The value "'+l+'" is invalid for option "size"');let n=new Uint8Array(l);return Object.setPrototypeOf(n,f.prototype),n}function f(l,n,o){if(typeof l=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return I(l)}return v(l,n,o)}f.poolSize=8192;function v(l,n,o){if(typeof l=="string")return R(l,n);if(ArrayBuffer.isView(l))return C(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(ae(l,ArrayBuffer)||l&&ae(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ae(l,SharedArrayBuffer)||l&&ae(l.buffer,SharedArrayBuffer)))return N(l,n,o);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=l.valueOf&&l.valueOf();if(c!=null&&c!==l)return f.from(c,n,o);let m=L(l);if(m)return m;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return f.from(l[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}f.from=function(l,n,o){return v(l,n,o)},Object.setPrototypeOf(f.prototype,Uint8Array.prototype),Object.setPrototypeOf(f,Uint8Array);function T(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function E(l,n,o){return T(l),l<=0?d(l):n!==void 0?typeof o=="string"?d(l).fill(n,o):d(l).fill(n):d(l)}f.alloc=function(l,n,o){return E(l,n,o)};function I(l){return T(l),d(l<0?0:F(l)|0)}f.allocUnsafe=function(l){return I(l)},f.allocUnsafeSlow=function(l){return I(l)};function R(l,n){if((typeof n!="string"||n==="")&&(n="utf8"),!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n);let o=k(l,n)|0,c=d(o),m=c.write(l,n);return m!==o&&(c=c.slice(0,m)),c}function P(l){let n=l.length<0?0:F(l.length)|0,o=d(n);for(let c=0;c<n;c+=1)o[c]=l[c]&255;return o}function C(l){if(ae(l,Uint8Array)){let n=new Uint8Array(l);return N(n.buffer,n.byteOffset,n.byteLength)}return P(l)}function N(l,n,o){if(n<0||l.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');let c;return n===void 0&&o===void 0?c=new Uint8Array(l):o===void 0?c=new Uint8Array(l,n):c=new Uint8Array(l,n,o),Object.setPrototypeOf(c,f.prototype),c}function L(l){if(f.isBuffer(l)){let n=F(l.length)|0,o=d(n);return o.length===0||l.copy(o,0,0,n),o}if(l.length!==void 0)return typeof l.length!="number"||Xt(l.length)?d(0):P(l);if(l.type==="Buffer"&&Array.isArray(l.data))return P(l.data)}function F(l){if(l>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return l|0}function $(l){return+l!=l&&(l=0),f.alloc(+l)}f.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==f.prototype},f.compare=function(n,o){if(ae(n,Uint8Array)&&(n=f.from(n,n.offset,n.byteLength)),ae(o,Uint8Array)&&(o=f.from(o,o.offset,o.byteLength)),!f.isBuffer(n)||!f.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;let c=n.length,m=o.length;for(let w=0,b=Math.min(c,m);w<b;++w)if(n[w]!==o[w]){c=n[w],m=o[w];break}return c<m?-1:m<c?1:0},f.isEncoding=function(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return f.alloc(0);let c;if(o===void 0)for(o=0,c=0;c<n.length;++c)o+=n[c].length;let m=f.allocUnsafe(o),w=0;for(c=0;c<n.length;++c){let b=n[c];if(ae(b,Uint8Array))w+b.length>m.length?(f.isBuffer(b)||(b=f.from(b)),b.copy(m,w)):Uint8Array.prototype.set.call(m,b,w);else if(f.isBuffer(b))b.copy(m,w);else throw new TypeError('"list" argument must be an Array of Buffers');w+=b.length}return m};function k(l,n){if(f.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||ae(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);let o=l.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&o===0)return 0;let m=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Zt(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return Lr(l).length;default:if(m)return c?-1:Zt(l).length;n=(""+n).toLowerCase(),m=!0}}f.byteLength=k;function H(l,n,o){let c=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(l||(l="utf8");;)switch(l){case"hex":return Wa(this,n,o);case"utf8":case"utf-8":return br(this,n,o);case"ascii":return qa(this,n,o);case"latin1":case"binary":return Va(this,n,o);case"base64":return $a(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ga(this,n,o);default:if(c)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),c=!0}}f.prototype._isBuffer=!0;function W(l,n,o){let c=l[n];l[n]=l[o],l[o]=c}f.prototype.swap16=function(){let n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<n;o+=2)W(this,o,o+1);return this},f.prototype.swap32=function(){let n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<n;o+=4)W(this,o,o+3),W(this,o+1,o+2);return this},f.prototype.swap64=function(){let n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<n;o+=8)W(this,o,o+7),W(this,o+1,o+6),W(this,o+2,o+5),W(this,o+3,o+4);return this},f.prototype.toString=function(){let n=this.length;return n===0?"":arguments.length===0?br(this,0,n):H.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(n){if(!f.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:f.compare(this,n)===0},f.prototype.inspect=function(){let n="",o=_e.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},e&&(f.prototype[e]=f.prototype.inspect),f.prototype.compare=function(n,o,c,m,w){if(ae(n,Uint8Array)&&(n=f.from(n,n.offset,n.byteLength)),!f.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(o===void 0&&(o=0),c===void 0&&(c=n?n.length:0),m===void 0&&(m=0),w===void 0&&(w=this.length),o<0||c>n.length||m<0||w>this.length)throw new RangeError("out of range index");if(m>=w&&o>=c)return 0;if(m>=w)return-1;if(o>=c)return 1;if(o>>>=0,c>>>=0,m>>>=0,w>>>=0,this===n)return 0;let b=w-m,B=c-o,j=Math.min(b,B),D=this.slice(m,w),q=n.slice(o,c);for(let U=0;U<j;++U)if(D[U]!==q[U]){b=D[U],B=q[U];break}return b<B?-1:B<b?1:0};function V(l,n,o,c,m){if(l.length===0)return-1;if(typeof o=="string"?(c=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Xt(o)&&(o=m?0:l.length-1),o<0&&(o=l.length+o),o>=l.length){if(m)return-1;o=l.length-1}else if(o<0)if(m)o=0;else return-1;if(typeof n=="string"&&(n=f.from(n,c)),f.isBuffer(n))return n.length===0?-1:vr(l,n,o,c,m);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?m?Uint8Array.prototype.indexOf.call(l,n,o):Uint8Array.prototype.lastIndexOf.call(l,n,o):vr(l,[n],o,c,m);throw new TypeError("val must be string, number or Buffer")}function vr(l,n,o,c,m){let w=1,b=l.length,B=n.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(l.length<2||n.length<2)return-1;w=2,b/=2,B/=2,o/=2}function j(q,U){return w===1?q[U]:q.readUInt16BE(U*w)}let D;if(m){let q=-1;for(D=o;D<b;D++)if(j(l,D)===j(n,q===-1?0:D-q)){if(q===-1&&(q=D),D-q+1===B)return q*w}else q!==-1&&(D-=D-q),q=-1}else for(o+B>b&&(o=b-B),D=o;D>=0;D--){let q=!0;for(let U=0;U<B;U++)if(j(l,D+U)!==j(n,U)){q=!1;break}if(q)return D}return-1}f.prototype.includes=function(n,o,c){return this.indexOf(n,o,c)!==-1},f.prototype.indexOf=function(n,o,c){return V(this,n,o,c,!0)},f.prototype.lastIndexOf=function(n,o,c){return V(this,n,o,c,!1)};function ka(l,n,o,c){o=Number(o)||0;let m=l.length-o;c?(c=Number(c),c>m&&(c=m)):c=m;let w=n.length;c>w/2&&(c=w/2);let b;for(b=0;b<c;++b){let B=parseInt(n.substr(b*2,2),16);if(Xt(B))return b;l[o+b]=B}return b}function Ua(l,n,o,c){return gt(Zt(n,l.length-o),l,o,c)}function Oa(l,n,o,c){return gt(Ya(n),l,o,c)}function Ma(l,n,o,c){return gt(Lr(n),l,o,c)}function Da(l,n,o,c){return gt(Ja(n,l.length-o),l,o,c)}f.prototype.write=function(n,o,c,m){if(o===void 0)m="utf8",c=this.length,o=0;else if(c===void 0&&typeof o=="string")m=o,c=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(c)?(c=c>>>0,m===void 0&&(m="utf8")):(m=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let w=this.length-o;if((c===void 0||c>w)&&(c=w),n.length>0&&(c<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");m||(m="utf8");let b=!1;for(;;)switch(m){case"hex":return ka(this,n,o,c);case"utf8":case"utf-8":return Ua(this,n,o,c);case"ascii":case"latin1":case"binary":return Oa(this,n,o,c);case"base64":return Ma(this,n,o,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Da(this,n,o,c);default:if(b)throw new TypeError("Unknown encoding: "+m);m=(""+m).toLowerCase(),b=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $a(l,n,o){return n===0&&o===l.length?r.fromByteArray(l):r.fromByteArray(l.slice(n,o))}function br(l,n,o){o=Math.min(l.length,o);let c=[],m=n;for(;m<o;){let w=l[m],b=null,B=w>239?4:w>223?3:w>191?2:1;if(m+B<=o){let j,D,q,U;switch(B){case 1:w<128&&(b=w);break;case 2:j=l[m+1],(j&192)===128&&(U=(w&31)<<6|j&63,U>127&&(b=U));break;case 3:j=l[m+1],D=l[m+2],(j&192)===128&&(D&192)===128&&(U=(w&15)<<12|(j&63)<<6|D&63,U>2047&&(U<55296||U>57343)&&(b=U));break;case 4:j=l[m+1],D=l[m+2],q=l[m+3],(j&192)===128&&(D&192)===128&&(q&192)===128&&(U=(w&15)<<18|(j&63)<<12|(D&63)<<6|q&63,U>65535&&U<1114112&&(b=U))}}b===null?(b=65533,B=1):b>65535&&(b-=65536,c.push(b>>>10&1023|55296),b=56320|b&1023),c.push(b),m+=B}return ja(c)}let Tr=4096;function ja(l){let n=l.length;if(n<=Tr)return String.fromCharCode.apply(String,l);let o="",c=0;for(;c<n;)o+=String.fromCharCode.apply(String,l.slice(c,c+=Tr));return o}function qa(l,n,o){let c="";o=Math.min(l.length,o);for(let m=n;m<o;++m)c+=String.fromCharCode(l[m]&127);return c}function Va(l,n,o){let c="";o=Math.min(l.length,o);for(let m=n;m<o;++m)c+=String.fromCharCode(l[m]);return c}function Wa(l,n,o){let c=l.length;(!n||n<0)&&(n=0),(!o||o<0||o>c)&&(o=c);let m="";for(let w=n;w<o;++w)m+=Za[l[w]];return m}function Ga(l,n,o){let c=l.slice(n,o),m="";for(let w=0;w<c.length-1;w+=2)m+=String.fromCharCode(c[w]+c[w+1]*256);return m}f.prototype.slice=function(n,o){let c=this.length;n=~~n,o=o===void 0?c:~~o,n<0?(n+=c,n<0&&(n=0)):n>c&&(n=c),o<0?(o+=c,o<0&&(o=0)):o>c&&(o=c),o<n&&(o=n);let m=this.subarray(n,o);return Object.setPrototypeOf(m,f.prototype),m};function G(l,n,o){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+n>o)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUintLE=f.prototype.readUIntLE=function(n,o,c){n=n>>>0,o=o>>>0,c||G(n,o,this.length);let m=this[n],w=1,b=0;for(;++b<o&&(w*=256);)m+=this[n+b]*w;return m},f.prototype.readUintBE=f.prototype.readUIntBE=function(n,o,c){n=n>>>0,o=o>>>0,c||G(n,o,this.length);let m=this[n+--o],w=1;for(;o>0&&(w*=256);)m+=this[n+--o]*w;return m},f.prototype.readUint8=f.prototype.readUInt8=function(n,o){return n=n>>>0,o||G(n,1,this.length),this[n]},f.prototype.readUint16LE=f.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||G(n,2,this.length),this[n]|this[n+1]<<8},f.prototype.readUint16BE=f.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||G(n,2,this.length),this[n]<<8|this[n+1]},f.prototype.readUint32LE=f.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||G(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},f.prototype.readUint32BE=f.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||G(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},f.prototype.readBigUInt64LE=be(function(n){n=n>>>0,Ge(n,"offset");let o=this[n],c=this[n+7];(o===void 0||c===void 0)&&rt(n,this.length-8);let m=o+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24,w=this[++n]+this[++n]*2**8+this[++n]*2**16+c*2**24;return BigInt(m)+(BigInt(w)<<BigInt(32))}),f.prototype.readBigUInt64BE=be(function(n){n=n>>>0,Ge(n,"offset");let o=this[n],c=this[n+7];(o===void 0||c===void 0)&&rt(n,this.length-8);let m=o*2**24+this[++n]*2**16+this[++n]*2**8+this[++n],w=this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+c;return(BigInt(m)<<BigInt(32))+BigInt(w)}),f.prototype.readIntLE=function(n,o,c){n=n>>>0,o=o>>>0,c||G(n,o,this.length);let m=this[n],w=1,b=0;for(;++b<o&&(w*=256);)m+=this[n+b]*w;return w*=128,m>=w&&(m-=Math.pow(2,8*o)),m},f.prototype.readIntBE=function(n,o,c){n=n>>>0,o=o>>>0,c||G(n,o,this.length);let m=o,w=1,b=this[n+--m];for(;m>0&&(w*=256);)b+=this[n+--m]*w;return w*=128,b>=w&&(b-=Math.pow(2,8*o)),b},f.prototype.readInt8=function(n,o){return n=n>>>0,o||G(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},f.prototype.readInt16LE=function(n,o){n=n>>>0,o||G(n,2,this.length);let c=this[n]|this[n+1]<<8;return c&32768?c|4294901760:c},f.prototype.readInt16BE=function(n,o){n=n>>>0,o||G(n,2,this.length);let c=this[n+1]|this[n]<<8;return c&32768?c|4294901760:c},f.prototype.readInt32LE=function(n,o){return n=n>>>0,o||G(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},f.prototype.readInt32BE=function(n,o){return n=n>>>0,o||G(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},f.prototype.readBigInt64LE=be(function(n){n=n>>>0,Ge(n,"offset");let o=this[n],c=this[n+7];(o===void 0||c===void 0)&&rt(n,this.length-8);let m=this[n+4]+this[n+5]*2**8+this[n+6]*2**16+(c<<24);return(BigInt(m)<<BigInt(32))+BigInt(o+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24)}),f.prototype.readBigInt64BE=be(function(n){n=n>>>0,Ge(n,"offset");let o=this[n],c=this[n+7];(o===void 0||c===void 0)&&rt(n,this.length-8);let m=(o<<24)+this[++n]*2**16+this[++n]*2**8+this[++n];return(BigInt(m)<<BigInt(32))+BigInt(this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+c)}),f.prototype.readFloatLE=function(n,o){return n=n>>>0,o||G(n,4,this.length),t.read(this,n,!0,23,4)},f.prototype.readFloatBE=function(n,o){return n=n>>>0,o||G(n,4,this.length),t.read(this,n,!1,23,4)},f.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||G(n,8,this.length),t.read(this,n,!0,52,8)},f.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||G(n,8,this.length),t.read(this,n,!1,52,8)};function Z(l,n,o,c,m,w){if(!f.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>m||n<w)throw new RangeError('"value" argument is out of bounds');if(o+c>l.length)throw new RangeError("Index out of range")}f.prototype.writeUintLE=f.prototype.writeUIntLE=function(n,o,c,m){if(n=+n,o=o>>>0,c=c>>>0,!m){let B=Math.pow(2,8*c)-1;Z(this,n,o,c,B,0)}let w=1,b=0;for(this[o]=n&255;++b<c&&(w*=256);)this[o+b]=n/w&255;return o+c},f.prototype.writeUintBE=f.prototype.writeUIntBE=function(n,o,c,m){if(n=+n,o=o>>>0,c=c>>>0,!m){let B=Math.pow(2,8*c)-1;Z(this,n,o,c,B,0)}let w=c-1,b=1;for(this[o+w]=n&255;--w>=0&&(b*=256);)this[o+w]=n/b&255;return o+c},f.prototype.writeUint8=f.prototype.writeUInt8=function(n,o,c){return n=+n,o=o>>>0,c||Z(this,n,o,1,255,0),this[o]=n&255,o+1},f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(n,o,c){return n=+n,o=o>>>0,c||Z(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(n,o,c){return n=+n,o=o>>>0,c||Z(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(n,o,c){return n=+n,o=o>>>0,c||Z(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(n,o,c){return n=+n,o=o>>>0,c||Z(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function Ar(l,n,o,c,m){Sr(n,c,m,l,o,7);let w=Number(n&BigInt(4294967295));l[o++]=w,w=w>>8,l[o++]=w,w=w>>8,l[o++]=w,w=w>>8,l[o++]=w;let b=Number(n>>BigInt(32)&BigInt(4294967295));return l[o++]=b,b=b>>8,l[o++]=b,b=b>>8,l[o++]=b,b=b>>8,l[o++]=b,o}function Er(l,n,o,c,m){Sr(n,c,m,l,o,7);let w=Number(n&BigInt(4294967295));l[o+7]=w,w=w>>8,l[o+6]=w,w=w>>8,l[o+5]=w,w=w>>8,l[o+4]=w;let b=Number(n>>BigInt(32)&BigInt(4294967295));return l[o+3]=b,b=b>>8,l[o+2]=b,b=b>>8,l[o+1]=b,b=b>>8,l[o]=b,o+8}f.prototype.writeBigUInt64LE=be(function(n,o=0){return Ar(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),f.prototype.writeBigUInt64BE=be(function(n,o=0){return Er(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),f.prototype.writeIntLE=function(n,o,c,m){if(n=+n,o=o>>>0,!m){let j=Math.pow(2,8*c-1);Z(this,n,o,c,j-1,-j)}let w=0,b=1,B=0;for(this[o]=n&255;++w<c&&(b*=256);)n<0&&B===0&&this[o+w-1]!==0&&(B=1),this[o+w]=(n/b>>0)-B&255;return o+c},f.prototype.writeIntBE=function(n,o,c,m){if(n=+n,o=o>>>0,!m){let j=Math.pow(2,8*c-1);Z(this,n,o,c,j-1,-j)}let w=c-1,b=1,B=0;for(this[o+w]=n&255;--w>=0&&(b*=256);)n<0&&B===0&&this[o+w+1]!==0&&(B=1),this[o+w]=(n/b>>0)-B&255;return o+c},f.prototype.writeInt8=function(n,o,c){return n=+n,o=o>>>0,c||Z(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},f.prototype.writeInt16LE=function(n,o,c){return n=+n,o=o>>>0,c||Z(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},f.prototype.writeInt16BE=function(n,o,c){return n=+n,o=o>>>0,c||Z(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},f.prototype.writeInt32LE=function(n,o,c){return n=+n,o=o>>>0,c||Z(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},f.prototype.writeInt32BE=function(n,o,c){return n=+n,o=o>>>0,c||Z(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},f.prototype.writeBigInt64LE=be(function(n,o=0){return Ar(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),f.prototype.writeBigInt64BE=be(function(n,o=0){return Er(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ir(l,n,o,c,m,w){if(o+c>l.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function Cr(l,n,o,c,m){return n=+n,o=o>>>0,m||Ir(l,n,o,4),t.write(l,n,o,c,23,4),o+4}f.prototype.writeFloatLE=function(n,o,c){return Cr(this,n,o,!0,c)},f.prototype.writeFloatBE=function(n,o,c){return Cr(this,n,o,!1,c)};function Nr(l,n,o,c,m){return n=+n,o=o>>>0,m||Ir(l,n,o,8),t.write(l,n,o,c,52,8),o+8}f.prototype.writeDoubleLE=function(n,o,c){return Nr(this,n,o,!0,c)},f.prototype.writeDoubleBE=function(n,o,c){return Nr(this,n,o,!1,c)},f.prototype.copy=function(n,o,c,m){if(!f.isBuffer(n))throw new TypeError("argument should be a Buffer");if(c||(c=0),!m&&m!==0&&(m=this.length),o>=n.length&&(o=n.length),o||(o=0),m>0&&m<c&&(m=c),m===c||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(m<0)throw new RangeError("sourceEnd out of bounds");m>this.length&&(m=this.length),n.length-o<m-c&&(m=n.length-o+c);let w=m-c;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,c,m):Uint8Array.prototype.set.call(n,this.subarray(c,m),o),w},f.prototype.fill=function(n,o,c,m){if(typeof n=="string"){if(typeof o=="string"?(m=o,o=0,c=this.length):typeof c=="string"&&(m=c,c=this.length),m!==void 0&&typeof m!="string")throw new TypeError("encoding must be a string");if(typeof m=="string"&&!f.isEncoding(m))throw new TypeError("Unknown encoding: "+m);if(n.length===1){let b=n.charCodeAt(0);(m==="utf8"&&b<128||m==="latin1")&&(n=b)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<c)throw new RangeError("Out of range index");if(c<=o)return this;o=o>>>0,c=c===void 0?this.length:c>>>0,n||(n=0);let w;if(typeof n=="number")for(w=o;w<c;++w)this[w]=n;else{let b=f.isBuffer(n)?n:f.from(n,m),B=b.length;if(B===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(w=0;w<c-o;++w)this[w+o]=b[w%B]}return this};let We={};function Jt(l,n,o){We[l]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:n.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${l}]`,this.stack,delete this.name}get code(){return l}set code(m){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:m,writable:!0})}toString(){return`${this.name} [${l}]: ${this.message}`}}}Jt("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Jt("ERR_INVALID_ARG_TYPE",function(l,n){return`The "${l}" argument must be of type number. Received type ${typeof n}`},TypeError),Jt("ERR_OUT_OF_RANGE",function(l,n,o){let c=`The value of "${l}" is out of range.`,m=o;return Number.isInteger(o)&&Math.abs(o)>2**32?m=Rr(String(o)):typeof o=="bigint"&&(m=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(m=Rr(m)),m+="n"),c+=` It must be ${n}. Received ${m}`,c},RangeError);function Rr(l){let n="",o=l.length,c=l[0]==="-"?1:0;for(;o>=c+4;o-=3)n=`_${l.slice(o-3,o)}${n}`;return`${l.slice(0,o)}${n}`}function za(l,n,o){Ge(n,"offset"),(l[n]===void 0||l[n+o]===void 0)&&rt(n,l.length-(o+1))}function Sr(l,n,o,c,m,w){if(l>o||l<n){let b=typeof n=="bigint"?"n":"",B;throw n===0||n===BigInt(0)?B=`>= 0${b} and < 2${b} ** ${(w+1)*8}${b}`:B=`>= -(2${b} ** ${(w+1)*8-1}${b}) and < 2 ** ${(w+1)*8-1}${b}`,new We.ERR_OUT_OF_RANGE("value",B,l)}za(c,m,w)}function Ge(l,n){if(typeof l!="number")throw new We.ERR_INVALID_ARG_TYPE(n,"number",l)}function rt(l,n,o){throw Math.floor(l)!==l?(Ge(l,o),new We.ERR_OUT_OF_RANGE("offset","an integer",l)):n<0?new We.ERR_BUFFER_OUT_OF_BOUNDS:new We.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${n}`,l)}let Ha=/[^+/0-9A-Za-z-_]/g;function Ka(l){if(l=l.split("=")[0],l=l.trim().replace(Ha,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function Zt(l,n){n=n||1/0;let o,c=l.length,m=null,w=[];for(let b=0;b<c;++b){if(o=l.charCodeAt(b),o>55295&&o<57344){if(!m){if(o>56319){(n-=3)>-1&&w.push(239,191,189);continue}else if(b+1===c){(n-=3)>-1&&w.push(239,191,189);continue}m=o;continue}if(o<56320){(n-=3)>-1&&w.push(239,191,189),m=o;continue}o=(m-55296<<10|o-56320)+65536}else m&&(n-=3)>-1&&w.push(239,191,189);if(m=null,o<128){if((n-=1)<0)break;w.push(o)}else if(o<2048){if((n-=2)<0)break;w.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;w.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;w.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return w}function Ya(l){let n=[];for(let o=0;o<l.length;++o)n.push(l.charCodeAt(o)&255);return n}function Ja(l,n){let o,c,m,w=[];for(let b=0;b<l.length&&!((n-=2)<0);++b)o=l.charCodeAt(b),c=o>>8,m=o%256,w.push(m),w.push(c);return w}function Lr(l){return r.toByteArray(Ka(l))}function gt(l,n,o,c){let m;for(m=0;m<c&&!(m+o>=n.length||m>=l.length);++m)n[m+o]=l[m];return m}function ae(l,n){return l instanceof n||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===n.name}function Xt(l){return l!==l}let Za=(function(){let l="0123456789abcdef",n=new Array(256);for(let o=0;o<16;++o){let c=o*16;for(let m=0;m<16;++m)n[c+m]=l[o]+l[m]}return n})();function be(l){return typeof BigInt>"u"?Xa:l}function Xa(){throw new Error("BigInt not supported")}return _e}var nt,Zn,bt,Xn,_e,Qn,ti=ze(()=>{"use strict";s();p();u();nt={},Zn=!1;bt={},Xn=!1;_e={},Qn=!1});var Fe,g,Hc,Kc,ri=ze(()=>{"use strict";s();p();u();ti();Fe=ei();Fe.Buffer;Fe.SlowBuffer;Fe.INSPECT_MAX_BYTES;Fe.kMaxLength;g=Fe.Buffer,Hc=Fe.INSPECT_MAX_BYTES,Kc=Fe.kMaxLength});var p=ze(()=>{"use strict";ri()});s();p();u();s();p();u();s();p();u();s();p();u();function O(r){throw new Error("Unexpected value: "+JSON.stringify(r))}s();p();u();s();p();u();s();p();u();s();p();u();s();p();u();s();p();u();var ns=typeof global=="object"&&global&&global.Object===Object&&global,Tt=ns;var is=typeof self=="object"&&self&&self.Object===Object&&self,os=Tt||is||Function("return this")(),z=os;var as=z.Symbol,Q=as;s();p();u();var ni=Object.prototype,ss=ni.hasOwnProperty,us=ni.toString,it=Q?Q.toStringTag:void 0;function ps(r){var t=ss.call(r,it),e=r[it];try{r[it]=void 0;var i=!0}catch{}var a=us.call(r);return i&&(t?r[it]=e:delete r[it]),a}var ii=ps;s();p();u();var ls=Object.prototype,fs=ls.toString;function cs(r){return fs.call(r)}var oi=cs;var ds="[object Null]",ms="[object Undefined]",ai=Q?Q.toStringTag:void 0;function hs(r){return r==null?r===void 0?ms:ds:ai&&ai in Object(r)?ii(r):oi(r)}var te=hs;s();p();u();function ys(r){return r!=null&&typeof r=="object"}var re=ys;var gs="[object Symbol]";function xs(r){return typeof r=="symbol"||re(r)&&te(r)==gs}var si=xs;s();p();u();s();p();u();function ws(r,t){for(var e=-1,i=r==null?0:r.length,a=Array(i);++e<i;)a[e]=t(r[e],e,r);return a}var ui=ws;s();p();u();var vs=Array.isArray,de=vs;var bs=1/0,pi=Q?Q.prototype:void 0,li=pi?pi.toString:void 0;function fi(r){if(typeof r=="string")return r;if(de(r))return ui(r,fi)+"";if(si(r))return li?li.call(r):"";var t=r+"";return t=="0"&&1/r==-bs?"-0":t}var ci=fi;s();p();u();function Ts(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}var At=Ts;s();p();u();s();p();u();s();p();u();s();p();u();var As="[object AsyncFunction]",Es="[object Function]",Is="[object GeneratorFunction]",Cs="[object Proxy]";function Ns(r){if(!At(r))return!1;var t=te(r);return t==Es||t==Is||t==As||t==Cs}var Et=Ns;s();p();u();s();p();u();var Rs=z["__core-js_shared__"],It=Rs;var di=(function(){var r=/[^.]+$/.exec(It&&It.keys&&It.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function Ss(r){return!!di&&di in r}var mi=Ss;s();p();u();var Ls=Function.prototype,Bs=Ls.toString;function Ps(r){if(r!=null){try{return Bs.call(r)}catch{}try{return r+""}catch{}}return""}var me=Ps;var _s=/[\\^$.*+?()[\]{}|]/g,Fs=/^\[object .+?Constructor\]$/,ks=Function.prototype,Us=Object.prototype,Os=ks.toString,Ms=Us.hasOwnProperty,Ds=RegExp("^"+Os.call(Ms).replace(_s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function $s(r){if(!At(r)||mi(r))return!1;var t=Et(r)?Ds:Fs;return t.test(me(r))}var hi=$s;s();p();u();function js(r,t){return r?.[t]}var yi=js;function qs(r,t){var e=yi(r,t);return hi(e)?e:void 0}var ee=qs;var Vs=ee(z,"WeakMap"),Ct=Vs;s();p();u();function Ws(){}var gi=Ws;s();p();u();s();p();u();s();p();u();function Gs(r,t,e,i){for(var a=r.length,d=e+(i?1:-1);i?d--:++d<a;)if(t(r[d],d,r))return d;return-1}var xi=Gs;s();p();u();function zs(r){return r!==r}var wi=zs;s();p();u();function Hs(r,t,e){for(var i=e-1,a=r.length;++i<a;)if(r[i]===t)return i;return-1}var vi=Hs;function Ks(r,t,e){return t===t?vi(r,t,e):xi(r,wi,e)}var bi=Ks;function Ys(r,t){var e=r==null?0:r.length;return!!e&&bi(r,t,0)>-1}var Ti=Ys;s();p();u();var Js=9007199254740991,Zs=/^(?:0|[1-9]\d*)$/;function Xs(r,t){var e=typeof r;return t=t??Js,!!t&&(e=="number"||e!="symbol"&&Zs.test(r))&&r>-1&&r%1==0&&r<t}var Ai=Xs;s();p();u();function Qs(r,t){return r===t||r!==r&&t!==t}var Nt=Qs;s();p();u();s();p();u();var eu=9007199254740991;function tu(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=eu}var Rt=tu;function ru(r){return r!=null&&Rt(r.length)&&!Et(r)}var Ei=ru;s();p();u();var nu=Object.prototype;function iu(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||nu;return r===e}var Ii=iu;s();p();u();s();p();u();s();p();u();function ou(r,t){for(var e=-1,i=Array(r);++e<r;)i[e]=t(e);return i}var Ci=ou;s();p();u();s();p();u();var au="[object Arguments]";function su(r){return re(r)&&te(r)==au}var rr=su;var Ni=Object.prototype,uu=Ni.hasOwnProperty,pu=Ni.propertyIsEnumerable,lu=rr((function(){return arguments})())?rr:function(r){return re(r)&&uu.call(r,"callee")&&!pu.call(r,"callee")},Ri=lu;s();p();u();s();p();u();function fu(){return!1}var Si=fu;var Pi=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Li=Pi&&typeof module=="object"&&module&&!module.nodeType&&module,cu=Li&&Li.exports===Pi,Bi=cu?z.Buffer:void 0,du=Bi?Bi.isBuffer:void 0,mu=du||Si,ot=mu;s();p();u();s();p();u();var hu="[object Arguments]",yu="[object Array]",gu="[object Boolean]",xu="[object Date]",wu="[object Error]",vu="[object Function]",bu="[object Map]",Tu="[object Number]",Au="[object Object]",Eu="[object RegExp]",Iu="[object Set]",Cu="[object String]",Nu="[object WeakMap]",Ru="[object ArrayBuffer]",Su="[object DataView]",Lu="[object Float32Array]",Bu="[object Float64Array]",Pu="[object Int8Array]",_u="[object Int16Array]",Fu="[object Int32Array]",ku="[object Uint8Array]",Uu="[object Uint8ClampedArray]",Ou="[object Uint16Array]",Mu="[object Uint32Array]",M={};M[Lu]=M[Bu]=M[Pu]=M[_u]=M[Fu]=M[ku]=M[Uu]=M[Ou]=M[Mu]=!0;M[hu]=M[yu]=M[Ru]=M[gu]=M[Su]=M[xu]=M[wu]=M[vu]=M[bu]=M[Tu]=M[Au]=M[Eu]=M[Iu]=M[Cu]=M[Nu]=!1;function Du(r){return re(r)&&Rt(r.length)&&!!M[te(r)]}var _i=Du;s();p();u();function $u(r){return function(t){return r(t)}}var Fi=$u;s();p();u();var ki=typeof exports=="object"&&exports&&!exports.nodeType&&exports,at=ki&&typeof module=="object"&&module&&!module.nodeType&&module,ju=at&&at.exports===ki,nr=ju&&Tt.process,qu=(function(){try{var r=at&&at.require&&at.require("util").types;return r||nr&&nr.binding&&nr.binding("util")}catch{}})(),ir=qu;var Ui=ir&&ir.isTypedArray,Vu=Ui?Fi(Ui):_i,St=Vu;var Wu=Object.prototype,Gu=Wu.hasOwnProperty;function zu(r,t){var e=de(r),i=!e&&Ri(r),a=!e&&!i&&ot(r),d=!e&&!i&&!a&&St(r),f=e||i||a||d,v=f?Ci(r.length,String):[],T=v.length;for(var E in r)(t||Gu.call(r,E))&&!(f&&(E=="length"||a&&(E=="offset"||E=="parent")||d&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||Ai(E,T)))&&v.push(E);return v}var Oi=zu;s();p();u();s();p();u();s();p();u();function Hu(r,t){return function(e){return r(t(e))}}var Mi=Hu;var Ku=Mi(Object.keys,Object),Di=Ku;var Yu=Object.prototype,Ju=Yu.hasOwnProperty;function Zu(r){if(!Ii(r))return Di(r);var t=[];for(var e in Object(r))Ju.call(r,e)&&e!="constructor"&&t.push(e);return t}var $i=Zu;function Xu(r){return Ei(r)?Oi(r):$i(r)}var ji=Xu;s();p();u();s();p();u();s();p();u();s();p();u();s();p();u();var Qu=ee(Object,"create"),he=Qu;function ep(){this.__data__=he?he(null):{},this.size=0}var qi=ep;s();p();u();function tp(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}var Vi=tp;s();p();u();var rp="__lodash_hash_undefined__",np=Object.prototype,ip=np.hasOwnProperty;function op(r){var t=this.__data__;if(he){var e=t[r];return e===rp?void 0:e}return ip.call(t,r)?t[r]:void 0}var Wi=op;s();p();u();var ap=Object.prototype,sp=ap.hasOwnProperty;function up(r){var t=this.__data__;return he?t[r]!==void 0:sp.call(t,r)}var Gi=up;s();p();u();var pp="__lodash_hash_undefined__";function lp(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=he&&t===void 0?pp:t,this}var zi=lp;function Ke(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var i=r[t];this.set(i[0],i[1])}}Ke.prototype.clear=qi;Ke.prototype.delete=Vi;Ke.prototype.get=Wi;Ke.prototype.has=Gi;Ke.prototype.set=zi;var or=Ke;s();p();u();s();p();u();function fp(){this.__data__=[],this.size=0}var Hi=fp;s();p();u();s();p();u();function cp(r,t){for(var e=r.length;e--;)if(Nt(r[e][0],t))return e;return-1}var Ae=cp;var dp=Array.prototype,mp=dp.splice;function hp(r){var t=this.__data__,e=Ae(t,r);if(e<0)return!1;var i=t.length-1;return e==i?t.pop():mp.call(t,e,1),--this.size,!0}var Ki=hp;s();p();u();function yp(r){var t=this.__data__,e=Ae(t,r);return e<0?void 0:t[e][1]}var Yi=yp;s();p();u();function gp(r){return Ae(this.__data__,r)>-1}var Ji=gp;s();p();u();function xp(r,t){var e=this.__data__,i=Ae(e,r);return i<0?(++this.size,e.push([r,t])):e[i][1]=t,this}var Zi=xp;function Ye(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var i=r[t];this.set(i[0],i[1])}}Ye.prototype.clear=Hi;Ye.prototype.delete=Ki;Ye.prototype.get=Yi;Ye.prototype.has=Ji;Ye.prototype.set=Zi;var Ee=Ye;s();p();u();var wp=ee(z,"Map"),Ie=wp;function vp(){this.size=0,this.__data__={hash:new or,map:new(Ie||Ee),string:new or}}var Xi=vp;s();p();u();s();p();u();s();p();u();function bp(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}var Qi=bp;function Tp(r,t){var e=r.__data__;return Qi(t)?e[typeof t=="string"?"string":"hash"]:e.map}var Ce=Tp;function Ap(r){var t=Ce(this,r).delete(r);return this.size-=t?1:0,t}var eo=Ap;s();p();u();function Ep(r){return Ce(this,r).get(r)}var to=Ep;s();p();u();function Ip(r){return Ce(this,r).has(r)}var ro=Ip;s();p();u();function Cp(r,t){var e=Ce(this,r),i=e.size;return e.set(r,t),this.size+=e.size==i?0:1,this}var no=Cp;function Je(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var i=r[t];this.set(i[0],i[1])}}Je.prototype.clear=Xi;Je.prototype.delete=eo;Je.prototype.get=to;Je.prototype.has=ro;Je.prototype.set=no;var Lt=Je;s();p();u();function Np(r){return r==null?"":ci(r)}var Ne=Np;s();p();u();function Rp(r,t){for(var e=-1,i=t.length,a=r.length;++e<i;)r[a+e]=t[e];return r}var io=Rp;s();p();u();s();p();u();s();p();u();s();p();u();s();p();u();s();p();u();function Sp(r,t,e){var i=-1,a=r.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 d=Array(a);++i<a;)d[i]=r[i+t];return d}var oo=Sp;function Lp(r,t,e){var i=r.length;return e=e===void 0?i:e,!t&&e>=i?r:oo(r,t,e)}var ao=Lp;s();p();u();var Bp="\\ud800-\\udfff",Pp="\\u0300-\\u036f",_p="\\ufe20-\\ufe2f",Fp="\\u20d0-\\u20ff",kp=Pp+_p+Fp,Up="\\ufe0e\\ufe0f",Op="\\u200d",Mp=RegExp("["+Op+Bp+kp+Up+"]");function Dp(r){return Mp.test(r)}var Bt=Dp;s();p();u();s();p();u();function $p(r){return r.split("")}var so=$p;s();p();u();var uo="\\ud800-\\udfff",jp="\\u0300-\\u036f",qp="\\ufe20-\\ufe2f",Vp="\\u20d0-\\u20ff",Wp=jp+qp+Vp,Gp="\\ufe0e\\ufe0f",zp="["+uo+"]",ar="["+Wp+"]",sr="\\ud83c[\\udffb-\\udfff]",Hp="(?:"+ar+"|"+sr+")",po="[^"+uo+"]",lo="(?:\\ud83c[\\udde6-\\uddff]){2}",fo="[\\ud800-\\udbff][\\udc00-\\udfff]",Kp="\\u200d",co=Hp+"?",mo="["+Gp+"]?",Yp="(?:"+Kp+"(?:"+[po,lo,fo].join("|")+")"+mo+co+")*",Jp=mo+co+Yp,Zp="(?:"+[po+ar+"?",ar,lo,fo,zp].join("|")+")",Xp=RegExp(sr+"(?="+sr+")|"+Zp+Jp,"g");function Qp(r){return r.match(Xp)||[]}var ho=Qp;function el(r){return Bt(r)?ho(r):so(r)}var yo=el;function tl(r){return function(t){t=Ne(t);var e=Bt(t)?yo(t):void 0,i=e?e[0]:t.charAt(0),a=e?ao(e,1).join(""):t.slice(1);return i[r]()+a}}var go=tl;var rl=go("toUpperCase"),Ze=rl;function nl(r){return Ze(Ne(r).toLowerCase())}var xo=nl;s();p();u();s();p();u();function il(r,t,e,i){var a=-1,d=r==null?0:r.length;for(i&&d&&(e=r[++a]);++a<d;)e=t(e,r[a],a,r);return e}var wo=il;s();p();u();s();p();u();s();p();u();function ol(r){return function(t){return r?.[t]}}var vo=ol;var al={\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"},sl=vo(al),bo=sl;var ul=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,pl="\\u0300-\\u036f",ll="\\ufe20-\\ufe2f",fl="\\u20d0-\\u20ff",cl=pl+ll+fl,dl="["+cl+"]",ml=RegExp(dl,"g");function hl(r){return r=Ne(r),r&&r.replace(ul,bo).replace(ml,"")}var To=hl;s();p();u();s();p();u();var yl=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function gl(r){return r.match(yl)||[]}var Ao=gl;s();p();u();var xl=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function wl(r){return xl.test(r)}var Eo=wl;s();p();u();var So="\\ud800-\\udfff",vl="\\u0300-\\u036f",bl="\\ufe20-\\ufe2f",Tl="\\u20d0-\\u20ff",Al=vl+bl+Tl,Lo="\\u2700-\\u27bf",Bo="a-z\\xdf-\\xf6\\xf8-\\xff",El="\\xac\\xb1\\xd7\\xf7",Il="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Cl="\\u2000-\\u206f",Nl=" \\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",Po="A-Z\\xc0-\\xd6\\xd8-\\xde",Rl="\\ufe0e\\ufe0f",_o=El+Il+Cl+Nl,Fo="['\u2019]",Io="["+_o+"]",Sl="["+Al+"]",ko="\\d+",Ll="["+Lo+"]",Uo="["+Bo+"]",Oo="[^"+So+_o+ko+Lo+Bo+Po+"]",Bl="\\ud83c[\\udffb-\\udfff]",Pl="(?:"+Sl+"|"+Bl+")",_l="[^"+So+"]",Mo="(?:\\ud83c[\\udde6-\\uddff]){2}",Do="[\\ud800-\\udbff][\\udc00-\\udfff]",Xe="["+Po+"]",Fl="\\u200d",Co="(?:"+Uo+"|"+Oo+")",kl="(?:"+Xe+"|"+Oo+")",No="(?:"+Fo+"(?:d|ll|m|re|s|t|ve))?",Ro="(?:"+Fo+"(?:D|LL|M|RE|S|T|VE))?",$o=Pl+"?",jo="["+Rl+"]?",Ul="(?:"+Fl+"(?:"+[_l,Mo,Do].join("|")+")"+jo+$o+")*",Ol="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ml="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Dl=jo+$o+Ul,$l="(?:"+[Ll,Mo,Do].join("|")+")"+Dl,jl=RegExp([Xe+"?"+Uo+"+"+No+"(?="+[Io,Xe,"$"].join("|")+")",kl+"+"+Ro+"(?="+[Io,Xe+Co,"$"].join("|")+")",Xe+"?"+Co+"+"+No,Xe+"+"+Ro,Ml,Ol,ko,$l].join("|"),"g");function ql(r){return r.match(jl)||[]}var qo=ql;function Vl(r,t,e){return r=Ne(r),t=e?void 0:t,t===void 0?Eo(r)?qo(r):Ao(r):r.match(t)||[]}var Vo=Vl;var Wl="['\u2019]",Gl=RegExp(Wl,"g");function zl(r){return function(t){return wo(Vo(To(t).replace(Gl,"")),r,"")}}var Wo=zl;var Hl=Wo(function(r,t,e){return t=t.toLowerCase(),r+(e?xo(t):t)}),Pt=Hl;s();p();u();s();p();u();function Kl(){this.__data__=new Ee,this.size=0}var Go=Kl;s();p();u();function Yl(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}var zo=Yl;s();p();u();function Jl(r){return this.__data__.get(r)}var Ho=Jl;s();p();u();function Zl(r){return this.__data__.has(r)}var Ko=Zl;s();p();u();var Xl=200;function Ql(r,t){var e=this.__data__;if(e instanceof Ee){var i=e.__data__;if(!Ie||i.length<Xl-1)return i.push([r,t]),this.size=++e.size,this;e=this.__data__=new Lt(i)}return e.set(r,t),this.size=e.size,this}var Yo=Ql;function Qe(r){var t=this.__data__=new Ee(r);this.size=t.size}Qe.prototype.clear=Go;Qe.prototype.delete=zo;Qe.prototype.get=Ho;Qe.prototype.has=Ko;Qe.prototype.set=Yo;var _t=Qe;s();p();u();s();p();u();function ef(r,t){for(var e=-1,i=r==null?0:r.length,a=0,d=[];++e<i;){var f=r[e];t(f,e,r)&&(d[a++]=f)}return d}var Jo=ef;s();p();u();function tf(){return[]}var Zo=tf;var rf=Object.prototype,nf=rf.propertyIsEnumerable,Xo=Object.getOwnPropertySymbols,of=Xo?function(r){return r==null?[]:(r=Object(r),Jo(Xo(r),function(t){return nf.call(r,t)}))}:Zo,Qo=of;s();p();u();s();p();u();function af(r,t,e){var i=t(r);return de(r)?i:io(i,e(r))}var ea=af;function sf(r){return ea(r,ji,Qo)}var ur=sf;s();p();u();s();p();u();var uf=ee(z,"DataView"),Ft=uf;s();p();u();var pf=ee(z,"Promise"),kt=pf;s();p();u();var lf=ee(z,"Set"),Re=lf;var ta="[object Map]",ff="[object Object]",ra="[object Promise]",na="[object Set]",ia="[object WeakMap]",oa="[object DataView]",cf=me(Ft),df=me(Ie),mf=me(kt),hf=me(Re),yf=me(Ct),ke=te;(Ft&&ke(new Ft(new ArrayBuffer(1)))!=oa||Ie&&ke(new Ie)!=ta||kt&&ke(kt.resolve())!=ra||Re&&ke(new Re)!=na||Ct&&ke(new Ct)!=ia)&&(ke=function(r){var t=te(r),e=t==ff?r.constructor:void 0,i=e?me(e):"";if(i)switch(i){case cf:return oa;case df:return ta;case mf:return ra;case hf:return na;case yf:return ia}return t});var pr=ke;s();p();u();var gf=z.Uint8Array,lr=gf;s();p();u();s();p();u();s();p();u();s();p();u();s();p();u();var xf="__lodash_hash_undefined__";function wf(r){return this.__data__.set(r,xf),this}var aa=wf;s();p();u();function vf(r){return this.__data__.has(r)}var sa=vf;function Ut(r){var t=-1,e=r==null?0:r.length;for(this.__data__=new Lt;++t<e;)this.add(r[t])}Ut.prototype.add=Ut.prototype.push=aa;Ut.prototype.has=sa;var Ot=Ut;s();p();u();function bf(r,t){for(var e=-1,i=r==null?0:r.length;++e<i;)if(t(r[e],e,r))return!0;return!1}var ua=bf;s();p();u();function Tf(r,t){return r.has(t)}var Mt=Tf;var Af=1,Ef=2;function If(r,t,e,i,a,d){var f=e&Af,v=r.length,T=t.length;if(v!=T&&!(f&&T>v))return!1;var E=d.get(r),I=d.get(t);if(E&&I)return E==t&&I==r;var R=-1,P=!0,C=e&Ef?new Ot:void 0;for(d.set(r,t),d.set(t,r);++R<v;){var N=r[R],L=t[R];if(i)var F=f?i(L,N,R,t,r,d):i(N,L,R,r,t,d);if(F!==void 0){if(F)continue;P=!1;break}if(C){if(!ua(t,function($,k){if(!Mt(C,k)&&(N===$||a(N,$,e,i,d)))return C.push(k)})){P=!1;break}}else if(!(N===L||a(N,L,e,i,d))){P=!1;break}}return d.delete(r),d.delete(t),P}var Dt=If;s();p();u();s();p();u();function Cf(r){var t=-1,e=Array(r.size);return r.forEach(function(i,a){e[++t]=[a,i]}),e}var pa=Cf;s();p();u();function Nf(r){var t=-1,e=Array(r.size);return r.forEach(function(i){e[++t]=i}),e}var et=Nf;var Rf=1,Sf=2,Lf="[object Boolean]",Bf="[object Date]",Pf="[object Error]",_f="[object Map]",Ff="[object Number]",kf="[object RegExp]",Uf="[object Set]",Of="[object String]",Mf="[object Symbol]",Df="[object ArrayBuffer]",$f="[object DataView]",la=Q?Q.prototype:void 0,fr=la?la.valueOf:void 0;function jf(r,t,e,i,a,d,f){switch(e){case $f:if(r.byteLength!=t.byteLength||r.byteOffset!=t.byteOffset)return!1;r=r.buffer,t=t.buffer;case Df:return!(r.byteLength!=t.byteLength||!d(new lr(r),new lr(t)));case Lf:case Bf:case Ff:return Nt(+r,+t);case Pf:return r.name==t.name&&r.message==t.message;case kf:case Of:return r==t+"";case _f:var v=pa;case Uf:var T=i&Rf;if(v||(v=et),r.size!=t.size&&!T)return!1;var E=f.get(r);if(E)return E==t;i|=Sf,f.set(r,t);var I=Dt(v(r),v(t),i,a,d,f);return f.delete(r),I;case Mf:if(fr)return fr.call(r)==fr.call(t)}return!1}var fa=jf;s();p();u();var qf=1,Vf=Object.prototype,Wf=Vf.hasOwnProperty;function Gf(r,t,e,i,a,d){var f=e&qf,v=ur(r),T=v.length,E=ur(t),I=E.length;if(T!=I&&!f)return!1;for(var R=T;R--;){var P=v[R];if(!(f?P in t:Wf.call(t,P)))return!1}var C=d.get(r),N=d.get(t);if(C&&N)return C==t&&N==r;var L=!0;d.set(r,t),d.set(t,r);for(var F=f;++R<T;){P=v[R];var $=r[P],k=t[P];if(i)var H=f?i(k,$,P,t,r,d):i($,k,P,r,t,d);if(!(H===void 0?$===k||a($,k,e,i,d):H)){L=!1;break}F||(F=P=="constructor")}if(L&&!F){var W=r.constructor,V=t.constructor;W!=V&&"constructor"in r&&"constructor"in t&&!(typeof W=="function"&&W instanceof W&&typeof V=="function"&&V instanceof V)&&(L=!1)}return d.delete(r),d.delete(t),L}var ca=Gf;var zf=1,da="[object Arguments]",ma="[object Array]",$t="[object Object]",Hf=Object.prototype,ha=Hf.hasOwnProperty;function Kf(r,t,e,i,a,d){var f=de(r),v=de(t),T=f?ma:pr(r),E=v?ma:pr(t);T=T==da?$t:T,E=E==da?$t:E;var I=T==$t,R=E==$t,P=T==E;if(P&&ot(r)){if(!ot(t))return!1;f=!0,I=!1}if(P&&!I)return d||(d=new _t),f||St(r)?Dt(r,t,e,i,a,d):fa(r,t,T,e,i,a,d);if(!(e&zf)){var C=I&&ha.call(r,"__wrapped__"),N=R&&ha.call(t,"__wrapped__");if(C||N){var L=C?r.value():r,F=N?t.value():t;return d||(d=new _t),a(L,F,e,i,d)}}return P?(d||(d=new _t),ca(r,t,e,i,a,d)):!1}var ya=Kf;function ga(r,t,e,i,a){return r===t?!0:r==null||t==null||!re(r)&&!re(t)?r!==r&&t!==t:ya(r,t,e,i,ga,a)}var xa=ga;s();p();u();function Yf(r,t,e){for(var i=-1,a=r==null?0:r.length;++i<a;)if(e(t,r[i]))return!0;return!1}var wa=Yf;s();p();u();function Jf(r,t){return xa(r,t)}var jt=Jf;s();p();u();s();p();u();var Zf=1/0,Xf=Re&&1/et(new Re([,-0]))[1]==Zf?function(r){return new Re(r)}:gi,va=Xf;var Qf=200;function ec(r,t,e){var i=-1,a=Ti,d=r.length,f=!0,v=[],T=v;if(e)f=!1,a=wa;else if(d>=Qf){var E=t?null:va(r);if(E)return et(E);f=!1,a=Mt,T=new Ot}else T=t?[]:v;e:for(;++i<d;){var I=r[i],R=t?t(I):I;if(I=e||I!==0?I:0,f&&R===R){for(var P=T.length;P--;)if(T[P]===R)continue e;t&&T.push(R),v.push(I)}else a(T,R,e)||(T!==v&&T.push(R),v.push(I))}return v}var ba=ec;s();p();u();function tc(r,t){return t=typeof t=="function"?t:void 0,r&&r.length?ba(r,void 0,t):[]}var qt=tc;s();p();u();function st(r){return Object.keys(r)}s();p();u();s();p();u();s();p();u();var ut=h.env.FERN_STACK_TRACK?.toLowerCase()??"",se=ut!==""&&ut!=="0"&&ut!=="false",cr=["single","multiline","box"].includes(ut)?ut:"single";se&&(Error.stackTraceLimit=50);var rc=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),nc=new Set(["stacktrace"]);function Wt({maxFrames:r=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:a=[],filterNode:d=!0,filterJs:f=!0,formatFilename:v=T=>T}={}){if(!se)return[];i=[...i,...rc],e=[...e,...nc],a=[...a,"runInteractiveTask"];let T=!1;return(new Error().stack??"").split(`
|
|
2
|
+
`).map(E=>{let I=E.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(I&&I.length===5){let[,R,P,C,N]=I;if(!R||!P||!C||!N)return;if(T||a.some(L=>R?.includes(L))){T=!0;return}switch(R){case"Object.<anonymous>":R="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":R=`${R.substring(R.indexOf(".")+1)}()=> { ... }`;break}return{fn:R,path:v(P),position:`${C}:${N}`}}}).filter(E=>E&&!i.some(I=>E.fn.includes(I))&&!(d&&E.path?.startsWith("node:"))&&!(f&&E.path?.endsWith(".js"))&&!e.some(I=>E.path.includes(I))).slice(t,t+r)}var Vt=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:i=[],filterFunctions:a=[],stopOn:d=[],filterNode:f=!0,filterJs:v=!0,multiline:T=!1,formatFilename:E=I=>I}={}){x(this,"maxFrames");x(this,"skip");x(this,"filterPaths");x(this,"filterFunctions");x(this,"stopOn");x(this,"filterNode");x(this,"filterJs");x(this,"multiline");x(this,"formatFilename");x(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=i,this.filterFunctions=a,this.stopOn=d,this.filterNode=f,this.filterJs=v,this.multiline=T,this.formatFilename=E}tag(t){let e=this.tracking.get(t)||new Set;Wt({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(!se)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}},dr;function Ta({maxFrames:r=50,skip:t=0,filterPaths:e=[],filterFunctions:i=[],stopOn:a=[],filterNode:d=!0,filterJs:f=!0,multiline:v=!1,formatFilename:T=E=>E}={}){se&&(dr??(dr=new Vt({maxFrames:r,skip:t,filterPaths:e,filterFunctions:i,stopOn:a,filterNode:d,filterJs:f,multiline:v,formatFilename:T})))}function Aa(r){dr?.tag(r)}function mr(r){return dr?.frames(r)??[]}var ye=class{constructor(){Aa(this)}};s();p();u();s();p();u();s();p();u();var ne=class extends ye{constructor(e){super();x(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 ic=4;Ta({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var pt=class{constructor(){x(this,"lineBuffer",[]);x(this,"indentLevel",0);x(this,"hasWrittenAnything",!1);x(this,"lastCharacterIsSemicolon",!1);x(this,"lastCharacterIsNewline",!1);x(this,"nodeStackFrames",[])}get buffer(){return se&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
4
|
+
`),this.lineBuffer.join(`
|
|
5
|
+
`)+(this.lastCharacterIsNewline?`
|
|
6
|
+
`:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let i=e.length>0&&e.endsWith(`
|
|
7
|
+
`),a=i?e.substring(0,e.length-1):e,d=this.getIndentString(),f=a.replaceAll(`
|
|
8
|
+
`,`
|
|
9
|
+
${d}`);this.isAtStartOfLine()&&(f=d+f),i&&(f+=`
|
|
10
|
+
`),this.writeInternal(f)}else this.writeNode(e)}writeStatement(...t){this.write(...t),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){se&&this.nodeStackFrames.push(...mr(t)),t.write(this),se&&cr!=="single"&&this.writeInternal(`
|
|
11
|
+
`)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){this.writeNode(t),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new ne(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new ne(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new ne(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new ne(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new ne(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(...t){this.write(...t.length===0?[""]:t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
12
|
+
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
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 d=1;d<t.length;d++){this.write(e);let f=t[d];f!=null&&i(f)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
|
|
14
|
+
`),this.lastCharacterIsSemicolon=t.endsWith(";");let i=t.split(`
|
|
15
|
+
`),a=se&&!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(Wt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,cr){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 ic}};s();p();u();function hr(r){return r?.name!=null&&r?.assignment!=null}s();p();u();var lt=class extends ye{constructor({condition:e,true_:i,false_:a}){super();x(this,"condition");x(this,"true_");x(this,"false_");this.condition=e,this.true_=i,this.false_=a}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};s();p();u();s();p();u();s();p();u();var ft=class{constructor(){x(this,"reporter");x(this,"snippet");x(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context: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 ct=class{constructor(t){x(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 ft;for(let d of i){let f=this.context.clone(),v=this.createSnippetGenerator(f);try{let T=await v.generateSnippet({endpoint:d,request:t,options:e});if(f.errors.empty())return{snippet:T,errors:void 0};a.update({context:f,snippet:T})}catch(T){a.err==null&&(a.err=T)}}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 d of i){let f=this.context.clone(),v=this.createSnippetGenerator(f);try{return await v.generateSnippetAst({endpoint:d,request:t,options:e})}catch(T){a=T}}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 ft;for(let d of i){let f=this.context.clone(),v=this.createSnippetGenerator(f);try{let T=v.generateSnippetSync({endpoint:d,request:t,options:e});if(f.errors.empty())return{snippet:T,errors:void 0};a.update({context:f,snippet:T})}catch(T){a.err==null&&(a.err=T)}}return a.getResponseOrThrow({endpoint:t.endpoint})}};s();p();u();s();p();u();s();p();u();var dt=class{constructor(){x(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]}}};s();p();u();var _={Critical:"CRITICAL",Warning:"WARNING"},mt=class r{constructor(){x(this,"errors");x(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 r;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 ht=class{constructor({ir:t,config:e,options:i={}}){x(this,"config");x(this,"options");x(this,"errors");x(this,"_ir");x(this,"httpEndpointReferenceParser");this._ir=t,this.config=e,this.options=i,this.errors=new mt,this.httpEndpointReferenceParser=new dt}associateQueryParametersByWireValue({parameters:t,values:e}){let i=[];for(let[a,d]of Object.entries(e)){this.errors.scope(a);try{let f=t.find(T=>T.name.wireValue===a);if(f==null)throw this.newParameterNotRecognizedError(a);let v=this.isListTypeReference(f.typeReference)&&!Array.isArray(d)?[d]:d;i.push({name:f.name,typeReference:f.typeReference,value:v})}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 d=e[a.name.wireValue];if(d==null)if(a.typeReference.type==="primitive"&&a.typeReference.value==="STRING")d=`<${a.name.wireValue}>`;else{this.errors.add({severity:_.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}i.push({name:a.name,typeReference:a.typeReference,value:d})}finally{this.errors.unscope()}}return i}associateByWireValue({parameters:t,values:e,ignoreMissingParameters:i}){let a=[];for(let[d,f]of Object.entries(e)){this.errors.scope(d);try{let v=t.find(T=>T.name.wireValue===d);if(v==null){if(i)continue;this.errors.add({severity:_.Critical,message:this.newParameterNotRecognizedError(d).message});continue}a.push({name:v.name,typeReference:v.typeReference,value:f})}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 d of t){let f=i[d.name.wireValue];f==null?d.typeReference.type==="nullable"&&a.push({name:d.name,typeReference:d.typeReference,value:null}):a.push({name:d.name,typeReference:d.typeReference,value:f})}return a}getSingleFileValue({property:t,record:e}){let i=e[t.wireValue];if(i!=null){if(typeof i!="string"){this.errors.add({severity:_.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:_.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}let a=[];for(let d of i){if(typeof d!="string"){this.errors.add({severity:_.Critical,message:`Expected file array value to be an array of strings, got ${typeof d}`});return}a.push(d)}return a}getRecord(t){if(typeof t!="object"||Array.isArray(t)){this.errors.add({severity:_.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:_.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,d=i[a];if(d==null){this.errors.add({severity:_.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof d!="string"){this.errors.add({severity:_.Critical,message:`Expected discriminant value to be a string but got: ${typeof d}`});return}let f=t.types[d];if(f==null){this.errors.add({severity:_.Critical,message:`No type found for discriminant value "${d}"`});return}let{[a]:v,...T}=i;return{singleDiscriminatedUnionType:f,discriminantValue:f.discriminantValue,value:T}}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:O(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:O(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:_.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:_.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:_.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(st(i.urls));for(let d of st(t))a.has(d)&&a.delete(d);return a.size>0?(this.errors.add({severity:_.Critical,message:`The provided environments are invalid; got: [${Object.keys(t).join(", ")}], expected: [${st(i.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:t}){if(typeof t!="number"){this.errors.add({severity:_.Critical,message:this.newTypeMismatchError({expected:"number",value:t}).message});return}return t}getValueAsBoolean({value:t}){if(typeof t!="boolean"){this.errors.add({severity:_.Critical,message:this.newTypeMismatchError({expected:"boolean",value:t}).message});return}return t}getValueAsString({value:t}){if(typeof t!="string"){this.errors.add({severity:_.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:O(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:O(e)}})}fileUploadHasFileProperties({fileUpload:t}){return t.properties.some(e=>{switch(e.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:O(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}};s();p();u();var ue={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};s();p();u();s();p();u();s();p();u();var Ea="self",Ia="static";s();p();u();var Ca=new Set(["abstract","and","array","as","break","callable","case","catch","class","clone","const","continue","declare","default","die","do","echo","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","eval","exit","extends","final","finally","fn","for","foreach","function","global","goto","if","implements","include","include_once","instanceof","insteadof","interface","isset","list","match","namespace","new","or","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","unset","use","var","while","xor","yield","yield_from","__halt_compiler"]);var A={};Pr(A,{Access:()=>Se,Array:()=>Ue,AstNode:()=>S,Attribute:()=>Oe,Class:()=>ge,ClassInstantiation:()=>le,ClassReference:()=>K,CodeBlock:()=>J,DataClass:()=>Me,Enum:()=>De,Field:()=>$e,Map:()=>je,Method:()=>ve,MethodInvocation:()=>we,Parameter:()=>xe,Trait:()=>qe,Type:()=>oe,TypeLiteral:()=>ie,Writer:()=>pe,array:()=>cc,assignVariable:()=>Cc,attribute:()=>dc,classReference:()=>yc,class_:()=>mc,codeblock:()=>Ve,dataClass:()=>gc,enum_:()=>xc,escapePhpString:()=>gr,field:()=>wc,instantiateClass:()=>Pa,invokeMethod:()=>vc,map:()=>Tc,mergeArrays:()=>Sc,method:()=>Ac,parameter:()=>Ec,string:()=>Rc,ternary:()=>Ic,this_:()=>Lc,throwException:()=>bc,trait:()=>hc,variable:()=>Nc});s();p();u();s();p();u();s();p();u();var Se={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};s();p();u();s();p();u();s();p();u();function Na(r){return{namespace:r.substring(0,r.lastIndexOf("\\")),name:r.substring(r.lastIndexOf("\\")+1)}}var pe=class extends pt{constructor({namespace:e,rootNamespace:i,customConfig:a}){super();x(this,"namespace");x(this,"rootNamespace");x(this,"customConfig");x(this,"references",{});this.namespace=e,this.rootNamespace=i,this.customConfig=a}addReference(e){var f;if(e.namespace==null)return;if(Object.keys(this.references).filter(v=>{let T=Na(v);return T.namespace!==e.namespace&&T.name===e.name}).length>0){e.requireFullyQualified();return}let a=e.namespace===""?e.name:`${e.namespace}\\${e.name}`;((f=this.references)[a]??(f[a]=[])).push(e)}toString(e=!1){if(e)return this.buffer;let i=`namespace ${this.namespace};`,a=this.stringifyImports();return a.length>0?`${i}
|
|
16
|
+
|
|
17
|
+
${a}
|
|
18
|
+
|
|
19
|
+
${this.buffer}`:i+`
|
|
20
|
+
|
|
21
|
+
`+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(i=>Na(i).namespace!==this.namespace).map(i=>`use ${i};`).join(`
|
|
22
|
+
`)}};var S=class extends ye{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:i,customConfig:a,skipImports:d=!1}=t,f=new pe({namespace:e,rootNamespace:i,customConfig:a});return this.write(f),f.toString(d)}async toStringAsync({namespace:t,rootNamespace:e,customConfig:i}){let a=new pe({namespace:t,rootNamespace:e,customConfig:i});return this.write(a),a.toString()}};var Ue=class extends S{constructor({entries:e}){super();x(this,"entries");this.entries=e??[]}write(e){e.write("["),this.entries.forEach((i,a)=>{a>0&&e.write(", "),i.write(e)}),e.write("]")}};s();p();u();var Oe=class extends S{constructor(e){super();x(this,"reference");x(this,"arguments");this.reference=e.reference,this.arguments=e.arguments??[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((i,a)=>{a>0&&e.write(","),typeof i=="string"?e.write(i):i.write(e)}),e.write(")"))}};s();p();u();s();p();u();var K=class extends S{constructor({name:e,namespace:i,generics:a}){super();x(this,"name");x(this,"namespace");x(this,"generics");x(this,"fullyQualified");this.name=e,this.namespace=i,this.generics=a,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let i=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${i}`)}};s();p();u();s();p();u();function Le(r){return r.startsWith("$")?r:`$${r}`}var X=class extends S{constructor({docs:e}={}){super();x(this,"docs");x(this,"tags",[]);this.docs=e}addTag(e){this.tags.push({...e,name:e.name!=null?Le(e.name):void 0})}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
|
|
23
|
+
`).forEach(i=>{e.writeLine(` * ${i}`)}),this.tags.length>0&&e.writeLine(" *"));for(let i of this.tags)this.writeTag({writer:e,tag:i});e.writeLine(" */")}writeTag({writer:e,tag:i}){let a=i.docs!=null?i.docs.split(`
|
|
24
|
+
`):void 0;a!=null&&a.length>1&&(a.forEach(d=>{e.writeLine(` * ${d}`)}),e.writeLine(" *")),e.write(` * @${i.tagType} `),i.type.write(e,{comment:!0}),i.name!=null&&e.write(` ${i.name}`),a!=null&&a.length===1&&e.write(` ${a[0]}`),e.newLine()}};s();p();u();function Be(r){return oc(r,[Se.Public,Se.PublicReadonly,Se.Protected,Se.Private])}function oc(r,t){return t.reduce((e,i)=>[...e,...r.filter(a=>a.access===i)],[])}var ge=class extends S{constructor({name:e,namespace:i,abstract:a,docs:d,parentClassReference:f,traits:v}){super();x(this,"name");x(this,"namespace");x(this,"abstract");x(this,"docs");x(this,"parentClassReference");x(this,"traits");x(this,"fields",[]);x(this,"methods",[]);x(this,"constructor_");this.name=e,this.namespace=i,this.abstract=a??!1,this.docs=d,this.parentClassReference=f,this.traits=v??[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addMethods(e){this.methods.push(...e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new K({name:this.name,namespace:this.namespace})),this.abstract&&e.write("abstract "),this.writeComment(e),e.write(`class ${this.name} `),this.parentClassReference!=null&&(e.write("extends "),this.parentClassReference.write(e)),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((i,a)=>{a>0&&e.write(","),e.writeNode(i)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:Be(this.fields)}),(this.constructor!=null||this.methods.length>0)&&e.newLine(),this.constructor_!=null&&(this.writeConstructor({writer:e,constructor:this.constructor_}),this.methods.length>0&&e.newLine()),this.writeMethods({writer:e,methods:Be(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new X({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:i}){this.writeConstructorComment({writer:e,constructor:i}),i.access!=null&&e.write(`${i.access} `),e.write("function __construct("),e.indent(),i.parameters.forEach((a,d)=>{d===0&&e.newLine(),a.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),i.body?.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:i}){if(i.parameters.length===0)return;let a=new X;for(let d of i.parameters)a.addTag(d.getCommentTag());a.write(e)}writeFields({writer:e,fields:i}){i.filter(a=>!a.inherited).forEach((a,d)=>{d>0&&e.newLine(),a.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:i}){i.forEach((a,d)=>{d>0&&e.newLine(),a.write(e),e.writeNewLineIfLastLineNot()})}};s();p();u();s();p();u();function tt({writer:r,arguments_:t,multiline:e}){if(t.length===0){r.write("()");return}if(e){ac({writer:r,arguments_:t});return}sc({writer:r,arguments_:t})}function ac({writer:r,arguments_:t}){r.writeLine("("),r.indent();for(let e of t)Sa({writer:r,argument:e,writeCompact:!1}),r.writeLine(",");r.dedent(),r.write(")")}function sc({writer:r,arguments_:t}){r.write("("),t.forEach((e,i)=>{i>0&&r.write(", "),Sa({writer:r,argument:e,writeCompact:!0})}),r.write(")")}function Sa({writer:r,argument:t,writeCompact:e}){hr(t)?(t.docs&&(e?r.write(`/* ${t.docs} */ `):r.writeLine(`/* ${t.docs} */`)),r.write(`${t.name}: `),r.writeNodeOrString(t.assignment)):t.write(r)}var le=class extends S{constructor({classReference:e,arguments_:i,multiline:a}){super();x(this,"classReference");x(this,"arguments_");x(this,"multiline");this.classReference=e,this.arguments_=i,this.multiline=a??!1}write(e){e.write("new "),e.writeNode(this.classReference),tt({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};s();p();u();var J=class extends S{constructor(e){super();x(this,"arg");this.arg=e}write(e){return new ne(this.arg).write(e)}};s();p();u();s();p();u();var xe=class extends S{constructor({name:e,type:i,docs:a,initializer:d,access:f,readonly_:v}){super();x(this,"name");x(this,"type");x(this,"docs");x(this,"initializer");x(this,"access");x(this,"readonly_");this.name=Le(e),this.type=i,this.docs=a,this.initializer=d,this.access=f,this.readonly_=v??!1}getCommentTag(){return{tagType:"param",type:this.type,name:this.name,docs:this.docs}}write(e){this.access!=null&&e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null?(e.write(" = "),this.initializer.write(e)):this.type.isOptional()&&e.write(" = null")}};s();p();u();s();p();u();s();p();u();s();p();u();var we=class extends S{constructor({method:e,arguments_:i,static_:a,multiline:d,on:f}){super();x(this,"method");x(this,"arguments_");x(this,"multiline");x(this,"static_");x(this,"on");this.method=e,this.arguments_=i,this.static_=a??!1,this.multiline=d??!1,this.on=f}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),tt({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};var ie=class r extends S{constructor(e){super();x(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"list":{this.writeList({writer:e,list:this.internalType});break}case"boolean":{e.write(this.internalType.value.toString());break}case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"file":{e.writeNode(pc({writer:e,value:this.internalType.value}));break}case"float":{e.write(this.internalType.value.toString());break}case"number":{e.write(this.internalType.value.toString());break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"datetime":{e.writeNode(uc({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
|
|
25
|
+
`)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}if(this.internalType.value.includes("'")){e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}e.write(`'${this.internalType.value}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:O(this.internalType)}}isClass(){return this.internalType.type==="class"}asClassOrThrow(){if(this.isClass())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a class")}writeStringWithHeredoc({writer:e,value:i}){e.writeLine("<<<EOT"),e.writeNoIndent(i),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:i}){e.writeNode(new le({classReference:i.reference,arguments_:[r.map({entries:i.fields.map(a=>({key:r.string(a.name),value:a.value}))})]}))}writeList({writer:e,list:i}){let a=fc({values:i.values});if(a.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let d of a)d.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:i}){let a=lc({entries:i.entries});if(a.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let d of a)d.key.write(e),e.write(" => "),d.value.write(e),e.writeLine(",");e.dedent(),e.write("]")}static list({values:e}){return new this({type:"list",values:e})}static boolean(e){return new this({type:"boolean",value:e})}static class_({reference:e,fields:i}){return new this({type:"class",reference:e,fields:i})}static file(e){return new this({type:"file",value:e})}static float(e){return new this({type:"float",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static map({entries:e}){return new this({type:"map",entries:e})}static reference(e){return new this({type:"reference",value:e})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:i}){switch(typeof i){case"boolean":e.write(i.toString());return;case"string":e.write(i.includes('"')?`\`${i}\``:`"${i}"`);return;case"number":e.write(i.toString());return;case"object":if(i==null){e.write("null");return}if(Array.isArray(i)){this.writeUnknownArray({writer:e,value:i});return}this.writeUnknownMap({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(r.unknown(a)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:i}){let a=Object.entries(i);if(a.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[d,f]of a)e.write(`'${d}' => `),e.writeNode(r.unknown(f)),e.writeLine(",");e.dedent(),e.write("]")}};function uc({writer:r,value:t}){return new le({classReference:new K({name:"DateTime",namespace:""}),arguments_:[new J(`'${t}'`)]})}function pc({writer:r,value:t}){return new we({on:new K({name:"File",namespace:`${r.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new J(`"${t}"`)]})}function lc({entries:r}){return r.filter(t=>!ie.isNop(t.key)&&!ie.isNop(t.value))}function fc({values:r}){return r.filter(t=>!ie.isNop(t))}var oe=class r extends S{constructor(e){super();x(this,"internalType");this.internalType=e}write(e,{comment:i}={}){switch(this.internalType.type){case"int":e.write("int");break;case"string":e.write("string");break;case"bool":e.write("bool");break;case"float":e.write("float");break;case"date":e.addReference(La),e.write("DateTime");break;case"dateTime":e.addReference(La),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!i){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:i}),e.write(">");break;case"map":{if(!i){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:i}),e.write(", "),this.internalType.valueType.write(e,{comment:i}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!i){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");let a=this.internalType.entries.filter(v=>!v.valueType.isOptional()),d=this.internalType.entries.filter(v=>v.valueType.isOptional()),f=[...a,...d];for(let v of f)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:v,comment:i}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((a,d)=>{d>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:a,comment:i})}),e.write("}");break}case"union":{this.writeUnion({writer:e,unionTypes:this.internalType.types,comment:i});break}case"optional":{let a=this.internalType.value.internalType,d=a.type==="mixed",f=a.type==="union";!f&&!d&&e.write("?"),this.internalType.value.write(e,{comment:i}),f&&!this.unionHasOptional(a.types)&&(e.write("|"),e.writeNode(r.null()));break}case"reference":if(i){e.writeNode(this.internalType.value);let a=this.internalType.value.generics;a&&a.length>0&&(e.write("<"),a.forEach((d,f)=>{f>0&&e.write(", "),d.write(e,{comment:i})}),e.write(">"))}else e.writeNode(this.internalType.value);break;case"enumString":i?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;case"literal":if(i)e.writeNode(this.internalType.value);else switch(this.internalType.value.internalType.type){case"string":e.write("string");break;case"boolean":e.write("bool");break;default:O(this.internalType.value.internalType)}break;default:O(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:r.optional(this)}underlyingTypeIfOptional(){if(this.internalType.type==="optional")return this.internalType.value}underlyingType(){return this.underlyingTypeIfOptional()??this}isOptional(){return this.internalType.type==="optional"}getClassReference(){switch(this.internalType.type){case"date":case"dateTime":return new K({name:"DateTime",namespace:""});case"enumString":case"reference":return this.internalType.value;case"int":case"string":case"bool":case"float":case"object":case"map":case"array":case"null":case"mixed":case"optional":case"typeDict":case"union":case"literal":throw new Error("Cannot get class reference for "+this.internalType.type);default:O(this.internalType)}}static int(){return new this({type:"int"})}static string(){return new this({type:"string"})}static bool(){return new this({type:"bool"})}static float(){return new this({type:"float"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static mixed(){return new this({type:"mixed"})}static object(){return new this({type:"object"})}static array(e){return new this({type:"array",value:e})}static map(e,i){return new this({type:"map",keyType:e,valueType:i})}static typeDict(e,{multiline:i}={}){return new this({type:"typeDict",entries:e,multiline:i})}static union(e){let i=this.flattenUnionTypes(e),a=qt(i,jt);return new this({type:"union",types:a})}static flattenUnionTypes(e){let i=[];for(let a of e)a.internalType.type==="union"?i.push(...this.flattenUnionTypes(a.internalType.types)):i.push(a);return i}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static null(){return new this({type:"null"})}static reference(e){return new this({type:"reference",value:e})}static enumString(e){return new this({type:"enumString",value:e})}static literalString(e){return new this({type:"literal",value:ie.string(e)})}static literalBoolean(e){return new this({type:"literal",value:ie.boolean(e)})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeUnion({writer:e,unionTypes:i,comment:a}){let d=this.getUniqueTypes({types:i,comment:a,writer:e}),f=this.unwrapOptionalTypes(d),v=f.filter(T=>T.underlyingType().internalType.type==="mixed").length>0;if(v&&!a){e.write("mixed");return}if(f.length>0&&a){e.writeLine("("),f.forEach((T,E)=>{E>0?e.write(" * |"):e.write(" * "),v&&(T=T.underlyingType()),T.write(e,{comment:a}),e.writeLine(),E++}),e.write(" * )");return}f.forEach((T,E)=>{E>0&&e.write("|"),v&&(T=T.underlyingType()),T.write(e,{comment:a}),E++})}writeTypeDictEntry({writer:e,entry:i,comment:a}){e.write(i.key),i.optional&&e.write("?"),e.write(": "),i.valueType.write(e,{comment:a})}getUniqueTypes({writer:e,types:i,comment:a}){let d=qt(i,jt),f=new Set;return d.filter(v=>{let T=v.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig,comment:a});return f.has(T)?!1:(f.add(T),!0)})}unwrapOptionalTypes(e){let i=!1,a=e.map(d=>d.internalType.type==="optional"?(i=!0,d.internalType.value):d);return i&&a.push(r.null()),a}unionHasOptional(e){return e.filter(i=>i.internalType.type==="optional").length>0}toString({namespace:e,rootNamespace:i,customConfig:a,comment:d}){let f=new pe({namespace:e,rootNamespace:i,customConfig:a});return this.write(f,{comment:d??!1}),f.toString()}},La=new K({namespace:"",name:"DateTime"});s();p();u();function Ba(r){return r.startsWith("$")?r.slice(1):r}var yr="values",Me=class extends S{constructor({name:e,namespace:i,abstract:a,docs:d,parentClassReference:f,traits:v,constructorAccess:T}){super();x(this,"name");x(this,"namespace");x(this,"constructorAccess");x(this,"class_");this.name=e,this.namespace=i,this.constructorAccess=T??"public",this.class_=new ge({name:e,namespace:i,abstract:a,docs:d,parentClassReference:f,traits:v})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let i=Be(this.class_.fields).map(a=>({...a,name:Ba(a.name)}));this.class_.addConstructor({access:this.constructorAccess,parameters:this.getConstructorParameters({orderedFields:i}),body:A.codeblock(a=>{if(i.length>0)for(let d of i)a.write(`$this->${d.name} = $${yr}['${d.name}']`),d.type.isOptional()&&a.write(" ?? null"),a.write(";");else a.writeLine(`unset($${yr});`)})}),this.class_.write(e)}allFieldsAreOptional(){return this.class_.fields.every(e=>e.type.isOptional())}getConstructorParameters({orderedFields:e}){return[new xe({name:yr,type:oe.typeDict(e.map(i=>({key:i.name,valueType:i.type,optional:i.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new J("[]"):void 0})]}};s();p();u();s();p();u();var ve=class extends S{constructor({name:e,access:i,parameters:a,throws:d,return_:f,body:v,docs:T,classReference:E,static_:I}){super();x(this,"name");x(this,"access");x(this,"parameters");x(this,"throws");x(this,"return_");x(this,"body");x(this,"docs");x(this,"classReference");x(this,"static_");this.name=e,this.access=i,this.parameters=a,this.throws=d??[],this.return_=f,this.body=v,this.docs=T,this.classReference=E,this.static_=I??!1}write(e){this.writeComment(e),e.write(`${this.access}${this.static_?" static":""} function ${this.name}(`);let i=this.parameters.filter(f=>!f.type.isOptional()),a=this.parameters.filter(f=>f.type.isOptional());[...i,...a].forEach((f,v)=>{v>0&&e.write(", "),f.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),this.body?.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let i=new X({docs:this.docs});for(let a of this.parameters)i.addTag({tagType:"param",type:a.type,name:a.name,docs:a.docs});this.return_!=null&&this.return_!==Ea&&this.return_!==Ia&&i.addTag({tagType:"return",type:this.return_});for(let a of this.throws)i.addTag({tagType:"throws",type:oe.reference(a)});e.writeNode(i)}};var De=class extends S{constructor({name:e,namespace:i,backing:a,docs:d,serializable:f}){super();x(this,"name");x(this,"namespace");x(this,"backing");x(this,"docs");x(this,"members",[]);x(this,"serializable");this.name=e,this.namespace=i,this.backing=a,this.docs=d,this.serializable=f??!1}addMember(e){this.members.push(e)}write(e){this.writeComment(e),e.write("enum "),e.writeLine(`${this.name}`),this.backing!=null&&e.write(` : ${this.backing}`),this.serializable&&(e.addReference(new K({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let i of this.members){if(e.write(`case ${i.name}`),i.value!=null)if(typeof i.value=="string"){let a=gr(i.value);e.write(` = "${a}"`)}else e.write(` = ${i.value}`);e.writeTextStatement("")}this.serializable&&(e.newLine(),e.writeNode(new ve({name:"jsonSerialize",return_:oe.string(),access:"public",parameters:[],body:new J("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new X({docs:this.docs}).write(e)}};s();p();u();var $e=class extends S{constructor({name:e,type:i,access:a,readonly_:d,initializer:f,docs:v,inlineDocs:T,attributes:E,inherited:I}){super();x(this,"name");x(this,"type");x(this,"access");x(this,"readonly_");x(this,"initializer");x(this,"docs");x(this,"inlineDocs");x(this,"attributes");x(this,"inherited");this.name=Le(e),this.type=i,this.access=a,this.readonly_=d??!1,this.initializer=f,this.docs=v,this.inlineDocs=T,this.attributes=E??[],this.inherited=I??!1}write(e){this.writeComment(e),this.writeAttributesIfPresent(e),e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null&&(e.write(" = "),this.initializer.write(e)),e.write(";"),this.inlineDocs!=null&&e.write(` // ${this.inlineDocs}`),e.newLine()}writeComment(e){let i=new X;i.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),i.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((i,a)=>{a>0&&e.write(", "),i.write(e)}),e.writeLine("]"))}};s();p();u();var je=class extends S{constructor({entries:e,multiline:i}){super();x(this,"entries");x(this,"multiline");this.entries=e??[],this.multiline=i??!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:i,value:a}of this.entries)i.write(e),e.write(" => "),a.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[i,{key:a,value:d}]of this.entries.entries())i>0&&e.write(", "),a.write(e),e.write(" => "),d.write(e);e.write("]")}};s();p();u();var qe=class extends S{constructor({name:e,namespace:i,docs:a,traits:d}){super();x(this,"name");x(this,"namespace");x(this,"docs");x(this,"traits");x(this,"fields",[]);x(this,"methods",[]);this.name=e,this.namespace=i,this.docs=a,this.traits=d??[]}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeComment(e),e.write(`trait ${this.name} `),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((i,a)=>{a>0&&e.write(","),e.writeNode(i)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:Be(this.fields)}),this.fields.length>0&&this.methods.length>0&&e.newLine(),this.writeMethods({writer:e,methods:Be(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){let i=new X({docs:this.docs});for(let a of this.fields)i.addTag({tagType:"property",type:a.type,name:a.name});i.write(e)}writeFields({writer:e,fields:i}){i.forEach((a,d)=>{d>0&&e.newLine(),a.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:i}){i.forEach((a,d)=>{d>0&&e.newLine(),a.write(e),e.writeNewLineIfLastLineNot()})}};s();p();u();var Gt=class extends S{constructor(e){super();x(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),tt({writer:e,arguments_:this.arrays.map(i=>Ve(a=>{if(typeof i=="string"||i instanceof S){a.writeNodeOrString(i);return}a.writeNodeOrString(i.ref),i.fallback&&(a.write(" ?? "),a.writeNodeOrString(i.fallback))}))})}};function cc(r){return new Ue(r)}function dc(r){return new Oe(r)}function mc(r){return new ge(r)}function hc(r){return new qe(r)}function yc(r){return new K(r)}function Ve(r){return new J(r)}function gc(r){return new Me(r)}function xc(r){return new De(r)}function wc(r){return new $e(r)}function Pa(r){return new le(r)}function vc(r){return new we(r)}function bc(r){return Ve(t=>{t.write("throw "),t.writeNode(Pa(r))})}function Tc(r){return new je(r)}function Ac(r){return new ve(r)}function Ec(r){return new xe(r)}function Ic(r){return new lt(r)}function Cc(r,t){return Ve(e=>{e.writeNodeOrString(r),e.write(" = "),e.writeNodeOrString(t)})}function Nc(r){return Ve(Le(r))}function Rc(r){return Ve(`"${r}"`)}function Sc(...r){return new Gt(r)}function gr(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\$/g,"\\$")}function Lc(){return new J(r=>{r.write("$this")})}s();p();u();function xr(r){return Ca.has(r.toLowerCase())?`${r}_`:r}s();p();u();var zt=class{constructor({context:t}){x(this,"context");this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?A.TypeLiteral.null():(this.context.errors.add({severity:_.Critical,message:"Expected non-null value, but got null"}),A.TypeLiteral.nop());if(t.value===void 0)return A.TypeLiteral.nop();switch(t.typeReference.type){case"list":case"set":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let e=this.context.resolveNamedType({typeId:t.typeReference.value});return e==null?A.TypeLiteral.nop():this.convertNamed({named:e,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"unknown":return this.convertUnknown({value:t.value});default:O(t.typeReference)}}convertLiteral({literalType:t,value:e}){switch(t.type){case"boolean":{let i=this.context.getValueAsBoolean({value:e});return i==null?A.TypeLiteral.nop():A.TypeLiteral.boolean(i)}case"string":{let i=this.context.getValueAsString({value:e});return i==null?A.TypeLiteral.nop():A.TypeLiteral.string(i)}default:O(t)}}convertList({list:t,value:e}){return Array.isArray(e)?A.TypeLiteral.list({values:e.map((i,a)=>{this.context.errors.scope({index:a});try{return this.convert({typeReference:t,value:i})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:_.Critical,message:`Expected array but got: ${typeof e}`}),A.TypeLiteral.nop())}convertMap({map:t,value:e}){return typeof e!="object"||e==null?(this.context.errors.add({severity:_.Critical,message:`Expected object but got: ${e==null?"null":typeof e}`}),A.TypeLiteral.nop()):A.TypeLiteral.map({entries: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()}})})}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:O(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:e}){let i=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:e});if(i==null)return A.TypeLiteral.nop();let a=i.singleDiscriminatedUnionType,d=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:i,unionVariant:a});return d==null?A.TypeLiteral.nop():A.TypeLiteral.reference(A.codeblock(f=>{f.writeNode(A.invokeMethod({on:A.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),method:this.context.getMethodName(a.discriminantValue.name),arguments_:this.convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:i,unionVariant:a,unionProperties:d}),static_:!0}))}))}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:e}){switch(e.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:e.typeId});if(i==null)return;let a=this.convertNamed({named:i,value:t.value});if(!a.isClass()){this.context.errors.add({severity:_.Critical,message:"Internal error; expected union value to be an object"});return}return a.asClassOrThrow().fields}case"singleProperty":try{this.context.errors.scope(e.discriminantValue.wireValue);let i=this.context.getRecord(t.value);return i==null?[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:t.value})}]:[{name:this.context.getPropertyName(e.discriminantValue.name),value:this.convert({typeReference:e.typeReference,value:i[e.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return[];default:O(e)}}convertDiscriminatedUnionVariantArgs({discriminatedUnionTypeInstance:t,unionVariant:e,unionProperties:i}){let a=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:e});if(e.type==="singleProperty"&&this.context.getRecord(t.value)==null&&i.length===1)return[...a,this.convert({typeReference:e.typeReference,value:t.value})];if(e.type==="samePropertiesAsObject"){let d=this.context.resolveNamedType({typeId:e.typeId});return d==null?[]:[...a,A.TypeLiteral.class_({reference:A.classReference({name:this.context.getClassName(d.declaration.name),namespace:this.context.getTypesNamespace(d.declaration.fernFilepath)}),fields:i})]}return a}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 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 A.TypeLiteral.class_({reference:A.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)}),fields: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()}})})}convertEnum({enum_:t,value:e}){let i=this.getEnumValueName({enum_:t,value:e});return i==null?A.TypeLiteral.nop():A.TypeLiteral.reference(A.codeblock(a=>{a.writeNode(A.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getTypesNamespace(t.declaration.fernFilepath)})),a.write("::"),a.write(i),a.write("->value")}))}getEnumValueName({enum_:t,value:e}){if(typeof e!="string"){this.context.errors.add({severity:_.Critical,message:`Expected enum value string, got: ${typeof e}`});return}let i=t.values.find(a=>a.wireValue===e);if(i==null){this.context.errors.add({severity:_.Critical,message:`An enum value named "${e}" does not exist in this context`});return}return this.context.getClassName(i.name)}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:e}){let i=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:e});return i??A.TypeLiteral.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:_.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof e}" value`})}convertUnknown({value:t}){return A.TypeLiteral.unknown(t)}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?A.TypeLiteral.nop():A.TypeLiteral.number(a)}case"FLOAT":case"DOUBLE":{let a=this.getValueAsNumber({value:e});return a==null?A.TypeLiteral.nop():A.TypeLiteral.float(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:e,as:i});return a==null?A.TypeLiteral.nop():A.TypeLiteral.boolean(a)}case"DATE":case"DATE_TIME":{let a=this.context.getValueAsString({value:e});return a==null?A.TypeLiteral.nop():A.TypeLiteral.datetime(a)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let a=this.context.getValueAsString({value:e});return a==null?A.TypeLiteral.nop():A.TypeLiteral.string(a)}default:O(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})}};s();p();u();var Ht=class{constructor({context:t}){x(this,"context");this.context=t}getFilePropertyInfo({body:t,value:e}){let i={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(e)??{};for(let d of t.properties)switch(d.type){case"file":i.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getSingleFileProperty({property:d,record:a})});break;case"fileArray":i.fileFields.push({name:this.context.getPropertyName(d.name),value:this.getArrayFileProperty({property:d,record:a})});break;case"bodyProperty":i.bodyPropertyFields.push({name:this.context.getPropertyName(d.name.name),value:this.getBodyProperty({property:d,record:a})});break;default:O(d)}return i}getSingleFileProperty({property:t,record:e}){let i=this.context.getSingleFileValue({property:t,record:e});return i==null?A.TypeLiteral.nop():A.TypeLiteral.file(i)}getArrayFileProperty({property:t,record:e}){let i=this.context.getFileArrayValues({property:t,record:e});return i==null?A.TypeLiteral.nop():A.TypeLiteral.list({values:i.map(a=>A.TypeLiteral.file(a))})}getBodyProperty({property:t,record:e}){let i=e[t.name.wireValue];return i==null?A.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:i})}};var Bc=["use","clone","list"],Pc="Requests",_c="Types",Kt=class r extends ht{constructor({ir:e,config:i}){super({ir:e,config:i});x(this,"ir");x(this,"customConfig");x(this,"dynamicTypeLiteralMapper");x(this,"filePropertyMapper");x(this,"rootNamespace");this.ir=e,this.customConfig=i.customConfig!=null?i.customConfig:void 0,this.dynamicTypeLiteralMapper=new zt({context:this}),this.filePropertyMapper=new Ht({context:this}),this.rootNamespace=Fc({organization:i.organization,namespaceOverride:this.customConfig?.namespace})}clone(){return new r({ir:this.ir,config:this.config})}getParameterName(e){return this.prependUnderscoreIfNeeded(e.camelCase.unsafeName)}getPropertyName(e){return this.prependUnderscoreIfNeeded(e.camelCase.unsafeName)}getMethodName(e){let i=e.camelCase.unsafeName;return Bc.includes(i)?i:e.camelCase.safeName}getClassName(e){return xr(e.pascalCase.safeName)}getRootClientClassName(){return this.customConfig?.clientName!=null?this.customConfig.clientName:this.customConfig?.["client-class-name"]!=null?this.customConfig?.["client-class-name"]:this.getComputedClientName()}getEnvironmentsClassReference(){return A.classReference({name:"Environments",namespace:this.rootNamespace})}getRequestNamespace(e){return this.getNamespace(e,Pc)}getTypesNamespace(e){return this.getNamespace(e,_c)}getNamespace(e,i){let a=e.allParts.map(d=>d.pascalCase.safeName);return a=i!=null?[...a,i]:a,[this.rootNamespace,...a].join("\\")}getEnvironmentClassAccessFromID(e){let i=this.resolveEnvironmentName(e);if(i!=null)return A.codeblock(a=>{a.writeNode(this.getEnvironmentClassReference(i)),a.write("::"),a.write(this.getClassName(i))})}getEnvironmentClassReference(e){return A.classReference({name:"Environments",namespace:this.rootNamespace})}prependUnderscoreIfNeeded(e){return/^[a-zA-Z_]/.test(e)?e:`_${e}`}getComputedClientName(){return`${this.getOrganizationPascalCase()}Client`}getOrganizationPascalCase(){return`${Ze(Pt(this.config.organization))}`}};function Fc({organization:r,namespaceOverride:t}){return t??`${Ze(Pt(r))}`}s();p();u();var _a="$client",Yt="Example",Fa=`<?php
|
|
26
|
+
|
|
27
|
+
`,yt=class{constructor({context:t}){x(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){let i=this.buildCodeBlock({endpoint:t,snippet:e});return Fa+await i.toStringAsync({namespace:Yt,rootNamespace:Yt,customConfig:this.context.customConfig??{}})}generateSnippetSync({endpoint:t,request:e}){let i=this.buildCodeBlock({endpoint:t,snippet:e});return Fa+i.toString({namespace:Yt,rootNamespace:Yt,customConfig:this.context.customConfig??{}})}async generateSnippetAst({endpoint:t,request:e,options:i}){return i?.skipClientInstantiation?this.buildCodeBlockWithoutClient({endpoint:t,snippet:e}):this.buildCodeBlock({endpoint:t,snippet:e})}buildCodeBlock({endpoint:t,snippet:e}){return A.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:t,snippet:e})),i.writeNodeStatement(this.callMethod({endpoint:t,snippet:e}))})}buildCodeBlockWithoutClient({endpoint:t,snippet:e}){return A.codeblock(i=>{i.writeNodeStatement(this.callMethodOnExistingClient({endpoint:t,snippet:e}))})}constructClient({endpoint:t,snippet:e}){return A.codeblock(i=>{i.write(`${_a} = `),i.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:t,snippet:e})))})}callMethod({endpoint:t,snippet:e}){return A.invokeMethod({on:A.codeblock(_a),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}),multiline:!0})}callMethodOnExistingClient({endpoint:t,snippet:e}){let i=this.getMethodArgs({endpoint:t,snippet:e}),a=this.getRequestOptions({endpoint:t,snippet:e});return A.TypeLiteral.isNop(a)||i.push(a),A.invokeMethod({on:A.codeblock("$this->client"),method:this.getMethod({endpoint:t}),arguments_:i,multiline:!0})}getRequestOptions({endpoint:t,snippet:e}){let i=e.headers??{},a=Object.entries(i);if(a.length===0)return A.TypeLiteral.nop();let d=new Set;if(this.context.ir.headers!=null)for(let v of this.context.ir.headers)d.add(v.name.wireValue.toLowerCase());if(t.request.type==="inlined"&&t.request.headers!=null)for(let v of t.request.headers)d.add(v.name.wireValue.toLowerCase());let f=a.filter(([v])=>!d.has(v.toLowerCase()));return f.length===0?A.TypeLiteral.nop():A.TypeLiteral.map({entries:[{key:A.TypeLiteral.string("headers"),value:A.TypeLiteral.map({entries:f.map(([v,T])=>({key:A.TypeLiteral.string(v),value:A.TypeLiteral.string(String(T))}))})}]})}getConstructorArgs({endpoint:t,snippet:e}){let i=[];if(t.auth!=null)if(e.auth!=null)i.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth}));else if(t.auth.type==="inferred"){let T={type:"inferred"};i.push(...this.getConstructorInferredAuthArgs({auth:t.auth,values:T}))}else this.context.errors.add({severity:_.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`});let a=this.context.ir.environments?.environments.type==="multipleBaseUrls",d=this.getConstructorEnvironmentArg({environment:e.environment,hasMultiUrlEnvironments:a}),f=[];if(!a){let T=this.getConstructorBaseUrlArgs({baseUrl:e.baseURL,environment:e.environment});T.length>0&&f.push(...T)}this.context.errors.scope(ue.Headers),this.context.ir.headers!=null&&e.headers!=null&&f.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope();let v=[...i];return d!=null&&v.push(d),f.length>0&&v.push({name:"options",assignment:A.TypeLiteral.map({entries:f.map(T=>({key:A.TypeLiteral.string(T.name),value:T.value}))})}),v}getConstructorAuthArgs({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),[];switch(t.type){case"basic":return e.type==="basic"?this.getConstructorBasicAuthArgs({auth:t,values:e}):[];case"bearer":return e.type==="bearer"?this.getConstructorBearerAuthArgs({auth:t,values:e}):[];case"header":return e.type==="header"?this.getConstructorHeaderAuthArgs({auth:t,values:e}):[];case"oauth":return e.type==="oauth"?this.getConstructorOAuthArgs({auth:t,values:e}):[];case"inferred":return e.type==="inferred"?this.getConstructorInferredAuthArgs({auth:t,values:e}):[];default:O(t)}}addError(t){this.context.errors.add({severity:_.Critical,message:t})}addWarning(t){this.context.errors.add({severity:_.Warning,message:t})}getConstructorBasicAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),assignment:A.TypeLiteral.string(e.username)},{name:this.context.getPropertyName(t.password),assignment:A.TypeLiteral.string(e.password)}]}getConstructorEnvironmentArg({environment:t,hasMultiUrlEnvironments:e}){if(!e)return;let i=this.context.getEnvironmentsClassReference();if(t!=null){if(this.context.isSingleEnvironmentID(t)){let d=this.context.resolveEnvironmentName(t);if(d==null){this.addWarning(`Environment "${t}" was not found`);return}let f=this.context.getClassName(d);return{name:"environment",assignment:A.TypeLiteral.reference(A.codeblock(v=>{v.writeNode(i),v.write("::"),v.write(f),v.write("()")}))}}if(this.context.isMultiEnvironmentValues(t)){let d=this.resolveMultiEnvironmentName(t);if(d==null){this.addWarning("Invalid multi url environment");return}return d.type==="named"?{name:"environment",assignment:A.TypeLiteral.reference(A.codeblock(f=>{f.writeNode(i),f.write("::"),f.write(d.name),f.write("()")}))}:{name:"environment",assignment:A.TypeLiteral.reference(A.codeblock(f=>{f.writeNode(i),f.write("::custom(");let v=Object.entries(d.urls);v.forEach(([T,E],I)=>{f.write(`${T}: '${E}'`),I<v.length-1&&f.write(", ")}),f.write(")")}))}}}let a=this.getDefaultEnvironmentName();if(a!=null)return{name:"environment",assignment:A.TypeLiteral.reference(A.codeblock(d=>{d.writeNode(i),d.write("::"),d.write(a),d.write("()")}))}}getDefaultEnvironmentName(){if(this.context.ir.environments?.environments.type!=="multipleBaseUrls")return;let t=this.context.ir.environments.environments;if(t.type!=="multipleBaseUrls")return;let e=t.environments;if(e.length===0)return;for(let a of e){let d=this.context.getClassName(a.name);if(d==="Production")return d}let i=e[0];if(i!=null)return this.context.getClassName(i.name)}resolveMultiEnvironmentName(t){let e=Object.keys(t);if(e.length===0||!this.context.validateMultiEnvironmentUrlValues(t))return;let i=e[0];if(i==null)return;let a=t[i];if(a==null)return;let d=this.context.resolveEnvironmentName(a);if(d!=null&&e.every(T=>{let E=t[T];return E==null?!1:this.context.resolveEnvironmentName(E)!=null&&E===a}))return{type:"named",name:this.context.getClassName(d)};let f={};for(let v of e){let T=t[v];if(T==null)continue;let E=this.getBaseUrlPropertyName(v);f[E]=T}if(Object.keys(f).length>0)return{type:"custom",urls:f}}getBaseUrlPropertyName(t){if(this.context.ir.environments?.environments.type!=="multipleBaseUrls")return t;let e=this.context.ir.environments.environments;if(e.type!=="multipleBaseUrls")return t;let i=e.baseUrls.find(a=>a.id===t);return i==null?t:i.name.camelCase.safeName}getConstructorBaseUrlArgs({baseUrl:t,environment:e}){let i=this.getBaseUrlArg({baseUrl:t,environment:e});return A.TypeLiteral.isNop(i)?[]:[{name:"baseUrl",value:i}]}getBaseUrlArg({baseUrl:t,environment:e}){if(t!=null&&e!=null)return this.context.errors.add({severity:_.Critical,message:"Cannot specify both baseUrl and environment options"}),A.TypeLiteral.nop();if(t!=null)return A.TypeLiteral.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let i=this.context.getEnvironmentClassAccessFromID(e);return i==null?(this.context.errors.add({severity:_.Warning,message:`Environment ${JSON.stringify(e)} was not found`}),A.TypeLiteral.nop()):A.TypeLiteral.reference(A.codeblock(a=>{a.writeNode(i),a.write("->value")}))}if(this.context.ir.environments?.environments.type==="multipleBaseUrls")return A.TypeLiteral.nop()}return A.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),assignment:A.TypeLiteral.string(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorOAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.clientId),assignment:A.TypeLiteral.string(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),assignment:A.TypeLiteral.string(e.clientSecret)}]}getConstructorInferredAuthArgs({auth:t,values:e}){return[]}getConstructorHeaderArgs({headers:t,values:e}){let i=[];for(let a of t){let d=this.getConstructorHeaderArg({header:a,value:e.value});d!=null&&i.push({name:this.context.getPropertyName(a.name.name),value:d})}return i}getConstructorHeaderArg({header:t,value:e}){let i=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!A.TypeLiteral.isNop(i))return i}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:O(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){let i=[];this.context.errors.scope(ue.PathParameters);let a=[...this.context.ir.pathParameters??[],...t.pathParameters??[]];return a.length>0&&i.push(...this.getPathParameters({namedParameters:a,snippet:e}).map(d=>d.value)),this.context.errors.unscope(),this.context.errors.scope(ue.RequestBody),t.body!=null&&i.push(this.getBodyRequestArg({body:t.body,value:e.requestBody})),this.context.errors.unscope(),i}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:O(t)}}getBytesBodyRequestArg({value:t}){return this.context.errors.add({severity:_.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),A.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:t,snippet:e}){let i=[],a=this.context.customConfig?.inlinePathParameters??!1;this.context.errors.scope(ue.PathParameters);let d=[],f=[...this.context.ir.pathParameters??[],...t.pathParameters??[]];f.length>0&&d.push(...this.getPathParameters({namedParameters:f,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(ue.RequestBody);let v=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})||i.push(...d.map(T=>T.value)),this.context.needsRequestParameter({request:t,inlinePathParameters:a,inlineFileProperties:!0})&&i.push(this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:a})?d:[],filePropertyInfo:v})),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})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:i,filePropertyInfo:a}){this.context.errors.scope(ue.QueryParameters);let f=this.context.associateQueryParametersByWireValue({parameters:t.queryParameters??[],values:e.queryParameters??{}}).map(I=>({name:this.context.getPropertyName(I.name.name),value:this.context.dynamicTypeLiteralMapper.convert(I)}));this.context.errors.unscope(),this.context.errors.scope(ue.Headers);let T=this.context.associateByWireValue({parameters:t.headers??[],values:e.headers??{}}).map(I=>({name:this.context.getPropertyName(I.name.name),value:this.context.dynamicTypeLiteralMapper.convert(I)}));this.context.errors.unscope(),this.context.errors.scope(ue.RequestBody);let E=t.body!=null?this.getInlinedRequestBodyConstructorFields({body:t.body,value:e.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),A.TypeLiteral.class_({reference:A.classReference({name:this.context.getClassName(t.declaration.name),namespace:this.context.getRequestNamespace(t.declaration.fernFilepath)}),fields:[...i,...f,...T,...E]})}getInlinedRequestBodyConstructorFields({body:t,value:e,filePropertyInfo:i}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:i});default:O(t)}}getFileUploadRequestBodyConstructorFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:t,value:e}){return{name:this.context.getPropertyName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeLiteral({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:t.value,value:e});default:O(t)}}getInlinedRequestBodyPropertyConstructorFields({parameters:t,value:e}){let i=[],a=this.context.associateByWireValue({parameters:t,values:this.context.getRecord(e)??{}});for(let d of a)i.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert(d)});return i}getPathParameters({namedParameters:t,snippet:e}){let i=[],a=this.context.associateByWireValue({parameters:t,values:e.pathParameters??{}});for(let d of a)i.push({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert(d)});return i}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getPropertyName(e)).join("->")}->${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getRootClientClassInstantiation(t){return A.instantiateClass({classReference:A.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:t,multiline:!0})}};var wr=class extends ct{constructor({ir:t,config:e}){super(new Kt({ir:t,config:e}))}async generate(t){return super.generate(t)}generateSync(t){return super.generateSync(t)}async generateSnippetAst(t,e){return await super.generateSnippetAst(t,e)}createSnippetGenerator(t){return new yt({context:t})}};export{wr as DynamicSnippetsGenerator,yt as EndpointSnippetGenerator};
|
|
28
|
+
/*! Bundled license information:
|
|
29
|
+
|
|
30
|
+
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|
|
31
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
32
|
+
|
|
33
|
+
lodash-es/lodash.js:
|
|
34
|
+
(**
|
|
35
|
+
* @license
|
|
36
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
37
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
38
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
39
|
+
* Released under MIT license <https://lodash.com/license>
|
|
40
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
41
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
42
|
+
*)
|
|
43
|
+
*/
|
|
44
|
+
//# sourceMappingURL=index.js.map
|