@zuplo/core 6.66.15 → 6.67.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/customer.cli.minified.js +1 -1
- package/index.minified.js +1 -1
- package/package.json +4 -4
- package/zeno.js +4 -4
package/customer.cli.minified.js
CHANGED
|
@@ -568,7 +568,7 @@ globstar while`,s,ae,f,Ke,$e),this.matchOne(s.slice(ae),f.slice(Ke),d))return th
|
|
|
568
568
|
`],[102,"\f"],[114,"\r"],[116," "]]),zoe=new Map([...RV,[118,"\v"],[48,"\0"]]),NKt=new Map([[QPe,QPe],["\\","\\"],["/","/"],["\b","b"],[`
|
|
569
569
|
`,"n"],["\f","f"],["\r","r"],[" ","t"]]),vCr=new Map([...NKt,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),Uoe=new Map([[bKt,"LBracket"],[SKt,"RBracket"],[TKt,"LBrace"],[xKt,"RBrace"],[EKt,"Colon"],[CKt,"Comma"],[kKt,"Boolean"],[wKt,"Boolean"],[DKt,"Null"]]),Boe=new Map([...Uoe,[PKt,"Number"],[AKt,"Number"]]),eAe=new Set([10,13,8232,8233]),UP=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:f,column:d,offset:y}){super(`${s} (${f}:${d})`),this.line=f,this.column=d,this.offset=y}},tAe=class extends UP{static{t(this,"UnexpectedChar")}constructor(s,f){super(`Unexpected character '${String.fromCharCode(s)}' found.`,f)}},rAe=class extends UP{static{t(this,"UnexpectedIdentifier")}constructor(s,f){super(`Unexpected identifier '${s}' found.`,f)}},dO=class extends UP{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},$oe=class extends UP{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},IKt=/[\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]/,OKt=/[\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]/,FKt=13,jnt=10,nAe=class{static{t(this,"CharCodeReader")}#e="";#n=1;#t=0;#r=-1;#s=!1;#p=-1;#o=!1;constructor(s){this.#e=s}#_(){this.#o||(this.#t++,this.#r++,this.#p=-1,this.#o=!0)}locate(){return{line:this.#n,column:this.#t,offset:this.#r}}next(){if(this.#r>=this.#e.length-1)return this.#_(),-1;this.#r++;let s=this.#e.charCodeAt(this.#r);return this.#s?(this.#n++,this.#t=1,this.#s=!1):this.#t++,s===FKt?(this.#s=!0,this.peek()===jnt&&this.#r++):s===jnt&&(this.#s=!0),this.#p=s,s}peek(){return this.#r===this.#e.length-1?-1:this.#e.charCodeAt(this.#r+1)}match(s){return s(this.peek())?(this.next(),!0):!1}current(){return this.#p}},LKt="Infinity",RKt="NaN",MKt=new Set([116,102,110]),iAe=new Set([32,9,10,13]),Bnt=new Set([...iAe,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),jKt={mode:"json",ranges:!1},BKt=new Set(["true","false","null"]),y_={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 BP(o){return o>=48&&o<=57}t(BP,"isDigit");function ZPe(o){return BP(o)||o>=65&&o<=70||o>=97&&o<=102}t(ZPe,"isHexDigit");function UKt(o){return o>=49&&o<=57}t(UKt,"isPositiveDigit");function zKt(o){return MKt.has(o)}t(zKt,"isKeywordStart");function znt(o){return BP(o)||o===46||o===45}t(znt,"isNumberStart");function $Kt(o){return znt(o)||o===43}t($Kt,"isJSON5NumberStart");function Unt(o,s){return o===34||s&&o===39}t(Unt,"isStringStart");function $nt(o){if(o===36||o===95||o===92||o>=97&&o<=122||o>=65&&o<=90||o===8204||o===8205)return!0;let s=String.fromCharCode(o);return IKt.test(s)}t($nt,"isJSON5IdentifierStart");function JKt(o){if($nt(o)||BP(o))return!0;let s=String.fromCharCode(o);return OKt.test(s)}t(JKt,"isJSON5IdentifierPart");var sAe=class{static{t(this,"Tokenizer")}#e;#n;#t;#r;#s;#p;#o;#_;#u;#c;#i;constructor(s,f){this.#n=s,this.#e={...jKt,...f},this.#t=new nAe(s),this.#r=this.#e.mode==="json5",this.#s=this.#e.mode!=="json",this.#p=this.#e.ranges,this.#_=this.#r?zoe.has.bind(zoe):RV.has.bind(RV),this.#u=this.#r?eAe.has.bind(eAe):()=>!1,this.#c=this.#r?d=>d===120:()=>!1,this.#i=this.#r?Bnt.has.bind(Bnt):iAe.has.bind(iAe)}#a(s,f=this.#t.locate()){throw new tAe(s,f)}#h(s,f=this.#t.locate()){throw new rAe(s,f)}#m(){throw new $oe(this.#t.locate())}#f(s,f,d,y){let x=d.offset+f,P=this.#e.ranges?{range:[d.offset,x]}:void 0;return{type:s,loc:{start:d,end:y||{line:d.line,column:d.column+f,offset:x}},...P}}#d(s){let f="",d;for(let y=0;y<s;y++){if(d=this.#t.peek(),ZPe(d)){this.#t.next(),f+=String.fromCharCode(d);continue}this.#a(d)}return f}#g(s){let f="";do{if(f+=String.fromCharCode(s),s===92&&(s=this.#t.next(),s!==117&&this.#a(s),f+=String.fromCharCode(s),f+=this.#d(4)),s=this.#t.peek(),!JKt(s))break;this.#t.next()}while(!0);return f}#y(s){let f=s,d=1;for(s=this.#t.peek();s!==-1&&s!==f;){if(this.#t.next(),d++,s===92)if(s=this.#t.peek(),this.#_(s)||this.#u(s))this.#t.next(),d++;else if(s===117){this.#t.next(),d++;let y=this.#d(4);d+=y.length}else if(this.#c(s)){this.#t.next(),d++;let y=this.#d(2);d+=y.length}else this.#r?(this.#t.next(),d++):this.#a(s);s=this.#t.peek()}return s===-1&&(this.#t.next(),this.#m()),this.#t.next(),d++,d}#E(s){let f=1;if(s===45||this.#r&&s===43){if(s=this.#t.peek(),this.#r&&(s===73||s===78)){this.#t.next();let d=this.#g(s);return d!==LKt&&d!==RKt&&this.#a(s),f+d.length}BP(s)||this.#a(s),this.#t.next(),f++}if(s===48)if(s=this.#t.peek(),this.#r&&(s===120||s===88)){this.#t.next(),f++,s=this.#t.peek(),ZPe(s)||(this.#t.next(),this.#a(s));do this.#t.next(),f++,s=this.#t.peek();while(ZPe(s))}else BP(s)&&this.#a(s);else if(!this.#r||s!==46)for(UKt(s)||this.#a(s),s=this.#t.peek();BP(s);)this.#t.next(),f++,s=this.#t.peek();if(s===46){let d=-1;for(this.#t.next(),f++,d++,s=this.#t.peek();BP(s);)this.#t.next(),f++,d++,s=this.#t.peek();!this.#r&&d===0&&(this.#t.next(),s?this.#a(s):this.#m())}if(s===101||s===69)for(this.#t.next(),f++,s=this.#t.peek(),(s===43||s===45)&&(this.#t.next(),f++,s=this.#t.peek()),s===-1&&(this.#t.next(),this.#m()),BP(s)||(this.#t.next(),this.#a(s));BP(s);)this.#t.next(),f++,s=this.#t.peek();return f}#T(s){let f=1;if(s=this.#t.peek(),s===47){do this.#t.next(),f+=1,s=this.#t.peek();while(s>-1&&s!==13&&s!==10);return{length:f,multiline:!1}}if(s===42){for(this.#t.next(),f+=1;s>-1;)if(s=this.#t.peek(),s===42){if(this.#t.next(),f+=1,s=this.#t.peek(),s===47)return this.#t.next(),f+=1,{length:f,multiline:!0}}else this.#t.next(),f+=1;this.#t.next(),this.#m()}this.#t.next(),this.#a(s)}next(){let s=this.#t.next();for(;this.#i(s);)s=this.#t.next();if(s===-1)return y_.EOF;let f=this.#t.locate(),d=String.fromCharCode(s);if(this.#r)if(Boe.has(d))this.#o=this.#f(Boe.get(d),1,f);else if($nt(s)){let y=this.#g(s);Boe.has(y)?this.#o=this.#f(Boe.get(y),y.length,f):this.#o=this.#f("Identifier",y.length,f)}else if($Kt(s)){let y=this.#E(s);this.#o=this.#f("Number",y,f)}else if(Unt(s,this.#r)){let y=this.#y(s),x=this.#t.locate();this.#o=this.#f("String",y,f,{line:x.line,column:x.column+1,offset:x.offset+1})}else if(s===47&&this.#s){let y=this.#T(s),x=this.#t.locate();this.#o=this.#f(y.multiline?"BlockComment":"LineComment",y.length,f,{line:x.line,column:x.column+1,offset:x.offset+1})}else this.#a(s);else if(Uoe.has(d))this.#o=this.#f(Uoe.get(d),1,f);else if(zKt(s)){let y=this.#g(s);BKt.has(y)||this.#h(y,f),this.#o=this.#f(Uoe.get(y),y.length,f)}else if(znt(s)){let y=this.#E(s);this.#o=this.#f("Number",y,f)}else if(Unt(s,this.#r)){let y=this.#y(s);this.#o=this.#f("String",y,f)}else if(s===47&&this.#s){let y=this.#T(s),x=this.#t.locate();this.#o=this.#f(y.multiline?"BlockComment":"LineComment",y.length,f,{line:x.line,column:x.column+1,offset:x.offset+1})}else this.#a(s);return y_[this.#o.type]}get token(){return this.#o}};var oT={document(o,s={}){return{type:"Document",body:o,loc:s.loc,...s}},string(o,s={}){return{type:"String",value:o,loc:s.loc,...s}},number(o,s={}){return{type:"Number",value:o,loc:s.loc,...s}},boolean(o,s={}){return{type:"Boolean",value:o,loc:s.loc,...s}},null(o={}){return{type:"Null",loc:o.loc,...o}},array(o,s={}){return{type:"Array",elements:o,loc:s.loc,...s}},element(o,s={}){return{type:"Element",value:o,loc:s.loc,...s}},object(o,s={}){return{type:"Object",members:o,loc:s.loc,...s}},member(o,s,f={}){return{type:"Member",name:o,value:s,loc:f.loc,...f}},identifier(o,s={}){return{type:"Identifier",name:o,loc:s.loc,...s}},nan(o="",s={}){return{type:"NaN",sign:o,loc:s.loc,...s}},infinity(o="",s={}){return{type:"Infinity",sign:o,loc:s.loc,...s}}},WKt={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function qKt(o,s,f=!1){let d="",y=o.indexOf("\\"),x=0;for(;y>=0;){d+=o.slice(x,y);let P=o.charAt(y+1),F=P.charCodeAt(0);if(f&&zoe.has(F))d+=zoe.get(F),x=y+2;else if(RV.has(F))d+=RV.get(F),x=y+2;else if(P==="u"){let J=o.slice(y+2,y+6);if(J.length<4||/[^0-9a-f]/i.test(J))throw new UP(`Invalid unicode escape \\u${J}.`,{line:s.loc.start.line,column:s.loc.start.column+y,offset:s.loc.start.offset+y});d+=String.fromCharCode(parseInt(J,16)),x=y+6}else if(f&&P==="x"){let J=o.slice(y+2,y+4);if(J.length<2||/[^0-9a-f]/i.test(J))throw new UP(`Invalid hex escape \\x${J}.`,{line:s.loc.start.line,column:s.loc.start.column+y,offset:s.loc.start.offset+y});d+=String.fromCharCode(parseInt(J,16)),x=y+4}else if(f&&eAe.has(F))x=y+2,P==="\r"&&o.charAt(x)===`
|
|
570
570
|
`&&x++;else if(f)d+=P,x=y+2;else throw new UP(`Invalid escape \\${P}.`,{line:s.loc.start.line,column:s.loc.start.column+y,offset:s.loc.start.offset+y});y=o.indexOf("\\",x)}return d+=o.slice(x),d}t(qKt,"getStringValue");function VKt(o,s,f=!1){switch(s.type){case"Boolean":return o==="true";case"Number":return Number(o);case"String":return qKt(o.slice(1,-1),s,f);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(VKt,"getLiteralValue");function Jnt(o,s){s=Object.freeze({...WKt,...s});let f=[],d=new sAe(o,{mode:s.mode,ranges:s.ranges}),y=s.mode==="json5",x=s.allowTrailingCommas||y;function P(){let Er=d.next();return Er&&s.tokens&&f.push(d.token),Er}t(P,"nextNoComments");function F(){let Er=d.next();return Er&&s.tokens&&f.push(d.token),Er>=y_.LineComment?F():Er}t(F,"nextSkipComments");let J=s.mode==="json"?P:F;function G(Er,vr){if(Er!==vr)throw new dO(d.token)}t(G,"assertTokenType");function Se(Er,vr){if(!vr.includes(Er))throw new dO(d.token)}t(Se,"assertTokenTypes");function de(Er,vr){return s.ranges?{range:[Er.offset,vr.offset]}:void 0}t(de,"createRange");function ae(Er){let vr=d.token,ls=de(vr.loc.start,vr.loc.end),Ni=VKt(o.slice(vr.loc.start.offset,vr.loc.end.offset),vr,y),bi={loc:{start:{...vr.loc.start},end:{...vr.loc.end}},...ls};switch(Er){case y_.String:return oT.string(Ni,bi);case y_.Number:return oT.number(Ni,bi);case y_.Boolean:return oT.boolean(Ni,bi);default:throw new TypeError(`Unknown token type ${vr.type}.`)}}t(ae,"createLiteralNode");function Ke(Er){let vr=de(Er.loc.start,Er.loc.end),ls=o.slice(Er.loc.start.offset,Er.loc.end.offset),nc={loc:{start:{...Er.loc.start},end:{...Er.loc.end}},...vr};if(Er.type!=="Identifier"){let bi="";return(ls[0]==="+"||ls[0]==="-")&&(bi=ls[0]),oT[ls.includes("NaN")?"nan":"infinity"](bi,nc)}return oT.identifier(ls,nc)}t(Ke,"createJSON5IdentifierNode");function $e(Er){let vr=de(Er.loc.start,Er.loc.end);return oT.null({loc:{start:{...Er.loc.start},end:{...Er.loc.end}},...vr})}t($e,"createNullNode");function Fe(Er){y?Se(Er,[y_.String,y_.Identifier,y_.Number]):G(Er,y_.String);let vr=d.token,ls=Er===y_.String?ae(Er):Ke(vr);if(y&&(ls.type==="NaN"||ls.type==="Infinity")){if(ls.sign!=="")throw new dO(d.token);ls=oT.identifier(ls.type,{loc:ls.loc,...de(ls.loc.start,ls.loc.end)})}Er=J(),G(Er,y_.Colon);let Ni=Pr(),nc=de(ls.loc.start,Ni.loc.end);return oT.member(ls,Ni,{loc:{start:{...ls.loc.start},end:{...Ni.loc.end}},...nc})}t(Fe,"parseProperty");function Gt(Er){G(Er,y_.LBrace);let vr=d.token,ls=[],Ni=J();if(Ni!==y_.RBrace)do{if(ls.push(Fe(Ni)),Ni=J(),!Ni)throw new $oe(ls[ls.length-1].loc.end);if(Ni===y_.Comma){if(Ni=J(),x&&Ni===y_.RBrace)break}else break}while(Ni);G(Ni,y_.RBrace);let nc=d.token,bi=de(vr.loc.start,nc.loc.end);return oT.object(ls,{loc:{start:{...vr.loc.start},end:{...nc.loc.end}},...bi})}t(Gt,"parseObject");function jt(Er){G(Er,y_.LBracket);let vr=d.token,ls=[],Ni=J();if(Ni!==y_.RBracket)do{let Qf=Pr(Ni);if(ls.push(oT.element(Qf,{loc:Qf.loc})),Ni=J(),Ni===y_.Comma){if(Ni=J(),x&&Ni===y_.RBracket)break}else break}while(Ni);G(Ni,y_.RBracket);let nc=d.token,bi=de(vr.loc.start,nc.loc.end);return oT.array(ls,{loc:{start:{...vr.loc.start},end:{...nc.loc.end}},...bi})}t(jt,"parseArray");function Pr(Er){Er=Er??J();let vr=d.token;switch(Er){case y_.String:case y_.Boolean:return ae(Er);case y_.Number:if(y){let ls=o.slice(vr.loc.start.offset,vr.loc.end.offset);if((ls[0]==="+"||ls[0]==="-")&&(ls=ls.slice(1)),ls==="NaN"||ls==="Infinity")return Ke(vr)}return ae(Er);case y_.Null:return $e(vr);case y_.LBrace:return Gt(Er);case y_.LBracket:return jt(Er);default:throw new dO(vr)}}t(Pr,"parseValue");let Fn=Pr();if(J())throw new dO(d.token);let Un={loc:{start:{line:1,column:1,offset:0},end:{...Fn.loc.end}}};return s.tokens&&(Un.tokens=f),s.ranges&&(Un.range=[Un.loc.start.offset,Un.loc.end.offset]),oT.document(Fn,Un)}t(Jnt,"parse");var HKt=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function Wnt(o){return o&&typeof o=="object"}t(Wnt,"isObject");function GKt(o){return Wnt(o)&&typeof o.type=="string"}t(GKt,"isNode");function YKt(o,s){function f(d,y){typeof s.enter=="function"&&s.enter(d,y);for(let x of HKt.get(d.type)){let P=d[x];Wnt(P)&&(Array.isArray(P)?P.forEach(F=>f(F,d)):GKt(P)&&f(P,d))}typeof s.exit=="function"&&s.exit(d,y)}t(f,"visitNode"),f(o)}t(YKt,"traverse");function qnt(o,s=()=>!0){let f=[];return YKt(o,{enter(d,y){f.push({node:d,parent:y,phase:"enter"})},exit(d,y){f.push({node:d,parent:y,phase:"exit"})}}),f.filter(s).values()}t(qnt,"iterator");import KKt from"node:fs/promises";var MV=t((o,s)=>o.split(/\r?\n/)[s-1],"getFileLineContent"),Joe=t(async o=>{try{return await KKt.readFile(o,"utf-8")}catch{return}},"getSchemaContent"),jV=t(async o=>{try{return Jnt(o)}catch(s){if(s.column&&s.line&&s.message){let f=MV(o,s.line);return{column:s.column,line:s.line,length:void 0,lineText:f}}return}},"getSchemaAST");var Vnt=t(async(o,s,f)=>{try{if(o.length===0)return;for(let d of o){let y=await Joe(d),x=await XKt(y,d,s,f);if(x)return x}}catch{}},"getRouteLocationByValue"),XKt=t(async(o,s,f,d)=>{try{if(!o)return;let y=null,x=await jV(o);if(x){for(let{node:P}of qnt(x))if(P.value&&P.value===f){y=P.loc;break}if(y!==null){let P=MV(o,y.start.line);return{file:s,line:y.start.line,column:y.start.column,length:y.end.column-y.start.column,lineText:P,suggestion:d}}}}catch{}},"getRouteLocationByValueFromSchema");import Hnt from"node:fs/promises";import bE from"node:path";var aAe="schemas",oAe=".oas.json";var mO=t(async o=>(await Hnt.readdir(o)).map(f=>bE.join(o,f)).filter(f=>f.endsWith(oAe)).sort(),"getOpenApiFilesByAlphabetical"),Z9=t(async o=>{let s=bE.resolve(o,"config");return(await Hnt.readdir(s)).filter(d=>d.endsWith(oAe)).length>=1},"oasFileInProject");function BV(o,s,f,d,y,x,P){if(x.has(f))return;let F;try{F=d.get(f)}catch($e){throw new w1({text:`Failed to resolve reference: ${f}`,detail:$e.message,severity:"error",message:"Failed to resolve reference",location:{file:o,column:0,line:0,length:0,lineText:f,namespace:s,suggestion:"Check the reference and try again."}})}let J=qoe(f),G=bE.basename(J,bE.extname(J)),Se=f.indexOf("#"),de=Se>=0?f.substring(0,Se):f,ae=Se>=0?f.substring(Se+1):"",Ke=d.get(de);if(ae){let $e=ae.split("/").filter(Boolean);for(let Fe of $e)if(Ke=Ke[Fe],Ke===void 0)throw new Error(`Cannot resolve JSON pointer: ${ae}`)}if(Ke&&typeof Ke=="object"&&"$ref"in Ke&&typeof Ke.$ref=="string"&&!Ke.$ref.startsWith("#")){let $e=bE.resolve(bE.dirname(de),Ke.$ref);if(J=$e,G=bE.basename(J,bE.extname(J)),de=$e,x.has(de)){let Gt=x.get(de);if(Gt===void 0)throw new Error(`Expected to find ${de} in refsVisited map`);x.set(f,Gt);return}let Fe=y.length;x.set(f,Fe),x.set(de,Fe),y.push(de),Woe(J,G,F,d,y,x,P)}else x.set(f,y.length),y.push(f),Woe(qoe(f),s,F,d,y,x,P)}t(BV,"chaseRefs");function Woe(o,s,f,d,y,x,P){if(Array.isArray(f))for(let F of f)Woe(o,s,F,d,y,x,P);else if(typeof f=="object")for(let F in f){if(F==="$ref"){let J=f[F];P&&(f[F]=P(s,J,o)),BV(o,s,YN(o,J),d,y,x,P)}Woe(o,s,f[F],d,y,x,P)}}t(Woe,"lookForRefs");function YN(o,s){let f=s.indexOf("#");return f>=0?`${bE.resolve(o,s.substring(0,f))}${s.substring(f)}`:bE.resolve(bE.dirname(o),s)}t(YN,"getFullyQualifiedRefName");function qoe(o){let s=o.indexOf("#");return s>=0?o.substring(0,s):o}t(qoe,"getFilePathNameFromRefName");import ble from"node:path";function ZKt(o){if(o.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let G=0;G<s.length;G++)s[G]=255;for(let G=0;G<o.length;G++){let Se=o.charAt(G),de=Se.charCodeAt(0);if(s[de]!==255)throw new TypeError(Se+" is ambiguous");s[de]=G}let f=o.length,d=o.charAt(0),y=Math.log(f)/Math.log(256),x=Math.log(256)/Math.log(f);function P(G){if(G instanceof Uint8Array||(ArrayBuffer.isView(G)?G=new Uint8Array(G.buffer,G.byteOffset,G.byteLength):Array.isArray(G)&&(G=Uint8Array.from(G))),!(G instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(G.length===0)return"";let Se=0,de=0,ae=0,Ke=G.length;for(;ae!==Ke&&G[ae]===0;)ae++,Se++;let $e=(Ke-ae)*x+1>>>0,Fe=new Uint8Array($e);for(;ae!==Ke;){let Pr=G[ae],Fn=0;for(let sn=$e-1;(Pr!==0||Fn<de)&&sn!==-1;sn--,Fn++)Pr+=256*Fe[sn]>>>0,Fe[sn]=Pr%f>>>0,Pr=Pr/f>>>0;if(Pr!==0)throw new Error("Non-zero carry");de=Fn,ae++}let Gt=$e-de;for(;Gt!==$e&&Fe[Gt]===0;)Gt++;let jt=d.repeat(Se);for(;Gt<$e;++Gt)jt+=o.charAt(Fe[Gt]);return jt}t(P,"encode");function F(G){if(typeof G!="string")throw new TypeError("Expected String");if(G.length===0)return new Uint8Array;let Se=0,de=0,ae=0;for(;G[Se]===d;)de++,Se++;let Ke=(G.length-Se)*y+1>>>0,$e=new Uint8Array(Ke);for(;G[Se];){let Pr=s[G.charCodeAt(Se)];if(Pr===255)return;let Fn=0;for(let sn=Ke-1;(Pr!==0||Fn<ae)&&sn!==-1;sn--,Fn++)Pr+=f*$e[sn]>>>0,$e[sn]=Pr%256>>>0,Pr=Pr/256>>>0;if(Pr!==0)throw new Error("Non-zero carry");ae=Fn,Se++}let Fe=Ke-ae;for(;Fe!==Ke&&$e[Fe]===0;)Fe++;let Gt=new Uint8Array(de+(Ke-Fe)),jt=de;for(;Fe!==Ke;)Gt[jt++]=$e[Fe++];return Gt}t(F,"decodeUnsafe");function J(G){let Se=F(G);if(Se)return Se;throw new Error("Non-base"+f+" character")}return t(J,"decode"),{encode:P,decodeUnsafe:F,decode:J}}t(ZKt,"base");var Gnt=ZKt;var QKt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Voe=Gnt(QKt);var eXt=!1;function Q9(o,s){return{open:`\x1B[${o.join(";")}m`,close:`\x1B[${s}m`,regexp:new RegExp(`\\x1b\\[${s}m`,"g")}}t(Q9,"code");function eM(o,s){return eXt?`${s.open}${o.replace(s.regexp,s.open)}${s.close}`:o}t(eM,"run");function tXt(o){return eM(o,Q9([31],39))}t(tXt,"red");function rXt(o){return eM(o,Q9([32],39))}t(rXt,"green");function nXt(o){return eM(o,Q9([33],39))}t(nXt,"yellow");function iXt(o){return eM(o,Q9([34],39))}t(iXt,"blue");function sXt(o){return eM(o,Q9([35],39))}t(sXt,"magenta");function aXt(o){return eM(o,Q9([36],39))}t(aXt,"cyan");var zCr=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");var Ynt=[tXt,rXt,nXt,iXt,sXt,aXt];function oXt(o){let s=0,f=o.length,d=0;if(f>0)for(;d<f;)s=(s<<5)-s+o.charCodeAt(d++)|0;return s}t(oXt,"hashCode");function Knt(o){let s=Math.abs(oXt(o));return Ynt[s%Ynt.length]}t(Knt,"generateColor");import{inspect as cXt}from"node:util";function Xnt(o,s,...f){let d=0,y=f.length,x=String(s).replace(/%[sdjoO%]/g,P=>{if(P==="%%")return"%";if(d>=y)return P;switch(P){case"%s":return String(f[d++]);case"%d":return Number(f[d++]).toString();case"%o":return o(f[d++]).split(`
|
|
571
|
-
`).map(F=>F.trim()).join(" ");case"%O":return o(f[d++]);case"%j":try{return JSON.stringify(f[d++])}catch{return"[Circular]"}default:return P}});for(let P of f.splice(d))P===null||!(typeof P=="object"&&P!==null)?x+=" "+P:x+=" "+o(P);return x}t(Xnt,"format");var Znt=t((o,...s)=>Xnt(cXt,o,s),"format");var cAe=class{static{t(this,"Debugger")}manager;ns;color;last;enabled;constructor(s,f){this.manager=s,this.ns=f,this.color=Knt(f),this.last=0,this.enabled=s.enabled.some(d=>d.test(f))}log(...s){if(!this.enabled)return;let f,d=s[0];typeof d=="function"?f=d():f=String(d);let y=Date.now()-(this.last||Date.now());f=Znt(f,...s);let x=`${this.color(this.ns)} ${f} ${this.color(`+${y}ms`)}`;console.log(x),this.last=Date.now()}},lAe=class{static{t(this,"DebugManager")}debuggers;enabled;constructor(s){this.debuggers=new Map,this.enabled=s??[]}};function lXt(o){return!o||o.length===0?[]:(o=o.replace(/\s/g,"").replace(/\*/g,".+"),o.split(",").map(s=>new RegExp(`^${s}$`)))}t(lXt,"extract");var Hoe;function Goe(o){Hoe||(Hoe=new lAe(lXt(process.env.DEBUG)));let s=new cAe(Hoe,o);return Hoe.debuggers.set(o,s),Object.assign(s.log.bind(s),{self:s})}t(Goe,"debug");var Qnt="zp-local-service";var tkr=Symbol("zuplo_meters"),rkr=Symbol("zuplo_dynamic_meters");var zP=class extends Error{static{t(this,"RuntimeError")}extensionMembers;constructor(s,f){typeof s=="string"?super(s,f):(super(s.message,f),this.extensionMembers=s.extensionMembers),this.name="RuntimeError"}};var KN=Goe("zuplo:runtime:external-service");function uXt(){let o,{__ZUPLO_EXTERNAL_SERVICE_TOKEN:s}=Em.instance.runtime;if(s&&s!=="undefined")try{let f=atob(s);o=JSON.parse(f)}catch{}return o}t(uXt,"getServiceAuth");async function eit(o,s){let f=".proxy",d=".tunnel";if(typeof o=="string"){let y=new URL(o),x=y.hostname;if(x.endsWith(f)){let Gt=x.slice(0,-f.length),jt=new URL(`http://${Gt}${y.pathname}${y.search}`);KN(`Routing to proxy: ${jt.toString()}`);let Pr=s??{};return UV(jt.toString(),Pr)}let P=x.endsWith(d),F=x.indexOf(".")===-1;if(!(P||F))throw new zP(`Invalid service hostname suffix: ${x}. Use .proxy for proxy routing, .tunnel for explicit tunnel routing, or no suffix for default tunnel routing.`);let G=P?x.slice(0,-d.length):x,Se=uXt();if(!Se)throw KN("There is no external service auth configured for this zup."),new zP("There are no external services configured for this zup.");KN(`Using external service auth. ClientId: ${Se.clientId})`);let de=s??{},ae=new Headers(de.headers||{});ae.set("CF-Access-Client-Id",Se.clientId),ae.set("CF-Access-Client-Secret",Se.clientSecret),de.headers=ae;let Ke;if(Se.customServiceMapping?.[G])Ke=`https://${Se.customServiceMapping[G]}`;else if(Em.instance.useLegacyServiceRouting)Ke=`https://${G}.zuptunnel.com`;else{KN("Using sha256 service routing");let Gt=Em.instance.build;if(Gt.ACCOUNT_NAME&&Gt.PROJECT_NAME&&Gt.ENVIRONMENT_TYPE){let jt=await fXt(G,Gt.ACCOUNT_NAME,Gt.PROJECT_NAME,Gt.ENVIRONMENT_TYPE),Pr=rit(Gt.ENVIRONMENT_TYPE),Fn=await uAe(`${Gt.ACCOUNT_NAME}-${Gt.PROJECT_NAME}-${Pr}`);Fn==="40d7ad502f5d743997999594c177184a00161a77865423511f3a1ea21eb5a5e"||Fn==="d05bffe8fa91a300187d2cf43e8aa4a56bd809c442ae10d1ee49af7d29a5a11"?Ke=`https://${jt}.zuptunnel.com`:Ke=`https://${jt}.t.zuplo.app`}else throw KN("Cannot use sha256 service routing, missing build variables"),new zP("Failed to generate fully qualified tunnel url.")}let $e=new URL(`${Ke}${y.pathname}${y.search}`);KN(`Calling external service: ${$e.toString()}`);let Fe=await UV($e.toString(),de);if(Fe.status===403&&Fe.headers.get("cf-access-domain")!==null)throw zV.console.error("403 Forbidden when calling external service.",{clientId:Se.clientId,tunnelHost:Ke}),new zP("Could not connect to secure tunnel.");return Fe}else throw KN("Cannot call external service with Request object"),new zP("Currently, we only support fetch(<some_string>, ...).")}t(eit,"externalServiceHandler");async function tit(o,s){if(typeof o=="string"){let f=new URL(o),d=f.hostname,y=s??{},x=`http://${d}.zuplo.svc.cluster.local:9000`,P=new URL(`${x}${f.pathname}${f.search}`),F=new Headers(y.headers||{});return F.set(Qnt,d),y.headers=F,await UV(P.toString(),y)}else throw new zP("Currently, we only support fetch(<some_string>, ...).")}t(tit,"clusterServiceHandler");async function fXt(o,s,f,d){let y=o.toLowerCase(),x=s.toLowerCase(),P=f.toLowerCase(),F=rit(d);KN(`Hashing service name: ${x}-${y}.${x}-${P}-${F}`);let J=await uAe(`${x}-${y}`),G=await uAe(`${x}-${P}-${F}`);return`${J}.${G}`}t(fXt,"hashServiceName");async function uAe(o){let s=new TextEncoder().encode(o),f=await crypto.subtle.digest("SHA-256",s);return Array.from(new Uint8Array(f)).map(x=>x.toString(16).padStart(2,"0")).join("").slice(0,-1)}t(uAe,"hashSegment");function rit(o){let s=o.toLowerCase();switch(s){case"production":case"preview":return s;default:return"working-copy"}}t(rit,"sanitizeEnvironmentType");var fAe=new Map;fAe.set("service:",eit);fAe.set("local:",tit);var UV=globalThis.fetch;function _Ae(o,s){let{transformedInit:f,mtlsCertificate:d}=_Xt(s);if(typeof o=="string"){let y=new URL(o),x=fAe.get(y.protocol);return x?x(o,f):nit(o,f,d)}else return nit(o,f,d)}t(_Ae,"internalFetch");globalThis.fetch=_Ae;function nit(o,s,f){if(!f)return UV(o,s);if(Em.instance.isCloudflare){let y=Em.instance.runtime[f];if(!y)throw new Error(`mTLS certificate binding '${f}' not found. Ensure the certificate is uploaded and properly configured.`);if(typeof y!="object"||typeof y.fetch!="function")throw new Error(`mTLS certificate binding '${f}' is not a valid mTLS certificate binding. Make sure it's configured as an mTLS certificate, not an environment variable.`);return y.fetch(o,s)}else throw Em.instance.isDeno?new Error("mTLS client certificates are not yet supported in Deno runtime. This will be added in a future update."):new Error("mTLS client certificates are not supported in this runtime environment")}t(nit,"performFetch");var _Xt=t(o=>{if(!o||o instanceof Request)return{transformedInit:o,mtlsCertificate:void 0};let s=o;if(!s.zuplo)return{transformedInit:o,mtlsCertificate:void 0};let f=s.zuplo.mtlsCertificate,d=o;return d.cf={cacheEverything:s.zuplo?.cacheEverything,cacheTtl:s.zuplo?.cacheTtlSeconds},delete o.zuplo,{transformedInit:o,mtlsCertificate:f}},"transformInit");var pXt={console:{log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),debug:console.debug.bind(console),assert:console.assert.bind(console),clear:console.clear.bind(console),count:console.count.bind(console),countReset:console.countReset.bind(console),dir:console.dir.bind(console),dirxml:console.dirxml.bind(console),group:console.group.bind(console),groupCollapsed:console.groupCollapsed.bind(console),groupEnd:console.groupEnd.bind(console),table:console.table.bind(console),time:console.time.bind(console),timeEnd:console.timeEnd.bind(console),timeLog:console.timeLog.bind(console),timeStamp:console.timeStamp.bind(console),trace:console.trace.bind(console),profile:console.profile.bind(console),profileEnd:console.profileEnd.bind(console)},fetch:_Ae},zV=pXt;var pAe="2025-02-06",iit=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2026-03-01":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,chainResponseSendingHooks:!0,return501ForUnsupportedHttpMethods:!0}});function sit(){return new Em({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:pAe,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:iit[pAe]},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:"",ZUPLO_SERVICE_BUCKET_ID:"mock-bucket-id"}})}t(sit,"getMockEnvironment");var Em=class o{static{t(this,"Environment")}config;static#e;static#n=!1;static initialize(s){o.#e||(o.#e=new o(s),o.#n=!0)}static get instance(){return o.#n||(zV.console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),o.#e=sit()),o.#e}constructor({build:s,runtime:f}){let d;try{if(f.ZUPLO_SYSTEM_CONFIGURATIONS){let y=new TextDecoder().decode(Voe.decode(f.ZUPLO_SYSTEM_CONFIGURATIONS)),x=JSON.parse(y);for(let P of Object.keys(x))f[P]||(f[P]=x[P])}if(f.__ZUPLO_CONFIG){let y=atob(f.__ZUPLO_CONFIG);d=JSON.parse(y)}}catch(y){zV.console.error("Failed to parse runtime configuration",y)}this.config=d??{},this.build=s,this.runtime=f,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 zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.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.config.auth_client_id??this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.config.auth_client_secret??this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get authPublicKey(){return this.config.auth_public_key??this.runtime.__ZUPLO_AUTH_PUBLIC_KEY}get authPrivateKey(){return this.config.auth_private_key??this.runtime.__ZUPLO_AUTH_PRIVATE_KEY}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 isManagedDedicated(){return this.runtime.__ZUPLO_IS_MANAGED_DEDICATED==="true"}get isDeno(){if(this.runtime.__ZUPLO_RUNTIME_TYPE)return this.runtime.__ZUPLO_RUNTIME_TYPE==="deno";if(this.config.runtime_type)return this.config.runtime_type==="deno";{let s=globalThis.Deno?.version?.deno;return typeof WebSocketPair!="function"&&s}}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"}get rateLimitServiceTimeoutMs(){let s=this.runtime.__ZUPLO_RATE_LIMIT_TIMEOUT_MS,f=this.config.rate_limit_service_timeout_ms,d=s??f;if(!d)return 500;let y=Number(d);return Number.isFinite(y)&&y>0?y:500}};var dXt=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function ait(o){return o.startsWith("__ZUPLO")||o.startsWith("ZUPLO_")?!dXt.includes(o)&&!o.startsWith("ZUPLO_PUBLIC_"):o.startsWith("ZUDOKU_")?!o.startsWith("ZUDOKU_PUBLIC_"):!1}t(ait,"isRestrictedEnvVariableName");function oit(o){return!!o.startsWith("ZUPLO_")}t(oit,"isZuploReadableEnvVariableName");var Nkr=new Proxy({},{get(o,s){let f=String(s);switch(f){case"ZUPLO_ENVIRONMENT_TYPE":return Em.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return Em.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return Em.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return Em.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return Em.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return Em.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return Em.instance.build.COMPATIBILITY_DATE}if(!(ait(f)&&!oit(f)))return Em.instance.runtime[f]}});function $V(o,s,f){return`_${$P(`${o}_${s}_${f}`)}`}t($V,"getRawOperationDataIdentifierName");function dAe(o,s,f,d){return`_${$P(o.toLowerCase())}_${s.toLowerCase()}_${f.toLowerCase()}_${d.toLowerCase()}`}t(dAe,"getIdForParameterSchema");function mAe(o,s,f){return`_${$P(o.toLowerCase())}_${s.toLowerCase()}_rb_${$P(f.toLowerCase())}`}t(mAe,"getIdForRequestBodySchema");function JV(o,s){return`_${$P(o)}_${$P(s)}`}t(JV,"getIdForRefSchema");function $P(o){let s=o.replace(/\[/g,"_LBRACKET_").replace(/\]/g,"_RBRACKET_").replace(/\{/g,"_LCURLY_").replace(/\}/g,"_RCURLY_").replace(/\//g,"_SLASH_").replace(/-/g,"_DASH_").replace(/\./g,"_DOT_").replace(/\+/g,"_PLUS_").replace(/:/g,"_COLON_").replace(/@/g,"_AT_").replace(/\$/g,"_DOLLAR_").replace(/[^a-zA-Z0-9_]/g,"_");return/^[a-zA-Z_]/.test(s)||(s=`_${s}`),s}t($P,"sanitizedIdentifierName");var gAe={};Ytt(gAe,{UnsafePathError:()=>Yoe,deleteFolder:()=>DXt,dirExists:()=>hAe,fileExists:()=>yXt,getParentDirFilename:()=>CXt,isNotFileOrDirectory:()=>bXt,listFolderContents:()=>uit,listFolders:()=>TXt,mkDirTemp:()=>vXt,mkdirForFilePathIfNotExits:()=>xXt,mkdirIfNotExists:()=>fit,safePath:()=>EXt,tarFolder:()=>kXt,untarFile:()=>wXt});import{spawn as cit}from"node:child_process";import{randomUUID as mXt}from"node:crypto";import XN from"node:fs/promises";import{platform as hXt,tmpdir as gXt}from"node:os";import I1 from"node:path";var lit=[".git","node_modules",".yarn",".DS_Store"];async function yXt(o){try{return(await XN.stat(o)).isFile()}catch{return!1}}t(yXt,"fileExists");async function vXt(){let o=process.env.BUILD_FILE_PATH??gXt(),s=mXt().replaceAll("-",""),f=I1.join(o,s);return await XN.mkdir(f,{recursive:!0}),f}t(vXt,"mkDirTemp");async function hAe(o){try{return(await XN.stat(o)).isDirectory()}catch{return!1}}t(hAe,"dirExists");async function bXt(o){try{return await XN.stat(o),!1}catch{return!0}}t(bXt,"isNotFileOrDirectory");function SXt(o,s){let f=I1.sep==="\\"?"\\\\":I1.sep,d=new RegExp(`(.*)(${f}${s})$|(.*)(${s}${f})`),y=o.match(d);if(!y)return"";let x=o.split(y[0]);return x[1]===""?"":I1.join(I1.sep,x[1])}t(SXt,"getParentDirectory");async function TXt(o){if(!await hAe(o))return[];let s=await XN.readdir(o,{withFileTypes:!0}),f=[];for await(let d of s)lit.includes(d.name)||d.isDirectory()&&f.push(d.name);return f}t(TXt,"listFolders");async function uit(o,s,f=!0){let d=SXt(o,s),y=await XN.readdir(o,{withFileTypes:!0}),x=[];for await(let P of y)if(!lit.includes(P.name)||!f)if(P.isDirectory()){let F=await uit(I1.join(o,P.name),s,f);x.push(...F)}else x.push(I1.join(d,P.name));return x}t(uit,"listFolderContents");var fit=t(async o=>{await XN.mkdir(o,{recursive:!0})},"mkdirIfNotExists"),xXt=t(async o=>{let s=I1.dirname(o);return fit(s)},"mkdirForFilePathIfNotExits"),Yoe=class extends Error{static{t(this,"UnsafePathError")}};function EXt(o){let s=I1.normalize(o),f=t(d=>{let y=I1.normalize(d),x=process.platform==="win32",P=!1;if(x?P=y.toLowerCase().startsWith(s.toLowerCase()):P=y.startsWith(s),!P)throw new Yoe("Resolved path is not part of the project.");return y},"ensureSafePath");return{resolve:t((...d)=>f(I1.resolve(...d)),"resolve")}}t(EXt,"safePath");function CXt(o){return I1.join(I1.basename(I1.dirname(o)),I1.basename(o))}t(CXt,"getParentDirFilename");async function kXt({folderPath:o,outputTarPath:s,exclude:f=["node_modules",".git","dist"],logger:d}){let y=[],x=[],P;try{await new Promise((F,J)=>{let G=cit("tar",[...f.flatMap(Se=>["--exclude",Se]),...hXt()!=="darwin"?["--warning=no-file-changed"]:[],"-cvf",s,"-C",o,"."]);G.stdout.on("data",Se=>{let de=Se.toString().trim();de.length>0&&y.push(de.trim())}),G.stderr.on("data",Se=>{let de=Se.toString().trim();de.length>0&&x.push(de.trim())}),G.on("close",Se=>{P=Se,Se===0?F():J(new Error(`tar process exited with code ${Se}`))}),G.on("error",Se=>{J(Se)})})}catch(F){throw new Error("Failed to tar folder",{cause:F})}finally{d.info({stdout:y.join(`
|
|
571
|
+
`).map(F=>F.trim()).join(" ");case"%O":return o(f[d++]);case"%j":try{return JSON.stringify(f[d++])}catch{return"[Circular]"}default:return P}});for(let P of f.splice(d))P===null||!(typeof P=="object"&&P!==null)?x+=" "+P:x+=" "+o(P);return x}t(Xnt,"format");var Znt=t((o,...s)=>Xnt(cXt,o,s),"format");var cAe=class{static{t(this,"Debugger")}manager;ns;color;last;enabled;constructor(s,f){this.manager=s,this.ns=f,this.color=Knt(f),this.last=0,this.enabled=s.enabled.some(d=>d.test(f))}log(...s){if(!this.enabled)return;let f,d=s[0];typeof d=="function"?f=d():f=String(d);let y=Date.now()-(this.last||Date.now());f=Znt(f,...s);let x=`${this.color(this.ns)} ${f} ${this.color(`+${y}ms`)}`;console.log(x),this.last=Date.now()}},lAe=class{static{t(this,"DebugManager")}debuggers;enabled;constructor(s){this.debuggers=new Map,this.enabled=s??[]}};function lXt(o){return!o||o.length===0?[]:(o=o.replace(/\s/g,"").replace(/\*/g,".+"),o.split(",").map(s=>new RegExp(`^${s}$`)))}t(lXt,"extract");var Hoe;function Goe(o){Hoe||(Hoe=new lAe(lXt(process.env.DEBUG)));let s=new cAe(Hoe,o);return Hoe.debuggers.set(o,s),Object.assign(s.log.bind(s),{self:s})}t(Goe,"debug");var Qnt="zp-local-service";var tkr=Symbol("zuplo_meters"),rkr=Symbol("zuplo_dynamic_meters");var zP=class extends Error{static{t(this,"RuntimeError")}extensionMembers;constructor(s,f){typeof s=="string"?super(s,f):(super(s.message,f),this.extensionMembers=s.extensionMembers),this.name="RuntimeError"}};var KN=Goe("zuplo:runtime:external-service");function uXt(){let o,{__ZUPLO_EXTERNAL_SERVICE_TOKEN:s}=Em.instance.runtime;if(s&&s!=="undefined")try{let f=atob(s);o=JSON.parse(f)}catch{}return o}t(uXt,"getServiceAuth");async function eit(o,s){let f=".proxy",d=".tunnel";if(typeof o=="string"){let y=new URL(o),x=y.hostname;if(x.endsWith(f)){let Gt=x.slice(0,-f.length),jt=new URL(`http://${Gt}${y.pathname}${y.search}`);KN(`Routing to proxy: ${jt.toString()}`);let Pr=s??{};return UV(jt.toString(),Pr)}let P=x.endsWith(d),F=x.indexOf(".")===-1;if(!(P||F))throw new zP(`Invalid service hostname suffix: ${x}. Use .proxy for proxy routing, .tunnel for explicit tunnel routing, or no suffix for default tunnel routing.`);let G=P?x.slice(0,-d.length):x,Se=uXt();if(!Se)throw KN("There is no external service auth configured for this zup."),new zP("There are no external services configured for this zup.");KN(`Using external service auth. ClientId: ${Se.clientId})`);let de=s??{},ae=new Headers(de.headers||{});ae.set("CF-Access-Client-Id",Se.clientId),ae.set("CF-Access-Client-Secret",Se.clientSecret),de.headers=ae;let Ke;if(Se.customServiceMapping?.[G])Ke=`https://${Se.customServiceMapping[G]}`;else if(Em.instance.useLegacyServiceRouting)Ke=`https://${G}.zuptunnel.com`;else{KN("Using sha256 service routing");let Gt=Em.instance.build;if(Gt.ACCOUNT_NAME&&Gt.PROJECT_NAME&&Gt.ENVIRONMENT_TYPE){let jt=await fXt(G,Gt.ACCOUNT_NAME,Gt.PROJECT_NAME,Gt.ENVIRONMENT_TYPE),Pr=rit(Gt.ENVIRONMENT_TYPE),Fn=await uAe(`${Gt.ACCOUNT_NAME}-${Gt.PROJECT_NAME}-${Pr}`);Fn==="40d7ad502f5d743997999594c177184a00161a77865423511f3a1ea21eb5a5e"||Fn==="d05bffe8fa91a300187d2cf43e8aa4a56bd809c442ae10d1ee49af7d29a5a11"?Ke=`https://${jt}.zuptunnel.com`:Ke=`https://${jt}.t.zuplo.app`}else throw KN("Cannot use sha256 service routing, missing build variables"),new zP("Failed to generate fully qualified tunnel url.")}let $e=new URL(`${Ke}${y.pathname}${y.search}`);KN(`Calling external service: ${$e.toString()}`);let Fe=await UV($e.toString(),de);if(Fe.status===403&&Fe.headers.get("cf-access-domain")!==null)throw zV.console.error("403 Forbidden when calling external service.",{clientId:Se.clientId,tunnelHost:Ke}),new zP("Could not connect to secure tunnel.");return Fe}else throw KN("Cannot call external service with Request object"),new zP("Currently, we only support fetch(<some_string>, ...).")}t(eit,"externalServiceHandler");async function tit(o,s){if(typeof o=="string"){let f=new URL(o),d=f.hostname,y=s??{},x=`http://${d}.zuplo.svc.cluster.local:9000`,P=new URL(`${x}${f.pathname}${f.search}`),F=new Headers(y.headers||{});return F.set(Qnt,d),y.headers=F,await UV(P.toString(),y)}else throw new zP("Currently, we only support fetch(<some_string>, ...).")}t(tit,"clusterServiceHandler");async function fXt(o,s,f,d){let y=o.toLowerCase(),x=s.toLowerCase(),P=f.toLowerCase(),F=rit(d);KN(`Hashing service name: ${x}-${y}.${x}-${P}-${F}`);let J=await uAe(`${x}-${y}`),G=await uAe(`${x}-${P}-${F}`);return`${J}.${G}`}t(fXt,"hashServiceName");async function uAe(o){let s=new TextEncoder().encode(o),f=await crypto.subtle.digest("SHA-256",s);return Array.from(new Uint8Array(f)).map(x=>x.toString(16).padStart(2,"0")).join("").slice(0,-1)}t(uAe,"hashSegment");function rit(o){let s=o.toLowerCase();switch(s){case"production":case"preview":return s;default:return"working-copy"}}t(rit,"sanitizeEnvironmentType");var fAe=new Map;fAe.set("service:",eit);fAe.set("local:",tit);var UV=globalThis.fetch;function _Ae(o,s){let{transformedInit:f,mtlsCertificate:d}=_Xt(s);if(typeof o=="string"){let y=new URL(o),x=fAe.get(y.protocol);return x?x(o,f):nit(o,f,d)}else return nit(o,f,d)}t(_Ae,"internalFetch");globalThis.fetch=_Ae;function nit(o,s,f){if(!f)return UV(o,s);if(Em.instance.isCloudflare){let y=Em.instance.runtime[f];if(!y)throw new Error(`mTLS certificate binding '${f}' not found. Ensure the certificate is uploaded and properly configured.`);if(typeof y!="object"||typeof y.fetch!="function")throw new Error(`mTLS certificate binding '${f}' is not a valid mTLS certificate binding. Make sure it's configured as an mTLS certificate, not an environment variable.`);return y.fetch(o,s)}else if(Em.instance.isDeno){let d=globalThis.managedDedicatedMtlsBindings?.[f];if(!d)throw new Error(`mTLS certificate binding '${f}' not found. Ensure the certificate is uploaded and properly configured.`);if(typeof d.fetch!="function")throw new Error(`mTLS certificate binding '${f}' is not a valid mTLS certificate binding.`);return d.fetch(o,s)}else throw new Error("mTLS client certificates are not supported in this runtime environment")}t(nit,"performFetch");var _Xt=t(o=>{if(!o||o instanceof Request)return{transformedInit:o,mtlsCertificate:void 0};let s=o;if(!s.zuplo)return{transformedInit:o,mtlsCertificate:void 0};let f=s.zuplo.mtlsCertificate,d=o;return d.cf={cacheEverything:s.zuplo?.cacheEverything,cacheTtl:s.zuplo?.cacheTtlSeconds},delete o.zuplo,{transformedInit:o,mtlsCertificate:f}},"transformInit");var pXt={console:{log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),debug:console.debug.bind(console),assert:console.assert.bind(console),clear:console.clear.bind(console),count:console.count.bind(console),countReset:console.countReset.bind(console),dir:console.dir.bind(console),dirxml:console.dirxml.bind(console),group:console.group.bind(console),groupCollapsed:console.groupCollapsed.bind(console),groupEnd:console.groupEnd.bind(console),table:console.table.bind(console),time:console.time.bind(console),timeEnd:console.timeEnd.bind(console),timeLog:console.timeLog.bind(console),timeStamp:console.timeStamp.bind(console),trace:console.trace.bind(console),profile:console.profile.bind(console),profileEnd:console.profileEnd.bind(console)},fetch:_Ae},zV=pXt;var pAe="2025-02-06",iit=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2026-03-01":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,chainResponseSendingHooks:!0,return501ForUnsupportedHttpMethods:!0}});function sit(){return new Em({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:pAe,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:iit[pAe]},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:"",ZUPLO_SERVICE_BUCKET_ID:"mock-bucket-id"}})}t(sit,"getMockEnvironment");var Em=class o{static{t(this,"Environment")}config;static#e;static#n=!1;static initialize(s){o.#e||(o.#e=new o(s),o.#n=!0)}static get instance(){return o.#n||(zV.console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),o.#e=sit()),o.#e}constructor({build:s,runtime:f}){let d;try{if(f.ZUPLO_SYSTEM_CONFIGURATIONS){let y=new TextDecoder().decode(Voe.decode(f.ZUPLO_SYSTEM_CONFIGURATIONS)),x=JSON.parse(y);for(let P of Object.keys(x))f[P]||(f[P]=x[P])}if(f.__ZUPLO_CONFIG){let y=atob(f.__ZUPLO_CONFIG);d=JSON.parse(y)}}catch(y){zV.console.error("Failed to parse runtime configuration",y)}this.config=d??{},this.build=s,this.runtime=f,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 zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.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.config.auth_client_id??this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.config.auth_client_secret??this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get authPublicKey(){return this.config.auth_public_key??this.runtime.__ZUPLO_AUTH_PUBLIC_KEY}get authPrivateKey(){return this.config.auth_private_key??this.runtime.__ZUPLO_AUTH_PRIVATE_KEY}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 isManagedDedicated(){return this.runtime.__ZUPLO_IS_MANAGED_DEDICATED==="true"}get isDeno(){if(this.runtime.__ZUPLO_RUNTIME_TYPE)return this.runtime.__ZUPLO_RUNTIME_TYPE==="deno";if(this.config.runtime_type)return this.config.runtime_type==="deno";{let s=globalThis.Deno?.version?.deno;return typeof WebSocketPair!="function"&&s}}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"}get rateLimitServiceTimeoutMs(){let s=this.runtime.__ZUPLO_RATE_LIMIT_TIMEOUT_MS,f=this.config.rate_limit_service_timeout_ms,d=s??f;if(!d)return 500;let y=Number(d);return Number.isFinite(y)&&y>0?y:500}};var dXt=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function ait(o){return o.startsWith("__ZUPLO")||o.startsWith("ZUPLO_")?!dXt.includes(o)&&!o.startsWith("ZUPLO_PUBLIC_"):o.startsWith("ZUDOKU_")?!o.startsWith("ZUDOKU_PUBLIC_"):!1}t(ait,"isRestrictedEnvVariableName");function oit(o){return!!o.startsWith("ZUPLO_")}t(oit,"isZuploReadableEnvVariableName");var Nkr=new Proxy({},{get(o,s){let f=String(s);switch(f){case"ZUPLO_ENVIRONMENT_TYPE":return Em.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return Em.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return Em.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return Em.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return Em.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return Em.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return Em.instance.build.COMPATIBILITY_DATE}if(!(ait(f)&&!oit(f)))return Em.instance.runtime[f]}});function $V(o,s,f){return`_${$P(`${o}_${s}_${f}`)}`}t($V,"getRawOperationDataIdentifierName");function dAe(o,s,f,d){return`_${$P(o.toLowerCase())}_${s.toLowerCase()}_${f.toLowerCase()}_${d.toLowerCase()}`}t(dAe,"getIdForParameterSchema");function mAe(o,s,f){return`_${$P(o.toLowerCase())}_${s.toLowerCase()}_rb_${$P(f.toLowerCase())}`}t(mAe,"getIdForRequestBodySchema");function JV(o,s){return`_${$P(o)}_${$P(s)}`}t(JV,"getIdForRefSchema");function $P(o){let s=o.replace(/\[/g,"_LBRACKET_").replace(/\]/g,"_RBRACKET_").replace(/\{/g,"_LCURLY_").replace(/\}/g,"_RCURLY_").replace(/\//g,"_SLASH_").replace(/-/g,"_DASH_").replace(/\./g,"_DOT_").replace(/\+/g,"_PLUS_").replace(/:/g,"_COLON_").replace(/@/g,"_AT_").replace(/\$/g,"_DOLLAR_").replace(/[^a-zA-Z0-9_]/g,"_");return/^[a-zA-Z_]/.test(s)||(s=`_${s}`),s}t($P,"sanitizedIdentifierName");var gAe={};Ytt(gAe,{UnsafePathError:()=>Yoe,deleteFolder:()=>DXt,dirExists:()=>hAe,fileExists:()=>yXt,getParentDirFilename:()=>CXt,isNotFileOrDirectory:()=>bXt,listFolderContents:()=>uit,listFolders:()=>TXt,mkDirTemp:()=>vXt,mkdirForFilePathIfNotExits:()=>xXt,mkdirIfNotExists:()=>fit,safePath:()=>EXt,tarFolder:()=>kXt,untarFile:()=>wXt});import{spawn as cit}from"node:child_process";import{randomUUID as mXt}from"node:crypto";import XN from"node:fs/promises";import{platform as hXt,tmpdir as gXt}from"node:os";import I1 from"node:path";var lit=[".git","node_modules",".yarn",".DS_Store"];async function yXt(o){try{return(await XN.stat(o)).isFile()}catch{return!1}}t(yXt,"fileExists");async function vXt(){let o=process.env.BUILD_FILE_PATH??gXt(),s=mXt().replaceAll("-",""),f=I1.join(o,s);return await XN.mkdir(f,{recursive:!0}),f}t(vXt,"mkDirTemp");async function hAe(o){try{return(await XN.stat(o)).isDirectory()}catch{return!1}}t(hAe,"dirExists");async function bXt(o){try{return await XN.stat(o),!1}catch{return!0}}t(bXt,"isNotFileOrDirectory");function SXt(o,s){let f=I1.sep==="\\"?"\\\\":I1.sep,d=new RegExp(`(.*)(${f}${s})$|(.*)(${s}${f})`),y=o.match(d);if(!y)return"";let x=o.split(y[0]);return x[1]===""?"":I1.join(I1.sep,x[1])}t(SXt,"getParentDirectory");async function TXt(o){if(!await hAe(o))return[];let s=await XN.readdir(o,{withFileTypes:!0}),f=[];for await(let d of s)lit.includes(d.name)||d.isDirectory()&&f.push(d.name);return f}t(TXt,"listFolders");async function uit(o,s,f=!0){let d=SXt(o,s),y=await XN.readdir(o,{withFileTypes:!0}),x=[];for await(let P of y)if(!lit.includes(P.name)||!f)if(P.isDirectory()){let F=await uit(I1.join(o,P.name),s,f);x.push(...F)}else x.push(I1.join(d,P.name));return x}t(uit,"listFolderContents");var fit=t(async o=>{await XN.mkdir(o,{recursive:!0})},"mkdirIfNotExists"),xXt=t(async o=>{let s=I1.dirname(o);return fit(s)},"mkdirForFilePathIfNotExits"),Yoe=class extends Error{static{t(this,"UnsafePathError")}};function EXt(o){let s=I1.normalize(o),f=t(d=>{let y=I1.normalize(d),x=process.platform==="win32",P=!1;if(x?P=y.toLowerCase().startsWith(s.toLowerCase()):P=y.startsWith(s),!P)throw new Yoe("Resolved path is not part of the project.");return y},"ensureSafePath");return{resolve:t((...d)=>f(I1.resolve(...d)),"resolve")}}t(EXt,"safePath");function CXt(o){return I1.join(I1.basename(I1.dirname(o)),I1.basename(o))}t(CXt,"getParentDirFilename");async function kXt({folderPath:o,outputTarPath:s,exclude:f=["node_modules",".git","dist"],logger:d}){let y=[],x=[],P;try{await new Promise((F,J)=>{let G=cit("tar",[...f.flatMap(Se=>["--exclude",Se]),...hXt()!=="darwin"?["--warning=no-file-changed"]:[],"-cvf",s,"-C",o,"."]);G.stdout.on("data",Se=>{let de=Se.toString().trim();de.length>0&&y.push(de.trim())}),G.stderr.on("data",Se=>{let de=Se.toString().trim();de.length>0&&x.push(de.trim())}),G.on("close",Se=>{P=Se,Se===0?F():J(new Error(`tar process exited with code ${Se}`))}),G.on("error",Se=>{J(Se)})})}catch(F){throw new Error("Failed to tar folder",{cause:F})}finally{d.info({stdout:y.join(`
|
|
572
572
|
`),stderr:x.join(`
|
|
573
573
|
`),exitCode:P},"Tar process logs")}}t(kXt,"tarFolder");async function wXt({tarFilePath:o,outputDir:s,logger:f}){let d=[],y=[],x;try{await new Promise((P,F)=>{let J=cit("sh",["-c",`tar -xvf ${o} -C ${s};`]);J.stdout.on("data",G=>{let Se=G.toString().trim();Se.length>0&&d.push(Se.trim())}),J.stderr.on("data",G=>{let Se=G.toString().trim();Se.length>0&&y.push(Se.trim())}),J.on("close",G=>{x=G,G===0?P():F(new Error(`tar process exited with code ${G}`))}),J.on("error",G=>{F(G)})})}catch(P){throw new Error("Failed to untar file",{cause:P})}finally{f.info({stdout:d.join(`
|
|
574
574
|
`),stderr:y.join(`
|
package/index.minified.js
CHANGED
|
@@ -568,7 +568,7 @@ globstar while`,s,ae,f,Ke,$e),this.matchOne(s.slice(ae),f.slice(Ke),d))return th
|
|
|
568
568
|
`],[102,"\f"],[114,"\r"],[116," "]]),zoe=new Map([...MV,[118,"\v"],[48,"\0"]]),tXt=new Map([[iAe,iAe],["\\","\\"],["/","/"],["\b","b"],[`
|
|
569
569
|
`,"n"],["\f","f"],["\r","r"],[" ","t"]]),$Cr=new Map([...tXt,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),Uoe=new Map([[WKt,"LBracket"],[qKt,"RBracket"],[VKt,"LBrace"],[HKt,"RBrace"],[GKt,"Colon"],[YKt,"Comma"],[KKt,"Boolean"],[XKt,"Boolean"],[ZKt,"Null"]]),Boe=new Map([...Uoe,[QKt,"Number"],[eXt,"Number"]]),sAe=new Set([10,13,8232,8233]),JP=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:f,column:d,offset:y}){super(`${s} (${f}:${d})`),this.line=f,this.column=d,this.offset=y}},aAe=class extends JP{static{t(this,"UnexpectedChar")}constructor(s,f){super(`Unexpected character '${String.fromCharCode(s)}' found.`,f)}},oAe=class extends JP{static{t(this,"UnexpectedIdentifier")}constructor(s,f){super(`Unexpected identifier '${s}' found.`,f)}},hO=class extends JP{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},$oe=class extends JP{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},rXt=/[\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]/,nXt=/[\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]/,iXt=13,Vnt=10,cAe=class{static{t(this,"CharCodeReader")}#e="";#n=1;#t=0;#r=-1;#s=!1;#p=-1;#o=!1;constructor(s){this.#e=s}#_(){this.#o||(this.#t++,this.#r++,this.#p=-1,this.#o=!0)}locate(){return{line:this.#n,column:this.#t,offset:this.#r}}next(){if(this.#r>=this.#e.length-1)return this.#_(),-1;this.#r++;let s=this.#e.charCodeAt(this.#r);return this.#s?(this.#n++,this.#t=1,this.#s=!1):this.#t++,s===iXt?(this.#s=!0,this.peek()===Vnt&&this.#r++):s===Vnt&&(this.#s=!0),this.#p=s,s}peek(){return this.#r===this.#e.length-1?-1:this.#e.charCodeAt(this.#r+1)}match(s){return s(this.peek())?(this.next(),!0):!1}current(){return this.#p}},sXt="Infinity",aXt="NaN",oXt=new Set([116,102,110]),lAe=new Set([32,9,10,13]),Hnt=new Set([...lAe,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),cXt={mode:"json",ranges:!1},lXt=new Set(["true","false","null"]),y_={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(o){return o>=48&&o<=57}t($P,"isDigit");function nAe(o){return $P(o)||o>=65&&o<=70||o>=97&&o<=102}t(nAe,"isHexDigit");function uXt(o){return o>=49&&o<=57}t(uXt,"isPositiveDigit");function fXt(o){return oXt.has(o)}t(fXt,"isKeywordStart");function Ynt(o){return $P(o)||o===46||o===45}t(Ynt,"isNumberStart");function _Xt(o){return Ynt(o)||o===43}t(_Xt,"isJSON5NumberStart");function Gnt(o,s){return o===34||s&&o===39}t(Gnt,"isStringStart");function Knt(o){if(o===36||o===95||o===92||o>=97&&o<=122||o>=65&&o<=90||o===8204||o===8205)return!0;let s=String.fromCharCode(o);return rXt.test(s)}t(Knt,"isJSON5IdentifierStart");function pXt(o){if(Knt(o)||$P(o))return!0;let s=String.fromCharCode(o);return nXt.test(s)}t(pXt,"isJSON5IdentifierPart");var uAe=class{static{t(this,"Tokenizer")}#e;#n;#t;#r;#s;#p;#o;#_;#u;#c;#i;constructor(s,f){this.#n=s,this.#e={...cXt,...f},this.#t=new cAe(s),this.#r=this.#e.mode==="json5",this.#s=this.#e.mode!=="json",this.#p=this.#e.ranges,this.#_=this.#r?zoe.has.bind(zoe):MV.has.bind(MV),this.#u=this.#r?sAe.has.bind(sAe):()=>!1,this.#c=this.#r?d=>d===120:()=>!1,this.#i=this.#r?Hnt.has.bind(Hnt):lAe.has.bind(lAe)}#a(s,f=this.#t.locate()){throw new aAe(s,f)}#h(s,f=this.#t.locate()){throw new oAe(s,f)}#m(){throw new $oe(this.#t.locate())}#f(s,f,d,y){let x=d.offset+f,P=this.#e.ranges?{range:[d.offset,x]}:void 0;return{type:s,loc:{start:d,end:y||{line:d.line,column:d.column+f,offset:x}},...P}}#d(s){let f="",d;for(let y=0;y<s;y++){if(d=this.#t.peek(),nAe(d)){this.#t.next(),f+=String.fromCharCode(d);continue}this.#a(d)}return f}#g(s){let f="";do{if(f+=String.fromCharCode(s),s===92&&(s=this.#t.next(),s!==117&&this.#a(s),f+=String.fromCharCode(s),f+=this.#d(4)),s=this.#t.peek(),!pXt(s))break;this.#t.next()}while(!0);return f}#y(s){let f=s,d=1;for(s=this.#t.peek();s!==-1&&s!==f;){if(this.#t.next(),d++,s===92)if(s=this.#t.peek(),this.#_(s)||this.#u(s))this.#t.next(),d++;else if(s===117){this.#t.next(),d++;let y=this.#d(4);d+=y.length}else if(this.#c(s)){this.#t.next(),d++;let y=this.#d(2);d+=y.length}else this.#r?(this.#t.next(),d++):this.#a(s);s=this.#t.peek()}return s===-1&&(this.#t.next(),this.#m()),this.#t.next(),d++,d}#E(s){let f=1;if(s===45||this.#r&&s===43){if(s=this.#t.peek(),this.#r&&(s===73||s===78)){this.#t.next();let d=this.#g(s);return d!==sXt&&d!==aXt&&this.#a(s),f+d.length}$P(s)||this.#a(s),this.#t.next(),f++}if(s===48)if(s=this.#t.peek(),this.#r&&(s===120||s===88)){this.#t.next(),f++,s=this.#t.peek(),nAe(s)||(this.#t.next(),this.#a(s));do this.#t.next(),f++,s=this.#t.peek();while(nAe(s))}else $P(s)&&this.#a(s);else if(!this.#r||s!==46)for(uXt(s)||this.#a(s),s=this.#t.peek();$P(s);)this.#t.next(),f++,s=this.#t.peek();if(s===46){let d=-1;for(this.#t.next(),f++,d++,s=this.#t.peek();$P(s);)this.#t.next(),f++,d++,s=this.#t.peek();!this.#r&&d===0&&(this.#t.next(),s?this.#a(s):this.#m())}if(s===101||s===69)for(this.#t.next(),f++,s=this.#t.peek(),(s===43||s===45)&&(this.#t.next(),f++,s=this.#t.peek()),s===-1&&(this.#t.next(),this.#m()),$P(s)||(this.#t.next(),this.#a(s));$P(s);)this.#t.next(),f++,s=this.#t.peek();return f}#T(s){let f=1;if(s=this.#t.peek(),s===47){do this.#t.next(),f+=1,s=this.#t.peek();while(s>-1&&s!==13&&s!==10);return{length:f,multiline:!1}}if(s===42){for(this.#t.next(),f+=1;s>-1;)if(s=this.#t.peek(),s===42){if(this.#t.next(),f+=1,s=this.#t.peek(),s===47)return this.#t.next(),f+=1,{length:f,multiline:!0}}else this.#t.next(),f+=1;this.#t.next(),this.#m()}this.#t.next(),this.#a(s)}next(){let s=this.#t.next();for(;this.#i(s);)s=this.#t.next();if(s===-1)return y_.EOF;let f=this.#t.locate(),d=String.fromCharCode(s);if(this.#r)if(Boe.has(d))this.#o=this.#f(Boe.get(d),1,f);else if(Knt(s)){let y=this.#g(s);Boe.has(y)?this.#o=this.#f(Boe.get(y),y.length,f):this.#o=this.#f("Identifier",y.length,f)}else if(_Xt(s)){let y=this.#E(s);this.#o=this.#f("Number",y,f)}else if(Gnt(s,this.#r)){let y=this.#y(s),x=this.#t.locate();this.#o=this.#f("String",y,f,{line:x.line,column:x.column+1,offset:x.offset+1})}else if(s===47&&this.#s){let y=this.#T(s),x=this.#t.locate();this.#o=this.#f(y.multiline?"BlockComment":"LineComment",y.length,f,{line:x.line,column:x.column+1,offset:x.offset+1})}else this.#a(s);else if(Uoe.has(d))this.#o=this.#f(Uoe.get(d),1,f);else if(fXt(s)){let y=this.#g(s);lXt.has(y)||this.#h(y,f),this.#o=this.#f(Uoe.get(y),y.length,f)}else if(Ynt(s)){let y=this.#E(s);this.#o=this.#f("Number",y,f)}else if(Gnt(s,this.#r)){let y=this.#y(s);this.#o=this.#f("String",y,f)}else if(s===47&&this.#s){let y=this.#T(s),x=this.#t.locate();this.#o=this.#f(y.multiline?"BlockComment":"LineComment",y.length,f,{line:x.line,column:x.column+1,offset:x.offset+1})}else this.#a(s);return y_[this.#o.type]}get token(){return this.#o}};var oT={document(o,s={}){return{type:"Document",body:o,loc:s.loc,...s}},string(o,s={}){return{type:"String",value:o,loc:s.loc,...s}},number(o,s={}){return{type:"Number",value:o,loc:s.loc,...s}},boolean(o,s={}){return{type:"Boolean",value:o,loc:s.loc,...s}},null(o={}){return{type:"Null",loc:o.loc,...o}},array(o,s={}){return{type:"Array",elements:o,loc:s.loc,...s}},element(o,s={}){return{type:"Element",value:o,loc:s.loc,...s}},object(o,s={}){return{type:"Object",members:o,loc:s.loc,...s}},member(o,s,f={}){return{type:"Member",name:o,value:s,loc:f.loc,...f}},identifier(o,s={}){return{type:"Identifier",name:o,loc:s.loc,...s}},nan(o="",s={}){return{type:"NaN",sign:o,loc:s.loc,...s}},infinity(o="",s={}){return{type:"Infinity",sign:o,loc:s.loc,...s}}},dXt={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function mXt(o,s,f=!1){let d="",y=o.indexOf("\\"),x=0;for(;y>=0;){d+=o.slice(x,y);let P=o.charAt(y+1),F=P.charCodeAt(0);if(f&&zoe.has(F))d+=zoe.get(F),x=y+2;else if(MV.has(F))d+=MV.get(F),x=y+2;else if(P==="u"){let J=o.slice(y+2,y+6);if(J.length<4||/[^0-9a-f]/i.test(J))throw new JP(`Invalid unicode escape \\u${J}.`,{line:s.loc.start.line,column:s.loc.start.column+y,offset:s.loc.start.offset+y});d+=String.fromCharCode(parseInt(J,16)),x=y+6}else if(f&&P==="x"){let J=o.slice(y+2,y+4);if(J.length<2||/[^0-9a-f]/i.test(J))throw new JP(`Invalid hex escape \\x${J}.`,{line:s.loc.start.line,column:s.loc.start.column+y,offset:s.loc.start.offset+y});d+=String.fromCharCode(parseInt(J,16)),x=y+4}else if(f&&sAe.has(F))x=y+2,P==="\r"&&o.charAt(x)===`
|
|
570
570
|
`&&x++;else if(f)d+=P,x=y+2;else throw new JP(`Invalid escape \\${P}.`,{line:s.loc.start.line,column:s.loc.start.column+y,offset:s.loc.start.offset+y});y=o.indexOf("\\",x)}return d+=o.slice(x),d}t(mXt,"getStringValue");function hXt(o,s,f=!1){switch(s.type){case"Boolean":return o==="true";case"Number":return Number(o);case"String":return mXt(o.slice(1,-1),s,f);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(hXt,"getLiteralValue");function Xnt(o,s){s=Object.freeze({...dXt,...s});let f=[],d=new uAe(o,{mode:s.mode,ranges:s.ranges}),y=s.mode==="json5",x=s.allowTrailingCommas||y;function P(){let Er=d.next();return Er&&s.tokens&&f.push(d.token),Er}t(P,"nextNoComments");function F(){let Er=d.next();return Er&&s.tokens&&f.push(d.token),Er>=y_.LineComment?F():Er}t(F,"nextSkipComments");let J=s.mode==="json"?P:F;function G(Er,vr){if(Er!==vr)throw new hO(d.token)}t(G,"assertTokenType");function Se(Er,vr){if(!vr.includes(Er))throw new hO(d.token)}t(Se,"assertTokenTypes");function de(Er,vr){return s.ranges?{range:[Er.offset,vr.offset]}:void 0}t(de,"createRange");function ae(Er){let vr=d.token,ls=de(vr.loc.start,vr.loc.end),Ni=hXt(o.slice(vr.loc.start.offset,vr.loc.end.offset),vr,y),bi={loc:{start:{...vr.loc.start},end:{...vr.loc.end}},...ls};switch(Er){case y_.String:return oT.string(Ni,bi);case y_.Number:return oT.number(Ni,bi);case y_.Boolean:return oT.boolean(Ni,bi);default:throw new TypeError(`Unknown token type ${vr.type}.`)}}t(ae,"createLiteralNode");function Ke(Er){let vr=de(Er.loc.start,Er.loc.end),ls=o.slice(Er.loc.start.offset,Er.loc.end.offset),nc={loc:{start:{...Er.loc.start},end:{...Er.loc.end}},...vr};if(Er.type!=="Identifier"){let bi="";return(ls[0]==="+"||ls[0]==="-")&&(bi=ls[0]),oT[ls.includes("NaN")?"nan":"infinity"](bi,nc)}return oT.identifier(ls,nc)}t(Ke,"createJSON5IdentifierNode");function $e(Er){let vr=de(Er.loc.start,Er.loc.end);return oT.null({loc:{start:{...Er.loc.start},end:{...Er.loc.end}},...vr})}t($e,"createNullNode");function Fe(Er){y?Se(Er,[y_.String,y_.Identifier,y_.Number]):G(Er,y_.String);let vr=d.token,ls=Er===y_.String?ae(Er):Ke(vr);if(y&&(ls.type==="NaN"||ls.type==="Infinity")){if(ls.sign!=="")throw new hO(d.token);ls=oT.identifier(ls.type,{loc:ls.loc,...de(ls.loc.start,ls.loc.end)})}Er=J(),G(Er,y_.Colon);let Ni=Pr(),nc=de(ls.loc.start,Ni.loc.end);return oT.member(ls,Ni,{loc:{start:{...ls.loc.start},end:{...Ni.loc.end}},...nc})}t(Fe,"parseProperty");function Gt(Er){G(Er,y_.LBrace);let vr=d.token,ls=[],Ni=J();if(Ni!==y_.RBrace)do{if(ls.push(Fe(Ni)),Ni=J(),!Ni)throw new $oe(ls[ls.length-1].loc.end);if(Ni===y_.Comma){if(Ni=J(),x&&Ni===y_.RBrace)break}else break}while(Ni);G(Ni,y_.RBrace);let nc=d.token,bi=de(vr.loc.start,nc.loc.end);return oT.object(ls,{loc:{start:{...vr.loc.start},end:{...nc.loc.end}},...bi})}t(Gt,"parseObject");function jt(Er){G(Er,y_.LBracket);let vr=d.token,ls=[],Ni=J();if(Ni!==y_.RBracket)do{let Qf=Pr(Ni);if(ls.push(oT.element(Qf,{loc:Qf.loc})),Ni=J(),Ni===y_.Comma){if(Ni=J(),x&&Ni===y_.RBracket)break}else break}while(Ni);G(Ni,y_.RBracket);let nc=d.token,bi=de(vr.loc.start,nc.loc.end);return oT.array(ls,{loc:{start:{...vr.loc.start},end:{...nc.loc.end}},...bi})}t(jt,"parseArray");function Pr(Er){Er=Er??J();let vr=d.token;switch(Er){case y_.String:case y_.Boolean:return ae(Er);case y_.Number:if(y){let ls=o.slice(vr.loc.start.offset,vr.loc.end.offset);if((ls[0]==="+"||ls[0]==="-")&&(ls=ls.slice(1)),ls==="NaN"||ls==="Infinity")return Ke(vr)}return ae(Er);case y_.Null:return $e(vr);case y_.LBrace:return Gt(Er);case y_.LBracket:return jt(Er);default:throw new hO(vr)}}t(Pr,"parseValue");let Fn=Pr();if(J())throw new hO(d.token);let Un={loc:{start:{line:1,column:1,offset:0},end:{...Fn.loc.end}}};return s.tokens&&(Un.tokens=f),s.ranges&&(Un.range=[Un.loc.start.offset,Un.loc.end.offset]),oT.document(Fn,Un)}t(Xnt,"parse");var gXt=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function Znt(o){return o&&typeof o=="object"}t(Znt,"isObject");function yXt(o){return Znt(o)&&typeof o.type=="string"}t(yXt,"isNode");function vXt(o,s){function f(d,y){typeof s.enter=="function"&&s.enter(d,y);for(let x of gXt.get(d.type)){let P=d[x];Znt(P)&&(Array.isArray(P)?P.forEach(F=>f(F,d)):yXt(P)&&f(P,d))}typeof s.exit=="function"&&s.exit(d,y)}t(f,"visitNode"),f(o)}t(vXt,"traverse");function Qnt(o,s=()=>!0){let f=[];return vXt(o,{enter(d,y){f.push({node:d,parent:y,phase:"enter"})},exit(d,y){f.push({node:d,parent:y,phase:"exit"})}}),f.filter(s).values()}t(Qnt,"iterator");import bXt from"node:fs/promises";var jV=t((o,s)=>o.split(/\r?\n/)[s-1],"getFileLineContent"),Joe=t(async o=>{try{return await bXt.readFile(o,"utf-8")}catch{return}},"getSchemaContent"),BV=t(async o=>{try{return Xnt(o)}catch(s){if(s.column&&s.line&&s.message){let f=jV(o,s.line);return{column:s.column,line:s.line,length:void 0,lineText:f}}return}},"getSchemaAST");var eit=t(async(o,s,f)=>{try{if(o.length===0)return;for(let d of o){let y=await Joe(d),x=await SXt(y,d,s,f);if(x)return x}}catch{}},"getRouteLocationByValue"),SXt=t(async(o,s,f,d)=>{try{if(!o)return;let y=null,x=await BV(o);if(x){for(let{node:P}of Qnt(x))if(P.value&&P.value===f){y=P.loc;break}if(y!==null){let P=jV(o,y.start.line);return{file:s,line:y.start.line,column:y.start.column,length:y.end.column-y.start.column,lineText:P,suggestion:d}}}}catch{}},"getRouteLocationByValueFromSchema");import tit from"node:fs/promises";import SE from"node:path";var fAe="schemas",_Ae=".oas.json";var gO=t(async o=>(await tit.readdir(o)).map(f=>SE.join(o,f)).filter(f=>f.endsWith(_Ae)).sort(),"getOpenApiFilesByAlphabetical"),Z9=t(async o=>{let s=SE.resolve(o,"config");return(await tit.readdir(s)).filter(d=>d.endsWith(_Ae)).length>=1},"oasFileInProject");function UV(o,s,f,d,y,x,P){if(x.has(f))return;let F;try{F=d.get(f)}catch($e){throw new D1({text:`Failed to resolve reference: ${f}`,detail:$e.message,severity:"error",message:"Failed to resolve reference",location:{file:o,column:0,line:0,length:0,lineText:f,namespace:s,suggestion:"Check the reference and try again."}})}let J=qoe(f),G=SE.basename(J,SE.extname(J)),Se=f.indexOf("#"),de=Se>=0?f.substring(0,Se):f,ae=Se>=0?f.substring(Se+1):"",Ke=d.get(de);if(ae){let $e=ae.split("/").filter(Boolean);for(let Fe of $e)if(Ke=Ke[Fe],Ke===void 0)throw new Error(`Cannot resolve JSON pointer: ${ae}`)}if(Ke&&typeof Ke=="object"&&"$ref"in Ke&&typeof Ke.$ref=="string"&&!Ke.$ref.startsWith("#")){let $e=SE.resolve(SE.dirname(de),Ke.$ref);if(J=$e,G=SE.basename(J,SE.extname(J)),de=$e,x.has(de)){let Gt=x.get(de);if(Gt===void 0)throw new Error(`Expected to find ${de} in refsVisited map`);x.set(f,Gt);return}let Fe=y.length;x.set(f,Fe),x.set(de,Fe),y.push(de),Woe(J,G,F,d,y,x,P)}else x.set(f,y.length),y.push(f),Woe(qoe(f),s,F,d,y,x,P)}t(UV,"chaseRefs");function Woe(o,s,f,d,y,x,P){if(Array.isArray(f))for(let F of f)Woe(o,s,F,d,y,x,P);else if(typeof f=="object")for(let F in f){if(F==="$ref"){let J=f[F];P&&(f[F]=P(s,J,o)),UV(o,s,ZN(o,J),d,y,x,P)}Woe(o,s,f[F],d,y,x,P)}}t(Woe,"lookForRefs");function ZN(o,s){let f=s.indexOf("#");return f>=0?`${SE.resolve(o,s.substring(0,f))}${s.substring(f)}`:SE.resolve(SE.dirname(o),s)}t(ZN,"getFullyQualifiedRefName");function qoe(o){let s=o.indexOf("#");return s>=0?o.substring(0,s):o}t(qoe,"getFilePathNameFromRefName");import ble from"node:path";function TXt(o){if(o.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let G=0;G<s.length;G++)s[G]=255;for(let G=0;G<o.length;G++){let Se=o.charAt(G),de=Se.charCodeAt(0);if(s[de]!==255)throw new TypeError(Se+" is ambiguous");s[de]=G}let f=o.length,d=o.charAt(0),y=Math.log(f)/Math.log(256),x=Math.log(256)/Math.log(f);function P(G){if(G instanceof Uint8Array||(ArrayBuffer.isView(G)?G=new Uint8Array(G.buffer,G.byteOffset,G.byteLength):Array.isArray(G)&&(G=Uint8Array.from(G))),!(G instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(G.length===0)return"";let Se=0,de=0,ae=0,Ke=G.length;for(;ae!==Ke&&G[ae]===0;)ae++,Se++;let $e=(Ke-ae)*x+1>>>0,Fe=new Uint8Array($e);for(;ae!==Ke;){let Pr=G[ae],Fn=0;for(let sn=$e-1;(Pr!==0||Fn<de)&&sn!==-1;sn--,Fn++)Pr+=256*Fe[sn]>>>0,Fe[sn]=Pr%f>>>0,Pr=Pr/f>>>0;if(Pr!==0)throw new Error("Non-zero carry");de=Fn,ae++}let Gt=$e-de;for(;Gt!==$e&&Fe[Gt]===0;)Gt++;let jt=d.repeat(Se);for(;Gt<$e;++Gt)jt+=o.charAt(Fe[Gt]);return jt}t(P,"encode");function F(G){if(typeof G!="string")throw new TypeError("Expected String");if(G.length===0)return new Uint8Array;let Se=0,de=0,ae=0;for(;G[Se]===d;)de++,Se++;let Ke=(G.length-Se)*y+1>>>0,$e=new Uint8Array(Ke);for(;G[Se];){let Pr=s[G.charCodeAt(Se)];if(Pr===255)return;let Fn=0;for(let sn=Ke-1;(Pr!==0||Fn<ae)&&sn!==-1;sn--,Fn++)Pr+=f*$e[sn]>>>0,$e[sn]=Pr%256>>>0,Pr=Pr/256>>>0;if(Pr!==0)throw new Error("Non-zero carry");ae=Fn,Se++}let Fe=Ke-ae;for(;Fe!==Ke&&$e[Fe]===0;)Fe++;let Gt=new Uint8Array(de+(Ke-Fe)),jt=de;for(;Fe!==Ke;)Gt[jt++]=$e[Fe++];return Gt}t(F,"decodeUnsafe");function J(G){let Se=F(G);if(Se)return Se;throw new Error("Non-base"+f+" character")}return t(J,"decode"),{encode:P,decodeUnsafe:F,decode:J}}t(TXt,"base");var rit=TXt;var xXt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Voe=rit(xXt);var EXt=!1;function Q9(o,s){return{open:`\x1B[${o.join(";")}m`,close:`\x1B[${s}m`,regexp:new RegExp(`\\x1b\\[${s}m`,"g")}}t(Q9,"code");function eM(o,s){return EXt?`${s.open}${o.replace(s.regexp,s.open)}${s.close}`:o}t(eM,"run");function CXt(o){return eM(o,Q9([31],39))}t(CXt,"red");function kXt(o){return eM(o,Q9([32],39))}t(kXt,"green");function wXt(o){return eM(o,Q9([33],39))}t(wXt,"yellow");function DXt(o){return eM(o,Q9([34],39))}t(DXt,"blue");function PXt(o){return eM(o,Q9([35],39))}t(PXt,"magenta");function AXt(o){return eM(o,Q9([36],39))}t(AXt,"cyan");var ukr=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");var nit=[CXt,kXt,wXt,DXt,PXt,AXt];function NXt(o){let s=0,f=o.length,d=0;if(f>0)for(;d<f;)s=(s<<5)-s+o.charCodeAt(d++)|0;return s}t(NXt,"hashCode");function iit(o){let s=Math.abs(NXt(o));return nit[s%nit.length]}t(iit,"generateColor");import{inspect as IXt}from"node:util";function sit(o,s,...f){let d=0,y=f.length,x=String(s).replace(/%[sdjoO%]/g,P=>{if(P==="%%")return"%";if(d>=y)return P;switch(P){case"%s":return String(f[d++]);case"%d":return Number(f[d++]).toString();case"%o":return o(f[d++]).split(`
|
|
571
|
-
`).map(F=>F.trim()).join(" ");case"%O":return o(f[d++]);case"%j":try{return JSON.stringify(f[d++])}catch{return"[Circular]"}default:return P}});for(let P of f.splice(d))P===null||!(typeof P=="object"&&P!==null)?x+=" "+P:x+=" "+o(P);return x}t(sit,"format");var ait=t((o,...s)=>sit(IXt,o,s),"format");var pAe=class{static{t(this,"Debugger")}manager;ns;color;last;enabled;constructor(s,f){this.manager=s,this.ns=f,this.color=iit(f),this.last=0,this.enabled=s.enabled.some(d=>d.test(f))}log(...s){if(!this.enabled)return;let f,d=s[0];typeof d=="function"?f=d():f=String(d);let y=Date.now()-(this.last||Date.now());f=ait(f,...s);let x=`${this.color(this.ns)} ${f} ${this.color(`+${y}ms`)}`;console.log(x),this.last=Date.now()}},dAe=class{static{t(this,"DebugManager")}debuggers;enabled;constructor(s){this.debuggers=new Map,this.enabled=s??[]}};function OXt(o){return!o||o.length===0?[]:(o=o.replace(/\s/g,"").replace(/\*/g,".+"),o.split(",").map(s=>new RegExp(`^${s}$`)))}t(OXt,"extract");var Hoe;function Goe(o){Hoe||(Hoe=new dAe(OXt(process.env.DEBUG)));let s=new pAe(Hoe,o);return Hoe.debuggers.set(o,s),Object.assign(s.log.bind(s),{self:s})}t(Goe,"debug");var oit="zp-local-service";var Ekr=Symbol("zuplo_meters"),Ckr=Symbol("zuplo_dynamic_meters");var WP=class extends Error{static{t(this,"RuntimeError")}extensionMembers;constructor(s,f){typeof s=="string"?super(s,f):(super(s.message,f),this.extensionMembers=s.extensionMembers),this.name="RuntimeError"}};var QN=Goe("zuplo:runtime:external-service");function FXt(){let o,{__ZUPLO_EXTERNAL_SERVICE_TOKEN:s}=Em.instance.runtime;if(s&&s!=="undefined")try{let f=atob(s);o=JSON.parse(f)}catch{}return o}t(FXt,"getServiceAuth");async function cit(o,s){let f=".proxy",d=".tunnel";if(typeof o=="string"){let y=new URL(o),x=y.hostname;if(x.endsWith(f)){let Gt=x.slice(0,-f.length),jt=new URL(`http://${Gt}${y.pathname}${y.search}`);QN(`Routing to proxy: ${jt.toString()}`);let Pr=s??{};return zV(jt.toString(),Pr)}let P=x.endsWith(d),F=x.indexOf(".")===-1;if(!(P||F))throw new WP(`Invalid service hostname suffix: ${x}. Use .proxy for proxy routing, .tunnel for explicit tunnel routing, or no suffix for default tunnel routing.`);let G=P?x.slice(0,-d.length):x,Se=FXt();if(!Se)throw QN("There is no external service auth configured for this zup."),new WP("There are no external services configured for this zup.");QN(`Using external service auth. ClientId: ${Se.clientId})`);let de=s??{},ae=new Headers(de.headers||{});ae.set("CF-Access-Client-Id",Se.clientId),ae.set("CF-Access-Client-Secret",Se.clientSecret),de.headers=ae;let Ke;if(Se.customServiceMapping?.[G])Ke=`https://${Se.customServiceMapping[G]}`;else if(Em.instance.useLegacyServiceRouting)Ke=`https://${G}.zuptunnel.com`;else{QN("Using sha256 service routing");let Gt=Em.instance.build;if(Gt.ACCOUNT_NAME&&Gt.PROJECT_NAME&&Gt.ENVIRONMENT_TYPE){let jt=await LXt(G,Gt.ACCOUNT_NAME,Gt.PROJECT_NAME,Gt.ENVIRONMENT_TYPE),Pr=uit(Gt.ENVIRONMENT_TYPE),Fn=await mAe(`${Gt.ACCOUNT_NAME}-${Gt.PROJECT_NAME}-${Pr}`);Fn==="40d7ad502f5d743997999594c177184a00161a77865423511f3a1ea21eb5a5e"||Fn==="d05bffe8fa91a300187d2cf43e8aa4a56bd809c442ae10d1ee49af7d29a5a11"?Ke=`https://${jt}.zuptunnel.com`:Ke=`https://${jt}.t.zuplo.app`}else throw QN("Cannot use sha256 service routing, missing build variables"),new WP("Failed to generate fully qualified tunnel url.")}let $e=new URL(`${Ke}${y.pathname}${y.search}`);QN(`Calling external service: ${$e.toString()}`);let Fe=await zV($e.toString(),de);if(Fe.status===403&&Fe.headers.get("cf-access-domain")!==null)throw $V.console.error("403 Forbidden when calling external service.",{clientId:Se.clientId,tunnelHost:Ke}),new WP("Could not connect to secure tunnel.");return Fe}else throw QN("Cannot call external service with Request object"),new WP("Currently, we only support fetch(<some_string>, ...).")}t(cit,"externalServiceHandler");async function lit(o,s){if(typeof o=="string"){let f=new URL(o),d=f.hostname,y=s??{},x=`http://${d}.zuplo.svc.cluster.local:9000`,P=new URL(`${x}${f.pathname}${f.search}`),F=new Headers(y.headers||{});return F.set(oit,d),y.headers=F,await zV(P.toString(),y)}else throw new WP("Currently, we only support fetch(<some_string>, ...).")}t(lit,"clusterServiceHandler");async function LXt(o,s,f,d){let y=o.toLowerCase(),x=s.toLowerCase(),P=f.toLowerCase(),F=uit(d);QN(`Hashing service name: ${x}-${y}.${x}-${P}-${F}`);let J=await mAe(`${x}-${y}`),G=await mAe(`${x}-${P}-${F}`);return`${J}.${G}`}t(LXt,"hashServiceName");async function mAe(o){let s=new TextEncoder().encode(o),f=await crypto.subtle.digest("SHA-256",s);return Array.from(new Uint8Array(f)).map(x=>x.toString(16).padStart(2,"0")).join("").slice(0,-1)}t(mAe,"hashSegment");function uit(o){let s=o.toLowerCase();switch(s){case"production":case"preview":return s;default:return"working-copy"}}t(uit,"sanitizeEnvironmentType");var hAe=new Map;hAe.set("service:",cit);hAe.set("local:",lit);var zV=globalThis.fetch;function gAe(o,s){let{transformedInit:f,mtlsCertificate:d}=RXt(s);if(typeof o=="string"){let y=new URL(o),x=hAe.get(y.protocol);return x?x(o,f):fit(o,f,d)}else return fit(o,f,d)}t(gAe,"internalFetch");globalThis.fetch=gAe;function fit(o,s,f){if(!f)return zV(o,s);if(Em.instance.isCloudflare){let y=Em.instance.runtime[f];if(!y)throw new Error(`mTLS certificate binding '${f}' not found. Ensure the certificate is uploaded and properly configured.`);if(typeof y!="object"||typeof y.fetch!="function")throw new Error(`mTLS certificate binding '${f}' is not a valid mTLS certificate binding. Make sure it's configured as an mTLS certificate, not an environment variable.`);return y.fetch(o,s)}else throw Em.instance.isDeno?new Error("mTLS client certificates are not yet supported in Deno runtime. This will be added in a future update."):new Error("mTLS client certificates are not supported in this runtime environment")}t(fit,"performFetch");var RXt=t(o=>{if(!o||o instanceof Request)return{transformedInit:o,mtlsCertificate:void 0};let s=o;if(!s.zuplo)return{transformedInit:o,mtlsCertificate:void 0};let f=s.zuplo.mtlsCertificate,d=o;return d.cf={cacheEverything:s.zuplo?.cacheEverything,cacheTtl:s.zuplo?.cacheTtlSeconds},delete o.zuplo,{transformedInit:o,mtlsCertificate:f}},"transformInit");var MXt={console:{log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),debug:console.debug.bind(console),assert:console.assert.bind(console),clear:console.clear.bind(console),count:console.count.bind(console),countReset:console.countReset.bind(console),dir:console.dir.bind(console),dirxml:console.dirxml.bind(console),group:console.group.bind(console),groupCollapsed:console.groupCollapsed.bind(console),groupEnd:console.groupEnd.bind(console),table:console.table.bind(console),time:console.time.bind(console),timeEnd:console.timeEnd.bind(console),timeLog:console.timeLog.bind(console),timeStamp:console.timeStamp.bind(console),trace:console.trace.bind(console),profile:console.profile.bind(console),profileEnd:console.profileEnd.bind(console)},fetch:gAe},$V=MXt;var yAe="2025-02-06",_it=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2026-03-01":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,chainResponseSendingHooks:!0,return501ForUnsupportedHttpMethods:!0}});function pit(){return new Em({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:yAe,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:_it[yAe]},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:"",ZUPLO_SERVICE_BUCKET_ID:"mock-bucket-id"}})}t(pit,"getMockEnvironment");var Em=class o{static{t(this,"Environment")}config;static#e;static#n=!1;static initialize(s){o.#e||(o.#e=new o(s),o.#n=!0)}static get instance(){return o.#n||($V.console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),o.#e=pit()),o.#e}constructor({build:s,runtime:f}){let d;try{if(f.ZUPLO_SYSTEM_CONFIGURATIONS){let y=new TextDecoder().decode(Voe.decode(f.ZUPLO_SYSTEM_CONFIGURATIONS)),x=JSON.parse(y);for(let P of Object.keys(x))f[P]||(f[P]=x[P])}if(f.__ZUPLO_CONFIG){let y=atob(f.__ZUPLO_CONFIG);d=JSON.parse(y)}}catch(y){$V.console.error("Failed to parse runtime configuration",y)}this.config=d??{},this.build=s,this.runtime=f,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 zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.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.config.auth_client_id??this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.config.auth_client_secret??this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get authPublicKey(){return this.config.auth_public_key??this.runtime.__ZUPLO_AUTH_PUBLIC_KEY}get authPrivateKey(){return this.config.auth_private_key??this.runtime.__ZUPLO_AUTH_PRIVATE_KEY}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 isManagedDedicated(){return this.runtime.__ZUPLO_IS_MANAGED_DEDICATED==="true"}get isDeno(){if(this.runtime.__ZUPLO_RUNTIME_TYPE)return this.runtime.__ZUPLO_RUNTIME_TYPE==="deno";if(this.config.runtime_type)return this.config.runtime_type==="deno";{let s=globalThis.Deno?.version?.deno;return typeof WebSocketPair!="function"&&s}}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"}get rateLimitServiceTimeoutMs(){let s=this.runtime.__ZUPLO_RATE_LIMIT_TIMEOUT_MS,f=this.config.rate_limit_service_timeout_ms,d=s??f;if(!d)return 500;let y=Number(d);return Number.isFinite(y)&&y>0?y:500}};var jXt=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function dit(o){return o.startsWith("__ZUPLO")||o.startsWith("ZUPLO_")?!jXt.includes(o)&&!o.startsWith("ZUPLO_PUBLIC_"):o.startsWith("ZUDOKU_")?!o.startsWith("ZUDOKU_PUBLIC_"):!1}t(dit,"isRestrictedEnvVariableName");function mit(o){return!!o.startsWith("ZUPLO_")}t(mit,"isZuploReadableEnvVariableName");var ewr=new Proxy({},{get(o,s){let f=String(s);switch(f){case"ZUPLO_ENVIRONMENT_TYPE":return Em.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return Em.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return Em.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return Em.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return Em.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return Em.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return Em.instance.build.COMPATIBILITY_DATE}if(!(dit(f)&&!mit(f)))return Em.instance.runtime[f]}});function JV(o,s,f){return`_${qP(`${o}_${s}_${f}`)}`}t(JV,"getRawOperationDataIdentifierName");function vAe(o,s,f,d){return`_${qP(o.toLowerCase())}_${s.toLowerCase()}_${f.toLowerCase()}_${d.toLowerCase()}`}t(vAe,"getIdForParameterSchema");function bAe(o,s,f){return`_${qP(o.toLowerCase())}_${s.toLowerCase()}_rb_${qP(f.toLowerCase())}`}t(bAe,"getIdForRequestBodySchema");function WV(o,s){return`_${qP(o)}_${qP(s)}`}t(WV,"getIdForRefSchema");function qP(o){let s=o.replace(/\[/g,"_LBRACKET_").replace(/\]/g,"_RBRACKET_").replace(/\{/g,"_LCURLY_").replace(/\}/g,"_RCURLY_").replace(/\//g,"_SLASH_").replace(/-/g,"_DASH_").replace(/\./g,"_DOT_").replace(/\+/g,"_PLUS_").replace(/:/g,"_COLON_").replace(/@/g,"_AT_").replace(/\$/g,"_DOLLAR_").replace(/[^a-zA-Z0-9_]/g,"_");return/^[a-zA-Z_]/.test(s)||(s=`_${s}`),s}t(qP,"sanitizedIdentifierName");var TAe={};ert(TAe,{UnsafePathError:()=>Yoe,deleteFolder:()=>ZXt,dirExists:()=>SAe,fileExists:()=>$Xt,getParentDirFilename:()=>YXt,isNotFileOrDirectory:()=>WXt,listFolderContents:()=>yit,listFolders:()=>VXt,mkDirTemp:()=>JXt,mkdirForFilePathIfNotExits:()=>HXt,mkdirIfNotExists:()=>vit,safePath:()=>GXt,tarFolder:()=>KXt,untarFile:()=>XXt});import{spawn as hit}from"node:child_process";import{randomUUID as BXt}from"node:crypto";import eI from"node:fs/promises";import{platform as UXt,tmpdir as zXt}from"node:os";import I1 from"node:path";var git=[".git","node_modules",".yarn",".DS_Store"];async function $Xt(o){try{return(await eI.stat(o)).isFile()}catch{return!1}}t($Xt,"fileExists");async function JXt(){let o=process.env.BUILD_FILE_PATH??zXt(),s=BXt().replaceAll("-",""),f=I1.join(o,s);return await eI.mkdir(f,{recursive:!0}),f}t(JXt,"mkDirTemp");async function SAe(o){try{return(await eI.stat(o)).isDirectory()}catch{return!1}}t(SAe,"dirExists");async function WXt(o){try{return await eI.stat(o),!1}catch{return!0}}t(WXt,"isNotFileOrDirectory");function qXt(o,s){let f=I1.sep==="\\"?"\\\\":I1.sep,d=new RegExp(`(.*)(${f}${s})$|(.*)(${s}${f})`),y=o.match(d);if(!y)return"";let x=o.split(y[0]);return x[1]===""?"":I1.join(I1.sep,x[1])}t(qXt,"getParentDirectory");async function VXt(o){if(!await SAe(o))return[];let s=await eI.readdir(o,{withFileTypes:!0}),f=[];for await(let d of s)git.includes(d.name)||d.isDirectory()&&f.push(d.name);return f}t(VXt,"listFolders");async function yit(o,s,f=!0){let d=qXt(o,s),y=await eI.readdir(o,{withFileTypes:!0}),x=[];for await(let P of y)if(!git.includes(P.name)||!f)if(P.isDirectory()){let F=await yit(I1.join(o,P.name),s,f);x.push(...F)}else x.push(I1.join(d,P.name));return x}t(yit,"listFolderContents");var vit=t(async o=>{await eI.mkdir(o,{recursive:!0})},"mkdirIfNotExists"),HXt=t(async o=>{let s=I1.dirname(o);return vit(s)},"mkdirForFilePathIfNotExits"),Yoe=class extends Error{static{t(this,"UnsafePathError")}};function GXt(o){let s=I1.normalize(o),f=t(d=>{let y=I1.normalize(d),x=process.platform==="win32",P=!1;if(x?P=y.toLowerCase().startsWith(s.toLowerCase()):P=y.startsWith(s),!P)throw new Yoe("Resolved path is not part of the project.");return y},"ensureSafePath");return{resolve:t((...d)=>f(I1.resolve(...d)),"resolve")}}t(GXt,"safePath");function YXt(o){return I1.join(I1.basename(I1.dirname(o)),I1.basename(o))}t(YXt,"getParentDirFilename");async function KXt({folderPath:o,outputTarPath:s,exclude:f=["node_modules",".git","dist"],logger:d}){let y=[],x=[],P;try{await new Promise((F,J)=>{let G=hit("tar",[...f.flatMap(Se=>["--exclude",Se]),...UXt()!=="darwin"?["--warning=no-file-changed"]:[],"-cvf",s,"-C",o,"."]);G.stdout.on("data",Se=>{let de=Se.toString().trim();de.length>0&&y.push(de.trim())}),G.stderr.on("data",Se=>{let de=Se.toString().trim();de.length>0&&x.push(de.trim())}),G.on("close",Se=>{P=Se,Se===0?F():J(new Error(`tar process exited with code ${Se}`))}),G.on("error",Se=>{J(Se)})})}catch(F){throw new Error("Failed to tar folder",{cause:F})}finally{d.info({stdout:y.join(`
|
|
571
|
+
`).map(F=>F.trim()).join(" ");case"%O":return o(f[d++]);case"%j":try{return JSON.stringify(f[d++])}catch{return"[Circular]"}default:return P}});for(let P of f.splice(d))P===null||!(typeof P=="object"&&P!==null)?x+=" "+P:x+=" "+o(P);return x}t(sit,"format");var ait=t((o,...s)=>sit(IXt,o,s),"format");var pAe=class{static{t(this,"Debugger")}manager;ns;color;last;enabled;constructor(s,f){this.manager=s,this.ns=f,this.color=iit(f),this.last=0,this.enabled=s.enabled.some(d=>d.test(f))}log(...s){if(!this.enabled)return;let f,d=s[0];typeof d=="function"?f=d():f=String(d);let y=Date.now()-(this.last||Date.now());f=ait(f,...s);let x=`${this.color(this.ns)} ${f} ${this.color(`+${y}ms`)}`;console.log(x),this.last=Date.now()}},dAe=class{static{t(this,"DebugManager")}debuggers;enabled;constructor(s){this.debuggers=new Map,this.enabled=s??[]}};function OXt(o){return!o||o.length===0?[]:(o=o.replace(/\s/g,"").replace(/\*/g,".+"),o.split(",").map(s=>new RegExp(`^${s}$`)))}t(OXt,"extract");var Hoe;function Goe(o){Hoe||(Hoe=new dAe(OXt(process.env.DEBUG)));let s=new pAe(Hoe,o);return Hoe.debuggers.set(o,s),Object.assign(s.log.bind(s),{self:s})}t(Goe,"debug");var oit="zp-local-service";var Ekr=Symbol("zuplo_meters"),Ckr=Symbol("zuplo_dynamic_meters");var WP=class extends Error{static{t(this,"RuntimeError")}extensionMembers;constructor(s,f){typeof s=="string"?super(s,f):(super(s.message,f),this.extensionMembers=s.extensionMembers),this.name="RuntimeError"}};var QN=Goe("zuplo:runtime:external-service");function FXt(){let o,{__ZUPLO_EXTERNAL_SERVICE_TOKEN:s}=Em.instance.runtime;if(s&&s!=="undefined")try{let f=atob(s);o=JSON.parse(f)}catch{}return o}t(FXt,"getServiceAuth");async function cit(o,s){let f=".proxy",d=".tunnel";if(typeof o=="string"){let y=new URL(o),x=y.hostname;if(x.endsWith(f)){let Gt=x.slice(0,-f.length),jt=new URL(`http://${Gt}${y.pathname}${y.search}`);QN(`Routing to proxy: ${jt.toString()}`);let Pr=s??{};return zV(jt.toString(),Pr)}let P=x.endsWith(d),F=x.indexOf(".")===-1;if(!(P||F))throw new WP(`Invalid service hostname suffix: ${x}. Use .proxy for proxy routing, .tunnel for explicit tunnel routing, or no suffix for default tunnel routing.`);let G=P?x.slice(0,-d.length):x,Se=FXt();if(!Se)throw QN("There is no external service auth configured for this zup."),new WP("There are no external services configured for this zup.");QN(`Using external service auth. ClientId: ${Se.clientId})`);let de=s??{},ae=new Headers(de.headers||{});ae.set("CF-Access-Client-Id",Se.clientId),ae.set("CF-Access-Client-Secret",Se.clientSecret),de.headers=ae;let Ke;if(Se.customServiceMapping?.[G])Ke=`https://${Se.customServiceMapping[G]}`;else if(Em.instance.useLegacyServiceRouting)Ke=`https://${G}.zuptunnel.com`;else{QN("Using sha256 service routing");let Gt=Em.instance.build;if(Gt.ACCOUNT_NAME&&Gt.PROJECT_NAME&&Gt.ENVIRONMENT_TYPE){let jt=await LXt(G,Gt.ACCOUNT_NAME,Gt.PROJECT_NAME,Gt.ENVIRONMENT_TYPE),Pr=uit(Gt.ENVIRONMENT_TYPE),Fn=await mAe(`${Gt.ACCOUNT_NAME}-${Gt.PROJECT_NAME}-${Pr}`);Fn==="40d7ad502f5d743997999594c177184a00161a77865423511f3a1ea21eb5a5e"||Fn==="d05bffe8fa91a300187d2cf43e8aa4a56bd809c442ae10d1ee49af7d29a5a11"?Ke=`https://${jt}.zuptunnel.com`:Ke=`https://${jt}.t.zuplo.app`}else throw QN("Cannot use sha256 service routing, missing build variables"),new WP("Failed to generate fully qualified tunnel url.")}let $e=new URL(`${Ke}${y.pathname}${y.search}`);QN(`Calling external service: ${$e.toString()}`);let Fe=await zV($e.toString(),de);if(Fe.status===403&&Fe.headers.get("cf-access-domain")!==null)throw $V.console.error("403 Forbidden when calling external service.",{clientId:Se.clientId,tunnelHost:Ke}),new WP("Could not connect to secure tunnel.");return Fe}else throw QN("Cannot call external service with Request object"),new WP("Currently, we only support fetch(<some_string>, ...).")}t(cit,"externalServiceHandler");async function lit(o,s){if(typeof o=="string"){let f=new URL(o),d=f.hostname,y=s??{},x=`http://${d}.zuplo.svc.cluster.local:9000`,P=new URL(`${x}${f.pathname}${f.search}`),F=new Headers(y.headers||{});return F.set(oit,d),y.headers=F,await zV(P.toString(),y)}else throw new WP("Currently, we only support fetch(<some_string>, ...).")}t(lit,"clusterServiceHandler");async function LXt(o,s,f,d){let y=o.toLowerCase(),x=s.toLowerCase(),P=f.toLowerCase(),F=uit(d);QN(`Hashing service name: ${x}-${y}.${x}-${P}-${F}`);let J=await mAe(`${x}-${y}`),G=await mAe(`${x}-${P}-${F}`);return`${J}.${G}`}t(LXt,"hashServiceName");async function mAe(o){let s=new TextEncoder().encode(o),f=await crypto.subtle.digest("SHA-256",s);return Array.from(new Uint8Array(f)).map(x=>x.toString(16).padStart(2,"0")).join("").slice(0,-1)}t(mAe,"hashSegment");function uit(o){let s=o.toLowerCase();switch(s){case"production":case"preview":return s;default:return"working-copy"}}t(uit,"sanitizeEnvironmentType");var hAe=new Map;hAe.set("service:",cit);hAe.set("local:",lit);var zV=globalThis.fetch;function gAe(o,s){let{transformedInit:f,mtlsCertificate:d}=RXt(s);if(typeof o=="string"){let y=new URL(o),x=hAe.get(y.protocol);return x?x(o,f):fit(o,f,d)}else return fit(o,f,d)}t(gAe,"internalFetch");globalThis.fetch=gAe;function fit(o,s,f){if(!f)return zV(o,s);if(Em.instance.isCloudflare){let y=Em.instance.runtime[f];if(!y)throw new Error(`mTLS certificate binding '${f}' not found. Ensure the certificate is uploaded and properly configured.`);if(typeof y!="object"||typeof y.fetch!="function")throw new Error(`mTLS certificate binding '${f}' is not a valid mTLS certificate binding. Make sure it's configured as an mTLS certificate, not an environment variable.`);return y.fetch(o,s)}else if(Em.instance.isDeno){let d=globalThis.managedDedicatedMtlsBindings?.[f];if(!d)throw new Error(`mTLS certificate binding '${f}' not found. Ensure the certificate is uploaded and properly configured.`);if(typeof d.fetch!="function")throw new Error(`mTLS certificate binding '${f}' is not a valid mTLS certificate binding.`);return d.fetch(o,s)}else throw new Error("mTLS client certificates are not supported in this runtime environment")}t(fit,"performFetch");var RXt=t(o=>{if(!o||o instanceof Request)return{transformedInit:o,mtlsCertificate:void 0};let s=o;if(!s.zuplo)return{transformedInit:o,mtlsCertificate:void 0};let f=s.zuplo.mtlsCertificate,d=o;return d.cf={cacheEverything:s.zuplo?.cacheEverything,cacheTtl:s.zuplo?.cacheTtlSeconds},delete o.zuplo,{transformedInit:o,mtlsCertificate:f}},"transformInit");var MXt={console:{log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),debug:console.debug.bind(console),assert:console.assert.bind(console),clear:console.clear.bind(console),count:console.count.bind(console),countReset:console.countReset.bind(console),dir:console.dir.bind(console),dirxml:console.dirxml.bind(console),group:console.group.bind(console),groupCollapsed:console.groupCollapsed.bind(console),groupEnd:console.groupEnd.bind(console),table:console.table.bind(console),time:console.time.bind(console),timeEnd:console.timeEnd.bind(console),timeLog:console.timeLog.bind(console),timeStamp:console.timeStamp.bind(console),trace:console.trace.bind(console),profile:console.profile.bind(console),profileEnd:console.profileEnd.bind(console)},fetch:gAe},$V=MXt;var yAe="2025-02-06",_it=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1},"2026-03-01":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,chainResponseSendingHooks:!0,return501ForUnsupportedHttpMethods:!0}});function pit(){return new Em({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:yAe,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:_it[yAe]},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:"",ZUPLO_SERVICE_BUCKET_ID:"mock-bucket-id"}})}t(pit,"getMockEnvironment");var Em=class o{static{t(this,"Environment")}config;static#e;static#n=!1;static initialize(s){o.#e||(o.#e=new o(s),o.#n=!0)}static get instance(){return o.#n||($V.console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),o.#e=pit()),o.#e}constructor({build:s,runtime:f}){let d;try{if(f.ZUPLO_SYSTEM_CONFIGURATIONS){let y=new TextDecoder().decode(Voe.decode(f.ZUPLO_SYSTEM_CONFIGURATIONS)),x=JSON.parse(y);for(let P of Object.keys(x))f[P]||(f[P]=x[P])}if(f.__ZUPLO_CONFIG){let y=atob(f.__ZUPLO_CONFIG);d=JSON.parse(y)}}catch(y){$V.console.error("Failed to parse runtime configuration",y)}this.config=d??{},this.build=s,this.runtime=f,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 zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.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.config.auth_client_id??this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.config.auth_client_secret??this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get authPublicKey(){return this.config.auth_public_key??this.runtime.__ZUPLO_AUTH_PUBLIC_KEY}get authPrivateKey(){return this.config.auth_private_key??this.runtime.__ZUPLO_AUTH_PRIVATE_KEY}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 isManagedDedicated(){return this.runtime.__ZUPLO_IS_MANAGED_DEDICATED==="true"}get isDeno(){if(this.runtime.__ZUPLO_RUNTIME_TYPE)return this.runtime.__ZUPLO_RUNTIME_TYPE==="deno";if(this.config.runtime_type)return this.config.runtime_type==="deno";{let s=globalThis.Deno?.version?.deno;return typeof WebSocketPair!="function"&&s}}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"}get rateLimitServiceTimeoutMs(){let s=this.runtime.__ZUPLO_RATE_LIMIT_TIMEOUT_MS,f=this.config.rate_limit_service_timeout_ms,d=s??f;if(!d)return 500;let y=Number(d);return Number.isFinite(y)&&y>0?y:500}};var jXt=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function dit(o){return o.startsWith("__ZUPLO")||o.startsWith("ZUPLO_")?!jXt.includes(o)&&!o.startsWith("ZUPLO_PUBLIC_"):o.startsWith("ZUDOKU_")?!o.startsWith("ZUDOKU_PUBLIC_"):!1}t(dit,"isRestrictedEnvVariableName");function mit(o){return!!o.startsWith("ZUPLO_")}t(mit,"isZuploReadableEnvVariableName");var ewr=new Proxy({},{get(o,s){let f=String(s);switch(f){case"ZUPLO_ENVIRONMENT_TYPE":return Em.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return Em.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return Em.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return Em.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return Em.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return Em.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return Em.instance.build.COMPATIBILITY_DATE}if(!(dit(f)&&!mit(f)))return Em.instance.runtime[f]}});function JV(o,s,f){return`_${qP(`${o}_${s}_${f}`)}`}t(JV,"getRawOperationDataIdentifierName");function vAe(o,s,f,d){return`_${qP(o.toLowerCase())}_${s.toLowerCase()}_${f.toLowerCase()}_${d.toLowerCase()}`}t(vAe,"getIdForParameterSchema");function bAe(o,s,f){return`_${qP(o.toLowerCase())}_${s.toLowerCase()}_rb_${qP(f.toLowerCase())}`}t(bAe,"getIdForRequestBodySchema");function WV(o,s){return`_${qP(o)}_${qP(s)}`}t(WV,"getIdForRefSchema");function qP(o){let s=o.replace(/\[/g,"_LBRACKET_").replace(/\]/g,"_RBRACKET_").replace(/\{/g,"_LCURLY_").replace(/\}/g,"_RCURLY_").replace(/\//g,"_SLASH_").replace(/-/g,"_DASH_").replace(/\./g,"_DOT_").replace(/\+/g,"_PLUS_").replace(/:/g,"_COLON_").replace(/@/g,"_AT_").replace(/\$/g,"_DOLLAR_").replace(/[^a-zA-Z0-9_]/g,"_");return/^[a-zA-Z_]/.test(s)||(s=`_${s}`),s}t(qP,"sanitizedIdentifierName");var TAe={};ert(TAe,{UnsafePathError:()=>Yoe,deleteFolder:()=>ZXt,dirExists:()=>SAe,fileExists:()=>$Xt,getParentDirFilename:()=>YXt,isNotFileOrDirectory:()=>WXt,listFolderContents:()=>yit,listFolders:()=>VXt,mkDirTemp:()=>JXt,mkdirForFilePathIfNotExits:()=>HXt,mkdirIfNotExists:()=>vit,safePath:()=>GXt,tarFolder:()=>KXt,untarFile:()=>XXt});import{spawn as hit}from"node:child_process";import{randomUUID as BXt}from"node:crypto";import eI from"node:fs/promises";import{platform as UXt,tmpdir as zXt}from"node:os";import I1 from"node:path";var git=[".git","node_modules",".yarn",".DS_Store"];async function $Xt(o){try{return(await eI.stat(o)).isFile()}catch{return!1}}t($Xt,"fileExists");async function JXt(){let o=process.env.BUILD_FILE_PATH??zXt(),s=BXt().replaceAll("-",""),f=I1.join(o,s);return await eI.mkdir(f,{recursive:!0}),f}t(JXt,"mkDirTemp");async function SAe(o){try{return(await eI.stat(o)).isDirectory()}catch{return!1}}t(SAe,"dirExists");async function WXt(o){try{return await eI.stat(o),!1}catch{return!0}}t(WXt,"isNotFileOrDirectory");function qXt(o,s){let f=I1.sep==="\\"?"\\\\":I1.sep,d=new RegExp(`(.*)(${f}${s})$|(.*)(${s}${f})`),y=o.match(d);if(!y)return"";let x=o.split(y[0]);return x[1]===""?"":I1.join(I1.sep,x[1])}t(qXt,"getParentDirectory");async function VXt(o){if(!await SAe(o))return[];let s=await eI.readdir(o,{withFileTypes:!0}),f=[];for await(let d of s)git.includes(d.name)||d.isDirectory()&&f.push(d.name);return f}t(VXt,"listFolders");async function yit(o,s,f=!0){let d=qXt(o,s),y=await eI.readdir(o,{withFileTypes:!0}),x=[];for await(let P of y)if(!git.includes(P.name)||!f)if(P.isDirectory()){let F=await yit(I1.join(o,P.name),s,f);x.push(...F)}else x.push(I1.join(d,P.name));return x}t(yit,"listFolderContents");var vit=t(async o=>{await eI.mkdir(o,{recursive:!0})},"mkdirIfNotExists"),HXt=t(async o=>{let s=I1.dirname(o);return vit(s)},"mkdirForFilePathIfNotExits"),Yoe=class extends Error{static{t(this,"UnsafePathError")}};function GXt(o){let s=I1.normalize(o),f=t(d=>{let y=I1.normalize(d),x=process.platform==="win32",P=!1;if(x?P=y.toLowerCase().startsWith(s.toLowerCase()):P=y.startsWith(s),!P)throw new Yoe("Resolved path is not part of the project.");return y},"ensureSafePath");return{resolve:t((...d)=>f(I1.resolve(...d)),"resolve")}}t(GXt,"safePath");function YXt(o){return I1.join(I1.basename(I1.dirname(o)),I1.basename(o))}t(YXt,"getParentDirFilename");async function KXt({folderPath:o,outputTarPath:s,exclude:f=["node_modules",".git","dist"],logger:d}){let y=[],x=[],P;try{await new Promise((F,J)=>{let G=hit("tar",[...f.flatMap(Se=>["--exclude",Se]),...UXt()!=="darwin"?["--warning=no-file-changed"]:[],"-cvf",s,"-C",o,"."]);G.stdout.on("data",Se=>{let de=Se.toString().trim();de.length>0&&y.push(de.trim())}),G.stderr.on("data",Se=>{let de=Se.toString().trim();de.length>0&&x.push(de.trim())}),G.on("close",Se=>{P=Se,Se===0?F():J(new Error(`tar process exited with code ${Se}`))}),G.on("error",Se=>{J(Se)})})}catch(F){throw new Error("Failed to tar folder",{cause:F})}finally{d.info({stdout:y.join(`
|
|
572
572
|
`),stderr:x.join(`
|
|
573
573
|
`),exitCode:P},"Tar process logs")}}t(KXt,"tarFolder");async function XXt({tarFilePath:o,outputDir:s,logger:f}){let d=[],y=[],x;try{await new Promise((P,F)=>{let J=hit("sh",["-c",`tar -xvf ${o} -C ${s};`]);J.stdout.on("data",G=>{let Se=G.toString().trim();Se.length>0&&d.push(Se.trim())}),J.stderr.on("data",G=>{let Se=G.toString().trim();Se.length>0&&y.push(Se.trim())}),J.on("close",G=>{x=G,G===0?P():F(new Error(`tar process exited with code ${G}`))}),J.on("error",G=>{F(G)})})}catch(P){throw new Error("Failed to untar file",{cause:P})}finally{f.info({stdout:d.join(`
|
|
574
574
|
`),stderr:y.join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.67.1",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"source-map": "^0.7.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@zuplo/graphql": "6.
|
|
44
|
-
"@zuplo/otel": "6.
|
|
45
|
-
"@zuplo/runtime": "6.
|
|
43
|
+
"@zuplo/graphql": "6.67.1",
|
|
44
|
+
"@zuplo/otel": "6.67.1",
|
|
45
|
+
"@zuplo/runtime": "6.67.1",
|
|
46
46
|
"deno": "2.3.1"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/zeno.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
var
|
|
26
|
-
`),Ye=M.encode("*"),Qe=M.encode("$");function oe(t){let e=[Ye,M.encode(t.length.toString()),J];for(let r of t){let o=r instanceof Uint8Array?r:M.encode(r.toString());e.push(Qe,M.encode(o.byteLength.toString()),J,o,J)}return q(e)}n(oe,"createRequest");async function*et(t){let e=new Uint8Array;for await(let r of t){e=q([e,r]);let o;for(;(o=e.indexOf(J[0]))!==-1&&e[o+1]===J[1];)yield e.subarray(0,o),e=e.subarray(o+2)}}n(et,"readLines");function K(t,e,r=!1){return Array.fromAsync({length:e},()=>X(t,r))}n(K,"readNReplies");function D(t){return se.decode(t.slice(1))}n(D,"parseLine");function tt(t){let e=[];for(let r=0;r<t.length;r+=2)e.push(t.slice(r,r+2));return e}n(tt,"chunk");async function X(t,e=!1){let{value:r}=await t.next();switch(r[0]){case Ie:case Je:{let o=Number(D(r));return o===-1?null:await K(t,o)}case Fe:{let o=Number(D(r))*2;return await K(t,o),X(t,e)}case Be:return BigInt(D(r));case Ge:{let{value:o}=await t.next();return Promise.reject(se.decode(o))}case $e:return D(r)==="t";case Me:case qe:return D(r)==="-1"?null:X(t,e);case We:case ze:switch(D(r)){case"inf":return 1/0;case"-inf":return-1/0;default:return Number(D(r))}case je:return Promise.reject(D(r));case Ve:{let o=Number(D(r))*2,s=await K(t,o);return Object.fromEntries(tt(s))}case Ke:return null;case Xe:return new Set(await K(t,Number(D(r)),e));case Ze:return D(r);default:return e?r:se.decode(r)}}n(X,"readReply");var Y=class{static{n(this,"RedisClient")}#t;#n;#e=Promise.resolve();constructor(e){this.#t=e.writable.getWriter(),this.#n=et(e.readable)}#r(e){return this.#e=this.#e.then(e),this.#e}sendCommand(e,r=!1){return this.#r(()=>(this.#t.write(oe(e)),X(this.#n,r)))}writeCommand(e){return this.#r(()=>this.#t.write(oe(e)))}async*readReplies(e=!1){for(;;)yield X(this.#n,e)}pipelineCommands(e,r=!1){return this.#r(()=>{let o=q(e.map(oe));return this.#t.write(o),K(this.#n,e.length,r)})}};var R=globalThis.Deno?.build.os==="windows"||globalThis.navigator?.platform?.startsWith("Win")||globalThis.process?.platform?.startsWith("win")||!1;function C(t){if(typeof t!="string")throw new TypeError(`Path must be a string, received "${JSON.stringify(t)}"`)}n(C,"assertPath");function v(t){return t===47}n(v,"isPosixPathSeparator");function y(t){return t===47||t===92}n(y,"isPathSeparator");function H(t){return t>=97&&t<=122||t>=65&&t<=90}n(H,"isWindowsDeviceRoot");function ee(t){if(C(t),t.length===0)return"."}n(ee,"assertArg");function W(t,e,r,o){let s="",l=0,f=-1,c=0,u;for(let i=0;i<=t.length;++i){if(i<t.length)u=t.charCodeAt(i);else{if(o(u))break;u=47}if(o(u)){if(!(f===i-1||c===1))if(f!==i-1&&c===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){let g=s.lastIndexOf(r);g===-1?(s="",l=0):(s=s.slice(0,g),l=s.length-1-s.lastIndexOf(r)),f=i,c=0;continue}else if(s.length===2||s.length===1){s="",l=0,f=i,c=0;continue}}e&&(s.length>0?s+=`${r}..`:s="..",l=2)}else s.length>0?s+=r+t.slice(f+1,i):s=t.slice(f+1,i),l=i-f-1;f=i,c=0}else u===46&&c!==-1?++c:c=-1}return s}n(W,"normalizeString");function te(t){ee(t);let e=v(t.charCodeAt(0)),r=v(t.charCodeAt(t.length-1));return t=W(t,!e,"/",v),t.length===0&&!e&&(t="."),t.length>0&&r&&(t+="/"),e?`/${t}`:t}n(te,"normalize");function ae(...t){if(t.length===0)return".";t.forEach(r=>C(r));let e=t.filter(r=>r.length>0).join("/");return e===""?".":te(e)}n(ae,"join");function re(t){ee(t);let e=t.length,r=0,o,s=!1,l=t.charCodeAt(0);if(e>1)if(y(l))if(s=!0,y(t.charCodeAt(1))){let c=2,u=c;for(;c<e&&!y(t.charCodeAt(c));++c);if(c<e&&c!==u){let i=t.slice(u,c);for(u=c;c<e&&y(t.charCodeAt(c));++c);if(c<e&&c!==u){for(u=c;c<e&&!y(t.charCodeAt(c));++c);if(c===e)return`\\\\${i}\\${t.slice(u)}\\`;c!==u&&(o=`\\\\${i}\\${t.slice(u,c)}`,r=c)}}}else r=1;else H(l)&&t.charCodeAt(1)===58&&(o=t.slice(0,2),r=2,e>2&&y(t.charCodeAt(2))&&(s=!0,r=3));else if(y(l))return"\\";let f;return r<e?f=W(t.slice(r),!s,"\\",y):f="",f.length===0&&!s&&(f="."),f.length>0&&y(t.charCodeAt(e-1))&&(f+="\\"),o===void 0?s?f.length>0?`\\${f}`:"\\":f:s?f.length>0?`${o}\\${f}`:`${o}\\`:o+f}n(re,"normalize");function le(...t){if(t.forEach(l=>C(l)),t=t.filter(l=>l.length>0),t.length===0)return".";let e=!0,r=0,o=t[0];if(y(o.charCodeAt(0))){++r;let l=o.length;l>1&&y(o.charCodeAt(1))&&(++r,l>2&&(y(o.charCodeAt(2))?++r:e=!1))}let s=t.join("\\");if(e){for(;r<s.length&&y(s.charCodeAt(r));++r);r>=2&&(s=`\\${s.slice(r)}`)}return re(s)}n(le,"join");function k(...t){return R?le(...t):ae(...t)}n(k,"join");function bt(t){if(t.length>=255)throw new TypeError("Alphabet too long");let e=new Uint8Array(256);for(let i=0;i<e.length;i++)e[i]=255;for(let i=0;i<t.length;i++){let g=t.charAt(i),p=g.charCodeAt(0);if(e[p]!==255)throw new TypeError(g+" is ambiguous");e[p]=i}let r=t.length,o=t.charAt(0),s=Math.log(r)/Math.log(256),l=Math.log(256)/Math.log(r);function f(i){if(i instanceof Uint8Array||(ArrayBuffer.isView(i)?i=new Uint8Array(i.buffer,i.byteOffset,i.byteLength):Array.isArray(i)&&(i=Uint8Array.from(i))),!(i instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(i.length===0)return"";let g=0,p=0,A=0,x=i.length;for(;A!==x&&i[A]===0;)A++,g++;let w=(x-A)*l+1>>>0,S=new Uint8Array(w);for(;A!==x;){let T=i[A],P=0;for(let N=w-1;(T!==0||P<p)&&N!==-1;N--,P++)T+=256*S[N]>>>0,S[N]=T%r>>>0,T=T/r>>>0;if(T!==0)throw new Error("Non-zero carry");p=P,A++}let _=w-p;for(;_!==w&&S[_]===0;)_++;let b=o.repeat(g);for(;_<w;++_)b+=t.charAt(S[_]);return b}n(f,"encode");function c(i){if(typeof i!="string")throw new TypeError("Expected String");if(i.length===0)return new Uint8Array;let g=0,p=0,A=0;for(;i[g]===o;)p++,g++;let x=(i.length-g)*s+1>>>0,w=new Uint8Array(x);for(;g<i.length;){let T=i.charCodeAt(g);if(T>255)return;let P=e[T];if(P===255)return;let N=0;for(let d=x-1;(P!==0||N<A)&&d!==-1;d--,N++)P+=r*w[d]>>>0,w[d]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");A=N,g++}let S=x-A;for(;S!==x&&w[S]===0;)S++;let _=new Uint8Array(p+(x-S)),b=p;for(;S!==x;)_[b++]=w[S++];return _}n(c,"decodeUnsafe");function u(i){let g=c(i);if(g)return g;throw new Error("Non-base"+r+" character")}return n(u,"decode"),{encode:f,decodeUnsafe:c,decode:u}}n(bt,"base");var ye=bt;var Rt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",xe=ye(Rt);import{pathToFileURL as be}from"node:url";import Re from"dotenv";var ce=class{static{n(this,"ZenoLogger")}prefix="[ZENO]:";logLevel;originalConsole={debug:console.debug,info:console.info,warn:console.warn,error:console.error};constructor(e="info"){this.logLevel=e}debug(...e){(this.shouldLog("debug")||Deno.env.get("ZENO_DEBUG"))&&this.originalConsole.debug(this.prefix,"[DEBUG]",...e)}info(...e){this.shouldLog("info")&&this.originalConsole.info(this.prefix,"[INFO]",...e)}warn(...e){this.shouldLog("warn")&&this.originalConsole.warn(this.prefix,"[WARN]",...e)}error(...e){this.shouldLog("error")&&this.originalConsole.error(this.prefix,"[ERROR]",...e)}shouldLog(e){let r=["debug","info","warn","error"],o=r.indexOf(this.logLevel);return r.indexOf(e)>=o}setLogLevel(e){this.logLevel=e}},E=new ce;async function Ce(t){let e={};for(let[r,o]of Object.entries(Deno.env.toObject()))o!==void 0&&(e[r]=o);try{let r=k(t,".env.zuplo"),o=new TextDecoder("utf-8"),s=await Deno.readFile(be(r)),l=o.decode(s),f=Re.parse(l);for(let[c,u]of Object.entries(f))if(e[c]=u,c==="ZUPLO_SYSTEM_CONFIGURATIONS")try{let i=new TextDecoder().decode(xe.decode(u)),g=JSON.parse(i);for(let[p,A]of Object.entries(g))e[p]=String(A)}catch(i){Deno.build.standalone||E.error("Failed to parse ZUPLO_SYSTEM_CONFIGURATIONS from .env.zuplo:",i)}}catch(r){r instanceof Deno.errors.NotFound||E.error("Failed to load .env.zuplo file:",r)}try{let r=k(t,".env"),o=new TextDecoder("utf-8"),s=await Deno.readFile(be(r)),l=o.decode(s),f=Re.parse(l);for(let[c,u]of Object.entries(f))e[c]=u}catch(r){r instanceof Deno.errors.NotFound||E.error("Failed to load .env.zuplo file:",r)}for(let[r,o]of Object.entries(e))o===void 0&&delete e[r];return e.__ZUPLO_IS_MANAGED_DEDICATED="true",e}n(Ce,"loadEnvironment");function Ee(t){return t?["true","1","yes","y"].includes(t.toLowerCase()):!1}n(Ee,"parseEnvBool");var fe=class{static{n(this,"CacheStorage")}#t;constructor(){this.#t=new Map}async open(e){let r=this.#t.get(e);return r||(r=new de,this.#t.set(e,r)),r}async has(e){return this.#t.has(e)}async delete(e){throw new Error("caches.delete is not supported")}};async function Ct(){let t=Deno.env.get("ZUPLO_CACHE_REDIS_HOSTNAME");if(t===void 0)throw new Error("ZUPLO_CACHE_REDIS_HOSTNAME is not set");let e=parseInt(Deno.env.get("ZUPLO_CACHE_REDIS_PORT")||"6379"),r=await Deno.connect({hostname:t,port:e});return new Y(r)}n(Ct,"getRedisClient");function Et(t){let e={};return t&&t.split(",").forEach(o=>{let[s,l]=o.trim().split("=");e[s.toLowerCase()]=l?l.trim():!0}),e}n(Et,"parseHeaderValue");function wt(t){let e={};for(let[r,o]of t.entries())e[r]=o;return e}n(wt,"objectifyHeaders");async function St(t){let e=await t.arrayBuffer(),r=new Uint8Array(e),o="";for(let s=0;s<r.length;s++)o+=String.fromCharCode(r[s]);return btoa(o)}n(St,"serializeResponseBody");function Pt(t){let e=atob(t),r=e.length,o=new Uint8Array(r);for(let s=0;s<r;s++)o[s]=e.charCodeAt(s);return o}n(Pt,"deserializeResponseBody");var de=class{static{n(this,"Cache")}#t;#n;#e;constructor(e="default",r={}){this.#t=e;let o=Deno.env.get("ZUPLO_CACHE_REDIS_HOSTNAME")&&Deno.env.get("ZUPLO_CACHE_REDIS_PORT");this.#n=!o||!Ee(Deno.env.get("USE_ZENO_ZONE_CACHE")),this.#e=r.getRedisClient||Ct}#r(e){return`${this.#t}:${e.url}`}async match(e,r){if(this.#n)return;let o=this.#r(e),s=await this.#e();await s.sendCommand(["HELLO",3]);let l=await s.sendCommand(["TTL",o]);if(l!==-2){if(l<2)return;{let f=await s.sendCommand(["HGETALL",o]),c=f.status,u=f.status,i=new Headers(JSON.parse(f.headers));return new Response(Pt(f.body),{status:c,statusText:u,headers:i})}}}async put(e,r){if(this.#n)return;let o=1*60*60,s=Et(r.headers.get("cache-control")),l=parseInt(s["s-maxage"]),f=parseInt(s["max-age"]),c=s["no-store"],u=s["no-cache"],i=l||f||0;if(i===0&&!c&&!u&&(i=o,r.headers.append("cache-control",`s-maxage=${o}`)),i>0){let g=this.#r(e),p=await this.#e();await p.sendCommand(["HELLO",3]),await p.sendCommand(["HSET",g,"maxage",i,"status",r.status,"statusText",r.statusText,"headers",JSON.stringify(wt(r.headers)),"body",await St(r)]),await p.sendCommand(["EXPIRE",g,i])}}async delete(e){if(this.#n)return;let r=this.#r(e);if(await(await this.#e()).sendCommand(["DEL",r])!==1)throw new Error("Failed to delete cache entry")}},_t=new fe;Object.defineProperty(globalThis,"caches",{value:_t,writable:!1,enumerable:!0,configurable:!1});var ne=class{static{n(this,"WorkerServer")}#t;#n;#e;#r=n(()=>({waitUntil:n(e=>{e.catch(r=>{console.error("Error in waitUntil:",r)})},"waitUntil")}),"#createContext");constructor(e){this.#e=e}async start(){let{port:e,workerModule:r,env:o}=this.#e,s=e+1;this.#n=Deno.serve({port:s,onListen:n(()=>{E.debug(`Stats server running at http://localhost:${s}`)},"onListen")},l=>l.url.endsWith("/__zuplo/internal_memory_metrics")?new Response(JSON.stringify(Deno.memoryUsage()),{headers:{"content-type":"application/json"}}):new Response("Not Found",{status:404})),this.#t=Deno.serve({port:e,onListen:n(()=>{E.debug(`Server running at http://localhost:${e}`)},"onListen")},async l=>{try{return await r.default.fetch(l,o,this.#r())}catch(f){return E.error("Error handling request:",f),new Response("Internal Server Error",{status:500})}}),await this.#t.finished,await this.#n.finished}async stop(){await this.#t?.shutdown()}};import{pathToFileURL as Nt}from"node:url";var we=k("dist","worker.js");function Se(){if(Deno.build.standalone)return k("..",we);let t=Deno.cwd();return k(t,we)}n(Se,"getDefaultWorkerPath");function Ot(t){return typeof t=="object"&&t!==null&&"default"in t&&typeof t.default=="object"&&"fetch"in t.default&&typeof t.default.fetch=="function"}n(Ot,"isWorkerModule");async function ue(t){let e;if(Deno.build.standalone?(E.debug("Loading worker module from: ",t),e=await import(t)):(E.debug("Loading dev worker module from: ",t),e=await import(Nt(t).href)),!Ot(e))throw new Error("Invalid worker module");return e}n(ue,"importWorkerModule");function Pe(){console.log("Enabling fetch host override.");let t=globalThis.fetch,e=Deno.createHttpClient({allowHost:!0,http2:!1});return globalThis.fetch=async(r,o={})=>await t(r,{...o,client:e}),e}n(Pe,"setFetchHostOverride");function _e(t){if(new.target)throw new TypeError("Cannot create an instance: parse is not a constructor");return new pe(t).parse()}n(_e,"parse");var pe=class{static{n(this,"JsoncParser")}#t=new Set(` \r
|
|
27
|
-
`);#n=new Set([..."[]{}:,/",...this.#t]);#e;#r;#s;constructor(e){this.#e=`${e}`,this.#r=this.#e.length,this.#s=this.#l()}parse(){let e=this.#o(),r=this.#i(e),{done:o,value:s}=this.#s.next();if(!o)throw new SyntaxError(
|
|
28
|
-
`||this.#e[e]==="\r");e++);continue}switch(this.#e[e]){case"{":yield{type:"BeginObject",position:e};break;case"}":yield{type:"EndObject",position:e};break;case"[":yield{type:"BeginArray",position:e};break;case"]":yield{type:"EndArray",position:e};break;case":":yield{type:"NameSeparator",position:e};break;case",":yield{type:"ValueSeparator",position:e};break;case'"':{let r=e,o=!1;for(e++;e<this.#r&&!(this.#e[e]==='"'&&!o);e++)o=this.#e[e]==="\\"&&!o;yield{type:"String",sourceText:this.#e.substring(r,e+1),position:r};break}default:{let r=e;for(;e<this.#r&&!this.#n.has(this.#e[e]);e++);e--,yield{type:"NullOrTrueOrFalseOrNumber",sourceText:this.#e.substring(r,e+1),position:r}}}}}#i(e){switch(e.type){case"BeginObject":return this.#c();case"BeginArray":return this.#f();case"NullOrTrueOrFalseOrNumber":return this.#d(e);case"String":return this.#a(e);default:throw new SyntaxError(
|
|
25
|
+
var Ue=Object.defineProperty;var n=(t,e)=>Ue(t,"name",{value:e,configurable:!0});import{scheduler as Ge}from"node:timers/promises";Object.defineProperty(globalThis,"scheduler",{value:Ge,writable:!1,enumerable:!0,configurable:!1});function q(t){let e=0;for(let s of t)e+=s.length;let r=new Uint8Array(e),o=0;for(let s of t)r.set(s,o),o+=s.length;return r}n(q,"concat");var $=new TextEncoder,se=new TextDecoder,$e=42,We=124,je=40,ze=33,Ve=35,Ke=36,Je=44,Xe=45,Ze=58,qe=37,Ye=95,Qe=62,et=126,tt=43,rt=61,J=$.encode(`\r
|
|
26
|
+
`),nt=$.encode("*"),ot=$.encode("$");function oe(t){let e=[nt,$.encode(t.length.toString()),J];for(let r of t){let o=r instanceof Uint8Array?r:$.encode(r.toString());e.push(ot,$.encode(o.byteLength.toString()),J,o,J)}return q(e)}n(oe,"createRequest");async function*st(t){let e=new Uint8Array;for await(let r of t){e=q([e,r]);let o;for(;(o=e.indexOf(J[0]))!==-1&&e[o+1]===J[1];)yield e.subarray(0,o),e=e.subarray(o+2)}}n(st,"readLines");function K(t,e,r=!1){return Array.fromAsync({length:e},()=>X(t,r))}n(K,"readNReplies");function v(t){return se.decode(t.slice(1))}n(v,"parseLine");function it(t){let e=[];for(let r=0;r<t.length;r+=2)e.push(t.slice(r,r+2));return e}n(it,"chunk");async function X(t,e=!1){let{value:r}=await t.next();switch(r[0]){case $e:case Qe:{let o=Number(v(r));return o===-1?null:await K(t,o)}case We:{let o=Number(v(r))*2;return await K(t,o),X(t,e)}case je:return BigInt(v(r));case ze:{let{value:o}=await t.next();return Promise.reject(se.decode(o))}case Ve:return v(r)==="t";case Ke:case rt:return v(r)==="-1"?null:X(t,e);case Je:case Ze:switch(v(r)){case"inf":return 1/0;case"-inf":return-1/0;default:return Number(v(r))}case Xe:return Promise.reject(v(r));case qe:{let o=Number(v(r))*2,s=await K(t,o);return Object.fromEntries(it(s))}case Ye:return null;case et:return new Set(await K(t,Number(v(r)),e));case tt:return v(r);default:return e?r:se.decode(r)}}n(X,"readReply");var Y=class{static{n(this,"RedisClient")}#t;#n;#e=Promise.resolve();constructor(e){this.#t=e.writable.getWriter(),this.#n=st(e.readable)}#r(e){return this.#e=this.#e.then(e),this.#e}sendCommand(e,r=!1){return this.#r(()=>(this.#t.write(oe(e)),X(this.#n,r)))}writeCommand(e){return this.#r(()=>this.#t.write(oe(e)))}async*readReplies(e=!1){for(;;)yield X(this.#n,e)}pipelineCommands(e,r=!1){return this.#r(()=>{let o=q(e.map(oe));return this.#t.write(o),K(this.#n,e.length,r)})}};var R=globalThis.Deno?.build.os==="windows"||globalThis.navigator?.platform?.startsWith("Win")||globalThis.process?.platform?.startsWith("win")||!1;function E(t){if(typeof t!="string")throw new TypeError(`Path must be a string, received "${JSON.stringify(t)}"`)}n(E,"assertPath");function k(t){return t===47}n(k,"isPosixPathSeparator");function b(t){return t===47||t===92}n(b,"isPathSeparator");function B(t){return t>=97&&t<=122||t>=65&&t<=90}n(B,"isWindowsDeviceRoot");function ee(t){if(E(t),t.length===0)return"."}n(ee,"assertArg");function W(t,e,r,o){let s="",a=0,f=-1,c=0,u;for(let i=0;i<=t.length;++i){if(i<t.length)u=t.charCodeAt(i);else{if(o(u))break;u=47}if(o(u)){if(!(f===i-1||c===1))if(f!==i-1&&c===2){if(s.length<2||a!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){let p=s.lastIndexOf(r);p===-1?(s="",a=0):(s=s.slice(0,p),a=s.length-1-s.lastIndexOf(r)),f=i,c=0;continue}else if(s.length===2||s.length===1){s="",a=0,f=i,c=0;continue}}e&&(s.length>0?s+=`${r}..`:s="..",a=2)}else s.length>0?s+=r+t.slice(f+1,i):s=t.slice(f+1,i),a=i-f-1;f=i,c=0}else u===46&&c!==-1?++c:c=-1}return s}n(W,"normalizeString");function te(t){ee(t);let e=k(t.charCodeAt(0)),r=k(t.charCodeAt(t.length-1));return t=W(t,!e,"/",k),t.length===0&&!e&&(t="."),t.length>0&&r&&(t+="/"),e?`/${t}`:t}n(te,"normalize");function ae(...t){if(t.length===0)return".";t.forEach(r=>E(r));let e=t.filter(r=>r.length>0).join("/");return e===""?".":te(e)}n(ae,"join");function re(t){ee(t);let e=t.length,r=0,o,s=!1,a=t.charCodeAt(0);if(e>1)if(b(a))if(s=!0,b(t.charCodeAt(1))){let c=2,u=c;for(;c<e&&!b(t.charCodeAt(c));++c);if(c<e&&c!==u){let i=t.slice(u,c);for(u=c;c<e&&b(t.charCodeAt(c));++c);if(c<e&&c!==u){for(u=c;c<e&&!b(t.charCodeAt(c));++c);if(c===e)return`\\\\${i}\\${t.slice(u)}\\`;c!==u&&(o=`\\\\${i}\\${t.slice(u,c)}`,r=c)}}}else r=1;else B(a)&&t.charCodeAt(1)===58&&(o=t.slice(0,2),r=2,e>2&&b(t.charCodeAt(2))&&(s=!0,r=3));else if(b(a))return"\\";let f;return r<e?f=W(t.slice(r),!s,"\\",b):f="",f.length===0&&!s&&(f="."),f.length>0&&b(t.charCodeAt(e-1))&&(f+="\\"),o===void 0?s?f.length>0?`\\${f}`:"\\":f:s?f.length>0?`${o}\\${f}`:`${o}\\`:o+f}n(re,"normalize");function le(...t){if(t.forEach(a=>E(a)),t=t.filter(a=>a.length>0),t.length===0)return".";let e=!0,r=0,o=t[0];if(b(o.charCodeAt(0))){++r;let a=o.length;a>1&&b(o.charCodeAt(1))&&(++r,a>2&&(b(o.charCodeAt(2))?++r:e=!1))}let s=t.join("\\");if(e){for(;r<s.length&&b(s.charCodeAt(r));++r);r>=2&&(s=`\\${s.slice(r)}`)}return re(s)}n(le,"join");function N(...t){return R?le(...t):ae(...t)}n(N,"join");function St(t){if(t.length>=255)throw new TypeError("Alphabet too long");let e=new Uint8Array(256);for(let i=0;i<e.length;i++)e[i]=255;for(let i=0;i<t.length;i++){let p=t.charAt(i),g=p.charCodeAt(0);if(e[g]!==255)throw new TypeError(p+" is ambiguous");e[g]=i}let r=t.length,o=t.charAt(0),s=Math.log(r)/Math.log(256),a=Math.log(256)/Math.log(r);function f(i){if(i instanceof Uint8Array||(ArrayBuffer.isView(i)?i=new Uint8Array(i.buffer,i.byteOffset,i.byteLength):Array.isArray(i)&&(i=Uint8Array.from(i))),!(i instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(i.length===0)return"";let p=0,g=0,A=0,x=i.length;for(;A!==x&&i[A]===0;)A++,p++;let w=(x-A)*a+1>>>0,S=new Uint8Array(w);for(;A!==x;){let y=i[A],_=0;for(let D=w-1;(y!==0||_<g)&&D!==-1;D--,_++)y+=256*S[D]>>>0,S[D]=y%r>>>0,y=y/r>>>0;if(y!==0)throw new Error("Non-zero carry");g=_,A++}let P=w-g;for(;P!==w&&S[P]===0;)P++;let C=o.repeat(p);for(;P<w;++P)C+=t.charAt(S[P]);return C}n(f,"encode");function c(i){if(typeof i!="string")throw new TypeError("Expected String");if(i.length===0)return new Uint8Array;let p=0,g=0,A=0;for(;i[p]===o;)g++,p++;let x=(i.length-p)*s+1>>>0,w=new Uint8Array(x);for(;p<i.length;){let y=i.charCodeAt(p);if(y>255)return;let _=e[y];if(_===255)return;let D=0;for(let d=x-1;(_!==0||D<A)&&d!==-1;d--,D++)_+=r*w[d]>>>0,w[d]=_%256>>>0,_=_/256>>>0;if(_!==0)throw new Error("Non-zero carry");A=D,p++}let S=x-A;for(;S!==x&&w[S]===0;)S++;let P=new Uint8Array(g+(x-S)),C=g;for(;S!==x;)P[C++]=w[S++];return P}n(c,"decodeUnsafe");function u(i){let p=c(i);if(p)return p;throw new Error("Non-base"+r+" character")}return n(u,"decode"),{encode:f,decodeUnsafe:c,decode:u}}n(St,"base");var Te=St;var _t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",be=Te(_t);import{pathToFileURL as xe}from"node:url";import Ce from"dotenv";var ce=class{static{n(this,"ZenoLogger")}prefix="[ZENO]:";logLevel;originalConsole={debug:console.debug,info:console.info,warn:console.warn,error:console.error};constructor(e="info"){this.logLevel=e}debug(...e){(this.shouldLog("debug")||Deno.env.get("ZENO_DEBUG"))&&this.originalConsole.debug(this.prefix,"[DEBUG]",...e)}info(...e){this.shouldLog("info")&&this.originalConsole.info(this.prefix,"[INFO]",...e)}warn(...e){this.shouldLog("warn")&&this.originalConsole.warn(this.prefix,"[WARN]",...e)}error(...e){this.shouldLog("error")&&this.originalConsole.error(this.prefix,"[ERROR]",...e)}shouldLog(e){let r=["debug","info","warn","error"],o=r.indexOf(this.logLevel);return r.indexOf(e)>=o}setLogLevel(e){this.logLevel=e}},T=new ce;async function Re(t){let e={};for(let[r,o]of Object.entries(Deno.env.toObject()))o!==void 0&&(e[r]=o);try{let r=N(t,".env.zuplo"),o=new TextDecoder("utf-8"),s=await Deno.readFile(xe(r)),a=o.decode(s),f=Ce.parse(a);for(let[c,u]of Object.entries(f))if(e[c]=u,c==="ZUPLO_SYSTEM_CONFIGURATIONS")try{let i=new TextDecoder().decode(be.decode(u)),p=JSON.parse(i);for(let[g,A]of Object.entries(p))e[g]=String(A)}catch(i){Deno.build.standalone||T.error("Failed to parse ZUPLO_SYSTEM_CONFIGURATIONS from .env.zuplo:",i)}}catch(r){r instanceof Deno.errors.NotFound||T.error("Failed to load .env.zuplo file:",r)}try{let r=N(t,".env"),o=new TextDecoder("utf-8"),s=await Deno.readFile(xe(r)),a=o.decode(s),f=Ce.parse(a);for(let[c,u]of Object.entries(f))e[c]=u}catch(r){r instanceof Deno.errors.NotFound||T.error("Failed to load .env.zuplo file:",r)}for(let[r,o]of Object.entries(e))o===void 0&&delete e[r];return e.__ZUPLO_IS_MANAGED_DEDICATED="true",e}n(Re,"loadEnvironment");function Ee(t){return t?["true","1","yes","y"].includes(t.toLowerCase()):!1}n(Ee,"parseEnvBool");var fe=class{static{n(this,"CacheStorage")}#t;constructor(){this.#t=new Map}async open(e){let r=this.#t.get(e);return r||(r=new de,this.#t.set(e,r)),r}async has(e){return this.#t.has(e)}async delete(e){throw new Error("caches.delete is not supported")}};async function Nt(){let t=Deno.env.get("ZUPLO_CACHE_REDIS_HOSTNAME");if(t===void 0)throw new Error("ZUPLO_CACHE_REDIS_HOSTNAME is not set");let e=parseInt(Deno.env.get("ZUPLO_CACHE_REDIS_PORT")||"6379"),r=await Deno.connect({hostname:t,port:e});return new Y(r)}n(Nt,"getRedisClient");function Pt(t){let e={};return t&&t.split(",").forEach(o=>{let[s,a]=o.trim().split("=");e[s.toLowerCase()]=a?a.trim():!0}),e}n(Pt,"parseHeaderValue");function Dt(t){let e={};for(let[r,o]of t.entries())e[r]=o;return e}n(Dt,"objectifyHeaders");async function Ot(t){let e=await t.arrayBuffer(),r=new Uint8Array(e),o="";for(let s=0;s<r.length;s++)o+=String.fromCharCode(r[s]);return btoa(o)}n(Ot,"serializeResponseBody");function vt(t){let e=atob(t),r=e.length,o=new Uint8Array(r);for(let s=0;s<r;s++)o[s]=e.charCodeAt(s);return o}n(vt,"deserializeResponseBody");var de=class{static{n(this,"Cache")}#t;#n;#e;constructor(e="default",r={}){this.#t=e;let o=Deno.env.get("ZUPLO_CACHE_REDIS_HOSTNAME")&&Deno.env.get("ZUPLO_CACHE_REDIS_PORT");this.#n=!o||!Ee(Deno.env.get("USE_ZENO_ZONE_CACHE")),this.#e=r.getRedisClient||Nt}#r(e){return`${this.#t}:${e.url}`}async match(e,r){if(this.#n)return;let o=this.#r(e),s=await this.#e();await s.sendCommand(["HELLO",3]);let a=await s.sendCommand(["TTL",o]);if(a!==-2){if(a<2)return;{let f=await s.sendCommand(["HGETALL",o]),c=f.status,u=f.status,i=new Headers(JSON.parse(f.headers));return new Response(vt(f.body),{status:c,statusText:u,headers:i})}}}async put(e,r){if(this.#n)return;let o=1*60*60,s=Pt(r.headers.get("cache-control")),a=parseInt(s["s-maxage"]),f=parseInt(s["max-age"]),c=s["no-store"],u=s["no-cache"],i=a||f||0;if(i===0&&!c&&!u&&(i=o,r.headers.append("cache-control",`s-maxage=${o}`)),i>0){let p=this.#r(e),g=await this.#e();await g.sendCommand(["HELLO",3]),await g.sendCommand(["HSET",p,"maxage",i,"status",r.status,"statusText",r.statusText,"headers",JSON.stringify(Dt(r.headers)),"body",await Ot(r)]),await g.sendCommand(["EXPIRE",p,i])}}async delete(e){if(this.#n)return;let r=this.#r(e);if(await(await this.#e()).sendCommand(["DEL",r])!==1)throw new Error("Failed to delete cache entry")}},kt=new fe;Object.defineProperty(globalThis,"caches",{value:kt,writable:!1,enumerable:!0,configurable:!1});var ne=class{static{n(this,"WorkerServer")}#t;#n;#e;#r=n(()=>({waitUntil:n(e=>{e.catch(r=>{console.error("Error in waitUntil:",r)})},"waitUntil")}),"#createContext");constructor(e){this.#e=e}async start(){let{port:e,workerModule:r,env:o}=this.#e,s=e+1;this.#n=Deno.serve({port:s,onListen:n(()=>{T.debug(`Stats server running at http://localhost:${s}`)},"onListen")},a=>a.url.endsWith("/__zuplo/internal_memory_metrics")?new Response(JSON.stringify(Deno.memoryUsage()),{headers:{"content-type":"application/json"}}):new Response("Not Found",{status:404})),this.#t=Deno.serve({port:e,onListen:n(()=>{T.debug(`Server running at http://localhost:${e}`)},"onListen")},async a=>{try{return await r.default.fetch(a,o,this.#r())}catch(f){return T.error("Error handling request:",f),new Response("Internal Server Error",{status:500})}}),await this.#t.finished,await this.#n.finished}async stop(){await this.#t?.shutdown()}};import{pathToFileURL as Lt}from"node:url";var we=N("dist","worker.js");function Se(){if(Deno.build.standalone)return N("..",we);let t=Deno.cwd();return N(t,we)}n(Se,"getDefaultWorkerPath");function Bt(t){return typeof t=="object"&&t!==null&&"default"in t&&typeof t.default=="object"&&"fetch"in t.default&&typeof t.default.fetch=="function"}n(Bt,"isWorkerModule");async function ue(t){let e;if(Deno.build.standalone?(T.debug("Loading worker module from: ",t),e=await import(t)):(T.debug("Loading dev worker module from: ",t),e=await import(Lt(t).href)),!Bt(e))throw new Error("Invalid worker module");return e}n(ue,"importWorkerModule");function _e(){console.log("Enabling fetch host override.");let t=globalThis.fetch,e=Deno.createHttpClient({allowHost:!0,http2:!1});return globalThis.fetch=(r,o)=>{let s={...o??{},client:e};return t(r,s)},e}n(_e,"setFetchHostOverride");function Ne(t){if(new.target)throw new TypeError("Cannot create an instance: parse is not a constructor");return new pe(t).parse()}n(Ne,"parse");var pe=class{static{n(this,"JsoncParser")}#t=new Set(` \r
|
|
27
|
+
`);#n=new Set([..."[]{}:,/",...this.#t]);#e;#r;#s;constructor(e){this.#e=`${e}`,this.#r=this.#e.length,this.#s=this.#l()}parse(){let e=this.#o(),r=this.#i(e),{done:o,value:s}=this.#s.next();if(!o)throw new SyntaxError(I(s));return r}#o(){let{done:e,value:r}=this.#s.next();if(e)throw new SyntaxError("Cannot parse JSONC: unexpected end of JSONC input");return r}*#l(){for(let e=0;e<this.#r;e++)if(!this.#t.has(this.#e[e])){if(this.#e[e]==="/"&&this.#e[e+1]==="*"){e+=2;let r=!1;for(;e<this.#r;e++)if(this.#e[e]==="*"&&this.#e[e+1]==="/"){r=!0;break}if(!r)throw new SyntaxError("Cannot parse JSONC: unexpected end of JSONC input");e++;continue}if(this.#e[e]==="/"&&this.#e[e+1]==="/"){for(e+=2;e<this.#r&&!(this.#e[e]===`
|
|
28
|
+
`||this.#e[e]==="\r");e++);continue}switch(this.#e[e]){case"{":yield{type:"BeginObject",position:e};break;case"}":yield{type:"EndObject",position:e};break;case"[":yield{type:"BeginArray",position:e};break;case"]":yield{type:"EndArray",position:e};break;case":":yield{type:"NameSeparator",position:e};break;case",":yield{type:"ValueSeparator",position:e};break;case'"':{let r=e,o=!1;for(e++;e<this.#r&&!(this.#e[e]==='"'&&!o);e++)o=this.#e[e]==="\\"&&!o;yield{type:"String",sourceText:this.#e.substring(r,e+1),position:r};break}default:{let r=e;for(;e<this.#r&&!this.#n.has(this.#e[e]);e++);e--,yield{type:"NullOrTrueOrFalseOrNumber",sourceText:this.#e.substring(r,e+1),position:r}}}}}#i(e){switch(e.type){case"BeginObject":return this.#c();case"BeginArray":return this.#f();case"NullOrTrueOrFalseOrNumber":return this.#d(e);case"String":return this.#a(e);default:throw new SyntaxError(I(e))}}#c(){let e={};for(;;){let r=this.#o();if(r.type==="EndObject")return e;if(r.type!=="String")throw new SyntaxError(I(r));let o=this.#a(r),s=this.#o();if(s.type!=="NameSeparator")throw new SyntaxError(I(s));let a=this.#o();Object.defineProperty(e,o,{value:this.#i(a),writable:!0,enumerable:!0,configurable:!0});let f=this.#o();if(f.type==="EndObject")return e;if(f.type!=="ValueSeparator")throw new SyntaxError(I(f))}}#f(){let e=[];for(;;){let r=this.#o();if(r.type==="EndArray")return e;e.push(this.#i(r));let o=this.#o();if(o.type==="EndArray")return e;if(o.type!=="ValueSeparator")throw new SyntaxError(I(o))}}#a(e){let r;try{r=JSON.parse(e.sourceText)}catch{throw new SyntaxError(I(e))}if(typeof r!="string")throw new TypeError(`Parsed value is not a string: ${r}`);return r}#d(e){if(e.sourceText==="null")return null;if(e.sourceText==="true")return!0;if(e.sourceText==="false")return!1;let r;try{r=JSON.parse(e.sourceText)}catch{throw new SyntaxError(I(e))}if(typeof r!="number")throw new TypeError(`Parsed value is not a number: ${r}`);return r}};function I({type:t,sourceText:e,position:r}){let o="";switch(t){case"BeginObject":o="{";break;case"EndObject":o="}";break;case"BeginArray":o="[";break;case"EndArray":o="]";break;case"NameSeparator":o=":";break;case"ValueSeparator":o=",";break;case"NullOrTrueOrFalseOrNumber":case"String":o=30<e.length?`${e.slice(0,30)}...`:e;break}return`Cannot parse JSONC: unexpected token "${o}" in JSONC at position ${r}`}n(I,"buildErrorMessage");var Pe="zuplo.jsonc";function De(t){let e=N(t,Pe),r;try{r=Deno.readTextFileSync(e)}catch(a){T.warn(a,`Failed to read ${Pe}`);return}let o=Ne(r);if(o===null)return;let s;return typeof o=="object"&&"managedDedicatedFlags"in o?s=o.managedDedicatedFlags:typeof o=="object"&&"flags"in o&&typeof o.flags=="object"&&o.flags!==null&&"managedDedicatedFlags"in o.flags?s=o.flags.managedDedicatedFlags:typeof o=="object"&&("projectType"in o||"allowHostHeaderOverride"in o)&&(s={useZeno:"projectType"in o&&o.projectType!=="managed-edge",allowFetchHostHeaderOverride:"allowHostHeaderOverride"in o&&o.allowHostHeaderOverride===!0}),s}n(De,"getManagedDedicatedSettings");var Mt=globalThis.fetch.bind(globalThis);function Oe(){return globalThis.__managedDedicatedMtlsClientState||(globalThis.__managedDedicatedMtlsClientState={clientsByName:{},bindingsByName:{},loadPromise:void 0}),globalThis.managedDedicatedMtlsClients||(globalThis.managedDedicatedMtlsClients=globalThis.__managedDedicatedMtlsClientState.clientsByName),globalThis.managedDedicatedMtlsBindings||(globalThis.managedDedicatedMtlsBindings=globalThis.__managedDedicatedMtlsClientState.bindingsByName),globalThis.__managedDedicatedMtlsClientState}n(Oe,"getMtlsClientState");function Ft(t,e){return e.map(r=>({certName:r,certPath:N(t,"mtls",`${r}.crt`),keyPath:N(t,"mtls",`${r}.key`)}))}n(Ft,"getCertPaths");async function Ht(t,e,r){let o=Ft(t,e);return(await Promise.all(o.map(async({certName:a,certPath:f,keyPath:c})=>{T.info(`Loading mTLS certificate ${a}`);try{let u=await Deno.readTextFile(f),i=await Deno.readTextFile(c),p;return r?p=Deno.createHttpClient({cert:u,key:i,allowHost:!0,http2:!1}):p=Deno.createHttpClient({cert:u,key:i}),T.info(`Successfully loaded mTLS certificate ${a}`),{certName:a,client:p}}catch(u){return T.warn(`Failed to load mTLS certificate ${a}: ${u}`),null}}))).filter(a=>a!==null)}n(Ht,"loadMtlsClientEntries");function ve(t,e,r){let o=Oe();return o.loadPromise||(o.loadPromise=Ht(t,e,r).then(s=>{let a={},f={};for(let{certName:c,client:u}of s)a[c]=u,f[c]={fetch:n((i,p)=>{let g={...p??{},client:u};return Mt(i,g)},"fetch")};return o.clientsByName=a,o.bindingsByName=f,globalThis.managedDedicatedMtlsClients=a,globalThis.managedDedicatedMtlsBindings=f,a}).catch(s=>{throw o.loadPromise=void 0,s})),o.loadPromise}n(ve,"initializeGlobalMtlsClients");function ke(){let t=Oe();for(let e of Object.values(t.clientsByName))e.close();t.clientsByName={},t.bindingsByName={},globalThis.managedDedicatedMtlsClients=t.clientsByName,globalThis.managedDedicatedMtlsBindings=t.bindingsByName,t.loadPromise=void 0}n(ke,"closeGlobalMtlsClients");var It=/^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value>.+?))?$/s,Ut=/[A-Za-z]/,Gt=/-?\d+(\.\d*)?(e-?\d+)?$/,$t=/^(-|--)[^-]/,Wt=/=(?<value>.+)/,jt=/^--[^=]+$/,zt=/\W/,Vt=/\S/;function Le(t){return Vt.test(t)&&Number.isFinite(Number(t))}n(Le,"isNumber");function j(t,e,r,o=!1){e=[...e];let s=e.pop();if(e.forEach(a=>t=t[a]??={}),o){let a=t[s];if(Array.isArray(a)){a.push(r);return}r=a?[a,r]:[r]}t[s]=r}n(j,"setNested");function ge(t,e){for(let r of e){let o=t[r];if(!Object.hasOwn(t,r))return!1;t=o}return!0}n(ge,"hasNested");function Be(t,e,r){let o=t.get(r);if(o===void 0)return!1;for(let s of o)if(e.has(s))return!0;return!1}n(Be,"aliasIsBoolean");function Me(t){return t==="true"||t==="false"}n(Me,"isBooleanString");function me(t){return t!=="false"}n(me,"parseBooleanString");function Fe(t,e){let{"--":r=!1,alias:o={},boolean:s=!1,default:a={},stopEarly:f=!1,string:c=[],collect:u=[],negatable:i=[],unknown:p=n(d=>d,"unknownFn")}=e??{},g=new Map,A=new Set,x=new Set,w=new Set,S=new Set,P=!1;if(o)for(let[d,l]of Object.entries(o)){if(l===void 0)throw new TypeError("Alias value must be defined");let m=Array.isArray(l)?l:[l];g.set(d,new Set(m)),m.forEach(M=>g.set(M,new Set([d,...m.filter(G=>G!==M)])))}if(s)if(typeof s=="boolean")P=s;else{let d=Array.isArray(s)?s:[s];for(let l of d.filter(Boolean))A.add(l),g.get(l)?.forEach(m=>{A.add(m)})}if(c){let d=Array.isArray(c)?c:[c];for(let l of d.filter(Boolean))x.add(l),g.get(l)?.forEach(m=>x.add(m))}if(u){let d=Array.isArray(u)?u:[u];for(let l of d.filter(Boolean))w.add(l),g.get(l)?.forEach(m=>w.add(m))}if(i){let d=Array.isArray(i)?i:[i];for(let l of d.filter(Boolean))S.add(l),g.get(l)?.forEach(m=>S.add(m))}let C={_:[]};function y(d,l,m,M){if(!A.has(d)&&!x.has(d)&&!g.has(d)&&!(P&&jt.test(m))&&p?.(m,d,l)===!1)return;typeof l=="string"&&!x.has(d)&&(l=Le(l)?Number(l):l);let G=M&&w.has(d);j(C,d.split("."),l,G),g.get(d)?.forEach(h=>{j(C,h.split("."),l,G)})}n(y,"setArgument");let _=[],D=t.indexOf("--");D!==-1&&(_=t.slice(D+1),t=t.slice(0,D));e:for(let d=0;d<t.length;d++){let l=t[d],m=l.match(It)?.groups;if(m){let{doubleDash:M,negated:G}=m,h=m.key,L=m.value;if(M){if(L){A.has(h)&&(L=me(L)),y(h,L,l,!0);continue}if(G){if(S.has(h)){y(h,!1,l,!1);continue}h=`no-${h}`}let O=t[d+1];if(O){if(!A.has(h)&&!P&&!O.startsWith("-")&&(!g.has(h)||!Be(g,A,h))){L=O,d++,y(h,L,l,!0);continue}if(Me(O)){L=me(O),d++,y(h,L,l,!0);continue}}L=x.has(h)?"":!0,y(h,L,l,!0);continue}let he=l.slice(1,-1).split("");for(let[O,U]of he.entries()){let V=l.slice(O+2);if(V==="-"){y(U,V,l,!0);continue}if(Ut.test(U)){let Ae=Wt.exec(V)?.groups;if(Ae){y(U,Ae.value,l,!0);continue e}if(Gt.test(V)){y(U,V,l,!0);continue e}}if(he[O+1]?.match(zt)){y(U,l.slice(O+2),l,!0);continue e}y(U,x.has(U)?"":!0,l,!0)}if(h=l.slice(-1),h==="-")continue;let z=t[d+1];if(z){if(!$t.test(z)&&!A.has(h)&&(!g.has(h)||!Be(g,A,h))){y(h,z,l,!0),d++;continue}if(Me(z)){let O=me(z);y(h,O,l,!0),d++;continue}}y(h,x.has(h)?"":!0,l,!0);continue}if(p?.(l)!==!1&&C._.push(x.has("_")||!Le(l)?l:Number(l)),f){C._.push(...t.slice(d+1));break}}for(let[d,l]of Object.entries(a)){let m=d.split(".");ge(C,m)||(j(C,m,l),g.get(d)?.forEach(M=>j(C,M.split("."),l)))}for(let d of A.keys()){let l=d.split(".");if(!ge(C,l)){let m=w.has(d)?[]:!1;j(C,l,m)}}for(let d of x.keys()){let l=d.split(".");!ge(C,l)&&w.has(d)&&j(C,l,[])}return r?C["--"]=_:C._.push(..._),C}n(Fe,"parseArgs");var He="__ZUPLO_MTLS_CLIENT_CERT_NAMES",Ie="__ZUPLO_MTLS_CLIENT_CERT_BASE_DIR";function Kt(t){return t?[...new Set(t.split(",").map(e=>e.trim()).filter(e=>e.length>0))]:[]}n(Kt,"getMtlsCertNames");async function Jt(){let t;T.debug("Starting Zeno server...");let e=Fe(Deno.args,{boolean:["help"],string:["port","dir"],default:{port:9e3}}),r=Number(e.port);(isNaN(r)||r<1||r>65535)&&(T.error(`Invalid port: ${e.port}. Port must be a number between 1 and 65535.`),Deno.exit(1));let o=r;try{let s=e.dir?e.dir:Deno.cwd(),a=N(s,"dist","worker.js"),f;Deno.build.standalone?f=await ue(Se()):f=await ue(a);let c=await Re(s),u=De(s);u?.allowFetchHostHeaderOverride&&(t=_e());let i=Kt(c[He]),p=c[Ie];p&&i.length>0&&(T.info(`Initializing ${i.length} mTLS client(s)`),await ve(p,i,u?.allowFetchHostHeaderOverride??!1)),await new ne({port:o,workerModule:f,env:c}).start()}catch(s){T.error("Failed to start server:",s)}finally{ke(),t&&t.close()}}n(Jt,"main");import.meta.main&&await Jt();export{Jt as main};
|