@zuplo/core 6.38.15 → 6.38.16
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 +125 -131
- package/index.minified.js +3 -9
- package/package.json +4 -4
package/index.minified.js
CHANGED
|
@@ -577,15 +577,9 @@ globstar while`,s,K,c,Ne,De),this.matchOne(s.slice(K),c.slice(Ne),f))return this
|
|
|
577
577
|
`,"n"],["\f","f"],["\r","r"],[" ","t"]]),yMr=new Map([..._or,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),_fe=new Map([[eor,"LBracket"],[tor,"RBracket"],[ror,"LBrace"],[nor,"RBrace"],[ior,"Colon"],[sor,"Comma"],[aor,"Boolean"],[oor,"Boolean"],[cor,"Null"]]),ffe=new Map([..._fe,[lor,"Number"],[uor,"Number"]]),wNe=new Set([10,13,8232,8233]),o6=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:c,column:f,offset:d}){super(`${s} (${c}:${f})`),this.line=c,this.column=f,this.offset=d}},PNe=class extends o6{static{t(this,"UnexpectedChar")}constructor(s,c){super(`Unexpected character '${String.fromCharCode(s)}' found.`,c)}},NNe=class extends o6{static{t(this,"UnexpectedIdentifier")}constructor(s,c){super(`Unexpected identifier '${s}' found.`,c)}},GF=class extends o6{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},dfe=class extends o6{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},por=/[\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]/,dor=/[\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]/,mor=13,kft=10,INe=class{static{t(this,"CharCodeReader")}#r="";#n=1;#e=0;#t=-1;#s=!1;#p=-1;#a=!1;constructor(s){this.#r=s}#_(){this.#a||(this.#e++,this.#t++,this.#p=-1,this.#a=!0)}locate(){return{line:this.#n,column:this.#e,offset:this.#t}}next(){if(this.#t>=this.#r.length-1)return this.#_(),-1;this.#t++;let s=this.#r.charCodeAt(this.#t);return this.#s?(this.#n++,this.#e=1,this.#s=!1):this.#e++,s===mor?(this.#s=!0,this.peek()===kft&&this.#t++):s===kft&&(this.#s=!0),this.#p=s,s}peek(){return this.#t===this.#r.length-1?-1:this.#r.charCodeAt(this.#t+1)}match(s){return s(this.peek())?(this.next(),!0):!1}current(){return this.#p}},hor="Infinity",gor="NaN",yor=new Set([116,102,110]),ONe=new Set([32,9,10,13]),wft=new Set([...ONe,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),vor={mode:"json",ranges:!1},bor=new Set(["true","false","null"]),G_={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 a6(a){return a>=48&&a<=57}t(a6,"isDigit");function ANe(a){return a6(a)||a>=65&&a<=70||a>=97&&a<=102}t(ANe,"isHexDigit");function Sor(a){return a>=49&&a<=57}t(Sor,"isPositiveDigit");function Tor(a){return yor.has(a)}t(Tor,"isKeywordStart");function Nft(a){return a6(a)||a===46||a===45}t(Nft,"isNumberStart");function Cor(a){return Nft(a)||a===43}t(Cor,"isJSON5NumberStart");function Pft(a,s){return a===34||s&&a===39}t(Pft,"isStringStart");function Ift(a){if(a===36||a===95||a===92||a>=97&&a<=122||a>=65&&a<=90||a===8204||a===8205)return!0;let s=String.fromCharCode(a);return por.test(s)}t(Ift,"isJSON5IdentifierStart");function Eor(a){if(Ift(a)||a6(a))return!0;let s=String.fromCharCode(a);return dor.test(s)}t(Eor,"isJSON5IdentifierPart");var FNe=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,c){this.#n=s,this.#r={...vor,...c},this.#e=new INe(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?pfe.has.bind(pfe):PQ.has.bind(PQ),this.#c=this.#t?wNe.has.bind(wNe):()=>!1,this.#l=this.#t?f=>f===120:()=>!1,this.#i=this.#t?wft.has.bind(wft):ONe.has.bind(ONe)}#f(s,c=this.#e.locate()){throw new PNe(s,c)}#v(s,c=this.#e.locate()){throw new NNe(s,c)}#d(){throw new dfe(this.#e.locate())}#u(s,c,f,d){let v=f.offset+c,E=this.#r.ranges?{range:[f.offset,v]}:void 0;return{type:s,loc:{start:f,end:d||{line:f.line,column:f.column+c,offset:v}},...E}}#m(s){let c="",f;for(let d=0;d<s;d++){if(f=this.#e.peek(),ANe(f)){this.#e.next(),c+=String.fromCharCode(f);continue}this.#f(f)}return c}#g(s){let c="";do{if(c+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),c+=String.fromCharCode(s),c+=this.#m(4)),s=this.#e.peek(),!Eor(s))break;this.#e.next()}while(!0);return c}#x(s){let c=s,f=1;for(s=this.#e.peek();s!==-1&&s!==c;){if(this.#e.next(),f++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),f++;else if(s===117){this.#e.next(),f++;let d=this.#m(4);f+=d.length}else if(this.#l(s)){this.#e.next(),f++;let d=this.#m(2);f+=d.length}else this.#t?(this.#e.next(),f++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),f++,f}#C(s){let c=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let f=this.#g(s);return f!==hor&&f!==gor&&this.#f(s),c+f.length}a6(s)||this.#f(s),this.#e.next(),c++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),c++,s=this.#e.peek(),ANe(s)||(this.#e.next(),this.#f(s));do this.#e.next(),c++,s=this.#e.peek();while(ANe(s))}else a6(s)&&this.#f(s);else if(!this.#t||s!==46)for(Sor(s)||this.#f(s),s=this.#e.peek();a6(s);)this.#e.next(),c++,s=this.#e.peek();if(s===46){let f=-1;for(this.#e.next(),c++,f++,s=this.#e.peek();a6(s);)this.#e.next(),c++,f++,s=this.#e.peek();!this.#t&&f===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),c++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),c++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),a6(s)||(this.#e.next(),this.#f(s));a6(s);)this.#e.next(),c++,s=this.#e.peek();return c}#b(s){let c=1;if(s=this.#e.peek(),s===47){do this.#e.next(),c+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:c,multiline:!1}}if(s===42){for(this.#e.next(),c+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),c+=1,s=this.#e.peek(),s===47)return this.#e.next(),c+=1,{length:c,multiline:!0}}else this.#e.next(),c+=1;this.#e.next(),this.#d()}this.#e.next(),this.#f(s)}next(){let s=this.#e.next();for(;this.#i(s);)s=this.#e.next();if(s===-1)return G_.EOF;let c=this.#e.locate(),f=String.fromCharCode(s);if(this.#t)if(ffe.has(f))this.#a=this.#u(ffe.get(f),1,c);else if(Ift(s)){let d=this.#g(s);ffe.has(d)?this.#a=this.#u(ffe.get(d),d.length,c):this.#a=this.#u("Identifier",d.length,c)}else if(Cor(s)){let d=this.#C(s);this.#a=this.#u("Number",d,c)}else if(Pft(s,this.#t)){let d=this.#x(s),v=this.#e.locate();this.#a=this.#u("String",d,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else if(s===47&&this.#s){let d=this.#b(s),v=this.#e.locate();this.#a=this.#u(d.multiline?"BlockComment":"LineComment",d.length,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else this.#f(s);else if(_fe.has(f))this.#a=this.#u(_fe.get(f),1,c);else if(Tor(s)){let d=this.#g(s);bor.has(d)||this.#v(d,c),this.#a=this.#u(_fe.get(d),d.length,c)}else if(Nft(s)){let d=this.#C(s);this.#a=this.#u("Number",d,c)}else if(Pft(s,this.#t)){let d=this.#x(s);this.#a=this.#u("String",d,c)}else if(s===47&&this.#s){let d=this.#b(s),v=this.#e.locate();this.#a=this.#u(d.multiline?"BlockComment":"LineComment",d.length,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else this.#f(s);return G_[this.#a.type]}get token(){return this.#a}};var hC={document(a,s={}){return{type:"Document",body:a,loc:s.loc,...s}},string(a,s={}){return{type:"String",value:a,loc:s.loc,...s}},number(a,s={}){return{type:"Number",value:a,loc:s.loc,...s}},boolean(a,s={}){return{type:"Boolean",value:a,loc:s.loc,...s}},null(a={}){return{type:"Null",loc:a.loc,...a}},array(a,s={}){return{type:"Array",elements:a,loc:s.loc,...s}},element(a,s={}){return{type:"Element",value:a,loc:s.loc,...s}},object(a,s={}){return{type:"Object",members:a,loc:s.loc,...s}},member(a,s,c={}){return{type:"Member",name:a,value:s,loc:c.loc,...c}},identifier(a,s={}){return{type:"Identifier",name:a,loc:s.loc,...s}},nan(a="",s={}){return{type:"NaN",sign:a,loc:s.loc,...s}},infinity(a="",s={}){return{type:"Infinity",sign:a,loc:s.loc,...s}}},xor={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function Dor(a,s,c=!1){let f="",d=a.indexOf("\\"),v=0;for(;d>=0;){f+=a.slice(v,d);let E=a.charAt(d+1),A=E.charCodeAt(0);if(c&&pfe.has(A))f+=pfe.get(A),v=d+2;else if(PQ.has(A))f+=PQ.get(A),v=d+2;else if(E==="u"){let O=a.slice(d+2,d+6);if(O.length<4||/[^0-9a-f]/i.test(O))throw new o6(`Invalid unicode escape \\u${O}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});f+=String.fromCharCode(parseInt(O,16)),v=d+6}else if(c&&E==="x"){let O=a.slice(d+2,d+4);if(O.length<2||/[^0-9a-f]/i.test(O))throw new o6(`Invalid hex escape \\x${O}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});f+=String.fromCharCode(parseInt(O,16)),v=d+4}else if(c&&wNe.has(A))v=d+2,E==="\r"&&a.charAt(v)===`
|
|
578
578
|
`&&v++;else if(c)f+=E,v=d+2;else throw new o6(`Invalid escape \\${E}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});d=a.indexOf("\\",v)}return f+=a.slice(v),f}t(Dor,"getStringValue");function Aor(a,s,c=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Dor(a.slice(1,-1),s,c);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Aor,"getLiteralValue");function Oft(a,s){s=Object.freeze({...xor,...s});let c=[],f=new FNe(a,{mode:s.mode,ranges:s.ranges}),d=s.mode==="json5",v=s.allowTrailingCommas||d;function E(){let pr=f.next();return pr&&s.tokens&&c.push(f.token),pr}t(E,"nextNoComments");function A(){let pr=f.next();return pr&&s.tokens&&c.push(f.token),pr>=G_.LineComment?A():pr}t(A,"nextSkipComments");let O=s.mode==="json"?E:A;function R(pr,sr){if(pr!==sr)throw new GF(f.token)}t(R,"assertTokenType");function W(pr,sr){if(!sr.includes(pr))throw new GF(f.token)}t(W,"assertTokenTypes");function $(pr,sr){return s.ranges?{range:[pr.offset,sr.offset]}:void 0}t($,"createRange");function K(pr){let sr=f.token,Cs=$(sr.loc.start,sr.loc.end),Di=Aor(a.slice(sr.loc.start.offset,sr.loc.end.offset),sr,d),hi={loc:{start:{...sr.loc.start},end:{...sr.loc.end}},...Cs};switch(pr){case G_.String:return hC.string(Di,hi);case G_.Number:return hC.number(Di,hi);case G_.Boolean:return hC.boolean(Di,hi);default:throw new TypeError(`Unknown token type ${sr.type}.`)}}t(K,"createLiteralNode");function Ne(pr){let sr=$(pr.loc.start,pr.loc.end),Cs=a.slice(pr.loc.start.offset,pr.loc.end.offset),_o={loc:{start:{...pr.loc.start},end:{...pr.loc.end}},...sr};if(pr.type!=="Identifier"){let hi="";return(Cs[0]==="+"||Cs[0]==="-")&&(hi=Cs[0]),hC[Cs.includes("NaN")?"nan":"infinity"](hi,_o)}return hC.identifier(Cs,_o)}t(Ne,"createJSON5IdentifierNode");function De(pr){let sr=$(pr.loc.start,pr.loc.end);return hC.null({loc:{start:{...pr.loc.start},end:{...pr.loc.end}},...sr})}t(De,"createNullNode");function Se(pr){d?W(pr,[G_.String,G_.Identifier,G_.Number]):R(pr,G_.String);let sr=f.token,Cs=pr===G_.String?K(pr):Ne(sr);if(d&&(Cs.type==="NaN"||Cs.type==="Infinity")){if(Cs.sign!=="")throw new GF(f.token);Cs=hC.identifier(Cs.type,{loc:Cs.loc,...$(Cs.loc.start,Cs.loc.end)})}pr=O(),R(pr,G_.Colon);let Di=vr(),_o=$(Cs.loc.start,Di.loc.end);return hC.member(Cs,Di,{loc:{start:{...Cs.loc.start},end:{...Di.loc.end}},..._o})}t(Se,"parseProperty");function Tt(pr){R(pr,G_.LBrace);let sr=f.token,Cs=[],Di=O();if(Di!==G_.RBrace)do{if(Cs.push(Se(Di)),Di=O(),!Di)throw new dfe(Cs[Cs.length-1].loc.end);if(Di===G_.Comma){if(Di=O(),v&&Di===G_.RBrace)break}else break}while(Di);R(Di,G_.RBrace);let _o=f.token,hi=$(sr.loc.start,_o.loc.end);return hC.object(Cs,{loc:{start:{...sr.loc.start},end:{..._o.loc.end}},...hi})}t(Tt,"parseObject");function xt(pr){R(pr,G_.LBracket);let sr=f.token,Cs=[],Di=O();if(Di!==G_.RBracket)do{let No=vr(Di);if(Cs.push(hC.element(No,{loc:No.loc})),Di=O(),Di===G_.Comma){if(Di=O(),v&&Di===G_.RBracket)break}else break}while(Di);R(Di,G_.RBracket);let _o=f.token,hi=$(sr.loc.start,_o.loc.end);return hC.array(Cs,{loc:{start:{...sr.loc.start},end:{..._o.loc.end}},...hi})}t(xt,"parseArray");function vr(pr){pr=pr??O();let sr=f.token;switch(pr){case G_.String:case G_.Boolean:return K(pr);case G_.Number:if(d){let Cs=a.slice(sr.loc.start.offset,sr.loc.end.offset);if((Cs[0]==="+"||Cs[0]==="-")&&(Cs=Cs.slice(1)),Cs==="NaN"||Cs==="Infinity")return Ne(sr)}return K(pr);case G_.Null:return De(sr);case G_.LBrace:return Tt(pr);case G_.LBracket:return xt(pr);default:throw new GF(sr)}}t(vr,"parseValue");let Tr=vr();if(O())throw new GF(f.token);let Cr={loc:{start:{line:1,column:1,offset:0},end:{...Tr.loc.end}}};return s.tokens&&(Cr.tokens=c),s.ranges&&(Cr.range=[Cr.loc.start.offset,Cr.loc.end.offset]),hC.document(Tr,Cr)}t(Oft,"parse");var kor=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function Fft(a){return a&&typeof a=="object"}t(Fft,"isObject");function wor(a){return Fft(a)&&typeof a.type=="string"}t(wor,"isNode");function Por(a,s){function c(f,d){typeof s.enter=="function"&&s.enter(f,d);for(let v of kor.get(f.type)){let E=f[v];Fft(E)&&(Array.isArray(E)?E.forEach(A=>c(A,f)):wor(E)&&c(E,f))}typeof s.exit=="function"&&s.exit(f,d)}t(c,"visitNode"),c(a)}t(Por,"traverse");function Lft(a,s=()=>!0){let c=[];return Por(a,{enter(f,d){c.push({node:f,parent:d,phase:"enter"})},exit(f,d){c.push({node:f,parent:d,phase:"exit"})}}),c.filter(s).values()}t(Lft,"iterator");import Nor from"fs/promises";var NQ=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),mfe=t(async a=>{try{return await Nor.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),IQ=t(async a=>{try{return Oft(a)}catch(s){if(s.column&&s.line&&s.message){let c=NQ(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:c}}return}},"getSchemaAST");var Rft=t(async(a,s,c)=>{try{if(a.length===0)return;for(let f of a){let d=await mfe(f),v=await Ior(d,f,s,c);if(v)return v}}catch{}},"getRouteLocationByValue"),Ior=t(async(a,s,c,f)=>{try{if(!a)return;let d=null,v=await IQ(a);if(v){for(let{node:E}of Lft(v))if(E.value&&E.value===c){d=E.loc;break}if(d!==null){let E=NQ(a,d.start.line);return{file:s,line:d.start.line,column:d.start.column,length:d.end.column-d.start.column,lineText:E,suggestion:f}}}}catch{}},"getRouteLocationByValueFromSchema");import Mft from"fs/promises";import hfe from"path";var LNe="schemas",RNe=".oas.json";var QF=t(async a=>(await Mft.readdir(a)).map(c=>`${a}/${c}`).filter(c=>c.endsWith(RNe)).sort(),"getOpenApiFilesByAlphabetical"),sB=t(async a=>{let s=hfe.resolve(a,"config");return(await Mft.readdir(s)).filter(f=>f.endsWith(RNe)).length>=1},"oasFileInProject");function OQ(a,s,c,f,d,v,E){if(v.has(c))return;let A;try{A=f.get(c)}catch(O){throw new Tv({text:`Failed to resolve reference: ${c}`,detail:O.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:c,namespace:s,suggestion:"Check the reference and try again."}})}v.set(c,d.length),d.push(c),MNe(jNe(c),s,A,f,d,v,E)}t(OQ,"chaseRefs");function MNe(a,s,c,f,d,v,E){if(Array.isArray(c))for(let A of c)MNe(a,s,A,f,d,v,E);else if(typeof c=="object")for(let A in c){if(A==="$ref"){let O=c[A];E&&(c[A]=E(s,O)),OQ(a,s,TN(a,O),f,d,v,E)}MNe(a,s,c[A],f,d,v,E)}}t(MNe,"lookForRefs");function TN(a,s){let c=s.indexOf("#");return c>=0?`${hfe.resolve(a,s.substring(0,c))}${s.substring(c)}`:hfe.resolve(hfe.dirname(a),s)}t(TN,"getFullyQualifiedRefName");function jNe(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(jNe,"getFilePathNameFromRefName");var BNe=class{static{t(this,"Environment")}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME??"working-copy.zuplotest.com"}},Oor=new BNe,UNe=Oor;var KQ=W_(t8e(),1);var n8e={};Llt(n8e,{UnsafePathError:()=>zfe,deleteFolder:()=>P_r,dirExists:()=>r8e,fileExists:()=>b_r,getParentDirFilename:()=>A_r,isNotFileOrDirectory:()=>T_r,listFolderContents:()=>fdt,listFolders:()=>E_r,mkDirTemp:()=>S_r,mkdirForFilePathIfNotExits:()=>x_r,mkdirIfNotExists:()=>_dt,safePath:()=>D_r,tarFolder:()=>k_r,untarFile:()=>w_r});import{spawn as ldt}from"child_process";import{randomUUID as g_r}from"crypto";import PN from"fs/promises";import{platform as y_r,tmpdir as v_r}from"os";import wN from"path";var udt=[".git","node_modules",".yarn",".DS_Store"];async function b_r(a){try{return(await PN.stat(a)).isFile()}catch{return!1}}t(b_r,"fileExists");async function S_r(){let a=process.env.BUILD_FILE_PATH??v_r(),s=g_r().replaceAll("-",""),c=wN.join(a,s);return await PN.mkdir(c,{recursive:!0}),c}t(S_r,"mkDirTemp");async function r8e(a){try{return(await PN.stat(a)).isDirectory()}catch{return!1}}t(r8e,"dirExists");async function T_r(a){try{return await PN.stat(a),!1}catch{return!0}}t(T_r,"isNotFileOrDirectory");function C_r(a,s){let c=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),f=a.match(c);if(!f)return"";let d=a.split(f[0]);return d[1]===""?"":`/${d[1]}`}t(C_r,"getParentDirectory");async function E_r(a){if(!await r8e(a))return[];let s=await PN.readdir(a,{withFileTypes:!0}),c=[];for await(let f of s)udt.includes(f.name)||f.isDirectory()&&c.push(f.name);return c}t(E_r,"listFolders");async function fdt(a,s,c=!0){let f=C_r(a,s),d=await PN.readdir(a,{withFileTypes:!0}),v=[];for await(let E of d)if(!udt.includes(E.name)||!c)if(E.isDirectory()){let A=await fdt(wN.join(a,E.name),s,c);v.push(...A)}else v.push(wN.join(f,E.name));return v}t(fdt,"listFolderContents");var _dt=t(async a=>{await PN.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),x_r=t(async a=>{let s=wN.dirname(a);return _dt(s)},"mkdirForFilePathIfNotExits"),zfe=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function D_r(a){let s=t(c=>{if(!c.startsWith(a))throw new zfe("Resolved path is not part of the project.");return c},"ensureSafePath");return{resolve:t((...c)=>s(wN.resolve(...c)),"resolve")}}t(D_r,"safePath");function A_r(a){return`${wN.basename(wN.dirname(a))}/${wN.basename(a)}`}t(A_r,"getParentDirFilename");async function k_r({folderPath:a,outputTarPath:s,exclude:c=["node_modules",".git","dist"],logger:f}){let d=[],v=[],E;try{await new Promise((A,O)=>{let R=ldt("tar",[...c.map(W=>["--exclude",W]).flat(),...y_r()!=="darwin"?["--warning=no-file-changed"]:[],"-cvf",s,"-C",a,"."]);R.stdout.on("data",W=>{let $=W.toString().trim();$.length>0&&d.push($.trim())}),R.stderr.on("data",W=>{let $=W.toString().trim();$.length>0&&v.push($.trim())}),R.on("close",W=>{E=W,W===0?A():O(new Error(`tar process exited with code ${W}`))}),R.on("error",W=>{O(W)})})}catch(A){throw new Error("Failed to tar folder",{cause:A})}finally{f.info({stdout:d.join(`
|
|
579
579
|
`),stderr:v.join(`
|
|
580
|
-
`),exitCode:E},"Tar process logs")}}t(k_r,"tarFolder");async function w_r({tarFilePath:a,outputDir:s,logger:c
|
|
581
|
-
|
|
582
|
-
tar --strip-components=1 -xvf ${a} -C ${s};
|
|
583
|
-
else
|
|
584
|
-
tar -xvf ${a} -C ${s};
|
|
585
|
-
fi
|
|
586
|
-
`.trim():R=`tar -xvf ${a} -C ${s};`;let W=ldt("sh",["-c",R]);W.stdout.on("data",$=>{let K=$.toString().trim();K.length>0&&d.push(K.trim())}),W.stderr.on("data",$=>{let K=$.toString().trim();K.length>0&&v.push(K.trim())}),W.on("close",$=>{E=$,$===0?A():O(new Error(`tar process exited with code ${$}`))}),W.on("error",$=>{O($)})})}catch(A){throw new Error("Failed to untar file",{cause:A})}finally{c.info({stdout:d.join(`
|
|
587
|
-
`),stderr:v.join(`
|
|
588
|
-
`),exitCode:E},"Untar process logs")}}t(w_r,"untarFile");async function P_r(a){if(await r8e(a))return await PN.rm(a,{recursive:!0})}t(P_r,"deleteFolder");var du=n8e;var bC=W_(t8e(),1);import{readFile as N_r}from"fs/promises";var i7=class extends Error{static{t(this,"CustomResolveError")}},NN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return KQ.$RefParser.dereference(s,{resolve:{json:!0,file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return KQ.$RefParser.bundle(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return KQ.$RefParser.parse(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return KQ.$RefParser.resolve(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function qfe(a,s){return{order:100,canRead(c){let f=F_r(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=pdt(c.url)}catch(E){throw new i7(`Malformed URI: ${c.url}`,{cause:E})}try{du.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=pdt(c.url)}catch(d){throw new i7(`Malformed URI: ${c.url}`,{cause:d})}try{return await N_r(f)}catch(d){throw new i7(`Error opening file "${f}"`,{cause:d})}}}}t(qfe,"customResolver");var i8e=/^win/.test(globalThis.process?globalThis.process.platform:""),I_r=/\//g,O_r=/^(\w{2,}):\/\//i,s8e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function F_r(a){let s=O_r.exec(a);if(s)return s[1].toLowerCase()}t(F_r,"getProtocol");function pdt(a,s){a=decodeURI(a);for(let f=0;f<s8e.length;f+=2)a=a.replace(s8e[f],s8e[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),i8e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=i8e?a:"/"+a)),i8e&&!c&&(a=a.replace(I_r,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(pdt,"toFileSystemPath");var ddt="YOUR_KEY_HERE";async function mdt(a){let c=await new NN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return L_r({...a,relativeOpenApiPath:f},c)}t(mdt,"buildPublicOpenApiFile");async function L_r(a,s){B_r({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=M_r(c),R_r(c,a),c=j_r(c,a),hdt(c,"x-zuplo"),c}t(L_r,"buildRawOpenApiFile");function R_r(a,{deploymentUrl:s,deploymentName:c,environmentType:f}){let d;s?d=new URL(s).hostname:f&&c&&(d=f===Jlt.WORKING_COPY?`${c}.${UNe.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${UNe.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(R_r,"addServerHost");function M_r(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(Wj in A&&Mue(A[Wj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},R=["delete","get","head","patch","post","put","trace","options"];return R.forEach(W=>{let $=A[W];if(!$)return;if(Mue($[Wj])){delete O[W];return}let{parameters:K}=$;if(!K)return;let Ne=K.filter(De=>{if(Wj in De&&Mue(De[Wj]))return!1;if("$ref"in De){let Se=De.$ref.split("/").pop();return Se?!f.includes(Se):!0}return!0});O[W]={...$,parameters:Ne}}),R.some(W=>!!O[W])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(M_r,"removeHiddenRoutesAndParams");function j_r(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,K)=>{let Ne=s.policies?.find(({name:Tt})=>Tt===K);if(!Ne)return $;if(!(Ne.handler.export==="CompositeInboundPolicy"))return $.concat(K);let Se=Ne.handler.options?.policies;return Se?$.concat(Se):$},[]),R=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="ApiAuthKeyInboundPolicy"||K.handler.export==="ApiKeyInboundPolicy")&&!K.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&R.push(K)})}),R.length>0){let $=R.length>0&&R[0].handler&&R[0].handler.options&&R[0].handler.options.authHeader?R[0].handler.options.authHeader:"Authorization",K=R.length>0&&R[0].handler&&R[0].handler.options&&(R[0].handler.options.authScheme||R[0].handler.options.authScheme==="")?R[0].handler.options.authScheme:"Bearer",Ne=K!==""?`${K} ${ddt}`:ddt,De={name:$,in:"header",required:!0,example:Ne,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Ne}\`.`};A.parameters?A.parameters.some(vr=>"name"in vr&&vr.name===De.name)||A.parameters.unshift(De):A.parameters=[De];let Se={type:"http",scheme:K.toLowerCase()},Tt="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(vr=>"name"in vr&&vr.type==="apiKey"||"type"in vr&&vr.type==="http"&&vr.scheme===K)||(a.components.securitySchemes={...a.components.securitySchemes,[Tt]:Se}):(a.components||(a.components={}),a.components.securitySchemes={[Tt]:Se});let xt={[Tt]:[]};A.security?A.security.some(vr=>vr[Tt]!==void 0)||A.security.unshift(xt):A.security=[xt]}let W=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="RateLimitInboundPolicy"||K.handler.export==="ComplexRateLimitInboundPolicy")&&W.push(K)})}),W.length>0){let $={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},K={...$,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:$,RateLimitWithRetryAfter:K},A.responses||(A.responses={});let Ne=W.some(De=>De.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Ne?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(j_r,"enrichSpecWithZuploData");function hdt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&hdt(a[c],s)}t(hdt,"removePropertiesByPrefix");function B_r({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new Tv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new Tv({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new Tv({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(B_r,"assertIsZuploOpenApiSpec");function U_r(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let R=0;R<s.length;R++)s[R]=255;for(let R=0;R<a.length;R++){let W=a.charAt(R),$=W.charCodeAt(0);if(s[$]!==255)throw new TypeError(W+" is ambiguous");s[$]=R}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";let W=0,$=0,K=0,Ne=R.length;for(;K!==Ne&&R[K]===0;)K++,W++;let De=(Ne-K)*v+1>>>0,Se=new Uint8Array(De);for(;K!==Ne;){let vr=R[K],Tr=0;for(let Nr=De-1;(vr!==0||Tr<$)&&Nr!==-1;Nr--,Tr++)vr+=256*Se[Nr]>>>0,Se[Nr]=vr%c>>>0,vr=vr/c>>>0;if(vr!==0)throw new Error("Non-zero carry");$=Tr,K++}let Tt=De-$;for(;Tt!==De&&Se[Tt]===0;)Tt++;let xt=f.repeat(W);for(;Tt<De;++Tt)xt+=a.charAt(Se[Tt]);return xt}t(E,"encode");function A(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;let W=0,$=0,K=0;for(;R[W]===f;)$++,W++;let Ne=(R.length-W)*d+1>>>0,De=new Uint8Array(Ne);for(;R[W];){let vr=s[R.charCodeAt(W)];if(vr===255)return;let Tr=0;for(let Nr=Ne-1;(vr!==0||Tr<K)&&Nr!==-1;Nr--,Tr++)vr+=c*De[Nr]>>>0,De[Nr]=vr%256>>>0,vr=vr/256>>>0;if(vr!==0)throw new Error("Non-zero carry");K=Tr,W++}let Se=Ne-K;for(;Se!==Ne&&De[Se]===0;)Se++;let Tt=new Uint8Array($+(Ne-Se)),xt=$;for(;Se!==Ne;)Tt[xt++]=De[Se++];return Tt}t(A,"decodeUnsafe");function O(R){let W=A(R);if(W)return W;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(U_r,"base");var gdt=U_r;var $_r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Vfe=gdt($_r);var a8e="2024-09-02",ydt=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function vdt(){return new SC({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:a8e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:ydt[a8e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(vdt,"getMockEnvironment");var SC=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=vdt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(Vfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,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 zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.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.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var J_r=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function bdt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!J_r.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(bdt,"isRestrictedEnvVariableName");function Sdt(a){return!!a.startsWith("ZUPLO_")}t(Sdt,"isZuploReadableEnvVariableName");var _Ur=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return SC.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return SC.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return SC.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return SC.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return SC.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return SC.instance.build.BUILD_ID}if(!(bdt(c)&&!Sdt(c)))return SC.instance.runtime[c]}});function YQ(a,s,c){return`_${_6(`${a}_${s}_${c}`)}`}t(YQ,"getRawOperationDataIdentifierName");function o8e(a,s,c,f){return`_${_6(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(o8e,"getIdForParameterSchema");function c8e(a,s,c){return`_${_6(a.toLowerCase())}_${s.toLowerCase()}_rb_${_6(c.toLowerCase())}`}t(c8e,"getIdForRequestBodySchema");function XQ(a,s){return`_${_6(a)}_${_6(s)}`}t(XQ,"getIdForRefSchema");function _6(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(_6,"sanitizedIdentifierName");var Zyt=W_(fht(),1);import gpe from"path";var dK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Fmr=/[$_\p{ID_Start}]/u,Lmr=/[$_\u200C\u200D\p{ID_Continue}]/u,rOe=".*";function Rmr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(Rmr,"Re");function dht(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&Fmr.test(O)||A!==f+1&&Lmr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,R=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!Rmr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),R=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),R=!0;break}A+=a[O++]}if(R)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(dht,"v");function mht(a,s={}){let c=dht(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${xC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,R=t(Tr=>{if(E<c.length&&c[E].type===Tr)return c[E++].value},"a"),W=t(()=>R("OTHER_MODIFIER")??R("ASTERISK"),"f"),$=t(Tr=>{let Nr=R(Tr);if(Nr!==void 0)return Nr;let{type:Cr,index:pr}=c[E];throw new TypeError(`Unexpected ${Cr} at ${pr}, expected ${Tr}`)},"d"),K=t(()=>{let Tr="",Nr;for(;Nr=R("CHAR")??R("ESCAPED_CHAR");)Tr+=Nr;return Tr},"T"),Ne=t(Tr=>Tr,"Se"),De=s.encodePart||Ne,Se="",Tt=t(Tr=>{Se+=Tr},"U"),xt=t(()=>{Se.length&&(d.push(new dK(3,"","",De(Se),"",3)),Se="")},"$"),vr=t((Tr,Nr,Cr,pr,sr)=>{let Cs=3;switch(sr){case"?":Cs=1;break;case"*":Cs=0;break;case"+":Cs=2;break}if(!Nr&&!Cr&&Cs===3){Tt(Tr);return}if(xt(),!Nr&&!Cr){if(!Tr)return;d.push(new dK(3,"","",De(Tr),"",Cs));return}let Di;Cr?Cr==="*"?Di=rOe:Di=Cr:Di=f;let _o=2;Di===f?(_o=1,Di=""):Di===rOe&&(_o=0,Di="");let hi;if(Nr?hi=Nr:Cr&&(hi=v++),O.has(hi))throw new TypeError(`Duplicate name '${hi}'.`);O.add(hi),d.push(new dK(_o,hi,De(Tr),Di,De(pr),Cs))},"V");for(;E<c.length;){let Tr=R("CHAR"),Nr=R("NAME"),Cr=R("REGEX");if(!Nr&&!Cr&&(Cr=R("ASTERISK")),Nr||Cr){let sr=Tr??"";s.prefixes.indexOf(sr)===-1&&(Tt(sr),sr=""),xt();let Cs=W();vr(sr,Nr,Cr,"",Cs);continue}let pr=Tr??R("ESCAPED_CHAR");if(pr){Tt(pr);continue}if(R("OPEN")){let sr=K(),Cs=R("NAME"),Di=R("REGEX");!Cs&&!Di&&(Di=R("ASTERISK"));let _o=K();$("CLOSE");let hi=W();vr(sr,Cs,Di,_o,hi);continue}xt(),$("END")}return d}t(mht,"D");function xC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xC,"S");function _ht(a){return a&&a.ignoreCase?"ui":"u"}t(_ht,"X");function Mmr(a,s,c){return hht(mht(a,c),s,c)}t(Mmr,"Z");function wB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(wB,"k");function hht(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=xC(A.value):f+=`(?:${xC(A.value)})${wB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${xC(c.delimiter)}]+?`,R=A.value;if(A.type===1?R=O:A.type===0&&(R=rOe),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${R})${wB(A.modifier)}`:f+=`((?:${R})${wB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${xC(A.prefix)}(${R})${xC(A.suffix)})`,f+=wB(A.modifier);continue}f+=`(?:${xC(A.prefix)}`,f+=`((?:${R})(?:`,f+=xC(A.suffix),f+=xC(A.prefix),f+=`(?:${R}))*)${xC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${xC(c.endsWith)}]|$`,v=`[${xC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,_ht(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,_ht(c))}t(hht,"F");var LN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},jmr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Bmr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Umr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Umr,"J");function ght(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(ght,"Q");function $mr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t($mr,"Ee");function yht(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(yht,"W");var vht=["ftp","file","http","https","ws","wss"];function bht(a){if(!a)return!0;for(let s of vht)if(a.test(s))return!0;return!1}t(bht,"N");function Jmr(a,s){if(a=ght(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(Jmr,"te");function zmr(a,s){if(a=ght(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(zmr,"re");function qmr(a,s){return s||a===""?a:yht(a)?Cht(a):Tht(a)}t(qmr,"ne");function Vmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(Vmr,"se");function Wmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Wmr,"ie");function Hmr(a,s,c){if(c||a==="")return a;if(s&&!vht.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Hmr,"ae");function Gmr(a,s,c){return Sht(s)===a&&(a=""),c||a===""?a:Eht(a)}t(Gmr,"oe");function Qmr(a,s){return a=$mr(a,":"),s||a===""?a:nOe(a)}t(Qmr,"ce");function Sht(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Sht,"_");function nOe(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(nOe,"y");function Kmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Kmr,"le");function Ymr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Ymr,"fe");function Tht(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(Tht,"z");function Cht(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Cht,"j");function Eht(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(Eht,"K");function Xmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Xmr,"he");function Zmr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Zmr,"ue");function ehr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(ehr,"de");function thr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(thr,"pe");var rhr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=dht(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#k()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#k(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,LN),a.encodePart=nOe;let s=Mmr(this.#T(),void 0,a);this.#l=bht(s)}},tOe=["protocol","username","password","hostname","port","pathname","search","hash"],FN="*";function pht(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(pht,"ge");function g6(a,s){return s?pK(a):a}t(g6,"b");function _K(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=g6(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=g6(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=g6(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=g6(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=g6(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=g6(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=g6(f.search.substring(1,f.search.length),c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=g6(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Qmr(s.protocol,c)),typeof s.username=="string"&&(a.username=Wmr(s.username,c)),typeof s.password=="string"&&(a.password=Vmr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=qmr(s.hostname,c)),typeof s.port=="string"&&(a.port=Gmr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!Umr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=g6(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Hmr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=zmr(s.search,c)),typeof s.hash=="string"&&(a.hash=Jmr(s.hash,c)),a}t(_K,"w");function pK(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(pK,"C");function nhr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(nhr,"Oe");function ihr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${nhr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=pK(A.value);continue}v+=`{${pK(A.value)}}${wB(A.modifier)}`;continue}let O=A.hasCustomName(),R=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),W=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!R&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let K=$.value.length>0?$.value[0]:"";R=d.test(K)}else R=!$.hasCustomName();if(!R&&!A.prefix.length&&W&&W.type===3){let K=W.value[W.value.length-1];R=s.prefixes.includes(K)}R&&(v+="{"),v+=pK(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!W||W.type===3||W.modifier!==3||R||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=pK(A.suffix),R&&(v+="}"),A.modifier!==3&&(v+=wB(A.modifier))}return v}t(ihr,"ke");var xht=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new rhr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:FN,protocol:FN,username:FN,password:FN,hostname:FN,port:FN,search:FN,hash:FN};this.#r=_K(v,a,!0),Sht(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of tOe){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,LN),A.encodePart=nOe;break;case"username":Object.assign(A,LN),A.encodePart=Kmr;break;case"password":Object.assign(A,LN),A.encodePart=Ymr;break;case"hostname":Object.assign(A,jmr),yht(O)?A.encodePart=Cht:A.encodePart=Tht;break;case"port":Object.assign(A,LN),A.encodePart=Eht;break;case"pathname":bht(this.#n.protocol)?(Object.assign(A,Bmr,d),A.encodePart=Xmr):(Object.assign(A,LN,d),A.encodePart=Zmr);break;case"search":Object.assign(A,LN,d),A.encodePart=ehr;break;case"hash":Object.assign(A,LN,d),A.encodePart=thr;break}try{this.#s[E]=mht(O,A),this.#n[E]=hht(this.#s[E],this.#e[E],A),this.#t[E]=ihr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(R=>R.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?c=_K(c,a,!1):c=_K(c,pht(a,s),!1)}catch{return!1}let f;for(f of tOe)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?c=_K(c,a,!1):c=_K(c,pht(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of tOe){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let R=v[A+1];E[O]=R}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let R of["type","modifier","prefix","value","suffix"]){if(A[R]<O[R])return-1;if(A[R]!==O[R])return 1}return 0},"o"),d=new dK(3,"","","","",3),v=new dK(0,"","","","",3),E=t((A,O)=>{let R=0;for(;R<Math.min(A.length,O.length);++R){let W=f(A[R],O[R]);if(W)return W}return A.length===O.length?0:f(A[R]??d,O[R]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=xht);import{AssertionError as shr}from"assert";function y6(a,s){if(a===!1)throw new shr({message:s})}t(y6,"assert");var Jc;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Jc||(Jc={}));function PB(a){return a.type===Jc.Object}t(PB,"isAstObject");function v6(a){return a.type===Jc.Property}t(v6,"isAstProperty");function Dht(a){return a.type===Jc.Array}t(Dht,"isAstArray");function NB(a){return a.type===Jc.Literal}t(NB,"isAstLiteral");function f7(a){if(a===void 0)throw new Error("Node is undefined");if(!PB(a))throw new Error("Node is not object")}t(f7,"assertAstObject");import{findNodeAtLocation as ahr,getNodeValue as ohr,printParseErrorCode as chr,visit as lhr}from"jsonc-parser";var uhr={DEFAULT:{allowTrailingComma:!1}};function mK(a,s=[],c=uhr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),lhr(a,{onObjectBegin:t((O,R,W)=>{f=v({type:"object",offset:O,length:-1,line:R+1,column:W+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,R,W,$,K)=>{f=v({type:"property",offset:R,length:-1,line:$+1,column:K+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:R,length:W,line:$,column:K,parent:f})},"onObjectProperty"),onObjectEnd:t((O,R)=>{d(O+R),f.length=O+R-f.offset,f=f.parent,d(O+R)},"onObjectEnd"),onArrayBegin:t((O,R,W,$)=>{f=v({type:"array",offset:O,length:-1,line:W+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,R)=>{f.length=O+R-f.offset,f=f.parent,d(O+R)},"onArrayEnd"),onLiteralValue:t((O,R,W,$,K)=>{v({type:fhr(O),offset:R,length:W,line:$+1,column:K+1,parent:f,value:O}),d(R+W)},"onLiteralValue"),onSeparator:t((O,R)=>{f.type==="property"&&(O===":"?f.colonOffset=R:O===","&&d(R))},"onSeparator"),onError:t((O,R,W,$,K)=>{s.push({error:O,offset:R,length:W,line:$+1,column:K+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(mK,"parse");function fhr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(fhr,"getNodeType");function iOe(a,s){return ahr(a,s)}t(iOe,"findNodeAtLocation");function hK(a){return ohr(a)}t(hK,"getNodeValue");function Aht(a){return chr(a)}t(Aht,"printParseErrorCode");var gK=class{static{t(this,"AstAdapter")}parse(s){let f=mK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Jc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Jc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){y6(s.children?.length===2,"Invalid property node");let f={type:Jc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Jc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Jc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Mx={createLiteral:t((a,s)=>({type:Jc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Jc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Jc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Jc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Jc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Jc.Array,parent:s,children:[]};for(let f of a)c.children.push(Mx.createLiteral(f,c));return c},"createArrayOfLiterals")};var _hr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,yK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Jc.Array:return this.generateArray(s,c);case Jc.Object:return this.generateObject(s,c);case Jc.Property:return this.generateProperty(s,c);case Jc.Literal:return this.generateLiteral(s,c);case Jc.FunctionCall:return this.generateFunctionCall(s,c);case Jc.Identifier:return this.generateIdentifier(s,c);case Jc.Raw:return this.generateRaw(s,c);case Jc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=_hr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as phr}from"@swc/core";import dhr from"fs/promises";var kht=t(async a=>{let s=new Set;try{let c=await dhr.readFile(a,"utf-8");(await phr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var wht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var sOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Pht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var aOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var oOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var zyt=W_(_yt(),1),qyt=W_(Jyt(),1);var lpe=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new qyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,zyt.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],R=E[2]?parseInt(E[2]):0,W=E[3],$=isNaN(R)?void 0:c[O][R][W];v={details:{property:O,index:R,field:W,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),R=O[O.length-1];d.message=`Value of property '${R}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var VN=lpe.instance;VN.addSchema(oOe,"route-configuration.schema.json");VN.addSchema(Pht,"policy-configuration.schema.json");VN.addSchema(sOe,"policies.schema.json");VN.addSchema(aOe,"open-api-route-configuration.schema.json");VN.addSchema(wht,"fragments.schema.json");var fVr=VN.compile(oOe),Vyt=VN.compile(aOe),T7e=VN.compile(sOe);var upe=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=T7e(s),this.results}};var fpe=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Vyt(s),this.results}};import b2r from"path";var C7e=/\$import\((.*)\)/,_pe=/\$env\((.*?)\)/g;var E6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},v2r=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),WN=t((a,s)=>{if(!a)return!1;let c=v2r(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||v6(A)&&A.name.value===v?!0:v==="{}"?A.type===Jc.Object:v==="[]"?A.type===Jc.Array:!1:!1})},"testPosition");var ppe=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),PB(s)?s.children.forEach(c=>{this.visitor(c)}):Dht(s)?s.children.forEach(c=>{this.visitor(c)}):v6(s)&&this.visitor(s.value)}},Wyt=t((a,s,c)=>f=>{if(!v6(f)||!NB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>WN(f,v))){_pe.test(f.value.value)&&s.push(new E6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(_pe).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Jc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(_pe),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Mx.createTemplateString(v,f))}},"getEnvStatementTransformer");var YK="config/routes.json",S2r=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],T2r=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Hyt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],C2r="handler/{}/options/{}/rewritePattern",E2r="handler/{}/options/{}/baseUrl",dpe=class extends ppe{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!v6(s)||!NB(s.value)||typeof s.value.value!="string")&&WN(s,C2r)){if(!s.parent||!PB(s.parent)){this.errors.push(new E6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!v6(s)||!NB(s.value)||typeof s.value.value!="string")&&WN(s,E2r)){if(!s.parent||!PB(s.parent)){this.errors.push(new E6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!v6(s)||!NB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!T2r.some(A=>WN(s,A))&&!Hyt.some(A=>WN(s,A))){if(C7e.test(c)){if(s.name.value==="$ref")return;this.errors.push(new E6("An $import() statement is not expected at this location.",YK,s.location,c))}return}let f=C7e.exec(c);if(Hyt.some(A=>WN(s,A))&&!f)return;if(!f){this.errors.push(new E6("Invalid $import() statement",YK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=b2r.join("..",d));let v=this.getImportName(d),E={type:Jc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=Wyt(S2r,this.errors,YK)};function Gyt(a){return`(request, context) => {
|
|
580
|
+
`),exitCode:E},"Tar process logs")}}t(k_r,"tarFolder");async function w_r({tarFilePath:a,outputDir:s,logger:c}){let f=[],d=[],v;try{await new Promise((E,A)=>{let O=ldt("sh",["-c",`tar -xvf ${a} -C ${s};`]);O.stdout.on("data",R=>{let W=R.toString().trim();W.length>0&&f.push(W.trim())}),O.stderr.on("data",R=>{let W=R.toString().trim();W.length>0&&d.push(W.trim())}),O.on("close",R=>{v=R,R===0?E():A(new Error(`tar process exited with code ${R}`))}),O.on("error",R=>{A(R)})})}catch(E){throw new Error("Failed to untar file",{cause:E})}finally{c.info({stdout:f.join(`
|
|
581
|
+
`),stderr:d.join(`
|
|
582
|
+
`),exitCode:v},"Untar process logs")}}t(w_r,"untarFile");async function P_r(a){if(await r8e(a))return await PN.rm(a,{recursive:!0})}t(P_r,"deleteFolder");var du=n8e;var bC=W_(t8e(),1);import{readFile as N_r}from"fs/promises";var i7=class extends Error{static{t(this,"CustomResolveError")}},NN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return KQ.$RefParser.dereference(s,{resolve:{json:!0,file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return KQ.$RefParser.bundle(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return KQ.$RefParser.parse(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return KQ.$RefParser.resolve(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function qfe(a,s){return{order:100,canRead(c){let f=F_r(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=pdt(c.url)}catch(E){throw new i7(`Malformed URI: ${c.url}`,{cause:E})}try{du.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=pdt(c.url)}catch(d){throw new i7(`Malformed URI: ${c.url}`,{cause:d})}try{return await N_r(f)}catch(d){throw new i7(`Error opening file "${f}"`,{cause:d})}}}}t(qfe,"customResolver");var i8e=/^win/.test(globalThis.process?globalThis.process.platform:""),I_r=/\//g,O_r=/^(\w{2,}):\/\//i,s8e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function F_r(a){let s=O_r.exec(a);if(s)return s[1].toLowerCase()}t(F_r,"getProtocol");function pdt(a,s){a=decodeURI(a);for(let f=0;f<s8e.length;f+=2)a=a.replace(s8e[f],s8e[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),i8e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=i8e?a:"/"+a)),i8e&&!c&&(a=a.replace(I_r,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(pdt,"toFileSystemPath");var ddt="YOUR_KEY_HERE";async function mdt(a){let c=await new NN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return L_r({...a,relativeOpenApiPath:f},c)}t(mdt,"buildPublicOpenApiFile");async function L_r(a,s){B_r({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=M_r(c),R_r(c,a),c=j_r(c,a),hdt(c,"x-zuplo"),c}t(L_r,"buildRawOpenApiFile");function R_r(a,{deploymentUrl:s,deploymentName:c,environmentType:f}){let d;s?d=new URL(s).hostname:f&&c&&(d=f===Jlt.WORKING_COPY?`${c}.${UNe.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${UNe.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(R_r,"addServerHost");function M_r(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(Wj in A&&Mue(A[Wj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},R=["delete","get","head","patch","post","put","trace","options"];return R.forEach(W=>{let $=A[W];if(!$)return;if(Mue($[Wj])){delete O[W];return}let{parameters:K}=$;if(!K)return;let Ne=K.filter(De=>{if(Wj in De&&Mue(De[Wj]))return!1;if("$ref"in De){let Se=De.$ref.split("/").pop();return Se?!f.includes(Se):!0}return!0});O[W]={...$,parameters:Ne}}),R.some(W=>!!O[W])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(M_r,"removeHiddenRoutesAndParams");function j_r(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,K)=>{let Ne=s.policies?.find(({name:Tt})=>Tt===K);if(!Ne)return $;if(!(Ne.handler.export==="CompositeInboundPolicy"))return $.concat(K);let Se=Ne.handler.options?.policies;return Se?$.concat(Se):$},[]),R=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="ApiAuthKeyInboundPolicy"||K.handler.export==="ApiKeyInboundPolicy")&&!K.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&R.push(K)})}),R.length>0){let $=R.length>0&&R[0].handler&&R[0].handler.options&&R[0].handler.options.authHeader?R[0].handler.options.authHeader:"Authorization",K=R.length>0&&R[0].handler&&R[0].handler.options&&(R[0].handler.options.authScheme||R[0].handler.options.authScheme==="")?R[0].handler.options.authScheme:"Bearer",Ne=K!==""?`${K} ${ddt}`:ddt,De={name:$,in:"header",required:!0,example:Ne,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Ne}\`.`};A.parameters?A.parameters.some(vr=>"name"in vr&&vr.name===De.name)||A.parameters.unshift(De):A.parameters=[De];let Se={type:"http",scheme:K.toLowerCase()},Tt="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(vr=>"name"in vr&&vr.type==="apiKey"||"type"in vr&&vr.type==="http"&&vr.scheme===K)||(a.components.securitySchemes={...a.components.securitySchemes,[Tt]:Se}):(a.components||(a.components={}),a.components.securitySchemes={[Tt]:Se});let xt={[Tt]:[]};A.security?A.security.some(vr=>vr[Tt]!==void 0)||A.security.unshift(xt):A.security=[xt]}let W=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="RateLimitInboundPolicy"||K.handler.export==="ComplexRateLimitInboundPolicy")&&W.push(K)})}),W.length>0){let $={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},K={...$,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:$,RateLimitWithRetryAfter:K},A.responses||(A.responses={});let Ne=W.some(De=>De.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Ne?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(j_r,"enrichSpecWithZuploData");function hdt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&hdt(a[c],s)}t(hdt,"removePropertiesByPrefix");function B_r({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new Tv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new Tv({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new Tv({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(B_r,"assertIsZuploOpenApiSpec");function U_r(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let R=0;R<s.length;R++)s[R]=255;for(let R=0;R<a.length;R++){let W=a.charAt(R),$=W.charCodeAt(0);if(s[$]!==255)throw new TypeError(W+" is ambiguous");s[$]=R}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";let W=0,$=0,K=0,Ne=R.length;for(;K!==Ne&&R[K]===0;)K++,W++;let De=(Ne-K)*v+1>>>0,Se=new Uint8Array(De);for(;K!==Ne;){let vr=R[K],Tr=0;for(let Nr=De-1;(vr!==0||Tr<$)&&Nr!==-1;Nr--,Tr++)vr+=256*Se[Nr]>>>0,Se[Nr]=vr%c>>>0,vr=vr/c>>>0;if(vr!==0)throw new Error("Non-zero carry");$=Tr,K++}let Tt=De-$;for(;Tt!==De&&Se[Tt]===0;)Tt++;let xt=f.repeat(W);for(;Tt<De;++Tt)xt+=a.charAt(Se[Tt]);return xt}t(E,"encode");function A(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;let W=0,$=0,K=0;for(;R[W]===f;)$++,W++;let Ne=(R.length-W)*d+1>>>0,De=new Uint8Array(Ne);for(;R[W];){let vr=s[R.charCodeAt(W)];if(vr===255)return;let Tr=0;for(let Nr=Ne-1;(vr!==0||Tr<K)&&Nr!==-1;Nr--,Tr++)vr+=c*De[Nr]>>>0,De[Nr]=vr%256>>>0,vr=vr/256>>>0;if(vr!==0)throw new Error("Non-zero carry");K=Tr,W++}let Se=Ne-K;for(;Se!==Ne&&De[Se]===0;)Se++;let Tt=new Uint8Array($+(Ne-Se)),xt=$;for(;Se!==Ne;)Tt[xt++]=De[Se++];return Tt}t(A,"decodeUnsafe");function O(R){let W=A(R);if(W)return W;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(U_r,"base");var gdt=U_r;var $_r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Vfe=gdt($_r);var a8e="2024-09-02",ydt=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function vdt(){return new SC({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:a8e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:ydt[a8e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(vdt,"getMockEnvironment");var SC=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=vdt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(Vfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,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 zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.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.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var J_r=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function bdt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!J_r.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(bdt,"isRestrictedEnvVariableName");function Sdt(a){return!!a.startsWith("ZUPLO_")}t(Sdt,"isZuploReadableEnvVariableName");var _Ur=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return SC.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return SC.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return SC.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return SC.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return SC.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return SC.instance.build.BUILD_ID}if(!(bdt(c)&&!Sdt(c)))return SC.instance.runtime[c]}});function YQ(a,s,c){return`_${_6(`${a}_${s}_${c}`)}`}t(YQ,"getRawOperationDataIdentifierName");function o8e(a,s,c,f){return`_${_6(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(o8e,"getIdForParameterSchema");function c8e(a,s,c){return`_${_6(a.toLowerCase())}_${s.toLowerCase()}_rb_${_6(c.toLowerCase())}`}t(c8e,"getIdForRequestBodySchema");function XQ(a,s){return`_${_6(a)}_${_6(s)}`}t(XQ,"getIdForRefSchema");function _6(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(_6,"sanitizedIdentifierName");var Zyt=W_(fht(),1);import gpe from"path";var dK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Fmr=/[$_\p{ID_Start}]/u,Lmr=/[$_\u200C\u200D\p{ID_Continue}]/u,rOe=".*";function Rmr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(Rmr,"Re");function dht(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&Fmr.test(O)||A!==f+1&&Lmr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,R=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!Rmr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),R=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),R=!0;break}A+=a[O++]}if(R)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(dht,"v");function mht(a,s={}){let c=dht(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${xC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,R=t(Tr=>{if(E<c.length&&c[E].type===Tr)return c[E++].value},"a"),W=t(()=>R("OTHER_MODIFIER")??R("ASTERISK"),"f"),$=t(Tr=>{let Nr=R(Tr);if(Nr!==void 0)return Nr;let{type:Cr,index:pr}=c[E];throw new TypeError(`Unexpected ${Cr} at ${pr}, expected ${Tr}`)},"d"),K=t(()=>{let Tr="",Nr;for(;Nr=R("CHAR")??R("ESCAPED_CHAR");)Tr+=Nr;return Tr},"T"),Ne=t(Tr=>Tr,"Se"),De=s.encodePart||Ne,Se="",Tt=t(Tr=>{Se+=Tr},"U"),xt=t(()=>{Se.length&&(d.push(new dK(3,"","",De(Se),"",3)),Se="")},"$"),vr=t((Tr,Nr,Cr,pr,sr)=>{let Cs=3;switch(sr){case"?":Cs=1;break;case"*":Cs=0;break;case"+":Cs=2;break}if(!Nr&&!Cr&&Cs===3){Tt(Tr);return}if(xt(),!Nr&&!Cr){if(!Tr)return;d.push(new dK(3,"","",De(Tr),"",Cs));return}let Di;Cr?Cr==="*"?Di=rOe:Di=Cr:Di=f;let _o=2;Di===f?(_o=1,Di=""):Di===rOe&&(_o=0,Di="");let hi;if(Nr?hi=Nr:Cr&&(hi=v++),O.has(hi))throw new TypeError(`Duplicate name '${hi}'.`);O.add(hi),d.push(new dK(_o,hi,De(Tr),Di,De(pr),Cs))},"V");for(;E<c.length;){let Tr=R("CHAR"),Nr=R("NAME"),Cr=R("REGEX");if(!Nr&&!Cr&&(Cr=R("ASTERISK")),Nr||Cr){let sr=Tr??"";s.prefixes.indexOf(sr)===-1&&(Tt(sr),sr=""),xt();let Cs=W();vr(sr,Nr,Cr,"",Cs);continue}let pr=Tr??R("ESCAPED_CHAR");if(pr){Tt(pr);continue}if(R("OPEN")){let sr=K(),Cs=R("NAME"),Di=R("REGEX");!Cs&&!Di&&(Di=R("ASTERISK"));let _o=K();$("CLOSE");let hi=W();vr(sr,Cs,Di,_o,hi);continue}xt(),$("END")}return d}t(mht,"D");function xC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xC,"S");function _ht(a){return a&&a.ignoreCase?"ui":"u"}t(_ht,"X");function Mmr(a,s,c){return hht(mht(a,c),s,c)}t(Mmr,"Z");function wB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(wB,"k");function hht(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=xC(A.value):f+=`(?:${xC(A.value)})${wB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${xC(c.delimiter)}]+?`,R=A.value;if(A.type===1?R=O:A.type===0&&(R=rOe),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${R})${wB(A.modifier)}`:f+=`((?:${R})${wB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${xC(A.prefix)}(${R})${xC(A.suffix)})`,f+=wB(A.modifier);continue}f+=`(?:${xC(A.prefix)}`,f+=`((?:${R})(?:`,f+=xC(A.suffix),f+=xC(A.prefix),f+=`(?:${R}))*)${xC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${xC(c.endsWith)}]|$`,v=`[${xC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,_ht(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,_ht(c))}t(hht,"F");var LN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},jmr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Bmr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Umr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Umr,"J");function ght(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(ght,"Q");function $mr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t($mr,"Ee");function yht(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(yht,"W");var vht=["ftp","file","http","https","ws","wss"];function bht(a){if(!a)return!0;for(let s of vht)if(a.test(s))return!0;return!1}t(bht,"N");function Jmr(a,s){if(a=ght(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(Jmr,"te");function zmr(a,s){if(a=ght(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(zmr,"re");function qmr(a,s){return s||a===""?a:yht(a)?Cht(a):Tht(a)}t(qmr,"ne");function Vmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(Vmr,"se");function Wmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Wmr,"ie");function Hmr(a,s,c){if(c||a==="")return a;if(s&&!vht.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Hmr,"ae");function Gmr(a,s,c){return Sht(s)===a&&(a=""),c||a===""?a:Eht(a)}t(Gmr,"oe");function Qmr(a,s){return a=$mr(a,":"),s||a===""?a:nOe(a)}t(Qmr,"ce");function Sht(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Sht,"_");function nOe(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(nOe,"y");function Kmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Kmr,"le");function Ymr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Ymr,"fe");function Tht(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(Tht,"z");function Cht(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Cht,"j");function Eht(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(Eht,"K");function Xmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Xmr,"he");function Zmr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Zmr,"ue");function ehr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(ehr,"de");function thr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(thr,"pe");var rhr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=dht(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#k()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#k(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,LN),a.encodePart=nOe;let s=Mmr(this.#T(),void 0,a);this.#l=bht(s)}},tOe=["protocol","username","password","hostname","port","pathname","search","hash"],FN="*";function pht(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(pht,"ge");function g6(a,s){return s?pK(a):a}t(g6,"b");function _K(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=g6(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=g6(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=g6(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=g6(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=g6(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=g6(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=g6(f.search.substring(1,f.search.length),c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=g6(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Qmr(s.protocol,c)),typeof s.username=="string"&&(a.username=Wmr(s.username,c)),typeof s.password=="string"&&(a.password=Vmr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=qmr(s.hostname,c)),typeof s.port=="string"&&(a.port=Gmr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!Umr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=g6(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Hmr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=zmr(s.search,c)),typeof s.hash=="string"&&(a.hash=Jmr(s.hash,c)),a}t(_K,"w");function pK(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(pK,"C");function nhr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(nhr,"Oe");function ihr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${nhr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=pK(A.value);continue}v+=`{${pK(A.value)}}${wB(A.modifier)}`;continue}let O=A.hasCustomName(),R=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),W=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!R&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let K=$.value.length>0?$.value[0]:"";R=d.test(K)}else R=!$.hasCustomName();if(!R&&!A.prefix.length&&W&&W.type===3){let K=W.value[W.value.length-1];R=s.prefixes.includes(K)}R&&(v+="{"),v+=pK(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!W||W.type===3||W.modifier!==3||R||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=pK(A.suffix),R&&(v+="}"),A.modifier!==3&&(v+=wB(A.modifier))}return v}t(ihr,"ke");var xht=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new rhr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:FN,protocol:FN,username:FN,password:FN,hostname:FN,port:FN,search:FN,hash:FN};this.#r=_K(v,a,!0),Sht(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of tOe){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,LN),A.encodePart=nOe;break;case"username":Object.assign(A,LN),A.encodePart=Kmr;break;case"password":Object.assign(A,LN),A.encodePart=Ymr;break;case"hostname":Object.assign(A,jmr),yht(O)?A.encodePart=Cht:A.encodePart=Tht;break;case"port":Object.assign(A,LN),A.encodePart=Eht;break;case"pathname":bht(this.#n.protocol)?(Object.assign(A,Bmr,d),A.encodePart=Xmr):(Object.assign(A,LN,d),A.encodePart=Zmr);break;case"search":Object.assign(A,LN,d),A.encodePart=ehr;break;case"hash":Object.assign(A,LN,d),A.encodePart=thr;break}try{this.#s[E]=mht(O,A),this.#n[E]=hht(this.#s[E],this.#e[E],A),this.#t[E]=ihr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(R=>R.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?c=_K(c,a,!1):c=_K(c,pht(a,s),!1)}catch{return!1}let f;for(f of tOe)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?c=_K(c,a,!1):c=_K(c,pht(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of tOe){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let R=v[A+1];E[O]=R}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let R of["type","modifier","prefix","value","suffix"]){if(A[R]<O[R])return-1;if(A[R]!==O[R])return 1}return 0},"o"),d=new dK(3,"","","","",3),v=new dK(0,"","","","",3),E=t((A,O)=>{let R=0;for(;R<Math.min(A.length,O.length);++R){let W=f(A[R],O[R]);if(W)return W}return A.length===O.length?0:f(A[R]??d,O[R]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=xht);import{AssertionError as shr}from"assert";function y6(a,s){if(a===!1)throw new shr({message:s})}t(y6,"assert");var Jc;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Jc||(Jc={}));function PB(a){return a.type===Jc.Object}t(PB,"isAstObject");function v6(a){return a.type===Jc.Property}t(v6,"isAstProperty");function Dht(a){return a.type===Jc.Array}t(Dht,"isAstArray");function NB(a){return a.type===Jc.Literal}t(NB,"isAstLiteral");function f7(a){if(a===void 0)throw new Error("Node is undefined");if(!PB(a))throw new Error("Node is not object")}t(f7,"assertAstObject");import{findNodeAtLocation as ahr,getNodeValue as ohr,printParseErrorCode as chr,visit as lhr}from"jsonc-parser";var uhr={DEFAULT:{allowTrailingComma:!1}};function mK(a,s=[],c=uhr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),lhr(a,{onObjectBegin:t((O,R,W)=>{f=v({type:"object",offset:O,length:-1,line:R+1,column:W+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,R,W,$,K)=>{f=v({type:"property",offset:R,length:-1,line:$+1,column:K+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:R,length:W,line:$,column:K,parent:f})},"onObjectProperty"),onObjectEnd:t((O,R)=>{d(O+R),f.length=O+R-f.offset,f=f.parent,d(O+R)},"onObjectEnd"),onArrayBegin:t((O,R,W,$)=>{f=v({type:"array",offset:O,length:-1,line:W+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,R)=>{f.length=O+R-f.offset,f=f.parent,d(O+R)},"onArrayEnd"),onLiteralValue:t((O,R,W,$,K)=>{v({type:fhr(O),offset:R,length:W,line:$+1,column:K+1,parent:f,value:O}),d(R+W)},"onLiteralValue"),onSeparator:t((O,R)=>{f.type==="property"&&(O===":"?f.colonOffset=R:O===","&&d(R))},"onSeparator"),onError:t((O,R,W,$,K)=>{s.push({error:O,offset:R,length:W,line:$+1,column:K+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(mK,"parse");function fhr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(fhr,"getNodeType");function iOe(a,s){return ahr(a,s)}t(iOe,"findNodeAtLocation");function hK(a){return ohr(a)}t(hK,"getNodeValue");function Aht(a){return chr(a)}t(Aht,"printParseErrorCode");var gK=class{static{t(this,"AstAdapter")}parse(s){let f=mK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Jc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Jc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){y6(s.children?.length===2,"Invalid property node");let f={type:Jc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Jc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Jc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Mx={createLiteral:t((a,s)=>({type:Jc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Jc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Jc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Jc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Jc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Jc.Array,parent:s,children:[]};for(let f of a)c.children.push(Mx.createLiteral(f,c));return c},"createArrayOfLiterals")};var _hr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,yK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Jc.Array:return this.generateArray(s,c);case Jc.Object:return this.generateObject(s,c);case Jc.Property:return this.generateProperty(s,c);case Jc.Literal:return this.generateLiteral(s,c);case Jc.FunctionCall:return this.generateFunctionCall(s,c);case Jc.Identifier:return this.generateIdentifier(s,c);case Jc.Raw:return this.generateRaw(s,c);case Jc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=_hr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as phr}from"@swc/core";import dhr from"fs/promises";var kht=t(async a=>{let s=new Set;try{let c=await dhr.readFile(a,"utf-8");(await phr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var wht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var sOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Pht={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var aOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var oOe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var zyt=W_(_yt(),1),qyt=W_(Jyt(),1);var lpe=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new qyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,zyt.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],R=E[2]?parseInt(E[2]):0,W=E[3],$=isNaN(R)?void 0:c[O][R][W];v={details:{property:O,index:R,field:W,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),R=O[O.length-1];d.message=`Value of property '${R}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var VN=lpe.instance;VN.addSchema(oOe,"route-configuration.schema.json");VN.addSchema(Pht,"policy-configuration.schema.json");VN.addSchema(sOe,"policies.schema.json");VN.addSchema(aOe,"open-api-route-configuration.schema.json");VN.addSchema(wht,"fragments.schema.json");var fVr=VN.compile(oOe),Vyt=VN.compile(aOe),T7e=VN.compile(sOe);var upe=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=T7e(s),this.results}};var fpe=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Vyt(s),this.results}};import b2r from"path";var C7e=/\$import\((.*)\)/,_pe=/\$env\((.*?)\)/g;var E6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},v2r=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),WN=t((a,s)=>{if(!a)return!1;let c=v2r(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||v6(A)&&A.name.value===v?!0:v==="{}"?A.type===Jc.Object:v==="[]"?A.type===Jc.Array:!1:!1})},"testPosition");var ppe=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),PB(s)?s.children.forEach(c=>{this.visitor(c)}):Dht(s)?s.children.forEach(c=>{this.visitor(c)}):v6(s)&&this.visitor(s.value)}},Wyt=t((a,s,c)=>f=>{if(!v6(f)||!NB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>WN(f,v))){_pe.test(f.value.value)&&s.push(new E6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(_pe).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Jc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(_pe),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Mx.createTemplateString(v,f))}},"getEnvStatementTransformer");var YK="config/routes.json",S2r=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],T2r=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Hyt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],C2r="handler/{}/options/{}/rewritePattern",E2r="handler/{}/options/{}/baseUrl",dpe=class extends ppe{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!v6(s)||!NB(s.value)||typeof s.value.value!="string")&&WN(s,C2r)){if(!s.parent||!PB(s.parent)){this.errors.push(new E6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!v6(s)||!NB(s.value)||typeof s.value.value!="string")&&WN(s,E2r)){if(!s.parent||!PB(s.parent)){this.errors.push(new E6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!v6(s)||!NB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!T2r.some(A=>WN(s,A))&&!Hyt.some(A=>WN(s,A))){if(C7e.test(c)){if(s.name.value==="$ref")return;this.errors.push(new E6("An $import() statement is not expected at this location.",YK,s.location,c))}return}let f=C7e.exec(c);if(Hyt.some(A=>WN(s,A))&&!f)return;if(!f){this.errors.push(new E6("Invalid $import() statement",YK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=b2r.join("..",d));let v=this.getImportName(d),E={type:Jc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=Wyt(S2r,this.errors,YK)};function Gyt(a){return`(request, context) => {
|
|
589
583
|
const { params, url, query, method, headers } = request;
|
|
590
584
|
const { host, hostname, origin, pathname, port, search } = new URL(url);
|
|
591
585
|
const e = encodeURIComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/core",
|
|
3
|
-
"version": "6.38.
|
|
3
|
+
"version": "6.38.16",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"prettier": "^3.3.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@zuplo/graphql": "^6.38.
|
|
44
|
-
"@zuplo/otel": "^6.38.
|
|
45
|
-
"@zuplo/runtime": "^6.38.
|
|
43
|
+
"@zuplo/graphql": "^6.38.16",
|
|
44
|
+
"@zuplo/otel": "^6.38.16",
|
|
45
|
+
"@zuplo/runtime": "^6.38.16"
|
|
46
46
|
}
|
|
47
47
|
}
|