diff --git a/build/panic-overlay.browser.js b/build/panic-overlay.browser.js index 1a3f5b9..894fdfc 100644 --- a/build/panic-overlay.browser.js +++ b/build/panic-overlay.browser.js @@ -2214,6 +2214,7 @@ function impl (fetchFile, sync) { const noFile = { path, text: '', + lines: [], error: e, resolve (loc) { return assign ({}, loc, { error: e, sourceLine: '', sourceFile: noFile }) @@ -6537,4 +6538,4 @@ var _default = panic; exports["default"] = _default; },{"get-source/impl/path":7,"stacktracey":23}]},{},[24]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvYXMtdGFibGUvYXMtdGFibGUuanMiLCJub2RlX21vZHVsZXMvYmFzZTY0LWpzL2luZGV4LmpzIiwibm9kZV9tb2R1bGVzL2Jyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2J1ZmZlci9pbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9kYXRhLXVyaS10by1idWZmZXIvaW5kZXguanMiLCJub2RlX21vZHVsZXMvZ2V0LXNvdXJjZS9nZXQtc291cmNlLmpzIiwibm9kZV9tb2R1bGVzL2dldC1zb3VyY2UvaW1wbC9TeW5jUHJvbWlzZS5qcyIsIm5vZGVfbW9kdWxlcy9nZXQtc291cmNlL2ltcGwvcGF0aC5qcyIsIm5vZGVfbW9kdWxlcy9pZWVlNzU0L2luZGV4LmpzIiwibm9kZV9tb2R1bGVzL3ByaW50YWJsZS1jaGFyYWN0ZXJzL3ByaW50YWJsZS1jaGFyYWN0ZXJzLmpzIiwibm9kZV9tb2R1bGVzL3Byb2Nlc3MvYnJvd3Nlci5qcyIsIm5vZGVfbW9kdWxlcy9zb3VyY2UtbWFwL2xpYi9hcnJheS1zZXQuanMiLCJub2RlX21vZHVsZXMvc291cmNlLW1hcC9saWIvYmFzZTY0LXZscS5qcyIsIm5vZGVfbW9kdWxlcy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HJpbmcgKGNvbnZlcnRpbmcgbXVsdGlsaW5lIHRleHQgdG8gc2luZ2xlbGluZSkgKi9cblxuICAgICAgICBjZWxscyAgICAgICAgICAgPSByb3dzLm1hcCAociA9PiByLm1hcCAoYyA9PiBjLnJlcGxhY2UgKC9cXG4vZywgJ1xcXFxuJykpKSxcblxuICAgIC8qICBDb21wdXRlIGNvbHVtbiB3aWR0aHMgKHBlciByb3cpIGFuZCBtYXggd2lkdGhzIChwZXIgY29sdW1uKSAgICAgKi9cblxuICAgICAgICBjZWxsV2lkdGhzICAgICAgPSBjZWxscy5tYXAgKHIgPT4gci5tYXAgKHN0cmxlbikpLFxuICAgICAgICBtYXhXaWR0aHMgICAgICAgPSB6aXAgKGNlbGxXaWR0aHMsIE1hdGgubWF4KSxcblxuICAgIC8qICBEZWZhdWx0IGNvbmZpZyAgICAgKi9cblxuICAgICAgICBjZmcgICAgICAgICAgICAgPSBPLmFzc2lnbiAoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGltaXRlcjogJyAgJyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW5Db2x1bW5XaWR0aHM6IG1heFdpZHRocy5tYXAgKHggPT4gMCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4VG90YWxXaWR0aDogMCB9LCBjZmdfKSxcblxuICAgICAgICBkZWxpbWl0ZXJMZW5ndGggPSBzdHJsZW4gKGNmZy5kZWxpbWl0ZXIpLFxuXG4gICAgLyogIFByb2plY3QgZGVzaXJlZCBjb2x1bW4gd2lkdGhzLCB0YWtpbmcgbWF4VG90YWxXaWR0aCBhbmQgbWluQ29sdW1uV2lkdGhzIGluIGFjY291bnQuICAgICAqL1xuXG4gICAgICAgIHRvdGFsV2lkdGggICAgICA9IG1heFdpZHRocy5yZWR1Y2UgKChhLCBiKSA9PiBhICsgYiwgMCksXG4gICAgICAgIHJlbGF0aXZlV2lkdGhzICA9IG1heFdpZHRocy5tYXAgKHcgPT4gdyAvIHRvdGFsV2lkdGgpLFxuICAgICAgICBtYXhUb3RhbFdpZHRoICAgPSBjZmcubWF4VG90YWxXaWR0aCAtIChkZWxpbWl0ZXJMZW5ndGggKiAobWF4V2lkdGhzLmxlbmd0aCAtIDEpKSxcbiAgICAgICAgZXhjZXNzV2lkdGggICAgID0gTWF0aC5tYXggKDAsIHRvdGFsV2lkdGggLSBtYXhUb3RhbFdpZHRoKSxcbiAgICAgICAgY29tcHV0ZWRXaWR0aHMgID0gemlwIChbY2ZnLm1pbkNvbHVtbldpZHRocywgbWF4V2lkdGhzLCByZWxhdGl2ZVdpZHRoc10sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKG1pbiwgbWF4LCByZWxhdGl2ZSkgPT4gTWF0aC5tYXggKG1pbiwgTWF0aC5mbG9vciAobWF4IC0gZXhjZXNzV2lkdGggKiByZWxhdGl2ZSkpKSxcblxuICAgIC8qICBUaGlzIGlzIGhvdyBtYW55IHN5bWJvbHMgd2Ugc2hvdWxkIHBhZCBvciBjdXQgKHBlciBjb2x1bW4pLiAgKi9cblxuICAgICAgICByZXN0Q2VsbFdpZHRocyAgPSBjZWxsV2lkdGhzLm1hcCAod2lkdGhzID0+IHppcCAoW2NvbXB1dGVkV2lkdGhzLCB3aWR0aHNdLCAoYSwgYikgPT4gYSAtIGIpKVxuXG4gICAgLyogIFBlcmZvcm0gZmluYWwgY29tcG9zaXRpb24uICAgKi9cblxuICAgICAgICByZXR1cm4gemlwIChbY2VsbHMsIHJlc3RDZWxsV2lkdGhzXSwgKGEsIGIpID0+XG4gICAgICAgICAgICAgICAgemlwIChbYSwgYl0sIChzdHIsIHcpID0+ICh3ID49IDApXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gKGNmZy5yaWdodCA/ICgnICcucmVwZWF0ICh3KSArIHN0cikgOiAoc3RyICsgJyAnLnJlcGVhdCAodykpKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IChsaW1pdCAoc3RyLCBzdHJsZW4gKHN0cikgKyB3KSkpLmpvaW4gKGNmZy5kZWxpbWl0ZXIpKVxufVxuXG5jb25zdCBhc1RhYmxlID0gY2ZnID0+IE8uYXNzaWduIChhcnIgPT4ge1xuXG4vKiAgUHJpbnQgYXJyYXlzICAqL1xuXG4gICAgaWYgKGFyclswXSAmJiBBcnJheS5pc0FycmF5IChhcnJbMF0pKSB7XG4gICAgICAgIHJldHVybiBhc0NvbHVtbnMgKGFyci5tYXAgKHIgPT4gci5tYXAgKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGMsIGkpID0+IChjID09PSB1bmRlZmluZWQpID8gJycgOiBjZmcucHJpbnQgKGMsIGkpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICAgICAgICAgIGNmZykuam9pbiAoJ1xcbicpXG4gICAgfVxuXG4vKiAgUHJpbnQgb2JqZWN0cyAgICovXG5cbiAgICBjb25zdCBjb2xOYW1lcyA9IFsuLi5uZXcgU2V0IChbXS5jb25jYXQgKC4uLmFyci5tYXAgKE8ua2V5cykpKV0sXG4gICAgICAgICAgY29sdW1ucyAgPSBbY29sTmFtZXMubWFwIChjZmcudGl0bGUpLFxuICAgICAgICAgICAgICAgICAgICAgIC4uLmFyci5tYXAgKG8gPT4gY29sTmFtZXMubWFwIChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXkgPT4gKG9ba2V5XSA9PT0gdW5kZWZpbmVkKSA/ICcnIDogY2ZnLnByaW50IChvW2tleV0sIGtleSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICAgICAgbGluZXM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yZXNvbHZlciA9IHJlc29sdmVyIHx8IFNvdXJjZU1hcFJlc29sdmVyRnJvbUZldGNoZWRGaWxlIChmaWxlKSkgKGxvYylcblxuICAgICAgICAgICAgcmV0dXJuIChmaWxlID0ge1xuICAgICAgICAgICAgICAgIHBhdGg6IHNyY1BhdGgsXG4gICAgICAgICAgICAgICAgdGV4dCxcbiAgICAgICAgICAgICAgICBnZXQgbGluZXMgKCkgeyByZXR1cm4gbGluZXMgPSAobGluZXMgfHwgdGV4dC5zcGxpdCAoJ1xcbicpKSB9LFxuICAgICAgICAgICAgICAgIHJlc29sdmUgKGxvYykge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCByZXN1bHQgPSBfcmVzb2x2ZSAobG9jKVxuICAgICAgICAgICAgICAgICAgICBpZiAoc3luYykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsgcmV0dXJuIFN5bmNQcm9taXNlLnZhbHVlRnJvbSAocmVzdWx0KSB9XG4gICAgICAgICAgICAgICAgICAgICAgICBjYXRjaCAoZSkgeyByZXR1cm4gYXNzaWduICh7fSwgbG9jLCB7IGVycm9yOiBlIH0pIH1cbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUgKHJlc3VsdClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgX3Jlc29sdmUsXG4gICAgICAgICAgICB9KVxuICAgICAgICB9KVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIFNvdXJjZU1hcFJlc29sdmVyRnJvbUZldGNoZWRGaWxlIChmaWxlKSB7XG5cbiAgICAvKiAgRXh0cmFjdCB0aGUgbGFzdCBzb3VyY2VNYXAgb2NjdXJlbmNlIChUT0RPOiBzdXBwb3J0IG11bHRpcGxlIHNvdXJjZW1hcHMpICAgKi9cblxuICAgICAgICBjb25zdCByZSA9IC9cXHUwMDIz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gIDogU291cmNlRmlsZSAocGF0aC5yZWxhdGl2ZVRvRmlsZSAob3JpZ2luYWxGaWxlUGF0aCwgc291cmNlTWFwUGF0aCkpXG5cbiAgICAgICAgY29uc3QgcGFyc2VkTWFwID0gc3JjRmlsZS50aGVuIChmID0+IFNvdXJjZU1hcENvbnN1bWVyIChKU09OLnBhcnNlIChmLnRleHQpKSlcbiAgICAgICAgXG4gICAgICAgIGNvbnN0IHNvdXJjZUZvciA9IG1lbW9pemUgKGZ1bmN0aW9uIHNvdXJjZUZvciAoZmlsZVBhdGgpIHtcbiAgICAgICAgICAgIHJldHVybiBzcmNGaWxlLnRoZW4gKGYgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IGZ1bGxQYXRoID0gcGF0aC5yZWxhdGl2ZVRvRmlsZSAoZi5wYXRoLCBmaWxlUGF0aClcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VkTWFwLnRoZW4gKHggPT4gU291cmNlRmlsZSAoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdWxsUGF0aCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHguc291cmNlQ29udGVudEZvciAoZmlsZVBhdGgsIHRydWUgLyogcmV0dXJuIG51bGwgb24gbWlzc2luZyAqLykgfHwgdW5kZWZpbmVkKSlcbiAgICAgICAgICAgIH0pXG4gICAgICAgIH0pXG4gICAgXG4gICAgICAgIHJldHVybiBsb2MgPT4gcGFyc2VkTWFwLnRoZW4gKHggPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgb3JpZ2luYWxMb2MgPSB4Lm9yaWdpbmFsUG9zaXRpb25Gb3IgKGxvYylcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvcmlnaW5hbExvYy5zb3VyY2UgPyBzb3VyY2VGb3IgKG9yaWdpbmFsTG9jLnNvdXJjZSkudGhlbiAoeCA9PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4Ll9yZXNvbHZlIChhc3NpZ24gKHt9LCBsb2MsIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmU6ICAgb3JpZ2luYWxMb2MubGluZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbjogb3JpZ2luYWxMb2MuY29sdW1uICsgMSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICAgb3JpZ2luYWxMb2MubmFtZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogZmFsbGJhY2tSZXNvbHZlIChsb2MpXG4gICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoIChlID0+XG4gICAgICAgICAgICAgICAgICAgICAgICBhc3NpZ24gKGZhbGxiYWNrUmVzb2x2ZSAobG9jKSwgeyBzb3VyY2VNYXBFcnJvcjogZSB9KSlcbiAgICB9XG5cbiAgICByZXR1cm4gYXNzaWduIChmdW5jdGlvbiBnZXRTb3VyY2UgKHBhdGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZpbGUgPSBTb3VyY2VGaWxlIChwYXRoKVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN5bmMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgeyByZXR1cm4gU3luY1Byb21pc2UudmFsdWVGcm9tIChmaWxlKSB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgbm9GaWxlID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHQ6ICcnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlIChsb2MpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXNzaWduICh7fSwgbG9jLCB7IGVycm9yOiBlLCBzb3VyY2VMaW5lOiAnJywgc291cmNlRmlsZTogbm9GaWxlIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5vRmlsZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmaWxlXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc2V0Q2FjaGU6ICgpID0+IFNvdXJjZUZpbGVNZW1vaXplZC5mb3JnZXRFdmVyeXRoaW5nICgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q2FjaGU6ICAgKCkgPT4gU291cmNlRmlsZU1lbW9pemVkLmNhY2hlXG4gICAgICAgICAgICAgICAgICAgIH0pXG59XG5cbi8qICAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKi9cblxubW9kdWxlLmV4cG9ydHMgPSBpbXBsIChmdW5jdGlvbiBmZXRjaEZpbGVTeW5jIChwYXRoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFN5bmNQcm9taXNlIChyZXNvbHZlID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNCcm93c2VyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB4aHIgPSBuZXcgWE1MSHR0cFJlcXVlc3QgKClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeGhyLm9wZW4gKCdHRVQnLCBwYXRoLCBmYWxzZSAvKiBTWU5DSFJPTk9VUyBYSFIgRlRXIDopICovKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4aHIuc2VuZCAobnVsbClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSAoeGhyLnJlc3BvbnNlVGV4dClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlIChub2RlUmVxdWlyZSAoJ2ZzJykucmVhZEZpbGVTeW5jIChwYXRoLCB7IGVuY29kaW5nOiAndXRmOCcgfSkpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgfSwgdHJ1ZSlcblxuLyogIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSAqL1xuXG5tb2R1bGUuZXhwb3J0cy5hc3luYyA9IGltcGwgKGZ1bmN0aW9uIGZldGNoRmlsZUFzeW5jIChwYXRoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UgKChyZXNvbHZlLCByZWplY3QpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNCcm93c2VyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB4aHIgPSBuZXcgWE1MSHR0cFJlcXVlc3QgKClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeGhyLm9wZW4gKCdHRVQnLCBwYXRoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4aHIub25yZWFkeXN0YXRlY2hhbmdlID0gZXZlbnQgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHhoci5yZWFkeVN0YXRlID09PSA0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHhoci5zdGF0dXMgPT09IDIwMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlICh4aHIucmVzcG9uc2VUZXh0KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdCAobmV3IEVycm9yICh4aHIuc3RhdHVzVGV4dCkpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhoci5zZW5kIChudWxsKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVSZXF1aXJlICgnZnMnKS5yZWFkRmlsZSAocGF0aCwgeyBlbmNvZGluZzogJ3V0ZjgnIH0sIChlLCB4KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID8gcmVqZWN0IChlKSA6IHJlc29sdmUgKHgpXG4gICAgICAgICAgICAgICAgICAgIC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KHggaW5zdGFuY2VvZiBTeW5jUHJvbWlzZSkge1xuICAgICAgICAgICAgaWYgKHgucmVqZWN0ZWQpIHRocm93ICB4LnZhbFxuICAgICAgICAgICAgZWxzZSAgICAgICAgICAgIHJldHVybiB4LnZhbFxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHhcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHRoZW4gKGZuKSB7XG4gICAgICAgIHRyeSAgICAgICB7IGlmICghdGhpcy5yZWplY3RlZCkgcmV0dXJuIFN5bmNQcm9taXNlLnJlc29sdmUgKGZuICh0aGlzLnZhbCkpIH1cbiAgICAgICAgY2F0Y2ggKGUpIHsgICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3luY1Byb21pc2UucmVqZWN0IChlKSB9XG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgY2F0Y2ggKGZuKSB7XG4gICAgICAgIHRyeSAgICAgICB7IGlmICh0aGlzLnJlamVjdGVkKSByZXR1cm4gU3luY1Byb21pc2UucmVzb2x2ZSAoZm4gKHRoaXMudmFsKSkgfVxuICAgICAgICBjYXRjaCAoZSkgeyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFN5bmNQcm9taXNlLnJlamVjdCAoZSkgfVxuICAgICAgICByZXR1cm4gdGhpc1xuICAgIH1cblxuICAgIHN0YXRpYyByZXNvbHZlICh4KSB7XG4gICAgICAgIHJldHVybiBuZXcgU3luY1Byb21pc2UgKHJlc29sdmUgPT4geyByZXNvbHZlICh4KSB9KVxuICAgIH1cblxuICAgIHN0YXRpYyByZWplY3QgKHgpIHtcbiAgICAgICAgcmV0dXJuIG5ldyBTeW5jUHJvbWlzZSAoKF8sIHJlamVjdCkgPT4geyByZWplY3QgKHgpIH0pXG4gICAgfVxufSIsIlwidXNlIHN0cmljdFwiO1xuXG4vKiAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t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AgICAgICAgIHJldHVybiBwYXRoLm5vcm1hbGl6ZSAoeCkgfVxuXG4gICAgICAgIHJldHVybiBwYXRoLm5vcm1hbGl6ZSAocGF0aC5jb25jYXQgKGN3ZCwgeCkpXG4gICAgfSxcblxuICAgIG5vcm1hbGl6ZSAoeCkge1xuXG4gICAgICAgIGxldCBvdXRwdXQgPSBbXSxcbiAgICAgICAgICAgIHNraXAgPSAwXG5cbiAgICAgICAgeC5zcGxpdCAoJy8nKS5yZXZlcnNlICgpLmZpbHRlciAoeCA9PiB4ICE9PSAnLicpLmZvckVhY2ggKHggPT4ge1xuXG4gICAgICAgICAgICAgICAgIGlmICh4ID09PSAnLi4nKSB7IHNraXArKyB9XG4gICAgICAgICAgICBlbHNlIGlmIChza2lwID09PSAwKSB7IG91dHB1dC5wdXNoICh4KSB9XG4gICAgICAgICAgICBlbHNlICAgICAgICAgICAgICAgICB7IHNraXAtLSB9XG4gICAgICAgIH0pXG5cbiAgICAgICAgY29uc3QgcmVzdWx0ID0gb3V0cHV0LnJldmVyc2UgKCkuam9pbiAoJy8nKVxuXG4gICAgICAgIHJldHVybiAoKGlzQnJvd3NlciAmJiAocmVzdWx0WzBdID09PSAnLycpKSA/IHJlc3VsdFsxXSA9PT0gJy8nID8gd2luZG93LmxvY2F0aW9uLnByb3RvY29sIDogd2luZG93LmxvY2F0aW9uLm9yaWdpbiA6ICcnKSArIHJlc3VsdFxuICAgIH0sXG5cbiAgICBpc0RhdGE6IHggPT4geC5pbmRleE9mICgnZGF0YTonKSA9PT0gMCxcblxuICAgIGlzVVJMOiB4ID0+IHVybFJlZ2V4cC50ZXN0ICh4KSxcblxuICAgIGlzQWJzb2x1dGU6IHggPT4gKHhbMF0gPT09ICcvJykgfHwgL15bXlxcL10qOi8udGVzdCAoeCksXG5cbiAgICByZWxhdGl2ZVRvRmlsZSAoYSwgYikge1xuXG4gICAgICAgIHJldHVybiAocGF0aC5pc0RhdGEgKGEpIHx8IHBhdGguaXNBYnNvbHV0ZSA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bjogdXRpbC5nZXRBcmcoYUFyZ3MsICdjb2x1bW4nLCAwKVxuICAgIH07XG5cbiAgICBuZWVkbGUuc291cmNlID0gdGhpcy5fZmluZFNvdXJjZUluZGV4KG5lZWRsZS5zb3VyY2UpO1xuICAgIGlmIChuZWVkbGUuc291cmNlIDwgMCkge1xuICAgICAgcmV0dXJuIFtdO1xuICAgIH1cblxuICAgIHZhciBtYXBwaW5ncyA9IFtdO1xuXG4gICAgdmFyIGluZGV4ID0gdGhpcy5fZmluZE1hcHBpbmcobmVlZGxlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX29yaWdpbmFsTWFwcGluZ3MsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJvcmlnaW5hbExpbmVcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm9yaWdpbmFsQ29sdW1uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXRpbC5jb21wYXJlQnlPcmlnaW5hbFBvc2l0aW9ucyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaW5hcnlTZWFyY2guTEVBU1RfVVBQRVJfQk9VTkQpO1xuICAgIGlmIChpbmRleCA+PSAwKSB7XG4gICAgICB2YXIgbWFwcGluZyA9IHRoaXMuX29yaWdpbmFsTWFwcGluZ3NbaW5kZXhdO1xuXG4gICAgICBpZiAoYUFyZ3MuY29sdW1uID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgdmFyIG9yaWdpbmFsTGluZSA9IG1hcHBpbmcub3JpZ2luYWxMaW5lO1xuXG4gICAgICAgIC8vIEl0ZXJhdGUgdW50aWwgZWl0aGVyIHdlIHJ1biBvdXQgb2YgbWFwcGluZ3MsIG9yIHdlIHJ1biBpbnRvXG4gICAgICAgIC8vIGEgbWFwcGluZyBmb3IgYSBkaWZmZXJlbnQgbGluZSB0aGFuIHRoZSBvbmUgd2UgZm91bmQuIFNpbmNlXG4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HVzIHRvIGF2b2lkIGEgc2Vjb25kIHBhcnNlIGlmIHdlIGVuY291bnRlciB0aGUgc2FtZVxuICAgICAgICAvLyBzZWdtZW50IGFnYWluLlxuICAgICAgICBmb3IgKGVuZCA9IGluZGV4OyBlbmQgPCBsZW5ndGg7IGVuZCsrKSB7XG4gICAgICAgICAgaWYgKHRoaXMuX2NoYXJJc01hcHBpbmdTZXBhcmF0b3IoYVN0ciwgZW5kKSkge1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHN0ciA9IGFTdHIuc2xpY2UoaW5kZXgsIGVuZCk7XG5cbiAgICAgICAgc2VnbWVudCA9IGNhY2hlZFNlZ21lbnRzW3N0cl07XG4gICAgICAgIGlmIChzZWdtZW50KSB7XG4gICAgICAgICAgaW5kZXggKz0gc3RyLmxlbmd0aDtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBzZWdtZW50ID0gW107XG4gICAgICAgICAgd2hpbGUgKGluZGV4IDwgZW5kKSB7XG4gICAgICAgICAgICBiYXNlNjRWTFEuZGVjb2RlKGFTdHIsIGluZGV4LCB0ZW1wKTtcbiAgICAgICAgICAgIHZhbHVlID0gdGVtcC52YWx1ZTtcbiAgICAgICAgICAgIGluZGV4ID0gdGVtcC5yZXN0O1xuICAgICAgICAgICAgc2VnbWVudC5wdXNoKHZhbHVlKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoc2VnbWVudC5sZW5ndGggPT09IDIpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignRm91bmQgYSBzb3VyY2UsIGJ1dCBubyBsaW5lIGFuZCBjb2x1bW4nKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoc2VnbWVudC5sZW5ndGggPT09IDMpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignRm91bmQgYSBzb3VyY2UgYW5kIGxpbmUsIGJ1dCBubyBjb2x1bW4nKTtcb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Ly8gQ2hlY2sgaWYgaXQgY2FuIGJlIG1hcHBlZCBieSB0aGUgc291cmNlIG1hcCwgdGhlbiB1cGRhdGUgdGhlIG1hcHBpbmcuXG4gICAgICAgIHZhciBvcmlnaW5hbCA9IGFTb3VyY2VNYXBDb25zdW1lci5vcmlnaW5hbFBvc2l0aW9uRm9yKHtcbiAgICAgICAgICBsaW5lOiBtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICBjb2x1bW46IG1hcHBpbmcub3JpZ2luYWxDb2x1bW5cbiAgICAgICAgfSk7XG4gICAgICAgIGlmIChvcmlnaW5hbC5zb3VyY2UgIT0gbnVsbCkge1xuICAgICAgICAgIC8vIENvcHkgbWFwcGluZ1xuICAgICAgICAgIG1hcHBpbmcuc291cmNlID0gb3JpZ2luYWwuc291cmNlO1xuICAgICAgICAgIGlmIChhU291cmNlTWFwUGF0aCAhPSBudWxsKSB7XG4gICAgICAgICAgICBtYXBwaW5nLnNvdXJjZSA9IHV0aWwuam9pbihhU291cmNlTWFwUGF0aCwgbWFwcGluZy5zb3VyY2UpXG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzb3VyY2VSb290ICE9IG51bGwpIHtcbiAgICAgICAgICAgIG1hcHBpbmcuc291cmNlID0gdXRpbC5yZWxhdGl2ZShzb3VyY2VSb290LCBtYXBwaW5nLnNvdXJjZSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIG1hcHBpbmcub3JpZ2luYWxMaW5lID0gb3JpZ2luYWwubGluZTtcbiAgICAgICAgICBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uID0gb3JpZ2luYWwuY29sdW1uO1xuICAgICAgICAgIGlmIChvcmlnaW5hbC5uYW1lICE9IG51bGwpIHtcbiAgICAgICAgICAgIG1hcHBpbmcubmFtZSA9IG9yaWdpbmFsLm5hbWU7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHZhciBzb3VyY2UgPSBtYXBwaW5nLnNvdXJ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AgICAgIHZhciBjb2RlID0gbmV4dExpbmUuc3Vic3RyKDAsIG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uIC1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0R2VuZXJhdGVkQ29sdW1uKTtcbiAgICAgICAgICByZW1haW5pbmdMaW5lc1tyZW1haW5pbmdMaW5lc0luZGV4XSA9IG5leHRMaW5lLnN1YnN0cihtYXBwaW5nLmdlbmVyYXRlZENvbHVtbiAtXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdEdlbmVyYXRlZENvbHVtbik7XG4gICAgICAgICAgbGFzdEdlbmVyYXRlZENvbHVtbiA9IG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uO1xuICAgICAgICAgIGFkZE1hcHBpbmdXaXRoQ29kZShsYXN0TWFwcGluZywgY29kZSk7XG4gICAgICAgICAgLy8gTm8gbW9yZSByZW1haW5pbmcgY29kZSwgY29udGludWVcbiAgICAgICAgICBsYXN0TWFwcGluZyA9IG1hcHBpbmc7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICAvLyBXZSBhZGQgdGhlIGdlbmVyYXRlZCBjb2RlIHVudGlsIHRoZSBmaXJzdCBtYXBwaW5nXG4gICAgICAvLyB0byB0aGUgU291cmNlTm9kZSB3aXRob3V0IGFueSBtYXBwaW5nLlxuICAgICAgLy8gRWFjaCBsaW5lIGlzIGFkZGVkIGFzIHNlcGFyYXRlIHN0cmluZy5cbiAgICAgIHdoaWxlIChsYXN0R2VuZXJhdGVkTGluZSA8IG1hcHBpbmcuZ2VuZXJhdGVkTGluZSkge1xuICAgICAgICBub2RlLmFkZChzaGlmdE5leHRMaW5lKCkpO1xuICAgICAgICBsYXN0R2VuZXJhdGVkTGluZSsrO1xuICAgICAgfVxuICAgICAgaWYgKGxhc3RHZW5lcmF0ZWRDb2x1bW4gPCBtYXBwaW5nLmd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ENvbnN1bWVyLnNvdXJjZXMuZm9yRWFjaChmdW5jdGlvbiAoc291cmNlRmlsZSkge1xuICAgICAgdmFyIGNvbnRlbnQgPSBhU291cmNlTWFwQ29uc3VtZXIuc291cmNlQ29udGVudEZvcihzb3VyY2VGaWxlKTtcbiAgICAgIGlmIChjb250ZW50ICE9IG51bGwpIHtcbiAgICAgICAgaWYgKGFSZWxhdGl2ZVBhdGggIT0gbnVsbCkge1xuICAgICAgICAgIHNvdXJjZUZpbGUgPSB1dGlsLmpvaW4oYVJlbGF0aXZlUGF0aCwgc291cmNlRmlsZSk7XG4gICAgICAgIH1cbiAgICAgICAgbm9kZS5zZXRTb3VyY2VDb250ZW50KHNvdXJjZUZpbGUsIGNvbnRlbnQpO1xuICAgICAgfVxuICAgIH0pO1xuXG4gICAgcmV0dXJuIG5vZGU7XG5cbiAgICBmdW5jdGlvbiBhZGRNYXBwaW5nV2l0aENvZGUobWFwcGluZywgY29kZSkge1xuICAgICAgaWYgKG1hcHBpbmcgPT09IG51bGwgfHwgbWFwcGluZy5zb3VyY2UgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICBub2RlLmFkZChjb2RlKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHZhciBzb3VyY2UgPSBhUmVsYXRpdmVQYXRoXG4gICAgICAgICAgPyB1dGlsLmpvaW4oYVJlbGF0aXZlUGF0aCwgbWFwcGluZy5zb3VyY2UpXG4gICAgICAgICAgOiBtYXBwaW5nLnNvdXJjZTtcbiAgICAgICAgbm9kZS5hZGQobmV3IFNvdXJjZU5vZGUobWFwcGluZy5vcmlnaW5hbExpbmUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcHBpbmcub3JpZ2luYWxDb2x1bW4sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFw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0YWNrVHJhY2V5IHtcblxuICAgIGNvbnN0cnVjdG9yIChpbnB1dCwgb2Zmc2V0KSB7XG4gICAgICAgIFxuICAgICAgICBjb25zdCBvcmlnaW5hbElucHV0ICAgICAgICAgID0gaW5wdXRcbiAgICAgICAgICAgICwgaXNQYXJzZWFibGVTeW50YXhFcnJvciA9IGlucHV0ICYmIChpbnB1dCBpbnN0YW5jZW9mIFN5bnRheEVycm9yICYmICFpc0Jyb3dzZXIpXG4gICAgICAgICAgICAgICAgXG4gICAgLyogIG5ldyBTdGFja1RyYWNleSAoKSAgICAgICAgICAgICovXG5cbiAgICAgICAgaWYgKCFpbnB1dCkge1xuICAgICAgICAgICAgIGlucHV0ID0gbmV3IEVycm9yICgpXG4gICAgICAgICAgICAgb2Zmc2V0ID0gKG9mZnNldCA9PT0gdW5kZWZpbmVkKSA/IDEgOiBvZmZzZXRcbiAgICAgICAgfVxuXG4gICAgLyogIG5ldyBTdGFja1RyYWNleSAoRXJyb3IpICAgICAgKi9cblxuICAgICAgICBpZiAoaW5wdXQgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgaW5wdXQgPSBpbnB1dC5zdGFjayB8fCAnJ1xuICAgICAgICB9XG5cbiAgICAvKiAgbmV3IFN0YWNrVHJhY2V5IChzdHJpbmcpICAgICAqL1xuXG4gICAgICAgIGlmICh0eXBlb2YgaW5wdXQgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgICBpbnB1dCA9IHRoaXMucmF3UGFyc2UgKGlucHV0KS5zbGljZSAob2Zmc2V0KS5tYXAgKHggPT4gdGhpcy5leHRyYWN0RW50cnlNZXRhZGF0YSAoeCkpXG4gICAgICAgIH1cblxuICAgIC8qICBuZXcgU3RhY2tUcmFjZXkgKGFycmF5KSAgICAgICovXG5cbiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkgKGlucHV0KSkge1xuXG4gICAgICAgICAgICBpZiAoaXNQYXJzZWFibGVTeW50YXhFcnJvcikge1xuICAgICAgICAgICAgICAgIFxuICAgICAgICAgICAgICAgIGNvbnN0IHJhd0xpbmVzID0gbm9kZVJlcXVpcmUgKCd1dGlsJykuaW5zcGVjdCAob3JpZ2luYWxJbnB1dCkuc3BsaXQgKCdcXG4nKVxuICAgICAgICAgICAgICAgICAgICAsIGZpbGVMaW5lID0gcmF3TGluZXNbMF0uc3BsaXQgKCc6JylcbiAgICAgICAgICAgICAgICAgICAgLCBsaW5lID0gZmlsZUxpbmUucG9wICgpXG4gICAgICAgICAgICAgICAgICAgICwgZmlsZSA9IGZpbGVMaW5lLmpvaW4gKCc6JylcblxuICAgICAgICAgICAgICAgIGlmIChmaWxlKSB7XG4gICAgICAgICAgICAgICAgICAgIGlucHV0LnVuc2hpZnQgKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGU6IG5peFNsYXNoZXMgKGZpbGUpLFxuICAgICAgICAgICAgICAgICAgICAgICAgbGluZTogbGluZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbjogKHJhd0xpbmVzWzJdIHx8ICcnKS5pbmRleE9mICgnXicpICsgMSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZUxpbmU6IHJhd0xpbmVzWzFdLFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGVlOiAnKHN5bnRheCBlcnJvciknLFxuICAgICAgICAgICAgICAgICAgICAgICAgc3ludGF4RXJyb3I6IHRydWVcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRoaXMuaXRlbXMgPSBpbnB1dFxuXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLml0ZW1zID0gW11cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGV4dHJhY3RFbnRyeU1ldGFkYXRhIChlKSB7XG5cbiAgICAgICAgY29uc3QgZGVjb21wb3NlZFBhdGggPSB0aGlzLmRlY29tcG9zZVBhdGggKGUuZ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AgICAgICAgICAgICAgICAgICAgICAgICB8fCAvLyBleHRlcm5hbCBzb3VyY2VcbiAgICAgICAgICAgICAgIChyZWxhdGl2ZVBhdGguaW5kZXhPZiAoJ25vZGVfbW9kdWxlcycpICAgICAgPT09IDApIHx8XG4gICAgICAgICAgICAgICAocmVsYXRpdmVQYXRoLmluZGV4T2YgKCd3ZWJwYWNrL2Jvb3RzdHJhcCcpID09PSAwKVxuICAgIH1cblxuICAgIHJhd1BhcnNlIChzdHIpIHtcblxuICAgICAgICBjb25zdCBsaW5lcyA9IChzdHIgfHwgJycpLnNwbGl0ICgnXFxuJylcblxuICAgICAgICBjb25zdCBlbnRyaWVzID0gbGluZXMubWFwIChsaW5lID0+IHtcblxuICAgICAgICAgICAgbGluZSA9IGxpbmUudHJpbSAoKVxuXG4gICAgICAgICAgICBsZXQgY2FsbGVlLCBmaWxlTGluZUNvbHVtbiA9IFtdLCBuYXRpdmUsIHBsYW5BLCBwbGFuQlxuXG4gICAgICAgICAgICBpZiAoKHBsYW5BID0gbGluZS5tYXRjaCAoL2F0ICguKykgXFwoZXZhbCBhdCAuKyBcXCgoLispXFwpLCAuK1xcKS8pKSB8fCAvLyBldmFsIGNhbGxzXG4gICAgICAgICAgICAgICAgKHBsYW5BID0gbGluZS5tYXRjaCAoL2F0ICguKykgXFwoKC4rKVxcKS8pKSB8fFxuICAgICAgICAgICAgICAgICgobGluZS5zbGljZSAoMCwgMykgIT09ICdhdCAnKSAmJiAocGxhbkEgPSBsaW5lLm1hdGNoICgvKC4qKUAoLiopLykpKSkge1xuXG4gICAgICAgICAgICAgICAgY2FsbGVlICAgICAgICAgPSAgcGxhbkFbMV1cbiAgICAgICAgICAgICAgICBuYXRpdmUgICAgICAgICA9IChwbGFuQVsyXSA9PT0gJ25hdGl2ZScpXG4gICAgICAgICAgICAgICAgZmlsZUxpbmVDb2x1bW4gPSAocGxhbkFbMl0ubWF0Y2ggKC8oLiopOihcXGQrKTooXFxkKykvKSB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsYW5BWzJdLm1hdGNoICgvKC4qKTooXFxkKykvKSB8fCBbXSkuc2xpY2UgKDEpXG5cbiAgICAgICAgICAgIH0gZWxzZSBpZiAoKHBsYW5CID0gbGluZS5tYXRjaCAoL14oYXRcXHMrKSooLispOihcXGQrKTooXFxkKykvKSApKSB7XG4gICAgICAgICAgICAgICAgZmlsZUxpbmVDb2x1bW4gPSAocGxhbkIpLnNsaWNlICgyKVxuXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWRcbiAgICAgICAgICAgIH1cblxuICAgICAgICAvKiAgRGV0ZWN0IHRoaW5ncyBsaWtlIEFycmF5LnJlZHVjZVxuICAgICAgICAgICAgVE9ETzogZGV0ZWN0IG1vcmUgYnVpbHQtaW4gdHlwZXMgICAgICAgICAgICAqL1xuICAgICAgICAgICAgXG4gICAgICAgICAgICBpZiAoY2FsbGVlICYmICFmaWxlTGluZUNvbHVtblswXSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBjYWxsZWUuc3BsaXQgKCcuJylbMF1cbiAgICAgICAgICAgICAgICBpZiAodHlwZSA9PT0gJ0FycmF5Jykge1xuICAgICAgICAgICAgICAgICAgICBuYXRpdmUgPSB0cnVlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIGJlZm9yZVBhcnNlOiBsaW5lLFxuICAgICAgICAgICAgICAgIGNhbGxlZTogICAgICBjYWxsZWUgfHwgJycsXG4gICAgICAgICAgICAgICAgaW5kZXg6ICAgICAgIGlzQnJvd3NlciAmJiAoZmlsZUxpbmVDb2x1bW5bMF0gPT09IHdpbmRvdy5sb2NhdGlvbi5ocmVmKSxcbiAgICAgICAgICAgICAgICBuYXRpdmU6ICAgICAgbmF0aXZlIHx8IGZhbHNlLFxuICAgICAgICAgICAgICAgIGZpbGU6ICAgICAgICBuaXhTbGFzaGVzIChmaWxlTGluZUNvbHVtblswXSB8fCAnJyksXG4gICAgICAgICAgICAgICAgbGluZTogICAgICAgIHBhcnNlSW50IChmaWxlTGluZUNvbHVtblsxXSB8fCAnJywgMTApIHx8IHVuZGVmaW5lZCxcbiAgICAgICAgICAgICAgICBjb2x1bW46ICAgICAgcGFyc2VJbnQgKGZpbGVMaW5lQ29sdW1uWzJdIHx8ICcnLCAxMCkgfHwgdW5kZWZpbmVkXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pXG5cbiAgICAgICAgcmV0dXJuIGVudHJpZXMuZmlsdGVyICh4ID0+ICh4ICE9PSB1bmRlZmluZWQpKVxuICAgIH1cblxuICAgIHdpdGhTb3VyY2VBdCAoaSkge1xuICAgICAgICByZXR1cm4gdGhpcy5pdGVtc1tpXSAmJiB0aGlzLndpdGhTb3VyY2UgKHRoaXMuaXRlbXNbaV0pXG4gICAgfVxuXG4gICAgd2l0aFNvdXJjZUFzeW5jQXQgKGkpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuaXRlbXNbaV0gJiYgdGhpcy53aXRoU291cmNlQXN5bmMgKHRoaXMuaXRlbXNbaV0pXG4gICAgfVxuXG4gICAgd2l0aFNvdXJjZSAobG9jKSB7XG4gICAgICAgIFxuICAgICAgICBpZiAodGhpcy5zaG91bGRTa2lwUmVzb2x2aW5nIChsb2MpKSB7XG4gICAgICAgICAgICByZXR1cm4gbG9jXG4gICAgICAgICAgICBcbiAgICAgICAgfSBlbHNlIHtcblxuICAgICAgICAgICAgbGV0IHJlc29sdmVkID0gZ2V0U291cmNlIChsb2MuZmlsZSB8fCAnJykucmVzb2x2ZSAobG9jKVxuXG4gICAgICAgICAgICBpZiAoIXJlc29sdmVkLnNvdXJjZUZpbGUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbG9jXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiB0aGlzLndpdGhTb3VyY2VSZXNvbHZlZCAobG9jLCByZXNvbHZlZClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHdpdGhTb3VyY2VBc3luYyAobG9jKSB7XG5cbiAgICAgICAgaWYgKHRoaXMuc2hvdWxkU2tpcFJlc29sdmluZyAobG9jKSkge1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSAobG9jKVxuICAgICAgICAgICAgXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0U291cmNlLmFzeW5jIChsb2MuZmlsZSB8fCAnJylcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuICh4ID0+IHgucmVzb2x2ZSAobG9jKSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuIChyZXNvbHZlZCA9PiB0aGlzLndpdGhTb3VyY2VSZXNvbHZlZCAobG9jLCByZXNvbHZlZCkpXG4gICAgICAgICAgICAgICAgICAgICAgICAuY2F0Y2ggKGUgPT4gdGhpcy53aXRoU291cmNlUmVzb2x2ZWQgKGxvYywgeyBlcnJvcjogZSwgc291cmNlTGluZTogJycgfSkpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBzaG91bGRTa2lwUmVzb2x2aW5nIChsb2MpIHtcbiAgICAgICAgcmV0dXJuIGxvYy5zb3VyY2VGaWxlIHx8IGxvYy5lcnJvciB8fCAobG9jLmZpbGUgJiYgbG9jLmZpbGUuaW5kZXhPZiAoJzwnKSA+PSAwKSAvLyBza2lwIHRoaW5ncyBsaWtlIDxhbm9ueW1vdXM+IGFuZCBzdHVmZiB0aGF0IHdhcyBhbHJlYWR5IGZldGNoZWRcbiAgICB9XG5cbiAgICB3aXRoU291cmNlUmVzb2x2ZWQgKGxvYywgcmVzb2x2ZWQpIHtcblxuICAgICAgICBpZiAocmVzb2x2ZWQuc291cmNlRmlsZSAmJiAhcmVzb2x2ZWQuc291cmNlRmlsZS5lcnJvcikge1xuICAgICAgICAgICAgcmVzb2x2ZWQuZmlsZSA9IG5peFN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G5cbiAgICBtZXJnZVJlcGVhdGVkTGluZXMgKCkge1xuICAgICAgICByZXR1cm4gbmV3IFN0YWNrVHJhY2V5IChcbiAgICAgICAgICAgIHBhcnRpdGlvbiAodGhpcy5pdGVtcywgZSA9PiBlLmZpbGUgKyBlLmxpbmUpLm1hcCAoXG4gICAgICAgICAgICAgICAgZ3JvdXAgPT4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ3JvdXAuaXRlbXMuc2xpY2UgKDEpLnJlZHVjZSAoKG1lbW8sIGVudHJ5KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZW1vLmNhbGxlZSAgICAgID0gKG1lbW8uY2FsbGVlICAgICAgfHwgJzxhbm9ueW1vdXM+JykgKyAnIOKGkiAnICsgKGVudHJ5LmNhbGxlZSAgICAgIHx8ICc8YW5vbnltb3VzPicpXG4gICAgICAgICAgICAgICAgICAgICAgICBtZW1vLmNhbGxlZVNob3J0ID0gKG1lbW8uY2FsbGVlU2hvcnQgfHwgJzxhbm9ueW1vdXM+JykgKyAnIOKGkiAnICsgKGVudHJ5LmNhbGxlZVNob3J0IHx8ICc8YW5vbnltb3VzPicpXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWVtb1xuICAgICAgICAgICAgICAgICAgICB9LCBPLmFzc2lnbiAoe30sIGdyb3VwLml0ZW1zWzBdKSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBjbGVhbiAoKSB7XG4gICAgICAgIGNvbnN0IHMgPSB0aGlzLndpdGhTb3VyY2VzICgpLm1lcmdlUmVwZWF0ZWRMaW5lcyAoKVxuICAgICAgICByZXR1cm4gcy5maWx0ZXIgKHMuaXNDbGVhbi5iaW5kIChzKSlcbiAgICB9XG5cbiAgICBjbGVhbkFzeW5jICgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMud2l0aFNvdXJjZXNBc3luYyAoKS50aGVuIChzID0+IHtcbiAgICAgICAgICAgIHMgPSBzLm1lcmdlUmVwZWF0ZWRMaW5lcyAoKVxuICAgICAgICAgICAgcmV0dXJuIHMuZmlsdGVyIChzLmlzQ2xlYW4uYmluZCAocykpXG4gICAgICAgIH0pXG4gICAgfVxuXG4gICAgaXNDbGVhbiAoZW50cnksIGluZGV4KSB7XG4gICAgICAgIHJldHVybiAoaW5kZXggPT09IDApIHx8ICEoZW50cnkudGhpcmRQYXJ0eSB8fCBlbnRyeS5oaWRlIHx8IGVudHJ5Lm5hdGl2ZSlcbiAgICB9XG5cbiAgICBhdCAoaSkge1xuICAgICAgICByZXR1cm4gTy5hc3NpZ24gKHtcblxuICAgICAgICAgICAgYmVmb3JlUGFyc2U6ICcnLFxuICAgICAgICAgICAgY2FsbGVlOiAgICAgICc8Pz8/PicsXG4gICAgICAgICAgICBpbmRleDogICAgICAgZmFsc2UsXG4gICAgICAgICAgICBuYXRpdmU6ICAgICAgZmFsc2UsXG4gICAgICAgICAgICBmaWxlOiAgICAgICAgJzw/Pz8+JyxcbiAgICAgICAgICAgIGxpbmU6ICAgICAgICAwLFxuICAgICAgICAgICAgY29sdW1uOiAgICAgIDBcblxuICAgICAgICB9LCB0aGlzLml0ZW1zW2ldKVxuICAgIH1cblxuICAgIGFzVGFibGUgKG9wdHMpIHtcblxuICAgICAgICBjb25zdCBtYXhDb2x1bW5XaWR0aHMgPSAob3B0cyAmJiBvcHRzLm1heENvbHVtbldpZHRocykgfHwgdGhpcy5tYXhDb2x1bW5XaWR0aHMgKClcblxuICAgICAgICBjb25zdCB0cmltRW5kICAgPSAocywgbikgPT4gcyAmJiAoKHMubGVuZ3RoID4gbikgPyAocy5zbGljZSAoMCwgbi0xKSArICfigKYnKSA6IHMpICAgXG4gICAgICAgIGNvbnN0IHRyaW1TdGFydCA9IChzLCBuKSA9PiBzICYmICgocy5sZW5ndGggPiBuKSA/ICgn4oCmJyArIHMuc2xpY2UgKC0obi0xKSkpIDogcylcblxuICAgICAgICBjb25zdCB0cmltbWVkID0gdGhpcy5tYXAgKFxuICAgICAgICAgICAgZSA9PiBbXG4gICAgICAgICAgICAgICAgKCdhdCAnICsgdHJpbUVuZCAoZS5jYWxsZWVTaG9ydCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heENvbHVtbldpZHRocy5jYWxsZWUpKSxcbiAgICAgICAgICAgICAgICB0cmltU3RhcnQgKChlLmZpbGVTaG9ydCAmJiAoZS5maWxlU2hvcnQgKyAnOicgKyBlLmxpbmUpKSB8fCAnJywgbWF4Q29sdW1uV2lkdGhzLmZpbGUpLFxuICAgICAgICAgICAgICAgIHRyaW1FbmQgKCgoZS5zb3VyY2VMaW5lIHx8ICcnKS50cmltICgpIHx8ICcnKSwgICAgICAgICAgICAgICAgICBtYXhDb2x1bW5XaWR0aHMuc291cmNlTGluZSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgKVxuXG4gICAgICAgIHJldHVybiBhc1RhYmxlICh0cmltbWVkLml0ZW1zKVxuICAgIH1cblxuICAgIG1heENvbHVtbldpZHRocyAoKSB7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBjYWxsZWU6ICAgICAzMCxcbiAgICAgICAgICAgIGZpbGU6ICAgICAgIDYwLFxuICAgICAgICAgICAgc291cmNlTGluZTogODBcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHN0YXRpYyByZXNldENhY2hlICgpIHtcblxuICAgICAgICBnZXRTb3VyY2UucmVzZXRDYWNoZSAoKVxuICAgICAgICBnZXRTb3VyY2UuYXN5bmMucmVzZXRDYWNoZSAoKVxuICAgIH1cblxuICAgIHN0YXRpYyBsb2NhdGlvbnNFcXVhbCAoYSwgYikge1xuXG4gICAgICAgIHJldHVybiAoYS5maWxlICAgPT09IGIuZmlsZSkgJiZcbiAgICAgICAgICAgICAgIChhLmxpbmUgICA9PT0gYi5saW5lKSAmJlxuICAgICAgICAgICAgICAgKGEuY29sdW1uID09PSBiLmNvbHVtbilcbiAgICB9XG59XG5cbi8qICBB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ICAgICAgICAgICAgICAgIGggKCdzcGFuLmxpbmUtbnVtYmVyJywgU3RyaW5nIChzdGFydCArIGkgKyAxKS5wYWRTdGFydCAobGluZU51bWJlcldpZHRoLCAnICcpKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGggKCdzcGFuLmxpbmUtdGV4dCcsIChpID09PSBoaWxpSW5kZXgpID8gcmVuZGVySGlnaGxpZ2h0ZWRMaW5lICh0ZXh0LCBjb2x1bW4sIGhpbGlNc2cpIDogdGV4dClcbiAgICAgICAgICAgICAgICAgICAgXSkpXG4gICAgICAgICAgICAgICAgICAgIDogW2ggKCcubGluZScsIFtcbiAgICAgICAgICAgICAgICAgICAgICAgIGggKCdzcGFuLmxpbmUtbnVtYmVyJywgU3RyaW5nIChsaW5lKSksXG4gICAgICAgICAgICAgICAgICAgICAgICBoICgnc3Bhbi5saW5lLXRleHQubm8tc291cmNlJywgYOKApiBzb21ld2hlcmUgYXQgJHtjYWxsZWVTaG9ydCA/IChjYWxsZWVTaG9ydCArICcoKScpIDogJz8/Pyd9IOKApmApLFxuICAgICAgICAgICAgICAgICAgICBdKV1cbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICBdKVxufVxuXG5mdW5jdGlvbiByZW5kZXJIaWdobGlnaHRlZExpbmUgKHRleHQsIGNvbHVtbiwgbXNnKSB7XG5cbiAgICBjb25zdCBbYmVmb3JlLCBhZnRlcl0gPSBbdGV4dC5zbGljZSAoMCwgY29sdW1uIC0gMSksIHRleHQuc2xpY2UgKGNvbHVtbiAtIDEpXVxuICAgIHJldHVybiBbYmVmb3JlLCBoICgnc3Ryb25nJywgYWZ0ZXIpLyosIG1zZyAmJiBoICgnZW0nLCBtc2cpKi9dXG59XG5cbmZ1bmN0aW9uIHBhbmljIChlcnIpIHtcblxuICAgIGNvbnN0IHN0YWNrID0gKG5ldyBTdGFja1RyYWNleSAoZXJyKSkud2l0aFNvdXJjZXMoKVxuICAgIGNvbnN0IGluZGV4VGV4dCA9IHN0YWNrLmNsZWFuKCkuYXNUYWJsZSgpXG5cbiAgICAvLyBEZWR1cGxpY2F0aW9uXG4gICAgZm9yIChjb25zdCBlbCBvZiBlcnJvcnMuY2hpbGROb2Rlcykge1xuICAgICAgICBpZiAoZWwuX2luZGV4VGV4dCA9PT0gaW5kZXhUZXh0KSB7XG4gICAgICAgICAgICBhc3NpZ24gKGVsLnF1ZXJ5U2VsZWN0b3IgKCcucGFuaWMtb3ZlcmxheV9fZXJyb3ItY291bnRlcicpLCB7XG4gICAgICAgICAgICAgICAgaW5uZXJUZXh0OiBlbC5fY291bnRlciA9IChlbC5fY291bnRlciB8fCAxKSArIDEsXG4gICAgICAgICAgICAgICAgc3R5bGU6ICcnXG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb25zdCBzaG93TW9yZSA9ICgpID0+IG1vZGFsLmNsYXNzTGlzdC5yZW1vdmUgKCdwYW5pYy1vdmVybGF5X19jb2xsYXBzZWQnKVxuICAgIFxuICAgIGNvbnN0IHR5cGUgPSBTdHJpbmcgKChlcnIgJiYgKGVyci50eXBlIHx8IChlcnIuY29uc3RydWN0b3IgJiYgZXJyLmNvbnN0cnVjdG9yLm5hbWUpKSkgfHwgdHlwZW9mIGVycilcbiAgICBjb25zdCBtc2cgID0gU3RyaW5nIChlcnIgJiYgZXJyLm1lc3NhZ2UpXG5cbiAgICBjb25zdCBlbCA9IGggKCcuZXJyb3InLCB7IF9pbmRleFRleHQ6IGluZGV4VGV4dCB9LCBbXG4gICAgICAgICAgICAgICAgICAgIGggKCcuZXJyb3ItdGl0bGUnLCBbXG4gICAgICAgICAgICAgICAgICAgICAgICBoICgnc3Bhbi5lcnJvci10eXBlJywgW3R5cGUsIGggKCdzcGFuLmVycm9yLWNvdW50ZXInLCB7IHN0eWxlOiAnZGlzcGxheTogbm9uZTsnIH0pXSksXG4gICAgICAgICAgICAgICAgICAgICAgICBoICgnc3Bhbi5lcnJvci1t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ycy5yZWR1Y2UgKChhLCBiKSA9PiBiLm1hcCAoKGIsIGkpID0+IFsuLi5hW2ldIHx8IFtdLCBiXSksIFtdKS5tYXAgKGFyZ3MgPT4gZiAoLi4uYXJncykpLFxuXG4gICAgLyogIENvbnZlcnQgY2VsbCBkYXRhIHRvIHN0cmluZyAoY29udmVydGluZyBtdWx0aWxpbmUgdGV4dCB0byBzaW5nbGVsaW5lKSAqL1xuXG4gICAgICAgIGNlbGxzICAgICAgICAgICA9IHJvd3MubWFwIChyID0+IHIubWFwIChjID0+IGMucmVwbGFjZSAoL1xcbi9nLCAnXFxcXG4nKSkpLFxuXG4gICAgLyogIENvbXB1dGUgY29sdW1uIHdpZHRocyAocGVyIHJvdykgYW5kIG1heCB3aWR0aHMgKHBlciBjb2x1bW4pICAgICAqL1xuXG4gICAgICAgIGNlbGxXaWR0aHMgICAgICA9IGNlbGxzLm1hcCAociA9PiByLm1hcCAoc3RybGVuKSksXG4gICAgICAgIG1heFdpZHRocyAgICAgICA9IHppcCAoY2VsbFdpZHRocywgTWF0aC5tYXgpLFxuXG4gICAgLyogIERlZmF1bHQgY29uZmlnICAgICAqL1xuXG4gICAgICAgIGNmZyAgICAgICAgICAgICA9IE8uYXNzaWduICh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsaW1pdGVyOiAnICAnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbkNvbHVtbldpZHRoczogbWF4V2lkdGhzLm1hcCAoeCA9PiAwKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhUb3RhbFdpZHRoOiAwIH0sIGNmZ18pLFxuXG4gICAgICAgIGRlbGltaXRlckxlbmd0aCA9IHN0cmxlbiAoY2ZnLmRlbGltaXRlciksXG5cbiAgICAvKiAgUHJvamVjdCBkZXNpcmVkIGNvbHVtbiB3aWR0aHMsIHRha2luZyBtYXhUb3RhbFdpZHRoIGFuZCBtaW5Db2x1bW5XaWR0aHMgaW4gYWNjb3VudC4gICA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gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyAoY2ZnLnJpZ2h0ID8gKCcgJy5yZXBlYXQgKHcpICsgc3RyKSA6IChzdHIgKyAnICcucmVwZWF0ICh3KSkpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogKGxpbWl0IChzdHIsIHN0cmxlbiAoc3RyKSArIHcpKSkuam9pbiAoY2ZnLmRlbGltaXRlcikpXG59XG5cbmNvbnN0IGFzVGFibGUgPSBjZmcgPT4gTy5hc3NpZ24gKGFyciA9PiB7XG5cbi8qICBQcmludCBhcnJheXMgICovXG5cbiAgICBpZiAoYXJyWzBdICYmIEFycmF5LmlzQXJyYXkgKGFyclswXSkpIHtcbiAgICAgICAgcmV0dXJuIGFzQ29sdW1ucyAoYXJyLm1hcCAociA9PiByLm1hcCAoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYywgaSkgPT4gKGMgPT09IHVuZGVmaW5lZCkgPyAnJyA6IGNmZy5wcmludCAoYywgaSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgY2ZnKS5qb2luICgnXFxuJylcbiAgICB9XG5cbi8qICBQcmludCBvYmplY3RzICAgKi9cblxuICAgIGNvbnN0IGNvbE5hbWVzID0gWy4uLm5ldyBTZXQgKFtdLmNvbmNhdCAoLi4uYXJyLm1hcCAoTy5rZXlzKSkpXSxcbiAgICAgICAgICBjb2x1bW5zICA9IFtjb2xOYW1lcy5tYXAgKGNmZy50aXRsZSksXG4gICAgICAgICAgICAgICAgICAgICAgLi4uYXJyLm1hcCAobyA9PiBjb2xOYW1lcy5tYXAgKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleSA9PiAob1trZXldID09PSB1bmRlZmluZWQpID8gJycg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BhdGgpKVxuXG4gICAgICAgIHJldHVybiBQcm9taXNlSW1wbC5yZXNvbHZlICh0ZXh0KS50aGVuICh0ZXh0ID0+IHtcblxuICAgICAgICAgICAgbGV0IGZpbGVcbiAgICAgICAgICAgIGxldCBsaW5lc1xuICAgICAgICAgICAgbGV0IHJlc29sdmVyXG4gICAgICAgICAgICBsZXQgX3Jlc29sdmUgPSBsb2MgPT4gKHJlc29sdmVyID0gcmVzb2x2ZXIgfHwgU291cmNlTWFwUmVzb2x2ZXJGcm9tRmV0Y2hlZEZpbGUgKGZpbGUpKSAobG9jKVxuXG4gICAgICAgICAgICByZXR1cm4gKGZpbGUgPSB7XG4gICAgICAgICAgICAgICAgcGF0aDogc3JjUGF0aCxcbiAgICAgICAgICAgICAgICB0ZXh0LFxuICAgICAgICAgICAgICAgIGdldCBsaW5lcyAoKSB7IHJldHVybiBsaW5lcyA9IChsaW5lcyB8fCB0ZXh0LnNwbGl0ICgnXFxuJykpIH0sXG4gICAgICAgICAgICAgICAgcmVzb2x2ZSAobG9jKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlc3VsdCA9IF9yZXNvbHZlIChsb2MpXG4gICAgICAgICAgICAgICAgICAgIGlmIChzeW5jKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0cnkgeyByZXR1cm4gU3luY1Byb21pc2UudmFsdWVGcm9tIChyZXN1bHQpIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGNoIChlKSB7IHJldHVybiBhc3NpZ24gKHt9LCBsb2MsIHsgZXJyb3I6IGUgfSkgfVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSAocmVzdWx0KVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBfcmVzb2x2ZSxcbiAgICAgICAgICAgIH0pXG4gICAgICAgIH0pXG4gIC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JjRmlsZSA9IHNvdXJjZU1hcFBhdGguc3RhcnRzV2l0aCAoJ2RhdGE6JylcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IFNvdXJjZUZpbGUgKG9yaWdpbmFsRmlsZVBhdGgsIGRhdGFVUklUb0J1ZmZlciAoc291cmNlTWFwUGF0aCkudG9TdHJpbmcgKCkpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBTb3VyY2VGaWxlIChwYXRoLnJlbGF0aXZlVG9GaWxlIChvcmlnaW5hbEZpbGVQYXRoLCBzb3VyY2VNYXBQYXRoKSlcblxuICAgICAgICBjb25zdCBwYXJzZWRNYXAgPSBzcmNGaWxlLnRoZW4gKGYgPT4gU291cmNlTWFwQ29uc3VtZXIgKEpTT04ucGFyc2UgKGYudGV4dCkpKVxuICAgICAgICBcbiAgICAgICAgY29uc3Qgc291cmNlRm9yID0gbWVtb2l6ZSAoZnVuY3Rpb24gc291cmNlRm9yIChmaWxlUGF0aCkge1xuICAgICAgICAgICAgcmV0dXJuIHNyY0ZpbGUudGhlbiAoZiA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgZnVsbFBhdGggPSBwYXRoLnJlbGF0aXZlVG9GaWxlIChmLnBhdGgsIGZpbGVQYXRoKVxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZWRNYXAudGhlbiAoeCA9PiBTb3VyY2VGaWxlIChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGxQYXRoLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeC5zb3VyY2VDb250ZW50Rm9yIChmaWxlUGF0aCwgdHJ1ZSAvKiByZXR1cm4gbnVsbCBvbiBtaXNzaW5nICovKSB8fCB1bmRlZmluZWQpKVxuICAgICAgICAgICAgfSlcbiAgICAgICAgfSlcbiAgICBcbiAgICAgICAgcmV0dXJuIGxvYyA9PiBwYXJzZWRNYXAudGhlbiAoeCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBvcmlnaW5hbExvYyA9IHgub3JpZ2luYWxQb3NpdGlvbkZvciAobG9jKVxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9yaWdpbmFsTG9jLnNvdXJjZSA/IHNvdXJjZUZvciAob3JpZ2luYWxMb2Muc291cmNlKS50aGVuICh4ID0+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHguX3Jlc29sdmUgKGFzc2lnbiAoe30sIGxvYywge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZTogICBvcmlnaW5hbExvYy5saW5lLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sdW1uOiBvcmlnaW5hbExvYy5jb2x1bW4gKyAxLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogICBvcmlnaW5hbExvYy5uYW1lXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBmYWxsYmFja1Jlc29sdmUgKGxvYylcbiAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2ggKGUgPT5cbiAgICAgICAgICAgICAgICAgICAgICAgIGFzc2lnbiAoZmFsbGJhY2tSZXNvbHZlIChsb2MpLCB7IHNvdXJjZU1hcEVycm9yOiBlIH0pKVxuICAgIH1cblxuICAgIHJldHVybiBhc3NpZ24gKGZ1bmN0aW9uIGdldFNvdXJjZSAocGF0aCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZmlsZSA9IFNvdXJjZUZpbGUgKHBhdGgpXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3luYykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7IHJldHVybiBTeW5jUHJvbWlzZS52YWx1ZUZyb20gKGZpbGUpIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBub0ZpbGUgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dDogJycsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lczogW10sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUgKGxvYykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhc3NpZ24gKHt9LCBsb2MsIHsgZXJyb3I6IGUsIHNvdXJjZUxpbmU6ICcnLCBzb3VyY2VGaWxlOiBub0ZpbGUgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbm9GaWxlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZpbGVcbiAgICAgICAgICAgICAgICAgICAgfSwge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXRDYWNoZTogKCkgPT4gU291cmNlRmlsZU1lbW9pemVkLmZvcmdldEV2ZXJ5dGhpbmcgKCksXG4gICAgICAgICAgICAgICAgICAgICAgICBnZXRDYWNoZTogICAoKSA9PiBTb3VyY2VGaWxlTWVtb2l6ZWQuY2FjaGVcbiAgICAgICAgICAgICAgICAgICAgfSlcbn1cblxuLyogIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSAqL1xuXG5tb2R1bGUuZXhwb3J0cyA9IGltcGwgKGZ1bmN0aW9uIGZldGNoRmlsZVN5bmMgKHBhdGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgU3luY1Byb21pc2UgKHJlc29sdmUgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc0Jyb3dzZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHhociA9IG5ldyBYTUxIdHRwUmVxdWVzdCAoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4aHIub3BlbiAoJ0dFVCcsIHBhdGgsIGZhbHNlIC8qIFNZTkNIUk9OT1VTIFhIUiBGVFcgOikgKi8pXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhoci5zZW5kIChudWxsKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlICh4aHIucmVzcG9uc2VUZXh0KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUgKG5vZGVSZXF1aXJlICgnZnMnKS5yZWFkRmlsZVN5bmMgKHBhdGgsIHsgZW5jb2Rpbmc6ICd1dGY4JyB9KSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICB9LCB0cnVlKVxuXG4vKiAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tICovXG5cbm1vZHVsZS5leHBvcnRzLmFzeW5jID0gaW1wbCAoZnVuY3Rpb24gZmV0Y2hGaWxlQXN5bmMgKHBhdGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSAoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc0Jyb3dzZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHhociA9IG5ldyBYTUxIdHRwUmVxdWVzdCAoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4aHIub3BlbiAoJ0dFVCcsIHBhdGgpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhoci5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBldmVudCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeGhyLnJlYWR5U3RhdGUgPT09IDQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeGhyLnN0YXR1cyA9PT0gMjAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUgKHhoci5yZXNwb25zZVRleHQpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVqZWN0IChuZXcgRXJyb3IgKHhoci5zdGF0dXNUZXh0KSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeGhyLnNlbmQgKG51bGwpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9kZVJlcXVpcmUgKCdmcycpLnJlYWRGaWxlIChwYXRoLCB7IGVuY29kaW5nOiAndXRmOCcgfSwgKGUsIHgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPyByZWplY3QgKGUpIDogcmVzb2x2ZSAoeClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICB9KVxuXG4vKiAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tICovXG4iLCJcInVzZSBzdHJpY3RcIjtcblxuLyogIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSAqL1xuXG5tb2R1bGUuZXhwb3J0cyA9IGNsYXNzIFN5bmNQcm9taXNlIHtcblxuICAgIGNvbnN0cnVjdG9yIChmbikge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgZm4gKFxuICAgICAgICAgICAgICAgIHggPT4geyB0aGlzLnNldFZhbHVlICh4LCBmYWxzZSkgfSwgLy8gcmVzb2x2ZVxuICAgICAgICAgICAgICAgIHggPT4geyB0aGlzLnNldFZhbHVlICh4LCB0cnVlKSB9ICAgLy8gcmVqZWN0XG4gICAgICAgICAgICApXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIHRoaXMuc2V0VmFsdWUgKGUsIHRydWUpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBzZXRWYWx1ZSAoeCwgcmVqZWN0ZWQpIHtcbiAgICAgICAgdGhpcy52YWwgICAgICA9ICh4IGluc3RhbmNlb2YgU3luY1Byb21pc2UpID8geC52YWwgOiB4XG4gICAgICAgIHRoaXMucmVqZWN0ZWQgPSByZWplY3RlZCB8fCAoKHggaW5zdGFuY2VvZiBTeW5jUHJvbWlzZSkgPyB4LnJlamVjdGVkIDogZmFsc2UpXG4gICAgfVxuXG4gICAgc3RhdGljIHZhbHVlRnJvbSAoeCkge1xuICAgICAgICBpZiAoeCBpbnN0YW5jZW9mIFN5bmNQcm9taXNlKSB7XG4gICAgICAgICAgICBpZiAoeC5yZWplY3RlZCkgdGhyb3cgIHgudmFsXG4gICAgICAgICAgICBlbHNlICAgICAgICAgICAgcmV0dXJuIHgudmFsXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4geFxuICAgICAgICB9XG4gICAgfVxuXG4gICAgdGhlbiAoZm4pIHtcbiAgICAgICAgdHJ5ICAgICAgIHsgaWYgKCF0aGlzLnJlamVjdGVkKSByZXR1cm4gU3luY1Byb21pc2UucmVzb2x2ZSAoZm4gKHRoaXMudmFsKSkgfVxuICAgICAgICBjYXRjaCAoZSkgeyAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTeW5jUHJvbWlzZS5yZWplY3QgKGUpIH1cbiAgICAgICAgcmV0dXJuIHRoaXNcbiAgICB9XG5cbiAgICBjYXRjaCAoZm4pIHtcbiAgICAgICAgdHJ5ICAgICAgIHsgaWYgKHRoaXMucmVqZWN0ZWQpIHJldHVybiBTeW5jUHJvbWlzZS5yZXNvbHZlIChmbiAodGhpcy52YWwpKSB9XG4gICAgICAgIGNhdGNoIChlKSB7ICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3luY1Byb21pc2UucmVqZWN0IChlKSB9XG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgc3RhdGljIHJlc29sdmUgKHgpIHtcbiAgICAgICAgcmV0dXJuIG5ldyBTeW5jUHJvbWl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gcmV0dXJuIGEgKyAoKGFfZW5kc1dpdGhTbGFzaCB8fCBiX3N0YXJ0c1dpdGhTbGFzaCkgPyAnJyA6ICcvJykgK1xuICAgICAgICAgICAgICAgICAgICgoYV9lbmRzV2l0aFNsYXNoICYmIGJfc3RhcnRzV2l0aFNsYXNoKSA/IGIuc3Vic3RyaW5nICgxKSA6IGIpXG4gICAgfSxcblxuICAgIHJlc29sdmUgKHgpIHtcblxuICAgICAgICBpZiAocGF0aC5pc0Fic29sdXRlICh4KSkge1xuICAgICAgICAgICAgcmV0dXJuIHBhdGgubm9ybWFsaXplICh4KSB9XG5cbiAgICAgICAgcmV0dXJuIHBhdGgubm9ybWFsaXplIChwYXRoLmNvbmNhdCAoY3dkLCB4KSlcbiAgICB9LFxuXG4gICAgbm9ybWFsaXplICh4KSB7XG5cbiAgICAgICAgbGV0IG91dHB1dCA9IFtdLFxuICAgICAgICAgICAgc2tpcCA9IDBcblxuICAgICAgICB4LnNwbGl0ICgnLycpLnJldmVyc2UgKCkuZmlsdGVyICh4ID0+IHggIT09ICcuJykuZm9yRWFjaCAoeCA9PiB7XG5cbiAgICAgICAgICAgICAgICAgaWYgKHggPT09ICcuLicpIHsgc2tpcCsrIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKHNraXAgPT09IDApIHsgb3V0cHV0LnB1c2ggKHgpIH1cbiAgICAgICAgICAgIGVsc2UgICAgICAgICAgICAgICAgIHsgc2tpcC0tIH1cbiAgICAgICAgfSlcblxuICAgICAgICBjb25zdCByZXN1bHQgPSBvdXRwdXQucmV2ZXJzZSAoKS5qb2luICgnLycpXG5cbiAgICAgICAgcmV0dXJuICgoaXNCcm93c2VyICYmIChyZXN1bHRbMF0gPT09ICcvJykpID8gcmVzdWx0WzFdID09PSAnLycgPyB3aW5kb3cubG9jYXRpb24ucHJvdG9jb2wgOiB3aW5kb3cubG9jYXRpb24ub3JpZ2luIDogJycpICsgcmVzdWx0XG4gICAgfSxcblxuICAgIGlzRGF0YTogeCA9P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lIHRodXMgZmluZCB0aGUgbGFzdCBtYXBwaW5nIGZvclxuICAgIC8vIHRoZSBnaXZlbiBsaW5lLCBwcm92aWRlZCBzdWNoIGEgbWFwcGluZyBleGlzdHMuXG4gICAgdmFyIG5lZWRsZSA9IHtcbiAgICAgIHNvdXJjZTogdXRpbC5nZXRBcmcoYUFyZ3MsICdzb3VyY2UnKSxcbiAgICAgIG9yaWdpbmFsTGluZTogbGluZSxcbiAgICAgIG9yaWdpbmFsQ29sdW1uOiB1dGlsLmdldEFyZyhhQXJncywgJ2NvbHVtbicsIDApXG4gICAgfTtcblxuICAgIG5lZWRsZS5zb3VyY2UgPSB0aGlzLl9maW5kU291cmNlSW5kZXgobmVlZGxlLnNvdXJjZSk7XG4gICAgaWYgKG5lZWRsZS5zb3VyY2UgPCAwKSB7XG4gICAgICByZXR1cm4gW107XG4gICAgfVxuXG4gICAgdmFyIG1hcHBpbmdzID0gW107XG5cbiAgICB2YXIgaW5kZXggPSB0aGlzLl9maW5kTWFwcGluZyhuZWVkbGUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fb3JpZ2luYWxNYXBwaW5ncyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm9yaWdpbmFsTGluZVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwib3JpZ2luYWxDb2x1bW5cIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1dGlsLmNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpbmFyeVNlYXJjaC5MRUFTVF9VUFBFUl9CT1VORCk7XG4gICAgaWYgKGluZGV4ID49IDApIHtcbiAgICAgIHZhciBtYXBwaW5nID0gdGhpcy5fb3JpZ2luYWxNYXBwaW5nc1tpbmRleF07XG5cbiAgICAgIGlmIChhQXJncy5jb2x1bW4gPT09IHVuZGVmaW5lZCkge1xuICA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lbmNvZGUobWFwcGluZy5vcmlnaW5hbENvbHVtblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHByZXZpb3VzT3JpZ2luYWxDb2x1bW4pO1xuICAgICAgICBwcmV2aW91c09yaWdpbmFsQ29sdW1uID0gbWFwcGluZy5vcmlnaW5hbENvbHVtbjtcblxuICAgICAgICBpZiAobWFwcGluZy5uYW1lICE9IG51bGwpIHtcbiAgICAgICAgICBuYW1lSWR4ID0gdGhpcy5fbmFtZXMuaW5kZXhPZihtYXBwaW5nLm5hbWUpO1xuICAgICAgICAgIG5leHQgKz0gYmFzZTY0VkxRLmVuY29kZShuYW1lSWR4IC0gcHJldmlvdXNOYW1lKTtcbiAgICAgICAgICBwcmV2aW91c05hbWUgPSBuYW1lSWR4O1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHJlc3VsdCArPSBuZXh0O1xuICAgIH1cblxuICAgIHJldHVybiByZXN1bHQ7XG4gIH07XG5cblNvdXJjZU1hcEdlbmVyYXRvci5wcm90b3R5cGUuX2dlbmVyYXRlU291cmNlc0NvbnRlbnQgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBHZW5lcmF0b3JfZ2VuZXJhdGVTb3VyY2VzQ29udGVudChhU291cmNlcywgYVNvdXJjZVJvb3QpIHtcbiAgICByZXR1cm4gYVNvdXJjZXMubWFwKGZ1bmN0aW9uIChzb3VyY2UpIHtcbiAgICAgIGlmICghdGhpcy5fc291cmNlc0NvbnRlbnRzKSB7XG4gICAgICAgIHJldHVybiBudWxsO1xuICAgICAgfVxuICAgICAgaWYgKGFTb3VyY2VSb290ICE9IG51bGwpIHtcbiAgICAgICAgc291cmNlID0gdXRpbC5yZWxhdGl2ZShhU291cmNlUm9vdCwgc291cmNlKTtcbiAgICAgIH1cbiAgICAgIHZhciBrZXkgPSB1dGlsLnRvU2V0U3RyaW5nKHNvdXJjZSk7XG4gICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Q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xhdGl2ZVBhdGhcbiAgICAgICAgICA/IHV0aWwuam9pbihhUmVsYXRpdmVQYXRoLCBtYXBwaW5nLnNvdXJjZSlcbiAgICAgICAgICA6IG1hcHBpbmcuc291cmNlO1xuICAgICAgICBub2RlLmFkZChuZXcgU291cmNlTm9kZShtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXBwaW5nLm5hbWUpKTtcbiAgICAgIH1cbiAgICB9XG4gIH07XG5cbi8qKlxuICogQWRkIGEgY2h1bmsgb2YgZ2VuZXJhdGVkIEpTIHRvIHRoaXMgc291cmNlIG5vZGUuXG4gKlxuICogQHBhcmFtIGFDaHVuayBBIHN0cmluZyBzbmlwcGV0IG9mIGdlbmVyYXRlZCBKUyBjb2RlLCBhbm90aGVyIGluc3RhbmNlIG9mXG4gKiAgICAgICAgU291cmNlTm9kZSwgb3IgYW4gYXJyYXkgd2hlcmUgZWFjaCBtZW1iZXIgaXMgb25lIG9mIHRob3NlIHRoaW5ncy5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gU291cmNlTm9kZV9hZGQoYUNodW5rKSB7XG4gIGlmIChBcnJheS5pc0FycmF5KGFDaHVuaykpIHtcbiAgICBhQ2h1bmsuZm9yRWFjaChmdW5jdGlvbiAoY2h1bmspIHtcbiAgICAgIHRoaXMuYWRkKGNodW5rKTtcbiAgICB9LCB0aGlzKTtcbiAgfVxuICBlbHNlIGlmIChhQ2h1bmtbaXNTb3VyY2VOb2RlXSB8fCB0eXBlb2YgYUNodW5rID09PSBcInN0cmluZ1wiKSB7XG4gICAgaWYgKGFDaHVuaykge1xuICAgICA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iBpbnB1dCA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgIGlucHV0ID0gdGhpcy5yYXdQYXJzZSAoaW5wdXQpLnNsaWNlIChvZmZzZXQpLm1hcCAoeCA9PiB0aGlzLmV4dHJhY3RFbnRyeU1ldGFkYXRhICh4KSlcbiAgICAgICAgfVxuXG4gICAgLyogIG5ldyBTdGFja1RyYWNleSAoYXJyYXkpICAgICAgKi9cblxuICAgICAgICBpZiAoQXJyYXkuaXNBcnJheSAoaW5wdXQpKSB7XG5cbiAgICAgICAgICAgIGlmIChpc1BhcnNlYWJsZVN5bnRheEVycm9yKSB7XG4gICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgY29uc3QgcmF3TGluZXMgPSBub2RlUmVxdWlyZSAoJ3V0aWwnKS5pbnNwZWN0IChvcmlnaW5hbElucHV0KS5zcGxpdCAoJ1xcbicpXG4gICAgICAgICAgICAgICAgICAgICwgZmlsZUxpbmUgPSByYXdMaW5lc1swXS5zcGxpdCAoJzonKVxuICAgICAgICAgICAgICAgICAgICAsIGxpbmUgPSBmaWxlTGluZS5wb3AgKClcbiAgICAgICAgICAgICAgICAgICAgLCBmaWxlID0gZmlsZUxpbmUuam9pbiAoJzonKVxuXG4gICAgICAgICAgICAgICAgaWYgKGZpbGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaW5wdXQudW5zaGlmdCAoe1xuICAgICAgICAgICAgICAgICAgICAgICAgZmlsZTogbml4U2xhc2hlcyAoZmlsZSksXG4gICAgICAgICAgICAgICAgICAgICAgICBsaW5lOiBsaW5lLFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sdW1uOiAocmF3TGluZXNbMl0gfHwgJycpLmluZGV4T2YgKCdeJykgKyAxLFxuICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlTGluZTogcmF3TGluZXNbMV0sXG4gICAgICAgICAgICAgICAgICAgICAgICBjYWxsZWU6ICcoc3ludGF4IGVycm9yKScsXG4gICAgICAgICAgICAgICAgICAgICAgICBzeW50YXhFcnJvcjogdHJ1ZVxuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhpcy5pdGVtcyA9IGlucHV0XG5cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuaXRlbXMgPSBbXVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZXh0cmFjdEVudHJ5TWV0YWRhdGEgKGUpIHtcblxuICAgICAgICBjb25zdCBkZWNvbXBvc2VkUGF0aCA9IHRoaXMuZGVjb21wb3NlUGF0aCAoZS5maWxlIHx8ICcnKVxuICAgICAgICBjb25zdCBmaWxlUmVsYXRpdmUgPSBkZWNvbXBvc2VkUGF0aFswXVxuICAgICAgICBjb25zdCBleHRlcm5hbERvbWFpbiA9IGRlY29tcG9zZWRQYXRoWzFdXG5cbiAgICAgICAgcmV0dXJuIE8uYXNzaWduIChlLCB7XG5cbiAgICAgICAgICAgIGNhbGxlZVNob3J0OiAgICBlLmNhbGxlZVNob3J0IHx8IGxhc3RPZiAoKGUuY2FsbGVlIHx8ICcnKS5zcGxpdCAoJy4nKSksXG4gICAgICAgICAgICBmaWxlUmVsYXRpdmU6ICAgZmlsZVJlbGF0aXZlLFxuICAgICAgICAgICAgZmlsZVNob3J0OiAgICAgIHRoaXMuc2hvcnRlblBhdGggKGZpbGVSZWxhdGl2ZSksXG4gICAgICAgICAgICBmaWxlTmFtZTogICAgICAgbGFzdE9mICgoZS5maWxlIHx8ICcnKS5zcGxpdCAoJy8nKSksXG4gICAgICAgICAgICB0aGlyZFBhcnR5OiAgICAgdGhpcy5pc1RoaXJkUGFydHkgKGZpbGVSZWxhdGl2ZSwgZXh0ZXJuYWxEb21haW4pICYmICFlLmluZGV4LFxuICAgICAgICAgICAgZXh0ZXJuYWxEb21haW46IGV4dGVybmFsRG9tYWluXG4gICAgICAgIH0pXG4gICAgfVxuXG4gICAgc2hvcnRlblBhdGggKHJlb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Rlcm5hbERvbWFpblxuICAgICAgICBdXG4gICAgfVxuXG4gICAgaXNUaGlyZFBhcnR5IChyZWxhdGl2ZVBhdGgsIGV4dGVybmFsRG9tYWluKSB7XG4gICAgICAgIHJldHVybiBleHRlcm5hbERvbWFpbiB8fFxuICAgICAgICAgICAgICAgKHJlbGF0aXZlUGF0aFswXSA9PT0gJ34nKSAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgLy8gd2VicGFjay1zcGVjaWZpYyBoZXVyaXN0aWNcbiAgICAgICAgICAgICAgIChyZWxhdGl2ZVBhdGhbMF0gPT09ICcvJykgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IC8vIGV4dGVybmFsIHNvdXJjZVxuICAgICAgICAgICAgICAgKHJlbGF0aXZlUGF0aC5pbmRleE9mICgnbm9kZV9tb2R1bGVzJykgICAgICA9PT0gMCkgfHxcbiAgICAgICAgICAgICAgIChyZWxhdGl2ZVBhdGguaW5kZXhPZiAoJ3dlYnBhY2svYm9vdHN0cmFwJykgPT09IDApXG4gICAgfVxuXG4gICAgcmF3UGFyc2UgKHN0cikge1xuXG4gICAgICAgIGNvbnN0IGxpbmVzID0gKHN0ciB8fCAnJykuc3BsaXQgKCdcXG4nKVxuXG4gICAgICAgIGNvbnN0IGVudHJpZXMgPSBsaW5lcy5tYXAgKGxpbmUgPT4ge1xuXG4gICAgICAgICAgICBsaW5lID0gbGluZS50cmltICgpXG5cbiAgICAgICAgICAgIGxldCBjYWxsZWUsIGZpbGVMaW5lQ29sdW1uID0gW10sIG5hdGl2ZSwgcGxhbkEsIHBsYW5CXG5cbiAgICAgICAgICAgIGlmICgocGxhbkEgPSBsaW5lLm1hdGNoICgvYXQgKC4rKSBcXChldmFsIGF0IC4rIFxcKCguKylcXCksIC4rXFwpLykpIHx8IC8vIGV2YWwgY2FsbHNcbiAgICAgICAgICAgICAgICAocGxhbkEgPSBsaW5lLm1hdGNoICgvYXQgKC4rKSBcXCgoLispXFwpLykpIHx8XG4gICAgICAgICAgICAgICAgKChsaW5lLnNsaWNlICgwLCAzKSAhPT0gJ2F0ICcpICYmIChwbGFuQSA9IGxpbmUubWF0Y2ggKC8oLiopQCguKikvKSkpKSB7XG5cbiAgICAgICAgICAgICAgICBjYWxsZWUgICAgICAgICA9ICBwbGFuQVsxXVxuICAgICAgICAgICAgICAgIG5hdGl2ZSAgICAgICAgID0gKHBsYW5BWzJdID09PSAnbmF0aXZlJylcbiAgICAgICAgICAgICAgICBmaWxlTGluZUNvbHVtbiA9IChwbGFuQVsyXS5tYXRjaCAoLyguKik6KFxcZCspOihcXGQrKS8pIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGxhbkFbMl0ubWF0Y2ggKC8oLiopOihcXGQrKS8pIHx8IFtdKS5zbGljZSAoMSlcblxuICAgICAgICAgICAgfSBlbHNlIGlmICgocGxhbkIgPSBsaW5lLm1hdGNoICgvXihhdFxccyspKiguKyk6KFxcZCspOihcXGQrKS8pICkpIHtcbiAgICAgICAgICAgICAgICBmaWxlTGluZUNvbHVtbiA9IChwbGFuQikuc2xpY2UgKDIpXG5cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZFxuICAgICAgICAgICAgfVxuXG4gICAgICAgIC8qICBEZXRlY3QgdGhpbmdzIGxpa2UgQXJyYXkucmVkdWNlXG4gICAgICAgICAgICBUT0RPOiBkZXRlY3QgbW9yZSBidWlsdC1pbiB0eXBlcyAgICAgICAgICAgICovXG4gICAgICAgICAgICBcbiAgICAgICAgICAgIGlmIChjYWxsZWUgJiYgIWZpbGVMaW5lQ29sdW1uWzBdKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgdHlwZSA9IGNhbGxlZS5zcGxpdCAoJy4nKVswXVxuICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSAnQXJyYXknKSB7XG4gICAgICAgICAgICAgICAgICAgIG5hdGl2ZSA9IHRydWVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgYmVmb3JlUGFyc2U6IGxpbmUsXG4gICAgICAgICAgICAgICAgY2FsbGVlOiAgICAgIGNhbGxlZSB8fCAnJyxcbiAgICAgICAgICAgICAgICBpbmRleDogICAgICAgaXNCcm93c2VyICYmIChmaWxlTGluZUNvbHVtblswXSA9PT0gd2luZG93LmxvY2F0aW9uLmhyZWYpLFxuICAgICAgICAgICAgICAgIG5hdGl2ZTogICAgICBuYXRpdmUgfHwgZmFsc2UsXG4gICAgICAgICAgICAgICAgZmlsZTogICAgICAgIG5peFNsYXNoZXMgKGZpbGVMaW5lQ29sdW1uWzBdIHx8ICcnKSxcbiAgICAgICAgICAgICAgICBsaW5lOiAgICAgICAgcGFyc2VJbnQgKGZpbGVMaW5lQ29sdW1uWzFdIHx8ICcnLCAxMCkgfHwgdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAgIGNvbHVtbjogICAgICBwYXJzZUludCAoZmlsZUxpbmVDb2x1bW5bMl0gfHwgJycsIDEwKSB8fCB1bmRlZmluZWRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSlcblxuICAgICAgICByZXR1cm4gZW50cmllcy5maWx0ZXIgKHggPT4gKHggIT09IHVuZGVmaW5lZCkpXG4gICAgfVxuXG4gICAgd2l0aFNvdXJjZUF0IChpKSB7XG4gICAgICAgIHJldHVybiB0aGlzLml0ZW1zW2ldICYmIHRoaXMud2l0aFNvdXJjZSAodGhpcy5pdGVtc1tpXSlcbiAgICB9XG5cbiAgICB3aXRoU291cmNlQXN5bmNBdCAoaSkge1xuICAgICAgICByZXR1cm4gdGhpcy5pdGVtc1tpXSAmJiB0aGlzLndpdGhTb3VyY2VBc3luYyAodGhpcy5pdGVtc1tpXSlcbiAgICB9XG5cbiAgICB3aXRoU291cmNlIChsb2MpIHtcbiAgICAgICAgXG4gICAgICAgIGlmICh0aGlzLnNob3VsZFNraXBSZXNvbHZpbmcgKGxvYykpIHtcbiAgICAgICAgICAgIHJldHVybiBsb2NcbiAgICAgICAgICAgIFxuICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICBsZXQgcmVzb2x2ZWQgPSBnZXRTb3VyY2UgKGxvYy5maWxlIHx8ICcnKS5yZXNvbHZlIChsb2MpXG5cbiAgICAgICAgICAgIGlmICghcmVzb2x2ZWQuc291cmNlRmlsZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBsb2NcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHRoaXMud2l0aFNvdXJjZVJlc29sdmVkIChsb2MsIHJlc29sdmVkKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgd2l0aFNvdXJjZUFzeW5jIChsb2MpIHtcblxuICAgICAgICBpZiAodGhpcy5zaG91bGRTa2lwUmVzb2x2aW5nIChsb2MpKSB7XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlIChsb2MpXG4gICAgICAgICAgICBcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBnZXRTb3VyY2UuYXN5bmMgKGxvYy5maWxlIHx8ICcnKVxuICAgICAgICAgICAgICAgICAgICAgICAgLnRoZW4gKHggPT4geC5yZXNvbHZlIChsb2MpKVxuICAgICAgICAgICAgICAgICAgICAgICAgLnRoZW4gKHJlc29sdmVkID0+IHRoaXMud2l0aFNvdXJjZVJlc29sdmVkIChsb2MsIHJlc29sdmVkKSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC5jYXRjaCAoZSA9PiB0aGlzLndpdGhTb3VyY2VSZXNvbHZlZCAobG9jLCB7IGVycm9yOiBlLCBzb3VyY2VMaW5lOiAnJyB9KSlcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHNob3VsZFNraXBSZXNvbHZpbmcgKGxvYykge1xuICAgICAgICByZXR1cm4gbG9jLnNvdXJjZUZpbGUgfHwgbG9jLmVycm9yIHx8IChsb2MuZmlsZSAmJiBsb2MuZmlsZS5pbmRleE9mICgnPCcpID49IDApIC8vIHNraXAgdGhpbmdzIGxpa2UgPGFub255bW91cz4gYW5kIHN0dWZmIHRoYXQgd2FzIGFscmVhZHkgZmV0Y2hlZFxuICAgIH1cblxuICAgIHdpdGhTb3VyY2VSZXNvbHZlZCAobG9jLCByZXNvbHZlZCkge1xuXG4gICAgICAgIGlmIChyZXNvbHZlZC5zb3VyY2VGaWxlICYmICFyZXNvbHZlZC5zb3VyY2VGaWxlLmVycm9yKSB7XG4gICAgICAgICAgICByZXNvbHZlZC5maWxlID0gbml4U2xhc2hlcyAocmVzb2x2ZWQuc291cmNlRmlsZS5wYXRoKVxuICAgICAgICAgICAgcmVzb2x2ZWQgPSB0aGlzLmV4dHJhY3RFbnRyeU1ldGFkYXRhIChyZXNvbHZlZClcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChyZXNvbHZlZC5zb3VyY2VMaW5lLmluY2x1ZGVzICgnLy8gQGhpZGUnKSkge1xuICAgICAgICAgICAgcmVzb2x2ZWQuc291cmNlTGluZSA9IHJlc29sdmVkLnNvdXJjZUxpbmUucmVwbGFjZSAgKCcvLyBAaGlkZScsICcnKVxuICAgICAgICAgICAgcmVzb2x2ZWQuaGlkZSAgICAgICA9IHRydWVcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChyZXNvbHZlZC5zb3VyY2VMaW5lLmluY2x1ZGVzICgnX193ZWJwYWNrX3JlcXVpcmVfXycpIHx8IC8vIHdlYnBhY2stc3BlY2lmaWMgaGV1cmlzdGljc1xuICAgICAgICAgICAgcmVzb2x2ZWQuc291cmNlTGluZS5pbmNsdWRlcyAoJy8qKioqKiovICh7JykpIHtcbiAgICAgICAgICAgIHJlc29sdmVkLnRoaXJkUGFydHkgPSB0cnVlXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gTy5hc3NpZ24gKHsgc291cmNlTGluZTogJycgfSwgbG9jLCByZXNvbHZlZClcbiAgICB9XG5cbiAgICB3aXRoU291cmNlcyAoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLm1hcCAoeCA9PiB0aGlzLndpdGhTb3VyY2UgKHgpKVxuICAgIH1cblxuICAgIHdpdGhTb3VyY2VzQXN5bmMgKCkge1xuICAgICAgICByZXR1cm4gUHJvbWlzZS5hbGwgKHRoaXMuaXRlbXMubWFwICh4ID0+IHRoaXMud2l0aFNvdXJjZUFzeW5jICh4KSkpXG4gICAgICAgICAgICAgICAgICAgICAgLnRoZW4gKGl0ZW1zID0+IG5ldyBTdGFja1RyYWNleSAoaXRlbXMpKVxuICAgIH1cblxuICAgIG1lcmdlUmVwZWF0ZWRMaW5lcyAoKSB7XG4gICAgICAgIHJldHVybiBuZXcgU3RhY2tUcmFjZXkgKFxuICAgICAgICAgICAgcGFydGl0aW9uICh0aGlzLml0ZW1zLCBlID0+IGUuZmlsZSArIGUubGluZSkubWFwIChcbiAgICAgICAgICAgICAgICBncm91cCA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBncm91cC5pdGVtcy5zbGljZSAoMSkucmVkdWNlICgobWVtbywgZW50cnkpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lbW8uY2FsbGVlICAgICAgPSAobWVtby5jYWxsZWUgICAgICB8fCAnPGFub255bW91cz4nKSArICcg4oaSICcgKyAoZW50cnkuY2FsbGVlICAgICAgfHwgJzxhbm9ueW1vdXM+JylcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lbW8uY2FsbGVlU2hvcnQgPSAobWVtby5jYWxsZWVTaG9ydCB8fCAnPGFub255bW91cz4nKSArICcg4oaSICcgKyAoZW50cnkuY2FsbGVlU2hvcnQgfHwgJzxhbm9ueW1vdXM+JylcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtZW1vXG4gICAgICAgICAgICAgICAgICAgIH0sIE8uYXNzaWduICh7fSwgZ3JvdXAuaXRlbXNbMF0pKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGNsZWFuICgpIHtcbiAgICAgICAgY29uc3QgcyA9IHRoaXMud2l0aFNvdXJjZXMgKCkubWVyZ2VSZXBlYXRlZExpbmVzICgpXG4gICAgICAgIHJldHVybiBzLmZpbHRlciAocy5pc0NsZWFuLmJpbmQgKHMpKVxuICAgIH1cblxuICAgIGNsZWFuQXN5bmMgKCkge1xuICAgICAgICByZXR1cm4gdGhpcy53aXRoU291cmNlc0FzeW5jICgpLnRoZW4gKHMgPT4ge1xuICAgICAgICAgICAgcyA9IHMubWVyZ2VSZXBlYXRlZExpbmVzICgpXG4gICAgICAgICAgICByZXR1cm4gcy5maWx0ZXIgKHMuaXNDbGVhbi5iaW5kIChzKSlcbiAgICAgICAgfSlcbiAgICB9XG5cbiAgICBpc0NsZWFuIChlbnRyeSwgaW5kZXgpIHtcbiAgICAgICAgcmV0dXJuIChpbmRleCA9PT0gMCkgfHwgIShlbnRyeS50aGlyZFBhcnR5IHx8IGVudHJ5LmhpZGUgfHwgZW50cnkubmF0aXZlKVxuICAgIH1cblxuICAgIGF0IChpKSB7XG4gICAgICAgIHJldHVybiBPLmFzc2lnbiAoe1xuXG4gICAgICAgICAgICBiZWZvcmVQYXJzZTogJycsXG4gICAgICAgICAgICBjYWxsZWU6ICAgICAgJzw/Pz8+JyxcbiAgICAgICAgICAgIGluZGV4OiAgICAgICBmYWxzZSxcbiAgICAgICAgICAgIG5hdGl2ZTogICAgICBmYWxzZSxcbiAgICAgICAgICAgIGZpbGU6ICAgICAgICAnPD8/Pz4nLFxuICAgICAgICAgICAgbGluZTogICAgICAgIDAsXG4gICAgICAgICAgICBjb2x1bW46ICAgICAgMFxuXG4gICAgICAgIH0sIHRoaXMuaXRlbXNbaV0pXG4gICAgfVxuXG4gICAgYXNUYWJsZSAob3B0cykge1xuXG4gICAgICAgIGNvbnN0IG1heENvbHVtbldpZHRocyA9IChvcHRzICYmIG9wdHMubWF4Q29sdW1uV2lkdGhzKSB8fCB0aGlzLm1heENvbHVtbldpZHRocyAoKVxuXG4gICAgICAgIGNvbnN0IHRyaW1FbmQgICA9IChzLCBuKSA9PiBzICYmICgocy5sZW5ndGggPiBuKSA/IChzLnNsaWNlICgwLCBuLTEpICsgJ+KApicpIDogcykgICBcbiAgICAgICAgY29uc3QgdHJpbVN0YXJ0ID0gKHMsIG4pID0+IHMgJiYgKChzLmxlbmd0aCA+IG4pID8gKCfigKYnICsgcy5zbGljZSAoLShuLTEpKSkgOiBzKVxuXG4gICAgICAgIGNvbnN0IHRyaW1tZWQgPSB0aGlzLm1hcCAoXG4gICAgICAgICAgICBlID0+IFtcbiAgICAgICAgICAgICAgICAoJ2F0ICcgKyB0cmltRW5kIChlLmNhbGxlZVNob3J0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4Q29sdW1uV2lkdGhzLmNhbGxlZSkpLFxuICAgICAgICAgICAgICAgIHRyaW1TdGFydCAoKGUuZmlsZVNob3J0ICYmIChlLmZpbGVTaG9ydCArICc6JyArIGUubGluZSkpIHx8ICcnLCBtYXhDb2x1bW5XaWR0aHMuZmlsZSksXG4gICAgICAgICAgICAgICAgdHJpbUVuZCAoKChlLnNvdXJjZUxpbmUgfHwgJycpLnRyaW0gKCkgfHwgJycpLCAgICAgICAgICAgICAgICAgIG1heENvbHVtbldpZHRocy5zb3VyY2VMaW5lKVxuICAgICAgICAgICAgXVxuICAgICAgICApXG5cbiAgICAgICAgcmV0dXJuIGFzVGFibGUgKHRyaW1tZWQuaXRlbXMpXG4gICAgfVxuXG4gICAgbWF4Q29sdW1uV2lkdGhzICgpIHtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGNhbGxlZTogICAgIDMwLFxuICAgICAgICAgICAgZmlsZTogICAgICAgNjAsXG4gICAgICAgICAgICBzb3VyY2VMaW5lOiA4MFxuICAgICAgICB9XG4gICAgfVxuXG4gICAgc3RhdGljIHJlc2V0Q2FjaGUgKCkge1xuXG4gICAgICAgIGdldFNvdXJjZS5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CAoZW50cnkpIH0gfSwgW1xuICAgICAgICAgICAgICAgIGggKCcuZmlsZScsIGggKCdzdHJvbmcnLCBmaWxlU2hvcnQpKSxcbiAgICAgICAgICAgICAgICBoICgnLmxpbmVzJyArIChvbkxhc3RMaW5lID8gJy5uby1mYWRlJyA6ICcnKSwgbGluZXMubGVuZ3RoXG4gICAgICAgICAgICAgICAgICAgID8gbGluZXMubWFwICgodGV4dCwgaSkgPT4gaCAoJy5saW5lJyArICgoaSA9PT0gaGlsaUluZGV4KSA/ICcubGluZS1oaWxpJyA6ICcnKSwgW1xuICAgICAgICAgICAgICAgICAgICAgICAgaCAoJ3NwYW4ubGluZS1udW1iZXInLCBTdHJpbmcgKHN0YXJ0ICsgaSArIDEpLnBhZFN0YXJ0IChsaW5lTnVtYmVyV2lkdGgsICcgJykpLFxuICAgICAgICAgICAgICAgICAgICAgICAgaCAoJ3NwYW4ubGluZS10ZXh0JywgKGkgPT09IGhpbGlJbmRleCkgPyByZW5kZXJIaWdobGlnaHRlZExpbmUgKHRleHQsIGNvbHVtbiwgaGlsaU1zZykgOiB0ZXh0KVxuICAgICAgICAgICAgICAgICAgICBdKSlcbiAgICAgICAgICAgICAgICAgICAgOiBbaCAoJy5saW5lJywgW1xuICAgICAgICAgICAgICAgICAgICAgICAgaCAoJ3NwYW4ubGluZS1udW1iZXInLCBTdHJpbmcgKGxpbmUpKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGggKCdzcGFuLmxpbmUtdGV4dC5uby1zb3VyY2UnLCBg4oCmIHNvbWV3aGVyZSBhdCAke2NhbGxlZVNob3J0ID8gKGNhbGxlZVNob3J0ICsgJygpJykgOiAnPz8/J30g4oCmYCksXG4gICAgICAgICAgICAgICAgICAgIF0pXVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIF0pXG59XG5cbmZ1bmN0aW9uIHJlbmRlckhpZ2hsaWdodGVkTGluZSAodGV4dCwgY29sdW1uLCBtc2cpIHtcblxuICAgIGNvbnN0IFt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WVzc2FnZSlcblxuICAgIGNvbnN0IGVsID0gaCAoJy5lcnJvcicsIHsgX2luZGV4VGV4dDogaW5kZXhUZXh0IH0sIFtcbiAgICAgICAgICAgICAgICAgICAgaCAoJy5lcnJvci10aXRsZScsIFtcbiAgICAgICAgICAgICAgICAgICAgICAgIGggKCdzcGFuLmVycm9yLXR5cGUnLCBbdHlwZSwgaCAoJ3NwYW4uZXJyb3ItY291bnRlcicsIHsgc3R5bGU6ICdkaXNwbGF5OiBub25lOycgfSldKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGggKCdzcGFuLmVycm9yLW1lc3NhZ2UnLCBtc2cpLFxuICAgICAgICAgICAgICAgICAgICBdKSxcbiAgICAgICAgICAgICAgICAgICAgaCAoJy5lcnJvci1zdGFjaycsIFtcbiAgICAgICAgICAgICAgICAgICAgICAgIC4uLnN0YWNrLml0ZW1zLm1hcCAoKGUsIGkpID0+IHJlbmRlclN0YWNrRW50cnkgKGUsIGksIG1zZykpLFxuICAgICAgICAgICAgICAgICAgICAgICAgaCAoJy5tb3JlJywgaCAoJ2VtJywgeyBvbmNsaWNrOiBzaG93TW9yZSB9LCAnc2hvdyBtb3JlJykpXG4gICAgICAgICAgICAgICAgICAgIF0pXG4gICAgICAgICAgICAgICAgXSlcblxuICAgIGlmICghc3RhY2suaXRlbXMuZmluZCAoc2hvdWxkSGlkZUVudHJ5KSkgc2hvd01vcmUgKCkgLy8gaGlkZXMgXCJzaG93IG1vcmVcIiBpZiBub3RoaW5nIHRvIHNob3dcblxuICAgIGVycm9ycy5pbnNlcnRCZWZvcmUgKGVsLCBlcnJvcnMuZmlyc3RDaGlsZClcbiAgICBpZiAoZXJyb3JzLmNoaWxkRWxlbWVudENvdW50ID4gMTApIGVycm9ycy5sYXN0Q2hpbGQucmVtb3ZlICgpIC8vIHByZXZlbnRzIGhhbmcgaW4gY2FzZSBvZiB2YXN0IG51bWJlciBvZiBlcnJvcnNcblxuICAgIHRvZ2dsZSAodHJ1ZSlcblxu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9XG5cbndpbmRvdy5hZGRFdmVudExpc3RlbmVyICgnZXJyb3InLCAgICAgICAgICAgICAgZSA9PiBvblVuY2F1Z2h0RXJyb3IgKGUuZXJyb3IpKVxud2luZG93LmFkZEV2ZW50TGlzdGVuZXIgKCd1bmhhbmRsZWRyZWplY3Rpb24nLCBlID0+IG9uVW5jYXVnaHRFcnJvciAoZS5yZWFzb24pKVxuXG47KGZ1bmN0aW9uIG9uUmVhZHkgKGZuKSB7XG5cbiAgICBpZiAoZG9jdW1lbnQuYm9keSkgZm4gKClcbiAgICBlbHNlIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIgKCdET01Db250ZW50TG9hZGVkJywgZm4pXG5cbn0pICgoKSA9PiB7IHRvZ2dsZSAodmlzaWJsZSkgfSlcblxuLyogIEVYUE9SVCAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSAgICAqL1xuXG5wYW5pYy50b2dnbGUgICAgPSB0b2dnbGVcbnBhbmljLmNvbmZpZ3VyZSA9IGZ1bmN0aW9uIGNvbmZpZ3VyZSAoY2ZnKSB7IGFzc2lnbiAoY29uZmlnLCBkZWZhdWx0Q29uZmlnLCBjZmcpOyByZXR1cm4gcGFuaWMgfVxuXG5leHBvcnQgZGVmYXVsdCBwYW5pY1xuIl19 diff --git a/package-lock.json b/package-lock.json index be8ac25..b3f0bc9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7554,9 +7554,9 @@ "integrity": "sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw==" }, "get-source": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.11.tgz", - "integrity": "sha512-3ep0eeCGsW2jTd1IByqtszqGq6xHDeoN8T7HgYJfcAMOxvjKpR6er1tWzHMwjyiqChC84Ov31pkMMJZiQ97rFg==", + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz", + "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==", "requires": { "data-uri-to-buffer": "^2.0.0", "source-map": "^0.6.1" @@ -11710,12 +11710,12 @@ "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==" }, "stacktracey": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.6.tgz", - "integrity": "sha512-NbyZDM7WA/UkRuKA2Kob20Dgybdj6EaTrZe/vNFF+c5dzDfBNIXfeRF2s6z3DDF8yKldKJ44VdlK9TLmJ0sjyQ==", + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.7.tgz", + "integrity": "sha512-/w8uiORLKmSndIoXcrs09yAfwr34rMpToeXageRKM2a5UhNOLLp1Iag6UP7O0IOYd7zDLNQVOUYHruXmK5dv0w==", "requires": { "as-table": "^1.0.36", - "get-source": "^2.0.11" + "get-source": "^2.0.12" } }, "static-extend": { diff --git a/package.json b/package.json index d294a2a..5133b64 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,6 @@ }, "dependencies": { "parcel": "^2.0.0-beta.1", - "stacktracey": "^2.1.6" + "stacktracey": "^2.1.7" } }