diff --git a/dist/1d220cf9da36861171fa90d3c164f4d3.svg b/dist/1d220cf9da36861171fa90d3c164f4d3.svg deleted file mode 100644 index 7caded30..00000000 --- a/dist/1d220cf9da36861171fa90d3c164f4d3.svg +++ /dev/null @@ -1,2564 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dist/1fd3de3f0eae964fc3b8c13a4fab42b6.woff b/dist/1fd3de3f0eae964fc3b8c13a4fab42b6.woff deleted file mode 100644 index 53fa3555..00000000 Binary files a/dist/1fd3de3f0eae964fc3b8c13a4fab42b6.woff and /dev/null differ diff --git a/dist/3bd0b15a9af4b9d737b7c06c53b57568.svg b/dist/3bd0b15a9af4b9d737b7c06c53b57568.svg deleted file mode 100644 index 492cff26..00000000 --- a/dist/3bd0b15a9af4b9d737b7c06c53b57568.svg +++ /dev/null @@ -1,1175 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dist/3cd80df0f3d51118fe6a0d5861ade8bb.eot b/dist/3cd80df0f3d51118fe6a0d5861ade8bb.eot deleted file mode 100644 index 5a5dbdfa..00000000 Binary files a/dist/3cd80df0f3d51118fe6a0d5861ade8bb.eot and /dev/null differ diff --git a/dist/448c34a56d699c29117adc64c43affeb.woff2 b/dist/448c34a56d699c29117adc64c43affeb.woff2 deleted file mode 100644 index 64539b54..00000000 Binary files a/dist/448c34a56d699c29117adc64c43affeb.woff2 and /dev/null differ diff --git a/dist/554f4f0aa372f88f0dfb3d1b129b3a40.woff2 b/dist/554f4f0aa372f88f0dfb3d1b129b3a40.woff2 deleted file mode 100644 index 036d4ff7..00000000 Binary files a/dist/554f4f0aa372f88f0dfb3d1b129b3a40.woff2 and /dev/null differ diff --git a/dist/7210218d8bc8295fc92416c22864d359.ttf b/dist/7210218d8bc8295fc92416c22864d359.ttf deleted file mode 100644 index 5d82cb72..00000000 Binary files a/dist/7210218d8bc8295fc92416c22864d359.ttf and /dev/null differ diff --git a/dist/89889688147bd7575d6327160d64e760.svg b/dist/89889688147bd7575d6327160d64e760.svg deleted file mode 100644 index 94fb5490..00000000 --- a/dist/89889688147bd7575d6327160d64e760.svg +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dist/8edbef6af175c4c78e9912f766e9e0dd.eot b/dist/8edbef6af175c4c78e9912f766e9e0dd.eot deleted file mode 100644 index 5becac23..00000000 Binary files a/dist/8edbef6af175c4c78e9912f766e9e0dd.eot and /dev/null differ diff --git a/dist/946f7400d254b08b8ca19c8a70ade0e2.woff2 b/dist/946f7400d254b08b8ca19c8a70ade0e2.woff2 deleted file mode 100644 index 61130cfb..00000000 Binary files a/dist/946f7400d254b08b8ca19c8a70ade0e2.woff2 and /dev/null differ diff --git a/dist/94eef589e0a57d1ff4b07bb49d46dac2.ttf b/dist/94eef589e0a57d1ff4b07bb49d46dac2.ttf deleted file mode 100644 index 1046ac42..00000000 Binary files a/dist/94eef589e0a57d1ff4b07bb49d46dac2.ttf and /dev/null differ diff --git a/dist/b4b673c246336df8fc6563226407dfdb.woff2 b/dist/b4b673c246336df8fc6563226407dfdb.woff2 deleted file mode 100644 index d1b3f706..00000000 Binary files a/dist/b4b673c246336df8fc6563226407dfdb.woff2 and /dev/null differ diff --git a/dist/b5a61b229c9c92a6ac21f5b0e3c6e9f1.svg b/dist/b5a61b229c9c92a6ac21f5b0e3c6e9f1.svg deleted file mode 100644 index 00858433..00000000 --- a/dist/b5a61b229c9c92a6ac21f5b0e3c6e9f1.svg +++ /dev/null @@ -1,467 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dist/cb899fd0c9ee53f4029c748a9cc8a51a.woff b/dist/cb899fd0c9ee53f4029c748a9cc8a51a.woff deleted file mode 100644 index c45522d2..00000000 Binary files a/dist/cb899fd0c9ee53f4029c748a9cc8a51a.woff and /dev/null differ diff --git a/dist/cc73e8d1fd1960c91502ca9a637f4315.eot b/dist/cc73e8d1fd1960c91502ca9a637f4315.eot deleted file mode 100644 index 6c1d989b..00000000 Binary files a/dist/cc73e8d1fd1960c91502ca9a637f4315.eot and /dev/null differ diff --git a/dist/d9e91b320c59f22e543f41d641639375.ttf b/dist/d9e91b320c59f22e543f41d641639375.ttf deleted file mode 100644 index 69c2bea5..00000000 Binary files a/dist/d9e91b320c59f22e543f41d641639375.ttf and /dev/null differ diff --git a/dist/e18bbf611f2a2e43afc071aa2f4e1512.ttf b/dist/e18bbf611f2a2e43afc071aa2f4e1512.ttf deleted file mode 100644 index 1413fc60..00000000 Binary files a/dist/e18bbf611f2a2e43afc071aa2f4e1512.ttf and /dev/null differ diff --git a/dist/f4769f9bdb7466be65088239c12046d1.eot b/dist/f4769f9bdb7466be65088239c12046d1.eot deleted file mode 100644 index b93a4953..00000000 Binary files a/dist/f4769f9bdb7466be65088239c12046d1.eot and /dev/null differ diff --git a/dist/fa2772327f55d8198301fdb8bcfc8158.woff b/dist/fa2772327f55d8198301fdb8bcfc8158.woff deleted file mode 100644 index 9e612858..00000000 Binary files a/dist/fa2772327f55d8198301fdb8bcfc8158.woff and /dev/null differ diff --git a/dist/fc99cf2991bfb604dd5c939f0766273f.woff b/dist/fc99cf2991bfb604dd5c939f0766273f.woff deleted file mode 100644 index 8b1cde91..00000000 Binary files a/dist/fc99cf2991bfb604dd5c939f0766273f.woff and /dev/null differ diff --git a/dist/main.bundle.js b/dist/main.bundle.js index 7ffe5b61..3e8f1676 100644 --- a/dist/main.bundle.js +++ b/dist/main.bundle.js @@ -10714,135 +10714,57 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); __WEBPACK_IMPORTED_MODULE_0_jquery___default()(function () { - - __WEBPACK_IMPORTED_MODULE_0_jquery___default()("#myInput").on("keyup", function(eventObject) { + + setInterval(function() { + var timeleft = parseInt(__WEBPACK_IMPORTED_MODULE_0_jquery___default()("#timeleft").html()); + timeleft--; + __WEBPACK_IMPORTED_MODULE_0_jquery___default()("#timeleft").html(timeleft) + }, 1000*60); - var input, filter, ul, li, a, i; + __WEBPACK_IMPORTED_MODULE_0_jquery___default()("#myInput").on("keyup", function(eventObject) { + + var input, filter, ul, li, a, i; - input = eventObject.currentTarget; - filter = input.value.toUpperCase(); - ul = document.getElementById("myUL"); - li = ul.getElementsByTagName('a'); + input = eventObject.currentTarget; + filter = input.value.toUpperCase(); + ul = document.getElementById("myUL"); + li = ul.getElementsByTagName('a'); - // Loop through all list items, and hide those who don't match the search query - for (i = 0; i < li.length; i++) { - a = li[i]; //li[i].getElementsByTagName("a")[0]; - if (a.innerHTML.toUpperCase().indexOf(filter) > -1) { - li[i].style.display = ""; - } else { - li[i].style.display = "none"; - } - } - - }); - - function checkUsernameInputHandler(eventObject) { - var input_el = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(eventObject.currentTarget); - var data = JSON.stringify({"username": input_el.val()}); - var url = `/teachers/check_username/${input_el.val()}` - - __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.post( - url, - data, - function(result) { - if (result.exists) { - console.log("Username exists"); + // Loop through all list items, and hide those who don't match the search query + for (i = 0; i < li.length; i++) { + a = li[i]; //li[i].getElementsByTagName("a")[0]; + if (a.innerHTML.toUpperCase().indexOf(filter) > -1) { + li[i].style.display = ""; + } else { + li[i].style.display = "none"; + } } - }, - "json" - ); - } - function usernameGenerator(eventObject, firstname, surname) { - var input_el = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(eventObject.currentTarget); - input_el.val(firstname+"."+surname); - } - - function deleteRelationHandler(eventObject) { - var url = this.dataset.url; - var modalEl = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#karmen-modal-remove'); - - var el = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this); - - modalEl.modal({backdrop: 'static'}).one('click', '#karmen-modal-btn-confirm', function() { - - __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.ajax({ - url: url, - type: 'DELETE', - success: function(result) { - el.closest(".list-group-item").remove(); - modalEl.modal('hide'); - } - }); - }); - - return false; - }; - function deleteHandler(eventObject) { - var url = this.dataset.url; - var modalEl = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#karmen-modal-remove'); - - var el = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this); + function deleteHandler(eventObject) { + var url = this.dataset.url; + var modalEl = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#karmen-modal-remove'); + + var el = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this); - modalEl.modal({backdrop: 'static'}).one('click', '#karmen-modal-btn-confirm', function() { - - __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.ajax({ - url: url, - type: 'DELETE', - success: function(result) { - modalEl.modal('hide'); - window.location.replace(result.redirect_url); - } - }); - - }); + modalEl.modal({backdrop: 'static'}).one('click', '#karmen-modal-btn-confirm', function() { + + __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.ajax({ + url: url, + type: 'DELETE', + success: function(result) { + modalEl.modal('hide'); + window.location.replace(result.redirect_url); + } + }); + + }); + + return false; + }; - return false; - }; - - __WEBPACK_IMPORTED_MODULE_0_jquery___default()(".ajax-post").on("click", function(eventObject) { - var select_el = __WEBPACK_IMPORTED_MODULE_0_jquery___default()("#"+this.dataset.select).first(); - var listgroup_el = __WEBPACK_IMPORTED_MODULE_0_jquery___default()("#"+this.dataset.listgroup).first(); - var url = this.dataset.url; - var data = JSON.stringify({"ids": select_el.val()}); - - __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.post( - url, - data, - function(result) { - var i; - if (result.elements != null) { - for (i = 0; i < result.elements.length; i++) { - var newItem = ` - - - ${result.elements[i].Name} - - - - `; - __WEBPACK_IMPORTED_MODULE_0_jquery___default()(listgroup_el).append(newItem); - __WEBPACK_IMPORTED_MODULE_0_jquery___default()(".karmen-ajax-delete").on("click", deleteHandler); - } - } - - }, - "json" - ); - - select_el.val('default'); - select_el.selectpicker("refresh"); - - return false; - - }); - - __WEBPACK_IMPORTED_MODULE_0_jquery___default()(".karmen-ajax-delete-relation").on("click", deleteRelationHandler); - __WEBPACK_IMPORTED_MODULE_0_jquery___default()(".karmen-ajax-delete").on("click", deleteHandler); + __WEBPACK_IMPORTED_MODULE_0_jquery___default()(".karmen-ajax-delete").on("click", deleteHandler); }); @@ -26165,4 +26087,4 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ /***/ }) /******/ ]); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAgNjBkMDRjMjNiZThkZWU2YzM3MDEiLCJ3ZWJwYWNrOi8vLy4vbm9kZV9tb2R1bGVzL2pxdWVyeS9kaXN0L2pxdWVyeS5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvaW5kZXguanMiLCJ3ZWJwYWNrOi8vLy4vbm9k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tZSQyLlBPSU5URVJfRVZFTlQpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgJCh0aGlzLl9lbGVtZW50KS5vbihFdmVudCQyLlRPVUNIU1RBUlQsIGZ1bmN0aW9uIChldmVudCkge1xuICAgICAgICAgIHJldHVybiBzdGFydChldmVudCk7XG4gICAgICAgIH0pO1xuICAgICAgICAkKHRoaXMuX2VsZW1lbnQpLm9uKEV2ZW50JDIuVE9VQ0hNT1ZFLCBmdW5jdGlvbiAoZXZlbnQpIHtcbiAgICAgICAgICByZXR1cm4gbW92ZShldmVudCk7XG4gICAgICAgIH0pO1xuICAgICAgICAkKHRoaXMuX2VsZW1lbnQpLm9uKEV2ZW50JDIuVE9VQ0hFTkQsIGZ1bmN0aW9uIChldmVudCkge1xuICAgICAgICAgIHJldHVybiBlbmQoZXZlbnQpO1xuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICB9O1xuXG4gICAgX3Byb3RvLl9rZXlkb3duID0gZnVuY3Rpb24gX2tleWRvd24oZXZlbnQpIHtcbiAgICAgIGlmICgvaW5wdXR8dGV4dGFyZWEvaS50ZXN0KGV2ZW50LnRhcmdldC50YWdOYW1lKSkge1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIHN3aXRjaCAoZXZlbnQud2hpY2gpIHtcbiAgICAgICAgY2FzZSBBUlJPV19MRUZUX0tFWUNPREU6XG4gICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICB0aGlzLnByZXYoKTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIEFSUk9XX1JJR0hUX0tFWUNPREU6XG4gICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICB0aGlzLm5leHQoKTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBkZWZhdWx0OlxuICAgICAgfVxuICAgIH07XG5cbiAgICBfcHJvdG8uX2dldEl0ZW1JbmRleCA9IGZ1bmN0aW9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VtZW50KCksXG4gICAgICAgIG1vZGlmaWVyczoge1xuICAgICAgICAgIG9mZnNldDogdGhpcy5fZ2V0T2Zmc2V0KCksXG4gICAgICAgICAgZmxpcDoge1xuICAgICAgICAgICAgZW5hYmxlZDogdGhpcy5fY29uZmlnLmZsaXBcbiAgICAgICAgICB9LFxuICAgICAgICAgIHByZXZlbnRPdmVyZmxvdzoge1xuICAgICAgICAgICAgYm91bmRhcmllc0VsZW1lbnQ6IHRoaXMuX2NvbmZpZy5ib3VuZGFyeVxuICAgICAgICAgIH1cbiAgICAgICAgfSAvLyBEaXNhYmxlIFBvcHBlci5qcyBpZiB3ZSBoYXZlIGEgc3RhdGljIGRpc3BsYXlcblxuICAgICAgfTtcblxuICAgICAgaWYgKHRoaXMuX2NvbmZpZy5kaXNwbGF5ID09PSAnc3RhdGljJykge1xuICAgICAgICBwb3BwZXJDb25maWcubW9kaWZpZXJzLmFwcGx5U3R5bGUgPSB7XG4gICAgICAgICAgZW5hYmxlZDogZmFsc2VcbiAgICAgICAgfTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHBvcHBlckNvbmZpZztcbiAgICB9IC8vIFN0YXRpY1xuICAgIDtcblxuICAgIERyb3Bkb3duLl9qUXVlcnlJbnRlcmZhY2UgPSBmdW5jdGlvbiBfalF1ZXJ5SW50ZXJmYWNlKGNvbmZpZykge1xuICAgICAgcmV0dXJuIHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7XG4gICAgICAgIHZhciBkYXRhID0gJCh0aGlzKS5kYXRhKERBVEFfS0VZJDQpO1xuXG4gICAgICAgIHZhciBfY29uZmlnID0gdHlwZW9mIGNvbmZpZyA9PT0gJ29iamVjdCcgPyBjb25maWcgOiBudWxsO1xuXG4gICAgICAgIGlmICghZGF0YSkge1xuICAgICAgICAgIGRhdGEgPSBuZXcgRHJvcGRvd24odGhpcywgX2NvbmZpZyk7XG4gICAgICAgICAgJCh0aGlzKS5kYXRhKERBVEFfS0VZJDQsIGRhdGEpO1x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lmICh0aGlzLl9pc1Nob3duICYmIHRoaXMuX2NvbmZpZy5iYWNrZHJvcCkge1xuICAgICAgICB0aGlzLl9iYWNrZHJvcCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpO1xuICAgICAgICB0aGlzLl9iYWNrZHJvcC5jbGFzc05hbWUgPSBDbGFzc05hbWUkNS5CQUNLRFJPUDtcblxuICAgICAgICBpZiAoYW5pbWF0ZSkge1xuICAgICAgICAgIHRoaXMuX2JhY2tkcm9wLmNsYXNzTGlzdC5hZGQoYW5pbWF0ZSk7XG4gICAgICAgIH1cblxuICAgICAgICAkKHRoaXMuX2JhY2tkcm9wKS5hcHBlbmRUbyhkb2N1bWVudC5ib2R5KTtcbiAgICAgICAgJCh0aGlzLl9lbGVtZW50KS5vbihFdmVudCQ1LkNMSUNLX0RJU01JU1MsIGZ1bmN0aW9uIChldmVudCkge1xuICAgICAgICAgIGlmIChfdGhpczguX2lnbm9yZUJhY2tkcm9wQ2xpY2spIHtcbiAgICAgICAgICAgIF90aGlzOC5faWdub3JlQmFja2Ryb3BDbGljayA9IGZhbHNlO1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChldmVudC50YXJnZXQgIT09IGV2ZW50LmN1cnJlbnRUYXJnZXQpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoX3RoaXM4Ll9jb25maWcuYmFja2Ryb3AgPT09ICdzdGF0aWMnKSB7XG4gICAgICAgICAgICBfdGhpczguX2VsZW1lbnQuZm9jdXMoKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgX3RoaXM4LmhpZGUoKTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGlmIChhbmltYXRlKSB7XG4gICAgICAgICAgVXRpbC5yZWZsb3codGhpcy5fYmFja2Ryb3ApO1xuICAgICAgICB9XG5cbiAgICAgIC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Blb2YgY29udGVudCA9PT0gJ29iamVjdCcgJiYgKGNvbnRlbnQubm9kZVR5cGUgfHwgY29udGVudC5qcXVlcnkpKSB7XG4gICAgICAgIC8vIENvbnRlbnQgaXMgYSBET00gbm9kZSBvciBhIGpRdWVyeVxuICAgICAgICBpZiAodGhpcy5jb25maWcuaHRtbCkge1xuICAgICAgICAgIGlmICghJChjb250ZW50KS5wYXJlbnQoKS5pcygkZWxlbWVudCkpIHtcbiAgICAgICAgICAgICRlbGVtZW50LmVtcHR5KCkuYXBwZW5kKGNvbnRlbnQpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAkZWxlbWVudC50ZXh0KCQoY29udGVudCkudGV4dCgpKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgaWYgKHRoaXMuY29uZmlnLmh0bWwpIHtcbiAgICAgICAgaWYgKHRoaXMuY29uZmlnLnNhbml0aXplKSB7XG4gICAgICAgICAgY29udGVudCA9IHNhbml0aXplSHRtbChjb250ZW50LCB0aGlzLmNvbmZpZy53aGl0ZUxpc3QsIHRoaXMuY29uZmlnLnNhbml0aXplRm4pO1xuICAgICAgICB9XG5cbiAgICAgICAgJGVsZW1lbnQuaHRtbChjb250ZW50KTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgICRlbGVtZW50LnRleHQoY29udGVudCk7XG4gICAgICB9XG4gICAgfTtcblxuICAgIF9wcm90by5nZXRUaXRsZSA9IGZ1bmN0aW9uIGdldFRpdGxlKCkge1xuICAgICAgdmFyIHRpdGxlID0gdGhpcy5lbGVtZW50LmdldEF0dHJpYnV0ZSgnZGF0YS1vcmlnaW5hbC10aXRsZScpO1xuXG4gICAgICBpZiAoIXRpdGxlKSB7XG4gICAgICAgIHRpdGxlID0gdHlwZW9mIHRoaXMuY29uZmlnLnRpdGxlID09PSAnZnVuY3Rpb24nID8gdGhpcy5jb25maWcudGl0bGUuY2FsbCh0aGlz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SG92ZXJTdGF0ZS5TSE9XO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIGNsZWFyVGltZW91dChjb250ZXh0Ll90aW1lb3V0KTtcbiAgICAgIGNvbnRleHQuX2hvdmVyU3RhdGUgPSBIb3ZlclN0YXRlLlNIT1c7XG5cbiAgICAgIGlmICghY29udGV4dC5jb25maWcuZGVsYXkgfHwgIWNvbnRleHQuY29uZmlnLmRlbGF5LnNob3cpIHtcbiAgICAgICAgY29udGV4dC5zaG93KCk7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgY29udGV4dC5fdGltZW91dCA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICBpZiAoY29udGV4dC5faG92ZXJTdGF0ZSA9PT0gSG92ZXJTdGF0ZS5TSE9XKSB7XG4gICAgICAgICAgY29udGV4dC5zaG93KCk7XG4gICAgICAgIH1cbiAgICAgIH0sIGNvbnRleHQuY29uZmlnLmRlbGF5LnNob3cpO1xuICAgIH07XG5cbiAgICBfcHJvdG8uX2xlYXZlID0gZnVuY3Rpb24gX2xlYXZlKGV2ZW50LCBjb250ZXh0KSB7XG4gICAgICB2YXIgZGF0YUtleSA9IHRoaXMuY29uc3RydWN0b3IuREFUQV9LRVk7XG4gICAgICBjb250ZXh0ID0gY29udGV4dCB8fCAkKGV2ZW50LmN1cnJlbnRUYXJnZXQpLmRhdGEoZGF0YUtleSk7XG5cbiAgICAgIGlmICghY29udGV4dCkge1xuICAgICAgICBjb250ZXh0ID0gbmV3IHRoaXMuY29uc3RydWN0b3IoZXZlbnQuY3VycmVudFRhcmdldCwgdGhpcy5fZ2V0RGVsZWdhdGVDb25maWcoKSk7XG4gICAgICAgICQoZXZlbnQuY3VycmVudFRhcmdldCkuZGF0YShkYXRhS2V5LCBjb250ZXh0KTtcbiAgICAgIH1cblxuICAgICAgaWYgKGV2ZW50KSB7XG4gICAgICAgIGNvbnRleHQuX2FjdGl2ZVRyaWdnZXJbZ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MlxyXG4gIGlmICghKCdjbGFzc0xpc3QnIGluIGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ18nKSkpIHtcclxuICAgIChmdW5jdGlvbiAodmlldykge1xyXG4gICAgICBpZiAoISgnRWxlbWVudCcgaW4gdmlldykpIHJldHVybjtcclxuXHJcbiAgICAgIHZhciBjbGFzc0xpc3RQcm9wID0gJ2NsYXNzTGlzdCcsXHJcbiAgICAgICAgICBwcm90b1Byb3AgPSAncHJvdG90eXBlJyxcclxuICAgICAgICAgIGVsZW1DdHJQcm90byA9IHZpZXcuRWxlbWVudFtwcm90b1Byb3BdLFxyXG4gICAgICAgICAgb2JqQ3RyID0gT2JqZWN0LFxyXG4gICAgICAgICAgY2xhc3NMaXN0R2V0dGVyID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgJGVsZW0gPSAkKHRoaXMpO1xyXG5cclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICBhZGQ6IGZ1bmN0aW9uIChjbGFzc2VzKSB7XHJcbiAgICAgICAgICAgICAgICBjbGFzc2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKS5qb2luKCcgJyk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJGVsZW0uYWRkQ2xhc3MoY2xhc3Nlcyk7XHJcbiAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uIChjbGFzc2VzKSB7XHJcbiAgICAgICAgICAgICAgICBjbGFzc2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKS5qb2luKCcgJyk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJGVsZW0ucmVtb3ZlQ2xhc3MoY2xhc3Nlcyk7XHJcbiAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICB0b2dnbGU6IGZ1bmN0aW9uIChjbGFzc2VzLCBmb3JjZSkge1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1xyXG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICB9O1xyXG4gICAgICBpZiAoZGVmaW5lUHJvcGVydHkpIHtcclxuICAgICAgICBkZWZpbmVQcm9wZXJ0eShTdHJpbmcucHJvdG90eXBlLCAnc3RhcnRzV2l0aCcsIHtcclxuICAgICAgICAgICd2YWx1ZSc6IHN0YXJ0c1dpdGgsXHJcbiAgICAgICAgICAnY29uZmlndXJhYmxlJzogdHJ1ZSxcclxuICAgICAgICAgICd3cml0YWJsZSc6IHRydWVcclxuICAgICAgICB9KTtcclxuICAgICAgfSBlbHNlIHtcclxuICAgICAgICBTdHJpbmcucHJvdG90eXBlLnN0YXJ0c1dpdGggPSBzdGFydHNXaXRoO1xyXG4gICAgICB9XHJcbiAgICB9KCkpO1xyXG4gIH1cclxuXHJcbiAgaWYgKCFPYmplY3Qua2V5cykge1xyXG4gICAgT2JqZWN0LmtleXMgPSBmdW5jdGlvbiAoXHJcbiAgICAgIG8sIC8vIG9iamVjdFxyXG4gICAgICBrLCAvLyBrZXlcclxuICAgICAgciAgLy8gcmVzdWx0IGFycmF5XHJcbiAgICApIHtcclxuICAgICAgLy8gaW5pdGlhbGl6ZSBvYmplY3QgYW5kIHJlc3VsdFxyXG4gICAgICByID0gW107XHJcbiAgICAgIC8vIGl0ZXJhdGUgb3ZlciBvYmplY3Qga2V5c1xyXG4gICAgICBmb3IgKGsgaW4gbykge1xyXG4gICAgICAgIC8vIGZpbGwgcmVzdWx0IGFycmF5IHdpdGggbm9uLXByb3RvdHlwaWNhbCBrZXlzXHJcbiAgICAgICAgci5oYXNPd25Qcm9wZXJ0eS5jYWxsKG8sIGspICYmIHIucHVzaChrKTtcclxuICAgICAgfVxyXG4gICAgICAvLyByZXR1cm4gcmVzdWx0XHJcbiAgICAgIHJldHVybiByO1xyXG4gICAgfTtcclxuICB9XHJcblxyX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7XHJcbiAgICAgICAgICAgICAgLy8gaWYgc2VsZWN0IGlzIG5vIGxvbmdlciBpbnZhbGlkLCByZW1vdmUgdGhlIGJzLWludmFsaWQgY2xhc3NcclxuICAgICAgICAgICAgICBpZiAodGhpcy52YWxpZGl0eS52YWxpZCkgdGhhdC4kYnV0dG9uWzBdLmNsYXNzTGlzdC5yZW1vdmUoJ2JzLWludmFsaWQnKTtcclxuICAgICAgICAgICAgICB0aGF0LiRlbGVtZW50Lm9mZigncmVuZGVyZWQnICsgRVZFTlRfS0VZKTtcclxuICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgdGhhdC4kYnV0dG9uLm9uKCdibHVyJyArIEVWRU5UX0tFWSwgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB0aGF0LiRlbGVtZW50LnRyaWdnZXIoJ2ZvY3VzJykudHJpZ2dlcignYmx1cicpO1xyXG4gICAgICAgICAgICB0aGF0LiRidXR0b24ub2ZmKCdibHVyJyArIEVWRU5UX0tFWSk7XHJcbiAgICAgICAgICB9KTtcclxuICAgICAgICB9KTtcclxuICAgICAgfVxyXG5cclxuICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgdGhhdC5jcmVhdGVMaSgpO1xyXG4gICAgICAgIHRoYXQuJGVsZW1lbnQudHJpZ2dlcignbG9hZGVkJyArIEVWRU5UX0tFWSk7XHJcbiAgICAgIH0pO1xyXG4gICAgfSxcclxuXHJcbiAgICBjcmVhdGVEcm9wZG93bjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAvLyBPcHRpb25zXHJcbiAgICAgIC8vIElmIHdlIGFyZSBtdWx0aXBsZSBvciBzaG93VGljayBvcHRpb24gaXMgc2V0LCB0aGVuIGFkZCB0aGUgc2hvdy10aWNrIGNsYXNzXHJcbiAgICAgIHZhciBzaG93VGljayA9ICh0aGlzLm11bHRpcGxlIHx8IHRoaXMub3B0aW9ucy5zaG93VGljaykgPyAnIHNob3ctdGlja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ArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5zZWxlY3RBbGxUZXh0ICtcclxuICAgICAgICAgICAgICAnPC9idXR0b24+JyArXHJcbiAgICAgICAgICAgICAgJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwiYWN0aW9ucy1idG4gYnMtZGVzZWxlY3QtYWxsIGJ0biAnICsgY2xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5kZXNlbGVjdEFsbFRleHQgK1xyXG4gICAgICAgICAgICAgICc8L2J1dHRvbj4nICtcclxuICAgICAgICAgICAgJzwvZGl2PicgK1xyXG4gICAgICAgICAgJzwvZGl2Pic7XHJcbiAgICAgIH1cclxuXHJcbiAgICAgIGlmICh0aGlzLm11bHRpcGxlICYmIHRoaXMub3B0aW9ucy5kb25lQnV0dG9uKSB7XHJcbiAgICAgICAgZG9uZWJ1dHRvbiA9XHJcbiAgICAgICAgICAnPGRpdiBjbGFzcz1cImJzLWRvbmVidXR0b25cIj4nICtcclxuICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJidG4tZ3JvdXAgYnRuLWJsb2NrXCI+JyArXHJcbiAgICAgICAgICAgICAgJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwiYnRuIGJ0bi1zbSAnICsgY2xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5kb25lQnV0dG9uVGV4dCArXHJcbiAgICAgICAgICAgICAgJzwvYnV0dG9uPicgK1xyXG4gICAgICAgICAgICAnPC9kaXY+JyArXHJcbiAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgfVxyXG5cclxuICAgICAgZHJvcCA9XHJcbiAgICAgICAgJzxkaXYgY2xhc3M9XCJkcm9wZG93biBib290c3RyYXAtc2VsZWN0JyArIHNob3dUaWNrICsgaW5wdXRHcm91cCArICdcIj4nICtcclxuICAgICAgICAgICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cIicgKyB0aGlzLm9wdGlvbnMuc3R5bGVCYXNlICsgJyBkcm9wZG93bi10b2dnbGVcIiAnICsgKHRoaXMub3B0aW9ucy5kaXNwbGF5ID09PSAnc3RhdGljJyA/ICdkYXRhLWRpc3BsYXk9XCJzdGF0aWNcIicgOiAnJykgKyAnZGF0YS10b2dnbGU9XCJkcm9wZG93blwiJyArIGF1dG9mb2N1cyArICcgcm9sZT1cImNvbWJvYm94XCIgYXJpYS1vd25zPVwiJyArIHRoaXMuc2VsZWN0SWQgKyAnXCIgYXJpYS1oYXNwb3B1cD1cImxpc3Rib3hcIiBhcmlhLWV4cGFuZGVkPVwiZmFsc2VcIj4nICtcclxuICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJmaWx0ZXItb3B0aW9uXCI+JyArXHJcbiAgICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJmaWx0ZXItb3B0aW9uLWlubmVyXCI+JyArXHJcbiAgICAgICAgICAgICAgICAnPGRpdiBjbGFzcz1cImZpbHRlci1vcHRpb24taW5uZXItaW5uZXJcIj48L2Rpdj4nICtcclxuICAgICAgICAgICAgICAnPC9kaXY+ICcgK1xyXG4gICAgICAgICAgICAnPC9kaXY+JyArXHJcbiAgICAgICAgICAgIChcclxuICAgICAgICAgICAgICB2ZXJzaW9uLm1ham9yID09PSAnNCcgPyAnJ1xyXG4gICAgICAgICAgICAgIDpcclxuICAgICAgICAgICAgICAnPHNwYW4gY2xhc3M9XCJicy1jYXJldFwiPicgK1xyXG4gICAgICAgICAgICAgICAgdGhpcy5vcHRpb25zLnRlbXBsYXRlLmNhcmV0ICtcclxuICAgICAgICAgICAgICAnPC9zcGFuPidcclxuICAgICAgICAgICAgKSArXHJcbiAgICAgICAgICAnPC9idXR0b24+JyArXHJcbiAgICAgICAgICAnPGRpdiBjbGFzcz1cIicgKyBjbGFzc05hbW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ICAgICAgICAgICAgY2h1bmtzID0gW10sXHJcbiAgICAgICAgICAgIGNodW5rU2l6ZSxcclxuICAgICAgICAgICAgY2h1bmtDb3VudCxcclxuICAgICAgICAgICAgZmlyc3RDaHVuayxcclxuICAgICAgICAgICAgbGFzdENodW5rLFxyXG4gICAgICAgICAgICBjdXJyZW50Q2h1bmssXHJcbiAgICAgICAgICAgIHByZXZQb3NpdGlvbnMsXHJcbiAgICAgICAgICAgIHBvc2l0aW9uSXNEaWZmZXJlbnQsXHJcbiAgICAgICAgICAgIHByZXZpb3VzRWxlbWVudHMsXHJcbiAgICAgICAgICAgIG1lbnVJc0RpZmZlcmVudCA9IHRydWUsXHJcbiAgICAgICAgICAgIGlzVmlydHVhbCA9IHRoYXQuaXNWaXJ0dWFsKCk7XHJcblxyXG4gICAgICAgIHRoYXQuc2VsZWN0cGlja2VyLnZpZXcuc2Nyb2xsVG9wID0gc2Nyb2xsVG9wO1xyXG5cclxuICAgICAgICBjaHVua1NpemUgPSBNYXRoLmNlaWwodGhhdC5zaXplSW5mby5tZW51SW5uZXJIZWlnaHQgLyB0aGF0LnNpemVJbmZvLmxpSGVpZ2h0ICogMS41KTsgLy8gbnVtYmVyIG9mIG9wdGlvbnMgaW4gYSBjaHVua1xyXG4gICAgICAgIGNodW5rQ291bnQgPSBNYXRoLnJvdW5kKHNpemUgLyBjaHVua1NpemUpIHx8IDE7IC8vIG51bWJlciBvZiBjaHVua3NcclxuXHJcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaHVua0NvdW50OyBpKyspIHtcclxuICAgICAgICAgIHZhciBlbmRPZkNodW5rID0gKGkgKyAxKSAqIGNodW5rU2l6ZTtcclxuXHJcbiAgICAgICAgICBpZiAoaSA9PT0gY2h1bmtDb3VudCAtIDEpIHtcclxuICAgICAgICAgICAgZW5kT2ZDaHVuayA9IHNpemU7XHJcbiAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgY2h1bmtzW2ldID0gW1xyXG4gICAgICAgICAgICAoaSkgKiBjaHVua1NpemUgKyAoIWkgPyAwIDogMSksXHJcbiAgICAgICAgICAgIGVuZE9mQ2h1bmtcclxuICAgICAgICAgIF07XHJcblxyXG4gICAgICAgICAgaWYgKCFzaXplKSBicmVhaztcclxuXHJcbiAgICAgICAgICBpZiAoY3VycmVudENodW5rID09PSB1bmRlZmluZWQgJiYgc2Nyb2xsVG9wIC0gMSA8PSB0aGF0LnNlbGVjdHBpY2tlci5jdXJyZW50LmRhdGFbZW5kT2ZDaHVuayAtIDFdLnBvc2l0aW9uIC0gdGhhdC5zaXplSW5mby5tZW51SW5uZXJIZWlnaHQpIHtcclxuICAgICAgICAgICAgY3VycmVudENodW5rID0gaTtcclxuICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGlmIChjdXJyZW50Q2h1bmsgPT09IHVuZGVmaW5lZCkgY3VycmVudENodW5rID0gMDtcclxuXHJcbiAgICAgICAgcHJldlBvc2l0aW9ucyA9IFt0aGF0LnNlbGVjdHBpY2tlci52aWV3LnBvc2l0aW9uMCwgdGhhdC5zZWxlY3RwaWNrZXIudmlldy5wb3NpdGlvbjFdO1xyXG5cclxuICAgICAgICAvLyBhbHdheXMgZGlzcGxheSBwcmV2aW91cywgY3VycmVudCwgYW5kIG5leHQgY2h1bmtzXHJcbiAgICAgICAgZmlyc3RDaHVuayA9IE1hdGgubWF4KDAsIGN1cnJlbnRDaHVuayAtIDEpO1xyXG4gICAgICAgIGxhc3RDaHVuayA9IE1hdGgubWluKGNodW5rQ291bnQgLSAxLCBjdXJyZW50Q2h1bmsgKyAxKTtcclxuXHJcbiAgICAgICAgdGhhdC5zZWxlY3RwaWNrZXIudmlldy5wb3NpdGlvbjAgPSBpc1ZpcnR1YWwgPT09IGZhbHNlID8gMCA6IChNYXRoLm1heCgwLCBjaHVua3NbZmlyc3RDaHVua11bMF0pIHx8IDApO1xyXG4gICAgICAgIHRoYXQuc2VsZWN0cGlja2VyLnZpZXcucG9zaXRp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HJcblxyXG4gICAgICAgICAgICAvLyByZXBsYWNlIHRoZSBleGlzdGluZyBVTCB3aXRoIGFuIGVtcHR5IG9uZSAtIHRoaXMgaXMgZmFzdGVyIHRoYW4gJC5lbXB0eSgpXHJcbiAgICAgICAgICAgIG1lbnVJbm5lci5yZXBsYWNlQ2hpbGQoZW1wdHlNZW51LCBtZW51SW5uZXIuZmlyc3RDaGlsZCk7XHJcblxyXG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgdmlzaWJsZUVsZW1lbnRzTGVuID0gZWxlbWVudHMubGVuZ3RoOyBpIDwgdmlzaWJsZUVsZW1lbnRzTGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICB2YXIgZWxlbWVudCA9IGVsZW1lbnRzW2ldLFxyXG4gICAgICAgICAgICAgICAgICBlbFRleHQsXHJcbiAgICAgICAgICAgICAgICAgIGVsZW1lbnREYXRhO1xyXG5cclxuICAgICAgICAgICAgICBpZiAodGhhdC5vcHRpb25zLnNhbml0aXplKSB7XHJcbiAgICAgICAgICAgICAgICBlbFRleHQgPSBlbGVtZW50Lmxhc3RDaGlsZDtcclxuXHJcbiAgICAgICAgICAgICAgICBpZiAoZWxUZXh0KSB7XHJcbiAgICAgICAgICAgICAgICAgIGVsZW1lbnREYXRhID0gdGhhdC5zZWxlY3RwaWNrZXIuY3VycmVudC5kYXRhW2kgKyB0aGF0LnNlbGVjdHBpY2tlci52aWV3LnBvc2l0aW9uMF07XHJcblxyXG4gICAgICAgICAgICAgICAgICBpZiAoZWxlbWVudERhdGEgJiYgZWxlbWVudERhdGEuY29udGVudCAmJiAhZWxlbWVudERhdGEuc2FuaXRpemVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdG9TYW5pdGl6ZS5wdXNoKGVsVGV4dCk7XHJcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudERhdGEuc2FuaXRpemVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxy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AgICAgICAgICB9IGVsc2UgaWYgKG1lbnVJbm5lcklubmVyV2lkdGggPiB0aGF0LnNpemVJbmZvLm1lbnVJbm5lcklubmVyV2lkdGgpIHtcclxuICAgICAgICAgICAgICAgIC8vIHNldCB0byAwIHRvIGdldCBhY3R1YWwgd2lkdGggb2YgbWVudVxyXG4gICAgICAgICAgICAgICAgdGhhdC4kbWVudVswXS5zdHlsZS5taW5XaWR0aCA9IDA7XHJcblxyXG4gICAgICAgICAgICAgICAgdmFyIGFjdHVhbE1lbnVXaWR0aCA9IG1lbnVJbm5lci5maXJzdENoaWxkLm9mZnNldFdpZHRoO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmIChhY3R1YWxNZW51V2lkdGggPiB0aGF0LnNpemVJbmZvLm1lbnVJbm5lcklubmVyV2lkdGgpIHtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zaXplSW5mby5tZW51SW5uZXJJbm5lcldpZHRoID0gYWN0dWFsTWVudVdpZHRoO1xyXG4gICAgICAgICAgICAgICAgICBtZW51SW5uZXIuZmlyc3RDaGlsZC5zdHlsZS5taW5XaWR0aCA9IHRoYXQuc2l6ZUluZm8ubWVudUlubmVySW5uZXJXaWR0aCArICdweCc7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgLy8gcmVzZXQgdG8gZGVmYXVsdCBDU1Mgc3R5bGluZ1xyXG4gICAgICAgICAgICAgICAgdGhhdC4kbWVudVswXS5zdHlsZS5taW5XaWR0aCA9ICcnO1xyXG4gICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdGhhdC5wcmV2QWN0aXZlSW5kZXggPSB0aGF0LmFjdGl2ZUluZGV4O1xyXG5cclxuICAgICAgICBpZiAoIXRoYXQub3B0aW9ucy5saXZlU2VhcmNoKSB7XHJcbiAgICAgICAgICB0aGF0LiRtZW51SW5uZXIudHJpZ2dlc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Y29uZmlnIHx8IHt9O1xyXG4gICAgICAgIGNvbmZpZy50eXBlID0gJ2RpdmlkZXInO1xyXG5cclxuICAgICAgICBtYWluRWxlbWVudHMucHVzaChcclxuICAgICAgICAgIGdlbmVyYXRlT3B0aW9uLmxpKFxyXG4gICAgICAgICAgICBmYWxzZSxcclxuICAgICAgICAgICAgY2xhc3NOYW1lcy5ESVZJREVSLFxyXG4gICAgICAgICAgICAoY29uZmlnLm9wdElEID8gY29uZmlnLm9wdElEICsgJ2RpdicgOiB1bmRlZmluZWQpXHJcbiAgICAgICAgICApXHJcbiAgICAgICAgKTtcclxuXHJcbiAgICAgICAgbWFpbkRhdGEucHVzaChjb25maWcpO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBmdW5jdGlvbiBhZGRPcHRpb24gKG9wdGlvbiwgY29uZmlnKSB7XHJcbiAgICAgICAgY29uZmlnID0gY29uZmlnIHx8IHt9O1xyXG5cclxuICAgICAgICBjb25maWcuZGl2aWRlciA9IG9wdGlvbi5nZXRBdHRyaWJ1dGUoJ2RhdGEtZGl2aWRlcicpID09PSAndHJ1ZSc7XHJcblxyXG4gICAgICAgIGlmIChjb25maWcuZGl2aWRlcikge1xyXG4gICAgICAgICAgYWRkRGl2aWRlcih7XHJcbiAgICAgICAgICAgIG9wdElEOiBjb25maWcub3B0SURcclxuICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICB2YXIgbGlJbmRleCA9IG1haW5EYXRhLmxlbmd0aCxcclxuICAgICAgICAgICAgICBjc3NUZXh0ID0gb3B0aW9uLnN0eWxlLmNzc1RleHQsXHJcbiAgICAgICAgICAgICAgaW5saW5lU3R5bGUgPSBjc3NUZXh0ID8gaHRtbEVzY2FwZShjc3NUZXh0KSA6ICcnLFxyXG4gICAgICAgICAgICAgIG9wdGlvbkNsYXNzID0gKG9wdGlvbi5jbGFzc05hbWUgfHwgJycpICsgKGNvbmZpZy5vcHRncm91cENsYXNzIHx8ICcnKTtcclxuXHJcbiAgICAgICAgICBpZiAoY29uZmlnLm9wdElEKSBvcHRpb25DbGFzcyA9ICdvcHQgJyArIG9wdGlvbkNsYXNzO1xyXG5cclxuICAgICAgICAgIGNvbmZpZy50ZXh0ID0gb3B0aW9uLnRleHRDb250ZW50O1xyXG5cclxuICAgICAgICAgIGNvbmZpZy5jb250ZW50ID0gb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1jb250ZW50Jyk7XHJcbiAgICAgICAgICBjb25maWcudG9rZW5zID0gb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS10b2tlbnMnKTtcclxuICAgICAgICAgIGNvbmZpZy5zdWJ0ZXh0ID0gb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1zdWJ0ZXh0Jyk7XHJcbiAgICAgICAgICBjb25maWcuaWNvbiA9IG9wdGlvbi5nZXRBdHRyaWJ1dGUoJ2RhdGEtaWNvbicpO1xyXG4gICAgICAgICAgY29uZmlnLmljb25CYXNlID0gaWNvbkJhc2U7XHJcblxyXG4gICAgICAgICAgdmFyIHRleHRFbGVtZW50ID0gZ2VuZXJhdGVPcHRpb24udGV4dChjb25maWcpO1xyXG4gICAgICAgICAgdmFyIGxpRWxlbWVudCA9IGdlbmVyYXRlT3B0aW9uLmxpKFxyXG4gICAgICAgICAgICBnZW5lcmF0ZU9wdGlvbi5hKFxyXG4gICAgICAgICAgICAgIHRleHRFbGVtZW50LFxyXG4gICAgICAgICAgICAgIG9wdGlvbkNsYXNzLFxyXG4gICAgICAgICAgICAgIGlubGluZVN0eWxlXHJcbiAgICAgICAgICAgICksXHJcbiAgICAgICAgICAgICcnLFxyXG4gICAgICAgICAgICBjb25maWcub3B0SURcclxuICAgICAgICAgICk7XHJcblxyXG4gICAgICAgICAgaWYgKGxpRWxlbWVudC5maXJzdENoaWxkKSB7XHJcbiAgICAgICAgICAgIGxpRWxlbWVudC5maXJzdENoaWxkLmlkID0gdGhhdC5zZWxlY3RJZCArICctJyArIGxpSW5kZXg7XHJcbiAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgbWFpbkVsZW1lbnRzLnB1c2gobGlFbGVtZW50KTtcclxuXHJcbiAgICAgICAgICBvcHRpb24ubGlJbmRleCA9IGxpSW5kZXg7XHJcblxyXG4gICAgICAgICAgY29uZmlnLmRpc3BsYXkgPSBjb25maWcuY29udGVudCB8fCBjb25maWcudGV4dDtcclxuICAgICAgICAgIGNvbmZpZy50eXBlID0gJ29wdGlvbic7XHJcbiAgICAgICAgICBjb25maWcuaW5kZXggPSBsaUluZGV4O1xyXG4gICAgICAgICAgY29uZmlnLm9wdGlvbiA9IG9wdGlvbjtcclxuICAgICAgICAgIGNvbmZpZy5kaXNhYmxlZCA9IGNvbmZpZy5kaXNhYmxlZCB8fCBvcHRpb24uZGlzYWJsZWQ7XHJcblxyXG4gICAgICAgICAgbWFpbkRhdGEucHVzaChjb25maWcpO1xyXG5cclxuICAgICAgICAgIHZhciBjb21iaW5lZExlbmd0aCA9IDA7XHJcblxyXG4gICAgICAgICAgLy8gY291bnQgdGhlIG51bWJlciBvZiBjaGFyYWN0ZXJzIGluIHRoZSBvcHRpb24gLSBub3QgcGVyZmVjdCwgYnV0IHNob3VsZCB3b3JrIGluIG1vc3QgY2FzZXNcclxuICAgICAgICAgIGlmIChjb25maWcuZGlzcGxheSkgY29tYmluZWRMZW5ndGggKz0gY29uZmlnLmRpc3BsYXkubGVuZ3RoO1xyXG4gICAgICAgICAgaWYgKGNvbmZpZy5zdWJ0ZXh0KSBjb21iaW5lZExlbmd0aCArPSBjb25maWcuc3VidGV4dC5sZW5ndGg7XHJcbiAgICAgICAgICAvLyBpZiB0aGVyZSBpcyBhbiBpY29uLCBlbnN1cmUgdGhpcyBvcHRpb24ncyB3aWR0aCBpcyBjaGVja2VkXHJcbiAgICAgICAgICBpZiAoY29uZmlnLmljb24pIGNvbWJpbmVkTGVuZ3RoICs9IDE7XHJcblxyXG4gICAgICAgICAgaWYgKGNvbWJpbmVkTG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25zLmxlbmd0aDsgaiA8IGxlbjsgaisrKSB7XHJcbiAgICAgICAgICB2YXIgb3B0aW9uID0gb3B0aW9uc1tqXTtcclxuXHJcbiAgICAgICAgICBpZiAoaiA9PT0gMCkge1xyXG4gICAgICAgICAgICBoZWFkZXJJbmRleCA9IG1haW5EYXRhLmxlbmd0aCAtIDE7XHJcbiAgICAgICAgICAgIGxhc3RJbmRleCA9IGhlYWRlckluZGV4ICsgbGVuO1xyXG4gICAgICAgICAgfVxyXG5cclxuICAgICAgICAgIGFkZE9wdGlvbihvcHRpb24sIHtcclxuICAgICAgICAgICAgaGVhZGVySW5kZXg6IGhlYWRlckluZGV4LFxyXG4gICAgICAgICAgICBsYXN0SW5kZXg6IGxhc3RJbmRleCxcclxuICAgICAgICAgICAgb3B0SUQ6IG9wdElELFxyXG4gICAgICAgICAgICBvcHRncm91cENsYXNzOiBvcHRncm91cENsYXNzLFxyXG4gICAgICAgICAgICBkaXNhYmxlZDogb3B0Z3JvdXAuZGlzYWJsZWRcclxuICAgICAgICAgIH0pO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgaWYgKG5leHQpIHtcclxuICAgICAgICAgIGFkZERpdmlkZXIoeyBvcHRJRDogb3B0SUQgfSk7XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcblxyXG4gICAgICBmb3IgKHZhciBsZW4gPSBzZWxlY3RPcHRpb25zLmxlbmd0aDsgc3RhcnRJbmRleCA8IGxlbjsgc3RhcnRJbmRleCsrKSB7XHJcbiAgICAgICAgdmFyIGl0ZW0gPSBzZWxlY3RPcHRpb25zW3N0YXJ0SW5kZXhdO1xyXG5cclxuICAgICAgICBpZiAoaXRlbS50YWdOYW1lICE9PSAnT1BUR1JPVVAnKSB7XHJcbiAgICAgICAgICBhZGRPcHRpb24oaXRlbSwge30pO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICBhZGRPcHRncm91cChzdGFydEluZGV4LCBzZWxlY3RPcHRpb25zKTtccl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3B0aW9ucy5zZWxlY3RlZFRleHRGb3JtYXQuc3BsaXQoJz4nKTtcclxuICAgICAgICAgIHNob3dDb3VudCA9IChjb3VudE1heC5sZW5ndGggPiAxICYmIHNlbGVjdGVkQ291bnQgPiBjb3VudE1heFsxXSkgfHwgKGNvdW50TWF4Lmxlbmd0aCA9PT0gMSAmJiBzZWxlY3RlZENvdW50ID49IDIpO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgLy8gb25seSBsb29wIHRocm91Z2ggYWxsIHNlbGVjdGVkIG9wdGlvbnMgaWYgdGhlIGNvdW50IHdvbid0IGJlIHNob3duXHJcbiAgICAgICAgaWYgKHNob3dDb3VudCA9PT0gZmFsc2UpIHtcclxuICAgICAgICAgIGZvciAodmFyIHNlbGVjdGVkSW5kZXggPSAwOyBzZWxlY3RlZEluZGV4IDwgc2VsZWN0ZWRDb3VudDsgc2VsZWN0ZWRJbmRleCsrKSB7XHJcbiAgICAgICAgICAgIGlmIChzZWxlY3RlZEluZGV4IDwgNTApIHtcclxuICAgICAgICAgICAgICB2YXIgb3B0aW9uID0gc2VsZWN0ZWRPcHRpb25zW3NlbGVjdGVkSW5kZXhdLFxyXG4gICAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMgPSB7fSxcclxuICAgICAgICAgICAgICAgICAgdGhpc0RhdGEgPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY29udGVudDogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1jb250ZW50JyksXHJcbiAgICAgICAgICAgICAgICAgICAgc3VidGV4dDogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1zdWJ0ZXh0JyksXHJcbiAgICAgICAgICAgICAgICAgICAgaWNvbjogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1pY29uJylcclxuICAgICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgICAgaWYgKHRoaXMubXVsdGlwbGUgJiYgc2VsZWN0ZWRJbmRleCA+IDApIHtcclxuICAgICAgICAgICAgICAgIHRpdGxlRnJhZ21lbnQuYXBwZW5kQ2hpbGQobXVsdGlwbGVTZXBhcmF0b3IuY2xvbmVOb2RlKGZhbHNlKSk7XHJcbiAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICBpZiAob3B0aW9uLnRpdGxlKSB7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMudGV4dCA9IG9wdGlvbi50aXRsZTtcclxuICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXNEYXRhLmNvbnRlbnQgJiYgdGhhdC5vcHRpb25zLnNob3dDb250ZW50KSB7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMuY29udGVudCA9IHRoaXNEYXRhLmNvbnRlbnQudG9TdHJpbmcoKTtcclxuICAgICAgICAgICAgICAgIGhhc0NvbnRlbnQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAodGhhdC5vcHRpb25zLnNob3dJY29uKSB7XHJcbiAgICAgICAgICAgICAgICAgIHRpdGxlT3B0aW9ucy5pY29uID0gdGhpc0RhdGEuaWNvbjtcclxuICAgICAgICAgICAgICAgICAgdGl0bGVPcHRpb25zLmljb25CYXNlID0gdGhpcy5vcHRpb25zLmljb25CYXNlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHRoYXQub3B0aW9ucy5zaG93U3VidGV4dCAmJiAhdGhhdC5tdWx0aXBsZSAmJiB0aGlzRGF0YS5zdWJ0ZXh0KSB0aXRsZU9wdGlvbnMuc3VidGV4dCA9ICcgJyArIHRoaXNEYXRhLnN1YnRleHQ7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMudGV4dCA9IG9wdGlvbi50ZXh0Q29udGVudC50cmltKCk7XHJcbiAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICB0aXRsZUZyYWdtZ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QpLmxlbmd0aCxcclxuICAgICAgICAgICAgICAgICAgbWF4UmVhY2hlZEdycCA9IG1heE9wdGlvbnNHcnAgPCAkb3B0Z3JvdXAuZmluZCgnb3B0aW9uOnNlbGVjdGVkJykubGVuZ3RoO1xyXG5cclxuICAgICAgICAgICAgICBpZiAoKG1heE9wdGlvbnMgJiYgbWF4UmVhY2hlZCkgfHwgKG1heE9wdGlvbnNHcnAgJiYgbWF4UmVhY2hlZEdycCkpIHtcclxuICAgICAgICAgICAgICAgIGlmIChtYXhPcHRpb25zICYmIG1heE9wdGlvbnMgPT0gMSkge1xyXG4gICAgICAgICAgICAgICAgICBlbGVtZW50LnNlbGVjdGVkSW5kZXggPSAtMTtcclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zZXRPcHRpb25TdGF0dXModHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1heE9wdGlvbnNHcnAgJiYgbWF4T3B0aW9uc0dycCA9PSAxKSB7XHJcbiAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgJG9wdGdyb3VwT3B0aW9ucy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBfb3B0aW9uID0gJG9wdGdyb3VwT3B0aW9uc1tpXTtcclxuICAgICAgICAgICAgICAgICAgICBfb3B0aW9uLnNlbGVjdGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhhdC5zZXRTZWxlY3RlZChfb3B0aW9uLmxpSW5kZXgsIGZhbHNlKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zZXRTZWxlY3RlZChjbGlja2VkSW5kZXgsIHRydWUpO1xyXG4gICAgICAgICAgICAgIC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gPSBtYXhUeHRHcnAucmVwbGFjZSgne3Zhcn0nLCBtYXhPcHRpb25zQXJyWzJdW21heE9wdGlvbnNHcnAgPiAxID8gMCA6IDFdKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gZmFsc2U7XHJcblxyXG4gICAgICAgICAgICAgICAgICB0aGF0LiRtZW51LmFwcGVuZCgkbm90aWZ5KTtcclxuXHJcbiAgICAgICAgICAgICAgICAgIGlmIChtYXhPcHRpb25zICYmIG1heFJlYWNoZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAkbm90aWZ5LmFwcGVuZCgkKCc8ZGl2PicgKyBtYXhUeHQgKyAnPC9kaXY+JykpO1xyXG4gICAgICAgICAgICAgICAgICAgIHRyaWdnZXJDaGFuZ2UgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB0aGF0LiRlbGVtZW50LnRyaWdnZXIoJ21heFJlYWNoZWQnICsgRVZFTlRfS0VZKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgaWYgKG1heE9wdGlvbnNHcnAgJiYgbWF4UmVhY2hlZEdycCkge1xyXG4gICAgICAgICAgICAgICAgICAgICRub3RpZnkuYXBwZW5kKCQoJzxkaXY+JyArIG1heFR4dEdycCArICc8L2Rpdj4nKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgdHJpZ2dlckNoYW5nZSA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIHRoYXQuJGVsZW1lbnQudHJpZ2dlcignbWF4UmVhY2hlZEdycCcgKyBFVkVOVF9LRVkpO1xyXG4gICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGF0LnNldFNlbGVjdGVkKGNsaWNrZWRJbmRleCwgZmFsc2UpO1xyX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ICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgdGhhdC5zZWxlY3RwaWNrZXIubWFpbi5kYXRhLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgIHZhciBsaSA9IHRoYXQuc2VsZWN0cGlja2VyLm1haW4uZGF0YVtpXTtcclxuXHJcbiAgICAgICAgICAgIGlmICghY2FjaGVbaV0pIHtcclxuICAgICAgICAgICAgICBjYWNoZVtpXSA9IHN0cmluZ1NlYXJjaChsaSwgcSwgc2VhcmNoU3R5bGUsIG5vcm1hbGl6ZVNlYXJjaCk7XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIGlmIChjYWNoZVtpXSAmJiBsaS5oZWFkZXJJbmRleCAhPT0gdW5kZWZpbmVkICYmIGNhY2hlQXJyLmluZGV4T2YobGkuaGVhZGVySW5kZXgpID09PSAtMSkge1xyXG4gICAgICAgICAgICAgIGlmIChsaS5oZWFkZXJJbmRleCA+IDApIHtcclxuICAgICAgICAgICAgICAgIGNhY2hlW2xpLmhlYWRlckluZGV4IC0gMV0gPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgY2FjaGVBcnIucHVzaChsaS5oZWFkZXJJbmRleCAtIDEpO1xyXG4gICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgY2FjaGVbbGkuaGVhZGVySW5kZXhdID0gdHJ1ZTtcclxuICAgICAgICAgICAgICBjYWNoZUFyci5wdXNoKGxpLmhlYWRlckluZGV4KTtcclxuXHJcbiAgICAgICAgICAgICAgY2FjaGVbbGkubGFzdEluZGV4ICsgMV0gPSB0cnVlO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAoY2FjaGVbaV0gJiYgbGkudHlwZSAhPT0gJ29wdGdyb3VwLWxhYmVsJykgY2FjaGVBcnIucHVzaChpKTtcclxuICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICBmb3IgKHZhciBpID0gMCwgY2FjaGVMZW4gPSBjYW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2VyKCdjbGljay5icy5kcm9wZG93bi5kYXRhLWFwaScpO1xyXG5cclxuICAgICAgICBpZiAodGhhdC5vcHRpb25zLmxpdmVTZWFyY2gpIHtcclxuICAgICAgICAgIHRoYXQuJHNlYXJjaGJveC50cmlnZ2VyKCdmb2N1cycpO1xyXG4gICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgIH1cclxuICAgICAgfVxyXG5cclxuICAgICAgaWYgKGUud2hpY2ggPT09IGtleUNvZGVzLkVTQ0FQRSAmJiBpc0FjdGl2ZSkge1xyXG4gICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICB0aGF0LiRidXR0b24udHJpZ2dlcignY2xpY2suYnMuZHJvcGRvd24uZGF0YS1hcGknKS50cmlnZ2VyKCdmb2N1cycpO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBpZiAoaXNBcnJvd0tleSkgeyAvLyBpZiB1cCBvciBkb3duXHJcbiAgICAgICAgaWYgKCEkaXRlbXMubGVuZ3RoKSByZXR1cm47XHJcblxyXG4gICAgICAgIGxpQWN0aXZlID0gdGhhdC5zZWxlY3RwaWNrZXIubWFpbi5lbGVtZW50c1t0aGF0LmFjdGl2ZUluZGV4XTtcclxuICAgICAgICBpbmRleCA9IGxpQWN0aXZlID8gQXJyYXkucHJvdG90eXBlLmluZGV4T2YuY2FsbChsaUFjdGl2ZS5wYXJlbnRFbGVtZW50LmNoaWxkcmVuLCBsaUFjdGl2ZSkgOiAtMTtcclxuXHJcbiAgICAgICAgaWYgKGluZGV4ICE9PSAtMSkge1xyXG4gICAgICAgICAgdGhhdC5kZWZvY3VzSXRlbShsaUFjdGl2ZSk7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBpZiAoZS53aGljaCA9PT0ga2V5Q29kZXMuQVJST1dfVVApIHsgLy8gdXBcclxuICAgICAgICAgIGlmIChpbmRleCAhPT0gLTEpIGluZGV4LS07XHJcbiAgICAgICAgICBpZiAoaW5kZXggKyBwb3NpdGlvbj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GlvbnMpO1xyXG4gICAgICAgICAgY29uZmlnLnRlbXBsYXRlID0gJC5leHRlbmQoe30sIFNlbGVjdHBpY2tlci5ERUZBVUxUUy50ZW1wbGF0ZSwgKCQuZm4uc2VsZWN0cGlja2VyLmRlZmF1bHRzID8gJC5mbi5zZWxlY3RwaWNrZXIuZGVmYXVsdHMudGVtcGxhdGUgOiB7fSksIGRhdGFBdHRyaWJ1dGVzLnRlbXBsYXRlLCBvcHRpb25zLnRlbXBsYXRlKTtcclxuICAgICAgICAgICR0aGlzLmRhdGEoJ3NlbGVjdHBpY2tlcicsIChkYXRhID0gbmV3IFNlbGVjdHBpY2tlcih0aGlzLCBjb25maWcpKSk7XHJcbiAgICAgICAgfSBlbHNlIGlmIChvcHRpb25zKSB7XHJcbiAgICAgICAgICBmb3IgKHZhciBpIGluIG9wdGlvbnMpIHtcclxuICAgICAgICAgICAgaWYgKG9wdGlvbnMuaGFzT3duUHJvcGVydHkoaSkpIHtcclxuICAgICAgICAgICAgICBkYXRhLm9wdGlvbnNbaV0gPSBvcHRpb25zW2ldO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBpZiAodHlwZW9mIF9vcHRpb24gPT0gJ3N0cmluZycpIHtcclxuICAgICAgICAgIGlmIChkYXRhW19vcHRpb25dIGluc3RhbmNlb2YgRnVuY3Rpb24pIHtcclxuICAgICAgICAgICAgdmFsdWUgPSBkYXRhW19vcHRpb25dLmFwcGx5KGRhdGEsIGFyZ3MpO1xyXG4gICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgdmFsdWUgPSBkYXRhLm9wdGlvbnNbX29wdGlvbl07XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcbiAgICB9KTtcclxuXHJcbiAgICBpZiAodHlwZW9mIHZhbHVlICE9PSAndW5kZWZpbmVkJykge1xyXG4gICAgICAvLyBub2luc3BlY3Rpb24gSlNV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jdCBbcm9sZT1cImxpc3Rib3hcIl0sIC5ib290c3RyYXAtc2VsZWN0IC5icy1zZWFyY2hib3ggaW5wdXQnLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xyXG4gICAgfSk7XHJcblxyXG4gIC8vIFNFTEVDVFBJQ0tFUiBEQVRBLUFQSVxyXG4gIC8vID09PT09PT09PT09PT09PT09PT09PVxyXG4gICQod2luZG93KS5vbignbG9hZCcgKyBFVkVOVF9LRVkgKyAnLmRhdGEtYXBpJywgZnVuY3Rpb24gKCkge1xyXG4gICAgJCgnLnNlbGVjdHBpY2tlcicpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICB2YXIgJHNlbGVjdHBpY2tlciA9ICQodGhpcyk7XHJcbiAgICAgIFBsdWdpbi5jYWxsKCRzZWxlY3RwaWNrZXIsICRzZWxlY3RwaWNrZXIuZGF0YSgpKTtcclxuICAgIH0pXHJcbiAgfSk7XHJcbn0pKGpRdWVyeSk7XHJcblxyXG5cclxufSkpO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1ib290c3RyYXAtc2VsZWN0LmpzLm1hcFxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2Jvb3RzdHJhcC1zZWxlY3QvZGlzdC9qcy9ib290c3RyYXAtc2VsZWN0LmpzXG4vLyBtb2R1bGUgaWQgPSA1XG4vLyBtb2R1bGUgY2h1bmtzID0gMCIsIi8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuICogQm9vdHN0cmFwIChwbHVnaW4pOiB2YWxpZGF0b3IuanMgdjAuMTEuOVxuICogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4gKiBUaGUgTUl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AgICAgICAgJGVsLmlzKCdzZWxlY3RbbXVsdGlwbGVdJykgID8gKCRlbC52YWwoKSB8fCBbXSkubGVuZ3RoICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRlbC52YWwoKVxuICB9XG5cbiAgdmFyIFZhbGlkYXRvciA9IGZ1bmN0aW9uIChlbGVtZW50LCBvcHRpb25zKSB7XG4gICAgdGhpcy5vcHRpb25zICAgID0gb3B0aW9uc1xuICAgIHRoaXMudmFsaWRhdG9ycyA9ICQuZXh0ZW5kKHt9LCBWYWxpZGF0b3IuVkFMSURBVE9SUywgb3B0aW9ucy5jdXN0b20pXG4gICAgdGhpcy4kZWxlbWVudCAgID0gJChlbGVtZW50KVxuICAgIHRoaXMuJGJ0biAgICAgICA9ICQoJ2J1dHRvblt0eXBlPVwic3VibWl0XCJdLCBpbnB1dFt0eXBlPVwic3VibWl0XCJdJylcbiAgICAgICAgICAgICAgICAgICAgICAgIC5maWx0ZXIoJ1tmb3JtPVwiJyArIHRoaXMuJGVsZW1lbnQuYXR0cignaWQnKSArICdcIl0nKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmFkZCh0aGlzLiRlbGVtZW50LmZpbmQoJ2lucHV0W3R5cGU9XCJzdWJtaXRcIl0sIGJ1dHRvblt0eXBlPVwic3VibWl0XCJdJykpXG5cbiAgICB0aGlzLnVwZGF0ZSgpXG5cbiAgICB0aGlzLiRlbGVtZW50Lm9uKCdpbnB1dC5icy52YWxpZGF0b3IgY2hhbmdlLmJzLnZhbGlkYXRvciBmb2N1c291dC5icy52YWxpZGF0b3InLCAkLnByb3h5KHRoaXMub25JbnB1dCwgdGhpcykpXG4gICAgdGhpcy4kZWxlbWVudC5vbignc3VibWl0LmJzLnZhbGlkYXRvcicsICQucHJveHkodGhpcy5vblN1Ym1pdCwgdGhpcykpXG4gICAgdGhpcy4kZWxlbWVudC5vbigncmVzZXQuYnMudmFsaW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HJcbiAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcbiAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldEZpbGVOYW1lOiBmdW5jdGlvbiAoZmlsZSkge1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBmaWxlLmZpbGVOYW1lICovXHJcbiAgICAgICAgICAgIHJldHVybiBmaWxlID8gKGZpbGUuZmlsZU5hbWUgfHwgZmlsZS5uYW1lIHx8ICcnKSA6ICcnOyAvLyBzb21lIGNvbmZ1c2lvbiBpbiBkaWZmZXJlbnQgdmVyc2lvbnMgb2YgRmlyZWZveFxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY3JlYXRlT2JqZWN0VVJMOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICBpZiAoJGgub2JqVXJsICYmICRoLm9ialVybC5jcmVhdGVPYmplY3RVUkwgJiYgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuICRoLm9ialVybC5jcmVhdGVPYmplY3RVUkwoZGF0YSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgcmV2b2tlT2JqZWN0VVJMOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICBpZiAoJGgub2JqVXJsICYmICRoLm9ialVybC5yZXZva2VPYmplY3RVUkwgJiYgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgJGgub2JqVXJsLnJldm9rZU9iamVjdFVSTChkYXRhKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY29tcGFyZTogZnVuY3Rpb24gKGlucHV0LCBzdHIsIGV4YWN0KSB7XHJcbiAgICAgICAgICAgIHJldHVybiBpbnB1dCAhPT0gdW5kZWZpbmVkICYmIChleGFjdCA/IGlucHV0ID09PSB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W5wdXQnKTtcclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIGlucHV0LnR5cGUgPSAnZmlsZSc7XHJcbiAgICAgICAgICAgICAgICBpbnB1dC5maWxlcyA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldERyYWdEcm9wRm9sZGVyczogZnVuY3Rpb24gKGl0ZW1zKSB7XHJcbiAgICAgICAgICAgIHZhciBpLCBpdGVtLCBsZW4gPSBpdGVtcyA/IGl0ZW1zLmxlbmd0aCA6IDAsIGZvbGRlcnMgPSAwO1xyXG4gICAgICAgICAgICBpZiAobGVuID4gMCAmJiBpdGVtc1swXS53ZWJraXRHZXRBc0VudHJ5KCkpIHtcclxuICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgIGl0ZW0gPSBpdGVtc1tpXS53ZWJraXRHZXRBc0VudHJ5KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0gJiYgaXRlbS5pc0RpcmVjdG9yeSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb2xkZXJzKys7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiBmb2xkZXJzO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaW5pdE1vZGFsOiBmdW5jdGlvbiAoJG1vZGFsKSB7XHJcbiAgICAgICAgICAgIHZhciAkYm9keSA9ICQoJ2JvZHknKTtcclxuICAgICAgICAgICAgaWYgKCRib2R5Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgJG1vZGFsLmFwcGVuZFRvKCRib2R5KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNFbXB0eTogZnVuY3Rpb24gKHZhbHVlLCB0cmltKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZSA9PT0gdW5kZWZpbmVkIHx8IHZhbHVlID09PSBudWxsIHx8IHZhbHVlLmxlbmd0aCA9PT0gMCB8fCAodHJpbSAmJiAkLnRyaW0odmFsdWUpID09PSAnJyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBpc0FycmF5OiBmdW5jdGlvbiAoYSkge1xyXG4gICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShhKSB8fCBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYSkgPT09ICdbb2JqZWN0IEFycmF5XSc7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBpZlNldDogZnVuY3Rpb24gKG5lZWRsZSwgaGF5c3RhY2ssIGRlZikge1xyXG4gICAgICAgICAgICBkZWYgPSBkZWYgfHwgJyc7XHJcbiAgICAgICAgICAgIHJldHVybiAoaGF5c3RhY2sgJiYgdHlwZW9mIGhheXN0YWNrID09PSAnb2JqZWN0JyAmJiBuZWVkbGUgaW4gaGF5c3RhY2spID8gaGF5c3RhY2tbbmVlZGxlXSA6IGRlZjtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGNsZWFuQXJyYXk6IGZ1bmN0aW9uIChhcnIpIHtcclxuICAgICAgICAgICAgaWYgKCEoYXJyIGluc3RhbmNlb2YgQXJyYXkpKSB7XHJcbiAgICAgICAgICAgICAgICBhcnIgPSBbXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gYXJyLmZpbHRlcihmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIChlICE9PSB1bmRlZmluZWQgJiYgZSAhPT0gbnVsbCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgc3BsaWNlQXJyYXk6IGZ1bmN0aW9uIChhcnIsIGluZGV4LCByZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgdmFyIGksIGogPSAwLCBvdXQgPSBbXSwgbmV3QXJyO1xyXG4gICAgICAgICAgICBpZiAoIShhcnIgaW5zdGFuY2VvZiBBcnJheSkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBbXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBuZXdBcnIgPSAkLmV4dGVuZCh0cnVlLCBbXSwgYXJyKTtcclxuICAgICAgICAgICAgaWYgKHJldmVyc2VPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgbmV3QXJyLnJldmVyc2UoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbmV3QXJyLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaSAhPT0gaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXRbal0gPSBuZXdBcnJbaV07XHJcbiAgICAgICAgICAgICAgICAgICAgaisrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChyZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgICAgIG91dC5yZXZlcnNlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldE51bTogZnVuY3Rpb24gKG51bSwgZGVmKSB7XHJcbiAgICAgICAgICAgIGRlZiA9IGRlZiB8fCAwO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIG51bSA9PT0gJ251bWJlcicpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBudW07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBudW0gPT09ICdzdH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uICAgICAgICAgICAgICAgIHJldHVybiAhIXdpbmRvdy5CbG9iICYmIEJvb2xlYW4obmV3IEJsb2IoKSk7XHJcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaGFzQXJyYXlCdWZmZXJWaWV3U3VwcG9ydDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBCbG9iKFtuZXcgVWludDhBcnJheSgxMDApXSkuc2l6ZSA9PT0gMTAwO1xyXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIGRhdGFVUkkyQmxvYjogZnVuY3Rpb24gKGRhdGFVUkkpIHtcclxuICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSlNVbnJlc29sdmVkVmFyaWFibGVcclxuICAgICAgICAgICAgdmFyIEJsb2JCdWlsZGVyID0gd2luZG93LkJsb2JCdWlsZGVyIHx8IHdpbmRvdy5XZWJLaXRCbG9iQnVpbGRlciB8fCB3aW5kb3cuTW96QmxvYkJ1aWxkZXIgfHxcclxuICAgICAgICAgICAgICAgIHdpbmRvdy5NU0Jsb2JCdWlsZGVyLCBjYW5CbG9iID0gJGguaGFzQmxvYlN1cHBvcnQoKSwgYnl0ZVN0ciwgYXJyYXlCdWZmZXIsIGludEFycmF5LCBpLCBtaW1lU3RyLCBiYixcclxuICAgICAgICAgICAgICAgIGNhblByb2NlZWQgPSAoY2FuQmxvYiB8fCBCbG9iQnVpbGRlcikgJiYgd2luZG93LmF0b2IgJiYgd2luZG93LkFycmF5QnVmZmVyICYmIHdpbmRvdy5VaW50OEFycmF5O1xyXG4gICAgICAgICAgICBpZiAoIWNhblByb2NlZWQpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBudWxsO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChkYXRhVVJJLnNwbGl0KCcsJylbMF0uaW5kZXhPZignYmFzZTY0JykgPj0gMCkge1xyXG4gICAgICAgICAgICAgICAgYnl0ZVN0ciA9IGF0b2IoZGF0YVVSSS5zcGxpdCgnLCcpWzFdKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGJ5dGVTdHIgPSBkZWNvZGVVUklDb21wb25lbnQoZGF0YVVSSS5zcGxpdCgnLCcpWzFdKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBhcnJheUJ1ZmZlciA9IG5ldyBBcnJheUJ1ZmZlcihieXRlU3RyLmxlbmd0aCk7XHJcbiAgICAgICAgICAgIGludEFycmF5ID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlCdWZmZXIpO1xyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgYnl0ZVN0ci5sZW5ndGg7IGkgKz0gMSkge1xyXG4gICAgICAgICAgICAgICAgaW50QXJyYXlbaV0gPSBieXRlU3RyLmNoYXJDb2RlQXQoaSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgbWltZVN0ciA9IGRhdGFVUkkuc3BsaXQoJywnKVswXS5zcGxpdCgnOicpWzFdLnNwbGl0KCc7JylbMF07XHJcbiAgICAgICAgICAgIGlmIChjYW5CbG9iKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEJsb2IoWyRoLmhhc0FycmF5QnVmZmVyVmlld1N1cHBvcnQoKSA/IGludEFycmF5IDogYXJyYXlCdWZmZXJdLCB7dHlwZTogbWltZVN0cn0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGJiID0gbmV3IEJsb2JCdWlsZGVyKCk7XHJcbiAgICAgICAgICAgIGJiLmFwcGVuZChhcnJheUJ1ZmZlcik7XHJcbiAgICAgICAgICAgIHJldHVybiBiYi5nZXRCbG9iKG1pbWVTdHIpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgYXJyYXlCdWZmZXIyU3RyaW5nOiBmdW5jdGlvbiAoYnVmZmVyKSB7XHJcbiAgICAgICAgICAgIC8vbm9pbnNwZWN0aW9uIEpTVW5yZXNvbHZlZFZhcmlhYmxlXHJcbiAgICAgICAgICAgIGlmICh3aW5kb3cuVGV4dERlY29kZXIpIHtcclxuICAgICAgICAgICAgICAgIC8vIG5vaW5zcGVjdGlvbiBKU1VucmVzb2x2ZWRGdW5jdGlvblxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUZXh0RGVjb2RlcigndXRmLTgnKS5kZWNvZGUoYnVmZmVyKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgYXJyYXkgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuYXBwbHkobmV3IFVpbnQ4QXJyYXkoYnVmZmVyKSksIG91dCA9ICcnLCBpID0gMCwgbGVuLCBjLCBjaGFyMiwgY2hhcjM7XHJcbiAgICAgICAgICAgIGxlbiA9IGFycmF5Lmxlbmd0aDtcclxuICAgICAgICAgICAgd2hpbGUgKGkgPCBsZW4pIHtcclxuICAgICAgICAgICAgICAgIGMgPSBhcnJheVtpKytdO1xyXG4gICAgICAgICAgICAgICAgc3dpdGNoIChjID4+IDQpIHsgLy8ganNoaW50IGlnbm9yZTpsaW5lXHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDI6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNDpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDU6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gMHh4eHh4eHhcclxuICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gMTEweCB4eHh4ICAgMTB4eCB4eHh4XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIyID0gYXJyYXlbaSsrXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoKChjICYgMHgxRikgPDwgNikgfCAoY2hhcjIgJiAweDNGKSk7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDE0OlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyAxMTEwIHh4eHggIDEweHggeHh4eCAgMTB4eCB4eHh4XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIyID0gYXJyYXlbaSsrXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2hhcjMgPSBhcnJheVtpKytdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgoKGMgJiAweDBGKSA8PCAxMikgfCAvLyBqc2hpbnQgaWdub3JlOmxpbmVcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoY2hhcjIgJiAweDNGKSA8PCA2KSB8ICAvLyBqc2hpbnQgaWdub3JlOmxpbmVcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoY2hhcjMgJiAweDNGKSA8PCAwKSk7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNIdG1sOiBmdW5jdGlvbiAoc3RyKSB7XHJcbiAgICAgICAgICAgIHZhciBhID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7XHJcbiAgICAgICAgICAgIGEuaW5uZXJIVE1MID0gc3RyO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBjID0gYS5jaGlsZE5vZGVzLCBpID0gYy5sZW5ndGg7IGktLTspIHtcclxuICAgICAgICAgICAgICAgIGlmIChjW2ldLm5vZGVUeXBlID09PSAxKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNTdmc6IGZ1bmN0aW9uIChzdHIpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHN0ci5tYXRjaCgvXlxccyo8XFw/eG1sL2kpICYmIChzdHIubWF0Y2goLzwhRE9DVFlQRSBzdmcvaSkgfHwgc3RyLm1hdGNoKC88c3ZnL2kpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldE1pbWVUeXBlOiBmdW5jdGlvbiAoc2lnbmF0dXJlLCBjb250ZW50cywgdHlwZSkge1xyXG4gICAgICAgICAgICBzd2l0Y2ggKHNpZ25hdHVyZSkge1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTAnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTEnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTInOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2UvanBlZyc7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc4OTUwNEU0Nyc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdpbWFnZS9wbmcnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNDc0OTQ2MzgnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2UvZ2lmJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzQ5NDkyYTAwJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ltYWdlL3RpZmYnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTI0OTQ2NDYnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2Uvd2VicCc7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc2Njc0Nzk3MCc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd2aWRlby8zZ3AnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNGY2NzY3NTMnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndmlkZW8vb2dnJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzFhNDVkZmEzJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3ZpZGVvL21rdic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICcwMDAwMDFiYSc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICcwMDAwMDFiMyc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd2aWRlby9tcGVnJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzMwMjZiMjc1JzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3ZpZGVvL3dtdic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICcyNTUwNDQ0Nic6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9wZGYnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnMjUyMTUwNTMnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vcHMnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjAzMDQnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjA1MDYnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjA1MDgnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vemlwJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzM3N2FiY2FmJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uLzd6JztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzc1NzM3NDYxJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uL3Rhcic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc3ODAxNzMwZCc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9kbWcnO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHNpZ25hdHVyZS5zdWJzdHJpbmcoMCwgNikpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnNDM1NzUzJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24veC1zaG9ja3dhdmUtZmxhc2gnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0OTQ0MzMnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhdWRpby9tcDMnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0MjVhNjgnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9iemlwJztcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc2lnbmF0dXJlLnN1YnN0cmluZygwLCA0KSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzQyNGQnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ltYWdlL2JtcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZmZmYic6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXVkaW8vbXAzJztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0ZDVhJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9leGUnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzFmOWQnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzFmYTAnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uL3ppcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnMWY4Yic6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vZ3ppcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnRlbnRzICYmICFjb250ZW50cy5tYXRjaChcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9bXlxcdTAwMDAtXFx1MDA3Zl0vKSA/ICdhcHBsaWNhdGlvbi90ZXh0LXBsYWluJyA6IHR5cGU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBhZGRDc3M6IGZ1bmN0aW9uICgkZWwsIGNzcykge1xyXG4gICAgICAgICAgICAkZWwucmVtb3ZlQ2xhc3MoY3NzKS5hZGRDbGFzcyhjc3MpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0RWxlbWVudDogZnVuY3Rpb24gKG9wdGlvbnMsIHBhcmFtLCB2YWx1ZSkge1xyXG4gICAgICAgICAgICByZXR1cm4gKCRoLmlzRW1wdHkob3B0aW9ucykgfHwgJGguaXNFbXB0eShvcHRpb25zW3BhcmFtXSkpID8gdmFsdWUgOiAkKG9wdGlvbnNbcGFyYW1dKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHVuaXFJZDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICByZXR1cm4gTWF0aC5yb3VuZChuZXcgRGF0ZSgpLmdldFRpbWUoKSkgKyAnXycgKyBNYXRoLnJvdW5kKE1hdGgucmFuZG9tKCkgKiAxMDApO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaHRtbEVuY29kZTogZnVuY3Rpb24gKHN0ciwgdW5kZWZWYWwpIHtcclxuICAgICAgICAgICAgaWYgKHN0ciA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdW5kZWZWYWwgfHwgbnVsbDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gc3RyLnJlcGxhY2UoLyYvZywgJyZhbXA7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC88L2csICcmbHQ7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8+L2csICcmZ3Q7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cIi9nLCAnJnF1b3Q7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8nL2csICcmYXBvczsnKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHJlcGxhY2VUYWdzOiBmdW5jdGlvbiAoc3RyLCB0YWdzKSB7XHJcbiAgICAgICAgICAgIHZhciBvdXQgPSBzdHI7XHJcbiAgICAgICAgICAgIGlmICghdGFncykge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkLmVhY2godGFncywgZnVuY3Rpb24gKGtleSwgdmFsdWUpIHtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdmdW5jdGlvbicpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YWx1ZSA9IHZhbHVlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBvdXQuc3BsaXQoa2V5KS5qb2luKHZhbHVlKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHJldHVybiBvdXQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBjbGVhbk1lbW9yeTogZnVuY3Rpb24gKCR0aHVtYikge1xyXG4gICAgICAgICAgICB2YXIgZGF0YSA9ICR0aHVtYi5pcygnaW1nJykgPyAkdGh1bWIuYXR0cignc3JjJykgOiAkdGh1bWIuZmluZCgnc291cmNlJykuYXR0cignc3JjJyk7XHJcbiAgICAgICAgICAgICRoLnJldm9rZU9iamVjdFVSTChkYXRhKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGZpbmRGaWxlTmFtZTogZnVuY3Rpb24gKGZpbGVQYXRoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZXBJbmRleCA9IGZpbGVQYXRoLmxhc3RJbmRleE9mKCcvJyk7XHJcbiAgICAgICAgICAgIGlmIChzZXBJbmRleCA9PT0gLTEpIHtcclxuICAgICAgICAgICAgICAgIHNlcEluZGV4ID0gZmlsZVBhdGgubGFzdEluZGV4T2YoJ1xcXFwnK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gKi9cclxuICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIEVsZW1lbnQuQUxMT1dfS0VZQk9BUkRfSU5QVVQgKi9cclxuICAgICAgICAgICAgICAgIGlmIChkZS5yZXF1ZXN0RnVsbHNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGRlLnJlcXVlc3RGdWxsc2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkZS5tc1JlcXVlc3RGdWxsc2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlLm1zUmVxdWVzdEZ1bGxzY3JlZW4oKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGUubW96UmVxdWVzdEZ1bGxTY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlLm1velJlcXVlc3RGdWxsU2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGUud2Via2l0UmVxdWVzdEZ1bGxzY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZS53ZWJraXRSZXF1ZXN0RnVsbHNjcmVlbihFbGVtZW50LkFMTE9XX0tFWUJPQVJEX0lOUFVUKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIGRvY3VtZW50LmV4aXRGdWxsc2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC5tc0V4aXRGdWxsc2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC5tb3pDYW5jZWxGdWxsU2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC53ZWJraXRFeGl0RnVsbHNjcmVlbiAqL1xyXG4gICAgICAgICAgICAgICAgaWYgKGRvYy5leGl0RnVsbHNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGRvYy5leGl0RnVsbHNjcmVlbigpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLm1zRXhpdEZ1bGxzY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZG9jLm1zRXhpdEZ1bGxzY3JlZW4oKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLm1vekNhbmNlbEZ1bGxTY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvYy5tb3pDYW5jZWxGdWxsU2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLndlYmtpdEV4aXRGdWxsc2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jLndlYmtpdEV4aXRGdWxsc2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIG1vdmVBcnJheTogZnVuY3Rpb24gKGFyciwgb2xkSW5kZXgsIG5ld0luZGV4LCByZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgdmFyIG5ld0FyciA9ICQuZXh0ZW5kKHRydWUsIFtdLCBhcnIpO1xyXG4gICAgICAgICAgICBpZiAocmV2ZXJzZU9yZGVyKSB7XHJcbiAgICAgICAgICAgICAgICBuZXdBcnIucmV2ZXJzZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChuZXdJbmRleCA+PSBuZXdBcnIubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgayA9IG5ld0luZGV4IC0gbmV3QXJyLmxlbmd0aDtcclxuICAgICAgICAgICAgICAgIHdoaWxlICgoay0tKSArIDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBuZXdBcnIucHVzaCh1bmRlZmluZWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG5ld0Fyci5zcGxpY2UobmV3SW5kZXgsIDAsIG5ld0Fyci5zcGxpY2Uob2xkSW5kZXgsIDEpWzBdKTtcclxuICAgICAgICAgICAgaWYgKHJldmVyc2VPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgbmV3QXJyLnJldmVyc2UoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gbmV3QXJyO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYW5ab29tQ2FjaGU6IGZ1bmN0aW9uICgkZWwpIHtcclxuICAgICAgICAgICAgdmFyICRjYWNoZSA9ICRlbC5jbG9zZXN0KCcua3Ytem9vbS1jYWNoZS10aGVtZScpO1xyXG4gICAgICAgICAgICBpZiAoISRjYWNoZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRjYWNoZSA9ICRlbC5jbG9zZXN0KCcua3Ytem9vbS1jYWNoZScpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRjYWNoZS5yZW1vdmUoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGNsb3NlQnV0dG9uOiBmdW5jdGlvbiAoY3NzKSB7XHJcbiAgICAgICAgICAgIGNzcyA9IGNzcyA/ICdjbG9zZSAnICsgY3NzIDogJ2Nsb3NlJztcclxuICAgICAgICAgICAgcmV0dXJuICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cIicgKyBjc3MgKyAnXCIgYXJpYS1sYWJlbD1cIkNsb3NlXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICA8c3BhbiBhcmlhLWhpZGRlbj1cInRydWVcIj4mdGltZXM7PC9zcGFuPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzwvYnV0dG9uPic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBnZXRSb3RhdGlvbjogZnVuY3Rpb24gKHZhbHVlKSB7XHJcbiAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgMjpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3JvdGF0ZVkoMTgwZGVnKSc7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDM6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdyb3RhdGUoMTgwZGVnKSc7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdyb3RhdGUoMTgwZGVnKSByb3RhdGVZKDE4MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA1OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDI3MGRlZykgcm90YXRlWSgxODBkZWcpJztcclxuICAgICAgICAgICAgICAgIGNhc2UgNjpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3JvdGF0ZSg5MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA3OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDkwZGVnKSByb3RhdGVZKDE4MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA4OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDI3MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIHNldFRyYW5zZm9ybTogZnVuY3Rpb24gKGVsLCB2YWwpIHtcclxuICAgICAgICAgICAgaWYgKCFlbCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsLnN0eWxlLnRyYW5zZm9ybSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGUud2Via2l0VHJhbnNmb3JtID0gdmFsO1xyXG4gICAgICAgICAgICBlbC5zdHlsZVsnLW1vei10cmFuc2Zvcm0nXSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGVbJy1tcy10cmFuc2Zvcm0nXSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGVbJy1vLXRyYW5zZm9ybSddID0gdmFsO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgc2V0SW1hZ2VPcmllbnRhdGlvbjogZnVuY3Rpb24gKCRpbWcsICR6b29tSW1nLCB2YWx1ZSkge1xyXG4gICAgICAgICAgICBpZiAoISRpbWcgfHwgISRpbWcubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGV2ID0gJ2xvYWQuZmlsZWlucHV0aW1hZ2VvcmllbnQnO1xyXG4gICAgICAgICAgICAkaW1nLm9mZihldikub24oZXYsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciBpbWcgPSAkaW1nLmdldCgwKSwgem9vbUltZyA9ICR6b29tSW1nICYmICR6b29tSW1nLmxlbmd0aCA/ICR6b29tSW1nLmdldCgwKSA6IG51bGwsXHJcbiAgICAgICAgICAgICAgICAgICAgaCA9IGltZy5vZmZzZXRIZWlnaHQsIHcgPSBpbWcub2Zmc2V0V2lkdGgsIHIgPSAkaC5nZXRSb3RhdGlvbih2YWx1ZSk7XHJcbiAgICAgICAgICAgICAgICAkaW1nLmRhdGEoJ29yaWVudGF0aW9uJywgdmFsdWUpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHpvb21JbWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAkem9vbUltZy5kYXRhKCdvcmllbnRhdGlvbicsIHZhbHVlKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA8IDUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkaC5zZXRUcmFuc2Zvcm0oaW1nLCByKTtcclxuICAgICAgICAgICAgICAgICAgICAkaC5zZXRUcmFuc2Zvcm0oem9vbUltZywgcik7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdmFyIG9mZnNldEFuZ2xlID0gTWF0aC5hdGFuKHcgLyBoKSwgb3JpZ0ZhY3RvciA9IE1hdGguc3FydChNYXRoLnBvdyhoLCAyKSArIE1hdGgucG93KHcsIDIpKSxcclxuICAgICAgICAgICAgICAgICAgICBzY2FsZSA9ICFvcmlnRmFjdG9yID8gMSA6IChoIC8gTWF0aC5jb3MoTWF0aC5QSSAvIDIgKyBvZmZzZXRBbmdsZSkpIC8gb3JpZ0ZhY3RvcixcclxuICAgICAgICAgICAgICAgICAgICBzID0gJyBzY2FsZSgnICsgTWF0aC5hYnMoc2NhbGUpICsgJyknO1xyXG4gICAgICAgICAgICAgICAgJGguc2V0VHJhbnNmb3JtKGltZywgciArIHMpO1xyXG4gICAgICAgICAgICAgICAgJGguc2V0VHJhbnNmb3JtKHpvb21JbWcsIHIgKyBzKTtcclxuICAgICAgICAgICAg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cclxuICAgICAgICAgICAgc2VsZi51cGxvYWRDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkU3RhdHVzID0ge307XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkTG9nID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQXN5bmNDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudG90YWxJbWFnZXNDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheFJlcXVlc3RzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVCYXRjaENvbXBsZXRlZCA9IHRydWU7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5pc1ByZXZpZXdhYmxlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnNob3dQcmV2aWV3ID0gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5pc0Vycm9yID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgc2VsZi5jYW5jZWxsaW5nID0gZmFsc2U7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdDogZnVuY3Rpb24gKG9wdGlvbnMsIHJlZnJlc2hNb2RlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZiwgJGVsID0gc2VsZi4kZWxlbWVudCwgJGNvbnQsIHQsIHRtcDtcclxuICAgICAgICAgICAgc2VsZi5vcHRpb25zID0gb3B0aW9ucztcclxuICAgICAgICAgICAgJC5lYWNoKG9wdGlvbnMsIGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7XHJcbiAgICAgICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21pbkZpbGVDb3VudCc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWF4RmlsZUNvdW50JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtaW5GaWxlU2l6ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWF4RmlsZVNpemUnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21heEZpbGVQcmV2aWV3U2l6ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAncmVzaXplSW1hZ2VRdWFsaXR5JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdyZXNpemVJZlNpemVNb3JlVGhhbic6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAncHJvZ3Jlc3NVcGxvYWRUaHJlc2hvbGQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2luaXRpYWxQcmV2aWV3Q291bnQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3pvb21Nb2RhbEhlaWdodCc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWluSW1hZ2VIZWlnaHQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21heEltYWdlSGVpZ2h0JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtaW5JbWFnZVdpZHRoJzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtYXhJbWFnZVdpZHRoJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZltrZXldID0gJGguZ2V0TnVtKHZhbHVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZltrZXldID0gdmFsdWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9K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kY29udGFpbmVyID0gc2VsZi5fY3JlYXRlQ29udGFpbmVyKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yZWZyZXNoQ29udGFpbmVyKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGNvbnQgPSBzZWxmLiRjb250YWluZXI7XHJcbiAgICAgICAgICAgIHNlbGYuJGRyb3Bab25lID0gJGNvbnQuZmluZCgnLmZpbGUtZHJvcC16b25lJyk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByb2dyZXNzID0gJGNvbnQuZmluZCgnLmt2LXVwbG9hZC1wcm9ncmVzcycpO1xyXG4gICAgICAgICAgICBzZWxmLiRidG5VcGxvYWQgPSAkY29udC5maW5kKCcuZmlsZWlucHV0LXVwbG9hZCcpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyID0gJGguZ2V0RWxlbWVudChvcHRpb25zLCAnZWxDYXB0aW9uQ29udGFpbmVyJywgJGNvbnQuZmluZCgnLmZpbGUtY2FwdGlvbicpKTtcclxuICAgICAgICAgICAgc2VsZi4kY2FwdGlvbiA9ICRoLmdldEVsZW1lbnQob3B0aW9ucywgJ2VsQ2FwdGlvblRleHQnLCAkY29udC5maW5kKCcuZmlsZS1jYXB0aW9uLW5hbWUnKSk7XHJcbiAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShzZWxmLm1zZ1BsYWNlaG9sZGVyKSkge1xyXG4gICAgICAgICAgICAgICAgZiA9ICRlbC5hdHRyKCdtdWx0aXBsZScpID8gc2VsZi5maWxlUGx1cmFsIDogc2VsZi5maWxlU2luZ2xlO1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbi5hdHRyKCdwbGFjZWhvbGRlcicsIHNlbGYubXNnUGxhY2Vob2xkZXIucmVwbGFjZSgne2ZpbGVzfScsIGYpKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uSWNvbiA9IHNlbGYuJGNhcHRpb25Db250YWluZXIuZmluZCgnLmZpbGUtY2FwdGlvbi1pY29uJyk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByZXZpZXdDb250YWluZXIgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbFByZXZpZXdDb250YWluZXInLCAkY29udC5maW5kKCcuZmlsZS1wcmV2aWV3JykpO1xyXG4gICAgICAgICAgICBzZWxmLiRwcmV2aWV3ID0gJGguZ2V0RWxlbWVudChvcHRpb25zLCAnZWxQcmV2aWV3SW1hZ2UnLCAkY29udC5maW5kKCcuZmlsZS1wcmV2aWV3LXRodW1ibmFpbHMnKSk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByZXZpZXdTdGF0dXMgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbFByZXZpZXdTdGF0dXMnLCAkY29udC5maW5kKCcuZmlsZS1wcmV2aWV3LXN0YXR1cycpKTtcclxuICAgICAgICAgICAgc2VsZi4kZXJyb3JDb250YWluZXIgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbEVycm9yQ29udGFpbmVyJyxcclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXdDb250YWluZXIuZmluZCgnLmt2LWZpbGVpbnB1dC1lcnJvcicpKTtcclxuICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEaXNhYmxlZCgpO1xyXG4gICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoc2VsZi5tc2dFcnJvckNsYXNzKSkge1xyXG4gICAgICAgICAgICAgICAgJGguYWRkQ3NzKHNlbGYuJGVycm9yQ29udGFpbmVyLCBzZWxmLm1zZ0Vycm9yQ2xhc3MpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghcmVmcmVzaE1vZGUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGVycm9yQ29udGFpbmVyLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0luaXRJZCA9ICdwcmV2aWV3LScgKyAkaC51bmlxSWQoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3Q2FjaGUoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi4kcGFyZW50Lmhhc0NsYXNzKCdmaWxlLWxvYWRpbmcnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5pbnNlcnRCZWZvcmUoc2VsZi4kcGFyZW50KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRwYXJlbnQucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuX2Vycm9yc0V4aXN0KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fc2V0RmlsZURyb3Bab25lVGl0bGUoKTtcclxuICAgICAgICAgICAgaWYgKCRlbC5hdHRyKCdkaXNhYmxlZCcpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmRpc2FibGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9pbml0Wm9vbSgpO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5oaWRlVGh1bWJuYWlsQ29udGVudCkge1xyXG4gICAgICAgICAgICAgICAgJGguYWRkQ3NzKHNlbGYuJHByZXZpZXcsICdoaWRlLWNvbnRlbnQnKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAg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W5wdXQtZ3JvdXAtYXBwZW5kXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAge3JlbW92ZX1cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICB7Y2FuY2VsfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIHt1cGxvYWR9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAge2Jyb3dzZX1cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgICAgICAgdE1haW4yID0gJ3twcmV2aWV3fVxcbjxkaXYgY2xhc3M9XCJrdi11cGxvYWQtcHJvZ3Jlc3Mga3YtaGlkZGVuXCI+PC9kaXY+XFxuPGRpdiBjbGFzcz1cImNsZWFyZml4XCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAne3JlbW92ZX1cXG57Y2FuY2VsfVxcbnt1cGxvYWR9XFxue2Jyb3dzZX1cXG4nO1xyXG4gICAgICAgICAgICB0UHJldmlldyA9ICc8ZGl2IGNsYXNzPVwiZmlsZS1wcmV2aWV3IHtjbGFzc31cIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAge2Nsb3NlfScgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwie2Ryb3BDbGFzc31cIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtcHJldmlldy10aHVtYm5haWxzXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwiY2xlYXJmaXhcIj48L2Rpdj4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtcHJldmlldy1zdGF0dXMgdGV4dC1jZW50ZXIgdGV4dC1zdWNjZXNzX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icgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIDxzcGFuIGNsYXNzPVwia3Ytem9vbS10aXRsZVwiPjwvc3Bhbj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICA8ZGl2IGNsYXNzPVwia3Ytem9vbS1hY3Rpb25zXCI+e3RvZ2dsZWhlYWRlcn17ZnVsbHNjcmVlbn17Ym9yZGVybGVzc317Y2xvc2V9PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwibW9kYWwtYm9keVwiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIDxkaXYgY2xhc3M9XCJmbG9hdGluZy1idXR0b25zXCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgPGRpdiBjbGFzcz1cImt2LXpvb20tYm9keSBmaWxlLXpvb20tY29udGVudCB7em9vbUZyYW1lQ2xhc3N9XCI+PC9kaXY+XFxuJyArICd7cHJldn0ge25leHR9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+XFxuJztcclxuICAgICAgICAgICAgdFByb2dyZXNzID0gJzxkaXYgY2xhc3M9XCJwcm9ncmVzc1wiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwie2NsYXNzfVwiIHJvbGU9XCJwcm9ncmVzc2JhclwiJyArXHJcbiAgICAgICAgICAgICAgICAnIGFyaWEtdmFsdWVub3c9XCJ7cGVyY2VudH1cIiBhcmlhLXZhbHVlbWluPVwiMFwiIGFyaWEtdmFsdWVtYXg9XCIxMDBcIiBzdHlsZT1cIndpZHRoOntwZXJjZW50fSU7XCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgICB7c3RhdHVzfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgICAgICAgdFNpemUgPSAnIDxzYW1wPih7c2l6ZVRleHR9KTwvc2FtcD4nO1xyXG4gICAgICAgICAgICB0Rm9vdGVyID0gJzxkaXYgY2xhc3M9XCJmaWxlLXRodW1ibmFpbC1mb290ZXJcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtZm9vdGVyLWNhcHRpb25cIiB0aXRsZT1cIntjYXB0aW9ufVwiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgICAgPGRpdiBjbGFzcz1cImZpbGUtY2FwdGlvbi1pbmZvXCI+e2NhcHRpb259PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgICA8ZGl2IGNsYXNzPVwiZmlsZS1zaXplLWluZm9cIj57c2l6ZX08L2Rpdj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIHtwcm9ncmVzc31cXG57aW5kaWNhdG9yfVxcbnthY3Rpb25zfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzwvZGl2Pic7XHJcbiAgICAgICAgICAgIHRBY3Rpb25zID0gJzxkaXYgY2xhc3M9XCJmaWxlLWFjdGlvbnNcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtZm9vdGVyLWJ1dHRvbnNcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICAgIHtkb3dubG9hZH0ge3VwbG9hZH0ge2RlbGV0ZX0ge3pvb219IHtvdGhlcn0nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAne2RyYWd9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPGRpdiBjbGFzcz1cImNsZWFyZml4XCI+PC9kaXY+JztcclxuICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSHRtbFVua25vd25BdHRyaWJ1dGVcclxuICAgICAgICAgICAgdEFjdGlvbkRlbGV0ZSA9ICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cImt2LWZpbGUtcmVtb3ZlIHtyZW1vdmVDbGFzc31cIiAnICtcclxuICAgICAgICAgICAgICAgICd0aXRsZT1cIntyZW1vdmVUaXRsZX1cIiB7ZGF0YVVybH17ZGF0YUtleX0+e3JlbW92ZUljb259PC9idXR0b24+XFxuJztcclxuICAgICAgICAgICAgdEFjdGlvblVwbG9hZCA9ICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cImt2LWZpbGUtdXBsb2FkIHt1cGxvYWRDbGFzc31cIiB0aXRsZT1cInt1cGxvYWRUaXRsZX1cIj4nICtcclxuICAgICAgICAgICAgICAgICd7dXBsb2FkSWNvbn08L2J1dHRvbj4nO1xyXG4gICAgICAgICAgICB0QWN0aW9uRG93bmxvYWQgPSAnPGEgY2xhc3M9XCJrdi1maWxlLWRvd25sb2FkIHtkb3dubG9hZENsYXNzfVwiIHRpdGxlPVwie2Rvd25sb2FkVGl0bGV9XCIgJyArXHJcbiAgICAgICAgICAgICAgICAnaHJlZj1cIntkb3dubG9hZFVybH1cIiBkb3dubG9hZD1cIntjYXB0aW9ufVwiIHRhcmdldD1cIl9ibGFua1wiPntkb3dubG9hZEljb259PC9hPic7XHJcbiAgICAgICAgICAgIHRBY3Rpb25ab29tID0gJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwia3YtZmlsZS16b29tIHt6b29tQ2xhc3N9XCIgJyArXHJcbiAgICAgICAgICAgICAgICAndGl0bGU9XCJ7em9vbVRpdGxlfVwiPnt6b29tSWNv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ZSArICc+XFxuJyArICc8cGFyYW0gbmFtZT1cIm1vdmllXCIgdmFsdWU9XCJ7Y2FwdGlvbn1cIiAvPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJGguT0JKRUNUX1BBUkFNUyArICcgJyArICRoLkRFRkFVTFRfUFJFVklFVyArICdcXG48L29iamVjdD5cXG4nO1xyXG4gICAgICAgICAgICB0T3RoZXIgPSAnPGRpdiBjbGFzcz1cImt2LXByZXZpZXctZGF0YSBmaWxlLXByZXZpZXctb3RoZXItZnJhbWVcIicgKyB0U3R5bGUgKyAnPlxcbicgKyAkaC5ERUZBVUxUX1BSRVZJRVcgKyAnXFxuPC9kaXY+XFxuJztcclxuICAgICAgICAgICAgdFpvb21DYWNoZSA9ICc8ZGl2IGNsYXNzPVwia3Ytem9vbS1jYWNoZVwiIHN0eWxlPVwiZGlzcGxheTpub25lXCI+e3pvb21Db250ZW50fTwvZGl2Pic7XHJcbiAgICAgICAgICAgIHZEZWZhdWx0RGltID0ge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9O1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5faXNQZGZSZW5kZXJlZCgpKSB7XHJcbiAgICAgICAgICAgICAgICB0UGRmID0gc2VsZi5wZGZSZW5kZXJlclRlbXBsYXRlLnJlcGxhY2UoJ3tyZW5kZXJlcn0nLCBzZWxmLl9lbmNvZGVVUkkoc2VsZi5wZGZSZW5kZXJlclVybCkpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuZGVmYXVsdHMgPSB7XHJcbiAgICAgICAgICAgICAgICBsYXlvdXRUZW1wbGF0ZXM6IHtcclxuICAgICAgICAgICAgICAgICAgICBtYWluMTogdE1haW4xLFxyXG4gICAgICAgICAgICAgICAgICAgIG1haW4yOiB0TWFpbjIsXHJcbiAgICAgICAgICAgICAgICAgICAgcHJldmlldzogdFByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAgICAgY2xvc2U6IHRDbG9zZSxcclxuICAgICAgICAgICAgICAgICAgICBmaWxlSWNvbjogdEZpbGVJY29uLFxyXG4gICAgICAgICAgICAgICAgICAgIGNhcHRpb246IHRDYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgIG1vZGFsTWFpbjogdE1vZGFsTWFpbixcclxuICAgICAgICAgICAgICAgICAgICBtb2RhbDogdE1vZGFsLFxyXG4gICAgICAgICAgICAgICAgICAgIHByb2dyZXNzOiB0UHJvZ3Jlc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgc2l6ZTogdFNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgZm9vdGVyOiB0Rm9vdGVyLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvcjogdEluZGljYXRvcixcclxuICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiB0QWN0aW9ucyxcclxuICAgICAgICAgICAgICAgICAgICBhY3Rpb25EZWxldGU6IHRBY3Rpb25EZWxldGUsXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uVXBsb2FkOiB0QWN0aW9uVXBsb2FkLFxyXG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbkRvd25sb2FkOiB0QWN0aW9uRG93bmxvYWQsXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uWm9vbTogdEFjdGlvblpvb20sXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uRHJhZzogdEFjdGlvbkRyYWcsXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuRGVmYXVsdDogdEJ0bkRlZmF1bHQsXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuTGluazogdEJ0bkxpbmssXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuQnJvd3NlOiB0QnRuQnJvd3NlLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21DYWNoZTogdFpvb21DYWNoZVxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHByZXZpZXdNYXJrdXBUYWdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQmVmb3JlMTogdFRhZ0JlZjEsXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQmVmb3JlMjogdFRhZ0JlZjIsXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQWZ0ZXI6IHRUYWdBZnRcclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3Q29udGVudFRlbXBsYXRlczoge1xyXG4gICAgICAgICAgICAgICAgICAgIGdlbmVyaWM6IHRHZW5lcmljLFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IHRIdG1sLFxyXG4gICAgICAgICAgICAgICAgICAgIGltYWdlOiB0SW1hZ2UsXHJcbiAgICAgICAgICAgICAgICAgICAgdGV4dDogdFRleHQsXHJcbiAgICAgICAgICAgICAgICAgICAgb2ZmaWNlOiB0T2ZmaWNlLFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB0R2RvY3MsXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IHRWaWRlbyxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzogdEF1ZGlvLFxyXG4gICAgICAgICAgICAgICAgICAgIGZsYXNoOiB0Rmxhc2gsXHJcbiAgICAgICAgICAgICAgICAgICAgb2JqZWN0OiB0T2JqZWN0LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogdFBkZixcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjogdE90aGVyXHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgYWxsb3dlZFByZXZpZXdUeXBlczogWydpbWFnZScsICdodG1sJywgJ3RleHQnLCAndmlkZW8nLCAnYXVkaW8nLCAnZmxhc2gnLCAncGRmJywgJ29iamVjdCddLFxyXG4gICAgICAgICAgICAgICAgcHJldmlld1RlbXBsYXRlczoge30sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3U2V0dGluZ3M6IHtcclxuICAgICAgICAgICAgICAgICAgICBpbWFnZToge3dpZHRoOiAnYXV0bycsIGhlaWdodDogJ2F1dG8nLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWF4LWhlaWdodCc6ICcxMDAlJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgaHRtbDoge3dpZHRoOiAnMjEzcHgnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBnZG9jczoge3dpZHRoOiAnMjEzcHgnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHZpZGVvOiB7d2lkdGg6ICcyMTNweCcsIGhlaWdodDogJzE2MHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgYXVkaW86IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICczMHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgZmxhc2g6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBwZGY6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIG90aGVyOiB7d2lkdGg6ICcyMTNweCcsIGhlaWdodDogJzE2MHB4J31cclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3U2V0dGluZ3NTbWFsbDoge1xyXG4gICAgICAgICAgICAgICAgICAgIGltYWdlOiB7d2lkdGg6ICdhdXRvJywgaGVpZ2h0OiAnYXV0bycsICdtYXgtd2lkdGgnOiAnMTAwJScsICdtYXgtaGVpZ2h0JzogJzEwMCUnfSxcclxuICAgICAgICAgICAgICAgICAgICBodG1sOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICB0ZXh0OiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICB2aWRlbzoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJ2F1dG8nfSxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzMwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBmbGFzaDoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJ2F1dG8nfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICdhdXRvJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgcGRmOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzE2MHB4J31cclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3Wm9vbVNldHRpbmdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICdhdXRvJywgJ21heC13aWR0aCc6ICcxMDAlJywgJ21heC1oZWlnaHQnOiAnMTAwJSd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IHZEZWZhdWx0RGltLFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IHZEZWZhdWx0RGltLFxyXG4gICAgICAgICAgICAgICAgICAgIG9mZmljZToge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzEwMCUnLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTAwJScsICdtYXgtd2lkdGgnOiAnMTAwJScsICdtaW4taGVpZ2h0JzogJzQ4MHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICcxMDAlJywgJ21heC13aWR0aCc6ICcxMDAlJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgYXVkaW86IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICczMHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgZmxhc2g6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIG9iamVjdDoge3dpZHRoOiAnYXV0bycsIGhlaWdodDogJzEwMCUnLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogdkRlZmF1bHREaW0sXHJcbiAgICAgICAgICAgICAgICAgICAgb3RoZXI6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICcxMDAlJywgJ21pbi1oZWlnaHQnOiAnNDgwcHgnfVxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIG1pbWVUeXBlQWxpYXNlczoge1xyXG4gICAgICAgICAgICAgICAgICAgICd2aWRlby9xdWlja3RpbWUnOiAndmlkZW8vbXA0J1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIGZpbGVUeXBlU2V0dGluZ3M6IHtcclxuICAgICAgICAgICAgICAgICAgICBpbWFnZTogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCRoLmNvbXBhcmUodlR5cGUsICdpbWFnZS4qJykgJiYgISRoLmNvbXBhcmUodlR5cGUsIC8odGlmZj98d21mKSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4oZ2lmfHBuZ3xqcGU/ZykkL2kpKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd0ZXh0L2h0bWwnKSB8fCAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKGh0bXxodG1sKSQvaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsIC8od29yZHxleGNlbHxwb3dlcnBvaW50fG9mZmljZSkkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKGRvY3g/fHhsc3g/fHBwdHg/fHBwc3xwb3R4PykkL2kpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgZ2RvY3M6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsIC8od29yZHxleGNlbHxwb3dlcnBvaW50fG9mZmljZXxpd29yay1wYWdlc3x0aWZmPykkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9cXC4oZG9jeD98eGxzeD98cHB0eD98cHBzfHBvdHg/fHJ0ZnxvZHN8b2R0fHBhZ2VzfGFpfGR4Znx0dGZ8dGlmZj98d21mfGU/cHMpJC9pKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd0ZXh0LionKSB8fCAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKHhtbHxqYXZhc2NyaXB0KSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4odHh0fG1kfGNzdnxuZm98aW5pfGpzb258cGhwfGpzfGNzcykkL2kpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd2aWRlby4qJykgJiYgKCRoLmNvbXBhcmUodlR5cGUsIC8ob2dnfG1wNHxtcD9nfG1vdnx3ZWJtfDNncCkkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKG9nP3xtcDR8d2VibXxtcD9nfG1vdnwzZ3ApJC9pKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGguY29tcGFyZSh2VHlwZSwgJ2F1ZGlvLionKSAmJiAoJGguY29tcGFyZSh2TmFtZSwgLyhvZ2d8bXAzfG1wP2d8d2F2KSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4ob2c/fG1wM3xtcD9nfHdhdikkL2kpKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIGZsYXNoOiBmdW5jdGlvbiAodlR5cGUsIHZOYW1lKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkaC5jb21wYXJlKHZUeXBlLCAnYXBwbGljYXRpb24veC1zaG9ja3dhdmUtZmxhc2gnLCB0cnVlKSB8fCAkaC5jb21wYXJlKHZOYW1lLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgL1xcLihzd2YpJC9pKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGguY29tcGFyZSh2VHlwZSwgJ2FwcGxpY2F0aW9uL3BkZicsIHRydWUpIHx8ICRoLmNvbXBhcmUodk5hbWUsIC9cXC4ocGRmKSQvaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZmlsZUFjdGlvblNldHRpbmdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2hvd1JlbW92ZTogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93VXBsb2FkOiB0cnVlLFxyXG4gICAgICAgICAgICAgICAgICAgIHNob3dEb3dubG9hZDogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93Wm9vbTogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93RHJhZzogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICByZW1vdmVJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXRyYXNoXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgcmVtb3ZlQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGVmYXVsdCBidG4tb3V0bGluZS1zZWNvbmRhcnknLFxyXG4gICAgICAgICAgICAgICAgICAgIHJlbW92ZUVycm9yQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGFuZ2VyJyxcclxuICAgICAgICAgICAgICAgICAgICByZW1vdmVUaXRsZTogJ1JlbW92ZSBmaWxlJyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXVwbG9hZFwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIHVwbG9hZENsYXNzOiAnYnRuIGJ0bi1zbSBidG4ta3YgYnRuLWRlZmF1bHQgYnRuLW91dGxpbmUtc2Vjb25kYXJ5JyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRUaXRsZTogJ1VwbG9hZCBmaWxlJyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRSZXRyeUljb246ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tcmVwZWF0XCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgdXBsb2FkUmV0cnlUaXRsZTogJ1JldHJ5IHVwbG9hZCcsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLWRvd25sb2FkXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRDbGFzczogJ2J0biBidG4tc20gYnRuLWt2IGJ0bi1kZWZhdWx0IGJ0bi1vdXRsaW5lLXNlY29uZGFyeScsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRUaXRsZTogJ0Rvd25sb2FkIGZpbGUnLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21JY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXpvb20taW5cIj48L2k+JyxcclxuICAgICAgICAgICAgICAgICAgICB6b29tQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGVmYXVsdCBidG4tb3V0bGluZS1zZWNvbmRhcnknLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21UaXRsZTogJ1ZpZXcgRGV0YWlscycsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ0ljb246ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tbW92ZVwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGRyYWdDbGFzczogJ3RleHQtaW5mbycsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ1RpdGxlOiAnTW92ZSAvIFJlYXJyYW5nZScsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ1NldHRpbmdzOiB7fSxcclxuICAgICAgICAgICAgICAgICAgICBpbmRpY2F0b3JOZXc6ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tcGx1cy1zaWduIHRleHQtd2FybmluZ1wiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvclN1Y2Nlc3M6ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tb2stc2lnbiB0ZXh0LXN1Y2Nlc3NcIj48L2k+JyxcclxuICAgICAgICAgICAgICAgICAgICBpbmRpY2F0b3JFcnJvcjogJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGdseXBoaWNvbi1leGNsYW1hdGlvbi1zaWduIHRleHQtZGFuZ2VyXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgaW5kaWNhdG9yTG9hZGluZzogJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGdseXBoaWNvbi1ob3VyZ2xhc3MgdGV4dC1tdXRlZFwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvck5ld1RpdGxlOiAnTm90IHVwbG9hZGVkIHlldCcsXHJcbiAgICAgICAgICAgICAgICAgICAgaW5kaWNhdG9yU3VjY2Vzc1RpdGxlOiAnVXBsb2FkZWQnLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvckVycm9yVGl0bGU6ICdVcGxvYWQgRXJyb3InLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvckxvYWRpbmdUaXRsZTogJ1VwbG9hZGluZyAuLi4nXHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICQuZWFjaChzZWxmLmRlZmF1bHRzLCBmdW5jdGlvbiAoa2V5LCBzZXR0aW5nKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSAnYWxsb3dlZFByZXZpZXdUeXBlcycpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzID0gc2V0dGluZztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZltrZXldID0gJC5leHRlbmQodHJ1ZSwge30sIHNldHRpbmcsIHNlbGZba2V5XSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0UHJldmlld1RlbXBsYXRlcygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3VGVtcGxhdGVzOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdGFncyA9IHNlbGYucHJldmlld01hcmt1cFRhZ3MsIHRhZ0JlZiwgdGFnQWZ0ID0gdGFncy50YWdBZnRlcjtcclxuICAgICAgICAgICAgJC5lYWNoKHNlbGYucHJldmlld0NvbnRlbnRUZW1wbGF0ZXMsIGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShzZWxmLnByZXZpZXdUZW1wbGF0ZXNba2V5XSkpIHtcclxuICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdzLnRhZ0JlZm9yZTI7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleSA9PT0gJ2dlbmVyaWMnIHx8IGtleSA9PT0gJ2ltYWdlJyB8fCBrZXkgPT09ICdodG1sJyB8fCBrZXkgPT09ICd0ZXh0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdzLnRhZ0JlZm9yZTE7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLl9pc1BkZlJlbmRlcmVkKCkgJiYga2V5ID09PSAncGRmJykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdCZWYucmVwbGFjZSgna3YtZmlsZS1jb250ZW50JywgJ2t2LWZpbGUtY29udGVudCBrdi1wZGYtcmVuZGVyZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3VGVtcGxhdGVzW2tleV0gPSB0YWdCZWYgKyB2YWx1ZSArIHRhZ0FmdDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFByZXZpZXdDYWNoZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlID0ge1xyXG4gICAgICAgICAgICAgICAgZGF0YToge30sXHJcbiAgICAgICAgICAgICAgICBpbml0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNvbnRlbnQgPSBzZWxmLmluaXRpYWxQcmV2aWV3O1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChjb250ZW50Lmxlbmd0aCA+IDAgJiYgISRoLmlzQXJyYXkoY29udGVudCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudCA9IGNvbnRlbnQuc3BsaXQoc2VsZi5pbml0aWFsUHJldmlld0RlbGltaXRlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZzogc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGFnczogc2VsZi5pbml0aWFsUHJldmlld1RodW1iVGFnc1xyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgY291bnQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFzZWxmLnByZXZpZXdDYWNoZS5kYXRhICYmICEhc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50ID9cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50Lmxlbmd0aCA6IDA7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoaSwgaXNEaXNhYmxlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBpbmQgPSAnaW5pdF8nICsgaSwgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmRhdGEsIGNvbmZpZyA9IGRhdGEuY29uZmlnW2ldLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50ID0gZGF0YS5jb250ZW50W2ldLCBwcmV2aWV3SWQgPSBzZWxmLnByZXZpZXdJbml0SWQgKyAnLScgKyBpbmQsIG91dCwgJHRtcCwgY2F0LCBmdHIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZuYW1lLCBmdHlwZSwgZnJhbWVDbGFzcywgYXNEYXRhID0gJGguaWZTZXQoJ3ByZXZpZXdBc0RhdGEnLCBjb25maWcsIHNlbGYuaW5pdGlhbFByZXZpZXdBc0RhdGEpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBhID0gY29uZmlnID8ge3RpdGxlOiBjb25maWcudGl0bGUgfHwgbnVsbCwgYWx0OiBjb25maWcuYWx0IHx8IG51bGx9IDoge3RpdGxlOiBudWxsLCBhbHQ6IG51bGx9LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJzZVRlbXBsYXRlID0gZnVuY3Rpb24gKGNhdCwgZGF0LCBmbiwgZnQsIGlkLCBmdHIsIGluZCwgZmMsIHQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZjID0gJyBmaWxlLXByZXZpZXctaW5pdGlhbCAnICsgJGguU09SVF9DU1MgKyAoZmMgPyAnICcgKyBmYyA6ICcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzZWxmLl9nZW5lcmF0ZVByZXZpZXdUZW1wbGF0ZShjYXQsIGRhdCwgZm4sIGZ0LCBpZCwgZmFsc2UsIG51bGwsIGZjLCBmdHIsIGluZCwgdCwgYSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFjb250ZW50KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaXNEaXNhYmxlZCA9IGlzRGlzYWJsZWQgPT09IHVuZGVmaW5lZCA/IHRydWUgOiBpc0Rpc2FibGVkO1xyXG4gICAgICAgICAgICAgICAgICAgIGNhdCA9ICRoLmlmU2V0KCd0eXBlJywgY29uZmlnLCBzZWxmLmluaXRpYWxQcmV2aWV3RmlsZVR5cGUgfHwgJ2dlbmVyaWMnKTtcclxuICAgICAgICAgICAgICAgICAgICBmbmFtZSA9ICRoLmlmU2V0KCdmaWxlbmFtZScsIGNvbmZpZywgJGguaWZTZXQoJ2NhcHRpb24nLCBjb25maWcpKTtcclxuICAgICAgICAgICAgICAgICAgICBmdHlwZSA9ICRoLmlmU2V0KCdmaWxldHlwZScsIGNvbmZpZywgY2F0KTtcclxuICAgICAgICAgICAgICAgICAgICBmdHIgPSBzZWxmLnByZXZpZXdDYWNoZS5mb290ZXIoaSwgaXNEaXNhYmxlZCwgKGNvbmZpZyAmJiBjb25maWcuc2l6ZSB8fCBudWxsKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgZnJhbWVDbGFzcyA9ICRoLmlmU2V0KCdmcmFtZUNsYXNzJywgY29uZmlnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoYXNEYXRhKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9IHBhcnNlVGVtcGxhdGUoY2F0LCBjb250ZW50LCBmbmFtZSwgZnR5cGUsIHByZXZpZXdJZCwgZnRyLCBpbmQsIGZyYW1lQ2xhc3MpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9IHBhcnNlVGVtcGxhdGUoJ2dlbmVyaWMnLCBjb250ZW50LCBmbmFtZSwgZnR5cGUsIHByZXZpZXdJZCwgZnRyLCBpbmQsIGZyYW1lQ2xhc3MsIGNhdClcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRUb2tlbnMoeydjb250ZW50JzogZGF0YS5jb250ZW50W2ldfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLnRhZ3MubGVuZ3RoICYmIGRhdGEudGFnc1tpXSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSAkaC5yZXBsYWNlVGFncyhvdXQsIGRhdGEudGFnc1tpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIGNvbmZpZy5mcmFtZUF0dHIgKi9cclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoY29uZmlnKSAmJiAhJGguaXNFbXB0eShjb25maWcuZnJhbWVBdHRyKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSkuaHRtbChvdXQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wLmZpbmQoJy5maWxlLXByZXZpZXctaW5pdGlhbCcpLmF0dHIoY29uZmlnLmZyYW1lQXR0cik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9ICR0bXAuaHRtbCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIGFkZDogZnVuY3Rpb24gKGNvbnRlbnQsIGNvbmZpZywgdGFncywgYXBwZW5kKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRhdGEgPSBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLCBpbmRleDtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzQXJyYXkoY29udGVudCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudCA9IGNvbnRlbnQuc3BsaXQoc2VsZi5pbml0aWFsUHJldmlld0RlbGltaXRlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhcHBlbmQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBkYXRhLmNvbnRlbnQucHVzaChjb250ZW50KSAtIDE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnW2luZGV4XSA9IGNvbmZpZztcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS50YWdzW2luZGV4XSA9IHRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBjb250ZW50Lmxlbmd0aCAtIDE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29udGVudCA9IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnID0gY29uZmlnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLnRhZ3MgPSB0YWdzO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhID0gZGF0YTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXg7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoY29udGVudCwgY29uZmlnLCB0YWdzLCBhcHBlbmQpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmRhdGEsIGksIGNoaztcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWNvbnRlbnQgfHwgIWNvbnRlbnQubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCEkaC5pc0FycmF5KGNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQgPSBjb250ZW50LnNwbGl0KHNlbGYuaW5pdGlhbFByZXZpZXdEZWxpbWl0ZXIpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBjaGsgPSBjb250ZW50LmZpbHRlcihmdW5jdGlvbiAobikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAhPT0gbnVsbDtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWNoay5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5jb250ZW50ID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb250ZW50ID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmNvbmZpZyA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLnRhZ3MgPT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLnRhZ3MgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGFwcGVuZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29udGVudC5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRlbnRbaV0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhLmNvbnRlbnQucHVzaChjb250ZW50W2ldKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29uZmlnLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29uZmlnW2ldKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWcucHVzaChjb25maWdbaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCB0YWdzLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGFnc1tpXSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudGFncy5wdXNoKHRhZ3NbaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb250ZW50ID0gY29udGVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWcgPSBjb25maWc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudGFncyA9IHRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSBkYXRhO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHVuc2V0OiBmdW5jdGlvbiAoaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgY2hrID0gc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSwgcmV2ID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghY2hrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNoayA9PT0gMSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLmNvbnRlbnQgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb25maWcgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS50YWdzID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXcgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50ID0gJGguc3BsaWNlQXJyYXkoc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50LCBpbmRleCwgcmV2KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLmNvbmZpZyA9ICRoLnNwbGljZUFycmF5KHNlbGYucHJldmlld0NhY2hlLmRhdGEuY29uZmlnLCBpbmRleCwgcmV2KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLnRhZ3MgPSAkaC5zcGxpY2VBcnJheShzZWxmLnByZXZpZXdDYWNoZS5kYXRhLnRhZ3MsIGluZGV4LCByZXYpO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIG91dDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBodG1sID0gJycsIGNhcHRpb24sIGxlbiA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCksIGksIGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxlbiA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge2NvbnRlbnQ6ICcnLCBjYXB0aW9uOiAnJ307XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50ID0gc2VsZi5wcmV2aWV3Q2FjaGUuZ2V0KGkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBodG1sID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyID8gKGNvbnRlbnQgKyBodG1sKSA6IChodG1sICsgY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNhcHRpb24gPSBzZWxmLl9nZXRNc2dTZWxlY3RlZChsZW4pO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7Y29udGVudDogaHRtbCwgY2FwdGlvbjogY2FwdGlvbn07XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZm9vdGVyOiBmdW5jdGlvbiAoaSwgaXNEaXNhYmxlZCwgc2l6ZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBkYXRhID0gc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YSB8fCB7fTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhLmNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCRoLmlzRW1wdHkoZGF0YS5jb25maWcpIHx8ICRoLmlzRW1wdHkoZGF0YS5jb25maWdbaV0pKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnW2ldID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlzRGlzYWJsZWQgPSBpc0Rpc2FibGVkID09PSB1bmRlZmluZWQgPyB0cnVlIDogaXNEaXNhYmxlZDtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgY29uZmlnID0gZGF0YS5jb25maWdbaV0sIGNhcHRpb24gPSAkaC5pZlNldCgnY2FwdGlvbicsIGNvbmZpZyksIGEsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoID0gJGguaWZTZXQoJ3dpZHRoJywgY29uZmlnLCAnYXV0bycpLCB1cmwgPSAkaC5pZlNldCgndXJsJywgY29uZmlnLCBmYWxzZSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGtleSA9ICRoLmlmU2V0KCdrZXknLCBjb25maWcsIG51bGwpLCBmcyA9IHNlbGYuZmlsZUFjdGlvblNldHRpbmdzLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0UHJldmlld1Nob3dEZWwgPSBzZWxmLmluaXRpYWxQcmV2aWV3U2hvd0RlbGV0ZSB8fCBmYWxzZSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgZFVybCA9IGNvbmZpZy5kb3dubG9hZFVybCB8fCBzZWxmLmluaXRpYWxQcmV2aWV3RG93bmxvYWRVcmwgfHwgJycsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRGaWwgPSBjb25maWcuZmlsZW5hbWUgfHwgY29uZmlnLmNhcHRpb24gfHwgJycsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRQcmV2aWV3U2hvd0R3bCA9ICEhKGRVcmwpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRGVsID0gJGguaWZTZXQoJ3Nob3dSZW1vdmUnLCBjb25maWcsICRoLmlmU2V0KCdzaG93UmVtb3ZlJywgZnMsIGluaXRQcmV2aWV3U2hvd0RlbCkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRHdsID0gJGguaWZTZXQoJ3Nob3dEb3dubG9hZCcsIGNvbmZpZywgJGguaWZTZXQoJ3Nob3dEb3dubG9hZCcsIGZzLCBpbml0UHJldmlld1Nob3dEd2wpKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgc1ptID0gJGguaWZTZXQoJ3Nob3dab29tJywgY29uZmlnLCAkaC5pZlNldCgnc2hvd1pvb20nLCBmcywgdHJ1ZSkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRHJnID0gJGguaWZTZXQoJ3Nob3dEcmFnJywgY29uZmlnLCAkaC5pZlNldCgnc2hvd0RyYWcnLCBmcywgdHJ1ZSkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXMgPSAodXJsID09PSBmYWxzZSkgJiYgaXNEaXNhYmxlZDtcclxuICAgICAgICAgICAgICAgICAgICBzRHdsID0gc0R3bCAmJiBjb25maWcuZG93bmxvYWRVcmwgIT09IGZhbHNlICYmICEhZFVybDtcclxuICAgICAgICAgICAgICAgICAgICBhID0gc2VsZi5fcmVuZGVyRmlsZUFjdGlvbnMoZmFsc2UsIHNEd2wsIHNEZWwsIHNabSwgc0RyZywgZGlzLCB1cmwsIGtleSwgdHJ1ZSwgZFVybCwgZEZpbCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdmb290ZXInKS5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnOiBzZWxmLl9yZW5kZXJUaHVtYlByb2dyZXNzKCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdhY3Rpb25zJzogYSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ2NhcHRpb24nOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IHNlbGYuX2dldFNpemUoc2l6ZSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICd3aWR0aCc6IHdpZHRoLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnaW5kaWNhdG9yJzogJydcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuaW5pdCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2lzUGRmUmVuZGVyZWQ6IGZ1bmN0aW9uICgpIHtc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AgICAgICAgICAgIG1zZyA9ICdib290c3RyYXAtZmlsZWlucHV0OiAnICsgbXNnO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIHdpbmRvdy5jb25zb2xlLmxvZyAhPT0gJ3VuZGVmaW5lZCcpIHtcclxuICAgICAgICAgICAgICAgIHdpbmRvdy5jb25zb2xlLmxvZyhtc2cpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgd2luZG93LmFsZXJ0KG1zZyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHN0YXR1cyA9IHNlbGYuJGVsZW1lbnQuYXR0cigndHlwZScpID09PSAnZmlsZSc7XHJcbiAgICAgICAgICAgIGlmICghc3RhdHVzKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9sb2coJ1RoZSBpbnB1dCBcInR5cGVcIiBtdXN0IGJlIHNldCB0byBcImZpbGVcIiBmb3IgaW5pdGlhbGl6aW5nIHRoZSBcImJvb3RzdHJhcC1maWxlaW5wdXRcIiBwbHVnaW4uJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHN0YXR1cztcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9lcnJvcnNFeGlzdDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnIsICRlcnJMaXN0ID0gc2VsZi4kZXJyb3JDb250YWluZXIuZmluZCgnbGknKTtcclxuICAgICAgICAgICAgaWYgKCRlcnJMaXN0Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGVyciA9ICQoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2JykpLmh0bWwoc2VsZi4kZXJyb3JDb250YWluZXIuaHRtbCgpKTtcclxuICAgICAgICAgICAgJGVyci5maW5kKCcua3YtZXJyb3ItY2xvc2UnKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgJGVyci5maW5kKCd1bCcpLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICByZXR1cm4gISEkLnRyaW0oJGVyci50ZXh0KCkpLmxlbmd0aDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9lcnJvckhhbmRsZXI6IGZ1bmN0aW9uIChldnQsIGNhcHRpb24pIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlcnIgPSBldnQudGFyZ2V0LmVycm9yLCBzaG93RXJyb3IgPSBmdW5jdGlvbiAobXNnKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93RXJyb3IobXNnLnJlcGxhY2UoJ3tuYW1lfScsIGNhcHRpb24pKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZXJyLk5PVF9GT1VORF9FUlIgKi9cclxuICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZXJyLlNFQ1VSSVRZX0VSUiAqL1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBlcnIuTk9UX1JFQURBQkxFX0VSUiAqL1xyXG4gICAgICAgICAgICBpZiAoZXJyLmNvZGUgPT09IGVyci5OT1RfRk9VTkRfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICBzaG93RXJyb3Ioc2VsZi5tc2dGaWxlTm90Rm91bmQpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKGVyci5jb2RlID09PSBlcnIuU0VDVVJJVFlfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2hvd0Vycm9yKHNlbGYubXNnRmlsZVNlY3VyZWQpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoZXJyLmNvZGUgPT09IGVyci5OT1RfUkVBREFCTEVfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNob3dFcnJvcihzZWxmLm1zZ0ZpbGVOb3RSZWFkYWJsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVyci5jb2RlID09PSBlcnIuQUJPUlRfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG93RXJyb3Ioc2VsZi5tc2dGaWxlUHJldmlld0Fib3J0ZWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvd0Vycm9yKHNlbGYubXNnRmlsZVByZXZpZXdFcnJvcik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9hZGRFcnJvcjogZnVuY3Rpb24gKG1zZykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnJvciA9IHNlbGYuJGVycm9yQ29udGFpbmVyO1xyXG4gICAgICAgICAgICBpZiAobXNnICYmICRlcnJvci5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRlcnJvci5odG1sKHNlbGYuZXJyb3JDbG9zZUJ1dHRvbiArIG1zZyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRlcnJvci5maW5kKCcua3YtZXJyb3ItY2xvc2UnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldyAmJiAhc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuY2xlYXIoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZXJyb3IuZmFkZU91dCgnc2xvdycpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sIDEwKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2V0VmFsaWRhdGlvbkVycm9yOiBmdW5jdGlvbiAoY3NzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgY3NzID0gKGNzcyA/IGNzcyArICcgJyA6ICcnKSArICdoYXMtZXJyb3InO1xyXG4gICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoY3NzKS5hZGRDbGFzcygnaGFzLWVycm9yJyk7XHJcbiAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjYXB0aW9uQ29udGFpbmVyLCAnaXMtaW52YWxpZCcpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0RXJyb3JzOiBmdW5jdGlvbiAoZmFkZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnJvciA9IHNlbGYuJGVycm9yQ29udGFpbmVyO1xyXG4gICAgICAgICAgICBzZWxmLmlzRXJyb3IgPSBmYWxzZTtcclxuICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLnJlbW92ZUNsYXNzKCdoYXMtZXJyb3InKTtcclxuICAgICAgICAgICAgc2VsZi4kY2FwdGlvbkNvbnRhaW5lci5yZW1vdmVDbGFzcygnaXMtaW52YWxpZCcpO1xyXG4gICAgICAgICAgICAkZXJyb3IuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgIGlmIChmYWRlKSB7XHJcbiAgICAgICAgICAgICAgICAkZXJyb3IuZmFkZU91dCgnc2xvdycpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJGVycm9yLmhpZGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Nob3dGb2xkZXJFcnJvcjogZnVuY3Rpb24gKGZvbGRlcnMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZXJyb3IgPSBzZWxmLiRlcnJvckNvbnRhaW5lciwgbXNnO1xyXG4gICAgICAgICAgICBpZiAoIWZvbGRlcnMpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9IHNlbGYubXNnRm9sZGVyc05vdEFsbG93ZWQucmVwbGFjZSgne259JywgZm9sZGVycyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2FkZEVycm9yKG1zZyk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFZhbGlkYXRpb25FcnJvcigpO1xyXG4gICAgICAgICAgICAkZXJyb3IuZmFkZUluKDgwMCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlZm9sZGVyZXJyb3InLCBbZm9sZGVycywgbXNnXSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2hvd1VwbG9hZEVycm9yOiBmdW5jdGlvbiAobXNnLCBwYXJhbXMsIGV2ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVycm9yID0gc2VsZi4kZXJyb3JDb250YWluZXIsIGV2ID0gZXZlbnQgfHwgJ2ZpbGV1cGxvYWRlcnJvcicsIGUgPSBwYXJhbXMgJiYgcGFyYW1zLmlkID9cclxuICAgICAgICAgICAgICAgICc8bGkgZGF0YS10aHVtYi1pZD1cIicgKyBwYXJhbXMuaWQgKyAnXCI+JyArIG1zZyArICc8L2xpPicgOiAnPGxpPicgKyBtc2cgKyAnPC9saT4nO1xyXG4gICAgICAgICAgICBpZiAoJGVycm9yLmZpbmQoJ3VsJykubGVuZ3RoID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9hZGRFcnJvcignPHVsPicgKyBlICsgJzwvdWw+Jyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAkZXJyb3IuZmluZCgndWwnKS5hcHBlbmQoZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGVycm9yLmZhZGVJbig4MDApO1xyXG4gICAgICAgICAgICBzZWxmLl9yYWlzZShldiwgW3BhcmFtcywgbXNnXSk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFZhbGlkYXRpb25FcnJvcignZmlsZS1pbnB1dC1uZXcnKTtcclxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2hvd0Vycm9yOiBmdW5jdGlvbiAobXNnLCBwYXJhbXMsIGV2ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVycm9yID0gc2VsZi4kZXJyb3JDb250YWluZXIsIGV2ID0gZXZlbnQgfHwgJ2ZpbGVlcnJvcic7XHJcbiAgICAgICAgICAgIHBhcmFtcyA9IHBhcmFtcyB8fCB7fTtcclxuICAgICAgICAgICAgcGFyYW1zLnJlYWRlciA9IHNlbGYucmVhZGVyO1xyXG4gICAgICAgICAgICBzZWxmLl9hZGRFcnJvcihtc2cpO1xyXG4gICAgICAgICAgICAkZXJyb3IuZmFkZUluKDgwMCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKGV2LCBbcGFyYW1zLCBtc2ddKTtcclxuICAgICAgICAgICAgaWYgKC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AgICAgfSxcclxuICAgICAgICBfcGFyc2VFcnJvcjogZnVuY3Rpb24gKG9wZXJhdGlvbiwganFYSFIsIGVycm9yVGhyb3duLCBmaWxlTmFtZSkge1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBqcVhIUi5yZXNwb25zZUpTT04gKi9cclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlcnJNc2cgPSAkLnRyaW0oZXJyb3JUaHJvd24gKyAnJyksIHRleHRQcmUsXHJcbiAgICAgICAgICAgICAgICB0ZXh0ID0ganFYSFIucmVzcG9uc2VKU09OICE9PSB1bmRlZmluZWQgJiYganFYSFIucmVzcG9uc2VKU09OLmVycm9yICE9PSB1bmRlZmluZWQgP1xyXG4gICAgICAgICAgICAgICAgICAgIGpxWEhSLnJlc3BvbnNlSlNPTi5lcnJvciA6IGpxWEhSLnJlc3BvbnNlVGV4dDtcclxuICAgICAgICAgICAgaWYgKHNlbGYuY2FuY2VsbGluZyAmJiBzZWxmLm1zZ1VwbG9hZEFib3J0ZWQpIHtcclxuICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYubXNnVXBsb2FkQWJvcnRlZDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93QWpheEVycm9yRGV0YWlscyAmJiB0ZXh0KSB7XHJcbiAgICAgICAgICAgICAgICB0ZXh0ID0gJC50cmltKHRleHQucmVwbGFjZSgvXFxuXFxzKlxcbi9nLCAnXFxuJykpO1xyXG4gICAgICAgICAgICAgICAgdGV4dFByZSA9IHRleHQubGVuZ3RoID8gJzxwcmU+JyArIHRleHQgKyAnPC9wcmU+JyA6ICcnO1xyXG4gICAgICAgICAgICAgICAgZXJyTXNnICs9IGVyck1zZyA/IHRleHRQcmUgOiB0ZXh0O1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghZXJyTXNnKSB7XHJcbiAgICAgICAgICAgICAgICBlcnJNc2cgPSBzZWxmLm1zZ0FqYXhFcnJvci5yZXBsYWNlKCd7b3BlcmF0aW9ufScsIG9wZXJhdGlvbik7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5jYW5jZWxsaW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHJldHVybiBmaWxlTmFtZSA/ICc8Yj4nICsgZmlsZU5hbWUgKyAnOiA8L2I+JyArIGVyck1zZyA6IGVyck1zZztcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9wYXJzZUZpbGVUeXBlOiBmdW5jdGlvbiAodHlwZSwgbmFtZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGlzVmFsaWQsIHZUeXBlLCBjYXQsIGksIHR5cGVzID0gc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzIHx8IFtdO1xyXG4gICAgICAgICAgICBpZiAodHlwZSA9PT0gJ2FwcGxpY2F0aW9uL3RleHQtcGxhaW4nKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RleHQnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCB0eXBlcy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY2F0ID0gdHlwZXNbaV07XHJcbiAgICAgICAgICAgICAgICBpc1ZhbGlkID0gc2VsZi5maWxlVHlwZVNldHRpbmdzW2NhdF07XHJcbiAgICAgICAgICAgICAgICB2VHlwZSA9IGlzVmFsaWQodHlwZSwgbmFtZSkgPyBjYXQgOiAnJztcclxuICAgICAgICAgICAgICAgIGlmICghJGguaXNFbXB0eSh2VHlwZSkpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlR5cGU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICdvdGhlcic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0UHJldmlld0ljb246IGZ1bmN0aW9uIChmbmFtZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGV4dCwgb3V0ID0gbnVsbDtcclxuICAgICAgICAgICAgaWYgKGZuYW1lICYmIGZuYW1lLmluZGV4T2YoJy4nKSA+IC0xKSB7XHJcbiAgICAgICAgICAgICAgICBleHQgPSBmbmFtZS5zcGxpdCgnLicpLnBvcCgpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYucHJldmlld0ZpbGVJY29uU2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2V4dF0gfHwgc2VsZi5wcmV2aWV3RmlsZUljb25TZXR0aW5nc1tleHQudG9Mb3dlckNhc2UoKV0gfHwgbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLnByZXZpZXdGaWxlRXh0U2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgICAgICAkLmVhY2goc2VsZi5wcmV2aWV3RmlsZUV4dFNldHRpbmdzLCBmdW5jdGlvbiAoa2V5LCBmdW5jKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2tleV0gJiYgZnVuYyhleHQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2tleV07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBVbm5lY2Vzc2FyeVJldHVyblN0YXRlbWVudEpTXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3BhcnNlRmlsZVByZXZpZXdJY29uOiBmdW5jdGlvbiAoY29udGVudCwgZm5hbWUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpY24gPSBzZWxmLl9nZXRQcmV2aWV3SWNvbihmbmFtZSkgfHwgc2VsZi5wcmV2aWV3RmlsZUljb24sIG91dCA9IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgIGlmIChvdXQuaW5kZXhPZigne3ByZXZpZXdGaWxlSWNvbn0nKSA+IC0xKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBvdXQuc2V0VG9rZW5zKHsncHJldmlld0ZpbGVJY29uQ2xhc3MnOiBzZWxmLnByZXZpZXdGaWxlSWNvbkNsYXNzLCAncHJldmlld0ZpbGVJY29uJzogaWNufSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yYWlzZTogZnVuY3Rpb24gKGV2ZW50LCBwYXJhbXMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlID0gJC5FdmVudChldmVudCk7XHJcbiAgICAgICAgICAgIGlmIChwYXJhbXMgIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kZWxlbWVudC50cmlnZ2VyKGUsIHBhcmFtcyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRlbGVtZW50LnRyaWdnZXIoZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGUuaXNEZWZhdWx0UHJldmVudGVkKCkgfHwgZS5yZXN1bHQgPT09IGZhbHNlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc3dpdGNoIChldmVudCkge1xyXG4gICAgICAgICAgICAgICAgLy8gaWdub3JlIHRoZXNlIGV2ZW50c1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWJhdGNodXBsb2FkY29tcGxldGUnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWJhdGNodXBsb2Fkc3VjY2Vzcyc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxldXBsb2FkZWQnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWNsZWFyJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVjbGVhcmVkJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVyZXNldCc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlZXJyb3InOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWZvbGRlcmVycm9yJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGV1cGxvYWRlcnJvcic6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlYmF0Y2h1cGxvYWRlcnJvcic6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlZGVsZXRlZXJyb3InOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWN1c3RvbWVycm9yJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVzdWNjZXNzcmVtb3ZlJzpcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIC8vIHJlY2VpdmUgZGF0YSByZXNwb25zZSB2aWEgYGZpbGVjdXN0b21lcnJvcmAgZXZlbnRgXHJcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5hamF4QWJvcnRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZS5yZXN1bHQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAg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ICAgICAgICAgICAgICAgJGJ0bkJvcmQuYWRkQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICd0cnVlJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCRtb2RhbC5oYXNDbGFzcygnZmlsZS16b29tLWZ1bGxzY3JlZW4nKSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaXNGdWxsU2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICRidG5Cb3JkLnJlbW92ZUNsYXNzKCdhY3RpdmUnKS5hdHRyKCdhcmlhLXByZXNzZWQnLCAnZmFsc2UnKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2xpc3RlbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlbCA9IHNlbGYuJGVsZW1lbnQsICRmb3JtID0gc2VsZi4kZm9ybSwgJGNvbnQgPSBzZWxmLiRjb250YWluZXIsIGZ1bGxTY3JlZW5FdmVudHM7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2xpY2snLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCRlbC5oYXNDbGFzcygnZmlsZS1uby1icm93c2UnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZWwuZGF0YSgnem9uZUNsaWNrZWQnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZWwuZGF0YSgnem9uZUNsaWNrZWQnLCBmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2hhbmdlJywgJC5wcm94eShzZWxmLl9jaGFuZ2UsIHNlbGYpKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0Jyb3dzZSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcihzZWxmLiRidG5GaWxlLCAnY2xpY2snLCAkLnByb3h5KHNlbGYuX2Jyb3dzZSwgc2VsZikpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGNvbnQuZmluZCgnLmZpbGVpbnB1dC1yZW1vdmU6bm90KFtkaXNhYmxlZF0pJyksICdjbGljaycsICQucHJveHkoc2VsZi5jbGVhciwgc2VsZikpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRjb250LmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJyksICdjbGljaycsICQucHJveHkoc2VsZi5jYW5jZWwsIHNlbGYpKTtcclxuICAgICAgICAgICAgc2VsZi5faW5pdERyYWdEcm9wKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGZvcm0sICdyZXNldCcsICQucHJveHkoc2VsZi5jbGVhciwgc2VsZikpO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRmb3JtLCAnc3VibWl0JywgJC5wcm94eShzZWxmLl9zdWJtaXRGb3JtLCBzZWxmKSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5faGFuZGxlcihz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QuYm9keS5jbGllbnRXaWR0aCxcclxuICAgICAgICAgICAgICAgIHNlbGYgPSB0aGlzLCBjb25maWcgPSB3aWR0aCA8IDQwMCA/IChzZWxmLnByZXZpZXdTZXR0aW5nc1NtYWxsIHx8IHNlbGYuZGVmYXVsdHMucHJldmlld1NldHRpbmdzU21hbGwpIDpcclxuICAgICAgICAgICAgICAgIChzZWxmLnByZXZpZXdTZXR0aW5ncyB8fCBzZWxmLmRlZmF1bHRzLnByZXZpZXdTZXR0aW5ncyksIHNlbDtcclxuICAgICAgICAgICAgJC5lYWNoKGNvbmZpZywgZnVuY3Rpb24gKGNhdCwgc2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgIHNlbCA9ICcuZmlsZS1wcmV2aWV3LWZyYW1lIC5maWxlLXByZXZpZXctJyArIGNhdDtcclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuZmluZChzZWwgKyAnLmt2LXByZXZpZXctZGF0YSwnICsgc2VsICsgJyAua3YtcHJldmlldy1kYXRhJykuY3NzKHNldHRpbmdzKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2NhbkRyb3BwZWRJdGVtczogZnVuY3Rpb24gKGl0ZW0sIGZpbGVzLCBwYXRoKSB7XHJcbiAgICAgICAgICAgIHBhdGggPSBwYXRoIHx8ICcnO1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGksIGRpclJlYWRlciwgcmVhZERpciwgZXJyb3JIYW5kbGVyID0gZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZygnRXJyb3Igc2Nhbm5pbmcgZHJvcHBlZCBmaWxlcyEnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZyhlKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgaWYgKGl0ZW0uaXNGaWxlKSB7XHJcbiAgICAgICAgICAgICAgICBpdGVtLmZpbGUoZnVuY3Rpb24gKGZpbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlcy5wdXNoKGZpbGUpO1xyXG4gICAgICAgICAgICAgICAgfSwgZXJyb3JIYW5kbGVyKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmIChpdGVtLmlzRGlyZWN0b3J5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZGlyUmVhZGVyID0gaXRlbS5jcmVhdGVSZWFkZXIoKTtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRGlyID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXJSZWFkZXIucmVhZEVudHJpZXMoZnVuY3Rpb24gKGVudHJpZXMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbnRyaWVzICYmIGVudHJpZXMubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBlbnRyaWVzLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NjYW5Ecm9wcGVkSXRlbXMoZW50cmllc1tpXSwgZmlsZXMsIHBhdGggKyBpdGVtLm5hbWUgKyAnLycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZWN1cnNpdmVseSBjYWxsIHJlYWREaXIoKSBhZ2Fpbiwgc2luY2UgYnJvd3NlciBjYW4gb25seSBoYW5kbGUgZmlyc3QgMTAwIGVudHJpZXMuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZERpcigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVycm9ySGFuZGxlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRGlyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdERyYWdEcm9wOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJHpvbmUgPSBzZWxmLiRkcm9wWm9uZTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuZHJvcFpvbmVFbmFibGVkICYmIHNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHpvbmUsICdkcmFnZW50ZXIgZHJhZ292ZXInLCAkLnByb3h5KHNlbGYuX3pvbmVEcmFnRW50ZXIsIHNlbGYpKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHpvbmUsICdkcmFnbGVhdmUnLCAkLnByb3h5KHNlbGYuX3pvbmVEcmFnTGVhdmUsIHNlbGYpKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHpvbmUsICdkcm9wJywgJC5wcm94eShzZWxmLl96b25lRHJvcCwgc2VsZikpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkKGRvY3VtZW50KSwgJ2RyYWdlbnRlciBkcmFnb3ZlciBkcm9wJywgc2VsZi5fem9uZURyYWdEcm9wSW5pdCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF96b25lRHJhZ0Ryb3BJbml0OiBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xyXG4gICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfem9uZURyYWdFbnRlcjogZnVuY3Rpb24gK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nZ2VyKCdjaGFuZ2UnICsgc2VsZi5uYW1lc3BhY2UpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2hhbmdlKGUsIGZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kZHJvcFpvbmUucmVtb3ZlQ2xhc3MoJ2ZpbGUtaGlnaGxpZ2h0ZWQnKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNEaXNhYmxlZCB8fCAkaC5pc0VtcHR5KGZpbGVzKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVEcmFnRHJvcCcsIHsnc291cmNlRXZlbnQnOiBlLCAnZmlsZXMnOiBmaWxlc30pKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGZvbGRlcnMgPiAwKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd0ZvbGRlckVycm9yKGZvbGRlcnMpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGZpbGVzID0gW107XHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaXRlbXMubGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgaXRlbSA9IGl0ZW1zW2ldLndlYmtpdEdldEFzRW50cnkoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zY2FuRHJvcHBlZEl0ZW1zKGl0ZW0sIGZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzRmlsZXMoKTtcclxuICAgICAgICAgICAgICAgIH0sIDUwMCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBwcm9jZXNzRmlsZXMoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwbG9hZENsaWNrOiBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRidG4gPSBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC11cGxvYWQnKSwgJGZvcm0sXHJcbiAgICAgICAgICAgICAgICBpc0VuYWJsZWQgPSAhJGJ0bi5oYXNDbGFzcygnZGlzYWJsZWQnKSAmJiAkaC5pc0VtcHR5KCRidG4uYXR0cignZGlzYWJsZWQnKSk7XHJcbiAgICAgICAgICAgIGlmIChlICYmIGUuaXNEZWZhdWx0UHJldmVudGVkKCkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaXNFbmFibGVkICYmICRidG4uYXR0cigndHlwZScpICE9PSAnc3VibWl0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgICRmb3JtID0gJGJ0bi5jbG9zZXN0KCdmb3JtJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy8gZG93bmdyYWRlIHRvIG5vcm1hbCBmb3JtIHN1Ym1pdCBpZiBwb3NzaWJsZVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZm9ybS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGZvcm0udHJpZ2dlcignc3VibWl0Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XHJcbiAgICAgICAgICAgIGlmIChpc0VuYWJsZWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zdWJtaXRGb3JtOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2lzRmlsZVNlbGVjdGlvblZhbGlkKCkgJiYgIXNlbGYuX2Fib3J0KHt9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jbGVhclByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkcCA9IHNlbGYuJHByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAkdGh1bWJzID0gc2VsZi5zaG93VXBsb2FkZWRUaHVtYnMgPyBzZWxmLmdldEZyYW1lcygnOm5vdCguZmlsZS1wcmV2aWV3LXN1Y2Nlc3MpJykgOiBzZWxmLmdldEZyYW1lcygpO1xyXG4gICAgICAgICAgICAkdGh1bWJzLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyk7XHJcbiAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAkaC5jbGVhblpvb21DYWNoZSgkcC5maW5kKCcjem9vbS0nICsgJHRodW1iLmF0dHIoJ2lkJykpKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGggfHwgIXNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0VXBsb2FkKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEZWZhdWx0UHJldmlldygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRTb3J0YWJsZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlbCA9IHNlbGYuJHByZXZpZXcsIHNldHRpbmdzLCBzZWxlY3RvciA9ICcuJyArICRoLlNPUlRfQ1NTLFxyXG4gICAgICAgICAgICAgICAgcmV2ID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyO1xyXG4gICAgICAgICAgICBpZiAoIXdpbmRvdy5LdlNvcnRhYmxlIHx8ICRlbC5maW5kKHNlbGVjdG9yKS5sZW5ndGggPT09IDApIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBKU1VudXNlZEdsb2JhbFN5bWJvbHNcclxuICAgICAgICAgICAgc2V0dGluZ3MgPSB7XHJcbiAgICAgICAgICAgICAgICBoYW5kbGU6ICcuZHJhZy1oYW5kbGUtaW5pdCcsXHJcbiAgICAgICAgICAgICAgICBkYXRhSWRBdHRyOiAnZGF0YS1wcmV2aWV3LWlkJyxcclxuICAgICAgICAgICAgICAgIHNjcm9sbDogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBkcmFnZ2FibGU6IHNlbGVjdG9yLFxyXG4gICAgICAgICAgICAgICAgb25Tb3J0OiBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBvbGRJbmRleCA9IGUub2xkSW5kZXgsIG5ld0luZGV4ID0gZS5uZXdJbmRleCwgaSA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlldyA9ICRoLm1vdmVBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3LCBvbGRJbmRleCwgbmV3SW5kZXgsIHJldik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9ICRoLm1vdmVBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnLCBvbGRJbmRleCwgbmV3SW5kZXgsIHJldik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuaW5pdCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuZ2V0RnJhbWVzKCcuZmlsZS1wcmV2aWV3LWluaXRpYWwnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS5hdHRyKCdkYXRhLWZpbGVpbmRleCcsICdpbml0XycgKyBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaSsrO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlc29ydGVkJywge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBwcmV2aWV3SWQ6ICQoZS5pdGVtKS5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnb2xkSW5kZXgnOiBvbGRJbmRleCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ25ld0luZGV4JzogbmV3SW5kZXgsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrOiBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnXHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGlmICgkZWwuZGF0YSgna3Zzb3J0YWJsZScpKSB7XHJcbiAgICAgICAgICAgICAgICAkZWwua3Zzb3J0YWJsZSgnZGVzdHJveScpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICQuZXh0ZW5kKHRydWUsIHNldHRpbmdzLCBzZWxmLmZpbGVBY3Rpb25TZXR0aW5ncy5kcmFnU2V0dGluZ3MpO1xyXG4gICAgICAgICAgICAkZWwua3Zzb3J0YWJsZShzZXR0aW5ncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2V0UHJldmlld0NvbnRlbnQ6IGZ1bmN0aW9uIChjb250ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kcHJldmlldy5odG1sKGNvbnRlbnQpO1xyXG4gICAgICAgICAgICBzZWxmLl9hdXRvRml0Q29udGVudCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3OiBmdW5jdGlvbiAoaXNJbml0KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY2FwID0gc2VsZi5pbml0aWFsQ2FwdGlvbiB8fCAnJywgb3V0O1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYucHJldmlld0NhY2hlLmNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyUHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGlzSW5pdCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24oY2FwKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdENhcHRpb24oKTtcclxuICAgICAgICAgICAgICAgIH1c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VlXCInIDogJycpO1xyXG4gICAgICAgICAgICBpZiAodHlwZSA9PT0gJ2Z1bGxzY3JlZW4nIHx8IHR5cGUgPT09ICdib3JkZXJsZXNzJyB8fCB0eXBlID09PSAndG9nZ2xlaGVhZGVyJykge1xyXG4gICAgICAgICAgICAgICAgcGFyYW1zICs9ICcgZGF0YS10b2dnbGU9XCJidXR0b25cIiBhcmlhLXByZXNzZWQ9XCJmYWxzZVwiIGF1dG9jb21wbGV0ZT1cIm9mZlwiJztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwiJyArIGNzcyArICcgYnRuLScgKyB0eXBlICsgJ1wiJyArIHBhcmFtcyArICc+JyArIGxhYmVsICsgJzwvYnV0dG9uPic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0TW9kYWxDb250ZW50OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdtb2RhbCcpLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAncnRsJzogc2VsZi5ydGwgPyAnIGt2LXJ0bCcgOiAnJyxcclxuICAgICAgICAgICAgICAgICd6b29tRnJhbWVDbGFzcyc6IHNlbGYuZnJhbWVDbGFzcyxcclxuICAgICAgICAgICAgICAgICdoZWFkaW5nJzogc2VsZi5tc2dab29tTW9kYWxIZWFkaW5nLFxyXG4gICAgICAgICAgICAgICAgJ3ByZXYnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdwcmV2JyksXHJcbiAgICAgICAgICAgICAgICAnbmV4dCc6IHNlbGYuX2dldFpvb21CdXR0b24oJ25leHQnKSxcclxuICAgICAgICAgICAgICAgICd0b2dnbGVoZWFkZXInOiBzZWxmLl9nZXRab29tQnV0dG9uKCd0b2dnbGVoZWFkZXInKSxcclxuICAgICAgICAgICAgICAgICdmdWxsc2NyZWVuJzogc2VsZi5fZ2V0Wm9vbUJ1dHRvbignZnVsbHNjcmVlbicpLFxyXG4gICAgICAgICAgICAgICAgJ2JvcmRlcmxlc3MnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdib3JkZXJsZXNzJyksXHJcbiAgICAgICAgICAgICAgICAnY2xvc2UnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdjbG9zZScpXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2xpc3Rlbk1vZGFsRXZlbnQ6IGZ1bmN0aW9uIChldmVudCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRtb2RhbCA9IHNlbGYuJG1vZGFsLCBnZXRQYXJhbXMgPSBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgICAgICBzb3VyY2VFdmVudDogZSxcclxuICAgICAgICAgICAgICAgICAgICBwcmV2aWV3SWQ6ICRtb2RhbC5kYXRhKCdwcmV2aWV3SWQnKSxcclxuICAgICAgICAgICAgICAgICAgICBtb2RhbDogJG1vZGFsXHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAkbW9kYWwub24oZXZlbnQgKyAnLmJzLm1vZGFsJywgZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkYnRuRnVsbCA9ICRtb2RhbC5maW5kKCcuYnRuLWZ1bGxzY3JlZW4nKSwgJGJ0bkJvcmQgPSAkbW9kYWwuZmluZCgnLmJ0bi1ib3JkZXJsZXNzJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXpvb20nICsgZXZlbnQsIGdldFBhcmFtcyhlKSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQgPT09ICdzaG93bicpIHtcclxuICAgICAgICAgICAgICAgICAgICAkYnRuQm9yZC5yZW1vdmVDbGFzcygnYWN0aXZlJykuYXR0cignYXJpYS1wcmVzc2VkJywgJ2ZhbHNlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGJ0bkZ1bGwucmVtb3ZlQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICdmYWxzZScpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkbW9kYWwuaGFzQ2xhc3MoJ2ZpbGUtem9vbS1mdWxsc2NyZWVuJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkaC5jaGVja0Z1bGxTY3JlZW4oKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkZ1bGwuYWRkQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICd0cnVlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuQm9yZC5hZGRDbGFzcygnYWN0aXZlJykuYXR0cignYXJpYS1wcmVzc2VkJywgJ3RydWUnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFpvb206IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZGlhbG9nLCBtb2RhbE1haW4gPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnbW9kYWxNYWluJyksIG1vZGFsSWQgPSAnIycgKyAkaC5NT0RBTF9JRDtcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi4kbW9kYWwgPSAkKG1vZGFsSWQpO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuJG1vZGFsIHx8ICFzZWxmLiRtb2RhbC5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRkaWFsb2cgPSAkKGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpKS5odG1sKG1vZGFsTWFpbikuaW5zZXJ0QWZ0ZXIoc2VsZi4kY29udGFpbmVyKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuJG1vZGFsID0gJChtb2RhbElkKS5pbnNlcnRCZWZvcmUoJGRpYWxvZyk7XHJcbiAgICAgICAgICAgICAgICAkZGlhbG9nLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRoLmluaXRNb2RhbChzZWxmLiRtb2RhbCk7XHJcbiAgICAgICAgICAgIHNlbGYuJG1vZGFsLmh0bWwoc2VsZi5fZ2V0TW9kYWxDb250ZW50KCkpO1xyXG4gICAgICAgICAgICAkLmVhY2goJGguTU9EQUxfRVZFTlRTLCBmdW5jdGlvbiAoa2V5LCBldmVudCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fbGlzdGVuTW9kYWxFdmVudChldmVudCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRab29tQnV0dG9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHByZXZpZXdJZCA9IHNlbGYuJG1vZGFsLmRhdGEoJ3ByZXZpZXdJZCcpIHx8ICcnLCAkZmlyc3QsICRsYXN0LFxyXG4gICAgICAgICAgICAgICAgdGh1bWJzID0gc2VsZi5nZXRGcmFtZXMoKS50b0FycmF5KCksIGxlbiA9IHRodW1icy5sZW5ndGgsICRwcmV2ID0gc2VsZi4kbW9kYWwuZmluZCgnLmJ0bi1wcmV2JyksXHJcbiAgICAgICAgICAgICAgICAkbmV4dCA9IHNlbGYuJG1vZGFsLmZpbmQoJy5idG4tbmV4dCcpO1xyXG4gICAgICAgICAgICBpZiAodGh1bWJzLmxlbmd0aCA8IDIpIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICRuZXh0LmhpZGUoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LnNob3coKTtcclxuICAgICAgICAgICAgICAgICRuZXh0LnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIWxlbikge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRmaXJzdCA9ICQodGh1bWJzWzBdKTtcclxuICAgICAgICAgICAgJGxhc3QgPSAkKHRodW1ic1tsZW4gLSAxXSk7XHJcbiAgICAgICAgICAgICRwcmV2LnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICRuZXh0LnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIGlmICgkZmlyc3QubGVuZ3RoICYmICRmaXJzdC5hdHRyKCdpZCcpID09PSBwcmV2aWV3SWQpIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LmF0dHIoJ2Rpc2FibGVkJywgdHJ1ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCRsYXN0Lmxlbmd0aCAmJiAkbGFzdC5hdHRyKCdpZCcpID09PSBwcmV2aWV3SWQpIHtcclxuICAgICAgICAgICAgICAgICRuZXh0LmF0dHIoJ2Rpc2FibGVkJywgdHJ1ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9tYXhpbWl6ZVpvb21EaWFsb2c6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkbW9kYWwgPSBzZWxmLiRtb2RhbCwgJGhlYWQgPSAkbW9kYWwuZmluZCgnLm1vZGFsLWhlYWRlcjp2aXNpYmxlJyksXHJcbiAgICAgICAgICAgICAgICAkZm9vdCA9ICRtb2RhbC5maW5kKCcubW9kYWwtZm9vdGVyOnZpc2libGUnKSwgJGJvZHkgPSAkbW9kYWwuZmluZCgnLm1vZGFsLWJvZHknKSxcclxuICAgICAgICAgICAgICAgIGggPSAkKHdpbmRvdykuaGVpZ2h0KCksIGRpZmYgPSAwO1xyXG4gICAgICAgICAgICAkbW9kYWwuYWRkQ2xhc3MoJ2ZpbGUtem9vbS1mdWxsc2NyZWVuJyk7XHJcbiAgICAgICAgICAgIGlmICgkaGVhZCAmJiAkaGVhZC5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIGggLT0gJGhlYWQub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCRmb290ICYmICRmb290Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgaCAtPSAkZm9vdC5vdXRlckhlaWdodCh0cnVlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoJGJvZHkgJiYgJGJvZHkubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICBkaWZmID0gJGJvZHkub3V0ZXJIZWlnaHQodHJ1ZSkgLSAkYm9keS5oZWlnaHQoKTtcclxuICAgICAgICAgICAgICAgIGggLT0gZGlmZjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkbW9kYWwuZmluZCgnLmt2LXpvb20tYm9keScpLmhlaWdodChoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZXNpemVab29tRGlhbG9nOiBmdW5jdGlvbiAoZnVsbFNjcmVlbikge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRtb2RhbCA9IHNlbGYuJG1vZGFsLCAkYnRuRnVsbCA9ICRtb2RhbC5maW5kKCcuYnRuLWZ1bGxzY3JlZW4nKSxcclxuICAgICAgICAgICAgICAgICRidG5Cb3JkID0gJG1vZGFsLmZpbmQoJy5idG4tYm9yZGVybGVzcycpO1xyXG4gICAgICAgICAgICBpZiAoJG1vZGFsLmhhc0NsYXNzKCdmaWxlLXpvb20tZnVsbHNjcmVlbicpKSB7XHJcbiAgICAgICAgICAgICAgICAkaC50b2dnbGVGdWxsU2NyZWVuKGZhbHNlKTtcclxuICAgICAgICAgICAgICAgIGlmICghZnVsbFNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJGJ0bkZ1bGwuaGFzQ2xhc3MoJ2FjdGl2ZScpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRtb2RhbC5yZW1vdmVDbGFzcygnZmlsZS16b29tLWZ1bGxzY3JlZW4nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi4kbW9kYWwuZmluZCgnLmt2LXpvb20tYm9keScpLmNzcygnaGVpZ2h0Jywgc2VsZi56b29tTW9kYWxIZWlnaHQpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5GdWxsLnJlbW92ZUNsYXNzKCdhY3RpdmUnKS5hdHRyKCdhcmlhLXByZXNzZWQnLCAnZmFsc2UnKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJGJ0bkZ1bGwuaGFzQ2xhc3MoJ2FjdGl2ZScpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRtb2RhbC5yZW1vdmVDbGFzcygnZmlsZS16b29tLWZ1bGxzY3JlZW4nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzaXplWm9vbURpYWxvZyh0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRidG5Cb3JkLmhhc0NsYXNzKCdhY3RpdmUnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkJvcmQucmVtb3ZlQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICdmYWxzZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFmdWxsU2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgJGgudG9nZ2xlRnVsbFNjcmVlbih0cnVlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkbW9kYWwuZm9jdXMoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zZXRab29tQ29udGVudDogZnVuY3Rpb24gKCRmcmFtZSwgYW5pbWF0ZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRjb250ZW50LCB0bXBsdCwgYm9keSwgdGl0bGUsICRib2R5LCAkZGF0YUVsLCBjb25maWcsIHByZXZpZXdJZCA9ICRmcmFtZS5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgJHpvb21QcmV2aWV3ID0gc2VsZi4kcHJldmlldy5maW5kKCcjem9vbS0nICsgcHJldmlld0lkKSwgJG1vZGFsID0gc2VsZi4kbW9kYWwsICR0bXAsXHJcbiAgICAgICAgICAgICAgICAkYnRuRnVsbCA9ICRtb2RhbC5maW5kKCcuY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woYm9keSkuaGlkZSgpO1xyXG4gICAgICAgICAgICAgICAgJHRtcC5mYWRlT3V0KCdmYXN0JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICRib2R5LmZhZGVJbignZmFzdCcsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJvZHkucmVtb3ZlQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICR0bXAucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICRib2R5Lmh0bWwoYm9keSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgY29uZmlnID0gc2VsZi5wcmV2aWV3Wm9vbVNldHRpbmdzW3RtcGx0XTtcclxuICAgICAgICAgICAgaWYgKGNvbmZpZykge1xyXG4gICAgICAgICAgICAgICAgJGRhdGFFbCA9ICRib2R5LmZpbmQoJy5rdi1wcmV2aWV3LWRhdGEnKTtcclxuICAgICAgICAgICAgICAgICRoLmFkZENzcygkZGF0YUVsLCAnZmlsZS16b29tLWRldGFpbCcpO1xyXG4gICAgICAgICAgICAgICAgJC5lYWNoKGNvbmZpZywgZnVuY3Rpb24gKGtleSwgdmFsdWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkZGF0YUVsLmNzcyhrZXksIHZhbHVlKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoKCRkYXRhRWwuYXR0cignd2lkdGgnKSAmJiBrZXkgPT09ICd3aWR0aCcpIHx8ICgkZGF0YUVsLmF0dHIoJ2hlaWdodCcpICYmIGtleSA9PT0gJ2hlaWdodCcpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRkYXRhRWwucmVtb3ZlQXR0cihrZXkpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRtb2RhbC5kYXRhKCdwcmV2aWV3SWQnLCBwcmV2aWV3SWQpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbC5maW5kKCcuYnRuLXByZXYnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fem9vbVNsaWRlU2hvdygncHJldicsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbC5maW5kKCcuYnRuLW5leHQnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fem9vbVNsaWRlU2hvdygnbmV4dCcsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRidG5GdWxsLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yZXNpemVab29tRGlhbG9nKHRydWUpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkYnRuQm9yZCwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmVzaXplWm9vbURpYWxvZyhmYWxzZSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRidG5Ub2doLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgJGhlYWRlciA9ICRtb2RhbC5maW5kKCcubW9kYWwtaGVhZGVyJyksICRmbG9hdEJhciA9ICRtb2RhbC5maW5kKCcubW9kYWwtYm9keSAuZmxvYXRpbmctYnV0dG9ucycpLFxyXG4gICAgICAgICAgICAgICAgICAgIGh0LCAkYWN0aW9ucyA9ICRoZWFkZXIuZmluZCgnLmt2LXpvb20tYWN0aW9ucycpLCByZXNpemUgPSBmdW5jdGlvbiAoaGVpZ2h0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciAkYm9keSA9IHNlbGYuJG1vZGFsLmZpbmQoJy5rdi16b29tLWJvZHknKSwgaCA9IHNlbGYuem9vbU1vZGFsSGVpZ2h0O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJG1vZGFsLmhhc0NsYXNzKCdmaWxlLXpvb20tZnVsbHNjcmVlbicpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gJGJvZHkub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWhlaWdodCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBoIC0gJGhlYWRlci5vdXRlckhlaWdodCh0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYm9keS5jc3MoJ2hlaWdodCcsIGhlaWdodCA/IGggKyBoZWlnaHQgOiBoKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgaWYgKCRoZWFkZXIuaXMoJzp2aXNpYmxlJykpIHtcclxuICAgICAgICAgICAgICAgICAgICBodCA9ICRoZWFkZXIub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGhlYWRlci5zbGlkZVVwKCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYWN0aW9ucy5maW5kKCcuYnRuJykuYXBwZW5kVG8oJGZsb2F0QmFyKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzaXplKGh0KTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZsb2F0QmFyLmZpbmQoJy5idG4nKS5hcHBlbmRUbygkYWN0aW9ucyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGhlYWRlci5zbGlkZURvd24oJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc2l6ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgJG1vZGFsLmZvY3VzKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbCwgJ2tleWRvd24nLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IGUud2hpY2ggfHwgZS5rZXlDb2RlLCAkcHJldiA9ICQodGhpcykuZmluZCgnLmJ0bi1wcmV2JyksICRuZXh0ID0gJCh0aGlzKS5maW5kKCcuYnRuLW5leHQnKSxcclxuICAgICAgICAgICAgICAgICAgICB2SWQgPSAkKHRoaXMpLmRhdGEoJ3ByZXZpZXdJZCcpLCB2UHJldktleSA9IHNlbGYucnRsID8gMzkgOiAzNywgdk5leHRLZXkgPSBzZWxmLnJ0bCA/IDM3IDogMzk7XHJcbiAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSB2UHJldktleSAmJiAkcHJldi5sZW5ndGggJiYgISRwcmV2LmF0dHIoJ2Rpc2FibGVkJykpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl96b29tU2xpZGVTaG93KCdwcmV2JywgdklkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChrZXkgPT09IHZOZXh0S2V5ICYmICRuZXh0Lmxlbmd0aCAmJiAhJG5leHQuYXR0cignZGlzYWJsZWQnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3pvb21TbGlkZVNob3coJ25leHQnLCB2SWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF96b29tUHJldmlldzogZnVuY3Rpb24gKCRidG4pIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUsICRtb2RhbCA9IHNlbGYuJG1vZGFsO1xyXG4gICAgICAgICAgICBpZiAoISRidG4ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICB0aHJvdyAnQ2Fubm90IHpvb20gdG8gZGV0YWlsZWQgcHJldmlldyEnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRoLmluaXRNb2RhbCgkbW9kYWwpO1xyXG4gICAgICAgICAgICAkbW9kYWwuaHRtbChzZWxmLl9nZXRNb2RhbENvbnRlbnQoKSk7XHJcbiAgICAgICAgICAgICRmcmFtZSA9ICRidG4uY2xvc2VzdCgkaC5GUkFNRVMpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRab29tQ29udGVudCgkZnJhbWUpO1xyXG4gICAgICAgICAgICAkbW9kYWwubW9kYWwoJ3Nob3cnKTtcclxuICAgICAgICAgICAgc2VsZi5faW5pdFpvb21CdXR0b25zKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfem9vbVNsaWRlU2hvdzogZnVuY3Rpb24gKGRpciwgcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGJ0biA9IHNlbGYuJG1vZGFsLmZpbmQoJy5rdi16b29tLWFjdGlvbnMgLmJ0bi0nICsgZGlyKSwgJHRhcmdGcmFtZSwgaSxcclxuICAgICAgICAgICAgICAgIHRodW1icyA9IHNlbGYuZ2V0RnJhbWVzKCkudG9BcnJheSgpLCBsZW4gPSB0aHVtYnMubGVuZ3RoLCBvdXQ7XHJcbiAgICAgICAgICAgIGlmICgkYnRuLmF0dHIoJ2Rpc2FibGVkJykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICAgIGlmICgkKHRodW1ic1tpXSkuYXR0cignaWQnKSA9PT0gcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgb3V0ID0gZGlyID09PSAncHJldicgPyBpIC0gMSA6IGkgKyAxO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChvdXQgPCAwIHx8IG91dCA+PSBsZW4gfHwgIXRodW1ic1tvdXRdKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJHRhcmdGcmFtZSA9ICQodGh1bWJzW291dF0pO1xyXG4gICAgICAgICAgICBpZiAoJHRhcmdGcmFtZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFpvb21Db250ZW50KCR0YXJnRnJhbWUsIHRydWUpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9ucygpO1xyXG4gICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXpvb20nICsgZGlyLCB7J3ByZXZpZXdJZCc6IHByZXZpZXdJZCwgbW9kYWw6IHNlbGYuJG1vZGFsfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFpvb21CdXR0b246IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBzZWxmLiRwcmV2aWV3LmZpbmQoJy5rdi1maWxlLXpvb20nKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkZWwsICdjbGljaycsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl96b29tUHJldmlldygkZWwpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2lucHV0RmlsZUNvdW50OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB0aGlzLiRlbGVtZW50LmdldCgwKS5maWxlcy5sZW5ndGg7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaFByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBmaWxlcztcclxuICAgICAgICAgICAgaWYgKCghc2VsZi5faW5wdXRGaWxlQ291bnQoKSAmJiAhc2VsZi5pc0FqYXhVcGxvYWQpIHx8ICFzZWxmLnNob3dQcmV2aWV3IHx8ICFzZWxmLmlzUHJldmlld2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIGZpbGVzID0gc2VsZi5nZXRGaWxlU3RhY2soKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZXN0YWNrID0gW107XHJcbiAgICAgICAgICAgICAgICBpZiAoZmlsZXMubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZXMgPSBzZWxmLiRlbGVtZW50LmdldCgwKS5maWxlcztcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGZpbGVzID0gc2VsZi4kZWxlbWVudC5nZXQoMCkuZmlsZXM7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGZpbGVzICYmIGZpbGVzLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5yZWFkRmlsZXMoZmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0RmlsZURyb3Bab25lVGl0bGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NsZWFyT2JqZWN0czogZnVuY3Rpb24gKCRlbCkge1xyXG4gICAgICAgICAgICAkZWwuZmluZCgndmlkZW8gYXVkaW8nKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMucGF1c2UoKTtcclxuICAgICAgICAgICAgICAgICQodGhpcykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAkZWwuZmluZCgnaW1nIG9iamVjdCBkaXYnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICQodGhpcykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NsZWFyRmlsZUlucHV0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVsID0gc2VsZi4kZWxlbWVudCwgJHNyY0ZybSwgJHRtcEZybSwgJHRtcEVsO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuX2lucHV0RmlsZUNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkc3JjRnJtID0gJGVsLmNsb3Nlc3QoJ2Zvcm0nKTtcclxuICAgICAgICAgICAgJHRtcEZybSA9ICQoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZm9ybScpKTtcclxuICAgICAgICAgICAgJHRtcEVsID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSk7XHJcbiAgICAgICAgICAgICRlbC5iZWZvcmUoJHRtcEVsKTtcclxuICAgICAgICAgICAgaWYgKCRzcmNGcm0ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAkc3JjRnJtLmFmdGVyKCR0bXBGcm0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJHRtcEVsLmFmdGVyKCR0bXBGcm0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICR0bXBGcm0uYXBwZW5kKCRlbCkudHJpZ2dlcigncmVzZXQnKTtcclxuICAgICAgICAgICAgJHRtcEVsLmJlZm9yZSgkZWwpLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAkdG1wRnJtLnJlbW92ZSgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0VXBsb2FkOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZSA9IHtjb250ZW50OiBbXSwgY29uZmlnOiBbXSwgdGFnczogW10sIGFwcGVuZDogdHJ1ZX07XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZFN0YXR1cyA9IHt9O1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZEFzeW5jQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLmxvYWRlZEltYWdlcyA9IFtdO1xyXG4gICAgICAgICAgICBzZWxmLnRvdGFsSW1hZ2VzQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLiRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMCk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByb2dyZXNzLmhpZGUoKTtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnMoZmFsc2UpO1xyXG4gICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheFJlcXVlc3RzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuX3Jlc2V0Q2FudmFzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuY2FjaGVJbml0aWFsUHJldmlldyA9IHt9O1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3ID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhID0ge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtdLFxyXG4gICAgICAgICAgICAgICAgICAgIGNvbmZpZzogW10sXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnczogW11cclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZXNldENhbnZhczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLmNhbnZhcyAmJiBzZWxmLmltYWdlQ2FudmFzQ29udGV4dCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5pbWFnZUNhbnZhc0NvbnRleHQuY2xlYXJSZWN0KDAsIDAsIHNlbGYuY2FudmFzLndpZHRoLCBzZWxmLmNhbnZhcy5oZWlnaHQpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaGFzSW5pdGlhbFByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gIXNlbGYub3ZlcndyaXRlSW5pdGlhbCAmJiBzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0UHJldmlldzogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIG91dCwgY2FwO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSkge1xyXG4gICAgICAgICAgICAgICAgb3V0ID0gc2VsZi5wcmV2aWV3Q2FjaGUub3V0KCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3Q29udGVudChvdXQuY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRJbml0VGh1bWJBdHRyKCk7XHJcbiAgICAgICAgICAgICAgICBjYXAgPSBzZWxmLmluaXRpYWxDYXB0aW9uID8gc2VsZi5pbml0aWFsQ2FwdGlvbiA6IG91dC5jYXB0aW9uO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0Q2FwdGlvbihjYXApO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJQcmV2aWV3KCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0Q2FwdGlvbigpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0Wm9vbSgpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jbGVhckRlZmF1bHRQcmV2aWV3OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kcHJldmlldy5maW5kKCcuZmlsZS1kZWZhdWx0LXByZXZpZXcnKS5yZW1vdmUoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZURlZmF1bHRQcmV2aWV3OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3IHx8ICRoLmlzRW1wdHkoc2VsZi5kZWZhdWx0UHJldmlld0NvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJldmlld0NvbnRlbnQoJzxkaXYgY2xhc3M9XCJmaWxlLWRlZmF1bHQtcHJldmlld1wiPicgKyBzZWxmLmRlZmF1bHRQcmV2aWV3Q29udGVudCArICc8L2Rpdj4nKTtcclxuICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLnJlbW92ZUNsYXNzKCdmaWxlLWlucHV0LW5ldycpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0Q2xpY2thYmxlKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVzZXRQcmV2aWV3VGh1bWJzOiBmdW5jdGlvbiAoaXNBamF4KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgb3V0O1xyXG4gICAgICAgICAgICBpZiAoaXNBamF4KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhclByZXZpZXcoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLl9oYXNJbml0aWFsUHJldmlldygpKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdDYWNoZS5vdXQoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdDb250ZW50KG91dC5jb250ZW50KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldEluaXRUaHVtYkF0dHIoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24ob3V0LmNhcHRpb24pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhclByZXZpZXcoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dldExheW91dFRlbXBsYXRlOiBmdW5jdGlvbiAodCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHRlbXBsYXRlID0gc2VsZi5sYXlvdXRUZW1wbGF0ZXNbdF07XHJcbiAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KHNlbGYuY3VzdG9tTGF5b3V0VGFncykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB0ZW1wbGF0ZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gJGgucmVwbGFjZVRhZ3ModGVtcGxhdGUsIHNlbGYuY3VzdG9tTGF5b3V0VGFncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0UHJldmlld1RlbXBsYXRlOiBmdW5jdGlvbiAodCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHRlbXBsYXRlID0gc2VsZi5wcmV2aWV3VGVtcGxhdGVzW3RdO1xyXG4gICAgICAgICAgICBpZiAoJGguaXNFbXB0eShzZWxmLmN1c3RvbVByZXZpZXdUYWdzKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRlbXBsYXRlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAkaC5yZXBsYWNlVGFncyh0ZW1wbGF0ZSwgc2VsZi5jdXN0b21QcmV2aWV3VGFncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0T3V0RGF0YTogZnVuY3Rpb24gKGpxWEhSLCByZXNwb25zZURhdGEsIGZpbGVzRGF0YSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGpxWEhSID0ganFYSFIgfHwge307XHJcbiAgICAgICAgICAgIHJlc3BvbnNlRGF0YSA9IHJlc3BvbnNlRGF0YSB8fCB7fTtcclxuICAgICAgICAgICAgZmlsZXNEYXRhID0gZmlsZXNEYXRhIHx8IHNlbGYuZmlsZXN0YWNrLnNsaWNlKDApIHx8IHt9O1xyXG4gICAgICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICAgICAgZm9ybTogc2VsZi5mb3JtZGF0YSxcclxuICAgICAgICAgICAgICAgIGZpbGVzOiBmaWxlc0RhdGEsXHJcbiAgICAgICAgICAgICAgICBmaWxlbmFtZXM6IHNlbGYuZmlsZW5hbWVzLFxyXG4gICAgICAgICAgICAgICAgZmlsZXNjb3VudDogc2VsZi5nZXRGaWxlc0NvdW50KCksXHJcbiAgICAgICAgICAgICAgICBleHRyYTogc2VsZi5fZ2V0RXh0cmFEYXRhKCksXHJcbiAgICAgICAgICAgICAgICByZXNwb25zZTogcmVzcG9uc2VEYXRhLFxyXG4gICAgICAgICAgICAgICAgcmVhZGVyOiBzZWxmLnJlYWRlcixcclxuICAgICAgICAgICAgICAgIGpxWEhSOiBqc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WxmID0gdGhpcywgZGF0YSA9IHNlbGYudXBsb2FkRXh0cmFEYXRhO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIHNlbGYudXBsb2FkRXh0cmFEYXRhID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBkYXRhID0gc2VsZi51cGxvYWRFeHRyYURhdGEocHJldmlld0lkLCBpbmRleCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGRhdGE7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFhocjogZnVuY3Rpb24gKHhocm9iaiwgcHJldmlld0lkLCBmaWxlQ291bnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoeGhyb2JqLnVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgeGhyb2JqLnVwbG9hZC5hZGRFdmVudExpc3RlbmVyKCdwcm9ncmVzcycsIGZ1bmN0aW9uIChldmVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBwY3QgPSAwLCB0b3RhbCA9IGV2ZW50LnRvdGFsLCBwb3NpdGlvbiA9IGV2ZW50LmxvYWRlZCB8fCBldmVudC5wb3NpdGlvbjtcclxuICAgICAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBldmVudC5sZW5ndGhDb21wdXRhYmxlICovXHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50Lmxlbmd0aENvbXB1dGFibGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcGN0ID0gTWF0aC5mbG9vcihwb3NpdGlvbiAvIHRvdGFsICogMTAwKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByZXZpZXdJZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRBc3luY1VwbG9hZFN0YXR1cyhwcmV2aWV3SWQsIHBjdCwgZmlsZUNvdW50KTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzcyhwY3QpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0sIGZhbHNlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4geGhyb2JqO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRBamF4U2V0dGluZ3M6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBzZWxmLl9hamF4U2V0dGluZ3MgPSAkLmV4dGVuZCh0cnVlLCB7fSwgc2VsZi5hamF4U2V0dGluZ3MpO1xyXG4gICAgICAgICAgICBzZWxmLl9hamF4RGVsZXRlU2V0dGluZ3MgPSAkLmV4dGVuZCh0cnVlLCB7fSwgc2VsZi5hamF4RGVsZXRlU2V0dGluZ3MpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX21lcmdlQWpheENhbGxiYWNrOiBmdW5jdGlvbiAoZnVuY05hbWUsIHNyY0Z1bmMsIHR5cGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBzZXR0aW5ncyA9IHNlbGYuX2FqYXhTZXR0aW5ncywgZmxhZyA9IHNlbGYubWVyZ2VBamF4Q2FsbGJhY2tzLCB0YXJnRnVuYztcclxuICAgICAgICAgICAgaWYgKHR5cGUgPT09ICdkZWxldGUnKSB7XHJcbiAgICAgICAgICAgICAgICBzZXR0aW5ncyA9IHNlbGYuX2FqYXhEZWxldGVTZXR0aW5ncztcclxuICAgICAgICAgICAgICAgIGZsYWcgPSBzZWxmLm1lcmdlQWpheERlbGV0ZUNhbGxiYWNrcztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB0YXJnRnVuYyA9IHNldHRpbmdzW2Z1bmNOYW1lXTtcclxuICAgICAgICAgICAgaWYgKGZsYWcgJiYgdHlwZW9mIHRhcmdGdW5jID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoZmxhZyA9PT0gJ2JlZm9yZScpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZXR0aW5nc1tmdW5jTmFtZV0gPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdGdW5jLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNyY0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBzZXR0aW5nc1tmdW5jTmFtZV0gPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNyY0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2V0dGluZ3NbZnVuY05hbWVdID0gc3JjRnVuYztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2FqYXhTdWJtaXQ6IGZ1bmN0aW9uIChmbkJlZm9yZSwgZm5TdWNjZXNzLCBmbkNvbXBsZXRlLCBmbkVycm9yLCBwcmV2aWV3SWQsIGluZGV4KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgc2V0dGluZ3MsIHZVcmw7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVwcmVhamF4JywgW3ByZXZpZXdJZCwgaW5kZXhdKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3VwbG9hZEV4dHJhKHByZXZpZXdJZCwgaW5kZXgpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0QWpheFNldHRpbmdzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX21lcmdlQWpheENhbGxiYWNrKCdiZWZvcmVTZW5kJywgZm5CZWZvcmUpO1xyXG4gICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnc3VjY2VzcycsIGZuU3VjY2Vzcyk7XHJcbiAgICAgICAgICAgIHNlbGYuX21lcmdlQWpheENhbGxiYWNrKCdjb21wbGV0ZScsIGZuQ29tcGxldGUpO1xyXG4gICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnZXJyb3InLCBmbkVycm9yKTtcclxuICAgICAgICAgICAgdlVybCA9IGluZGV4ICYmIHNlbGYudXBsb2FkVXJsVGh1bWIgPyBzZWxmLnVwbG9hZFVybFRodW1iIDogc2VsZi51cGxvYWRVcmw7XHJcbiAgICAgICAgICAgIHNldHRpbmdzID0gJC5leHRlbmQodHJ1ZSwge30sIHtcclxuICAgICAgICAgICAgICAgIHhocjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciB4aHJvYmogPSAkLmFqYXhTZXR0aW5ncy54aHIoKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2VsZi5faW5pdFhocih4aHJvYmosIHByZXZpZXdJZCwgc2VsZi5nZXRGaWxlU3RhY2soKS5sZW5ndGgpO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHVybDogc2VsZi5fZW5jb2RlVVJJKHZVcmwpLFxyXG4gICAgICAgICAgICAgICAgdHlwZTogJ1BPU1QnLFxyXG4gICAgICAgICAgICAgICAgZGF0YVR5cGU6ICdqc29uJyxcclxuICAgICAgICAgICAgICAgIGRhdGE6IHNlbGYuZm9ybWRhdGEsXHJcbiAgICAgICAgICAgICAgICBjYWNoZTogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBwcm9jZXNzRGF0YTogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBjb250ZW50VHlwZTogZmFsc2VcclxuICAgICAgICAgICAgfSwgc2VsZi5fYWpheFNldHRpbmdzKTtcclxuICAgICAgICAgICAgc2VsZi5hamF4UmVxdWVzdHMucHVzaCgkLmFqYXgoc2V0dGluZ3MpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9tZXJnZUFycmF5OiBmdW5jdGlvbiAocHJvcCwgY29udGVudCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGFycjEgPSAkaC5jbGVhbkFycmF5KHNlbGZbcHJvcF0pLCBhcnIyID0gJGguY2xlYW5BcnJheShjb250ZW50KTtcclxuICAgICAgICAgICAgc2VsZltwcm9wXSA9IGFycjEuY29uY2F0KGFycjIpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRVcGxvYWRTdWNjZXNzOiBmdW5jdGlvbiAob3V0LCAkdGh1bWIsIGFsbEZpbGVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgYXBwZW5kLCBkYXRhLCBpbmRleCwgJGRpdiwgJG5ld0NhY2hlLCBjb250ZW50LCBjb25maWcsIHRhZ3MsIGk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5zaG93UHJldmlldyB8fCB0eXBlb2Ygb3V0ICE9PSAnb2JqZWN0JyB8fCAkLmlzRW1wdHlPYmplY3Qob3V0KSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChvdXQuaW5pdGlhbFByZXZpZXcgIT09IHVuZGVmaW5lZCAmJiBvdXQuaW5pdGlhbFByZXZpZXcubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5oYXNJbml0RGF0YSA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBjb250ZW50ID0gb3V0LmluaXRpYWxQcmV2aWV3IHx8IFtdO1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gb3V0LmluaXRpYWxQcmV2aWV3Q29uZmlnIHx8IFtdO1xyXG4gICAgICAgICAgICAgICAgdGFncyA9IG91dC5pbml0aWFsUHJldmlld1RodW1iVGFncyB8fCBbXTtcclxuICAgICAgICAgICAgICAgIGFwcGVuZCA9IG91dC5hcHBlbmQgPT09IHVuZGVmaW5lZCB8fCBvdXQuYXBwZW5kO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvbnRlbnQubGVuZ3RoID4gMCAmJiAhJGguaXNBcnJheShjb250ZW50KSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQgPSBjb250ZW50LnNwbGl0KHNlbGYuaW5pdGlhbFByZXZpZXdEZWxpbWl0ZXIpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fbWVyZ2VBcnJheSgnaW5pdGlhbFByZXZpZXcnLCBjb250ZW50KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX21lcmdlQXJyYXkoJ2luaXRpYWxQcmV2aWV3Q29uZmlnJywgY29uZmlnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX21lcmdlQXJyYXkoJ2luaXRpYWxQcmV2aWV3VGh1bWJUYWdzJywgdGFncyk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJHRodW1iICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWFsbEZpbGVzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gc2VsZi5wcmV2aWV3Q2FjaGUuYWRkKGNvbnRlbnQsIGNvbmZpZ1swXSwgdGFnc1swXSwgYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmdldChpbmRleCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZGl2ID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSkuaHRtbChkYXRhKS5oaWRlKCkuaW5zZXJ0QWZ0ZXIoJHRodW1iKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJG5ld0NhY2hlID0gJGRpdi5maW5kKCcua3Ytem9vbS1jYWNoZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJG5ld0NhY2hlICYmICRuZXdDYWNoZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRuZXdDYWNoZS5pbnNlcnRBZnRlcigkdGh1bWIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5mYWRlT3V0KCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyICRuZXdUaHVtYiA9ICRkaXYuZmluZCgnLmZpbGUtcHJldmlldy1mcmFtZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRuZXdUaHVtYiAmJiAkbmV3VGh1bWIubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJG5ld1RodW1iLmluc2VydEJlZm9yZSgkdGh1bWIpLmZhZGVJbignc2xvdycpLmNzcygnZGlzcGxheTppbmxpbmUtYmxvY2snKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3QWN0aW9ucygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNsZWFuWm9vbUNhY2hlKHNlbGYuJHByZXZpZXcuZmluZCgnI3pvb20tJyArICR0aHVtYi5hdHRyKCdpZCcpKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZGl2LnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSAkdGh1bWIuYXR0cignZGF0YS1maWxlaW5kZXgnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb250ZW50W2ldID0gY29udGVudFswXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb25maWdbaV0gPSBjb25maWdbMF0gfHwgW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQ2FjaGUudGFnc1tpXSA9IHRhZ3NbMF0gfHwgW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQ2FjaGUuYXBwZW5kID0gYXBwZW5kO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuc2V0KGNvbnRlbnQsIGNvbmZpZywgdGFncywgYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3QWN0aW9ucygpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFN1Y2Nlc3NUaHVtYnM6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9nZXRUaHVtYnMoJGguRlJBTUVTICsgJy5maWxlLXByZXZpZXctc3VjY2VzcycpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldywgJHJlbW92ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICRyZW1vdmUucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHJlbW92ZSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBpZCA9ICR0aHVtYi5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLl9yYWlzZSgnZmlsZXN1Y2Nlc3NyZW1vdmUnLCBbaWQsICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGguY2xlYW5NZW1vcnkoJHRodW1iKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAob3V0ID09PSBmYWxzZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5mYWRlT3V0KCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkaC5jbGVhblpvb21DYWNoZSgkcHJldmlldy5maW5kKCcjem9vbS0nICsgaWQpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuZ2V0RnJhbWVzKCkubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJlc2V0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jaGVja0FzeW5jQ29tcGxldGU6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBwcmV2aWV3SWQsIGk7XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzZWxmLmZpbGVzdGFjay5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuZmlsZXN0YWNrW2ldKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcHJldmlld0lkID0gc2VsZi5wcmV2aWV3SW5pdElkICsgJy0nICsgaTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJC5pbkFycmF5KHByZXZpZXdJZCwgc2VsZi51cGxvYWRMb2cpID09PSAtMSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAoc2VsZi51cGxvYWRBc3luY0NvdW50ID09PSBzZWxmLnVwbG9hZExvZy5sZW5ndGgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwbG9hZEV4dHJhOiBmdW5jdGlvbiAocHJldmlld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ZVVwbG9hZExvZywgcGFyYW1zID0ge2lkOiBwcmV2aWV3SWQsIGluZGV4OiBpfTtcclxuICAgICAgICAgICAgc2VsZi5mb3JtZGF0YSA9IGZvcm1kYXRhO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgJHRodW1iID0gJCgnIycgKyBwcmV2aWV3SWQgKyAnOm5vdCguZmlsZS1wcmV2aWV3LWluaXRpYWwpJyk7XHJcbiAgICAgICAgICAgICAgICAkYnRuVXBsb2FkID0gJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpO1xyXG4gICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICRwcm9nLnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAodG90YWwgPT09IDAgfHwgIWhhc1Bvc3REYXRhIHx8ICgkYnRuVXBsb2FkICYmICRidG5VcGxvYWQuaGFzQ2xhc3MoJ2Rpc2FibGVkJykpIHx8IHNlbGYuX2Fib3J0KHBhcmFtcykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB1cGRhdGVVcGxvYWRMb2cgPSBmdW5jdGlvbiAoaSwgcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXVwbG9hZEZhaWxlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkTG9nLnB1c2gocHJldmlld0lkKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9jaGVja0FzeW5jQ29tcGxldGUoKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgY2hrQ29tcGxldGUgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgdSA9IHNlbGYudXBsb2FkQ2FjaGUsICRpbml0VGh1bWJzLCBpLCBqLCBsZW4gPSAwLCBkYXRhID0gc2VsZi5jYWNoZUluaXRpYWxQcmV2aWV3O1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLmZpbGVCYXRjaENvbXBsZXRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChkYXRhICYmIGRhdGEuY29udGVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGxlbiA9IGRhdGEuY29udGVudC5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgdHJpZ2dlclJlc2V0ID0gc2VsZi5nZXRGaWxlU3RhY2sodHJ1ZSkubGVuZ3RoID09PSAwO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLnNldCh1LmNvbnRlbnQsIHUuY29uZmlnLCB1LnRhZ3MsIHUuYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHUuY29udGVudC5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPSBpICsgbGVuO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29udGVudFtqXSA9IHUuY29udGVudFtpXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBKU1VucmVzb2x2ZWRWYXJpYWJsZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmNvbmZpZy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWdbal0gPSB1LmNvbmZpZ1tpXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEudGFncy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS50YWdzW2pdID0gdS50YWdzW2ldO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXcgPSAkaC5jbGVhbkFycmF5KGRhdGEuY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnID0gJGguY2xlYW5BcnJheShkYXRhLmNvbmZpZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gJGguY2xlYW5BcnJheShkYXRhLnRhZ3MpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlldyA9IHUuY29udGVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdDb25maWcgPSB1LmNvbmZpZztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdUaHVtYlRhZ3MgPSB1LnRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jYWNoZUluaXRpYWxQcmV2aWV3ID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmhhc0luaXREYXRhKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51bmxvY2sodHJpZ2dlclJlc2V0KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAodHJpZ2dlclJlc2V0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRpbml0VGh1bWJzID0gc2VsZi4kcHJldmlldy5maW5kKCcuZmlsZS1wcmV2aWV3LWluaXRpYWwnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi51cGxvYWRBc3luYyAmJiAkaW5pdFRodW1icy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRpbml0VGh1bWJzLCAkaC5TT1JUX0NTUyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRTb3J0YWJsZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNodXBsb2FkY29tcGxldGUnLCBbc2VsZi5maWxlc3RhY2ssIHNlbGYuX2dldEV4dHJhRGF0YSgpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDb3VudCA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRTdGF0dXMgPSB7fTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5hamF4QWJvcnRlZCA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJHRodW1iLmhhc0NsYXNzKCdmaWxlLXByZXZpZXctc3VjY2VzcycpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0xvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCR0aHVtYiwgJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQuYXR0cignZGlzYWJsZWQnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAkYnRuRGVsZXRlLmF0dHIoJ2Rpc2FibGVkJywgdHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlcHJldXBsb2FkJywgW291dERhdGEsIHByZXZpZXdJZCwgaV0pO1xyXG4gICAgICAgICAgICAgICAgJC5leHRlbmQodHJ1ZSwgcGFyYW1zLCBvdXREYXRhKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydChwYXJhbXMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAganFYSFIuYWJvcnQoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJTdGF0dXMoJHRodW1iLCAnTmV3Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0blVwbG9hZC5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYnRuRGVsZXRlLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudW5sb2NrKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuU3VjY2VzcyA9IGZ1bmN0aW9uIChkYXRhLCB0ZXh0U3RhdHVzLCBqcVhIUikge1xyXG4gICAgICAgICAgICAgICAgdmFyIHBpZCA9IHNlbGYuc2hvd1ByZXZpZXcgJiYgJHRodW1iLmF0dHIoJ2lkJykgPyAkdGh1bWIuYXR0cignaWQnKSA6IHByZXZpZXdJZDtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSLCBkYXRhKTtcclxuICAgICAgICAgICAgICAgICQuZXh0ZW5kKHRydWUsIHBhcmFtcywgb3V0RGF0YSk7XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhKSB8fCAkaC5pc0VtcHR5KGRhdGEuZXJyb3IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRUaHVtYlN0YXR1cygkdGh1bWIsICdTdWNjZXNzJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuVXBsb2FkLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRVcGxvYWRTdWNjZXNzKGRhdGEsICR0aHVtYiwgaXNCYXRjaCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzcygxMDEsICRwcm9nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXVwbG9hZGVkJywgW291dERhdGEsIHBpZCwgaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVVwbG9hZExvZyhpLCBwaWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdXBsb2FkRmFpbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIHBhcmFtcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdFcnJvcigkdGh1bWIsIGksIHNlbGYuZmlsZXN0YWNrW2ldLCBzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuVXBsb2FkLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNCYXRjaCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlVXBsb2FkTG9nKGksIHBpZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCAkKCcjJyArIHBpZCkuZmluZCgnLmZpbGUtdGh1bWItcHJvZ3Jlc3MnKSwgc2VsZi5tc2dVcGxvYWRFcnJvcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5Db21wbGV0ZSA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghaXNCYXRjaCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnVubG9jayhmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2hrQ29tcGxldGUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFN1Y2Nlc3NUaHVtYnMoKTtcclxuICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuRXJyb3IgPSBmdW5jdGlvbiAoanFYSFIsIHRleHRTdGF0dXMsIGVycm9yVGhyb3duKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgb3AgPSBzZWxmLmFqYXhPcGVyYXRpb25zLnVwbG9hZFRodW1iLFxyXG4gICAgICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bixcclxuICAgICAgICAgICAgICAgICAgICAgICAgK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IH1cclxuICAgICAgICAgICAgc2V0QWxsVXBsb2FkZWQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uIChrZXkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGtleSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYubG9jaygpO1xyXG4gICAgICAgICAgICAgICAgdmFyIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciAkdGh1bWIgPSAkKHRoaXMpLCAkYnRuVXBsb2FkID0gJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEkdGh1bWIuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1zdWNjZXNzJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0xvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmFkZENzcygkdGh1bWIsICdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQuYXR0cignZGlzYWJsZWQnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5hdHRyKCdkaXNhYmxlZCcsIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHByZXVwbG9hZCcsIFtvdXREYXRhXSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5fYWJvcnQob3V0RGF0YSkpIHtcclxuICAgICAgICAgICAgICAgICAgICBqcVhIUi5hYm9ydCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgJHRodW1iID0gJCh0aGlzKSwgJGJ0blVwbG9hZCA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRidG5EZWxldGUgPSAkdGh1bWIuZmluZCgnLmt2LWZpbGUtcmVtb3ZlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkdGh1bWIuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1sb2FkaW5nJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ05ldycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuU3VjY2VzcyA9IGZ1bmN0aW9uIChkYXRhLCB0ZXh0U3RhdHVzLCBqcVhIUikge1xyXG4gICAgICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZGF0YS5lcnJvcmtleXMgKi9cclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUiwgZGF0YSksIGtleSA9IDAsXHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1icyA9IHNlbGYuX2dldFRodW1icygnOm5vdCguZmlsZS1wcmV2aWV3LXN1Y2Nlc3MpJyksXHJcbiAgICAgICAgICAgICAgICAgICAga2V5cyA9ICRoLmlzRW1wdHkoZGF0YSkgfHwgJGguaXNFbXB0eShkYXRhLmVycm9ya2V5cykgPyBbXSA6IGRhdGEuZXJyb3JrZXlzO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KGRhdGEpIHx8ICRoLmlzRW1wdHkoZGF0YS5lcnJvcikpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNodXBsb2Fkc3VjY2VzcycsIFtvdXREYXRhXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2V0QWxsVXBsb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWJzLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRUaHVtYlN0YXR1cygkdGh1bWIsICdTdWNjZXNzJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIuZmluZCgnLmt2LWZpbGUtdXBsb2FkJykuaGlkZSgpLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0VXBsb2FkU3VjY2VzcyhkYXRhKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJlc2V0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYnMuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgJHRodW1iID0gJCh0aGlzKSwgaSA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIuZmluZCgnLmt2LWZpbGUtcmVtb3ZlJykucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrZXlzLmxlbmd0aCA9PT0gMCB8fCAkLmluQXJyYXkoa2V5LCBrZXlzKSAhPT0gLTEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpLCBzZWxmLmZpbGVzdGFja1tpXSwgc2VsZi5yZXRyeUVycm9yVXBsb2Fkcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJTdGF0dXMoJHRodW1iLCAnU3VjY2VzcycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghJHRodW1iLmhhc0NsYXNzKCdmaWxlLXByZXZpZXctZXJyb3InKSB8fCBzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5Kys7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0VXBsb2FkU3VjY2VzcyhkYXRhKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIG91dERhdGEsICdmaWxlYmF0Y2h1cGxvYWRlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSwgc2VsZi4kcHJvZ3Jlc3MsIHNlbGYubXNnVXBsb2FkRXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkNvbXBsZXRlID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi51bmxvY2soKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRTdWNjZXNzVGh1bWJzKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHVwbG9hZGNvbXBsZXRlJywgW3NlbGYuZmlsZXN0YWNrLCBzZWxmLl9nZXRFeHRyYURhdGEoKV0pO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkVycm9yID0gZnVuY3Rpb24gKGpxWEhSLCB0ZXh0U3RhdHVzLCBlcnJvclRocm93bikge1xyXG4gICAgICAgICAgICAgICAgdmFyIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKSwgb3AgPSBzZWxmLmFqYXhPcGVyYXRpb25zLnVwbG9hZEJhdGNoLFxyXG4gICAgICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93VXBsb2FkRXJyb3IoZXJyTXNnLCBvdXREYXRhLCAnZmlsZWJhdGNodXBsb2FkZXJyb3InKTtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkRmlsZUNvdW50ID0gdG90YWwgLSAxO1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGtleSA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5maWxlc3RhY2tba2V5XSAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdFcnJvcigkdGh1bWIpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9nZXRUaHVtY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JcbiAgICAgICAgICAgIGZuQmVmb3JlID0gZnVuY3Rpb24gKGpxWEhSKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNocHJldXBsb2FkJywgW291dERhdGFdKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDUwKTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy5kYXRhID0gb3V0RGF0YTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy54aHIgPSBqcVhIUjtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydChwYXJhbXMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAganFYSFIuYWJvcnQoKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzc0NhbmNlbGxlZCgpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmblN1Y2Nlc3MgPSBmdW5jdGlvbiAoZGF0YSwgdGV4dFN0YXR1cywganFYSFIpIHtcclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUiwgZGF0YSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhKSB8fCAkaC5pc0VtcHR5KGRhdGEuZXJyb3IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHVwbG9hZHN1Y2Nlc3MnLCBbb3V0RGF0YV0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFVwbG9hZFN1Y2Nlc3MoZGF0YSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIG91dERhdGEsICdmaWxlYmF0Y2h1cGxvYWRlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkNvbXBsZXRlID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi51bmxvY2soKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNodXBsb2FkY29tcGxldGUnLCBbc2VsZi5maWxlc3RhY2ssIHNlbGYuX2dldEV4dHJhRGF0YSgpXSk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuRXJyb3IgPSBmdW5jdGlvbiAoanFYSFIsIHRleHRTdGF0dXMsIGVycm9yVGhyb3duKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgb3V0RGF0YSA9IHNlbGYuX2dldE91dERhdGEoanFYSFIpLCBvcCA9IHNlbGYuYWpheE9wZXJhdGlvbnMudXBsb2FkRXh0cmEsXHJcbiAgICAgICAgICAgICAgICAgICAgZXJyTXNnID0gc2VsZi5fcGFyc2VFcnJvcihvcCwganFYSFIsIGVycm9yVGhyb3duKTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy5kYXRhID0gb3V0RGF0YTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihlcnJNc2csIG91dERhdGEsICdmaWxlYmF0Y2h1cGxvYWRlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCBzZWxmLiRwcm9ncmVzcywgc2VsZi5tc2dBamF4UHJvZ3Jlc3NFcnJvci5yZXBsYWNlKCd7b3BlcmF0aW9ufScsIG9wKSk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNlbGYuX2FqYXhTdWJtaXQoZm5CZWZvcmUsIGZuU3VjY2VzcywgZm5Db21wbGV0ZSwgZm5FcnJvcik7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZGVsZXRlRmlsZUluZGV4OiBmdW5jdGlvbiAoJGZyYW1lKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgaW5kID0gJGZyYW1lLmF0dHIoJ2RhdGEtZmlsZWluZGV4JyksIHJldiA9IHNlbGYucmV2ZXJzZVByZXZpZXdPcmRlcjtcclxuICAgICAgICAgICAgaWYgKGluZC5zdWJzdHJpbmcoMCwgNSkgPT09ICdpbml0XycpIHtcclxuICAgICAgICAgICAgICAgIGluZCA9IHBhcnNlSW50KGluZC5yZXBsYWNlKCdpbml0XycsICcnKSk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3ID0gJGguc3BsaWNlQXJyYXkoc2VsZi5pbml0aWFsUHJldmlldywgaW5kLCByZXYpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9ICRoLnNwbGljZUFycmF5KHNlbGYuaW5pdGlhbFByZXZpZXdDb25maWcsIGluZCwgcmV2KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdUaHVtYlRhZ3MgPSAkaC5zcGxpY2VBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzLCBpbmQsIHJldik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmdldEZyYW1lcygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciAkbkZyYW1lID0gJCh0aGlzKSwgbkluZCA9ICRuRnJhbWUuYXR0cignZGF0YS1maWxlaW5kZXgnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAobkluZC5zdWJzdHJpbmcoMCwgNSkgPT09ICdpbml0XycpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgbkluZCA9IHBhcnNlSW50KG5JbmQucmVwbGFjZSgnaW5pdF8nLCAnJykpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobkluZCA+IGluZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbkluZC0tO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJG5GcmFtZS5hdHRyKCdkYXRhLWZpbGVpbmRleCcsICdpbml0XycgKyBuSW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYudXBsb2FkQXN5bmMpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNhY2hlSW5pdGlhbFByZXZpZXcgPSBzZWxmLmdldFByZXZpZXcoKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRGaWxlQWN0aW9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5faW5pdFpvb21CdXR0b24oKTtcclxuICAgICAgICAgICAgc2VsZi5nZXRGcmFtZXMoJyAua3YtZmlsZS1yZW1vdmUnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpLCAkZnJhbWUgPSAkZWwuY2xvc2VzdCgkaC5GUkFNRVMpLCBoYXNFcnJvciwgaWQgPSAkZnJhbWUuYXR0cignaWQnKSxcclxuICAgICAgICAgICAgICAgICAgICBpbmQgPSAkZnJhbWUuYXR0cignZGF0YS1maWxlaW5kZXgnKSwgbiwgY2FwLCBzdGF0dXM7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRlbCwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IHNlbGYuX3JhaXNlKCdmaWxlcHJlcmVtb3ZlJywgW2lkLCBpbmRdKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzID09PSBmYWxzZSB8fCAhc2VsZi5fdmFsaWRhdGVNaW5Db3VudCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaGFzRXJyb3IgPSAkZnJhbWUuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1lcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgICRoLmNsZWFuTWVtb3J5KCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLmZhZGVPdXQoJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRoLmNsZWFuWm9vbUNhY2hlKCRwcmV2aWV3LmZpbmQoJyN6b29tLScgKyBpZCkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGluZCwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJPYmplY3RzKCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRmcmFtZS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlkICYmIGhhc0Vycm9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5maW5kKCdsaVtkYXRhLXRodW1iLWlkPVwiJyArIGlkICsgJ1wiXScpLmZhZGVPdXQoJ2Zhc3QnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuX2Vycm9yc0V4aXN0KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnMoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmlsZXN0YWNrID0gc2VsZi5nZXRGaWxlU3RhY2sodHJ1ZSksIGNoayA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gPSBmaWxlc3RhY2subGVuZ3RoLCBoYXNUaHVtYiA9IHNlbGYuc2hvd1ByZXZpZXcgJiYgc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPT09IDAgJiYgY2hrID09PSAwICYmICFoYXNUaHVtYikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5yZXNldCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGNoayArIGxlbjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhcCA9IG4gPiAxID8gc2VsZi5fZ2V0TXNnU2VsZWN0ZWQobikgOiAoZmlsZXN0YWNrWzBdID8gc2VsZi5fZ2V0RmlsZU5hbWVzKClbMF0gOiAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGNhcCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVyZW1vdmVkJywgW2lkLCBpbmRdKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgc2VsZi5nZXRGcmFtZXMoJyAua3YtZmlsZS11cGxvYWQnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkZWwsICdjbGljaycsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgJGZyYW1lID0gJGVsLmNsb3Nlc3QoJGguRlJBTUVTKSwgaW5kID0gJGZyYW1lLmF0dHIoJ2RhdGEtZmlsZWluZGV4Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kcHJvZ3Jlc3MuaGlkZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZnJhbWUuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1lcnJvcicpICYmICFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBsb2FkU2luZ2xlKGluZCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3QWN0aW9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldywgZGVsZXRlRXh0cmFEYXRhID0gc2VsZi5kZWxldGVFeHRyYURhdGEgfHwge30sXHJcbiAgICAgICAgICAgICAgICBidG5SZW1vdmUgPSAkaC5GUkFNRVMgKyAnIC5rdi1maWxlLXJlbW92ZScsIHNldHRpbmdzID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3MsXHJcbiAgICAgICAgICAgICAgICBvcmlnQ2xhc3MgPSBzZXR0aW5ncy5yZW1vdmVDbGFzcywgZXJyQ2xhc3MgPSBzZXR0aW5ncy5yZW1vdmVFcnJvckNsYXNzLFxyXG4gICAgICAgICAgICAgICAgcmVzZXRQcm9ncmVzcyA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgaGFzRmlsZXMgPSBzZWxmLmlzQWpheFVwbG9hZCA/IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCkgOiBzZWxmLl9pbnB1dEZpbGVDb3VudCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJHByZXZpZXcuZmluZCgkaC5GUkFNRVMpLmxlbmd0aCAmJiAhaGFzRmlsZXMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0Q2FwdGlvbignJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucmVzZXQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsQ2FwdGlvbiA9ICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9uKCk7XHJcbiAgICAgICAgICAgICRwcmV2aWV3LmZpbmQoYnRuUmVtb3ZlKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpLCB2VXJsID0gJGVsLmRhdGEoJ3VybCcpIHx8IHNlbGYuZGVsZXRlVXJsLCB2S2V5ID0gJGVsLmRhdGEoJ2tleScpLFxyXG4gICAgICAgICAgICAgICAgICAgIGZuQmVmb3JlLCBmblN1Y2Nlc3MsIGZuRXJyb3I7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eSh2VXJsKSB8fCB2S2V5ID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB2YXIgJGZyYW1lID0gJGVsLmNsb3Nlc3QoJGguRlJBTUVTKSwgY2FjaGUgPSBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLFxyXG4gICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLCBwYXJhbXMsIGluZGV4ID0gJGZyYW1lLmF0dHIoJ2RhdGEtZmlsZWluZGV4JyksIGNvbmZpZywgZXh0cmFEYXRhO1xyXG4gICAgICAgICAgICAgICAgaW5kZXggPSBwYXJzZUludChpbmRleC5yZXBsYWNlKCdpbml0XycsICcnKSk7XHJcbiAgICAgICAgICAgICAgICBjb25maWcgPSAkaC5pc0VtcHR5KGNhY2hlLmNvbmZpZykgJiYgJGguaXNFbXB0eShjYWNoZS5jb25maWdbaW5kZXhdKSA/IG51bGwgOiBjYWNoZS5jb25maWdbaW5kZXhdO1xyXG4gICAgICAgICAgICAgICAgZXh0cmFEYXRhID0gJGguaXNFbXB0eShjb25maWcpIHx8ICRoLmlzRW1wdHkoY29uZmlnLmV4dHJhKSA/IGRlbGV0ZUV4dHJhRGF0YSA6IGNvbmZpZy5leHRyYTtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZXh0cmFEYXRhID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZXh0cmFEYXRhID0gZXh0cmFEYXRhKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBwYXJhbXMgPSB7aWQ6ICRlbC5hdHRyKCdpZCcpLCBrZXk6IHZLZXksIGV4dHJhOiBleHRyYURhdGF9O1xyXG4gICAgICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVwcmVkZWxldGUnLCBbdktleSwganFYSFIsIGV4dHJhRGF0YV0pO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGpxWEhSLmFib3J0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGVsLnJlbW92ZUNsYXNzKGVyckNsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRmcmFtZSwgJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRoLmFkZENzcygkZWwsICdkaXNhYmxlZCAnICsgb3JpZ0NsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgZm5TdWNjZXNzID0gZnVuY3Rpb24gKGRhdGEsIHRleHRTdGF0dXMsIGpxWEhSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGNhcDtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoZGF0YSkgJiYgISRoLmlzRW1wdHkoZGF0YS5lcnJvcikpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmpxWEhSID0ganFYSFI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5yZXNwb25zZSA9IGRhdGE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dFcnJvcihkYXRhLmVycm9yLCBwYXJhbXMsICdmaWxlZGVsZXRlZXJyb3InKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGZyYW1lLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZWwucmVtb3ZlQ2xhc3MoJ2Rpc2FibGVkICcgKyBvcmlnQ2xhc3MpLmFkZENsYXNzKGVyckNsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXRQcm9ncmVzcygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRmcmFtZS5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKS5hZGRDbGFzcygnZmlsZS1kZWxldGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLmZhZGVPdXQoJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gcGFyc2VJbnQoKCRmcmFtZS5hdHRyKCdkYXRhLWZpbGVpbmRleCcpKS5yZXBsYWNlKCdpbml0XycsICcnKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLnVuc2V0KGluZGV4KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fZGVsZXRlRmlsZUluZGV4KCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXAgPSBuID4gMCA/IHNlbGYuX2dldE1zZ1NlbGVjdGVkKG4pIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24oY2FwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVkZWxldGVkJywgW3ZLZXksIGpxWEhSLCBleHRyYURhdGFdKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguY2xlYW5ab29tQ2FjaGUoJHByZXZpZXcuZmluZCgnI3pvb20tJyArICRmcmFtZS5hdHRyKCdpZCcpKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyT2JqZWN0cygkZnJhbWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZnJhbWUucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc2V0UHJvZ3Jlc3MoKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBmbkVycm9yID0gZnVuY3Rpb24gKGpxWEhSLCB0ZXh0U3RhdHVzLCBlcnJvclRocm93bikge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBvcCA9IHNlbGYuYWpheE9wZXJhdGlvbnMuZGVsZXRlVGh1bWIsIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bik7XHJcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmpxWEhSID0ganFYSFI7XHJcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zLnJlc3BvbnNlID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd0Vycm9yKGVyck1zZywgcGFyYW1zLCAnZmlsZWRlbGV0ZWVycm9yJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICRlbC5yZW1vdmVDbGFzcygnZGlzYWJsZWQgJyArIG9yaWdDbGFzcykuYWRkQ2xhc3MoZXJyQ2xhc3MpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJlc2V0UHJvZ3Jlc3MoKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0QWpheFNldHRpbmdzKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnYmVmb3JlU2VuZCcsIGZuQmVmb3JlLCAnZGVsZXRlJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnc3VjY2VzcycsIGZuU3VjY2VzcywgJ2RlbGV0ZScpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fbWVyZ2VBamF4Q2FsbGJhY2soJ2Vycm9yJywgZm5FcnJvciwgJ2RlbGV0ZScpO1xyXG4gICAgICAgICAgICAgICAgc2V0dGluZ3MgPSAkLmV4dGVuZCh0cnVlLCB7fSwge1xyXG4gICAgICAgICAgICAgICAgICAgIHVybDogc2VsZi5fZW5jb2RlVVJJKHZVcmwpLFxyXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6ICdQT1NUJyxcclxuICAgICAgICAgICAgICAgICAgICBkYXRhVHlwZTogJ2pzb24nLFxyXG4gICAgICAgICAgICAgICAgICAgIGRhdGE6ICQuZXh0ZW5kKHRydWUsIHt9LCB7a2V5OiB2S2V5fSwgZXh0cmFEYXRhKVxyXG4gICAgICAgICAgICAgICAgfSwgc2VsZi5fYWpheERlbGV0ZVNldHRpbmdzKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLl92YWxpZGF0ZU1pbkNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViZWZvcmVkZWxldGUnLCBbdktleSwgZXh0cmFEYXRhXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSlNVbnJlc29sdmVkVmFyaWFibGUsSlNIaW50XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlbGYuYWpheEFib3J0ZWQgaW5zdGFuY2VvZiBQcm9taXNlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQudGhlbihmdW5jdGlvbiAocmVzdWx0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQuYWpheChzZXR0aW5ncyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5hamF4QWJvcnRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJC5hamF4KHNldHRpbmdzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9oaWRlRmlsZUljb246IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Nob3dGaWxlSWNvbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjYXB0aW9uQ29udGFpbmVyLCAnaWNvbi12aXNpYmxlJyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0U2l6ZTogZnVuY3Rpb24gKGJ5dGVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgc2l6ZSA9IHBhcnNlRmxvYXQoYnl0ZXMpLCBpLCBmdW5jID0gc2VsZi5maWxlU2l6ZUdldHRlciwgc2l6ZXMsIG91dDtcclxuICAgICAgICAgICAgaWYgKCEkLmlzTnVtZXJpYyhieXRlcykgfHwgISQuaXNOdW1lcmljKHNpemUpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBmdW5jID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBmdW5jKHNpemUpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKHNpemUgPT09IDApIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSAnMC4wMCBCJztcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaSA9IE1hdGguZmxvb3IoTWF0aC5sb2coc2l6ZSkgLyBNYXRoLmxvZygxMDI0KSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2l6ZXMgPSBbJ0InLCAnS0InLCAnTUInLCAnR0InLCAnVEInLCAnUEInLCAnRUInLCAnWkInLCAnWUInXTtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSAoc2l6ZSAvIE1hdGgucG93KDEwMjQsIGkpKS50b0ZpeGVkKDIpICogMSArICcgJyArIHNpemVzW2ldO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnc2l6ZScpLnJlcGxhY2UoJ3tzaXplVGV4dH0nLCBvdXQpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dldEZpbGVUeXBlOiBmdW5jdGlvbiAoZnR5cGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi5taW1lVHlwZUFsaWFzZXNbZnR5cGVdIHx8IGZ0eXBlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dlbmVyYXRlUHJldmlld1RlbXBsYXRlOiBmdW5jdGlvbiAoXHJcbiAgICAgICAgICAgIGNhdCxcclxuICAgICAgICAgICAgZGF0YSxcclxuICAgICAgICAgICAgZm5hbWUsXHJcbiAgICAgICAgICAgIGZ0eXBlLFxyXG4gICAgICAgICAgICBwcmV2aWV3SWQsXHJcbiAgICAgICAgICAgIGlzRXJyb3IsXHJcbiAgICAgICAgICAgIHNpemUsXHJcbiAgICAgICAgICAgIGZyYW1lQ2xhc3MsXHJcbiAgICAgICAgICAgIGZvb3QsXHJcbiAgICAgICAgICAgIGluZCxcclxuICAgICAgICAgICAgdGVtcGwsXHJcbiAgICAgICAgICAgIGF0dHJzXHJcbiAgICAgICAgKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY2FwdGlvbiA9IHNlbGYuc2x1ZyhmbmFtZSksIHByZXZDb250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xyXG4gICAgICAgICAgICAgICAgICAgIHN0eWxlQXR0cmlicyArPSBrZXkgKyAnOicgKyB2YWwgKyAnOyc7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBnZXRDb250ZW50ID0gZnVuY3Rpb24gKGMsIGQsIHpvb20sIGZyYW1lQ3NzKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgaWQgPSB6b29tID8gJ3pvb20tJyArIHByZXZpZXdJZCA6IHByZXZpZXdJZCwgdG1wbHQgPSBzZWxmLl9nZXRQcmV2aWV3VGVtcGxhdGUoYyksXHJcbiAgICAgICAgICAgICAgICAgICAgY3NzID0gKGZyYW1lQ2xhc3MgfHwgJycpICsgJyAnICsgZnJhbWVDc3M7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5mcmFtZUNsYXNzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY3NzID0gc2VsZi5mcmFtZUNsYXNzICsgJyAnICsgY3NzO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHpvb20pIHtcclxuICAgICAgICAgICAgICAgICAgICBjc3MgPSBjc3MucmVwbGFjZSgnICcgKyAkaC5TT1JUX0NTUywgJycpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdG1wbHQgPSBzZWxmLl9wYXJzZUZpbGVQcmV2aWV3SWNvbih0bXBsdCwgZm5hbWUpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGMgPT09ICd0ZXh0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgIGQgPSAkaC5odG1sRW5jb2RlKGQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKGNhdCA9PT0gJ29iamVjdCcgJiYgIWZ0eXBlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJC5lYWNoKHNlbGYuZGVmYXVsdHMuZmlsZVR5cGVTZXR0aW5ncywgZnVuY3Rpb24gKGtleSwgZnVuYykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSAnb2JqZWN0JyB8fCBrZXkgPT09ICdvdGhlcicpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZnVuYyhmbmFtZSwgZnR5cGUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlQ3NzID0gJ3R5cGUtJyArIGtleTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCEkaC5pc0VtcHR5KGF0dHJzKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhdHRycy50aXRsZSAhPT0gdW5kZWZpbmVkICYmIGF0dHJzLnRpdGxlICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gYXR0cnMudGl0bGU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhdHRycy5hbHQgIT09IHVuZGVmaW5lZCAmJiBhdHRycy5hbHQgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSBhdHRycy5hbHQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRtcGx0LnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAgICAgJ3ByZXZpZXdJZCc6IGlkLFxyXG4gICAgICAgICAgICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICAgICAndGl0bGUnOiB0aXRsZSxcclxuICAgICAgICAgICAgICAgICAgICAnYWx0JzogYWx0LFxyXG4gICAgICAgICAgICAgICAgICAgICdmcmFtZUNsYXNzJzogY3NzLFxyXG4gICAgICAgICAgICAgICAgICAgICd0eXBlJzogc2VsZi5fZ2V0RmlsZVR5cGUoZnR5cGUpLFxyXG4gICAgICAgICAgICAgICAgICAgICdmaWxlaW5kZXgnOiBpbmQsXHJcbiAgICAgICAgICAgICAgICAgICAgJ2ZpbGVpZCc6IHNlbGYuX2dldEZpbGVJZHMoKVtpbmRdIHx8ICcnLFxyXG4gICAgICAgICAgICAgICAgICAgICd0eXBlQ3NzJzogdHlwZUNzcyxcclxuICAgICAgICAgICAgICAgICAgICAnZm9vdGVyJzogZm9vdGVyLFxyXG4gICAgICAgICAgICAgICAgICAgICdkYXRhJzogZCxcclxuICAgICAgICAgICAgICAgICAgICAndGVtcGxhdGUnOiB0ZW1wbCB8fCBjYXQsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3N0eWxlJzogc3R5bGVBdHRyaWJzID8gJ3N0eWxlPVwiJyArIHN0eWxlQXR0cmlicyArICdcIicgOiAnJ1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGluZCA9IGluZCB8fCBwcmV2aWV3SWQuc2xpY2UocHJldmlld0lkLmxhc3RJbmRleE9mKCctJykgKyAxKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuZmlsZUFjdGlvblNldHRpbmdzLnNob3dab29tKSB7XHJcbiAgICAgICAgICAgICAgICB6b29tQ29udGVudCA9IGdldENvbnRlbnQoKGZvcmNlWm9vbUljb24gPyAnb3RoZXInIDogY2F0KSwgZGF0YSwgdHJ1ZSwgJ2t2LXpvb20tdGh1bWInKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB6b29tQ29udGVudCA9ICdcXG4nICsgc2VsZi5fZ2V0TGF5b3V0VGVtcGxhdGUoJ3pvb21DYWNoZScpLnJlcGxhY2UoJ3t6b29tQ29udGVudH0nLCB6b29tQ29udGVudCk7XHJcbiAgICAgICAgICAgIHByZXZDb250ZW50ID0gZ2V0Q29udGVudCgoZm9yY2VQcmV2SWNvbiA/ICdvdGhlcicgOiBjYXQpLCBkYXRhLCBmYWxzZSwgJ2t2LXByZXZpZXctdGh1bWInKTtcclxuICAgICAgICAgICAgcmV0dXJuIHByZXZDb250ZW50ICsgem9vbUNvbnRlbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfYWRkVG9QcmV2aWV3OiBmdW5jdGlvbiAoJHByZXZpZXcsIGNvbnRlbnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyID8gJHByZXZpZXcucHJlcGVuZChjb250ZW50KSA6ICRwcmV2aWV3LmFwcGVuZChjb250ZW50KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9wcmV2aWV3RGVmYXVsdDogZnVuY3Rpb24gKGZpbGUsIHByZXZpZXdJZCwgaXNEaXNhYmxlZCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGZuYW1lID0gJGguZ2V0RmlsZU5hbWUoZmlsZSksIGZ0eXBlID0gZmlsZSA/IGZpbGUudHlwZSA6ICcnLCBjb250ZW50LCBzaXplID0gZmlsZS5zaXplIHx8IDAsXHJcbiAgICAgICAgICAgICAgICBjYXB0aW9uID0gc2VsZi5zbHVnKGZuYW1lKSwgaXNFcnJvciA9IGlzRGlzYWJsZWQgPT09IHRydWUgJiYgIXNlbGYuaXNBamF4VXBsb2FkLFxyXG4gICAgICAgICAgICAgICAgZGF0YSA9ICRoLmNyZWF0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cHJldmlld0lkO1xyXG4gICAgICAgICAgICBpZiAobGVuID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gZGF0YS5jb25maWdbaV07XHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3SWQgPSBzZWxmLnByZXZpZXdJbml0SWQgKyAnLScgKyAnaW5pdF8nICsgaTtcclxuICAgICAgICAgICAgICAgIGNhcHRpb24gPSAkaC5pZlNldCgnY2FwdGlvbicsIGNvbmZpZywgJGguaWZTZXQoJ2ZpbGVuYW1lJywgY29uZmlnKSk7XHJcbiAgICAgICAgICAgICAgICBzaXplID0gJGguaWZTZXQoJ3NpemUnLCBjb25maWcpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJBdHRyKHByZXZpZXdJZCwgY2FwdGlvbiwgc2l6ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zbHVnRGVmYXVsdDogZnVuY3Rpb24gKHRleHQpIHtcclxuICAgICAgICAgICAgLy8gbm9pbnNwZWN0aW9uIFJlZ0V4cFJlZHVuZGFudEVzY2FwZVxyXG4gICAgICAgICAgICByZXR1cm4gJGguaXNFbXB0eSh0ZXh0KSA/ICcnIDogU3RyaW5nKHRleHQpLnJlcGxhY2UoL1tcXFtcXF1cXC9cXHt9OjsjJT1cXChcXClcXCpcXCtcXD9cXFxcXFxeXFwkXFx8PD4mXCInXS9nLCAnXycpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwZGF0ZUZpbGVEZXRhaWxzOiBmdW5jdGlvbiAobnVtRmlsZXMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZWwgPSBzZWxmLiRlbGVtZW50LCBmaWxlU3RhY2sgPSBzZWxmLm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ucHV0LWFqYXgtbmV3Jyk7XHJcbiAgICAgICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID09PSAxKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXNlbGVjdCcsIFtudW1GaWxlcywgbGFiZWxdKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zZXRUaHVtYlN0YXR1czogZnVuY3Rpb24gKCR0aHVtYiwgc3RhdHVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGljb24gPSAnaW5kaWNhdG9yJyArIHN0YXR1cywgbXNnID0gaWNvbiArICdUaXRsZScsXHJcbiAgICAgICAgICAgICAgICBjc3MgPSAnZmlsZS1wcmV2aWV3LScgKyBzdGF0dXMudG9Mb3dlckNhc2UoKSxcclxuICAgICAgICAgICAgICAgICRpbmRpY2F0b3IgPSAkdGh1bWIuZmluZCgnLmZpbGUtdXBsb2FkLWluZGljYXRvcicpLFxyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3M7XHJcbiAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS1wcmV2aWV3LXN1Y2Nlc3MgZmlsZS1wcmV2aWV3LWVycm9yIGZpbGUtcHJldmlldy1sb2FkaW5nJyk7XHJcbiAgICAgICAgICAgIGlmIChzdGF0dXMgPT09ICdTdWNjZXNzJykge1xyXG4gICAgICAgICAgICAg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ZW1wbGF0ZSA6IChlcnJvciA/IHNlbGYucHJvZ3Jlc3NFcnJvclRlbXBsYXRlIDogdCk7XHJcbiAgICAgICAgICAgICRlbCA9ICRlbCB8fCBzZWxmLiRwcm9ncmVzcztcclxuICAgICAgICAgICAgaWYgKCEkaC5pc0VtcHR5KHRlbXBsYXRlKSkge1xyXG4gICAgICAgICAgICAgICAgaWYgKHBjdExpbWl0ICYmIHBjdCA+IHBjdExpbWl0ICYmIHAgPD0gMTAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgb3V0ID0gdGVtcGxhdGUuc2V0VG9rZW5zKHsncGVyY2VudCc6IHBjdExpbWl0LCAnc3RhdHVzJzogc2VsZi5tc2dVcGxvYWRUaHJlc2hvbGR9KTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgb3V0ID0gdGVtcGxhdGUuc2V0VG9rZW5zKHsncGVyY2VudCc6IHBjdCwgJ3N0YXR1cyc6IChwID4gMTAwID8gc2VsZi5tc2dVcGxvYWRFbmQgOiBwY3QgKyAnJScpfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAkZWwuaHRtbChvdXQpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGVycm9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJGVsLmZpbmQoJ1tyb2xlPVwicHJvZ3Jlc3NiYXJcIl0nKS5odG1sKGVycm9yKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldEZpbGVEcm9wWm9uZVRpdGxlOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJHpvbmUgPSBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGUtZHJvcC16b25lJyksIHRpdGxlID0gc2VsZi5kcm9wWm9uZVRpdGxlLCBzdHJGaWxlcztcclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNDbGlja2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHN0ckZpbGVzID0gJGguaXNFbXB0eShzZWxmLiRlbGVtZW50LmF0dHIoJ211bHRpcGxlJykpID8gc2VsZi5maWxlU2luZ2xlIDogc2VsZi5maWxlUGx1cmFsO1xyXG4gICAgICAgICAgICAgICAgdGl0bGUgKz0gc2VsZi5kcm9wWm9uZUNsaWNrVGl0bGUucmVwbGFjZSgne2ZpbGVzfScsIHN0ckZpbGVzKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkem9uZS5maW5kKCcuJyArIHNlbGYuZHJvcFpvbmVUaXRsZUNsYXNzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3IHx8ICR6b25lLmxlbmd0aCA9PT0gMCB8fCBzZWxmLmdldEZpbGVTdGFjaygpLmxlbmd0aCA+IDAgfHwgIXNlbGYuZHJvcFpvbmVFbmFibGVkIHx8XHJcbiAgICAgICAgICAgICAgICAoIXNlbGYuaXNBamF4VXBsb2FkICYmIHNlbGYuJGVsZW1lbnQuZmlsZXMpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCR6b25lLmZpbmQoJGguRlJBTUVTKS5sZW5ndGggPT09IDAgJiYgJGguaXNFbXB0eShzZWxmLmRlZmF1bHRQcmV2aWV3Q29udGVudCkpIHtcclxuICAgICAgICAgICAgICAgICR6b25lLnByZXBlbmQoJzxkaXYgY2xhc3M9XCInICsgc2VsZi5kcm9wWm9uZVRpdGxlQ2xhc3MgKyAnXCI+JyArIHRpdGxlICsgJzwvZGl2PicpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5yZW1vdmVDbGFzcygnZmlsZS1pbnB1dC1uZXcnKTtcclxuICAgICAgICAgICAgJGguYWRkQ3NzKHNlbG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4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0RmlsZUNvdW50OiBmdW5jdGlvbiAoZmlsZUNvdW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgYWRkQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi52YWxpZGF0ZUluaXRpYWxDb3VudCAmJiAhc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBhZGRDb3VudCA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCk7XHJcbiAgICAgICAgICAgICAgICBmaWxlQ291bnQgKz0gYWRkQ291bnQ7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZpbGVDb3VudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRGaWxlSWQ6IGZ1bmN0aW9uIChmaWxlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY3VzdG9tID0gc2VsZi5nZW5lcmF0ZUZpbGVJZCwgcmVsYXRpdmVQYXRoO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIGN1c3RvbSA9PT0gJ2Z1bmN0aW9uJykge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIGN1c3RvbShmaWxlLCBldmVudCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCFmaWxlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBmaWxlLnJlbGF0aXZlUGF0aCAqL1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBmaWxlLndlYmtpdFJlbGF0aXZlUGF0aCAqL1xyXG4gICAgICAgICAgICByZWxhdGl2ZVBhdGggPSBTdHJpbmco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GVuYW1lcy5maWx0ZXIoZnVuY3Rpb24gKG4pIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiAoc2tpcE51bGwgPyBuICE9PSB1bmRlZmluZWQgOiBuICE9PSB1bmRlZmluZWQgJiYgbiAhPT0gbnVsbCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldFByZXZpZXdFcnJvcjogZnVuY3Rpb24gKCR0aHVtYiwgaSwgdmFsLCByZXBlYXQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoaSAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGksIHZhbCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYucmVtb3ZlRnJvbVByZXZpZXdPbkVycm9yICYmICFyZXBlYXQpIHtcclxuICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0Vycm9yJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmVmcmVzaFVwbG9hZEJ1dHRvbigkdGh1bWIsIHJlcGVhdCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaFVwbG9hZEJ1dHRvbjogZnVuY3Rpb24gKCR0aHVtYiwgcmVwZWF0KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGJ0biA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKSwgY2ZnID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3MsXHJcbiAgICAgICAgICAgICAgICBpY29uID0gY2ZnLnVwbG9hZEljb24sIHRpdGxlID0gY2ZnLnVwbG9hZFRpdGxlO1xyXG4gICAgICAgICAgICBpZiAoISRidG4ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHJlcGVhdCkge1xyXG4gICAgICAgICAgICAgICAgaWNvbiA9IGNmZy51cGxvYWRSZXRyeUljb247XHJcbiAgICAgICAgICAgICAgICB0aXRsZSA9IGNmZy51cGxvYWRSZXRyeVRpdGxlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRidG4uYXR0cigndGl0bGUnLCB0aXRsZSkuaHRtbChpY29uKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jaGVja0RpbWVuc2lvbnM6IGZ1bmN0aW9uIChpLCBjaGssICRpbWcsICR0aHVtYiwgZm5hbWUsIHR5cGUsIHBhcmFtcykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIG1zZywgZGltLCB0YWcgPSBjaGsgPT09ICdTbWFsbCcgPyAnbWluJyA6ICdtYXgnLCBsaW1pdCA9IHNlbGZbdGFnICsgJ0ltYWdlJyArIHR5cGVdLFxyXG4gICAgICAgICAgICAgICAgJGltZ0VsLCBpc1ZhbGlkO1xyXG4gICAgICAgICAgICBpZiAoJGguaXNFbXB0eShsaW1pdCkgfHwgISRpbWcubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGltZ0VsID0gJGltZ1swXTtcclxuICAgICAgICAgICAgZGltID0gKHR5cGUgPT09ICdXaWR0aCcpID8gJGltZ0VsLm5hdHVyYWxXaWR0aCB8fCAkaW1nRWwud2lkdGggOiAkaW1nRWwubmF0dXJhbEhlaWdodCB8fCAkaW1nRWwuaGVpZ2h0O1xyXG4gICAgICAgICAgICBpc1ZhbGlkID0gY2hrID09PSAnU21hbGwnID8gZGltID49IGxpbWl0IDogZGltIDw9IGxpbWl0O1xyXG4gICAgICAgICAgICBpZiAoaXNWYWxpZCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9IHNlbGZbJ21zZ0ltYWdlJyArIHR5cGUgKyBjaGtdLnNldFRva2Vucyh7J25hbWUnOiBmbmFtZSwgJ3NpemUnOiBsaW1pdH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9zaG93VXBsb2FkRXJyb3IobXNnLCBwYXJhbXMpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpLCBudWxsKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRFeGlmT2JqOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGV4aWZPYmogPSBudWxsO1xyXG4gICAgICAgICAgICBpZiAoZGF0YS5zbGljZSgwLCAyMykgIT09ICdkYXRhOmltYWdlL2pwZWc7YmFzZTY0LCcgJiYgZGF0YS5zbGljZSgwLCAyMikgIT09ICdkYXRhOmltYWdlL2pwZztiYXNlNjQsJykge1xyXG4gICAgICAgICAgICAgICAgZXhpZk9iaiA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIGV4aWZPYmogPSB3aW5kb3cucGlleGlmID8gd2luZG93LnBpZXhpZi5sb2FkKGRhdGEpIDogbnVsbDtcclxuXHJcbiAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xyXG4gICAgICAgICAgICAgICAgZXhpZk9iaiA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9sb2coZXJyKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIWV4aWZPYmopIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZyhcclxuICAgICAgICAgICAgICAgICAgICAnVGhlIHBpZXhpZi5qcyBsaWJyYXJ5IHdhcyBub3QgZGV0ZWN0ZWQuIEVpdGhlciBsb2FkIHBpZXhpZi5qcyBvbiB5b3VyIHBhZ2UgT1Igc2V0IGBhdXRvT3JpZW50SW1hZ2VgIHRvIGBmYWxzZWAuJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGV4aWZPYmo7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfdmFsaWRhdGVJbWFnZU9yaWVudGF0aW9uOiBmdW5jdGlvbiAoJGltZywgZmlsZSwgcHJldmlld0lkLCBjYXB0aW9uLCBmdHlwZSwgZnNpemUsIGlEYXRhKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZXhpZk9iaiwgdmFsdWUsIGF1dG9PcmllbnRJbWFnZSA9IHNlbGYuYXV0b09yaWVudEltYWdlO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIGF1dG9PcmllbnRJbWFnZSA9PT0gJ2Z1bmN0aW9uJykge1xyXG4gICAgICAgICAgICAgICAgYXV0b09yaWVudEltYWdlID0gYXV0b09yaWVudEltYWdlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZXhpZk9iaiA9ICRpbWcubGVuZ3RoICYmIGF1dG9PcmllbnRJbWFnZSA/IHNlbGYuX2dldEV4aWZPYmooaURhdGEpIDogbnVsbDtcclxuICAgICAgICAgICAgdmFsdWUgPSBleGlmT2JqID8gZXhpZk9ialsnMHRoJ11bcGlleGlmLkltYWdlSUZELk9yaWVudGF0aW9uXSA6IG51bGw7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICAgICAgICBpZiAoIXZhbHVlKSB7XHJc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gICAgICAgdzIgPSAkcHJldmlldy53aWR0aCgpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHcxID4gdzIpIHtcclxuICAgICAgICAgICAgICAgICAgICAkaW1nLmNzcygnd2lkdGgnLCAnMTAwJScpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgcGFyYW1zID0ge2luZDogaSwgaWQ6IHByZXZpZXdJZH07XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jaGVja0RpbWVuc2lvbnMoaSwgJ1NtYWxsJywgJGltZywgJHRodW1iLCBmbmFtZSwgJ1dpZHRoJywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnU21hbGwnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnSGVpZ2h0JywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIGlmICghc2VsZi5yZXNpemVJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnTGFyZ2UnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnV2lkdGgnLCBwYXJhbXMpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnTGFyZ2UnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnSGVpZ2h0JywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2Vsb2FkZWQnLCBbcHJldmlld0lkXSk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmxvYWRlZEltYWdlcy5wdXNoKHtcclxuICAgICAgICAgICAgICAgICAgICBpbmQ6IGksXHJcbiAgICAgICAgICAgICAgICAgICAgaW1nOiAkaW1nLFxyXG4gICAgICAgICAgICAgICAgICAgIHRodW1iOiAkdGh1bWIsXHJcbiAgICAgICAgICAgICAgICAgICAgcGlkOiBwcmV2aWV3SWQsXHJcbiAgICAgICAgICAgICAgICAgICAgdHlwOiBmdHlwZSxcclxuICAgICAgICAgICAgICAgICAgICBzaXo6IGZzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlZDogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICAgICAgaW1nRGF0YTogaURhdGEsXHJcbiAgICAgICAgICAgICAgICAgICAgZXhpZk9iajogZXhpZk9ialxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAkdGh1bWIuZGF0YSgnZXhpZicsIGV4aWZPYmopO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVBbGxJbWFnZXMoKTtcclxuICAgICAgICAgICAgfSkub25lKCdlcnJvcicsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2Vsb2FkZXJyb3InLCBbcHJldmlld0lkXSk7XHJcbiAgICAgICAgICAgIH0pLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuY29tcGxldGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkKHRoaXMpLnRyaWdnZXIoJ2xvYWQnKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuZXJyb3IpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS50cmlnZ2VyKCdlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfdmFsaWRhdGVBbGxJbWFnZXM6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpLCBjb3VudGVyID0ge3ZhbDogMH0sIG51bUltZ3MgPSBzZWxmLmxvYWRlZEltYWdlcy5sZW5ndGgsIGNvbmZpZyxcclxuICAgICAgICAgICAgICAgIGZzaXplLCBtaW5TaXplID0gc2VsZi5yZXNpemVJZlNpemVNb3JlVGhhbjtcclxuICAgICAgICAgICAgaWYgKG51bUltZ3MgIT09IHNlbGYudG90YWxJbWFnZXNDb3VudCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VzbG9hZGVkJyk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5yZXNpemVJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzZWxmLmxvYWRlZEltYWdlcy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gc2VsZi5sb2FkZWRJbWFnZXNbaV07XHJcbiAgICAgICAgICAgICAgICBpZiAoY29uZmlnLnZhbGlkYXRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgZnNpemUgPSBjb25maWcuc2l6O1xyXG4gICAgICAgICAgICAgICAgaWYgKGZzaXplICYmIGZzaXplID4gbWluU2l6ZSAqIDEwMDApIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9nZXRSZXNpemVkSW1hZ2UoY29uZmlnLCBjb3VudGVyLCBudW1JbWdzKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzW2ldLnZhbGlkYXRlZCA9IHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRSZXNpemVkSW1hZ2U6IGZ1bmN0aW9uIChjb25maWcsI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HJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpbmQpO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuZmlsZXN0YWNrW2luZF0gfHwgIWlzVmFsaWRJbWFnZSB8fCAod2lkdGggPD0gbWF4V2lkdGggJiYgaGVpZ2h0IDw9IG1heEhlaWdodCkpIHtcclxuICAgICAgICAgICAgICAgIGlmIChpc1ZhbGlkSW1hZ2UgJiYgc2VsZi5maWxlc3RhY2tbaW5kXSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VyZXNpemVkJywgW3BpZCwgaW5kXSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBjb3VudGVyLnZhbCsrO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvdW50ZXIudmFsID09PSBudW1JbWdzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVpbWFnZXNyZXNpemVkJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzVmFsaWRJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRocm93RXJyb3Ioc2VsZi5tc2dJbWFnZVJlc2l6ZUVycm9yLCB7aWQ6IHBpZCwgJ2luZGV4JzogaW5kfSwgJ2ZpbGVpbWFnZXJlc2l6ZWVycm9yJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHR5cGUgPSB0eXBlIHx8IHNlbGYucmVzaXplRGVmYXVsdEltYWdlVHlwZTtcclxuICAgICAgICAgICAgY2hrV2lkdGggPSB3aWR0aCA+IG1heFdpZHRoO1xyXG4gICAgICAgICAgICBjaGtIZWlnaHQgPSBoZWlnaHQgPiBtYXhIZWlnaHQ7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc2l6ZVByZWZlcmVuY2UgPT09ICd3aWR0aCcpIHtcclxuICAgICAgICAgICAgICAgIHJhdGlvID0gY2hrV2lkdGggPyBtYXhXaWR0aCAvIHdpZHRoIDogKGNoa0hlaWdodCA/IG1heEhlaWdodCAvIGhlaWdodCA6IDEpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgcmF0aW8gPSBjaGtIZWlnaHQgPyBtYXhIZWlnaHQgLyBoZWlnaHQgOiAoY2hrV2lkdGggPyBtYXhXaWR0aCAvIHdpZHRoIDogMSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRDYW52YXMoKTtcclxuICAgICAgICAgICAgd2lkdGggKj0gcmF0aW87XHJcbiAgICAgICAgICAgIGhlaWdodCAqPSByYXRpbztcclxuICAgICAgICAgICAgY2FudmFzLndpZHRoID0gd2lkdGg7XHJcbiAgICAgICAgICAgIGNhbnZhcy5oZWlnaHQgPSBoZWlnaHQ7XHJcbiAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICBjb250ZXh0LmRyYXdJbWFnZShpbWcsIDAsIDAsIHdpZHRoLCBoZWlnaHQpO1xyXG4gICAgICAgICAgICAgICAgZGF0YVVSSSA9IGNhbnZhcy50b0RhdGFVUkwodHlwZSwgc2VsZi5yZXNpemVRdWFsaXR5KTtcclxuICAgICAgICAgICAgICAgIGlmIChleGlmT2JqKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZXhpZlN0ciA9IHdpbmRvdy5waWV4aWYuZHVtcChleGlmT2JqKTtcclxuICAgICAgICAgICAgICAgICAgICBkYXRhVVJJID0gd2luZG93LnBpZXhpZi5pbnNlcnQoZXhpZlN0ciwgZGF0YVVSSSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBibG9iID0gJGguZGF0YVVSSTJCbG9iKGRhdGFVUkkpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5maWxlc3RhY2tbaW5kXSA9IGJsb2I7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWltYWdlcmVzaXplZCcsIFtwaWQsIGluZF0pO1xyXG4gICAgICAgICAgICAgICAgY291bnRlci52YWwrKztcclxuICAgICAgICAgICAgICAgIGlmIChjb3VudGVyLnZhbCA9PT0gbnVtSW1ncykge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VzcmVzaXplZCcsIFt1bmRlZmluZWQsIHVuZGVmaW5lZF0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCEoYmxvYiBpbnN0YW5jZW9mIEJsb2IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihzZWxmLm1zZ0ltYWdlUmVzaXplRXJyb3IsIHtpZDogcGlkLCAnaW5kZXgnOiBpbmR9LCAnZmlsZWltYWdlcmVzaXplZXJyb3InKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBjYXRjaCAoZXJyKSB7XHJcbiAgICAgICAgICAgICAgICBjb3VudGVyLnZhbCsrO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvdW50ZXIudmFsID09PSBudW1JbWdzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVpbWFnZXNyZXNpemVkJywgW3VuZGVmaW5lZCwgdW5kZWZpbmVkXSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ0ltYWdlUmVzaXplRXhjZXB0aW9uLnJlcGxhY2UoJ3tlcnJvcnN9JywgZXJyLm1lc3NhZ2UpO1xyXG4gICAgICAgICAgICAgICAgdGhyb3dFcnJvcihtc2csIHtpZDogcGlkLCAnaW5kZXgnOiBpbmR9LCAnZmlsZWltYWdlcmVzaXplZXhjZXB0aW9uJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9pbml0QnJvd3NlOiBmdW5jdGlvbiAoJGNvbnRhaW5lcikge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlbCA9IHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dCcm93c2UpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGJ0bkZpbGUgPSAkY29udGFpbmVyLmZpbmQoJy5idG4tZmlsZScpLmFwcGVuZCgkZWwpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJGVsLmFwcGVuZFRvKCRjb250YWluZXIpLmF0dHIoJ3RhYmluZGV4JywgLTEpO1xyXG4gICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRlbCwgJ2ZpbGUtbm8tYnJvd3NlJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9pbml0Q2xpY2thYmxlOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJHpvbmUsICR0bXBab25lO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNDbGlja2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkem9uZSA9IHNlbGYuJGRyb3Bab25lO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAkdG1wWm9uZSA9IHNlbGYuJHByZXZpZXcuZmluZCgnLmZpbGUtZGVmYXVsdC1wcmV2aWV3Jyk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJHRtcFpvbmUubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJHpvbmUgPSAkdG1wWm9uZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgJGguYWRkQ3NzKCR6b25lLCAnY2xpY2thYmxlJyk7XHJcbiAgICAgICAgICAgICR6b25lLmF0dHIoJ3RhYmluZGV4JywgLTEpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCR6b25lLCAnY2xpY2snLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0YXIgPSAkKGUudGFyZ2V0KTtcclxuICAgICAgICAgICAgICAgIGlmICghJChzZWxmLmVsRXJyb3JDb250YWluZXIgKyAnOnZpc2libGUnKS5sZW5ndGggJiZcclxuICAgICAgICAgICAgICAgICAgICAoISR0YXIucGFyZW50cygnLmZpbGUtcHJldmlldy10aHVtYm5haWxzJykubGVuZ3RoIHx8ICR0YXIucGFyZW50cyhcclxuICAgICAgICAgICAgICAgICAgICAgICAgJy5maWxlLWRlZmF1bHQtcHJldmlldycpLmxlbmd0aCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRlbGVtZW50LmRhdGEoJ3pvbmVDbGlja2VkJywgdHJ1ZSkudHJpZ2dlcignY2xpY2snKTtcclxuICAgICAgICAgICAgICAgICAgICAkem9uZS5ibHVyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRDYXB0aW9uOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY2FwID0gc2VsZi5pbml0aWFsQ2FwdGlvbiB8fCAnJztcclxuICAgICAgICAgICAgaWYgKHNlbGYub3ZlcndyaXRlSW5pdGlhbCB8fCAkaC5pc0VtcHR5KGNhcCkpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGNhcHRpb24udmFsKCcnKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGNhcCk7XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldENhcHRpb246IGZ1bmN0aW9uIChjb250ZW50LCBpc0Vycm9yKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdGl0bGUsIG91dCwgaWNvbiwgbiwgY2FwLCBzdGFjayA9IHNlbGYuZ2V0RmlsZVN0YWNrKCk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi4kY2FwdGlvbi5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgaWYgKGlzRXJyb3IpIHtcclxuICAgICAgICAgICAgICAgIHRpdGxlID0gJCgnPGRpdj4nICsgc2VsZi5tc2dWYWxpZGF0aW9uRXJyb3IgKyAnPC9kaXY+JykudGV4dCgpO1xyXG4gICAgICAgICAgICAgICAgbiA9IHN0YWNrLmxlbmd0aDtcclxuICAgICAgICAgICAgICAgIGlmIChuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY2FwID0gbiA9PT0gMSAmJiBzdGFja1swXSA/IHNlbGYuX2dldEZpbGVOYW1lcygpWzBdIDogc2VsZi5fZ2V0TXNnU2VsZWN0ZWQobik7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGNhcCA9IHNlbGYuX2dldE1zZ1NlbGVjdGVkKHNlbGYubXNnTm8pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgb3V0ID0gJGguaXNFbXB0eShjb250ZW50KSA/IGNhcCA6IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICBpY29uID0gJzxzcGFuIGNsYXNzPVwiJyArIHNlbGYubXNnVmFsaWRhdGlvbkVycm9yQ2xhc3MgKyAnXCI+JyArIHNlbGYubXNnVmFsaWRhdGlvbkVycm9ySWNvbiArICc8L3NwYW4+JztcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KGNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdGl0bGUgPSAkKCc8ZGl2PicgKyBjb250ZW50ICsgJzwvZGl2PicpLnRleHQoKTtcclxuICAgICAgICAgICAgICAgIG91dCA9IHRpdGxlO1xyXG4gICAgICAgICAgICAgICAgaWNvbiA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdmaWxlSWNvbicpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuJGNhcHRpb25Db250YWluZXIuYWRkQ2xhc3MoJ2ljb24tdmlzaWJsZScpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uLmF0dHIoJ3RpdGxlJywgdGl0bGUpLnZhbChvdXQpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uSWNvbi5odG1sKGljb24pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NyZWF0ZUNvbnRhaW5lcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGF0dHJpYnMgPSB7J2NsYXNzJzogJ2ZpbGUtaW5wdXQgZmlsZS1pbnB1dC1uZXcnICsgKHNlbGYucnRsID8gJyBrdi1ydGwnIDogJycpfSxcclxuICAgICAgICAgICAgICAgICRjb250YWluZXIgPSAkKGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpKS5hdHRyKGF0dHJpYnMpLmh0bWwoc2VsZi5fcmVuZGVyTWFpbigpKTtcclxuICAgICAgICAgICAgJGNvbnRhaW5lci5pbnNlcnRCZWZvcmUoc2VsZi4kZWxlbWVudCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRCcm93c2UoJGNvbnRhaW5lcik7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnRoZW1lKSB7XHJcbiAgICAgICAgICAgICAgICAkY29udGFpbmVyLmFkZENsYXNzKCd0aGVtZS0nICsgc2VsZi50aGVtZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICRjb250YWluZXI7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaENvbnRhaW5lcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRjb250YWluZXIgPSBzZWxmLiRjb250YWluZXIsICRlbCA9IHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgICAgICRlbC5pbnNlcnRBZnRlcigkY29udGFpbmVyKTtcclxuICAgICAgICAgICAgJGNvbnRhaW5lci5odG1sKHNlbGYuX3JlbmRlck1haW4oKSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRCcm93c2UoJGNvbnRhaW5lcik7XHJcbiAgICAgICAgICAgIHNlbGYuX3ZhbGlkYXRlRGlzYWJsZWQoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZURpc2FibGVkOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kY2FwdGlvbi5hdHRyKHtyZWFkb25seTogc2VsZi5pc0Rpc2FibGVkfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVuZGVyTWFpbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsXHJcbiAgICAgICAgICAgICAgICBkcm9wQ3NzID0gc2VsZi5kcm9wWm9uZUVuYWJsZWQgPyAnIGZpbGUtZHJvcC16b25lJyA6ICdmaWxlLWRyb3AtZGlzYWJsZWQnLFxyXG4gICAgICAgICAgICAgICAgY2xvc2UgPSAhc2VsZi5zaG93Q2xvc2UgPyAnJyA6IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdjbG9zZScpLFxyXG4gICAgICAgICAgICAgICAgcHJldmlldyA9ICFzZWxmLnNob3dQcmV2aWV3ID8gJycgOiBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgncHJldmlldycpXHJcbiAgICAgICAgICAgICAgICAgICAgLnNldFRva2Vucyh7J2NsYXNzJzogc2VsZi5wcmV2aWV3Q2xhc3MsICdkcm9wQ2xhc3MnOiBkcm9wQ3NzfSksXHJcbiAgICAgICAgICAgICAgICBjc3MgPSBzZWxmLmlzRGlzYWJsZWQgPyBzZWxmLmNhcHRpb25DbGFzcyArICcgZmlsZS1jYXB0aW9uLWRpc2FibGVkJyA6IHNlbGYuY2FwdGlvbkNsYXNzLFxyXG4gICAgICAgICAgICAgICAgY2FwdGlvbiA9IHNlbGYuY2FwdGlvblRlbXBsYXRlLnNldFRva2Vucyh7J2NsYXNzJzogY3NzICsgJyBrdi1maWxlaW5wdXQtY2FwdGlvbid9KTtcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYubWFpblRlbXBsYXRlLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAnY2xhc3MnOiBzZWxmLm1haW5DbGFzcyArICghc2VsZi5zaG93QnJvd3NlICYmIHNlbGYuc2hvd0NhcHRpb24gPyAnIG5vLWJyb3dzZScgOiAnJyksXHJcbiAgICAgICAgICAgICAgICAncHJldmlldyc6IHByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAnY2xvc2UnOiBjbG9zZSxcclxuICAgICAgICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICd1cGxvYWQnOiBzZWxmLl9yZW5kZXJCdXR0b24oJ3VwbG9hZCcpLFxyXG4gICAgICAgICAgICAgICAgJ3JlbW92ZSc6IHNlbGYuX3JlbmRlckJ1dHRvbigncmVtb3ZlJyksXHJcbiAgICAgICAgICAgICAgICAnY2FuY2VsJzogc2VsZi5fcmVuZGVyQnV0dG9uKCdjYW5jZWwnKSxcclxuICAgICAgICAgICAgICAgICdicm93c2UnOiBzZWxmLl9yZW5kZXJCdXR0b24oJ2Jyb3dzZScpXHJcbiAgICAgICAgICAgIH0pO1xyXG5cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZW5kZXJCdXR0b246IGZ1bmN0aW9uICh0eXBlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdG1wbHQgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYnRuRGVmYXVsdCcpLCBjc3MgPSBzZWxmW3R5cGUgKyAnQ2xhc3MnXSxcclxuICAgICAgICAgICAgICAgIHRpdGxlID0gc2VsZlt0eXBlICsgJ1RpdGxlJ10sIGljb24gPSBzZWxmW3R5cGUgKyAnSWNvbiddLCBsYWJlbCA9IHNlbGZbdHlwZSArICdMYWJlbCddLFxyXG4gICAgICAgICAgICAgICAgc3RhdHVzID0gc2VsZi5pc0Rpc2FibGVkID8gJyBkaXNhYmxlZCcgOiAnJywgYnRuVHlwZSA9ICdidXR0b24nO1xyXG4gICAgICAgICAgICBzd2l0Y2ggKHR5cGUpIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgJ3JlbW92ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dSZW1vdmUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2NhbmNlbCc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dDYW5jZWwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBjc3MgKz0gJyBrdi1oaWRkZW4nO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAndXBsb2FkJzpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuc2hvd1VwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCAmJiAhc2VsZi5pc0Rpc2FibGVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRtcGx0ID0gc2VsZi5fZ2V0TGF5b3V0VGVtcGxhdGUoJ2J0bkxpbmsnKS5yZXBsYWNlKCd7aHJlZn0nLCBzZWxmLnVwbG9hZFVybCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYnRuVHlwZSA9ICdzdWJtaXQnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2Jyb3dzZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dCcm93c2UpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB0bXBsdCA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdidG5Ccm93c2UnKTtcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAg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ICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3dpZHRoJzogd2lkdGgsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3Byb2dyZXNzJzogc2VsZi5fcmVuZGVyVGh1bWJQcm9ncmVzcygpLFxyXG4gICAgICAgICAgICAgICAgICAgICdpbmRpY2F0b3InOiBpbmRpY2F0b3JcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgb3V0ID0gdGVtcGxhdGUuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnYWN0aW9ucyc6IHNlbGYuX3JlbmRlckZpbGVBY3Rpb25zKGZhbHNlLCBmYWxzZSwgZmFsc2UsIHpvb20sIGRyZywgZmFsc2UsIGZhbHNlLCBmYWxzZSksXHJcbiAgICAgICAgICAgICAgICAgICAgJ2NhcHRpb24nOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICdzaXplJzogc2l6ZSxcclxuICAgICAgICAgICAgICAgICAgICAnd2lkdGgnOiB3aWR0aCxcclxuICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnOiAnJyxcclxuICAgICAgICAgICAgICAgICAgICAnaW5kaWNhdG9yJzogaW5kaWNhdG9yXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvdXQgPSAkaC5yZXBsYWNlVGFncyhvdXQsIHNlbGYucHJldmlld1RodW1iVGFncyk7XHJcbiAgICAgICAgICAgIHJldHVybiBvdXQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVuZGVyRmlsZUFjdGlvbnM6IGZ1bmN0aW9uIChcclxuICAgICAgICAgICAgc2hvd1VwbCxcclxuICAgICAgICAgICAgc2hvd0R3bixcclxuICAgICAgICAgICAgc2hvd0RlbCxcclxuICAgICAgICAgICAgc2hvd1pvb20sXHJcbiAgICAgICAgICAgIHNob3dEcmFnLFxyXG4gICAgICAgICAgICBkaXNhYmxlZCxcclxuICAgICAgICAgICAgdXJsLFxyXG4gICAgICAgICAgICBrZXksXHJcbiAgICAgICAgICAgIGlzSW5pdCxcclxuICAgICAgICAgICAgZFVybCxcclxuICAgICAgICAgICAgZEZpbGVcclxuICAgICAgICApIHtcclxuICAgICAgICAgICAgaWYgKCFzaG93VXBsICYmICFzaG93RHduICYmICFzaG93RGVsICYmICFzaG93Wm9vbSAmJiAhc2hvd0RyYWcpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHZVcmwgPSB1cmwgPT09IGZhbHNlID8gJycgOiAnIGRhdGEtdXJsPVwiJyArIHVybCArICdcIicsXHJcbiAgICAgICAgICAgICAgICB2S2V5ID0ga2V5ID09PSBmYWxzZSA/ICcnIDogJyBkYXRhLWtleT1cIicgKyBrZXkgKyAnXCInLCBidG5EZWxldGUgPSAnJywgYnRuVXBsb2FkID0gJycsIGJ0bkRvd25sb2FkID0gJycsXHJcbiAgICAgICAgICAgICAgICBidG5ab29tID0gJycsIGJ0bkRyYWcgPSAnJywgY3NzLCB0ZW1wbGF0ZSA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25zJyksXHJcbiAgICAgICAgICAgICAgICBjb25maWcgPSBzZWxmLmZpbGVBY3Rpb25TZXR0aW5ncyxcclxuICAgICAgICAgICAgICAgIG90aGVyQnV0dG9ucyA9IHNlbGYub3RoZXJBY3Rpb25CdXR0b25zLnNldFRva2Vucyh7J2RhdGFLZXknOiB2S2V5LCAna2V5Jzoga2V5fSksXHJcbiAgICAgICAgICAgICAgICByZW1vdmVDbGFzcyA9IGRpc2FibGVkID8gY29uZmlnLnJlbW92ZUNsYXNzICsgJyBkaXNhYmxlZCcgOiBjb25maWcucmVtb3ZlQ2xhc3M7XHJcbiAgICAgICAgICAgIGlmIChzaG93RGVsKSB7XHJcbiAgICAgICAgICAgICAgICBidG5EZWxldGUgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYWN0aW9uRGVsZXRlJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAncmVtb3ZlQ2xhc3MnOiByZW1vdmVDbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAncmVtb3ZlSWNvbic6IGNvbmZpZy5yZW1vdmVJY29uLFxyXG4gICAgICAgICAgICAgICAgICAgICdyZW1vdmVUaXRsZSc6IGNvbmZpZy5yZW1vdmVUaXRsZSxcclxuICAgICAgICAgICAgICAgICAgICAnZGF0YVVybCc6IHZVcmwsXHJcbiAgICAgICAgICAgICAgICAgICAgJ2RhdGFLZXknOiB2S2V5LFxyXG4gICAgICAgICAgICAgICAgICAgICdrZXknOiBrZXlcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93VXBsKSB7XHJcbiAgICAgICAgICAgICAgICBidG5VcGxvYWQgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYWN0aW9uVXBsb2FkJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAndXBsb2FkQ2xhc3MnOiBjb25maWcudXBsb2FkQ2xhc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3VwbG9hZEljb24nOiBjb25maWcudXBsb2FkSWNvbixcclxuICAgICAgICAgICAgICAgICAgICAndXBsb2FkVGl0bGUnOiBjb25maWcudXBsb2FkVGl0bGVcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93RHduKSB7XHJcbiAgICAgICAgICAgICAgICBidG5Eb3dubG9hZCA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25Eb3dubG9hZCcpLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAgICAgJ2Rvd25sb2FkQ2xhc3MnOiBjb25maWcuZG93bmxvYWRDbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAnZG93bmxvYWRJY29uJzogY29uZmlnLmRvd25sb2FkSWNvbixcclxuICAgICAgICAgICAgICAgICAgICAnZG93bmxvYWRUaXRsZSc6IGNvbmZpZy5kb3dubG9hZFRpdGxlLFxyXG4gICAgICAgICAgICAgICAgICAgICdkb3dubG9hZFVybCc6IGRVcmwgfHwgc2VsZi5pbml0aWFsUHJldmlld0Rvd25sb2FkVXJsXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIGJ0bkRvd25sb2FkID0gYnRuRG93bmxvYWQuc2V0VG9rZW5zKHsnZmlsZW5hbWUnOiBkRmlsZSwgJ2tleSc6IGtleX0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93Wm9vbSkge1xyXG4gICAgICAgICAgICAgICAgYnRuWm9vbSA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25ab29tJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnem9vbUNsYXNzJzogY29uZmlnLnpvb21DbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAnem9vbUljb24nOiBjb25maWcuem9vbUljb24sXHJcbiAgICAgICAgICAgICAgICAgICAgJ3pvb21UaXRsZSc6IGNvbmZpZy56b29tVGl0bGVcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93RHJhZyAmJiBpc0luaXQpIHtcclxuICAgICAgICAgICAgICAgIGNzcyA9ICdkcmFnLWhhbmRsZS1pbml0ICcgKyBjb25maWcuZHJhZ0NsYXNzO1xyXG4gICAgICAgICAgICAgICAgYnRuRHJhZyA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25EcmFnJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnZHJhZ0NsYXNzJzogY3NzLFxyXG4gICAgICAgICAgICAgICAgICAgICdkcmFnVGl0bGUnOiBjb25maWcuZHJhZ1RpdGxlLFxyXG4gICAgICAgICAgICAgICAgICAgICdkcmFnSWNvbic6IGNvbmZpZy5kcmFnSWNvblxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHRlbXBsYXRlLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAnZGVsZXRlJzogYnRuRGVsZXRlLFxyXG4gICAgICAgICAgICAgICAgJ3VwbG9hZCc6IGJ0blVwbG9hZCxcclxuICAgICAgICAgICAgICAgICdkb3dubG9hZCc6IGJ0bkRvd25sb2FkLFxyXG4gICAgICAgICAgICAgICAgJ3pvb20nOiBidG5ab29tLFxyXG4gICAgICAgICAgICAgICAgJ2RyYWcnOiBidG5EcmFnLFxyXG4gICAgICAgICAgICAgICAgJ290aGVyJzogb3RoZXJCdXR0b25zXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2Jyb3dzZTogZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoZSAmJiBlLmlzRGVmYXVsdFByZXZlbnRlZCgpIHx8ICFzZWxmLl9yYWlzZSgnZmlsZWJyb3dzZScpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNFcnJvciAmJiAhc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuY2xlYXIoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLmZvY3Vz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LCBudWxsLCBudWxsLCBudWxsKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKCcnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtaW5wdXQtbmV3IGZpbGUtaW5wdXQtYWpheC1uZXcnKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNlbGYucmVhZGVyID0gbnVsbDtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRVcGxvYWQoKTtcclxuICAgICAgICAgICAgc2VsZi5faGlkZUZpbGVJY29uKCk7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLmRyb3Bab25lRW5hYmxlZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlLWRyb3Atem9uZSAuJyArIHNlbGYuZHJvcFpvbmVUaXRsZUNsYXNzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uICh2S2V5LCB2RmlsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2ZpbHRlckR1cGxpY2F0ZSh2RmlsZSwgdGZpbGVzLCBmaWxlSWRzKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKGUudGFyZ2V0ICYmIGUudGFyZ2V0LmZpbGVzID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlcyA9IGUudGFyZ2V0LnZhbHVlID8gW3tuYW1lOiBlLnRhcmdldC52YWx1ZS5yZXBsYWNlKC9eLitcXFxcLywgJycpfV0gOiBbXTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZXMgPSBlLnRhcmdldC5maWxlcyB8fCB7fTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHRmaWxlcyA9IGZpbGVzO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KHRmaWxlcykgfHwgdGZpbGVzLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFpc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNsZWFyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXNlbGVjdG5vbmUnKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9yZXNldEVycm9ycygpO1xyXG4gICAgICAgICAgICBsZW4gPSB0ZmlsZXMubGVuZ3RoO1xyXG4gICAgICAgICAgICB0b3RhbCA9IHNlbGYuX2dldEZpbGVDb3VudChpc0FqYXhVcGxvYWQgPyAoc2VsZi5nZXRGaWxlU3RhY2soKS5sZW5ndGggKyBsZW4pIDogbGVuKTtcclxuICAgICAgICAgICAgaWYgKG1heENvdW50ID4gMCAmJiB0b3RhbCA+IG1heENvdW50KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuYXV0b1JlcGxhY2UgfHwgbGVuID4gbWF4Q291bnQpIHtcclxuICAgICAgICAgICAgICAgICAgICBtYXhDb3VudENoZWNrKChzZWxmLmF1dG9SZXBsYWNlICYmIGxlbiA+IG1heENvdW50ID8gbGVuIDogdG90YWwpLCBtYXhDb3VudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHRvdGFsID4gbWF4Q291bnQpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yZXNldFByZXZpZXdUaHVtYnMoaXNBamF4VXBsb2FkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmICghaXNBamF4VXBsb2FkIHx8IGZsYWdTaW5nbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yZXNldFByZXZpZXdUaHVtYnMoZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChmbGFnU2luZ2xlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQWpheFVwbG9hZCAmJiBjdHIgPT09IDAgJiYgKCFzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpIHx8IHNlbGYub3ZlcndyaXRlSW5pdGlhbCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzZXRQcmV2aWV3VGh1bWJzKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc1ByZXZpZXdhYmxlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnJlYWRGaWxlcyh0ZmlsZXMpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMoMSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9hYm9ydDogZnVuY3Rpb24gKHBhcm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VhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGluZCA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpLCBmaWxlID0gc2VsZi5maWxlc3RhY2tbaW5kXSxcclxuICAgICAgICAgICAgICAgICAgICBwaWQgPSAkdGh1bWIuYXR0cignaWQnKTtcclxuICAgICAgICAgICAgICAgIGlmIChpbmQgPT09ICctMScgfHwgaW5kID09PSAtMSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChmaWxlICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBuZXdzdGFja1tpXSA9IGZpbGU7XHJcbiAgICAgICAgICAgICAgICAgICAgbmV3bmFtZXNbaV0gPSBzZWxmLl9nZXRGaWxlTmFtZShmaWxlKTtcclxuICAgICAgICAgICAgICAgICAgICBuZXdpZHNbaV0gPSBzZWxmLl9nZXRGaWxlSWQoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1iLmF0dHIoeydpZCc6IHNlbGYucHJldmlld0luaXRJZCArICctJyArIGksICdkYXRhLWZpbGVpbmRleCc6IGl9KTtcclxuICAgICAgICAgICAgICAgICAgICBpKys7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5hdHRyKHsnaWQnOiAndXBsb2FkZWQtJyArICRoLnVuaXFJZCgpLCAnZGF0YS1maWxlaW5kZXgnOiAnLTEnfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRwcmV2aWV3LmZpbmQoJyN6b29tLScgKyBwaWQpLmF0dHIoe1xyXG4gICAgICAgICAgICAgICAgICAgICdpZCc6ICd6b29tLScgKyAkdGh1bWIuYXR0cignaWQnKSxcclxuICAgICAgICAgICAgICAgICAgICAnZGF0YS1maWxlaW5kZXgnOiAkdGh1bWIuYXR0cignZGF0YS1maWxlaW5kZXgnKVxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVzdGFjayA9IG5ld3N0YWNrO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVuYW1lcyA9IG5ld25hbWVzO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVpZHMgPSBuZXdpZHM7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaXNGaWxlU2VsZWN0aW9uVmFsaWQ6IGZ1bmN0aW9uIChjbnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBjbnQgPSBjbnQgfHwgMDtcclxuICAgICAgICAgICAgaWYgKHNlbGYucmVxdWlyZWQgJiYgIXNlbGYuZ2V0RmlsZXNDb3VudCgpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5odG1sKCcnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihzZWxmLm1zZ0ZpbGVSZXF1aXJlZCk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYubWluRmlsZUNvdW50ID4gMCAmJiBzZWxmLl9nZXRGaWxlQ291bnQoY250KSA8IHNlbGYubWluRmlsZUNvdW50KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9ub0ZpbGVzRXJyb3Ioe30pO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYXJTdGFjazogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2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ChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2sodW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpbmRleCArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG51bUZpbGVzID0gMDtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdEZpbGVBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1iID0gJCgnIycgKyBwcmV2aWV3SWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlbGYucmVtb3ZlRnJvbVByZXZpZXdPbkVycm9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pc0Vycm9yID0gc2VsZi5pc0FqYXhVcGxvYWQgPyBzZWxmLl9zaG93VXBsb2FkRXJyb3IobXNnLCBwMSkgOiBzZWxmLl9zaG93RXJyb3IobXNnLCBwMik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudG90YWxJbWFnZXNDb3VudCA9IDA7XHJcblxyXG4gICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uIChrZXksIGZpbGUpIHtcclxuICAgICAgICAgICAgICAgIHZhciBmdW5jID0gc2VsZi5maWxlVHlwZVNldHRpbmdzLmltYWdlO1xyXG4gICAgICAgICAgICAgICAgaWYgKGZ1bmMgJiYgZnVuYyhmaWxlLnR5cGUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi50b3RhbEltYWdlc0NvdW50Kys7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICByZWFkRmlsZSA9IGZ1bmN0aW9uIChpKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eSgkZWwuYXR0cignbXVsdGlwbGUnKSkpIHtcclxuICAgICAgICAgICAgICAgICAgICBudW1GaWxlcyA9IDE7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoaSA+PSBudW1GaWxlcykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCAmJiBzZWxmLmZpbGVzdGFjay5sZW5ndGggPiAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlYmF0Y2hzZWxlY3RlZCcsIFtzZWxmLmdldEZpbGVTdGFjaygpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHNlbGVjdGVkJywgW2ZpbGVzXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdmFyIG5vZGUgPSBjdHIgKyBpLCBwcmV2aWV3SWQgPSBwcmV2aWV3SW5pdElkICsgJy0nICsgbm9kZSwgZmlsZSA9IGZpbGVzW2ldLCBmU2l6ZUtCLCBqLCBtc2csXHJcbiAgICAgICAgICAgICAgICAgICAgZm5UZXh0ID0gc2V0dGluZ3MudGV4dCwgZm5JbWFnZSA9IHNldHRpbmdzLmltYWdlLCBmbkh0bWwgPSBzZXR0aW5ncy5odG1sLCB0eXAsIGNoaywgdHlwMSwgdHlwMixcclxuICAgICAgICAgICAgICAgICAgICBjYXB0aW9uID0gc2VsZi5fZ2V0RmlsZU5hbWUoZmlsZSwgJycpLCBmaWxlU2l6ZSA9IChmaWxlICYmIGZpbGUuc2l6ZSB8fCAwKSAvIDEwMDAsXHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZUV4dEV4cHIgPSAnJywgcHJldmlld0RhdGEgPSAkaC5jcmVhdGVPYmplY3RVUkwoZmlsZSksIGZpbGVDb3VudCA9IDAsXHJcbiAgICAgICAgICAgICAgICAgICAgc3RyVHlwZXMgPSAnJyxcclxuICAgICAgICAgICAgICAgICAgICBmdW5jLCBrbm93blR5cGVzID0gMCwgaXNUZXh0LCBpc0h0bWwsIGlzSW1hZ2UsIHR4dEZsYWcsIHByb2Nlc3NGaWxlTG9hZGVkID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgbXNnID0gbXNnUHJvZ3Jlc3Muc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbmRleCc6IGkgKyAxLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ZpbGVzJzogbnVtRmlsZXMsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGVyY2VudCc6IDUwLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbChtc2cpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZEZpbGUoaSArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWxvYWRlZCcsIFtmaWxlLCBwcmV2aWV3SWQsIGksIHJlYWRlcl0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBpZiAoIWZpbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAodHlwTGVuID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCB0eXBMZW47IGorKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXAxID0gZmlsZVR5cGVzW2pdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXAyID0gc2VsZi5tc2dGaWxlVHlwZXNbdHlwMV0gfHwgdHlwMTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyVHlwZXMgKz0gaiA9PT0gMCA/IHR5cDIgOiAnLCAnICsgdHlwMjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoY2FwdGlvbiA9PT0gZmFsc2UpIHtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpICsgMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKGNhcHRpb24ubGVuZ3RoID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbXNnID0gc2VsZi5tc2dJbnZhbGlkRmlsZU5hbWUucmVwbGFjZSgne25hbWV9JywgJGguaHRtbEVuY29kZSgkaC5nZXRGaWxlTmFtZShmaWxlKSwgJ1t1bmtub3duXScpKTtcclxuICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoZmlsZUV4dCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlRXh0RXhwciA9IG5ldyBSZWdFeHAoJ1xcXFwuKCcgKyBmaWxlRXh0LmpvaW4oJ3wnKSArICcpJCcsICdpJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBmU2l6ZUtCID0gZmlsZVNpemUudG9GaXhlZCgyKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLm1heEZpbGVTaXplID4gMCAmJiBmaWxlU2l6ZSA+IHNlbGYubWF4RmlsZVNpemUpIHtcclxuICAgICAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ1NpemVUb29MYXJnZS5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAnbmFtZSc6IGNhcHRpb24sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdzaXplJzogZlNpemVLQixcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ21heFNpemUnOiBzZWxmLm1heEZpbGVTaXplXHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihtc2csIGZpbGUsIHByZXZpZXdJZCwgaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYubWluRmlsZVNpemUgIT09IG51bGwgJiYgZmlsZVNpemUgPD0gJGguZ2V0TnVtKHNlbGYubWluRmlsZVNpemUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbXNnID0gc2VsZi5tc2dTaXplVG9vU21hbGwuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IGZTaXplS0IsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdtaW5TaXplJzogc2VsZi5taW5GaWxlU2l6ZVxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHRocm93RXJyb3IobXNnLCBmaWxlLCBwcmV2aWV3SWQsIGkpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShmaWxlVHlwZXMpICYmICRoLmlzQXJyYXkoZmlsZVR5cGVzKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCBmaWxlVHlwZXMubGVuZ3RoOyBqICs9IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdHlwID0gZmlsZVR5cGVzW2pdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmdW5jID0gc2V0dGluZ3NbdHlwXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZmlsZUNvdW50ICs9ICFmdW5jIHx8ICh0eXBlb2YgZnVuYyAhPT0gJ2Z1bmN0aW9uJykgPyAwIDogKGZ1bmMoZmlsZS50eXBlLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGguZ2V0RmlsZU5hbWUoZmlsZSkpID8gMSA6IDApO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAoZmlsZUNvdW50ID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG1zZyA9IHNlbGYubXNnSW52YWxpZEZpbGVUeXBlLnNldFRva2Vucyh7J25hbWUnOiBjYXB0aW9uLCAndHlwZXMnOiBzdHJUeXBlc30pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChmaWxlQ291bnQgPT09IDAgJiYgISRoLmlzRW1wdHkoZmlsZUV4dCkgJiYgJGguaXNBcnJheShmaWxlRXh0KSAmJiAhJGguaXNFbXB0eShmaWxlRXh0RXhwcikpIHtcclxuICAgICAgICAgICAgICAgICAgICBjaGsgPSAkaC5jb21wYXJlKGNhcHRpb24sIGZpbGVFeHRFeHByKTtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlQ291bnQgKz0gJGguaXNFbXB0eShjaGspID8gMCA6IGNoay5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGVDb3VudCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ0ludmFsaWRGaWxlRXh0ZW5zaW9uLnNldFRva2Vucyh7J25hbWUnOiBjYXB0aW9uLCAnZXh0ZW5zaW9ucyc6IHN0ckV4dH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICghc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2soZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpICsgMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3VwZGF0ZUZpbGVEZXRhaWxzKG51bUZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlbG9hZGVkJywgW2ZpbGUsIHByZXZpZXdJZCwgaSwgcmVhZGVyXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCFjYW5QcmV2aWV3ICYmIGZpbGVTaXplID4gbWF4UHJldmlld1NpemUpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2soZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGNvbnRhaW5lci5hZGRDbGFzcygnZmlsZS10aHVtYi1sb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcHJldmlld0RlZmF1bHQoZmlsZSwgcHJldmlld0lkKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0RmlsZUFjdGlvbnMoKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl91cGRhdGVGaWxlRGV0YWlscyhudW1GaWxlcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmVhZEZpbGUoaSArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICgkcHJldmlldy5sZW5ndGggJiYgRmlsZVJlYWRlciAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNUZXh0ID0gZm5UZXh0KGZpbGUudHlwZSwgY2FwdGlvbik7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNIdG1sID0gZm5IdG1sKGZpbGUudHlwZSwgY2FwdGlvbik7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNJbWFnZSA9IGZuSW1hZ2UoZmlsZS50eXBlLCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICAkc3RhdHVzLmh0bWwobXNnTG9hZGluZy5yZXBsYWNlKCd7aW5kZXh9JywgaSArIDEpLnJlcGxhY2UoJ3tmaWxlc30nLCBudW1GaWxlcykpO1xyXG4gICAgICAgICAgICAgICAgICAgICRjb250YWluZXIuYWRkQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbmVycm9yID0gZnVuY3Rpb24gKGV2dCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9lcnJvckhhbmRsZXIoZXZ0LCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbmxvYWQgPSBmdW5jdGlvbiAodGhlRmlsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgaGV4LCBmaWxlSW5mbywgdWludCwgYnl0ZSwgYnl0ZXMgPSBbXSwgY29udGVudHMsIG1pbWUsIHJlYWRUZXh0SW1hZ2UgPSBmdW5jdGlvbiAodGV4dEZsYWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuZXdSZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3UmVhZGVyLm9uZXJyb3IgPSBmdW5jdGlvbiAodGhlRmlsZU5ldykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2Vycm9ySGFuZGxlcih0aGVGaWxlTmV3LCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdSZWFkZXIub25sb2FkID0gZnVuY3Rpb24gKHRoZUZpbGVOZXcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9wcmV2aWV3RmlsZShpLCBmaWxlLCB0aGVGaWxlTmV3LCBwcmV2aWV3SWQsIHByZXZpZXdEYXRhLCBmaWxlSW5mbyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdEZpbGVBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0ZpbGVMb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGV4dEZsYWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdSZWFkZXIucmVhZEFzVGV4dChmaWxlLCBzZWxmLnRleHRFbmNvZGluZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld1JlYWRlci5yZWFkQXNEYXRhVVJMKGZpbGUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlSW5mbyA9IHsnbmFtZSc6IGNhcHRpb24sICd0eXBlJzogZmlsZS50eXBlfTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJC5lYWNoKHNldHRpbmdzLCBmdW5jdGlvbiAoaywgZikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGsgIT09ICdvYmplY3QnICYmIGsgIT09ICdvdGhlcicgJiYgdHlwZW9mIGYgPT09ICdmdW5jdGlvbicgJiYgZihmaWxlLnR5cGUsIGNhcHRpb24pKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga25vd25UeXBlcysrO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGtub3duVHlwZXMgPT09IDApIHsvLyBhdXRvIGRldGVjdCBtaW1lIHR5cGVzIGZyb20gY29udGVudCBpZiBubyBrbm93biBmaWxlIHR5cGVzIGRldGVjdGVkXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50ID0gbmV3IFVpbnQ4QXJyYXkodGhlRmlsZS50YXJnZXQucmVzdWx0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCB1aW50Lmxlbmd0aDsgaisrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZSA9IHVpbnRbal0udG9TdHJpbmcoMTYpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVzLnB1c2goYnl0ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBieXRlcy5qb2luKCcnKS50b0xvd2VyQ2FzZSgpLnN1YnN0cmluZygwLCA4KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbWUgPSAkaC5nZXRNaW1lVHlwZShoZXgsICcnLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShtaW1lKSkgeyAvLyBsb29rIGZvciBhc2NpaSB0ZXh0IGNvbnRlbnRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50cyA9ICRoLmFycmF5QnVmZmVyMlN0cmluZyhyZWFkZXIucmVzdWx0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW1lID0gJGguaXNTdmcoY29udGVudHMpID8gJ2ltYWdlL3N2Zyt4bWwnIDogJGguZ2V0TWltZVR5cGUoaGV4LCBjb250ZW50cywgZmlsZS50eXBlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVJbmZvID0geyduYW1lJzogY2FwdGlvbiwgJ3R5cGUnOiBtaW1lfTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzVGV4dCA9IGZuVGV4dChtaW1lLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0h0bWwgPSBmbkh0bWwobWltZSwgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNJbWFnZSA9IGZuSW1hZ2UobWltZSwgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHh0RmxhZyA9IGlzVGV4dCB8fCBpc0h0bWw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHh0RmxhZyB8fCBpc0ltYWdlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZFRleHRJbWFnZSh0eHRGbGFnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcHJldmlld0ZpbGUoaSwgZmlsZSwgdGhlRmlsZSwgcHJldmlld0lkLCBwcmV2aWV3RGF0YSwgZmlsZUluZm8pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0RmlsZUFjdGlvbnMoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0ZpbGVMb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbnByb2dyZXNzID0gZnVuY3Rpb24gKGRhdGEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEubGVuZ3RoQ29tcHV0YWJsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGZhY3QgPSAoZGF0YS5sb2FkZWQgLyBkYXRhLnRvdGFsKSAqIDEwMCwgcHJvZ3Jlc3MgPSBNYXRoLmNlaWwoZmFjdCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2cgPSBtc2dQcm9ncmVzcy5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbmRleCc6IGkgKyAxLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmaWxlcyc6IG51bUZpbGVzLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwZXJjZW50JzogcHJvZ3Jlc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbChtc2cpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChpc1RleHQgfHwgaXNIdG1sKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRlci5yZWFkQXNUZXh0KGZpbGUsIHNlbGYudGV4dEVuY29kaW5nKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnJlYWRBc0RhdGFVUkwoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkZXIucmVhZEFzQXJyYXlCdWZmZXIoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3ByZXZpZXdEZWZhdWx0KGZpbGUsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRGaWxlKGkgKyAxKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVsb2FkZWQnLCBbZmlsZSwgcHJldmlld0lkLCBpLCByZWFkZXJdKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuYWRkVG9TdGFjayhmaWxlKTtcclxuICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHJlYWRGaWxlKDApO1xyXG4gICAgICAgICAgICBzZWxmLl91cGRhdGVGaWxlRGV0YWlscyhudW1GaWxlcywgZmFsc2UpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgbG9jazogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYuX3Jlc2V0RXJyb3JzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuZGlzYWJsZSgpO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93UmVtb3ZlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC1yZW1vdmUnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0NhbmNlbCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJykuc2hvdygpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlbG9jaycsIFtzZWxmLmZpbGVzdGFjaywgc2VsZi5fZ2V0RXh0cmFEYXRhKCldKTtcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICB1bmxvY2s6IGZ1bmN0aW9uIChyZXNldCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGlmIChyZXNldCA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICByZXNldCA9IHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5lbmFibGUoKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0NhbmNlbCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJykuaGlkZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dSZW1vdmUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5maW5kKCcuZmlsZWlucHV0LXJlbW92ZScpLnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAocmVzZXQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0RmlsZVN0YWNrKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGV1bmxvY2snLCBbc2VsZi5maWxlc3RhY2ssIHNlbGYuX2dldEV4dHJhRGF0YSgpXSk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgeGhyID0gc2VsZi5hamF4UmVxdWVzdHMsIGxlbiA9IHhoci5sZW5ndGgsIGk7XHJcbiAgICAgICAgICAgIGlmIChsZW4gPiAwKSB7XHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpICs9IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNhbmNlbGxpbmcgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgIHhocltpXS5hYm9ydCgpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGluZCA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuZmlsZXN0YWNrW2luZF0gIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5yZW1vdmVDbGFzcygnZGlzYWJsZWQnKS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKS5yZW1vdmVDbGFzcygnZGlzYWJsZWQnKS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi51bmxvY2soKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYXI6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBjYXA7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVjbGVhcicpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi4kYnRuVXBsb2FkLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmZpbmQoJ3ZpZGVvLGF1ZGlvLGltZycpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgJGguY2xlYW5NZW1vcnkoJCh0aGlzKSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICBzZWxmLl9yZXNldFVwbG9hZCgpO1xyXG4gICAgICAgICAgICBzZWxmLmNsZWFyU3RhY2soKTtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnModHJ1ZSk7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLl9oYXNJbml0aWFsUHJldmlldygpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93RmlsZUljb24oKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtaW5wdXQtbmV3Jyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9nZXRUaHVtYnMoKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9jbGVhck9iamVjdHMoJCh0aGlzKSk7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSB7fTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgICAgICBjYXAgPSAoIXNlbGYub3ZlcndyaXRlSW5pdGlhbCAmJiBzZWxmLmluaXRpYWxDYXB0aW9uLmxlbmd0aCA+IDApID8gc2VsZi5pbml0aWFsQ2FwdGlvbiA6ICcnO1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbi5hdHRyKCd0aXRsZScsICcnKS52YWwoY2FwKTtcclxuICAgICAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjb250YWluZXIsICdmaWxlLWlucHV0LW5ldycpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEZWZhdWx0UHJldmlldygpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLiRjb250YWluZXIuZmluZCgkaC5GUkFNRVMpLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLl9pbml0Q2FwdGlvbigpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbkNvbnRhaW5lci5yZW1vdmVDbGFzcygnaWNvbi12aXNpYmxlJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5faGlkZUZpbGVJY29uKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlY2xlYXJlZCcpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLmZvY3VzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldEZpbGVEcm9wWm9uZVRpdGxlKCk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgcmVzZXQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuX3JhaXNlKCdmaWxlcmVzZXQnKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3Jlc2V0UHJldmlldygpO1xyXG4gICAgICAgICAgICBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC1maWxlbmFtZScpLnRleHQoJycpO1xyXG4gICAgICAgICAgICAkaC5hZ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ubGVuZ3RoLCBpLCBvdXREYXRhLCBsZW4sXHJcbiAgICAgICAgICAgICAgICBoYXNFeHRyYURhdGEgPSAhJC5pc0VtcHR5T2JqZWN0KHNlbGYuX2dldEV4dHJhRGF0YSgpKTtcclxuICAgICAgICAgICAgaWYgKCFzZWxmLmlzQWpheFVwbG9hZCB8fCBzZWxmLmlzRGlzYWJsZWQgfHwgIXNlbGYuX2lzRmlsZVNlbGVjdGlvblZhbGlkKHRvdExlbikpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9yZXNldFVwbG9hZCgpO1xyXG4gICAgICAgICAgICBpZiAodG90TGVuID09PSAwICYmICFoYXNFeHRyYURhdGEpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihzZWxmLm1zZ1VwbG9hZEVtcHR5KTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRwcm9ncmVzcy5zaG93KCk7XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZFN0YXR1cyA9IHt9O1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMik7XHJcbiAgICAgICAgICAgIGlmICh0b3RMZW4gPT09IDAgJiYgaGFzRXh0cmFEYXRhKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl91cGxvYWRFeHRyYU9ubHkoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBsZW4gPSBzZWxmLmZpbGVzdGFjay5sZW5ndGg7XHJcbiAgICAgICAgICAgIHNlbGYuaGFzSW5pdERhdGEgPSBmYWxzZTtcclxuICAgICAgICAgICAgaWYgKHNlbGYudXBsb2FkQXN5bmMpIHtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNocHJldXBsb2FkJywgW291dERhdGFdKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZENhY2hlID0ge2NvbnRlbnQ6IFtdLCBjb25maWc6IFtdLCB0YWdzOiBbXSwgYXBwZW5kOiB0cnVlfTtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQXN5bmNDb3VudCA9IHNlbGYuZ2V0RmlsZVN0YWNrKCkubGVuZ3RoO1xyXG4gICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbjsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb250ZW50W2ldID0gbnVsbDtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZENhY2hlLmNvbmZpZ1tpXSA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS50YWdzW2ldID0gbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuZmluZCgnLmZpbGUtcHJldmlldy1pbml0aWFsJykucmVtb3ZlQ2xhc3MoJGguU09SVF9DU1MpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmNhY2hlSW5pdGlhbFByZXZpZXcgPSBzZWxmLmdldFByZXZpZXcoKTtcclxuXHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5maWxlc3RhY2tbaV0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBsb2FkU2luZ2xlKGksIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl91cGxvYWRCYXRjaCgpO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGRlc3Ryb3k6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZm9ybSA9IHNlbGYuJGZvcm0sICRjb250ID0gc2VsZi4kY29udGFpbmVyLCAkZWwgPSBzZWxmLiRlbGVtZW50LCBucyA9IHNlbGYubmFtZXNwYWNlO1xyXG4gICAgICAgICAgICAkKGRvY3VtZW50KS5vZmYobnMpO1xyXG4gICAgICAgICAgICAkKHdpbmRvdykub2ZmKG5zKTtcclxuICAgICAgICAgICAgaWYgKCRmb3JtICYmICRmb3JtLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgJGZvcm0ub2ZmKG5zKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fY2xlYW51cCgpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0UHJldmlld0NhY2hlKCk7XHJcbiAgICAgICAgICAgICRlbC5pbnNlcnRCZWZvcmUoJGNvbnQpLm9mZihucykucmVtb3ZlRGF0YSgpO1xyXG4gICAgICAgICAgICAkY29udC5vZmYoKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgcmV0dXJuICRlbDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHJlZnJlc2g6IGZ1bmN0aW9uIChvcHRpb25zKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVsID0gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBvcHRpb25zICE9PSAnb2JqZWN0JyB8fCAkaC5pc0VtcHR5KG9wdGlvbnMpKSB7XHJcbiAgICAgICAgICAgICAgICBvcHRpb25zID0gc2VsZi5vcHRpb25zO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgb3B0aW9ucyA9ICQuZXh0ZW5kKHRydWUsIHt9LCBzZWxmLm9wdGlvbnMsIG9wdGlvbnMpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXQob3B0aW9ucywgdHJ1ZSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2xpc3RlbigpO1xyXG4gICAgICAgICAgICByZXR1cm4gJGVsO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgem9vbTogZnVuY3Rpb24gKGZyYW1lSWQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUgPSBzZWxmLl9nZXRGcmFtZShmcmFtZUlkKSwgJG1vZGFsID0gc2VsZi4kbW9kYWw7XHJcbiAgICAgICAgICAgIGlmICghJGZyYW1lKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGguaW5pdE1vZGFsKCRtb2RhbCk7XHJcbiAgICAgICAgICAgICRtb2RhbC5odG1sKHNlbGYuX2dldE1vZGFsQ29udGVudCgpKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0Wm9vbUNvbnRlbnQoJGZyYW1lKTtcclxuICAgICAgICAgICAgJG1vZGFsLm1vZGFsKCdzaG93Jyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9ucygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0RXhpZjogZnVuY3Rpb24gKGZyYW1lSWQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUgPSBzZWxmLl9nZXRGcmFtZShmcmFtZUlkKTtcclxuICAgICAgICAgICAgcmV0dXJuICRmcmFtZSAmJiAkZnJhbWUuZGF0YSgnZXhpZicpIHx8IG51bGw7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBnZXRGcmFtZXM6IGZ1bmN0aW9uIChjc3NGaWx0ZXIpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWVzO1xyXG4gICAgICAgICAgICBjc3NGaWx0ZXIgPSBjc3NGaWx0ZXIgfHwgJyc7XHJcbiAgICAgICAgICAgICRmcmFtZXMgPSBzZWxmLiRwcmV2aWV3LmZpbmQoJGguRlJBTUVTICsgY3NzRmlsdGVyKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYucmV2ZXJzZVByZXZpZXdPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgJGZyYW1lcyA9ICQoJGZyYW1lcy5nZXQoKS5yZXZlcnNlKCkpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAkZnJhbWVzO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0UHJldmlldzogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICBjb250ZW50OiBzZWxmLmluaXRpYWxQcmV2aWV3LFxyXG4gICAgICAgICAgICAgICAgY29uZmlnOiBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnLFxyXG4gICAgICAgICAgICAgICAgdGFnczogc2VsZi5pbml0aWFsUHJldmlld1RodW1iVGFnc1x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kpIHtcclxuICAgICAgICAgICAgICAgICAgICBsID0gJC5mbi5maWxlaW5wdXRMb2NhbGVzW2xhbmddIHx8IHt9O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgb3B0ID0gJC5leHRlbmQodHJ1ZSwge30sICQuZm4uZmlsZWlucHV0LmRlZmF1bHRzLCB0LCAkLmZuLmZpbGVpbnB1dExvY2FsZXMuZW4sIGwsIG9wdGlvbnMsIHNlbGYuZGF0YSgpKTtcclxuICAgICAgICAgICAgICAgIGRhdGEgPSBuZXcgRmlsZUlucHV0KHRoaXMsIG9wdCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmRhdGEoJ2ZpbGVpbnB1dCcsIGRhdGEpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbiA9PT0gJ3N0cmluZycpIHtcclxuICAgICAgICAgICAgICAgIHJldHZhbHMucHVzaChkYXRhW29wdGlvbl0uYXBwbHkoZGF0YSwgYXJncykpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgc3dpdGNoIChyZXR2YWxzLmxlbmd0aCkge1xyXG4gICAgICAgICAgICBjYXNlIDA6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcztcclxuICAgICAgICAgICAgY2FzZSAxOlxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJldHZhbHNbMF07XHJcbiAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gcmV0dmFscztcclxuICAgICAgICB9XHJcbiAgICB9O1xyXG5cclxuICAgICQuZm4uZmlsZWlucHV0LmRlZmF1bHRzID0ge1xyXG4gICAgICAgIGxhbmd1YWdlOiAnZW4nLFxyXG4gICAgICAgIHNob3dDYXB0aW9uOiB0cnVlLFxyXG4gICAgICAgIHNob3dCcm93c2U6IHRydWUsXHJcbiAgICAgICAgc2hvd1ByZXZpZX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jbGFzc0xpc3QuYWRkKENsYXNzTmFtZSQyLlBPSU5URVJfRVZFTlQpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgJCh0aGlzLl9lbGVtZW50KS5vbihFdmVudCQyLlRPVUNIU1RBUlQsIGZ1bmN0aW9uIChldmVudCkge1xuICAgICAgICAgIHJldHVybiBzdGFydChldmVudCk7XG4gICAgICAgIH0pO1xuICAgICAgICAkKHRoaXMuX2VsZW1lbnQpLm9uKEV2ZW50JDIuVE9VQ0hNT1ZFLCBmdW5jdGlvbiAoZXZlbnQpIHtcbiAgICAgICAgICByZXR1cm4gbW92ZShldmVudCk7XG4gICAgICAgIH0pO1xuICAgICAgICAkKHRoaXMuX2VsZW1lbnQpLm9uKEV2ZW50JDIuVE9VQ0hFTkQsIGZ1bmN0aW9uIChldmVudCkge1xuICAgICAgICAgIHJldHVybiBlbmQoZXZlbnQpO1xuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICB9O1xuXG4gICAgX3Byb3RvLl9rZXlkb3duID0gZnVuY3Rpb24gX2tleWRvd24oZXZlbnQpIHtcbiAgICAgIGlmICgvaW5wdXR8dGV4dGFyZWEvaS50ZXN0KGV2ZW50LnRhcmdldC50YWdOYW1lKSkge1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIHN3aXRjaCAoZXZlbnQud2hpY2gpIHtcbiAgICAgICAgY2FzZSBBUlJPV19MRUZUX0tFWUNPREU6XG4gICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICB0aGlzLnByZXYoKTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIEFSUk9XX1JJR0hUX0tFWUNPREU6XG4gICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICB0aGlzLm5leHQoKTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBkZWZhdWx0OlxuICAgICAgfVxuICAgIH07XG5cbiAgICBfcHJvdG8uX2dld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NlbWVudDogdGhpcy5fZ2V0UGxhY2VtZW50KCksXG4gICAgICAgIG1vZGlmaWVyczoge1xuICAgICAgICAgIG9mZnNldDogdGhpcy5fZ2V0T2Zmc2V0KCksXG4gICAgICAgICAgZmxpcDoge1xuICAgICAgICAgICAgZW5hYmxlZDogdGhpcy5fY29uZmlnLmZsaXBcbiAgICAgICAgICB9LFxuICAgICAgICAgIHByZXZlbnRPdmVyZmxvdzoge1xuICAgICAgICAgICAgYm91bmRhcmllc0VsZW1lbnQ6IHRoaXMuX2NvbmZpZy5ib3VuZGFyeVxuICAgICAgICAgIH1cbiAgICAgICAgfSAvLyBEaXNhYmxlIFBvcHBlci5qcyBpZiB3ZSBoYXZlIGEgc3RhdGljIGRpc3BsYXlcblxuICAgICAgfTtcblxuICAgICAgaWYgKHRoaXMuX2NvbmZpZy5kaXNwbGF5ID09PSAnc3RhdGljJykge1xuICAgICAgICBwb3BwZXJDb25maWcubW9kaWZpZXJzLmFwcGx5U3R5bGUgPSB7XG4gICAgICAgICAgZW5hYmxlZDogZmFsc2VcbiAgICAgICAgfTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHBvcHBlckNvbmZpZztcbiAgICB9IC8vIFN0YXRpY1xuICAgIDtcblxuICAgIERyb3Bkb3duLl9qUXVlcnlJbnRlcmZhY2UgPSBmdW5jdGlvbiBfalF1ZXJ5SW50ZXJmYWNlKGNvbmZpZykge1xuICAgICAgcmV0dXJuIHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7XG4gICAgICAgIHZhciBkYXRhID0gJCh0aGlzKS5kYXRhKERBVEFfS0VZJDQpO1xuXG4gICAgICAgIHZhciBfY29uZmlnID0gdHlwZW9mIGNvbmZpZyA9PT0gJ29iamVjdCcgPyBjb25maWcgOiBudWxsO1xuXG4gICAgICAgIGlmICghZGF0YSkge1xuICAgICAgICAgIGRhdGEgPSBuZXcgRHJvcGRvd24odGhpcywgX2NvbmZpZyk7XG4gICAgICAgICAgJCh0aGlzKS5kYXR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NS5GQURFIDogJyc7XG5cbiAgICAgIGlmICh0aGlzLl9pc1Nob3duICYmIHRoaXMuX2NvbmZpZy5iYWNrZHJvcCkge1xuICAgICAgICB0aGlzLl9iYWNrZHJvcCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpO1xuICAgICAgICB0aGlzLl9iYWNrZHJvcC5jbGFzc05hbWUgPSBDbGFzc05hbWUkNS5CQUNLRFJPUDtcblxuICAgICAgICBpZiAoYW5pbWF0ZSkge1xuICAgICAgICAgIHRoaXMuX2JhY2tkcm9wLmNsYXNzTGlzdC5hZGQoYW5pbWF0ZSk7XG4gICAgICAgIH1cblxuICAgICAgICAkKHRoaXMuX2JhY2tkcm9wKS5hcHBlbmRUbyhkb2N1bWVudC5ib2R5KTtcbiAgICAgICAgJCh0aGlzLl9lbGVtZW50KS5vbihFdmVudCQ1LkNMSUNLX0RJU01JU1MsIGZ1bmN0aW9uIChldmVudCkge1xuICAgICAgICAgIGlmIChfdGhpczguX2lnbm9yZUJhY2tkcm9wQ2xpY2spIHtcbiAgICAgICAgICAgIF90aGlzOC5faWdub3JlQmFja2Ryb3BDbGljayA9IGZhbHNlO1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChldmVudC50YXJnZXQgIT09IGV2ZW50LmN1cnJlbnRUYXJnZXQpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoX3RoaXM4Ll9jb25maWcuYmFja2Ryb3AgPT09ICdzdGF0aWMnKSB7XG4gICAgICAgICAgICBfdGhpczguX2VsZW1lbnQuZm9jdXMoKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgX3RoaXM4LmhpZGUoKTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGlmIChhbmltYXRlKSB7XG4gICAgICAgICAgVXRpbC5yZWZsb3codGhpcy5fYmFja2Ryb3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nRlbnQpIHtcbiAgICAgIGlmICh0eXBlb2YgY29udGVudCA9PT0gJ29iamVjdCcgJiYgKGNvbnRlbnQubm9kZVR5cGUgfHwgY29udGVudC5qcXVlcnkpKSB7XG4gICAgICAgIC8vIENvbnRlbnQgaXMgYSBET00gbm9kZSBvciBhIGpRdWVyeVxuICAgICAgICBpZiAodGhpcy5jb25maWcuaHRtbCkge1xuICAgICAgICAgIGlmICghJChjb250ZW50KS5wYXJlbnQoKS5pcygkZWxlbWVudCkpIHtcbiAgICAgICAgICAgICRlbGVtZW50LmVtcHR5KCkuYXBwZW5kKGNvbnRlbnQpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAkZWxlbWVudC50ZXh0KCQoY29udGVudCkudGV4dCgpKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgaWYgKHRoaXMuY29uZmlnLmh0bWwpIHtcbiAgICAgICAgaWYgKHRoaXMuY29uZmlnLnNhbml0aXplKSB7XG4gICAgICAgICAgY29udGVudCA9IHNhbml0aXplSHRtbChjb250ZW50LCB0aGlzLmNvbmZpZy53aGl0ZUxpc3QsIHRoaXMuY29uZmlnLnNhbml0aXplRm4pO1xuICAgICAgICB9XG5cbiAgICAgICAgJGVsZW1lbnQuaHRtbChjb250ZW50KTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgICRlbGVtZW50LnRleHQoY29udGVudCk7XG4gICAgICB9XG4gICAgfTtcblxuICAgIF9wcm90by5nZXRUaXRsZSA9IGZ1bmN0aW9uIGdldFRpdGxlKCkge1xuICAgICAgdmFyIHRpdGxlID0gdGhpcy5lbGVtZW50LmdldEF0dHJpYnV0ZSgnZGF0YS1vcmlnaW5hbC10aXRsZScpO1xuXG4gICAgICBpZiAoIXRpdGxlKSB7XG4gICAgICAgIHRpdGxlID0gdHlwZW9mIHRoaXMuY29uZmlnLnRpdGxlID09PSAnZnVuY3Rpb24nID8gdGhpcy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b250ZXh0Ll9ob3ZlclN0YXRlID0gSG92ZXJTdGF0ZS5TSE9XO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIGNsZWFyVGltZW91dChjb250ZXh0Ll90aW1lb3V0KTtcbiAgICAgIGNvbnRleHQuX2hvdmVyU3RhdGUgPSBIb3ZlclN0YXRlLlNIT1c7XG5cbiAgICAgIGlmICghY29udGV4dC5jb25maWcuZGVsYXkgfHwgIWNvbnRleHQuY29uZmlnLmRlbGF5LnNob3cpIHtcbiAgICAgICAgY29udGV4dC5zaG93KCk7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgY29udGV4dC5fdGltZW91dCA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICBpZiAoY29udGV4dC5faG92ZXJTdGF0ZSA9PT0gSG92ZXJTdGF0ZS5TSE9XKSB7XG4gICAgICAgICAgY29udGV4dC5zaG93KCk7XG4gICAgICAgIH1cbiAgICAgIH0sIGNvbnRleHQuY29uZmlnLmRlbGF5LnNob3cpO1xuICAgIH07XG5cbiAgICBfcHJvdG8uX2xlYXZlID0gZnVuY3Rpb24gX2xlYXZlKGV2ZW50LCBjb250ZXh0KSB7XG4gICAgICB2YXIgZGF0YUtleSA9IHRoaXMuY29uc3RydWN0b3IuREFUQV9LRVk7XG4gICAgICBjb250ZXh0ID0gY29udGV4dCB8fCAkKGV2ZW50LmN1cnJlbnRUYXJnZXQpLmRhdGEoZGF0YUtleSk7XG5cbiAgICAgIGlmICghY29udGV4dCkge1xuICAgICAgICBjb250ZXh0ID0gbmV3IHRoaXMuY29uc3RydWN0b3IoZXZlbnQuY3VycmVudFRhcmdldCwgdGhpcy5fZ2V0RGVsZWdhdGVDb25maWcoKSk7XG4gICAgICAgICQoZXZlbnQuY3VycmVudFRhcmdldCkuZGF0YShkYXRhS2V5LCBjb250ZXh0KTtcbiAgICAgIH1cblxuICAgICAgaWYgKGV2ZW50KSB7XG4gICAgICAgIGNvbn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cycsICdkaXInLCAnaWQnLCAnbGFuZycsICdyb2xlJywgJ3RhYmluZGV4JywgJ3N0eWxlJywgQVJJQV9BVFRSSUJVVEVfUEFUVEVSTl0sXHJcbiAgICBhOiBbJ3RhcmdldCcsICdocmVmJywgJ3RpdGxlJywgJ3JlbCddLFxyXG4gICAgYXJlYTogW10sXHJcbiAgICBiOiBbXSxcclxuICAgIGJyOiBbXSxcclxuICAgIGNvbDogW10sXHJcbiAgICBjb2RlOiBbXSxcclxuICAgIGRpdjogW10sXHJcbiAgICBlbTogW10sXHJcbiAgICBocjogW10sXHJcbiAgICBoMTogW10sXHJcbiAgICBoMjogW10sXHJcbiAgICBoMzogW10sXHJcbiAgICBoNDogW10sXHJcbiAgICBoNTogW10sXHJcbiAgICBoNjogW10sXHJcbiAgICBpOiBbXSxcclxuICAgIGltZzogWydzcmMnLCAnYWx0JywgJ3RpdGxlJywgJ3dpZHRoJywgJ2hlaWdodCddLFxyXG4gICAgbGk6IFtdLFxyXG4gICAgb2w6IFtdLFxyXG4gICAgcDogW10sXHJcbiAgICBwcmU6IFtdLFxyXG4gICAgczogW10sXHJcbiAgICBzbWFsbDogW10sXHJcbiAgICBzcGFuOiBbXSxcclxuICAgIHN1YjogW10sXHJcbiAgICBzdXA6IFtdLFxyXG4gICAgc3Ryb25nOiBbXSxcclxuICAgIHU6IFtdLFxyXG4gICAgdWw6IFtdXHJcbiAgfVxyXG5cclxuICAvKipcclxuICAgKiBBIHBhdHRlcm4gdGhhdCByZWNvZ25pemVzIGEgY29tbW9ubHkgdXNlZnVsIHN1YnNldCBvZiBVUkxzIHRoYXQgYXJlIHNhZmUuXHJcbiAgICpcclxuICAgKiBTaG91dG91dCB0byBBbmd1bGFyIDcgaHR0cHM6Ly9naXRodWIuY29tL2FuZ3VsYXIvYW5ndWxhci9ibG9iLzcuMi40L3BhY2thZ2VzL2NvcmUvc3JjL3Nhbml0aXphdGlvbi91cmxfc2FuaXRpemVyLnRzXHJcbiAgICovXHJcbiAgd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FxyXG4gIC8vIFJlbW92ZSBpbiB2MlxyXG4gIGlmICghKCdjbGFzc0xpc3QnIGluIGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ18nKSkpIHtcclxuICAgIChmdW5jdGlvbiAodmlldykge1xyXG4gICAgICBpZiAoISgnRWxlbWVudCcgaW4gdmlldykpIHJldHVybjtcclxuXHJcbiAgICAgIHZhciBjbGFzc0xpc3RQcm9wID0gJ2NsYXNzTGlzdCcsXHJcbiAgICAgICAgICBwcm90b1Byb3AgPSAncHJvdG90eXBlJyxcclxuICAgICAgICAgIGVsZW1DdHJQcm90byA9IHZpZXcuRWxlbWVudFtwcm90b1Byb3BdLFxyXG4gICAgICAgICAgb2JqQ3RyID0gT2JqZWN0LFxyXG4gICAgICAgICAgY2xhc3NMaXN0R2V0dGVyID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgJGVsZW0gPSAkKHRoaXMpO1xyXG5cclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICBhZGQ6IGZ1bmN0aW9uIChjbGFzc2VzKSB7XHJcbiAgICAgICAgICAgICAgICBjbGFzc2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKS5qb2luKCcgJyk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJGVsZW0uYWRkQ2xhc3MoY2xhc3Nlcyk7XHJcbiAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uIChjbGFzc2VzKSB7XHJcbiAgICAgICAgICAgICAgICBjbGFzc2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKS5qb2luKCcgJyk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJGVsZW0ucmVtb3ZlQ2xhc3MoY2xhc3Nlcyk7XHJcbiAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICB0b2dnbGU6IGZ1bmN0a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Zy5jaGFyQ29kZUF0KGluZGV4KSkge1xyXG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICB9O1xyXG4gICAgICBpZiAoZGVmaW5lUHJvcGVydHkpIHtcclxuICAgICAgICBkZWZpbmVQcm9wZXJ0eShTdHJpbmcucHJvdG90eXBlLCAnc3RhcnRzV2l0aCcsIHtcclxuICAgICAgICAgICd2YWx1ZSc6IHN0YXJ0c1dpdGgsXHJcbiAgICAgICAgICAnY29uZmlndXJhYmxlJzogdHJ1ZSxcclxuICAgICAgICAgICd3cml0YWJsZSc6IHRydWVcclxuICAgICAgICB9KTtcclxuICAgICAgfSBlbHNlIHtcclxuICAgICAgICBTdHJpbmcucHJvdG90eXBlLnN0YXJ0c1dpdGggPSBzdGFydHNXaXRoO1xyXG4gICAgICB9XHJcbiAgICB9KCkpO1xyXG4gIH1cclxuXHJcbiAgaWYgKCFPYmplY3Qua2V5cykge1xyXG4gICAgT2JqZWN0LmtleXMgPSBmdW5jdGlvbiAoXHJcbiAgICAgIG8sIC8vIG9iamVjdFxyXG4gICAgICBrLCAvLyBrZXlcclxuICAgICAgciAgLy8gcmVzdWx0IGFycmF5XHJcbiAgICApIHtcclxuICAgICAgLy8gaW5pdGlhbGl6ZSBvYmplY3QgYW5kIHJlc3VsdFxyXG4gICAgICByID0gW107XHJcbiAgICAgIC8vIGl0ZXJhdGUgb3ZlciBvYmplY3Qga2V5c1xyXG4gICAgICBmb3IgKGsgaW4gbykge1xyXG4gICAgICAgIC8vIGZpbGwgcmVzdWx0IGFycmF5IHdpdGggbm9uLXByb3RvdHlwaWNhbCBrZXlzXHJcbiAgICAgICAgci5oYXNPd25Qcm9wZXJ0eS5jYWxsKG8sIGspICYmIHIucHVzaChrKTtcclxuICAgICAgfVxyXG4gICAgICAvLyByZXR1cm4gcmVzdWx0XHJcbiAgICAgIHJldHVybiByO1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c3NcclxuICAgICAgdmlldzoge30sXHJcbiAgICAgIGtleWRvd246IHtcclxuICAgICAgICBrZXlIaXN0b3J5OiAnJyxcclxuICAgICAgICByZXNldEtleUhpc3Rvcnk6IHtcclxuICAgICAgICAgIHN0YXJ0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICB0aGF0LnNlbGVjdHBpY2tlci5rZXlkb3duLmtleUhpc3RvcnkgPSAnJztcclxuICAgICAgICAgICAgfSwgODAwKTtcclxuICAgICAgICAgIH1cclxuICAgICAgICB9XHJcbiAgICAgIH1cclxuICAgIH07XHJcbiAgICAvLyBJZiB3ZSBoYXZlIG5vIHRpdGxlIHlldCwgdHJ5IHRvIHB1bGwgaXQgZnJvbSB0aGUgaHRtbCB0aXRsZSBhdHRyaWJ1dGUgKGpRdWVyeSBkb2VzbnQnIHBpY2sgaXQgdXAgYXMgaXQncyBub3QgYVxyXG4gICAgLy8gZGF0YS1hdHRyaWJ1dGUpXHJcbiAgICBpZiAodGhpcy5vcHRpb25zLnRpdGxlID09PSBudWxsKSB7XHJcbiAgICAgIHRoaXMub3B0aW9ucy50aXRsZSA9IHRoaXMuJGVsZW1lbnQuYXR0cigndGl0bGUnKTtcclxuICAgIH1cclxuXHJcbiAgICAvLyBGb3JtYXQgd2luZG93IHBhZGRpbmdcclxuICAgIHZhciB3aW5QYWQgPSB0aGlzLm9wdGlvbnMud2luZG93UGFkZGluZztcclxuICAgIGlmICh0eXBlb2Ygd2luUGFkID09PSAnbnVtYmVyJykge1xyXG4gICAgICB0aGlzLm9wdGlvbnMud2luZG93UGFkZGluZyA9IFt3aW5QYWQsIHdpblBhZCwgd2luUGFkLCB3aW5QYWRdO1xyXG4gICAgfVxyXG5cclxuICAgIC8vIEV4cG9zZSBwdWJsaWMgbWV0aG9kc1xyXG4gICAgdGhpcy52YWwgPSBTZWxlY3RwaWNrZXIucHJ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xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5zZWxlY3RBbGxUZXh0ICtcclxuICAgICAgICAgICAgICAnPC9idXR0b24+JyArXHJcbiAgICAgICAgICAgICAgJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwiYWN0aW9ucy1idG4gYnMtZGVzZWxlY3QtYWxsIGJ0biAnICsgY2xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5kZXNlbGVjdEFsbFRleHQgK1xyXG4gICAgICAgICAgICAgICc8L2J1dHRvbj4nICtcclxuICAgICAgICAgICAgJzwvZGl2PicgK1xyXG4gICAgICAgICAgJzwvZGl2Pic7XHJcbiAgICAgIH1cclxuXHJcbiAgICAgIGlmICh0aGlzLm11bHRpcGxlICYmIHRoaXMub3B0aW9ucy5kb25lQnV0dG9uKSB7XHJcbiAgICAgICAgZG9uZWJ1dHRvbiA9XHJcbiAgICAgICAgICAnPGRpdiBjbGFzcz1cImJzLWRvbmVidXR0b25cIj4nICtcclxuICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJidG4tZ3JvdXAgYnRuLWJsb2NrXCI+JyArXHJcbiAgICAgICAgICAgICAgJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwiYnRuIGJ0bi1zbSAnICsgY2xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5kb25lQnV0dG9uVGV4dCArXHJcbiAgICAgICAgICAgICAgJzwvYnV0dG9uPicgK1xyXG4gICAgICAgICAgICAnPC9kaXY+JyArXHJcbiAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgfVxyXG5cclxuICAgICAgZHJvcCA9XHJcbiAgICAgICAgJzxkaXYgY2xhc3M9XCJkcm9wZG93biBib290c3RyYXAtc2VsZWN0JyArIHNob3dUaWNrICsgaW5wdXRHcm91cCArICdcIj4nICtcclxuICAgICAgICAgICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cIicgKyB0aGlzLm9wdGlvbnMuc3R5bGVCYXNlICsgJyBkcm9wZG93bi10b2dnbGVcIiAnICsgKHRoaXMub3B0aW9ucy5kaXNwbGF5ID09PSAnc3RhdGljJyA/ICdkYXRhLWRpc3BsYXk9XCJzdGF0aWNcIicgOiAnJykgKyAnZGF0YS10b2dnbGU9XCJkcm9wZG93blwiJyArIGF1dG9mb2N1cyArICcgcm9sZT1cImNvbWJvYm94XCIgYXJpYS1vd25zPVwiJyArIHRoaXMuc2VsZWN0SWQgKyAnXCIgYXJpYS1oYXNwb3B1cD1cImxpc3Rib3hcIiBhcmlhLWV4cGFuZGVkPVwiZmFsc2VcIj4nICtcclxuICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJmaWx0ZXItb3B0aW9uXCI+JyArXHJcbiAgICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJmaWx0ZXItb3B0aW9uLWlubmVyXCI+JyArXHJcbiAgICAgICAgICAgICAgICAnPGRpdiBjbGFzcz1cImZpbHRlci1vcHRpb24taW5uZXItaW5uZXJcIj48L2Rpdj4nICtcclxuICAgICAgICAgICAgICAnPC9kaXY+ICcgK1xyXG4gICAgICAgICAgICAnPC9kaXY+JyArXHJcbiAgICAgICAgICAgIChcclxuICAgICAgICAgICAgICB2ZXJzaW9uLm1ham9yID09PSAnNCcgPyAnJ1xyXG4gICAgICAgICAgICAgIDpcclxuICAgICAgICAgICAgICAnPHNwYW4gY2xhc3M9XCJicy1jYXJldFwiPicgK1xyXG4gICAgICAgICAgICAgICAgdGhpcy5vcHRpb25zLnRlbXBsYXRlLmNhcmV0ICtcclxuICAgICAgICAgICAgICAnPC9zcGFuPidcclxuICAgICAgICAgICAgKSArXHJcbiAgICAgICAgICAnPC9idXR0b24+JyArXHJcbiAgICAgICAgICAnPGRpd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LmVsZW1lbnRzLmxlbmd0aCxcclxuICAgICAgICAgICAgY2h1bmtzID0gW10sXHJcbiAgICAgICAgICAgIGNodW5rU2l6ZSxcclxuICAgICAgICAgICAgY2h1bmtDb3VudCxcclxuICAgICAgICAgICAgZmlyc3RDaHVuayxcclxuICAgICAgICAgICAgbGFzdENodW5rLFxyXG4gICAgICAgICAgICBjdXJyZW50Q2h1bmssXHJcbiAgICAgICAgICAgIHByZXZQb3NpdGlvbnMsXHJcbiAgICAgICAgICAgIHBvc2l0aW9uSXNEaWZmZXJlbnQsXHJcbiAgICAgICAgICAgIHByZXZpb3VzRWxlbWVudHMsXHJcbiAgICAgICAgICAgIG1lbnVJc0RpZmZlcmVudCA9IHRydWUsXHJcbiAgICAgICAgICAgIGlzVmlydHVhbCA9IHRoYXQuaXNWaXJ0dWFsKCk7XHJcblxyXG4gICAgICAgIHRoYXQuc2VsZWN0cGlja2VyLnZpZXcuc2Nyb2xsVG9wID0gc2Nyb2xsVG9wO1xyXG5cclxuICAgICAgICBjaHVua1NpemUgPSBNYXRoLmNlaWwodGhhdC5zaXplSW5mby5tZW51SW5uZXJIZWlnaHQgLyB0aGF0LnNpemVJbmZvLmxpSGVpZ2h0ICogMS41KTsgLy8gbnVtYmVyIG9mIG9wdGlvbnMgaW4gYSBjaHVua1xyXG4gICAgICAgIGNodW5rQ291bnQgPSBNYXRoLnJvdW5kKHNpemUgLyBjaHVua1NpemUpIHx8IDE7IC8vIG51bWJlciBvZiBjaHVua3NcclxuXHJcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaHVua0NvdW50OyBpKyspIHtcclxuICAgICAgICAgIHZhciBlbmRPZkNodW5rID0gKGkgKyAxKSAqIGNodW5rU2l6ZTtcclxuXHJcbiAgICAgICAgICBpZiAoaSA9PT0gY2h1bmtDb3VudCAtIDEpIHtcclxuICAgICAgICAgICAgZW5kT2ZDaHVuayA9IHNpemU7XHJcbiAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgY2h1bmtzW2ldID0gW1xyXG4gICAgICAgICAgICAoaSkgKiBjaHVua1NpemUgKyAoIWkgPyAwIDogMSksXHJcbiAgICAgICAgICAgIGVuZE9mQ2h1bmtcclxuICAgICAgICAgIF07XHJcblxyXG4gICAgICAgICAgaWYgKCFzaXplKSBicmVhaztcclxuXHJcbiAgICAgICAgICBpZiAoY3VycmVudENodW5rID09PSB1bmRlZmluZWQgJiYgc2Nyb2xsVG9wIC0gMSA8PSB0aGF0LnNlbGVjdHBpY2tlci5jdXJyZW50LmRhdGFbZW5kT2ZDaHVuayAtIDFdLnBvc2l0aW9uIC0gdGhhdC5zaXplSW5mby5tZW51SW5uZXJIZWlnaHQpIHtcclxuICAgICAgICAgICAgY3VycmVudENodW5rID0gaTtcclxuICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGlmIChjdXJyZW50Q2h1bmsgPT09IHVuZGVmaW5lZCkgY3VycmVudENodW5rID0gMDtcclxuXHJcbiAgICAgICAgcHJldlBvc2l0aW9ucyA9IFt0aGF0LnNlbGVjdHBpY2tlci52aWV3LnBvc2l0aW9uMCwgdGhhdC5zZWxlY3RwaWNrZXIudmlldy5wb3NpdGlvbjFdO1xyXG5cclxuICAgICAgICAvLyBhbHdheXMgZGlzcGxheSBwcmV2aW91cywgY3VycmVudCwgYW5kIG5leHQgY2h1bmtzXHJcbiAgICAgICAgZmlyc3RDaHVuayA9IE1hdGgubWF4KDAsIGN1cnJlbnRDaHVuayAtIDEpO1xyXG4gICAgICAgIGxhc3RDaHVuayA9IE1hdGgubWluKGNodW5rQ291bnQgLSAxLCBjdXJyZW50Q2h1bmsgKyAxKTtcclxuXHJcbiAgICAgICAgdGhhdC5zZWxlY3RwaWNrZXIudmlldy5wb3NpdGlvbjAgPSBpc1ZpcnR1YWwgPT09IGZhbHNlID8gMCA6IChNYXRoLm1heCgwLCBjaHVua3NbZmlyc3RDaHVua11bMF0pIHx8IDApO1xyXG4gICAgICAgIHRoYXQuc2V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gICAgICAgICB0b1Nhbml0aXplID0gW107XHJcblxyXG4gICAgICAgICAgICAvLyByZXBsYWNlIHRoZSBleGlzdGluZyBVTCB3aXRoIGFuIGVtcHR5IG9uZSAtIHRoaXMgaXMgZmFzdGVyIHRoYW4gJC5lbXB0eSgpXHJcbiAgICAgICAgICAgIG1lbnVJbm5lci5yZXBsYWNlQ2hpbGQoZW1wdHlNZW51LCBtZW51SW5uZXIuZmlyc3RDaGlsZCk7XHJcblxyXG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgdmlzaWJsZUVsZW1lbnRzTGVuID0gZWxlbWVudHMubGVuZ3RoOyBpIDwgdmlzaWJsZUVsZW1lbnRzTGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICB2YXIgZWxlbWVudCA9IGVsZW1lbnRzW2ldLFxyXG4gICAgICAgICAgICAgICAgICBlbFRleHQsXHJcbiAgICAgICAgICAgICAgICAgIGVsZW1lbnREYXRhO1xyXG5cclxuICAgICAgICAgICAgICBpZiAodGhhdC5vcHRpb25zLnNhbml0aXplKSB7XHJcbiAgICAgICAgICAgICAgICBlbFRleHQgPSBlbGVtZW50Lmxhc3RDaGlsZDtcclxuXHJcbiAgICAgICAgICAgICAgICBpZiAoZWxUZXh0KSB7XHJcbiAgICAgICAgICAgICAgICAgIGVsZW1lbnREYXRhID0gdGhhdC5zZWxlY3RwaWNrZXIuY3VycmVudC5kYXRhW2kgKyB0aGF0LnNlbGVjdHBpY2tlci52aWV3LnBvc2l0aW9uMF07XHJcblxyXG4gICAgICAgICAgICAgICAgICBpZiAoZWxlbWVudERhdGEgJiYgZWxlbWVudERhdGEuY29udGVudCAmJiAhZWxlbWVudERhdGEuc2FuaXRpemVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdG9TYW5pdGl6ZS5wdXNoKGVsVGV4dCk7XHJcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudERhdGEuc2FuaXRpemVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAg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5lcldpZHRoICsgJ3B4JztcclxuICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1lbnVJbm5lcklubmVyV2lkdGggPiB0aGF0LnNpemVJbmZvLm1lbnVJbm5lcklubmVyV2lkdGgpIHtcclxuICAgICAgICAgICAgICAgIC8vIHNldCB0byAwIHRvIGdldCBhY3R1YWwgd2lkdGggb2YgbWVudVxyXG4gICAgICAgICAgICAgICAgdGhhdC4kbWVudVswXS5zdHlsZS5taW5XaWR0aCA9IDA7XHJcblxyXG4gICAgICAgICAgICAgICAgdmFyIGFjdHVhbE1lbnVXaWR0aCA9IG1lbnVJbm5lci5maXJzdENoaWxkLm9mZnNldFdpZHRoO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmIChhY3R1YWxNZW51V2lkdGggPiB0aGF0LnNpemVJbmZvLm1lbnVJbm5lcklubmVyV2lkdGgpIHtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zaXplSW5mby5tZW51SW5uZXJJbm5lcldpZHRoID0gYWN0dWFsTWVudVdpZHRoO1xyXG4gICAgICAgICAgICAgICAgICBtZW51SW5uZXIuZmlyc3RDaGlsZC5zdHlsZS5taW5XaWR0aCA9IHRoYXQuc2l6ZUluZm8ubWVudUlubmVySW5uZXJXaWR0aCArICdweCc7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgLy8gcmVzZXQgdG8gZGVmYXVsdCBDU1Mgc3R5bGluZ1xyXG4gICAgICAgICAgICAgICAgdGhhdC4kbWVudVswXS5zdHlsZS5taW5XaWR0aCA9ICcnO1xyXG4gICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdGhhdC5wcmV2QWN0aXZlSW5kZXggPSB0aGF0LmFjdGl2ZUluZGV4O1xyXG5cclxuICAgICAgICBpZiAoIXRoYXQub3B0aW9ucy5saXZlU2VhcmNoKSB7XHJcbiAgICAgICAgICB0a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clxuXHJcbiAgICAgICAgY29uZmlnID0gY29uZmlnIHx8IHt9O1xyXG4gICAgICAgIGNvbmZpZy50eXBlID0gJ2RpdmlkZXInO1xyXG5cclxuICAgICAgICBtYWluRWxlbWVudHMucHVzaChcclxuICAgICAgICAgIGdlbmVyYXRlT3B0aW9uLmxpKFxyXG4gICAgICAgICAgICBmYWxzZSxcclxuICAgICAgICAgICAgY2xhc3NOYW1lcy5ESVZJREVSLFxyXG4gICAgICAgICAgICAoY29uZmlnLm9wdElEID8gY29uZmlnLm9wdElEICsgJ2RpdicgOiB1bmRlZmluZWQpXHJcbiAgICAgICAgICApXHJcbiAgICAgICAgKTtcclxuXHJcbiAgICAgICAgbWFpbkRhdGEucHVzaChjb25maWcpO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBmdW5jdGlvbiBhZGRPcHRpb24gKG9wdGlvbiwgY29uZmlnKSB7XHJcbiAgICAgICAgY29uZmlnID0gY29uZmlnIHx8IHt9O1xyXG5cclxuICAgICAgICBjb25maWcuZGl2aWRlciA9IG9wdGlvbi5nZXRBdHRyaWJ1dGUoJ2RhdGEtZGl2aWRlcicpID09PSAndHJ1ZSc7XHJcblxyXG4gICAgICAgIGlmIChjb25maWcuZGl2aWRlcikge1xyXG4gICAgICAgICAgYWRkRGl2aWRlcih7XHJcbiAgICAgICAgICAgIG9wdElEOiBjb25maWcub3B0SURcclxuICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICB2YXIgbGlJbmRleCA9IG1haW5EYXRhLmxlbmd0aCxcclxuICAgICAgICAgICAgICBjc3NUZXh0ID0gb3B0aW9uLnN0eWxlLmNzc1RleHQsXHJcbiAgICAgICAgICAgICAgaW5saW5lU3R5bGUgPSBjc3NUZXh0ID8gaHRtbEVzY2FwZShjc3NUZXh0KSA6ICcnLFxyXG4gICAgICAgICAgICAgIG9wdGlvbkNsYXNzID0gKG9wdGlvbi5jbGFzc05hbWUgfHwgJycpICsgKGNvbmZpZy5vcHRncm91cENsYXNzIHx8ICcnKTtcclxuXHJcbiAgICAgICAgICBpZiAoY29uZmlnLm9wdElEKSBvcHRpb25DbGFzcyA9ICdvcHQgJyArIG9wdGlvbkNsYXNzO1xyXG5cclxuICAgICAgICAgIGNvbmZpZy50ZXh0ID0gb3B0aW9uLnRleHRDb250ZW50O1xyXG5cclxuICAgICAgICAgIGNvbmZpZy5jb250ZW50ID0gb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1jb250ZW50Jyk7XHJcbiAgICAgICAgICBjb25maWcudG9rZW5zID0gb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS10b2tlbnMnKTtcclxuICAgICAgICAgIGNvbmZpZy5zdWJ0ZXh0ID0gb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1zdWJ0ZXh0Jyk7XHJcbiAgICAgICAgICBjb25maWcuaWNvbiA9IG9wdGlvbi5nZXRBdHRyaWJ1dGUoJ2RhdGEtaWNvbicpO1xyXG4gICAgICAgICAgY29uZmlnLmljb25CYXNlID0gaWNvbkJhc2U7XHJcblxyXG4gICAgICAgICAgdmFyIHRleHRFbGVtZW50ID0gZ2VuZXJhdGVPcHRpb24udGV4dChjb25maWcpO1xyXG4gICAgICAgICAgdmFyIGxpRWxlbWVudCA9IGdlbmVyYXRlT3B0aW9uLmxpKFxyXG4gICAgICAgICAgICBnZW5lcmF0ZU9wdGlvbi5hKFxyXG4gICAgICAgICAgICAgIHRleHRFbGVtZW50LFxyXG4gICAgICAgICAgICAgIG9wdGlvbkNsYXNzLFxyXG4gICAgICAgICAgICAgIGlubGluZVN0eWxlXHJcbiAgICAgICAgICAgICksXHJcbiAgICAgICAgICAgICcnLFxyXG4gICAgICAgICAgICBjb25maWcub3B0SURcclxuICAgICAgICAgICk7XHJcblxyXG4gICAgICAgICAgaWYgKGxpRWxlbWVudC5maXJzdENoaWxkKSB7XHJcbiAgICAgICAgICAgIGxpRWxlbWVudC5maXJzdENoaWxkLmlkID0gdGhhdC5zZWxlY3RJZCArICctJyArIGxpSW5kZXg7XHJcbiAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgbWFpbkVsZW1lbnRzLnB1c2gobGlFbGVtZW50KTtcclxuXHJcbiAgICAgICAgICBvcHRpb24ubGlJbmRleCA9IGxpSW5kZXg7XHJcblxyXG4gICAgICAgICAgY29uZmlnLmRpc3BsYXkgPSBjb25maWcuY29udGVudCB8fCBjb25maWcudGV4dDtcclxuICAgICAgICAgIGNvbmZpZy50eXBlID0gJ29wdGlvbic7XHJcbiAgICAgICAgICBjb25maWcuaW5kZXggPSBsaUluZGV4O1xyXG4gICAgICAgICAgY29uZmlnLm9wdGlvbiA9IG9wdGlvbjtcclxuICAgICAgICAgIGNvbmZpZy5kaXNhYmxlZCA9IGNvbmZpZy5kaXNhYmxlZCB8fCBvcHRpb24uZGlzYWJsZWQ7XHJcblxyXG4gICAgICAgICAgbWFpbkRhdGEucHVzaChjb25maWcpO1xyXG5cclxuICAgICAgICAgIHZhciBjb21iaW5lZExlbmd0aCA9IDA7XHJcblxyXG4gICAgICAgICAgLy8gY291bnQgdGhlIG51bWJlciBvZiBjaGFyYWN0ZXJzIGluIHRoZSBvcHRpb24gLSBub3QgcGVyZmVjdCwgYnV0IHNob3VsZCB3b3JrIGluIG1vc3QgY2FzZXNcclxuICAgICAgICAgIGlmIChjb25maWcuZGlzcGxheSkgY29tYmluZWRMZW5ndGggKz0gY29uZmlnLmRpc3BsYXkubGVuZ3RoO1xyXG4gICAgICAgICAgaWYgKGNvbmZpZy5zdWJ0ZXh0KSBjb21iaW5lZExlbmd0aCArPSBjb25maWcuc3VidGV4dC5sZW5ndGg7XHJcbiAgICAgICAgICAvLyBpZiB0aGVyZSBpcyBhbiBpY29uLCBlbnN1cmUgdGhpcyBvcHRpb24ncyB3aWR0aCBpcyBjaGVja2VkXHJcbiAgICAgICAgICBpZiAoY29uZmlnLmljb24pIGNvbWJpbmVkTGVuZ3RoICs9IDE7XHJcblxyXG4g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mFyIGogPSAwLCBsZW4gPSBvcHRpb25zLmxlbmd0aDsgaiA8IGxlbjsgaisrKSB7XHJcbiAgICAgICAgICB2YXIgb3B0aW9uID0gb3B0aW9uc1tqXTtcclxuXHJcbiAgICAgICAgICBpZiAoaiA9PT0gMCkge1xyXG4gICAgICAgICAgICBoZWFkZXJJbmRleCA9IG1haW5EYXRhLmxlbmd0aCAtIDE7XHJcbiAgICAgICAgICAgIGxhc3RJbmRleCA9IGhlYWRlckluZGV4ICsgbGVuO1xyXG4gICAgICAgICAgfVxyXG5cclxuICAgICAgICAgIGFkZE9wdGlvbihvcHRpb24sIHtcclxuICAgICAgICAgICAgaGVhZGVySW5kZXg6IGhlYWRlckluZGV4LFxyXG4gICAgICAgICAgICBsYXN0SW5kZXg6IGxhc3RJbmRleCxcclxuICAgICAgICAgICAgb3B0SUQ6IG9wdElELFxyXG4gICAgICAgICAgICBvcHRncm91cENsYXNzOiBvcHRncm91cENsYXNzLFxyXG4gICAgICAgICAgICBkaXNhYmxlZDogb3B0Z3JvdXAuZGlzYWJsZWRcclxuICAgICAgICAgIH0pO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgaWYgKG5leHQpIHtcclxuICAgICAgICAgIGFkZERpdmlkZXIoeyBvcHRJRDogb3B0SUQgfSk7XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcblxyXG4gICAgICBmb3IgKHZhciBsZW4gPSBzZWxlY3RPcHRpb25zLmxlbmd0aDsgc3RhcnRJbmRleCA8IGxlbjsgc3RhcnRJbmRleCsrKSB7XHJcbiAgICAgICAgdmFyIGl0ZW0gPSBzZWxlY3RPcHRpb25zW3N0YXJ0SW5kZXhdO1xyXG5cclxuICAgICAgICBpZiAoaXRlbS50YWdOYW1lICE9PSAnT1BUR1JPVVAnKSB7XHJcbiAgICAgICAgICBhZGRPcHRpb24oaXRlbSwge30pO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICBhZGRPcHRncm91cChzdGFydEluZ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ICAgICAgICBjb3VudE1heCA9IHRoaXMub3B0aW9ucy5zZWxlY3RlZFRleHRGb3JtYXQuc3BsaXQoJz4nKTtcclxuICAgICAgICAgIHNob3dDb3VudCA9IChjb3VudE1heC5sZW5ndGggPiAxICYmIHNlbGVjdGVkQ291bnQgPiBjb3VudE1heFsxXSkgfHwgKGNvdW50TWF4Lmxlbmd0aCA9PT0gMSAmJiBzZWxlY3RlZENvdW50ID49IDIpO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgLy8gb25seSBsb29wIHRocm91Z2ggYWxsIHNlbGVjdGVkIG9wdGlvbnMgaWYgdGhlIGNvdW50IHdvbid0IGJlIHNob3duXHJcbiAgICAgICAgaWYgKHNob3dDb3VudCA9PT0gZmFsc2UpIHtcclxuICAgICAgICAgIGZvciAodmFyIHNlbGVjdGVkSW5kZXggPSAwOyBzZWxlY3RlZEluZGV4IDwgc2VsZWN0ZWRDb3VudDsgc2VsZWN0ZWRJbmRleCsrKSB7XHJcbiAgICAgICAgICAgIGlmIChzZWxlY3RlZEluZGV4IDwgNTApIHtcclxuICAgICAgICAgICAgICB2YXIgb3B0aW9uID0gc2VsZWN0ZWRPcHRpb25zW3NlbGVjdGVkSW5kZXhdLFxyXG4gICAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMgPSB7fSxcclxuICAgICAgICAgICAgICAgICAgdGhpc0RhdGEgPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY29udGVudDogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1jb250ZW50JyksXHJcbiAgICAgICAgICAgICAgICAgICAgc3VidGV4dDogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1zdWJ0ZXh0JyksXHJcbiAgICAgICAgICAgICAgICAgICAgaWNvbjogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1pY29uJylcclxuICAgICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgICAgaWYgKHRoaXMubXVsdGlwbGUgJiYgc2VsZWN0ZWRJbmRleCA+IDApIHtcclxuICAgICAgICAgICAgICAgIHRpdGxlRnJhZ21lbnQuYXBwZW5kQ2hpbGQobXVsdGlwbGVTZXBhcmF0b3IuY2xvbmVOb2RlKGZhbHNlKSk7XHJcbiAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICBpZiAob3B0aW9uLnRpdGxlKSB7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMudGV4dCA9IG9wdGlvbi50aXRsZTtcclxuICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXNEYXRhLmNvbnRlbnQgJiYgdGhhdC5vcHRpb25zLnNob3dDb250ZW50KSB7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMuY29udGVudCA9IHRoaXNEYXRhLmNvbnRlbnQudG9TdHJpbmcoKTtcclxuICAgICAgICAgICAgICAgIGhhc0NvbnRlbnQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAodGhhdC5vcHRpb25zLnNob3dJY29uKSB7XHJcbiAgICAgICAgICAgICAgICAgIHRpdGxlT3B0aW9ucy5pY29uID0gdGhpc0RhdGEuaWNvbjtcclxuICAgICAgICAgICAgICAgICAgdGl0bGVPcHRpb25zLmljb25CYXNlID0gdGhpcy5vcHRpb25zLmljb25CYXNlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHRoYXQub3B0aW9ucy5zaG93U3VidGV4dCAmJiAhdGhhdC5tdWx0aXBsZSAmJiB0aGlzRGF0YS5zdWJ0ZXh0KSB0aXRsZU9wdGlvbnMuc3VidGV4dCA9ICcgJyArIHRoaXNEYXRhLnN1YnRleHQ7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMudGV4dCA9IG9wdGlvbi50ZXh0Q29udGVudC50cmltKCk7XHJcbiAgICAgICAgICAgICAgfVxyXG5cclxuIC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gICAgKTtcclxuXHJcbiAgICAgICAgICAgIHRoYXQuJGJzQ29udGFpbmVyLmFkZENsYXNzKCRlbGVtZW50LmF0dHIoJ2NsYXNzJykucmVwbGFjZSgvZm9ybS1jb250cm9sfGZpdC13aWR0aC9naSwgJycpKS50b2dnbGVDbGFzcyhjbGFzc05hbWVzLkRST1BVUCwgJGVsZW1lbnQuaGFzQ2xhc3MoY2xhc3NOYW1lcy5EUk9QVVApKTtcclxuICAgICAgICAgICAgcG9zID0gJGVsZW1lbnQub2Zmc2V0KCk7XHJcblxyXG4gICAgICAgICAgICBpZiAoISRjb250YWluZXIuaXMoJ2JvZHknKSkge1xyXG4gICAgICAgICAgICAgIGNvbnRhaW5lclBvcyA9ICRjb250YWluZXIub2Zmc2V0KCk7XHJcbiAgICAgICAgICAgICAgY29udGFpbmVyUG9zLnRvcCArPSBwYXJzZUludCgkY29udGFpbmVyLmNzcygnYm9yZGVyVG9wV2lkdGgnKSkgLSAkY29udGFpbmVyLnNjcm9sbFRvcCgpO1xyXG4gICAgICAgICAgICAgIGNvbnRhaW5lclBvcy5sZWZ0ICs9IHBhcnNlSW50KCRjb250YWluZXIuY3NzKCdib3JkZXJMZWZ0V2lkdGgnKSkgLSAkY29udGFpbmVyLnNjcm9sbExlZnQoKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICBjb250YWluZXJQb3MgPSB7IHRvcDogMCwgbGVmdDogMCB9O1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBhY3R1YWxIZWlnaHQgPSAkZWxlbWVudC5oYXNDbGFzcyhjbGFzc05hbWVzLkRST1BVUCkgPyAwIDogJGVsZW1lbnRbMF0ub2Zmc2V0SGVpZ2h0O1xyXG5cclxuICAgICAgICAgICAgLy8gQm9vdHN0cmFwIDQrIHVzZXMgUG9wcGVyIGZvciBtZW51IHBvc2l0aW9uaW5nXHJcbiAgICAgICAgICAgIGlmICh2ZXJzaW9uLm1ham9yIDwgNCB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sZWN0ZWRPcHRpb25zKGVsZW1lbnQpLmxlbmd0aCxcclxuICAgICAgICAgICAgICAgICAgbWF4UmVhY2hlZEdycCA9IG1heE9wdGlvbnNHcnAgPCAkb3B0Z3JvdXAuZmluZCgnb3B0aW9uOnNlbGVjdGVkJykubGVuZ3RoO1xyXG5cclxuICAgICAgICAgICAgICBpZiAoKG1heE9wdGlvbnMgJiYgbWF4UmVhY2hlZCkgfHwgKG1heE9wdGlvbnNHcnAgJiYgbWF4UmVhY2hlZEdycCkpIHtcclxuICAgICAgICAgICAgICAgIGlmIChtYXhPcHRpb25zICYmIG1heE9wdGlvbnMgPT0gMSkge1xyXG4gICAgICAgICAgICAgICAgICBlbGVtZW50LnNlbGVjdGVkSW5kZXggPSAtMTtcclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zZXRPcHRpb25TdGF0dXModHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1heE9wdGlvbnNHcnAgJiYgbWF4T3B0aW9uc0dycCA9PSAxKSB7XHJcbiAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgJG9wdGdyb3VwT3B0aW9ucy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBfb3B0aW9uID0gJG9wdGdyb3VwT3B0aW9uc1tpXTtcclxuICAgICAgICAgICAgICAgICAgICBfb3B0aW9uLnNlbGVjdGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhhdC5zZXRTZWxlY3RlZChfb3B0aW9uLmxpSW5kZXgsIGZhbHNlKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zZXRTZWxlY3RlZChjbGlja2VkSW5kZXgsI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gICAgICAgICAgICAgICBtYXhUeHRHcnAgPSBtYXhUeHRHcnAucmVwbGFjZSgne3Zhcn0nLCBtYXhPcHRpb25zQXJyWzJdW21heE9wdGlvbnNHcnAgPiAxID8gMCA6IDFdKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gZmFsc2U7XHJcblxyXG4gICAgICAgICAgICAgICAgICB0aGF0LiRtZW51LmFwcGVuZCgkbm90aWZ5KTtcclxuXHJcbiAgICAgICAgICAgICAgICAgIGlmIChtYXhPcHRpb25zICYmIG1heFJlYWNoZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAkbm90aWZ5LmFwcGVuZCgkKCc8ZGl2PicgKyBtYXhUeHQgKyAnPC9kaXY+JykpO1xyXG4gICAgICAgICAgICAgICAgICAgIHRyaWdnZXJDaGFuZ2UgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB0aGF0LiRlbGVtZW50LnRyaWdnZXIoJ21heFJlYWNoZWQnICsgRVZFTlRfS0VZKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgaWYgKG1heE9wdGlvbnNHcnAgJiYgbWF4UmVhY2hlZEdycCkge1xyXG4gICAgICAgICAgICAgICAgICAgICRub3RpZnkuYXBwZW5kKCQoJzxkaXY+JyArIG1heFR4dEdycCArICc8L2Rpdj4nKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgdHJpZ2dlckNoYW5nZSA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIHRoYXQuJGVsZW1lbnQudHJpZ2dlcignbWF4UmVhY2hlZEdycCcgKyBFVkVOVF9LRVkpO1xyXG4gICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGF0LnNldFNlbGVjdGVkKGNsa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zZWxlY3RlZCcpO1xyXG5cclxuICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgdGhhdC5zZWxlY3RwaWNrZXIubWFpbi5kYXRhLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgIHZhciBsaSA9IHRoYXQuc2VsZWN0cGlja2VyLm1haW4uZGF0YVtpXTtcclxuXHJcbiAgICAgICAgICAgIGlmICghY2FjaGVbaV0pIHtcclxuICAgICAgICAgICAgICBjYWNoZVtpXSA9IHN0cmluZ1NlYXJjaChsaSwgcSwgc2VhcmNoU3R5bGUsIG5vcm1hbGl6ZVNlYXJjaCk7XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIGlmIChjYWNoZVtpXSAmJiBsaS5oZWFkZXJJbmRleCAhPT0gdW5kZWZpbmVkICYmIGNhY2hlQXJyLmluZGV4T2YobGkuaGVhZGVySW5kZXgpID09PSAtMSkge1xyXG4gICAgICAgICAgICAgIGlmIChsaS5oZWFkZXJJbmRleCA+IDApIHtcclxuICAgICAgICAgICAgICAgIGNhY2hlW2xpLmhlYWRlckluZGV4IC0gMV0gPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgY2FjaGVBcnIucHVzaChsaS5oZWFkZXJJbmRleCAtIDEpO1xyXG4gICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgY2FjaGVbbGkuaGVhZGVySW5kZXhdID0gdHJ1ZTtcclxuICAgICAgICAgICAgICBjYWNoZUFyci5wdXNoKGxpLmhlYWRlckluZGV4KTtcclxuXHJcbiAgICAgICAgICAgICAgY2FjaGVbbGkubGFzdEluZGV4ICsgMV0gPSB0cnVlO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAoY2FjaGVbaV0gJiYgbGkudHlwZSAhPT0gJ29wdGdyb3VwLWxhYmVsJykgY2FjaGVBcnIucHVzaChpKTtcclxuICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICBmb3IgKHZhci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VksIGNoYW5nZWRBcmd1bWVudHMpO1xyXG5cclxuICAgICAgICBpZiAodGhpcy4kbmV3RWxlbWVudC5oYXNDbGFzcyhjbGFzc05hbWVzLlNIT1cpKSB7XHJcbiAgICAgICAgICBpZiAodGhpcy5tdWx0aXBsZSkge1xyXG4gICAgICAgICAgICB0aGlzLnNldE9wdGlvblN0YXR1cyh0cnVlKTtcclxuICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgIHZhciBsaVNlbGVjdGVkSW5kZXggPSAoZWxlbWVudC5vcHRpb25zW2VsZW1lbnQuc2VsZWN0ZWRJbmRleF0gfHwge30pLmxpSW5kZXg7XHJcblxyXG4gICAgICAgICAgICBpZiAodHlwZW9mIGxpU2VsZWN0ZWRJbmRleCA9PT0gJ251bWJlcicpIHtcclxuICAgICAgICAgICAgICB0aGlzLnNldFNlbGVjdGVkKHRoaXMuc2VsZWN0ZWRJbmRleCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgIHRoaXMuc2V0U2VsZWN0ZWQobGlTZWxlY3RlZEluZGV4LCB0cnVlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdGhpcy5yZW5kZXIoKTtcclxuXHJcbiAgICAgICAgY2hhbmdlZEFyZ3VtZW50cyA9IG51bGw7XHJcblxyXG4gICAgICAgIHJldHVybiB0aGlzLiRlbGVtZW50O1xyXG4gICAgICB9IGVsc2Uge1xyXG4gICAgICAgIHJldHVybiB0aGlzLiRlbGVtZW50LnZhbCgpO1xyXG4gICAgICB9XHJcbiAgICB9LFxyXG5cclxuICAgIGNoYW5nZUFsbDogZnVuY3Rpb24gKHN0YXR1cykge1xyXG4gICAgICBpZiAoIXRoaXMubXVsdGlwbGUpIHJldHVybjtcclxuICAgICAgaWYgKHR5cGVvZiBzdGF0dXMgPT09ICd1bmRlZmluZWQnKSBzdGF0dXMgPSB0cnVlO1xyXG5cclxuICAgICAgdmFyI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RpdmVMaSxcclxuICAgICAgICAgIG9mZnNldCxcclxuICAgICAgICAgIHVwZGF0ZVNjcm9sbCA9IGZhbHNlLFxyXG4gICAgICAgICAgZG93bk9uVGFiID0gZS53aGljaCA9PT0ga2V5Q29kZXMuVEFCICYmICFpc1RvZ2dsZSAmJiAhdGhhdC5vcHRpb25zLnNlbGVjdE9uVGFiLFxyXG4gICAgICAgICAgaXNBcnJvd0tleSA9IFJFR0VYUF9BUlJPVy50ZXN0KGUud2hpY2gpIHx8IGRvd25PblRhYixcclxuICAgICAgICAgIHNjcm9sbFRvcCA9IHRoYXQuJG1lbnVJbm5lclswXS5zY3JvbGxUb3AsXHJcbiAgICAgICAgICBpc1ZpcnR1YWwgPSB0aGF0LmlzVmlydHVhbCgpLFxyXG4gICAgICAgICAgcG9zaXRpb24wID0gaXNWaXJ0dWFsID09PSB0cnVlID8gdGhhdC5zZWxlY3RwaWNrZXIudmlldy5wb3NpdGlvbjAgOiAwO1xyXG5cclxuICAgICAgLy8gZG8gbm90aGluZyBpZiBhIGZ1bmN0aW9uIGtleSBpcyBwcmVzc2VkXHJcbiAgICAgIGlmIChlLndoaWNoID49IDExMiAmJiBlLndoaWNoIDw9IDEyMykgcmV0dXJuO1xyXG5cclxuICAgICAgaXNBY3RpdmUgPSB0aGF0LiRuZXdFbGVtZW50Lmhhc0NsYXNzKGNsYXNzTmFtZXMuU0hPVyk7XHJcblxyXG4gICAgICBpZiAoXHJcbiAgICAgICAgIWlzQWN0aXZlICYmXHJcbiAgICAgICAgKFxyXG4gICAgICAgICAgaXNBcnJvd0tleSB8fFxyXG4gICAgICAgICAgKGUud2hpY2ggPj0gNDggJiYgZS53aGljaCA8PSA1NykgfHxcclxuICAgICAgICAgIChlLndoaWNoID49IDk2ICYmIGUud2hpY2ggPD0gMTA1KSB8fFxyXG4gICAgICAgICAgKGUud2hpY2ggPj0gNjUgJiYgZS53aGljaCA8PSA5MClcclxuICAgICAgICApXHJcbiAgICAgICkge1xyXG4gICAgICAgIHRoYXQuJGJ1dHRvbi50cmlnZ2VyKCdjbGljay5icy5kcm9wZG93bi5kYXRhLWFwaScpO1xyXG5cclxuICAgICAgICBpZiAodGhhdC5vcHRpb25zLmxpdmVTZWFyY2gpIHtcclxuICAgICAgICAgIHRoYXQuJHNlYXJjaGJveC50cmlnZ2VyKCdmb2N1cycpO1xyXG4gICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgIH1cclxuICAgICAgfVxyXG5cclxuICAgICAgaWYgKGUud2hpY2ggPT09IGtleUNvZGVzLkVTQ0FQRSAmJiBpc0FjdGl2ZSkge1xyXG4gICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICB0aGF0LiRidXR0b24udHJpZ2dlcignY2xpY2suYnMuZHJvcGRvd24uZGF0YS1hcGknKS50cmlnZ2VyKCdmb2N1cycpO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBpZiAoaXNBcnJvd0tleSkgeyAvLyBpZiB1cCBvciBkb3duXHJcbiAgICAgICAgaWYgKCEkaXRlbXMubGVuZ3RoKSByZXR1cm47XHJcblxyXG4gICAgICAgIGxpQWN0aXZlID0gdGhhdC5zZWxlY3RwaWNrZXIubWFpbi5lbGVtZW50c1t0aGF0LmFjdGl2ZUluZGV4XTtcclxuICAgICAgICBpbmRleCA9IGxpQWN0aXZlID8gQXJyYXkucHJvdG90eXBlLmluZGV4T2YuY2FsbChsaUFjdGl2ZS5wYXJlbnRFbGVtZW50LmNoaWxkcmVuLCBsaUFjdGl2ZSkgOiAtMTtcclxuXHJcbiAgICAgICAgaWYgKGluZGV4ICE9PSAtMSkge1xyXG4gICAgICAgICAgdGhhdC5kZWZvY3VzSXRlbShsaUFjdGl2ZSk7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBpZiAoZS53aGljaCA9PT0ga2V5Q29kZXMuQVJST1dfVVApIHsgLy8gdXBcclxuICAgICAgICAgIGlmIChpbmRleCAhPT0gLTEpIGluZGV4LS07XHJcbiAgICAgICAgIC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aGVja2VkJykubGVuZ3RoIDpcbiAgICAgICAgICAgJGVsLmlzKCdzZWxlY3RbbXVsdGlwbGVdJykgID8gKCRlbC52YWwoKSB8fCBbXSkubGVuZ3RoICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRlbC52YWwoKVxuICB9XG5cbiAgdmFyIFZhbGlkYXRvciA9IGZ1bmN0aW9uIChlbGVtZW50LCBvcHRpb25zKSB7XG4gICAgdGhpcy5vcHRpb25zICAgID0gb3B0aW9uc1xuICAgIHRoaXMudmFsaWRhdG9ycyA9ICQuZXh0ZW5kKHt9LCBWYWxpZGF0b3IuVkFMSURBVE9SUywgb3B0aW9ucy5jdXN0b20pXG4gICAgdGhpcy4kZWxlbWVudCAgID0gJChlbGVtZW50KVxuICAgIHRoaXMuJGJ0biAgICAgICA9ICQoJ2J1dHRvblt0eXBlPVwic3VibWl0XCJdLCBpbnB1dFt0eXBlPVwic3VibWl0XCJdJylcbiAgICAgICAgICAgICAgICAgICAgICAgIC5maWx0ZXIoJ1tmb3JtPVwiJyArIHRoaXMuJGVsZW1lbnQuYXR0cignaWQnKSArICdcIl0nKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmFkZCh0aGlzLiRlbGVtZW50LmZpbmQoJ2lucHV0W3R5cGU9XCJzdWJtaXRcIl0sIGJ1dHRvblt0eXBlPVwic3VibWl0XCJdJykpXG5cbiAgICB0aGlzLnVwZGF0ZSgpXG5cbiAgICB0aGlzLiRlbGVtZW50Lm9uKCdpbnB1dC5icy52YWxpZGF0b3IgY2hhbmdlLmJzLnZhbGlkYXRvciBmb2N1c291dC5icy52YWxpZGF0b3InLCAkLnByb3h5KHRoaXMub25JbnB1dCwgdGhpcykpXG4gICAgdGhpcy4kZWxlbWVudC5vbignc3VibWl0LmJzLnZhbGlkYXRvcicsICQucHJveHkodGhpcy5vblN1Ym1pdCwgdGhpcykpXG4gICAgdGhpcy4kZWx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lbnQ6IGZ1bmN0aW9uIChlKSB7XHJcbiAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcbiAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldEZpbGVOYW1lOiBmdW5jdGlvbiAoZmlsZSkge1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBmaWxlLmZpbGVOYW1lICovXHJcbiAgICAgICAgICAgIHJldHVybiBmaWxlID8gKGZpbGUuZmlsZU5hbWUgfHwgZmlsZS5uYW1lIHx8ICcnKSA6ICcnOyAvLyBzb21lIGNvbmZ1c2lvbiBpbiBkaWZmZXJlbnQgdmVyc2lvbnMgb2YgRmlyZWZveFxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY3JlYXRlT2JqZWN0VVJMOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICBpZiAoJGgub2JqVXJsICYmICRoLm9ialVybC5jcmVhdGVPYmplY3RVUkwgJiYgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuICRoLm9ialVybC5jcmVhdGVPYmplY3RVUkwoZGF0YSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgcmV2b2tlT2JqZWN0VVJMOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICBpZiAoJGgub2JqVXJsICYmICRoLm9ialVybC5yZXZva2VPYmplY3RVUkwgJiYgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgJGgub2JqVXJsLnJldm9rZU9iamVjdFVSTChkYXRhKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY29tcGFyZTogZnVuY3Rpb24gKGlucHV0LCBzdHIsIGV4YWN0KSB7XHJcbiAgICAgICAgICAgIHJldHVybiBpbnB1dCAhPT0gdW5kZWZpbmVkICYmIChleGFjdCA/IGlucHV0ID09PSBzdHIgOiBpbnB1dC5tYXRjaChzdHIpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGlzSUU6IGZ1bmN0aW9uICh2ZXIpIHtcclxuICAgICAgICAgICAgdmFyIGRpdiwgc3RhdHVzO1xyXG4gICAgICAgICAgICAvLyBjaGVjayBmb3IgSUUgdmVyc2lvbnMgPCAxMVxyXG4gICAgICAgICAgICBpZiAobmF2aWdhdG9yLmFwcE5hbWUgIT09ICdNaWNyb3NvZnQgSW50ZXJuZXQgRXhwbG9yZXInKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHZlciA9PT0gMTApIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUmVnRXhwKCdtc2llXFxcXHMnICsgdmVyLCAnaScpLnRlc3QobmF2aWdhdG9yLnVzZXJBZ2VudCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZGl2ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7XHJcbiAgICAgICAgICAgIGRpdi5pbm5lckhUTUwgPSAnPCEtLVtpZiBJRSAnICsgdmVyICsgJ10+IDxpPjwvaT4gPCFbZW5kaWZdLS0+JztcclxuICAgICAgICAgICAgc3RhdHVzID0gZGl2LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdpJykubGVuZ3RoO1xyXG4gICAgICAgICAgICBkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGRpdik7XHJcbiAgICAgICAgICAgIGRpdi5wYXJlbnROb2RlLnJlbW92ZUNoaWxkKGRpdik7XHJcbiAgICAgICAgICAgIHJldHVybiBzdGF0dXM7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBjYW5Bc3NpZ25GaWxlc1RvSW5wdXQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIGlucHV0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnaW5wdXQnKTtcclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIGlucHV0LnR5cGUgPSAnZmlsZSc7XHJcbiAgICAgICAgICAgICAgICBpbnB1dC5maWxlcyA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldERyYWdEcm9wRm9sZGVyczogZnVuY3Rpb24gKGl0ZW1zKSB7XHJcbiAgICAgICAgICAgIHZhciBpLCBpdGVtLCBsZW4gPSBpdGVtcyA/IGl0ZW1zLmxlbmd0aCA6IDAsIGZvbGRlcnMgPSAwO1xyXG4gICAgICAgICAgICBpZiAobGVuID4gMCAmJiBpdGVtc1swXS53ZWJraXRHZXRBc0VudHJ5KCkpIHtcclxuICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgIGl0ZW0gPSBpdGVtc1tpXS53ZWJraXRHZXRBc0VudHJ5KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0gJiYgaXRlbS5pc0RpcmVjdG9yeSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb2xkZXJzKys7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiBmb2xkZXJzO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaW5pdE1vZGFsOiBmdW5jdGlvbiAoJG1vZGFsKSB7XHJcbiAgICAgICAgICAgIHZhciAkYm9keSA9ICQoJ2JvZHknKTtcclxuICAgICAgICAgICAgaWYgKCRib2R5Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgJG1vZGFsLmFwcGVuZFRvKCRib2R5KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNFbXB0eTogZnVuY3Rpb24gKHZhbHVlLCB0cmltKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZSA9PT0gdW5kZWZpbmVkIHx8IHZhbHVlID09PSBudWxsIHx8IHZhbHVlLmxlbmd0aCA9PT0gMCB8fCAodHJpbSAmJiAkLnRyaW0odmFsdWUpID09PSAnJyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBpc0FycmF5OiBmdW5jdGlvbiAoYSkge1xyXG4gICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShhKSB8fCBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYSkgPT09ICdbb2JqZWN0IEFycmF5XSc7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBpZlNldDogZnVuY3Rpb24gKG5lZWRsZSwgaGF5c3RhY2ssIGRlZikge1xyXG4gICAgICAgICAgICBkZWYgPSBkZWYgfHwgJyc7XHJcbiAgICAgICAgICAgIHJldHVybiAoaGF5c3RhY2sgJiYgdHlwZW9mIGhheXN0YWNrID09PSAnb2JqZWN0JyAmJiBuZWVkbGUgaW4gaGF5c3RhY2spID8gaGF5c3RhY2tbbmVlZGxlXSA6IGRlZjtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGNsZWFuQXJyYXk6IGZ1bmN0aW9uIChhcnIpIHtcclxuICAgICAgICAgICAgaWYgKCEoYXJyIGluc3RhbmNlb2YgQXJyYXkpKSB7XHJcbiAgICAgICAgICAgICAgICBhcnIgPSBbXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gYXJyLmZpbHRlcihmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIChlICE9PSB1bmRlZmluZWQgJiYgZSAhPT0gbnVsbCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgc3BsaWNlQXJyYXk6IGZ1bmN0aW9uIChhcnIsIGluZGV4LCByZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgdmFyIGksIGogPSAwLCBvdXQgPSBbXSwgbmV3QXJyO1xyXG4gICAgICAgICAgICBpZiAoIShhcnIgaW5zdGFuY2VvZiBBcnJheSkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBbXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBuZXdBcnIgPSAkLmV4dGVuZCh0cnVlLCBbXSwgYXJyKTtcclxuICAgICAgICAgICAgaWYgKHJldmVyc2VPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgbmV3QXJyLnJldmVyc2UoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbmV3QXJyLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaSAhPT0gaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXRbal0gPSBuZXdBcnJbaV07XHJcbiAgICAgICAgICAgICAgICAgICAgaisrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChyZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgICAgIG91dC5yZXZlcnNlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldE51bTogZnVuY3Rpb24gKG51bSwgZGVmKSB7XHJcbiAgICAgICAgICAgIGRlZiA9IGRlZiB8fCAwO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIG51bSA9PT0gJ251bWJlcicpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBudW07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAga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cclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIHJldHVybiAhIXdpbmRvdy5CbG9iICYmIEJvb2xlYW4obmV3IEJsb2IoKSk7XHJcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaGFzQXJyYXlCdWZmZXJWaWV3U3VwcG9ydDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBCbG9iKFtuZXcgVWludDhBcnJheSgxMDApXSkuc2l6ZSA9PT0gMTAwO1xyXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIGRhdGFVUkkyQmxvYjogZnVuY3Rpb24gKGRhdGFVUkkpIHtcclxuICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSlNVbnJlc29sdmVkVmFyaWFibGVcclxuICAgICAgICAgICAgdmFyIEJsb2JCdWlsZGVyID0gd2luZG93LkJsb2JCdWlsZGVyIHx8IHdpbmRvdy5XZWJLaXRCbG9iQnVpbGRlciB8fCB3aW5kb3cuTW96QmxvYkJ1aWxkZXIgfHxcclxuICAgICAgICAgICAgICAgIHdpbmRvdy5NU0Jsb2JCdWlsZGVyLCBjYW5CbG9iID0gJGguaGFzQmxvYlN1cHBvcnQoKSwgYnl0ZVN0ciwgYXJyYXlCdWZmZXIsIGludEFycmF5LCBpLCBtaW1lU3RyLCBiYixcclxuICAgICAgICAgICAgICAgIGNhblByb2NlZWQgPSAoY2FuQmxvYiB8fCBCbG9iQnVpbGRlcikgJiYgd2luZG93LmF0b2IgJiYgd2luZG93LkFycmF5QnVmZmVyICYmIHdpbmRvdy5VaW50OEFycmF5O1xyXG4gICAgICAgICAgICBpZiAoIWNhblByb2NlZWQpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBudWxsO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChkYXRhVVJJLnNwbGl0KCcsJylbMF0uaW5kZXhPZignYmFzZTY0JykgPj0gMCkge1xyXG4gICAgICAgICAgICAgICAgYnl0ZVN0ciA9IGF0b2IoZGF0YVVSSS5zcGxpdCgnLCcpWzFdKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGJ5dGVTdHIgPSBkZWNvZGVVUklDb21wb25lbnQoZGF0YVVSSS5zcGxpdCgnLCcpWzFdKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBhcnJheUJ1ZmZlciA9IG5ldyBBcnJheUJ1ZmZlcihieXRlU3RyLmxlbmd0aCk7XHJcbiAgICAgICAgICAgIGludEFycmF5ID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlCdWZmZXIpO1xyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgYnl0ZVN0ci5sZW5ndGg7IGkgKz0gMSkge1xyXG4gICAgICAgICAgICAgICAgaW50QXJyYXlbaV0gPSBieXRlU3RyLmNoYXJDb2RlQXQoaSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgbWltZVN0ciA9IGRhdGFVUkkuc3BsaXQoJywnKVswXS5zcGxpdCgnOicpWzFdLnNwbGl0KCc7JylbMF07XHJcbiAgICAgICAgICAgIGlmIChjYW5CbG9iKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEJsb2IoWyRoLmhhc0FycmF5QnVmZmVyVmlld1N1cHBvcnQoKSA/IGludEFycmF5IDogYXJyYXlCdWZmZXJdLCB7dHlwZTogbWltZVN0cn0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGJiID0gbmV3IEJsb2JCdWlsZGVyKCk7XHJcbiAgICAgICAgICAgIGJiLmFwcGVuZChhcnJheUJ1ZmZlcik7XHJcbiAgICAgICAgICAgIHJldHVybiBiYi5nZXRCbG9iKG1pbWVTdHIpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgYXJyYXlCdWZmZXIyU3RyaW5nOiBmdW5jdGlvbiAoYnVmZmVyKSB7XHJcbiAgICAgICAgICAgIC8vbm9pbnNwZWN0aW9uIEpTVW5yZXNvbHZlZFZhcmlhYmxlXHJcbiAgICAgICAgICAgIGlmICh3aW5kb3cuVGV4dERlY29kZXIpIHtcclxuICAgICAgICAgICAgICAgIC8vIG5vaW5zcGVjdGlvbiBKU1VucmVzb2x2ZWRGdW5jdGlvblxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUZXh0RGVjb2RlcigndXRmLTgnKS5kZWNvZGUoYnVmZmVyKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgYXJyYXkgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuYXBwbHkobmV3IFVpbnQ4QXJyYXkoYnVmZmVyKSksIG91dCA9ICcnLCBpID0gMCwgbGVuLCBjLCBjaGFyMiwgY2hhcjM7XHJcbiAgICAgICAgICAgIGxlbiA9IGFycmF5Lmxlbmd0aDtcclxuICAgICAgICAgICAgd2hpbGUgKGkgPCBsZW4pIHtcclxuICAgICAgICAgICAgICAgIGMgPSBhcnJheVtpKytdO1xyXG4gICAgICAgICAgICAgICAgc3dpdGNoIChjID4+IDQpIHsgLy8ganNoaW50IGlnbm9yZTpsaW5lXHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDI6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNDpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDU6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gMHh4eHh4eHhcclxuICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gMTEweCB4eHh4ICAgMTB4eCB4eHh4XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIyID0gYXJyYXlbaSsrXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoKChjICYgMHgxRikgPDwgNikgfCAoY2hhcjIgJiAweDNGKSk7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDE0OlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyAxMTEwIHh4eHggIDEweHggeHh4eCAgMTB4eCB4eHh4XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIyID0gYXJyYXlbaSsrXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2hhcjMgPSBhcnJheVtpKytdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgoKGMgJiAweDBGKSA8PCAxMikgfCAvLyBqc2hpbnQgaWdub3JlOmxpbmVcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoY2hhcjIgJiAweDNGKSA8PCA2KSB8ICAvLyBqc2hpbnQgaWdub3JlOmxpbmVcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoY2hhcjMgJiAweDNGKSA8PCAwKSk7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNIdG1sOiBmdW5jdGlvbiAoc3RyKSB7XHJcbiAgICAgICAgICAgIHZhciBhID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7XHJcbiAgICAgICAgICAgIGEuaW5uZXJIVE1MID0gc3RyO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBjID0gYS5jaGlsZE5vZGVzLCBpID0gYy5sZW5ndGg7IGktLTspIHtcclxuICAgICAgICAgICAgICAgIGlmIChjW2ldLm5vZGVUeXBlID09PSAxKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNTdmc6IGZ1bmN0aW9uIChzdHIpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHN0ci5tYXRjaCgvXlxccyo8XFw/eG1sL2kpICYmIChzdHIubWF0Y2goLzwhRE9DVFlQRSBzdmcvaSkgfHwgc3RyLm1hdGNoKC88c3ZnL2kpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldE1pbWVUeXBlOiBmdW5jdGlvbiAoc2lnbmF0dXJlLCBjb250ZW50cywgdHlwZSkge1xyXG4gICAgICAgICAgICBzd2l0Y2ggKHNpZ25hdHVyZSkge1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTAnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTEnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTInOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2UvanBlZyc7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc4OTUwNEU0Nyc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdpbWFnZS9wbmcnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNDc0OTQ2MzgnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2UvZ2lmJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzQ5NDkyYTAwJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ltYWdlL3RpZmYnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTI0OTQ2NDYnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2Uvd2VicCc7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc2Njc0Nzk3MCc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd2aWRlby8zZ3AnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNGY2NzY3NTMnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndmlkZW8vb2dnJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzFhNDVkZmEzJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3ZpZGVvL21rdic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICcwMDAwMDFiYSc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICcwMDAwMDFiMyc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd2aWRlby9tcGVnJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzMwMjZiMjc1JzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3ZpZGVvL3dtdic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICcyNTUwNDQ0Nic6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9wZGYnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnMjUyMTUwNTMnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vcHMnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjAzMDQnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjA1MDYnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjA1MDgnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vemlwJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzM3N2FiY2FmJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uLzd6JztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzc1NzM3NDYxJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uL3Rhcic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc3ODAxNzMwZCc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9kbWcnO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHNpZ25hdHVyZS5zdWJzdHJpbmcoMCwgNikpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnNDM1NzUzJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24veC1zaG9ja3dhdmUtZmxhc2gnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0OTQ0MzMnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhdWRpby9tcDMnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0MjVhNjgnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9iemlwJztcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc2lnbmF0dXJlLnN1YnN0cmluZygwLCA0KSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzQyNGQnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ltYWdlL2JtcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZmZmYic6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXVkaW8vbXAzJztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0ZDVhJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9leGUnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzFmOWQnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzFmYTAnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uL3ppcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnMWY4Yic6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vZ3ppcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnRlbnRzICYmICFjb250ZW50cy5tYXRjaChcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9bXlxcdTAwMDAtXFx1MDA3Zl0vKSA/ICdhcHBsaWNhdGlvbi90ZXh0LXBsYWluJyA6IHR5cGU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBhZGRDc3M6IGZ1bmN0aW9uICgkZWwsIGNzcykge1xyXG4gICAgICAgICAgICAkZWwucmVtb3ZlQ2xhc3MoY3NzKS5hZGRDbGFzcyhjc3MpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0RWxlbWVudDogZnVuY3Rpb24gKG9wdGlvbnMsIHBhcmFtLCB2YWx1ZSkge1xyXG4gICAgICAgICAgICByZXR1cm4gKCRoLmlzRW1wdHkob3B0aW9ucykgfHwgJGguaXNFbXB0eShvcHRpb25zW3BhcmFtXSkpID8gdmFsdWUgOiAkKG9wdGlvbnNbcGFyYW1dKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHVuaXFJZDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICByZXR1cm4gTWF0aC5yb3VuZChuZXcgRGF0ZSgpLmdldFRpbWUoKSkgKyAnXycgKyBNYXRoLnJvdW5kKE1hdGgucmFuZG9tKCkgKiAxMDApO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaHRtbEVuY29kZTogZnVuY3Rpb24gKHN0ciwgdW5kZWZWYWwpIHtcclxuICAgICAgICAgICAgaWYgKHN0ciA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdW5kZWZWYWwgfHwgbnVsbDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gc3RyLnJlcGxhY2UoLyYvZywgJyZhbXA7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC88L2csICcmbHQ7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8+L2csICcmZ3Q7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cIi9nLCAnJnF1b3Q7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8nL2csICcmYXBvczsnKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHJlcGxhY2VUYWdzOiBmdW5jdGlvbiAoc3RyLCB0YWdzKSB7XHJcbiAgICAgICAgICAgIHZhciBvdXQgPSBzdHI7XHJcbiAgICAgICAgICAgIGlmICghdGFncykge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkLmVhY2godGFncywgZnVuY3Rpb24gKGtleSwgdmFsdWUpIHtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdmdW5jdGlvbicpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YWx1ZSA9IHZhbHVlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBvdXQuc3BsaXQoa2V5KS5qb2luKHZhbHVlKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHJldHVybiBvdXQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBjbGVhbk1lbW9yeTogZnVuY3Rpb24gKCR0aHVtYikge1xyXG4gICAgICAgICAgICB2YXIgZGF0YSA9ICR0aHVtYi5pcygnaW1nJykgPyAkdGh1bWIuYXR0cignc3JjJykgOiAkdGh1bWIuZmluZCgnc291cmNlJykuYXR0cignc3JjJyk7XHJcbiAgICAgICAgICAgICRoLnJldm9rZU9iamVjdFVSTChkYXRhKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGZpbmRGaWxlTmFtZTogZnVuY3Rpb24gKGZpbGVQYXRoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZXBJbmRleCA9IGZpbGVQYXRoLmxhc3RJbmRleE9mKCcvJyk7XHJcbiAgICAgICAgICAgIGlmIChzZXBJbmRleCA9PT0gLTEpIHtcclxuICAgICAgICAgICAgICAgIHNlcEluZGV4ID0gZmlsZVBhd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2l0UmVxdWVzdEZ1bGxzY3JlZW4gKi9cclxuICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIEVsZW1lbnQuQUxMT1dfS0VZQk9BUkRfSU5QVVQgKi9cclxuICAgICAgICAgICAgICAgIGlmIChkZS5yZXF1ZXN0RnVsbHNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGRlLnJlcXVlc3RGdWxsc2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkZS5tc1JlcXVlc3RGdWxsc2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlLm1zUmVxdWVzdEZ1bGxzY3JlZW4oKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGUubW96UmVxdWVzdEZ1bGxTY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlLm1velJlcXVlc3RGdWxsU2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGUud2Via2l0UmVxdWVzdEZ1bGxzY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZS53ZWJraXRSZXF1ZXN0RnVsbHNjcmVlbihFbGVtZW50LkFMTE9XX0tFWUJPQVJEX0lOUFVUKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIGRvY3VtZW50LmV4aXRGdWxsc2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC5tc0V4aXRGdWxsc2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC5tb3pDYW5jZWxGdWxsU2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC53ZWJraXRFeGl0RnVsbHNjcmVlbiAqL1xyXG4gICAgICAgICAgICAgICAgaWYgKGRvYy5leGl0RnVsbHNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGRvYy5leGl0RnVsbHNjcmVlbigpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLm1zRXhpdEZ1bGxzY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZG9jLm1zRXhpdEZ1bGxzY3JlZW4oKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLm1vekNhbmNlbEZ1bGxTY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvYy5tb3pDYW5jZWxGdWxsU2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLndlYmtpdEV4aXRGdWxsc2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jLndlYmtpdEV4aXRGdWxsc2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIG1vdmVBcnJheTogZnVuY3Rpb24gKGFyciwgb2xkSW5kZXgsIG5ld0luZGV4LCByZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgdmFyIG5ld0FyciA9ICQuZXh0ZW5kKHRydWUsIFtdLCBhcnIpO1xyXG4gICAgICAgICAgICBpZiAocmV2ZXJzZU9yZGVyKSB7XHJcbiAgICAgICAgICAgICAgICBuZXdBcnIucmV2ZXJzZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChuZXdJbmRleCA+PSBuZXdBcnIubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgayA9IG5ld0luZGV4IC0gbmV3QXJyLmxlbmd0aDtcclxuICAgICAgICAgICAgICAgIHdoaWxlICgoay0tKSArIDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBuZXdBcnIucHVzaCh1bmRlZmluZWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG5ld0Fyci5zcGxpY2UobmV3SW5kZXgsIDAsIG5ld0Fyci5zcGxpY2Uob2xkSW5kZXgsIDEpWzBdKTtcclxuICAgICAgICAgICAgaWYgKHJldmVyc2VPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgbmV3QXJyLnJldmVyc2UoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gbmV3QXJyO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYW5ab29tQ2FjaGU6IGZ1bmN0aW9uICgkZWwpIHtcclxuICAgICAgICAgICAgdmFyICRjYWNoZSA9ICRlbC5jbG9zZXN0KCcua3Ytem9vbS1jYWNoZS10aGVtZScpO1xyXG4gICAgICAgICAgICBpZiAoISRjYWNoZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRjYWNoZSA9ICRlbC5jbG9zZXN0KCcua3Ytem9vbS1jYWNoZScpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRjYWNoZS5yZW1vdmUoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGNsb3NlQnV0dG9uOiBmdW5jdGlvbiAoY3NzKSB7XHJcbiAgICAgICAgICAgIGNzcyA9IGNzcyA/ICdjbG9zZSAnICsgY3NzIDogJ2Nsb3NlJztcclxuICAgICAgICAgICAgcmV0dXJuICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cIicgKyBjc3MgKyAnXCIgYXJpYS1sYWJlbD1cIkNsb3NlXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICA8c3BhbiBhcmlhLWhpZGRlbj1cInRydWVcIj4mdGltZXM7PC9zcGFuPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzwvYnV0dG9uPic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBnZXRSb3RhdGlvbjogZnVuY3Rpb24gKHZhbHVlKSB7XHJcbiAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgMjpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3JvdGF0ZVkoMTgwZGVnKSc7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDM6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdyb3RhdGUoMTgwZGVnKSc7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdyb3RhdGUoMTgwZGVnKSByb3RhdGVZKDE4MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA1OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDI3MGRlZykgcm90YXRlWSgxODBkZWcpJztcclxuICAgICAgICAgICAgICAgIGNhc2UgNjpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3JvdGF0ZSg5MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA3OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDkwZGVnKSByb3RhdGVZKDE4MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA4OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDI3MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIHNldFRyYW5zZm9ybTogZnVuY3Rpb24gKGVsLCB2YWwpIHtcclxuICAgICAgICAgICAgaWYgKCFlbCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsLnN0eWxlLnRyYW5zZm9ybSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGUud2Via2l0VHJhbnNmb3JtID0gdmFsO1xyXG4gICAgICAgICAgICBlbC5zdHlsZVsnLW1vei10cmFuc2Zvcm0nXSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGVbJy1tcy10cmFuc2Zvcm0nXSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGVbJy1vLXRyYW5zZm9ybSddID0gdmFsO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgc2V0SW1hZ2VPcmllbnRhdGlvbjogZnVuY3Rpb24gKCRpbWcsICR6b29tSW1nLCB2YWx1ZSkge1xyXG4gICAgICAgICAgICBpZiAoISRpbWcgfHwgISRpbWcubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGV2ID0gJ2xvYWQuZmlsZWlucHV0aW1hZ2VvcmllbnQnO1xyXG4gICAgICAgICAgICAkaW1nLm9mZihldikub24oZXYsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciBpbWcgPSAkaW1nLmdldCgwKSwgem9vbUltZyA9ICR6b29tSW1nICYmICR6b29tSW1nLmxlbmd0aCA/ICR6b29tSW1nLmdldCgwKSA6IG51bGwsXHJcbiAgICAgICAgICAgICAgICAgICAgaCA9IGltZy5vZmZzZXRIZWlnaHQsIHcgPSBpbWcub2Zmc2V0V2lkdGgsIHIgPSAkaC5nZXRSb3RhdGlvbih2YWx1ZSk7XHJcbiAgICAgICAgICAgICAgICAkaW1nLmRhdGEoJ29yaWVudGF0aW9uJywgdmFsdWUpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHpvb21JbWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAkem9vbUltZy5kYXRhKCdvcmllbnRhdGlvbicsIHZhbHVlKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA8IDUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkaC5zZXRUcmFuc2Zvcm0oaW1nLCByKTtcclxuICAgICAgICAgICAgICAgICAgICAkaC5zZXRUcmFuc2Zvcm0oem9vbUltZywgcik7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdmFyIG9mZnNldEFuZ2xlID0gTWF0aC5hdGFuKHcgLyBoKSwgb3JpZ0ZhY3RvciA9IE1hdGguc3FydChNYXRoLnBvdyhoLCAyKSArIE1hdGgucG93KHcsIDIpKSxcclxuICAgICAgICAgICAgICAgICAgICBzY2FsZSA9ICFvcmlnRmFjdG9yID8gMSA6IChoIC8gTWF0aC5jb3MoTWF0aC5QSSAvIDIgKyBvZmZzZXRBbmdsZSkpIC8gb3JpZ0ZhY3RvcixcclxuICAgICAgICAgICAgICAgICAgICBzID0gJyBzY2FsZSgnICsgTWF0aC5hYnMoc2NhbGUpICsgJyknO1xyXG4gICAgICAgICAgICAgICAgJGguc2V0VHJhbnNmb3JtKGltZywgciArIHMpO1xyXG4gICAgICAgICAgICAgICAgJGguc2V0VHJhbnNmb3JtKHpvb21JbWcs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IHNlbGYuZm9ybWRhdGEgPSB7fTtcclxuICAgICAgICAgICAgc2VsZi51cGxvYWRDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkU3RhdHVzID0ge307XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkTG9nID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQXN5bmNDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudG90YWxJbWFnZXNDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheFJlcXVlc3RzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVCYXRjaENvbXBsZXRlZCA9IHRydWU7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5pc1ByZXZpZXdhYmxlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnNob3dQcmV2aWV3ID0gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5pc0Vycm9yID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgc2VsZi5jYW5jZWxsaW5nID0gZmFsc2U7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdDogZnVuY3Rpb24gKG9wdGlvbnMsIHJlZnJlc2hNb2RlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZiwgJGVsID0gc2VsZi4kZWxlbWVudCwgJGNvbnQsIHQsIHRtcDtcclxuICAgICAgICAgICAgc2VsZi5vcHRpb25zID0gb3B0aW9ucztcclxuICAgICAgICAgICAgJC5lYWNoKG9wdGlvbnMsIGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7XHJcbiAgICAgICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21pbkZpbGVDb3VudCc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWF4RmlsZUNvdW50JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtaW5GaWxlU2l6ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWF4RmlsZVNpemUnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21heEZpbGVQcmV2aWV3U2l6ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAncmVzaXplSW1hZ2VRdWFsaXR5JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdyZXNpemVJZlNpemVNb3JlVGhhbic6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAncHJvZ3Jlc3NVcGxvYWRUaHJlc2hvbGQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2luaXRpYWxQcmV2aWV3Q291bnQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3pvb21Nb2RhbEhlaWdodCc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWluSW1hZ2VIZWlnaHQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21heEltYWdlSGVpZ2h0JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtaW5JbWFnZVdpZHRoJzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtYXhJbWFnZVdpZHRoJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZltrZXldID0gJGguZ2V0TnVtKHZhbHVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZltrZXldID0gdmFsdWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgaWYgKHNlbGYucnRsKSB7IC8vIHN3YXAgYnV0dG9ucyBmb3IgcnRsXHJcbiAgICAgICAgICAgICAgICB0bXAgPSBzZWxmLnByZXZpZXdab29tQnV0dG9uSWNvbnMucHJldjtcclxuICAgICAgICAgICAgICAgIHNlbGYucHJldmlld1pvb21CdXR0b25JY29ucy5wcmV2ID0gc2VsZi5wcmV2aWV3Wm9vbUJ1dHRvbkljb25zLm5leHQ7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdab29tQnV0dG9uSWNvbnMubmV4dCA9IHRtcDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIXJlZnJlc2hNb2RlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhbnVwKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi4kZm9ybSA9ICRlbC5jbG9zZXN0KCdmb3JtJyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRUZW1wbGF0ZURlZmF1bHRzKCk7XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkRmlsZUF0dHIgPSAhJGguaXNFbXB0eSgkZWwuYXR0cignbmFtZScpKSA/ICRlbC5hdHRyKCduYW1lJykgOiAnZmlsZV9kYXRhJztcclxuICAgICAgICAgICAgdCA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdwcm9ncmVzcycpO1xyXG4gICAgICAgICAgICBzZWxmLnByb2dyZXNzVGVtcGxhdGUgPSB0LnJlcGxhY2UoJ3tjbGFzc30nLCBzZWxmLnByb2dyZXNzQ2xhc3MpO1xyXG4gICAgICAgICAgICBzZWxmLnByb2dyZXNzQ29tcGxldGVUZW1wbGF0ZSA9IHQucmVwbGFjZSgne2NsYXNzfScsIHNlbGYucHJvZ3Jlc3NDb21wbGV0ZUNsYXNzKTtcclxuICAgICAgICAgICAgc2VsZi5wcm9ncmV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yXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyID0gc2VsZi5fY3JlYXRlQ29udGFpbmVyKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yZWZyZXNoQ29udGFpbmVyKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGNvbnQgPSBzZWxmLiRjb250YWluZXI7XHJcbiAgICAgICAgICAgIHNlbGYuJGRyb3Bab25lID0gJGNvbnQuZmluZCgnLmZpbGUtZHJvcC16b25lJyk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByb2dyZXNzID0gJGNvbnQuZmluZCgnLmt2LXVwbG9hZC1wcm9ncmVzcycpO1xyXG4gICAgICAgICAgICBzZWxmLiRidG5VcGxvYWQgPSAkY29udC5maW5kKCcuZmlsZWlucHV0LXVwbG9hZCcpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyID0gJGguZ2V0RWxlbWVudChvcHRpb25zLCAnZWxDYXB0aW9uQ29udGFpbmVyJywgJGNvbnQuZmluZCgnLmZpbGUtY2FwdGlvbicpKTtcclxuICAgICAgICAgICAgc2VsZi4kY2FwdGlvbiA9ICRoLmdldEVsZW1lbnQob3B0aW9ucywgJ2VsQ2FwdGlvblRleHQnLCAkY29udC5maW5kKCcuZmlsZS1jYXB0aW9uLW5hbWUnKSk7XHJcbiAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShzZWxmLm1zZ1BsYWNlaG9sZGVyKSkge1xyXG4gICAgICAgICAgICAgICAgZiA9ICRlbC5hdHRyKCdtdWx0aXBsZScpID8gc2VsZi5maWxlUGx1cmFsIDogc2VsZi5maWxlU2luZ2xlO1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbi5hdHRyKCdwbGFjZWhvbGRlcicsIHNlbGYubXNnUGxhY2Vob2xkZXIucmVwbGFjZSgne2ZpbGVzfScsIGYpKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uSWNvbiA9IHNlbGYuJGNhcHRpb25Db250YWluZXIuZmluZCgnLmZpbGUtY2FwdGlvbi1pY29uJyk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByZXZpZXdDb250YWluZXIgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbFByZXZpZXdDb250YWluZXInLCAkY29udC5maW5kKCcuZmlsZS1wcmV2aWV3JykpO1xyXG4gICAgICAgICAgICBzZWxmLiRwcmV2aWV3ID0gJGguZ2V0RWxlbWVudChvcHRpb25zLCAnZWxQcmV2aWV3SW1hZ2UnLCAkY29udC5maW5kKCcuZmlsZS1wcmV2aWV3LXRodW1ibmFpbHMnKSk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByZXZpZXdTdGF0dXMgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbFByZXZpZXdTdGF0dXMnLCAkY29udC5maW5kKCcuZmlsZS1wcmV2aWV3LXN0YXR1cycpKTtcclxuICAgICAgICAgICAgc2VsZi4kZXJyb3JDb250YWluZXIgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbEVycm9yQ29udGFpbmVyJyxcclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXdDb250YWluZXIuZmluZCgnLmt2LWZpbGVpbnB1dC1lcnJvcicpKTtcclxuICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEaXNhYmxlZCgpO1xyXG4gICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoc2VsZi5tc2dFcnJvckNsYXNzKSkge1xyXG4gICAgICAgICAgICAgICAgJGguYWRkQ3NzKHNlbGYuJGVycm9yQ29udGFpbmVyLCBzZWxmLm1zZ0Vycm9yQ2xhc3MpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghcmVmcmVzaE1vZGUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGVycm9yQ29udGFpbmVyLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0luaXRJZCA9ICdwcmV2aWV3LScgKyAkaC51bmlxSWQoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3Q2FjaGUoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi4kcGFyZW50Lmhhc0NsYXNzKCdmaWxlLWxvYWRpbmcnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5pbnNlcnRCZWZvcmUoc2VsZi4kcGFyZW50KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRwYXJlbnQucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuX2Vycm9yc0V4aXN0KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fc2V0RmlsZURyb3Bab25lVGl0bGUoKTtcclxuICAgICAgICAgICAgaWYgKCRlbC5hdHRyKCdkaXNhYmxlZCcpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmRpc2FibGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9pbml0Wm9vbSgpO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5oaWRlVGh1bWJuYWlsQ29udGVudCkge1xyXG4gICAgICAgICAgICAgICAgJGguYWRkQ3NzKHNlbGYuJHByZXZpZXcsICdoaWRlLWNvbnRlbnQnKTtcclxuICAgICAgICAgICAgfV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c3M9XCJpbnB1dC1ncm91cC1idG4gaW5wdXQtZ3JvdXAtYXBwZW5kXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAge3JlbW92ZX1cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICB7Y2FuY2VsfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIHt1cGxvYWR9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAge2Jyb3dzZX1cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgICAgICAgdE1haW4yID0gJ3twcmV2aWV3fVxcbjxkaXYgY2xhc3M9XCJrdi11cGxvYWQtcHJvZ3Jlc3Mga3YtaGlkZGVuXCI+PC9kaXY+XFxuPGRpdiBjbGFzcz1cImNsZWFyZml4XCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAne3JlbW92ZX1cXG57Y2FuY2VsfVxcbnt1cGxvYWR9XFxue2Jyb3dzZX1cXG4nO1xyXG4gICAgICAgICAgICB0UHJldmlldyA9ICc8ZGl2IGNsYXNzPVwiZmlsZS1wcmV2aWV3IHtjbGFzc31cIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAge2Nsb3NlfScgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwie2Ryb3BDbGFzc31cIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtcHJldmlldy10aHVtYm5haWxzXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwiY2xlYXJmaXhcIj48L2Rpdj4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtcHJldmlldy1zdGF0dXMgdGV4dC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0bGVcIj57aGVhZGluZ308L2g1PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIDxzcGFuIGNsYXNzPVwia3Ytem9vbS10aXRsZVwiPjwvc3Bhbj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICA8ZGl2IGNsYXNzPVwia3Ytem9vbS1hY3Rpb25zXCI+e3RvZ2dsZWhlYWRlcn17ZnVsbHNjcmVlbn17Ym9yZGVybGVzc317Y2xvc2V9PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwibW9kYWwtYm9keVwiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIDxkaXYgY2xhc3M9XCJmbG9hdGluZy1idXR0b25zXCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgPGRpdiBjbGFzcz1cImt2LXpvb20tYm9keSBmaWxlLXpvb20tY29udGVudCB7em9vbUZyYW1lQ2xhc3N9XCI+PC9kaXY+XFxuJyArICd7cHJldn0ge25leHR9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+XFxuJztcclxuICAgICAgICAgICAgdFByb2dyZXNzID0gJzxkaXYgY2xhc3M9XCJwcm9ncmVzc1wiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwie2NsYXNzfVwiIHJvbGU9XCJwcm9ncmVzc2JhclwiJyArXHJcbiAgICAgICAgICAgICAgICAnIGFyaWEtdmFsdWVub3c9XCJ7cGVyY2VudH1cIiBhcmlhLXZhbHVlbWluPVwiMFwiIGFyaWEtdmFsdWVtYXg9XCIxMDBcIiBzdHlsZT1cIndpZHRoOntwZXJjZW50fSU7XCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgICB7c3RhdHVzfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgICAgICAgdFNpemUgPSAnIDxzYW1wPih7c2l6ZVRleHR9KTwvc2FtcD4nO1xyXG4gICAgICAgICAgICB0Rm9vdGVyID0gJzxkaXYgY2xhc3M9XCJmaWxlLXRodW1ibmFpbC1mb290ZXJcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtZm9vdGVyLWNhcHRpb25cIiB0aXRsZT1cIntjYXB0aW9ufVwiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgICAgPGRpdiBjbGFzcz1cImZpbGUtY2FwdGlvbi1pbmZvXCI+e2NhcHRpb259PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgICA8ZGl2IGNsYXNzPVwiZmlsZS1zaXplLWluZm9cIj57c2l6ZX08L2Rpdj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIHtwcm9ncmVzc31cXG57aW5kaWNhdG9yfVxcbnthY3Rpb25zfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzwvZGl2Pic7XHJcbiAgICAgICAgICAgIHRBY3Rpb25zID0gJzxkaXYgY2xhc3M9XCJmaWxlLWFjdGlvbnNcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtZm9vdGVyLWJ1dHRvbnNcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICAgIHtkb3dubG9hZH0ge3VwbG9hZH0ge2RlbGV0ZX0ge3pvb219IHtvdGhlcn0nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAne2RyYWd9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPGRpdiBjbGFzcz1cImNsZWFyZml4XCI+PC9kaXY+JztcclxuICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSHRtbFVua25vd25BdHRyaWJ1dGVcclxuICAgICAgICAgICAgdEFjdGlvbkRlbGV0ZSA9ICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cImt2LWZpbGUtcmVtb3ZlIHtyZW1vdmVDbGFzc31cIiAnICtcclxuICAgICAgICAgICAgICAgICd0aXRsZT1cIntyZW1vdmVUaXRsZX1cIiB7ZGF0YVVybH17ZGF0YUtleX0+e3JlbW92ZUljb259PC9idXR0b24+XFxuJztcclxuICAgICAgICAgICAgdEFjdGlvblVwbG9hZCA9ICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cImt2LWZpbGUtdXBsb2FkIHt1cGxvYWRDbGFzc31cIiB0aXRsZT1cInt1cGxvYWRUaXRsZX1cIj4nICtcclxuICAgICAgICAgICAgICAgICd7dXBsb2FkSWNvbn08L2J1dHRvbj4nO1xyXG4gICAgICAgICAgICB0QWN0aW9uRG93bmxvYWQgPSAnPGEgY2xhc3M9XCJrdi1maWxlLWRvd25sb2FkIHtkb3dubG9hZENsYXNzfVwiIHRpdGxlPVwie2Rvd25sb2FkVGl0bGV9XCIgJyArXHJcbiAgICAgICAgICAgICAgICAnaHJlZj1cIntkb3dubG9hZFVybH1cIiBkb3dubG9hZD1cIntjYXB0aW9ufVwiIHRhcmdldD1cIl9ibGFua1wiPntkb3dubG9hZEljb259PC9hPic7XHJcbiAgICAgICAgICAgIHRBY3Rpb25ab29tID0gJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwia3YtZmlsZS16b29tIHt6b29tQ2xhc3N9XCIgJyArXHJcbiAgICAgICAgICAgICAgICAndGl0bGU9XCJ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wZT1cInt0eXBlfVwiJyArIHRTdHlsZSArICc+XFxuJyArICc8cGFyYW0gbmFtZT1cIm1vdmllXCIgdmFsdWU9XCJ7Y2FwdGlvbn1cIiAvPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJGguT0JKRUNUX1BBUkFNUyArICcgJyArICRoLkRFRkFVTFRfUFJFVklFVyArICdcXG48L29iamVjdD5cXG4nO1xyXG4gICAgICAgICAgICB0T3RoZXIgPSAnPGRpdiBjbGFzcz1cImt2LXByZXZpZXctZGF0YSBmaWxlLXByZXZpZXctb3RoZXItZnJhbWVcIicgKyB0U3R5bGUgKyAnPlxcbicgKyAkaC5ERUZBVUxUX1BSRVZJRVcgKyAnXFxuPC9kaXY+XFxuJztcclxuICAgICAgICAgICAgdFpvb21DYWNoZSA9ICc8ZGl2IGNsYXNzPVwia3Ytem9vbS1jYWNoZVwiIHN0eWxlPVwiZGlzcGxheTpub25lXCI+e3pvb21Db250ZW50fTwvZGl2Pic7XHJcbiAgICAgICAgICAgIHZEZWZhdWx0RGltID0ge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9O1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5faXNQZGZSZW5kZXJlZCgpKSB7XHJcbiAgICAgICAgICAgICAgICB0UGRmID0gc2VsZi5wZGZSZW5kZXJlclRlbXBsYXRlLnJlcGxhY2UoJ3tyZW5kZXJlcn0nLCBzZWxmLl9lbmNvZGVVUkkoc2VsZi5wZGZSZW5kZXJlclVybCkpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuZGVmYXVsdHMgPSB7XHJcbiAgICAgICAgICAgICAgICBsYXlvdXRUZW1wbGF0ZXM6IHtcclxuICAgICAgICAgICAgICAgICAgICBtYWluMTogdE1haW4xLFxyXG4gICAgICAgICAgICAgICAgICAgIG1haW4yOiB0TWFpbjIsXHJcbiAgICAgICAgICAgICAgICAgICAgcHJldmlldzogdFByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAgICAgY2xvc2U6IHRDbG9zZSxcclxuICAgICAgICAgICAgICAgICAgICBmaWxlSWNvbjogdEZpbGVJY29uLFxyXG4gICAgICAgICAgICAgICAgICAgIGNhcHRpb246IHRDYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgIG1vZGFsTWFpbjogdE1vZGFsTWFpbixcclxuICAgICAgICAgICAgICAgICAgICBtb2RhbDogdE1vZGFsLFxyXG4gICAgICAgICAgICAgICAgICAgIHByb2dyZXNzOiB0UHJvZ3Jlc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgc2l6ZTogdFNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgZm9vdGVyOiB0Rm9vdGVyLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvcjogdEluZGljYXRvcixcclxuICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiB0QWN0aW9ucyxcclxuICAgICAgICAgICAgICAgICAgICBhY3Rpb25EZWxldGU6IHRBY3Rpb25EZWxldGUsXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uVXBsb2FkOiB0QWN0aW9uVXBsb2FkLFxyXG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbkRvd25sb2FkOiB0QWN0aW9uRG93bmxvYWQsXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uWm9vbTogdEFjdGlvblpvb20sXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uRHJhZzogdEFjdGlvbkRyYWcsXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuRGVmYXVsdDogdEJ0bkRlZmF1bHQsXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuTGluazogdEJ0bkxpbmssXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuQnJvd3NlOiB0QnRuQnJvd3NlLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21DYWNoZTogdFpvb21DYWNoZVxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHByZXZpZXdNYXJrdXBUYWdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQmVmb3JlMTogdFRhZ0JlZjEsXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQmVmb3JlMjogdFRhZ0JlZjIsXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQWZ0ZXI6IHRUYWdBZnRcclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3Q29udGVudFRlbXBsYXRlczoge1xyXG4gICAgICAgICAgICAgICAgICAgIGdlbmVyaWM6IHRHZW5lcmljLFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IHRIdG1sLFxyXG4gICAgICAgICAgICAgICAgICAgIGltYWdlOiB0SW1hZ2UsXHJcbiAgICAgICAgICAgICAgICAgICAgdGV4dDogdFRleHQsXHJcbiAgICAgICAgICAgICAgICAgICAgb2ZmaWNlOiB0T2ZmaWNlLFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB0R2RvY3MsXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IHRWaWRlbyxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzogdEF1ZGlvLFxyXG4gICAgICAgICAgICAgICAgICAgIGZsYXNoOiB0Rmxhc2gsXHJcbiAgICAgICAgICAgICAgICAgICAgb2JqZWN0OiB0T2JqZWN0LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogdFBkZixcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjogdE90aGVyXHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgYWxsb3dlZFByZXZpZXdUeXBlczogWydpbWFnZScsICdodG1sJywgJ3RleHQnLCAndmlkZW8nLCAnYXVkaW8nLCAnZmxhc2gnLCAncGRmJywgJ29iamVjdCddLFxyXG4gICAgICAgICAgICAgICAgcHJldmlld1RlbXBsYXRlczoge30sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3U2V0dGluZ3M6IHtcclxuICAgICAgICAgICAgICAgICAgICBpbWFnZToge3dpZHRoOiAnYXV0bycsIGhlaWdodDogJ2F1dG8nLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWF4LWhlaWdodCc6ICcxMDAlJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgaHRtbDoge3dpZHRoOiAnMjEzcHgnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBnZG9jczoge3dpZHRoOiAnMjEzcHgnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHZpZGVvOiB7d2lkdGg6ICcyMTNweCcsIGhlaWdodDogJzE2MHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgYXVkaW86IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICczMHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgZmxhc2g6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBwZGY6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIG90aGVyOiB7d2lkdGg6ICcyMTNweCcsIGhlaWdodDogJzE2MHB4J31cclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3U2V0dGluZ3NTbWFsbDoge1xyXG4gICAgICAgICAgICAgICAgICAgIGltYWdlOiB7d2lkdGg6ICdhdXRvJywgaGVpZ2h0OiAnYXV0bycsICdtYXgtd2lkdGgnOiAnMTAwJScsICdtYXgtaGVpZ2h0JzogJzEwMCUnfSxcclxuICAgICAgICAgICAgICAgICAgICBodG1sOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICB0ZXh0OiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICB2aWRlbzoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJ2F1dG8nfSxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzMwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBmbGFzaDoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJ2F1dG8nfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICdhdXRvJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgcGRmOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzE2MHB4J31cclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3Wm9vbVNldHRpbmdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICdhdXRvJywgJ21heC13aWR0aCc6ICcxMDAlJywgJ21heC1oZWlnaHQnOiAnMTAwJSd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IHZEZWZhdWx0RGltLFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IHZEZWZhdWx0RGltLFxyXG4gICAgICAgICAgICAgICAgICAgIG9mZmljZToge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzEwMCUnLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTAwJScsICdtYXgtd2lkdGgnOiAnMTAwJScsICdtaW4taGVpZ2h0JzogJzQ4MHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICcxMDAlJywgJ21heC13aWR0aCc6ICcxMDAlJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgYXVkaW86IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICczMHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgZmxhc2g6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIG9iamVjdDoge3dpZHRoOiAnYXV0bycsIGhlaWdodDogJzEwMCUnLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogdkRlZmF1bHREaW0sXHJcbiAgICAgICAgICAgICAgICAgICAgb3RoZXI6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICcxMDAlJywgJ21pbi1oZWlnaHQnOiAnNDgwcHgnfVxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIG1pbWVUeXBlQWxpYXNlczoge1xyXG4gICAgICAgICAgICAgICAgICAgICd2aWRlby9xdWlja3RpbWUnOiAndmlkZW8vbXA0J1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIGZpbGVUeXBlU2V0dGluZ3M6IHtcclxuICAgICAgICAgICAgICAgICAgICBpbWFnZTogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCRoLmNvbXBhcmUodlR5cGUsICdpbWFnZS4qJykgJiYgISRoLmNvbXBhcmUodlR5cGUsIC8odGlmZj98d21mKSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4oZ2lmfHBuZ3xqcGU/ZykkL2kpKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd0ZXh0L2h0bWwnKSB8fCAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKGh0bXxodG1sKSQvaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsIC8od29yZHxleGNlbHxwb3dlcnBvaW50fG9mZmljZSkkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKGRvY3g/fHhsc3g/fHBwdHg/fHBwc3xwb3R4PykkL2kpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgZ2RvY3M6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsIC8od29yZHxleGNlbHxwb3dlcnBvaW50fG9mZmljZXxpd29yay1wYWdlc3x0aWZmPykkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9cXC4oZG9jeD98eGxzeD98cHB0eD98cHBzfHBvdHg/fHJ0ZnxvZHN8b2R0fHBhZ2VzfGFpfGR4Znx0dGZ8dGlmZj98d21mfGU/cHMpJC9pKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd0ZXh0LionKSB8fCAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKHhtbHxqYXZhc2NyaXB0KSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4odHh0fG1kfGNzdnxuZm98aW5pfGpzb258cGhwfGpzfGNzcykkL2kpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd2aWRlby4qJykgJiYgKCRoLmNvbXBhcmUodlR5cGUsIC8ob2dnfG1wNHxtcD9nfG1vdnx3ZWJtfDNncCkkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKG9nP3xtcDR8d2VibXxtcD9nfG1vdnwzZ3ApJC9pKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGguY29tcGFyZSh2VHlwZSwgJ2F1ZGlvLionKSAmJiAoJGguY29tcGFyZSh2TmFtZSwgLyhvZ2d8bXAzfG1wP2d8d2F2KSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4ob2c/fG1wM3xtcD9nfHdhdikkL2kpKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIGZsYXNoOiBmdW5jdGlvbiAodlR5cGUsIHZOYW1lKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkaC5jb21wYXJlKHZUeXBlLCAnYXBwbGljYXRpb24veC1zaG9ja3dhdmUtZmxhc2gnLCB0cnVlKSB8fCAkaC5jb21wYXJlKHZOYW1lLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgL1xcLihzd2YpJC9pKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGguY29tcGFyZSh2VHlwZSwgJ2FwcGxpY2F0aW9uL3BkZicsIHRydWUpIHx8ICRoLmNvbXBhcmUodk5hbWUsIC9cXC4ocGRmKSQvaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZmlsZUFjdGlvblNldHRpbmdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2hvd1JlbW92ZTogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93VXBsb2FkOiB0cnVlLFxyXG4gICAgICAgICAgICAgICAgICAgIHNob3dEb3dubG9hZDogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93Wm9vbTogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93RHJhZzogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICByZW1vdmVJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXRyYXNoXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgcmVtb3ZlQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGVmYXVsdCBidG4tb3V0bGluZS1zZWNvbmRhcnknLFxyXG4gICAgICAgICAgICAgICAgICAgIHJlbW92ZUVycm9yQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGFuZ2VyJyxcclxuICAgICAgICAgICAgICAgICAgICByZW1vdmVUaXRsZTogJ1JlbW92ZSBmaWxlJyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXVwbG9hZFwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIHVwbG9hZENsYXNzOiAnYnRuIGJ0bi1zbSBidG4ta3YgYnRuLWRlZmF1bHQgYnRuLW91dGxpbmUtc2Vjb25kYXJ5JyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRUaXRsZTogJ1VwbG9hZCBmaWxlJyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRSZXRyeUljb246ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tcmVwZWF0XCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgdXBsb2FkUmV0cnlUaXRsZTogJ1JldHJ5IHVwbG9hZCcsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLWRvd25sb2FkXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRDbGFzczogJ2J0biBidG4tc20gYnRuLWt2IGJ0bi1kZWZhdWx0IGJ0bi1vdXRsaW5lLXNlY29uZGFyeScsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRUaXRsZTogJ0Rvd25sb2FkIGZpbGUnLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21JY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXpvb20taW5cIj48L2k+JyxcclxuICAgICAgICAgICAgICAgICAgICB6b29tQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGVmYXVsdCBidG4tb3V0bGluZS1zZWNvbmRhcnknLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21UaXRsZTogJ1ZpZXcgRGV0YWlscycsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ0ljb246ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tbW92ZVwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGRyYWdDbGFzczogJ3RleHQtaW5mbycsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ1RpdGxlOiAnTW92ZSAvIFJlYXJyYW5nZScsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ1NldHRpbmdzOiB7fSxcclxuICAgICAgICAgICAgICAgICAgICBpbmRpY2F0b3JOZXc6ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tcGx1cy1zaWduIHRleHQtd2FybmluZ1wiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvclN1Y2Nlc3M6ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tb2stc2lnbiB0ZXh0LXN1Y2Nlc3NcIj48L2k+JyxcclxuICAgICAgICAgICAgICAgICAgICBpbmRpY2F0b3JFcnJvcjogJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGdseXBoaWNvbi1leGNsYW1hdGlvbi1zaWduIHRleHQtZGFuZ2VyXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgaW5kaWNhdG9yTG9hZGluZzogJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGdseXBoaWNvbi1ob3VyZ2xhc3MgdGV4dC1tdXRlZFwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvck5ld1RpdGxlOiAnTm90IHVwbG9hZGVkIHlldCcsXHJcbiAgICAgICAgICAgICAgICAgICAgaW5kaWNhdG9yU3VjY2Vzc1RpdGxlOiAnVXBsb2FkZWQnLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvckVycm9yVGl0bGU6ICdVcGxvYWQgRXJyb3InLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvckxvYWRpbmdUaXRsZTogJ1VwbG9hZGluZyAuLi4nXHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICQuZWFjaChzZWxmLmRlZmF1bHRzLCBmdW5jdGlvbiAoa2V5LCBzZXR0aW5nKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSAnYWxsb3dlZFByZXZpZXdUeXBlcycpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzID0gc2V0dGluZztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZltrZXldID0gJC5leHRlbmQodHJ1ZSwge30sIHNldHRpbmcsIHNlbGZba2V5XSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0UHJldmlld1RlbXBsYXRlcygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3VGVtcGxhdGVzOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdGFncyA9IHNlbGYucHJldmlld01hcmt1cFRhZ3MsIHRhZ0JlZiwgdGFnQWZ0ID0gdGFncy50YWdBZnRlcjtcclxuICAgICAgICAgICAgJC5lYWNoKHNlbGYucHJldmlld0NvbnRlbnRUZW1wbGF0ZXMsIGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShzZWxmLnByZXZpZXdUZW1wbGF0ZXNba2V5XSkpIHtcclxuICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdzLnRhZ0JlZm9yZTI7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleSA9PT0gJ2dlbmVyaWMnIHx8IGtleSA9PT0gJ2ltYWdlJyB8fCBrZXkgPT09ICdodG1sJyB8fCBrZXkgPT09ICd0ZXh0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdzLnRhZ0JlZm9yZTE7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLl9pc1BkZlJlbmRlcmVkKCkgJiYga2V5ID09PSAncGRmJykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdCZWYucmVwbGFjZSgna3YtZmlsZS1jb250ZW50JywgJ2t2LWZpbGUtY29udGVudCBrdi1wZGYtcmVuZGVyZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3VGVtcGxhdGVzW2tleV0gPSB0YWdCZWYgKyB2YWx1ZSArIHRhZ0FmdDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFByZXZpZXdDYWNoZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlID0ge1xyXG4gICAgICAgICAgICAgICAgZGF0YToge30sXHJcbiAgICAgICAgICAgICAgICBpbml0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNvbnRlbnQgPSBzZWxmLmluaXRpYWxQcmV2aWV3O1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChjb250ZW50Lmxlbmd0aCA+IDAgJiYgISRoLmlzQXJyYXkoY29udGVudCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudCA9IGNvbnRlbnQuc3BsaXQoc2VsZi5pbml0aWFsUHJldmlld0RlbGltaXRlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZzogc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGFnczogc2VsZi5pbml0aWFsUHJldmlld1RodW1iVGFnc1xyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgY291bnQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFzZWxmLnByZXZpZXdDYWNoZS5kYXRhICYmICEhc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50ID9cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50Lmxlbmd0aCA6IDA7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoaSwgaXNEaXNhYmxlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBpbmQgPSAnaW5pdF8nICsgaSwgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmRhdGEsIGNvbmZpZyA9IGRhdGEuY29uZmlnW2ldLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50ID0gZGF0YS5jb250ZW50W2ldLCBwcmV2aWV3SWQgPSBzZWxmLnByZXZpZXdJbml0SWQgKyAnLScgKyBpbmQsIG91dCwgJHRtcCwgY2F0LCBmdHIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZuYW1lLCBmdHlwZSwgZnJhbWVDbGFzcywgYXNEYXRhID0gJGguaWZTZXQoJ3ByZXZpZXdBc0RhdGEnLCBjb25maWcsIHNlbGYuaW5pdGlhbFByZXZpZXdBc0RhdGEpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBhID0gY29uZmlnID8ge3RpdGxlOiBjb25maWcudGl0bGUgfHwgbnVsbCwgYWx0OiBjb25maWcuYWx0IHx8IG51bGx9IDoge3RpdGxlOiBudWxsLCBhbHQ6IG51bGx9LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJzZVRlbXBsYXRlID0gZnVuY3Rpb24gKGNhdCwgZGF0LCBmbiwgZnQsIGlkLCBmdHIsIGluZCwgZmMsIHQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZjID0gJyBmaWxlLXByZXZpZXctaW5pdGlhbCAnICsgJGguU09SVF9DU1MgKyAoZmMgPyAnICcgKyBmYyA6ICcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzZWxmLl9nZW5lcmF0ZVByZXZpZXdUZW1wbGF0ZShjYXQsIGRhdCwgZm4sIGZ0LCBpZCwgZmFsc2UsIG51bGwsIGZjLCBmdHIsIGluZCwgdCwgYSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFjb250ZW50KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaXNEaXNhYmxlZCA9IGlzRGlzYWJsZWQgPT09IHVuZGVmaW5lZCA/IHRydWUgOiBpc0Rpc2FibGVkO1xyXG4gICAgICAgICAgICAgICAgICAgIGNhdCA9ICRoLmlmU2V0KCd0eXBlJywgY29uZmlnLCBzZWxmLmluaXRpYWxQcmV2aWV3RmlsZVR5cGUgfHwgJ2dlbmVyaWMnKTtcclxuICAgICAgICAgICAgICAgICAgICBmbmFtZSA9ICRoLmlmU2V0KCdmaWxlbmFtZScsIGNvbmZpZywgJGguaWZTZXQoJ2NhcHRpb24nLCBjb25maWcpKTtcclxuICAgICAgICAgICAgICAgICAgICBmdHlwZSA9ICRoLmlmU2V0KCdmaWxldHlwZScsIGNvbmZpZywgY2F0KTtcclxuICAgICAgICAgICAgICAgICAgICBmdHIgPSBzZWxmLnByZXZpZXdDYWNoZS5mb290ZXIoaSwgaXNEaXNhYmxlZCwgKGNvbmZpZyAmJiBjb25maWcuc2l6ZSB8fCBudWxsKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgZnJhbWVDbGFzcyA9ICRoLmlmU2V0KCdmcmFtZUNsYXNzJywgY29uZmlnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoYXNEYXRhKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9IHBhcnNlVGVtcGxhdGUoY2F0LCBjb250ZW50LCBmbmFtZSwgZnR5cGUsIHByZXZpZXdJZCwgZnRyLCBpbmQsIGZyYW1lQ2xhc3MpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9IHBhcnNlVGVtcGxhdGUoJ2dlbmVyaWMnLCBjb250ZW50LCBmbmFtZSwgZnR5cGUsIHByZXZpZXdJZCwgZnRyLCBpbmQsIGZyYW1lQ2xhc3MsIGNhdClcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRUb2tlbnMoeydjb250ZW50JzogZGF0YS5jb250ZW50W2ldfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLnRhZ3MubGVuZ3RoICYmIGRhdGEudGFnc1tpXSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSAkaC5yZXBsYWNlVGFncyhvdXQsIGRhdGEudGFnc1tpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIGNvbmZpZy5mcmFtZUF0dHIgKi9cclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoY29uZmlnKSAmJiAhJGguaXNFbXB0eShjb25maWcuZnJhbWVBdHRyKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSkuaHRtbChvdXQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wLmZpbmQoJy5maWxlLXByZXZpZXctaW5pdGlhbCcpLmF0dHIoY29uZmlnLmZyYW1lQXR0cik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9ICR0bXAuaHRtbCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIGFkZDogZnVuY3Rpb24gKGNvbnRlbnQsIGNvbmZpZywgdGFncywgYXBwZW5kKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRhdGEgPSBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLCBpbmRleDtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzQXJyYXkoY29udGVudCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudCA9IGNvbnRlbnQuc3BsaXQoc2VsZi5pbml0aWFsUHJldmlld0RlbGltaXRlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhcHBlbmQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBkYXRhLmNvbnRlbnQucHVzaChjb250ZW50KSAtIDE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnW2luZGV4XSA9IGNvbmZpZztcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS50YWdzW2luZGV4XSA9IHRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBjb250ZW50Lmxlbmd0aCAtIDE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29udGVudCA9IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnID0gY29uZmlnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLnRhZ3MgPSB0YWdzO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhID0gZGF0YTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXg7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoY29udGVudCwgY29uZmlnLCB0YWdzLCBhcHBlbmQpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmRhdGEsIGksIGNoaztcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWNvbnRlbnQgfHwgIWNvbnRlbnQubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCEkaC5pc0FycmF5KGNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQgPSBjb250ZW50LnNwbGl0KHNlbGYuaW5pdGlhbFByZXZpZXdEZWxpbWl0ZXIpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBjaGsgPSBjb250ZW50LmZpbHRlcihmdW5jdGlvbiAobikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAhPT0gbnVsbDtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWNoay5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5jb250ZW50ID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb250ZW50ID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmNvbmZpZyA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLnRhZ3MgPT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLnRhZ3MgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGFwcGVuZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29udGVudC5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRlbnRbaV0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhLmNvbnRlbnQucHVzaChjb250ZW50W2ldKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29uZmlnLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29uZmlnW2ldKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWcucHVzaChjb25maWdbaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCB0YWdzLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGFnc1tpXSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudGFncy5wdXNoKHRhZ3NbaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb250ZW50ID0gY29udGVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWcgPSBjb25maWc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudGFncyA9IHRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSBkYXRhO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHVuc2V0OiBmdW5jdGlvbiAoaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgY2hrID0gc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSwgcmV2ID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghY2hrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNoayA9PT0gMSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLmNvbnRlbnQgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb25maWcgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS50YWdzID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXcgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50ID0gJGguc3BsaWNlQXJyYXkoc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50LCBpbmRleCwgcmV2KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLmNvbmZpZyA9ICRoLnNwbGljZUFycmF5KHNlbGYucHJldmlld0NhY2hlLmRhdGEuY29uZmlnLCBpbmRleCwgcmV2KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLnRhZ3MgPSAkaC5zcGxpY2VBcnJheShzZWxmLnByZXZpZXdDYWNoZS5kYXRhLnRhZ3MsIGluZGV4LCByZXYpO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIG91dDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBodG1sID0gJycsIGNhcHRpb24sIGxlbiA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCksIGksIGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxlbiA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge2NvbnRlbnQ6ICcnLCBjYXB0aW9uOiAnJ307XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50ID0gc2VsZi5wcmV2aWV3Q2FjaGUuZ2V0KGkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBodG1sID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyID8gKGNvbnRlbnQgKyBodG1sKSA6IChodG1sICsgY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNhcHRpb24gPSBzZWxmLl9nZXRNc2dTZWxlY3RlZChsZW4pO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7Y29udGVudDogaHRtbCwgY2FwdGlvbjogY2FwdGlvbn07XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZm9vdGVyOiBmdW5jdGlvbiAoaSwgaXNEaXNhYmxlZCwgc2l6ZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBkYXRhID0gc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YSB8fCB7fTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhLmNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCRoLmlzRW1wdHkoZGF0YS5jb25maWcpIHx8ICRoLmlzRW1wdHkoZGF0YS5jb25maWdbaV0pKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnW2ldID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlzRGlzYWJsZWQgPSBpc0Rpc2FibGVkID09PSB1bmRlZmluZWQgPyB0cnVlIDogaXNEaXNhYmxlZDtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgY29uZmlnID0gZGF0YS5jb25maWdbaV0sIGNhcHRpb24gPSAkaC5pZlNldCgnY2FwdGlvbicsIGNvbmZpZyksIGEsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoID0gJGguaWZTZXQoJ3dpZHRoJywgY29uZmlnLCAnYXV0bycpLCB1cmwgPSAkaC5pZlNldCgndXJsJywgY29uZmlnLCBmYWxzZSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGtleSA9ICRoLmlmU2V0KCdrZXknLCBjb25maWcsIG51bGwpLCBmcyA9IHNlbGYuZmlsZUFjdGlvblNldHRpbmdzLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0UHJldmlld1Nob3dEZWwgPSBzZWxmLmluaXRpYWxQcmV2aWV3U2hvd0RlbGV0ZSB8fCBmYWxzZSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgZFVybCA9IGNvbmZpZy5kb3dubG9hZFVybCB8fCBzZWxmLmluaXRpYWxQcmV2aWV3RG93bmxvYWRVcmwgfHwgJycsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRGaWwgPSBjb25maWcuZmlsZW5hbWUgfHwgY29uZmlnLmNhcHRpb24gfHwgJycsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRQcmV2aWV3U2hvd0R3bCA9ICEhKGRVcmwpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRGVsID0gJGguaWZTZXQoJ3Nob3dSZW1vdmUnLCBjb25maWcsICRoLmlmU2V0KCdzaG93UmVtb3ZlJywgZnMsIGluaXRQcmV2aWV3U2hvd0RlbCkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRHdsID0gJGguaWZTZXQoJ3Nob3dEb3dubG9hZCcsIGNvbmZpZywgJGguaWZTZXQoJ3Nob3dEb3dubG9hZCcsIGZzLCBpbml0UHJldmlld1Nob3dEd2wpKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgc1ptID0gJGguaWZTZXQoJ3Nob3dab29tJywgY29uZmlnLCAkaC5pZlNldCgnc2hvd1pvb20nLCBmcywgdHJ1ZSkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRHJnID0gJGguaWZTZXQoJ3Nob3dEcmFnJywgY29uZmlnLCAkaC5pZlNldCgnc2hvd0RyYWcnLCBmcywgdHJ1ZSkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXMgPSAodXJsID09PSBmYWxzZSkgJiYgaXNEaXNhYmxlZDtcclxuICAgICAgICAgICAgICAgICAgICBzRHdsID0gc0R3bCAmJiBjb25maWcuZG93bmxvYWRVcmwgIT09IGZhbHNlICYmICEhZFVybDtcclxuICAgICAgICAgICAgICAgICAgICBhID0gc2VsZi5fcmVuZGVyRmlsZUFjdGlvbnMoZmFsc2UsIHNEd2wsIHNEZWwsIHNabSwgc0RyZywgZGlzLCB1cmwsIGtleSwgdHJ1ZSwgZFVybCwgZEZpbCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdmb290ZXInKS5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnOiBzZWxmLl9yZW5kZXJUaHVtYlByb2dyZXNzKCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdhY3Rpb25zJzogYSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ2NhcHRpb24nOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IHNlbGYuX2dldFNpemUoc2l6ZSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICd3aWR0aCc6IHdpZHRoLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnaW5kaWNhdG9yJzogJydcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuaW5pdCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2lzUGRmUmVuZG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nO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9ICdib290c3RyYXAtZmlsZWlucHV0OiAnICsgbXNnO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIHdpbmRvdy5jb25zb2xlLmxvZyAhPT0gJ3VuZGVmaW5lZCcpIHtcclxuICAgICAgICAgICAgICAgIHdpbmRvdy5jb25zb2xlLmxvZyhtc2cpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgd2luZG93LmFsZXJ0KG1zZyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHN0YXR1cyA9IHNlbGYuJGVsZW1lbnQuYXR0cigndHlwZScpID09PSAnZmlsZSc7XHJcbiAgICAgICAgICAgIGlmICghc3RhdHVzKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9sb2coJ1RoZSBpbnB1dCBcInR5cGVcIiBtdXN0IGJlIHNldCB0byBcImZpbGVcIiBmb3IgaW5pdGlhbGl6aW5nIHRoZSBcImJvb3RzdHJhcC1maWxlaW5wdXRcIiBwbHVnaW4uJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHN0YXR1cztcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9lcnJvcnNFeGlzdDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnIsICRlcnJMaXN0ID0gc2VsZi4kZXJyb3JDb250YWluZXIuZmluZCgnbGknKTtcclxuICAgICAgICAgICAgaWYgKCRlcnJMaXN0Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGVyciA9ICQoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2JykpLmh0bWwoc2VsZi4kZXJyb3JDb250YWluZXIuaHRtbCgpKTtcclxuICAgICAgICAgICAgJGVyci5maW5kKCcua3YtZXJyb3ItY2xvc2UnKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgJGVyci5maW5kKCd1bCcpLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICByZXR1cm4gISEkLnRyaW0oJGVyci50ZXh0KCkpLmxlbmd0aDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9lcnJvckhhbmRsZXI6IGZ1bmN0aW9uIChldnQsIGNhcHRpb24pIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlcnIgPSBldnQudGFyZ2V0LmVycm9yLCBzaG93RXJyb3IgPSBmdW5jdGlvbiAobXNnKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93RXJyb3IobXNnLnJlcGxhY2UoJ3tuYW1lfScsIGNhcHRpb24pKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZXJyLk5PVF9GT1VORF9FUlIgKi9cclxuICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZXJyLlNFQ1VSSVRZX0VSUiAqL1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBlcnIuTk9UX1JFQURBQkxFX0VSUiAqL1xyXG4gICAgICAgICAgICBpZiAoZXJyLmNvZGUgPT09IGVyci5OT1RfRk9VTkRfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICBzaG93RXJyb3Ioc2VsZi5tc2dGaWxlTm90Rm91bmQpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKGVyci5jb2RlID09PSBlcnIuU0VDVVJJVFlfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2hvd0Vycm9yKHNlbGYubXNnRmlsZVNlY3VyZWQpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoZXJyLmNvZGUgPT09IGVyci5OT1RfUkVBREFCTEVfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNob3dFcnJvcihzZWxmLm1zZ0ZpbGVOb3RSZWFkYWJsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVyci5jb2RlID09PSBlcnIuQUJPUlRfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG93RXJyb3Ioc2VsZi5tc2dGaWxlUHJldmlld0Fib3J0ZWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvd0Vycm9yKHNlbGYubXNnRmlsZVByZXZpZXdFcnJvcik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9hZGRFcnJvcjogZnVuY3Rpb24gKG1zZykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnJvciA9IHNlbGYuJGVycm9yQ29udGFpbmVyO1xyXG4gICAgICAgICAgICBpZiAobXNnICYmICRlcnJvci5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRlcnJvci5odG1sKHNlbGYuZXJyb3JDbG9zZUJ1dHRvbiArIG1zZyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRlcnJvci5maW5kKCcua3YtZXJyb3ItY2xvc2UnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldyAmJiAhc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuY2xlYXIoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZXJyb3IuZmFkZU91dCgnc2xvdycpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sIDEwKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2V0VmFsaWRhdGlvbkVycm9yOiBmdW5jdGlvbiAoY3NzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgY3NzID0gKGNzcyA/IGNzcyArICcgJyA6ICcnKSArICdoYXMtZXJyb3InO1xyXG4gICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoY3NzKS5hZGRDbGFzcygnaGFzLWVycm9yJyk7XHJcbiAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjYXB0aW9uQ29udGFpbmVyLCAnaXMtaW52YWxpZCcpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0RXJyb3JzOiBmdW5jdGlvbiAoZmFkZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnJvciA9IHNlbGYuJGVycm9yQ29udGFpbmVyO1xyXG4gICAgICAgICAgICBzZWxmLmlzRXJyb3IgPSBmYWxzZTtcclxuICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLnJlbW92ZUNsYXNzKCdoYXMtZXJyb3InKTtcclxuICAgICAgICAgICAgc2VsZi4kY2FwdGlvbkNvbnRhaW5lci5yZW1vdmVDbGFzcygnaXMtaW52YWxpZCcpO1xyXG4gICAgICAgICAgICAkZXJyb3IuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgIGlmIChmYWRlKSB7XHJcbiAgICAgICAgICAgICAgICAkZXJyb3IuZmFkZU91dCgnc2xvdycpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJGVycm9yLmhpZGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Nob3dGb2xkZXJFcnJvcjogZnVuY3Rpb24gKGZvbGRlcnMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZXJyb3IgPSBzZWxmLiRlcnJvckNvbnRhaW5lciwgbXNnO1xyXG4gICAgICAgICAgICBpZiAoIWZvbGRlcnMpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9IHNlbGYubXNnRm9sZGVyc05vdEFsbG93ZWQucmVwbGFjZSgne259JywgZm9sZGVycyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2FkZEVycm9yKG1zZyk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFZhbGlkYXRpb25FcnJvcigpO1xyXG4gICAgICAgICAgICAkZXJyb3IuZmFkZUluKDgwMCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlZm9sZGVyZXJyb3InLCBbZm9sZGVycywgbXNnXSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2hvd1VwbG9hZEVycm9yOiBmdW5jdGlvbiAobXNnLCBwYXJhbXMsIGV2ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVycm9yID0gc2VsZi4kZXJyb3JDb250YWluZXIsIGV2ID0gZXZlbnQgfHwgJ2ZpbGV1cGxvYWRlcnJvcicsIGUgPSBwYXJhbXMgJiYgcGFyYW1zLmlkID9cclxuICAgICAgICAgICAgICAgICc8bGkgZGF0YS10aHVtYi1pZD1cIicgKyBwYXJhbXMuaWQgKyAnXCI+JyArIG1zZyArICc8L2xpPicgOiAnPGxpPicgKyBtc2cgKyAnPC9saT4nO1xyXG4gICAgICAgICAgICBpZiAoJGVycm9yLmZpbmQoJ3VsJykubGVuZ3RoID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9hZGRFcnJvcignPHVsPicgKyBlICsgJzwvdWw+Jyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAkZXJyb3IuZmluZCgndWwnKS5hcHBlbmQoZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGVycm9yLmZhZGVJbig4MDApO1xyXG4gICAgICAgICAgICBzZWxmLl9yYWlzZShldiwgW3BhcmFtcywgbXNnXSk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFZhbGlkYXRpb25FcnJvcignZmlsZS1pbnB1dC1uZXcnKTtcclxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2hvd0Vycm9yOiBmdW5jdGlvbiAobXNnLCBwYXJhbXMsIGV2ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVycm9yID0gc2VsZi4kZXJyb3JDb250YWluZXIsIGV2ID0gZXZlbnQgfHwgJ2ZpbGVlcnJvcic7XHJcbiAgICAgICAgICAgIHBhcmFtcyA9IHBhcmFtcyB8fCB7fTtcclxuICAgICAgICAgICAgcGFyYW1zLnJlYWRlciA9IHNlbGYucmVhZGVyO1xyXG4gICAgICAgICAgICBzZWxmLl9hZGRFcnJvcihtc2cpO1xyXG4gICAgICAgICAgICAkZXJyb3IuZmFkZUluKDgwMCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKGV2LCBbcGFyYW1zLCBtc2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WRhdGlvbkVycm9yKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcGFyc2VFcnJvcjogZnVuY3Rpb24gKG9wZXJhdGlvbiwganFYSFIsIGVycm9yVGhyb3duLCBmaWxlTmFtZSkge1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBqcVhIUi5yZXNwb25zZUpTT04gKi9cclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlcnJNc2cgPSAkLnRyaW0oZXJyb3JUaHJvd24gKyAnJyksIHRleHRQcmUsXHJcbiAgICAgICAgICAgICAgICB0ZXh0ID0ganFYSFIucmVzcG9uc2VKU09OICE9PSB1bmRlZmluZWQgJiYganFYSFIucmVzcG9uc2VKU09OLmVycm9yICE9PSB1bmRlZmluZWQgP1xyXG4gICAgICAgICAgICAgICAgICAgIGpxWEhSLnJlc3BvbnNlSlNPTi5lcnJvciA6IGpxWEhSLnJlc3BvbnNlVGV4dDtcclxuICAgICAgICAgICAgaWYgKHNlbGYuY2FuY2VsbGluZyAmJiBzZWxmLm1zZ1VwbG9hZEFib3J0ZWQpIHtcclxuICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYubXNnVXBsb2FkQWJvcnRlZDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93QWpheEVycm9yRGV0YWlscyAmJiB0ZXh0KSB7XHJcbiAgICAgICAgICAgICAgICB0ZXh0ID0gJC50cmltKHRleHQucmVwbGFjZSgvXFxuXFxzKlxcbi9nLCAnXFxuJykpO1xyXG4gICAgICAgICAgICAgICAgdGV4dFByZSA9IHRleHQubGVuZ3RoID8gJzxwcmU+JyArIHRleHQgKyAnPC9wcmU+JyA6ICcnO1xyXG4gICAgICAgICAgICAgICAgZXJyTXNnICs9IGVyck1zZyA/IHRleHRQcmUgOiB0ZXh0O1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghZXJyTXNnKSB7XHJcbiAgICAgICAgICAgICAgICBlcnJNc2cgPSBzZWxmLm1zZ0FqYXhFcnJvci5yZXBsYWNlKCd7b3BlcmF0aW9ufScsIG9wZXJhdGlvbik7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5jYW5jZWxsaW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHJldHVybiBmaWxlTmFtZSA/ICc8Yj4nICsgZmlsZU5hbWUgKyAnOiA8L2I+JyArIGVyck1zZyA6IGVyck1zZztcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9wYXJzZUZpbGVUeXBlOiBmdW5jdGlvbiAodHlwZSwgbmFtZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGlzVmFsaWQsIHZUeXBlLCBjYXQsIGksIHR5cGVzID0gc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzIHx8IFtdO1xyXG4gICAgICAgICAgICBpZiAodHlwZSA9PT0gJ2FwcGxpY2F0aW9uL3RleHQtcGxhaW4nKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RleHQnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCB0eXBlcy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY2F0ID0gdHlwZXNbaV07XHJcbiAgICAgICAgICAgICAgICBpc1ZhbGlkID0gc2VsZi5maWxlVHlwZVNldHRpbmdzW2NhdF07XHJcbiAgICAgICAgICAgICAgICB2VHlwZSA9IGlzVmFsaWQodHlwZSwgbmFtZSkgPyBjYXQgOiAnJztcclxuICAgICAgICAgICAgICAgIGlmICghJGguaXNFbXB0eSh2VHlwZSkpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlR5cGU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICdvdGhlcic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0UHJldmlld0ljb246IGZ1bmN0aW9uIChmbmFtZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGV4dCwgb3V0ID0gbnVsbDtcclxuICAgICAgICAgICAgaWYgKGZuYW1lICYmIGZuYW1lLmluZGV4T2YoJy4nKSA+IC0xKSB7XHJcbiAgICAgICAgICAgICAgICBleHQgPSBmbmFtZS5zcGxpdCgnLicpLnBvcCgpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYucHJldmlld0ZpbGVJY29uU2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2V4dF0gfHwgc2VsZi5wcmV2aWV3RmlsZUljb25TZXR0aW5nc1tleHQudG9Mb3dlckNhc2UoKV0gfHwgbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLnByZXZpZXdGaWxlRXh0U2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgICAgICAkLmVhY2goc2VsZi5wcmV2aWV3RmlsZUV4dFNldHRpbmdzLCBmdW5jdGlvbiAoa2V5LCBmdW5jKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2tleV0gJiYgZnVuYyhleHQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2tleV07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBVbm5lY2Vzc2FyeVJldHVyblN0YXRlbWVudEpTXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3BhcnNlRmlsZVByZXZpZXdJY29uOiBmdW5jdGlvbiAoY29udGVudCwgZm5hbWUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpY24gPSBzZWxmLl9nZXRQcmV2aWV3SWNvbihmbmFtZSkgfHwgc2VsZi5wcmV2aWV3RmlsZUljb24sIG91dCA9IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgIGlmIChvdXQuaW5kZXhPZigne3ByZXZpZXdGaWxlSWNvbn0nKSA+IC0xKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBvdXQuc2V0VG9rZW5zKHsncHJldmlld0ZpbGVJY29uQ2xhc3MnOiBzZWxmLnByZXZpZXdGaWxlSWNvbkNsYXNzLCAncHJldmlld0ZpbGVJY29uJzogaWNufSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yYWlzZTogZnVuY3Rpb24gKGV2ZW50LCBwYXJhbXMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlID0gJC5FdmVudChldmVudCk7XHJcbiAgICAgICAgICAgIGlmIChwYXJhbXMgIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kZWxlbWVudC50cmlnZ2VyKGUsIHBhcmFtcyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRlbGVtZW50LnRyaWdnZXIoZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGUuaXNEZWZhdWx0UHJldmVudGVkKCkgfHwgZS5yZXN1bHQgPT09IGZhbHNlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc3dpdGNoIChldmVudCkge1xyXG4gICAgICAgICAgICAgICAgLy8gaWdub3JlIHRoZXNlIGV2ZW50c1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWJhdGNodXBsb2FkY29tcGxldGUnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWJhdGNodXBsb2Fkc3VjY2Vzcyc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxldXBsb2FkZWQnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWNsZWFyJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVjbGVhcmVkJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVyZXNldCc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlZXJyb3InOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWZvbGRlcmVycm9yJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGV1cGxvYWRlcnJvcic6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlYmF0Y2h1cGxvYWRlcnJvcic6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlZGVsZXRlZXJyb3InOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWN1c3RvbWVycm9yJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVzdWNjZXNzcmVtb3ZlJzpcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIC8vIHJlY2VpdmUgZGF0YSByZXNwb25zZSB2aWEgYGZpbGVjdXN0b21lcnJvcmAgZXZlbnRgXHJcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5hamF4QWJvcnRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZS5yZXN1bHQ7XHJcbiAgICA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AgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJGJ0bkJvcmQuYWRkQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICd0cnVlJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCRtb2RhbC5oYXNDbGFzcygnZmlsZS16b29tLWZ1bGxzY3JlZW4nKSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaXNGdWxsU2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICRidG5Cb3JkLnJlbW92ZUNsYXNzKCdhY3RpdmUnKS5hdHRyKCdhcmlhLXByZXNzZWQnLCAnZmFsc2UnKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2xpc3RlbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlbCA9IHNlbGYuJGVsZW1lbnQsICRmb3JtID0gc2VsZi4kZm9ybSwgJGNvbnQgPSBzZWxmLiRjb250YWluZXIsIGZ1bGxTY3JlZW5FdmVudHM7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2xpY2snLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCRlbC5oYXNDbGFzcygnZmlsZS1uby1icm93c2UnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZWwuZGF0YSgnem9uZUNsaWNrZWQnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZWwuZGF0YSgnem9uZUNsaWNrZWQnLCBmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2hhbmdlJywgJC5wcm94eShzZWxmLl9jaGFuZ2UsIHNlbGYpKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0Jyb3dzZSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcihzZWxmLiRidG5GaWxlLCAnY2xpY2snLCAkLnByb3h5KHNlbGYuX2Jyb3dzZSwgc2VsZikpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGNvbnQuZmluZCgnLmZpbGVpbnB1dC1yZW1vdmU6bm90KFtkaXNhYmxlZF0pJyksICdjbGljaycsICQucHJveHkoc2VsZi5jbGVhciwgc2VsZikpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRjb250LmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJyksICdjbGljaycsICQucHJveHkoc2VsZi5jYW5jZWwsIHNlbGYpKTtcclxuICAgICAgICAgICAgc2VsZi5faW5pdERyYWdEcm9wKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGZvcm0sICdyZXNldCcsICQucHJveHkoc2VsZi5jbGVhciwgc2VsZikpO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRmb3JtLCAnc3VibWl0JywgJC5wcm94eShzZWxmLl9zdWJtaXRGb3JtLCBzZWxmKSk7XHJcbiAgICAgICAgICAgIH1cclxuICAg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2xpZW50V2lkdGggfHwgZG9jdW1lbnQuYm9keS5jbGllbnRXaWR0aCxcclxuICAgICAgICAgICAgICAgIHNlbGYgPSB0aGlzLCBjb25maWcgPSB3aWR0aCA8IDQwMCA/IChzZWxmLnByZXZpZXdTZXR0aW5nc1NtYWxsIHx8IHNlbGYuZGVmYXVsdHMucHJldmlld1NldHRpbmdzU21hbGwpIDpcclxuICAgICAgICAgICAgICAgIChzZWxmLnByZXZpZXdTZXR0aW5ncyB8fCBzZWxmLmRlZmF1bHRzLnByZXZpZXdTZXR0aW5ncyksIHNlbDtcclxuICAgICAgICAgICAgJC5lYWNoKGNvbmZpZywgZnVuY3Rpb24gKGNhdCwgc2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgIHNlbCA9ICcuZmlsZS1wcmV2aWV3LWZyYW1lIC5maWxlLXByZXZpZXctJyArIGNhdDtcclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuZmluZChzZWwgKyAnLmt2LXByZXZpZXctZGF0YSwnICsgc2VsICsgJyAua3YtcHJldmlldy1kYXRhJykuY3NzKHNldHRpbmdzKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2NhbkRyb3BwZWRJdGVtczogZnVuY3Rpb24gKGl0ZW0sIGZpbGVzLCBwYXRoKSB7XHJcbiAgICAgICAgICAgIHBhdGggPSBwYXRoIHx8ICcnO1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGksIGRpclJlYWRlciwgcmVhZERpciwgZXJyb3JIYW5kbGVyID0gZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZygnRXJyb3Igc2Nhbm5pbmcgZHJvcHBlZCBmaWxlcyEnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZyhlKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgaWYgKGl0ZW0uaXNGaWxlKSB7XHJcbiAgICAgICAgICAgICAgICBpdGVtLmZpbGUoZnVuY3Rpb24gKGZpbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlcy5wdXNoKGZpbGUpO1xyXG4gICAgICAgICAgICAgICAgfSwgZXJyb3JIYW5kbGVyKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmIChpdGVtLmlzRGlyZWN0b3J5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZGlyUmVhZGVyID0gaXRlbS5jcmVhdGVSZWFkZXIoKTtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRGlyID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXJSZWFkZXIucmVhZEVudHJpZXMoZnVuY3Rpb24gKGVudHJpZXMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbnRyaWVzICYmIGVudHJpZXMubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBlbnRyaWVzLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NjYW5Ecm9wcGVkSXRlbXMoZW50cmllc1tpXSwgZmlsZXMsIHBhdGggKyBpdGVtLm5hbWUgKyAnLycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZWN1cnNpdmVseSBjYWxsIHJlYWREaXIoKSBhZ2Fpbiwgc2luY2UgYnJvd3NlciBjYW4gb25seSBoYW5kbGUgZmlyc3QgMTAwIGVudHJpZXMuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZERpcigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVycm9ySGFuZGxlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRGlyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdERyYWdEcm9wOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJHpvbmUgPSBzZWxmLiRkcm9wWm9uZTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuZHJvcFpvbmVFbmFibGVkICYmIHNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHpvbmUsICdkcmFnZW50ZXIgZHJhZ292ZXInLCAkLnByb3h5KHNlbGYuX3pvbmVEcmFnRW50ZXIsIHNlbGYpKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHpvbmUsICdkcmFnbGVhdmUnLCAkLnByb3h5KHNlbGYuX3pvbmVEcmFnTGVhdmUsIHNlbGYpKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHpvbmUsICdkcm9wJywgJC5wcm94eShzZWxmLl96b25lRHJvcCwgc2VsZikpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkKGRvY3VtZW50KSwgJ2RyYWdlbnRlciBkcmFnb3ZlciBkcm9wJywgc2VsZi5fem9uZURyYWdEcm9wSW5pdCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF96b25lRHJhZ0Ryb3BJbml0OiBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xyXG4gICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfem9u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ICAgICAgICAgICAgICAgICAgICRlbC50cmlnZ2VyKCdjaGFuZ2UnICsgc2VsZi5uYW1lc3BhY2UpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2hhbmdlKGUsIGZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kZHJvcFpvbmUucmVtb3ZlQ2xhc3MoJ2ZpbGUtaGlnaGxpZ2h0ZWQnKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNEaXNhYmxlZCB8fCAkaC5pc0VtcHR5KGZpbGVzKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVEcmFnRHJvcCcsIHsnc291cmNlRXZlbnQnOiBlLCAnZmlsZXMnOiBmaWxlc30pKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGZvbGRlcnMgPiAwKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd0ZvbGRlckVycm9yKGZvbGRlcnMpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGZpbGVzID0gW107XHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaXRlbXMubGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgaXRlbSA9IGl0ZW1zW2ldLndlYmtpdEdldEFzRW50cnkoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zY2FuRHJvcHBlZEl0ZW1zKGl0ZW0sIGZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzRmlsZXMoKTtcclxuICAgICAgICAgICAgICAgIH0sIDUwMCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBwcm9jZXNzRmlsZXMoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwbG9hZENsaWNrOiBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRidG4gPSBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC11cGxvYWQnKSwgJGZvcm0sXHJcbiAgICAgICAgICAgICAgICBpc0VuYWJsZWQgPSAhJGJ0bi5oYXNDbGFzcygnZGlzYWJsZWQnKSAmJiAkaC5pc0VtcHR5KCRidG4uYXR0cignZGlzYWJsZWQnKSk7XHJcbiAgICAgICAgICAgIGlmIChlICYmIGUuaXNEZWZhdWx0UHJldmVudGVkKCkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaXNFbmFibGVkICYmICRidG4uYXR0cigndHlwZScpICE9PSAnc3VibWl0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgICRmb3JtID0gJGJ0bi5jbG9zZXN0KCdmb3JtJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy8gZG93bmdyYWRlIHRvIG5vcm1hbCBmb3JtIHN1Ym1pdCBpZiBwb3NzaWJsZVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZm9ybS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGZvcm0udHJpZ2dlcignc3VibWl0Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XHJcbiAgICAgICAgICAgIGlmIChpc0VuYWJsZWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zdWJtaXRGb3JtOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2lzRmlsZVNlbGVjdGlvblZhbGlkKCkgJiYgIXNlbGYuX2Fib3J0KHt9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jbGVhclByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkcCA9IHNlbGYuJHByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAkdGh1bWJzID0gc2VsZi5zaG93VXBsb2FkZWRUaHVtYnMgPyBzZWxmLmdldEZyYW1lcygnOm5vdCguZmlsZS1wcmV2aWV3LXN1Y2Nlc3MpJykgOiBzZWxmLmdldEZyYW1lcygpO1xyXG4gICAgICAgICAgICAkdGh1bWJzLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyk7XHJcbiAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAkaC5jbGVhblpvb21DYWNoZSgkcC5maW5kKCcjem9vbS0nICsgJHRodW1iLmF0dHIoJ2lkJykpKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGggfHwgIXNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0VXBsb2FkKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEZWZhdWx0UHJldmlldygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRTb3J0YWJsZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlbCA9IHNlbGYuJHByZXZpZXcsIHNldHRpbmdzLCBzZWxlY3RvciA9ICcuJyArICRoLlNPUlRfQ1NTLFxyXG4gICAgICAgICAgICAgICAgcmV2ID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyO1xyXG4gICAgICAgICAgICBpZiAoIXdpbmRvdy5LdlNvcnRhYmxlIHx8ICRlbC5maW5kKHNlbGVjdG9yKS5sZW5ndGggPT09IDApIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBKU1VudXNlZEdsb2JhbFN5bWJvbHNcclxuICAgICAgICAgICAgc2V0dGluZ3MgPSB7XHJcbiAgICAgICAgICAgICAgICBoYW5kbGU6ICcuZHJhZy1oYW5kbGUtaW5pdCcsXHJcbiAgICAgICAgICAgICAgICBkYXRhSWRBdHRyOiAnZGF0YS1wcmV2aWV3LWlkJyxcclxuICAgICAgICAgICAgICAgIHNjcm9sbDogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBkcmFnZ2FibGU6IHNlbGVjdG9yLFxyXG4gICAgICAgICAgICAgICAgb25Tb3J0OiBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBvbGRJbmRleCA9IGUub2xkSW5kZXgsIG5ld0luZGV4ID0gZS5uZXdJbmRleCwgaSA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlldyA9ICRoLm1vdmVBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3LCBvbGRJbmRleCwgbmV3SW5kZXgsIHJldik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9ICRoLm1vdmVBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnLCBvbGRJbmRleCwgbmV3SW5kZXgsIHJldik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuaW5pdCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuZ2V0RnJhbWVzKCcuZmlsZS1wcmV2aWV3LWluaXRpYWwnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS5hdHRyKCdkYXRhLWZpbGVpbmRleCcsICdpbml0XycgKyBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaSsrO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlc29ydGVkJywge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBwcmV2aWV3SWQ6ICQoZS5pdGVtKS5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnb2xkSW5kZXgnOiBvbGRJbmRleCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ25ld0luZGV4JzogbmV3SW5kZXgsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrOiBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnXHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGlmICgkZWwuZGF0YSgna3Zzb3J0YWJsZScpKSB7XHJcbiAgICAgICAgICAgICAgICAkZWwua3Zzb3J0YWJsZSgnZGVzdHJveScpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICQuZXh0ZW5kKHRydWUsIHNldHRpbmdzLCBzZWxmLmZpbGVBY3Rpb25TZXR0aW5ncy5kcmFnU2V0dGluZ3MpO1xyXG4gICAgICAgICAgICAkZWwua3Zzb3J0YWJsZShzZXR0aW5ncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2V0UHJldmlld0NvbnRlbnQ6IGZ1bmN0aW9uIChjb250ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kcHJldmlldy5odG1sKGNvbnRlbnQpO1xyXG4gICAgICAgICAgICBzZWxmLl9hdXRvRml0Q29udGVudCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3OiBmdW5jdGlvbiAoaXNJbml0KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY2FwID0gc2VsZi5pbml0aWFsQ2FwdGlvbiB8fCAnJywgb3V0O1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYucHJldmlld0NhY2hlLmNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyUHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGlzSW5pdCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24oY2FwKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdENhcHRpb24oKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdDYWNoZS5vdXQoKTtcclxuICAgICAgICAgICAgY2FwID0gaXNJbml0ICYmIHNlbGYuaW5pdGlhbENhcHRpb24gPyBzZWxmLmluaXRpYWxDYXB0aW9uIDogb3V0LmNhcHRpb247XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdDb250ZW50KG91dC5jb250ZW50KTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0SW5pdFRodW1iQXR0cigpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGNhcCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRTb3J0YWJsZSgpO1xyXG4gICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkob3V0LmNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtaW5wdXQtbmV3Jyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRab29tQnV0dG9uOiBmdW5jdGlvbiAodHlwZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGxhYmVsID0gc2VsZi5wcmV2aWV3Wm9vbUJ1dHRvbkljb25zW3R5cGVdLCBjc3MgPSBzZWxmLnByZXZpZXdab29tQnV0dG9uQ2xhc3Nlc1t0eXBlXSxcclxuICAgICAgICAgICAgICAgIHRpdGxlID0gJyB0aXRsZT1cIicgKyAoc2VsZi5wcmV2aWV3Wm9vbUJ1dHRvblRpdGxlc1t0eXBlXSB8fCAnJykgKyAnXCIgJyxcclxuICAgICAgICAgICAgICAgIHBhcmFtcyA9IHRpdGxlICsgKHR5cGUgPT09ICdjbG9zZScgPyAnIGRhdGEtZGlzbWlzcz1cIm1vZGFsXCIgYXJpYS1oaWRkZW49XCJ0cnVlXCInIDogJycpO1xyXG4gICAgICAgICAgICBpZiAodHlwZSA9PT0gJ2Z1bGxzY3JlZW4nIHx8IHR5cGUgPT09ICdib3JkZXJsZXNzJyB8fCB0eXBlID09PSAndG9nZ2xlaGVhZGVyJykge1xyXG4gICAgICAgICAgICAgICAgcGFyYW1zICs9ICcgZGF0YS10b2dnbGU9XCJidXR0b25cIiBhcmlhLXByZXNzZWQ9XCJmYWxzZVwiIGF1dG9jb21wbGV0ZT1cIm9mZlwiJztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwiJyArIGNzcyArICcgYnRuLScgKyB0eXBlICsgJ1wiJyArIHBhcmFtcyArICc+JyArIGxhYmVsICsgJzwvYnV0dG9uPic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0TW9kYWxDb250ZW50OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdtb2RhbCcpLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAncnRsJzogc2VsZi5ydGwgPyAnIGt2LXJ0bCcgOiAnJyxcclxuICAgICAgICAgICAgICAgICd6b29tRnJhbWVDbGFzcyc6IHNlbGYuZnJhbWVDbGFzcyxcclxuICAgICAgICAgICAgICAgICdoZWFkaW5nJzogc2VsZi5tc2dab29tTW9kYWxIZWFkaW5nLFxyXG4gICAgICAgICAgICAgICAgJ3ByZXYnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdwcmV2JyksXHJcbiAgICAgICAgICAgICAgICAnbmV4dCc6IHNlbGYuX2dldFpvb21CdXR0b24oJ25leHQnKSxcclxuICAgICAgICAgICAgICAgICd0b2dnbGVoZWFkZXInOiBzZWxmLl9nZXRab29tQnV0dG9uKCd0b2dnbGVoZWFkZXInKSxcclxuICAgICAgICAgICAgICAgICdmdWxsc2NyZWVuJzogc2VsZi5fZ2V0Wm9vbUJ1dHRvbignZnVsbHNjcmVlbicpLFxyXG4gICAgICAgICAgICAgICAgJ2JvcmRlcmxlc3MnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdib3JkZXJsZXNzJyksXHJcbiAgICAgICAgICAgICAgICAnY2xvc2UnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdjbG9zZScpXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2xpc3Rlbk1vZGFsRXZlbnQ6IGZ1bmN0aW9uIChldmVudCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRtb2RhbCA9IHNlbGYuJG1vZGFsLCBnZXRQYXJhbXMgPSBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgICAgICBzb3VyY2VFdmVudDogZSxcclxuICAgICAgICAgICAgICAgICAgICBwcmV2aWV3SWQ6ICRtb2RhbC5kYXRhKCdwcmV2aWV3SWQnKSxcclxuICAgICAgICAgICAgICAgICAgICBtb2RhbDogJG1vZGFsXHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAkbW9kYWwub24oZXZlbnQgKyAnLmJzLm1vZGFsJywgZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkYnRuRnVsbCA9ICRtb2RhbC5maW5kKCcuYnRuLWZ1bGxzY3JlZW4nKSwgJGJ0bkJvcmQgPSAkbW9kYWwuZmluZCgnLmJ0bi1ib3JkZXJsZXNzJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXpvb20nICsgZXZlbnQsIGdldFBhcmFtcyhlKSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQgPT09ICdzaG93bicpIHtcclxuICAgICAgICAgICAgICAgICAgICAkYnRuQm9yZC5yZW1vdmVDbGFzcygnYWN0aXZlJykuYXR0cignYXJpYS1wcmVzc2VkJywgJ2ZhbHNlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGJ0bkZ1bGwucmVtb3ZlQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICdmYWxzZScpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkbW9kYWwuaGFzQ2xhc3MoJ2ZpbGUtem9vbS1mdWxsc2NyZWVuJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkaC5jaGVja0Z1bGxTY3JlZW4oKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkZ1bGwuYWRkQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICd0cnVlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuQm9yZC5hZGRDbGFzcygnYWN0aXZlJykuYXR0cignYXJpYS1wcmVzc2VkJywgJ3RydWUnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFpvb206IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZGlhbG9nLCBtb2RhbE1haW4gPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnbW9kYWxNYWluJyksIG1vZGFsSWQgPSAnIycgKyAkaC5NT0RBTF9JRDtcclxuICAgICAgICAgICAgaWYg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1icy5sZW5ndGgsICRwcmV2ID0gc2VsZi4kbW9kYWwuZmluZCgnLmJ0bi1wcmV2JyksXHJcbiAgICAgICAgICAgICAgICAkbmV4dCA9IHNlbGYuJG1vZGFsLmZpbmQoJy5idG4tbmV4dCcpO1xyXG4gICAgICAgICAgICBpZiAodGh1bWJzLmxlbmd0aCA8IDIpIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICRuZXh0LmhpZGUoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LnNob3coKTtcclxuICAgICAgICAgICAgICAgICRuZXh0LnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIWxlbikge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRmaXJzdCA9ICQodGh1bWJzWzBdKTtcclxuICAgICAgICAgICAgJGxhc3QgPSAkKHRodW1ic1tsZW4gLSAxXSk7XHJcbiAgICAgICAgICAgICRwcmV2LnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICRuZXh0LnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIGlmICgkZmlyc3QubGVuZ3RoICYmICRmaXJzdC5hdHRyKCdpZCcpID09PSBwcmV2aWV3SWQpIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LmF0dHIoJ2Rpc2FibGVkJywgdHJ1ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCRsYXN0Lmxlbmd0aCAmJiAkbGFzdC5hdHRyKCdpZCcpID09PSBwcmV2aWV3SWQpIHtcclxuICAgICAgICAgICAgICAgICRuZXh0LmF0dHIoJ2Rpc2FibGVkJywgdHJ1ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9tYXhpbWl6ZVpvb21EaWFsb2c6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkbW9kYWwgPSBzZWxmLiRtb2RhbCwgJGhlYWQgPSAkbW9kYWwuZmluZCgnLm1vZGFsLWhlYWRlcjp2aXNpYmxlJyksXHJcbiAgICAgICAgICAgICAgICAkZm9vdCA9ICRtb2RhbC5maW5kKCcubW9kYWwtZm9vdGVyOnZpc2libGUnKSwgJGJvZHkgPSAkbW9kYWwuZmluZCgnLm1vZGFsLWJvZHknKSxcclxuICAgICAgICAgICAgICAgIGggPSAkKHdpbmRvdykuaGVpZ2h0KCksIGRpZmYgPSAwO1xyXG4gICAgICAgICAgICAkbW9kYWwuYWRkQ2xhc3MoJ2ZpbGUtem9vbS1mdWxsc2NyZWVuJyk7XHJcbiAgICAgICAgICAgIGlmICgkaGVhZCAmJiAkaGVhZC5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIGggLT0gJGhlYWQub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCRmb290ICYmICRmb290Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgaCAtPSAkZm9vdC5vdXRlckhlaWdodCh0cnVlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoJGJvZHkgJiYgJGJvZHkubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICBkaWZmID0gJGJvZHkub3V0ZXJIZWlnaHQodHJ1ZSkgLSAkYm9keS5oZWlnaHQoKTtcclxuICAgICAgICAgICAgICAgIGggLT0gZGlmZjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkbW9kYWwuZmluZCgnLmt2LXpvb20tYm9keScpLmhlaWdodChoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZXNpemVab29tRGlhbG9nOiBmdW5jdGlvbiAoZnVsbFNjcmVlbikge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRtb2RhbCA9IHNlbGYuJG1vZGFsLCAkYnRuRnVsbCA9ICRtb2RhbC5maW5kKCcuYnRuLWZ1bGxzY3JlZW4nKSxcclxuICAgICAgICAgICAgICAgICRidG5Cb3JkID0gJG1vZGFsLmZpbmQoJy5idG4tYm9yZGVybGVzcycpO1xyXG4gICAgICAgICAgICBpZiAoJG1vZGFsLmhhc0NsYXNzKCdmaWxlLXpvb20tZnVsbHNjcmVlbicpKSB7XHJcbiAgICAgICAgICAgICAgICAkaC50b2dnbGVGdWxsU2NyZWVuKGZhbHNlKTtcclxuICAgICAgICAgICAgICAgIGlmICghZnVsbFNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJGJ0bkZ1bGwuaGFzQ2xhc3MoJ2FjdGl2ZScpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRtb2RhbC5yZW1vdmVDbGFzcygnZmlsZS16b29tLWZ1bGxzY3JlZW4nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi4kbW9kYWwuZmluZCgnLmt2LXpvb20tYm9keScpLmNzcygnaGVpZ2h0Jywgc2VsZi56b29tTW9kYWxIZWlnaHQpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5GdWxsLnJlbW92ZUNsYXNzKCdhY3RpdmUnKS5hdHRyKCdhcmlhLXByZXNzZWQnLCAnZmFsc2UnKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJGJ0bkZ1bGwuaGFzQ2xhc3MoJ2FjdGl2ZScpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRtb2RhbC5yZW1vdmVDbGFzcygnZmlsZS16b29tLWZ1bGxzY3JlZW4nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzaXplWm9vbURpYWxvZyh0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRidG5Cb3JkLmhhc0NsYXNzKCdhY3RpdmUnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkJvcmQucmVtb3ZlQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICdmYWxzZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFmdWxsU2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgJGgudG9nZ2xlRnVsbFNjcmVlbih0cnVlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkbW9kYWwuZm9jdXMoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zZXRab29tQ29udGVudDogZnVuY3Rpb24gKCRmcmFtZSwgYW5pbWF0ZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRjb250ZW50LCB0bXBsdCwgYm9keSwgdGl0bGUsICRib2R5LCAkZGF0YUVsLCBjb25maWcsIHByZXZpZXdJZCA9ICRmcmFtZS5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgJHpvb21QcmV2aWV3ID0gc2VsZi4kcHJldmlldy5maW5kKCcjem9vbS0nICsgcHJldmlld0lkKSwgJG1vZGFsID0gc2VsZi4kbW9kYWwsICR0bXAsXHJcbiAgICAgICAgICAgICAgICAkYnRuR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AgICAgICAgICAgICAgICRib2R5Lmh0bWwoYm9keSkuaGlkZSgpO1xyXG4gICAgICAgICAgICAgICAgJHRtcC5mYWRlT3V0KCdmYXN0JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICRib2R5LmZhZGVJbignZmFzdCcsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJvZHkucmVtb3ZlQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICR0bXAucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICRib2R5Lmh0bWwoYm9keSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgY29uZmlnID0gc2VsZi5wcmV2aWV3Wm9vbVNldHRpbmdzW3RtcGx0XTtcclxuICAgICAgICAgICAgaWYgKGNvbmZpZykge1xyXG4gICAgICAgICAgICAgICAgJGRhdGFFbCA9ICRib2R5LmZpbmQoJy5rdi1wcmV2aWV3LWRhdGEnKTtcclxuICAgICAgICAgICAgICAgICRoLmFkZENzcygkZGF0YUVsLCAnZmlsZS16b29tLWRldGFpbCcpO1xyXG4gICAgICAgICAgICAgICAgJC5lYWNoKGNvbmZpZywgZnVuY3Rpb24gKGtleSwgdmFsdWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkZGF0YUVsLmNzcyhrZXksIHZhbHVlKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoKCRkYXRhRWwuYXR0cignd2lkdGgnKSAmJiBrZXkgPT09ICd3aWR0aCcpIHx8ICgkZGF0YUVsLmF0dHIoJ2hlaWdodCcpICYmIGtleSA9PT0gJ2hlaWdodCcpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRkYXRhRWwucmVtb3ZlQXR0cihrZXkpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRtb2RhbC5kYXRhKCdwcmV2aWV3SWQnLCBwcmV2aWV3SWQpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbC5maW5kKCcuYnRuLXByZXYnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fem9vbVNsaWRlU2hvdygncHJldicsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbC5maW5kKCcuYnRuLW5leHQnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fem9vbVNsaWRlU2hvdygnbmV4dCcsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRidG5GdWxsLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yZXNpemVab29tRGlhbG9nKHRydWUpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkYnRuQm9yZCwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmVzaXplWm9vbURpYWxvZyhmYWxzZSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRidG5Ub2doLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgJGhlYWRlciA9ICRtb2RhbC5maW5kKCcubW9kYWwtaGVhZGVyJyksICRmbG9hdEJhciA9ICRtb2RhbC5maW5kKCcubW9kYWwtYm9keSAuZmxvYXRpbmctYnV0dG9ucycpLFxyXG4gICAgICAgICAgICAgICAgICAgIGh0LCAkYWN0aW9ucyA9ICRoZWFkZXIuZmluZCgnLmt2LXpvb20tYWN0aW9ucycpLCByZXNpemUgPSBmdW5jdGlvbiAoaGVpZ2h0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciAkYm9keSA9IHNlbGYuJG1vZGFsLmZpbmQoJy5rdi16b29tLWJvZHknKSwgaCA9IHNlbGYuem9vbU1vZGFsSGVpZ2h0O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJG1vZGFsLmhhc0NsYXNzKCdmaWxlLXpvb20tZnVsbHNjcmVlbicpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gJGJvZHkub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWhlaWdodCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBoIC0gJGhlYWRlci5vdXRlckhlaWdodCh0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYm9keS5jc3MoJ2hlaWdodCcsIGhlaWdodCA/IGggKyBoZWlnaHQgOiBoKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgaWYgKCRoZWFkZXIuaXMoJzp2aXNpYmxlJykpIHtcclxuICAgICAgICAgICAgICAgICAgICBodCA9ICRoZWFkZXIub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGhlYWRlci5zbGlkZVVwKCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYWN0aW9ucy5maW5kKCcuYnRuJykuYXBwZW5kVG8oJGZsb2F0QmFyKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzaXplKGh0KTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZsb2F0QmFyLmZpbmQoJy5idG4nKS5hcHBlbmRUbygkYWN0aW9ucyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGhlYWRlci5zbGlkZURvd24oJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc2l6ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgJG1vZGFsLmZvY3VzKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbCwgJ2tleWRvd24nLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IGUud2hpY2ggfHwgZS5rZXlDb2RlLCAkcHJldiA9ICQodGhpcykuZmluZCgnLmJ0bi1wcmV2JyksICRuZXh0ID0gJCh0aGlzKS5maW5kKCcuYnRuLW5leHQnKSxcclxuICAgICAgICAgICAgICAgICAgICB2SWQgPSAkKHRoaXMpLmRhdGEoJ3ByZXZpZXdJZCcpLCB2UHJldktleSA9IHNlbGYucnRsID8gMzkgOiAzNywgdk5leHRLZXkgPSBzZWxmLnJ0bCA/IDM3IDogMzk7XHJcbiAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSB2UHJldktleSAmJiAkcHJldi5sZW5ndGggJiYgISRwcmV2LmF0dHIoJ2Rpc2FibGVkJykpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl96b29tU2xpZGVTaG93KCdwcmV2JywgdklkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChrZXkgPT09IHZOZXh0S2V5ICYmICRuZXh0Lmxlbmd0aCAmJiAhJG5leHQuYXR0cignZGlzYWJsZWQnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3pvb21TbGlkZVNob3coJ25leHQnLCB2SWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF96b29tUHJldmlldzogZnVuY3Rpb24gKCRidG4pIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUsICRtb2RhbCA9IHNlbGYuJG1vZGFsO1xyXG4gICAgICAgICAgICBpZiAoISRidG4ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICB0aHJvdyAnQ2Fubm90IHpvb20gdG8gZGV0YWlsZWQgcHJldmlldyEnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRoLmluaXRNb2RhbCgkbW9kYWwpO1xyXG4gICAgICAgICAgICAkbW9kYWwuaHRtbChzZWxmLl9nZXRNb2RhbENvbnRlbnQoKSk7XHJcbiAgICAgICAgICAgICRmcmFtZSA9ICRidG4uY2xvc2VzdCgkaC5GUkFNRVMpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRab29tQ29udGVudCgkZnJhbWUpO1xyXG4gICAgICAgICAgICAkbW9kYWwubW9kYWwoJ3Nob3cnKTtcclxuICAgICAgICAgICAgc2VsZi5faW5pdFpvb21CdXR0b25zKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfem9vbVNsaWRlU2hvdzogZnVuY3Rpb24gKGRpciwgcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGJ0biA9IHNlbGYuJG1vZGFsLmZpbmQoJy5rdi16b29tLWFjdGlvbnMgLmJ0bi0nICsgZGlyKSwgJHRhcmdGcmFtZSwgaSxcclxuICAgICAgICAgICAgICAgIHRodW1icyA9IHNlbGYuZ2V0RnJhbWVzKCkudG9BcnJheSgpLCBsZW4gPSB0aHVtYnMubGVuZ3RoLCBvdXQ7XHJcbiAgICAgICAgICAgIGlmICgkYnRuLmF0dHIoJ2Rpc2FibGVkJykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICAgIGlmICgkKHRodW1ic1tpXSkuYXR0cignaWQnKSA9PT0gcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgb3V0ID0gZGlyID09PSAncHJldicgPyBpIC0gMSA6IGkgKyAxO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChvdXQgPCAwIHx8IG91dCA+PSBsZW4gfHwgIXRodW1ic1tvdXRdKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJHRhcmdGcmFtZSA9ICQodGh1bWJzW291dF0pO1xyXG4gICAgICAgICAgICBpZiAoJHRhcmdGcmFtZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFpvb21Db250ZW50KCR0YXJnRnJhbWUsIHRydWUpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9ucygpO1xyXG4gICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXpvb20nICsgZGlyLCB7J3ByZXZpZXdJZCc6IHByZXZpZXdJZCwgbW9kYWw6IHNlbGYuJG1vZGFsfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFpvb21CdXR0b246IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBzZWxmLiRwcmV2aWV3LmZpbmQoJy5rdi1maWxlLXpvb20nKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkZWwsICdjbGljaycsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl96b29tUHJldmlldygkZWwpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2lucHV0RmlsZUNvdW50OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB0aGlzLiRlbGVtZW50LmdldCgwKS5maWxlcy5sZW5ndGg7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaFByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBmaWxlcztcclxuICAgICAgICAgICAgaWYgKCghc2VsZi5faW5wdXRGaWxlQ291bnQoKSAmJiAhc2VsZi5pc0FqYXhVcGxvYWQpIHx8ICFzZWxmLnNob3dQcmV2aWV3IHx8ICFzZWxmLmlzUHJldmlld2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIGZpbGVzID0gc2VsZi5nZXRGaWxlU3RhY2soKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZXN0YWNrID0gW107XHJcbiAgICAgICAgICAgICAgICBpZiAoZmlsZXMubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZXMgPSBzZWxmLiRlbGVtZW50LmdldCgwKS5maWxlcztcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGZpbGVzID0gc2VsZi4kZWxlbWVudC5nZXQoMCkuZmlsZXM7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGZpbGVzICYmIGZpbGVzLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5yZWFkRmlsZXMoZmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0RmlsZURyb3Bab25lVGl0bGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NsZWFyT2JqZWN0czogZnVuY3Rpb24gKCRlbCkge1xyXG4gICAgICAgICAgICAkZWwuZmluZCgndmlkZW8gYXVkaW8nKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMucGF1c2UoKTtcclxuICAgICAgICAgICAgICAgICQodGhpcykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAkZWwuZmluZCgnaW1nIG9iamVjdCBkaXYnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICQodGhpcykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NsZWFyRmlsZUlucHV0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVsID0gc2VsZi4kZWxlbWVudCwgJHNyY0ZybSwgJHRtcEZybSwgJHRtcEVsO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuX2lucHV0RmlsZUNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkc3JjRnJtID0gJGVsLmNsb3Nlc3QoJ2Zvcm0nKTtcclxuICAgICAgICAgICAgJHRtcEZybSA9ICQoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZm9ybScpKTtcclxuICAgICAgICAgICAgJHRtcEVsID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSk7XHJcbiAgICAgICAgICAgICRlbC5iZWZvcmUoJHRtcEVsKTtcclxuICAgICAgICAgICAgaWYgKCRzcmNGcm0ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAkc3JjRnJtLmFmdGVyKCR0bXBGcm0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJHRtcEVsLmFmdGVyKCR0bXBGcm0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICR0bXBGcm0uYXBwZW5kKCRlbCkudHJpZ2dlcigncmVzZXQnKTtcclxuICAgICAgICAgICAgJHRtcEVsLmJlZm9yZSgkZWwpLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAkdG1wRnJtLnJlbW92ZSgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0VXBsb2FkOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZSA9IHtjb250ZW50OiBbXSwgY29uZmlnOiBbXSwgdGFnczogW10sIGFwcGVuZDogdHJ1ZX07XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZFN0YXR1cyA9IHt9O1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZEFzeW5jQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLmxvYWRlZEltYWdlcyA9IFtdO1xyXG4gICAgICAgICAgICBzZWxmLnRvdGFsSW1hZ2VzQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLiRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMCk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByb2dyZXNzLmhpZGUoKTtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnMoZmFsc2UpO1xyXG4gICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheFJlcXVlc3RzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuX3Jlc2V0Q2FudmFzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuY2FjaGVJbml0aWFsUHJldmlldyA9IHt9O1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3ID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhID0ge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtdLFxyXG4gICAgICAgICAgICAgICAgICAgIGNvbmZpZzogW10sXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnczogW11cclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZXNldENhbnZhczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLmNhbnZhcyAmJiBzZWxmLmltYWdlQ2FudmFzQ29udGV4dCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5pbWFnZUNhbnZhc0NvbnRleHQuY2xlYXJSZWN0KDAsIDAsIHNlbGYuY2FudmFzLndpZHRoLCBzZWxmLmNhbnZhcy5oZWlnaHQpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaGFzSW5pdGlhbFByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gIXNlbGYub3ZlcndyaXRlSW5pdGlhbCAmJiBzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0UHJldmlldzogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIG91dCwgY2FwO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSkge1xyXG4gICAgICAgICAgICAgICAgb3V0ID0gc2VsZi5wcmV2aWV3Q2FjaGUub3V0KCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3Q29udGVudChvdXQuY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRJbml0VGh1bWJBdHRyKCk7XHJcbiAgICAgICAgICAgICAgICBjYXAgPSBzZWxmLmluaXRpYWxDYXB0aW9uID8gc2VsZi5pbml0aWFsQ2FwdGlvbiA6IG91dC5jYXB0aW9uO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0Q2FwdGlvbihjYXApO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJQcmV2aWV3KCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0Q2FwdGlvbigpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0Wm9vbSgpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jbGVhckRlZmF1bHRQcmV2aWV3OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kcHJldmlldy5maW5kKCcuZmlsZS1kZWZhdWx0LXByZXZpZXcnKS5yZW1vdmUoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZURlZmF1bHRQcmV2aWV3OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3IHx8ICRoLmlzRW1wdHkoc2VsZi5kZWZhdWx0UHJldmlld0NvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJldmlld0NvbnRlbnQoJzxkaXYgY2xhc3M9XCJmaWxlLWRlZmF1bHQtcHJldmlld1wiPicgKyBzZWxmLmRlZmF1bHRQcmV2aWV3Q29udGVudCArICc8L2Rpdj4nKTtcclxuICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLnJlbW92ZUNsYXNzKCdmaWxlLWlucHV0LW5ldycpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0Q2xpY2thYmxlKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVzZXRQcmV2aWV3VGh1bWJzOiBmdW5jdGlvbiAoaXNBamF4KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgb3V0O1xyXG4gICAgICAgICAgICBpZiAoaXNBamF4KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhclByZXZpZXcoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLl9oYXNJbml0aWFsUHJldmlldygpKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdDYWNoZS5vdXQoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdDb250ZW50KG91dC5jb250ZW50KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldEluaXRUaHVtYkF0dHIoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24ob3V0LmNhcHRpb24pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhclByZXZpZXcoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dldExheW91dFRlbXBsYXRlOiBmdW5jdGlvbiAodCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHRlbXBsYXRlID0gc2VsZi5sYXlvdXRUZW1wbGF0ZXNbdF07XHJcbiAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KHNlbGYuY3VzdG9tTGF5b3V0VGFncykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB0ZW1wbGF0ZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gJGgucmVwbGFjZVRhZ3ModGVtcGxhdGUsIHNlbGYuY3VzdG9tTGF5b3V0VGFncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0UHJldmlld1RlbXBsYXRlOiBmdW5jdGlvbiAodCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHRlbXBsYXRlID0gc2VsZi5wcmV2aWV3VGVtcGxhdGVzW3RdO1xyXG4gICAgICAgICAgICBpZiAoJGguaXNFbXB0eShzZWxmLmN1c3RvbVByZXZpZXdUYWdzKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRlbXBsYXRlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAkaC5yZXBsYWNlVGFncyh0ZW1wbGF0ZSwgc2VsZi5jdXN0b21QcmV2aWV3VGFncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0T3V0RGF0YTogZnVuY3Rpb24gKGpxWEhSLCByZXNwb25zZURhdGEsIGZpbGVzRGF0YSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGpxWEhSID0ganFYSFIgfHwge307XHJcbiAgICAgICAgICAgIHJlc3BvbnNlRGF0YSA9IHJlc3BvbnNlRGF0YSB8fCB7fTtcclxuICAgICAgICAgICAgZmlsZXNEYXRhID0gZmlsZXNEYXRhIHx8IHNlbGYuZmlsZXN0YWNrLnNsaWNlKDApIHx8IHt9O1xyXG4gICAgICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICAgICAgZm9ybTogc2VsZi5mb3JtZGF0YSxcclxuICAgICAgICAgICAgICAgIGZpbGVzOiBmaWxlc0RhdGEsXHJcbiAgICAgICAgICAgICAgICBmaWxlbmFtZXM6IHNlbGYuZmlsZW5hbWVzLFxyXG4gICAgICAgICAgICAgICAgZmlsZXNjb3VudDogc2VsZi5nZXRGaWxlc0NvdW50KCksXHJcbiAgICAgICAgICAgICAgICBleHRyYTogc2VsZi5fZ2V0RXh0cmFEYXRhKCksXHJcbiAgICAgICAgICAgICAgICByZXNwb25zZTogcmVzcG9uc2VEYXRhLFxyXG4gICAgICAgICAgICAgICAgcmVhZGVyOiBzZWxmLnJlYWRlcixcclxuIC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B7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZGF0YSA9IHNlbGYudXBsb2FkRXh0cmFEYXRhO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIHNlbGYudXBsb2FkRXh0cmFEYXRhID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBkYXRhID0gc2VsZi51cGxvYWRFeHRyYURhdGEocHJldmlld0lkLCBpbmRleCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGRhdGE7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFhocjogZnVuY3Rpb24gKHhocm9iaiwgcHJldmlld0lkLCBmaWxlQ291bnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoeGhyb2JqLnVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgeGhyb2JqLnVwbG9hZC5hZGRFdmVudExpc3RlbmVyKCdwcm9ncmVzcycsIGZ1bmN0aW9uIChldmVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBwY3QgPSAwLCB0b3RhbCA9IGV2ZW50LnRvdGFsLCBwb3NpdGlvbiA9IGV2ZW50LmxvYWRlZCB8fCBldmVudC5wb3NpdGlvbjtcclxuICAgICAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBldmVudC5sZW5ndGhDb21wdXRhYmxlICovXHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50Lmxlbmd0aENvbXB1dGFibGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcGN0ID0gTWF0aC5mbG9vcihwb3NpdGlvbiAvIHRvdGFsICogMTAwKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByZXZpZXdJZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRBc3luY1VwbG9hZFN0YXR1cyhwcmV2aWV3SWQsIHBjdCwgZmlsZUNvdW50KTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzcyhwY3QpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0sIGZhbHNlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4geGhyb2JqO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRBamF4U2V0dGluZ3M6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBzZWxmLl9hamF4U2V0dGluZ3MgPSAkLmV4dGVuZCh0cnVlLCB7fSwgc2VsZi5hamF4U2V0dGluZ3MpO1xyXG4gICAgICAgICAgICBzZWxmLl9hamF4RGVsZXRlU2V0dGluZ3MgPSAkLmV4dGVuZCh0cnVlLCB7fSwgc2VsZi5hamF4RGVsZXRlU2V0dGluZ3MpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX21lcmdlQWpheENhbGxiYWNrOiBmdW5jdGlvbiAoZnVuY05hbWUsIHNyY0Z1bmMsIHR5cGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBzZXR0aW5ncyA9IHNlbGYuX2FqYXhTZXR0aW5ncywgZmxhZyA9IHNlbGYubWVyZ2VBamF4Q2FsbGJhY2tzLCB0YXJnRnVuYztcclxuICAgICAgICAgICAgaWYgKHR5cGUgPT09ICdkZWxldGUnKSB7XHJcbiAgICAgICAgICAgICAgICBzZXR0aW5ncyA9IHNlbGYuX2FqYXhEZWxldGVTZXR0aW5ncztcclxuICAgICAgICAgICAgICAgIGZsYWcgPSBzZWxmLm1lcmdlQWpheERlbGV0ZUNhbGxiYWNrcztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB0YXJnRnVuYyA9IHNldHRpbmdzW2Z1bmNOYW1lXTtcclxuICAgICAgICAgICAgaWYgKGZsYWcgJiYgdHlwZW9mIHRhcmdGdW5jID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoZmxhZyA9PT0gJ2JlZm9yZScpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZXR0aW5nc1tmdW5jTmFtZV0gPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdGdW5jLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNyY0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBzZXR0aW5nc1tmdW5jTmFtZV0gPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNyY0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2V0dGluZ3NbZnVuY05hbWVdID0gc3JjRnVuYztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2FqYXhTdWJtaXQ6IGZ1bmN0aW9uIChmbkJlZm9yZSwgZm5TdWNjZXNzLCBmbkNvbXBsZXRlLCBmbkVycm9yLCBwcmV2aWV3SWQsIGluZGV4KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgc2V0dGluZ3MsIHZVcmw7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVwcmVhamF4JywgW3ByZXZpZXdJZCwgaW5kZXhdKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3VwbG9hZEV4dHJhKHByZXZpZXdJZCwgaW5kZXgpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0QWpheFNldHRpbmdzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX21lcmdlQWpheENhbGxiYWNrKCdiZWZvcmVTZW5kJywgZm5CZWZvcmUpO1xyXG4gICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnc3VjY2VzcycsIGZuU3VjY2Vzcyk7XHJcbiAgICAgICAgICAgIHNlbGYuX21lcmdlQWpheENhbGxiYWNrKCdjb21wbGV0ZScsIGZuQ29tcGxldGUpO1xyXG4gICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnZXJyb3InLCBmbkVycm9yKTtcclxuICAgICAgICAgICAgdlVybCA9IGluZGV4ICYmIHNlbGYudXBsb2FkVXJsVGh1bWIgPyBzZWxmLnVwbG9hZFVybFRodW1iIDogc2VsZi51cGxvYWRVcmw7XHJcbiAgICAgICAgICAgIHNldHRpbmdzID0gJC5leHRlbmQodHJ1ZSwge30sIHtcclxuICAgICAgICAgICAgICAgIHhocjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciB4aHJvYmogPSAkLmFqYXhTZXR0aW5ncy54aHIoKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2VsZi5faW5pdFhocih4aHJvYmosIHByZXZpZXdJZCwgc2VsZi5nZXRGaWxlU3RhY2soKS5sZW5ndGgpO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHVybDogc2VsZi5fZW5jb2RlVVJJKHZVcmwpLFxyXG4gICAgICAgICAgICAgICAgdHlwZTogJ1BPU1QnLFxyXG4gICAgICAgICAgICAgICAgZGF0YVR5cGU6ICdqc29uJyxcclxuICAgICAgICAgICAgICAgIGRhdGE6IHNlbGYuZm9ybWRhdGEsXHJcbiAgICAgICAgICAgICAgICBjYWNoZTogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBwcm9jZXNzRGF0YTogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBjb250ZW50VHlwZTogZmFsc2VcclxuICAgICAgICAgICAgfSwgc2VsZi5fYWpheFNldHRpbmdzKTtcclxuICAgICAgICAgICAgc2VsZi5hamF4UmVxdWVzdHMucHVzaCgkLmFqYXgoc2V0dGluZ3MpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9tZXJnZUFycmF5OiBmdW5jdGlvbiAocHJvcCwgY29udGVudCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGFycjEgPSAkaC5jbGVhbkFycmF5KHNlbGZbcHJvcF0pLCBhcnIyID0gJGguY2xlYW5BcnJheShjb250ZW50KTtcclxuICAgICAgICAgICAgc2VsZltwcm9wXSA9IGFycjEuY29uY2F0KGFycjIpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRVcGxvYWRTdWNjZXNzOiBmdW5jdGlvbiAob3V0LCAkdGh1bWIsIGFsbEZpbGVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgYXBwZW5kLCBkYXRhLCBpbmRleCwgJGRpdiwgJG5ld0NhY2hlLCBjb250ZW50LCBjb25maWcsIHRhZ3MsIGk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5zaG93UHJldmlldyB8fCB0eXBlb2Ygb3V0ICE9PSAnb2JqZWN0JyB8fCAkLmlzRW1wdHlPYmplY3Qob3V0KSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChvdXQuaW5pdGlhbFByZXZpZXcgIT09IHVuZGVmaW5lZCAmJiBvdXQuaW5pdGlhbFByZXZpZXcubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5oYXNJbml0RGF0YSA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBjb250ZW50ID0gb3V0LmluaXRpYWxQcmV2aWV3IHx8IFtdO1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gb3V0LmluaXRpYWxQcmV2aWV3Q29uZmlnIHx8IFtdO1xyXG4gICAgICAgICAgICAgICAgdGFncyA9IG91dC5pbml0aWFsUHJldmlld1RodW1iVGFncyB8fCBbXTtcclxuICAgICAgICAgICAgICAgIGFwcGVuZCA9IG91dC5hcHBlbmQgPT09IHVuZGVmaW5lZCB8fCBvdXQuYXBwZW5kO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvbnRlbnQubGVuZ3RoID4gMCAmJiAhJGguaXNBcnJheShjb250ZW50KSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQgPSBjb250ZW50LnNwbGl0KHNlbGYuaW5pdGlhbFByZXZpZXdEZWxpbWl0ZXIpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fbWVyZ2VBcnJheSgnaW5pdGlhbFByZXZpZXcnLCBjb250ZW50KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX21lcmdlQXJyYXkoJ2luaXRpYWxQcmV2aWV3Q29uZmlnJywgY29uZmlnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX21lcmdlQXJyYXkoJ2luaXRpYWxQcmV2aWV3VGh1bWJUYWdzJywgdGFncyk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJHRodW1iICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWFsbEZpbGVzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gc2VsZi5wcmV2aWV3Q2FjaGUuYWRkKGNvbnRlbnQsIGNvbmZpZ1swXSwgdGFnc1swXSwgYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmdldChpbmRleCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZGl2ID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSkuaHRtbChkYXRhKS5oaWRlKCkuaW5zZXJ0QWZ0ZXIoJHRodW1iKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJG5ld0NhY2hlID0gJGRpdi5maW5kKCcua3Ytem9vbS1jYWNoZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJG5ld0NhY2hlICYmICRuZXdDYWNoZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRuZXdDYWNoZS5pbnNlcnRBZnRlcigkdGh1bWIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5mYWRlT3V0KCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyICRuZXdUaHVtYiA9ICRkaXYuZmluZCgnLmZpbGUtcHJldmlldy1mcmFtZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRuZXdUaHVtYiAmJiAkbmV3VGh1bWIubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJG5ld1RodW1iLmluc2VydEJlZm9yZSgkdGh1bWIpLmZhZGVJbignc2xvdycpLmNzcygnZGlzcGxheTppbmxpbmUtYmxvY2snKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3QWN0aW9ucygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNsZWFuWm9vbUNhY2hlKHNlbGYuJHByZXZpZXcuZmluZCgnI3pvb20tJyArICR0aHVtYi5hdHRyKCdpZCcpKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZGl2LnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSAkdGh1bWIuYXR0cignZGF0YS1maWxlaW5kZXgnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb250ZW50W2ldID0gY29udGVudFswXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb25maWdbaV0gPSBjb25maWdbMF0gfHwgW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQ2FjaGUudGFnc1tpXSA9IHRhZ3NbMF0gfHwgW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQ2FjaGUuYXBwZW5kID0gYXBwZW5kO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuc2V0KGNvbnRlbnQsIGNvbmZpZywgdGFncywgYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3QWN0aW9ucygpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFN1Y2Nlc3NUaHVtYnM6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9nZXRUaHVtYnMoJGguRlJBTUVTICsgJy5maWxlLXByZXZpZXctc3VjY2VzcycpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldywgJHJlbW92ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICRyZW1vdmUucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHJlbW92ZSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBpZCA9ICR0aHVtYi5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLl9yYWlzZSgnZmlsZXN1Y2Nlc3NyZW1vdmUnLCBbaWQsICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGguY2xlYW5NZW1vcnkoJHRodW1iKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAob3V0ID09PSBmYWxzZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5mYWRlT3V0KCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkaC5jbGVhblpvb21DYWNoZSgkcHJldmlldy5maW5kKCcjem9vbS0nICsgaWQpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuZ2V0RnJhbWVzKCkubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJlc2V0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jaGVja0FzeW5jQ29tcGxldGU6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBwcmV2aWV3SWQsIGk7XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzZWxmLmZpbGVzdGFjay5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuZmlsZXN0YWNrW2ldKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcHJldmlld0lkID0gc2VsZi5wcmV2aWV3SW5pdElkICsgJy0nICsgaTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJC5pbkFycmF5KHByZXZpZXdJZCwgc2VsZi51cGxvYWRMb2cpID09PSAtMSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAoc2VsZi51cGxvYWRBc3luY0NvdW50ID09PSBzZWxmLnVwbG9hZExvZy5sZW5ndGgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwbG9hZEV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clxuICAgICAgICAgICAgICAgIHVwZGF0ZVVwbG9hZExvZywgcGFyYW1zID0ge2lkOiBwcmV2aWV3SWQsIGluZGV4OiBpfTtcclxuICAgICAgICAgICAgc2VsZi5mb3JtZGF0YSA9IGZvcm1kYXRhO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgJHRodW1iID0gJCgnIycgKyBwcmV2aWV3SWQgKyAnOm5vdCguZmlsZS1wcmV2aWV3LWluaXRpYWwpJyk7XHJcbiAgICAgICAgICAgICAgICAkYnRuVXBsb2FkID0gJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpO1xyXG4gICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICRwcm9nLnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAodG90YWwgPT09IDAgfHwgIWhhc1Bvc3REYXRhIHx8ICgkYnRuVXBsb2FkICYmICRidG5VcGxvYWQuaGFzQ2xhc3MoJ2Rpc2FibGVkJykpIHx8IHNlbGYuX2Fib3J0KHBhcmFtcykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB1cGRhdGVVcGxvYWRMb2cgPSBmdW5jdGlvbiAoaSwgcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXVwbG9hZEZhaWxlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkTG9nLnB1c2gocHJldmlld0lkKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9jaGVja0FzeW5jQ29tcGxldGUoKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgY2hrQ29tcGxldGUgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgdSA9IHNlbGYudXBsb2FkQ2FjaGUsICRpbml0VGh1bWJzLCBpLCBqLCBsZW4gPSAwLCBkYXRhID0gc2VsZi5jYWNoZUluaXRpYWxQcmV2aWV3O1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLmZpbGVCYXRjaENvbXBsZXRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChkYXRhICYmIGRhdGEuY29udGVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGxlbiA9IGRhdGEuY29udGVudC5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgdHJpZ2dlclJlc2V0ID0gc2VsZi5nZXRGaWxlU3RhY2sodHJ1ZSkubGVuZ3RoID09PSAwO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLnNldCh1LmNvbnRlbnQsIHUuY29uZmlnLCB1LnRhZ3MsIHUuYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHUuY29udGVudC5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPSBpICsgbGVuO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29udGVudFtqXSA9IHUuY29udGVudFtpXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBKU1VucmVzb2x2ZWRWYXJpYWJsZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmNvbmZpZy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWdbal0gPSB1LmNvbmZpZ1tpXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEudGFncy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS50YWdzW2pdID0gdS50YWdzW2ldO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXcgPSAkaC5jbGVhbkFycmF5KGRhdGEuY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnID0gJGguY2xlYW5BcnJheShkYXRhLmNvbmZpZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gJGguY2xlYW5BcnJheShkYXRhLnRhZ3MpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlldyA9IHUuY29udGVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdDb25maWcgPSB1LmNvbmZpZztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdUaHVtYlRhZ3MgPSB1LnRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jYWNoZUluaXRpYWxQcmV2aWV3ID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmhhc0luaXREYXRhKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51bmxvY2sodHJpZ2dlclJlc2V0KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAodHJpZ2dlclJlc2V0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRpbml0VGh1bWJzID0gc2VsZi4kcHJldmlldy5maW5kKCcuZmlsZS1wcmV2aWV3LWluaXRpYWwnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi51cGxvYWRBc3luYyAmJiAkaW5pdFRodW1icy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRpbml0VGh1bWJzLCAkaC5TT1JUX0NTUyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRTb3J0YWJsZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNodXBsb2FkY29tcGxldGUnLCBbc2VsZi5maWxlc3RhY2ssIHNlbGYuX2dldEV4dHJhRGF0YSgpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDb3VudCA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRTdGF0dXMgPSB7fTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5hamF4QWJvcnRlZCA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJHRodW1iLmhhc0NsYXNzKCdmaWxlLXByZXZpZXctc3VjY2VzcycpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0xvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCR0aHVtYiwgJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQuYXR0cignZGlzYWJsZWQnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAkYnRuRGVsZXRlLmF0dHIoJ2Rpc2FibGVkJywgdHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlcHJldXBsb2FkJywgW291dERhdGEsIHByZXZpZXdJZCwgaV0pO1xyXG4gICAgICAgICAgICAgICAgJC5leHRlbmQodHJ1ZSwgcGFyYW1zLCBvdXREYXRhKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydChwYXJhbXMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAganFYSFIuYWJvcnQoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJTdGF0dXMoJHRodW1iLCAnTmV3Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0blVwbG9hZC5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYnRuRGVsZXRlLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudW5sb2NrKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuU3VjY2VzcyA9IGZ1bmN0aW9uIChkYXRhLCB0ZXh0U3RhdHVzLCBqcVhIUikge1xyXG4gICAgICAgICAgICAgICAgdmFyIHBpZCA9IHNlbGYuc2hvd1ByZXZpZXcgJiYgJHRodW1iLmF0dHIoJ2lkJykgPyAkdGh1bWIuYXR0cignaWQnKSA6IHByZXZpZXdJZDtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSLCBkYXRhKTtcclxuICAgICAgICAgICAgICAgICQuZXh0ZW5kKHRydWUsIHBhcmFtcywgb3V0RGF0YSk7XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhKSB8fCAkaC5pc0VtcHR5KGRhdGEuZXJyb3IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRUaHVtYlN0YXR1cygkdGh1bWIsICdTdWNjZXNzJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuVXBsb2FkLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRVcGxvYWRTdWNjZXNzKGRhdGEsICR0aHVtYiwgaXNCYXRjaCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzcygxMDEsICRwcm9nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXVwbG9hZGVkJywgW291dERhdGEsIHBpZCwgaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVVwbG9hZExvZyhpLCBwaWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdXBsb2FkRmFpbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIHBhcmFtcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdFcnJvcigkdGh1bWIsIGksIHNlbGYuZmlsZXN0YWNrW2ldLCBzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuVXBsb2FkLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNCYXRjaCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlVXBsb2FkTG9nKGksIHBpZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCAkKCcjJyArIHBpZCkuZmluZCgnLmZpbGUtdGh1bWItcHJvZ3Jlc3MnKSwgc2VsZi5tc2dVcGxvYWRFcnJvcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5Db21wbGV0ZSA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghaXNCYXRjaCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnVubG9jayhmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2hrQ29tcGxldGUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFN1Y2Nlc3NUaHVtYnMoKTtcclxuICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuRXJyb3IgPSBmdW5jdGlvbiAoanFYSFIsIHRleHRTdGF0dXMsIGVycm9yVGhyb3duKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgb3AgPSBzZWxmLmFqYXhPcGVyYXRpb25zLnVwbG9hZFRodW1iLFxyXG4gICAgICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bixcclxuICAgICAgICAgICAgICAgICAgICAgICAgKGlzQmF0Y2ggJiYgc2VsZi5maWxlc3RhY2tbaV0ubmFtZSA/IHNlbGYuZmlsZXN0YWNrW2ldLm5hbWUgOiBudWxsKSk7XHJcbiAgICAgICAgICAgICAgICB1cGxvYWRGYWlsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlVXBsb2FkTG9nKGksIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkU3RhdHVzW3ByZXZpZXdJZF0gPSAxMDA7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJldmlld0Vycm9yKCR0aHVtYiwgaSwgc2VsZi5maWxlc3RhY2tbaV0sIHNlbGYucmV0cnlFcnJvclVwbG9hZHMpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5yZXRyeUVycm9yVXBsb2Fkcykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYnRuVXBsb2FkLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgJC5leHRlbmQodHJ1ZSwgcGFyYW1zLCBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCAkcHJvZywgc2VsZi5tc2dBamF4UHJvZ3Jlc3NFcnJvci5yZXBsYWNlKCd7b3BlcmF0aW9ufScsIG9wKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCAkKCcjJyArIHByZXZpZXdJZCkuZmluZCgnLmZpbGUtdGh1bWItcHJ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gICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2V0QWxsVXBsb2FkZWQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uIChrZXkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGtleSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYubG9jaygpO1xyXG4gICAgICAgICAgICAgICAgdmFyIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciAkdGh1bWIgPSAkKHRoaXMpLCAkYnRuVXBsb2FkID0gJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEkdGh1bWIuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1zdWNjZXNzJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0xvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmFkZENzcygkdGh1bWIsICdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQuYXR0cignZGlzYWJsZWQnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5hdHRyKCdkaXNhYmxlZCcsIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHByZXVwbG9hZCcsIFtvdXREYXRhXSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5fYWJvcnQob3V0RGF0YSkpIHtcclxuICAgICAgICAgICAgICAgICAgICBqcVhIUi5hYm9ydCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgJHRodW1iID0gJCh0aGlzKSwgJGJ0blVwbG9hZCA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRidG5EZWxldGUgPSAkdGh1bWIuZmluZCgnLmt2LWZpbGUtcmVtb3ZlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkdGh1bWIuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1sb2FkaW5nJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ05ldycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuU3VjY2VzcyA9IGZ1bmN0aW9uIChkYXRhLCB0ZXh0U3RhdHVzLCBqcVhIUikge1xyXG4gICAgICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZGF0YS5lcnJvcmtleXMgKi9cclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUiwgZGF0YSksIGtleSA9IDAsXHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1icyA9IHNlbGYuX2dldFRodW1icygnOm5vdCguZmlsZS1wcmV2aWV3LXN1Y2Nlc3MpJyksXHJcbiAgICAgICAgICAgICAgICAgICAga2V5cyA9ICRoLmlzRW1wdHkoZGF0YSkgfHwgJGguaXNFbXB0eShkYXRhLmVycm9ya2V5cykgPyBbXSA6IGRhdGEuZXJyb3JrZXlzO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KGRhdGEpIHx8ICRoLmlzRW1wdHkoZGF0YS5lcnJvcikpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNodXBsb2Fkc3VjY2VzcycsIFtvdXREYXRhXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2V0QWxsVXBsb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWJzLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRUaHVtYlN0YXR1cygkdGh1bWIsICdTdWNjZXNzJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIuZmluZCgnLmt2LWZpbGUtdXBsb2FkJykuaGlkZSgpLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0VXBsb2FkU3VjY2VzcyhkYXRhKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJlc2V0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYnMuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgJHRodW1iID0gJCh0aGlzKSwgaSA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIuZmluZCgnLmt2LWZpbGUtcmVtb3ZlJykucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrZXlzLmxlbmd0aCA9PT0gMCB8fCAkLmluQXJyYXkoa2V5LCBrZXlzKSAhPT0gLTEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpLCBzZWxmLmZpbGVzdGFja1tpXSwgc2VsZi5yZXRyeUVycm9yVXBsb2Fkcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJTdGF0dXMoJHRodW1iLCAnU3VjY2VzcycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghJHRodW1iLmhhc0NsYXNzKCdmaWxlLXByZXZpZXctZXJyb3InKSB8fCBzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5Kys7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0VXBsb2FkU3VjY2VzcyhkYXRhKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIG91dERhdGEsICdmaWxlYmF0Y2h1cGxvYWRlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSwgc2VsZi4kcHJvZ3Jlc3MsIHNlbGYubXNnVXBsb2FkRXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkNvbXBsZXRlID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi51bmxvY2soKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRTdWNjZXNzVGh1bWJzKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHVwbG9hZGNvbXBsZXRlJywgW3NlbGYuZmlsZXN0YWNrLCBzZWxmLl9nZXRFeHRyYURhdGEoKV0pO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkVycm9yID0gZnVuY3Rpb24gKGpxWEhSLCB0ZXh0U3RhdHVzLCBlcnJvclRocm93bikge1xyXG4gICAgICAgICAgICAgICAgdmFyIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKSwgb3AgPSBzZWxmLmFqYXhPcGVyYXRpb25zLnVwbG9hZEJhdGNoLFxyXG4gICAgICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93VXBsb2FkRXJyb3IoZXJyTXNnLCBvdXREYXRhLCAnZmlsZWJhdGNodXBsb2FkZXJyb3InKTtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkRmlsZUNvdW50ID0gdG90YWwgLSAxO1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGtleSA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5maWxlc3RhY2tba2V5XSAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdFcnJvcigkdGh1bWIpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICA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0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZuQmVmb3JlID0gZnVuY3Rpb24gKGpxWEhSKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNocHJldXBsb2FkJywgW291dERhdGFdKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDUwKTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy5kYXRhID0gb3V0RGF0YTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy54aHIgPSBqcVhIUjtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydChwYXJhbXMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAganFYSFIuYWJvcnQoKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzc0NhbmNlbGxlZCgpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmblN1Y2Nlc3MgPSBmdW5jdGlvbiAoZGF0YSwgdGV4dFN0YXR1cywganFYSFIpIHtcclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUiwgZGF0YSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhKSB8fCAkaC5pc0VtcHR5KGRhdGEuZXJyb3IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHVwbG9hZHN1Y2Nlc3MnLCBbb3V0RGF0YV0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFVwbG9hZFN1Y2Nlc3MoZGF0YSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIG91dERhdGEsICdmaWxlYmF0Y2h1cGxvYWRlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkNvbXBsZXRlID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi51bmxvY2soKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNodXBsb2FkY29tcGxldGUnLCBbc2VsZi5maWxlc3RhY2ssIHNlbGYuX2dldEV4dHJhRGF0YSgpXSk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuRXJyb3IgPSBmdW5jdGlvbiAoanFYSFIsIHRleHRTdGF0dXMsIGVycm9yVGhyb3duKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgb3V0RGF0YSA9IHNlbGYuX2dldE91dERhdGEoanFYSFIpLCBvcCA9IHNlbGYuYWpheE9wZXJhdGlvbnMudXBsb2FkRXh0cmEsXHJcbiAgICAgICAgICAgICAgICAgICAgZXJyTXNnID0gc2VsZi5fcGFyc2VFcnJvcihvcCwganFYSFIsIGVycm9yVGhyb3duKTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy5kYXRhID0gb3V0RGF0YTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihlcnJNc2csIG91dERhdGEsICdmaWxlYmF0Y2h1cGxvYWRlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgc2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ZyYW1lID0gJCh0aGlzKSwgbkluZCA9ICRuRnJhbWUuYXR0cignZGF0YS1maWxlaW5kZXgnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAobkluZC5zdWJzdHJpbmcoMCwgNSkgPT09ICdpbml0XycpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgbkluZCA9IHBhcnNlSW50KG5JbmQucmVwbGFjZSgnaW5pdF8nLCAnJykpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobkluZCA+IGluZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbkluZC0tO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJG5GcmFtZS5hdHRyKCdkYXRhLWZpbGVpbmRleCcsICdpbml0XycgKyBuSW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYudXBsb2FkQXN5bmMpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNhY2hlSW5pdGlhbFByZXZpZXcgPSBzZWxmLmdldFByZXZpZXcoKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRGaWxlQWN0aW9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5faW5pdFpvb21CdXR0b24oKTtcclxuICAgICAgICAgICAgc2VsZi5nZXRGcmFtZXMoJyAua3YtZmlsZS1yZW1vdmUnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpLCAkZnJhbWUgPSAkZWwuY2xvc2VzdCgkaC5GUkFNRVMpLCBoYXNFcnJvciwgaWQgPSAkZnJhbWUuYXR0cignaWQnKSxcclxuICAgICAgICAgICAgICAgICAgICBpbmQgPSAkZnJhbWUuYXR0cignZGF0YS1maWxlaW5kZXgnKSwgbiwgY2FwLCBzdGF0dXM7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRlbCwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IHNlbGYuX3JhaXNlKCdmaWxlcHJlcmVtb3ZlJywgW2lkLCBpbmRdKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzID09PSBmYWxzZSB8fCAhc2VsZi5fdmFsaWRhdGVNaW5Db3VudCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaGFzRXJyb3IgPSAkZnJhbWUuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1lcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgICRoLmNsZWFuTWVtb3J5KCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLmZhZGVPdXQoJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRoLmNsZWFuWm9vbUNhY2hlKCRwcmV2aWV3LmZpbmQoJyN6b29tLScgKyBpZCkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGluZCwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJPYmplY3RzKCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRmcmFtZS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlkICYmIGhhc0Vycm9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5maW5kKCdsaVtkYXRhLXRodW1iLWlkPVwiJyArIGlkICsgJ1wiXScpLmZhZGVPdXQoJ2Zhc3QnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuX2Vycm9yc0V4aXN0KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnMoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmlsZXN0YWNrID0gc2VsZi5nZXRGaWxlU3RhY2sodHJ1ZSksIGNoayA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gPSBmaWxlc3RhY2subGVuZ3RoLCBoYXNUaHVtYiA9IHNlbGYuc2hvd1ByZXZpZXcgJiYgc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPT09IDAgJiYgY2hrID09PSAwICYmICFoYXNUaHVtYikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5yZXNldCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGNoayArIGxlbjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhcCA9IG4gPiAxID8gc2VsZi5fZ2V0TXNnU2VsZWN0ZWQobikgOiAoZmlsZXN0YWNrWzBdID8gc2VsZi5fZ2V0RmlsZU5hbWVzKClbMF0gOiAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGNhcCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVyZW1vdmVkJywgW2lkLCBpbmRdKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgc2VsZi5nZXRGcmFtZXMoJyAua3YtZmlsZS11cGxvYWQnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkZWwsICdjbGljaycsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgJGZyYW1lID0gJGVsLmNsb3Nlc3QoJGguRlJBTUVTKSwgaW5kID0gJGZyYW1lLmF0dHIoJ2RhdGEtZmlsZWluZGV4Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kcHJvZ3Jlc3MuaGlkZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZnJhbWUuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1lcnJvcicpICYmICFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBsb2FkU2luZ2xlKGluZCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3QWN0aW9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldywgZGVsZXRlRXh0cmFEYXRhID0gc2VsZi5kZWxldGVFeHRyYURhdGEgfHwge30sXHJcbiAgICAgICAgICAgICAgICBidG5SZW1vdmUgPSAkaC5GUkFNRVMgKyAnIC5rdi1maWxlLXJlbW92ZScsIHNldHRpbmdzID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3MsXHJcbiAgICAgICAgICAgICAgICBvcmlnQ2xhc3MgPSBzZXR0aW5ncy5yZW1vdmVDbGFzcywgZXJyQ2xhc3MgPSBzZXR0aW5ncy5yZW1vdmVFcnJvckNsYXNzLFxyXG4gICAgICAgICAgICAgICAgcmVzZXRQcm9ncmVzcyA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgaGFzRmlsZXMgPSBzZWxmLmlzQWpheFVwbG9hZCA/IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCkgOiBzZWxmLl9pbnB1dEZpbGVDb3VudCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJHByZXZpZXcuZmluZCgkaC5GUkFNRVMpLmxlbmd0aCAmJiAhaGFzRmlsZXMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0Q2FwdGlvbignJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucmVzZXQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsQ2FwdGlvbiA9ICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH07XHJcb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5leHRyYTtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZXh0cmFEYXRhID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZXh0cmFEYXRhID0gZXh0cmFEYXRhKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBwYXJhbXMgPSB7aWQ6ICRlbC5hdHRyKCdpZCcpLCBrZXk6IHZLZXksIGV4dHJhOiBleHRyYURhdGF9O1xyXG4gICAgICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVwcmVkZWxldGUnLCBbdktleSwganFYSFIsIGV4dHJhRGF0YV0pO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGpxWEhSLmFib3J0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGVsLnJlbW92ZUNsYXNzKGVyckNsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRmcmFtZSwgJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRoLmFkZENzcygkZWwsICdkaXNhYmxlZCAnICsgb3JpZ0NsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgZm5TdWNjZXNzID0gZnVuY3Rpb24gKGRhdGEsIHRleHRTdGF0dXMsIGpxWEhSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGNhcDtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoZGF0YSkgJiYgISRoLmlzRW1wdHkoZGF0YS5lcnJvcikpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmpxWEhSID0ganFYSFI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5yZXNwb25zZSA9IGRhdGE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dFcnJvcihkYXRhLmVycm9yLCBwYXJhbXMsICdmaWxlZGVsZXRlZXJyb3InKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGZyYW1lLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZWwucmVtb3ZlQ2xhc3MoJ2Rpc2FibGVkICcgKyBvcmlnQ2xhc3MpLmFkZENsYXNzKGVyckNsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXRQcm9ncmVzcygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRmcmFtZS5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKS5hZGRDbGFzcygnZmlsZS1kZWxldGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLmZhZGVPdXQoJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gcGFyc2VJbnQoKCRmcmFtZS5hdHRyKCdkYXRhLWZpbGVpbmRleCcpKS5yZXBsYWNlKCdpbml0XycsICcnKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLnVuc2V0KGluZGV4KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fZGVsZXRlRmlsZUluZGV4KCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXAgPSBuID4gMCA/IHNlbGYuX2dldE1zZ1NlbGVjdGVkKG4pIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24oY2FwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVkZWxldGVkJywgW3ZLZXksIGpxWEhSLCBleHRyYURhdGFdKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguY2xlYW5ab29tQ2FjaGUoJHByZXZpZXcuZmluZCgnI3pvb20tJyArICRmcmFtZS5hdHRyKCdpZCcpKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyT2JqZWN0cygkZnJhbWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZnJhbWUucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc2V0UHJvZ3Jlc3MoKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBmbkVycm9yID0gZnVuY3Rpb24gKGpxWEhSLCB0ZXh0U3RhdHVzLCBlcnJvclRocm93bikge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBvcCA9IHNlbGYuYWpheE9wZXJhdGlvbnMuZGVsZXRlVGh1bWIsIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bik7XHJcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmpxWEhSID0ganFYSFI7XHJcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zLnJlc3BvbnNlID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd0Vycm9yKGVyck1zZywgcGFyYW1zLCAnZmlsZWRl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lvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLl92YWxpZGF0ZU1pbkNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViZWZvcmVkZWxldGUnLCBbdktleSwgZXh0cmFEYXRhXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSlNVbnJlc29sdmVkVmFyaWFibGUsSlNIaW50XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlbGYuYWpheEFib3J0ZWQgaW5zdGFuY2VvZiBQcm9taXNlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQudGhlbihmdW5jdGlvbiAocmVzdWx0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQuYWpheChzZXR0aW5ncyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5hamF4QWJvcnRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJC5hamF4KHNldHRpbmdzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9oaWRlRmlsZUljb246IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Nob3dGaWxlSWNvbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjYXB0aW9uQ29udGFpbmVyLCAnaWNvbi12aXNpYmxlJyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0U2l6ZTogZnVuY3Rpb24gKGJ5dGVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgc2l6ZSA9IHBhcnNlRmxvYXQoYnl0ZXMpLCBpLCBmdW5jID0gc2VsZi5maWxlU2l6ZUdldHRlciwgc2l6ZXMsIG91dDtcclxuICAgICAgICAgICAgaWYgKCEkLmlzTnVtZXJpYyhieXRlcykgfHwgISQuaXNOdW1lcmljKHNpemUpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBmdW5jID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBmdW5jKHNpemUpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKHNpemUgPT09IDApIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSAnMC4wMCBCJztcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaSA9IE1hdGguZmxvb3IoTWF0aC5sb2coc2l6ZSkgLyBNYXRoLmxvZygxMDI0KSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2l6ZXMgPSBbJ0InLCAnS0InLCAnTUInLCAnR0InLCAnVEInLCAnUEInLCAnRUInLCAnWkInLCAnWUInXTtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSAoc2l6ZSAvIE1hdGgucG93KDEwMjQsIGkpKS50b0ZpeGVkKDIpICogMSArICcgJyArIHNpemVzW2ldO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnc2l6ZScpLnJlcGxhY2UoJ3tzaXplVGV4dH0nLCBvdXQpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dldEZpbGVUeXBlOiBmdW5jdGlvbiAoZnR5cGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi5taW1lVHlwZUFsaWFzZXNbZnR5cGVdIHx8IGZ0eXBlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dlbmVyYXRlUHJldmlld1RlbXBsYXRlOiBmdW5jdGlvbiAoXHJcbiAgICAgICAgICAgIGNhdCxcclxuICAgICAgICAgICAgZGF0YSxcclxuICAgICAgICAgICAgZm5hbWUsXHJcbiAgICAgICAgICAgIGZ0eXBlLFxyXG4gICAgICAgICAgICBwcmV2aWV3SWQsXHJcbiAgICAgICAgICAgIGlzRXJyb3IsXHJcbiAgICAgICAgICAgIHNpemUsXHJcbiAgICAgICAgICAgIGZyYW1lQ2xhc3MsXHJcbiAgICAgICAgICAgIGZvb3QsXHJcbiAgICAgICAgICAgIGluZCxcclxuICAgICAgICAgICAgdGVtcGwsXHJcbiAgICAgICAgICAgIGF0dHJzXHJcbiAgICAgICAgKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY2FwdGlvbiA9IHNlbGY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GZ1bmN0aW9uIChrZXksIHZhbCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHN0eWxlQXR0cmlicyArPSBrZXkgKyAnOicgKyB2YWwgKyAnOyc7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBnZXRDb250ZW50ID0gZnVuY3Rpb24gKGMsIGQsIHpvb20sIGZyYW1lQ3NzKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgaWQgPSB6b29tID8gJ3pvb20tJyArIHByZXZpZXdJZCA6IHByZXZpZXdJZCwgdG1wbHQgPSBzZWxmLl9nZXRQcmV2aWV3VGVtcGxhdGUoYyksXHJcbiAgICAgICAgICAgICAgICAgICAgY3NzID0gKGZyYW1lQ2xhc3MgfHwgJycpICsgJyAnICsgZnJhbWVDc3M7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5mcmFtZUNsYXNzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY3NzID0gc2VsZi5mcmFtZUNsYXNzICsgJyAnICsgY3NzO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHpvb20pIHtcclxuICAgICAgICAgICAgICAgICAgICBjc3MgPSBjc3MucmVwbGFjZSgnICcgKyAkaC5TT1JUX0NTUywgJycpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdG1wbHQgPSBzZWxmLl9wYXJzZUZpbGVQcmV2aWV3SWNvbih0bXBsdCwgZm5hbWUpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGMgPT09ICd0ZXh0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgIGQgPSAkaC5odG1sRW5jb2RlKGQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKGNhdCA9PT0gJ29iamVjdCcgJiYgIWZ0eXBlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJC5lYWNoKHNlbGYuZGVmYXVsdHMuZmlsZVR5cGVTZXR0aW5ncywgZnVuY3Rpb24gKGtleSwgZnVuYykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSAnb2JqZWN0JyB8fCBrZXkgPT09ICdvdGhlcicpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZnVuYyhmbmFtZSwgZnR5cGUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlQ3NzID0gJ3R5cGUtJyArIGtleTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCEkaC5pc0VtcHR5KGF0dHJzKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhdHRycy50aXRsZSAhPT0gdW5kZWZpbmVkICYmIGF0dHJzLnRpdGxlICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gYXR0cnMudGl0bGU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhdHRycy5hbHQgIT09IHVuZGVmaW5lZCAmJiBhdHRycy5hbHQgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSBhdHRycy5hbHQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRtcGx0LnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAgICAgJ3ByZXZpZXdJZCc6IGlkLFxyXG4gICAgICAgICAgICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICAgICAndGl0bGUnOiB0aXRsZSxcclxuICAgICAgICAgICAgICAgICAgICAnYWx0JzogYWx0LFxyXG4gICAgICAgICAgICAgICAgICAgICdmcmFtZUNsYXNzJzogY3NzLFxyXG4gICAgICAgICAgICAgICAgICAgICd0eXBlJzogc2VsZi5fZ2V0RmlsZVR5cGUoZnR5cGUpLFxyXG4gICAgICAgICAgICAgICAgICAgICdmaWxlaW5kZXgnOiBpbmQsXHJcbiAgICAgICAgICAgICAgICAgICAgJ2ZpbGVpZCc6IHNlbGYuX2dldEZpbGVJZHMoKVtpbmRdIHx8ICcnLFxyXG4gICAgICAgICAgICAgICAgICAgICd0eXBlQ3NzJzogdHlwZUNzcyxcclxuICAgICAgICAgICAgICAgICAgICAnZm9vdGVyJzogZm9vdGVyLFxyXG4gICAgICAgICAgICAgICAgICAgICdkYXRhJzogZCxcclxuICAgICAgICAgICAgICAgICAgICAndGVtcGxhdGUnOiB0ZW1wbCB8fCBjYXQsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3N0eWxlJzogc3R5bGVBdHRyaWJzID8gJ3N0eWxlPVwiJyArIHN0eWxlQXR0cmlicyArICdcIicgOiAnJ1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGluZCA9IGluZCB8fCBwcmV2aWV3SWQuc2xpY2UocHJldmlld0lkLmxhc3RJbmRleE9mKCctJykgKyAxKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuZmlsZUFjdGlvblNldHRpbmdzLnNob3dab29tKSB7XHJcbiAgICAgICAgICAgICAgICB6b29tQ29udGVudCA9IGdldENvbnRlbnQoKGZvcmNlWm9vbUljb24gPyAnb3RoZXInIDogY2F0KSwgZGF0YSwgdHJ1ZSwgJ2t2LXpvb20tdGh1bWInKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB6b29tQ29udGVudCA9ICdcXG4nICsgc2VsZi5fZ2V0TGF5b3V0VGVtcGxhdGUoJ3pvb21DYWNoZScpLnJlcGxhY2UoJ3t6b29tQ29udGVudH0nLCB6b29tQ29udGVudCk7XHJcbiAgICAgICAgICAgIHByZXZDb250ZW50ID0gZ2V0Q29udGVudCgoZm9yY2VQcmV2SWNvbiA/ICdvdGhlcicgOiBjYXQpLCBkYXRhLCBmYWxzZSwgJ2t2LXByZXZpZXctdGh1bWInKTtcclxuICAgICAgICAgICAgcmV0dXJuIHByZXZDb250ZW50ICsgem9vbUNvbnRlbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfYWRkVG9QcmV2aWV3OiBmdW5jdGlvbiAoJHByZXZpZXcsIGNvbnRlbnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyID8gJHByZXZpZXcucHJlcGVuZChjb250ZW50KSA6ICRwcmV2aWV3LmFwcGVuZChjb250ZW50KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9wcmV2aWV3RGVmYXVsdDogZnVuY3Rpb24gKGZpbGUsIHByZXZpZXdJZCwgaXNEaXNhYmxlZCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGZuYW1lID0gJGguZ2V0RmlsZU5hbWUoZmlsZSksIGZ0eXBlID0gZmlsZSA/IGZpbGUudHlwZSA6ICcnLCBjb250ZW50LCBzaXplID0gZmlsZS5zaXplIHx8IDAsXHJcbiAgICAgICAgICAgICAgICBjYXB0aW9uID0gc2VsZi5zbHVnKGZuYW1lKSwgaXNFcnJvciA9IGlzRGlzYWJsZWQgPT09IHRydWUgJiYgIXNlbGYuaXNBamF4VXBsb2FkLFxyXG4gICAgICAgICA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ICAgICAgY2FwdGlvbiwgc2l6ZSwgcHJldmlld0lkO1xyXG4gICAgICAgICAgICBpZiAobGVuID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gZGF0YS5jb25maWdbaV07XHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3SWQgPSBzZWxmLnByZXZpZXdJbml0SWQgKyAnLScgKyAnaW5pdF8nICsgaTtcclxuICAgICAgICAgICAgICAgIGNhcHRpb24gPSAkaC5pZlNldCgnY2FwdGlvbicsIGNvbmZpZywgJGguaWZTZXQoJ2ZpbGVuYW1lJywgY29uZmlnKSk7XHJcbiAgICAgICAgICAgICAgICBzaXplID0gJGguaWZTZXQoJ3NpemUnLCBjb25maWcpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJBdHRyKHByZXZpZXdJZCwgY2FwdGlvbiwgc2l6ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zbHVnRGVmYXVsdDogZnVuY3Rpb24gKHRleHQpIHtcclxuICAgICAgICAgICAgLy8gbm9pbnNwZWN0aW9uIFJlZ0V4cFJlZHVuZGFudEVzY2FwZVxyXG4gICAgICAgICAgICByZXR1cm4gJGguaXNFbXB0eSh0ZXh0KSA/ICcnIDogU3RyaW5nKHRleHQpLnJlcGxhY2UoL1tcXFtcXF1cXC9cXHt9OjsjJT1cXChcXClcXCpcXCtcXD9cXFxcXFxeXFwkXFx8PD4mXCInXS9nLCAnXycpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwZGF0ZUZpbGVEZXRhaWxzOiBmdW5jdGlvbiAobnVtRmlsZXMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZWwgPSBzZWxmLiRlbGVtZW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maWxlLWlucHV0LW5ldyBmaWxlLWlucHV0LWFqYXgtbmV3Jyk7XHJcbiAgICAgICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID09PSAxKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXNlbGVjdCcsIFtudW1GaWxlcywgbGFiZWxdKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zZXRUaHVtYlN0YXR1czogZnVuY3Rpb24gKCR0aHVtYiwgc3RhdHVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGljb24gPSAnaW5kaWNhdG9yJyArIHN0YXR1cywgbXNnID0gaWNvbiArICdUaXRsZScsXHJcbiAgICAgICAgICAgICAgICBjc3MgPSAnZmlsZS1wcmV2aWV3LScgKyBzdGF0dXMudG9Mb3dlckNhc2UoKSxcclxuICAgICAgICAgICAgICAgICRpbmRpY2F0b3IgPSAkdGh1bWIuZmluZCgnLmZpbGUtdXBsb2FkLWluZGljYXRvcicpLFxyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3M7XHJcbiAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS1wcmV2aWV3LXN1Y2Nlc3MgZmlsZS1wcmV2aWV3LWVycm9yIGZpbGUtcHJldmlldy1sb2FkaW5nJyk7XHJcbiAgICAgICAgICAgIGlmIChzdGF0dXMgPT09ICdTdWNjZXNzJykge1xyXG4gICAgICAgICAgICAgICAgJHRodW1iLmZpbmQoJy5maWxlLWRyYWctaGFuZGxlJykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGluZGljYXRvci5odG1sKGNvbmZpZ1tpY29uXSk7XHJcbiAgICAgICAgICAgICRpbmRpY2F0b3IuYXR0cigndGl0bGUnLCBjb25maWdbbXNnXSk7XHJcbiAgICAgICAgICAgICR0aHVtYi5hZGRDbGFzcyhjc3MpO1xyXG4gICAgICAgICAgICBpZiAoc3RhdHVzID09PSAnRXJyb3InICYmICFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAkdGh1bWIuZmluZCgnLmt2LWZpbGUtdXBsb2FkJykuYXR0cignZGlzYWJsZWQnLCB0cnVlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldFByb2dyZXNzQ2FuY2VsbGVkOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCBzZWxmLiRwcm9ncmVzcywgc2VsZi5tc2dDYW5jZWxsZWQpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldFByb2dyZXNzOiBmdW5jdGlvbiAocCwgJGVsLCBlcnJvcikge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHBjdCA9IE1hdGgubWluKHAsIDEwMCksIG91dCwgcGN0TGltaXQgPSBzZWxmLnByb2dyZXNzVXBsb2FkVGhyZXNob2xkLFxyXG4gICAgICAgICAgICAgICAgdCA9IHAgPD0gMTAwID8gc2VsZi5wcm9ncmVzc1RlbXBsYXRlIDogc2VsZi5wcm9ncmVzc0NvbXBsZXRlVGVtcGxhdGUsXHJcbiAgICAgICAgICAgICAgICB0ZW1wbGF0ZSA9IHBjdCA8ID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GxlLCBzdHJGaWxlcztcclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNDbGlja2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHN0ckZpbGVzID0gJGguaXNFbXB0eShzZWxmLiRlbGVtZW50LmF0dHIoJ211bHRpcGxlJykpID8gc2VsZi5maWxlU2luZ2xlIDogc2VsZi5maWxlUGx1cmFsO1xyXG4gICAgICAgICAgICAgICAgdGl0bGUgKz0gc2VsZi5kcm9wWm9uZUNsaWNrVGl0bGUucmVwbGFjZSgne2ZpbGVzfScsIHN0ckZpbGVzKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkem9uZS5maW5kKCcuJyArIHNlbGYuZHJvcFpvbmVUaXRsZUNsYXNzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3IHx8ICR6b25lLmxlbmd0aCA9PT0gMCB8fCBzZWxmLmdldEZpbGVTdGFjaygpLmxlbmd0aCA+IDAgfHwgIXNlbGYuZHJvcFpvbmVFbmFibGVkIHx8XHJcbiAgICAgICAgICAgICAgICAoIXNlbGYuaXNBamF4VXBsb2FkICYmIHNlbGYuJGVsZW1lbnQuZmlsZXMpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCR6b25lLmZpbmQoJGguRlJBTUVTKS5sZW5ndGggPT09IDAgJiYgJGguaXNFbXB0eShzZWxmLmRlZmF1bHRQcmV2aWV3Q29udGVudCkpIHtcclxuICAgICAgICAgICAgICAgICR6b25lLnByZXBlbmQoJzxkaXYgY2xhc3M9XCInICsgc2VsZi5kcm9wWm9uZVRpdGxlQ2xhc3MgKyAnXCI+JyArIHRpdGxlICsgJzwvZGl2PicpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5yZW1vdmVDbGFzcygnZmlsZS1pbnB1dC1uZXcnKTtcclxuICAg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HJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0RmlsZUNvdW50OiBmdW5jdGlvbiAoZmlsZUNvdW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgYWRkQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi52YWxpZGF0ZUluaXRpYWxDb3VudCAmJiAhc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBhZGRDb3VudCA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCk7XHJcbiAgICAgICAgICAgICAgICBmaWxlQ291bnQgKz0gYWRkQ291bnQ7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZpbGVDb3VudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRGaWxlSWQ6IGZ1bmN0aW9uIChmaWxlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY3VzdG9tID0gc2VsZi5nZW5lcmF0ZUZpbGVJZCwgcmVsYXRpdmVQYXRoO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIGN1c3RvbSA9PT0gJ2Z1bmN0aW9uJykge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIGN1c3RvbShmaWxlLCBldmVudCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCFmaWxlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBmaWxlLnJlbGF0aXZlUGF0aCAqL1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBmaWxlLndlYmtpdFJlbGF0aXZlUGF0aCAqL1xyXG4gICAgICAgICAgICByZ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AgICAgICAgIHJldHVybiBzZWxmLmZpbGVuYW1lcy5maWx0ZXIoZnVuY3Rpb24gKG4pIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiAoc2tpcE51bGwgPyBuICE9PSB1bmRlZmluZWQgOiBuICE9PSB1bmRlZmluZWQgJiYgbiAhPT0gbnVsbCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldFByZXZpZXdFcnJvcjogZnVuY3Rpb24gKCR0aHVtYiwgaSwgdmFsLCByZXBlYXQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoaSAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGksIHZhbCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYucmVtb3ZlRnJvbVByZXZpZXdPbkVycm9yICYmICFyZXBlYXQpIHtcclxuICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0Vycm9yJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmVmcmVzaFVwbG9hZEJ1dHRvbigkdGh1bWIsIHJlcGVhdCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaFVwbG9hZEJ1dHRvbjogZnVuY3Rpb24gKCR0aHVtYiwgcmVwZWF0KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGJ0biA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKSwgY2ZnID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3MsXHJcbiAgICAgICAgICAgICAgICBpY29uID0gY2ZnLnVwbG9hZEljb24sIHRpdGxlID0gY2ZnLnVwbG9hZFRpdGxlO1xyXG4gICAgICAgICAgICBpZiAoISRidG4ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHJlcGVhdCkge1xyXG4gICAgICAgICAgICAgICAgaWNvbiA9IGNmZy51cGxvYWRSZXRyeUljb247XHJcbiAgICAgICAgICAgICAgICB0aXRsZSA9IGNmZy51cGxvYWRSZXRyeVRpdGxlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRidG4uYXR0cigndGl0bGUnLCB0aXRsZSkuaHRtbChpY29uKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jaGVja0RpbWVuc2lvbnM6IGZ1bmN0aW9uIChpLCBjaGssICRpbWcsICR0aHVtYiwgZm5hbWUsIHR5cGUsIHBhcmFtcykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIG1zZywgZGltLCB0YWcgPSBjaGsgPT09ICdTbWFsbCcgPyAnbWluJyA6ICdtYXgnLCBsaW1pdCA9IHNlbGZbdGFnICsgJ0ltYWdlJyArIHR5cGVdLFxyXG4gICAgICAgICAgICAgICAgJGltZ0VsLCBpc1ZhbGlkO1xyXG4gICAgICAgICAgICBpZiAoJGguaXNFbXB0eShsaW1pdCkgfHwgISRpbWcubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGltZ0VsID0gJGltZ1swXTtcclxuICAgICAgICAgICAgZGltID0gKHR5cGUgPT09ICdXaWR0aCcpID8gJGltZ0VsLm5hdHVyYWxXaWR0aCB8fCAkaW1nRWwud2lkdGggOiAkaW1nRWwubmF0dXJhbEhlaWdodCB8fCAkaW1nRWwuaGVpZ2h0O1xyXG4gICAgICAgICAgICBpc1ZhbGlkID0gY2hrID09PSAnU21hbGwnID8gZGltID49IGxpbWl0IDogZGltIDw9IGxpbWl0O1xyXG4gICAgICAgICAgICBpZiAoaXNWYWxpZCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9IHNlbGZbJ21zZ0ltYWdlJyArIHR5cGUgKyBjaGtdLnNldFRva2Vucyh7J25hbWUnOiBmbmFtZSwgJ3NpemUnOiBsaW1pdH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9zaG93VXBsb2FkRXJyb3IobXNnLCBwYXJhbXMpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpLCBudWxsKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRFeGlmT2JqOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGV4aWZPYmogPSBudWxsO1xyXG4gICAgICAgICAgICBpZiAoZGF0YS5zbGljZSgwLCAyMykgIT09ICdkYXRhOmltYWdlL2pwZWc7YmFzZTY0LCcgJiYgZGF0YS5zbGljZSgwLCAyMikgIT09ICdkYXRhOmltYWdlL2pwZztiYXNlNjQsJykge1xyXG4gICAgICAgICAgICAgICAgZXhpZk9iaiA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIGV4aWZPYmogPSB3aW5kb3cucGlleGlmID8gd2luZG93LnBpZXhpZi5sb2FkKGRhdGEpIDogbnVsbDtcclxuXHJcbiAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xyXG4gICAgICAgICAgICAgICAgZXhpZk9iaiA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9sb2coZXJyKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIWV4aWZPYmopIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZyhcclxuICAgICAgICAgICAgICAgICAgICAnVGhlIHBpZXhpZi5qcyBsaWJyYXJ5IHdhcyBub3QgZGV0ZWN0ZWQuIEVpdGhlciBsb2FkIHBpZXhpZi5qcyBvbiB5b3VyIHBhZ2UgT1Igc2V0IGBhdXRvT3JpZW50SW1hZ2VgIHRvIGBmYWxzZWAuJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGV4aWZPYmo7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfdmFsaWRhdGVJbWFnZU9yaWVudGF0aW9uOiBmdW5jdGlvbiAoJGltZywgZmlsZSwgcHJldmlld0lkLCBjYXB0aW9uLCBmdHlwZSwgZnNpemUsIGlEYXRhKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZXhpZk9iaiwgdmFsdWUsIGF1dG9PcmllbnRJbWFnZSA9IHNlbGYuYXV0b09yaWVudEltYWdlO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIGF1dG9PcmllbnRJbWFnZSA9PT0gJ2Z1bmN0aW9uJykge1xyXG4gICAgICAgICAgICAgICAgYXV0b09yaWVudEltYWdlID0gYXV0b09yaWVudEltYWdlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZXhpZk9iaiA9ICRpbWcubGVuZ3RoICYmIGF1dG9PcmllbnRJbWFnZSA/IHNlbGYuX2dldEV4aWZPYmooaURhdGEpIDogbnVsbDtcclxuICAgICAgICAgICAgdmFsdWUgPSBleGlmT2JqID8gZXhpZk9ialsnMHRoJ11bcGlleGlmLkltYWdlSUZELk9yaWVudGF0aW9uXSA6IG51bGw7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICA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Yi53aWR0aCgpO1xyXG4gICAgICAgICAgICAgICAgdzIgPSAkcHJldmlldy53aWR0aCgpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHcxID4gdzIpIHtcclxuICAgICAgICAgICAgICAgICAgICAkaW1nLmNzcygnd2lkdGgnLCAnMTAwJScpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgcGFyYW1zID0ge2luZDogaSwgaWQ6IHByZXZpZXdJZH07XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jaGVja0RpbWVuc2lvbnMoaSwgJ1NtYWxsJywgJGltZywgJHRodW1iLCBmbmFtZSwgJ1dpZHRoJywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnU21hbGwnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnSGVpZ2h0JywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIGlmICghc2VsZi5yZXNpemVJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnTGFyZ2UnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnV2lkdGgnLCBwYXJhbXMpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnTGFyZ2UnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnSGVpZ2h0JywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2Vsb2FkZWQnLCBbcHJldmlld0lkXSk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmxvYWRlZEltYWdlcy5wdXNoKHtcclxuICAgICAgICAgICAgICAgICAgICBpbmQ6IGksXHJcbiAgICAgICAgICAgICAgICAgICAgaW1nOiAkaW1nLFxyXG4gICAgICAgICAgICAgICAgICAgIHRodW1iOiAkdGh1bWIsXHJcbiAgICAgICAgICAgICAgICAgICAgcGlkOiBwcmV2aWV3SWQsXHJcbiAgICAgICAgICAgICAgICAgICAgdHlwOiBmdHlwZSxcclxuICAgICAgICAgICAgICAgICAgICBzaXo6IGZzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlZDogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICAgICAgaW1nRGF0YTogaURhdGEsXHJcbiAgICAgICAgICAgICAgICAgICAgZXhpZk9iajogZXhpZk9ialxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAkdGh1bWIuZGF0YSgnZXhpZicsIGV4aWZPYmopO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVBbGxJbWFnZXMoKTtcclxuICAgICAgICAgICAgfSkub25lKCdlcnJvcicsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2Vsb2FkZXJyb3InLCBbcHJldmlld0lkXSk7XHJcbiAgICAgICAgICAgIH0pLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuY29tcGxldGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkKHRoaXMpLnRyaWdnZXIoJ2xvYWQnKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuZXJyb3IpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS50cmlnZ2VyKCdlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfdmFsaWRhdGVBbGxJbWFnZXM6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpLCBjb3VudGVyID0ge3ZhbDogMH0sIG51bUltZ3MgPSBzZWxmLmxvYWRlZEltYWdlcy5sZW5ndGgsIGNvbmZpZyxcclxuICAgICAgICAgICAgICAgIGZzaXplLCBtaW5TaXplID0gc2VsZi5yZXNpemVJZlNpemVNb3JlVGhhbjtcclxuICAgICAgICAgICAgaWYgKG51bUltZ3MgIT09IHNlbGYudG90YWxJbWFnZXNDb3VudCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VzbG9hZGVkJyk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5yZXNpemVJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzZWxmLmxvYWRlZEltYWdlcy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gc2VsZi5sb2FkZWRJbWFnZXNbaV07XHJcbiAgICAgICAgICAgICAgICBpZiAoY29uZmlnLnZhbGlkYXRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgZnNpemUgPSBjb25maWcuc2l6O1xyXG4gICAgICAgICAgICAgICAgaWYgKGZzaXplICYmIGZzaXplID4gbWluU2l6ZSAqIDEwMDApIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9nZXRSZXNpemVkSW1hZ2UoY29uZmlnLCBjb3VudGVyLCBudW1JbWdzKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzW2ldLnZhbGlkYXRlZCA9IHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRSZXNpemVkSW1hZ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ldik7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpbmQpO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuZmlsZXN0YWNrW2luZF0gfHwgIWlzVmFsaWRJbWFnZSB8fCAod2lkdGggPD0gbWF4V2lkdGggJiYgaGVpZ2h0IDw9IG1heEhlaWdodCkpIHtcclxuICAgICAgICAgICAgICAgIGlmIChpc1ZhbGlkSW1hZ2UgJiYgc2VsZi5maWxlc3RhY2tbaW5kXSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VyZXNpemVkJywgW3BpZCwgaW5kXSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBjb3VudGVyLnZhbCsrO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvdW50ZXIudmFsID09PSBudW1JbWdzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVpbWFnZXNyZXNpemVkJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzVmFsaWRJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRocm93RXJyb3Ioc2VsZi5tc2dJbWFnZVJlc2l6ZUVycm9yLCB7aWQ6IHBpZCwgJ2luZGV4JzogaW5kfSwgJ2ZpbGVpbWFnZXJlc2l6ZWVycm9yJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHR5cGUgPSB0eXBlIHx8IHNlbGYucmVzaXplRGVmYXVsdEltYWdlVHlwZTtcclxuICAgICAgICAgICAgY2hrV2lkdGggPSB3aWR0aCA+IG1heFdpZHRoO1xyXG4gICAgICAgICAgICBjaGtIZWlnaHQgPSBoZWlnaHQgPiBtYXhIZWlnaHQ7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc2l6ZVByZWZlcmVuY2UgPT09ICd3aWR0aCcpIHtcclxuICAgICAgICAgICAgICAgIHJhdGlvID0gY2hrV2lkdGggPyBtYXhXaWR0aCAvIHdpZHRoIDogKGNoa0hlaWdodCA/IG1heEhlaWdodCAvIGhlaWdodCA6IDEpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgcmF0aW8gPSBjaGtIZWlnaHQgPyBtYXhIZWlnaHQgLyBoZWlnaHQgOiAoY2hrV2lkdGggPyBtYXhXaWR0aCAvIHdpZHRoIDogMSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRDYW52YXMoKTtcclxuICAgICAgICAgICAgd2lkdGggKj0gcmF0aW87XHJcbiAgICAgICAgICAgIGhlaWdodCAqPSByYXRpbztcclxuICAgICAgICAgICAgY2FudmFzLndpZHRoID0gd2lkdGg7XHJcbiAgICAgICAgICAgIGNhbnZhcy5oZWlnaHQgPSBoZWlnaHQ7XHJcbiAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICBjb250ZXh0LmRyYXdJbWFnZShpbWcsIDAsIDAsIHdpZHRoLCBoZWlnaHQpO1xyXG4gICAgICAgICAgICAgICAgZGF0YVVSSSA9IGNhbnZhcy50b0RhdGFVUkwodHlwZSwgc2VsZi5yZXNpemVRdWFsaXR5KTtcclxuICAgICAgICAgICAgICAgIGlmIChleGlmT2JqKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZXhpZlN0ciA9IHdpbmRvdy5waWV4aWYuZHVtcChleGlmT2JqKTtcclxuICAgICAgICAgICAgICAgICAgICBkYXRhVVJJID0gd2luZG93LnBpZXhpZi5pbnNlcnQoZXhpZlN0ciwgZGF0YVVSSSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBibG9iID0gJGguZGF0YVVSSTJCbG9iKGRhdGFVUkkpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5maWxlc3RhY2tbaW5kXSA9IGJsb2I7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWltYWdlcmVzaXplZCcsIFtwaWQsIGluZF0pO1xyXG4gICAgICAgICAgICAgICAgY291bnRlci52YWwrKztcclxuICAgICAgICAgICAgICAgIGlmIChjb3VudGVyLnZhbCA9PT0gbnVtSW1ncykge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VzcmVzaXplZCcsIFt1bmRlZmluZWQsIHVuZGVmaW5lZF0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCEoYmxvYiBpbnN0YW5jZW9mIEJsb2IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihzZWxmLm1zZ0ltYWdlUmVzaXplRXJyb3IsIHtpZDogcGlkLCAnaW5kZXgnOiBpbmR9LCAnZmlsZWltYWdlcmVzaXplZXJyb3InKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBjYXRjaCAoZXJyKSB7XHJcbiAgICAgICAgICAgICAgICBjb3VudGVyLnZhbCsrO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvdW50ZXIudmFsID09PSBudW1JbWdzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVpbWFnZXNyZXNpemVkJywgW3VuZGVmaW5lZCwgdW5kZWZpbmVkXSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ0ltYWdlUmVzaXplRXhjZXB0aW9uLnJlcGxhY2UoJ3tlcnJvcnN9JywgZXJyLm1lc3NhZ2UpO1xyXG4gICAgICAgICAgICAgICAgdGhyb3dFcnJvcihtc2csIHtpZDogcGlkLCAnaW5kZXgnOiBpbmR9LCAnZmlsZWltYWdlcmVzaXplZXhjZXB0aW9uJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9pbml0QnJvd3NlOiBmdW5jdGlvbiAoJGNvbnRhaW5lcikge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlbCA9IHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dCcm93c2UpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGJ0bkZpbGUgPSAkY29udGFpbmVyLmZpbmQoJy5idG4tZmlsZScpLmFwcGVuZCgkZWwpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJGVsLmFwcGVuZFRvKCRjb250YWluZXIpLmF0dHIoJ3RhYmluZGV4JywgLTEpO1xyXG4gICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRlbCwgJ2ZpbGUtbm8tYnJvd3NlJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9pbml0Q2xpY2thYmxlOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJHpvbmUsICR0bXBab25lO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNDbGlja2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkem9uZSA9IHNlbGYuJGRyb3Bab25lO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAkdG1wWm9uZSA9IHNlbGYuJHByZXZpZXcuZmluZCgnLmZpbGUtZGVmYXVsdC1wcmV2aWV3Jyk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJHRtcFpvbmUubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJHpvbmUgPSAkdG1wWm9uZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgJGguYWRkQ3NzKCR6b25lLCAnY2xpY2thYmxlJyk7XHJcbiAgICAgICAgICAgICR6b25lLmF0dHIoJ3RhYmluZGV4JywgLTEpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCR6b25lLCAnY2xpY2snLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0YXIgPSAkKGUudGFyZ2V0KTtcclxuICAgICAgICAgICAgICAgIGlmICghJChzZWxmLmVsRXJyb3JDb250YWluZXIgKyAnOnZpc2libGUnKS5sZW5ndGggJiZcclxuICAgICAgICAgICAgICAgICAgICAoISR0YXIucGFyZW50cygnLmZpbGUtcHJldmlldy10aHVtYm5haWxzJykubGVuZ3RoIHx8ICR0YXIucGFyZW50cyhcclxuICAgICAgICAgICAgICAgICAgICAgICAgJy5maWxlLWRlZmF1bHQtcHJldmlldycpLmxlbmd0aCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRlbGVtZW50LmRhdGEoJ3pvbmVDbGlja2VkJywgdHJ1ZSkudHJpZ2dlcignY2xpY2snKTtcclxuICAgICAgICAgICAgICAgICAgICAkem9uZS5ibHVyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRDYXB0aW9uOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY2FwID0gc2VsZi5pbml0aWFsQ2FwdGlvbiB8fCAnJztcclxuICAgICAgICAgICAgaWYgKHNlbGYub3ZlcndyaXRlSW5pdGlhbCB8fCAkaC5pc0VtcHR5KGNhcCkpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGNhcHRpb24udmFsKCcnKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGNhcCk7XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldENhcHRpb246IGZ1bmN0aW9uIChjb250ZW50LCBpc0Vycm9yKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdGl0bGUsIG91dCwgaWNvbiwgbiwgY2FwLCBzdGFjayA9IHNlbGYuZ2V0RmlsZVN0YWNrKCk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi4kY2FwdGlvbi5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgaWYgKGlzRXJyb3IpIHtcclxuICAgICAgICAgICAgICAgIHRpdGxlID0gJCgnPGRpdj4nICsgc2VsZi5tc2dWYWxpZGF0aW9uRXJyb3IgKyAnPC9kaXY+JykudGV4dCgpO1xyXG4gICAgICAgICAgICAgICAgbiA9IHN0YWNrLmxlbmd0aDtcclxuICAgICAgICAgICAgICAgIGlmIChuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY2FwID0gbiA9PT0gMSAmJiBzdGFja1swXSA/IHNlbGYuX2dldEZpbGVOYW1lcygpWzBdIDogc2VsZi5fZ2V0TXNnU2VsZWN0ZWQobik7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGNhcCA9IHNlbGYuX2dldE1zZ1NlbGVjdGVkKHNlbGYubXNnTm8pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgb3V0ID0gJGguaXNFbXB0eShjb250ZW50KSA/IGNhcCA6IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICBpY29uID0gJzxzcGFuIGNsYXNzPVwiJyArIHNlbGYubXNnVmFsaWRhdGlvbkVycm9yQ2xhc3MgKyAnXCI+JyArIHNlbGYubXNnVmFsaWRhdGlvbkVycm9ySWNvbiArICc8L3NwYW4+JztcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KGNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdGl0bGUgPSAkKCc8ZGl2PicgKyBjb250ZW50ICsgJzwvZGl2PicpLnRleHQoKTtcclxuICAgICAgICAgICAgICAgIG91dCA9IHRpdGxlO1xyXG4gICAgICAgICAgICAgICAgaWNvbiA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdmaWxlSWNvbicpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuJGNhcHRpb25Db250YWluZXIuYWRkQ2xhc3MoJ2ljb24tdmlzaWJsZScpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uLmF0dHIoJ3RpdGxlJywgdGl0bGUpLnZhbChvdXQpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uSWNvbi5odG1sKGljb24pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NyZWF0ZUNvbnRhaW5lcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGF0dHJpYnMgPSB7J2NsYXNzJzogJ2ZpbGUtaW5wdXQgZmlsZS1pbnB1dC1uZXcnICsgKHNlbGYucnRsID8gJyBrdi1ydGwnIDogJycpfSxcclxuICAgICAgICAgICAgICAgICRjb250YWluZXIgPSAkKGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpKS5hdHRyKGF0dHJpYnMpLmh0bWwoc2VsZi5fcmVuZGVyTWFpbigpKTtcclxuICAgICAgICAgICAgJGNvbnRhaW5lci5pbnNlcnRCZWZvcmUoc2VsZi4kZWxlbWVudCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRCcm93c2UoJGNvbnRhaW5lcik7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnRoZW1lKSB7XHJcbiAgICAgICAgICAgICAgICAkY29udGFpbmVyLmFkZENsYXNzKCd0aGVtZS0nICsgc2VsZi50aGVtZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICRjb250YWluZXI7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaENvbnRhaW5lcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRjb250YWluZXIgPSBzZWxmLiRjb250YWluZXIsICRlbCA9IHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgICAgICRlbC5pbnNlcnRBZnRlcigkY29udGFpbmVyKTtcclxuICAgICAgICAgICAgJGNvbnRhaW5lci5odG1sKHNlbGYuX3JlbmRlck1haW4oKSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRCcm93c2UoJGNvbnRhaW5lcik7XHJcbiAgICAgICAgICAgIHNlbGYuX3ZhbGlkYXRlRGlzYWJsZWQoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZURpc2FibGVkOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kY2FwdGlvbi5hdHRyKHtyZWFkb25seTogc2VsZi5pc0Rpc2FibGVkfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVuZGVyTWFpbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsXHJcbiAgICAgICAgICAgICAgICBkcm9wQ3NzID0gc2VsZi5kcm9wWm9uZUVuYWJsZWQgPyAnIGZpbGUtZHJvcC16b25lJyA6ICdmaWxlLWRyb3AtZGlzYWJsZWQnLFxyXG4gICAgICAgICAgICAgICAgY2xvc2UgPSAhc2VsZi5zaG93Q2xvc2UgPyAnJyA6IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdjbG9zZScpLFxyXG4gICAgICAgICAgICAgICAgcHJldmlldyA9ICFzZWxmLnNob3dQcmV2aWV3ID8gJycgOiBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgncHJldmlldycpXHJcbiAgICAgICAgICAgICAgICAgICAgLnNldFRva2Vucyh7J2NsYXNzJzogc2VsZi5wcmV2aWV3Q2xhc3MsICdkcm9wQ2xhc3MnOiBkcm9wQ3NzfSksXHJcbiAgICAgICAgICAgICAgICBjc3MgPSBzZWxmLmlzRGlzYWJsZWQgPyBzZWxmLmNhcHRpb25DbGFzcyArICcgZmlsZS1jYXB0aW9uLWRpc2FibGVkJyA6IHNlbGYuY2FwdGlvbkNsYXNzLFxyXG4gICAgICAgICAgICAgICAgY2FwdGlvbiA9IHNlbGYuY2FwdGlvblRlbXBsYXRlLnNldFRva2Vucyh7J2NsYXNzJzogY3NzICsgJyBrdi1maWxlaW5wdXQtY2FwdGlvbid9KTtcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYubWFpblRlbXBsYXRlLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAnY2xhc3MnOiBzZWxmLm1haW5DbGFzcyArICghc2VsZi5zaG93QnJvd3NlICYmIHNlbGYuc2hvd0NhcHRpb24gPyAnIG5vLWJyb3dzZScgOiAnJyksXHJcbiAgICAgICAgICAgICAgICAncHJldmlldyc6IHByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAnY2xvc2UnOiBjbG9zZSxcclxuICAgICAgICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICd1cGxvYWQnOiBzZWxmLl9yZW5kZXJCdXR0b24oJ3VwbG9hZCcpLFxyXG4gICAgICAgICAgICAgICAgJ3JlbW92ZSc6IHNlbGYuX3JlbmRlckJ1dHRvbigncmVtb3ZlJyksXHJcbiAgICAgICAgICAgICAgICAnY2FuY2VsJzogc2VsZi5fcmVuZGVyQnV0dG9uKCdjYW5jZWwnKSxcclxuICAgICAgICAgICAgICAgICdicm93c2UnOiBzZWxmLl9yZW5kZXJCdXR0b24oJ2Jyb3dzZScpXHJcbiAgICAgICAgICAgIH0pO1xyXG5cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZW5kZXJCdXR0b246IGZ1bmN0aW9uICh0eXBlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdG1wbHQgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYnRuRGVmYXVsdCcpLCBjc3MgPSBzZWxmW3R5cGUgKyAnQ2xhc3MnXSxcclxuICAgICAgICAgICAgICAgIHRpdGxlID0gc2VsZlt0eXBlICsgJ1RpdGxlJ10sIGljb24gPSBzZWxmW3R5cGUgKyAnSWNvbiddLCBsYWJlbCA9IHNlbGZbdHlwZSArICdMYWJlbCddLFxyXG4gICAgICAgICAgICAgICAgc3RhdHVzID0gc2VsZi5pc0Rpc2FibGVkID8gJyBkaXNhYmxlZCcgOiAnJywgYnRuVHlwZSA9ICdidXR0b24nO1xyXG4gICAgICAgICAgICBzd2l0Y2ggKHR5cGUpIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgJ3JlbW92ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dSZW1vdmUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2NhbmNlbCc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dDYW5jZWwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBjc3MgKz0gJyBrdi1oaWRkZW4nO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAndXBsb2FkJzpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuc2hvd1VwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCAmJiAhc2VsZi5pc0Rpc2FibGVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRtcGx0ID0gc2VsZi5fZ2V0TGF5b3V0VGVtcGxhdGUoJ2J0bkxpbmsnKS5yZXBsYWNlKCd7aHJlZn0nLCBzZWxmLnVwbG9hZFVybCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYnRuVHlwZSA9ICdzdWJtaXQnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2Jyb3dzZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dCcm93c2UpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB0bXBsdCA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdidG5Ccm93c2UnKTtcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGRlZm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wgZmFsc2UpLFxyXG4gICAgICAgICAgICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3dpZHRoJzogd2lkdGgsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3Byb2dyZXNzJzogc2VsZi5fcmVuZGVyVGh1bWJQcm9ncmVzcygpLFxyXG4gICAgICAgICAgICAgICAgICAgICdpbmRpY2F0b3InOiBpbmRpY2F0b3JcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgb3V0ID0gdGVtcGxhdGUuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnYWN0aW9ucyc6IHNlbGYuX3JlbmRlckZpbGVBY3Rpb25zKGZhbHNlLCBmYWxzZSwgZmFsc2UsIHpvb20sIGRyZywgZmFsc2UsIGZhbHNlLCBmYWxzZSksXHJcbiAgICAgICAgICAgICAgICAgICAgJ2NhcHRpb24nOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICdzaXplJzogc2l6ZSxcclxuICAgICAgICAgICAgICAgICAgICAnd2lkdGgnOiB3aWR0aCxcclxuICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnOiAnJyxcclxuICAgICAgICAgICAgICAgICAgICAnaW5kaWNhdG9yJzogaW5kaWNhdG9yXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvdXQgPSAkaC5yZXBsYWNlVGFncyhvdXQsIHNlbGYucHJldmlld1RodW1iVGFncyk7XHJcbiAgICAgICAgICAgIHJldHVybiBvdXQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVuZGVyRmlsZUFjdGlvbnM6IGZ1bmN0aW9uIChcclxuICAgICAgICAgICAgc2hvd1VwbCxcclxuICAgICAgICAgICAgc2hvd0R3bixcclxuICAgICAgICAgICAgc2hvd0RlbCxcclxuICAgICAgICAgICAgc2hvd1pvb20sXHJcbiAgICAgICAgICAgIHNob3dEcmFnLFxyXG4gICAgICAgICAgICBkaXNhYmxlZCxcclxuICAgICAgICAgICAgdXJsLFxyXG4gICAgICAgICAgICBrZXksXHJcbiAgICAgICAgICAgIGlzSW5pdCxcclxuICAgICAgICAgICAgZFVybCxcclxuICAgICAgICAgICAgZEZpbGVcclxuICAgICAgICApIHtcclxuICAgICAgICAgICAgaWYgKCFzaG93VXBsICYmICFzaG93RHduICYmICFzaG93RGVsICYmICFzaG93Wm9vbSAmJiAhc2hvd0RyYWcpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHZVcmwgPSB1cmwgPT09IGZhbHNlID8gJycgOiAnIGRhdGEtdXJsPVwiJyArIHVybCArICdcIicsXHJcbiAgICAgICAgICAgICAgICB2S2V5ID0ga2V5ID09PSBmYWxzZSA/ICcnIDogJyBkYXRhLWtleT1cIicgKyBrZXkgKyAnXCInLCBidG5EZWxldGUgPSAnJywgYnRuVXBsb2FkID0gJycsIGJ0bkRvd25sb2FkID0gJycsXHJcbiAgICAgICAgICAgICAgICBidG5ab29tID0gJycsIGJ0bkRyYWcgPSAnJywgY3NzLCB0ZW1wbGF0ZSA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25zJyksXHJcbiAgICAgICAgICAgICAgICBjb25maWcgPSBzZWxmLmZpbGVBY3Rpb25TZXR0aW5ncyxcclxuICAgICAgICAgICAgICAgIG90aGVyQnV0dG9ucyA9IHNlbGYub3RoZXJBY3Rpb25CdXR0b25zLnNldFRva2Vucyh7J2RhdGFLZXknOiB2S2V5LCAna2V5Jzoga2V5fSksXHJcbiAgICAgICAgICAgICAgICByZW1vdmVDbGFzcyA9IGRpc2FibGVkID8gY29uZmlnLnJlbW92ZUNsYXNzICsgJyBkaXNhYmxlZCcgOiBjb25maWcucmVtb3ZlQ2xhc3M7XHJcbiAgICAgICAgICAgIGlmIChzaG93RGVsKSB7XHJcbiAgICAgICAgICAgICAgICBidG5EZWxldGUgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYWN0aW9uRGVsZXRlJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAncmVtb3ZlQ2xhc3MnOiByZW1vdmVDbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAncmVtb3ZlSWNvbic6IGNvbmZpZy5yZW1vdmVJY29uLFxyXG4gICAgICAgICAgICAgICAgICAgICdyZW1vdmVUaXRsZSc6IGNvbmZpZy5yZW1vdmVUaXRsZSxcclxuICAgICAgICAgICAgICAgICAgICAnZGF0YVVybCc6IHZVcmwsXHJcbiAgICAgICAgICAgICAgICAgICAgJ2RhdGFLZXknOiB2S2V5LFxyXG4gICAgICAgICAgICAgICAgICAgICdrZXknOiBrZXlcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93VXBsKSB7XHJcbiAgICAgICAgICAgICAgICBidG5VcGxvYWQgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYWN0aW9uVXBsb2FkJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAndXBsb2FkQ2xhc3MnOiBjb25maWcudXBsb2FkQ2xhc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3VwbG9hZEljb24nOiBjb25maWcudXBsb2FkSWNvbixcclxuICAgICAgICAgICAgICAgICAgICAndXBsb2FkVGl0bGUnOiBjb25maWcudXBsb2FkVGl0bGVcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93RHduKSB7XHJcbiAgICAgICAgICAgICAgICBidG5Eb3dubG9hZCA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25Eb3dubG9hZCcpLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAgICAgJ2Rvd25sb2FkQ2xhc3MnOiBjb25maWcuZG93bmxvYWRDbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAnZG93bmxvYWRJY29uJzogY29uZmlnLmRvd25sb2FkSWNvbixcclxuICAgICAgICAgICAgICAgICAgICAnZG93bmxvYWRUaXRsZSc6IGNvbmZpZy5kb3dubG9hZFRpdGxlLFxyXG4gICAgICAgICAgICAgICAgICAgICdkb3dubG9hZFVybCc6IGRVcmwgfHwgc2VsZi5pbml0aWFsUHJldmlld0Rvd25sb2FkVXJsXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIGJ0bkRvd25sb2FkID0gYnRuRG93bmxvYWQuc2V0VG9rZW5zKHsnZmlsZW5hbWUnOiBkRmlsZSwgJ2tleSc6IGtleX0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93Wm9vbSkge1xyXG4gICAgICAgICAgICAgICAgYnRuWm9vbSA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25ab29tJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnem9vbUNsYXNzJzogY29uZmlnLnpvb21DbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAnem9vbUljb24nOiBjb25maWcuem9vbUljb24sXHJcbiAgICAgICAgICAgICAgICAgICAgJ3pvb21UaXRsZSc6IGNvbmZpZy56b29tVGl0bGVcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93RHJhZyAmJiBpc0luaXQpIHtcclxuICAgICAgICAgICAgICAgIGNzcyA9ICdkcmFnLWhhbmRsZS1pbml0ICcgKyBjb25maWcuZHJhZ0NsYXNzO1xyXG4gICAgICAgICAgICAgICAgYnRuRHJhZyA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25EcmFnJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnZHJhZ0NsYXNzJzogY3NzLFxyXG4gICAgICAgICAgICAgICAgICAgICdkcmFnVGl0bGUnOiBjb25maWcuZHJhZ1RpdGxlLFxyXG4gICAgICAgICAgICAgICAgICAgICdkcmFnSWNvbic6IGNvbmZpZy5kcmFnSWNvblxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHRlbXBsYXRlLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAnZGVsZXRlJzogYnRuRGVsZXRlLFxyXG4gICAgICAgICAgICAgICAgJ3VwbG9hZCc6IGJ0blVwbG9hZCxcclxuICAgICAgICAgICAgICAgICdkb3dubG9hZCc6IGJ0bkRvd25sb2FkLFxyXG4gICAgICAgICAgICAgICAgJ3pvb20nOiBidG5ab29tLFxyXG4gICAgICAgICAgICAgICAgJ2RyYWcnOiBidG5EcmFnLFxyXG4gICAgICAgICAgICAgICAgJ290aGVyJzogb3RoZXJCdXR0b25zXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2Jyb3dzZTogZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoZSAmJiBlLmlzRGVmYXVsdFByZXZlbnRlZCgpIHx8ICFzZWxmLl9yYWlzZSgnZmlsZWJyb3dzZScpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNFcnJvciAmJiAhc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuY2xlYXIoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLmZvY3VzKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZmlsdGVyRHVwbGljYXRlOiBmdW5jdGlvbiAoZmlsZSwgZmlsZXMsIGZpbGVJZHMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBmaWxlSWQgPSBzZWxmLl9nZXRGaWxlSWQoZmlsZSk7XHJcblxyXG4gICAgICAgICAgICBpZiAoZmlsZUlkICYmIGZpbGVJZHMgJiYgZmlsZUlkcy5pbmRleE9mKGZpbGVJZCkgPiAtMSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghZmlsZUlkcykge1xyXG4gICAgICAgICAgICAgICAgZmlsZUlkcyA9IFtdO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZpbGVzLnB1c2goZmlsZSk7XHJcbiAgICAgICAgICAgIGZpbGVJZHMucHVzaChmaWxlSWQpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NoYW5nZTogZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5jaGFuZ2VUcmlnZ2VyZWQpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgJGVsID0gc2VsZi4kZWxlbWVudCwgaXNEcmFnRHJvcCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxLCBpc0FqYXhVcGxvYWQgPSBzZWxmLmlzQWpheFVwbG9hZCxcclxuICAgICAgICAgICAgICAgIHRmaWxlcyA9IFtdLCBmaWxlcyA9IGlzRHJhZ0Ryb3AgPyBhcmd1bWVudHNbMV0gOiAkZWwuZ2V0KDApLmZpbGVzLCB0b3RhbCxcclxuICAgICAgICAgICAgICAgIG1heENvdW50ID0gIWlzQWpheFV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XNFcnJvciA9IHRocm93RXJyb3IobXNnLCBudWxsLCBudWxsLCBudWxsKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKCcnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtaW5wdXQtbmV3IGZpbGUtaW5wdXQtYWpheC1uZXcnKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNlbGYucmVhZGVyID0gbnVsbDtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRVcGxvYWQoKTtcclxuICAgICAgICAgICAgc2VsZi5faGlkZUZpbGVJY29uKCk7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLmRyb3Bab25lRW5hYmxlZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlLWRyb3Atem9uZSAuJyArIHNlbGYuZHJvcFpvbmVUaXRsZUNsYXNzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uICh2S2V5LCB2RmlsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2ZpbHRlckR1cGxpY2F0ZSh2RmlsZSwgdGZpbGVzLCBmaWxlSWRzKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKGUudGFyZ2V0ICYmIGUudGFyZ2V0LmZpbGVzID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlcyA9IGUudGFyZ2V0LnZhbHVlID8gW3tuYW1lOiBlLnRhcmdldC52YWx1ZS5yZXBsYWNlKC9eLitcXFxcLywgJycpfV0gOiBbXTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZXMgPSBlLnRhcmdldC5maWxlcyB8fCB7fTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHRmaWxlcyA9IGZpbGVzO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KHRmaWxlcykgfHwgdGZpbGVzLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFpc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNsZWFyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXNlbGVjdG5vbmUnKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9yZXNldEVycm9ycygpO1xyXG4gICAgICAgICAgICBsZW4gPSB0ZmlsZXMubGVuZ3RoO1xyXG4gICAgICAgICAgICB0b3RhbCA9IHNlbGYuX2dldEZpbGVDb3VudChpc0FqYXhVcGxvYWQgPyAoc2VsZi5nZXRGaWxlU3RhY2soKS5sZW5ndGggKyBsZW4pIDogbGVuKTtcclxuICAgICAgICAgICAgaWYgKG1heENvdW50ID4gMCAmJiB0b3RhbCA+IG1heENvdW50KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuYXV0b1JlcGxhY2UgfHwgbGVuID4gbWF4Q291bnQpIHtcclxuICAgICAgICAgICAgICAgICAgICBtYXhDb3VudENoZWNrKChzZWxmLmF1dG9SZXBsYWNlICYmIGxlbiA+IG1heENvdW50ID8gbGVuIDogdG90YWwpLCBtYXhDb3VudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHRvdGFsID4gbWF4Q291bnQpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yZXNldFByZXZpZXdUaHVtYnMoaXNBamF4VXBsb2FkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmICghaXNBamF4VXBsb2FkIHx8IGZsYWdTaW5nbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yZXNldFByZXZpZXdUaHVtYnMoZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChmbGFnU2luZ2xlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQWpheFVwbG9hZCAmJiBjdHIgPT09IDAgJiYgKCFzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpIHx8IHNlbGYub3ZlcndyaXRlSW5pdGlhbCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzZXRQcmV2aWV3VGh1bWJzKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc1ByZXZpZXdhYmxlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnJlYWRGaWxlcyh0ZmlsZXMpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMoMSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF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AgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGluZCA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpLCBmaWxlID0gc2VsZi5maWxlc3RhY2tbaW5kXSxcclxuICAgICAgICAgICAgICAgICAgICBwaWQgPSAkdGh1bWIuYXR0cignaWQnKTtcclxuICAgICAgICAgICAgICAgIGlmIChpbmQgPT09ICctMScgfHwgaW5kID09PSAtMSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChmaWxlICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBuZXdzdGFja1tpXSA9IGZpbGU7XHJcbiAgICAgICAgICAgICAgICAgICAgbmV3bmFtZXNbaV0gPSBzZWxmLl9nZXRGaWxlTmFtZShmaWxlKTtcclxuICAgICAgICAgICAgICAgICAgICBuZXdpZHNbaV0gPSBzZWxmLl9nZXRGaWxlSWQoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1iLmF0dHIoeydpZCc6IHNlbGYucHJldmlld0luaXRJZCArICctJyArIGksICdkYXRhLWZpbGVpbmRleCc6IGl9KTtcclxuICAgICAgICAgICAgICAgICAgICBpKys7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5hdHRyKHsnaWQnOiAndXBsb2FkZWQtJyArICRoLnVuaXFJZCgpLCAnZGF0YS1maWxlaW5kZXgnOiAnLTEnfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRwcmV2aWV3LmZpbmQoJyN6b29tLScgKyBwaWQpLmF0dHIoe1xyXG4gICAgICAgICAgICAgICAgICAgICdpZCc6ICd6b29tLScgKyAkdGh1bWIuYXR0cignaWQnKSxcclxuICAgICAgICAgICAgICAgICAgICAnZGF0YS1maWxlaW5kZXgnOiAkdGh1bWIuYXR0cignZGF0YS1maWxlaW5kZXgnKVxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVzdGFjayA9IG5ld3N0YWNrO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVuYW1lcyA9IG5ld25hbWVzO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVpZHMgPSBuZXdpZHM7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaXNGaWxlU2VsZWN0aW9uVmFsaWQ6IGZ1bmN0aW9uIChjbnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBjbnQgPSBjbnQgfHwgMDtcclxuICAgICAgICAgICAgaWYgKHNlbGYucmVxdWlyZWQgJiYgIXNlbGYuZ2V0RmlsZXNDb3VudCgpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5odG1sKCcnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihzZWxmLm1zZ0ZpbGVSZXF1aXJlZCk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYubWluRmlsZUNvdW50ID4gMCAmJiBzZWxmLl9nZXRGaWxlQ291bnQoY250KSA8IHNlbGYubWluRmlsZUNvdW50KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9ub0ZpbGVzRXJyb3Ioe30pO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYXJTdGFjazogZnVuY3R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XG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2sodW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpbmRleCArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG51bUZpbGVzID0gMDtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdEZpbGVBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1iID0gJCgnIycgKyBwcmV2aWV3SWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlbGYucmVtb3ZlRnJvbVByZXZpZXdPbkVycm9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pc0Vycm9yID0gc2VsZi5pc0FqYXhVcGxvYWQgPyBzZWxmLl9zaG93VXBsb2FkRXJyb3IobXNnLCBwMSkgOiBzZWxmLl9zaG93RXJyb3IobXNnLCBwMik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudG90YWxJbWFnZXNDb3VudCA9IDA7XHJcblxyXG4gICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uIChrZXksIGZpbGUpIHtcclxuICAgICAgICAgICAgICAgIHZhciBmdW5jID0gc2VsZi5maWxlVHlwZVNldHRpbmdzLmltYWdlO1xyXG4gICAgICAgICAgICAgICAgaWYgKGZ1bmMgJiYgZnVuYyhmaWxlLnR5cGUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi50b3RhbEltYWdlc0NvdW50Kys7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICByZWFkRmlsZSA9IGZ1bmN0aW9uIChpKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eSgkZWwuYXR0cignbXVsdGlwbGUnKSkpIHtcclxuICAgICAgICAgICAgICAgICAgICBudW1GaWxlcyA9IDE7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoaSA+PSBudW1GaWxlcykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCAmJiBzZWxmLmZpbGVzdGFjay5sZW5ndGggPiAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlYmF0Y2hzZWxlY3RlZCcsIFtzZWxmLmdldEZpbGVTdGFjaygpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHNlbGVjdGVkJywgW2ZpbGVzXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdmFyIG5vZGUgPSBjdHIgKyBpLCBwcmV2aWV3SWQgPSBwcmV2aWV3SW5pdElkICsgJy0nICsgbm9kZSwgZmlsZSA9IGZpbGVzW2ldLCBmU2l6ZUtCLCBqLCBtc2csXHJcbiAgICAgICAgICAgICAgICAgICAgZm5UZXh0ID0gc2V0dGluZ3MudGV4dCwgZm5JbWFnZSA9IHNldHRpbmdzLmltYWdlLCBmbkh0bWwgPSBzZXR0aW5ncy5odG1sLCB0eXAsIGNoaywgdHlwMSwgdHlwMixcclxuICAgICAgICAgICAgICAgICAgICBjYXB0aW9uID0gc2VsZi5fZ2V0RmlsZU5hbWUoZmlsZSwgJycpLCBmaWxlU2l6ZSA9IChmaWxlICYmIGZpbGUuc2l6ZSB8fCAwKSAvIDEwMDAsXHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZUV4dEV4cHIgPSAnJywgcHJldmlld0RhdGEgPSAkaC5jcmVhdGVPYmplY3RVUkwoZmlsZSksIGZpbGVDb3VudCA9IDAsXHJcbiAgICAgICAgICAgICAgICAgICAgc3RyVHlwZXMgPSAnJyxcclxuICAgICAgICAgICAgICAgICAgICBmdW5jLCBrbm93blR5cGVzID0gMCwgaXNUZXh0LCBpc0h0bWwsIGlzSW1hZ2UsIHR4dEZsYWcsIHByb2Nlc3NGaWxlTG9hZGVkID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgbXNnID0gbXNnUHJvZ3Jlc3Muc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbmRleCc6IGkgKyAxLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ZpbGVzJzogbnVtRmlsZXMsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGVyY2VudCc6IDUwLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbChtc2cpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZEZpbGUoaSArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWxvYWRlZCcsIFtmaWxlLCBwcmV2aWV3SWQsIGksIHJlYWRlcl0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBpZiAoIWZpbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAodHlwTGVuID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCB0eXBMZW47IGorKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXAxID0gZmlsZVR5cGVzW2pdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXAyID0gc2VsZi5tc2dGaWxlVHlwZXNbdHlwMV0gfHwgdHlwMTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyVHlwZXMgKz0gaiA9PT0gMCA/IHR5cDIgOiAnLCAnICsgdHlwMjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoY2FwdGlvbiA9PT0gZmFsc2UpIHtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpICsgMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKGNhcHRpb24ubGVuZ3RoID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbXNnID0gc2VsZi5tc2dJbnZhbGlkRmlsZU5hbWUucmVwbGFjZSgne25hbWV9JywgJGguaHRtbEVuY29kZSgkaC5nZXRGaWxlTmFtZShmaWxlKSwgJ1t1bmtub3duXScpKTtcclxuICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoZmlsZUV4dCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlRXh0RXhwciA9IG5ldyBSZWdFeHAoJ1xcXFwuKCcgKyBmaWxlRXh0LmpvaW4oJ3wnKSArICcpJCcsICdpJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBmU2l6ZUtCID0gZmlsZVNpemUudG9GaXhlZCgyKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLm1heEZpbGVTaXplID4gMCAmJiBmaWxlU2l6ZSA+IHNlbGYubWF4RmlsZVNpemUpIHtcclxuICAgICAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ1NpemVUb29MYXJnZS5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAnbmFtZSc6IGNhcHRpb24sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdzaXplJzogZlNpemVLQixcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ21heFNpemUnOiBzZWxmLm1heEZpbGVTaXplXHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihtc2csIGZpbGUsIHByZXZpZXdJZCwgaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYubWluRmlsZVNpemUgIT09IG51bGwgJiYgZmlsZVNpemUgPD0gJGguZ2V0TnVtKHNlbGYubWluRmlsZVNpemUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbXNnID0gc2VsZi5tc2dTaXplVG9vU21hbGwuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IGZTaXplS0IsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdtaW5TaXplJzogc2VsZi5taW5GaWxlU2l6ZVxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHRocm93RXJyb3IobXNnLCBmaWxlLCBwcmV2aWV3SWQsIGkpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShmaWxlVHlwZXMpICYmICRoLmlzQXJyYXkoZmlsZVR5cGVzKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCBmaWxlVHlwZXMubGVuZ3RoOyBqICs9IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdHlwID0gZmlsZVR5cGVzW2pdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmdW5jID0gc2V0dGluZ3NbdHlwXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZmlsZUNvdW50ICs9ICFmdW5jIHx8ICh0eXBlb2YgZnVuYyAhPT0gJ2Z1bmN0aW9uJykgPyAwIDogKGZ1bmMoZmlsZS50eXBlLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGguZ2V0RmlsZU5hbWUoZmlsZSkpID8gMSA6IDApO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAoZmlsZUNvdW50ID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG1zZyA9IHNlbGYubXNnSW52YWxpZEZpbGVUeXBlLnNldFRva2Vucyh7J25hbWUnOiBjYXB0aW9uLCAndHlwZXMnOiBzdHJUeXBlc30pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChmaWxlQ291bnQgPT09IDAgJiYgISRoLmlzRW1wdHkoZmlsZUV4dCkgJiYgJGguaXNBcnJheShmaWxlRXh0KSAmJiAhJGguaXNFbXB0eShmaWxlRXh0RXhwcikpIHtcclxuICAgICAgICAgICAgICAgICAgICBjaGsgPSAkaC5jb21wYXJlKGNhcHRpb24sIGZpbGVFeHRFeHByKTtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlQ291bnQgKz0gJGguaXNFbXB0eShjaGspID8gMCA6IGNoay5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGVDb3VudCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ0ludmFsaWRGaWxlRXh0ZW5zaW9uLnNldFRva2Vucyh7J25hbWUnOiBjYXB0aW9uLCAnZXh0ZW5zaW9ucyc6IHN0ckV4dH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICghc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2soZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpICsgMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3VwZGF0ZUZpbGVEZXRhaWxzKG51bUZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlbG9hZGVkJywgW2ZpbGUsIHByZXZpZXdJZCwgaSwgcmVhZGVyXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCFjYW5QcmV2aWV3ICYmIGZpbGVTaXplID4gbWF4UHJldmlld1NpemUpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2soZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGNvbnRhaW5lci5hZGRDbGFzcygnZmlsZS10aHVtYi1sb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcHJldmlld0RlZmF1bHQoZmlsZSwgcHJldmlld0lkKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0RmlsZUFjdGlvbnMoKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl91cGRhdGVGaWxlRGV0YWlscyhudW1GaWxlcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmVhZEZpbGUoaSArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICgkcHJldmlldy5sZW5ndGggJiYgRmlsZVJlYWRlciAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNUZXh0ID0gZm5UZXh0KGZpbGUudHlwZSwgY2FwdGlvbik7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNIdG1sID0gZm5IdG1sKGZpbGUudHlwZSwgY2FwdGlvbik7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNJbWFnZSA9IGZuSW1hZ2UoZmlsZS50eXBlLCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICAkc3RhdHVzLmh0bWwobXNnTG9hZGluZy5yZXBsYWNlKCd7aW5kZXh9JywgaSArIDEpLnJlcGxhY2UoJ3tmaWxlc30nLCBudW1GaWxlcykpO1xyXG4gICAgICAgICAgICAgICAgICAgICRjb250YWluZXIuYWRkQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbmVycm9yID0gZnVuY3Rpb24gKGV2dCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9lcnJvckhhbmRsZXIoZXZ0LCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbmxvYWQgPSBmdW5jdGlvbiAodGhlRmlsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgaGV4LCBmaWxlSW5mbywgdWludCwgYnl0ZSwgYnl0ZXMgPSBbXSwgY29udGVudHMsIG1pbWUsIHJlYWRUZXh0SW1hZ2UgPSBmdW5jdGlvbiAodGV4dEZsYWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuZXdSZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3UmVhZGVyLm9uZXJyb3IgPSBmdW5jdGlvbiAodGhlRmlsZU5ldykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2Vycm9ySGFuZGxlcih0aGVGaWxlTmV3LCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdSZWFkZXIub25sb2FkID0gZnVuY3Rpb24gKHRoZUZpbGVOZXcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9wcmV2aWV3RmlsZShpLCBmaWxlLCB0aGVGaWxlTmV3LCBwcmV2aWV3SWQsIHByZXZpZXdEYXRhLCBmaWxlSW5mbyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdEZpbGVBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0ZpbGVMb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGV4dEZsYWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdSZWFkZXIucmVhZEFzVGV4dChmaWxlLCBzZWxmLnRleHRFbmNvZGluZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld1JlYWRlci5yZWFkQXNEYXRhVVJMKGZpbGUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlSW5mbyA9IHsnbmFtZSc6IGNhcHRpb24sICd0eXBlJzogZmlsZS50eXBlfTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJC5lYWNoKHNldHRpbmdzLCBmdW5jdGlvbiAoaywgZikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGsgIT09ICdvYmplY3QnICYmIGsgIT09ICdvdGhlcicgJiYgdHlwZW9mIGYgPT09ICdmdW5jdGlvbicgJiYgZihmaWxlLnR5cGUsIGNhcHRpb24pKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga25vd25UeXBlcysrO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGtub3duVHlwZXMgPT09IDApIHsvLyBhdXRvIGRldGVjdCBtaW1lIHR5cGVzIGZyb20gY29udGVudCBpZiBubyBrbm93biBmaWxlIHR5cGVzIGRldGVjdGVkXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50ID0gbmV3IFVpbnQ4QXJyYXkodGhlRmlsZS50YXJnZXQucmVzdWx0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCB1aW50Lmxlbmd0aDsgaisrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZSA9IHVpbnRbal0udG9TdHJpbmcoMTYpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVzLnB1c2goYnl0ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBieXRlcy5qb2luKCcnKS50b0xvd2VyQ2FzZSgpLnN1YnN0cmluZygwLCA4KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbWUgPSAkaC5nZXRNaW1lVHlwZShoZXgsICcnLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShtaW1lKSkgeyAvLyBsb29rIGZvciBhc2NpaSB0ZXh0IGNvbnRlbnRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50cyA9ICRoLmFycmF5QnVmZmVyMlN0cmluZyhyZWFkZXIucmVzdWx0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW1lID0gJGguaXNTdmcoY29udGVudHMpID8gJ2ltYWdlL3N2Zyt4bWwnIDogJGguZ2V0TWltZVR5cGUoaGV4LCBjb250ZW50cywgZmlsZS50eXBlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVJbmZvID0geyduYW1lJzogY2FwdGlvbiwgJ3R5cGUnOiBtaW1lfTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzVGV4dCA9IGZuVGV4dChtaW1lLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0h0bWwgPSBmbkh0bWwobWltZSwgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNJbWFnZSA9IGZuSW1hZ2UobWltZSwgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHh0RmxhZyA9IGlzVGV4dCB8fCBpc0h0bWw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHh0RmxhZyB8fCBpc0ltYWdlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZFRleHRJbWFnZSh0eHRGbGFnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcHJldmlld0ZpbGUoaSwgZmlsZSwgdGhlRmlsZSwgcHJldmlld0lkLCBwcmV2aWV3RGF0YSwgZmlsZUluZm8pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0RmlsZUFjdGlvbnMoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0ZpbGVMb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbnByb2dyZXNzID0gZnVuY3Rpb24gKGRhdGEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEubGVuZ3RoQ29tcHV0YWJsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGZhY3QgPSAoZGF0YS5sb2FkZWQgLyBkYXRhLnRvdGFsKSAqIDEwMCwgcHJvZ3Jlc3MgPSBNYXRoLmNlaWwoZmFjdCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2cgPSBtc2dQcm9ncmVzcy5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbmRleCc6IGkgKyAxLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmaWxlcyc6IG51bUZpbGVzLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwZXJjZW50JzogcHJvZ3Jlc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbChtc2cpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChpc1RleHQgfHwgaXNIdG1sKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRlci5yZWFkQXNUZXh0KGZpbGUsIHNlbGYudGV4dEVuY29kaW5nKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnJlYWRBc0RhdGFVUkwoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkZXIucmVhZEFzQXJyYXlCdWZmZXIoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3ByZXZpZXdEZWZhdWx0KGZpbGUsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRGaWxlKGkgKyAxKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVsb2FkZWQnLCBbZmlsZSwgcHJldmlld0lkLCBpLCByZWFkZXJdKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuYWRkVG9TdGFjayhmaWxlKTtcclxuICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHJlYWRGaWxlKDApO1xyXG4gICAgICAgICAgICBzZWxmLl91cGRhdGVGaWxlRGV0YWlscyhudW1GaWxlcywgZmFsc2UpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgbG9jazogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYuX3Jlc2V0RXJyb3JzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuZGlzYWJsZSgpO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93UmVtb3ZlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC1yZW1vdmUnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0NhbmNlbCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJykuc2hvdygpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlbG9jaycsIFtzZWxmLmZpbGVzdGFjaywgc2VsZi5fZ2V0RXh0cmFEYXRhKCldKTtcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICB1bmxvY2s6IGZ1bmN0aW9uIChyZXNldCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGlmIChyZXNldCA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICByZXNldCA9IHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5lbmFibGUoKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0NhbmNlbCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJykuaGlkZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dSZW1vdmUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5maW5kKCcuZmlsZWlucHV0LXJlbW92ZScpLnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAocmVzZXQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0RmlsZVN0YWNrKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGV1bmxvY2snLCBbc2VsZi5maWxlc3RhY2ssIHNlbGYuX2dldEV4dHJhRGF0YSgpXSk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgeGhyID0gc2VsZi5hamF4UmVxdWVzdHMsIGxlbiA9IHhoci5sZW5ndGgsIGk7XHJcbiAgICAgICAgICAgIGlmIChsZW4gPiAwKSB7XHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpICs9IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNhbmNlbGxpbmcgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgIHhocltpXS5hYm9ydCgpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGluZCA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuZmlsZXN0YWNrW2luZF0gIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5yZW1vdmVDbGFzcygnZGlzYWJsZWQnKS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKS5yZW1vdmVDbGFzcygnZGlzYWJsZWQnKS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi51bmxvY2soKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYXI6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBjYXA7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVjbGVhcicpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi4kYnRuVXBsb2FkLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmZpbmQoJ3ZpZGVvLGF1ZGlvLGltZycpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgJGguY2xlYW5NZW1vcnkoJCh0aGlzKSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICBzZWxmLl9yZXNldFVwbG9hZCgpO1xyXG4gICAgICAgICAgICBzZWxmLmNsZWFyU3RhY2soKTtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnModHJ1ZSk7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLl9oYXNJbml0aWFsUHJldmlldygpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93RmlsZUljb24oKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtaW5wdXQtbmV3Jyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9nZXRUaHVtYnMoKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9jbGVhck9iamVjdHMoJCh0aGlzKSk7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSB7fTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgICAgICBjYXAgPSAoIXNlbGYub3ZlcndyaXRlSW5pdGlhbCAmJiBzZWxmLmluaXRpYWxDYXB0aW9uLmxlbmd0aCA+IDApID8gc2VsZi5pbml0aWFsQ2FwdGlvbiA6ICcnO1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbi5hdHRyKCd0aXRsZScsICcnKS52YWwoY2FwKTtcclxuICAgICAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjb250YWluZXIsICdmaWxlLWlucHV0LW5ldycpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEZWZhdWx0UHJldmlldygpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLiRjb250YWluZXIuZmluZCgkaC5GUkFNRVMpLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLl9pbml0Q2FwdGlvbigpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbkNvbnRhaW5lci5yZW1vdmVDbGFzcygnaWNvbi12aXNpYmxlJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5faGlkZUZpbGVJY29uKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlY2xlYXJlZCcpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLmZvY3VzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldEZpbGVEcm9wWm9uZVRpdGxlKCk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgcmVzZXQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuX3JhaXNlKCdmaWxlcmVzZXQnKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3Jlc2V0UHJldmlldygpO1xyXG4gICAgICAgICAgICBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC1maWxlbmFtZScpLnRleHQoJ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HNlbGYuZ2V0RmlsZVN0YWNrKCkubGVuZ3RoLCBpLCBvdXREYXRhLCBsZW4sXHJcbiAgICAgICAgICAgICAgICBoYXNFeHRyYURhdGEgPSAhJC5pc0VtcHR5T2JqZWN0KHNlbGYuX2dldEV4dHJhRGF0YSgpKTtcclxuICAgICAgICAgICAgaWYgKCFzZWxmLmlzQWpheFVwbG9hZCB8fCBzZWxmLmlzRGlzYWJsZWQgfHwgIXNlbGYuX2lzRmlsZVNlbGVjdGlvblZhbGlkKHRvdExlbikpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9yZXNldFVwbG9hZCgpO1xyXG4gICAgICAgICAgICBpZiAodG90TGVuID09PSAwICYmICFoYXNFeHRyYURhdGEpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihzZWxmLm1zZ1VwbG9hZEVtcHR5KTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRwcm9ncmVzcy5zaG93KCk7XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZFN0YXR1cyA9IHt9O1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMik7XHJcbiAgICAgICAgICAgIGlmICh0b3RMZW4gPT09IDAgJiYgaGFzRXh0cmFEYXRhKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl91cGxvYWRFeHRyYU9ubHkoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBsZW4gPSBzZWxmLmZpbGVzdGFjay5sZW5ndGg7XHJcbiAgICAgICAgICAgIHNlbGYuaGFzSW5pdERhdGEgPSBmYWxzZTtcclxuICAgICAgICAgICAgaWYgKHNlbGYudXBsb2FkQXN5bmMpIHtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNocHJldXBsb2FkJywgW291dERhdGFdKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZENhY2hlID0ge2NvbnRlbnQ6IFtdLCBjb25maWc6IFtdLCB0YWdzOiBbXSwgYXBwZW5kOiB0cnVlfTtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQXN5bmNDb3VudCA9IHNlbGYuZ2V0RmlsZVN0YWNrKCkubGVuZ3RoO1xyXG4gICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbjsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb250ZW50W2ldID0gbnVsbDtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZENhY2hlLmNvbmZpZ1tpXSA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS50YWdzW2ldID0gbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuZmluZCgnLmZpbGUtcHJldmlldy1pbml0aWFsJykucmVtb3ZlQ2xhc3MoJGguU09SVF9DU1MpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmNhY2hlSW5pdGlhbFByZXZpZXcgPSBzZWxmLmdldFByZXZpZXcoKTtcclxuXHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5maWxlc3RhY2tbaV0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBsb2FkU2luZ2xlKGksIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl91cGxvYWRCYXRjaCgpO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGRlc3Ryb3k6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZm9ybSA9IHNlbGYuJGZvcm0sICRjb250ID0gc2VsZi4kY29udGFpbmVyLCAkZWwgPSBzZWxmLiRlbGVtZW50LCBucyA9IHNlbGYubmFtZXNwYWNlO1xyXG4gICAgICAgICAgICAkKGRvY3VtZW50KS5vZmYobnMpO1xyXG4gICAgICAgICAgICAkKHdpbmRvdykub2ZmKG5zKTtcclxuICAgICAgICAgICAgaWYgKCRmb3JtICYmICRmb3JtLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgJGZvcm0ub2ZmKG5zKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fY2xlYW51cCgpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0UHJldmlld0NhY2hlKCk7XHJcbiAgICAgICAgICAgICRlbC5pbnNlcnRCZWZvcmUoJGNvbnQpLm9mZihucykucmVtb3ZlRGF0YSgpO1xyXG4gICAgICAgICAgICAkY29udC5vZmYoKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgcmV0dXJuICRlbDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHJlZnJlc2g6IGZ1bmN0aW9uIChvcHRpb25zKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVsID0gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBvcHRpb25zICE9PSAnb2JqZWN0JyB8fCAkaC5pc0VtcHR5KG9wdGlvbnMpKSB7XHJcbiAgICAgICAgICAgICAgICBvcHRpb25zID0gc2VsZi5vcHRpb25zO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgb3B0aW9ucyA9ICQuZXh0ZW5kKHRydWUsIHt9LCBzZWxmLm9wdGlvbnMsIG9wdGlvbnMpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXQob3B0aW9ucywgdHJ1ZSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2xpc3RlbigpO1xyXG4gICAgICAgICAgICByZXR1cm4gJGVsO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgem9vbTogZnVuY3Rpb24gKGZyYW1lSWQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUgPSBzZWxmLl9nZXRGcmFtZShmcmFtZUlkKSwgJG1vZGFsID0gc2VsZi4kbW9kYWw7XHJcbiAgICAgICAgICAgIGlmICghJGZyYW1lKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGguaW5pdE1vZGFsKCRtb2RhbCk7XHJcbiAgICAgICAgICAgICRtb2RhbC5odG1sKHNlbGYuX2dldE1vZGFsQ29udGVudCgpKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0Wm9vbUNvbnRlbnQoJGZyYW1lKTtcclxuICAgICAgICAgICAgJG1vZGFsLm1vZGFsKCdzaG93Jyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9ucygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0RXhpZjogZnVuY3Rpb24gKGZyYW1lSWQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUgPSBzZWxmLl9nZXRGcmFtZShmcmFtZUlkKTtcclxuICAgICAgICAgICAgcmV0dXJuICRmcmFtZSAmJiAkZnJhbWUuZGF0YSgnZXhpZicpIHx8IG51bGw7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBnZXRGcmFtZXM6IGZ1bmN0aW9uIChjc3NGaWx0ZXIpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWVzO1xyXG4gICAgICAgICAgICBjc3NGaWx0ZXIgPSBjc3NGaWx0ZXIgfHwgJyc7XHJcbiAgICAgICAgICAgICRmcmFtZXMgPSBzZWxmLiRwcmV2aWV3LmZpbmQoJGguRlJBTUVTICsgY3NzRmlsdGVyKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYucmV2ZXJzZVByZXZpZXdPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgJGZyYW1lcyA9ICQoJGZyYW1lcy5nZXQoKS5yZXZlcnNlKCkpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAkZnJhbWVzO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0UHJldmlldzogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICBjb250ZW50OiBzZWxmLmluaXRpYWxQcmV2aWV3LFxyXG4gICAgICAgICAgICAgICAgY29uZmlnOiBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnLFxyXG4gICAgICAgICAgICAgICAgdGFnczogc2VsZi5p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lsZWlucHV0TG9jYWxlc1tsYW5nXSkpIHtcclxuICAgICAgICAgICAgICAgICAgICBsID0gJC5mbi5maWxlaW5wdXRMb2NhbGVzW2xhbmddIHx8IHt9O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgb3B0ID0gJC5leHRlbmQodHJ1ZSwge30sICQuZm4uZmlsZWlucHV0LmRlZmF1bHRzLCB0LCAkLmZuLmZpbGVpbnB1dExvY2FsZXMuZW4sIGwsIG9wdGlvbnMsIHNlbGYuZGF0YSgpKTtcclxuICAgICAgICAgICAgICAgIGRhdGEgPSBuZXcgRmlsZUlucHV0KHRoaXMsIG9wdCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmRhdGEoJ2ZpbGVpbnB1dCcsIGRhdGEpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbiA9PT0gJ3N0cmluZycpIHtcclxuICAgICAgICAgICAgICAgIHJldHZhbHMucHVzaChkYXRhW29wdGlvbl0uYXBwbHkoZGF0YSwgYXJncykpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgc3dpdGNoIChyZXR2YWxzLmxlbmd0aCkge1xyXG4gICAgICAgICAgICBjYXNlIDA6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcztcclxuICAgICAgICAgICAgY2FzZSAxOlxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJldHZhbHNbMF07XHJcbiAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gcmV0dmFscztcclxuICAgICAgICB9XHJcbiAgICB9O1xyXG5cclxuICAgICQuZm4uZmlsZWlucHV0LmRlZmF1bHRzID0ge1xyXG4gICAgICAgIGxhbmd1YWdlOiAnZW4nLFxyXG4gICAgICAgIHNob3dDYXB0aW9uOiB0cnVlLFxyXG4gICAgICAgIHNob3dCcm93c2U6IHRydWUsX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G4gICAgICAgIHByZXZpZXdDb250ZW50VGVtcGxhdGVzOiB7fSxcclxuICAgICAgICBwcmVmZXJJY29uaWNQcmV2aWV3OiBmYWxzZSxcclxuICAgICAgICBwcmVmZXJJY29uaWNab29tUHJldmlldzogZmFsc2UsXHJcbiAgICAgICAgYWxsb3dlZFByZXZpZXdUeXBlczogdW5kZWZpbmVkLFxyXG4gICAgICAgIGFsbG93ZWRQcmV2aWV3TWltZVR5cGVzOiBudWxsLFxyXG4gICAgICAgIGFsbG93ZWRGaWxlVHlwZXM6IG51bGwsXHJcbiAgICAgICAgYWxsb3dlZEZpbGVFeHRlbnNpb25zOiBudWxsLFxyXG4gICAgICAgIGRlZmF1bHRQcmV2aWV3Q29udGVudDogbnVsbCxcclxuICAgICAgICBjdXN0b21MYXlvdXRUYWdzOiB7fSxcclxuICAgICAgICBjdXN0b21QcmV2aWV3VGFnczoge30sXHJcbiAgICAgICAgcHJldmlld0ZpbGVJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLWZpbGVcIj48L2k+JyxcclxuICAgICAgICBwcmV2aWV3RmlsZUljb25DbGFzczogJ2ZpbGUtb3RoZXItaWNvbicsXHJcbiAgICAgICAgcHJldmlld0ZpbGVJY29uU2V0dGluZ3M6IHt9LFxyXG4gICAgICAgIHByZXZpZXdGaWxlRXh0U2V0dGluZ3M6IHt9LFxyXG4gICAgICAgIGJ1dHRvbkxhYmVsQ2xhc3M6ICdoaWRkZW4teHMnLFxyXG4gICAgICAgIGJyb3dzZUljb246ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tZm9sZGVyLW9wZW5cIj48L2k+Jm5ic3A7JyxcclxuICAgICAgICBicm93c2VDbGFzczogJ2J0biBidG4tcHJpbWFyeScsXHJcbiAgICAgICAgcmVtb3ZlSWNvbjogJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGdseXBoaWNvbi10cmFzaFwiPjwvaT4nLFxyXG4gICAgICAgIHJlbW92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8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL0Bmb3J0YXdlc29tZS9mb250YXdlc29tZS1mcmVlL2Nzcy9hbGwuY3NzXG4vLyBtb2R1bGUgaWQgPSAxMVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvLyByZW1vdmVkIGJ5IGV4dHJhY3QtdGV4dC13ZWJwYWNrLXBsdWdpblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vc3JjL3N0eWxlLmNzc1xuLy8gbW9kdWxlIGlkID0gMTJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sInNvdXJjZVJvb3QiOiIifQ== \ No newline at end of file diff --git a/errors/errors.go b/errors/errors.go index c9f12026..fc77cbf1 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -22,4 +22,8 @@ var ( TemplateName: "error_category_exists", Err: errors.New(i18n.FlashMessages["categoryExists"]["it"]), } + OutOfTime = &Error{ + TemplateName: "error_out_of_time", + Err: errors.New(i18n.Errors["outOfTime"]["it"]), + } ) diff --git a/i18n/i18n.go b/i18n/i18n.go index d9c7814d..4f1514a8 100644 --- a/i18n/i18n.go +++ b/i18n/i18n.go @@ -36,4 +36,10 @@ var ( "it": "sempre attiva", }, } + + Errors = map[string]map[string]string{ + "outOfTime": map[string]string{ + "it": "Il tempo utile per consegnare la prova è scaduto.", + }, + } ) diff --git a/orm/response.go b/orm/response.go index ce955868..c3262e0e 100644 --- a/orm/response.go +++ b/orm/response.go @@ -9,6 +9,7 @@ import ( "strings" "time" + "git.andreafazzi.eu/andrea/oef/errors" "git.andreafazzi.eu/andrea/oef/renderer" "github.com/jinzhu/gorm" ) @@ -59,6 +60,11 @@ func (model *Response) String() string { return model.Name } +func (model *Response) IsActive() bool { + log.Println(model.Contest.EndTime) + return !time.Now().After(model.Contest.EndTime) +} + func (model *Response) generateAnswersIDs() string { ids := make([]string, 0) for _, sr := range model.SingleResponses { @@ -174,6 +180,9 @@ func (model *Response) Update(args map[string]string, w http.ResponseWriter, r * // Write StartTime for the first time if user is a participant if isParticipant(r) && !response.Contest.isAlwaysActive() { + if !response.IsActive() { + return nil, errors.OutOfTime + } if response.StartTime.IsZero() { if err := DB().Model(&response).Update("start_time", time.Now()).Error; err != nil { return nil, err @@ -184,7 +193,6 @@ func (model *Response) Update(args map[string]string, w http.ResponseWriter, r * log.Println("StartTime/EndTime", response.StartTime, response.EndTime) } response.TimeLeft = response.EndTime.Sub(time.Now()) - log.Println("TimeLeft:", response.TimeLeft) } return response, nil @@ -193,6 +201,12 @@ func (model *Response) Update(args map[string]string, w http.ResponseWriter, r * if err != nil { return nil, err } + + // Check if the contest is still active + if !response.(*Response).IsActive() { + return nil, errors.OutOfTime + } + err = renderer.Decode(response, r) if err != nil { return nil, err diff --git a/renderer/funcmap.go b/renderer/funcmap.go index 1e2f8dbb..7bf77cfa 100644 --- a/renderer/funcmap.go +++ b/renderer/funcmap.go @@ -22,6 +22,7 @@ const ( var ( funcMap = template.FuncMap{ + "toInt": toInt, "isResponseIn": isResponseIn, "query": query, "convertDate": convertDate, @@ -64,6 +65,10 @@ var ( } ) +func toInt(value float64) int { + return int(value) +} + func isResponseIn(id uint, answersIDs string) (bool, error) { if answersIDs != "" { ids := make([]uint, 0) diff --git a/src/index.js b/src/index.js index 8526e7e6..c21e6e95 100644 --- a/src/index.js +++ b/src/index.js @@ -18,134 +18,56 @@ import '@fortawesome/fontawesome-free/css/all.css'; import './style.css' $(function () { - - $("#myInput").on("keyup", function(eventObject) { + + setInterval(function() { + var timeleft = parseInt($("#timeleft").html()); + timeleft--; + $("#timeleft").html(timeleft) + }, 1000*60); - var input, filter, ul, li, a, i; + $("#myInput").on("keyup", function(eventObject) { + + var input, filter, ul, li, a, i; - input = eventObject.currentTarget; - filter = input.value.toUpperCase(); - ul = document.getElementById("myUL"); - li = ul.getElementsByTagName('a'); + input = eventObject.currentTarget; + filter = input.value.toUpperCase(); + ul = document.getElementById("myUL"); + li = ul.getElementsByTagName('a'); - // Loop through all list items, and hide those who don't match the search query - for (i = 0; i < li.length; i++) { - a = li[i]; //li[i].getElementsByTagName("a")[0]; - if (a.innerHTML.toUpperCase().indexOf(filter) > -1) { - li[i].style.display = ""; - } else { - li[i].style.display = "none"; - } - } - - }); - - function checkUsernameInputHandler(eventObject) { - var input_el = $(eventObject.currentTarget); - var data = JSON.stringify({"username": input_el.val()}); - var url = `/teachers/check_username/${input_el.val()}` - - $.post( - url, - data, - function(result) { - if (result.exists) { - console.log("Username exists"); + // Loop through all list items, and hide those who don't match the search query + for (i = 0; i < li.length; i++) { + a = li[i]; //li[i].getElementsByTagName("a")[0]; + if (a.innerHTML.toUpperCase().indexOf(filter) > -1) { + li[i].style.display = ""; + } else { + li[i].style.display = "none"; + } } - }, - "json" - ); - } - function usernameGenerator(eventObject, firstname, surname) { - var input_el = $(eventObject.currentTarget); - input_el.val(firstname+"."+surname); - } - - function deleteRelationHandler(eventObject) { - var url = this.dataset.url; - var modalEl = $('#karmen-modal-remove'); - - var el = $(this); - - modalEl.modal({backdrop: 'static'}).one('click', '#karmen-modal-btn-confirm', function() { - - $.ajax({ - url: url, - type: 'DELETE', - success: function(result) { - el.closest(".list-group-item").remove(); - modalEl.modal('hide'); - } - }); - }); - - return false; - }; - function deleteHandler(eventObject) { - var url = this.dataset.url; - var modalEl = $('#karmen-modal-remove'); - - var el = $(this); + function deleteHandler(eventObject) { + var url = this.dataset.url; + var modalEl = $('#karmen-modal-remove'); + + var el = $(this); - modalEl.modal({backdrop: 'static'}).one('click', '#karmen-modal-btn-confirm', function() { - - $.ajax({ - url: url, - type: 'DELETE', - success: function(result) { - modalEl.modal('hide'); - window.location.replace(result.redirect_url); - } - }); - - }); + modalEl.modal({backdrop: 'static'}).one('click', '#karmen-modal-btn-confirm', function() { + + $.ajax({ + url: url, + type: 'DELETE', + success: function(result) { + modalEl.modal('hide'); + window.location.replace(result.redirect_url); + } + }); + + }); + + return false; + }; - return false; - }; - - $(".ajax-post").on("click", function(eventObject) { - var select_el = $("#"+this.dataset.select).first(); - var listgroup_el = $("#"+this.dataset.listgroup).first(); - var url = this.dataset.url; - var data = JSON.stringify({"ids": select_el.val()}); - - $.post( - url, - data, - function(result) { - var i; - if (result.elements != null) { - for (i = 0; i < result.elements.length; i++) { - var newItem = ` - - - ${result.elements[i].Name} - - - - `; - $(listgroup_el).append(newItem); - $(".karmen-ajax-delete").on("click", deleteHandler); - } - } - - }, - "json" - ); - - select_el.val('default'); - select_el.selectpicker("refresh"); - - return false; - - }); - - $(".karmen-ajax-delete-relation").on("click", deleteRelationHandler); - $(".karmen-ajax-delete").on("click", deleteHandler); + $(".karmen-ajax-delete").on("click", deleteHandler); }); diff --git a/templates/error_out_of_time.html.tpl b/templates/error_out_of_time.html.tpl new file mode 100644 index 00000000..7779e486 --- /dev/null +++ b/templates/error_out_of_time.html.tpl @@ -0,0 +1,11 @@ +{{ define "content" }} +
+

Errore

+

+ Si è verificato nella gestione della prova di gara: {{.Data}} +

+

+ Clicca {{.Claims|userId|show "Participant"|anchor "qui"}} per tornare alle informazioni sul partecipante. +

+
+{{ end }} diff --git a/templates/responses_add_update.html.tpl b/templates/responses_add_update.html.tpl index 8420b1d9..a121dea1 100644 --- a/templates/responses_add_update.html.tpl +++ b/templates/responses_add_update.html.tpl @@ -15,6 +15,9 @@ {{- else -}} {{template "add_update_header" dict "update" $update "addTitle" "Rispondi al questionario" "updateTitle" (.Data|string)}} {{- end -}} + {{- if and $isParticipant .Data.TimeLeft}} +
Tempo rimanente {{.Data.TimeLeft.Minutes|toInt}} min
+ {{- end -}} {{- $form := "form_add_update" -}}
diff --git a/templates/responses_show.html.tpl b/templates/responses_show.html.tpl index 9bc01ad4..20e30324 100644 --- a/templates/responses_show.html.tpl +++ b/templates/responses_show.html.tpl @@ -11,16 +11,19 @@ {{end}} {{if $isParticipant}} + {{if .Data.IsActive}} {{$options := `{updateButtonTitle: "Vai alla gara!"}`}} {{template "show_header" dict "options" ($options|yaml) "title" (.Data|string) "updatePath" (.Data.ID|update "Response")}} {{end}} + {{end}}

Informazioni generali

Periodo di attività
{{if not (.Data.Contest.Date|zeroTime)}} - La gara si svolgerà il giorno {{.Data.Contest.Date|prettyDate}} dalle ore {{.Data.Contest.StartTime|convertTime}} alle ore {{.Data.Contest.EndTime|convertTime}} + Giorno {{.Data.Contest.Date|prettyDate}} dalle ore {{.Data.Contest.StartTime|convertTime}} alle ore {{.Data.Contest.EndTime|convertTime}} + {{- if not .Data.IsActive -}} [Scaduta]{{- end -}} {{else}} La gara è sempre attiva. {{end}}