@zuplo/core 6.15.4 → 6.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/customer.cli.minified.js +5 -3
- package/index.minified.js +5 -3
- package/package.json +4 -4
package/customer.cli.minified.js
CHANGED
|
@@ -554,10 +554,12 @@ Segment #${l}
|
|
|
554
554
|
`);let _;for(;(_=KCr.exec(l))!=null;){let h=_[1],S=_[2]||"";S=S.trim();let k=S[0];S=S.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),k==='"'&&(S=S.replace(/\\n/g,`
|
|
555
555
|
`),S=S.replace(/\\r/g,"\r")),s[h]=S}return s}t(YCr,"parse");function XCr(a){let s=DSt(a),l=Gh.configDotenv({path:s});if(!l.parsed){let k=new Error(`MISSING_DATA: Cannot parse ${s} for an unknown reason`);throw k.code="MISSING_DATA",k}let _=wSt(a).split(","),h=_.length,S;for(let k=0;k<h;k++)try{let N=_[k].trim(),B=ekr(l,N);S=Gh.decrypt(B.ciphertext,B.key);break}catch(N){if(k+1>=h)throw N}return Gh.parse(S)}t(XCr,"_parseVault");function QCr(a){console.log(`[dotenv@${oFe}][INFO] ${a}`)}t(QCr,"_log");function ZCr(a){console.log(`[dotenv@${oFe}][WARN] ${a}`)}t(ZCr,"_warn");function fpe(a){console.log(`[dotenv@${oFe}][DEBUG] ${a}`)}t(fpe,"_debug");function wSt(a){return a&&a.DOTENV_KEY&&a.DOTENV_KEY.length>0?a.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}t(wSt,"_dotenvKey");function ekr(a,s){let l;try{l=new URL(s)}catch(N){if(N.code==="ERR_INVALID_URL"){let B=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw B.code="INVALID_DOTENV_KEY",B}throw N}let _=l.password;if(!_){let N=new Error("INVALID_DOTENV_KEY: Missing key part");throw N.code="INVALID_DOTENV_KEY",N}let h=l.searchParams.get("environment");if(!h){let N=new Error("INVALID_DOTENV_KEY: Missing environment part");throw N.code="INVALID_DOTENV_KEY",N}let S=`DOTENV_VAULT_${h.toUpperCase()}`,k=a.parsed[S];if(!k){let N=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${S} in your .env.vault file.`);throw N.code="NOT_FOUND_DOTENV_ENVIRONMENT",N}return{ciphertext:k,key:_}}t(ekr,"_instructions");function DSt(a){let s=null;if(a&&a.path&&a.path.length>0)if(Array.isArray(a.path))for(let l of a.path)sFe.existsSync(l)&&(s=l.endsWith(".vault")?l:`${l}.vault`);else s=a.path.endsWith(".vault")?a.path:`${a.path}.vault`;else s=aFe.resolve(process.cwd(),".env.vault");return sFe.existsSync(s)?s:null}t(DSt,"_vaultPath");function kSt(a){return a[0]==="~"?aFe.join(WCr.homedir(),a.slice(1)):a}t(kSt,"_resolveHome");function tkr(a){QCr("Loading env from encrypted .env.vault");let s=Gh._parseVault(a),l=process.env;return a&&a.processEnv!=null&&(l=a.processEnv),Gh.populate(l,s,a),{parsed:s}}t(tkr,"_configVault");function rkr(a){let s=aFe.resolve(process.cwd(),".env"),l="utf8",_=!!(a&&a.debug);a&&a.encoding?l=a.encoding:_&&fpe("No encoding is specified. UTF-8 is used by default");let h=[s];if(a&&a.path)if(!Array.isArray(a.path))h=[kSt(a.path)];else{h=[];for(let B of a.path)h.push(kSt(B))}let S,k={};for(let B of h)try{let q=Gh.parse(sFe.readFileSync(B,{encoding:l}));Gh.populate(k,q,a)}catch(q){_&&fpe(`Failed to load ${B} ${q.message}`),S=q}let N=process.env;return a&&a.processEnv!=null&&(N=a.processEnv),Gh.populate(N,k,a),S?{parsed:k,error:S}:{parsed:k}}t(rkr,"configDotenv");function nkr(a){if(wSt(a).length===0)return Gh.configDotenv(a);let s=DSt(a);return s?Gh._configVault(a):(ZCr(`You set DOTENV_KEY but you are missing a .env.vault file at ${s}. Did you forget to build it?`),Gh.configDotenv(a))}t(nkr,"config");function ikr(a,s){let l=Buffer.from(s.slice(-64),"hex"),_=Buffer.from(a,"base64"),h=_.subarray(0,12),S=_.subarray(-16);_=_.subarray(12,-16);try{let k=HCr.createDecipheriv("aes-256-gcm",l,h);return k.setAuthTag(S),`${k.update(_)}${k.final()}`}catch(k){let N=k instanceof RangeError,B=k.message==="Invalid key length",q=k.message==="Unsupported state or unable to authenticate data";if(N||B){let le=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw le.code="INVALID_DOTENV_KEY",le}else if(q){let le=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw le.code="DECRYPTION_FAILED",le}else throw k}}t(ikr,"decrypt");function skr(a,s,l={}){let _=!!(l&&l.debug),h=!!(l&&l.override);if(typeof s!="object"){let S=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw S.code="OBJECT_REQUIRED",S}for(let S of Object.keys(s))Object.prototype.hasOwnProperty.call(a,S)?(h===!0&&(a[S]=s[S]),_&&fpe(h===!0?`"${S}" is already defined and WAS overwritten`:`"${S}" is already defined and was NOT overwritten`)):a[S]=s[S]}t(skr,"populate");var Gh={configDotenv:rkr,_configVault:tkr,_parseVault:XCr,config:nkr,decrypt:ikr,parse:YCr,populate:skr};m6.exports.configDotenv=Gh.configDotenv;m6.exports._configVault=Gh._configVault;m6.exports._parseVault=Gh._parseVault;m6.exports.config=Gh.config;m6.exports.decrypt=Gh.decrypt;m6.exports.parse=Gh.parse;m6.exports.populate=Gh.populate;m6.exports=Gh});var FSt=vt((hJr,OSt)=>{OSt.exports=ISt;ISt.sync=okr;var ASt=so("fs");function akr(a,s){var l=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var _=0;_<l.length;_++){var h=l[_].toLowerCase();if(h&&a.substr(-h.length).toLowerCase()===h)return!0}return!1}t(akr,"checkPathExt");function NSt(a,s,l){return!a.isSymbolicLink()&&!a.isFile()?!1:akr(s,l)}t(NSt,"checkStat");function ISt(a,s,l){ASt.stat(a,function(_,h){l(_,_?!1:NSt(h,a,s))})}t(ISt,"isexe");function okr(a,s){return NSt(ASt.statSync(a),a,s)}t(okr,"sync")});var BSt=vt((yJr,jSt)=>{jSt.exports=RSt;RSt.sync=ckr;var LSt=so("fs");function RSt(a,s,l){LSt.stat(a,function(_,h){l(_,_?!1:MSt(h,s))})}t(RSt,"isexe");function ckr(a,s){return MSt(LSt.statSync(a),s)}t(ckr,"sync");function MSt(a,s){return a.isFile()&&lkr(a,s)}t(MSt,"checkStat");function lkr(a,s){var l=a.mode,_=a.uid,h=a.gid,S=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),k=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),N=parseInt("100",8),B=parseInt("010",8),q=parseInt("001",8),le=N|B,oe=l&q||l&B&&h===k||l&N&&_===S||l&le&&S===0;return oe}t(lkr,"checkMode")});var $St=vt((SJr,USt)=>{var bJr=so("fs"),_pe;process.platform==="win32"||global.TESTING_WINDOWS?_pe=FSt():_pe=BSt();USt.exports=cFe;cFe.sync=ukr;function cFe(a,s,l){if(typeof s=="function"&&(l=s,s={}),!l){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(_,h){cFe(a,s||{},function(S,k){S?h(S):_(k)})})}_pe(a,s||{},function(_,h){_&&(_.code==="EACCES"||s&&s.ignoreErrors)&&(_=null,h=!1),l(_,h)})}t(cFe,"isexe");function ukr(a,s){try{return _pe.sync(a,s||{})}catch(l){if(s&&s.ignoreErrors||l.code==="EACCES")return!1;throw l}}t(ukr,"sync")});var GSt=vt((xJr,HSt)=>{var sB=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",JSt=so("path"),fkr=sB?";":":",qSt=$St(),zSt=t(a=>Object.assign(new Error(`not found: ${a}`),{code:"ENOENT"}),"getNotFoundError"),VSt=t((a,s)=>{let l=s.colon||fkr,_=a.match(/\//)||sB&&a.match(/\\/)?[""]:[...sB?[process.cwd()]:[],...(s.path||process.env.PATH||"").split(l)],h=sB?s.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",S=sB?h.split(l):[""];return sB&&a.indexOf(".")!==-1&&S[0]!==""&&S.unshift(""),{pathEnv:_,pathExt:S,pathExtExe:h}},"getPathInfo"),WSt=t((a,s,l)=>{typeof s=="function"&&(l=s,s={}),s||(s={});let{pathEnv:_,pathExt:h,pathExtExe:S}=VSt(a,s),k=[],N=t(q=>new Promise((le,oe)=>{if(q===_.length)return s.all&&k.length?le(k):oe(zSt(a));let re=_[q],We=/^".*"$/.test(re)?re.slice(1,-1):re,Ne=JSt.join(We,a),we=!We&&/^\.[\\\/]/.test(a)?a.slice(0,2)+Ne:Ne;le(B(we,q,0))}),"step"),B=t((q,le,oe)=>new Promise((re,We)=>{if(oe===h.length)return re(N(le+1));let Ne=h[oe];qSt(q+Ne,{pathExt:S},(we,Ot)=>{if(!we&&Ot)if(s.all)k.push(q+Ne);else return re(q+Ne);return re(B(q,le,oe+1))})}),"subStep");return l?N(0).then(q=>l(null,q),l):N(0)},"which"),_kr=t((a,s)=>{s=s||{};let{pathEnv:l,pathExt:_,pathExtExe:h}=VSt(a,s),S=[];for(let k=0;k<l.length;k++){let N=l[k],B=/^".*"$/.test(N)?N.slice(1,-1):N,q=JSt.join(B,a),le=!B&&/^\.[\\\/]/.test(a)?a.slice(0,2)+q:q;for(let oe=0;oe<_.length;oe++){let re=le+_[oe];try{if(qSt.sync(re,{pathExt:h}))if(s.all)S.push(re);else return re}catch{}}}if(s.all&&S.length)return S;if(s.nothrow)return null;throw zSt(a)},"whichSync");HSt.exports=WSt;WSt.sync=_kr});var YSt=vt((CJr,lFe)=>{"use strict";var KSt=t((a={})=>{let s=a.env||process.env;return(a.platform||process.platform)!=="win32"?"PATH":Object.keys(s).reverse().find(_=>_.toUpperCase()==="PATH")||"Path"},"pathKey");lFe.exports=KSt;lFe.exports.default=KSt});var e2t=vt((wJr,ZSt)=>{"use strict";var XSt=so("path"),pkr=GSt(),dkr=YSt();function QSt(a,s){let l=a.options.env||process.env,_=process.cwd(),h=a.options.cwd!=null,S=h&&process.chdir!==void 0&&!process.chdir.disabled;if(S)try{process.chdir(a.options.cwd)}catch{}let k;try{k=pkr.sync(a.command,{path:l[dkr({env:l})],pathExt:s?XSt.delimiter:void 0})}catch{}finally{S&&process.chdir(_)}return k&&(k=XSt.resolve(h?a.options.cwd:"",k)),k}t(QSt,"resolveCommandAttempt");function mkr(a){return QSt(a)||QSt(a,!0)}t(mkr,"resolveCommand");ZSt.exports=mkr});var t2t=vt((PJr,fFe)=>{"use strict";var uFe=/([()\][%!^"`<>&|;, *?])/g;function hkr(a){return a=a.replace(uFe,"^$1"),a}t(hkr,"escapeCommand");function gkr(a,s){return a=`${a}`,a=a.replace(/(\\*)"/g,'$1$1\\"'),a=a.replace(/(\\*)$/,"$1$1"),a=`"${a}"`,a=a.replace(uFe,"^$1"),s&&(a=a.replace(uFe,"^$1")),a}t(gkr,"escapeArgument");fFe.exports.command=hkr;fFe.exports.argument=gkr});var n2t=vt((NJr,r2t)=>{"use strict";r2t.exports=/^#!(.*)/});var s2t=vt((IJr,i2t)=>{"use strict";var ykr=n2t();i2t.exports=(a="")=>{let s=a.match(ykr);if(!s)return null;let[l,_]=s[0].replace(/#! ?/,"").split(" "),h=l.split("/").pop();return h==="env"?_:_?`${h} ${_}`:h}});var o2t=vt((OJr,a2t)=>{"use strict";var _Fe=so("fs"),vkr=s2t();function bkr(a){let l=Buffer.alloc(150),_;try{_=_Fe.openSync(a,"r"),_Fe.readSync(_,l,0,150,0),_Fe.closeSync(_)}catch{}return vkr(l.toString())}t(bkr,"readShebang");a2t.exports=bkr});var f2t=vt((LJr,u2t)=>{"use strict";var Skr=so("path"),c2t=e2t(),l2t=t2t(),Tkr=o2t(),xkr=process.platform==="win32",Ekr=/\.(?:com|exe)$/i,Ckr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function kkr(a){a.file=c2t(a);let s=a.file&&Tkr(a.file);return s?(a.args.unshift(a.file),a.command=s,c2t(a)):a.file}t(kkr,"detectShebang");function wkr(a){if(!xkr)return a;let s=kkr(a),l=!Ekr.test(s);if(a.options.forceShell||l){let _=Ckr.test(s);a.command=Skr.normalize(a.command),a.command=l2t.command(a.command),a.args=a.args.map(S=>l2t.argument(S,_));let h=[a.command].concat(a.args).join(" ");a.args=["/d","/s","/c",`"${h}"`],a.command=process.env.comspec||"cmd.exe",a.options.windowsVerbatimArguments=!0}return a}t(wkr,"parseNonShell");function Dkr(a,s,l){s&&!Array.isArray(s)&&(l=s,s=null),s=s?s.slice(0):[],l=Object.assign({},l);let _={command:a,args:s,options:l,file:void 0,original:{command:a,args:s}};return l.shell?_:wkr(_)}t(Dkr,"parse");u2t.exports=Dkr});var d2t=vt((MJr,p2t)=>{"use strict";var pFe=process.platform==="win32";function dFe(a,s){return Object.assign(new Error(`${s} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${s} ${a.command}`,path:a.command,spawnargs:a.args})}t(dFe,"notFoundError");function Pkr(a,s){if(!pFe)return;let l=a.emit;a.emit=function(_,h){if(_==="exit"){let S=_2t(h,s,"spawn");if(S)return l.call(a,"error",S)}return l.apply(a,arguments)}}t(Pkr,"hookChildProcess");function _2t(a,s){return pFe&&a===1&&!s.file?dFe(s.original,"spawn"):null}t(_2t,"verifyENOENT");function Akr(a,s){return pFe&&a===1&&!s.file?dFe(s.original,"spawnSync"):null}t(Akr,"verifyENOENTSync");p2t.exports={hookChildProcess:Pkr,verifyENOENT:_2t,verifyENOENTSync:Akr,notFoundError:dFe}});var g2t=vt((BJr,aB)=>{"use strict";var m2t=so("child_process"),mFe=f2t(),hFe=d2t();function h2t(a,s,l){let _=mFe(a,s,l),h=m2t.spawn(_.command,_.args,_.options);return hFe.hookChildProcess(h,_),h}t(h2t,"spawn");function Nkr(a,s,l){let _=mFe(a,s,l),h=m2t.spawnSync(_.command,_.args,_.options);return h.error=h.error||hFe.verifyENOENTSync(h.status,_),h}t(Nkr,"spawnSync");aB.exports=h2t;aB.exports.spawn=h2t;aB.exports.sync=Nkr;aB.exports._parse=mFe;aB.exports._enoent=hFe});var w2t=vt((Sqr,gpe)=>{gpe.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&gpe.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&gpe.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var I2t=vt((Tqr,lB)=>{var ad=global.process,D7=t(function(a){return a&&typeof a=="object"&&typeof a.removeListener=="function"&&typeof a.emit=="function"&&typeof a.reallyExit=="function"&&typeof a.listeners=="function"&&typeof a.kill=="function"&&typeof a.pid=="number"&&typeof a.on=="function"},"processOk");D7(ad)?(D2t=so("assert"),oB=w2t(),P2t=/^win/i.test(ad.platform),JK=so("events"),typeof JK!="function"&&(JK=JK.EventEmitter),ad.__signal_exit_emitter__?Kg=ad.__signal_exit_emitter__:(Kg=ad.__signal_exit_emitter__=new JK,Kg.count=0,Kg.emitted={}),Kg.infinite||(Kg.setMaxListeners(1/0),Kg.infinite=!0),lB.exports=function(a,s){if(!D7(global.process))return function(){};D2t.equal(typeof a,"function","a callback must be provided for exit handler"),cB===!1&&TFe();var l="exit";s&&s.alwaysLast&&(l="afterexit");var _=t(function(){Kg.removeListener(l,a),Kg.listeners("exit").length===0&&Kg.listeners("afterexit").length===0&&ype()},"remove");return Kg.on(l,a),_},ype=t(function(){!cB||!D7(global.process)||(cB=!1,oB.forEach(function(s){try{ad.removeListener(s,vpe[s])}catch{}}),ad.emit=bpe,ad.reallyExit=xFe,Kg.count-=1)},"unload"),lB.exports.unload=ype,P7=t(function(s,l,_){Kg.emitted[s]||(Kg.emitted[s]=!0,Kg.emit(s,l,_))},"emit"),vpe={},oB.forEach(function(a){vpe[a]=t(function(){if(D7(global.process)){var l=ad.listeners(a);l.length===Kg.count&&(ype(),P7("exit",null,a),P7("afterexit",null,a),P2t&&a==="SIGHUP"&&(a="SIGINT"),ad.kill(ad.pid,a))}},"listener")}),lB.exports.signals=function(){return oB},cB=!1,TFe=t(function(){cB||!D7(global.process)||(cB=!0,Kg.count+=1,oB=oB.filter(function(s){try{return ad.on(s,vpe[s]),!0}catch{return!1}}),ad.emit=N2t,ad.reallyExit=A2t)},"load"),lB.exports.load=TFe,xFe=ad.reallyExit,A2t=t(function(s){D7(global.process)&&(ad.exitCode=s||0,P7("exit",ad.exitCode,null),P7("afterexit",ad.exitCode,null),xFe.call(ad,ad.exitCode))},"processReallyExit"),bpe=ad.emit,N2t=t(function(s,l){if(s==="exit"&&D7(global.process)){l!==void 0&&(ad.exitCode=l);var _=bpe.apply(this,arguments);return P7("exit",ad.exitCode,null),P7("afterexit",ad.exitCode,null),_}else return bpe.apply(this,arguments)},"processEmit")):lB.exports=function(){return function(){}};var D2t,oB,P2t,JK,Kg,ype,P7,vpe,cB,TFe,xFe,A2t,bpe,N2t});var $2t=vt((Pqr,U2t)=>{"use strict";var{PassThrough:awr}=so("stream");U2t.exports=a=>{a={...a};let{array:s}=a,{encoding:l}=a,_=l==="buffer",h=!1;s?h=!(l||_):l=l||"utf8",_&&(l=null);let S=new awr({objectMode:h});l&&S.setEncoding(l);let k=0,N=[];return S.on("data",B=>{N.push(B),h?k=N.length:k+=B.length}),S.getBufferedValue=()=>s?N:_?Buffer.concat(N,k):N.join(""),S.getBufferedLength=()=>k,S}});var J2t=vt((Aqr,qK)=>{"use strict";var{constants:owr}=so("buffer"),cwr=so("stream"),{promisify:lwr}=so("util"),uwr=$2t(),fwr=lwr(cwr.pipeline),Spe=class extends Error{static{t(this,"MaxBufferError")}constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}};async function EFe(a,s){if(!a)throw new Error("Expected a stream");s={maxBuffer:1/0,...s};let{maxBuffer:l}=s,_=uwr(s);return await new Promise((h,S)=>{let k=t(N=>{N&&_.getBufferedLength()<=owr.MAX_LENGTH&&(N.bufferedData=_.getBufferedValue()),S(N)},"rejectPromise");(async()=>{try{await fwr(a,_),h()}catch(N){k(N)}})(),_.on("data",()=>{_.getBufferedLength()>l&&k(new Spe)})}),_.getBufferedValue()}t(EFe,"getStream");qK.exports=EFe;qK.exports.buffer=(a,s)=>EFe(a,{...s,encoding:"buffer"});qK.exports.array=(a,s)=>EFe(a,{...s,array:!0});qK.exports.MaxBufferError=Spe});var z2t=vt((Iqr,q2t)=>{"use strict";var{PassThrough:_wr}=so("stream");q2t.exports=function(){var a=[],s=new _wr({objectMode:!0});return s.setMaxListeners(0),s.add=l,s.isEmpty=_,s.on("unpipe",h),Array.prototype.slice.call(arguments).forEach(l),s;function l(S){return Array.isArray(S)?(S.forEach(l),this):(a.push(S),S.once("end",h.bind(null,S)),S.once("error",s.emit.bind(s,"error")),S.pipe(s,{end:!1}),this)}t(l,"add");function _(){return a.length==0}t(_,"isEmpty");function h(S){a=a.filter(function(k){return k!==S}),!a.length&&s.readable&&s.end()}t(h,"remove")}});function Goe(a,s){return{...s}}t(Goe,"getBuildFlags");var _O="Good",g6e="Warnings",pO="Failed",y6e="error",Koe="warning",FS=class extends Error{static{t(this,"BuildIssueError")}issue;pluginName;constructor(s,l){super(s.message),this.issue=s,this.pluginName=l}};var Yoe=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});var BR=Object.freeze(["2023-03-14","2024-01-15","2024-03-14","2024-09-02"]);var Oit;(function(a){a[a.IS_STARTING=0]="IS_STARTING",a[a.STARTED=1]="STARTED",a[a.STOPPED=2]="STOPPED",a[a.ERRORED=3]="ERRORED"})(Oit||(Oit={}));var Fit;(function(a){a.CLOUDFLARE="CLOUDFLARE",a.KNATIVE="KNATIVE"})(Fit||(Fit={}));var Xoe;(function(a){a.PRODUCTION="PRODUCTION",a.PREVIEW="PREVIEW",a.WORKING_COPY="WORKING_COPY"})(Xoe||(Xoe={}));var Lit;(function(a){a.FREE_V1="FREE_V1",a.PAY_GO_V1="PAY_GO_V1",a.BUILDER_V1="BUILDER_V1",a.BUSINESS_V1="BUSINESS_V1",a.CUSTOM="CUSTOM",a.EMPLOYEE="EMPLOYEE",a.CUSTOM_TRIAL_V1="CUSTOM_TRIAL_V1"})(Lit||(Lit={}));var Rit;(function(a){a.GITHUB="GITHUB",a.GITLAB="GITLAB",a.BITBUCKET="BITBUCKET"})(Rit||(Rit={}));var Mit;(function(a){a.PROCESSING="PROCESSING",a.SENT="SENT",a.ERROR="ERROR",a.MISCONFIGURED="MISCONFIGURED"})(Mit||(Mit={}));var jit="x-zuplo",Jwr=`${jit}-path`,qwr=`${jit}-route`,UR="x-internal";var{toString:Vwr}=Object.prototype,{propertyIsEnumerable:Wwr}=Object.prototype;function v6e(a){return typeof a=="string"}t(v6e,"isString");function bE(a){return v6e(a)&&a.trim().length>0}t(bE,"isNonWhitespaceString");function Bit(a){return a===!0||a===!1}t(Bit,"isBoolean");function Qoe(a,s=!1){if(Bit(a))return a;if(v6e(a)){if(a.toLowerCase()==="true")return!0;if(a.toLowerCase()==="false")return!1;if(s)throw new TypeError(`Attempted to parse string to boolean, but received ${a} which cannot be parsed.`)}if(s)throw new TypeError(`Expected type of boolean, received type '${typeof a}'`);return!1}t(Qoe,"parseValueToBoolean");import{readFileSync as zSr}from"fs";import Ej,{dirname as VSr}from"path";import{fileURLToPath as WSr}from"url";var I1="config",ZW="schemas",Uit="assets";var Zoe="policies.json",ece="dev-portal.json";var $it="zuplo.jsonc",Jit="zuplo.json";var $R="dist",H4=".zuplo",tce="build.json";var rce="worker.ts";var Wst=Nd(_st(),1),pce=Nd(zst(),1);import{readFile as GYt}from"fs/promises";import KYt from"path";var _ce=` ${pce.default.gray("|")} `;async function Hst(a,s,l){await Promise.all(l.warnings.map(_=>Vst(a,s,_))),await Promise.all(l.errors.map(_=>Vst(a,s,_))),l.status==="Good"?s.info("Build succeeded"):l.status==="Warnings"?s.warn(`
|
|
556
556
|
Build succeeded with warnings`):l.status==="Failed"&&s.error(`
|
|
557
|
-
Failed to build API`)}t(Hst,"outputBuildResult");async function Vst(a,s,l){let _=
|
|
557
|
+
Failed to build API`)}t(Hst,"outputBuildResult");async function Vst(a,s,l){let _=[],h=l.severity==="error"?pce.default.red:pce.default.yellow,S=h(`${l.severity.toUpperCase()}: ${l.message}${l.detail?`
|
|
558
558
|
${_ce}${l.detail.split(`
|
|
559
559
|
`).join(`
|
|
560
|
-
${_ce}`)}`:""}`);_(S);let k=YYt(l.location??void 0);if(k&&_(`${_ce}${h(`The error was found in the file: ${k}`)}`),
|
|
560
|
+
${_ce}`)}`:""}`);_.push(S);let k=YYt(l.location??void 0);if(k&&_.push(`${_ce}${h(`The error was found in the file: ${k}`)}`),l.location&&l.location.column!==0&&l.location.line!==0){let N=KYt.join(a,l.location.file),B=await GYt(N,"utf-8"),q=(0,Wst.codeFrameColumns)(B,{start:{line:l.location.line,column:l.location.column}},{highlightCode:!0,message:l.message,linesAbove:3,linesBelow:3});_.push(_ce),_.push(q)}l.severity==="warning"?s.warn(_.join(`
|
|
561
|
+
`)):s.error(_.join(`
|
|
562
|
+
`))}t(Vst,"logIssue");function YYt(a){if(a&&a.file){let s=a.file;if(a.line)return`${s}:${a.line}`;if(a.column)return`${s}:${a.column}`}}t(YYt,"getFileLocation");var O1=class{static{t(this,"PluginResult")}errors=[];warnings=[];constructor(s){s&&this.errors.push(s)}};async function Gst(a,s){let l=[],_=[],h=new Map;for await(let S of a)try{let k=await S(s,h);if(_.push(...k.errors.map(N=>(N.pluginName===""&&(N.pluginName=S.name),N))),l.push(...k.warnings),k.errors.length>0)break}catch(k){k instanceof FS?_.push({...k.issue,pluginName:k.pluginName??"unknown"}):_.push(k);break}return{errors:_,warnings:l,data:h}}t(Gst,"runPlugins");import{performance as dce,PerformanceObserver as XYt}from"perf_hooks";var M6e=[];async function QYt(a,s){let l=dce.timerify(s),_=new XYt(h=>{let S=h.getEntries()[0];M6e.push({name:a,duration:S.duration}),_.disconnect()});return _.observe({entryTypes:["function"]}),l()}t(QYt,"timeFn");var ZYt={mark:t(a=>{dce.mark(a)},"mark"),measure:t((a,s,l)=>{dce.measure(a,s,l)},"measure"),timeFn:QYt,report:t(()=>{M6e.length>0&&console.table(M6e)},"report"),getDuration:t(a=>{let s=dce.getEntriesByName(a);return s.length===0?0:s[0].duration},"getDuration")},kf=ZYt;var j6e={};Nit(j6e,{UnsafePathError:()=>mce,deleteFile:()=>tXt,deleteFolder:()=>uXt,dirExists:()=>hce,ensureDirectoryExists:()=>sXt,fileExists:()=>eXt,getParentDirFilename:()=>oXt,isNotFileOrDirectory:()=>rXt,listFolderContents:()=>Xst,listFolders:()=>iXt,mkdirForFilePathIfNotExits:()=>Zst,mkdirIfNotExists:()=>Qst,safePath:()=>aXt,tarFolderContent:()=>cXt,untar:()=>lXt});import Kst from"child_process";import Y4 from"fs/promises";import K4 from"path";var Yst=[".git","node_modules",".yarn",".DS_Store"];async function eXt(a){try{return(await Y4.stat(a)).isFile()}catch{return!1}}t(eXt,"fileExists");async function tXt(a,s){return await Y4.rm(a,s)}t(tXt,"deleteFile");async function hce(a){try{return(await Y4.stat(a)).isDirectory()}catch{return!1}}t(hce,"dirExists");async function rXt(a){try{return await Y4.stat(a),!1}catch{return!0}}t(rXt,"isNotFileOrDirectory");function nXt(a,s){let l=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),_=a.match(l);if(!_)return"";let h=a.split(_[0]);return h[1]===""?"":`/${h[1]}`}t(nXt,"getParentDirectory");async function iXt(a){if(!await hce(a))return[];let s=await Y4.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Yst.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(iXt,"listFolders");async function Xst(a,s,l=!0){let _=nXt(a,s),h=await Y4.readdir(a,{withFileTypes:!0}),S=[];for await(let k of h)if(!Yst.includes(k.name)||!l)if(k.isDirectory()){let N=await Xst(K4.join(a,k.name),s,l);S.push(...N)}else S.push(K4.join(_,k.name));return S}t(Xst,"listFolderContents");var Qst=t(async a=>{if(await hce(a))return!0;await Y4.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Zst=t(async a=>{let s=K4.dirname(a);return Qst(s)},"mkdirForFilePathIfNotExits"),sXt=Zst,mce=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function aXt(a){let s=t(l=>{if(!l.startsWith(a))throw new mce("Resolved path is not part of the project.");return l},"ensureSafePath");return{resolve:t((...l)=>s(K4.resolve(...l)),"resolve")}}t(aXt,"safePath");function oXt(a){return`${K4.basename(K4.dirname(a))}/${K4.basename(a)}`}t(oXt,"getParentDirFilename");function cXt(a,s,l,_){let h=K4.join(_,l);return Kst.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${h} ${s}`,{cwd:a}),h}t(cXt,"tarFolderContent");function lXt(a,s,l,_=!1){Kst.execSync(`tar -xf ${s} ${_?"--strip-components=1 ":""}-C ${l}`,{cwd:a})}t(lXt,"untar");async function uXt(a){if(await hce(a))return await Y4.rm(a,{recursive:!0})}t(uXt,"deleteFolder");var yl=j6e;import{parse as fXt}from"jsonc-parser";import{readFile as _Xt}from"fs/promises";import eat from"path";async function gce(a){let s=eat.join(a,$it),l=eat.join(a,Jit),_=!1,h=s;await yl.fileExists(s)?(_=!0,h=s):await yl.fileExists(l)&&(_=!0,h=l);let S,k;if(_){let B=await _Xt(h,"utf-8"),le=fXt(B,[]);if(typeof le!="object")return{status:pO,errors:[{message:"Invalid zuplo.jsonc file.",detail:"The zuplo.jsonc file is not a valid JSON object",pluginName:"buildData",severity:"error"}]};if("version"in le&&le.version!==1)return{status:pO,errors:[{message:"Invalid version set in zuplo.jsonc file.",detail:"version in zuplo.jsonc must be set to 1",pluginName:"buildData",severity:"error"}]};if("compatibilityDate"in le&&BR&&typeof le.compatibilityDate=="string"){if(!BR.includes(le.compatibilityDate)){let oe={message:"Invalid compatibilityDate set in zuplo.jsonc file.",detail:`compatibilityDate was set to ${le.compatibilityDate}. Valid compatibility dates are ${BR.join(", ")}`,pluginName:"buildData",severity:"error"};return{status:pO,errors:[oe]}}S=le.compatibilityDate}k=Goe(S,le.flags)}else k=Goe(void 0,void 0);return{status:_O,config:{version:1,compatibilityDate:S,flags:k}}}t(gce,"getZuploConfig");var F1=class extends Error{static{t(this,"CompilationError")}buildMessages;constructor(s){super("An error occurred during compilation."),this.buildMessages=Array.isArray(s)?s:[s]}toBuildResult(){return{content:"",errors:this.buildMessages}}};var pXt="[",dXt="]",mXt="{",hXt="}",gXt=":",yXt=",",vXt="true",bXt="false",SXt="null",TXt="NaN",xXt="Infinity",U6e='"',sH=new Map([[34,U6e],[92,"\\"],[47,"/"],[98,"\b"],[110,`
|
|
561
563
|
`],[102,"\f"],[114,"\r"],[116," "]]),bce=new Map([...sH,[118,"\v"],[48,"\0"]]),EXt=new Map([[U6e,U6e],["\\","\\"],["/","/"],["\b","b"],[`
|
|
562
564
|
`,"n"],["\f","f"],["\r","r"],[" ","t"]]),gPr=new Map([...EXt,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),vce=new Map([[pXt,"LBracket"],[dXt,"RBracket"],[mXt,"LBrace"],[hXt,"RBrace"],[gXt,"Colon"],[yXt,"Comma"],[vXt,"Boolean"],[bXt,"Boolean"],[SXt,"Null"]]),yce=new Map([...vce,[TXt,"Number"],[xXt,"Number"]]),$6e=new Set([10,13,8232,8233]),JP=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:l,column:_,offset:h}){super(`${s} (${l}:${_})`),this.line=l,this.column=_,this.offset=h}},J6e=class extends JP{static{t(this,"UnexpectedChar")}constructor(s,l){super(`Unexpected character '${String.fromCharCode(s)}' found.`,l)}},q6e=class extends JP{static{t(this,"UnexpectedIdentifier")}constructor(s,l){super(`Unexpected identifier '${s}' found.`,l)}},mO=class extends JP{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},Sce=class extends JP{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},CXt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,kXt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,wXt=13,tat=10,z6e=class{static{t(this,"CharCodeReader")}#r="";#n=1;#e=0;#t=-1;#s=!1;#p=-1;#a=!1;constructor(s){this.#r=s}#_(){this.#a||(this.#e++,this.#t++,this.#p=-1,this.#a=!0)}locate(){return{line:this.#n,column:this.#e,offset:this.#t}}next(){if(this.#t>=this.#r.length-1)return this.#_(),-1;this.#t++;let s=this.#r.charCodeAt(this.#t);return this.#s?(this.#n++,this.#e=1,this.#s=!1):this.#e++,s===wXt?(this.#s=!0,this.peek()===tat&&this.#t++):s===tat&&(this.#s=!0),this.#p=s,s}peek(){return this.#t===this.#r.length-1?-1:this.#r.charCodeAt(this.#t+1)}match(s){return s(this.peek())?(this.next(),!0):!1}current(){return this.#p}},DXt="Infinity",PXt="NaN",AXt=new Set([116,102,110]),V6e=new Set([32,9,10,13]),rat=new Set([...V6e,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),NXt={mode:"json",ranges:!1},IXt=new Set(["true","false","null"]),S_={EOF:0,Number:1,String:2,Boolean:3,Null:4,NaN:5,Infinity:6,Identifier:7,Colon:20,LBrace:21,RBrace:22,LBracket:23,RBracket:24,Comma:25,LineComment:40,BlockComment:41};function $P(a){return a>=48&&a<=57}t($P,"isDigit");function B6e(a){return $P(a)||a>=65&&a<=70||a>=97&&a<=102}t(B6e,"isHexDigit");function OXt(a){return a>=49&&a<=57}t(OXt,"isPositiveDigit");function FXt(a){return AXt.has(a)}t(FXt,"isKeywordStart");function iat(a){return $P(a)||a===46||a===45}t(iat,"isNumberStart");function LXt(a){return iat(a)||a===43}t(LXt,"isJSON5NumberStart");function nat(a,s){return a===34||s&&a===39}t(nat,"isStringStart");function sat(a){if(a===36||a===95||a===92||a>=97&&a<=122||a>=65&&a<=90||a===8204||a===8205)return!0;let s=String.fromCharCode(a);return CXt.test(s)}t(sat,"isJSON5IdentifierStart");function RXt(a){if(sat(a)||$P(a))return!0;let s=String.fromCharCode(a);return kXt.test(s)}t(RXt,"isJSON5IdentifierPart");var W6e=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,l){this.#n=s,this.#r={...NXt,...l},this.#e=new z6e(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?bce.has.bind(bce):sH.has.bind(sH),this.#c=this.#t?$6e.has.bind($6e):()=>!1,this.#l=this.#t?_=>_===120:()=>!1,this.#i=this.#t?rat.has.bind(rat):V6e.has.bind(V6e)}#f(s,l=this.#e.locate()){throw new J6e(s,l)}#v(s,l=this.#e.locate()){throw new q6e(s,l)}#d(){throw new Sce(this.#e.locate())}#u(s,l,_,h){let S=_.offset+l,k=this.#r.ranges?{range:[_.offset,S]}:void 0;return{type:s,loc:{start:_,end:h||{line:_.line,column:_.column+l,offset:S}},...k}}#m(s){let l="",_;for(let h=0;h<s;h++){if(_=this.#e.peek(),B6e(_)){this.#e.next(),l+=String.fromCharCode(_);continue}this.#f(_)}return l}#g(s){let l="";do{if(l+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),l+=String.fromCharCode(s),l+=this.#m(4)),s=this.#e.peek(),!RXt(s))break;this.#e.next()}while(!0);return l}#C(s){let l=s,_=1;for(s=this.#e.peek();s!==-1&&s!==l;){if(this.#e.next(),_++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),_++;else if(s===117){this.#e.next(),_++;let h=this.#m(4);_+=h.length}else if(this.#l(s)){this.#e.next(),_++;let h=this.#m(2);_+=h.length}else this.#t?(this.#e.next(),_++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),_++,_}#x(s){let l=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let _=this.#g(s);return _!==DXt&&_!==PXt&&this.#f(s),l+_.length}$P(s)||this.#f(s),this.#e.next(),l++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),l++,s=this.#e.peek(),B6e(s)||(this.#e.next(),this.#f(s));do this.#e.next(),l++,s=this.#e.peek();while(B6e(s))}else $P(s)&&this.#f(s);else if(!this.#t||s!==46)for(OXt(s)||this.#f(s),s=this.#e.peek();$P(s);)this.#e.next(),l++,s=this.#e.peek();if(s===46){let _=-1;for(this.#e.next(),l++,_++,s=this.#e.peek();$P(s);)this.#e.next(),l++,_++,s=this.#e.peek();!this.#t&&_===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),l++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),l++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),$P(s)||(this.#e.next(),this.#f(s));$P(s);)this.#e.next(),l++,s=this.#e.peek();return l}#b(s){let l=1;if(s=this.#e.peek(),s===47){do this.#e.next(),l+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:l,multiline:!1}}if(s===42){for(this.#e.next(),l+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),l+=1,s=this.#e.peek(),s===47)return this.#e.next(),l+=1,{length:l,multiline:!0}}else this.#e.next(),l+=1;this.#e.next(),this.#d()}this.#e.next(),this.#f(s)}next(){let s=this.#e.next();for(;this.#i(s);)s=this.#e.next();if(s===-1)return S_.EOF;let l=this.#e.locate(),_=String.fromCharCode(s);if(this.#t)if(yce.has(_))this.#a=this.#u(yce.get(_),1,l);else if(sat(s)){let h=this.#g(s);yce.has(h)?this.#a=this.#u(yce.get(h),h.length,l):this.#a=this.#u("Identifier",h.length,l)}else if(LXt(s)){let h=this.#x(s);this.#a=this.#u("Number",h,l)}else if(nat(s,this.#t)){let h=this.#C(s),S=this.#e.locate();this.#a=this.#u("String",h,l,{line:S.line,column:S.column+1,offset:S.offset+1})}else if(s===47&&this.#s){let h=this.#b(s),S=this.#e.locate();this.#a=this.#u(h.multiline?"BlockComment":"LineComment",h.length,l,{line:S.line,column:S.column+1,offset:S.offset+1})}else this.#f(s);else if(vce.has(_))this.#a=this.#u(vce.get(_),1,l);else if(FXt(s)){let h=this.#g(s);IXt.has(h)||this.#v(h,l),this.#a=this.#u(vce.get(h),h.length,l)}else if(iat(s)){let h=this.#x(s);this.#a=this.#u("Number",h,l)}else if(nat(s,this.#t)){let h=this.#C(s);this.#a=this.#u("String",h,l)}else if(s===47&&this.#s){let h=this.#b(s),S=this.#e.locate();this.#a=this.#u(h.multiline?"BlockComment":"LineComment",h.length,l,{line:S.line,column:S.column+1,offset:S.offset+1})}else this.#f(s);return S_[this.#a.type]}get token(){return this.#a}};var dT={document(a,s={}){return{type:"Document",body:a,loc:s.loc,...s}},string(a,s={}){return{type:"String",value:a,loc:s.loc,...s}},number(a,s={}){return{type:"Number",value:a,loc:s.loc,...s}},boolean(a,s={}){return{type:"Boolean",value:a,loc:s.loc,...s}},null(a={}){return{type:"Null",loc:a.loc,...a}},array(a,s={}){return{type:"Array",elements:a,loc:s.loc,...s}},element(a,s={}){return{type:"Element",value:a,loc:s.loc,...s}},object(a,s={}){return{type:"Object",members:a,loc:s.loc,...s}},member(a,s,l={}){return{type:"Member",name:a,value:s,loc:l.loc,...l}},identifier(a,s={}){return{type:"Identifier",name:a,loc:s.loc,...s}},nan(a="",s={}){return{type:"NaN",sign:a,loc:s.loc,...s}},infinity(a="",s={}){return{type:"Infinity",sign:a,loc:s.loc,...s}}},MXt={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function jXt(a,s,l=!1){let _="",h=a.indexOf("\\"),S=0;for(;h>=0;){_+=a.slice(S,h);let k=a.charAt(h+1),N=k.charCodeAt(0);if(l&&bce.has(N))_+=bce.get(N),S=h+2;else if(sH.has(N))_+=sH.get(N),S=h+2;else if(k==="u"){let B=a.slice(h+2,h+6);if(B.length<4||/[^0-9a-f]/i.test(B))throw new JP(`Invalid unicode escape \\u${B}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});_+=String.fromCharCode(parseInt(B,16)),S=h+6}else if(l&&k==="x"){let B=a.slice(h+2,h+4);if(B.length<2||/[^0-9a-f]/i.test(B))throw new JP(`Invalid hex escape \\x${B}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});_+=String.fromCharCode(parseInt(B,16)),S=h+4}else if(l&&$6e.has(N))S=h+2,k==="\r"&&a.charAt(S)===`
|
|
563
565
|
`&&S++;else if(l)_+=k,S=h+2;else throw new JP(`Invalid escape \\${k}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});h=a.indexOf("\\",S)}return _+=a.slice(S),_}t(jXt,"getStringValue");function BXt(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return jXt(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(BXt,"getLiteralValue");function aat(a,s){s=Object.freeze({...MXt,...s});let l=[],_=new W6e(a,{mode:s.mode,ranges:s.ranges}),h=s.mode==="json5",S=s.allowTrailingCommas||h;function k(){let pr=_.next();return pr&&s.tokens&&l.push(_.token),pr}t(k,"nextNoComments");function N(){let pr=_.next();return pr&&s.tokens&&l.push(_.token),pr>=S_.LineComment?N():pr}t(N,"nextSkipComments");let B=s.mode==="json"?k:N;function q(pr,_r){if(pr!==_r)throw new mO(_.token)}t(q,"assertTokenType");function le(pr,_r){if(!_r.includes(pr))throw new mO(_.token)}t(le,"assertTokenTypes");function oe(pr,_r){return s.ranges?{range:[pr.offset,_r.offset]}:void 0}t(oe,"createRange");function re(pr){let _r=_.token,ks=oe(_r.loc.start,_r.loc.end),Ci=BXt(a.slice(_r.loc.start.offset,_r.loc.end.offset),_r,h),Ti={loc:{start:{..._r.loc.start},end:{..._r.loc.end}},...ks};switch(pr){case S_.String:return dT.string(Ci,Ti);case S_.Number:return dT.number(Ci,Ti);case S_.Boolean:return dT.boolean(Ci,Ti);default:throw new TypeError(`Unknown token type ${_r.type}.`)}}t(re,"createLiteralNode");function We(pr){let _r=oe(pr.loc.start,pr.loc.end),ks=a.slice(pr.loc.start.offset,pr.loc.end.offset),Po={loc:{start:{...pr.loc.start},end:{...pr.loc.end}},..._r};if(pr.type!=="Identifier"){let Ti="";return(ks[0]==="+"||ks[0]==="-")&&(Ti=ks[0]),dT[ks.includes("NaN")?"nan":"infinity"](Ti,Po)}return dT.identifier(ks,Po)}t(We,"createJSON5IdentifierNode");function Ne(pr){let _r=oe(pr.loc.start,pr.loc.end);return dT.null({loc:{start:{...pr.loc.start},end:{...pr.loc.end}},..._r})}t(Ne,"createNullNode");function we(pr){h?le(pr,[S_.String,S_.Identifier,S_.Number]):q(pr,S_.String);let _r=_.token,ks=pr===S_.String?re(pr):We(_r);if(h&&(ks.type==="NaN"||ks.type==="Infinity")){if(ks.sign!=="")throw new mO(_.token);ks=dT.identifier(ks.type,{loc:ks.loc,...oe(ks.loc.start,ks.loc.end)})}pr=B(),q(pr,S_.Colon);let Ci=br(),Po=oe(ks.loc.start,Ci.loc.end);return dT.member(ks,Ci,{loc:{start:{...ks.loc.start},end:{...Ci.loc.end}},...Po})}t(we,"parseProperty");function Ot(pr){q(pr,S_.LBrace);let _r=_.token,ks=[],Ci=B();if(Ci!==S_.RBrace)do{if(ks.push(we(Ci)),Ci=B(),!Ci)throw new Sce(ks[ks.length-1].loc.end);if(Ci===S_.Comma){if(Ci=B(),S&&Ci===S_.RBrace)break}else break}while(Ci);q(Ci,S_.RBrace);let Po=_.token,Ti=oe(_r.loc.start,Po.loc.end);return dT.object(ks,{loc:{start:{..._r.loc.start},end:{...Po.loc.end}},...Ti})}t(Ot,"parseObject");function wt(pr){q(pr,S_.LBracket);let _r=_.token,ks=[],Ci=B();if(Ci!==S_.RBracket)do{let up=br(Ci);if(ks.push(dT.element(up,{loc:up.loc})),Ci=B(),Ci===S_.Comma){if(Ci=B(),S&&Ci===S_.RBracket)break}else break}while(Ci);q(Ci,S_.RBracket);let Po=_.token,Ti=oe(_r.loc.start,Po.loc.end);return dT.array(ks,{loc:{start:{..._r.loc.start},end:{...Po.loc.end}},...Ti})}t(wt,"parseArray");function br(pr){pr=pr??B();let _r=_.token;switch(pr){case S_.String:case S_.Boolean:return re(pr);case S_.Number:if(h){let ks=a.slice(_r.loc.start.offset,_r.loc.end.offset);if((ks[0]==="+"||ks[0]==="-")&&(ks=ks.slice(1)),ks==="NaN"||ks==="Infinity")return We(_r)}return re(pr);case S_.Null:return Ne(_r);case S_.LBrace:return Ot(pr);case S_.LBracket:return wt(pr);default:throw new mO(_r)}}t(br,"parseValue");let Kr=br();if(B())throw new mO(_.token);let hn={loc:{start:{line:1,column:1,offset:0},end:{...Kr.loc.end}}};return s.tokens&&(hn.tokens=l),s.ranges&&(hn.range=[hn.loc.start.offset,hn.loc.end.offset]),dT.document(Kr,hn)}t(aat,"parse");var UXt=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function oat(a){return a&&typeof a=="object"}t(oat,"isObject");function $Xt(a){return oat(a)&&typeof a.type=="string"}t($Xt,"isNode");function JXt(a,s){function l(_,h){typeof s.enter=="function"&&s.enter(_,h);for(let S of UXt.get(_.type)){let k=_[S];oat(k)&&(Array.isArray(k)?k.forEach(N=>l(N,_)):$Xt(k)&&l(k,_))}typeof s.exit=="function"&&s.exit(_,h)}t(l,"visitNode"),l(a)}t(JXt,"traverse");function cat(a,s=()=>!0){let l=[];return JXt(a,{enter(_,h){l.push({node:_,parent:h,phase:"enter"})},exit(_,h){l.push({node:_,parent:h,phase:"exit"})}}),l.filter(s).values()}t(cat,"iterator");import qXt from"fs/promises";var aH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Tce=t(async a=>{try{return await qXt.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),oH=t(async a=>{try{return aat(a)}catch(s){if(s.column&&s.line&&s.message){let l=aH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var lat=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let h=await Tce(_),S=await zXt(h,_,s,l);if(S)return S}}catch{}},"getRouteLocationByValue"),zXt=t(async(a,s,l,_)=>{try{if(!a)return;let h=null,S=await oH(a);if(S){for(let{node:k}of cat(S))if(k.value&&k.value===l){h=k.loc;break}if(h!==null){let k=aH(a,h.start.line);return{file:s,line:h.start.line,column:h.start.column,length:h.end.column-h.start.column,lineText:k,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import uat from"fs/promises";import xce from"path";var H6e="schemas",G6e=".oas.json";var hO=t(async a=>(await uat.readdir(a)).map(l=>`${a}/${l}`).filter(l=>l.endsWith(G6e)).sort(),"getOpenApiFilesByAlphabetical"),WR=t(async a=>{let s=xce.resolve(a,"config");return(await uat.readdir(s)).filter(_=>_.endsWith(G6e)).length>=1},"oasFileInProject");function cH(a,s,l,_,h,S,k){if(S.has(l))return;let N=_.get(l);S.set(l,h.length),h.push(l),K6e(Y6e(l),s,N,_,h,S,k)}t(cH,"chaseRefs");function K6e(a,s,l,_,h,S,k){if(Array.isArray(l))for(let N of l)K6e(a,s,N,_,h,S,k);else if(typeof l=="object")for(let N in l){if(N==="$ref"){let B=l[N];k&&(l[N]=k(s,B)),cH(a,s,X4(a,B),_,h,S,k)}K6e(a,s,l[N],_,h,S,k)}}t(K6e,"lookForRefs");function X4(a,s){let l=s.indexOf("#");return l>=0?`${xce.resolve(a,s.substring(0,l))}${s.substring(l)}`:xce.resolve(xce.dirname(a),s)}t(X4,"getFullyQualifiedRefName");function Y6e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(Y6e,"getFilePathNameFromRefName");var CH=Nd(f4e(),1);var yT=Nd(f4e(),1);import{readFile as Drr}from"fs/promises";var CO=class extends Error{static{t(this,"CustomResolveError")}},iN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,l){this.sourceDirectory=s,this.logger=l}dereference(s,l){return CH.$RefParser.dereference(s,{resolve:{json:!0,file:Yce(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:l?.onDereference}})}bundle(s){return CH.$RefParser.bundle(s,{resolve:{file:Yce(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return CH.$RefParser.parse(s,{resolve:{file:Yce(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return CH.$RefParser.resolve(s,{resolve:{file:Yce(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Yce(a,s){return{order:100,canRead(l){let _=Nrr(l.url);if(!(_===void 0||_==="file"))return!1;let S;try{S=Rct(l.url)}catch(k){throw new CO(`Malformed URI: ${l.url}`,{cause:k})}try{yl.safePath(a).resolve(S)}catch(k){return s?.warn(k),!1}return!0},async read(l){let _;try{_=Rct(l.url)}catch(h){throw new CO(`Malformed URI: ${l.url}`,{cause:h})}try{return await Drr(_)}catch(h){throw new CO(`Error opening file "${_}"`,{cause:h})}}}}t(Yce,"customResolver");var _4e=/^win/.test(globalThis.process?globalThis.process.platform:""),Prr=/\//g,Arr=/^(\w{2,}):\/\//i,p4e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function Nrr(a){let s=Arr.exec(a);if(s)return s[1].toLowerCase()}t(Nrr,"getProtocol");function Rct(a,s){a=decodeURI(a);for(let _=0;_<p4e.length;_+=2)a=a.replace(p4e[_],p4e[_+1]);let l=a.substr(0,7).toLowerCase()==="file://";return l&&(a=a[7]==="/"?a.substr(8):a.substr(7),_4e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(l=!1,a=_4e?a:"/"+a)),_4e&&!l&&(a=a.replace(Prr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(Rct,"toFileSystemPath");var Mct="YOUR_KEY_HERE";async function jct(a){let l=await new iN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),_=a.openApiDocPath.replace(a.sourceDirectory,"");return Irr({...a,relativeOpenApiPath:_},l)}t(jct,"buildPublicOpenApiFile");async function Irr(a,s){Rrr({relativeOpenApiPath:a.relativeOpenApiPath},s);let l=s;return l=Frr(l),Orr(l,a),l=Lrr(l,a),Bct(l,"x-zuplo"),l}t(Irr,"buildRawOpenApiFile");function Orr(a,{customDomain:s,deploymentName:l,environmentType:_}){let h;s?h=s:_&&l&&(h=_===Xoe.WORKING_COPY?`${l}.d2.zuplo.dev`:`${l}.zuplo.app`),h?a.servers=[{url:`https://${h}`}]:a.servers=void 0}t(Orr,"addServerHost");function Frr(a){if(!a.paths)return a;let{components:s}=a,l=s?{...s}:void 0,_=[];l&&l.parameters&&(_=Object.entries(l.parameters).reduce((S,[k,N])=>(UR in N&&Qoe(N[UR])&&(S.push(k),l.parameters&&delete l.parameters[k]),S),[]));let h=Object.entries(a.paths).reduce((S,[k,N])=>{if(!N)return S;let B={...N},q=["delete","get","head","patch","post","put","trace","options"];return q.forEach(le=>{let oe=N[le];if(!oe)return;if(Qoe(oe[UR])){delete B[le];return}let{parameters:re}=oe;if(!re)return;let We=re.filter(Ne=>{if(UR in Ne&&Qoe(Ne[UR]))return!1;if("$ref"in Ne){let we=Ne.$ref.split("/").pop();return we?!_.includes(we):!0}return!0});B[le]={...oe,parameters:We}}),q.some(le=>!!B[le])&&(S[k]=B),S},{});return{...a,paths:h,components:l}}t(Frr,"removeHiddenRoutesAndParams");function Lrr(a,{policiesConfig:s}){if(!a.paths)return a;let l=Object.entries(a.paths).reduce((_,[h,S])=>{if(!S)return _;let k={...S};return[k.delete,k.get,k.head,k.patch,k.post,k.put,k.trace,k.options].forEach(N=>{if(!N)return;let B=N["x-zuplo-route"]?.policies?.inbound?.reduce((oe,re)=>{let We=s.policies?.find(({name:Ot})=>Ot===re);if(!We)return oe;if(!(We.handler.export==="CompositeInboundPolicy"))return oe.concat(re);let we=We.handler.options?.policies;return we?oe.concat(we):oe},[]),q=[];if(B&&B.forEach(oe=>{s.policies?.forEach(re=>{re.name===oe&&(re.handler.export==="ApiAuthKeyInboundPolicy"||re.handler.export==="ApiKeyInboundPolicy")&&!re.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&q.push(re)})}),q.length>0){let oe=q.length>0&&q[0].handler&&q[0].handler.options&&q[0].handler.options.authHeader?q[0].handler.options.authHeader:"Authorization",re=q.length>0&&q[0].handler&&q[0].handler.options&&(q[0].handler.options.authScheme||q[0].handler.options.authScheme==="")?q[0].handler.options.authScheme:"Bearer",We=re!==""?`${re} ${Mct}`:Mct,Ne={name:oe,in:"header",required:!0,example:We,schema:{type:"string"},description:`The \`${oe}\` header is used to authenticate with the API using your API key. Value is of the format \`${We}\`.`};N.parameters?N.parameters.some(br=>"name"in br&&br.name===Ne.name)||N.parameters.unshift(Ne):N.parameters=[Ne];let we={type:"http",scheme:re.toLowerCase()},Ot="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(br=>"name"in br&&br.type==="apiKey"||"type"in br&&br.type==="http"&&br.scheme===re)||(a.components.securitySchemes={...a.components.securitySchemes,[Ot]:we}):(a.components||(a.components={}),a.components.securitySchemes={[Ot]:we});let wt={[Ot]:[]};N.security?N.security.some(br=>br[Ot]!==void 0)||N.security.unshift(wt):N.security=[wt]}let le=[];if(B&&B.forEach(oe=>{s.policies?.forEach(re=>{re.name===oe&&(re.handler.export==="RateLimitInboundPolicy"||re.handler.export==="ComplexRateLimitInboundPolicy")&&le.push(re)})}),le.length>0){let oe={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},re={...oe,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:oe,RateLimitWithRetryAfter:re},N.responses||(N.responses={});let We=le.some(Ne=>Ne.handler.options?.headerMode!=="none");N.responses[429]||(N.responses[429]={$ref:We?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),_[h]=k,_},{});return{...a,paths:l}}t(Lrr,"enrichSpecWithZuploData");function Bct(a,s){for(let l in a)l.startsWith(s)?delete a[l]:typeof a[l]=="object"&&Bct(a[l],s)}t(Bct,"removePropertiesByPrefix");function Rrr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new FS({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new FS({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new FS({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(Rrr,"assertIsZuploOpenApiSpec");function Mrr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let q=0;q<s.length;q++)s[q]=255;for(let q=0;q<a.length;q++){let le=a.charAt(q),oe=le.charCodeAt(0);if(s[oe]!==255)throw new TypeError(le+" is ambiguous");s[oe]=q}let l=a.length,_=a.charAt(0),h=Math.log(l)/Math.log(256),S=Math.log(256)/Math.log(l);function k(q){if(q instanceof Uint8Array||(ArrayBuffer.isView(q)?q=new Uint8Array(q.buffer,q.byteOffset,q.byteLength):Array.isArray(q)&&(q=Uint8Array.from(q))),!(q instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(q.length===0)return"";let le=0,oe=0,re=0,We=q.length;for(;re!==We&&q[re]===0;)re++,le++;let Ne=(We-re)*S+1>>>0,we=new Uint8Array(Ne);for(;re!==We;){let br=q[re],Kr=0;for(let ln=Ne-1;(br!==0||Kr<oe)&&ln!==-1;ln--,Kr++)br+=256*we[ln]>>>0,we[ln]=br%l>>>0,br=br/l>>>0;if(br!==0)throw new Error("Non-zero carry");oe=Kr,re++}let Ot=Ne-oe;for(;Ot!==Ne&&we[Ot]===0;)Ot++;let wt=_.repeat(le);for(;Ot<Ne;++Ot)wt+=a.charAt(we[Ot]);return wt}t(k,"encode");function N(q){if(typeof q!="string")throw new TypeError("Expected String");if(q.length===0)return new Uint8Array;let le=0,oe=0,re=0;for(;q[le]===_;)oe++,le++;let We=(q.length-le)*h+1>>>0,Ne=new Uint8Array(We);for(;q[le];){let br=s[q.charCodeAt(le)];if(br===255)return;let Kr=0;for(let ln=We-1;(br!==0||Kr<re)&&ln!==-1;ln--,Kr++)br+=l*Ne[ln]>>>0,Ne[ln]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");re=Kr,le++}let we=We-re;for(;we!==We&&Ne[we]===0;)we++;let Ot=new Uint8Array(oe+(We-we)),wt=oe;for(;we!==We;)Ot[wt++]=Ne[we++];return Ot}t(N,"decodeUnsafe");function B(q){let le=N(q);if(le)return le;throw new Error("Non-base"+l+" character")}return t(B,"decode"),{encode:k,decodeUnsafe:N,decode:B}}t(Mrr,"base");var Uct=Mrr;var jrr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Xce=Uct(jrr);var d4e="2024-09-02",$ct=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function Jct(){return new vT({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:d4e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:$ct[d4e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(Jct,"getMockEnvironment");var vT=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=Jct()),this.#r}constructor({build:s,runtime:l}){let _;try{if(l.__ZUPLO_CONFIG){let h=atob(l.__ZUPLO_CONFIG);_=JSON.parse(h)}if(l.ZUPLO_SYSTEM_CONFIGURATIONS){let h=new TextDecoder().decode(Xce.decode(l.ZUPLO_SYSTEM_CONFIGURATIONS)),S=JSON.parse(h);for(let k of Object.keys(S))l[k]=S[k]}}catch(h){console.error("Failed to parse runtime configuration",h)}this.config=_??{},this.build=s,this.runtime=l,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var Brr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function qct(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!Brr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(qct,"isRestrictedEnvVariableName");function zct(a){return!!a.startsWith("ZUPLO_")}t(zct,"isZuploReadableEnvVariableName");var ZAr=new Proxy({},{get(a,s){let l=String(s);switch(l){case"ZUPLO_ENVIRONMENT_TYPE":return vT.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return vT.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return vT.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return vT.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return vT.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return vT.instance.build.BUILD_ID}if(!(qct(l)&&!zct(l)))return vT.instance.runtime[l]}});function kH(a,s,l){return`_${HP(`${a}_${s}_${l}`)}`}t(kH,"getRawOperationDataIdentifierName");function m4e(a,s,l,_){return`_${HP(a.toLowerCase())}_${s.toLowerCase()}_${l.toLowerCase()}_${_.toLowerCase()}`}t(m4e,"getIdForParameterSchema");function h4e(a,s,l){return`_${HP(a.toLowerCase())}_${s.toLowerCase()}_rb_${HP(l.toLowerCase())}`}t(h4e,"getIdForRequestBodySchema");function wH(a,s){return`_${HP(a)}_${HP(s)}`}t(wH,"getIdForRefSchema");function HP(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(HP,"sanitizedIdentifierName");var Tdt=Nd(Fut(),1);import xue from"path";var qH=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,l,_,h,S){this.type=a,this.name=s,this.prefix=l,this.value=_,this.suffix=h,this.modifier=S}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Nsr=/[$_\p{ID_Start}]/u,Isr=/[$_\u200C\u200D\p{ID_Continue}]/u,uNe=".*";function Osr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(Osr,"Re");function Mut(a,s=!1){let l=[],_=0;for(;_<a.length;){let h=a[_],S=t(function(k){if(!s)throw new TypeError(k);l.push({type:"INVALID_CHAR",index:_,value:a[_++]})},"c");if(h==="*"){l.push({type:"ASTERISK",index:_,value:a[_++]});continue}if(h==="+"||h==="?"){l.push({type:"OTHER_MODIFIER",index:_,value:a[_++]});continue}if(h==="\\"){l.push({type:"ESCAPED_CHAR",index:_++,value:a[_++]});continue}if(h==="{"){l.push({type:"OPEN",index:_,value:a[_++]});continue}if(h==="}"){l.push({type:"CLOSE",index:_,value:a[_++]});continue}if(h===":"){let k="",N=_+1;for(;N<a.length;){let B=a.substr(N,1);if(N===_+1&&Nsr.test(B)||N!==_+1&&Isr.test(B)){k+=a[N++];continue}break}if(!k){S(`Missing parameter name at ${_}`);continue}l.push({type:"NAME",index:_,value:k}),_=N;continue}if(h==="("){let k=1,N="",B=_+1,q=!1;if(a[B]==="?"){S(`Pattern cannot start with "?" at ${B}`);continue}for(;B<a.length;){if(!Osr(a[B],!1)){S(`Invalid character '${a[B]}' at ${B}.`),q=!0;break}if(a[B]==="\\"){N+=a[B++]+a[B++];continue}if(a[B]===")"){if(k--,k===0){B++;break}}else if(a[B]==="("&&(k++,a[B+1]!=="?")){S(`Capturing groups are not allowed at ${B}`),q=!0;break}N+=a[B++]}if(q)continue;if(k){S(`Unbalanced pattern at ${_}`);continue}if(!N){S(`Missing pattern at ${_}`);continue}l.push({type:"REGEX",index:_,value:N}),_=B;continue}l.push({type:"CHAR",index:_,value:a[_++]})}return l.push({type:"END",index:_,value:""}),l}t(Mut,"v");function jut(a,s={}){let l=Mut(a);s.delimiter??="/#?",s.prefixes??="./";let _=`[^${xT(s.delimiter)}]+?`,h=[],S=0,k=0,N="",B=new Set,q=t(Kr=>{if(k<l.length&&l[k].type===Kr)return l[k++].value},"a"),le=t(()=>q("OTHER_MODIFIER")??q("ASTERISK"),"f"),oe=t(Kr=>{let ln=q(Kr);if(ln!==void 0)return ln;let{type:hn,index:pr}=l[k];throw new TypeError(`Unexpected ${hn} at ${pr}, expected ${Kr}`)},"d"),re=t(()=>{let Kr="",ln;for(;ln=q("CHAR")??q("ESCAPED_CHAR");)Kr+=ln;return Kr},"T"),We=t(Kr=>Kr,"Se"),Ne=s.encodePart||We,we="",Ot=t(Kr=>{we+=Kr},"U"),wt=t(()=>{we.length&&(h.push(new qH(3,"","",Ne(we),"",3)),we="")},"$"),br=t((Kr,ln,hn,pr,_r)=>{let ks=3;switch(_r){case"?":ks=1;break;case"*":ks=0;break;case"+":ks=2;break}if(!ln&&!hn&&ks===3){Ot(Kr);return}if(wt(),!ln&&!hn){if(!Kr)return;h.push(new qH(3,"","",Ne(Kr),"",ks));return}let Ci;hn?hn==="*"?Ci=uNe:Ci=hn:Ci=_;let Po=2;Ci===_?(Po=1,Ci=""):Ci===uNe&&(Po=0,Ci="");let Ti;if(ln?Ti=ln:hn&&(Ti=S++),B.has(Ti))throw new TypeError(`Duplicate name '${Ti}'.`);B.add(Ti),h.push(new qH(Po,Ti,Ne(Kr),Ci,Ne(pr),ks))},"V");for(;k<l.length;){let Kr=q("CHAR"),ln=q("NAME"),hn=q("REGEX");if(!ln&&!hn&&(hn=q("ASTERISK")),ln||hn){let _r=Kr??"";s.prefixes.indexOf(_r)===-1&&(Ot(_r),_r=""),wt();let ks=le();br(_r,ln,hn,"",ks);continue}let pr=Kr??q("ESCAPED_CHAR");if(pr){Ot(pr);continue}if(q("OPEN")){let _r=re(),ks=q("NAME"),Ci=q("REGEX");!ks&&!Ci&&(Ci=q("ASTERISK"));let Po=re();oe("CLOSE");let Ti=le();br(_r,ks,Ci,Po,Ti);continue}wt(),oe("END")}return h}t(jut,"D");function xT(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xT,"S");function Lut(a){return a&&a.ignoreCase?"ui":"u"}t(Lut,"X");function Fsr(a,s,l){return But(jut(a,l),s,l)}t(Fsr,"Z");function hM(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(hM,"k");function But(a,s,l={}){l.delimiter??="/#?",l.prefixes??="./",l.sensitive??=!1,l.strict??=!1,l.end??=!0,l.start??=!0,l.endsWith="";let _=l.start?"^":"";for(let N of a){if(N.type===3){N.modifier===3?_+=xT(N.value):_+=`(?:${xT(N.value)})${hM(N.modifier)}`;continue}s&&s.push(N.name);let B=`[^${xT(l.delimiter)}]+?`,q=N.value;if(N.type===1?q=B:N.type===0&&(q=uNe),!N.prefix.length&&!N.suffix.length){N.modifier===3||N.modifier===1?_+=`(${q})${hM(N.modifier)}`:_+=`((?:${q})${hM(N.modifier)})`;continue}if(N.modifier===3||N.modifier===1){_+=`(?:${xT(N.prefix)}(${q})${xT(N.suffix)})`,_+=hM(N.modifier);continue}_+=`(?:${xT(N.prefix)}`,_+=`((?:${q})(?:`,_+=xT(N.suffix),_+=xT(N.prefix),_+=`(?:${q}))*)${xT(N.suffix)})`,N.modifier===0&&(_+="?")}let h=`[${xT(l.endsWith)}]|$`,S=`[${xT(l.delimiter)}]`;if(l.end)return l.strict||(_+=`${S}?`),l.endsWith.length?_+=`(?=${h})`:_+="$",new RegExp(_,Lut(l));l.strict||(_+=`(?:${S}(?=${h}))?`);let k=!1;if(a.length){let N=a[a.length-1];N.type===3&&N.modifier===3&&(k=l.delimiter.indexOf(N)>-1)}return k||(_+=`(?=${S}|${h})`),new RegExp(_,Lut(l))}t(But,"F");var cN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Lsr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Rsr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Msr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Msr,"J");function Uut(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(Uut,"Q");function jsr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(jsr,"Ee");function $ut(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t($ut,"W");var Jut=["ftp","file","http","https","ws","wss"];function qut(a){if(!a)return!0;for(let s of Jut)if(a.test(s))return!0;return!1}t(qut,"N");function Bsr(a,s){if(a=Uut(a,"#"),s||a==="")return a;let l=new URL("https://example.com");return l.hash=a,l.hash?l.hash.substring(1,l.hash.length):""}t(Bsr,"te");function Usr(a,s){if(a=Uut(a,"?"),s||a==="")return a;let l=new URL("https://example.com");return l.search=a,l.search?l.search.substring(1,l.search.length):""}t(Usr,"re");function $sr(a,s){return s||a===""?a:$ut(a)?Wut(a):Vut(a)}t($sr,"ne");function Jsr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.password=a,l.password}t(Jsr,"se");function qsr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.username=a,l.username}t(qsr,"ie");function zsr(a,s,l){if(l||a==="")return a;if(s&&!Jut.includes(s))return new URL(`${s}:${a}`).pathname;let _=a[0]=="/";return a=new URL(_?a:"/-"+a,"https://example.com").pathname,_||(a=a.substring(2,a.length)),a}t(zsr,"ae");function Vsr(a,s,l){return zut(s)===a&&(a=""),l||a===""?a:Hut(a)}t(Vsr,"oe");function Wsr(a,s){return a=jsr(a,":"),s||a===""?a:fNe(a)}t(Wsr,"ce");function zut(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(zut,"_");function fNe(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(fNe,"y");function Hsr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Hsr,"le");function Gsr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Gsr,"fe");function Vut(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(Vut,"z");function Wut(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Wut,"j");function Hut(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(Hut,"K");function Ksr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Ksr,"he");function Ysr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Ysr,"ue");function Xsr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(Xsr,"de");function Qsr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(Qsr,"pe");var Zsr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=Mut(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#k()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#D()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#C()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#x()?this.#d(3):(this.#E()||this.#y()||this.#k())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#x()&&this.#i(5,1);break;case 4:this.#x()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#w()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#k()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#k()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#k()&&this.#i(9,1);break;case 8:this.#k()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let l=this.#u(a);return l.value===s&&(l.type==="CHAR"||l.type==="ESCAPED_CHAR"||l.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#C(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#x(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#w(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#k(){return this.#m(this.#t,"#")}#D(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,cN),a.encodePart=fNe;let s=Fsr(this.#T(),void 0,a);this.#l=qut(s)}},lNe=["protocol","username","password","hostname","port","pathname","search","hash"],oN="*";function Rut(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let l=new URL(a,s);return{protocol:l.protocol.substring(0,l.protocol.length-1),username:l.username,password:l.password,hostname:l.hostname,port:l.port,pathname:l.pathname,search:l.search!==""?l.search.substring(1,l.search.length):void 0,hash:l.hash!==""?l.hash.substring(1,l.hash.length):void 0}}t(Rut,"ge");function QP(a,s){return s?JH(a):a}t(QP,"b");function $H(a,s,l){let _;if(typeof s.baseURL=="string")try{_=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=QP(_.protocol.substring(0,_.protocol.length-1),l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=QP(_.username,l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=QP(_.password,l)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=QP(_.hostname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=QP(_.port,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=QP(_.pathname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=QP(_.search.substring(1,_.search.length),l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=QP(_.hash.substring(1,_.hash.length),l))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Wsr(s.protocol,l)),typeof s.username=="string"&&(a.username=qsr(s.username,l)),typeof s.password=="string"&&(a.password=Jsr(s.password,l)),typeof s.hostname=="string"&&(a.hostname=$sr(s.hostname,l)),typeof s.port=="string"&&(a.port=Vsr(s.port,a.protocol,l)),typeof s.pathname=="string"){if(a.pathname=s.pathname,_&&!Msr(a.pathname,l)){let h=_.pathname.lastIndexOf("/");h>=0&&(a.pathname=QP(_.pathname.substring(0,h+1),l)+a.pathname)}a.pathname=zsr(a.pathname,a.protocol,l)}return typeof s.search=="string"&&(a.search=Usr(s.search,l)),typeof s.hash=="string"&&(a.hash=Bsr(s.hash,l)),a}t($H,"w");function JH(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(JH,"C");function ear(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(ear,"Oe");function tar(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let l=".*",_=`[^${ear(s.delimiter)}]+?`,h=/[$_\u200C\u200D\p{ID_Continue}]/u,S="";for(let k=0;k<a.length;++k){let N=a[k];if(N.type===3){if(N.modifier===3){S+=JH(N.value);continue}S+=`{${JH(N.value)}}${hM(N.modifier)}`;continue}let B=N.hasCustomName(),q=!!N.suffix.length||!!N.prefix.length&&(N.prefix.length!==1||!s.prefixes.includes(N.prefix)),le=k>0?a[k-1]:null,oe=k<a.length-1?a[k+1]:null;if(!q&&B&&N.type===1&&N.modifier===3&&oe&&!oe.prefix.length&&!oe.suffix.length)if(oe.type===3){let re=oe.value.length>0?oe.value[0]:"";q=h.test(re)}else q=!oe.hasCustomName();if(!q&&!N.prefix.length&&le&&le.type===3){let re=le.value[le.value.length-1];q=s.prefixes.includes(re)}q&&(S+="{"),S+=JH(N.prefix),B&&(S+=`:${N.name}`),N.type===2?S+=`(${N.value})`:N.type===1?B||(S+=`(${_})`):N.type===0&&(!B&&(!le||le.type===3||le.modifier!==3||q||N.prefix!=="")?S+="*":S+=`(${l})`),N.type===1&&B&&N.suffix.length&&h.test(N.suffix[0])&&(S+="\\"),S+=JH(N.suffix),q&&(S+="}"),N.modifier!==3&&(S+=hM(N.modifier))}return S}t(tar,"ke");var Gut=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,l){try{let _;if(typeof s=="string"?_=s:l=s,typeof a=="string"){let N=new Zsr(a);if(N.parse(),a=N.result,_===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=_}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(_)throw new TypeError("parameter 1 is not of type 'string'.")}typeof l>"u"&&(l={ignoreCase:!1});let h={ignoreCase:l.ignoreCase===!0},S={pathname:oN,protocol:oN,username:oN,password:oN,hostname:oN,port:oN,search:oN,hash:oN};this.#r=$H(S,a,!0),zut(this.#r.protocol)===this.#r.port&&(this.#r.port="");let k;for(k of lNe){if(!(k in this.#r))continue;let N={},B=this.#r[k];switch(this.#e[k]=[],k){case"protocol":Object.assign(N,cN),N.encodePart=fNe;break;case"username":Object.assign(N,cN),N.encodePart=Hsr;break;case"password":Object.assign(N,cN),N.encodePart=Gsr;break;case"hostname":Object.assign(N,Lsr),$ut(B)?N.encodePart=Wut:N.encodePart=Vut;break;case"port":Object.assign(N,cN),N.encodePart=Hut;break;case"pathname":qut(this.#n.protocol)?(Object.assign(N,Rsr,h),N.encodePart=Ksr):(Object.assign(N,cN,h),N.encodePart=Ysr);break;case"search":Object.assign(N,cN,h),N.encodePart=Xsr;break;case"hash":Object.assign(N,cN,h),N.encodePart=Qsr;break}try{this.#s[k]=jut(B,N),this.#n[k]=But(this.#s[k],this.#e[k],N),this.#t[k]=tar(this.#s[k],N),this.#p=this.#p||this.#s[k].some(q=>q.type===2)}catch{throw new TypeError(`invalid ${k} pattern '${this.#r[k]}'.`)}}}catch(_){throw new TypeError(`Failed to construct 'URLPattern': ${_.message}`)}}test(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?l=$H(l,a,!1):l=$H(l,Rut(a,s),!1)}catch{return!1}let _;for(_ of lNe)if(!this.#n[_].exec(l[_]))return!1;return!0}exec(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?l=$H(l,a,!1):l=$H(l,Rut(a,s),!1)}catch{return null}let _={};s?_.inputs=[a,s]:_.inputs=[a];let h;for(h of lNe){let S=this.#n[h].exec(l[h]);if(!S)return null;let k={};for(let[N,B]of this.#e[h].entries())if(typeof B=="string"||typeof B=="number"){let q=S[N+1];k[B]=q}_[h]={input:l[h]??"",groups:k}}return _}static compareComponent(a,s,l){let _=t((N,B)=>{for(let q of["type","modifier","prefix","value","suffix"]){if(N[q]<B[q])return-1;if(N[q]!==B[q])return 1}return 0},"o"),h=new qH(3,"","","","",3),S=new qH(0,"","","","",3),k=t((N,B)=>{let q=0;for(;q<Math.min(N.length,B.length);++q){let le=_(N[q],B[q]);if(le)return le}return N.length===B.length?0:_(N[q]??h,B[q]??h)},"s");return!s.#t[a]&&!l.#t[a]?0:s.#t[a]&&!l.#t[a]?k(s.#s[a],[S]):!s.#t[a]&&l.#t[a]?k([S],l.#s[a]):k(s.#s[a],l.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=Gut);import{AssertionError as rar}from"assert";function ZP(a,s){if(a===!1)throw new rar({message:s})}t(ZP,"assert");var Ac;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Ac||(Ac={}));function gM(a){return a.type===Ac.Object}t(gM,"isAstObject");function e6(a){return a.type===Ac.Property}t(e6,"isAstProperty");function Kut(a){return a.type===Ac.Array}t(Kut,"isAstArray");function yM(a){return a.type===Ac.Literal}t(yM,"isAstLiteral");function IO(a){if(a===void 0)throw new Error("Node is undefined");if(!gM(a))throw new Error("Node is not object")}t(IO,"assertAstObject");import{findNodeAtLocation as nar,getNodeValue as iar,printParseErrorCode as sar,visit as aar}from"jsonc-parser";var oar={DEFAULT:{allowTrailingComma:!1}};function zH(a,s=[],l=oar.DEFAULT){let _={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function h(B){_.type==="property"&&(_.length=B-_.offset,_=_.parent)}t(h,"ensurePropertyComplete");function S(B){return _.children?.push(B),B}t(S,"onValue"),aar(a,{onObjectBegin:t((B,q,le)=>{_=S({type:"object",offset:B,length:-1,line:q+1,column:le+1,parent:_,children:[]})},"onObjectBegin"),onObjectProperty:t((B,q,le,oe,re)=>{_=S({type:"property",offset:q,length:-1,line:oe+1,column:re+1,parent:_,children:[]}),_.children?.push({type:"string",value:B,offset:q,length:le,line:oe,column:re,parent:_})},"onObjectProperty"),onObjectEnd:t((B,q)=>{h(B+q),_.length=B+q-_.offset,_=_.parent,h(B+q)},"onObjectEnd"),onArrayBegin:t((B,q,le,oe)=>{_=S({type:"array",offset:B,length:-1,line:le+1,column:oe+1,parent:_,children:[]})},"onArrayBegin"),onArrayEnd:t((B,q)=>{_.length=B+q-_.offset,_=_.parent,h(B+q)},"onArrayEnd"),onLiteralValue:t((B,q,le,oe,re)=>{S({type:car(B),offset:q,length:le,line:oe+1,column:re+1,parent:_,value:B}),h(q+le)},"onLiteralValue"),onSeparator:t((B,q)=>{_.type==="property"&&(B===":"?_.colonOffset=q:B===","&&h(q))},"onSeparator"),onError:t((B,q,le,oe,re)=>{s.push({error:B,offset:q,length:le,line:oe+1,column:re+1})},"onError")},l);let N=_.children[0];return N&&delete N.parent,N}t(zH,"parse");function car(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(car,"getNodeType");function _Ne(a,s){return nar(a,s)}t(_Ne,"findNodeAtLocation");function VH(a){return iar(a)}t(VH,"getNodeValue");function Yut(a){return sar(a)}t(Yut,"printParseErrorCode");var WH=class{static{t(this,"AstAdapter")}parse(s){let _=zH(s,[]);if(_)return this.parseNode(_,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,l){switch(s.type){case"object":return this.createObject(s,l);case"array":return this.createArray(s,l);case"property":return this.createProperty(s,l);case"string":return this.createLiteral(s,l);case"number":return this.createLiteral(s,l);case"boolean":return this.createLiteral(s,l);case"null":return this.createLiteral(s,l)}}createLiteral(s,l){return{type:Ac.Literal,location:{line:s.line,column:s.column},parent:l,value:s.type==="null"?null:s.value}}createObject(s,l){let _={type:Ac.Object,children:[],parent:l,location:{line:s.line,column:s.column}};return s.children?.forEach(h=>{_.children.push(this.parseNode(h,_))}),_}createProperty(s,l){ZP(s.children?.length===2,"Invalid property node");let _={type:Ac.Property,location:{line:s.line,column:s.column},parent:l,name:null,value:null};return _.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Ac.Identifier,parent:_},_.value=this.parseNode(s.children[1],_),_}createArray(s,l){let _={type:Ac.Array,location:{line:s.line,column:s.column},parent:l,children:[]};return s.children?.forEach(h=>_.children.push(this.parseNode(h,_))),_}};var NE={createLiteral:t((a,s)=>({type:Ac.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Ac.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Ac.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,l)=>{let _={type:Ac.Property,parent:l,name:null,value:s};return _.name={value:a,type:Ac.Identifier,parent:_},_.value.parent=_,_},"createProperty"),createArrayOfLiterals:t((a,s)=>{let l={type:Ac.Array,parent:s,children:[]};for(let _ of a)l.children.push(NE.createLiteral(_,l));return l},"createArrayOfLiterals")};var lar=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,HH=class{static{t(this,"SourceGenerator")}generate(s){let l=[];return this.generateSource(l,s),l.join("")}generateSource(s,l){switch(l.type){case Ac.Array:return this.generateArray(s,l);case Ac.Object:return this.generateObject(s,l);case Ac.Property:return this.generateProperty(s,l);case Ac.Literal:return this.generateLiteral(s,l);case Ac.FunctionCall:return this.generateFunctionCall(s,l);case Ac.Identifier:return this.generateIdentifier(s,l);case Ac.Raw:return this.generateRaw(s,l);case Ac.TemplateString:return this.generateTemplateString(s,l)}}generateArray(s,l){s.push("["),l.children.map(_=>{this.generateSource(s,_),s.push(",")}),s.push("]")}generateObject(s,l){s.push("{"),l.children.forEach(_=>{this.generateSource(s,_),s.push(",")}),s.push("}")}generateProperty(s,l){this.generateIdentifier(s,l.name),s.push(":"),this.generateSource(s,l.value)}generateFunctionCall(s,l){s.push(l.name.value),s.push("("),l.children.forEach((_,h,S)=>{this.generateSource(s,_),h<S.length&&s.push(",")}),s.push(")")}generateRaw(s,l){s.push(l.value)}generateTemplateString(s,l){s.push("`"),s.push(l.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,l){if(l.value===null)return s.push("null");switch(typeof l.value){case"number":case"boolean":return s.push(`${l.value}`);case"string":{let _=l.value,h=JSON.stringify(_);return s.push(`${h}`)}}}generateIdentifier(s,l){let _=lar.test(l.value)?l.value:`'${l.value}'`;s.push(_)}};import{parse as uar}from"@swc/core";import far from"fs/promises";var Xut=t(async a=>{let s=new Set;try{let l=await far.readFile(a,"utf-8");(await uar(l,{syntax:"typescript"})).body.forEach(h=>{h.type==="ExportDefaultDeclaration"||h.type==="ExportDefaultExpression"?s.add("default"):h.type==="ExportDeclaration"&&h.declaration.type==="FunctionDeclaration"?s.add(h.declaration.identifier.value):h.type==="ExportDeclaration"&&h.declaration.type==="VariableDeclaration"&&h.declaration.declarations[0].id.type==="Identifier"&&s.add(h.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var Qut={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var pNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Zut={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var dNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var mNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var _dt=Nd(Lpt(),1),pdt=Nd(fdt(),1);var mue=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new pdt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,_dt.default)(this.ajv,{mode:"fast"})}addSchema(s,l){this.ajv.addSchema(s,l)}compile(s){let l=this.ajv.compile(s);return t(h=>({isValid:l(h),errors:this.toSimpleErrors(l.errors,h),warnings:[]}),"validator")}toSimpleErrors(s,l){let _=[];return s?.forEach(h=>{h.keyword==="enum"&&h.params.allowedValues&&Array.isArray(h.params.allowedValues)&&(h.message+=`; ${h.params.allowedValues.join(", ")}`),h.instancePath&&(h.instancePath=h.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let S={details:{}},k=h.instancePath.split("/");if(k.length>2){let B=k[1],q=k[2]?parseInt(k[2]):0,le=k[3],oe=isNaN(q)?void 0:l[B][q][le];S={details:{property:B,index:q,field:le,fieldValue:oe}}}if(h.keyword==="required"&&h.params.missingProperty&&h.instancePath&&(h.message=`A 'path' is missing required property '${h.params.missingProperty}'`),h.keyword==="additionalProperties"&&h.params.additionalProperty&&h.instancePath&&(h.message=`A 'path' should NOT include property '${h.params.additionalProperty}'`),h.keyword==="type"&&h.params.type&&h.instancePath){let B=h.instancePath.split("/"),q=B[B.length-1];h.message=`Value of property '${q}' must be '${h.params.type}'`}let N=Object.assign(h,S);_.push(N)}),_}};var yN=mue.instance;yN.addSchema(mNe,"route-configuration.schema.json");yN.addSchema(Zut,"policy-configuration.schema.json");yN.addSchema(pNe,"policies.schema.json");yN.addSchema(dNe,"open-api-route-configuration.schema.json");yN.addSchema(Qut,"fragments.schema.json");var Q8r=yN.compile(mNe),ddt=yN.compile(dNe),AIe=yN.compile(pNe);var hue=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=AIe(s),this.results}};var gue=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=ddt(s),this.results}};import vpr from"path";var NIe=/\$import\((.*)\)/,yue=/\$env\((.*?)\)/g;var s6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,l,_,h){super(s),this.location={file:l,namespace:"",line:_?_.line:0,column:_?_.column:0,length:0,lineText:h??"",suggestion:""}}},ypr=t(a=>{let s=[],l=a;for(;l.parent;)s.push(l),l=l.parent;return s.reverse()},"invertTree"),vN=t((a,s)=>{if(!a)return!1;let l=ypr(a);return s.split("/").every((S,k)=>{let N=l[k];return N?S==="*"||e6(N)&&N.name.value===S?!0:S==="{}"?N.type===Ac.Object:S==="[]"?N.type===Ac.Array:!1:!1})},"testPosition");var vue=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),gM(s)?s.children.forEach(l=>{this.visitor(l)}):Kut(s)?s.children.forEach(l=>{this.visitor(l)}):e6(s)&&this.visitor(s.value)}},mdt=t((a,s,l)=>_=>{if(!e6(_)||!yM(_.value)||typeof _.value.value!="string")return;if(!a.some(S=>vN(_,S))){yue.test(_.value.value)&&s.push(new s6("An $env() statement is not expected at this location.",l,_.location,_.value.value));return}let h=new RegExp(yue).exec(_.value.value);if(h?.length===2&&h[0]===_.value.value){let S={type:Ac.Raw,parent:null,value:`environment["${h[1]}"]`};_.value=S}else{let S=_.value.value.replaceAll(new RegExp(yue),(k,N)=>`\${environment["${N}"] ? environment["${N}"] : ""}`);S!==_.value.value&&(_.value=NE.createTemplateString(S,_))}},"getEnvStatementTransformer");var kG="config/routes.json",bpr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Spr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],hdt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Tpr="handler/{}/options/{}/rewritePattern",xpr="handler/{}/options/{}/baseUrl",bue=class extends vue{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let l=this.addedImports.get(s);if(!l)throw new Error("Import name is undefined. This should not happen.");return l}getImports(){let s=[];return this.addedImports.forEach((l,_)=>{s.push({name:l,path:_})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!e6(s)||!yM(s.value)||typeof s.value.value!="string")&&vN(s,Tpr)){if(!s.parent||!gM(s.parent)){this.errors.push(new s6("Invalid node, expected object",kG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:gdt(l)},h=NE.createProperty("__rewriteFunction",_,s);s.parent.children.push(h)}}rewriteForwardFunction(s){if(!(!e6(s)||!yM(s.value)||typeof s.value.value!="string")&&vN(s,xpr)){if(!s.parent||!gM(s.parent)){this.errors.push(new s6("Invalid node, expected object",kG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:gdt(l)},h=NE.createProperty("__rewriteFunction",_,s);s.parent.children.push(h)}}replaceImportStatements(s){if(!e6(s)||!yM(s.value))return;let l=s.value.value;if(typeof l!="string")return;if(!Spr.some(N=>vN(s,N))&&!hdt.some(N=>vN(s,N))){if(NIe.test(l)){if(s.name.value==="$ref")return;this.errors.push(new s6("An $import() statement is not expected at this location.",kG,s.location,l))}return}let _=NIe.exec(l);if(hdt.some(N=>vN(s,N))&&!_)return;if(!_){this.errors.push(new s6("Invalid $import() statement",kG,s.location,l));return}let h=_[1];h.startsWith(".")&&(h=vpr.join("..",h));let S=this.getImportName(h),k={type:Ac.Identifier,parent:s.parent,value:S};s.value=k}replaceEnvStatements=mdt(bpr,this.errors,kG)};function gdt(a){return`(request, context) => {
|
|
@@ -629,5 +631,5 @@ globstar while`,s,re,l,We,Ne),this.matchOne(s.slice(re),l.slice(We),_))return th
|
|
|
629
631
|
`:10,l=typeof a=="string"?"\r":13;return a[a.length-1]===s&&(a=a.slice(0,-1)),a[a.length-1]===l&&(a=a.slice(0,-1)),a}t(gFe,"stripFinalNewline");import dpe from"process";import $K from"path";import{fileURLToPath as y2t}from"url";function ppe(a={}){let{env:s=process.env,platform:l=process.platform}=a;return l!=="win32"?"PATH":Object.keys(s).reverse().find(_=>_.toUpperCase()==="PATH")||"Path"}t(ppe,"pathKey");var Ikr=t(({cwd:a=dpe.cwd(),path:s=dpe.env[ppe()],preferLocal:l=!0,execPath:_=dpe.execPath,addExecPath:h=!0}={})=>{let S=a instanceof URL?y2t(a):a,k=$K.resolve(S),N=[];return l&&Okr(N,k),h&&Fkr(N,_,k),[...N,s].join($K.delimiter)},"npmRunPath"),Okr=t((a,s)=>{let l;for(;l!==s;)a.push($K.join(s,"node_modules/.bin")),l=s,s=$K.resolve(s,"..")},"applyPreferLocal"),Fkr=t((a,s,l)=>{let _=s instanceof URL?y2t(s):s;a.push($K.resolve(l,_,".."))},"applyExecPath"),v2t=t(({env:a=dpe.env,...s}={})=>{a={...a};let l=ppe({env:a});return s.path=a[l],a[l]=Ikr(s),a},"npmRunPathEnv");var Lkr=t((a,s,l,_)=>{if(l==="length"||l==="prototype"||l==="arguments"||l==="caller")return;let h=Object.getOwnPropertyDescriptor(a,l),S=Object.getOwnPropertyDescriptor(s,l);!Rkr(h,S)&&_||Object.defineProperty(a,l,S)},"copyProperty"),Rkr=t(function(a,s){return a===void 0||a.configurable||a.writable===s.writable&&a.enumerable===s.enumerable&&a.configurable===s.configurable&&(a.writable||a.value===s.value)},"canCopyProperty"),Mkr=t((a,s)=>{let l=Object.getPrototypeOf(s);l!==Object.getPrototypeOf(a)&&Object.setPrototypeOf(a,l)},"changePrototype"),jkr=t((a,s)=>`/* Wrapped ${a}*/
|
|
630
632
|
${s}`,"wrappedToString"),Bkr=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Ukr=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),$kr=t((a,s,l)=>{let _=l===""?"":`with ${l.trim()}() `,h=jkr.bind(null,_,s.toString());Object.defineProperty(h,"name",Ukr),Object.defineProperty(a,"toString",{...Bkr,value:h})},"changeToString");function yFe(a,s,{ignoreNonConfigurable:l=!1}={}){let{name:_}=a;for(let h of Reflect.ownKeys(s))Lkr(a,s,h,l);return Mkr(a,s),$kr(a,s,_),a}t(yFe,"mimicFunction");var mpe=new WeakMap,b2t=t((a,s={})=>{if(typeof a!="function")throw new TypeError("Expected a function");let l,_=0,h=a.displayName||a.name||"<anonymous>",S=t(function(...k){if(mpe.set(S,++_),_===1)l=a.apply(this,k),a=null;else if(s.throw===!0)throw new Error(`Function \`${h}\` can only be called once`);return l},"onetime");return yFe(S,a),mpe.set(S,_),S},"onetime");b2t.callCount=a=>{if(!mpe.has(a))throw new Error(`The given function \`${a.name}\` is not wrapped by the \`onetime\` package`);return mpe.get(a)};var S2t=b2t;import{constants as Vkr}from"os";var T2t=t(function(){let a=vFe-x2t+1;return Array.from({length:a},Jkr)},"getRealtimeSignals"),Jkr=t(function(a,s){return{name:`SIGRT${s+1}`,number:x2t+s,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}},"getRealtimeSignal"),x2t=34,vFe=64;import{constants as qkr}from"os";var E2t=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var bFe=t(function(){let a=T2t();return[...E2t,...a].map(zkr)},"getSignals"),zkr=t(function({name:a,number:s,description:l,action:_,forced:h=!1,standard:S}){let{signals:{[a]:k}}=qkr,N=k!==void 0;return{name:a,number:N?k:s,description:l,supported:N,action:_,forced:h,standard:S}},"normalizeSignal");var Wkr=t(function(){return bFe().reduce(Hkr,{})},"getSignalsByName"),Hkr=t(function(a,{name:s,number:l,description:_,supported:h,action:S,forced:k,standard:N}){return{...a,[s]:{name:s,number:l,description:_,supported:h,action:S,forced:k,standard:N}}},"getSignalByName"),C2t=Wkr(),Gkr=t(function(){let a=bFe(),s=vFe+1,l=Array.from({length:s},(_,h)=>Kkr(h,a));return Object.assign({},...l)},"getSignalsByNumber"),Kkr=t(function(a,s){let l=Ykr(a,s);if(l===void 0)return{};let{name:_,description:h,supported:S,action:k,forced:N,standard:B}=l;return{[a]:{name:_,number:a,description:h,supported:S,action:k,forced:N,standard:B}}},"getSignalByNumber"),Ykr=t(function(a,s){let l=s.find(({name:_})=>Vkr.signals[_]===a);return l!==void 0?l:s.find(_=>_.number===a)},"findSignalByNumber"),pqr=Gkr();var Xkr=t(({timedOut:a,timeout:s,errorCode:l,signal:_,signalDescription:h,exitCode:S,isCanceled:k})=>a?`timed out after ${s} milliseconds`:k?"was canceled":l!==void 0?`failed with ${l}`:_!==void 0?`was killed with ${_} (${h})`:S!==void 0?`failed with exit code ${S}`:"failed","getErrorPrefix"),SFe=t(({stdout:a,stderr:s,all:l,error:_,signal:h,exitCode:S,command:k,escapedCommand:N,timedOut:B,isCanceled:q,killed:le,parsed:{options:{timeout:oe}}})=>{S=S===null?void 0:S,h=h===null?void 0:h;let re=h===void 0?void 0:C2t[h].description,We=_&&_.code,we=`Command ${Xkr({timedOut:B,timeout:oe,errorCode:We,signal:h,signalDescription:re,exitCode:S,isCanceled:q})}: ${k}`,Ot=Object.prototype.toString.call(_)==="[object Error]",wt=Ot?`${we}
|
|
631
633
|
${_.message}`:we,br=[wt,s,a].filter(Boolean).join(`
|
|
632
|
-
`);return Ot?(_.originalMessage=_.message,_.message=br):_=new Error(br),_.shortMessage=wt,_.command=k,_.escapedCommand=N,_.exitCode=S,_.signal=h,_.signalDescription=re,_.stdout=a,_.stderr=s,l!==void 0&&(_.all=l),"bufferedData"in _&&delete _.bufferedData,_.failed=!0,_.timedOut=!!B,_.isCanceled=q,_.killed=le&&!B,_},"makeError");var hpe=["stdin","stdout","stderr"],Qkr=t(a=>hpe.some(s=>a[s]!==void 0),"hasAlias"),k2t=t(a=>{if(!a)return;let{stdio:s}=a;if(s===void 0)return hpe.map(_=>a[_]);if(Qkr(a))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${hpe.map(_=>`\`${_}\``).join(", ")}`);if(typeof s=="string")return s;if(!Array.isArray(s))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof s}\``);let l=Math.max(s.length,hpe.length);return Array.from({length:l},(_,h)=>s[h])},"normalizeStdio");var O2t=Nd(I2t(),1);import Zkr from"os";var ewr=1e3*5,F2t=t((a,s="SIGTERM",l={})=>{let _=a(s);return twr(a,s,l,_),_},"spawnedKill"),twr=t((a,s,l,_)=>{if(!rwr(s,l,_))return;let h=iwr(l),S=setTimeout(()=>{a("SIGKILL")},h);S.unref&&S.unref()},"setKillTimeout"),rwr=t((a,{forceKillAfterTimeout:s},l)=>nwr(a)&&s!==!1&&l,"shouldForceKill"),nwr=t(a=>a===Zkr.constants.signals.SIGTERM||typeof a=="string"&&a.toUpperCase()==="SIGTERM","isSigterm"),iwr=t(({forceKillAfterTimeout:a=!0})=>{if(a===!0)return ewr;if(!Number.isFinite(a)||a<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${a}\` (${typeof a})`);return a},"getForceKillAfterTimeout"),L2t=t((a,s)=>{a.kill()&&(s.isCanceled=!0)},"spawnedCancel"),swr=t((a,s,l)=>{a.kill(s),l(Object.assign(new Error("Timed out"),{timedOut:!0,signal:s}))},"timeoutKill"),R2t=t((a,{timeout:s,killSignal:l="SIGTERM"},_)=>{if(s===0||s===void 0)return _;let h,S=new Promise((N,B)=>{h=setTimeout(()=>{swr(a,l,B)},s)}),k=_.finally(()=>{clearTimeout(h)});return Promise.race([S,k])},"setupTimeout"),M2t=t(({timeout:a})=>{if(a!==void 0&&(!Number.isFinite(a)||a<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${a}\` (${typeof a})`)},"validateTimeout"),j2t=t(async(a,{cleanup:s,detached:l},_)=>{if(!s||l)return _;let h=(0,O2t.default)(()=>{a.kill()});return _.finally(()=>{h()})},"setExitHandler");function B2t(a){return a!==null&&typeof a=="object"&&typeof a.pipe=="function"}t(B2t,"isStream");var wFe=Nd(J2t(),1),V2t=Nd(z2t(),1);var W2t=t((a,s)=>{s===void 0||a.stdin===void 0||(B2t(s)?s.pipe(a.stdin):a.stdin.end(s))},"handleInput"),H2t=t((a,{all:s})=>{if(!s||!a.stdout&&!a.stderr)return;let l=(0,V2t.default)();return a.stdout&&l.add(a.stdout),a.stderr&&l.add(a.stderr),l},"makeAllStream"),CFe=t(async(a,s)=>{if(a){a.destroy();try{return await s}catch(l){return l.bufferedData}}},"getBufferedData"),kFe=t((a,{encoding:s,buffer:l,maxBuffer:_})=>{if(!(!a||!l))return s?(0,wFe.default)(a,{encoding:s,maxBuffer:_}):wFe.default.buffer(a,{maxBuffer:_})},"getStreamPromise"),G2t=t(async({stdout:a,stderr:s,all:l},{encoding:_,buffer:h,maxBuffer:S},k)=>{let N=kFe(a,{encoding:_,buffer:h,maxBuffer:S}),B=kFe(s,{encoding:_,buffer:h,maxBuffer:S}),q=kFe(l,{encoding:_,buffer:h,maxBuffer:S*2});try{return await Promise.all([k,N,B,q])}catch(le){return Promise.all([{error:le,signal:le.signal,timedOut:le.timedOut},CFe(a,N),CFe(s,B),CFe(l,q)])}},"getSpawnedResult");var pwr=(async()=>{})().constructor.prototype,dwr=["then","catch","finally"].map(a=>[a,Reflect.getOwnPropertyDescriptor(pwr,a)]),DFe=t((a,s)=>{for(let[l,_]of dwr){let h=typeof s=="function"?(...S)=>Reflect.apply(_.value,s(),S):_.value.bind(s);Reflect.defineProperty(a,l,{..._,value:h})}return a},"mergePromise"),K2t=t(a=>new Promise((s,l)=>{a.on("exit",(_,h)=>{s({exitCode:_,signal:h})}),a.on("error",_=>{l(_)}),a.stdin&&a.stdin.on("error",_=>{l(_)})}),"getSpawnedPromise");var Y2t=t((a,s=[])=>Array.isArray(s)?[a,...s]:[a],"normalizeArgs"),mwr=/^[\w.-]+$/,hwr=/"/g,gwr=t(a=>typeof a!="string"||mwr.test(a)?a:`"${a.replace(hwr,'\\"')}"`,"escapeArg"),X2t=t((a,s)=>Y2t(a,s).join(" "),"joinCommand"),Q2t=t((a,s)=>Y2t(a,s).map(l=>gwr(l)).join(" "),"getEscapedCommand");var bwr=1e3*1e3*100,Swr=t(({env:a,extendEnv:s,preferLocal:l,localDir:_,execPath:h})=>{let S=s?{...Tpe.env,...a}:a;return l?v2t({env:S,cwd:_,execPath:h}):S},"getEnv"),Twr=t((a,s,l={})=>{let _=eTt.default._parse(a,s,l);return a=_.command,s=_.args,l=_.options,l={maxBuffer:bwr,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:l.cwd||Tpe.cwd(),execPath:Tpe.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...l},l.env=Swr(l),l.stdio=k2t(l),Tpe.platform==="win32"&&vwr.basename(a,".exe")==="cmd"&&s.unshift("/q"),{file:a,args:s,options:l,parsed:_}},"handleArguments"),PFe=t((a,s,l)=>typeof s!="string"&&!ywr.isBuffer(s)?l===void 0?void 0:"":a.stripFinalNewline?gFe(s):s,"handleOutput");function tTt(a,s,l){let _=Twr(a,s,l),h=X2t(a,s),S=Q2t(a,s);M2t(_.options);let k;try{k=Z2t.spawn(_.file,_.args,_.options)}catch(We){let Ne=new Z2t.ChildProcess,we=Promise.reject(SFe({error:We,stdout:"",stderr:"",all:"",command:h,escapedCommand:S,parsed:_,timedOut:!1,isCanceled:!1,killed:!1}));return DFe(Ne,we)}let N=K2t(k),B=R2t(k,_.options,N),q=j2t(k,_.options,B),le={isCanceled:!1};k.kill=F2t.bind(null,k.kill.bind(k)),k.cancel=L2t.bind(null,k,le);let re=S2t(t(async()=>{let[{error:We,exitCode:Ne,signal:we,timedOut:Ot},wt,br,Kr]=await G2t(k,_.options,q),ln=PFe(_.options,wt),hn=PFe(_.options,br),pr=PFe(_.options,Kr);if(We||Ne!==0||we!==null){let _r=SFe({error:We,exitCode:Ne,signal:we,stdout:ln,stderr:hn,all:pr,command:h,escapedCommand:S,parsed:_,timedOut:Ot,isCanceled:le.isCanceled||(_.options.signal?_.options.signal.aborted:!1),killed:k.killed});if(!_.options.reject)return _r;throw _r}return{command:h,escapedCommand:S,exitCode:0,stdout:ln,stderr:hn,all:pr,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}},"handlePromise"));return W2t(k,_.options.input),k.all=H2t(k,_.options),DFe(k,re)}t(tTt,"execa");import{existsSync as rTt,readFileSync as nTt}from"fs";import xpe from"path";async function Epe(a,s){if(a.__ZUPLO_LOG_LEVEL=process.env.__ZUPLO_LOG_LEVEL??process.env.LOG_LEVEL,a.__ZUPLO_LOG_FORMAT=process.env.__ZUPLO_LOG_FORMAT??process.env.LOG_FORMAT,a.LOG_LEVEL=process.env.LOG_LEVEL??process.env.LOG_LEVEL,a.LOG_FORMAT=process.env.LOG_FORMAT??process.env.LOG_FORMAT,a.GIT_SHA=process.env.GIT_SHA??await xwr(s),process.env.__ZUPLO_CONFIG&&(a.__ZUPLO_CONFIG=process.env.__ZUPLO_CONFIG),rTt(xpe.join(s,".env.zuplo"))){let l=nTt(xpe.join(s,".env.zuplo"),"utf8"),_=AFe.default.parse(l);for(let h of Object.keys(_))if(a[h]=_[h],h==="ZUPLO_SYSTEM_CONFIGURATIONS"){let S=Buffer.from(Xce.decode(_[h])).toString(),k=JSON.parse(S);for(let N of Object.keys(k))a[N]=k[N]}}if(rTt(xpe.join(s,".env"))){let l=nTt(xpe.join(s,".env"),"utf8"),_=AFe.default.parse(l);for(let h of Object.keys(_))a[h]=_[h]}for(let l of Object.keys(a))a[l]===void 0&&delete a[l];return a}t(Epe,"setEnvironment");async function xwr(a){let s="unknown";try{let{stdout:l}=await tTt("git",["rev-parse","HEAD"],{cwd:a});l.trim().length===40&&(s=l.trim())}catch{}return s}t(xwr,"getGitSha");async function wwr({buildId:a,output:s,sourceDirectory:l,bundledDir:_,port:h,binaryName:S,publicZuploEnvironmentVariables:k,logger:N,handleRuntimeStdio:B}){if(_){let le=zK.join(l,_,"modules.json");if(!Ewr(le))throw new Error("The bundled-dir does not contain a modules.json file.");let oe=await kwr(le,"utf-8").then(JSON.parse),re=await gce(l);return re.status===_O?new Promise((We,Ne)=>{q(re.config.compatibilityDate,zK.join(l,_),oe,We,B)().catch(we=>{N.error(we),Ne(we)})}):(N.warn("Failed to get Zuplo config. Using default compatibility date."),new Promise((We,Ne)=>{q(void 0,l,oe,We,B)().catch(we=>{N.error(we),Ne(we)})}))}else{let le=new iB({buildId:a,output:s,sourceDirectory:l,command:"dev",logger:N,generateSourceMaps:!0,publicZuploEnvironmentVariables:k??{ZUPLO_ENVIRONMENT_TYPE:"LOCAL_DEVELOPMENT"}});try{await le.start()}catch{N.info("Ran into irrecoverable error while building. Fix the error and rerun the command."),process.exit(1)}return new Promise((oe,re)=>{le.onReload((We,Ne)=>{(Ne||We&&We.errors&&We.errors.length>0)&&re(Ne??We?.errors),q(We?.compatibilityDate,zK.join(l,"dist"),Tj(l,We?.metafile),oe,B)().catch(we=>{N.error(we),re(we)})})})}function q(le,oe,re,We,Ne){return async()=>{let we={};await Epe(we,l);let Ot=new iTt.ZuploWorkerd({compatibilityDate:le,scriptDirectory:oe,modules:re,port:h??lh.DEV_SERVER_PORT,bindings:we,handleRuntimeStdio:Ne}),wt=S??"compiled-zup",br=zK.join(l,"dist");await Cwr(br,{recursive:!0}),await Ot.compileBinary({binaryPath:zK.join(l,"dist",wt)}),await Ot.dispose(),We(void 0)}}t(q,"compile")}t(wwr,"compileWorkerdServer");var aTt=Nd(nFe(),1);import Pwr from"path";import Dwr from"net";function sTt(a,s){return new Promise(l=>{let _=new Dwr.Socket;_.connect(s,a),_.on("connect",()=>{_.destroy(),l(!1)}),_.on("error",()=>{_.destroy(),l(!0)})})}t(sTt,"isPortAvailable");var Cpe=class{static{t(this,"WorkerdServer")}sourceDirectory;port;debugPort;buildWatcher;workerd;logger;output;buildId;handleRuntimeStdio;onReload;constructor(s){this.sourceDirectory=s.sourceDirectory,this.port=s.port??lh.DEV_SERVER_PORT,this.debugPort=s.debugPort,this.logger=s.logger,this.output=s.output,this.buildId=s.buildId,this.handleRuntimeStdio=s.handleRuntimeStdio,this.onReload=s.onReload,s.zupTestMode||(this.buildWatcher=new iB({...s,logger:this.logger,generateSourceMaps:!0,publicZuploEnvironmentVariables:s.publicZuploEnvironmentVariables??{ZUPLO_ENVIRONMENT_TYPE:"LOCAL_DEVELOPMENT"}}),this.buildWatcher.watchEnvFiles())}async start(){if(!await sTt("localhost",this.port))throw new Error(`Port ${this.port} is currently in use. Please use a different port.`);if(this.buildWatcher)try{await this.buildWatcher.start()}catch{this.logger?.info("Ran into irrecoverable error while starting watcher. Fix the error and restart the server."),process.exit(1)}await this.startOrReload(),this.buildWatcher?.onReload((l,_)=>{_||l&&l.errors&&l.errors.length>0||(this.onReload(l,_),this.startOrReload(l).catch(h=>{this.logger?.error(h)}))})}async startOrReload(s){try{let l={};await Epe(l,this.sourceDirectory),await this.workerd?.dispose(),this.workerd=new aTt.ZuploWorkerd({compatibilityDate:s?.compatibilityDate,scriptDirectory:Pwr.join(this.sourceDirectory,"dist"),modules:Tj(this.sourceDirectory,s?.metafile),port:this.port,inspectorPort:this.debugPort??void 0,bindings:l,handleRuntimeStdio:this.handleRuntimeStdio}),await this.workerd.serve()}catch{}}async stop(){await this.buildWatcher?.close(),await this.workerd?.dispose()}};async function Awr({sourceDirectory:a,port:s,debugPort:l,publicZuploEnvironmentVariables:_,logger:h,output:S,buildId:k,onReload:N,handleRuntimeStdio:B}){process.env.ZUPLO_IS_LOCAL_DEVELOPMENT="true";let q=new Cpe({sourceDirectory:a,command:"dev",port:s,debugPort:l,publicZuploEnvironmentVariables:_,logger:h,output:S,buildId:k,onReload:N,handleRuntimeStdio:B});await q.start();async function le(){await q.stop()}t(le,"handle"),process.on("SIGTERM",le),process.on("SIGINT",le)}t(Awr,"startDevServer");export{W7e as build,wwr as compileWorkerdServer,Awr as startDevServer};
|
|
634
|
+
`);return Ot?(_.originalMessage=_.message,_.message=br):_=new Error(br),_.shortMessage=wt,_.command=k,_.escapedCommand=N,_.exitCode=S,_.signal=h,_.signalDescription=re,_.stdout=a,_.stderr=s,l!==void 0&&(_.all=l),"bufferedData"in _&&delete _.bufferedData,_.failed=!0,_.timedOut=!!B,_.isCanceled=q,_.killed=le&&!B,_},"makeError");var hpe=["stdin","stdout","stderr"],Qkr=t(a=>hpe.some(s=>a[s]!==void 0),"hasAlias"),k2t=t(a=>{if(!a)return;let{stdio:s}=a;if(s===void 0)return hpe.map(_=>a[_]);if(Qkr(a))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${hpe.map(_=>`\`${_}\``).join(", ")}`);if(typeof s=="string")return s;if(!Array.isArray(s))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof s}\``);let l=Math.max(s.length,hpe.length);return Array.from({length:l},(_,h)=>s[h])},"normalizeStdio");var O2t=Nd(I2t(),1);import Zkr from"os";var ewr=1e3*5,F2t=t((a,s="SIGTERM",l={})=>{let _=a(s);return twr(a,s,l,_),_},"spawnedKill"),twr=t((a,s,l,_)=>{if(!rwr(s,l,_))return;let h=iwr(l),S=setTimeout(()=>{a("SIGKILL")},h);S.unref&&S.unref()},"setKillTimeout"),rwr=t((a,{forceKillAfterTimeout:s},l)=>nwr(a)&&s!==!1&&l,"shouldForceKill"),nwr=t(a=>a===Zkr.constants.signals.SIGTERM||typeof a=="string"&&a.toUpperCase()==="SIGTERM","isSigterm"),iwr=t(({forceKillAfterTimeout:a=!0})=>{if(a===!0)return ewr;if(!Number.isFinite(a)||a<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${a}\` (${typeof a})`);return a},"getForceKillAfterTimeout"),L2t=t((a,s)=>{a.kill()&&(s.isCanceled=!0)},"spawnedCancel"),swr=t((a,s,l)=>{a.kill(s),l(Object.assign(new Error("Timed out"),{timedOut:!0,signal:s}))},"timeoutKill"),R2t=t((a,{timeout:s,killSignal:l="SIGTERM"},_)=>{if(s===0||s===void 0)return _;let h,S=new Promise((N,B)=>{h=setTimeout(()=>{swr(a,l,B)},s)}),k=_.finally(()=>{clearTimeout(h)});return Promise.race([S,k])},"setupTimeout"),M2t=t(({timeout:a})=>{if(a!==void 0&&(!Number.isFinite(a)||a<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${a}\` (${typeof a})`)},"validateTimeout"),j2t=t(async(a,{cleanup:s,detached:l},_)=>{if(!s||l)return _;let h=(0,O2t.default)(()=>{a.kill()});return _.finally(()=>{h()})},"setExitHandler");function B2t(a){return a!==null&&typeof a=="object"&&typeof a.pipe=="function"}t(B2t,"isStream");var wFe=Nd(J2t(),1),V2t=Nd(z2t(),1);var W2t=t((a,s)=>{s===void 0||a.stdin===void 0||(B2t(s)?s.pipe(a.stdin):a.stdin.end(s))},"handleInput"),H2t=t((a,{all:s})=>{if(!s||!a.stdout&&!a.stderr)return;let l=(0,V2t.default)();return a.stdout&&l.add(a.stdout),a.stderr&&l.add(a.stderr),l},"makeAllStream"),CFe=t(async(a,s)=>{if(a){a.destroy();try{return await s}catch(l){return l.bufferedData}}},"getBufferedData"),kFe=t((a,{encoding:s,buffer:l,maxBuffer:_})=>{if(!(!a||!l))return s?(0,wFe.default)(a,{encoding:s,maxBuffer:_}):wFe.default.buffer(a,{maxBuffer:_})},"getStreamPromise"),G2t=t(async({stdout:a,stderr:s,all:l},{encoding:_,buffer:h,maxBuffer:S},k)=>{let N=kFe(a,{encoding:_,buffer:h,maxBuffer:S}),B=kFe(s,{encoding:_,buffer:h,maxBuffer:S}),q=kFe(l,{encoding:_,buffer:h,maxBuffer:S*2});try{return await Promise.all([k,N,B,q])}catch(le){return Promise.all([{error:le,signal:le.signal,timedOut:le.timedOut},CFe(a,N),CFe(s,B),CFe(l,q)])}},"getSpawnedResult");var pwr=(async()=>{})().constructor.prototype,dwr=["then","catch","finally"].map(a=>[a,Reflect.getOwnPropertyDescriptor(pwr,a)]),DFe=t((a,s)=>{for(let[l,_]of dwr){let h=typeof s=="function"?(...S)=>Reflect.apply(_.value,s(),S):_.value.bind(s);Reflect.defineProperty(a,l,{..._,value:h})}return a},"mergePromise"),K2t=t(a=>new Promise((s,l)=>{a.on("exit",(_,h)=>{s({exitCode:_,signal:h})}),a.on("error",_=>{l(_)}),a.stdin&&a.stdin.on("error",_=>{l(_)})}),"getSpawnedPromise");var Y2t=t((a,s=[])=>Array.isArray(s)?[a,...s]:[a],"normalizeArgs"),mwr=/^[\w.-]+$/,hwr=/"/g,gwr=t(a=>typeof a!="string"||mwr.test(a)?a:`"${a.replace(hwr,'\\"')}"`,"escapeArg"),X2t=t((a,s)=>Y2t(a,s).join(" "),"joinCommand"),Q2t=t((a,s)=>Y2t(a,s).map(l=>gwr(l)).join(" "),"getEscapedCommand");var bwr=1e3*1e3*100,Swr=t(({env:a,extendEnv:s,preferLocal:l,localDir:_,execPath:h})=>{let S=s?{...Tpe.env,...a}:a;return l?v2t({env:S,cwd:_,execPath:h}):S},"getEnv"),Twr=t((a,s,l={})=>{let _=eTt.default._parse(a,s,l);return a=_.command,s=_.args,l=_.options,l={maxBuffer:bwr,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:l.cwd||Tpe.cwd(),execPath:Tpe.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...l},l.env=Swr(l),l.stdio=k2t(l),Tpe.platform==="win32"&&vwr.basename(a,".exe")==="cmd"&&s.unshift("/q"),{file:a,args:s,options:l,parsed:_}},"handleArguments"),PFe=t((a,s,l)=>typeof s!="string"&&!ywr.isBuffer(s)?l===void 0?void 0:"":a.stripFinalNewline?gFe(s):s,"handleOutput");function tTt(a,s,l){let _=Twr(a,s,l),h=X2t(a,s),S=Q2t(a,s);M2t(_.options);let k;try{k=Z2t.spawn(_.file,_.args,_.options)}catch(We){let Ne=new Z2t.ChildProcess,we=Promise.reject(SFe({error:We,stdout:"",stderr:"",all:"",command:h,escapedCommand:S,parsed:_,timedOut:!1,isCanceled:!1,killed:!1}));return DFe(Ne,we)}let N=K2t(k),B=R2t(k,_.options,N),q=j2t(k,_.options,B),le={isCanceled:!1};k.kill=F2t.bind(null,k.kill.bind(k)),k.cancel=L2t.bind(null,k,le);let re=S2t(t(async()=>{let[{error:We,exitCode:Ne,signal:we,timedOut:Ot},wt,br,Kr]=await G2t(k,_.options,q),ln=PFe(_.options,wt),hn=PFe(_.options,br),pr=PFe(_.options,Kr);if(We||Ne!==0||we!==null){let _r=SFe({error:We,exitCode:Ne,signal:we,stdout:ln,stderr:hn,all:pr,command:h,escapedCommand:S,parsed:_,timedOut:Ot,isCanceled:le.isCanceled||(_.options.signal?_.options.signal.aborted:!1),killed:k.killed});if(!_.options.reject)return _r;throw _r}return{command:h,escapedCommand:S,exitCode:0,stdout:ln,stderr:hn,all:pr,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}},"handlePromise"));return W2t(k,_.options.input),k.all=H2t(k,_.options),DFe(k,re)}t(tTt,"execa");import{existsSync as rTt,readFileSync as nTt}from"fs";import xpe from"path";async function Epe(a,s){if(a.__ZUPLO_LOG_LEVEL=process.env.__ZUPLO_LOG_LEVEL??process.env.LOG_LEVEL,a.__ZUPLO_LOG_FORMAT=process.env.__ZUPLO_LOG_FORMAT??process.env.LOG_FORMAT,a.LOG_LEVEL=process.env.LOG_LEVEL??process.env.LOG_LEVEL,a.LOG_FORMAT=process.env.LOG_FORMAT??process.env.LOG_FORMAT,a.GIT_SHA=process.env.GIT_SHA??await xwr(s),process.env.__ZUPLO_CONFIG&&(a.__ZUPLO_CONFIG=process.env.__ZUPLO_CONFIG),rTt(xpe.join(s,".env.zuplo"))){let l=nTt(xpe.join(s,".env.zuplo"),"utf8"),_=AFe.default.parse(l);for(let h of Object.keys(_))if(a[h]=_[h],h==="ZUPLO_SYSTEM_CONFIGURATIONS"){let S=Buffer.from(Xce.decode(_[h])).toString(),k=JSON.parse(S);for(let N of Object.keys(k))a[N]=k[N]}}if(rTt(xpe.join(s,".env"))){let l=nTt(xpe.join(s,".env"),"utf8"),_=AFe.default.parse(l);for(let h of Object.keys(_))a[h]=_[h]}for(let l of Object.keys(a))a[l]===void 0&&delete a[l];return a}t(Epe,"setEnvironment");async function xwr(a){let s="unknown";try{let{stdout:l}=await tTt("git",["rev-parse","HEAD"],{cwd:a});l.trim().length===40&&(s=l.trim())}catch{}return s}t(xwr,"getGitSha");async function wwr({buildId:a,output:s,sourceDirectory:l,bundledDir:_,port:h,binaryName:S,publicZuploEnvironmentVariables:k,logger:N,handleRuntimeStdio:B}){if(_){let le=zK.join(l,_,"modules.json");if(!Ewr(le))throw new Error("The bundled-dir does not contain a modules.json file.");let oe=await kwr(le,"utf-8").then(JSON.parse),re=await gce(l);return re.status===_O?new Promise((We,Ne)=>{q(re.config.compatibilityDate,zK.join(l,_),oe,We,B)().catch(we=>{N.error(we),Ne(we)})}):(N.warn("Failed to get Zuplo config. Using default compatibility date."),new Promise((We,Ne)=>{q(void 0,l,oe,We,B)().catch(we=>{N.error(we),Ne(we)})}))}else{let le=new iB({buildId:a,output:s,sourceDirectory:l,command:"dev",logger:N,generateSourceMaps:!0,publicZuploEnvironmentVariables:k??{ZUPLO_ENVIRONMENT_TYPE:"LOCAL_DEVELOPMENT"}});try{await le.start()}catch{N.info("Ran into irrecoverable error while building. Fix the error and rerun the command."),process.exit(1)}return new Promise((oe,re)=>{le.onReload((We,Ne)=>{(Ne||We&&We.errors&&We.errors.length>0)&&re(Ne??We?.errors),q(We?.compatibilityDate,zK.join(l,"dist"),Tj(l,We?.metafile),oe,B)().catch(we=>{N.error(we),re(we)})})})}function q(le,oe,re,We,Ne){return async()=>{let we={};await Epe(we,l);let Ot=new iTt.ZuploWorkerd({compatibilityDate:le,scriptDirectory:oe,modules:re,port:h??lh.DEV_SERVER_PORT,bindings:we,handleRuntimeStdio:Ne}),wt=S??"compiled-zup",br=zK.join(l,"dist");await Cwr(br,{recursive:!0}),await Ot.compileBinary({binaryPath:zK.join(l,"dist",wt)}),await Ot.dispose(),We(void 0)}}t(q,"compile")}t(wwr,"compileWorkerdServer");var aTt=Nd(nFe(),1);import Pwr from"path";import Dwr from"net";function sTt(a,s){return new Promise(l=>{let _=new Dwr.Socket;_.connect(s,a),_.on("connect",()=>{_.destroy(),l(!1)}),_.on("error",()=>{_.destroy(),l(!0)})})}t(sTt,"isPortAvailable");var Cpe=class{static{t(this,"WorkerdServer")}sourceDirectory;port;debugPort;buildWatcher;workerd;logger;handleRuntimeStdio;onReload;constructor(s){this.sourceDirectory=s.sourceDirectory,this.port=s.port??lh.DEV_SERVER_PORT,this.debugPort=s.debugPort,this.logger=s.logger,this.handleRuntimeStdio=s.handleRuntimeStdio,this.onReload=s.onReload,s.zupTestMode||(this.buildWatcher=new iB({...s,logger:this.logger,generateSourceMaps:!0,publicZuploEnvironmentVariables:s.publicZuploEnvironmentVariables??{ZUPLO_ENVIRONMENT_TYPE:"LOCAL_DEVELOPMENT"}}),this.buildWatcher.watchEnvFiles())}async start(){if(!await sTt("localhost",this.port))throw new Error(`Port ${this.port} is currently in use. Please use a different port.`);if(this.buildWatcher)try{await this.buildWatcher.start()}catch{this.logger?.info("Ran into irrecoverable error while starting watcher. Fix the error and restart the server."),process.exit(1)}await this.startOrReload(),this.buildWatcher?.onReload((l,_)=>{_||l&&l.errors&&l.errors.length>0||(this.onReload(l,_),this.startOrReload(l).catch(h=>{this.logger?.error(h)}))})}async startOrReload(s){try{let l={};await Epe(l,this.sourceDirectory),await this.workerd?.dispose(),this.workerd=new aTt.ZuploWorkerd({compatibilityDate:s?.compatibilityDate,scriptDirectory:Pwr.join(this.sourceDirectory,"dist"),modules:Tj(this.sourceDirectory,s?.metafile),port:this.port,inspectorPort:this.debugPort??void 0,bindings:l,handleRuntimeStdio:this.handleRuntimeStdio}),await this.workerd.serve()}catch{}}async stop(){await this.buildWatcher?.close(),await this.workerd?.dispose()}};async function Awr({sourceDirectory:a,port:s,debugPort:l,publicZuploEnvironmentVariables:_,logger:h,output:S,buildId:k,onReload:N,handleRuntimeStdio:B}){process.env.ZUPLO_IS_LOCAL_DEVELOPMENT="true";let q=new Cpe({sourceDirectory:a,command:"dev",port:s,debugPort:l,publicZuploEnvironmentVariables:_,logger:h,output:S,buildId:k,onReload:N,handleRuntimeStdio:B});await q.start();async function le(){await q.stop()}t(le,"handle"),process.on("SIGTERM",le),process.on("SIGINT",le)}t(Awr,"startDevServer");export{W7e as build,wwr as compileWorkerdServer,Awr as startDevServer};
|
|
633
635
|
/*! For license information please see customer.cli.minified.js.LEGAL.txt */
|
package/index.minified.js
CHANGED
|
@@ -554,10 +554,12 @@ Segment #${l}
|
|
|
554
554
|
//# sourceURL=${(0,pkr.pathToFileURL)(l)}
|
|
555
555
|
`;return s+h}async configure(s={embedVariables:!0}){let l=this.options.compatibilityDate??"2024-09-02";if(this.options.modules.length===0)throw new Error("No modules provided. Cannot run local dev server.");let _=this.options.modules.filter(k=>!k.endsWith(".js.map")).map(k=>{let N=_kr.default.join(this.options.scriptDirectory,k),j=(0,fkr.readFileSync)(N,"utf8"),q=this.withSourceURL(j,N);return{name:k,esModule:q}}).sort(k=>k.name==="./worker.js"?-1:1),h;s.embedVariables?h=Object.entries(this.options.bindings).map(([k,N])=>({name:k,json:JSON.stringify(N)})):h=Object.entries(this.options.bindings).map(([k])=>({name:k,fromEnvironment:k}));let S;return s.embedVariables?S=Object.entries(this.options.bindings).filter(([k])=>k.startsWith("ZUPLO_CACHE")).map(([k,N])=>({name:k,json:JSON.stringify(N)})):S=Object.entries(this.options.bindings).filter(([k])=>k.startsWith("ZUPLO_CACHE")).map(([k])=>({name:k,fromEnvironment:k})),{services:[{name:"zuplo-entry",worker:{modules:_,compatibilityDate:l,compatibilityFlags:["nodejs_compat"],bindings:h,cacheApiOutbound:{name:"zuplo-cache-extension"}}},{name:"zuplo-cache-extension",worker:{modules:[{name:"zuplo-cache-extension.js",esModule:mkr.ZUPLO_CACHE_EXTENSION}],bindings:S,compatibilityDate:l,compatibilityFlags:["nodejs_compat"]}},{name:"internet",network:{allow:["public","private"],deny:[],tlsOptions:{trustBrowserCas:!0,trustedCertificates:[]}}}],sockets:[{name:"http",address:`*:${this.options.port}`,http:{},service:{name:"zuplo-entry"}}]}}};iB.ZuploWorkerd=lFe});var FSt=vt((RJr,OSt)=>{OSt.exports=ISt;ISt.sync=gkr;var ASt=so("fs");function hkr(a,s){var l=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var _=0;_<l.length;_++){var h=l[_].toLowerCase();if(h&&a.substr(-h.length).toLowerCase()===h)return!0}return!1}t(hkr,"checkPathExt");function NSt(a,s,l){return!a.isSymbolicLink()&&!a.isFile()?!1:hkr(s,l)}t(NSt,"checkStat");function ISt(a,s,l){ASt.stat(a,function(_,h){l(_,_?!1:NSt(h,a,s))})}t(ISt,"isexe");function gkr(a,s){return NSt(ASt.statSync(a),a,s)}t(gkr,"sync")});var BSt=vt((jJr,jSt)=>{jSt.exports=RSt;RSt.sync=ykr;var LSt=so("fs");function RSt(a,s,l){LSt.stat(a,function(_,h){l(_,_?!1:MSt(h,s))})}t(RSt,"isexe");function ykr(a,s){return MSt(LSt.statSync(a),s)}t(ykr,"sync");function MSt(a,s){return a.isFile()&&vkr(a,s)}t(MSt,"checkStat");function vkr(a,s){var l=a.mode,_=a.uid,h=a.gid,S=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),k=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),N=parseInt("100",8),j=parseInt("010",8),q=parseInt("001",8),le=N|j,oe=l&q||l&j&&h===k||l&N&&_===S||l&le&&S===0;return oe}t(vkr,"checkMode")});var $St=vt(($Jr,USt)=>{var UJr=so("fs"),_pe;process.platform==="win32"||global.TESTING_WINDOWS?_pe=FSt():_pe=BSt();USt.exports=fFe;fFe.sync=bkr;function fFe(a,s,l){if(typeof s=="function"&&(l=s,s={}),!l){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(_,h){fFe(a,s||{},function(S,k){S?h(S):_(k)})})}_pe(a,s||{},function(_,h){_&&(_.code==="EACCES"||s&&s.ignoreErrors)&&(_=null,h=!1),l(_,h)})}t(fFe,"isexe");function bkr(a,s){try{return _pe.sync(a,s||{})}catch(l){if(s&&s.ignoreErrors||l.code==="EACCES")return!1;throw l}}t(bkr,"sync")});var GSt=vt((qJr,HSt)=>{var sB=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",JSt=so("path"),Skr=sB?";":":",qSt=$St(),zSt=t(a=>Object.assign(new Error(`not found: ${a}`),{code:"ENOENT"}),"getNotFoundError"),VSt=t((a,s)=>{let l=s.colon||Skr,_=a.match(/\//)||sB&&a.match(/\\/)?[""]:[...sB?[process.cwd()]:[],...(s.path||process.env.PATH||"").split(l)],h=sB?s.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",S=sB?h.split(l):[""];return sB&&a.indexOf(".")!==-1&&S[0]!==""&&S.unshift(""),{pathEnv:_,pathExt:S,pathExtExe:h}},"getPathInfo"),WSt=t((a,s,l)=>{typeof s=="function"&&(l=s,s={}),s||(s={});let{pathEnv:_,pathExt:h,pathExtExe:S}=VSt(a,s),k=[],N=t(q=>new Promise((le,oe)=>{if(q===_.length)return s.all&&k.length?le(k):oe(zSt(a));let re=_[q],We=/^".*"$/.test(re)?re.slice(1,-1):re,Ne=JSt.join(We,a),we=!We&&/^\.[\\\/]/.test(a)?a.slice(0,2)+Ne:Ne;le(j(we,q,0))}),"step"),j=t((q,le,oe)=>new Promise((re,We)=>{if(oe===h.length)return re(N(le+1));let Ne=h[oe];qSt(q+Ne,{pathExt:S},(we,Ot)=>{if(!we&&Ot)if(s.all)k.push(q+Ne);else return re(q+Ne);return re(j(q,le,oe+1))})}),"subStep");return l?N(0).then(q=>l(null,q),l):N(0)},"which"),Tkr=t((a,s)=>{s=s||{};let{pathEnv:l,pathExt:_,pathExtExe:h}=VSt(a,s),S=[];for(let k=0;k<l.length;k++){let N=l[k],j=/^".*"$/.test(N)?N.slice(1,-1):N,q=JSt.join(j,a),le=!j&&/^\.[\\\/]/.test(a)?a.slice(0,2)+q:q;for(let oe=0;oe<_.length;oe++){let re=le+_[oe];try{if(qSt.sync(re,{pathExt:h}))if(s.all)S.push(re);else return re}catch{}}}if(s.all&&S.length)return S;if(s.nothrow)return null;throw zSt(a)},"whichSync");HSt.exports=WSt;WSt.sync=Tkr});var YSt=vt((VJr,_Fe)=>{"use strict";var KSt=t((a={})=>{let s=a.env||process.env;return(a.platform||process.platform)!=="win32"?"PATH":Object.keys(s).reverse().find(_=>_.toUpperCase()==="PATH")||"Path"},"pathKey");_Fe.exports=KSt;_Fe.exports.default=KSt});var e2t=vt((HJr,ZSt)=>{"use strict";var XSt=so("path"),xkr=GSt(),Ekr=YSt();function QSt(a,s){let l=a.options.env||process.env,_=process.cwd(),h=a.options.cwd!=null,S=h&&process.chdir!==void 0&&!process.chdir.disabled;if(S)try{process.chdir(a.options.cwd)}catch{}let k;try{k=xkr.sync(a.command,{path:l[Ekr({env:l})],pathExt:s?XSt.delimiter:void 0})}catch{}finally{S&&process.chdir(_)}return k&&(k=XSt.resolve(h?a.options.cwd:"",k)),k}t(QSt,"resolveCommandAttempt");function Ckr(a){return QSt(a)||QSt(a,!0)}t(Ckr,"resolveCommand");ZSt.exports=Ckr});var t2t=vt((KJr,dFe)=>{"use strict";var pFe=/([()\][%!^"`<>&|;, *?])/g;function kkr(a){return a=a.replace(pFe,"^$1"),a}t(kkr,"escapeCommand");function wkr(a,s){return a=`${a}`,a=a.replace(/(\\*)"/g,'$1$1\\"'),a=a.replace(/(\\*)$/,"$1$1"),a=`"${a}"`,a=a.replace(pFe,"^$1"),s&&(a=a.replace(pFe,"^$1")),a}t(wkr,"escapeArgument");dFe.exports.command=kkr;dFe.exports.argument=wkr});var n2t=vt((XJr,r2t)=>{"use strict";r2t.exports=/^#!(.*)/});var s2t=vt((QJr,i2t)=>{"use strict";var Dkr=n2t();i2t.exports=(a="")=>{let s=a.match(Dkr);if(!s)return null;let[l,_]=s[0].replace(/#! ?/,"").split(" "),h=l.split("/").pop();return h==="env"?_:_?`${h} ${_}`:h}});var o2t=vt((ZJr,a2t)=>{"use strict";var mFe=so("fs"),Pkr=s2t();function Akr(a){let l=Buffer.alloc(150),_;try{_=mFe.openSync(a,"r"),mFe.readSync(_,l,0,150,0),mFe.closeSync(_)}catch{}return Pkr(l.toString())}t(Akr,"readShebang");a2t.exports=Akr});var f2t=vt((tqr,u2t)=>{"use strict";var Nkr=so("path"),c2t=e2t(),l2t=t2t(),Ikr=o2t(),Okr=process.platform==="win32",Fkr=/\.(?:com|exe)$/i,Lkr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Rkr(a){a.file=c2t(a);let s=a.file&&Ikr(a.file);return s?(a.args.unshift(a.file),a.command=s,c2t(a)):a.file}t(Rkr,"detectShebang");function Mkr(a){if(!Okr)return a;let s=Rkr(a),l=!Fkr.test(s);if(a.options.forceShell||l){let _=Lkr.test(s);a.command=Nkr.normalize(a.command),a.command=l2t.command(a.command),a.args=a.args.map(S=>l2t.argument(S,_));let h=[a.command].concat(a.args).join(" ");a.args=["/d","/s","/c",`"${h}"`],a.command=process.env.comspec||"cmd.exe",a.options.windowsVerbatimArguments=!0}return a}t(Mkr,"parseNonShell");function jkr(a,s,l){s&&!Array.isArray(s)&&(l=s,s=null),s=s?s.slice(0):[],l=Object.assign({},l);let _={command:a,args:s,options:l,file:void 0,original:{command:a,args:s}};return l.shell?_:Mkr(_)}t(jkr,"parse");u2t.exports=jkr});var d2t=vt((nqr,p2t)=>{"use strict";var hFe=process.platform==="win32";function gFe(a,s){return Object.assign(new Error(`${s} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${s} ${a.command}`,path:a.command,spawnargs:a.args})}t(gFe,"notFoundError");function Bkr(a,s){if(!hFe)return;let l=a.emit;a.emit=function(_,h){if(_==="exit"){let S=_2t(h,s,"spawn");if(S)return l.call(a,"error",S)}return l.apply(a,arguments)}}t(Bkr,"hookChildProcess");function _2t(a,s){return hFe&&a===1&&!s.file?gFe(s.original,"spawn"):null}t(_2t,"verifyENOENT");function Ukr(a,s){return hFe&&a===1&&!s.file?gFe(s.original,"spawnSync"):null}t(Ukr,"verifyENOENTSync");p2t.exports={hookChildProcess:Bkr,verifyENOENT:_2t,verifyENOENTSync:Ukr,notFoundError:gFe}});var g2t=vt((sqr,aB)=>{"use strict";var m2t=so("child_process"),yFe=f2t(),vFe=d2t();function h2t(a,s,l){let _=yFe(a,s,l),h=m2t.spawn(_.command,_.args,_.options);return vFe.hookChildProcess(h,_),h}t(h2t,"spawn");function $kr(a,s,l){let _=yFe(a,s,l),h=m2t.spawnSync(_.command,_.args,_.options);return h.error=h.error||vFe.verifyENOENTSync(h.status,_),h}t($kr,"spawnSync");aB.exports=h2t;aB.exports.spawn=h2t;aB.exports.sync=$kr;aB.exports._parse=yFe;aB.exports._enoent=vFe});var w2t=vt(($qr,gpe)=>{gpe.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&gpe.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&gpe.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var I2t=vt((Jqr,lB)=>{var od=global.process,A7=t(function(a){return a&&typeof a=="object"&&typeof a.removeListener=="function"&&typeof a.emit=="function"&&typeof a.reallyExit=="function"&&typeof a.listeners=="function"&&typeof a.kill=="function"&&typeof a.pid=="number"&&typeof a.on=="function"},"processOk");A7(od)?(D2t=so("assert"),oB=w2t(),P2t=/^win/i.test(od.platform),JK=so("events"),typeof JK!="function"&&(JK=JK.EventEmitter),od.__signal_exit_emitter__?Kg=od.__signal_exit_emitter__:(Kg=od.__signal_exit_emitter__=new JK,Kg.count=0,Kg.emitted={}),Kg.infinite||(Kg.setMaxListeners(1/0),Kg.infinite=!0),lB.exports=function(a,s){if(!A7(global.process))return function(){};D2t.equal(typeof a,"function","a callback must be provided for exit handler"),cB===!1&&CFe();var l="exit";s&&s.alwaysLast&&(l="afterexit");var _=t(function(){Kg.removeListener(l,a),Kg.listeners("exit").length===0&&Kg.listeners("afterexit").length===0&&ype()},"remove");return Kg.on(l,a),_},ype=t(function(){!cB||!A7(global.process)||(cB=!1,oB.forEach(function(s){try{od.removeListener(s,vpe[s])}catch{}}),od.emit=bpe,od.reallyExit=kFe,Kg.count-=1)},"unload"),lB.exports.unload=ype,N7=t(function(s,l,_){Kg.emitted[s]||(Kg.emitted[s]=!0,Kg.emit(s,l,_))},"emit"),vpe={},oB.forEach(function(a){vpe[a]=t(function(){if(A7(global.process)){var l=od.listeners(a);l.length===Kg.count&&(ype(),N7("exit",null,a),N7("afterexit",null,a),P2t&&a==="SIGHUP"&&(a="SIGINT"),od.kill(od.pid,a))}},"listener")}),lB.exports.signals=function(){return oB},cB=!1,CFe=t(function(){cB||!A7(global.process)||(cB=!0,Kg.count+=1,oB=oB.filter(function(s){try{return od.on(s,vpe[s]),!0}catch{return!1}}),od.emit=N2t,od.reallyExit=A2t)},"load"),lB.exports.load=CFe,kFe=od.reallyExit,A2t=t(function(s){A7(global.process)&&(od.exitCode=s||0,N7("exit",od.exitCode,null),N7("afterexit",od.exitCode,null),kFe.call(od,od.exitCode))},"processReallyExit"),bpe=od.emit,N2t=t(function(s,l){if(s==="exit"&&A7(global.process)){l!==void 0&&(od.exitCode=l);var _=bpe.apply(this,arguments);return N7("exit",od.exitCode,null),N7("afterexit",od.exitCode,null),_}else return bpe.apply(this,arguments)},"processEmit")):lB.exports=function(){return function(){}};var D2t,oB,P2t,JK,Kg,ype,N7,vpe,cB,CFe,kFe,A2t,bpe,N2t});var $2t=vt((Kqr,U2t)=>{"use strict";var{PassThrough:hwr}=so("stream");U2t.exports=a=>{a={...a};let{array:s}=a,{encoding:l}=a,_=l==="buffer",h=!1;s?h=!(l||_):l=l||"utf8",_&&(l=null);let S=new hwr({objectMode:h});l&&S.setEncoding(l);let k=0,N=[];return S.on("data",j=>{N.push(j),h?k=N.length:k+=j.length}),S.getBufferedValue=()=>s?N:_?Buffer.concat(N,k):N.join(""),S.getBufferedLength=()=>k,S}});var J2t=vt((Yqr,qK)=>{"use strict";var{constants:gwr}=so("buffer"),ywr=so("stream"),{promisify:vwr}=so("util"),bwr=$2t(),Swr=vwr(ywr.pipeline),Spe=class extends Error{static{t(this,"MaxBufferError")}constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}};async function wFe(a,s){if(!a)throw new Error("Expected a stream");s={maxBuffer:1/0,...s};let{maxBuffer:l}=s,_=bwr(s);return await new Promise((h,S)=>{let k=t(N=>{N&&_.getBufferedLength()<=gwr.MAX_LENGTH&&(N.bufferedData=_.getBufferedValue()),S(N)},"rejectPromise");(async()=>{try{await Swr(a,_),h()}catch(N){k(N)}})(),_.on("data",()=>{_.getBufferedLength()>l&&k(new Spe)})}),_.getBufferedValue()}t(wFe,"getStream");qK.exports=wFe;qK.exports.buffer=(a,s)=>wFe(a,{...s,encoding:"buffer"});qK.exports.array=(a,s)=>wFe(a,{...s,array:!0});qK.exports.MaxBufferError=Spe});var z2t=vt((Qqr,q2t)=>{"use strict";var{PassThrough:Twr}=so("stream");q2t.exports=function(){var a=[],s=new Twr({objectMode:!0});return s.setMaxListeners(0),s.add=l,s.isEmpty=_,s.on("unpipe",h),Array.prototype.slice.call(arguments).forEach(l),s;function l(S){return Array.isArray(S)?(S.forEach(l),this):(a.push(S),S.once("end",h.bind(null,S)),S.once("error",s.emit.bind(s,"error")),S.pipe(s,{end:!1}),this)}t(l,"add");function _(){return a.length==0}t(_,"isEmpty");function h(S){a=a.filter(function(k){return k!==S}),!a.length&&s.readable&&s.end()}t(h,"remove")}});var cTt=vt((rVr,oTt)=>{"use strict";function $wr(a){return a>=55296&&a<=56319}t($wr,"isHighSurrogate");function Jwr(a){return a>=56320&&a<=57343}t(Jwr,"isLowSurrogate");oTt.exports=t(function(s,l,_){if(typeof l!="string")throw new Error("Input must be string");for(var h=l.length,S=0,k,N,j=0;j<h;j+=1){if(k=l.charCodeAt(j),N=l[j],$wr(k)&&Jwr(l.charCodeAt(j+1))&&(j+=1,N+=l[j]),S+=s(N),S===_)return l.slice(0,j+1);if(S>_)return l.slice(0,j-N.length+1)}return l},"truncate")});var uTt=vt((iVr,lTt)=>{"use strict";var qwr=cTt(),zwr=Buffer.byteLength.bind(Buffer);lTt.exports=qwr.bind(null,zwr)});var _Tt=Lp(b6e(),1);function Koe(a,s){return{...s}}t(Koe,"getBuildFlags");var _O="Good",S6e="Warnings",pO="Failed",T6e="error",Yoe="warning",FS=class extends Error{static{t(this,"BuildIssueError")}issue;pluginName;constructor(s,l){super(s.message),this.issue=s,this.pluginName=l}};var Xoe=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});var $R=Object.freeze(["2023-03-14","2024-01-15","2024-03-14","2024-09-02"]);var Uit;(function(a){a[a.IS_STARTING=0]="IS_STARTING",a[a.STARTED=1]="STARTED",a[a.STOPPED=2]="STOPPED",a[a.ERRORED=3]="ERRORED"})(Uit||(Uit={}));var $it;(function(a){a.CLOUDFLARE="CLOUDFLARE",a.KNATIVE="KNATIVE"})($it||($it={}));var Qoe;(function(a){a.PRODUCTION="PRODUCTION",a.PREVIEW="PREVIEW",a.WORKING_COPY="WORKING_COPY"})(Qoe||(Qoe={}));var Jit;(function(a){a.FREE_V1="FREE_V1",a.PAY_GO_V1="PAY_GO_V1",a.BUILDER_V1="BUILDER_V1",a.BUSINESS_V1="BUSINESS_V1",a.CUSTOM="CUSTOM",a.EMPLOYEE="EMPLOYEE",a.CUSTOM_TRIAL_V1="CUSTOM_TRIAL_V1"})(Jit||(Jit={}));var qit;(function(a){a.GITHUB="GITHUB",a.GITLAB="GITLAB",a.BITBUCKET="BITBUCKET"})(qit||(qit={}));var zit;(function(a){a.PROCESSING="PROCESSING",a.SENT="SENT",a.ERROR="ERROR",a.MISCONFIGURED="MISCONFIGURED"})(zit||(zit={}));var Vit="x-zuplo",fDr=`${Vit}-path`,_Dr=`${Vit}-route`,JR="x-internal";var{toString:dDr}=Object.prototype,{propertyIsEnumerable:mDr}=Object.prototype;function x6e(a){return typeof a=="string"}t(x6e,"isString");function bE(a){return x6e(a)&&a.trim().length>0}t(bE,"isNonWhitespaceString");function Wit(a){return a===!0||a===!1}t(Wit,"isBoolean");function Zoe(a,s=!1){if(Wit(a))return a;if(x6e(a)){if(a.toLowerCase()==="true")return!0;if(a.toLowerCase()==="false")return!1;if(s)throw new TypeError(`Attempted to parse string to boolean, but received ${a} which cannot be parsed.`)}if(s)throw new TypeError(`Expected type of boolean, received type '${typeof a}'`);return!1}t(Zoe,"parseValueToBoolean");import{readFileSync as m2r}from"fs";import Cj,{dirname as h2r}from"path";import{fileURLToPath as g2r}from"url";var wy="config",ZW="schemas",Hit="assets";var ece="policies.json",tce="dev-portal.json",CYt="dev-portal";var kYt=".oas.json";var E6e="zuplo.jsonc",C6e="zuplo.json";var dO="dist",H4=".zuplo",rce="build.json";var nce="worker.ts",wYt="worker.js",DYt="worker.js.map";var Xst=Lp(gst(),1),dce=Lp(Kst(),1);import{readFile as vXt}from"fs/promises";import bXt from"path";var pce=` ${dce.default.gray("|")} `;async function Qst(a,s,l){await Promise.all(l.warnings.map(_=>Yst(a,s,_))),await Promise.all(l.errors.map(_=>Yst(a,s,_))),l.status==="Good"?s.info("Build succeeded"):l.status==="Warnings"?s.warn(`
|
|
556
556
|
Build succeeded with warnings`):l.status==="Failed"&&s.error(`
|
|
557
|
-
Failed to build API`)}t(Qst,"outputBuildResult");async function Yst(a,s,l){let _=
|
|
557
|
+
Failed to build API`)}t(Qst,"outputBuildResult");async function Yst(a,s,l){let _=[],h=l.severity==="error"?dce.default.red:dce.default.yellow,S=h(`${l.severity.toUpperCase()}: ${l.message}${l.detail?`
|
|
558
558
|
${pce}${l.detail.split(`
|
|
559
559
|
`).join(`
|
|
560
|
-
${pce}`)}`:""}`);_(S);let k=SXt(l.location??void 0);if(k&&_(`${pce}${h(`The error was found in the file: ${k}`)}`),
|
|
560
|
+
${pce}`)}`:""}`);_.push(S);let k=SXt(l.location??void 0);if(k&&_.push(`${pce}${h(`The error was found in the file: ${k}`)}`),l.location&&l.location.column!==0&&l.location.line!==0){let N=bXt.join(a,l.location.file),j=await vXt(N,"utf-8"),q=(0,Xst.codeFrameColumns)(j,{start:{line:l.location.line,column:l.location.column}},{highlightCode:!0,message:l.message,linesAbove:3,linesBelow:3});_.push(pce),_.push(q)}l.severity==="warning"?s.warn(_.join(`
|
|
561
|
+
`)):s.error(_.join(`
|
|
562
|
+
`))}t(Yst,"logIssue");function SXt(a){if(a&&a.file){let s=a.file;if(a.line)return`${s}:${a.line}`;if(a.column)return`${s}:${a.column}`}}t(SXt,"getFileLocation");var O1=class{static{t(this,"PluginResult")}errors=[];warnings=[];constructor(s){s&&this.errors.push(s)}};async function Zst(a,s){let l=[],_=[],h=new Map;for await(let S of a)try{let k=await S(s,h);if(_.push(...k.errors.map(N=>(N.pluginName===""&&(N.pluginName=S.name),N))),l.push(...k.warnings),k.errors.length>0)break}catch(k){k instanceof FS?_.push({...k.issue,pluginName:k.pluginName??"unknown"}):_.push(k);break}return{errors:_,warnings:l,data:h}}t(Zst,"runPlugins");import{performance as mce,PerformanceObserver as TXt}from"perf_hooks";var q6e=[];async function xXt(a,s){let l=mce.timerify(s),_=new TXt(h=>{let S=h.getEntries()[0];q6e.push({name:a,duration:S.duration}),_.disconnect()});return _.observe({entryTypes:["function"]}),l()}t(xXt,"timeFn");var EXt={mark:t(a=>{mce.mark(a)},"mark"),measure:t((a,s,l)=>{mce.measure(a,s,l)},"measure"),timeFn:xXt,report:t(()=>{q6e.length>0&&console.table(q6e)},"report"),getDuration:t(a=>{let s=mce.getEntriesByName(a);return s.length===0?0:s[0].duration},"getDuration")},kf=EXt;var z6e={};Fit(z6e,{UnsafePathError:()=>hce,deleteFile:()=>kXt,deleteFolder:()=>LXt,dirExists:()=>gce,ensureDirectoryExists:()=>AXt,fileExists:()=>CXt,getParentDirFilename:()=>IXt,isNotFileOrDirectory:()=>wXt,listFolderContents:()=>rat,listFolders:()=>PXt,mkdirForFilePathIfNotExits:()=>iat,mkdirIfNotExists:()=>nat,safePath:()=>NXt,tarFolderContent:()=>OXt,untar:()=>FXt});import eat from"child_process";import Y4 from"fs/promises";import K4 from"path";var tat=[".git","node_modules",".yarn",".DS_Store"];async function CXt(a){try{return(await Y4.stat(a)).isFile()}catch{return!1}}t(CXt,"fileExists");async function kXt(a,s){return await Y4.rm(a,s)}t(kXt,"deleteFile");async function gce(a){try{return(await Y4.stat(a)).isDirectory()}catch{return!1}}t(gce,"dirExists");async function wXt(a){try{return await Y4.stat(a),!1}catch{return!0}}t(wXt,"isNotFileOrDirectory");function DXt(a,s){let l=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),_=a.match(l);if(!_)return"";let h=a.split(_[0]);return h[1]===""?"":`/${h[1]}`}t(DXt,"getParentDirectory");async function PXt(a){if(!await gce(a))return[];let s=await Y4.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)tat.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(PXt,"listFolders");async function rat(a,s,l=!0){let _=DXt(a,s),h=await Y4.readdir(a,{withFileTypes:!0}),S=[];for await(let k of h)if(!tat.includes(k.name)||!l)if(k.isDirectory()){let N=await rat(K4.join(a,k.name),s,l);S.push(...N)}else S.push(K4.join(_,k.name));return S}t(rat,"listFolderContents");var nat=t(async a=>{if(await gce(a))return!0;await Y4.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),iat=t(async a=>{let s=K4.dirname(a);return nat(s)},"mkdirForFilePathIfNotExits"),AXt=iat,hce=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function NXt(a){let s=t(l=>{if(!l.startsWith(a))throw new hce("Resolved path is not part of the project.");return l},"ensureSafePath");return{resolve:t((...l)=>s(K4.resolve(...l)),"resolve")}}t(NXt,"safePath");function IXt(a){return`${K4.basename(K4.dirname(a))}/${K4.basename(a)}`}t(IXt,"getParentDirFilename");function OXt(a,s,l,_){let h=K4.join(_,l);return eat.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${h} ${s}`,{cwd:a}),h}t(OXt,"tarFolderContent");function FXt(a,s,l,_=!1){eat.execSync(`tar -xf ${s} ${_?"--strip-components=1 ":""}-C ${l}`,{cwd:a})}t(FXt,"untar");async function LXt(a){if(await gce(a))return await Y4.rm(a,{recursive:!0})}t(LXt,"deleteFolder");var yl=z6e;import{parse as RXt}from"jsonc-parser";import{readFile as MXt}from"fs/promises";import sat from"path";async function yce(a){let s=sat.join(a,E6e),l=sat.join(a,C6e),_=!1,h=s;await yl.fileExists(s)?(_=!0,h=s):await yl.fileExists(l)&&(_=!0,h=l);let S,k;if(_){let j=await MXt(h,"utf-8"),le=RXt(j,[]);if(typeof le!="object")return{status:pO,errors:[{message:"Invalid zuplo.jsonc file.",detail:"The zuplo.jsonc file is not a valid JSON object",pluginName:"buildData",severity:"error"}]};if("version"in le&&le.version!==1)return{status:pO,errors:[{message:"Invalid version set in zuplo.jsonc file.",detail:"version in zuplo.jsonc must be set to 1",pluginName:"buildData",severity:"error"}]};if("compatibilityDate"in le&&$R&&typeof le.compatibilityDate=="string"){if(!$R.includes(le.compatibilityDate)){let oe={message:"Invalid compatibilityDate set in zuplo.jsonc file.",detail:`compatibilityDate was set to ${le.compatibilityDate}. Valid compatibility dates are ${$R.join(", ")}`,pluginName:"buildData",severity:"error"};return{status:pO,errors:[oe]}}S=le.compatibilityDate}k=Koe(S,le.flags)}else k=Koe(void 0,void 0);return{status:_O,config:{version:1,compatibilityDate:S,flags:k}}}t(yce,"getZuploConfig");var F1=class extends Error{static{t(this,"CompilationError")}buildMessages;constructor(s){super("An error occurred during compilation."),this.buildMessages=Array.isArray(s)?s:[s]}toBuildResult(){return{content:"",errors:this.buildMessages}}};var jXt="[",BXt="]",UXt="{",$Xt="}",JXt=":",qXt=",",zXt="true",VXt="false",WXt="null",HXt="NaN",GXt="Infinity",W6e='"',sH=new Map([[34,W6e],[92,"\\"],[47,"/"],[98,"\b"],[110,`
|
|
561
563
|
`],[102,"\f"],[114,"\r"],[116," "]]),Sce=new Map([...sH,[118,"\v"],[48,"\0"]]),KXt=new Map([[W6e,W6e],["\\","\\"],["/","/"],["\b","b"],[`
|
|
562
564
|
`,"n"],["\f","f"],["\r","r"],[" ","t"]]),UPr=new Map([...KXt,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),bce=new Map([[jXt,"LBracket"],[BXt,"RBracket"],[UXt,"LBrace"],[$Xt,"RBrace"],[JXt,"Colon"],[qXt,"Comma"],[zXt,"Boolean"],[VXt,"Boolean"],[WXt,"Null"]]),vce=new Map([...bce,[HXt,"Number"],[GXt,"Number"]]),H6e=new Set([10,13,8232,8233]),qP=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:l,column:_,offset:h}){super(`${s} (${l}:${_})`),this.line=l,this.column=_,this.offset=h}},G6e=class extends qP{static{t(this,"UnexpectedChar")}constructor(s,l){super(`Unexpected character '${String.fromCharCode(s)}' found.`,l)}},K6e=class extends qP{static{t(this,"UnexpectedIdentifier")}constructor(s,l){super(`Unexpected identifier '${s}' found.`,l)}},hO=class extends qP{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},Tce=class extends qP{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},YXt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,XXt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,QXt=13,aat=10,Y6e=class{static{t(this,"CharCodeReader")}#r="";#n=1;#e=0;#t=-1;#s=!1;#p=-1;#a=!1;constructor(s){this.#r=s}#_(){this.#a||(this.#e++,this.#t++,this.#p=-1,this.#a=!0)}locate(){return{line:this.#n,column:this.#e,offset:this.#t}}next(){if(this.#t>=this.#r.length-1)return this.#_(),-1;this.#t++;let s=this.#r.charCodeAt(this.#t);return this.#s?(this.#n++,this.#e=1,this.#s=!1):this.#e++,s===QXt?(this.#s=!0,this.peek()===aat&&this.#t++):s===aat&&(this.#s=!0),this.#p=s,s}peek(){return this.#t===this.#r.length-1?-1:this.#r.charCodeAt(this.#t+1)}match(s){return s(this.peek())?(this.next(),!0):!1}current(){return this.#p}},ZXt="Infinity",eQt="NaN",tQt=new Set([116,102,110]),X6e=new Set([32,9,10,13]),oat=new Set([...X6e,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),rQt={mode:"json",ranges:!1},nQt=new Set(["true","false","null"]),S_={EOF:0,Number:1,String:2,Boolean:3,Null:4,NaN:5,Infinity:6,Identifier:7,Colon:20,LBrace:21,RBrace:22,LBracket:23,RBracket:24,Comma:25,LineComment:40,BlockComment:41};function JP(a){return a>=48&&a<=57}t(JP,"isDigit");function V6e(a){return JP(a)||a>=65&&a<=70||a>=97&&a<=102}t(V6e,"isHexDigit");function iQt(a){return a>=49&&a<=57}t(iQt,"isPositiveDigit");function sQt(a){return tQt.has(a)}t(sQt,"isKeywordStart");function lat(a){return JP(a)||a===46||a===45}t(lat,"isNumberStart");function aQt(a){return lat(a)||a===43}t(aQt,"isJSON5NumberStart");function cat(a,s){return a===34||s&&a===39}t(cat,"isStringStart");function uat(a){if(a===36||a===95||a===92||a>=97&&a<=122||a>=65&&a<=90||a===8204||a===8205)return!0;let s=String.fromCharCode(a);return YXt.test(s)}t(uat,"isJSON5IdentifierStart");function oQt(a){if(uat(a)||JP(a))return!0;let s=String.fromCharCode(a);return XXt.test(s)}t(oQt,"isJSON5IdentifierPart");var Q6e=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,l){this.#n=s,this.#r={...rQt,...l},this.#e=new Y6e(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?Sce.has.bind(Sce):sH.has.bind(sH),this.#c=this.#t?H6e.has.bind(H6e):()=>!1,this.#l=this.#t?_=>_===120:()=>!1,this.#i=this.#t?oat.has.bind(oat):X6e.has.bind(X6e)}#f(s,l=this.#e.locate()){throw new G6e(s,l)}#v(s,l=this.#e.locate()){throw new K6e(s,l)}#d(){throw new Tce(this.#e.locate())}#u(s,l,_,h){let S=_.offset+l,k=this.#r.ranges?{range:[_.offset,S]}:void 0;return{type:s,loc:{start:_,end:h||{line:_.line,column:_.column+l,offset:S}},...k}}#m(s){let l="",_;for(let h=0;h<s;h++){if(_=this.#e.peek(),V6e(_)){this.#e.next(),l+=String.fromCharCode(_);continue}this.#f(_)}return l}#g(s){let l="";do{if(l+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),l+=String.fromCharCode(s),l+=this.#m(4)),s=this.#e.peek(),!oQt(s))break;this.#e.next()}while(!0);return l}#C(s){let l=s,_=1;for(s=this.#e.peek();s!==-1&&s!==l;){if(this.#e.next(),_++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),_++;else if(s===117){this.#e.next(),_++;let h=this.#m(4);_+=h.length}else if(this.#l(s)){this.#e.next(),_++;let h=this.#m(2);_+=h.length}else this.#t?(this.#e.next(),_++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),_++,_}#x(s){let l=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let _=this.#g(s);return _!==ZXt&&_!==eQt&&this.#f(s),l+_.length}JP(s)||this.#f(s),this.#e.next(),l++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),l++,s=this.#e.peek(),V6e(s)||(this.#e.next(),this.#f(s));do this.#e.next(),l++,s=this.#e.peek();while(V6e(s))}else JP(s)&&this.#f(s);else if(!this.#t||s!==46)for(iQt(s)||this.#f(s),s=this.#e.peek();JP(s);)this.#e.next(),l++,s=this.#e.peek();if(s===46){let _=-1;for(this.#e.next(),l++,_++,s=this.#e.peek();JP(s);)this.#e.next(),l++,_++,s=this.#e.peek();!this.#t&&_===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),l++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),l++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),JP(s)||(this.#e.next(),this.#f(s));JP(s);)this.#e.next(),l++,s=this.#e.peek();return l}#b(s){let l=1;if(s=this.#e.peek(),s===47){do this.#e.next(),l+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:l,multiline:!1}}if(s===42){for(this.#e.next(),l+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),l+=1,s=this.#e.peek(),s===47)return this.#e.next(),l+=1,{length:l,multiline:!0}}else this.#e.next(),l+=1;this.#e.next(),this.#d()}this.#e.next(),this.#f(s)}next(){let s=this.#e.next();for(;this.#i(s);)s=this.#e.next();if(s===-1)return S_.EOF;let l=this.#e.locate(),_=String.fromCharCode(s);if(this.#t)if(vce.has(_))this.#a=this.#u(vce.get(_),1,l);else if(uat(s)){let h=this.#g(s);vce.has(h)?this.#a=this.#u(vce.get(h),h.length,l):this.#a=this.#u("Identifier",h.length,l)}else if(aQt(s)){let h=this.#x(s);this.#a=this.#u("Number",h,l)}else if(cat(s,this.#t)){let h=this.#C(s),S=this.#e.locate();this.#a=this.#u("String",h,l,{line:S.line,column:S.column+1,offset:S.offset+1})}else if(s===47&&this.#s){let h=this.#b(s),S=this.#e.locate();this.#a=this.#u(h.multiline?"BlockComment":"LineComment",h.length,l,{line:S.line,column:S.column+1,offset:S.offset+1})}else this.#f(s);else if(bce.has(_))this.#a=this.#u(bce.get(_),1,l);else if(sQt(s)){let h=this.#g(s);nQt.has(h)||this.#v(h,l),this.#a=this.#u(bce.get(h),h.length,l)}else if(lat(s)){let h=this.#x(s);this.#a=this.#u("Number",h,l)}else if(cat(s,this.#t)){let h=this.#C(s);this.#a=this.#u("String",h,l)}else if(s===47&&this.#s){let h=this.#b(s),S=this.#e.locate();this.#a=this.#u(h.multiline?"BlockComment":"LineComment",h.length,l,{line:S.line,column:S.column+1,offset:S.offset+1})}else this.#f(s);return S_[this.#a.type]}get token(){return this.#a}};var dT={document(a,s={}){return{type:"Document",body:a,loc:s.loc,...s}},string(a,s={}){return{type:"String",value:a,loc:s.loc,...s}},number(a,s={}){return{type:"Number",value:a,loc:s.loc,...s}},boolean(a,s={}){return{type:"Boolean",value:a,loc:s.loc,...s}},null(a={}){return{type:"Null",loc:a.loc,...a}},array(a,s={}){return{type:"Array",elements:a,loc:s.loc,...s}},element(a,s={}){return{type:"Element",value:a,loc:s.loc,...s}},object(a,s={}){return{type:"Object",members:a,loc:s.loc,...s}},member(a,s,l={}){return{type:"Member",name:a,value:s,loc:l.loc,...l}},identifier(a,s={}){return{type:"Identifier",name:a,loc:s.loc,...s}},nan(a="",s={}){return{type:"NaN",sign:a,loc:s.loc,...s}},infinity(a="",s={}){return{type:"Infinity",sign:a,loc:s.loc,...s}}},cQt={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function lQt(a,s,l=!1){let _="",h=a.indexOf("\\"),S=0;for(;h>=0;){_+=a.slice(S,h);let k=a.charAt(h+1),N=k.charCodeAt(0);if(l&&Sce.has(N))_+=Sce.get(N),S=h+2;else if(sH.has(N))_+=sH.get(N),S=h+2;else if(k==="u"){let j=a.slice(h+2,h+6);if(j.length<4||/[^0-9a-f]/i.test(j))throw new qP(`Invalid unicode escape \\u${j}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});_+=String.fromCharCode(parseInt(j,16)),S=h+6}else if(l&&k==="x"){let j=a.slice(h+2,h+4);if(j.length<2||/[^0-9a-f]/i.test(j))throw new qP(`Invalid hex escape \\x${j}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});_+=String.fromCharCode(parseInt(j,16)),S=h+4}else if(l&&H6e.has(N))S=h+2,k==="\r"&&a.charAt(S)===`
|
|
563
565
|
`&&S++;else if(l)_+=k,S=h+2;else throw new qP(`Invalid escape \\${k}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});h=a.indexOf("\\",S)}return _+=a.slice(S),_}t(lQt,"getStringValue");function uQt(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return lQt(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(uQt,"getLiteralValue");function fat(a,s){s=Object.freeze({...cQt,...s});let l=[],_=new Q6e(a,{mode:s.mode,ranges:s.ranges}),h=s.mode==="json5",S=s.allowTrailingCommas||h;function k(){let pr=_.next();return pr&&s.tokens&&l.push(_.token),pr}t(k,"nextNoComments");function N(){let pr=_.next();return pr&&s.tokens&&l.push(_.token),pr>=S_.LineComment?N():pr}t(N,"nextSkipComments");let j=s.mode==="json"?k:N;function q(pr,_r){if(pr!==_r)throw new hO(_.token)}t(q,"assertTokenType");function le(pr,_r){if(!_r.includes(pr))throw new hO(_.token)}t(le,"assertTokenTypes");function oe(pr,_r){return s.ranges?{range:[pr.offset,_r.offset]}:void 0}t(oe,"createRange");function re(pr){let _r=_.token,ks=oe(_r.loc.start,_r.loc.end),Ci=uQt(a.slice(_r.loc.start.offset,_r.loc.end.offset),_r,h),Ti={loc:{start:{..._r.loc.start},end:{..._r.loc.end}},...ks};switch(pr){case S_.String:return dT.string(Ci,Ti);case S_.Number:return dT.number(Ci,Ti);case S_.Boolean:return dT.boolean(Ci,Ti);default:throw new TypeError(`Unknown token type ${_r.type}.`)}}t(re,"createLiteralNode");function We(pr){let _r=oe(pr.loc.start,pr.loc.end),ks=a.slice(pr.loc.start.offset,pr.loc.end.offset),Po={loc:{start:{...pr.loc.start},end:{...pr.loc.end}},..._r};if(pr.type!=="Identifier"){let Ti="";return(ks[0]==="+"||ks[0]==="-")&&(Ti=ks[0]),dT[ks.includes("NaN")?"nan":"infinity"](Ti,Po)}return dT.identifier(ks,Po)}t(We,"createJSON5IdentifierNode");function Ne(pr){let _r=oe(pr.loc.start,pr.loc.end);return dT.null({loc:{start:{...pr.loc.start},end:{...pr.loc.end}},..._r})}t(Ne,"createNullNode");function we(pr){h?le(pr,[S_.String,S_.Identifier,S_.Number]):q(pr,S_.String);let _r=_.token,ks=pr===S_.String?re(pr):We(_r);if(h&&(ks.type==="NaN"||ks.type==="Infinity")){if(ks.sign!=="")throw new hO(_.token);ks=dT.identifier(ks.type,{loc:ks.loc,...oe(ks.loc.start,ks.loc.end)})}pr=j(),q(pr,S_.Colon);let Ci=br(),Po=oe(ks.loc.start,Ci.loc.end);return dT.member(ks,Ci,{loc:{start:{...ks.loc.start},end:{...Ci.loc.end}},...Po})}t(we,"parseProperty");function Ot(pr){q(pr,S_.LBrace);let _r=_.token,ks=[],Ci=j();if(Ci!==S_.RBrace)do{if(ks.push(we(Ci)),Ci=j(),!Ci)throw new Tce(ks[ks.length-1].loc.end);if(Ci===S_.Comma){if(Ci=j(),S&&Ci===S_.RBrace)break}else break}while(Ci);q(Ci,S_.RBrace);let Po=_.token,Ti=oe(_r.loc.start,Po.loc.end);return dT.object(ks,{loc:{start:{..._r.loc.start},end:{...Po.loc.end}},...Ti})}t(Ot,"parseObject");function wt(pr){q(pr,S_.LBracket);let _r=_.token,ks=[],Ci=j();if(Ci!==S_.RBracket)do{let up=br(Ci);if(ks.push(dT.element(up,{loc:up.loc})),Ci=j(),Ci===S_.Comma){if(Ci=j(),S&&Ci===S_.RBracket)break}else break}while(Ci);q(Ci,S_.RBracket);let Po=_.token,Ti=oe(_r.loc.start,Po.loc.end);return dT.array(ks,{loc:{start:{..._r.loc.start},end:{...Po.loc.end}},...Ti})}t(wt,"parseArray");function br(pr){pr=pr??j();let _r=_.token;switch(pr){case S_.String:case S_.Boolean:return re(pr);case S_.Number:if(h){let ks=a.slice(_r.loc.start.offset,_r.loc.end.offset);if((ks[0]==="+"||ks[0]==="-")&&(ks=ks.slice(1)),ks==="NaN"||ks==="Infinity")return We(_r)}return re(pr);case S_.Null:return Ne(_r);case S_.LBrace:return Ot(pr);case S_.LBracket:return wt(pr);default:throw new hO(_r)}}t(br,"parseValue");let Kr=br();if(j())throw new hO(_.token);let hn={loc:{start:{line:1,column:1,offset:0},end:{...Kr.loc.end}}};return s.tokens&&(hn.tokens=l),s.ranges&&(hn.range=[hn.loc.start.offset,hn.loc.end.offset]),dT.document(Kr,hn)}t(fat,"parse");var fQt=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function _at(a){return a&&typeof a=="object"}t(_at,"isObject");function _Qt(a){return _at(a)&&typeof a.type=="string"}t(_Qt,"isNode");function pQt(a,s){function l(_,h){typeof s.enter=="function"&&s.enter(_,h);for(let S of fQt.get(_.type)){let k=_[S];_at(k)&&(Array.isArray(k)?k.forEach(N=>l(N,_)):_Qt(k)&&l(k,_))}typeof s.exit=="function"&&s.exit(_,h)}t(l,"visitNode"),l(a)}t(pQt,"traverse");function pat(a,s=()=>!0){let l=[];return pQt(a,{enter(_,h){l.push({node:_,parent:h,phase:"enter"})},exit(_,h){l.push({node:_,parent:h,phase:"exit"})}}),l.filter(s).values()}t(pat,"iterator");import dQt from"fs/promises";var aH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),xce=t(async a=>{try{return await dQt.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),oH=t(async a=>{try{return fat(a)}catch(s){if(s.column&&s.line&&s.message){let l=aH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var dat=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let h=await xce(_),S=await mQt(h,_,s,l);if(S)return S}}catch{}},"getRouteLocationByValue"),mQt=t(async(a,s,l,_)=>{try{if(!a)return;let h=null,S=await oH(a);if(S){for(let{node:k}of pat(S))if(k.value&&k.value===l){h=k.loc;break}if(h!==null){let k=aH(a,h.start.line);return{file:s,line:h.start.line,column:h.start.column,length:h.end.column-h.start.column,lineText:k,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import mat from"fs/promises";import Ece from"path";var Z6e="schemas",eAe=".oas.json";var gO=t(async a=>(await mat.readdir(a)).map(l=>`${a}/${l}`).filter(l=>l.endsWith(eAe)).sort(),"getOpenApiFilesByAlphabetical"),HR=t(async a=>{let s=Ece.resolve(a,"config");return(await mat.readdir(s)).filter(_=>_.endsWith(eAe)).length>=1},"oasFileInProject");function cH(a,s,l,_,h,S,k){if(S.has(l))return;let N=_.get(l);S.set(l,h.length),h.push(l),tAe(rAe(l),s,N,_,h,S,k)}t(cH,"chaseRefs");function tAe(a,s,l,_,h,S,k){if(Array.isArray(l))for(let N of l)tAe(a,s,N,_,h,S,k);else if(typeof l=="object")for(let N in l){if(N==="$ref"){let j=l[N];k&&(l[N]=k(s,j)),cH(a,s,X4(a,j),_,h,S,k)}tAe(a,s,l[N],_,h,S,k)}}t(tAe,"lookForRefs");function X4(a,s){let l=s.indexOf("#");return l>=0?`${Ece.resolve(a,s.substring(0,l))}${s.substring(l)}`:Ece.resolve(Ece.dirname(a),s)}t(X4,"getFullyQualifiedRefName");function rAe(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(rAe,"getFilePathNameFromRefName");var CH=Lp(g4e(),1);var yT=Lp(g4e(),1);import{readFile as Zrr}from"fs/promises";var kO=class extends Error{static{t(this,"CustomResolveError")}},iN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,l){this.sourceDirectory=s,this.logger=l}dereference(s,l){return CH.$RefParser.dereference(s,{resolve:{json:!0,file:Xce(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:l?.onDereference}})}bundle(s){return CH.$RefParser.bundle(s,{resolve:{file:Xce(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return CH.$RefParser.parse(s,{resolve:{file:Xce(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return CH.$RefParser.resolve(s,{resolve:{file:Xce(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Xce(a,s){return{order:100,canRead(l){let _=rnr(l.url);if(!(_===void 0||_==="file"))return!1;let S;try{S=$ct(l.url)}catch(k){throw new kO(`Malformed URI: ${l.url}`,{cause:k})}try{yl.safePath(a).resolve(S)}catch(k){return s?.warn(k),!1}return!0},async read(l){let _;try{_=$ct(l.url)}catch(h){throw new kO(`Malformed URI: ${l.url}`,{cause:h})}try{return await Zrr(_)}catch(h){throw new kO(`Error opening file "${_}"`,{cause:h})}}}}t(Xce,"customResolver");var y4e=/^win/.test(globalThis.process?globalThis.process.platform:""),enr=/\//g,tnr=/^(\w{2,}):\/\//i,v4e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function rnr(a){let s=tnr.exec(a);if(s)return s[1].toLowerCase()}t(rnr,"getProtocol");function $ct(a,s){a=decodeURI(a);for(let _=0;_<v4e.length;_+=2)a=a.replace(v4e[_],v4e[_+1]);let l=a.substr(0,7).toLowerCase()==="file://";return l&&(a=a[7]==="/"?a.substr(8):a.substr(7),y4e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(l=!1,a=y4e?a:"/"+a)),y4e&&!l&&(a=a.replace(enr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t($ct,"toFileSystemPath");var Jct="YOUR_KEY_HERE";async function qct(a){let l=await new iN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),_=a.openApiDocPath.replace(a.sourceDirectory,"");return nnr({...a,relativeOpenApiPath:_},l)}t(qct,"buildPublicOpenApiFile");async function nnr(a,s){onr({relativeOpenApiPath:a.relativeOpenApiPath},s);let l=s;return l=snr(l),inr(l,a),l=anr(l,a),zct(l,"x-zuplo"),l}t(nnr,"buildRawOpenApiFile");function inr(a,{customDomain:s,deploymentName:l,environmentType:_}){let h;s?h=s:_&&l&&(h=_===Qoe.WORKING_COPY?`${l}.d2.zuplo.dev`:`${l}.zuplo.app`),h?a.servers=[{url:`https://${h}`}]:a.servers=void 0}t(inr,"addServerHost");function snr(a){if(!a.paths)return a;let{components:s}=a,l=s?{...s}:void 0,_=[];l&&l.parameters&&(_=Object.entries(l.parameters).reduce((S,[k,N])=>(JR in N&&Zoe(N[JR])&&(S.push(k),l.parameters&&delete l.parameters[k]),S),[]));let h=Object.entries(a.paths).reduce((S,[k,N])=>{if(!N)return S;let j={...N},q=["delete","get","head","patch","post","put","trace","options"];return q.forEach(le=>{let oe=N[le];if(!oe)return;if(Zoe(oe[JR])){delete j[le];return}let{parameters:re}=oe;if(!re)return;let We=re.filter(Ne=>{if(JR in Ne&&Zoe(Ne[JR]))return!1;if("$ref"in Ne){let we=Ne.$ref.split("/").pop();return we?!_.includes(we):!0}return!0});j[le]={...oe,parameters:We}}),q.some(le=>!!j[le])&&(S[k]=j),S},{});return{...a,paths:h,components:l}}t(snr,"removeHiddenRoutesAndParams");function anr(a,{policiesConfig:s}){if(!a.paths)return a;let l=Object.entries(a.paths).reduce((_,[h,S])=>{if(!S)return _;let k={...S};return[k.delete,k.get,k.head,k.patch,k.post,k.put,k.trace,k.options].forEach(N=>{if(!N)return;let j=N["x-zuplo-route"]?.policies?.inbound?.reduce((oe,re)=>{let We=s.policies?.find(({name:Ot})=>Ot===re);if(!We)return oe;if(!(We.handler.export==="CompositeInboundPolicy"))return oe.concat(re);let we=We.handler.options?.policies;return we?oe.concat(we):oe},[]),q=[];if(j&&j.forEach(oe=>{s.policies?.forEach(re=>{re.name===oe&&(re.handler.export==="ApiAuthKeyInboundPolicy"||re.handler.export==="ApiKeyInboundPolicy")&&!re.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&q.push(re)})}),q.length>0){let oe=q.length>0&&q[0].handler&&q[0].handler.options&&q[0].handler.options.authHeader?q[0].handler.options.authHeader:"Authorization",re=q.length>0&&q[0].handler&&q[0].handler.options&&(q[0].handler.options.authScheme||q[0].handler.options.authScheme==="")?q[0].handler.options.authScheme:"Bearer",We=re!==""?`${re} ${Jct}`:Jct,Ne={name:oe,in:"header",required:!0,example:We,schema:{type:"string"},description:`The \`${oe}\` header is used to authenticate with the API using your API key. Value is of the format \`${We}\`.`};N.parameters?N.parameters.some(br=>"name"in br&&br.name===Ne.name)||N.parameters.unshift(Ne):N.parameters=[Ne];let we={type:"http",scheme:re.toLowerCase()},Ot="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(br=>"name"in br&&br.type==="apiKey"||"type"in br&&br.type==="http"&&br.scheme===re)||(a.components.securitySchemes={...a.components.securitySchemes,[Ot]:we}):(a.components||(a.components={}),a.components.securitySchemes={[Ot]:we});let wt={[Ot]:[]};N.security?N.security.some(br=>br[Ot]!==void 0)||N.security.unshift(wt):N.security=[wt]}let le=[];if(j&&j.forEach(oe=>{s.policies?.forEach(re=>{re.name===oe&&(re.handler.export==="RateLimitInboundPolicy"||re.handler.export==="ComplexRateLimitInboundPolicy")&&le.push(re)})}),le.length>0){let oe={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},re={...oe,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:oe,RateLimitWithRetryAfter:re},N.responses||(N.responses={});let We=le.some(Ne=>Ne.handler.options?.headerMode!=="none");N.responses[429]||(N.responses[429]={$ref:We?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),_[h]=k,_},{});return{...a,paths:l}}t(anr,"enrichSpecWithZuploData");function zct(a,s){for(let l in a)l.startsWith(s)?delete a[l]:typeof a[l]=="object"&&zct(a[l],s)}t(zct,"removePropertiesByPrefix");function onr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new FS({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new FS({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new FS({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(onr,"assertIsZuploOpenApiSpec");function cnr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let q=0;q<s.length;q++)s[q]=255;for(let q=0;q<a.length;q++){let le=a.charAt(q),oe=le.charCodeAt(0);if(s[oe]!==255)throw new TypeError(le+" is ambiguous");s[oe]=q}let l=a.length,_=a.charAt(0),h=Math.log(l)/Math.log(256),S=Math.log(256)/Math.log(l);function k(q){if(q instanceof Uint8Array||(ArrayBuffer.isView(q)?q=new Uint8Array(q.buffer,q.byteOffset,q.byteLength):Array.isArray(q)&&(q=Uint8Array.from(q))),!(q instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(q.length===0)return"";let le=0,oe=0,re=0,We=q.length;for(;re!==We&&q[re]===0;)re++,le++;let Ne=(We-re)*S+1>>>0,we=new Uint8Array(Ne);for(;re!==We;){let br=q[re],Kr=0;for(let ln=Ne-1;(br!==0||Kr<oe)&&ln!==-1;ln--,Kr++)br+=256*we[ln]>>>0,we[ln]=br%l>>>0,br=br/l>>>0;if(br!==0)throw new Error("Non-zero carry");oe=Kr,re++}let Ot=Ne-oe;for(;Ot!==Ne&&we[Ot]===0;)Ot++;let wt=_.repeat(le);for(;Ot<Ne;++Ot)wt+=a.charAt(we[Ot]);return wt}t(k,"encode");function N(q){if(typeof q!="string")throw new TypeError("Expected String");if(q.length===0)return new Uint8Array;let le=0,oe=0,re=0;for(;q[le]===_;)oe++,le++;let We=(q.length-le)*h+1>>>0,Ne=new Uint8Array(We);for(;q[le];){let br=s[q.charCodeAt(le)];if(br===255)return;let Kr=0;for(let ln=We-1;(br!==0||Kr<re)&&ln!==-1;ln--,Kr++)br+=l*Ne[ln]>>>0,Ne[ln]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");re=Kr,le++}let we=We-re;for(;we!==We&&Ne[we]===0;)we++;let Ot=new Uint8Array(oe+(We-we)),wt=oe;for(;we!==We;)Ot[wt++]=Ne[we++];return Ot}t(N,"decodeUnsafe");function j(q){let le=N(q);if(le)return le;throw new Error("Non-base"+l+" character")}return t(j,"decode"),{encode:k,decodeUnsafe:N,decode:j}}t(cnr,"base");var Vct=cnr;var lnr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Qce=Vct(lnr);var b4e="2024-09-02",Wct=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function Hct(){return new vT({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:b4e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:Wct[b4e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(Hct,"getMockEnvironment");var vT=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=Hct()),this.#r}constructor({build:s,runtime:l}){let _;try{if(l.__ZUPLO_CONFIG){let h=atob(l.__ZUPLO_CONFIG);_=JSON.parse(h)}if(l.ZUPLO_SYSTEM_CONFIGURATIONS){let h=new TextDecoder().decode(Qce.decode(l.ZUPLO_SYSTEM_CONFIGURATIONS)),S=JSON.parse(h);for(let k of Object.keys(S))l[k]=S[k]}}catch(h){console.error("Failed to parse runtime configuration",h)}this.config=_??{},this.build=s,this.runtime=l,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var unr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function Gct(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!unr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(Gct,"isRestrictedEnvVariableName");function Kct(a){return!!a.startsWith("ZUPLO_")}t(Kct,"isZuploReadableEnvVariableName");var T4r=new Proxy({},{get(a,s){let l=String(s);switch(l){case"ZUPLO_ENVIRONMENT_TYPE":return vT.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return vT.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return vT.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return vT.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return vT.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return vT.instance.build.BUILD_ID}if(!(Gct(l)&&!Kct(l)))return vT.instance.runtime[l]}});function kH(a,s,l){return`_${GP(`${a}_${s}_${l}`)}`}t(kH,"getRawOperationDataIdentifierName");function S4e(a,s,l,_){return`_${GP(a.toLowerCase())}_${s.toLowerCase()}_${l.toLowerCase()}_${_.toLowerCase()}`}t(S4e,"getIdForParameterSchema");function T4e(a,s,l){return`_${GP(a.toLowerCase())}_${s.toLowerCase()}_rb_${GP(l.toLowerCase())}`}t(T4e,"getIdForRequestBodySchema");function wH(a,s){return`_${GP(a)}_${GP(s)}`}t(wH,"getIdForRefSchema");function GP(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(GP,"sanitizedIdentifierName");var wdt=Lp(But(),1);import Eue from"path";var qH=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,l,_,h,S){this.type=a,this.name=s,this.prefix=l,this.value=_,this.suffix=h,this.modifier=S}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},rar=/[$_\p{ID_Start}]/u,nar=/[$_\u200C\u200D\p{ID_Continue}]/u,hNe=".*";function iar(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(iar,"Re");function Jut(a,s=!1){let l=[],_=0;for(;_<a.length;){let h=a[_],S=t(function(k){if(!s)throw new TypeError(k);l.push({type:"INVALID_CHAR",index:_,value:a[_++]})},"c");if(h==="*"){l.push({type:"ASTERISK",index:_,value:a[_++]});continue}if(h==="+"||h==="?"){l.push({type:"OTHER_MODIFIER",index:_,value:a[_++]});continue}if(h==="\\"){l.push({type:"ESCAPED_CHAR",index:_++,value:a[_++]});continue}if(h==="{"){l.push({type:"OPEN",index:_,value:a[_++]});continue}if(h==="}"){l.push({type:"CLOSE",index:_,value:a[_++]});continue}if(h===":"){let k="",N=_+1;for(;N<a.length;){let j=a.substr(N,1);if(N===_+1&&rar.test(j)||N!==_+1&&nar.test(j)){k+=a[N++];continue}break}if(!k){S(`Missing parameter name at ${_}`);continue}l.push({type:"NAME",index:_,value:k}),_=N;continue}if(h==="("){let k=1,N="",j=_+1,q=!1;if(a[j]==="?"){S(`Pattern cannot start with "?" at ${j}`);continue}for(;j<a.length;){if(!iar(a[j],!1)){S(`Invalid character '${a[j]}' at ${j}.`),q=!0;break}if(a[j]==="\\"){N+=a[j++]+a[j++];continue}if(a[j]===")"){if(k--,k===0){j++;break}}else if(a[j]==="("&&(k++,a[j+1]!=="?")){S(`Capturing groups are not allowed at ${j}`),q=!0;break}N+=a[j++]}if(q)continue;if(k){S(`Unbalanced pattern at ${_}`);continue}if(!N){S(`Missing pattern at ${_}`);continue}l.push({type:"REGEX",index:_,value:N}),_=j;continue}l.push({type:"CHAR",index:_,value:a[_++]})}return l.push({type:"END",index:_,value:""}),l}t(Jut,"v");function qut(a,s={}){let l=Jut(a);s.delimiter??="/#?",s.prefixes??="./";let _=`[^${xT(s.delimiter)}]+?`,h=[],S=0,k=0,N="",j=new Set,q=t(Kr=>{if(k<l.length&&l[k].type===Kr)return l[k++].value},"a"),le=t(()=>q("OTHER_MODIFIER")??q("ASTERISK"),"f"),oe=t(Kr=>{let ln=q(Kr);if(ln!==void 0)return ln;let{type:hn,index:pr}=l[k];throw new TypeError(`Unexpected ${hn} at ${pr}, expected ${Kr}`)},"d"),re=t(()=>{let Kr="",ln;for(;ln=q("CHAR")??q("ESCAPED_CHAR");)Kr+=ln;return Kr},"T"),We=t(Kr=>Kr,"Se"),Ne=s.encodePart||We,we="",Ot=t(Kr=>{we+=Kr},"U"),wt=t(()=>{we.length&&(h.push(new qH(3,"","",Ne(we),"",3)),we="")},"$"),br=t((Kr,ln,hn,pr,_r)=>{let ks=3;switch(_r){case"?":ks=1;break;case"*":ks=0;break;case"+":ks=2;break}if(!ln&&!hn&&ks===3){Ot(Kr);return}if(wt(),!ln&&!hn){if(!Kr)return;h.push(new qH(3,"","",Ne(Kr),"",ks));return}let Ci;hn?hn==="*"?Ci=hNe:Ci=hn:Ci=_;let Po=2;Ci===_?(Po=1,Ci=""):Ci===hNe&&(Po=0,Ci="");let Ti;if(ln?Ti=ln:hn&&(Ti=S++),j.has(Ti))throw new TypeError(`Duplicate name '${Ti}'.`);j.add(Ti),h.push(new qH(Po,Ti,Ne(Kr),Ci,Ne(pr),ks))},"V");for(;k<l.length;){let Kr=q("CHAR"),ln=q("NAME"),hn=q("REGEX");if(!ln&&!hn&&(hn=q("ASTERISK")),ln||hn){let _r=Kr??"";s.prefixes.indexOf(_r)===-1&&(Ot(_r),_r=""),wt();let ks=le();br(_r,ln,hn,"",ks);continue}let pr=Kr??q("ESCAPED_CHAR");if(pr){Ot(pr);continue}if(q("OPEN")){let _r=re(),ks=q("NAME"),Ci=q("REGEX");!ks&&!Ci&&(Ci=q("ASTERISK"));let Po=re();oe("CLOSE");let Ti=le();br(_r,ks,Ci,Po,Ti);continue}wt(),oe("END")}return h}t(qut,"D");function xT(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xT,"S");function Uut(a){return a&&a.ignoreCase?"ui":"u"}t(Uut,"X");function sar(a,s,l){return zut(qut(a,l),s,l)}t(sar,"Z");function gM(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(gM,"k");function zut(a,s,l={}){l.delimiter??="/#?",l.prefixes??="./",l.sensitive??=!1,l.strict??=!1,l.end??=!0,l.start??=!0,l.endsWith="";let _=l.start?"^":"";for(let N of a){if(N.type===3){N.modifier===3?_+=xT(N.value):_+=`(?:${xT(N.value)})${gM(N.modifier)}`;continue}s&&s.push(N.name);let j=`[^${xT(l.delimiter)}]+?`,q=N.value;if(N.type===1?q=j:N.type===0&&(q=hNe),!N.prefix.length&&!N.suffix.length){N.modifier===3||N.modifier===1?_+=`(${q})${gM(N.modifier)}`:_+=`((?:${q})${gM(N.modifier)})`;continue}if(N.modifier===3||N.modifier===1){_+=`(?:${xT(N.prefix)}(${q})${xT(N.suffix)})`,_+=gM(N.modifier);continue}_+=`(?:${xT(N.prefix)}`,_+=`((?:${q})(?:`,_+=xT(N.suffix),_+=xT(N.prefix),_+=`(?:${q}))*)${xT(N.suffix)})`,N.modifier===0&&(_+="?")}let h=`[${xT(l.endsWith)}]|$`,S=`[${xT(l.delimiter)}]`;if(l.end)return l.strict||(_+=`${S}?`),l.endsWith.length?_+=`(?=${h})`:_+="$",new RegExp(_,Uut(l));l.strict||(_+=`(?:${S}(?=${h}))?`);let k=!1;if(a.length){let N=a[a.length-1];N.type===3&&N.modifier===3&&(k=l.delimiter.indexOf(N)>-1)}return k||(_+=`(?=${S}|${h})`),new RegExp(_,Uut(l))}t(zut,"F");var cN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},aar={delimiter:".",prefixes:"",sensitive:!0,strict:!0},oar={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function car(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(car,"J");function Vut(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(Vut,"Q");function lar(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(lar,"Ee");function Wut(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(Wut,"W");var Hut=["ftp","file","http","https","ws","wss"];function Gut(a){if(!a)return!0;for(let s of Hut)if(a.test(s))return!0;return!1}t(Gut,"N");function uar(a,s){if(a=Vut(a,"#"),s||a==="")return a;let l=new URL("https://example.com");return l.hash=a,l.hash?l.hash.substring(1,l.hash.length):""}t(uar,"te");function far(a,s){if(a=Vut(a,"?"),s||a==="")return a;let l=new URL("https://example.com");return l.search=a,l.search?l.search.substring(1,l.search.length):""}t(far,"re");function _ar(a,s){return s||a===""?a:Wut(a)?Xut(a):Yut(a)}t(_ar,"ne");function par(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.password=a,l.password}t(par,"se");function dar(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.username=a,l.username}t(dar,"ie");function mar(a,s,l){if(l||a==="")return a;if(s&&!Hut.includes(s))return new URL(`${s}:${a}`).pathname;let _=a[0]=="/";return a=new URL(_?a:"/-"+a,"https://example.com").pathname,_||(a=a.substring(2,a.length)),a}t(mar,"ae");function har(a,s,l){return Kut(s)===a&&(a=""),l||a===""?a:Qut(a)}t(har,"oe");function gar(a,s){return a=lar(a,":"),s||a===""?a:gNe(a)}t(gar,"ce");function Kut(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Kut,"_");function gNe(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(gNe,"y");function yar(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(yar,"le");function bar(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(bar,"fe");function Yut(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(Yut,"z");function Xut(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Xut,"j");function Qut(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(Qut,"K");function Sar(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Sar,"he");function Tar(a){return a===""?a:new URL(`data:${a}`).pathname}t(Tar,"ue");function xar(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(xar,"de");function Ear(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(Ear,"pe");var Car=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=Jut(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#k()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#D()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#C()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#x()?this.#d(3):(this.#E()||this.#y()||this.#k())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#x()&&this.#i(5,1);break;case 4:this.#x()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#w()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#k()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#k()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#k()&&this.#i(9,1);break;case 8:this.#k()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let l=this.#u(a);return l.value===s&&(l.type==="CHAR"||l.type==="ESCAPED_CHAR"||l.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#C(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#x(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#w(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#k(){return this.#m(this.#t,"#")}#D(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,cN),a.encodePart=gNe;let s=sar(this.#T(),void 0,a);this.#l=Gut(s)}},mNe=["protocol","username","password","hostname","port","pathname","search","hash"],oN="*";function $ut(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let l=new URL(a,s);return{protocol:l.protocol.substring(0,l.protocol.length-1),username:l.username,password:l.password,hostname:l.hostname,port:l.port,pathname:l.pathname,search:l.search!==""?l.search.substring(1,l.search.length):void 0,hash:l.hash!==""?l.hash.substring(1,l.hash.length):void 0}}t($ut,"ge");function ZP(a,s){return s?JH(a):a}t(ZP,"b");function $H(a,s,l){let _;if(typeof s.baseURL=="string")try{_=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=ZP(_.protocol.substring(0,_.protocol.length-1),l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=ZP(_.username,l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=ZP(_.password,l)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=ZP(_.hostname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=ZP(_.port,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=ZP(_.pathname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=ZP(_.search.substring(1,_.search.length),l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=ZP(_.hash.substring(1,_.hash.length),l))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=gar(s.protocol,l)),typeof s.username=="string"&&(a.username=dar(s.username,l)),typeof s.password=="string"&&(a.password=par(s.password,l)),typeof s.hostname=="string"&&(a.hostname=_ar(s.hostname,l)),typeof s.port=="string"&&(a.port=har(s.port,a.protocol,l)),typeof s.pathname=="string"){if(a.pathname=s.pathname,_&&!car(a.pathname,l)){let h=_.pathname.lastIndexOf("/");h>=0&&(a.pathname=ZP(_.pathname.substring(0,h+1),l)+a.pathname)}a.pathname=mar(a.pathname,a.protocol,l)}return typeof s.search=="string"&&(a.search=far(s.search,l)),typeof s.hash=="string"&&(a.hash=uar(s.hash,l)),a}t($H,"w");function JH(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(JH,"C");function kar(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(kar,"Oe");function war(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let l=".*",_=`[^${kar(s.delimiter)}]+?`,h=/[$_\u200C\u200D\p{ID_Continue}]/u,S="";for(let k=0;k<a.length;++k){let N=a[k];if(N.type===3){if(N.modifier===3){S+=JH(N.value);continue}S+=`{${JH(N.value)}}${gM(N.modifier)}`;continue}let j=N.hasCustomName(),q=!!N.suffix.length||!!N.prefix.length&&(N.prefix.length!==1||!s.prefixes.includes(N.prefix)),le=k>0?a[k-1]:null,oe=k<a.length-1?a[k+1]:null;if(!q&&j&&N.type===1&&N.modifier===3&&oe&&!oe.prefix.length&&!oe.suffix.length)if(oe.type===3){let re=oe.value.length>0?oe.value[0]:"";q=h.test(re)}else q=!oe.hasCustomName();if(!q&&!N.prefix.length&&le&&le.type===3){let re=le.value[le.value.length-1];q=s.prefixes.includes(re)}q&&(S+="{"),S+=JH(N.prefix),j&&(S+=`:${N.name}`),N.type===2?S+=`(${N.value})`:N.type===1?j||(S+=`(${_})`):N.type===0&&(!j&&(!le||le.type===3||le.modifier!==3||q||N.prefix!=="")?S+="*":S+=`(${l})`),N.type===1&&j&&N.suffix.length&&h.test(N.suffix[0])&&(S+="\\"),S+=JH(N.suffix),q&&(S+="}"),N.modifier!==3&&(S+=gM(N.modifier))}return S}t(war,"ke");var Zut=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,l){try{let _;if(typeof s=="string"?_=s:l=s,typeof a=="string"){let N=new Car(a);if(N.parse(),a=N.result,_===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=_}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(_)throw new TypeError("parameter 1 is not of type 'string'.")}typeof l>"u"&&(l={ignoreCase:!1});let h={ignoreCase:l.ignoreCase===!0},S={pathname:oN,protocol:oN,username:oN,password:oN,hostname:oN,port:oN,search:oN,hash:oN};this.#r=$H(S,a,!0),Kut(this.#r.protocol)===this.#r.port&&(this.#r.port="");let k;for(k of mNe){if(!(k in this.#r))continue;let N={},j=this.#r[k];switch(this.#e[k]=[],k){case"protocol":Object.assign(N,cN),N.encodePart=gNe;break;case"username":Object.assign(N,cN),N.encodePart=yar;break;case"password":Object.assign(N,cN),N.encodePart=bar;break;case"hostname":Object.assign(N,aar),Wut(j)?N.encodePart=Xut:N.encodePart=Yut;break;case"port":Object.assign(N,cN),N.encodePart=Qut;break;case"pathname":Gut(this.#n.protocol)?(Object.assign(N,oar,h),N.encodePart=Sar):(Object.assign(N,cN,h),N.encodePart=Tar);break;case"search":Object.assign(N,cN,h),N.encodePart=xar;break;case"hash":Object.assign(N,cN,h),N.encodePart=Ear;break}try{this.#s[k]=qut(j,N),this.#n[k]=zut(this.#s[k],this.#e[k],N),this.#t[k]=war(this.#s[k],N),this.#p=this.#p||this.#s[k].some(q=>q.type===2)}catch{throw new TypeError(`invalid ${k} pattern '${this.#r[k]}'.`)}}}catch(_){throw new TypeError(`Failed to construct 'URLPattern': ${_.message}`)}}test(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?l=$H(l,a,!1):l=$H(l,$ut(a,s),!1)}catch{return!1}let _;for(_ of mNe)if(!this.#n[_].exec(l[_]))return!1;return!0}exec(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?l=$H(l,a,!1):l=$H(l,$ut(a,s),!1)}catch{return null}let _={};s?_.inputs=[a,s]:_.inputs=[a];let h;for(h of mNe){let S=this.#n[h].exec(l[h]);if(!S)return null;let k={};for(let[N,j]of this.#e[h].entries())if(typeof j=="string"||typeof j=="number"){let q=S[N+1];k[j]=q}_[h]={input:l[h]??"",groups:k}}return _}static compareComponent(a,s,l){let _=t((N,j)=>{for(let q of["type","modifier","prefix","value","suffix"]){if(N[q]<j[q])return-1;if(N[q]!==j[q])return 1}return 0},"o"),h=new qH(3,"","","","",3),S=new qH(0,"","","","",3),k=t((N,j)=>{let q=0;for(;q<Math.min(N.length,j.length);++q){let le=_(N[q],j[q]);if(le)return le}return N.length===j.length?0:_(N[q]??h,j[q]??h)},"s");return!s.#t[a]&&!l.#t[a]?0:s.#t[a]&&!l.#t[a]?k(s.#s[a],[S]):!s.#t[a]&&l.#t[a]?k([S],l.#s[a]):k(s.#s[a],l.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=Zut);import{AssertionError as Dar}from"assert";function e6(a,s){if(a===!1)throw new Dar({message:s})}t(e6,"assert");var Ac;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Ac||(Ac={}));function yM(a){return a.type===Ac.Object}t(yM,"isAstObject");function t6(a){return a.type===Ac.Property}t(t6,"isAstProperty");function eft(a){return a.type===Ac.Array}t(eft,"isAstArray");function vM(a){return a.type===Ac.Literal}t(vM,"isAstLiteral");function OO(a){if(a===void 0)throw new Error("Node is undefined");if(!yM(a))throw new Error("Node is not object")}t(OO,"assertAstObject");import{findNodeAtLocation as Par,getNodeValue as Aar,printParseErrorCode as Nar,visit as Iar}from"jsonc-parser";var Oar={DEFAULT:{allowTrailingComma:!1}};function zH(a,s=[],l=Oar.DEFAULT){let _={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function h(j){_.type==="property"&&(_.length=j-_.offset,_=_.parent)}t(h,"ensurePropertyComplete");function S(j){return _.children?.push(j),j}t(S,"onValue"),Iar(a,{onObjectBegin:t((j,q,le)=>{_=S({type:"object",offset:j,length:-1,line:q+1,column:le+1,parent:_,children:[]})},"onObjectBegin"),onObjectProperty:t((j,q,le,oe,re)=>{_=S({type:"property",offset:q,length:-1,line:oe+1,column:re+1,parent:_,children:[]}),_.children?.push({type:"string",value:j,offset:q,length:le,line:oe,column:re,parent:_})},"onObjectProperty"),onObjectEnd:t((j,q)=>{h(j+q),_.length=j+q-_.offset,_=_.parent,h(j+q)},"onObjectEnd"),onArrayBegin:t((j,q,le,oe)=>{_=S({type:"array",offset:j,length:-1,line:le+1,column:oe+1,parent:_,children:[]})},"onArrayBegin"),onArrayEnd:t((j,q)=>{_.length=j+q-_.offset,_=_.parent,h(j+q)},"onArrayEnd"),onLiteralValue:t((j,q,le,oe,re)=>{S({type:Far(j),offset:q,length:le,line:oe+1,column:re+1,parent:_,value:j}),h(q+le)},"onLiteralValue"),onSeparator:t((j,q)=>{_.type==="property"&&(j===":"?_.colonOffset=q:j===","&&h(q))},"onSeparator"),onError:t((j,q,le,oe,re)=>{s.push({error:j,offset:q,length:le,line:oe+1,column:re+1})},"onError")},l);let N=_.children[0];return N&&delete N.parent,N}t(zH,"parse");function Far(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(Far,"getNodeType");function yNe(a,s){return Par(a,s)}t(yNe,"findNodeAtLocation");function VH(a){return Aar(a)}t(VH,"getNodeValue");function tft(a){return Nar(a)}t(tft,"printParseErrorCode");var WH=class{static{t(this,"AstAdapter")}parse(s){let _=zH(s,[]);if(_)return this.parseNode(_,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,l){switch(s.type){case"object":return this.createObject(s,l);case"array":return this.createArray(s,l);case"property":return this.createProperty(s,l);case"string":return this.createLiteral(s,l);case"number":return this.createLiteral(s,l);case"boolean":return this.createLiteral(s,l);case"null":return this.createLiteral(s,l)}}createLiteral(s,l){return{type:Ac.Literal,location:{line:s.line,column:s.column},parent:l,value:s.type==="null"?null:s.value}}createObject(s,l){let _={type:Ac.Object,children:[],parent:l,location:{line:s.line,column:s.column}};return s.children?.forEach(h=>{_.children.push(this.parseNode(h,_))}),_}createProperty(s,l){e6(s.children?.length===2,"Invalid property node");let _={type:Ac.Property,location:{line:s.line,column:s.column},parent:l,name:null,value:null};return _.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Ac.Identifier,parent:_},_.value=this.parseNode(s.children[1],_),_}createArray(s,l){let _={type:Ac.Array,location:{line:s.line,column:s.column},parent:l,children:[]};return s.children?.forEach(h=>_.children.push(this.parseNode(h,_))),_}};var NE={createLiteral:t((a,s)=>({type:Ac.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Ac.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Ac.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,l)=>{let _={type:Ac.Property,parent:l,name:null,value:s};return _.name={value:a,type:Ac.Identifier,parent:_},_.value.parent=_,_},"createProperty"),createArrayOfLiterals:t((a,s)=>{let l={type:Ac.Array,parent:s,children:[]};for(let _ of a)l.children.push(NE.createLiteral(_,l));return l},"createArrayOfLiterals")};var Lar=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,HH=class{static{t(this,"SourceGenerator")}generate(s){let l=[];return this.generateSource(l,s),l.join("")}generateSource(s,l){switch(l.type){case Ac.Array:return this.generateArray(s,l);case Ac.Object:return this.generateObject(s,l);case Ac.Property:return this.generateProperty(s,l);case Ac.Literal:return this.generateLiteral(s,l);case Ac.FunctionCall:return this.generateFunctionCall(s,l);case Ac.Identifier:return this.generateIdentifier(s,l);case Ac.Raw:return this.generateRaw(s,l);case Ac.TemplateString:return this.generateTemplateString(s,l)}}generateArray(s,l){s.push("["),l.children.map(_=>{this.generateSource(s,_),s.push(",")}),s.push("]")}generateObject(s,l){s.push("{"),l.children.forEach(_=>{this.generateSource(s,_),s.push(",")}),s.push("}")}generateProperty(s,l){this.generateIdentifier(s,l.name),s.push(":"),this.generateSource(s,l.value)}generateFunctionCall(s,l){s.push(l.name.value),s.push("("),l.children.forEach((_,h,S)=>{this.generateSource(s,_),h<S.length&&s.push(",")}),s.push(")")}generateRaw(s,l){s.push(l.value)}generateTemplateString(s,l){s.push("`"),s.push(l.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,l){if(l.value===null)return s.push("null");switch(typeof l.value){case"number":case"boolean":return s.push(`${l.value}`);case"string":{let _=l.value,h=JSON.stringify(_);return s.push(`${h}`)}}}generateIdentifier(s,l){let _=Lar.test(l.value)?l.value:`'${l.value}'`;s.push(_)}};import{parse as Rar}from"@swc/core";import Mar from"fs/promises";var rft=t(async a=>{let s=new Set;try{let l=await Mar.readFile(a,"utf-8");(await Rar(l,{syntax:"typescript"})).body.forEach(h=>{h.type==="ExportDefaultDeclaration"||h.type==="ExportDefaultExpression"?s.add("default"):h.type==="ExportDeclaration"&&h.declaration.type==="FunctionDeclaration"?s.add(h.declaration.identifier.value):h.type==="ExportDeclaration"&&h.declaration.type==="VariableDeclaration"&&h.declaration.declarations[0].id.type==="Identifier"&&s.add(h.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var nft={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var vNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var ift={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var bNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var SNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var gdt=Lp(Upt(),1),ydt=Lp(hdt(),1);var hue=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new ydt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,gdt.default)(this.ajv,{mode:"fast"})}addSchema(s,l){this.ajv.addSchema(s,l)}compile(s){let l=this.ajv.compile(s);return t(h=>({isValid:l(h),errors:this.toSimpleErrors(l.errors,h),warnings:[]}),"validator")}toSimpleErrors(s,l){let _=[];return s?.forEach(h=>{h.keyword==="enum"&&h.params.allowedValues&&Array.isArray(h.params.allowedValues)&&(h.message+=`; ${h.params.allowedValues.join(", ")}`),h.instancePath&&(h.instancePath=h.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let S={details:{}},k=h.instancePath.split("/");if(k.length>2){let j=k[1],q=k[2]?parseInt(k[2]):0,le=k[3],oe=isNaN(q)?void 0:l[j][q][le];S={details:{property:j,index:q,field:le,fieldValue:oe}}}if(h.keyword==="required"&&h.params.missingProperty&&h.instancePath&&(h.message=`A 'path' is missing required property '${h.params.missingProperty}'`),h.keyword==="additionalProperties"&&h.params.additionalProperty&&h.instancePath&&(h.message=`A 'path' should NOT include property '${h.params.additionalProperty}'`),h.keyword==="type"&&h.params.type&&h.instancePath){let j=h.instancePath.split("/"),q=j[j.length-1];h.message=`Value of property '${q}' must be '${h.params.type}'`}let N=Object.assign(h,S);_.push(N)}),_}};var yN=hue.instance;yN.addSchema(SNe,"route-configuration.schema.json");yN.addSchema(ift,"policy-configuration.schema.json");yN.addSchema(vNe,"policies.schema.json");yN.addSchema(bNe,"open-api-route-configuration.schema.json");yN.addSchema(nft,"fragments.schema.json");var SOr=yN.compile(SNe),vdt=yN.compile(bNe),RIe=yN.compile(vNe);var gue=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=RIe(s),this.results}};var yue=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=vdt(s),this.results}};import zpr from"path";var MIe=/\$import\((.*)\)/,vue=/\$env\((.*?)\)/g;var a6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,l,_,h){super(s),this.location={file:l,namespace:"",line:_?_.line:0,column:_?_.column:0,length:0,lineText:h??"",suggestion:""}}},qpr=t(a=>{let s=[],l=a;for(;l.parent;)s.push(l),l=l.parent;return s.reverse()},"invertTree"),vN=t((a,s)=>{if(!a)return!1;let l=qpr(a);return s.split("/").every((S,k)=>{let N=l[k];return N?S==="*"||t6(N)&&N.name.value===S?!0:S==="{}"?N.type===Ac.Object:S==="[]"?N.type===Ac.Array:!1:!1})},"testPosition");var bue=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),yM(s)?s.children.forEach(l=>{this.visitor(l)}):eft(s)?s.children.forEach(l=>{this.visitor(l)}):t6(s)&&this.visitor(s.value)}},bdt=t((a,s,l)=>_=>{if(!t6(_)||!vM(_.value)||typeof _.value.value!="string")return;if(!a.some(S=>vN(_,S))){vue.test(_.value.value)&&s.push(new a6("An $env() statement is not expected at this location.",l,_.location,_.value.value));return}let h=new RegExp(vue).exec(_.value.value);if(h?.length===2&&h[0]===_.value.value){let S={type:Ac.Raw,parent:null,value:`environment["${h[1]}"]`};_.value=S}else{let S=_.value.value.replaceAll(new RegExp(vue),(k,N)=>`\${environment["${N}"] ? environment["${N}"] : ""}`);S!==_.value.value&&(_.value=NE.createTemplateString(S,_))}},"getEnvStatementTransformer");var kG="config/routes.json",Vpr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Wpr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Sdt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Hpr="handler/{}/options/{}/rewritePattern",Gpr="handler/{}/options/{}/baseUrl",Sue=class extends bue{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let l=this.addedImports.get(s);if(!l)throw new Error("Import name is undefined. This should not happen.");return l}getImports(){let s=[];return this.addedImports.forEach((l,_)=>{s.push({name:l,path:_})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!t6(s)||!vM(s.value)||typeof s.value.value!="string")&&vN(s,Hpr)){if(!s.parent||!yM(s.parent)){this.errors.push(new a6("Invalid node, expected object",kG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Tdt(l)},h=NE.createProperty("__rewriteFunction",_,s);s.parent.children.push(h)}}rewriteForwardFunction(s){if(!(!t6(s)||!vM(s.value)||typeof s.value.value!="string")&&vN(s,Gpr)){if(!s.parent||!yM(s.parent)){this.errors.push(new a6("Invalid node, expected object",kG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Tdt(l)},h=NE.createProperty("__rewriteFunction",_,s);s.parent.children.push(h)}}replaceImportStatements(s){if(!t6(s)||!vM(s.value))return;let l=s.value.value;if(typeof l!="string")return;if(!Wpr.some(N=>vN(s,N))&&!Sdt.some(N=>vN(s,N))){if(MIe.test(l)){if(s.name.value==="$ref")return;this.errors.push(new a6("An $import() statement is not expected at this location.",kG,s.location,l))}return}let _=MIe.exec(l);if(Sdt.some(N=>vN(s,N))&&!_)return;if(!_){this.errors.push(new a6("Invalid $import() statement",kG,s.location,l));return}let h=_[1];h.startsWith(".")&&(h=zpr.join("..",h));let S=this.getImportName(h),k={type:Ac.Identifier,parent:s.parent,value:S};s.value=k}replaceEnvStatements=bdt(Vpr,this.errors,kG)};function Tdt(a){return`(request, context) => {
|
|
@@ -629,5 +631,5 @@ globstar while`,s,re,l,We,Ne),this.matchOne(s.slice(re),l.slice(We),_))return th
|
|
|
629
631
|
`:10,l=typeof a=="string"?"\r":13;return a[a.length-1]===s&&(a=a.slice(0,-1)),a[a.length-1]===l&&(a=a.slice(0,-1)),a}t(bFe,"stripFinalNewline");import dpe from"process";import $K from"path";import{fileURLToPath as y2t}from"url";function ppe(a={}){let{env:s=process.env,platform:l=process.platform}=a;return l!=="win32"?"PATH":Object.keys(s).reverse().find(_=>_.toUpperCase()==="PATH")||"Path"}t(ppe,"pathKey");var Jkr=t(({cwd:a=dpe.cwd(),path:s=dpe.env[ppe()],preferLocal:l=!0,execPath:_=dpe.execPath,addExecPath:h=!0}={})=>{let S=a instanceof URL?y2t(a):a,k=$K.resolve(S),N=[];return l&&qkr(N,k),h&&zkr(N,_,k),[...N,s].join($K.delimiter)},"npmRunPath"),qkr=t((a,s)=>{let l;for(;l!==s;)a.push($K.join(s,"node_modules/.bin")),l=s,s=$K.resolve(s,"..")},"applyPreferLocal"),zkr=t((a,s,l)=>{let _=s instanceof URL?y2t(s):s;a.push($K.resolve(l,_,".."))},"applyExecPath"),v2t=t(({env:a=dpe.env,...s}={})=>{a={...a};let l=ppe({env:a});return s.path=a[l],a[l]=Jkr(s),a},"npmRunPathEnv");var Vkr=t((a,s,l,_)=>{if(l==="length"||l==="prototype"||l==="arguments"||l==="caller")return;let h=Object.getOwnPropertyDescriptor(a,l),S=Object.getOwnPropertyDescriptor(s,l);!Wkr(h,S)&&_||Object.defineProperty(a,l,S)},"copyProperty"),Wkr=t(function(a,s){return a===void 0||a.configurable||a.writable===s.writable&&a.enumerable===s.enumerable&&a.configurable===s.configurable&&(a.writable||a.value===s.value)},"canCopyProperty"),Hkr=t((a,s)=>{let l=Object.getPrototypeOf(s);l!==Object.getPrototypeOf(a)&&Object.setPrototypeOf(a,l)},"changePrototype"),Gkr=t((a,s)=>`/* Wrapped ${a}*/
|
|
630
632
|
${s}`,"wrappedToString"),Kkr=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Ykr=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Xkr=t((a,s,l)=>{let _=l===""?"":`with ${l.trim()}() `,h=Gkr.bind(null,_,s.toString());Object.defineProperty(h,"name",Ykr),Object.defineProperty(a,"toString",{...Kkr,value:h})},"changeToString");function SFe(a,s,{ignoreNonConfigurable:l=!1}={}){let{name:_}=a;for(let h of Reflect.ownKeys(s))Vkr(a,s,h,l);return Hkr(a,s),Xkr(a,s,_),a}t(SFe,"mimicFunction");var mpe=new WeakMap,b2t=t((a,s={})=>{if(typeof a!="function")throw new TypeError("Expected a function");let l,_=0,h=a.displayName||a.name||"<anonymous>",S=t(function(...k){if(mpe.set(S,++_),_===1)l=a.apply(this,k),a=null;else if(s.throw===!0)throw new Error(`Function \`${h}\` can only be called once`);return l},"onetime");return SFe(S,a),mpe.set(S,_),S},"onetime");b2t.callCount=a=>{if(!mpe.has(a))throw new Error(`The given function \`${a.name}\` is not wrapped by the \`onetime\` package`);return mpe.get(a)};var S2t=b2t;import{constants as twr}from"os";var T2t=t(function(){let a=TFe-x2t+1;return Array.from({length:a},Qkr)},"getRealtimeSignals"),Qkr=t(function(a,s){return{name:`SIGRT${s+1}`,number:x2t+s,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}},"getRealtimeSignal"),x2t=34,TFe=64;import{constants as Zkr}from"os";var E2t=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var xFe=t(function(){let a=T2t();return[...E2t,...a].map(ewr)},"getSignals"),ewr=t(function({name:a,number:s,description:l,action:_,forced:h=!1,standard:S}){let{signals:{[a]:k}}=Zkr,N=k!==void 0;return{name:a,number:N?k:s,description:l,supported:N,action:_,forced:h,standard:S}},"normalizeSignal");var rwr=t(function(){return xFe().reduce(nwr,{})},"getSignalsByName"),nwr=t(function(a,{name:s,number:l,description:_,supported:h,action:S,forced:k,standard:N}){return{...a,[s]:{name:s,number:l,description:_,supported:h,action:S,forced:k,standard:N}}},"getSignalByName"),C2t=rwr(),iwr=t(function(){let a=xFe(),s=TFe+1,l=Array.from({length:s},(_,h)=>swr(h,a));return Object.assign({},...l)},"getSignalsByNumber"),swr=t(function(a,s){let l=awr(a,s);if(l===void 0)return{};let{name:_,description:h,supported:S,action:k,forced:N,standard:j}=l;return{[a]:{name:_,number:a,description:h,supported:S,action:k,forced:N,standard:j}}},"getSignalByNumber"),awr=t(function(a,s){let l=s.find(({name:_})=>twr.signals[_]===a);return l!==void 0?l:s.find(_=>_.number===a)},"findSignalByNumber"),Oqr=iwr();var owr=t(({timedOut:a,timeout:s,errorCode:l,signal:_,signalDescription:h,exitCode:S,isCanceled:k})=>a?`timed out after ${s} milliseconds`:k?"was canceled":l!==void 0?`failed with ${l}`:_!==void 0?`was killed with ${_} (${h})`:S!==void 0?`failed with exit code ${S}`:"failed","getErrorPrefix"),EFe=t(({stdout:a,stderr:s,all:l,error:_,signal:h,exitCode:S,command:k,escapedCommand:N,timedOut:j,isCanceled:q,killed:le,parsed:{options:{timeout:oe}}})=>{S=S===null?void 0:S,h=h===null?void 0:h;let re=h===void 0?void 0:C2t[h].description,We=_&&_.code,we=`Command ${owr({timedOut:j,timeout:oe,errorCode:We,signal:h,signalDescription:re,exitCode:S,isCanceled:q})}: ${k}`,Ot=Object.prototype.toString.call(_)==="[object Error]",wt=Ot?`${we}
|
|
631
633
|
${_.message}`:we,br=[wt,s,a].filter(Boolean).join(`
|
|
632
|
-
`);return Ot?(_.originalMessage=_.message,_.message=br):_=new Error(br),_.shortMessage=wt,_.command=k,_.escapedCommand=N,_.exitCode=S,_.signal=h,_.signalDescription=re,_.stdout=a,_.stderr=s,l!==void 0&&(_.all=l),"bufferedData"in _&&delete _.bufferedData,_.failed=!0,_.timedOut=!!j,_.isCanceled=q,_.killed=le&&!j,_},"makeError");var hpe=["stdin","stdout","stderr"],cwr=t(a=>hpe.some(s=>a[s]!==void 0),"hasAlias"),k2t=t(a=>{if(!a)return;let{stdio:s}=a;if(s===void 0)return hpe.map(_=>a[_]);if(cwr(a))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${hpe.map(_=>`\`${_}\``).join(", ")}`);if(typeof s=="string")return s;if(!Array.isArray(s))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof s}\``);let l=Math.max(s.length,hpe.length);return Array.from({length:l},(_,h)=>s[h])},"normalizeStdio");var O2t=Lp(I2t(),1);import lwr from"os";var uwr=1e3*5,F2t=t((a,s="SIGTERM",l={})=>{let _=a(s);return fwr(a,s,l,_),_},"spawnedKill"),fwr=t((a,s,l,_)=>{if(!_wr(s,l,_))return;let h=dwr(l),S=setTimeout(()=>{a("SIGKILL")},h);S.unref&&S.unref()},"setKillTimeout"),_wr=t((a,{forceKillAfterTimeout:s},l)=>pwr(a)&&s!==!1&&l,"shouldForceKill"),pwr=t(a=>a===lwr.constants.signals.SIGTERM||typeof a=="string"&&a.toUpperCase()==="SIGTERM","isSigterm"),dwr=t(({forceKillAfterTimeout:a=!0})=>{if(a===!0)return uwr;if(!Number.isFinite(a)||a<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${a}\` (${typeof a})`);return a},"getForceKillAfterTimeout"),L2t=t((a,s)=>{a.kill()&&(s.isCanceled=!0)},"spawnedCancel"),mwr=t((a,s,l)=>{a.kill(s),l(Object.assign(new Error("Timed out"),{timedOut:!0,signal:s}))},"timeoutKill"),R2t=t((a,{timeout:s,killSignal:l="SIGTERM"},_)=>{if(s===0||s===void 0)return _;let h,S=new Promise((N,j)=>{h=setTimeout(()=>{mwr(a,l,j)},s)}),k=_.finally(()=>{clearTimeout(h)});return Promise.race([S,k])},"setupTimeout"),M2t=t(({timeout:a})=>{if(a!==void 0&&(!Number.isFinite(a)||a<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${a}\` (${typeof a})`)},"validateTimeout"),j2t=t(async(a,{cleanup:s,detached:l},_)=>{if(!s||l)return _;let h=(0,O2t.default)(()=>{a.kill()});return _.finally(()=>{h()})},"setExitHandler");function B2t(a){return a!==null&&typeof a=="object"&&typeof a.pipe=="function"}t(B2t,"isStream");var AFe=Lp(J2t(),1),V2t=Lp(z2t(),1);var W2t=t((a,s)=>{s===void 0||a.stdin===void 0||(B2t(s)?s.pipe(a.stdin):a.stdin.end(s))},"handleInput"),H2t=t((a,{all:s})=>{if(!s||!a.stdout&&!a.stderr)return;let l=(0,V2t.default)();return a.stdout&&l.add(a.stdout),a.stderr&&l.add(a.stderr),l},"makeAllStream"),DFe=t(async(a,s)=>{if(a){a.destroy();try{return await s}catch(l){return l.bufferedData}}},"getBufferedData"),PFe=t((a,{encoding:s,buffer:l,maxBuffer:_})=>{if(!(!a||!l))return s?(0,AFe.default)(a,{encoding:s,maxBuffer:_}):AFe.default.buffer(a,{maxBuffer:_})},"getStreamPromise"),G2t=t(async({stdout:a,stderr:s,all:l},{encoding:_,buffer:h,maxBuffer:S},k)=>{let N=PFe(a,{encoding:_,buffer:h,maxBuffer:S}),j=PFe(s,{encoding:_,buffer:h,maxBuffer:S}),q=PFe(l,{encoding:_,buffer:h,maxBuffer:S*2});try{return await Promise.all([k,N,j,q])}catch(le){return Promise.all([{error:le,signal:le.signal,timedOut:le.timedOut},DFe(a,N),DFe(s,j),DFe(l,q)])}},"getSpawnedResult");var xwr=(async()=>{})().constructor.prototype,Ewr=["then","catch","finally"].map(a=>[a,Reflect.getOwnPropertyDescriptor(xwr,a)]),NFe=t((a,s)=>{for(let[l,_]of Ewr){let h=typeof s=="function"?(...S)=>Reflect.apply(_.value,s(),S):_.value.bind(s);Reflect.defineProperty(a,l,{..._,value:h})}return a},"mergePromise"),K2t=t(a=>new Promise((s,l)=>{a.on("exit",(_,h)=>{s({exitCode:_,signal:h})}),a.on("error",_=>{l(_)}),a.stdin&&a.stdin.on("error",_=>{l(_)})}),"getSpawnedPromise");var Y2t=t((a,s=[])=>Array.isArray(s)?[a,...s]:[a],"normalizeArgs"),Cwr=/^[\w.-]+$/,kwr=/"/g,wwr=t(a=>typeof a!="string"||Cwr.test(a)?a:`"${a.replace(kwr,'\\"')}"`,"escapeArg"),X2t=t((a,s)=>Y2t(a,s).join(" "),"joinCommand"),Q2t=t((a,s)=>Y2t(a,s).map(l=>wwr(l)).join(" "),"getEscapedCommand");var Awr=1e3*1e3*100,Nwr=t(({env:a,extendEnv:s,preferLocal:l,localDir:_,execPath:h})=>{let S=s?{...Tpe.env,...a}:a;return l?v2t({env:S,cwd:_,execPath:h}):S},"getEnv"),Iwr=t((a,s,l={})=>{let _=eTt.default._parse(a,s,l);return a=_.command,s=_.args,l=_.options,l={maxBuffer:Awr,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:l.cwd||Tpe.cwd(),execPath:Tpe.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...l},l.env=Nwr(l),l.stdio=k2t(l),Tpe.platform==="win32"&&Pwr.basename(a,".exe")==="cmd"&&s.unshift("/q"),{file:a,args:s,options:l,parsed:_}},"handleArguments"),IFe=t((a,s,l)=>typeof s!="string"&&!Dwr.isBuffer(s)?l===void 0?void 0:"":a.stripFinalNewline?bFe(s):s,"handleOutput");function tTt(a,s,l){let _=Iwr(a,s,l),h=X2t(a,s),S=Q2t(a,s);M2t(_.options);let k;try{k=Z2t.spawn(_.file,_.args,_.options)}catch(We){let Ne=new Z2t.ChildProcess,we=Promise.reject(EFe({error:We,stdout:"",stderr:"",all:"",command:h,escapedCommand:S,parsed:_,timedOut:!1,isCanceled:!1,killed:!1}));return NFe(Ne,we)}let N=K2t(k),j=R2t(k,_.options,N),q=j2t(k,_.options,j),le={isCanceled:!1};k.kill=F2t.bind(null,k.kill.bind(k)),k.cancel=L2t.bind(null,k,le);let re=S2t(t(async()=>{let[{error:We,exitCode:Ne,signal:we,timedOut:Ot},wt,br,Kr]=await G2t(k,_.options,q),ln=IFe(_.options,wt),hn=IFe(_.options,br),pr=IFe(_.options,Kr);if(We||Ne!==0||we!==null){let _r=EFe({error:We,exitCode:Ne,signal:we,stdout:ln,stderr:hn,all:pr,command:h,escapedCommand:S,parsed:_,timedOut:Ot,isCanceled:le.isCanceled||(_.options.signal?_.options.signal.aborted:!1),killed:k.killed});if(!_.options.reject)return _r;throw _r}return{command:h,escapedCommand:S,exitCode:0,stdout:ln,stderr:hn,all:pr,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}},"handlePromise"));return W2t(k,_.options.input),k.all=H2t(k,_.options),NFe(k,re)}t(tTt,"execa");import{existsSync as rTt,readFileSync as nTt}from"fs";import xpe from"path";async function Epe(a,s){if(a.__ZUPLO_LOG_LEVEL=process.env.__ZUPLO_LOG_LEVEL??process.env.LOG_LEVEL,a.__ZUPLO_LOG_FORMAT=process.env.__ZUPLO_LOG_FORMAT??process.env.LOG_FORMAT,a.LOG_LEVEL=process.env.LOG_LEVEL??process.env.LOG_LEVEL,a.LOG_FORMAT=process.env.LOG_FORMAT??process.env.LOG_FORMAT,a.GIT_SHA=process.env.GIT_SHA??await Owr(s),process.env.__ZUPLO_CONFIG&&(a.__ZUPLO_CONFIG=process.env.__ZUPLO_CONFIG),rTt(xpe.join(s,".env.zuplo"))){let l=nTt(xpe.join(s,".env.zuplo"),"utf8"),_=OFe.default.parse(l);for(let h of Object.keys(_))if(a[h]=_[h],h==="ZUPLO_SYSTEM_CONFIGURATIONS"){let S=Buffer.from(Qce.decode(_[h])).toString(),k=JSON.parse(S);for(let N of Object.keys(k))a[N]=k[N]}}if(rTt(xpe.join(s,".env"))){let l=nTt(xpe.join(s,".env"),"utf8"),_=OFe.default.parse(l);for(let h of Object.keys(_))a[h]=_[h]}for(let l of Object.keys(a))a[l]===void 0&&delete a[l];return a}t(Epe,"setEnvironment");async function Owr(a){let s="unknown";try{let{stdout:l}=await tTt("git",["rev-parse","HEAD"],{cwd:a});l.trim().length===40&&(s=l.trim())}catch{}return s}t(Owr,"getGitSha");async function Mwr({buildId:a,output:s,sourceDirectory:l,bundledDir:_,port:h,binaryName:S,publicZuploEnvironmentVariables:k,logger:N,handleRuntimeStdio:j}){if(_){let le=zK.join(l,_,"modules.json");if(!Fwr(le))throw new Error("The bundled-dir does not contain a modules.json file.");let oe=await Rwr(le,"utf-8").then(JSON.parse),re=await yce(l);return re.status===_O?new Promise((We,Ne)=>{q(re.config.compatibilityDate,zK.join(l,_),oe,We,j)().catch(we=>{N.error(we),Ne(we)})}):(N.warn("Failed to get Zuplo config. Using default compatibility date."),new Promise((We,Ne)=>{q(void 0,l,oe,We,j)().catch(we=>{N.error(we),Ne(we)})}))}else{let le=new l7({buildId:a,output:s,sourceDirectory:l,command:"dev",logger:N,generateSourceMaps:!0,publicZuploEnvironmentVariables:k??{ZUPLO_ENVIRONMENT_TYPE:"LOCAL_DEVELOPMENT"}});try{await le.start()}catch{N.info("Ran into irrecoverable error while building. Fix the error and rerun the command."),process.exit(1)}return new Promise((oe,re)=>{le.onReload((We,Ne)=>{(Ne||We&&We.errors&&We.errors.length>0)&&re(Ne??We?.errors),q(We?.compatibilityDate,zK.join(l,"dist"),xj(l,We?.metafile),oe,j)().catch(we=>{N.error(we),re(we)})})})}function q(le,oe,re,We,Ne){return async()=>{let we={};await Epe(we,l);let Ot=new iTt.ZuploWorkerd({compatibilityDate:le,scriptDirectory:oe,modules:re,port:h??Vm.DEV_SERVER_PORT,bindings:we,handleRuntimeStdio:Ne}),wt=S??"compiled-zup",br=zK.join(l,"dist");await Lwr(br,{recursive:!0}),await Ot.compileBinary({binaryPath:zK.join(l,"dist",wt)}),await Ot.dispose(),We(void 0)}}t(q,"compile")}t(Mwr,"compileWorkerdServer");var aTt=Lp(uFe(),1);import Bwr from"path";import jwr from"net";function sTt(a,s){return new Promise(l=>{let _=new jwr.Socket;_.connect(s,a),_.on("connect",()=>{_.destroy(),l(!1)}),_.on("error",()=>{_.destroy(),l(!0)})})}t(sTt,"isPortAvailable");var Cpe=class{static{t(this,"WorkerdServer")}sourceDirectory;port;debugPort;buildWatcher;workerd;logger;output;buildId;handleRuntimeStdio;onReload;constructor(s){this.sourceDirectory=s.sourceDirectory,this.port=s.port??Vm.DEV_SERVER_PORT,this.debugPort=s.debugPort,this.logger=s.logger,this.output=s.output,this.buildId=s.buildId,this.handleRuntimeStdio=s.handleRuntimeStdio,this.onReload=s.onReload,s.zupTestMode||(this.buildWatcher=new l7({...s,logger:this.logger,generateSourceMaps:!0,publicZuploEnvironmentVariables:s.publicZuploEnvironmentVariables??{ZUPLO_ENVIRONMENT_TYPE:"LOCAL_DEVELOPMENT"}}),this.buildWatcher.watchEnvFiles())}async start(){if(!await sTt("localhost",this.port))throw new Error(`Port ${this.port} is currently in use. Please use a different port.`);if(this.buildWatcher)try{await this.buildWatcher.start()}catch{this.logger?.info("Ran into irrecoverable error while starting watcher. Fix the error and restart the server."),process.exit(1)}await this.startOrReload(),this.buildWatcher?.onReload((l,_)=>{_||l&&l.errors&&l.errors.length>0||(this.onReload(l,_),this.startOrReload(l).catch(h=>{this.logger?.error(h)}))})}async startOrReload(s){try{let l={};await Epe(l,this.sourceDirectory),await this.workerd?.dispose(),this.workerd=new aTt.ZuploWorkerd({compatibilityDate:s?.compatibilityDate,scriptDirectory:Bwr.join(this.sourceDirectory,"dist"),modules:xj(this.sourceDirectory,s?.metafile),port:this.port,inspectorPort:this.debugPort??void 0,bindings:l,handleRuntimeStdio:this.handleRuntimeStdio}),await this.workerd.serve()}catch{}}async stop(){await this.buildWatcher?.close(),await this.workerd?.dispose()}};async function Uwr({sourceDirectory:a,port:s,debugPort:l,publicZuploEnvironmentVariables:_,logger:h,output:S,buildId:k,onReload:N,handleRuntimeStdio:j}){process.env.ZUPLO_IS_LOCAL_DEVELOPMENT="true";let q=new Cpe({sourceDirectory:a,command:"dev",port:s,debugPort:l,publicZuploEnvironmentVariables:_,logger:h,output:S,buildId:k,onReload:N,handleRuntimeStdio:j});await q.start();async function le(){await q.stop()}t(le,"handle"),process.on("SIGTERM",le),process.on("SIGINT",le)}t(Uwr,"startDevServer");var fTt=Lp(uTt(),1);var Vwr=/[/?<>\\:*|"]/g,Wwr=/[\x00-\x1f\x80-\x9f]/g,Hwr=/^\.+$/,Gwr=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,Kwr=/[. ]+$/;function Ywr(a,s=""){if(typeof a!="string")throw new Error("Input must be string");let l=a.replace(Vwr,s).replace(Wwr,s).replace(Hwr,s).replace(Gwr,s).replace(Kwr,s);return(0,fTt.default)(l,255)}t(Ywr,"sanitize");_Tt.default.config();export{dO as BUILD_OUTPUT_DIR,l7 as BuildWatcher,CYt as DEV_PORTAL_OUTPUT_DIR_NAME,kYt as OPEN_API_FILE_SUFFIX,wy as USER_CONFIG_DIR_NAME,wYt as WORKER_BUILD_OUTPUT_FILE,DYt as WORKER_BUILD_OUTPUT_SOURCEMAP_FILE,C6e as ZUPLO_FALLBACK_JSON_FILE,E6e as ZUPLO_PREFERRED_JSON_FILE,Q7e as build,Mwr as compileWorkerdServer,Vm as env,Ywr as sanitize,Uwr as startDevServer};
|
|
634
|
+
`);return Ot?(_.originalMessage=_.message,_.message=br):_=new Error(br),_.shortMessage=wt,_.command=k,_.escapedCommand=N,_.exitCode=S,_.signal=h,_.signalDescription=re,_.stdout=a,_.stderr=s,l!==void 0&&(_.all=l),"bufferedData"in _&&delete _.bufferedData,_.failed=!0,_.timedOut=!!j,_.isCanceled=q,_.killed=le&&!j,_},"makeError");var hpe=["stdin","stdout","stderr"],cwr=t(a=>hpe.some(s=>a[s]!==void 0),"hasAlias"),k2t=t(a=>{if(!a)return;let{stdio:s}=a;if(s===void 0)return hpe.map(_=>a[_]);if(cwr(a))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${hpe.map(_=>`\`${_}\``).join(", ")}`);if(typeof s=="string")return s;if(!Array.isArray(s))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof s}\``);let l=Math.max(s.length,hpe.length);return Array.from({length:l},(_,h)=>s[h])},"normalizeStdio");var O2t=Lp(I2t(),1);import lwr from"os";var uwr=1e3*5,F2t=t((a,s="SIGTERM",l={})=>{let _=a(s);return fwr(a,s,l,_),_},"spawnedKill"),fwr=t((a,s,l,_)=>{if(!_wr(s,l,_))return;let h=dwr(l),S=setTimeout(()=>{a("SIGKILL")},h);S.unref&&S.unref()},"setKillTimeout"),_wr=t((a,{forceKillAfterTimeout:s},l)=>pwr(a)&&s!==!1&&l,"shouldForceKill"),pwr=t(a=>a===lwr.constants.signals.SIGTERM||typeof a=="string"&&a.toUpperCase()==="SIGTERM","isSigterm"),dwr=t(({forceKillAfterTimeout:a=!0})=>{if(a===!0)return uwr;if(!Number.isFinite(a)||a<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${a}\` (${typeof a})`);return a},"getForceKillAfterTimeout"),L2t=t((a,s)=>{a.kill()&&(s.isCanceled=!0)},"spawnedCancel"),mwr=t((a,s,l)=>{a.kill(s),l(Object.assign(new Error("Timed out"),{timedOut:!0,signal:s}))},"timeoutKill"),R2t=t((a,{timeout:s,killSignal:l="SIGTERM"},_)=>{if(s===0||s===void 0)return _;let h,S=new Promise((N,j)=>{h=setTimeout(()=>{mwr(a,l,j)},s)}),k=_.finally(()=>{clearTimeout(h)});return Promise.race([S,k])},"setupTimeout"),M2t=t(({timeout:a})=>{if(a!==void 0&&(!Number.isFinite(a)||a<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${a}\` (${typeof a})`)},"validateTimeout"),j2t=t(async(a,{cleanup:s,detached:l},_)=>{if(!s||l)return _;let h=(0,O2t.default)(()=>{a.kill()});return _.finally(()=>{h()})},"setExitHandler");function B2t(a){return a!==null&&typeof a=="object"&&typeof a.pipe=="function"}t(B2t,"isStream");var AFe=Lp(J2t(),1),V2t=Lp(z2t(),1);var W2t=t((a,s)=>{s===void 0||a.stdin===void 0||(B2t(s)?s.pipe(a.stdin):a.stdin.end(s))},"handleInput"),H2t=t((a,{all:s})=>{if(!s||!a.stdout&&!a.stderr)return;let l=(0,V2t.default)();return a.stdout&&l.add(a.stdout),a.stderr&&l.add(a.stderr),l},"makeAllStream"),DFe=t(async(a,s)=>{if(a){a.destroy();try{return await s}catch(l){return l.bufferedData}}},"getBufferedData"),PFe=t((a,{encoding:s,buffer:l,maxBuffer:_})=>{if(!(!a||!l))return s?(0,AFe.default)(a,{encoding:s,maxBuffer:_}):AFe.default.buffer(a,{maxBuffer:_})},"getStreamPromise"),G2t=t(async({stdout:a,stderr:s,all:l},{encoding:_,buffer:h,maxBuffer:S},k)=>{let N=PFe(a,{encoding:_,buffer:h,maxBuffer:S}),j=PFe(s,{encoding:_,buffer:h,maxBuffer:S}),q=PFe(l,{encoding:_,buffer:h,maxBuffer:S*2});try{return await Promise.all([k,N,j,q])}catch(le){return Promise.all([{error:le,signal:le.signal,timedOut:le.timedOut},DFe(a,N),DFe(s,j),DFe(l,q)])}},"getSpawnedResult");var xwr=(async()=>{})().constructor.prototype,Ewr=["then","catch","finally"].map(a=>[a,Reflect.getOwnPropertyDescriptor(xwr,a)]),NFe=t((a,s)=>{for(let[l,_]of Ewr){let h=typeof s=="function"?(...S)=>Reflect.apply(_.value,s(),S):_.value.bind(s);Reflect.defineProperty(a,l,{..._,value:h})}return a},"mergePromise"),K2t=t(a=>new Promise((s,l)=>{a.on("exit",(_,h)=>{s({exitCode:_,signal:h})}),a.on("error",_=>{l(_)}),a.stdin&&a.stdin.on("error",_=>{l(_)})}),"getSpawnedPromise");var Y2t=t((a,s=[])=>Array.isArray(s)?[a,...s]:[a],"normalizeArgs"),Cwr=/^[\w.-]+$/,kwr=/"/g,wwr=t(a=>typeof a!="string"||Cwr.test(a)?a:`"${a.replace(kwr,'\\"')}"`,"escapeArg"),X2t=t((a,s)=>Y2t(a,s).join(" "),"joinCommand"),Q2t=t((a,s)=>Y2t(a,s).map(l=>wwr(l)).join(" "),"getEscapedCommand");var Awr=1e3*1e3*100,Nwr=t(({env:a,extendEnv:s,preferLocal:l,localDir:_,execPath:h})=>{let S=s?{...Tpe.env,...a}:a;return l?v2t({env:S,cwd:_,execPath:h}):S},"getEnv"),Iwr=t((a,s,l={})=>{let _=eTt.default._parse(a,s,l);return a=_.command,s=_.args,l=_.options,l={maxBuffer:Awr,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:l.cwd||Tpe.cwd(),execPath:Tpe.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...l},l.env=Nwr(l),l.stdio=k2t(l),Tpe.platform==="win32"&&Pwr.basename(a,".exe")==="cmd"&&s.unshift("/q"),{file:a,args:s,options:l,parsed:_}},"handleArguments"),IFe=t((a,s,l)=>typeof s!="string"&&!Dwr.isBuffer(s)?l===void 0?void 0:"":a.stripFinalNewline?bFe(s):s,"handleOutput");function tTt(a,s,l){let _=Iwr(a,s,l),h=X2t(a,s),S=Q2t(a,s);M2t(_.options);let k;try{k=Z2t.spawn(_.file,_.args,_.options)}catch(We){let Ne=new Z2t.ChildProcess,we=Promise.reject(EFe({error:We,stdout:"",stderr:"",all:"",command:h,escapedCommand:S,parsed:_,timedOut:!1,isCanceled:!1,killed:!1}));return NFe(Ne,we)}let N=K2t(k),j=R2t(k,_.options,N),q=j2t(k,_.options,j),le={isCanceled:!1};k.kill=F2t.bind(null,k.kill.bind(k)),k.cancel=L2t.bind(null,k,le);let re=S2t(t(async()=>{let[{error:We,exitCode:Ne,signal:we,timedOut:Ot},wt,br,Kr]=await G2t(k,_.options,q),ln=IFe(_.options,wt),hn=IFe(_.options,br),pr=IFe(_.options,Kr);if(We||Ne!==0||we!==null){let _r=EFe({error:We,exitCode:Ne,signal:we,stdout:ln,stderr:hn,all:pr,command:h,escapedCommand:S,parsed:_,timedOut:Ot,isCanceled:le.isCanceled||(_.options.signal?_.options.signal.aborted:!1),killed:k.killed});if(!_.options.reject)return _r;throw _r}return{command:h,escapedCommand:S,exitCode:0,stdout:ln,stderr:hn,all:pr,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}},"handlePromise"));return W2t(k,_.options.input),k.all=H2t(k,_.options),NFe(k,re)}t(tTt,"execa");import{existsSync as rTt,readFileSync as nTt}from"fs";import xpe from"path";async function Epe(a,s){if(a.__ZUPLO_LOG_LEVEL=process.env.__ZUPLO_LOG_LEVEL??process.env.LOG_LEVEL,a.__ZUPLO_LOG_FORMAT=process.env.__ZUPLO_LOG_FORMAT??process.env.LOG_FORMAT,a.LOG_LEVEL=process.env.LOG_LEVEL??process.env.LOG_LEVEL,a.LOG_FORMAT=process.env.LOG_FORMAT??process.env.LOG_FORMAT,a.GIT_SHA=process.env.GIT_SHA??await Owr(s),process.env.__ZUPLO_CONFIG&&(a.__ZUPLO_CONFIG=process.env.__ZUPLO_CONFIG),rTt(xpe.join(s,".env.zuplo"))){let l=nTt(xpe.join(s,".env.zuplo"),"utf8"),_=OFe.default.parse(l);for(let h of Object.keys(_))if(a[h]=_[h],h==="ZUPLO_SYSTEM_CONFIGURATIONS"){let S=Buffer.from(Qce.decode(_[h])).toString(),k=JSON.parse(S);for(let N of Object.keys(k))a[N]=k[N]}}if(rTt(xpe.join(s,".env"))){let l=nTt(xpe.join(s,".env"),"utf8"),_=OFe.default.parse(l);for(let h of Object.keys(_))a[h]=_[h]}for(let l of Object.keys(a))a[l]===void 0&&delete a[l];return a}t(Epe,"setEnvironment");async function Owr(a){let s="unknown";try{let{stdout:l}=await tTt("git",["rev-parse","HEAD"],{cwd:a});l.trim().length===40&&(s=l.trim())}catch{}return s}t(Owr,"getGitSha");async function Mwr({buildId:a,output:s,sourceDirectory:l,bundledDir:_,port:h,binaryName:S,publicZuploEnvironmentVariables:k,logger:N,handleRuntimeStdio:j}){if(_){let le=zK.join(l,_,"modules.json");if(!Fwr(le))throw new Error("The bundled-dir does not contain a modules.json file.");let oe=await Rwr(le,"utf-8").then(JSON.parse),re=await yce(l);return re.status===_O?new Promise((We,Ne)=>{q(re.config.compatibilityDate,zK.join(l,_),oe,We,j)().catch(we=>{N.error(we),Ne(we)})}):(N.warn("Failed to get Zuplo config. Using default compatibility date."),new Promise((We,Ne)=>{q(void 0,l,oe,We,j)().catch(we=>{N.error(we),Ne(we)})}))}else{let le=new l7({buildId:a,output:s,sourceDirectory:l,command:"dev",logger:N,generateSourceMaps:!0,publicZuploEnvironmentVariables:k??{ZUPLO_ENVIRONMENT_TYPE:"LOCAL_DEVELOPMENT"}});try{await le.start()}catch{N.info("Ran into irrecoverable error while building. Fix the error and rerun the command."),process.exit(1)}return new Promise((oe,re)=>{le.onReload((We,Ne)=>{(Ne||We&&We.errors&&We.errors.length>0)&&re(Ne??We?.errors),q(We?.compatibilityDate,zK.join(l,"dist"),xj(l,We?.metafile),oe,j)().catch(we=>{N.error(we),re(we)})})})}function q(le,oe,re,We,Ne){return async()=>{let we={};await Epe(we,l);let Ot=new iTt.ZuploWorkerd({compatibilityDate:le,scriptDirectory:oe,modules:re,port:h??Vm.DEV_SERVER_PORT,bindings:we,handleRuntimeStdio:Ne}),wt=S??"compiled-zup",br=zK.join(l,"dist");await Lwr(br,{recursive:!0}),await Ot.compileBinary({binaryPath:zK.join(l,"dist",wt)}),await Ot.dispose(),We(void 0)}}t(q,"compile")}t(Mwr,"compileWorkerdServer");var aTt=Lp(uFe(),1);import Bwr from"path";import jwr from"net";function sTt(a,s){return new Promise(l=>{let _=new jwr.Socket;_.connect(s,a),_.on("connect",()=>{_.destroy(),l(!1)}),_.on("error",()=>{_.destroy(),l(!0)})})}t(sTt,"isPortAvailable");var Cpe=class{static{t(this,"WorkerdServer")}sourceDirectory;port;debugPort;buildWatcher;workerd;logger;handleRuntimeStdio;onReload;constructor(s){this.sourceDirectory=s.sourceDirectory,this.port=s.port??Vm.DEV_SERVER_PORT,this.debugPort=s.debugPort,this.logger=s.logger,this.handleRuntimeStdio=s.handleRuntimeStdio,this.onReload=s.onReload,s.zupTestMode||(this.buildWatcher=new l7({...s,logger:this.logger,generateSourceMaps:!0,publicZuploEnvironmentVariables:s.publicZuploEnvironmentVariables??{ZUPLO_ENVIRONMENT_TYPE:"LOCAL_DEVELOPMENT"}}),this.buildWatcher.watchEnvFiles())}async start(){if(!await sTt("localhost",this.port))throw new Error(`Port ${this.port} is currently in use. Please use a different port.`);if(this.buildWatcher)try{await this.buildWatcher.start()}catch{this.logger?.info("Ran into irrecoverable error while starting watcher. Fix the error and restart the server."),process.exit(1)}await this.startOrReload(),this.buildWatcher?.onReload((l,_)=>{_||l&&l.errors&&l.errors.length>0||(this.onReload(l,_),this.startOrReload(l).catch(h=>{this.logger?.error(h)}))})}async startOrReload(s){try{let l={};await Epe(l,this.sourceDirectory),await this.workerd?.dispose(),this.workerd=new aTt.ZuploWorkerd({compatibilityDate:s?.compatibilityDate,scriptDirectory:Bwr.join(this.sourceDirectory,"dist"),modules:xj(this.sourceDirectory,s?.metafile),port:this.port,inspectorPort:this.debugPort??void 0,bindings:l,handleRuntimeStdio:this.handleRuntimeStdio}),await this.workerd.serve()}catch{}}async stop(){await this.buildWatcher?.close(),await this.workerd?.dispose()}};async function Uwr({sourceDirectory:a,port:s,debugPort:l,publicZuploEnvironmentVariables:_,logger:h,output:S,buildId:k,onReload:N,handleRuntimeStdio:j}){process.env.ZUPLO_IS_LOCAL_DEVELOPMENT="true";let q=new Cpe({sourceDirectory:a,command:"dev",port:s,debugPort:l,publicZuploEnvironmentVariables:_,logger:h,output:S,buildId:k,onReload:N,handleRuntimeStdio:j});await q.start();async function le(){await q.stop()}t(le,"handle"),process.on("SIGTERM",le),process.on("SIGINT",le)}t(Uwr,"startDevServer");var fTt=Lp(uTt(),1);var Vwr=/[/?<>\\:*|"]/g,Wwr=/[\x00-\x1f\x80-\x9f]/g,Hwr=/^\.+$/,Gwr=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,Kwr=/[. ]+$/;function Ywr(a,s=""){if(typeof a!="string")throw new Error("Input must be string");let l=a.replace(Vwr,s).replace(Wwr,s).replace(Hwr,s).replace(Gwr,s).replace(Kwr,s);return(0,fTt.default)(l,255)}t(Ywr,"sanitize");_Tt.default.config();export{dO as BUILD_OUTPUT_DIR,l7 as BuildWatcher,CYt as DEV_PORTAL_OUTPUT_DIR_NAME,kYt as OPEN_API_FILE_SUFFIX,wy as USER_CONFIG_DIR_NAME,wYt as WORKER_BUILD_OUTPUT_FILE,DYt as WORKER_BUILD_OUTPUT_SOURCEMAP_FILE,C6e as ZUPLO_FALLBACK_JSON_FILE,E6e as ZUPLO_PREFERRED_JSON_FILE,Q7e as build,Mwr as compileWorkerdServer,Vm as env,Ywr as sanitize,Uwr as startDevServer};
|
|
633
635
|
/*! For license information please see index.minified.js.LEGAL.txt */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/core",
|
|
3
|
-
"version": "6.15.
|
|
3
|
+
"version": "6.15.5",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"prettier": "^3.3.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@zuplo/graphql": "^6.15.
|
|
44
|
-
"@zuplo/otel": "^6.15.
|
|
45
|
-
"@zuplo/runtime": "^6.15.
|
|
43
|
+
"@zuplo/graphql": "^6.15.5",
|
|
44
|
+
"@zuplo/otel": "^6.15.5",
|
|
45
|
+
"@zuplo/runtime": "^6.15.5"
|
|
46
46
|
}
|
|
47
47
|
}
|