From 2fb6cda55c3466c0d01b4b40d830a1b1628ef9a0 Mon Sep 17 00:00:00 2001 From: Andrea Fazzi Date: Mon, 2 Dec 2019 10:48:46 +0100 Subject: [PATCH] Add errors package and improve style --- dist/main.bundle.js | 2 +- dist/styles.css | 4 ++++ errors/errors.go | 5 +++++ orm/participant.go | 21 +++++++++++++++++++-- renderer/funcmap.go | 2 +- renderer/renderer.go | 9 +++++---- src/style.css | 4 ++++ templates/participants_add_update.html.tpl | 9 ++++++++- 8 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 errors/errors.go diff --git a/dist/main.bundle.js b/dist/main.bundle.js index a677fe88..1b549a05 100644 --- a/dist/main.bundle.js +++ b/dist/main.bundle.js @@ -26165,4 +26165,4 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ /***/ }) /******/ ]); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAgNzcwOWI5OGU3OTRlZWE2MzY5YjQiLCJ3ZWJwYWNrOi8vLy4vbm9kZV9tb2R1bGVzL2pxdWVyeS9kaXN0L2pxdWVyeS5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvaW5kZXguanMiLCJ3ZWJwYWNrOi8vLy4vbm9kZV9tb2R1bGVzL2Jvb3RzdHJhcC9kaXN0L2pzL2Jvb3RzdHJhcC5qcyIsIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcG9wcGVyLmpzL2Rpc3QvZXNtL3BvcHBlci5qcyIsIndlYnBhY2s6Ly8vKHdlYnBhY2spL2J1aWxkaW4vZ2xvYmFsLmpzIiwid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9ib290c3RyYXAtc2VsZWN0L2Rpc3QvanMvYm9vdHN0cmFwLXNlbGVjdC5qcyIsIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZ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4gICAgICAgIHRoaXMuY3ljbGUoKTtcbiAgICAgIH1cbiAgICB9IC8vIFN0YXRpY1xuICAgIDtcblxuICAgIENhcm91c2VsLl9qUXVlcnlJbnRlcmZhY2UgPSBmdW5jdGlvbiBfalF1ZXJ5SW50ZXJmYWNlKGNvbmZpZykge1xuICAgICAgcmV0dXJuIHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7XG4gICAgICAgIHZhciBkYXRhID0gJCh0aGlzKS5kYXRhKERBVEFfS0VZJDIpO1xuXG4gICAgICAgIHZhciBfY29uZmlnID0gX29iamVjdFNwcmVhZCh7fSwgRGVmYXVsdCwgJCh0aGlzKS5kYXRhKCkpO1xuXG4gICAgICAgIGlmICh0eXBlb2YgY29uZmlnID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgIF9jb25maWcgPSBfb2JqZWN0U3ByZWFkKHt9LCBfY29uZmlnLCBjb25maWcpO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGFjdGlvbiA9IHR5cGVvZiBjb25maWcgPT09ICdzdHJpbmcnID8gY29uZmlnIDogX2NvbmZpZy5zbGlkZTtcblxuICAgICAgICBpZiAoIWRhdGEpIHtcbiAgICAgICAgICBkYXRhID0gbmV3IENhcm91c2VsKHRoaXMsIF9jb25maWcpO1xuICAgICAgICAgICQodGhpcykuZGF0YShEQVRBX0tFWSQyLCBkYXRhKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0eXBlb2YgY29uZmlnID09PSAnbnVtYmVyJykge1xuICAgICAgICAgIGRhdGEudG8oY29uZmlnKTtcbiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgYWN0aW9uID09PSAnc3RyaW5nJykge1xuICAgICAgICAgIGlmICh0eXBlb2YgZGF0YVthY3Rpb25dID09PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihcIk5vIG1ldGhvZCBuYW1lZCBcXFwiXCIgKyBhY3Rpb24gKyBcIlxcXCJcI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S0VZQ09ERSkge1xuICAgICAgICAgIHZhciB0b2dnbGUgPSBwYXJlbnQucXVlcnlTZWxlY3RvcihTZWxlY3RvciQ0LkRBVEFfVE9HR0xFKTtcbiAgICAgICAgICAkKHRvZ2dsZSkudHJpZ2dlcignZm9jdXMnKTtcbiAgICAgICAgfVxuXG4gICAgICAgICQodGhpcykudHJpZ2dlcignY2xpY2snKTtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuXG4gICAgICB2YXIgaXRlbXMgPSBbXS5zbGljZS5jYWxsKHBhcmVudC5xdWVyeVNlbGVjdG9yQWxsKFNlbGVjdG9yJDQuVklTSUJMRV9JVEVNUykpO1xuXG4gICAgICBpZiAoaXRlbXMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgdmFyIGluZGV4ID0gaXRlbXMuaW5kZXhPZihldmVudC50YXJnZXQpO1xuXG4gICAgICBpZiAoZXZlbnQud2hpY2ggPT09IEFSUk9XX1VQX0tFWUNPREUgJiYgaW5kZXggPiAwKSB7XG4gICAgICAgIC8vIFVwXG4gICAgICAgIGluZGV4LS07XG4gICAgICB9XG5cbiAgICAgIGlmIChldmVudC53aGljaCA9PT0gQVJST1dfRE9XTl9LRVlDT0RFICYmIGluZGV4IDwgaXRlbXMubGVuZ3RoIC0gMSkge1xuICAgICAgICAvLyBEb3duXG4gICAgICAgIGluZGV4Kys7XG4gICAgICB9XG5cbiAgICAgIGlmIChpbmRleCA8IDApIHtcbiAgICAgICAgaW5kZXggPSAwO1xuICAgICAgfVxuXG4gICAgICBpdGVtc1tpbmRleF0uZm9jdXMoKTtcbiAgICB9O1xuXG4gICAgX2NyZWF0ZUNsYXNzKERyb3Bkb3duLCBudWxsLCBbe1xuICAgICAga2V5OiBcIlZFUlNJT05cIixcbiAgICAgIGdldDogZnVuY3Rpb24gZ2V0KCkge1xuICAgICAgICByZXR1cm4gVkVSU0lPTiQ0O1xuICAgICAgfVxuICAgIH0sIH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uICAgICAgICAkKHRoaXMuX2JhY2tkcm9wKS5hcHBlbmRUbyhkb2N1bWVudC5ib2R5KTtcbiAgICAgICAgJCh0aGlzLl9lbGVtZW50KS5vbihFdmVudCQ1LkNMSUNLX0RJU01JU1MsIGZ1bmN0aW9uIChldmVudCkge1xuICAgICAgICAgIGlmIChfdGhpczguX2lnbm9yZUJhY2tkcm9wQ2xpY2spIHtcbiAgICAgICAgICAgIF90aGlzOC5faWdub3JlQmFja2Ryb3BDbGljayA9IGZhbHNlO1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChldmVudC50YXJnZXQgIT09IGV2ZW50LmN1cnJlbnRUYXJnZXQpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoX3RoaXM4Ll9jb25maWcuYmFja2Ryb3AgPT09ICdzdGF0aWMnKSB7XG4gICAgICAgICAgICBfdGhpczguX2VsZW1lbnQuZm9jdXMoKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgX3RoaXM4LmhpZGUoKTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGlmIChhbmltYXRlKSB7XG4gICAgICAgICAgVXRpbC5yZWZsb3codGhpcy5fYmFja2Ryb3ApO1xuICAgICAgICB9XG5cbiAgICAgICAgJCh0aGlzLl9iYWNrZHJvcCkuYWRkQ2xhc3MoQ2xhc3NOYW1lJDUuU0hPVyk7XG5cbiAgICAgICAgaWYgKCFjYWxsYmFjaykge1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghYW5pbWF0ZSkge1xuICAgICAgICAgIGNhbGxiYWNrKCk7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGJhY2tkcm9wVHJhbnNpdGlvbkR1cmF0aW9uID0gVXRpbC5nZXRUcmFuc2l0aW9uRHVyYXR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gICAgICAgJCh0aXApLmRhdGEodGhpcy5jb25zdHJ1Y3Rvci5EQVRBX0tFWSwgdGhpcyk7XG5cbiAgICAgICAgaWYgKCEkLmNvbnRhaW5zKHRoaXMuZWxlbWVudC5vd25lckRvY3VtZW50LmRvY3VtZW50RWxlbWVudCwgdGhpcy50aXApKSB7XG4gICAgICAgICAgJCh0aXApLmFwcGVuZFRvKGNvbnRhaW5lcik7XG4gICAgICAgIH1cblxuICAgICAgICAkKHRoaXMuZWxlbWVudCkudHJpZ2dlcih0aGlzLmNvbnN0cnVjdG9yLkV2ZW50LklOU0VSVEVEKTtcbiAgICAgICAgdGhpcy5fcG9wcGVyID0gbmV3IFBvcHBlcih0aGlzLmVsZW1lbnQsIHRpcCwge1xuICAgICAgICAgIHBsYWNlbWVudDogYXR0YWNobWVudCxcbiAgICAgICAgICBtb2RpZmllcnM6IHtcbiAgICAgICAgICAgIG9mZnNldDogdGhpcy5fZ2V0T2Zmc2V0KCksXG4gICAgICAgICAgICBmbGlwOiB7XG4gICAgICAgICAgICAgIGJlaGF2aW9yOiB0aGlzLmNvbmZpZy5mYWxsYmFja1BsYWNlbWVudFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGFycm93OiB7XG4gICAgICAgICAgICAgIGVsZW1lbnQ6IFNlbGVjdG9yJDYuQVJST1dcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBwcmV2ZW50T3ZlcmZsb3c6IHtcbiAgICAgICAgICAgICAgYm91bmRhcmllc0VsZW1lbnQ6IHRoaXMuY29uZmlnLmJvdW5kYXJ5XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSxcbiAgICAgICAgICBvbkNyZWF0ZTogZnVuY3Rpb24gb25DcmVhdGUoZGF0YSkge1xuICAgICAgICAgICAgaWYgKGRhdGEub3JpZ2luYWxQbGFjZW1lbnQgIT09IGRhdGEucGxhY2VtZW50KSB7XG4gICAgICAgICAgICAgIF90aGlzLl9oYW5kbGVQb3BwZXJQbGFjZW1lb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AgICAgfSBlbHNlIHtcbiAgICAgICAgICAkZWxlbWVudC50ZXh0KCQoY29udGVudCkudGV4dCgpKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgaWYgKHRoaXMuY29uZmlnLmh0bWwpIHtcbiAgICAgICAgaWYgKHRoaXMuY29uZmlnLnNhbml0aXplKSB7XG4gICAgICAgICAgY29udGVudCA9IHNhbml0aXplSHRtbChjb250ZW50LCB0aGlzLmNvbmZpZy53aGl0ZUxpc3QsIHRoaXMuY29uZmlnLnNhbml0aXplRm4pO1xuICAgICAgICB9XG5cbiAgICAgICAgJGVsZW1lbnQuaHRtbChjb250ZW50KTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgICRlbGVtZW50LnRleHQoY29udGVudCk7XG4gICAgICB9XG4gICAgfTtcblxuICAgIF9wcm90by5nZXRUaXRsZSA9IGZ1bmN0aW9uIGdldFRpdGxlKCkge1xuICAgICAgdmFyIHRpdGxlID0gdGhpcy5lbGVtZW50LmdldEF0dHJpYnV0ZSgnZGF0YS1vcmlnaW5hbC10aXRsZScpO1xuXG4gICAgICBpZiAoIXRpdGxlKSB7XG4gICAgICAgIHRpdGxlID0gdHlwZW9mIHRoaXMuY29uZmlnLnRpdGxlID09PSAnZnVuY3Rpb24nID8gdGhpcy5jb25maWcudGl0bGUuY2FsbCh0aGlzLmVsZW1lbnQpIDogdGhpcy5jb25maWcudGl0bGU7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB0aXRsZTtcbiAgICB9IC8vIFByaXZhdGVcbiAgICA7XG5cbiAgICBfcHJvdG8uX2dldE9mZnNldCA9IGZ1bmN0aW9uIF9nZXRPZmZzZXQoKSB7XG4gICAgICB2YXIgX3RoaXMzID0gdGhpcztcblxuICAgICAgdmFyIG9mZnNldCA9IHt9O1xuXG4gICAgICBpZiAodHlwZW9mIHRoaXMuY29uZmlnLm9mZnNldCA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgIC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gICAgIH1cbiAgICAgIH0pO1xuICAgICAgY29uZmlnID0gX29iamVjdFNwcmVhZCh7fSwgdGhpcy5jb25zdHJ1Y3Rvci5EZWZhdWx0LCBkYXRhQXR0cmlidXRlcywgdHlwZW9mIGNvbmZpZyA9PT0gJ29iamVjdCcgJiYgY29uZmlnID8gY29uZmlnIDoge30pO1xuXG4gICAgICBpZiAodHlwZW9mIGNvbmZpZy5kZWxheSA9PT0gJ251bWJlcicpIHtcbiAgICAgICAgY29uZmlnLmRlbGF5ID0ge1xuICAgICAgICAgIHNob3c6IGNvbmZpZy5kZWxheSxcbiAgICAgICAgICBoaWRlOiBjb25maWcuZGVsYXlcbiAgICAgICAgfTtcbiAgICAgIH1cblxuICAgICAgaWYgKHR5cGVvZiBjb25maWcudGl0bGUgPT09ICdudW1iZXInKSB7XG4gICAgICAgIGNvbmZpZy50aXRsZSA9IGNvbmZpZy50aXRsZS50b1N0cmluZygpO1xuICAgICAgfVxuXG4gICAgICBpZiAodHlwZW9mIGNvbmZpZy5jb250ZW50ID09PSAnbnVtYmVyJykge1xuICAgICAgICBjb25maWcuY29udGVudCA9IGNvbmZpZy5jb250ZW50LnRvU3RyaW5nKCk7XG4gICAgICB9XG5cbiAgICAgIFV0aWwudHlwZUNoZWNrQ29uZmlnKE5BTUUkNiwgY29uZmlnLCB0aGlzLmNvbnN0cnVjdG9yLkRlZmF1bHRUeXBlKTtcblxuICAgICAgaWYgKGNvbmZpZy5zYW5pdGl6ZSkge1xuICAgICAgICBjb25maWcudGVtcGxhdGUgPSBzYW5pdGl6ZUh0bWwoY29uZmlnLnRlbXBsYXRlLCBjb25maWcud2hpdGVMaXN0LCBjb25maWcuc2FuaXRpemVGbik7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBjb25maWc7XG4gICAgfTtcblxuICAgIF9wcm90by5fZ2V0RGVsZWdhdGVDb25maWcgPSBmdW5jdGlvbiBfZ2V0RGVsZWdhdGVDb25maWcoKSB7XG4gICAgICB2YXIgY29uZm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kFDVElWRSk7XG4gICAgICAgIH1cblxuICAgICAgICBlbGVtZW50LnNldEF0dHJpYnV0ZSgnYXJpYS1leHBhbmRlZCcsIHRydWUpO1xuICAgICAgfVxuXG4gICAgICBpZiAoY2FsbGJhY2spIHtcbiAgICAgICAgY2FsbGJhY2soKTtcbiAgICAgIH1cbiAgICB9IC8vIFN0YXRpY1xuICAgIDtcblxuICAgIFRhYi5falF1ZXJ5SW50ZXJmYWNlID0gZnVuY3Rpb24gX2pRdWVyeUludGVyZmFjZShjb25maWcpIHtcbiAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgJHRoaXMgPSAkKHRoaXMpO1xuICAgICAgICB2YXIgZGF0YSA9ICR0aGlzLmRhdGEoREFUQV9LRVkkOSk7XG5cbiAgICAgICAgaWYgKCFkYXRhKSB7XG4gICAgICAgICAgZGF0YSA9IG5ldyBUYWIodGhpcyk7XG4gICAgICAgICAgJHRoaXMuZGF0YShEQVRBX0tFWSQ5LCBkYXRhKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0eXBlb2YgY29uZmlnID09PSAnc3RyaW5nJykge1xuICAgICAgICAgIGlmICh0eXBlb2YgZGF0YVtjb25maWddID09PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihcIk5vIG1ldGhvZCBuYW1lZCBcXFwiXCIgKyBjb25maWcgKyBcIlxcXCJcIik7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgZGF0YVtjb25maWddKCk7XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgIH07XG5cbiAgICBfY3JlYXRlQ2xhc3MoVGFiLCBudWxsLCBbe1xuICAgICAga2V5OiBcIlZFUlNJT05cIixcbiAgICAgIGdldDogZnVuY3Rpb24gZ2V0KCkge1xuICAgICAgICByZXR1cm4gVkVSU0lPTiQ5O1xuICAgICAgfVxuICAgIH1dKTtcblxuICAgIHJldHVybiBUYW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byb3BdLFxyXG4gICAgICAgICAgb2JqQ3RyID0gT2JqZWN0LFxyXG4gICAgICAgICAgY2xhc3NMaXN0R2V0dGVyID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgJGVsZW0gPSAkKHRoaXMpO1xyXG5cclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICBhZGQ6IGZ1bmN0aW9uIChjbGFzc2VzKSB7XHJcbiAgICAgICAgICAgICAgICBjbGFzc2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKS5qb2luKCcgJyk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJGVsZW0uYWRkQ2xhc3MoY2xhc3Nlcyk7XHJcbiAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uIChjbGFzc2VzKSB7XHJcbiAgICAgICAgICAgICAgICBjbGFzc2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKS5qb2luKCcgJyk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJGVsZW0ucmVtb3ZlQ2xhc3MoY2xhc3Nlcyk7XHJcbiAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICB0b2dnbGU6IGZ1bmN0aW9uIChjbGFzc2VzLCBmb3JjZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuICRlbGVtLnRvZ2dsZUNsYXNzKGNsYXNzZXMsIGZvcmNlKTtcclxuICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgIGNvbnRhaW5zOiBmdW5jdGlvbiAoY2xhc3Nlcykge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuICRlbGVtLmhhc0NsYXNzKGNsYXNzZXMpO1xyXG4gICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgfTtcclxuXHJcbiAgICAgIGlmIChvYmpDdHIuZGVmaW5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0NsYXNzKCdpbnB1dC1ncm91cCcpKSB7XHJcbiAgICAgICAgaW5wdXRHcm91cCA9ICcgaW5wdXQtZ3JvdXAtYnRuJztcclxuICAgICAgfVxyXG5cclxuICAgICAgLy8gRWxlbWVudHNcclxuICAgICAgdmFyIGRyb3AsXHJcbiAgICAgICAgICBoZWFkZXIgPSAnJyxcclxuICAgICAgICAgIHNlYXJjaGJveCA9ICcnLFxyXG4gICAgICAgICAgYWN0aW9uc2JveCA9ICcnLFxyXG4gICAgICAgICAgZG9uZWJ1dHRvbiA9ICcnO1xyXG5cclxuICAgICAgaWYgKHRoaXMub3B0aW9ucy5oZWFkZXIpIHtcclxuICAgICAgICBoZWFkZXIgPVxyXG4gICAgICAgICAgJzxkaXYgY2xhc3M9XCInICsgY2xhc3NOYW1lcy5QT1BPVkVSSEVBREVSICsgJ1wiPicgK1xyXG4gICAgICAgICAgICAnPGJ1dHRvbiB0eXBlPVwiYnV0dG9uXCIgY2xhc3M9XCJjbG9zZVwiIGFyaWEtaGlkZGVuPVwidHJ1ZVwiPiZ0aW1lczs8L2J1dHRvbj4nICtcclxuICAgICAgICAgICAgICB0aGlzLm9wdGlvbnMuaGVhZGVyICtcclxuICAgICAgICAgICc8L2Rpdj4nO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBpZiAodGhpcy5vcHRpb25zLmxpdmVTZWFyY2gpIHtcclxuICAgICAgICBzZWFyY2hib3ggPVxyXG4gICAgICAgICAgJzxkaXYgY2xhc3M9XCJicy1zZWFyY2hib3hcIj4nICtcclxuICAgICAgICAgICAgJzxpbnB1dCB0eXBlPVwic2VhcmNoXCIgY2xhc3M9XCJmb3JtLWNvbnRyb2xcIiBhdXRvY29tcGxldGU9XCJvZmZcIicgK1xyXG4gICAgICAgICAgICAgIChcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5saXZlU2VhcmNoUGxhY2Vob2xkZXIgPT09IG51bGwgPyAnJ1xyXG4gICAgICAgICAgICAgICAgOlxyXG4gICAgICAgICAgICAgICAgJyBwbGFjZWhvbGRlcj1cIicgKyBodG1sRXNjYXBlKHRoaXMub3B0aW9ucy5saXZlU2VhcmNoUGxhY2Vob2xkZXIpICsgJ1wiJ1xyXG4gICAgICAgICAgICAgICkgK1xyXG4gICAgICAgICAgICAgICcgcm9sZT1cImNvbWJvYm94XCIgYXJpYS1sYWJlbD1cIlNlYXJjaFwiIGFyaWEtY29udHJvbHM9XCInICsgdGhpcy5zZWxlY3RJZCArICdcIiBhcmlhLWF1dG9jb21wbGV0ZT1cImxpc3RcIj4nICtcclxuICAgICAgICAgICc8L2Rpdj4nO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBpZiAodGhpcy5tdWx0aXBsZSAmJiB0aGlzLm9wdGlvbnMuYWN0aW9uc0JveCkge1xyXG4gICAgICAgIGFjdGlvbnNib3ggPVxyXG4gICAgICAgICAgJzxkaXYgY2xhc3M9XCJicy1hY3Rpb25zYm94XCI+JyArXHJcbiAgICAgICAgICAgICc8ZGl2IGNsYXNzPVwiYnRuLWdyb3VwIGJ0bi1ncm91cC1zbSBidG4tYmxvY2tcIj4nICtcclxuICAgICAgICAgICAgICAnPGJ1dHRvbiB0eXBlPVwiYnV0dG9uXCIgY2xhc3M9XCJhY3Rpb25zLWJ0biBicy1zZWxlY3QtYWxsIGJ0biAnICsgY2xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5zZWxlY3RBbGxUZXh0ICtcclxuICAgICAgICAgICAgICAnPC9idXR0b24+JyArXHJcbiAgICAgICAgICAgICAgJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwiYWN0aW9ucy1idG4gYnMtZGVzZWxlY3QtYWxsIGJ0biAnICsgY2xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5kZXNlbGVjdEFsbFRleHQgK1xyXG4gICAgICAgICAgICAgICc8L2J1dHRvbj4nICtcclxuICAgICAgICAgICAgJzwvZGl2PicgK1xyXG4gICAgICAgICAgJzwvZGl2Pic7XHJcbiAgICAgIH1cclxuXHJcbiAgICAgIGlmICh0aGlzLm11bHRpcGxlICYmIHRoaXMub3B0aW9ucy5kb25lQnV0dG9uKSB7XHJcbiAgICAgICAgZG9uZWJ1dHRvbiA9XHJcbiAgICAgICAgICAnPGRpdiBjbGFzcz1cImJzLWRvbmVidXR0b25cIj4nICtcclxuICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJidG4tZ3JvdXAgYnRuLWJsb2NrXCI+JyArXHJcbiAgICAgICAgICAgICAgJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwiYnRuIGJ0bi1zbSAnICsgY2xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5kb25lQnV0dG9uVGV4dCArXHJcbiAgICAgICAgICAgICAgJzwvYnV0dG9uPicgK1xyXG4gICAgICAgICAgICAnPC9kaXY+JyArXHJcbiAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgfVxyXG5cclxuICAgICAgZHJvcCA9XHJcbiAgICAgICAgJzxkaXYgY2xhc3M9XCJkcm9wZG93biBib290c3RyYXAtc2VsZWN0JyArIHNob3dUaWNrICsgaW5wdXRHcm91cCArICdcIj4nICtcclxuICAgICAgICAgICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cIicgKyB0aGlzLm9wdGlvbnMuc3R5bGVCYXNlICsgJyBkcm9wZG93bi10b2dnbGVcIiAnICsgKHRoaXMub3B0aW9ucy5kaXNwbGF5ID09PSAnc3RhdGljJyA/ICdkYXRhLWRpc3BsYXk9XCJzdGF0aWNcIicgOiAnJykgKyAnZGF0YS10b2dnbGU9XCJkcm9wZG93blwiJyArIGF1dG9mb2N1cyArICcgcm9sZT1cImNvbWJvYm94XCIgYXJpYS1vd25zPVwiJyArIHRoaXMuc2VsZWN0SWQgKyAnXCIgYXJpYS1oYXNwb3B1cD1cImxpc3Rib3hcIiBhcmlhLWV4cGFuZGVkPVwiZmFsc2VcIj4nICtcclxuICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJmaWx0ZXItb3B0aW9uXCI+JyArXHJcbiAgICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJmaWx0ZXItb3B0aW9uLWlubmVyXCI+JyArXHJcbiAgICAgICAgICAgICAgICAnPGRpdiBjbGFzcz1cImZpbHRlci1vcHRpb24taW5uZXItaW5uZXJcIj48L2Rpdj4nICtcclxuICAgICAgICAgICAgICAnPC9kaXY+ICcgK1xyXG4gICAgICAgICAgICAnPC9kaXY+JyArXHJcbiAgICAgICAgICAgIChcclxuICAgICAgICAgICAgICB2ZXJzaW9uLm1ham9yID09PSAnNCcgPyAnJ1xyXG4gICAgICAgICAgICAgIDpcclxuICAgICAgICAgICAgICAnPHNwYW4gY2xhc3M9XCJicy1jYXJldFwiPicgK1xyXG4gICAgICAgICAgICAgICAgdGhpcy5vcHRpb25zLnRlbXBsYXRlLmNhcmV0ICtcclxuICAgICAgICAgICAgICAnPC9zcGFuPidcclxuICAgICAgICAgICAgKSArXHJcbiAgICAgICAgICAnPC9idXR0b24+JyArXHJcbiAgICAgICAgICAnPGRpdiBjbGFzcz1cIicgKyBjbGFzc05hbWVzLk1FTlUgKyAnICcgKyAodmVyc2lvbi5tYWpvciA9PT0gJzQnID8gJycgOiBjbGFzc05hbWVzLlNIT1cpICsgJ1wiPicgK1xyXG4gICAgICAgICAgICBoZWFkZXIgK1xyXG4gICAgICAgICAgICBzZWFyY2hib3ggK1xyXG4gICAgICAgICAgICBhY3Rpb25zYm94ICtcclxuICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJpbm5lciAnICsgY2xhc3NOYW1lcy5TSE9XICsgJ1wiIHJvbGU9XCJsaXN0Ym94XCIgaWQ9XCInICsgdGhpcy5zZWxlY3RJZCArICdcI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dHBpY2tlci52aWV3LnZpc2libGVFbGVtZW50cyk7XHJcblxyXG4gICAgICAgICAgLy8gaWYgdmlydHVhbCBzY3JvbGwgaXMgZGlzYWJsZWQgYW5kIG5vdCBzZWFyY2hpbmcsXHJcbiAgICAgICAgICAvLyBtZW51IHNob3VsZCBuZXZlciBuZWVkIHRvIGJlIHVwZGF0ZWQgbW9yZSB0aGFuIG9uY2VcclxuICAgICAgICAgIGlmICgoaW5pdCB8fCBpc1ZpcnR1YWwgPT09IHRydWUpICYmIG1lbnVJc0RpZmZlcmVudCkge1xyXG4gICAgICAgICAgICB2YXIgbWVudUlubmVyID0gdGhhdC4kbWVudUlubmVyWzBdLFxyXG4gICAgICAgICAgICAgICAgbWVudUZyYWdtZW50ID0gZG9jdW1lbnQuY3JlYXRlRG9jdW1lbnRGcmFnbWVudCgpLFxyXG4gICAgICAgICAgICAgICAgZW1wdHlNZW51ID0gbWVudUlubmVyLmZpcnN0Q2hpbGQuY2xvbmVOb2RlKGZhbHNlKSxcclxuICAgICAgICAgICAgICAgIG1hcmdpblRvcCxcclxuICAgICAgICAgICAgICAgIG1hcmdpbkJvdHRvbSxcclxuICAgICAgICAgICAgICAgIGVsZW1lbnRzID0gdGhhdC5zZWxlY3RwaWNrZXIudmlldy52aXNpYmxlRWxlbWVudHMsXHJcbiAgICAgICAgICAgICAgICB0b1Nhbml0aXplID0gW107XHJcblxyXG4gICAgICAgICAgICAvLyByZXBsYWNlIHRoZSBleGlzdGluZyBVTCB3aXRoIGFuIGVtcHR5IG9uZSAtIHRoaXMgaXMgZmFzdGVyIHRoYW4gJC5lbXB0eSgpXHJcbiAgICAgICAgICAgIG1lbnVJbm5lci5yZXBsYWNlQ2hpbGQoZW1wdHlNZW51LCBtZW51SW5uZXIuZmlyc3RDaGlsZCk7XHJcblxyXG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgdmlzaWJsZUVsZW1lbnRzTGVuID0gZWxlbWVudHMubGVuZ3RoOyBpIDwgdmlzaWJsZUVsZW1lbnRzTGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICB2YXIgZWxlbWVudCA9IGVsZW1lbnRzW2ldLFxyXG4gICAgICAgICAgICAgICAgICBlbFRleHQsXHJcbiAgICAgICAgICAgICAgICAgIGVsZW1lbnREYXRhO1xyXG5cclxuICAgICAgICAgICAgICBpZiAodGhhdC5vcHRpb25zLnNhbml0aXplKSB7XHJcbiAgICAgICAgICAgICAgICBlbFRleHQgPSBlbGVtZW50Lmxhc3RDaGlsZDtcclxuXHJcbiAgICAgICAgICAgICAgICBpZiAoZWxUZXh0KSB7XHJcbiAgICAgICAgICAgICAgICAgIGVsZW1lbnREYXRhID0gdGhhdC5zZWxlY3RwaWNrZXIuY3VycmVudC5kYXRhW2kgKyB0aGF0LnNlbGVjdHBpY2tlci52aWV3LnBvc2l0aW9uMF07XHJcblxyXG4gICAgICAgICAgICAgICAgICBpZiAoZWxlbWVudERhdGEgJiYgZWxlbWVudERhdGEuY29udGVudCAmJiAhZWxlbWVudERhdGEuc2FuaXRpemVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdG9TYW5pdGl6ZS5wdXNoKGVsVGV4dCk7XHJcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudERhdGEuc2FuaXRpemVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgbWVudUZyYWdtZW50LmFwcGVuZENoaWxkKGVsZW1lbnQpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAodGhhdC5vcHRpb25zLnNhbml0aXplICYmIHRvU2FuaXRpemUubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgc2FuaXRpemVIdG1sKHRvU2FuaXRpemUsIHRoYXQub3B0aW9ucy53aGl0ZUxpc3QsIHRoYXQub3B0aW9ucy5zYW5pdGl6ZUZuKTtcclxuICAgICAgIC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ldFdpZHRoO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmIChhY3R1YWxNZW51V2lkdGggPiB0aGF0LnNpemVJbmZvLm1lbnVJbm5lcklubmVyV2lkdGgpIHtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zaXplSW5mby5tZW51SW5uZXJJbm5lcldpZHRoID0gYWN0dWFsTWVudVdpZHRoO1xyXG4gICAgICAgICAgICAgICAgICBtZW51SW5uZXIuZmlyc3RDaGlsZC5zdHlsZS5taW5XaWR0aCA9IHRoYXQuc2l6ZUluZm8ubWVudUlubmVySW5uZXJXaWR0aCArICdweCc7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgLy8gcmVzZXQgdG8gZGVmYXVsdCBDU1Mgc3R5bGluZ1xyXG4gICAgICAgICAgICAgICAgdGhhdC4kbWVudVswXS5zdHlsZS5taW5XaWR0aCA9ICcnO1xyXG4gICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdGhhdC5wcmV2QWN0aXZlSW5kZXggPSB0aGF0LmFjdGl2ZUluZGV4O1xyXG5cclxuICAgICAgICBpZiAoIXRoYXQub3B0aW9ucy5saXZlU2VhcmNoKSB7XHJcbiAgICAgICAgICB0aGF0LiRtZW51SW5uZXIudHJpZ2dlcignZm9jdXMnKTtcclxuICAgICAgICB9IGVsc2UgaWYgKGlzU2VhcmNoaW5nICYmIGluaXQpIHtcclxuICAgICAgICAgIHZhciBpbmRleCA9IDAsXHJcbiAgICAgICAgICAgICAgbmV3QWN0aXZlO1xyXG5cclxuICAgICAgICAgIGlmICghdGhhdC5zZWxlY3RwaWNrZXIudmlldy5jYW5IaWdobGlnaHRbaW5kZXhdKSB7XHJcbiAgICAgICAgICAgIGluZGV4ID0gMSArIHRoYXQuc2VsZWN0cGlja2VyLnZpZXcuY2FuSGlnaGxpZ2h0LnNsaWNlKDEpLmluZGV4T2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uICsgJyBjaGVjay1tYXJrJztcclxuICAgICAgICBlbGVtZW50VGVtcGxhdGVzLmEuYXBwZW5kQ2hpbGQoZWxlbWVudFRlbXBsYXRlcy5jaGVja01hcmspO1xyXG4gICAgICB9XHJcblxyXG4gICAgICB2YXIgc2VsZWN0T3B0aW9ucyA9IHRoaXMuJGVsZW1lbnRbMF0ucXVlcnlTZWxlY3RvckFsbCgnc2VsZWN0ID4gKicgKyBvcHRpb25TZWxlY3Rvcik7XHJcblxyXG4gICAgICBmdW5jdGlvbiBhZGREaXZpZGVyIChjb25maWcpIHtcclxuICAgICAgICB2YXIgcHJldmlvdXNEYXRhID0gbWFpbkRhdGFbbWFpbkRhdGEubGVuZ3RoIC0gMV07XHJcblxyXG4gICAgICAgIC8vIGVuc3VyZSBvcHRncm91cCBkb2Vzbid0IGNyZWF0ZSBiYWNrLXRvLWJhY2sgZGl2aWRlcnNcclxuICAgICAgICBpZiAoXHJcbiAgICAgICAgICBwcmV2aW91c0RhdGEgJiZcclxuICAgICAgICAgIHByZXZpb3VzRGF0YS50eXBlID09PSAnZGl2aWRlcicgJiZcclxuICAgICAgICAgIChwcmV2aW91c0RhdGEub3B0SUQgfHwgY29uZmlnLm9wdElEKVxyXG4gICAgICAgICkge1xyXG4gICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgY29uZmlnID0gY29uZmlnIHx8IHt9O1xyXG4gICAgICAgIGNvbmZpZy50eXBlID0gJ2RpdmlkZXInO1xyXG5cclxuICAgICAgICBtYWluRWxlbWVudHMucHVzaChcclxuICAgICAgICAgIGdlbmVyYXRlT3B0aW9uLmxpKFxyXG4gICAgICAgICAgICBmYWxzZSxcclxuICAgICAgICAgICAgY2xhc3NOYW1lcy5ESVZJREVSLFxyXG4gICAgICAgICAgICAoY29uZmlnLm9wdElEID8gY29uZmlnLm9wdElEICsgJ2RpdicgOiB1bmRlZmluZWQpXHJcbiAgICAgICAgICApXHJcbiAgICAgICAgKTtcclxuXHJcbiAgICAgICAgbWFpbkRhdGEucHVzaChjb25maWcpO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBmdW5jdGlvbiBhZGRPcHRpb24gKG9wdGlvbiwgY29uZmlnKSB7XHJcbiAgICAgICAgY29uZmlnID0gY29uZmlnIHx8IHt9O1xyXG5cclxuICAgICAgICBjb25maWcuZGl2aWRlciA9IG9wdGlvbi5nZXRBdHRyaWJ1dGUoJ2RhdGEtZGl2aWRlcicpID09PSAndHJ1ZSc7XHJcblxyXG4gICAgICAgIGlmIChjb25maWcuZGl2aWRlcikge1xyXG4gICAgICAgICAgYWRkRGl2aWRlcih7XHJcbiAgICAgICAgICAgIG9wdElEOiBjb25maWcub3B0SURcclxuICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICB2YXIgbGlJbmRleCA9IG1haW5EYXRhLmxlbmd0aCxcclxuICAgICAgICAgICAgICBjc3NUZXh0ID0gb3B0aW9uLnN0eWxlLmNzc1RleHQsXHJcbiAgICAgICAgICAgICAgaW5saW5lU3R5bGUgPSBjc3NUZXh0ID8gaHRtbEVzY2FwZShjc3NUZXh0KSA6ICcnLFxyXG4gICAgICAgICAgICAgIG9wdGlvbkNsYXNzID0gKG9wdGlvbi5jbGFzc05hbWUgfHwgJycpICsgKGNvbmZpZy5vcHRncm91cENsYXNzIHx8ICcnKTtcclxuXHJcbiAgICAgICAgICBpZiAoY29uZmlnLm9wdElEKSBvcHRpb25DbGFzcyA9ICdvcHQgJyArIG9wdGlvbkNsYXNzO1xyXG5cclxuICAgICAgICAgIGNvbmZpZy50ZXh0ID0gb3B0aW9uLnRleHRDb250ZW50O1xyXG5cclxuICAgICAgICAgIGNvbmZpZy5jb250ZW50ID0gb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1jb250ZW50Jyk7XHJcbiAgICAgICAgICBjb25maWcudG9rZW5zID0gb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS10b2tlbnMnKTtcclxuICAgICAgICAgIGNvbmZpZy5zdWJ0ZXh0ID0gb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1zdWJ0ZXh0Jyk7XHJcbiAgICAgICAgICBjb25maWcuaWNvbiA9IG9wdGlvbi5nZXRBdHRyaWJ1dGUoJ2RhdGEtaWNvbicpO1xyXG4gICAgICAgICAgY29uZmlnLmljb25CYXNlID0gaWNvbkJhc2U7XHJcblxyXG4gICAgICAgICAgdmFyIHRleHRFbGVtZW50ID0gZ2VuZXJhdGVPcHRpb24udGV4dChjb25maWcpO1xyXG4gICAgICAgICAgdmFyIGxpRWxlbWVudCA9IGdlbmVyYXRlT3B0aW9uLmxpKFxyXG4gICAgICAgICAgICBnZW5lcmF0ZU9wdGlvbi5hKFxyXG4gICAgICAgICAgICAgIHRleHRFbGVtZW50LFxyXG4gICAgICAgICAgICAgIG9wdGlvbkNsYXNzLFxyXG4gICAgICAgICAgICAgIGlubGluZVN0eWxlXHJcbiAgICAgICAgICAgICksXHJcbiAgICAgICAgICAgICcnLFxyXG4gICAgICAgICAgICBjb25maWcub3B0SURcclxuICAgICAgICAgICk7XHJcblxyXG4gICAgICAgICAgaWYgKGxpRWxlbWVudC5maXJzdENoaWxkKSB7XHJcbiAgICAgICAgICAgIGxpRWxlbWVudC5maXJzdENoaWxkLmlkID0gdGhhdC5zZWxlY3RJZCArICctJyArIGxpSW5kZXg7XHJcbiAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgbWFpbkVsZW1lbnRzLnB1c2gobGlFbGVtZW50KTtcclxuXHJcbiAgICAgICAgICBvcHRpb24ubGlJbmRleCA9IGxpSW5kZXg7XHJcblxyXG4gICAgICAgICAgY29uZmlnLmRpc3BsYXkgPSBjb25maWcuY29udGVudCB8fCBjb25maWcudGV4dDtcclxuICAgICAgICAgIGNvbmZpZy50eXBlID0gJ29wdGlvbic7XHJcbiAgICAgICAgICBjb25maWcuaW5kZXggPSBsaUluZGV4O1xyXG4gICAgICAgICAgY29u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xcclxuICAgICAgICAgICAgaGVhZGVySW5kZXgsXHJcbiAgICAgICAgICAgIGxhc3RJbmRleDtcclxuXHJcbiAgICAgICAgb3B0SUQrKztcclxuXHJcbiAgICAgICAgaWYgKHByZXZpb3VzKSB7XHJcbiAgICAgICAgICBhZGREaXZpZGVyKHsgb3B0SUQ6IG9wdElEIH0pO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdmFyIGxhYmVsRWxlbWVudCA9IGdlbmVyYXRlT3B0aW9uLmxhYmVsKGNvbmZpZyk7XHJcblxyXG4gICAgICAgIG1haW5FbGVtZW50cy5wdXNoKFxyXG4gICAgICAgICAgZ2VuZXJhdGVPcHRpb24ubGkobGFiZWxFbGVtZW50LCAnZHJvcGRvd24taGVhZGVyJyArIG9wdGdyb3VwQ2xhc3MsIG9wdElEKVxyXG4gICAgICAgICk7XHJcblxyXG4gICAgICAgIG1haW5EYXRhLnB1c2goe1xyXG4gICAgICAgICAgZGlzcGxheTogY29uZmlnLmxhYmVsLFxyXG4gICAgICAgICAgc3VidGV4dDogY29uZmlnLnN1YnRleHQsXHJcbiAgICAgICAgICB0eXBlOiAnb3B0Z3JvdXAtbGFiZWwnLFxyXG4gICAgICAgICAgb3B0SUQ6IG9wdElEXHJcbiAgICAgICAgfSk7XHJcblxyXG4gICAgICAgIGZvciAodmFyIGogPSAwLCBsZW4gPSBvcHRpb25zLmxlbmd0aDsgaiA8IGxlbjsgaisrKSB7XHJcbiAgICAgICAgICB2YXIgb3B0aW9uID0gb3B0aW9uc1tqXTtcclxuXHJcbiAgICAgICAgICBpZiAoaiA9PT0gMCkge1xyXG4gICAgICAgICAgICBoZWFkZXJJbmRleCA9IG1haW5EYXRhLmxlbmd0aCAtIDE7XHJcbiAgICAgICAgICAgIGxhc3RJbmRleCA9IGhlYWRlckluZGV4ICsgbGVuO1xyXG4gICAgICAgICAgfVxyXG5cclxuICAgICAgICAgIGFkZE9wdGlvbihvcHRpb24sIHtcclxuICAgICAgICAgICAgaGVhZGVySW5kZXg6IGhlYWRlckluZGV4LFxyXG4gICAgICAgICAgICBsYXN0SW5kZXg6IGxhc3RJbmRleCxcclxuICAgICAgICAgICAgb3B0SUQ6IG9wdElELFxyXG4gICAgICAgICAgICBvcHRncm91cENsYXNzOiBvcHRncm91cENsYXNzLFxyXG4gICAgICAgICAgICBkaXNhYmxlZDogb3B0Z3JvdXAuZGlzYWJsZWRcclxuICAgICAgICAgIH0pO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgaWYgKG5leHQpIHtcclxuICAgICAgICAgIGFkZERpdmlkZXIoeyBvcHRJRDogb3B0SUQgfSk7XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcblxyXG4gICAgICBmb3IgKHZhciBsZW4gPSBzZWxlY3RPcHRpb25zLmxlbmd0aDsgc3RhcnRJbmRleCA8IGxlbjsgc3RhcnRJbmRleCsrKSB7XHJcbiAgICAgICAgdmFyIGl0ZW0gPSBzZWxlY3RPcHRpb25zW3N0YXJ0SW5kZXhdO1xyXG5cclxuICAgICAgICBpZiAoaXRlbS50YWdOYW1lICE9PSAnT1BUR1JPVVAnKSB7XHJcbiAgICAgICAgICBhZGRPcHRpb24oaXRlbSwge30pO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICBhZGRPcHRncm91cChzdGFydEluZGV4LCBzZWxlY3RPcHRpb25zKTtcclxuICAgICAgICB9XHJcbiAgICAgIH1cclxuXHJcbiAgICAgIHRoaXMuc2VsZWN0cGlja2VyLm1haW4uZWxlbWVudHMgPSBtYWluRWxlbWVudHM7XHJcbiAgICAgIHRoaXMuc2VsZWN0cGlja2VyLm1haW4uZGF0YSA9IG1haW5EYXRhO1xyXG5cclxuICAgICAgdGhpcy5zZWxlY3RwaWNrZXIuY3VycmVudCA9IHRoaXMuc2VsZWN0cGlja2VyLm1haW47XHJcbiAgICB9LFxyXG5cclxuICAgIGZpbmRMaXM6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgcmV0dXJ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JlIHNob3duXHJcbiAgICAgICAgaWYgKHNob3dDb3VudCA9PT0gZmFsc2UpIHtcclxuICAgICAgICAgIGZvciAodmFyIHNlbGVjdGVkSW5kZXggPSAwOyBzZWxlY3RlZEluZGV4IDwgc2VsZWN0ZWRDb3VudDsgc2VsZWN0ZWRJbmRleCsrKSB7XHJcbiAgICAgICAgICAgIGlmIChzZWxlY3RlZEluZGV4IDwgNTApIHtcclxuICAgICAgICAgICAgICB2YXIgb3B0aW9uID0gc2VsZWN0ZWRPcHRpb25zW3NlbGVjdGVkSW5kZXhdLFxyXG4gICAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMgPSB7fSxcclxuICAgICAgICAgICAgICAgICAgdGhpc0RhdGEgPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY29udGVudDogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1jb250ZW50JyksXHJcbiAgICAgICAgICAgICAgICAgICAgc3VidGV4dDogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1zdWJ0ZXh0JyksXHJcbiAgICAgICAgICAgICAgICAgICAgaWNvbjogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1pY29uJylcclxuICAgICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgICAgaWYgKHRoaXMubXVsdGlwbGUgJiYgc2VsZWN0ZWRJbmRleCA+IDApIHtcclxuICAgICAgICAgICAgICAgIHRpdGxlRnJhZ21lbnQuYXBwZW5kQ2hpbGQobXVsdGlwbGVTZXBhcmF0b3IuY2xvbmVOb2RlKGZhbHNlKSk7XHJcbiAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICBpZiAob3B0aW9uLnRpdGxlKSB7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMudGV4dCA9IG9wdGlvbi50aXRsZTtcclxuICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXNEYXRhLmNvbnRlbnQgJiYgdGhhdC5vcHRpb25zLnNob3dDb250ZW50KSB7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMuY29udGVudCA9IHRoaXNEYXRhLmNvbnRlbnQudG9TdHJpbmcoKTtcclxuICAgICAgICAgICAgICAgIGhhc0NvbnRlbnQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAodGhhdC5vcHRpb25zLnNob3dJY29uKSB7XHJcbiAgICAgICAgICAgICAgICAgIHRpdGxlT3B0aW9ucy5pY29uID0gdGhpc0RhdGEuaWNvbjtcclxuICAgICAgICAgICAgICAgICAgdGl0bGVPcHRpb25zLmljb25CYXNlID0gdGhpcy5vcHRpb25zLmljb25CYXNlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHRoYXQub3B0aW9ucy5zaG93U3VidGV4dCAmJiAhdGhhdC5tdWx0aXBsZSAmJiB0aGlzRGF0YS5zdWJ0ZXh0KSB0aXRsZU9wdGlvbnMuc3VidGV4dCA9ICcgJyArIHRoaXNEYXRhLnN1YnRleHQ7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMudGV4dCA9IG9wdGlvbi50ZXh0Q29udGVudC50cmltKCk7XHJcbiAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICB0aXRsZUZyYWdtZW50LmFwcGVuZENoaWxkKGdlbmVyYXRlT3B0aW9uLnRleHQodGl0bGVPcHRpb25zLCB0cnVlKSk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAvLyBhZGQgZWxsaXBzaXNcclxuICAgICAgICAgIGlmIChzZWxlY3RlZENvdW50ID4gNDkpIHtcclxuICAgICAgICAgICAgdGl0bGVGcmFnbWVudC5hcHBlbmRDaGlsZChkb2N1bWVudC5jcmV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gICAgICAgICAgICAgIGNvbnRhaW5lclBvcyA9ICRjb250YWluZXIub2Zmc2V0KCk7XHJcbiAgICAgICAgICAgICAgY29udGFpbmVyUG9zLnRvcCArPSBwYXJzZUludCgkY29udGFpbmVyLmNzcygnYm9yZGVyVG9wV2lkdGgnKSkgLSAkY29udGFpbmVyLnNjcm9sbFRvcCgpO1xyXG4gICAgICAgICAgICAgIGNvbnRhaW5lclBvcy5sZWZ0ICs9IHBhcnNlSW50KCRjb250YWluZXIuY3NzKCdib3JkZXJMZWZ0V2lkdGgnKSkgLSAkY29udGFpbmVyLnNjcm9sbExlZnQoKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICBjb250YWluZXJQb3MgPSB7IHRvcDogMCwgbGVmdDogMCB9O1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBhY3R1YWxIZWlnaHQgPSAkZWxlbWVudC5oYXNDbGFzcyhjbGFzc05hbWVzLkRST1BVUCkgPyAwIDogJGVsZW1lbnRbMF0ub2Zmc2V0SGVpZ2h0O1xyXG5cclxuICAgICAgICAgICAgLy8gQm9vdHN0cmFwIDQrIHVzZXMgUG9wcGVyIGZvciBtZW51IHBvc2l0aW9uaW5nXHJcbiAgICAgICAgICAgIGlmICh2ZXJzaW9uLm1ham9yIDwgNCB8fCBkaXNwbGF5ID09PSAnc3RhdGljJykge1xyXG4gICAgICAgICAgICAgIGNvbnRhaW5lclBvc2l0aW9uLnRvcCA9IHBvcy50b3AgLSBjb250YWluZXJQb3MudG9wICsgYWN0dWFsSGVpZ2h0O1xyXG4gICAgICAgICAgICAgIGNvbnRhaW5lclBvc2l0aW9uLmxlZnQgPSBwb3MubGVmdCAtIGNvbnRhaW5lclBvcy5sZWZ0O1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBjb250YWluZXJQb3NpdGlvbi53aWR0aCA9ICRlbGVtZW50WzBdLm9mZnNldFdpZHRoO1xyXG5cclxuICAgICAg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ICAgICAgICAgICAgICAgICBlbGVtZW50LnNlbGVjdGVkSW5kZXggPSAtMTtcclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zZXRPcHRpb25TdGF0dXModHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1heE9wdGlvbnNHcnAgJiYgbWF4T3B0aW9uc0dycCA9PSAxKSB7XHJcbiAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgJG9wdGdyb3VwT3B0aW9ucy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBfb3B0aW9uID0gJG9wdGdyb3VwT3B0aW9uc1tpXTtcclxuICAgICAgICAgICAgICAgICAgICBfb3B0aW9uLnNlbGVjdGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhhdC5zZXRTZWxlY3RlZChfb3B0aW9uLmxpSW5kZXgsIGZhbHNlKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zZXRTZWxlY3RlZChjbGlja2VkSW5kZXgsIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgdmFyIG1heE9wdGlvbnNUZXh0ID0gdHlwZW9mIHRoYXQub3B0aW9ucy5tYXhPcHRpb25zVGV4dCA9PT0gJ3N0cmluZycgPyBbdGhhdC5vcHRpb25zLm1heE9wdGlvbnNUZXh0LCB0aGF0Lm9wdGlvbnMubWF4T3B0aW9uc1RleHRdIDogdGhhdC5vcHRpb25zLm1heE9wdGlvbnNUZXh0LFxyXG4gICAgICAgICAgICAgICAgICAgICAgbWF4T3B0aW9uc0FyciA9IHR5cGVvZiBtYXhPcHRpb25zVGV4dCA9PT0gJ2Z1bmN0aW9uJyA/IG1heE9wdGlvbnNUZXh0KG1heE9wdGlvbnMsIG1heE9wdGlvbnNHcnApIDogbWF4T3B0aW9uc1RleHQsXHJcbiAgICAgICAgICAgICAgICAgICAgICBtYXhUeHQgPSBtYXhPcHRpb25zQXJyWzBdLnJlcGxhY2UoJ3tufScsIG1heE9wdGlvbnMpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgbWF4VHh0R3JwID0gbWF4T3B0aW9uc0FyclsxXS5yZXBsYWNlKCd7bn0nLCBtYXhPcHRpb25zR3JwKSxcclxuICAgICAgICAgICAgICAgICAgICAgICRub3RpZnkgPSAkKCc8ZGl2IGNsYXNzPVwibm90aWZ5XCI+PC9kaXY+Jyk7XHJcbiAgICAgICAgICAgICAgICAgIC8vIElmIHt2YXJ9IGlzIHNldCBpbiBhcnJheSwgcmVwbGFjZSBpdFxyXG4gICAgICAgICAgICAgICAgICAvKiogQGRlcHJlY2F0ZWQgKi9cclxuICAgICAgICAgICAgICAgICAgaWYgKG1heE9wdGlvbnNBcnJbMl0pIHtcclxuICAgICAgICAgICAgICAgICAgICBtYXhUeHQgPSBtYXhUeHQucmVwbGFjZSgne3Zhcn0nLCBtYXhPcHRpb25zQXJyWzJdW21heE9wdGlvbnMgPiAxID8gMCA6IDFdKTtcclxuICAgICAgICAgICAgICAgICAgICBtYXhUeHRHcnAgPSBtYXhUeHRHcnAucmVwbGFjZSgne3Zhcn0nLCBtYXhPcHRpb25zQXJyWzJdW21heE9wdGlvbnNHcnAgPiAxID8gMCA6IDFdKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gZmFsc2U7XHJcblxyXG4gICAgICAgICAgICAgICAgICB0aGF0LiRtZW51LmFwcGVuZCgkbm90aWZ5KTtcclxuXHJcbiAgICAgICAgICAgICAgICAgIGlmIChtYXhPcHRpb25zICYmIG1heFJlYWNoZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAkbm90aWZ5LmFwcGVuZCgkKCc8ZGl2PicgKyBtYXhUeHQgKyAnPC9kaXY+JykpO1xyXG4gICAgICAgICAgICAgICAgICAgIHRyaWdnZXJDaGFuZ2UgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB0aGF0LiRlbGVtZW50LnRyaWdnZXIoJ21heFJlYWNoZWQnICsgRVZFTlRfS0VZKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgaWYgKG1heE9wdGlvbnNHcnAgJiYgbWF4UmVhY2hlZEdycCkge1xyXG4gICAgICAgICAgICAgICAgICAgICRub3RpZnkuYXBwZW5kKCQoJzxkaXY+JyArIG1heFR4dEdycCArICc8L2Rpdj4nKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgdHJpZ2dlckNoYW5nZSA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIHRoYXQuJGVsZW1lbnQudHJpZ2dlcignbWF4UmVhY2hlZEdycCcgKyBFVkVOVF9LRVkpO1xyXG4gICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGF0LnNldFNlbGVjdGVkKGNsaWNrZWRJbmRleCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICB9LCAxMCk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAkbm90aWZ5WzBdLmNsYXNzTGlzdC5hZGQoJ2ZhZGVPdXQnKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICRub3RpZnkucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAgIH0sIDEwNTApO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxy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AgIH1cclxuXHJcbiAgICAgICAgICAgIGlmIChjYWNoZVtpXSAmJiBsaS5oZWFkZXJJbmRleCAhPT0gdW5kZWZpbmVkICYmIGNhY2hlQXJyLmluZGV4T2YobGkuaGVhZGVySW5kZXgpID09PSAtMSkge1xyXG4gICAgICAgICAgICAgIGlmIChsaS5oZWFkZXJJbmRleCA+IDApIHtcclxuICAgICAgICAgICAgICAgIGNhY2hlW2xpLmhlYWRlckluZGV4IC0gMV0gPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgY2FjaGVBcnIucHVzaChsaS5oZWFkZXJJbmRleCAtIDEpO1xyXG4gICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgY2FjaGVbbGkuaGVhZGVySW5kZXhdID0gdHJ1ZTtcclxuICAgICAgICAgICAgICBjYWNoZUFyci5wdXNoKGxpLmhlYWRlckluZGV4KTtcclxuXHJcbiAgICAgICAgICAgICAgY2FjaGVbbGkubGFzdEluZGV4ICsgMV0gPSB0cnVlO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAoY2FjaGVbaV0gJiYgbGkudHlwZSAhPT0gJ29wdGdyb3VwLWxhYmVsJykgY2FjaGVBcnIucHVzaChpKTtcclxuICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICBmb3IgKHZhciBpID0gMCwgY2FjaGVMZW4gPSBjYWNoZUFyci5sZW5ndGg7IGkgPCBjYWNoZUxlbjsgaSsrKSB7XHJcbiAgICAgICAgICAgIHZhciBpbmRleCA9IGNhY2hlQXJyW2ldLFxyXG4gICAgICAgICAgICAgICAgcHJldkluZGV4ID0gY2FjaGVBcnJbaSAtIDFdLFxyXG4gICAgICAgICAgICAgICAgbGkgPSB0aGF0LnNlbGVjdHBpY2tlci5tYWluLmRhdGFbaW5kZXhdLFxyXG4gICAgICAgICAgICAgICAgbGlQcmV2ID0gdGhhdC5zZWxlY3RwaWNrZXIubWFpbi5kYXRhW3ByZXZJbmRleF07XHJcblx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XHJcbiAgICAgICAgICBpc1ZpcnR1YWwgPSB0aGF0LmlzVmlydHVhbCgpLFxyXG4gICAgICAgICAgcG9zaXRpb24wID0gaXNWaXJ0dWFsID09PSB0cnVlID8gdGhhdC5zZWxlY3RwaWNrZXIudmlldy5wb3NpdGlvbjAgOiAwO1xyXG5cclxuICAgICAgLy8gZG8gbm90aGluZyBpZiBhIGZ1bmN0aW9uIGtleSBpcyBwcmVzc2VkXHJcbiAgICAgIGlmIChlLndoaWNoID49IDExMiAmJiBlLndoaWNoIDw9IDEyMykgcmV0dXJuO1xyXG5cclxuICAgICAgaXNBY3RpdmUgPSB0aGF0LiRuZXdFbGVtZW50Lmhhc0NsYXNzKGNsYXNzTmFtZXMuU0hPVyk7XHJcblxyXG4gICAgICBpZiAoXHJcbiAgICAgICAgIWlzQWN0aXZlICYmXHJcbiAgICAgICAgKFxyXG4gICAgICAgICAgaXNBcnJvd0tleSB8fFxyXG4gICAgICAgICAgKGUud2hpY2ggPj0gNDggJiYgZS53aGljaCA8PSA1NykgfHxcclxuICAgICAgICAgIChlLndoaWNoID49IDk2ICYmIGUud2hpY2ggPD0gMTA1KSB8fFxyXG4gICAgICAgICAgKGUud2hpY2ggPj0gNjUgJiYgZS53aGljaCA8PSA5MClcclxuICAgICAgICApXHJcbiAgICAgICkge1xyXG4gICAgICAgIHRoYXQuJGJ1dHRvbi50cmlnZ2VyKCdjbGljay5icy5kcm9wZG93bi5kYXRhLWFwaScpO1xyXG5cclxuICAgICAgICBpZiAodGhhdC5vcHRpb25zLmxpdmVTZWFyY2gpIHtcclxuICAgICAgICAgIHRoYXQuJHNlYXJjaGJveC50cmlnZ2VyKCdmb2N1cycpO1xyXG4gICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgIH1cclxuICAgICAgfVxyXG5cclxuICAgICAgaWYgKGUud2hpY2ggPT09IGtleUNvZGVzLkVTQ0FQRSAmJiBpc0FjdGl2ZSkge1xyXG4gICAgICAgIGUucHJldmVudERlZmF1bHQoK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gbmV3IFNlbGVjdHBpY2tlcih0aGlzLCBjb25maWcpKSk7XHJcbiAgICAgICAgfSBlbHNlIGlmIChvcHRpb25zKSB7XHJcbiAgICAgICAgICBmb3IgKHZhciBpIGluIG9wdGlvbnMpIHtcclxuICAgICAgICAgICAgaWYgKG9wdGlvbnMuaGFzT3duUHJvcGVydHkoaSkpIHtcclxuICAgICAgICAgICAgICBkYXRhLm9wdGlvbnNbaV0gPSBvcHRpb25zW2ldO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBpZiAodHlwZW9mIF9vcHRpb24gPT0gJ3N0cmluZycpIHtcclxuICAgICAgICAgIGlmIChkYXRhW19vcHRpb25dIGluc3RhbmNlb2YgRnVuY3Rpb24pIHtcclxuICAgICAgICAgICAgdmFsdWUgPSBkYXRhW19vcHRpb25dLmFwcGx5KGRhdGEsIGFyZ3MpO1xyXG4gICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgdmFsdWUgPSBkYXRhLm9wdGlvbnNbX29wdGlvbl07XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcbiAgICB9KTtcclxuXHJcbiAgICBpZiAodHlwZW9mIHZhbHVlICE9PSAndW5kZWZpbmVkJykge1xyXG4gICAgICAvLyBub2luc3BlY3Rpb24gSlNVbnVzZWRBc3NpZ25tZW50XHJcbiAgICAgIHJldHVybiB2YWx1ZTtcclxuICAgIH0gZWxzZSB7XHJcbiAgICAgIHJldHVybiBjaGFpbjtcclxuICAgIH1cclxuICB9XHJcblxyXG4gIHZhciBvbGQgPSAkLmZuLnNlbGVjdHBpY2tlcjtcclxuICAkLmZuLnNlbGVjdHBpY2tlciA9IFBsdWdpbjtcclxuICAkLmZuLnNlbGVjdHBpY2tlci5Db25zdHJ1Y3RvciA9IFNlbGVjdHBpY2tlcjtcclxuXHJcbiAgLy8gU0VMRUNUUElDS0VSIE5PIENPTkZMSUN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wgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIFRPUlQgT1IgT1RIRVJXSVNFLCBBUklTSU5HIEZST00sXG4gKiBPVVQgT0YgT1IgSU4gQ09OTkVDVElPTiBXSVRIIFRIRSBTT0ZUV0FSRSBPUiBUSEUgVVNFIE9SIE9USEVSIERFQUxJTkdTIElOXG4gKiBUSEUgU09GVFdBUkUuXG4gKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi9cblxuXG4rZnVuY3Rpb24gKCQpIHtcbiAgJ3VzZSBzdHJpY3QnO1xuXG4gIC8vIFZBTElEQVRPUiBDTEFTUyBERUZJTklUSU9OXG4gIC8vID09PT09PT09PT09PT09PT09PT09PT09PT09XG5cbiAgZnVuY3Rpb24gZ2V0VmFsdWUoJGVsKSB7XG4gICAgcmV0dXJuICRlbC5pcygnW3R5cGU9XCJjaGVja2JveFwiXScpID8gJGVsLnByb3AoJ2NoZWNrZWQnKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6XG4gICAgICAgICAgICRlbC5pcygnW3R5cGU9XCJyYWRpb1wiXScpICAgID8gISEkKCdbbmFtZT1cIicgKyAkZWwuYXR0cignbmFtZScpICsgJ1wiXTpjaGVja2VkJykubGVuZ3RoIDpcbiAgICAgICAgICAgJGVsLmlzKCdzZWxlY3RbbXVsdGlwbGVdJykgID8gKCRlbC52YWwoKSB8fCBbXSkubGVuZ3RoICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRlbC52YWwoKVxuICB9XG5cbiAgdmFyIFZhbGlkYXRvciA9IGZ1bmN0aW9uIChlbGVtZW50LCBvcHRpb25zKSB7XG4gICAgdGhpcy5vcHRpb25zICAgID0gb3B0aW9uc1xuICAgIHRoaXMudmFsaWRhdG9ycyA9ICQuZXh0ZW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c2lvbiBpbiBkaWZmZXJlbnQgdmVyc2lvbnMgb2YgRmlyZWZveFxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY3JlYXRlT2JqZWN0VVJMOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICBpZiAoJGgub2JqVXJsICYmICRoLm9ialVybC5jcmVhdGVPYmplY3RVUkwgJiYgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuICRoLm9ialVybC5jcmVhdGVPYmplY3RVUkwoZGF0YSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgcmV2b2tlT2JqZWN0VVJMOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICBpZiAoJGgub2JqVXJsICYmICRoLm9ialVybC5yZXZva2VPYmplY3RVUkwgJiYgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgJGgub2JqVXJsLnJldm9rZU9iamVjdFVSTChkYXRhKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY29tcGFyZTogZnVuY3Rpb24gKGlucHV0LCBzdHIsIGV4YWN0KSB7XHJcbiAgICAgICAgICAgIHJldHVybiBpbnB1dCAhPT0gdW5kZWZpbmVkICYmIChleGFjdCA/IGlucHV0ID09PSBzdHIgOiBpbnB1dC5tYXRjaChzdHIpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGlzSUU6IGZ1bmN0aW9uICh2ZXIpIHtcclxuICAgICAgICAgICAgdmFyIGRpdiwgc3RhdHVzO1xyXG4gICAgICAgICAgICAvLyBjaGVjayBmb3IgSUUgdmVyc2lvbnMgPCAxMVxyXG4gICAgICAgICAgICBpZiAobmF2aWdhdG9yLmFwcE5hbWUgIT09ICdNaWNyb3NvZnQgSW50ZXJuZXQgRXhwbG9yZXInKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHZlciA9PT0gMTApIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUmVnRXhwKCdtc2llXFxcXHMnICsgdmVyLCAnaScpLnRlc3QobmF2aWdhdG9yLnVzZXJBZ2VudCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZGl2ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7XHJcbiAgICAgICAgICAgIGRpdi5pbm5lckhUTUwgPSAnPCEtLVtpZiBJRSAnICsgdmVyICsgJ10+IDxpPjwvaT4gPCFbZW5kaWZdLS0+JztcclxuICAgICAgICAgICAgc3RhdHVzID0gZGl2LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdpJykubGVuZ3RoO1xyXG4gICAgICAgICAgICBkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGRpdik7XHJcbiAgICAgICAgICAgIGRpdi5wYXJlbnROb2RlLnJlbW92ZUNoaWxkKGRpdik7XHJcbiAgICAgICAgICAgIHJldHVybiBzdGF0dXM7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBjYW5Bc3NpZ25GaWxlc1RvSW5wdXQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIGlucHV0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnaW5wdXQnKTtcclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIGlucHV0LnR5cGUgPSAnZmlsZSc7XHJcbiAgICAgICAgICAgICAgICBpbnB1dC5maWxlcyA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldERyYWdEcm9wRm9sZGVyczogZnVuY3Rpb24gKGl0ZW1zKSB7XHJcbiAgICAgICAgICAgIHZhciBpLCBpdGVtLCBsZW4gPSBpdGVtcyA/IGl0ZW1zLmxlbmd0aCA6IDAsIGZvbGRlcnMgPSAwO1xyXG4gICAgICAgICAgICBpZiAobGVuID4gMCAmJiBpdGVtc1swXS53ZWJraXRHZXRBc0VudHJ5KCkpIHtcclxuICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgIGl0ZW0gPSBpdGVtc1tpXS53ZWJraXRHZXRBc0VudHJ5KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0gJiYgaXRlbS5pc0RpcmVjdG9yeSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb2xkZXJzKys7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiBmb2xkZXJzO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaW5pdE1vZGFsOiBmdW5jdGlvbiAoJG1vZGFsKSB7XHJcbiAgICAgICAgICAgIHZhciAkYm9keSA9ICQoJ2JvZHknKTtcclxuICAgICAgICAgICAgaWYgKCRib2R5Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgJG1vZGFsLmFwcGVuZFRvKCRib2R5KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNFbXB0eTogZnVuY3Rpb24gKHZhbHVlLCB0cmltKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZSA9PT0gdW5kZWZpbmVkIHx8IHZhbHVlID09PSBudWxsIHx8IHZhbHVlLmxlbmd0aCA9PT0gMCB8fCAodHJpbSAmJiAkLnRyaW0odmFsdWUpID09PSAnJyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBpc0FycmF5OiBmdW5jdGlvbiAoYSkge1xyXG4gICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShhKSB8fCBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYSkgPT09ICdbb2JqZWN0IEFycmF5XSc7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBpZlNldDogZnVuY3Rpb24gKG5lZWRsZSwgaGF5c3RhY2ssIGRlZikge1xyXG4gICAgICAgICAgICBkZWYgPSBkZWYgfHwgJyc7XHJcbiAgICAgICAgICAgIHJldHVybiAoaGF5c3RhY2sgJiYgdHlwZW9mIGhheXN0YWNrID09PSAnb2JqZWN0JyAmJiBuZWVkbGUgaW4gaGF5c3RhY2spID8gaGF5c3RhY2tbbmVlZGxlXSA6IGRlZjtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGNsZWFuQXJyYXk6IGZ1bmN0aW9uIChhcnIpIHtcclxuICAgICAgICAgICAgaWYgKCEoYXJyIGluc3RhbmNlb2YgQXJyYXkpKSB7XHJcbiAgICAgICAgICAgICAgICBhcnIgPSBbXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gYXJyLmZpbHRlcihmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIChlICE9PSB1bmRlZmluZWQgJiYgZSAhPT0gbnVsbCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgc3BsaWNlQXJyYXk6IGZ1bmN0aW9uIChhcnIsIGluZGV4LCByZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgdmFyIGksIGogPSAwLCBvdXQgPSBbXSwgbmV3QXJyO1xyXG4gICAgICAgICAgICBpZiAoIShhcnIgaW5zdGFuY2VvZiBBcnJheSkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBbXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBuZXdBcnIgPSAkLmV4dGVuZCh0cnVlLCBbXSwgYXJyKTtcclxuICAgICAgICAgICAgaWYgKHJldmVyc2VPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgbmV3QXJyLnJldmVyc2UoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbmV3QXJyLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaSAhPT0gaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXRbal0gPSBuZXdBcnJbaV07XHJcbiAgICAgICAgICAgICAgICAgICAgaisrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChyZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgICAgIG91dC5yZXZlcnNlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldE51bTogZnVuY3Rpb24gKG51bSwgZGVmKSB7XHJcbiAgICAgICAgICAgIGRlZiA9IGRlZiB8fCAwO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIG51bSA9PT0gJ251bWJlcicpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBudW07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBudW0gPT09ICdzdHJpbmcnKSB7XHJcbiAgICAgICAgICAgICAgICBudW0gPSBwYXJzZUZsb2F0KG51bSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGlzTmFOKG51bSkgPyBkZWYgOiBudW07XHJcbiAgICAgICAgfSxcclxuICAgICAgICBoYXNGaWxlQVBJU3VwcG9ydDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICByZXR1cm4gISEod2luZG93LkZpbGUgJiYgd2luZG93LkZpbGVSZWFkZXIpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaGFzRHJhZ0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uZXcgVWludDhBcnJheSgxMDApXSkuc2l6ZSA9PT0gMTAwO1xyXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIGRhdGFVUkkyQmxvYjogZnVuY3Rpb24gKGRhdGFVUkkpIHtcclxuICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSlNVbnJlc29sdmVkVmFyaWFibGVcclxuICAgICAgICAgICAgdmFyIEJsb2JCdWlsZGVyID0gd2luZG93LkJsb2JCdWlsZGVyIHx8IHdpbmRvdy5XZWJLaXRCbG9iQnVpbGRlciB8fCB3aW5kb3cuTW96QmxvYkJ1aWxkZXIgfHxcclxuICAgICAgICAgICAgICAgIHdpbmRvdy5NU0Jsb2JCdWlsZGVyLCBjYW5CbG9iID0gJGguaGFzQmxvYlN1cHBvcnQoKSwgYnl0ZVN0ciwgYXJyYXlCdWZmZXIsIGludEFycmF5LCBpLCBtaW1lU3RyLCBiYixcclxuICAgICAgICAgICAgICAgIGNhblByb2NlZWQgPSAoY2FuQmxvYiB8fCBCbG9iQnVpbGRlcikgJiYgd2luZG93LmF0b2IgJiYgd2luZG93LkFycmF5QnVmZmVyICYmIHdpbmRvdy5VaW50OEFycmF5O1xyXG4gICAgICAgICAgICBpZiAoIWNhblByb2NlZWQpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBudWxsO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChkYXRhVVJJLnNwbGl0KCcsJylbMF0uaW5kZXhPZignYmFzZTY0JykgPj0gMCkge1xyXG4gICAgICAgICAgICAgICAgYnl0ZVN0ciA9IGF0b2IoZGF0YVVSSS5zcGxpdCgnLCcpWzFdKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGJ5dGVTdHIgPSBkZWNvZGVVUklDb21wb25lbnQoZGF0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zb2x2ZWRGdW5jdGlvblxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUZXh0RGVjb2RlcigndXRmLTgnKS5kZWNvZGUoYnVmZmVyKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgYXJyYXkgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuYXBwbHkobmV3IFVpbnQ4QXJyYXkoYnVmZmVyKSksIG91dCA9ICcnLCBpID0gMCwgbGVuLCBjLCBjaGFyMiwgY2hhcjM7XHJcbiAgICAgICAgICAgIGxlbiA9IGFycmF5Lmxlbmd0aDtcclxuICAgICAgICAgICAgd2hpbGUgKGkgPCBsZW4pIHtcclxuICAgICAgICAgICAgICAgIGMgPSBhcnJheVtpKytdO1xyXG4gICAgICAgICAgICAgICAgc3dpdGNoIChjID4+IDQpIHsgLy8ganNoaW50IGlnbm9yZTpsaW5lXHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDI6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNDpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDU6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gMHh4eHh4eHhcclxuICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gMTEweCB4eHh4ICAgMTB4eCB4eHh4XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIyID0gYXJyYXlbaSsrXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoKChjICYgMHgxRikgPDwgNikgfCAoY2hhcjIgJiAweDNGKSk7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDE0OlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyAxMTEwIHh4eHggIDEweHggeHh4eCAgMTB4eCB4eHh4XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIyID0gYXJyYXlbaSsrXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2hhcjMgPSBhcnJheVtpKytdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgoKGMgJiAweDBGKSA8PCAxMikgfCAvLyBqc2hpbnQgaWdub3JlOmxpbmVcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoY2hhcjIgJiAweDNGKSA8PCA2KSB8ICAvLyBqc2hpbnQgaWdub3JlOmxpbmVcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoY2hhcjMgJiAweDNGKSA8PCAwKSk7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNIdG1sOiBmdW5jdGlvbiAoc3RyKSB7XHJcbiAgICAgICAgICAgIHZhciBhID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7XHJcbiAgICAgICAgICAgIGEuaW5uZXJIVE1MID0gc3RyO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBjID0gYS5jaGlsZE5vZGVzLCBpID0gYy5sZW5ndGg7IGktLTspIHtcclxuICAgICAgICAgICAgICAgIGlmIChjW2ldLm5vZGVUeXBlID09PSAxKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNTdmc6IGZ1bmN0aW9uIChzdHIpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHN0ci5tYXRjaCgvXlxccyo8XFw/eG1sL2kpICYmIChzdHIubWF0Y2goLzwhRE9DVFlQRSBzdmcvaSkgfHwgc3RyLm1hdGNoKC88c3ZnL2kpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldE1pbWVUeXBlOiBmdW5jdGlvbiAoc2lnbmF0dXJlLCBjb250ZW50cywgdHlwZSkge1xyXG4gICAgICAgICAgICBzd2l0Y2ggKHNpZ25hdHVyZSkge1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTAnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTEnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTInOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2UvanBlZyc7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc4OTUwNEU0Nyc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdpbWFnZS9wbmcnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNDc0OTQ2MzgnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2UvZ2lmJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzQ5NDkyYTAwJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ltYWdlL3RpZmYnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTI0OTQ2NDYnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2Uvd2VicCc7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc2Njc0Nzk3MCc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd2aWRlby8zZ3AnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNGY2NzY3NTMnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndmlkZW8vb2dnJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzFhNDVkZmEzJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3ZpZGVvL21rdic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICcwMDAwMDFiYSc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICcwMDAwMDFiMyc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd2aWRlby9tcGVnJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzMwMjZiMjc1JzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3ZpZGVvL3dtdic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICcyNTUwNDQ0Nic6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9wZGYnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnMjUyMTUwNTMnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vcHMnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjAzMDQnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjA1MDYnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjA1MDgnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vemlwJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzM3N2FiY2FmJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uLzd6JztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzc1NzM3NDYxJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uL3Rhcic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc3ODAxNzMwZCc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9kbWcnO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHNpZ25hdHVyZS5zdWJzdHJpbmcoMCwgNikpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnNDM1NzUzJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24veC1zaG9ja3dhdmUtZmxhc2gnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0OTQ0MzMnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhdWRpby9tcDMnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0MjVhNjgnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9iemlwJztcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc2lnbmF0dXJlLnN1YnN0cmluZygwLCA0KSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzQyNGQnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ltYWdlL2JtcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZmZmYic6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXVkaW8vbXAzJztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0ZDVhJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9leGUnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzFmOWQnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzFmYTAnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uL3ppcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnMWY4Yic6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vZ3ppcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnRlbnRzICYmICFjb250ZW50cy5tYXRjaChcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9bXlxcdTAwMDAtXFx1MDA3Zl0vKSA/ICdhcHBsaWNhdGlvbi90ZXh0LXBsYWluJyA6IHR5cGU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBhZGRDc3M6IGZ1bmN0aW9uICgkZWwsIGNzcykge1xyXG4gICAgICAgICAgICAkZWwucmVtb3ZlQ2xhc3MoY3NzKS5hZGRDbGFzcyhjc3MpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0RWxlbWVudDogZnVuY3Rpb24gKG9wdGlvbnMsIHBhcmFtLCB2YWx1ZSkge1xyXG4gICAgICAgICAgICByZXR1cm4gKCRoLmlzRW1wdHkob3B0aW9ucykgfHwgJGguaXNFbXB0eShvcHRpb25zW3BhcmFtXSkpID8gdmFsdWUgOiAkKG9wdGlvbnNbcGFyYW1dKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHVuaXFJZDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICByZXR1cm4gTWF0aC5yb3VuZChuZXcgRGF0ZSgpLmdldFRpbWUoKSkgKyAnXycgKyBNYXRoLnJvdW5kKE1hdGgucmFuZG9tKCkgKiAxMDApO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaHRtbEVuY29kZTogZnVuY3Rpb24gKHN0ciwgdW5kZWZWYWwpIHtcclxuICAgICAgICAgICAgaWYgKHN0ciA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdW5kZWZWYWwgfHwgbnVsbDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gc3RyLnJlcGxhY2UoLyYvZywgJyZhbXA7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC88L2csICcmbHQ7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8+L2csICcmZ3Q7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cIi9nLCAnJnF1b3Q7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8nL2csICcmYXBvczsnKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHJlcGxhY2VUYWdzOiBmdW5jdGlvbiAoc3RyLCB0YWdzKSB7XHJcbiAgICAgICAgICAgIHZhciBvdXQgPSBzdHI7XHJcbiAgICAgICAgICAgIGlmICghdGFncykge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkLmVhY2godGFncywgZnVuY3Rpb24gKGtleSwgdmFsdWUpIHtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdmdW5jdGlvbicpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YWx1ZSA9IHZhbHVlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBvdXQuc3BsaXQoa2V5KS5qb2luKHZhbHVlKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHJldHVybiBvdXQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBjbGVhbk1lbW9yeTogZnVuY3Rpb24gKCR0aHVtYikge1xyXG4gICAgICAgICAgICB2YXIgZGF0YSA9ICR0aHVtYi5pcygnaW1nJykgPyAkdGh1bWIuYXR0cignc3JjJykgOiAkdGh1bWIuZmluZCgnc291cmNlJykuYXR0cignc3JjJyk7XHJcbiAgICAgICAgICAgICRoLnJldm9rZU9iamVjdFVSTChkYXRhKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGZpbmRGaWxlTmFtZTogZnVuY3Rpb24gKGZpbGVQYXRoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZXBJbmRleCA9IGZpbGVQYXRoLmxhc3RJbmRleE9mKCcvJyk7XHJcbiAgICAgICAgICAgIGlmIChzZXBJbmRleCA9PT0gLTEpIHtcclxuICAgICAgICAgICAgICAgIHNlcEluZGV4ID0gZmlsZVBhdGgubGFzdEluZGV4T2YoJ1xcXFwnKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gZmlsZVBhdGguc3BsaXQoZmlsZVBhdGguc3Vic3RyaW5nKHNlcEluZGV4LCBzZXBJbmRleCArIDEpKS5wb3AoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGNoZWNrRnVsbFNjcmVlbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBKU1VucmVzb2x2ZWRWYXJpYWJsZVxyXG4gICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuZnVsbHNjcmVlbkVsZW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gICAgICAgICAgIGRlLm1zUmVxdWVzdEZ1bGxzY3JlZW4oKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGUubW96UmVxdWVzdEZ1bGxTY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlLm1velJlcXVlc3RGdWxsU2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGUud2Via2l0UmVxdWVzdEZ1bGxzY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZS53ZWJraXRSZXF1ZXN0RnVsbHNjcmVlbihFbGVtZW50LkFMTE9XX0tFWUJPQVJEX0lOUFVUKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIGRvY3VtZW50LmV4aXRGdWxsc2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC5tc0V4aXRGdWxsc2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC5tb3pDYW5jZWxGdWxsU2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC53ZWJraXRFeGl0RnVsbHNjcmVlbiAqL1xyXG4gICAgICAgICAgICAgICAgaWYgKGRvYy5leGl0RnVsbHNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGRvYy5leGl0RnVsbHNjcmVlbigpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLm1zRXhpdEZ1bGxzY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZG9jLm1zRXhpdEZ1bGxzY3JlZW4oKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLm1vekNhbmNlbEZ1bGxTY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvYy5tb3pDYW5jZWxGdWxsU2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLndlYmtpdEV4aXRGdWxsc2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jLndlYmtpdEV4aXRGdWxsc2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIG1vdmVBcnJheTogZnVuY3Rpb24gKGFyciwgb2xkSW5kZXgsIG5ld0luZGV4LCByZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgdmFyIG5ld0FyciA9ICQuZXh0ZW5kKHRydWUsIFtdLCBhcnIpO1xyXG4gICAgICAgICAgICBpZiAocmV2ZXJzZU9yZGVyKSB7XHJcbiAgICAgICAgICAgICAgICBuZXdBcnIucmV2ZXJzZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChuZXdJbmRleCA+PSBuZXdBcnIubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgayA9IG5ld0luZGV4IC0gbmV3QXJyLmxlbmd0aDtcclxuICAgICAgICAgICAgICAgIHdoaWxlICgoay0tKSArIDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBuZXdBcnIucHVzaCh1bmRlZmluZWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG5ld0Fyci5zcGxpY2UobmV3SW5kZXgsIDAsIG5ld0Fyci5zcGxpY2Uob2xkSW5kZXgsIDEpWzBdKTtcclxuICAgICAgICAgICAgaWYgKHJldmVyc2VPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgbmV3QXJyLnJldmVyc2UoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gbmV3QXJyO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYW5ab29tQ2FjaGU6IGZ1bmN0aW9uICgkZWwpIHtcclxuICAgICAgICAgICAgdmFyICRjYWNoZSA9ICRlbC5jbG9zZXN0KCcua3Ytem9vbS1jYWNoZS10aGVtZScpO1xyXG4gICAgICAgICAgICBpZiAoISRjYWNoZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRjYWNoZSA9ICRlbC5jbG9zZXN0KCcua3Ytem9vbS1jYWNoZScpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRjYWNoZS5yZW1vdmUoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGNsb3NlQnV0dG9uOiBmdW5jdGlvbiAoY3NzKSB7XHJcbiAgICAgICAgICAgIGNzcyA9IGNzcyA/ICdjbG9zZSAnICsgY3NzIDogJ2Nsb3NlJztcclxuICAgICAgICAgICAgcmV0dXJuICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cIicgKyBjc3MgKyAnXCIgYXJpYS1sYWJlbD1cIkNsb3NlXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICA8c3BhbiBhcmlhLWhpZGRlbj1cInRydWVcIj4mdGltZXM7PC9zcGFuPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzwvYnV0dG9uPic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBnZXRSb3RhdGlvbjogZnVuY3Rpb24gKHZhbHVlKSB7XHJcbiAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgMjpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3JvdGF0ZVkoMTgwZGVnKSc7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDM6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdyb3RhdGUoMTgwZGVnKSc7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdyb3RhdGUoMTgwZGVnKSByb3RhdGVZKDE4MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA1OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDI3MGRlZykgcm90YXRlWSgxODBkZWcpJztcclxuICAgICAgICAgICAgICAgIGNhc2UgNjpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3JvdGF0ZSg5MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA3OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDkwZGVnKSByb3RhdGVZKDE4MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA4OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDI3MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIHNldFRyYW5zZm9ybTogZnVuY3Rpb24gKGVsLCB2YWwpIHtcclxuICAgICAgICAgICAgaWYgKCFlbCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsLnN0eWxlLnRyYW5zZm9ybSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGUud2Via2l0VHJhbnNmb3JtID0gdmFsO1xyXG4gICAgICAgICAgICBlbC5zdHlsZVsnLW1vei10cmFuc2Zvcm0nXSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGVbJy1tcy10cmFuc2Zvcm0nXSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGVbJy1vLXRyYW5zZm9ybSddID0gdmFsO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgc2V0SW1hZ2VPcmllbnRhdGlvbjogZnVuY3Rpb24gKCRpbWcsICR6b29tSW1nLCB2YWx1ZSkge1xyXG4gICAgICAgICAgICBpZiAoISRpbWcgfHwgISRpbWcubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGV2ID0gJ2xvYWQuZmlsZWlucHV0aW1hZ2VvcmllbnQnO1xyXG4gICAgICAgICAgICAkaW1nLm9mZihldikub24oZXYsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciBpbWcgPSAkaW1nLmdldCgwKSwgem9vbUltZyA9ICR6b29tSW1nICYmICR6b29tSW1nLmxlbmd0aCA/ICR6b29tSW1nLmdldCgwKSA6IG51bGwsXHJcbiAgICAgICAgICAgICAgICAgICAgaCA9IGltZy5vZmZzZXRIZWlnaHQsIHcgPSBpbWcub2Zmc2V0V2lkdGgsIHIgPSAkaC5nZXRSb3RhdGlvbih2YWx1ZSk7XHJcbiAgICAgICAgICAgICAgICAkaW1nLmRhdGEoJ29yaWVudGF0aW9uJywgdmFsdWUpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHpvb21JbWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAkem9vbUltZy5kYXRhKCdvcmllbnRhdGlvbicsIHZhbHVlKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA8IDUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkaC5zZXRUcmFuc2Zvcm0oaW1nLCByKTtcclxuICAgICAgICAgICAgICAgICAgICAkaC5zZXRUcmFuc2Zvcm0oem9vbUltZywgcik7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdmFyIG9mZnNldEFuZ2xlID0gTWF0aC5hdGFuKHcgLyBoKSwgb3JpZ0ZhY3RvciA9IE1hdGguc3FydChNYXRoLnBvdyhoLCAyKSArIE1hdGgucG93KHcsIDIpKSxcclxuICAgICAgICAgICAgICAgICAgICBzY2FsZSA9ICFvcmlnRmFjdG9yID8gMSA6IChoIC8gTWF0aC5jb3MoTWF0aC5QSSAvIDIgKyBvZmZzZXRBbmdsZSkpIC8gb3JpZ0ZhY3RvcixcclxuICAgICAgICAgICAgICAgICAgICBzID0gJyBzY2FsZSgnICsgTWF0aC5hYnMoc2NhbGUpICsgJyknO1xyXG4gICAgICAgICAgICAgICAgJGguc2V0VHJhbnNmb3JtKGltZywgciArIHMpO1xyXG4gICAgICAgICAgICAgICAgJGguc2V0VHJhbnNmb3JtKHpvb21JbWcsIHIgKyBzKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfVxyXG4gICAgfTtcclxuICAgIEZpbGVJbnB1dCA9IGZ1bmN0aW9uIChlbGVtZW50LCBvcHRpb25zKSB7XHJcbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgIHNlbGYuJGVsZW1lbnQgPSAkKGVsZW1lbnQpO1xyXG4gICAgICAgIHNlbGYuJHBhcmVudCA9IHNlbGYuJGVsZW1lbnQucGFyZW50KCk7XHJcbiAgICAgICAgaWYgKCFzZWxmLl92YWxpZGF0ZSgpKSB7XHJcbiAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICB9XHJcbiAgICAgICAgc2VsZi5pc1ByZXZpZXdhYmxlID0gJGguaGFzRmlsZUFQSVN1cHBvcnQoKTtcclxuICAgICAgICBzZWxmLmlzSUU5ID0gJGguaXNJRSg5KTtcclxuICAgICAgICBzZWxmLmlzSUUxMCA9ICRoLmlzSUUoMTApO1xyXG4gICAgICAgIGlmIChzZWxmLmlzUHJldmlld2FibGUgfHwgc2VsZi5pc0lFOSkge1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0KG9wdGlvbnMpO1xyXG4gICAgICAgICAgICBzZWxmLl9saXN0ZW4oKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgc2VsZi4kZWxlbWVudC5yZW1vdmVDbGFzcygnZmlsZS1sb2FkaW5nJyk7XHJcbiAgICB9O1xyXG4gICAgLy9ub2luc3BlY3Rpb24gSlNVbnVzZWRHbG9iYWxTeW1ib2xzXHJcbiAgICBGaWxlSW5wdXQucHJvdG90eXBlID0ge1xyXG4gICAgICAgIGNvbnN0cnVjdG9yOiBGaWxlSW5wdXQsXHJcbiAgICAgICAgX2NsZWFudXA6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBzZWxmLnJlYWRlciA9IG51bGw7XHJcbiAgICAgICAgICAgIHNlbGYuZm9ybWRhdGEgPSB7fTtcclxuICAgICAgICAgICAgc2VsZi51cGxvYWRDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkU3RhdHVzID0ge307XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkTG9nID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQXN5bmNDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudG90YWxJbWFnZXNDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheFJlcXVlc3RzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVCYXRjaENvbXBsZXRlZCA9IHRydWU7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5pc1ByZXZpZXdhYmxlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnNob3dQcmV2aWV3ID0gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5pc0Vycm9yID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgc2VsZi5jYW5jZWxsaW5nID0gZmFsc2U7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdDogZnVuY3Rpb24gKG9wdGlvbnMsIHJlZnJlc2hNb2RlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZiwgJGVsID0gc2VsZi4kZWxlbWVudCwgJGNvbnQsIHQsIHRtcDtcclxuICAgICAgICAgICAgc2VsZi5vcHRpb25zID0gb3B0aW9ucztcclxuICAgICAgICAgICAgJC5lYWNoKG9wdGlvbnMsIGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7XHJcbiAgICAgICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21pbkZpbGVDb3VudCc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWF4RmlsZUNvdW50JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtaW5GaWxlU2l6ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWF4RmlsZVNpemUnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21heEZpbGVQcmV2aWV3U2l6ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAncmVzaXplSW1hZ2VRdWFsaXR5JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdyZXNpemVJZlNpemVNb3JlVGhhbic6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAncHJvZ3Jlc3NVcGxvYWRUaHJlc2hvbGQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2luaXRpYWxQcmV2aWV3Q291bnQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3pvb21Nb2RhbEhlaWdodCc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWluSW1hZ2VIZWlnaHQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21heEltYWdlSGVpZ2h0JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtaW5JbWFnZVdpZHRoJzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtYXhJbWFnZVdpZHRoJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZltrZXldID0gJGguZ2V0TnVtKHZhbHVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZltrZXldID0gdmFsdWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgaWYgKHNlbGYucnRsKSB7IC8vIHN3YXAgYnV0dG9ucyBmb3IgcnRsXHJcbiAgICAgICAgICAgICAgICB0bXAgPSBzZWxmLnByZXZpZXdab29tQnV0dG9uSWNvbnMucHJldjtcclxuICAgICAgICAgICAgICAgIHNlbGYucHJldmlld1pvb21CdXR0b25JY29ucy5wcmV2ID0gc2VsZi5wcmV2aWV3Wm9vbUJ1dHRvbkljb25zLm5leHQ7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdab29tQnV0dG9uSWNvbnMubmV4dCA9IHRtcD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IHNlbGYuX2dldFByZXZpZXdUZW1wbGF0ZSgnZ2VuZXJpYycpO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaW1hZ2VDYW52YXMgJiYgc2VsZi5yZXNpemVJbWFnZSAmJiAoc2VsZi5tYXhJbWFnZVdpZHRoIHx8IHNlbGYubWF4SW1hZ2VIZWlnaHQpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmltYWdlQ2FudmFzID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnY2FudmFzJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmltYWdlQ2FudmFzQ29udGV4dCA9IHNlbGYuaW1hZ2VDYW52YXMuZ2V0Q29udGV4dCgnMmQnKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoJGguaXNFbXB0eSgkZWwuYXR0cignaWQnKSkpIHtcclxuICAgICAgICAgICAgICAgICRlbC5hdHRyKCdpZCcsICRoLnVuaXFJZCgpKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLm5hbWVzcGFjZSA9ICcuZmlsZWlucHV0XycgKyAkZWwuYXR0cignaWQnKS5yZXBsYWNlKC8tL2csICdfJyk7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLiRjb250YWluZXIgPT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyID0gc2VsZi5fY3JlYXRlQ29udGFpbmVyKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yZWZyZXNoQ29udGFpbmVyKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGNvbnQgPSBzZWxmLiRjb250YWluZXI7XHJcbiAgICAgICAgICAgIHNlbGYuJGRyb3Bab25lID0gJGNvbnQuZmluZCgnLmZpbGUtZHJvcC16b25lJyk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByb2dyZXNzID0gJGNv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Y29udC5maW5kKCcuZmlsZS1wcmV2aWV3LXRodW1ibmFpbHMnKSk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByZXZpZXdTdGF0dXMgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbFByZXZpZXdTdGF0dXMnLCAkY29udC5maW5kKCcuZmlsZS1wcmV2aWV3LXN0YXR1cycpKTtcclxuICAgICAgICAgICAgc2VsZi4kZXJyb3JDb250YWluZXIgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbEVycm9yQ29udGFpbmVyJyxcclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXdDb250YWluZXIuZmluZCgnLmt2LWZpbGVpbnB1dC1lcnJvcicpKTtcclxuICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEaXNhYmxlZCgpO1xyXG4gICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoc2VsZi5tc2dFcnJvckNsYXNzKSkge1xyXG4gICAgICAgICAgICAgICAgJGguYWRkQ3NzKHNlbGYuJGVycm9yQ29udGFpbmVyLCBzZWxmLm1zZ0Vycm9yQ2xhc3MpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghcmVmcmVzaE1vZGUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGVycm9yQ29udGFpbmVyLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0luaXRJZCA9ICdwcmV2aWV3LScgKyAkaC51bmlxSWQoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3Q2FjaGUoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi4kcGFyZW50Lmhhc0NsYXNzKCdmaWxlLWxvYWRpbmcnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5pbnNlcnRCZWZvcmUoc2VsZi4kcGFyZW50KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRwYXJlbnQucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuX2Vycm9yc0V4aXN0KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fc2V0RmlsZURyb3Bab25lVGl0bGUoKTtcclxuICAgICAgICAgICAgaWYgKCRlbC5hdHRyKCdkaXNhYmxlZCcpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmRpc2FibGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9pbml0Wm9vbSgpO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5oaWRlVGh1bWJuYWlsQ29udGVudCkge1xyXG4gICAgICAgICAgICAgICAgJGguYWRkQ3NzKHNlbGYuJHByZXZpZXcsICdoaWRlLWNvbnRlbnQnKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRUZW1wbGF0ZURlZmF1bHRzOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdE1haW4xLCB0TWFpbjIsIHRQcmV2aWV3LCB0RmlsZUljb24sIHRDbG9zZSwgdENhcHRpb24sIHRCdG5EZWZhdWx0LCB0QnRuTGluaywgdEJ0bkJyb3dzZSxcclxuICAgICAgICAgICAgICAgIHRNb2RhbE1haW4sIHRNb2RhbCwgdFByb2dyZXNzLCB0U2l6ZSwgdEZvb3RlciwgdEFjdGlvbnMsIHRBY3Rpb25EZWxldGUsIHRBY3Rpb25VcGxvYWQsIHRBY3Rpb25Eb3dubG9hZCxcclxuICAgICAgICAgICAgICAgIHRBY3Rpb25ab29tLCB0QWN0aW9uRHJhZywgdEluZGljYXRvciwgdFRhZ0JlZiwgdFRhZ0JlZjEsIHRUYWdCZWYyLCB0VGFnQWZ0LCB0R2VuZXJpYywgdEh0bWwsIHRJbWFnZSxcclxuICAgICAgICAgICAgICAgIHRUZXh0LCB0T2ZmaWNlLCB0R2RvY3MsIHRWaWRlbywgdEF1ZGlvLCB0Rmxhc2gsIHRPYmplY3QsIHRQZGYsIHRPdGhlciwgdFN0eWxlLCB0Wm9vbUNhY2hlLCB2RGVmYXVsdERpbTtcclxuICAgICAgICAgICAgdE1haW4xID0gJ3twcmV2aWV3fVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJrdi11cGxvYWQtcHJvZ3Jlc3Mga3YtaGlkZGVuXCI+PC9kaXY+PGRpdiBjbGFzcz1cImNsZWFyZml4XCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPGRpdiBjbGFzcz1cImlucHV0LWdyb3VwIHtjbGFzc31cIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgIHtjYXB0aW9ufVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJpbnB1dC1ncm91cC1idG4gaW5wdXQtZ3JvdXAtYXBwZW5kXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAge3JlbW92ZX1cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICB7Y2FuY2VsfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIHt1cGxvYWR9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAge2Jyb3dzZX1cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgICAgICAgdE1haW4yID0gJ3twcmV2aWV3fVxcbjxkaXYgY2xhc3M9XCJrdi11cGxvYWQtcHJvZ3Jlc3Mga3YtaGlkZGVuXCI+PC9kaXY+XFxuPGRpdiBjbGFzcz1cImNsZWFyZml4XCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAne3JlbW92ZX1cXG57Y2FuY2VsfVxcbnt1cGxvYWR9XFxue2Jyb3dzZX1cXG4nO1xyXG4gICAgICAgICAgICB0UHJldmlldyA9ICc8ZGl2IGNsYXNzPVwiZmlsZS1wcmV2aWV3IHtjbGFzc31cIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAge2Nsb3NlfScgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwie2Ryb3BDbGFzc31cIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtcHJldmlldy10aHVtYm5haWxzXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwiY2xlYXJmaXhcIj48L2Rpdj4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtcHJldmlldy1zdGF0dXMgdGV4dC1jZW50ZXIgdGV4dC1zdWNjZXNzXCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDxkaXYgY2xhc3M9XCJrdi1maWxlaW5wdXQtZXJyb3JcIj48L2Rpdj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgICAgICAgdENsb3NlID0gJGguY2xvc2VCdXR0b24oJ2ZpbGVpbnB1dC1yZW1vdmUnKTtcclxuICAgICAgICAgICAgdEZpbGVJY29uID0gJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGd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XNzPVwibW9kYWwtYm9keVwiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIDxkaXYgY2xhc3M9XCJmbG9hdGluZy1idXR0b25zXCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgPGRpdiBjbGFzcz1cImt2LXpvb20tYm9keSBmaWxlLXpvb20tY29udGVudCB7em9vbUZyYW1lQ2xhc3N9XCI+PC9kaXY+XFxuJyArICd7cHJldn0ge25leHR9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+XFxuJztcclxuICAgICAgICAgICAgdFByb2dyZXNzID0gJzxkaXYgY2xhc3M9XCJwcm9ncmVzc1wiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwie2NsYXNzfVwiIHJvbGU9XCJwcm9ncmVzc2JhclwiJyArXHJcbiAgICAgICAgICAgICAgICAnIGFyaWEtdmFsdWVub3c9XCJ7cGVyY2VudH1cIiBhcmlhLXZhbHVlbWluPVwiMFwiIGFyaWEtdmFsdWVtYXg9XCIxMDBcIiBzdHlsZT1cIndpZHRoOntwZXJjZW50fSU7XCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgICB7c3RhdHVzfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgICAgICAgdFNpemUgPSAnIDxzYW1wPih7c2l6ZVRleHR9KTwvc2FtcD4nO1xyXG4gICAgICAgICAgICB0Rm9vdGVyID0gJzxkaXYgY2xhc3M9XCJmaWxlLXRodW1ibmFpbC1mb290ZXJcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtZm9vdGVyLWNhcHRpb25cIiB0aXRsZT1cIntjYXB0aW9ufVwiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgICAgPGRpdiBjbGFzcz1cImZpbGUtY2FwdGlvbi1pbmZvXCI+e2NhcHRpb259PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgICA8ZGl2IGNsYXNzPVwiZmlsZS1zaXplLWluZm9cIj57c2l6ZX08L2Rpdj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIHtwcm9ncmVzc31cXG57aW5kaWNhdG9yfVxcbnthY3Rpb25zfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzwvZGl2Pic7XHJcbiAgICAgICAgICAgIHRBY3Rpb25zID0gJzxkaXYgY2xhc3M9XCJmaWxlLWFjdGlvbnNcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtZm9vdGVyLWJ1dHRvbnNcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICAgIHtkb3dubG9hZH0ge3VwbG9hZH0ge2RlbGV0ZX0ge3pvb219IHtvdGhlcn0nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAne2RyYWd9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPGRpdiBjbGFzcz1cImNsZWFyZml4XCI+PC9kaXY+JztcclxuICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSHRtbFVua25vd25BdHRyaWJ1dGVcclxuICAgICAgICAgICAgdEFjdGlvbkRlbGV0ZSA9ICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cImt2LWZpbGUtcmVtb3ZlIHtyZW1vdmVDbGFzc31cIiAnICtcclxuICAgICAgICAgICAgICAgICd0aXRs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VUxUX1BSRVZJRVcgKyAnXFxuPC9kaXY+XFxuJztcclxuICAgICAgICAgICAgdFpvb21DYWNoZSA9ICc8ZGl2IGNsYXNzPVwia3Ytem9vbS1jYWNoZVwiIHN0eWxlPVwiZGlzcGxheTpub25lXCI+e3pvb21Db250ZW50fTwvZGl2Pic7XHJcbiAgICAgICAgICAgIHZEZWZhdWx0RGltID0ge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9O1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5faXNQZGZSZW5kZXJlZCgpKSB7XHJcbiAgICAgICAgICAgICAgICB0UGRmID0gc2VsZi5wZGZSZW5kZXJlclRlbXBsYXRlLnJlcGxhY2UoJ3tyZW5kZXJlcn0nLCBzZWxmLl9lbmNvZGVVUkkoc2VsZi5wZGZSZW5kZXJlclVybCkpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuZGVmYXVsdHMgPSB7XHJcbiAgICAgICAgICAgICAgICBsYXlvdXRUZW1wbGF0ZXM6IHtcclxuICAgICAgICAgICAgICAgICAgICBtYWluMTogdE1haW4xLFxyXG4gICAgICAgICAgICAgICAgICAgIG1haW4yOiB0TWFpbjIsXHJcbiAgICAgICAgICAgICAgICAgICAgcHJldmlldzogdFByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAgICAgY2xvc2U6IHRDbG9zZSxcclxuICAgICAgICAgICAgICAgICAgICBmaWxlSWNvbjogdEZpbGVJY29uLFxyXG4gICAgICAgICAgICAgICAgICAgIGNhcHRpb246IHRDYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgIG1vZGFsTWFpbjogdE1vZGFsTWFpbixcclxuICAgICAgICAgICAgICAgICAgICBtb2RhbDogdE1vZGFsLFxyXG4gICAgICAgICAgICAgICAgICAgIHByb2dyZXNzOiB0UHJvZ3Jlc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgc2l6ZTogdFNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgZm9vdGVyOiB0Rm9vdGVyLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvcjogdEluZGljYXRvcixcclxuICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiB0QWN0aW9ucyxcclxuICAgICAgICAgICAgICAgICAgICBhY3Rpb25EZWxldGU6IHRBY3Rpb25EZWxldGUsXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uVXBsb2FkOiB0QWN0aW9uVXBsb2FkLFxyXG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbkRvd25sb2FkOiB0QWN0aW9uRG93bmxvYWQsXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uWm9vbTogdEFjdGlvblpvb20sXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uRHJhZzogdEFjdGlvbkRyYWcsXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuRGVmYXVsdDogdEJ0bkRlZmF1bHQsXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuTGluazogdEJ0bkxpbmssXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuQnJvd3NlOiB0QnRuQnJvd3NlLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21DYWNoZTogdFpvb21DYWNoZVxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHByZXZpZXdNYXJrdXBUYWdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQmVmb3JlMTogdFRhZ0JlZjEsXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQmVmb3JlMjogdFRhZ0JlZjIsXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQWZ0ZXI6IHRUYWdBZnRcclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3Q29udGVudFRlbXBsYXRlczoge1xyXG4gICAgICAgICAgICAgICAgICAgIGdlbmVyaWM6IHRHZW5lcmljLFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IHRIdG1sLFxyXG4gICAgICAgICAgICAgICAgICAgIGltYWdlOiB0SW1hZ2UsXHJcbiAgICAgICAgICAgICAgICAgICAgdGV4dDogdFRleHQsXHJcbiAgICAgICAgICAgICAgICAgICAgb2ZmaWNlOiB0T2ZmaWNlLFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB0R2RvY3MsXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IHRWaWRlbyxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzogdEF1ZGlvLFxyXG4gICAgICAgICAgICAgICAgICAgIGZsYXNoOiB0Rmxhc2gsXHJcbiAgICAgICAgICAgICAgICAgICAgb2JqZWN0OiB0T2JqZWN0LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogdFBkZixcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjogdE90aGVyXHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgYWxsb3dlZFByZXZpZXdUeXBlczogWydpbWFnZScsICdodG1sJywgJ3RleHQnLCAndmlkZW8nLCAnYXVkaW8nLCAnZmxhc2gnLCAncGRmJywgJ29iamVjdCddLFxyXG4gICAgICAgICAgICAgICAgcHJldmlld1RlbXBsYXRlczoge30sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3U2V0dGluZ3M6IHtcclxuICAgICAgICAgICAgICAgICAgICBpbWFnZToge3dpZHRoOiAnYXV0bycsIGhlaWdodDogJ2F1dG8nLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWF4LWhlaWdodCc6ICcxMDAlJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgaHRtbDoge3dpZHRoOiAnMjEzcHgnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBnZG9jczoge3dpZHRoOiAnMjEzcHgnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHZpZGVvOiB7d2lkdGg6ICcyMTNweCcsIGhlaWdodDogJzE2MHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgYXVkaW86IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICczMHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgZmxhc2g6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBwZGY6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIG90aGVyOiB7d2lkdGg6ICcyMTNweCcsIGhlaWdodDogJzE2MHB4J31cclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3U2V0dGluZ3NTbWFsbDoge1xyXG4gICAgICAgICAgICAgICAgICAgIGltYWdlOiB7d2lkdGg6ICdhdXRvJywgaGVpZ2h0OiAnYXV0bycsICdtYXgtd2lkdGgnOiAnMTAwJScsICdtYXgtaGVpZ2h0JzogJzEwMCUnfSxcclxuICAgICAgICAgICAgICAgICAgICBodG1sOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICB0ZXh0OiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICB2aWRlbzoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJ2F1dG8nfSxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzMwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBmbGFzaDoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJ2F1dG8nfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICdhdXRvJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgcGRmOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzE2MHB4J31cclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3Wm9vbVNldHRpbmdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICdhdXRvJywgJ21heC13aWR0aCc6ICcxMDAlJywgJ21heC1oZWlnaHQnOiAnMTAwJSd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IHZEZWZhdWx0RGltLFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IHZEZWZhdWx0RGltLFxyXG4gICAgICAgICAgICAgICAgICAgIG9mZmljZToge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzEwMCUnLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTAwJScsICdtYXgtd2lkdGgnOiAnMTAwJScsICdtaW4taGVpZ2h0JzogJzQ4MHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICcxMDAlJywgJ21heC13aWR0aCc6ICcxMDAlJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgYXVkaW86IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICczMHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgZmxhc2g6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIG9iamVjdDoge3dpZHRoOiAnYXV0bycsIGhlaWdodDogJzEwMCUnLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogdkRlZmF1bHREaW0sXHJcbiAgICAgICAgICAgICAgICAgICAgb3RoZXI6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICcxMDAlJywgJ21pbi1oZWlnaHQnOiAnNDgwcHgnfVxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIG1pbWVUeXBlQWxpYXNlczoge1xyXG4gICAgICAgICAgICAgICAgICAgICd2aWRlby9xdWlja3RpbWUnOiAndmlkZW8vbXA0J1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIGZpbGVUeXBlU2V0dGluZ3M6IHtcclxuICAgICAgICAgICAgICAgICAgICBpbWFnZTogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCRoLmNvbXBhcmUodlR5cGUsICdpbWFnZS4qJykgJiYgISRoLmNvbXBhcmUodlR5cGUsIC8odGlmZj98d21mKSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4oZ2lmfHBuZ3xqcGU/ZykkL2kpKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd0ZXh0L2h0bWwnKSB8fCAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKGh0bXxodG1sKSQvaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsIC8od29yZHxleGNlbHxwb3dlcnBvaW50fG9mZmljZSkkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKGRvY3g/fHhsc3g/fHBwdHg/fHBwc3xwb3R4PykkL2kpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgZ2RvY3M6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsIC8od29yZHxleGNlbHxwb3dlcnBvaW50fG9mZmljZXxpd29yay1wYWdlc3x0aWZmPykkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9cXC4oZG9jeD98eGxzeD98cHB0eD98cHBzfHBvdHg/fHJ0ZnxvZHN8b2R0fHBhZ2VzfGFpfGR4Znx0dGZ8dGlmZj98d21mfGU/cHMpJC9pKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd0ZXh0LionKSB8fCAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKHhtbHxqYXZhc2NyaXB0KSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4odHh0fG1kfGNzdnxuZm98aW5pfGpzb258cGhwfGpzfGNzcykkL2kpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd2aWRlby4qJykgJiYgKCRoLmNvbXBhcmUodlR5cGUsIC8ob2dnfG1wNHxtcD9nfG1vdnx3ZWJtfDNncCkkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKG9nP3xtcDR8d2VibXxtcD9nfG1vdnwzZ3ApJC9pKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGguY29tcGFyZSh2VHlwZSwgJ2F1ZGlvLionKSAmJiAoJGguY29tcGFyZSh2TmFtZSwgLyhvZ2d8bXAzfG1wP2d8d2F2KSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4ob2c/fG1wM3xtcD9nfHdhdikkL2kpKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIGZsYXNoOiBmdW5jdGlvbiAodlR5cGUsIHZOYW1lKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkaC5jb21wYXJlKHZUeXBlLCAnYXBwbGljYXRpb24veC1zaG9ja3dhdmUtZmxhc2gnLCB0cnVlKSB8fCAkaC5jb21wYXJlKHZOYW1lLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgL1xcLihzd2YpJC9pKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGguY29tcGFyZSh2VHlwZSwgJ2FwcGxpY2F0aW9uL3BkZicsIHRydWUpIHx8ICRoLmNvbXBhcmUodk5hbWUsIC9cXC4ocGRmKSQvaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZmlsZUFjdGlvblNldHRpbmdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2hvd1JlbW92ZTogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93VXBsb2FkOiB0cnVlLFxyXG4gICAgICAgICAgICAgICAgICAgIHNob3dEb3dubG9hZDogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93Wm9vbTogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93RHJhZzogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICByZW1vdmVJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXRyYXNoXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgcmVtb3ZlQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGVmYXVsdCBidG4tb3V0bGluZS1zZWNvbmRhcnknLFxyXG4gICAgICAgICAgICAgICAgICAgIHJlbW92ZUVycm9yQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGFuZ2VyJyxcclxuICAgICAgICAgICAgICAgICAgICByZW1vdmVUaXRsZTogJ1JlbW92ZSBmaWxlJyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXVwbG9hZFwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIHVwbG9hZENsYXNzOiAnYnRuIGJ0bi1zbSBidG4ta3YgYnRuLWRlZmF1bHQgYnRuLW91dGxpbmUtc2Vjb25kYXJ5JyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRUaXRsZTogJ1VwbG9hZCBmaWxlJyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRSZXRyeUljb246ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tcmVwZWF0XCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgdXBsb2FkUmV0cnlUaXRsZTogJ1JldHJ5IHVwbG9hZCcsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLWRvd25sb2FkXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRDbGFzczogJ2J0biBidG4tc20gYnRuLWt2IGJ0bi1kZWZhdWx0IGJ0bi1vdXRsaW5lLXNlY29uZGFyeScsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRUaXRsZTogJ0Rvd25sb2FkIGZpbGUnLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21JY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXpvb20taW5cIj48L2k+JyxcclxuICAgICAgICAgICAgICAgICAgICB6b29tQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGVmYXVsdCBidG4tb3V0bGluZS1zZWNvbmRhcnknLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21UaXRsZTogJ1ZpZXcgRGV0YWlscycsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ0ljb246ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tbW92ZVwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGRyYWdDbGFzczogJ3RleHQtaW5mbycsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ1RpdGxlOiAnTW92ZSAvIFJlYXJyYW5nZScsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ1NldHRpbmdzOiB7fSxcclxuICAgICAgICAgICAgICAgICAgICBpbmRpY2F0b3JOZXc6ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tcGx1cy1zaWduIHRleHQtd2FybmluZ1wiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvclN1Y2Nlc3M6ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tb2stc2lnbiB0ZXh0LXN1Y2Nlc3NcIj48L2k+JyxcclxuICAgICAgICAgICAgICAgICAgICBpbmRpY2F0b3JFcnJvcjogJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGdseXBoaWNvbi1leGNsYW1hdGlvbi1zaWduIHRleHQtZGFuZ2VyXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgaW5kaWNhdG9yTG9hZGluZzogJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGdseXBoaWNvbi1ob3VyZ2xhc3MgdGV4dC1tdXRlZFwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvck5ld1RpdGxlOiAnTm90IHVwbG9hZGVkIHlldCcsXHJcbiAgICAgICAgICAgICAgICAgICAgaW5kaWNhdG9yU3VjY2Vzc1RpdGxlOiAnVXBsb2FkZWQnLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvckVycm9yVGl0bGU6ICdVcGxvYWQgRXJyb3InLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvckxvYWRpbmdUaXRsZTogJ1VwbG9hZGluZyAuLi4nXHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICQuZWFjaChzZWxmLmRlZmF1bHRzLCBmdW5jdGlvbiAoa2V5LCBzZXR0aW5nKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSAnYWxsb3dlZFByZXZpZXdUeXBlcycpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzID0gc2V0dGluZztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZltrZXldID0gJC5leHRlbmQodHJ1ZSwge30sIHNldHRpbmcsIHNlbGZba2V5XSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0UHJldmlld1RlbXBsYXRlcygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3VGVtcGxhdGVzOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdGFncyA9IHNlbGYucHJldmlld01hcmt1cFRhZ3MsIHRhZ0JlZiwgdGFnQWZ0ID0gdGFncy50YWdBZnRlcjtcclxuICAgICAgICAgICAgJC5lYWNoKHNlbGYucHJldmlld0NvbnRlbnRUZW1wbGF0ZXMsIGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShzZWxmLnByZXZpZXdUZW1wbGF0ZXNba2V5XSkpIHtcclxuICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdzLnRhZ0JlZm9yZTI7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleSA9PT0gJ2dlbmVyaWMnIHx8IGtleSA9PT0gJ2ltYWdlJyB8fCBrZXkgPT09ICdodG1sJyB8fCBrZXkgPT09ICd0ZXh0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdzLnRhZ0JlZm9yZTE7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLl9pc1BkZlJlbmRlcmVkKCkgJiYga2V5ID09PSAncGRmJykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdCZWYucmVwbGFjZSgna3YtZmlsZS1jb250ZW50JywgJ2t2LWZpbGUtY29udGVudCBrdi1wZGYtcmVuZGVyZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3VGVtcGxhdGVzW2tleV0gPSB0YWdCZWYgKyB2YWx1ZSArIHRhZ0FmdDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFByZXZpZXdDYWNoZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlID0ge1xyXG4gICAgICAgICAgICAgICAgZGF0YToge30sXHJcbiAgICAgICAgICAgICAgICBpbml0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNvbnRlbnQgPSBzZWxmLmluaXRpYWxQcmV2aWV3O1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChjb250ZW50Lmxlbmd0aCA+IDAgJiYgISRoLmlzQXJyYXkoY29udGVudCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudCA9IGNvbnRlbnQuc3BsaXQoc2VsZi5pbml0aWFsUHJldmlld0RlbGltaXRlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZzogc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGFnczogc2VsZi5pbml0aWFsUHJldmlld1RodW1iVGFnc1xyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgY291bnQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFzZWxmLnByZXZpZXdDYWNoZS5kYXRhICYmICEhc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50ID9cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50Lmxlbmd0aCA6IDA7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoaSwgaXNEaXNhYmxlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBpbmQgPSAnaW5pdF8nICsgaSwgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmRhdGEsIGNvbmZpZyA9IGRhdGEuY29uZmlnW2ldLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50ID0gZGF0YS5jb250ZW50W2ldLCBwcmV2aWV3SWQgPSBzZWxmLnByZXZpZXdJbml0SWQgKyAnLScgKyBpbmQsIG91dCwgJHRtcCwgY2F0LCBmdHIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZuYW1lLCBmdHlwZSwgZnJhbWVDbGFzcywgYXNEYXRhID0gJGguaWZTZXQoJ3ByZXZpZXdBc0RhdGEnLCBjb25maWcsIHNlbGYuaW5pdGlhbFByZXZpZXdBc0RhdGEpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBhID0gY29uZmlnID8ge3RpdGxlOiBjb25maWcudGl0bGUgfHwgbnVsbCwgYWx0OiBjb25maWcuYWx0IHx8IG51bGx9IDoge3RpdGxlOiBudWxsLCBhbHQ6IG51bGx9LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJzZVRlbXBsYXRlID0gZnVuY3Rpb24gKGNhdCwgZGF0LCBmbiwgZnQsIGlkLCBmdHIsIGluZCwgZmMsIHQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZjID0gJyBmaWxlLXByZXZpZXctaW5pdGlhbCAnICsgJGguU09SVF9DU1MgKyAoZmMgPyAnICcgKyBmYyA6ICcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzZWxmLl9nZW5lcmF0ZVByZXZpZXdUZW1wbGF0ZShjYXQsIGRhdCwgZm4sIGZ0LCBpZCwgZmFsc2UsIG51bGwsIGZjLCBmdHIsIGluZCwgdCwgYSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFjb250ZW50KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaXNEaXNhYmxlZCA9IGlzRGlzYWJsZWQgPT09IHVuZGVmaW5lZCA/IHRydWUgOiBpc0Rpc2FibGVkO1xyXG4gICAgICAgICAgICAgICAgICAgIGNhdCA9ICRoLmlmU2V0KCd0eXBlJywgY29uZmlnLCBzZWxmLmluaXRpYWxQcmV2aWV3RmlsZVR5cGUgfHwgJ2dlbmVyaWMnKTtcclxuICAgICAgICAgICAgICAgICAgICBmbmFtZSA9ICRoLmlmU2V0KCdmaWxlbmFtZScsIGNvbmZpZywgJGguaWZTZXQoJ2NhcHRpb24nLCBjb25maWcpKTtcclxuICAgICAgICAgICAgICAgICAgICBmdHlwZSA9ICRoLmlmU2V0KCdmaWxldHlwZScsIGNvbmZpZywgY2F0KTtcclxuICAgICAgICAgICAgICAgICAgICBmdHIgPSBzZWxmLnByZXZpZXdDYWNoZS5mb290ZXIoaSwgaXNEaXNhYmxlZCwgKGNvbmZpZyAmJiBjb25maWcuc2l6ZSB8fCBudWxsKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgZnJhbWVDbGFzcyA9ICRoLmlmU2V0KCdmcmFtZUNsYXNzJywgY29uZmlnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoYXNEYXRhKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9IHBhcnNlVGVtcGxhdGUoY2F0LCBjb250ZW50LCBmbmFtZSwgZnR5cGUsIHByZXZpZXdJZCwgZnRyLCBpbmQsIGZyYW1lQ2xhc3MpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9IHBhcnNlVGVtcGxhdGUoJ2dlbmVyaWMnLCBjb250ZW50LCBmbmFtZSwgZnR5cGUsIHByZXZpZXdJZCwgZnRyLCBpbmQsIGZyYW1lQ2xhc3MsIGNhdClcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRUb2tlbnMoeydjb250ZW50JzogZGF0YS5jb250ZW50W2ldfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLnRhZ3MubGVuZ3RoICYmIGRhdGEudGFnc1tpXSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSAkaC5yZXBsYWNlVGFncyhvdXQsIGRhdGEudGFnc1tpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIGNvbmZpZy5mcmFtZUF0dHIgKi9cclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoY29uZmlnKSAmJiAhJGguaXNFbXB0eShjb25maWcuZnJhbWVBdHRyKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSkuaHRtbChvdXQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wLmZpbmQoJy5maWxlLXByZXZpZXctaW5pdGlhbCcpLmF0dHIoY29uZmlnLmZyYW1lQXR0cik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9ICR0bXAuaHRtbCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIGFkZDogZnVuY3Rpb24gKGNvbnRlbnQsIGNvbmZpZywgdGFncywgYXBwZW5kKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRhdGEgPSBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLCBpbmRleDtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzQXJyYXkoY29udGVudCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudCA9IGNvbnRlbnQuc3BsaXQoc2VsZi5pbml0aWFsUHJldmlld0RlbGltaXRlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhcHBlbmQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBkYXRhLmNvbnRlbnQucHVzaChjb250ZW50KSAtIDE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnW2luZGV4XSA9IGNvbmZpZztcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS50YWdzW2luZGV4XSA9IHRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBjb250ZW50Lmxlbmd0aCAtIDE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29udGVudCA9IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnID0gY29uZmlnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLnRhZ3MgPSB0YWdzO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhID0gZGF0YTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXg7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoY29udGVudCwgY29uZmlnLCB0YWdzLCBhcHBlbmQpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmRhdGEsIGksIGNoaztcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWNvbnRlbnQgfHwgIWNvbnRlbnQubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCEkaC5pc0FycmF5KGNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQgPSBjb250ZW50LnNwbGl0KHNlbGYuaW5pdGlhbFByZXZpZXdEZWxpbWl0ZXIpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBjaGsgPSBjb250ZW50LmZpbHRlcihmdW5jdGlvbiAobikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAhPT0gbnVsbDtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWNoay5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5jb250ZW50ID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb250ZW50ID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmNvbmZpZyA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLnRhZ3MgPT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLnRhZ3MgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGFwcGVuZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29udGVudC5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRlbnRbaV0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhLmNvbnRlbnQucHVzaChjb250ZW50W2ldKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29uZmlnLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29uZmlnW2ldKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWcucHVzaChjb25maWdbaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCB0YWdzLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGFnc1tpXSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudGFncy5wdXNoKHRhZ3NbaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb250ZW50ID0gY29udGVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWcgPSBjb25maWc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudGFncyA9IHRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSBkYXRhO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHVuc2V0OiBmdW5jdGlvbiAoaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgY2hrID0gc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSwgcmV2ID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghY2hrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNoayA9PT0gMSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLmNvbnRlbnQgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb25maWcgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS50YWdzID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXcgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50ID0gJGguc3BsaWNlQXJyYXkoc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50LCBpbmRleCwgcmV2KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLmNvbmZpZyA9ICRoLnNwbGljZUFycmF5KHNlbGYucHJldmlld0NhY2hlLmRhdGEuY29uZmlnLCBpbmRleCwgcmV2KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLnRhZ3MgPSAkaC5zcGxpY2VBcnJheShzZWxmLnByZXZpZXdDYWNoZS5kYXRhLnRhZ3MsIGluZGV4LCByZXYpO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIG91dDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBodG1sID0gJycsIGNhcHRpb24sIGxlbiA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCksIGksIGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxlbiA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge2NvbnRlbnQ6ICcnLCBjYXB0aW9uOiAnJ307XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50ID0gc2VsZi5wcmV2aWV3Q2FjaGUuZ2V0KGkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBodG1sID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyID8gKGNvbnRlbnQgKyBodG1sKSA6IChodG1sICsgY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNhcHRpb24gPSBzZWxmLl9nZXRNc2dTZWxlY3RlZChsZW4pO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7Y29udGVudDogaHRtbCwgY2FwdGlvbjogY2FwdGlvbn07XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZm9vdGVyOiBmdW5jdGlvbiAoaSwgaXNEaXNhYmxlZCwgc2l6ZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBkYXRhID0gc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YSB8fCB7fTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhLmNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCRoLmlzRW1wdHkoZGF0YS5jb25maWcpIHx8ICRoLmlzRW1wdHkoZGF0YS5jb25maWdbaV0pKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnW2ldID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlzRGlzYWJsZWQgPSBpc0Rpc2FibGVkID09PSB1bmRlZmluZWQgPyB0cnVlIDogaXNEaXNhYmxlZDtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgY29uZmlnID0gZGF0YS5jb25maWdbaV0sIGNhcHRpb24gPSAkaC5pZlNldCgnY2FwdGlvbicsIGNvbmZpZyksIGEsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoID0gJGguaWZTZXQoJ3dpZHRoJywgY29uZmlnLCAnYXV0bycpLCB1cmwgPSAkaC5pZlNldCgndXJsJywgY29uZmlnLCBmYWxzZSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGtleSA9ICRoLmlmU2V0KCdrZXknLCBjb25maWcsIG51bGwpLCBmcyA9IHNlbGYuZmlsZUFjdGlvblNldHRpbmdzLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0UHJldmlld1Nob3dEZWwgPSBzZWxmLmluaXRpYWxQcmV2aWV3U2hvd0RlbGV0ZSB8fCBmYWxzZSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgZFVybCA9IGNvbmZpZy5kb3dubG9hZFVybCB8fCBzZWxmLmluaXRpYWxQcmV2aWV3RG93bmxvYWRVcmwgfHwgJycsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRGaWwgPSBjb25maWcuZmlsZW5hbWUgfHwgY29uZmlnLmNhcHRpb24gfHwgJycsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRQcmV2aWV3U2hvd0R3bCA9ICEhKGRVcmwpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRGVsID0gJGguaWZTZXQoJ3Nob3dSZW1vdmUnLCBjb25maWcsICRoLmlmU2V0KCdzaG93UmVtb3ZlJywgZnMsIGluaXRQcmV2aWV3U2hvd0RlbCkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRHdsID0gJGguaWZTZXQoJ3Nob3dEb3dubG9hZCcsIGNvbmZpZywgJGguaWZTZXQoJ3Nob3dEb3dubG9hZCcsIGZzLCBpbml0UHJldmlld1Nob3dEd2wpKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgc1ptID0gJGguaWZTZXQoJ3Nob3dab29tJywgY29uZmlnLCAkaC5pZlNldCgnc2hvd1pvb20nLCBmcywgdHJ1ZSkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRHJnID0gJGguaWZTZXQoJ3Nob3dEcmFnJywgY29uZmlnLCAkaC5pZlNldCgnc2hvd0RyYWcnLCBmcywgdHJ1ZSkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXMgPSAodXJsID09PSBmYWxzZSkgJiYgaXNEaXNhYmxlZDtcclxuICAgICAgICAgICAgICAgICAgICBzRHdsID0gc0R3bCAmJiBjb25maWcuZG93bmxvYWRVcmwgIT09IGZhbHNlICYmICEhZFVybDtcclxuICAgICAgICAgICAgICAgICAgICBhID0gc2VsZi5fcmVuZGVyRmlsZUFjdGlvbnMoZmFsc2UsIHNEd2wsIHNEZWwsIHNabSwgc0RyZywgZGlzLCB1cmwsIGtleSwgdHJ1ZSwgZFVybCwgZEZpbCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdmb290ZXInKS5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnOiBzZWxmLl9yZW5kZXJUaHVtYlByb2dyZXNzKCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdhY3Rpb25zJzogYSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ2NhcHRpb24nOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IHNlbGYuX2dldFNpemUoc2l6ZSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICd3aWR0aCc6IHdpZHRoLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnaW5kaWNhdG9yJzogJydcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuaW5pdCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2lzUGRmUmVuZGVyZWQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCB1c2VMaWIgPSBzZWxmLnVzZVBkZlJlbmRlcmVyLFxyXG4gICAgICAgICAgICAgICAgZmxhZyA9IHR5cGVvZiB1c2VMaWIgPT09ICdmdW5jdGlvbicgPyB1c2VMaWIoKSA6ICEhdXNlTGliO1xyXG4gICAgICAgICAgICByZXR1cm4gZmxhZyAmJiBzZWxmLnBkZlJlbmRlcmVyVXJsO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2hhbmRsZXI6IGZ1bmN0aW9uICgkZWwsIGV2ZW50LCBjYWxsYmFjaykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIG5zID0gc2VsZi5uYW1lc3BhY2UsIGV2ID0gZXZlbnQuc3BsaXQoJyAnKS5qb2luKG5zICsgJyAnKSArIG5zO1xyXG4gICAgICAgICAgICBpZiAoISRlbCB8fCAhJGVsLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRlbC5vZmYoZXYpLm9uKGV2LCBjYWxsYmFjayk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZW5jb2RlVVJJOiBmdW5jdGlvbiAodlVybCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLmVuY29kZVVybCA/IGVuY29kZVVSSSh2VXJsKSA6IHZVcmw7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfbG9nOiBmdW5jdGlvbiAobXNnKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgaWQgPSBzZWxmLiRlbGVtZW50LmF0dHIoJ2lkJyk7XHJcbiAgICAgICAgICAgIGlmIChpZCkge1xyXG4gICAgICAgICAgICAgICAgbXNnID0gJ1wiJyArIGlkICsgJ1wiOiAnICsgbXNnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9ICdib290c3RyYXAtZmlsZWlucHV0OiAnICsgbXNnO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIHdpbmRvdy5jb25zb2xlLmxvZyAhPT0gJ3VuZGVmaW5lZCcpIHtcclxuICAgICAgICAgICAgICAgIHdpbmRvdy5jb25zb2xlLmxvZyhtc2cpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgd2luZG93LmFsZXJ0KG1zZyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHN0YXR1cyA9IHNlbGYuJGVsZW1lbnQuYXR0cigndHlwZScpID09PSAnZmlsZSc7XHJcbiAgICAgICAgICAgIGlmICghc3RhdHVzKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9sb2coJ1RoZSBpbnB1dCBcInR5cGVcIiBtdXN0IGJlIHNldCB0byBcImZpbGVcIiBmb3IgaW5pdGlhbGl6aW5nIHRoZSBcImJvb3RzdHJhcC1maWxlaW5wdXRcIiBwbHVnaW4uJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHN0YXR1cztcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9lcnJvcnNFeGlzdDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnIsICRlcnJMaXN0ID0gc2VsZi4kZXJyb3JDb250YWluZXIuZmluZCgnbGknKTtcclxuICAgICAgICAgICAgaWYgKCRlcnJMaXN0Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGVyciA9ICQoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2JykpLmh0bWwoc2VsZi4kZXJyb3JDb250YWluZXIuaHRtbCgpKTtcclxuICAgICAgICAgICAgJGVyci5maW5kKCcua3YtZXJyb3ItY2xvc2UnKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgJGVyci5maW5kKCd1bCcpLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICByZXR1cm4gISEkLnRyaW0oJGVyci50ZXh0KCkpLmxlbmd0aDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9lcnJvckhhbmRsZXI6IGZ1bmN0aW9uIChldnQsIGNhcHRpb24pIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlcnIgPSBldnQudGFyZ2V0LmVycm9yLCBzaG93RXJyb3IgPSBmdW5jdGlvbiAobXNnKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93RXJyb3IobXNnLnJlcGxhY2UoJ3tuYW1lfScsIGNhcHRpb24pKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZXJyLk5PVF9GT1VORF9FUlIgKi9cclxuICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZXJyLlNFQ1VSSVRZX0VSUiAqL1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBlcnIuTk9UX1JFQURBQkxFX0VSUiAqL1xyXG4gICAgICAgICAgICBpZiAoZXJyLmNvZGUgPT09IGVyci5OT1RfRk9VTkRfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICBzaG93RXJyb3Ioc2VsZi5tc2dGaWxlTm90Rm91bmQpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKGVyci5jb2RlID09PSBlcnIuU0VDVVJJVFlfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2hvd0Vycm9yKHNlbGYubXNnRmlsZVNlY3VyZWQpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoZXJyLmNvZGUgPT09IGVyci5OT1RfUkVBREFCTEVfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNob3dFcnJvcihzZWxmLm1zZ0ZpbGVOb3RSZWFkYWJsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVyci5jb2RlID09PSBlcnIuQUJPUlRfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG93RXJyb3Ioc2VsZi5tc2dGaWxlUHJldmlld0Fib3J0ZWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvd0Vycm9yKHNlbGYubXNnRmlsZVByZXZpZXdFcnJvcik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9hZGRFcnJvcjogZnVuY3Rpb24gKG1zZykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnJvciA9IHNlbGYuJGVycm9yQ29udGFpbmVyO1xyXG4gICAgICAgICAgICBpZiAobXNnICYmICRlcnJvci5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRlcnJvci5odG1sKHNlbGYuZXJyb3JDbG9zZUJ1dHRvbiArIG1zZyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRlcnJvci5maW5kKCcua3YtZXJyb3ItY2xvc2UnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldyAmJiAhc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuY2xlYXIoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZXJyb3IuZmFkZU91dCgnc2xvdycpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sIDEwKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2V0VmFsaWRhdGlvbkVycm9yOiBmdW5jdGlvbiAoY3NzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgY3NzID0gKGNzcyA/IGNzcyArICcgJyA6ICcnKSArICdoYXMtZXJyb3InO1xyXG4gICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoY3NzKS5hZGRDbGFzcygnaGFzLWVycm9yJyk7XHJcbiAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjYXB0aW9uQ29udGFpbmVyLCAnaXMtaW52YWxpZCcpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0RXJyb3JzOiBmdW5jdGlvbiAoZmFkZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnJvciA9IHNlbGYuJGVycm9yQ29udGFpbmVyO1xyXG4gICAgICAgICAgICBzZWxmLmlzRXJyb3IgPSBmYWxzZTtcclxuICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLnJlbW92ZUNsYXNzKCdoYXMtZXJyb3InKTtcclxuICAgICAgICAgICAgc2VsZi4kY2FwdGlvbkNvbnRhaW5lci5yZW1vdmVDbGFzcygnaXMtaW52YWxpZCcpO1xyXG4gICAgICAgICAgICAkZXJyb3IuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgIGlmIChmYWRlKSB7XHJcbiAgICAgICAgICAgICAgICAkZXJyb3IuZmFkZU91dCgnc2xvdycpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJGVycm9yLmhpZGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Nob3dGb2xkZXJFcnJvcjogZnVuY3Rpb24gKGZvbGRlcnMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZXJyb3IgPSBzZWxmLiRlcnJvckNvbnRhaW5lciwgbXNnO1xyXG4gICAgICAgICAgICBpZiAoIWZvbGRlcnMpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9IHNlbGYubXNnRm9sZGVyc05vdEFsbG93ZWQucmVwbGFjZSgne259JywgZm9sZGVycyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2FkZEVycm9yKG1zZyk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFZhbGlkYXRpb25FcnJvcigpO1xyXG4gICAgICAgICAgICAkZXJyb3IuZmFkZUluKDgwMCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlZm9sZGVyZXJyb3InLCBbZm9sZGVycywgbXNnXSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2hvd1VwbG9hZEVycm9yOiBmdW5jdGlvbiAobXNnLCBwYXJhbXMsIGV2ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVycm9yID0gc2VsZi4kZXJyb3JDb250YWluZXIsIGV2ID0gZXZlbnQgfHwgJ2ZpbGV1cGxvYWRlcnJvcicsIGUgPSBwYXJhbXMgJiYgcGFyYW1zLmlkID9cclxuICAgICAgICAgICAgICAgICc8bGkgZGF0YS10aHVtYi1pZD1cIicgKyBwYXJhbXMuaWQgKyAnXCI+JyArIG1zZyArICc8L2xpPicgOiAnPGxpPicgKyBtc2cgKyAnPC9saT4nO1xyXG4gICAgICAgICAgICBpZiAoJGVycm9yLmZpbmQoJ3VsJykubGVuZ3RoID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9hZGRFcnJvcignPHVsPicgKyBlICsgJzwvdWw+Jyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAkZXJyb3IuZmluZCgndWwnKS5hcHBlbmQoZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGVycm9yLmZhZGVJbig4MDApO1xyXG4gICAgICAgICAgICBzZWxmLl9yYWlzZShldiwgW3BhcmFtcywgbXNnXSk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFZhbGlkYXRpb25FcnJvcignZmlsZS1pbnB1dC1uZXcnKTtcclxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2hvd0Vycm9yOiBmdW5jdGlvbiAobXNnLCBwYXJhbXMsIGV2ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVycm9yID0gc2VsZi4kZXJyb3JDb250YWluZXIsIGV2ID0gZXZlbnQgfHwgJ2ZpbGVlcnJvcic7XHJcbiAgICAgICAgICAgIHBhcmFtcyA9IHBhcmFtcyB8fCB7fTtcclxuICAgICAgICAgICAgcGFyYW1zLnJlYWRlciA9IHNlbGYucmVhZGVyO1xyXG4gICAgICAgICAgICBzZWxmLl9hZGRFcnJvcihtc2cpO1xyXG4gICAgICAgICAgICAkZXJyb3IuZmFkZUluKDgwMCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKGV2LCBbcGFyYW1zLCBtc2ddKTtcclxuICAgICAgICAgICAgaWYgKCFzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9zZXRWYWxpZGF0aW9uRXJyb3IoJ2ZpbGUtaW5wdXQtbmV3Jyk7XHJcbiAgICAgICAgICAgIHNlbGYuJGJ0blVwbG9hZC5hdHRyKCdkaXNhYmxlZCcsIHRydWUpO1xyXG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9ub0Z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PSB1bmRlZmluZWQgJiYganFYSFIucmVzcG9uc2VKU09OLmVycm9yICE9PSB1bmRlZmluZWQgP1xyXG4gICAgICAgICAgICAgICAgICAgIGpxWEhSLnJlc3BvbnNlSlNPTi5lcnJvciA6IGpxWEhSLnJlc3BvbnNlVGV4dDtcclxuICAgICAgICAgICAgaWYgKHNlbGYuY2FuY2VsbGluZyAmJiBzZWxmLm1zZ1VwbG9hZEFib3J0ZWQpIHtcclxuICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYubXNnVXBsb2FkQWJvcnRlZDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93QWpheEVycm9yRGV0YWlscyAmJiB0ZXh0KSB7XHJcbiAgICAgICAgICAgICAgICB0ZXh0ID0gJC50cmltKHRleHQucmVwbGFjZSgvXFxuXFxzKlxcbi9nLCAnXFxuJykpO1xyXG4gICAgICAgICAgICAgICAgdGV4dFByZSA9IHRleHQubGVuZ3RoID8gJzxwcmU+JyArIHRleHQgKyAnPC9wcmU+JyA6ICcnO1xyXG4gICAgICAgICAgICAgICAgZXJyTXNnICs9IGVyck1zZyA/IHRleHRQcmUgOiB0ZXh0O1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghZXJyTXNnKSB7XHJcbiAgICAgICAgICAgICAgICBlcnJNc2cgPSBzZWxmLm1zZ0FqYXhFcnJvci5yZXBsYWNlKCd7b3BlcmF0aW9ufScsIG9wZXJhdGlvbik7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5jYW5jZWxsaW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHJldHVybiBmaWxlTmFtZSA/ICc8Yj4nICsgZmlsZU5hbWUgKyAnOiA8L2I+JyArIGVyck1zZyA6IGVyck1zZztcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9wYXJzZUZpbGVUeXBlOiBmdW5jdGlvbiAodHlwZSwgbmFtZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGlzVmFsaWQsIHZUeXBlLCBjYXQsIGksIHR5cGVzID0gc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzIHx8IFtdO1xyXG4gICAgICAgICAgICBpZiAodHlwZSA9PT0gJ2FwcGxpY2F0aW9uL3RleHQtcGxhaW4nKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RleHQnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCB0eXBlcy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY2F0ID0gdHlwZXNbaV07XHJcbiAgICAgICAgICAgICAgICBpc1ZhbGlkID0gc2VsZi5maWxlVHlwZVNldHRpbmdzW2NhdF07XHJcbiAgICAgICAgICAgICAgICB2VHlwZSA9IGlzVmFsaWQodHlwZSwgbmFtZSkgPyBjYXQgOiAnJztcclxuICAgICAgICAgICAgICAgIGlmICghJGguaXNFbXB0eSh2VHlwZSkpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlR5cGU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICdvdGhlcic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0UHJldmlld0ljb246IGZ1bmN0aW9uIChmbmFtZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGV4dCwgb3V0ID0gbnVsbDtcclxuICAgICAgICAgICAgaWYgKGZuYW1lICYmIGZuYW1lLmluZGV4T2YoJy4nKSA+IC0xKSB7XHJcbiAgICAgICAgICAgICAgICBleHQgPSBmbmFtZS5zcGxpdCgnLicpLnBvcCgpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYucHJldmlld0ZpbGVJY29uU2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2V4dF0gfHwgc2VsZi5wcmV2aWV3RmlsZUljb25TZXR0aW5nc1tleHQudG9Mb3dlckNhc2UoKV0gfHwgbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLnByZXZpZXdGaWxlRXh0U2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgICAgICAkLmVhY2goc2VsZi5wcmV2aWV3RmlsZUV4dFNldHRpbmdzLCBmdW5jdGlvbiAoa2V5LCBmdW5jKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2tleV0gJiYgZnVuYyhleHQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2tleV07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBVbm5lY2Vzc2FyeVJldHVyblN0YXRlbWVudEpTXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3BhcnNlRmlsZVByZXZpZXdJY29uOiBmdW5jdGlvbiAoY29udGVudCwgZm5hbWUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpY24gPSBzZWxmLl9nZXRQcmV2aWV3SWNvbihmbmFtZSkgfHwgc2VsZi5wcmV2aWV3RmlsZUljb24sIG91dCA9IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgIGlmIChvdXQuaW5kZXhPZigne3ByZXZpZXdGaWxlSWNvbn0nKSA+IC0xKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBvdXQuc2V0VG9rZW5zKHsncHJldmlld0ZpbGVJY29uQ2xhc3MnOiBzZWxmLnByZXZpZXdGaWxlSWNvbkNsYXNzLCAncHJldmlld0ZpbGVJY29uJzogaWNufSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yYWlzZTogZnVuY3Rpb24gKGV2ZW50LCBwYXJhbXMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlID0gJC5FdmVudChldmVudCk7XHJcbiAgICAgICAgICAgIGlmIChwYXJhbXMgIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kZWxlbWVudC50cmlnZ2VyKGUsIHBhcmFtcyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRlbGVtZW50LnRyaWdnZXIoZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGUuaXNEZWZhdWx0UHJldmVudGVkKCkgfHwgZS5yZXN1bHQgPT09IGZhbHNlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc3dpdGNoIChldmVudCkge1xyXG4gICAgICAgICAgICAgICAgLy8gaWdub3JlIHRoZXNlIGV2ZW50c1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWJhdGNodXBsb2FkY29tcGxldGUnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWJhdGNodXBsb2Fkc3VjY2Vzcyc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxldXBsb2FkZWQnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWNsZWFyJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVjbGVhcmVkJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVyZXNldCc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlZXJyb3InOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWZvbGRlcmVycm9yJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGV1cGxvYWRlcnJvcic6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlYmF0Y2h1cGxvYWRlcnJvcic6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlZGVsZXRlZXJyb3InOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWN1c3RvbWVycm9yJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVzdWNjZXNzcmVtb3ZlJzpcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIC8vIHJlY2VpdmUgZGF0YSByZXNwb25zZSB2aWEgYGZpbGVjdXN0b21lcnJvcmAgZXZlbnRgXHJcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5hamF4QWJvcnRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZS5yZXN1bHQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2xpc3RlbkZ1bGxTY3JlZW46IGZ1bmN0aW9uIChpc0Z1bGxTY3JlZW4pIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkbW9kYWwgPSBzZWxmLiRtb2RhbCwgJGJ0bkZ1bGwsICRidG5Cb3JkO1xyXG4gICAgICAgICAgICBpZiAoISRtb2RhbCB8fCAhJG1vZGFsLmxlbm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WVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICRidG5Cb3JkLnJlbW92ZUNsYXNzKCdhY3RpdmUnKS5hdHRyKCdhcmlhLXByZXNzZWQnLCAnZmFsc2UnKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2xpc3RlbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlbCA9IHNlbGYuJGVsZW1lbnQsICRmb3JtID0gc2VsZi4kZm9ybSwgJGNvbnQgPSBzZWxmLiRjb250YWluZXIsIGZ1bGxTY3JlZW5FdmVudHM7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2xpY2snLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCRlbC5oYXNDbGFzcygnZmlsZS1uby1icm93c2UnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZWwuZGF0YSgnem9uZUNsaWNrZWQnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZWwuZGF0YSgnem9uZUNsaWNrZWQnLCBmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2hhbmdlJywgJC5wcm94eShzZWxmLl9jaGFuZ2UsIHNlbGYpKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0Jyb3dzZSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcihzZWxmLiRidG5GaWxlLCAnY2xpY2snLCAkLnByb3h5KHNlbGYuX2Jyb3dzZSwgc2VsZikpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGNvbnQuZmluZCgnLmZpbGVpbnB1dC1yZW1vdmU6bm90KFtkaXNhYmxlZF0pJyksICdjbGljaycsICQucHJveHkoc2VsZi5jbGVhciwgc2VsZikpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRjb250LmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJyksICdjbGljaycsICQucHJveHkoc2VsZi5jYW5jZWwsIHNlbGYpKTtcclxuICAgICAgICAgICAgc2VsZi5faW5pdERyYWdEcm9wKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGZvcm0sICdyZXNldCcsICQucHJveHkoc2VsZi5jbGVhciwgc2VsZikpO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRmb3JtLCAnc3VibWl0JywgJC5wcm94eShzZWxmLl9zdWJtaXRGb3JtLCBzZWxmKSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5faGFuZGxlcihzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC11cGxvYWQnKSwgJ2NsaWNrJywgJC5wcm94eShzZWxmLl91cGxvYWRDbGljaywgc2VsZikpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCQod2luZG93KSwgJ3Jlc2l6ZScsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xpc3RlbkZ1bGxTY3JlZW4oc2NyZWVuLndpZHRoID09PSB3aW5kb3cuaW5uZXJXaWR0aCAmJiBzY3JlZW4uaGVpZ2h0ID09PSB3aW5k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rpb24gKGNhdCwgc2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgIHNlbCA9ICcuZmlsZS1wcmV2aWV3LWZyYW1lIC5maWxlLXByZXZpZXctJyArIGNhdDtcclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuZmluZChzZWwgKyAnLmt2LXByZXZpZXctZGF0YSwnICsgc2VsICsgJyAua3YtcHJldmlldy1kYXRhJykuY3NzKHNldHRpbmdzKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2NhbkRyb3BwZWRJdGVtczogZnVuY3Rpb24gKGl0ZW0sIGZpbGVzLCBwYXRoKSB7XHJcbiAgICAgICAgICAgIHBhdGggPSBwYXRoIHx8ICcnO1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGksIGRpclJlYWRlciwgcmVhZERpciwgZXJyb3JIYW5kbGVyID0gZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZygnRXJyb3Igc2Nhbm5pbmcgZHJvcHBlZCBmaWxlcyEnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZyhlKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgaWYgKGl0ZW0uaXNGaWxlKSB7XHJcbiAgICAgICAgICAgICAgICBpdGVtLmZpbGUoZnVuY3Rpb24gKGZpbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlcy5wdXNoKGZpbGUpO1xyXG4gICAgICAgICAgICAgICAgfSwgZXJyb3JIYW5kbGVyKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmIChpdGVtLmlzRGlyZWN0b3J5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZGlyUmVhZGVyID0gaXRlbS5jcmVhdGVSZWFkZXIoKTtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRGlyID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXJSZWFkZXIucmVhZEVudHJpZXMoZnVuY3Rpb24gKGVudHJpZXMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbnRyaWVzICYmIGVudHJpZXMubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBlbnRyaWVzLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NjYW5Ecm9wcGVkSXRlbXMoZW50cmllc1tpXSwgZmlsZXMsIHBhdGggKyBpdGVtLm5hbWUgKyAnLycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZWN1cnNpdmVseSBjYWxsIHJlYWREaXIoKSBhZ2Fpbiwgc2luY2UgYnJvd3NlciBjYW4gb25seSBoYW5kbGUgZmlyc3QgMTAwIGVudHJpZXMuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZERpcigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVycm9ySGFuZGxlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRGlyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdERyYWdEcm9wOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJHpvbmUgPSBzZWxmLiRkcm9wWm9uZTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuZHJvcFpvbmVFbmFibGVk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RhdGFUcmFuc2ZlciAqL1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGksICRlbCA9IHNlbGYuJGVsZW1lbnQsIGRhdGFUcmFuc2ZlciA9IGUub3JpZ2luYWxFdmVudC5kYXRhVHJhbnNmZXIsXHJcbiAgICAgICAgICAgICAgICBmaWxlcyA9IGRhdGFUcmFuc2Zlci5maWxlcywgaXRlbXMgPSBkYXRhVHJhbnNmZXIuaXRlbXMsIGZvbGRlcnMgPSAkaC5nZXREcmFnRHJvcEZvbGRlcnMoaXRlbXMpLFxyXG4gICAgICAgICAgICAgICAgcHJvY2Vzc0ZpbGVzID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jaGFuZ2VUcmlnZ2VyZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZWwuZ2V0KDApLmZpbGVzID0gZmlsZXM7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jaGFuZ2VUcmlnZ2VyZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRlbC50cmlnZ2VyKCdjaGFuZ2UnICsgc2VsZi5uYW1lc3BhY2UpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2hhbmdlKGUsIGZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kZHJvcFpvbmUucmVtb3ZlQ2xhc3MoJ2ZpbGUtaGlnaGxpZ2h0ZWQnKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNEaXNhYmxlZCB8fCAkaC5pc0VtcHR5KGZpbGVzKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVEcmFnRHJvcCcsIHsnc291cmNlRXZlbnQnOiBlLCAnZmlsZXMnOiBmaWxlc30pKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGZvbGRlcnMgPiAwKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd0ZvbGRlckVycm9yKGZvbGRlcnMpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGZpbGVzID0gW107XHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaXRlbXMubGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgaXRlbSA9IGl0ZW1zW2ldLndlYmtpdEdldEFzRW50cnkoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zY2FuRHJvcHBlZEl0ZW1zKGl0ZW0sIGZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzRmlsZXMoKTtcclxuICAgICAgICAgICAgICAgIH0sIDUwMCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBwcm9jZXNzRmlsZXMoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwbG9hZENsaWNrOiBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRidG4gPSBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC11cGxvYWQnKSwgJGZvcm0sXHJcbiAgICAgICAgICAgICAgICBpc0VuYWJsZWQgPSAhJGJ0bi5oYXNDbGFzcygnZGlzYWJsZWQnKSAmJiAkaC5pc0VtcHR5KCRidG4uYXR0cignZGlzYWJsZWQnKSk7XHJcbiAgICAgICAgICAgIGlmIChlICYmIGUuaXNEZWZhdWx0UHJldmVudGVkKCkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaXNFbmFibGVkICYmICRidG4uYXR0cigndHlwZScpICE9PSAnc3VibWl0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgICRmb3JtID0gJGJ0bi5jbG9zZXN0KCdmb3JtJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy8gZG93bmdyYWRlIHRvIG5vcm1hbCBmb3JtIHN1Ym1pdCBpZiBwb3NzaWJsZVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZm9ybS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGZvcm0udHJpZ2dlcignc3VibWl0Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XHJcbiAgICAgICAgICAgIGlmIChpc0VuYWJsZWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zdWJtaXRGb3JtOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2lzRmlsZVNlbGVjdGlvblZhbGlkKCkgJiYgIXNlbGYuX2Fib3J0KHt9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jbGVhclByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkcCA9IHNlbGYuJHByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAkdGh1bWJzID0gc2VsZi5zaG93VXBsb2FkZWRUaHVtYnMgPyBzZWxmLmdldEZyYW1lcygnOm5vdCguZmlsZS1wcmV2aWV3LXN1Y2Nlc3MpJykgOiBzZWxmLmdldEZyYW1lcygpO1xyXG4gICAgICAgICAgICAkdGh1bWJzLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyk7XHJcbiAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAkaC5jbGVhblpvb21DYWNoZSgkcC5maW5kKCcjem9vbS0nICsgJHRodW1iLmF0dHIoJ2lkJykpKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGggfHwgIXNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0VXBsb2FkKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEZWZhdWx0UHJldmlldygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRTb3J0YWJsZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlbCA9IHNlbGYuJHByZXZpZXcsIHNldHRpbmdzLCBzZWxlY3RvciA9ICcuJyArICRoLlNPUlRfQ1NTLFxyXG4gICAgICAgICAgICAgICAgcmV2ID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyO1xyXG4gICAgICAgICAgICBpZiAoIXdpbmRvdy5LdlNvcnRhYmxlIHx8ICRlbC5maW5kKHNlbGVjdG9yKS5sZW5ndGggPT09IDApIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBKU1VudXNlZEdsb2JhbFN5bWJvbHNcclxuICAgICAgICAgICAgc2V0dGluZ3MgPSB7XHJcbiAgICAgICAgICAgICAgICBoYW5kbGU6ICcuZHJhZy1oYW5kbGUtaW5pdCcsXHJcbiAgICAgICAgICAgICAgICBkYXRhSWRBdHRyOiAnZGF0YS1wcmV2aWV3LWlkJyxcclxuICAgICAgICAgICAgICAgIHNjcm9sbDogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBkcmFnZ2FibGU6IHNlbGVjdG9yLFxyXG4gICAgICAgICAgICAgICAgb25Tb3J0OiBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBvbGRJbmRleCA9IGUub2xkSW5kZXgsIG5ld0luZGV4ID0gZS5uZXdJbmRleCwgaSA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlldyA9ICRoLm1vdmVBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3LCBvbGRJbmRleCwgbmV3SW5kZXgsIHJldik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9ICRoLm1vdmVBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnLCBvbGRJbmRleCwgbmV3SW5kZXgsIHJldik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuaW5pdCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuZ2V0RnJhbWVzKCcuZmlsZS1wcmV2aWV3LWluaXRpYWwnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS5hdHRyKCdkYXRhLWZpbGVpbmRleCcsICdpbml0XycgKyBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaSsrO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlc29ydGVkJywge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBwcmV2aWV3SWQ6ICQoZS5pdGVtKS5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnb2xkSW5kZXgnOiBvbGRJbmRleCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ25ld0luZGV4JzogbmV3SW5kZXgsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrOiBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnXHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGlmICgkZWwuZGF0YSgna3Zzb3J0YWJsZScpKSB7XHJcbiAgICAgICAgICAgICAgICAkZWwua3Zzb3J0YWJsZSgnZGVzdHJveScpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICQuZXh0ZW5kKHRydWUsIHNldHRpbmdzLCBzZWxmLmZpbGVBY3Rpb25TZXR0aW5ncy5kcmFnU2V0dGluZ3MpO1xyXG4gICAgICAgICAgICAkZWwua3Zzb3J0YWJsZShzZXR0aW5ncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2V0UHJldmlld0NvbnRlbnQ6IGZ1bmN0aW9uIChjb250ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kcHJldmlldy5odG1sKGNvbnRlbnQpO1xyXG4gICAgICAgICAgICBzZWxmLl9hdXRvRml0Q29udGVudCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3OiBmdW5jdGlvbiAoaXNJbml0KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY2FwID0gc2VsZi5pbml0aWFsQ2FwdGlvbiB8fCAnJywgb3V0O1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYucHJldmlld0NhY2hlLmNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyUHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGlzSW5pdCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24oY2FwKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdENhcHRpb24oKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdDYWNoZS5vdXQoKTtcclxuICAgICAgICAgICAgY2FwID0gaXNJbml0ICYmIHNlbGYuaW5pdGlhbENhcHRpb24gPyBzZWxmLmluaXRpYWxDYXB0aW9uIDogb3V0LmNhcHRpb247XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdDb250ZW50KG91dC5jb250ZW50KTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0SW5pdFRodW1iQXR0cigp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ZT1cImJ1dHRvblwiIGNsYXNzPVwiJyArIGNzcyArICcgYnRuLScgKyB0eXBlICsgJ1wiJyArIHBhcmFtcyArICc+JyArIGxhYmVsICsgJzwvYnV0dG9uPic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0TW9kYWxDb250ZW50OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdtb2RhbCcpLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAncnRsJzogc2VsZi5ydGwgPyAnIGt2LXJ0bCcgOiAnJyxcclxuICAgICAgICAgICAgICAgICd6b29tRnJhbWVDbGFzcyc6IHNlbGYuZnJhbWVDbGFzcyxcclxuICAgICAgICAgICAgICAgICdoZWFkaW5nJzogc2VsZi5tc2dab29tTW9kYWxIZWFkaW5nLFxyXG4gICAgICAgICAgICAgICAgJ3ByZXYnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdwcmV2JyksXHJcbiAgICAgICAgICAgICAgICAnbmV4dCc6IHNlbGYuX2dldFpvb21CdXR0b24oJ25leHQnKSxcclxuICAgICAgICAgICAgICAgICd0b2dnbGVoZWFkZXInOiBzZWxmLl9nZXRab29tQnV0dG9uKCd0b2dnbGVoZWFkZXInKSxcclxuICAgICAgICAgICAgICAgICdmdWxsc2NyZWVuJzogc2VsZi5fZ2V0Wm9vbUJ1dHRvbignZnVsbHNjcmVlbicpLFxyXG4gICAgICAgICAgICAgICAgJ2JvcmRlcmxlc3MnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdib3JkZXJsZXNzJyksXHJcbiAgICAgICAgICAgICAgICAnY2xvc2UnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdjbG9zZScpXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2xpc3Rlbk1vZGFsRXZlbnQ6IGZ1bmN0aW9uIChldmVudCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRtb2RhbCA9IHNlbGYuJG1vZGFsLCBnZXRQYXJhbXMgPSBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgICAgICBzb3VyY2VFdmVudDogZSxcclxuICAgICAgICAgICAgICAgICAgICBwcmV2aWV3SWQ6ICRtb2RhbC5kYXRhKCdwcmV2aWV3SWQnKSxcclxuICAgICAgICAgICAgICAgICAgICBtb2RhbDogJG1vZGFsXHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAkbW9kYWwub24oZXZlbnQgKyAnLmJzLm1vZGFsJywgZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkYnRuRnVsbCA9ICRtb2RhbC5maW5kKCcuYnRuLWZ1bGxzY3JlZW4nKSwgJGJ0bkJvcmQgPSAkbW9kYWwuZmluZCgnLmJ0bi1ib3JkZXJsZXNzJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXpvb20nICsgZXZlbnQsIGdldFBhcmFtcyhlKSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQgPT09ICdzaG93bicpIHtcclxuICAgICAgICAgICAgICAgICAgICAkYnRuQm9yZC5yZW1vdmVDbGFzcygnYWN0aXZlJykuYXR0cignYXJpYS1wcmVzc2VkJywgJ2ZhbHNlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGJ0bkZ1bGwucmVtb3ZlQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICdmYWxzZScpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkbW9kYWwuaGFzQ2xhc3MoJ2ZpbGUtem9vbS1mdWxsc2NyZWVuJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkaC5jaGVja0Z1bGxTY3JlZW4oKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkZ1bGwuYWRkQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICd0cnVlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuQm9yZC5hZGRDbGFzcygnYWN0aXZlJykuYXR0cignYXJpYS1wcmVzc2VkJywgJ3RydWUnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFpvb206IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZGlhbG9nLCBtb2RhbE1haW4gPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnbW9kYWxNYWluJyksIG1vZGFsSWQgPSAnIycgKyAkaC5NT0RBTF9JRDtcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi4kbW9kYWwgPSAkKG1vZGFsSWQpO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuJG1vZGFsIHx8ICFzZWxmLiRtb2RhbC5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRkaWFsb2cgPSAkKGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpKS5odG1sKG1vZGFsTWFpbikuaW5zZXJ0QWZ0ZXIoc2VsZi4kY29udGFpbmVyKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuJG1vZGFsID0gJChtb2RhbElkKS5pbnNlcnRCZWZvcmUoJGRpYWxvZyk7XHJcbiAgICAgICAgICAgICAgICAkZGlhbG9nLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRoLmluaXRNb2RhbChzZWxmLiRtb2RhbCk7XHJcbiAgICAgICAgICAgIHNlbGYuJG1vZGFsLmh0bWwoc2VsZi5fZ2V0TW9kYWxDb250ZW50KCkpO1xyXG4gICAgICAgICAgICAkLmVhY2goJGguTU9EQUxfRVZFTlRTLCBmdW5jdGlvbiAoa2V5LCBldmVudCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fbGlzdGVuTW9kYWxFdmVudChldmVudCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRab29tQnV0dG9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHByZXZpZXdJZCA9IHNlbGYuJG1vZGFsLmRhdGEoJ3ByZXZpZXdJZCcpIHx8ICcnLCAkZmlyc3QsICRsYXN0LFxyXG4gICAgICAgICAgICAgICAgdGh1bWJzID0gc2VsZi5nZXRGcmFtZXMoKS50b0FycmF5KCksIGxlbiA9IHRodW1icy5sZW5ndGgsICRwcmV2ID0gc2VsZi4kbW9kYWwuZmluZCgnLmJ0bi1wcmV2JyksXHJcbiAgICAgICAgICAgICAgICAkbmV4dCA9IHNlbGYuJG1vZGFsLmZpbmQoJy5idG4tbmV4dCcpO1xyXG4gICAgICAgICAgICBpZiAodGh1bWJzLmxlbmd0aCA8IDIpIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICRuZXh0LmhpZGUoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LnNob3coKTtcclxuICAgICAgICAgICAgICAgICRuZXh0LnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIWxlbikge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRmaXJzdCA9ICQodGh1bWJzWzBdKTtcclxuICAgICAgICAgICAgJGxhc3QgPSAkKHRodW1ic1tsZW4gLSAxXSk7XHJcbiAgICAgICAgICAgICRwcmV2LnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICRuZXh0LnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIGlmICgkZmlyc3QubGVuZ3RoICYmICRmaXJzdC5hdHRyKCdpZCcpID09PSBwcmV2aWV3SWQpIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LmF0dHIoJ2Rpc2FibGVkJywgdHJ1ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCRsYXN0Lmxlbmd0aCAmJiAkbGFzdC5hdHRyKCdpZCcpID09PSBwcmV2aWV3SWQpIHtcclxuICAgICAgICAgICAgICAgICRuZXh0LmF0dHIoJ2Rpc2FibGVkJywgdHJ1ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9tYXhpbWl6ZVpvb21EaWFsb2c6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkbW9kYWwgPSBzZWxmLiRtb2RhbCwgJGhlYWQgPSAkbW9kYWwuZmluZCgnLm1vZGFsLWhlYWRlcjp2aXNpYmxlJyksXHJcbiAgICAgICAgICAgICAgICAkZm9vdCA9ICRtb2RhbC5maW5kKCcubW9kYWwtZm9vdGVyOnZpc2libGUnKSwgJGJvZHkgPSAkbW9kYWwuZmluZCgnLm1vZGFsLWJvZHknKSxcclxuICAgICAgICAgICAgICAgIGggPSAkKHdpbmRvdykuaGVpZ2h0KCksIGRpZmYgPSAwO1xyXG4gICAgICAgICAgICAkbW9kYWwuYWRkQ2xhc3MoJ2ZpbGUtem9vbS1mdWxsc2NyZWVuJyk7XHJcbiAgICAgICAgICAgIGlmICgkaGVhZCAmJiAkaGVhZC5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIGggLT0gJGhlYWQub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCRmb290ICYmICRmb290Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgaCAtPSAkZm9vdC5vdXRlckhlaWdodCh0cnVlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoJGJvZHkgJiYgJGJvZHkubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICBkaWZmID0gJGJvZHkub3V0ZXJIZWlnaHQodHJ1ZSkgLSAkYm9keS5oZWlnaHQoKTtcclxuICAgICAgICAgICAgICAgIGggLT0gZGlmZjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkbW9kYWwuZmluZCgnLmt2LXpvb20tYm9keScpLmhlaWdodChoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZXNpemVab29tRGlhbG9nOiBmdW5jdGlvbiAoZnVsbFNjcmVlbikge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRtb2RhbCA9IHNlbGYuJG1vZGFsLCAkYnRuRnVsbCA9ICRtb2RhbC5maW5kKCcuYnRuLWZ1bGxzY3JlZW4nKSxcclxuICAgICAgICAgICAgICAgICRidG5Cb3JkID0gJG1vZGFsLmZpbmQoJy5idG4tYm9yZGVybGVzcycpO1xyXG4gICAgICAgICAgICBpZiAoJG1vZGFsLmhhc0NsYXNzKCdmaWxlLXpvb20tZnVsbHNjcmVlbicpKSB7XHJcbiAgICAgICAgICAgICAgICAkaC50b2dnbGVGdWxsU2NyZWVuKGZhbHNlKTtcclxuICAgICAgICAgICAgICAgIGlmICghZnVsbFNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJGJ0bkZ1bGwuaGFzQ2xhc3MoJ2FjdGl2ZScpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRtb2RhbC5yZW1vdmVDbGFzcygnZmlsZS16b29tLWZ1bGxzY3JlZW4nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi4kbW9kYWwuZmluZCgnLmt2LXpvb20tYm9keScpLmNzcygnaGVpZ2h0Jywgc2VsZi56b29tTW9kYWxIZWlnaHQpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5GdWxsLnJlbW92ZUNsYXNzKCdhY3RpdmUnKS5hdHRyKCdhcmlhLXByZXNzZWQnLCAnZmFsc2UnKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJGJ0bkZ1bGwuaGFzQ2xhc3MoJ2FjdGl2ZScpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRtb2RhbC5yZW1vdmVDbGFzcygnZmlsZS16b29tLWZ1bGxzY3JlZW4nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzaXplWm9vbURpYWxvZyh0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRidG5Cb3JkLmhhc0NsYXNzKCdhY3RpdmUnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkJvcmQucmVtb3ZlQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICdmYWxzZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFmdWxsU2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgJGgudG9nZ2xlRnVsbFNjcmVlbih0cnVlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkbW9kYWwuZm9jdXMoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zZXRab29tQ29udGVudDogZnVuY3Rpb24gKCRmcmFtZSwgYW5pbWF0ZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRjb250ZW50LCB0bXBsdCwgYm9keSwgdGl0bGUsICRib2R5LCAkZGF0YUVsLCBjb25maWcsIHByZXZpZXdJZCA9ICRmcmFtZS5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgJHpvb21QcmV2aWV3ID0gc2VsZi4kcHJldmlldy5maW5kKCcjem9vbS0nICsgcHJldmlld0lkKSwgJG1vZGFsID0gc2VsZi4kbW9kYWwsICR0bXAsXHJcbiAgICAgICAgICAgICAgICAkYnRuRnVsbCA9ICRtb2RhbC5maW5kKCcuYnRuLWZ1bGxzY3JlZW4nKSwgJGJ0bkJvcmQgPSAkbW9kYWwuZmluZCgnLmJ0bi1ib3JkZXJsZXNzJyksIGNhcCwgc2l6ZSxcclxuICAgICAgICAgICAgICAgICRidG5Ub2doID0gJG1vZGFsLmZpbmQoJy5idG4tdG9nZ2xlaGVhZGVyJyk7XHJcbiAgICAgICAgICAgIHRtcGx0ID0gJHpvb21QcmV2aWV3LmF0dHIoJ2RhdGEtdGVtcGxhdGUnKSB8fCAnZ2VuZXJpYyc7XHJcbiAgICAgICAgICAgICRjb250ZW50ID0gJHpvb21QcmV2aWV3LmZpbmQoJy5rdi1maWxlLWNvbnRlbnQnKTtcclxuICAgICAgICAgICAgYm9keSA9ICRjb250ZW50Lmxlbmd0aCA/ICRjb250ZW50Lmh0bWwoKSA6ICcnO1xyXG4gICAgICAgICAgICBjYXAgPSAkZnJhbWUuZGF0YSgnY2FwdGlvbicpIHx8ICcnO1xyXG4gICAgICAgICAgICBzaXplID0gJGZyYW1lLmRhdGEoJ3NpemUnKSB8fCAnJztcclxuICAgICAgICAgICAgdGl0bGUgPSBjYXAgKyAnICcgKyBzaXplO1xyXG4gICAgICAgICAgICAkbW9kYWwuZmluZCgnLmt2LXpvb20tdGl0bGUnKS5hdHRyKCd0aXRsZScsICQoJzxkaXYvPicpLmh0bWwodGl0bGUpLnRleHQoKSkuaHRtbCh0aXRsZSk7XHJcbiAgICAgICAgICAgICRib2R5ID0gJG1vZGFsLmZpbmQoJy5rdi16b29tLWJvZHknKTtcclxuICAgICAgICAgICAgJG1vZGFsLnJlbW92ZUNsYXNzKCdrdi1zaW5nbGUtY29udGVudCcpO1xyXG4gICAgICAgICAgICBpZiAoYW5pbWF0ZSkge1xyXG4gICAgICAgICAgICAgICAgJHRtcCA9ICRib2R5LmFkZENsYXNzKCdmaWxlLXRodW1iLWxvYWRpbmcnKS5jbG9uZSgpLmluc2VydEFmdGVyKCRib2R5KTtcclxuICAgICAgICAgICAgICAgICRib2R5Lmh0bWwoYm9keSkuaGlkZSgpO1xyXG4gICAgICAgICAgICAgICAgJHRtcC5mYWRlT3V0KCdmYXN0JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICRib2R5LmZhZGVJbignZmFzdCcsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJvZHkucmVtb3ZlQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICR0bXAucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICRib2R5Lmh0bWwoYm9keSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgY29uZmlnID0gc2VsZi5wcmV2aWV3Wm9vbVNldHRpbmdzW3RtcGx0XTtcclxuICAgICAgICAgICAgaWYgKGNvbmZpZykge1xyXG4gICAgICAgICAgICAgICAgJGRhdGFFbCA9ICRib2R5LmZpbmQoJy5rdi1wcmV2aWV3LWRhdGEnKTtcclxuICAgICAgICAgICAgICAgICRoLmFkZENzcygkZGF0YUVsLCAnZmlsZS16b29tLWRldGFpbCcpO1xyXG4gICAgICAgICAgICAgICAgJC5lYWNoKGNvbmZpZywgZnVuY3Rpb24gKGtleSwgdmFsdWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkZGF0YUVsLmNzcyhrZXksIHZhbHVlKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoKCRkYXRhRWwuYXR0cignd2lkdGgnKSAmJiBrZXkgPT09ICd3aWR0aCcpIHx8ICgkZGF0YUVsLmF0dHIoJ2hlaWdodCcpICYmIGtleSA9PT0gJ2hlaWdodCcpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRkYXRhRWwucmVtb3ZlQXR0cihrZXkpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRtb2RhbC5kYXRhKCdwcmV2aWV3SWQnLCBwcmV2aWV3SWQpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbC5maW5kKCcuYnRuLXByZXYnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fem9vbVNsaWRlU2hvdygncHJldicsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbC5maW5kKCcuYnRuLW5leHQnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fem9vbVNsaWRlU2hvdygnbmV4dCcsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRidG5GdWxsLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yZXNpemVab29tRGlhbG9nKHRydWUpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkYnRuQm9yZCwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmVzaXplWm9vbURpYWxvZyhmYWxzZSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRidG5Ub2doLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgJGhlYWRlciA9ICRtb2RhbC5maW5kKCcubW9kYWwtaGVhZGVyJyksICRmbG9hdEJhciA9ICRtb2RhbC5maW5kKCcubW9kYWwtYm9keSAuZmxvYXRpbmctYnV0dG9ucycpLFxyXG4gICAgICAgICAgICAgICAgICAgIGh0LCAkYWN0aW9ucyA9ICRoZWFkZXIuZmluZCgnLmt2LXpvb20tYWN0aW9ucycpLCByZXNpemUgPSBmdW5jdGlvbiAoaGVpZ2h0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciAkYm9keSA9IHNlbGYuJG1vZGFsLmZpbmQoJy5rdi16b29tLWJvZHknKSwgaCA9IHNlbGYuem9vbU1vZGFsSGVpZ2h0O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJG1vZGFsLmhhc0NsYXNzKCdmaWxlLXpvb20tZnVsbHNjcmVlbicpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gJGJvZHkub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWhlaWdodCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBoIC0gJGhlYWRlci5vdXRlckhlaWdodCh0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYm9keS5jc3MoJ2hlaWdodCcsIGhlaWdodCA/IGggKyBoZWlnaHQgOiBoKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgaWYgKCRoZWFkZXIuaXMoJzp2aXNpYmxlJykpIHtcclxuICAgICAgICAgICAgICAgICAgICBodCA9ICRoZWFkZXIub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGhlYWRlci5zbGlkZVVwKCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYWN0aW9ucy5maW5kKCcuYnRuJykuYXBwZW5kVG8oJGZsb2F0QmFyKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzaXplKGh0KTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZsb2F0QmFyLmZpbmQoJy5idG4nKS5hcHBlbmRUbygkYWN0aW9ucyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGhlYWRlci5zbGlkZURvd24oJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc2l6ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgJG1vZGFsLmZvY3VzKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbCwgJ2tleWRvd24nLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IGUud2hpY2ggfHwgZS5rZXlDb2RlLCAkcHJldiA9ICQodGhpcykuZmluZCgnLmJ0bi1wcmV2JyksICRuZXh0ID0gJCh0aGlzKS5maW5kKCcuYnRuLW5leHQnKSxcclxuICAgICAgICAgICAgICAgICAgICB2SWQgPSAkKHRoaXMpLmRhdGEoJ3ByZXZpZXdJZCcpLCB2UHJldktleSA9IHNlbGYucnRsID8gMzkgOiAzNywgdk5leHRLZXkgPSBzZWxmLnJ0bCA/IDM3IDogMzk7XHJcbiAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSB2UHJldktleSAmJiAkcHJldi5sZW5ndGggJiYgISRwcmV2LmF0dHIoJ2Rpc2FibGVkJykpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl96b29tU2xpZGVTaG93KCdwcmV2JywgdklkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChrZXkgPT09IHZOZXh0S2V5ICYmICRuZXh0Lmxlbmd0aCAmJiAhJG5leHQuYXR0cignZGlzYWJsZWQnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3pvb21TbGlkZVNob3coJ25leHQnLCB2SWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF96b29tUHJldmlldzogZnVuY3Rpb24gKCRidG4pIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUsICRtb2RhbCA9IHNlbGYuJG1vZGFsO1xyXG4gICAgICAgICAgICBpZiAoISRidG4ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICB0aHJvdyAnQ2Fubm90IHpvb20gdG8gZGV0YWlsZWQgcHJldmlldyEnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRoLmluaXRNb2RhbCgkbW9kYWwpO1xyXG4gICAgICAgICAgICAkbW9kYWwuaHRtbChzZWxmLl9nZXRNb2RhbENvbnRlbnQoKSk7XHJcbiAgICAgICAgICAgICRmcmFtZSA9ICRidG4uY2xvc2VzdCgkaC5GUkFNRVMpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRab29tQ29udGVudCgkZnJhbWUpO1xyXG4gICAgICAgICAgICAkbW9kYWwubW9kYWwoJ3Nob3cnKTtcclxuICAgICAgICAgICAgc2VsZi5faW5pdFpvb21CdXR0b25zKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfem9vbVNsaWRlU2hvdzogZnVuY3Rpb24gKGRpciwgcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGJ0biA9IHNlbGYuJG1vZGFsLmZpbmQoJy5rdi16b29tLWFjdGlvbnMgLmJ0bi0nICsgZGlyKSwgJHRhcmdGcmFtZSwgaSxcclxuICAgICAgICAgICAgICAgIHRodW1icyA9IHNlbGYuZ2V0RnJhbWVzKCkudG9BcnJheSgpLCBsZW4gPSB0aHVtYnMubGVuZ3RoLCBvdXQ7XHJcbiAgICAgICAgICAgIGlmICgkYnRuLmF0dHIoJ2Rpc2FibGVkJykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICAgIGlmICgkKHRodW1ic1tpXSkuYXR0cignaWQnKSA9PT0gcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgb3V0ID0gZGlyID09PSAncHJldicgPyBpIC0gMSA6IGkgKyAxO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChvdXQgPCAwIHx8IG91dCA+PSBsZW4gfHwgIXRodW1ic1tvdXRdKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJHRhcmdGcmFtZSA9ICQodGh1bWJzW291dF0pO1xyXG4gICAgICAgICAgICBpZiAoJHRhcmdGcmFtZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFpvb21Db250ZW50KCR0YXJnRnJhbWUsIHRydWUpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9ucygpO1xyXG4gICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXpvb20nICsgZGlyLCB7J3ByZXZpZXdJZCc6IHByZXZpZXdJZCwgbW9kYWw6IHNlbGYuJG1vZGFsfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFpvb21CdXR0b246IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBzZWxmLiRwcmV2aWV3LmZpbmQoJy5rdi1maWxlLXpvb20nKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkZWwsICdjbGljaycsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl96b29tUHJldmlldygkZWwpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2lucHV0RmlsZUNvdW50OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB0aGlzLiRlbGVtZW50LmdldCgwKS5maWxlcy5sZW5ndGg7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaFByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBmaWxlcztcclxuICAgICAgICAgICAgaWYgKCghc2VsZi5faW5wdXRGaWxlQ291bnQoKSAmJiAhc2VsZi5pc0FqYXhVcGxvYWQpIHx8ICFzZWxmLnNob3dQcmV2aWV3IHx8ICFzZWxmLmlzUHJldmlld2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIGZpbGVzID0gc2VsZi5nZXRGaWxlU3RhY2soKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZXN0YWNrID0gW107XHJcbiAgICAgICAgICAgICAgICBpZiAoZmlsZXMubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZXMgPSBzZWxmLiRlbGVtZW50LmdldCgwKS5maWxlcztcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGZpbGVzID0gc2VsZi4kZWxlbWVudC5nZXQoMCkuZmlsZXM7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGZpbGVzICYmIGZpbGVzLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5yZWFkRmlsZXMoZmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0RmlsZURyb3Bab25lVGl0bGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NsZWFyT2JqZWN0czogZnVuY3Rpb24gKCRlbCkge1xyXG4gICAgICAgICAgICAkZWwuZmluZCgndmlkZW8gYXVkaW8nKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMucGF1c2UoKTtcclxuICAgICAgICAgICAgICAgICQodGhpcykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAkZWwuZmluZCgnaW1nIG9iamVjdCBkaXYnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICQodGhpcykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NsZWFyRmlsZUlucHV0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVsID0gc2VsZi4kZWxlbWVudCwgJHNyY0ZybSwgJHRtcEZybSwgJHRtcEVsO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuX2lucHV0RmlsZUNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkc3JjRnJtID0gJGVsLmNsb3Nlc3QoJ2Zvcm0nKTtcclxuICAgICAgICAgICAgJHRtcEZybSA9ICQoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZm9ybScpKTtcclxuICAgICAgICAgICAgJHRtcEVsID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSk7XHJcbiAgICAgICAgICAgICRlbC5iZWZvcmUoJHRtcEVsKTtcclxuICAgICAgICAgICAgaWYgKCRzcmNGcm0ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAkc3JjRnJtLmFmdGVyKCR0bXBGcm0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAg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YuX3Jlc2V0Q2FudmFzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuY2FjaGVJbml0aWFsUHJldmlldyA9IHt9O1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3ID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhID0ge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtdLFxyXG4gICAgICAgICAgICAgICAgICAgIGNvbmZpZzogW10sXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnczogW11cclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZXNldENhbnZhczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLmNhbnZhcyAmJiBzZWxmLmltYWdlQ2FudmFzQ29udGV4dCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5pbWFnZUNhbnZhc0NvbnRleHQuY2xlYXJSZWN0KDAsIDAsIHNlbGYuY2FudmFzLndpZHRoLCBzZWxmLmNhbnZhcy5oZWlnaHQpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaGFzSW5pdGlhbFByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gIXNlbGYub3ZlcndyaXRlSW5pdGlhbCAmJiBzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0UHJldmlldzogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIG91dCwgY2FwO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSkge1xyXG4gICAgICAgICAgICAgICAgb3V0ID0gc2VsZi5wcmV2aWV3Q2FjaGUub3V0KCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3Q29udGVudChvdXQuY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRJbml0VGh1bWJBdHRyKCk7XHJcbiAgICAgICAgICAgICAgICBjYXAgPSBzZWxmLmluaXRpYWxDYXB0aW9uID8gc2VsZi5pbml0aWFsQ2FwdGlvbiA6IG91dC5jYXB0aW9uO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0Q2FwdGlvbihjYXApO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJQcmV2aWV3KCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0Q2FwdGlvbigpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0Wm9vbSgpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jbGVhckRlZmF1bHRQcmV2aWV3OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kcHJldmlldy5maW5kKCcuZmlsZS1kZWZhdWx0LXByZXZpZXcnKS5yZW1vdmUoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZURlZmF1bHRQcmV2aWV3OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3IHx8ICRoLmlzRW1wdHkoc2VsZi5kZWZhdWx0UHJldmlld0NvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJldmlld0NvbnRlbnQoJzxkaXYgY2xhc3M9XCJmaWxlLWRlZmF1bHQtcHJldmlld1wiPicgKyBzZWxmLmRlZmF1bHRQcmV2aWV3Q29udGVudCArICc8L2Rpdj4nKTtcclxuICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLnJlbW92ZUNsYXNzKCdmaWxlLWlucHV0LW5ldycpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0Q2xpY2thYmxlKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVzZXRQcmV2aWV3VGh1bWJzOiBmdW5jdGlvbiAoaXNBamF4KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgb3V0O1xyXG4gICAgICAgICAgICBpZiAoaXNBamF4KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhclByZXZpZXcoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLl9oYXNJbml0aWFsUHJldmlldygpKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdDYWNoZS5vdXQoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdDb250ZW50KG91dC5jb250ZW50KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldEluaXRUaHVtYkF0dHIoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24ob3V0LmNhcHRpb24pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhclByZXZpZXcoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dldExheW91dFRlbXBsYXRlOiBmdW5jdGlvbiAodCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHRlbXBsYXRlID0gc2VsZi5sYXlvdXRUZW1wbGF0ZXNbdF07XHJcbiAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KHNlbGYuY3VzdG9tTGF5b3V0VGFncykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB0ZW1wbGF0ZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gJGgucmVwbGFjZVRhZ3ModGVtcGxhdGUsIHNlbGYuY3VzdG9tTGF5b3V0VGFncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0UHJldmlld1RlbXBsYXRlOiBmdW5jdGlvbiAodCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHRlbXBsYXRlID0gc2VsZi5wcmV2aWV3VGVtcGxhdGVzW3RdO1xyXG4gICAgICAgICAgICBpZiAoJGguaXNFbXB0eShzZWxmLmN1c3RvbVByZXZpZXdUYWdzKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRlbXBsYXRlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAkaC5yZXBsYWNlVGFncyh0ZW1wbGF0ZSwgc2VsZi5jdXN0b21QcmV2aWV3VGFncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0T3V0RGF0YTogZnVuY3Rpb24gKGpxWEhSLCByZXNwb25zZURhdGEsIGZpbGVzRGF0YSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGpxWEhSID0ganFYSFIgfHwge307XHJcbiAgICAgICAgICAgIHJlc3BvbnNlRGF0YSA9IHJlc3BvbnNlRGF0YSB8fCB7fTtcclxuICAgICAgICAgICAgZmlsZXNEYXRhID0gZmlsZXNEYXRhIHx8IHNlbGYuZmlsZXN0YWNrLnNsaWNlKDApIHx8IHt9O1xyXG4gICAgICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICAgICAgZm9ybTogc2VsZi5mb3JtZGF0YSxcclxuICAgICAgICAgICAgICAgIGZpbGVzOiBmaWxlc0RhdGEsXHJcbiAgICAgICAgICAgICAgICBmaWxlbmFtZXM6IHNlbGYuZmlsZW5hbWVzLFxyXG4gICAgICAgICAgICAgICAgZmlsZXNjb3VudDogc2VsZi5nZXRGaWxlc0NvdW50KCksXHJcbiAgICAgICAgICAgICAgICBleHRyYTogc2VsZi5fZ2V0RXh0cmFEYXRhKCksXHJcbiAgICAgICAgICAgICAgICByZXNwb25zZTogcmVzcG9uc2VEYXRhLFxyXG4gICAgICAgICAgICAgICAgcmVhZGVyOiBzZWxmLnJlYWRlcixcclxuICAgICAgICAgICAgICAgIGpxWEhSOiBqcVhIUlxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dldE1zZ1NlbGVjdGVkOiBmdW5jdGlvbiAobikge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHN0ckZpbGVzID0gbiA9PT0gMSA/IHNlbGYuZmlsZVNpbmdsZSA6IHNlbGYuZmlsZVBsdXJhbDtcclxuICAgICAgICAgICAgcmV0dXJuIG4gPiAwID8gc2VsZi5tc2dTZWxlY3RlZC5yZXBsYWNlKCd7bn0nLCBuKS5yZXBsYWNlKCd7ZmlsZXN9Jywgc3RyRmlsZXMpIDogc2VsZi5tc2dOb0ZpbGVzU2VsZWN0ZWQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0RnJhbWU6IGZ1bmN0aW9uIChpZCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRmcmFtZSA9ICQoJyMnICsgaWQpO1xyXG4gICAgICAgICAgICBpZiAoISRmcmFtZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZygnSW52YWxpZCB0aHVtYiBmcmFtZSB3aXRoIGlkOiBcIicgKyBpZCArICdcIi4nKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiBudWxsO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAkZnJhbWU7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0VGh1bWJzOiBmdW5jdGlvbiAoY3NzKSB7XHJcbiAgICAgICAgICAgIGNzcyA9IGNzcyB8fCAnJztcclxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RnJhbWVzKCc6bm90KC5maWxlLXByZXZpZXctaW5pdGlhbCknICsgY3NzKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRFeHRyYURhdGE6IGZ1bmN0aW9uIChwcmV2aWV3SWQsIGluZGV4KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZGF0YSA9IHNlbGYudXBsb2FkRXh0cmFEYXRhO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIHNlbGYudXBsb2FkRXh0cmFEYXRhID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBkYXRhID0gc2VsZi51cGxvYWRFeHRyYURhdGEocHJldmlld0lkLCBpbmRleCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGRhdGE7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFhocjogZnVuY3Rpb24gKHhocm9iaiwgcHJldmlld0lkLCBmaWxlQ291bnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoeGhyb2JqLnVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgeGhyb2JqLnVwbG9hZC5hZGRFdmVudExpc3RlbmVyKCdwcm9ncmVzcycsIGZ1bmN0aW9uIChldmVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBwY3QgPSAwLCB0b3RhbCA9IGV2ZW50LnRvdGFsLCBwb3NpdGlvbiA9IGV2ZW50LmxvYWRlZCB8fCBldmVudC5wb3NpdGlvbjtcclxuICAgICAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBldmVudC5sZW5ndGhDb21wdXRhYmxlICovXHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50Lmxlbmd0aENvbXB1dGFibGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcGN0ID0gTWF0aC5mbG9vcihwb3NpdGlvbiAvIHRvdGFsICogMTAwKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByZXZpZXdJZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRBc3luY1VwbG9hZFN0YXR1cyhwcmV2aWV3SWQsIHBjdCwgZmlsZUNvdW50KTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzcyhwY3QpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0sIGZhbHNlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4geGhyb2JqO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRBamF4U2V0dGluZ3M6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHN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XBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBzZXR0aW5nc1tmdW5jTmFtZV0gPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNyY0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2V0dGluZ3NbZnVuY05hbWVdID0gc3JjRnVuYztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2FqYXhTdWJtaXQ6IGZ1bmN0aW9uIChmbkJlZm9yZSwgZm5TdWNjZXNzLCBmbkNvbXBsZXRlLCBmbkVycm9yLCBwcmV2aWV3SWQsIGluZGV4KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgc2V0dGluZ3MsIHZVcmw7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVwcmVhamF4JywgW3ByZXZpZXdJZCwgaW5kZXhdKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3VwbG9hZEV4dHJhKHByZXZpZXdJZCwgaW5kZXgpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0QWpheFNldHRpbmdzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX21lcmdlQWpheENhbGxiYWNrKCdiZWZvcmVTZW5kJywgZm5CZWZvcmUpO1xyXG4gICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnc3VjY2VzcycsIGZuU3VjY2Vzcyk7XHJcbiAgICAgICAgICAgIHNlbGYuX21lcmdlQWpheENhbGxiYWNrKCdjb21wbGV0ZScsIGZuQ29tcGxldGUpO1xyXG4gICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnZXJyb3InLCBmbkVycm9yKTtcclxuICAgICAgICAgICAgdlVybCA9IGluZGV4ICYmIHNlbGYudXBsb2FkVXJsVGh1bWIgPyBzZWxmLnVwbG9hZFVybFRodW1iIDogc2VsZi51cGxvYWRVcmw7XHJcbiAgICAgICAgICAgIHNldHRpbmdzID0gJC5leHRlbmQodHJ1ZSwge30sIHtcclxuICAgICAgICAgICAgICAgIHhocjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciB4aHJvYmogPSAkLmFqYXhTZXR0aW5ncy54aHIoKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2VsZi5faW5pdFhocih4aHJvYmosIHByZXZpZXdJZCwgc2VsZi5nZXRGaWxlU3RhY2soKS5sZW5ndGgpO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHVybDogc2VsZi5fZW5jb2RlVVJJKHZVcmwpLFxyXG4gICAgICAgICAgICAgICAgdHlwZTogJ1BPU1QnLFxyXG4gICAgICAgICAgICAgICAgZGF0YVR5cGU6ICdqc29uJyxcclxuICAgICAgICAgICAgICAgIGRhdGE6IHNlbGYuZm9ybWRhdGEsXHJcbiAgICAgICAgICAgICAgICBjYWNoZTogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBwcm9jZXNzRGF0YTogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBjb250ZW50VHlwZTogZmFsc2VcclxuICAgICAgICAgICAgfSwgc2VsZi5fYWpheFNldHRpbmdzKTtcclxuICAgICAgICAgICAgc2VsZi5hamF4UmVxdWVzdHMucHVzaCgkLmFqYXgoc2V0dGluZ3MpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9tZXJnZUFycmF5OiBmdW5jdGlvbiAocHJvcCwgY29udGVudCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGFycjEgPSAkaC5jbGVhbkFycmF5KHNlbGZbcHJvcF0pLCBhcnIyID0gJGguY2xlYW5BcnJheShjb250ZW50KTtcclxuICAgICAgICAgICAgc2VsZltwcm9wXSA9IGFycjEuY29uY2F0KGFycjIpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRVcGxvYWRTdWNjZXNzOiBmdW5jdGlvbiAob3V0LCAkdGh1bWIsIGFsbEZpbGVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgYXBwZW5kLCBkYXRhLCBpbmRleCwgJGRpdiwgJG5ld0NhY2hlLCBjb250ZW50LCBjb25maWcsIHRhZ3MsIGk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5zaG93UHJldmlldyB8fCB0eXBlb2Ygb3V0ICE9PSAnb2JqZWN0JyB8fCAkLmlzRW1wdHlPYmplY3Qob3V0KSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChvdXQuaW5pdGlhbFByZXZpZXcgIT09IHVuZGVmaW5lZCAmJiBvdXQuaW5pdGlhbFByZXZpZXcubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5oYXNJbml0RGF0YSA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBjb250ZW50ID0gb3V0LmluaXRpYWxQcmV2aWV3IHx8IFtdO1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gb3V0LmluaXRpYWxQcmV2aWV3Q29uZmlnIHx8IFtdO1xyXG4gICAgICAgICAgICAgICAgdGFncyA9IG91dC5pbml0aWFsUHJldmlld1RodW1iVGFncyB8fCBbXTtcclxuICAgICAgICAgICAgICAgIGFwcGVuZCA9IG91dC5hcHBlbmQgPT09IHVuZGVmaW5lZCB8fCBvdXQuYXBwZW5kO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvbnRlbnQubGVuZ3RoID4gMCAmJiAhJGguaXNBcnJheShjb250ZW50KSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQgPSBjb250ZW50LnNwbGl0KHNlbGYuaW5pdGlhbFByZXZpZXdEZWxpbWl0ZXIpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fbWVyZ2VBcnJheSgnaW5pdGlhbFByZXZpZXcnLCBjb250ZW50KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX21lcmdlQXJyYXkoJ2luaXRpYWxQcmV2aWV3Q29uZmlnJywgY29uZmlnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX21lcmdlQXJyYXkoJ2luaXRpYWxQcmV2aWV3VGh1bWJUYWdzJywgdGFncyk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJHRodW1iICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWFsbEZpbGVzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gc2VsZi5wcmV2aWV3Q2FjaGUuYWRkKGNvbnRlbnQsIGNvbmZpZ1swXSwgdGFnc1swXSwgYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmdldChpbmRleCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZGl2ID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSkuaHRtbChkYXRhKS5oaWRlKCkuaW5zZXJ0QWZ0ZXIoJHRodW1iKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJG5ld0NhY2hlID0gJGRpdi5maW5kKCcua3Ytem9vbS1jYWNoZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJG5ld0NhY2hlICYmICRuZXdDYWNoZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRuZXdDYWNoZS5pbnNlcnRBZnRlcigkdGh1bWIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5mYWRlT3V0KCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyICRuZXdUaHVtYiA9ICRkaXYuZmluZCgnLmZpbGUtcHJldmlldy1mcmFtZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRuZXdUaHVtYiAmJiAkbmV3VGh1bWIubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJG5ld1RodW1iLmluc2VydEJlZm9yZSgkdGh1bWIpLmZhZGVJbignc2xvdycpLmNzcygnZGlzcGxheTppbmxpbmUtYmxvY2snKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3QWN0aW9ucygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNsZWFuWm9vbUNhY2hlKHNlbGYuJHByZXZpZXcuZmluZCgnI3pvb20tJyArICR0aHVtYi5hdHRyKCdpZCcpKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZGl2LnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSAkdGh1bWIuYXR0cignZGF0YS1maWxlaW5kZXgnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb250ZW50W2ldID0gY29udGVudFswXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb25maWdbaV0gPSBjb25maWdbMF0gfHwgW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQ2FjaGUudGFnc1tpXSA9IHRhZ3NbMF0gfHwgW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQ2FjaGUuYXBwZW5kID0gYXBwZW5kO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuc2V0KGNvbnRlbnQsIGNvbmZpZywgdGFncywgYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3QWN0aW9ucygpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFN1Y2Nlc3NUaHVtYnM6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9nZXRUaHVtYnMoJGguRlJBTUVTICsgJy5maWxlLXByZXZpZXctc3VjY2VzcycpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldywgJHJlbW92ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICRyZW1vdmUucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHJlbW92ZSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBpZCA9ICR0aHVtYi5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLl9yYWlzZSgnZmlsZXN1Y2Nlc3NyZW1vdmUnLCBbaWQsICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGguY2xlYW5NZW1vcnkoJHRodW1iKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAob3V0ID09PSBmYWxzZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5mYWRlT3V0KCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkaC5jbGVhblpvb21DYWNoZSgkcHJldmlldy5maW5kKCcjem9vbS0nICsgaWQpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuZ2V0RnJhbWVzKCkubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJlc2V0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jaGVja0FzeW5jQ29tcGxldGU6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBwcmV2aWV3SWQsIGk7XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzZWxmLmZpbGVzdGFjay5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuZmlsZXN0YWNrW2ldKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcHJldmlld0lkID0gc2VsZi5wcmV2aWV3SW5pdElkICsgJy0nICsgaTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJC5pbkFycmF5KHByZXZpZXdJZCwgc2VsZi51cGxvYWRMb2cpID09PSAtMSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAoc2VsZi51cGxvYWRBc3luY0NvdW50ID09PSBzZWxmLnVwbG9hZExvZy5sZW5ndGgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwbG9hZEV4dHJhOiBmdW5jdGlvbiAocHJldmlld0lkLCBpbmRleCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGRhdGEgPSBzZWxmLl9nZXRFeHRyYURhdGEocHJldmlld0lkLCBpbmRleCk7XHJcbiAgICAgICAgICAgIGlmIChkYXRhLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICQuZWFjaChkYXRhLCBmdW5jdGlvbiAoa2V5LCB2YWx1ZSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5mb3JtZGF0YS5h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LXVwbG9hZCcpO1xyXG4gICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICRwcm9nLnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAodG90YWwgPT09IDAgfHwgIWhhc1Bvc3REYXRhIHx8ICgkYnRuVXBsb2FkICYmICRidG5VcGxvYWQuaGFzQ2xhc3MoJ2Rpc2FibGVkJykpIHx8IHNlbGYuX2Fib3J0KHBhcmFtcykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB1cGRhdGVVcGxvYWRMb2cgPSBmdW5jdGlvbiAoaSwgcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXVwbG9hZEZhaWxlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkTG9nLnB1c2gocHJldmlld0lkKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9jaGVja0FzeW5jQ29tcGxldGUoKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgY2hrQ29tcGxldGUgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgdSA9IHNlbGYudXBsb2FkQ2FjaGUsICRpbml0VGh1bWJzLCBpLCBqLCBsZW4gPSAwLCBkYXRhID0gc2VsZi5jYWNoZUluaXRpYWxQcmV2aWV3O1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLmZpbGVCYXRjaENvbXBsZXRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChkYXRhICYmIGRhdGEuY29udGVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGxlbiA9IGRhdGEuY29udGVudC5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgdHJpZ2dlclJlc2V0ID0gc2VsZi5nZXRGaWxlU3RhY2sodHJ1ZSkubGVuZ3RoID09PSAwO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLnNldCh1LmNvbnRlbnQsIHUuY29uZmlnLCB1LnRhZ3MsIHUuYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHUuY29udGVudC5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPSBpICsgbGVuO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29udGVudFtqXSA9IHUuY29udGVudFtpXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBKU1VucmVzb2x2ZWRWYXJpYWJsZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmNvbmZpZy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWdbal0gPSB1LmNvbmZpZ1tpXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEudGFncy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS50YWdzW2pdID0gdS50YWdzW2ldO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXcgPSAkaC5jbGVhbkFycmF5KGRhdGEuY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnID0gJGguY2xlYW5BcnJheShkYXRhLmNvbmZpZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gJGguY2xlYW5BcnJheShkYXRhLnRhZ3MpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlldyA9IHUuY29udGVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdDb25maWcgPSB1LmNvbmZpZztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdUaHVtYlRhZ3MgPSB1LnRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jYWNoZUluaXRpYWxQcmV2aWV3ID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmhhc0luaXREYXRhKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51bmxvY2sodHJpZ2dlclJlc2V0KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAodHJpZ2dlclJlc2V0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRpbml0VGh1bWJzID0gc2VsZi4kcHJldmlldy5maW5kKCcuZmlsZS1wcmV2aWV3LWluaXRpYWwnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi51cGxvYWRBc3luYyAmJiAkaW5pdFRodW1icy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRpbml0VGh1bWJzLCAkaC5TT1JUX0NTUyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRTb3J0YWJsZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNodXBsb2FkY29tcGxldGUnLCBbc2VsZi5maWxlc3RhY2ssIHNlbGYuX2dldEV4dHJhRGF0YSgpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDb3VudCA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRTdGF0dXMgPSB7fTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5hamF4QWJvcnRlZCA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJHRodW1iLmhhc0NsYXNzKCdmaWxlLXByZXZpZXctc3VjY2VzcycpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0xvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCR0aHVtYiwgJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQuYXR0cignZGlzYWJsZWQnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAkYnRuRGVsZXRlLmF0dHIoJ2Rpc2FibGVkJywgdHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlcHJldXBsb2FkJywgW291dERhdGEsIHByZXZpZXdJZCwgaV0pO1xyXG4gICAgICAgICAgICAgICAgJC5leHRlbmQodHJ1ZSwgcGFyYW1zLCBvdXREYXRhKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydChwYXJhbXMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAganFYSFIuYWJvcnQoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJTdGF0dXMoJHRodW1iLCAnTmV3Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0blVwbG9hZC5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYnRuRGVsZXRlLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudW5sb2NrKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuU3VjY2VzcyA9IGZ1bmN0aW9uIChkYXRhLCB0ZXh0U3RhdHVzLCBqcVhIUikge1xyXG4gICAgICAgICAgICAgICAgdmFyIHBpZCA9IHNlbGYuc2hvd1ByZXZpZXcgJiYgJHRodW1iLmF0dHIoJ2lkJykgPyAkdGh1bWIuYXR0cignaWQnKSA6IHByZXZpZXdJZDtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSLCBkYXRhKTtcclxuICAgICAgICAgICAgICAgICQuZXh0ZW5kKHRydWUsIHBhcmFtcywgb3V0RGF0YSk7XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhKSB8fCAkaC5pc0VtcHR5KGRhdGEuZXJyb3IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRUaHVtYlN0YXR1cygkdGh1bWIsICdTdWNjZXNzJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuVXBsb2FkLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRVcGxvYWRTdWNjZXNzKGRhdGEsICR0aHVtYiwgaXNCYXRjaCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzcygxMDEsICRwcm9nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXVwbG9hZGVkJywgW291dERhdGEsIHBpZCwgaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVVwbG9hZExvZyhpLCBwaWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdXBsb2FkRmFpbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIHBhcmFtcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdFcnJvcigkdGh1bWIsIGksIHNlbGYuZmlsZXN0YWNrW2ldLCBzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuVXBsb2FkLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNCYXRjaCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlVXBsb2FkTG9nKGksIHBpZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCAkKCcjJyArIHBpZCkuZmluZCgnLmZpbGUtdGh1bWItcHJvZ3Jlc3MnKSwgc2VsZi5tc2dVcGxvYWRFcnJvcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5Db21wbGV0ZSA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghaXNCYXRjaCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnVubG9jayhmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2hrQ29tcGxldGUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFN1Y2Nlc3NUaHVtYnMoKTtcclxuICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuRXJyb3IgPSBmdW5jdGlvbiAoanFYSFIsIHRleHRTdGF0dXMsIGVycm9yVGhyb3duKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgb3AgPSBzZWxmLmFqYXhPcGVyYXRpb25zLnVwbG9hZFRodW1iLFxyXG4gICAgICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bixcclxuICAgICAgICAgICAgICAgICAgICAgICAgKGlzQmF0Y2ggJiYgc2VsZi5maWxlc3RhY2tbaV0ubmFtZSA/IHNlbGYuZmlsZXN0YWNrW2ldLm5hbWUgOiBudWxsKSk7XHJcbiAgICAgICAgICAgICAgICB1cGxvYWRGYWlsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlVXBsb2FkTG9nKGksIHByZXZpZXdJZCk7XHJcbiAgICAg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PSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYubG9jaygpO1xyXG4gICAgICAgICAgICAgICAgdmFyIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciAkdGh1bWIgPSAkKHRoaXMpLCAkYnRuVXBsb2FkID0gJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEkdGh1bWIuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1zdWNjZXNzJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0xvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmFkZENzcygkdGh1bWIsICdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQuYXR0cignZGlzYWJsZWQnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5hdHRyKCdkaXNhYmxlZCcsIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHByZXVwbG9hZCcsIFtvdXREYXRhXSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5fYWJvcnQob3V0RGF0YSkpIHtcclxuICAgICAgICAgICAgICAgICAgICBqcVhIUi5hYm9ydCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgJHRodW1iID0gJCh0aGlzKSwgJGJ0blVwbG9hZCA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRidG5EZWxldGUgPSAkdGh1bWIuZmluZCgnLmt2LWZpbGUtcmVtb3ZlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkdGh1bWIuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1sb2FkaW5nJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ05ldycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuU3VjY2VzcyA9IGZ1bmN0aW9uIChkYXRhLCB0ZXh0U3RhdHVzLCBqcVhIUikge1xyXG4gICAgICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZGF0YS5lcnJvcmtleXMgKi9cclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUiwgZGF0YSksIGtleSA9IDAsXHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1icyA9IHNlbGYuX2dldFRodW1icygnOm5vdCguZmlsZS1wcmV2aWV3LXN1Y2Nlc3MpJyksXHJcbiAgICAgICAgICAgICAgICAgICAga2V5cyA9ICRoLmlzRW1wdHkoZGF0YSkgfHwgJGguaXNFbXB0eShkYXRhLmVycm9ya2V5cykgPyBbXSA6IGRhdGEuZXJyb3JrZXlzO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KGRhdGEpIHx8ICRoLmlzRW1wdHkoZGF0YS5lcnJvcikpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNodXBsb2Fkc3VjY2VzcycsIFtvdXREYXRhXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2V0QWxsVXBsb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWJzLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRUaHVtYlN0YXR1cygkdGh1bWIsICdTdWNjZXNzJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIuZmluZCgnLmt2LWZpbGUtdXBsb2FkJykuaGlkZSgpLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0VXBsb2FkU3VjY2VzcyhkYXRhKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJlc2V0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYnMuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgJHRodW1iID0gJCh0aGlzKSwgaSA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIuZmluZCgnLmt2LWZpbGUtcmVtb3ZlJykucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrZXlzLmxlbmd0aCA9PT0gMCB8fCAkLmluQXJyYXkoa2V5LCBrZXlzKSAhPT0gLTEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpLCBzZWxmLmZpbGVzdGFja1tpXSwgc2VsZi5yZXRyeUVycm9yVXBsb2Fkcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJTdGF0dXMoJHRodW1iLCAnU3VjY2VzcycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghJHRodW1iLmhhc0NsYXNzKCdmaWxlLXByZXZpZXctZXJyb3InKSB8fCBzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5Kys7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0VXBsb2FkU3VjY2VzcyhkYXRhKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIG91dERhdGEsICdmaWxlYmF0Y2h1cGxvYWRlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSwgc2VsZi4kcHJvZ3Jlc3MsIHNlbGYubXNnVXBsb2FkRXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkNvbXBsZXRlID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi51bmxvY2soKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRTdWNjZXNzVGh1bWJzKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHVwbG9hZGNvbXBsZXRlJywgW3NlbGYuZmlsZXN0YWNrLCBzZWxmLl9nZXRFeHRyYURhdGEoKV0pO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkVycm9yID0gZnVuY3Rpb24gKGpxWEhSLCB0ZXh0U3RhdHVzLCBlcnJvclRocm93bikge1xyXG4gICAgICAgICAgICAgICAgdmFyIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKSwgb3AgPSBzZWxmLmFqYXhPcGVyYXRpb25zLnVwbG9hZEJhdGNoLFxyXG4gICAgICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93VXBsb2FkRXJyb3IoZXJyTXNnLCBvdXREYXRhLCAnZmlsZWJhdGNodXBsb2FkZXJyb3InKTtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkRmlsZUNvdW50ID0gdG90YWwgLSAxO1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGtleSA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5maWxlc3RhY2tba2V5XSAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdFcnJvcigkdGh1bWIpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9nZXRUaHVtYnMoJyAua3YtZmlsZS11cGxvYWQnKS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCcgLmt2LWZpbGUtZGVsZXRlJykucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSwgc2VsZi4kcHJvZ3Jlc3MsIHNlbGYubXNnQWpheFByb2dyZXNzRXJyb3IucmVwbGFjZSgne29wZXJhdGlvbn0nLCBvcCkpO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uIChrZXksIGRhdGEpIHtcclxuICAgICAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShmaWxlc1trZXldKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuZm9ybWRhdGEuYXBwZW5kKHNlbGYudXBsb2FkRmlsZUF0dHIsIGRhdGEsIHNlbGYuZmlsZW5hbWVzW2tleV0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgc2VsZi5fYWpheFN1Ym1pdChmbkJlZm9yZSwgZm5TdWNjZXNzLCBmbkNvbXBsZXRlLCBmbkVycm9yKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF91cGxvYWRFeHRyYU9ubHk6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBwYXJhbXMgPSB7fSwgZm5CZWZvcmUsIGZuU3VjY2VzcywgZm5Db21wbGV0ZSwgZm5FcnJvcjtcclxuICAgICAgICAgICAgc2VsZi5mb3JtZGF0YSA9IG5ldyBGb3JtRGF0YSgpO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5fYWJvcnQocGFyYW1zKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZuQmVmb3JlID0gZnVuY3Rpb24gKGpxWEhSKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNocHJldXBsb2FkJywgW291dERhdGFdKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDUwKTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy5kYXRhID0gb3V0RGF0YTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy54aHIgPSBqcVhIUjtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydChwYXJhbXMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAganFYSFIuYWJvcnQoKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzc0NhbmNlbGxlZCgpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmblN1Y2Nlc3MgPSBmdW5jdGlvbiAoZGF0YSwgdGV4dFN0YXR1cywganFYSFIpIHtcclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUiwgZGF0YSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhKSB8fCAkaC5pc0VtcHR5KGRhdGEuZXJyb3IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHVwbG9hZHN1Y2Nlc3MnLCBbb3V0RGF0YV0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFVwbG9hZFN1Y2Nlc3MoZGF0YSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIG91dERhdGEsICdmaWxlYmF0Y2h1cGxvYWRlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkNvbXBsZXRlID0gZnVuY3Rpb24gKCkge1xyXG4g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WxmID0gdGhpcywgaW5kID0gJGZyYW1lLmF0dHIoJ2RhdGEtZmlsZWluZGV4JyksIHJldiA9IHNlbGYucmV2ZXJzZVByZXZpZXdPcmRlcjtcclxuICAgICAgICAgICAgaWYgKGluZC5zdWJzdHJpbmcoMCwgNSkgPT09ICdpbml0XycpIHtcclxuICAgICAgICAgICAgICAgIGluZCA9IHBhcnNlSW50KGluZC5yZXBsYWNlKCdpbml0XycsICcnKSk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3ID0gJGguc3BsaWNlQXJyYXkoc2VsZi5pbml0aWFsUHJldmlldywgaW5kLCByZXYpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9ICRoLnNwbGljZUFycmF5KHNlbGYuaW5pdGlhbFByZXZpZXdDb25maWcsIGluZCwgcmV2KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdUaHVtYlRhZ3MgPSAkaC5zcGxpY2VBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzLCBpbmQsIHJldik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmdldEZyYW1lcygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciAkbkZyYW1lID0gJCh0aGlzKSwgbkluZCA9ICRuRnJhbWUuYXR0cignZGF0YS1maWxlaW5kZXgnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAobkluZC5zdWJzdHJpbmcoMCwgNSkgPT09ICdpbml0XycpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgbkluZCA9IHBhcnNlSW50KG5JbmQucmVwbGFjZSgnaW5pdF8nLCAnJykpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobkluZCA+IGluZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbkluZC0tO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJG5GcmFtZS5hdHRyKCdkYXRhLWZpbGVpbmRleCcsICdpbml0XycgKyBuSW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYudXBsb2FkQXN5bmMpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNhY2hlSW5pdGlhbFByZXZpZXcgPSBzZWxmLmdldFByZXZpZXcoKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRGaWxlQWN0aW9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5faW5pdFpvb21CdXR0b24oKTtcclxuICAgICAgICAgICAgc2VsZi5nZXRGcmFtZXMoJyAua3YtZmlsZS1yZW1vdmUnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpLCAkZnJhbWUgPSAkZWwuY2xvc2VzdCgkaC5GUkFNRVMpLCBoYXNFcnJvciwgaWQgPSAkZnJhbWUuYXR0cignaWQnKSxcclxuICAgICAgICAgICAgICAgICAgICBpbmQgPSAkZnJhbWUuYXR0cignZGF0YS1maWxlaW5kZXgnKSwgbiwgY2FwLCBzdGF0dXM7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRlbCwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IHNlbGYuX3JhaXNlKCdmaWxlcHJlcmVtb3ZlJywgW2lkLCBpbmRdKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzID09PSBmYWxzZSB8fCAhc2VsZi5fdmFsaWRhdGVNaW5Db3VudCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaGFzRXJyb3IgPSAkZnJhbWUuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1lcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgICRoLmNsZWFuTWVtb3J5KCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLmZhZGVPdXQoJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRoLmNsZWFuWm9vbUNhY2hlKCRwcmV2aWV3LmZpbmQoJyN6b29tLScgKyBpZCkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGluZCwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJPYmplY3RzKCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRmcmFtZS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlkICYmIGhhc0Vycm9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5maW5kKCdsaVtkYXRhLXRodW1iLWlkPVwiJyArIGlkICsgJ1wiXScpLmZhZGVPdXQoJ2Zhc3QnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuX2Vycm9yc0V4aXN0KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnMoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmlsZXN0YWNrID0gc2VsZi5nZXRGaWxlU3RhY2sodHJ1ZSksIGNoayA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gPSBmaWxlc3RhY2subGVuZ3RoLCBoYXNUaHVtYiA9IHNlbGYuc2hvd1ByZXZpZXcgJiYgc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPT09IDAgJiYgY2hrID09PSAwICYmICFoYXNUaHVtYikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5yZXNldCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGNoayArIGxlbjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhcCA9IG4gPiAxID8gc2VsZi5fZ2V0TXNnU2VsZWN0ZWQobikgOiAoZmlsZXN0YWNrWzBdID8gc2VsZi5fZ2V0RmlsZU5hbWVzKClbMF0gOiAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGNhcCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVyZW1vdmVkJywgW2lkLCBpbmRdKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgc2VsZi5nZXRGcmFtZXMoJyAua3YtZmlsZS11cGxvYWQnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkZWwsICdjbGljaycsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgJGZyYW1lID0gJGVsLmNsb3Nlc3QoJGguRlJBTUVTKSwgaW5kID0gJGZyYW1lLmF0dHIoJ2RhdGEtZmlsZWluZGV4Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kcHJvZ3Jlc3MuaGlkZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZnJhbWUuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1lcnJvcicpICYmICFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBsb2FkU2luZ2xlKGluZCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3QWN0aW9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldywgZGVsZXRlRXh0cmFEYXRhID0gc2VsZi5kZWxldGVFeHRyYURhdGEgfHwge30sXHJcbiAgICAgICAgICAgICAgICBidG5SZW1vdmUgPSAkaC5GUkFNRVMgKyAnIC5rdi1maWxlLXJlbW92ZScsIHNldHRpbmdzID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3MsXHJcbiAgICAgICAgICAgICAgICBvcmlnQ2xhc3MgPSBzZXR0aW5ncy5yZW1vdmVDbGFzcywgZXJyQ2xhc3MgPSBzZXR0aW5ncy5yZW1vdmVFcnJvckNsYXNzLFxyXG4gICAgICAgICAgICAgICAgcmVzZXRQcm9ncmVzcyA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgaGFzRmlsZXMgPSBzZWxmLmlzQWpheFVwbG9hZCA/IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCkgOiBzZWxmLl9pbnB1dEZpbGVDb3VudCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJHByZXZpZXcuZmluZCgkaC5GUkFNRVMpLmxlbmd0aCAmJiAhaGFzRmlsZXMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0Q2FwdGlvbignJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucmVzZXQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsQ2FwdGlvbiA9ICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9uKCk7XHJcbiAgICAgICAgICAgICRwcmV2aWV3LmZpbmQoYnRuUmVtb3ZlKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpLCB2VXJsID0gJGVsLmRhdGEoJ3VybCcpIHx8IHNlbGYuZGVsZXRlVXJsLCB2S2V5ID0gJGVsLmRhdGEoJ2tleScpLFxyXG4gICAgICAgICAgICAgICAgICAgIGZuQmVmb3JlLCBmblN1Y2Nlc3MsIGZuRXJyb3I7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eSh2VXJsKSB8fCB2S2V5ID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB2YXIgJGZyYW1lID0gJGVsLmNsb3Nlc3QoJGguRlJBTUVTKSwgY2FjaGUgPSBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLFxyXG4gICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLCBwYXJhbXMsIGluZGV4ID0gJGZyYW1lLmF0dHIoJ2RhdGEtZmlsZWluZGV4JyksIGNvbmZpZywgZXh0cmFEYXRhO1xyXG4gICAgICAgICAgICAgICAgaW5kZXggPSBwYXJzZUludChpbmRleC5yZXBsYWNlKCdpbml0XycsICcnKSk7XHJcbiAgICAgICAgICAgICAgICBjb25maWcgPSAkaC5pc0VtcHR5KGNhY2hlLmNvbmZpZykgJiYgJGguaXNFbXB0eShjYWNoZS5jb25maWdbaW5kZXhdKSA/IG51bGwgOiBjYWNoZS5jb25maWdbaW5kZXhdO1xyXG4gICAgICAgICAgICAgICAgZXh0cmFEYXRhID0gJGguaXNFbXB0eShjb25maWcpIHx8ICRoLmlzRW1wdHkoY29uZmlnLmV4dHJhKSA/IGRlbGV0ZUV4dHJhRGF0YSA6IGNvbmZpZy5leHRyYTtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZXh0cmFEYXRhID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZXh0cmFEYXRhID0gZXh0cmFEYXRhKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBwYXJhbXMgPSB7aWQ6ICRlbC5hdHRyKCdpZCcpLCBrZXk6IHZLZXksIGV4dHJhOiBleHRyYURhdGF9O1xyXG4gICAgICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVwcmVkZWxldGUnLCBbdktleSwganFYSFIsIGV4dHJhRGF0YV0pO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGpxWEhSLmFib3J0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGVsLnJlbW92ZUNsYXNzKGVyckNsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRmcmFtZSwgJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRoLmFkZENzcygkZWwsICdkaXNhYmxlZCAnICsgb3JpZ0NsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgZm5TdWNjZXNzID0gZnVuY3Rpb24gKGRhdGEsIHRleHRTdGF0dXMsIGpxWEhSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGNhcDtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoZGF0YSkgJiYgISRoLmlzRW1wdHkoZGF0YS5lcnJvcikpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmpxWEhSID0ganFYSFI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5yZXNwb25zZSA9IGRhdGE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dFcnJvcihkYXRhLmVycm9yLCBwYXJhbXMsICdmaWxlZGVsZXRlZXJyb3InKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGZyYW1lLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZWwucmVtb3ZlQ2xhc3MoJ2Rpc2FibGVkICcgKyBvcmlnQ2xhc3MpLmFkZENsYXNzKGVyckNsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXRQcm9ncmVzcygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRmcmFtZS5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKS5hZGRDbGFzcygnZmlsZS1kZWxldGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLmZhZGVPdXQoJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gcGFyc2VJbnQoKCRmcmFtZS5hdHRyKCdkYXRhLWZpbGVpbmRleCcpKS5yZXBsYWNlKCdpbml0XycsICcnKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLnVuc2V0KGluZGV4KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fZGVsZXRlRmlsZUluZGV4KCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXAgPSBuID4gMCA/IHNlbGYuX2dldE1zZ1NlbGVjdGVkKG4pIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24oY2FwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVkZWxldGVkJywgW3ZLZXksIGpxWEhSLCBleHRyYURhdGFdKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguY2xlYW5ab29tQ2FjaGUoJHByZXZpZXcuZmluZCgnI3pvb20tJyArICRmcmFtZS5hdHRyKCdpZCcpKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyT2JqZWN0cygkZnJhbWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZnJhbWUucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc2V0UHJvZ3Jlc3MoKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBmbkVycm9yID0gZnVuY3Rpb24gKGpxWEhSLCB0ZXh0U3RhdHVzLCBlcnJvclRocm93bikge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBvcCA9IHNlbGYuYWpheE9wZXJhdGlvbnMuZGVsZXRlVGh1bWIsIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bik7XHJcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmpxWEhSID0ganFYSFI7XHJcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zLnJlc3BvbnNlID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd0Vycm9yKGVyck1zZywgcGFyYW1zLCAnZmlsZWRlbGV0ZWVycm9yJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICRlbC5yZW1vdmVDbGFzcygnZGlzYWJsZWQgJyArIG9yaWdDbGFzcykuYWRkQ2xhc3MoZXJyQ2xhc3MpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJlc2V0UHJvZ3Jlc3MoKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0QWpheFNldHRpbmdzKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnYmVmb3JlU2VuZCcsIGZuQmVmb3JlLCAnZGVsZXRlJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnc3VjY2VzcycsIGZuU3VjY2VzcywgJ2RlbGV0ZScpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fbWVyZ2VBamF4Q2FsbGJhY2soJ2Vycm9yJywgZm5FcnJvciwgJ2RlbGV0ZScpO1xyXG4gICAgICAgICAgICAgICAgc2V0dGluZ3MgPSAkLmV4dGVuZCh0cnVlLCB7fSwge1xyXG4gICAgICAgICAgICAgICAgICAgIHVybDogc2VsZi5fZW5jb2RlVVJJKHZVcmwpLFxyXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6ICdQT1NUJyxcclxuICAgICAgICAgICAgICAgICAgICBkYXRhVHlwZTogJ2pzb24nLFxyXG4gICAgICAgICAgICAgICAgICAgIGRhdGE6ICQuZXh0ZW5kKHRydWUsIHt9LCB7a2V5OiB2S2V5fSwgZXh0cmFEYXRhKVxyXG4gICAgICAgICAgICAgICAgfSwgc2VsZi5fYWpheERlbGV0ZVNldHRpbmdzKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLl92YWxpZGF0ZU1pbkNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViZWZvcmVkZWxldGUnLCBbdktleSwgZXh0cmFEYXRhXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSlNVbnJlc29sdmVkVmFyaWFibGUsSlNIaW50XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlbGYuYWpheEFib3J0ZWQgaW5zdGFuY2VvZiBQcm9taXNlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQudGhlbihmdW5jdGlvbiAocmVzdWx0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQuYWpheChzZXR0aW5ncyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5hamF4QWJvcnRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJC5hamF4KHNldHRpbmdzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9oaWRlRmlsZUljb246IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Nob3dGaWxlSWNvbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjYXB0aW9uQ29udGFpbmVyLCAnaWNvbi12aXNpYmxlJyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0U2l6ZTogZnVuY3Rpb24gKGJ5dGVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgc2l6ZSA9IHBhcnNlRmxvYXQoYnl0ZXMpLCBpLCBmdW5jID0gc2VsZi5maWxlU2l6ZUdldHRlciwgc2l6ZXMsIG91dDtcclxuICAgICAgICAgICAgaWYgKCEkLmlzTnVtZXJpYyhieXRlcykgfHwgISQuaXNOdW1lcmljKHNpemUpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBmdW5jID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBmdW5jKHNpemUpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKHNpemUgPT09IDApIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSAnMC4wMCBCJztcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaSA9IE1hdGguZmxvb3IoTWF0aC5sb2coc2l6ZSkgLyBNYXRoLmxvZygxMDI0KSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2l6ZXMgPSBbJ0InLCAnS0InLCAnTUInLCAnR0InLCAnVEInLCAnUEInLCAnRUInLCAnWkInLCAnWUInXTtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSAoc2l6ZSAvIE1hdGgucG93KDEwMjQsIGkpKS50b0ZpeGVkKDIpICogMSArICcgJyArIHNpemVzW2ldO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnc2l6ZScpLn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HJldmlld1NldHRpbmdzU21hbGxbY2F0XSkgOlxyXG4gICAgICAgICAgICAgICAgICAgIChzZWxmLnByZXZpZXdTZXR0aW5nc1tjYXRdIHx8IHNlbGYuZGVmYXVsdHMucHJldmlld1NldHRpbmdzW2NhdF0pLCB0aXRsZSA9IGNhcHRpb24sIGFsdCA9IGNhcHRpb24sXHJcbiAgICAgICAgICAgICAgICBmb290ZXIgPSBmb290IHx8IHNlbGYuX3JlbmRlckZpbGVGb290ZXIoY2FwdGlvbiwgc2l6ZSwgJ2F1dG8nLCBpc0Vycm9yKSxcclxuICAgICAgICAgICAgICAgIGhhc0ljb25TZXR0aW5nID0gc2VsZi5fZ2V0UHJldmlld0ljb24oZm5hbWUpLCB0eXBlQ3NzID0gJ3R5cGUtZGVmYXVsdCcsXHJcbiAgICAgICAgICAgICAgICBmb3JjZVByZXZJY29uID0gaGFzSWNvblNldHRpbmcgJiYgc2VsZi5wcmVmZXJJY29uaWNQcmV2aWV3LFxyXG4gICAgICAgICAgICAgICAgZm9yY2Vab29tSWNvbiA9IGhhc0ljb25TZXR0aW5nICYmIHNlbGYucHJlZmVySWNvbmljWm9vbVByZXZpZXcsIGdldENvbnRlbnQ7XHJcbiAgICAgICAgICAgIGlmIChjb25maWcpIHtcclxuICAgICAgICAgICAgICAgICQuZWFjaChjb25maWcsIGZ1bmN0aW9uIChrZXksIHZhbCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHN0eWxlQXR0cmlicyArPSBrZXkgKyAnOicgKyB2YWwgKyAnOyc7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBnZXRDb250ZW50ID0gZnVuY3Rpb24gKGMsIGQsIHpvb20sIGZyYW1lQ3NzKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgaWQgPSB6b29tID8gJ3pvb20tJyArIHByZXZpZXdJZCA6IHByZXZpZXdJZCwgdG1wbHQgPSBzZWxmLl9nZXRQcmV2aWV3VGVtcGxhdGUoYyksXHJcbiAgICAgICAgICAgICAgICAgICAgY3NzID0gKGZyYW1lQ2xhc3MgfHwgJycpICsgJyAnICsgZnJhbWVDc3M7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5mcmFtZUNsYXNzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY3NzID0gc2VsZi5mcmFtZUNsYXNzICsgJyAnICsgY3NzO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHpvb20pIHtcclxuICAgICAgICAgICAgICAgICAgICBjc3MgPSBjc3MucmVwbGFjZSgnICcgKyAkaC5TT1JUX0NTUywgJycpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdG1wbHQgPSBzZWxmLl9wYXJzZUZpbGVQcmV2aWV3SWNvbih0bXBsdCwgZm5hbWUpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGMgPT09ICd0ZXh0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgIGQgPSAkaC5odG1sRW5jb2RlKGQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKGNhdCA9PT0gJ29iamVjdCcgJiYgIWZ0eXBlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJC5lYWNoKHNlbGYuZGVmYXVsdHMuZmlsZVR5cGVTZXR0aW5ncywgZnVuY3Rpb24gKGtleSwgZnVuYykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSAnb2JqZWN0JyB8fCBrZXkgPT09ICdvdGhlcicpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZnVuYyhmbmFtZSwgZnR5cGUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlQ3NzID0gJ3R5cGUtJyArIGtleTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCEkaC5pc0VtcHR5KGF0dHJzKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhdHRycy50aXRsZSAhPT0gdW5kZWZpbmVkICYmIGF0dHJzLnRpdGxlICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gYXR0cnMudGl0bGU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhdHRycy5hbHQgIT09IHVuZGVmaW5lZCAmJiBhdHRycy5hbHQgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSBhdHRycy5hbHQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRtcGx0LnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAgICAgJ3ByZXZpZXdJZCc6IGlkLFxyXG4gICAgICAgICAgICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICAgICAndGl0bGUnOiB0aXRsZSxcclxuICAgICAgICAgICAgICAgICAgICAnYWx0JzogYWx0LFxyXG4gICAgICAgICAgICAgICAgICAgICdmcmFtZUNsYXNzJzogY3NzLFxyXG4gICAgICAgICAgICAgICAgICAgICd0eXBlJzogc2VsZi5fZ2V0RmlsZVR5cGUoZnR5cGUpLFxyXG4gICAgICAgICAgICAgICAgICAgICdmaWxlaW5kZXgnOiBpbmQsXHJcbiAgICAgICAgICAgICAgICAgICAgJ2ZpbGVpZCc6IHNlbGYuX2dldEZpbGVJZHMoKVtpbmRdIHx8ICcnLFxyXG4gICAgICAgICAgICAgICAgICAgICd0eXBlQ3NzJzogdHlwZUNzcyxcclxuICAgICAgICAgICAgICAgICAgICAnZm9vdGVyJzogZm9vdGVyLFxyXG4gICAgICAgICAgICAgICAgICAgICdkYXRhJzogZCxcclxuICAgICAgICAgICAgICAgICAgICAndGVtcGxhdGUnOiB0ZW1wbCB8fCBjYXQsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3N0eWxlJzogc3R5bGVBdHRyaWJzID8gJ3N0eWxlPVwiJyArIHN0eWxlQXR0cmlicyArICdcIicgOiAnJ1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGluZCA9IGluZCB8fCBwcmV2aWV3SWQuc2xpY2UocHJldmlld0lkLmxhc3RJbmRleE9mKCctJykgKyAxKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuZmlsZUFjdGlvblNldHRpbmdzLnNob3dab29tKSB7XHJcbiAgICAgICAgICAgICAgICB6b29tQ29udGVudCA9IGdldENvbnRlbnQoKGZvcmNlWm9vbUljb24gPyAnb3RoZXInIDogY2F0KSwgZGF0YSwgdHJ1ZSwgJ2t2LXpvb20tdGh1bWInKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB6b29tQ29udGVudCA9ICdcXG4nICsgc2VsZi5fZ2V0TGF5b3V0VGVtcGxhdGUoJ3pvb21DYWNoZScpLnJlcGxhY2UoJ3t6b29tQ29udGVudH0nLCB6b29tQ29udGVudCk7XHJcbiAgICAgICAgICAgIHByZXZDb250ZW50ID0gZ2V0Q29udGVudCgoZm9yY2VQcmV2SWNvbiA/ICdvdGhlcicgOiBjYXQpLCBkYXRhLCBmYWxzZSwgJ2t2LXByZXZpZXctdGh1bWInKTtcclxuICAgICAgICAgICAgcmV0dXJuIHByZXZDb250ZW50ICsgem9vbUNvbnRlbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfYWRkVG9QcmV2aWV3OiBmdW5jdGlvbiAoJHByZXZpZXcsIGNvbnRlbnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyID8gJHByZXZpZXcucHJlcGVuZChjb250ZW50KSA6ICRwcmV2aWV3LmFwcGVuZChjb250ZW50KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9wcmV2aWV3RGVmYXVsdDogZnVuY3Rpb24gKGZpbGUsIHByZXZpZXdJZCwgaXNEaXNhYmxlZCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGZuYW1lID0gJGguZ2V0RmlsZU5hbWUoZmlsZSksIGZ0eXBlID0gZmlsZSA/IGZpbGUudHlwZSA6ICcnLCBjb250ZW50LCBzaXplID0gZmlsZS5zaXplIHx8IDAsXHJcbiAgICAgICAgICAgICAgICBjYXB0aW9uID0gc2VsZi5zbHVnKGZuYW1lKSwgaXNFcnJvciA9IGlzRGlzYWJsZWQgPT09IHRydWUgJiYgIXNlbGYuaXNBamF4VXBsb2FkLFxyXG4gICAgICAgICAgICAgICAgZGF0YSA9ICRoLmNyZWF0ZU9iamVjdFVSTChmaWxlKTtcclxuICAgICAgICAgICAgc2VsZi5fY2xlYXJEZWZhdWx0UHJldmlldygpO1xyXG4gICAgICAgICAgICBjb250ZW50ID0gc2VsZi5fZ2VuZXJhdGVQcmV2aWV3VGVtcGxhdGUoJ290aGVyJywgZGF0YSwgZm5hbWUsIGZ0eXBlLCBwcmV2aWV3SWQsIGlzRXJyb3IsIHNpemUpO1xyXG4gICAgICAgICAgICBzZWxmLl9hZGRUb1ByZXZpZXcoJHByZXZpZXcsIGNvbnRlbnQpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRUa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RyKHByZXZpZXdJZCwgY2FwdGlvbiwgZnNpemUpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0U29ydGFibGUoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zZXRUaHVtYkF0dHI6IGZ1bmN0aW9uIChpZCwgY2FwdGlvbiwgc2l6ZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRmcmFtZSA9ICQoJyMnICsgaWQpO1xyXG4gICAgICAgICAgICBpZiAoJGZyYW1lLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgc2l6ZSA9IHNpemUgJiYgc2l6ZSA+IDAgPyBzZWxmLl9nZXRTaXplKHNpemUpIDogJyc7XHJcbiAgICAgICAgICAgICAgICAkZnJhbWUuZGF0YSh7J2NhcHRpb24nOiBjYXB0aW9uLCAnc2l6ZSc6IHNpemV9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldEluaXRUaHVtYkF0dHI6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBkYXRhID0gc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YSwgbGVuID0gc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSwgY29uZmlnLFxyXG4gICAgICAgICAgICAgICAgY2FwdGlvbiwgc2l6ZSwgcHJldmlld0lkO1xyXG4gICAgICAgICAgICBpZiAobGVuID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gZGF0YS5jb25maWdbaV07XHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3SWQgPSBzZWxmLnByZXZpZXdJbml0SWQgKyAnLScgKyAnaW5pdF8nICsgaTtcclxuICAgICAgICAgICAgICAgIGNhcHRpb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c0FqYXhVcGxvYWQgPyBmaWxlU3RhY2subGVuZ3RoIDogbnVtRmlsZXMsXHJcbiAgICAgICAgICAgICAgICBuRmlsZXMgPSBzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpICsgbiwgbG9nID0gbiA9PT0gMSA/IGxhYmVsIDogc2VsZi5fZ2V0TXNnU2VsZWN0ZWQobkZpbGVzKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNFcnJvcikge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kcHJldmlld0NvbnRhaW5lci5yZW1vdmVDbGFzcygnZmlsZS10aHVtYi1sb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRwcmV2aWV3U3RhdHVzLmh0bWwoJycpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbkNvbnRhaW5lci5yZW1vdmVDbGFzcygnaWNvbi12aXNpYmxlJyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93RmlsZUljb24oKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGxvZywgc2VsZi5pc0Vycm9yKTtcclxuICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLnJlbW92ZUNsYXNzKCdmaWxlLWlucHV0LW5ldyBmaWxlLWlucHV0LWFqYXgtbmV3Jyk7XHJcbiAgICAgICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID09PSAxKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXNlbGVjdCcsIFtudW1GaWxlcywgbGFiZWxdKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zZXRUaHVtYlN0YXR1czogZnVuY3Rpb24gKCR0aHVtYiwgc3RhdHVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGljb24gPSAnaW5kaWNhdG9yJyArIHN0YXR1cywgbXNnID0gaWNvbiArICdUaXRsZScsXHJcbiAgICAgICAgICAgICAgICBjc3MgPSAnZmlsZS1wcmV2aWV3LScgKyBzdGF0dXMudG9Mb3dlckNhc2UoKSxcclxuICAgICAgICAgICAgICAgICRpbmRpY2F0b3IgPSAkdGh1bWIuZmluZCgnLmZpbGUtdXBsb2FkLWluZGljYXRvcicpLFxyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3M7XHJcbiAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS1wcmV2aWV3LXN1Y2Nlc3MgZmlsZS1wcmV2aWV3LWVycm9yIGZpbGUtcHJldmlldy1sb2FkaW5nJyk7XHJcbiAgICAgICAgICAgIGlmIChzdGF0dXMgPT09ICdTdWNjZXNzJykge1xyXG4gICAgICAgICAgICAgICAgJHRodW1iLmZpbmQoJy5maWxlLWRyYWctaGFuZGxlJykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGluZGljYXRvci5odG1sKGNvbmZpZ1tpY29uXSk7XHJcbiAgICAgICAgICAgICRpbmRpY2F0b3IuYXR0cigndGl0bGUnLCBjb25maWdbbXNnXSk7XHJcbiAgICAgICAgICAgICR0aHVtYi5hZGRDbGFzcyhjc3MpO1xyXG4gICAgICAgICAgICBpZiAoc3RhdHVzID09PSAnRXJyb3InICYmICFzZWxmLnJldHJ5RXJyb3JVcGxvYW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sncGVyY2VudCc6IHBjdExpbWl0LCAnc3RhdHVzJzogc2VsZi5tc2dVcGxvYWRUaHJlc2hvbGR9KTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgb3V0ID0gdGVtcGxhdGUuc2V0VG9rZW5zKHsncGVyY2VudCc6IHBjdCwgJ3N0YXR1cyc6IChwID4gMTAwID8gc2VsZi5tc2dVcGxvYWRFbmQgOiBwY3QgKyAnJScpfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAkZWwuaHRtbChvdXQpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGVycm9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJGVsLmZpbmQoJ1tyb2xlPVwicHJvZ3Jlc3NiYXJcIl0nKS5odG1sKGVycm9yKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldEZpbGVEcm9wWm9uZVRpdGxlOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJHpvbmUgPSBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGUtZHJvcC16b25lJyksIHRpdGxlID0gc2VsZi5kcm9wWm9uZVRpdGxlLCBzdHJGaWxlcztcclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNDbGlja2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHN0ckZpbGVzID0gJGguaXNFbXB0eShzZWxmLiRlbGVtZW50LmF0dHIoJ211bHRpcGxlJykpID8gc2VsZi5maWxlU2luZ2xlIDogc2VsZi5maWxlUGx1cmFsO1xyXG4gICAgICAgICAgICAgICAgdGl0bGUgKz0gc2VsZi5kcm9wWm9uZUNsaWNrVGl0bGUucmVwbGFjZSgne2ZpbGVzfScsIHN0ckZpbGVzKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkem9uZS5maW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3VudCA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCk7XHJcbiAgICAgICAgICAgICAgICBmaWxlQ291bnQgKz0gYWRkQ291bnQ7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZpbGVDb3VudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRGaWxlSWQ6IGZ1bmN0aW9uIChmaWxlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY3VzdG9tID0gc2VsZi5nZW5lcmF0ZUZpbGVJZCwgcmVsYXRpdmVQYXRoO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIGN1c3RvbSA9PT0gJ2Z1bmN0aW9uJykge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIGN1c3RvbShmaWxlLCBldmVudCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCFmaWxlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBmaWxlLnJlbGF0aXZlUGF0aCAqL1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBmaWxlLndlYmtpdFJlbGF0aXZlUGF0aCAqL1xyXG4gICAgICAgICAgICByZWxhdGl2ZVBhdGggPSBTdHJpbmcoZmlsZS5yZWxhdGl2ZVBhdGggfHwgZmlsZS53ZWJraXRSZWxhdGl2ZVBhdGggfHwgJGguZ2V0RmlsZU5hbWUoZmlsZSkgfHwgbnVsbCk7XHJcbiAgICAgICAgICAgIGlmICghcmVsYXRpdmVQYXRoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gKGZpbGUuc2l6ZSArICctJyArIHJlbGF0aXZlUGF0aC5yZXBsYWNlKC9bXjAtOWEtekEtWl8tXS9pbWcsICcnKSk7XHJ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ICAgICBpZiAoaSAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGksIHZhbCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYucmVtb3ZlRnJvbVByZXZpZXdPbkVycm9yICYmICFyZXBlYXQpIHtcclxuICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0Vycm9yJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmVmcmVzaFVwbG9hZEJ1dHRvbigkdGh1bWIsIHJlcGVhdCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaFVwbG9hZEJ1dHRvbjogZnVuY3Rpb24gKCR0aHVtYiwgcmVwZWF0KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGJ0biA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKSwgY2ZnID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3MsXHJcbiAgICAgICAgICAgICAgICBpY29uID0gY2ZnLnVwbG9hZEljb24sIHRpdGxlID0gY2ZnLnVwbG9hZFRpdGxlO1xyXG4gICAgICAgICAgICBpZiAoISRidG4ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHJlcGVhdCkge1xyXG4gICAgICAgICAgICAgICAgaWNvbiA9IGNmZy51cGxvYWRSZXRyeUljb247XHJcbiAgICAgICAgICAgICAgICB0aXRsZSA9IGNmZy51cGxvYWRSZXRyeVRpdGxlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRidG4uYXR0cigndGl0bGUnLCB0aXRsZSkuaHRtbChpY29uKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jaGVja0RpbWVuc2lvbnM6IGZ1bmN0aW9uIChpLCBjaGssICRpbWcsICR0aHVtYiwgZm5hbWUsIHR5cGUsIHBhcmFtcykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIG1zZywgZGltLCB0YWcgPSBjaGsgPT09ICdTbWFsbCcgPyAnbWluJyA6ICdtYXgnLCBsaW1pdCA9IHNlbGZbdGFnICsgJ0ltYWdlJyArIHR5cGVdLFxyXG4gICAgICAgICAgICAgICAgJGltZ0VsLCBpc1ZhbGlkO1xyXG4gICAgICAgICAgICBpZiAoJGguaXNFbXB0eShsaW1pdCkgfHwgISRpbWcubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGltZ0VsID0gJGltZ1swXTtcclxuICAgICAgICAgICAgZGltID0gKHR5cGUgPT09ICdXaWR0aCcpID8gJGltZ0VsLm5hdHVyYWxXaWR0aCB8fCAkaW1nRWwud2lkdGggOiAkaW1nRWwubmF0dXJhbEhlaWdodCB8fCAkaW1nRWwuaGVpZ2h0O1xyXG4gICAgICAgICAgICBpc1ZhbGlkID0gY2hrID09PSAnU21hbGwnID8gZGltID49IGxpbWl0IDogZGltIDw9IGxpbWl0O1xyXG4gICAgICAgICAgICBpZiAoaXNWYWxpZCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9IHNlbGZbJ21zZ0ltYWdlJyArIHR5cGUgKyBjaGtdLnNldFRva2Vucyh7J25hbWUnOiBmbmFtZSwgJ3NpemUnOiBsaW1pdH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9zaG93VXBsb2FkRXJyb3IobXNnLCBwYXJhbXMpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpLCBudWxsKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRFeGlmT2JqOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGV4aWZPYmogPSBudWxsO1xyXG4gICAgICAgICAgICBpZiAoZGF0YS5zbGljZSgwLCAyMykgIT09ICdkYXRhOmltYWdlL2pwZWc7YmFzZTY0LCcgJiYgZGF0YS5zbGljZSgwLCAyMikgIT09ICdkYXRhOmltYWdlL2pwZztiYXNlNjQsJykge1xyXG4gICAgICAgICAgICAgICAgZXhpZk9iaiA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIGV4aWZPYmogPSB3aW5kb3cucGlleGlmID8gd2luZG93LnBpZXhpZi5sb2FkKGRhdGEpIDogbnVsbDtcclxuXHJcbiAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xyXG4gICAgICAgICAgICAgICAgZXhpZk9iaiA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9sb2coZXJyKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIWV4aWZPYmopIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZyhcclxuICAgICAgICAgICAgICAgICAgICAnVGhlIHBpZXhpZi5qcyBsaWJyYXJ5IHdhcyBub3QgZGV0ZWN0ZWQuIEVpdGhlciBsb2FkIHBpZXhpZi5qcyBvbiB5b3VyIHBhZ2UgT1Igc2V0IGBhdXRvT3JpZW50SW1hZ2VgIHRvIGBmYWxzZWAuJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGV4aWZPYmo7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfdmFsaWRhdGVJbWFnZU9yaWVudGF0aW9uOiBmdW5jdGlvbiAoJGltZywgZmlsZSwgcHJldmlld0lkLCBjYXB0aW9uLCBmdHlwZSwgZnNpemUsIGlEYXRhKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZXhpZk9iaiwgdmFsdWUsIGF1dG9PcmllbnRJbWFnZSA9IHNlbGYuYXV0b09yaWVudEltYWdlO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIGF1dG9PcmllbnRJbWFnZSA9PT0gJ2Z1bmN0aW9uJykge1xyXG4gICAgICAgICAgICAgICAgYXV0b09yaWVudEltYWdlID0gYXV0b09yaWVudEltYWdlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZXhpZk9iaiA9ICRpbWcubGVuZ3RoICYmIGF1dG9PcmllbnRJbWFnZSA/IHNlbGYuX2dldEV4aWZPYmooaURhdGEpIDogbnVsbDtcclxuICAgICAgICAgICAgdmFsdWUgPSBleGlmT2JqID8gZXhpZk9ialsnMHRoJ11bcGlleGlmLkltYWdlSUZELk9yaWVudGF0aW9uXSA6IG51bGw7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICAgICAgICBpZiAoIXZhbHVlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl92YWxpZGF0ZUltYWdlKHByZXZpZXdJZCwgY2FwdGlvbiwgZnR5cGUsIGZzaXplLCBpRGF0YSwgZXhpZk9iaik7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGguc2V0SW1hZ2VPcmllbnRhdGlvbigkaW1nLCBzZWxmLiRwcmV2aWV3LmZpbmQoJyN6b29tLScgKyBwcmV2aWV3SWQgKyAnIGltZycpLCB2YWx1ZSk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VvcmllbnRlZCcsIHsnJGltZyc6ICRpbWcsICdmaWxlJzogZmlsZX0pO1xyXG4gICAgICAgICAgICBzZWxmLl92YWxpZGF0ZUltYWdlKHByZXZpZXdJZCwgY2FwdGlvbiwgZnR5cGUsIGZzaXplLCBpRGF0YSwgZXhpZk9iaik7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfdmFsaWRhdGVJbWFnZTogZnVuY3Rpb24gKHByZXZpZXdJZCwgZm5hbWUsIGZ0eXBlLCBmc2l6ZSwgaURhdGEsIGV4aWZPYmopIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkcHJldmlldyA9IHNlbGYuJHByZXZpZXcsIHBhcmFtcywgdzEsIHcyLCAkdGh1bWIgPSAkcHJldmlldy5maW5kKCcjJyArIHByZXZpZXdJZCksXHJcbiAgICAgICAgICAgICAgICBpID0gJHRodW1iLmF0dHIoJ2RhdGEtZmlsZWluZGV4JyksICRpbWcgPSAkdGh1bWIuZmluZCgnaW1nJyk7XHJcbiAgICAgICAgICAgIGZuYW1lID0gZm5hbWUgfHwgJ1VudGl0bGVkJztcclxuICAgICAgICAgICAgJGltZy5vbmUoJ2xvYWQnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB3MSA9ICR0aHVtYi53aWR0aCgpO1xyXG4gICAgICAgICAgICAgICAgdzIgPSAkcHJldmlldy53aWR0aCgpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHcxID4gdzIpIHtcclxuICAgICAgICAgICAgICAgICAgICAkaW1nLmNzcygnd2lkdGgnLCAnMTAwJScpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgcGFyYW1zID0ge2luZDogaSwgaWQ6IHByZXZpZXdJZH07XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jaGVja0RpbWVuc2lvbnMoaSwgJ1NtYWxsJywgJGltZywgJHRodW1iLCBmbmFtZSwgJ1dpZHRoJywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnU21hbGwnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnSGVpZ2h0JywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIGlmICghc2VsZi5yZXNpemVJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnTGFyZ2UnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnV2lkdGgnLCBwYXJhbXMpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnTGFyZ2UnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnSGVpZ2h0JywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2Vsb2FkZWQnLCBbcHJldmlld0lkXSk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmxvYWRlZEltYWdlcy5wdXNoKHtcclxuICAgICAgICAgICAgICAgICAgICBpbmQ6IGksXHJcbiAgICAgICAgICAgICAgICAgICAgaW1nOiAkaW1nLFxyXG4gICAgICAgICAgICAgICAgICAgIHRodW1iOiAkdGh1bWIsXHJcbiAgICAgICAgICAgICAgICAgICAgcGlkOiBwcmV2aWV3SWQsXHJcbiAgICAgICAgICAgICAgICAgICAgdHlwOiBmdHlwZSxcclxuICAgICAgICAgICAgICAgICAgICBzaXo6IGZzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlZDogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICAgICAgaW1nRGF0YTogaURhdGEsXHJcbiAgICAgICAgICAgICAgICAgICAgZXhpZk9iajogZXhpZk9ialxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAkdGh1bWIuZGF0YSgnZXhpZicsIGV4aWZPYmopO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVBbGxJbWFnZXMoKTtcclxuICAgICAgICAgICAgfSkub25lKCdlcnJvcicsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2Vsb2FkZXJyb3InLCBbcHJldmlld0lkXSk7XHJcbiAgICAgICAgICAgIH0pLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuY29tcGxldGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkKHRoaXMpLnRyaWdnZXIoJ2xvYWQnKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuZXJyb3IpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS50cmlnZ2VyKCdlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfdmFsaWRhdGVBbGxJbWFnZXM6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpLCBjb3VudGVyID0ge3ZhbDogMH0sIG51bUltZ3MgPSBzZWxmLmxvYWRlZEltYWdlcy5sZW5ndGgsIGNvbmZpZyxcclxuICAgICAgICAgICAgICAgIGZzaXplLCBtaW5TaXplID0gc2VsZi5yZXNpemVJZlNpemVNb3JlVGhhbjtcclxuICAgICAgICAgICAgaWYgKG51bUltZ3MgIT09IHNlbGYudG90YWxJbWFnZXNDb3VudCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VzbG9hZGVkJyk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5yZXNpemVJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzZWxmLmxvYWRlZEltYWdlcy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gc2VsZi5sb2FkZWRJbWFnZXNbaV07XHJcbiAgICAgICAgICAgICAgICBpZiAoY29uZmlnLnZhbGlkYXRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgZnNpemUgPSBjb25maWcuc2l6O1xyXG4gICAgICAgICAgICAgICAgaWYgKGZzaXplICYmIGZzaXplID4gbWluU2l6ZSAqIDEwMDApIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9nZXRSZXNpemVkSW1hZ2UoY29uZmlnLCBjb3VudGVyLCBudW1JbWdzKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzW2ldLnZhbGlkYXRlZCA9IHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRSZXNpemVkSW1hZ2U6IGZ1bmN0aW9uIChjb25maWcsIGNvdW50ZXIsIG51bUltZ3MpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpbWcgPSAkKGNvbmZpZy5pbWcpWzBdLCB3aWR0aCA9IGltZy5uYXR1cmFsV2lkdGgsIGhlaWdodCA9IGltZy5uYXR1cmFsSGVpZ2h0LCBibG9iLFxyXG4gICAgICAgICAgICAgICAgcmF0aW8gPSAxLCBtYXhXaWR0aCA9IHNlbGYubWF4SW1hZ2VXaWR0aCB8fCB3aWR0aCwgbWF4SGVpZ2h0ID0gc2VsZi5tYXhJbWFnZUhlaWdodCB8fCBoZWlnaHQsXHJcbiAgICAgICAgICAgICAgICBpc1ZhbGlkSW1hZ2UgPSAhISh3aWR0aCAmJiBoZWlnaHQpLCBjaGtXaWR0aCwgY2hrSGVpZ2h0LCBjYW52YXMgPSBzZWxmLmltYWdlQ2FudmFzLCBkYXRhVVJJLFxyXG4gICAgICAgICAgICAgICAgY29udGV4dCA9IHNlbGYuaW1hZ2VDYW52YXNDb250ZXh0LCB0eXBlID0gY29uZmlnLnR5cCwgcGlkID0gY29uZmlnLnBpZCwgaW5kID0gY29uZmlnLmluZCxcclxuICAgICAgICAgICAgICAgICR0aHVtYiA9IGNvbmZpZy50aHVtYiwgdGhyb3dFcnJvciwgbXNnLCBleGlmT2JqID0gY29uZmlnLmV4aWZPYmosIGV4aWZTdHI7XHJcbiAgICAgICAgICAgIHRocm93RXJyb3IgPSBmdW5jdGlvbiAobXNnLCBwYXJhbXMsIGV2KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9zaG93VXBsb2FkRXJyb3IobXNnLCBwYXJhbXMsIGV2KTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd0Vycm9yKG1zZywgcGFyYW1zLCBldik7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpbmQpO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuZmlsZXN0YWNrW2luZF0gfHwgIWlzVmFsaWRJbWFnZSB8fCAod2lkdGggPD0gbWF4V2lkdGggJiYgaGVpZ2h0IDw9IG1heEhlaWdodCkpIHtcclxuICAgICAgICAgICAgICAgIGlmIChpc1ZhbGlkSW1hZ2UgJiYgc2VsZi5maWxlc3RhY2tbaW5kXSkge1xyXG4gICAgICAgICAgICA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2lkdGggPyBtYXhXaWR0aCAvIHdpZHRoIDogMSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRDYW52YXMoKTtcclxuICAgICAgICAgICAgd2lkdGggKj0gcmF0aW87XHJcbiAgICAgICAgICAgIGhlaWdodCAqPSByYXRpbztcclxuICAgICAgICAgICAgY2FudmFzLndpZHRoID0gd2lkdGg7XHJcbiAgICAgICAgICAgIGNhbnZhcy5oZWlnaHQgPSBoZWlnaHQ7XHJcbiAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICBjb250ZXh0LmRyYXdJbWFnZShpbWcsIDAsIDAsIHdpZHRoLCBoZWlnaHQpO1xyXG4gICAgICAgICAgICAgICAgZGF0YVVSSSA9IGNhbnZhcy50b0RhdGFVUkwodHlwZSwgc2VsZi5yZXNpemVRdWFsaXR5KTtcclxuICAgICAgICAgICAgICAgIGlmIChleGlmT2JqKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZXhpZlN0ciA9IHdpbmRvdy5waWV4aWYuZHVtcChleGlmT2JqKTtcclxuICAgICAgICAgICAgICAgICAgICBkYXRhVVJJID0gd2luZG93LnBpZXhpZi5pbnNlcnQoZXhpZlN0ciwgZGF0YVVSSSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBibG9iID0gJGguZGF0YVVSSTJCbG9iKGRhdGFVUkkpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5maWxlc3RhY2tbaW5kXSA9IGJsb2I7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWltYWdlcmVzaXplZCcsIFtwaWQsIGluZF0pO1xyXG4gICAgICAgICAgICAgICAgY291bnRlci52YWwrKztcclxuICAgICAgICAgICAgICAgIGlmIChjb3VudGVyLnZhbCA9PT0gbnVtSW1ncykge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VzcmVzaXplZCcsIFt1bmRlZmluZWQsIHVuZGVmaW5lZF0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCEoYmxvYiBpbnN0YW5jZW9mIEJsb2IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihzZWxmLm1zZ0ltYWdlUmVzaXplRXJyb3IsIHtpZDogcGlkLCAnaW5kZXgnOiBpbmR9LCAnZmlsZWltYWdlcmVzaXplZXJyb3InKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBjYXRjaCAoZXJyKSB7XHJcbiAgICAgICAgICAgICAgICBjb3VudGVyLnZhbCsrO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvdW50ZXIudmFsID09PSBudW1JbWdzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVpbWFnZXNyZXNpemVkJywgW3VuZGVmaW5lZCwgdW5kZWZpbmVkXSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ0ltYWdlUmVzaXplRXhjZXB0aW9uLnJlcGxhY2UoJ3tlcnJvcnN9JywgZXJyLm1lc3NhZ2UpO1xyXG4gICAgICAgICAgICAgICAgdGhyb3dFcnJvcihtc2csIHtpZDogcGlkLCAnaW5kZXgnOiBpbmR9LCAnZmlsZWltYWdlcmVzaXplZXhjZXB0aW9uJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9pbml0QnJvd3NlOiBmdW5jdGlvbiAoJGNvbnRhaW5lcikge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlbCA9IHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dCcm93c2UpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGJ0bkZpbGUgPSAkY29udGFpbmVyLmZpbmQoJy5idG4tZmlsZScpLmFwcGVuZCgkZWwpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJGVsLmFwcGVuZFRvKCRjb250YWluZXIpLmF0dHIoJ3RhYmluZGV4JywgLTEpO1xyXG4gICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRlbCwgJ2ZpbGUtbm8tYnJvd3NlJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9pbml0Q2xpY2thYmxlOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJHpvbmUsICR0bXBab25lO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNDbGlja2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkem9uZSA9IHNlbGYuJGRyb3Bab25lO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAkdG1wWm9uZSA9IHNlbGYuJHByZXZpZXcuZmluZCgnLmZpbGUtZGVmYXVsdC1wcmV2aWV3Jyk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJHRtcFpvbmUubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJHpvbmUgPSAkdG1wWm9uZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgJGguYWRkQ3NzKCR6b25lLCAnY2xpY2thYmxlJyk7XHJcbiAgICAgICAgICAgICR6b25lLmF0dHIoJ3RhYmluZGV4JywgLTEpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCR6b25lLCAnY2xpY2snLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0YXIgPSAkKGUudGFyZ2V0KTtcclxuICAgICAgICAgICAgICAgIGlmICghJChzZWxmLmVsRXJyb3JDb250YWluZXIgKyAnOnZpc2libGUnKS5sZW5ndGggJiZcclxuICAgICAgICAgICAgICAgICAgICAoISR0YXIucGFyZW50cygnLmZpbGUtcHJldmlldy10aHVtYm5haWxzJykubGVuZ3RoIHx8ICR0YXIucGFyZW50cyhcclxuICAgICAgICAgICAgICAgICAgICAgICAgJy5maWxlLWRlZmF1bHQtcHJldmlldycpLmxlbmd0aCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRlbGVtZW50LmRhdGEoJ3pvbmVDbGlja2VkJywgdHJ1ZSkudHJpZ2dlcignY2xpY2snKTtcclxuICAgICAgICAgICAgICAgICAgICAkem9uZS5ibHVyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRDYXB0aW9uOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY2FwID0gc2VsZi5pbml0aWFsQ2FwdGlvbiB8fCAnJztcclxuICAgICAgICAgICAgaWYgKHNlbGYub3ZlcndyaXRlSW5pdGlhbCB8fCAkaC5pc0VtcHR5KGNhcCkpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGNhcHRpb24udmFsKCcnKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGNhcCk7XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldENhcHRpb246IGZ1bmN0aW9uIChjb250ZW50LCBpc0Vycm9yKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdGl0bGUsIG91dCwgaWNvbiwgbiwgY2FwLCBzdGFjayA9IHNlbGYuZ2V0RmlsZVN0YWNrKCk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi4kY2FwdGlvbi5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgaWYgKGlzRXJyb3IpIHtcclxuICAgICAgICAgICAgICAgIHRpdGxlID0gJCgnPGRpdj4nICsgc2VsZi5tc2dWYWxpZGF0aW9uRXJyb3IgKyAnPC9kaXY+JykudGV4dCgpO1xyXG4gICAgICAgICAgICAgICAgbiA9IHN0YWNrLmxlbmd0aDtcclxuICAgICAgICAgICAgICAgIGlmIChuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY2FwID0gbiA9PT0gMSAmJiBzdGFja1swXSA/IHNlbGYuX2dldEZpbGVOYW1lcygpWzBdIDogc2VsZi5fZ2V0TXNnU2VsZWN0ZWQobik7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGNhcCA9IHNlbGYuX2dldE1zZ1NlbGVjdGVkKHNlbGYubXNnTm8pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgb3V0ID0gJGguaXNFbXB0eShjb250ZW50KSA/IGNhcCA6IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICBpY29uID0gJzxzcGFuIGNsYXNzPVwiJyArIHNlbGYubXNnVmFsaWRhdGlvbkVycm9yQ2xhc3MgKyAnXCI+JyArIHNlbGYubXNnVmFsaWRhdGlvbkVycm9ySWNvbiArICc8L3NwYW4+JztcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KGNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdGl0bGUgPSAkKCc8ZGl2PicgKyBjb250ZW50ICsgJzwvZGl2PicpLnRleHQoKTtcclxuICAgICAgICAgICAgICAgIG91dCA9IHRpdGxlO1xyXG4gICAgICAgICAgICAgICAgaWNvbiA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdmaWxlSWNvbicpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuJGNhcHRpb25Db250YWluZXIuYWRkQ2xhc3MoJ2ljb24tdmlzaWJsZScpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uLmF0dHIoJ3RpdGxlJywgdGl0bGUpLnZhbChvdXQpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uSWNvbi5odG1sKGljb24pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NyZWF0ZUNvbnRhaW5lcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGF0dHJpYnMgPSB7J2NsYXNzJzogJ2ZpbGUtaW5wdXQgZmlsZS1pbnB1dC1uZXcnICsgKHNlbGYucnRsID8gJyBrdi1ydGwnIDogJycpfSxcclxuICAgICAgICAgICAgICAgICRjb250YWluZXIgPSAkKGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpKS5hdHRyKGF0dHJpYnMpLmh0bWwoc2VsZi5fcmVuZGVyTWFpbigpKTtcclxuICAgICAgICAgICAgJGNvbnRhaW5lci5pbnNlcnRCZWZvcmUoc2VsZi4kZWxlbWVudCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRCcm93c2UoJGNvbnRhaW5lcik7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnRoZW1lKSB7XHJcbiAgICAgICAgICAgICAgICAkY29udGFpbmVyLmFkZENsYXNzKCd0aGVtZS0nICsgc2VsZi50aGVtZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICRjb250YWluZXI7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaENvbnRhaW5lcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRjb250YWluZXIgPSBzZWxmLiRjb250YWluZXIsICRlbCA9IHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgICAgICRlbC5pbnNlcnRBZnRlcigkY29udGFpbmVyKTtcclxuICAgICAgICAgICAgJGNvbnRhaW5lci5odG1sKHNlbGYuX3JlbmRlck1haW4oKSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRCcm93c2UoJGNvbnRhaW5lcik7XHJcbiAgICAgICAgICAgIHNlbGYuX3ZhbGlkYXRlRGlzYWJsZWQoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZURpc2FibGVkOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kY2FwdGlvbi5hdHRyKHtyZWFkb25seTogc2VsZi5pc0Rpc2FibGVkfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVuZGVyTWFpbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsXHJcbiAgICAgICAgICAgICAgICBkcm9wQ3NzID0gc2VsZi5kcm9wWm9uZUVuYWJsZWQgPyAnIGZpbGUtZHJvcC16b25lJyA6ICdmaWxlLWRyb3AtZGlzYWJsZWQnLFxyXG4gICAgICAgICAgICAgICAgY2xvc2UgPSAhc2VsZi5zaG93Q2xvc2UgPyAnJyA6IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdjbG9zZScpLFxyXG4gICAgICAgICAgICAgICAgcHJldmlldyA9ICFzZWxmLnNob3dQcmV2aWV3ID8gJycgOiBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgncHJldmlldycpXHJcbiAgICAgICAgICAgICAgICAgICAgLnNldFRva2Vucyh7J2NsYXNzJzogc2VsZi5wcmV2aWV3Q2xhc3MsICdkcm9wQ2xhc3MnOiBkcm9wQ3NzfSksXHJcbiAgICAgICAgICAgICAgICBjc3MgPSBzZWxmLmlzRGlzYWJsZWQgPyBzZWxmLmNhcHRpb25DbGFzcyArICcgZmlsZS1jYXB0aW9uLWRpc2FibGVkJyA6IHNlbGYuY2FwdGlvbkNsYXNzLFxyXG4gICAgICAgICAgICAgICAgY2FwdGlvbiA9IHNlbGYuY2FwdGlvblRlbXBsYXRlLnNldFRva2Vucyh7J2NsYXNzJzogY3NzICsgJyBrdi1maWxlaW5wdXQtY2FwdGlvbid9KTtcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYubWFpblRlbXBsYXRlLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAnY2xhc3MnOiBzZWxmLm1haW5DbGFzcyArICghc2VsZi5zaG93QnJvd3NlICYmIHNlbGYuc2hvd0NhcHRpb24gPyAnIG5vLWJyb3dzZScgOiAnJyksXHJcbiAgICAgICAgICAgICAgICAncHJldmlldyc6IHByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAnY2xvc2UnOiBjbG9zZSxcclxuICAgICAgICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICd1cGxvYWQnOiBzZWxmLl9yZW5kZXJCdXR0b24oJ3VwbG9hZCcpLFxyXG4gICAgICAgICAgICAgICAgJ3JlbW92ZSc6IHNlbGYuX3JlbmRlckJ1dHRvbigncmVtb3ZlJyksXHJcbiAgICAgICAgICAgICAgICAnY2FuY2VsJzogc2VsZi5fcmVuZGVyQnV0dG9uKCdjYW5jZWwnKSxcclxuICAgICAgICAgICAgICAgICdicm93c2UnOiBzZWxmLl9yZW5kZXJCdXR0b24oJ2Jyb3dzZScpXHJcbiAgICAgICAgICAgIH0pO1xyXG5cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZW5kZXJCdXR0b246IGZ1bmN0aW9uICh0eXBlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdG1wbHQgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYnRuRGVmYXVsdCcpLCBjc3MgPSBzZWxmW3R5cGUgKyAnQ2xhc3MnXSxcclxuICAgICAgICAgICAgICAgIHRpdGxlID0gc2VsZlt0eXBlICsgJ1RpdGxlJ10sIGljb24gPSBzZWxmW3R5cGUgKyAnSWNvbiddLCBsYWJlbCA9IHNlbGZbdHlwZSArICdMYWJlbCddLFxyXG4gICAgICAgICAgICAgICAgc3RhdHVzID0gc2VsZi5pc0Rpc2FibGVkID8gJyBkaXNhYmxlZCcgOiAnJywgYnRuVHlwZSA9ICdidXR0b24nO1xyXG4gICAgICAgICAgICBzd2l0Y2ggKHR5cGUpIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgJ3JlbW92ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dSZW1vdmUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2NhbmNlbCc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dDYW5jZWwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBjc3MgKz0gJyBrdi1oaWRkZW4nO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAndXBsb2FkJzpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuc2hvd1VwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCAmJiAhc2VsZi5pc0Rpc2FibGVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRtcGx0ID0gc2VsZi5fZ2V0TGF5b3V0VGVtcGxhdGUoJ2J0bkxpbmsnKS5yZXBsYWNlKCd7aHJlZn0nLCBzZWxmLnVwbG9hZFVybCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYnRuVHlwZSA9ICdzdWJtaXQnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2Jyb3dzZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dCcm93c2UpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB0bXBsdCA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdidG5Ccm93c2UnKTtcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBjc3MgKz0gdHlwZSA9PT0gJ2Jyb3dzZScgPyAnIGJ0bi1maWxlJyA6ICcgZmlsZWlucHV0LScgKyB0eXBlICsgJyBmaWxlaW5wdXQtJyArIHR5cGUgKyAnLWJ1dHRvbic7XHJcbiAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShsYWJlbCkpIHtcclxuICAgICAgICAgICAgICAgIGxhYmVsID0gJyA8c3BhbiBjbGFzcz1cIicgKyBzZWxmLmJ1dHRvbkxhYmVsQ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AgICAgICAgICAgICAgb3V0ID0gdGVtcGxhdGUuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnYWN0aW9ucyc6IHNlbGYuX3JlbmRlckZpbGVBY3Rpb25zKGZhbHNlLCBmYWxzZSwgZmFsc2UsIHpvb20sIGRyZywgZmFsc2UsIGZhbHNlLCBmYWxzZSksXHJcbiAgICAgICAgICAgICAgICAgICAgJ2NhcHRpb24nOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICdzaXplJzogc2l6ZSxcclxuICAgICAgICAgICAgICAgICAgICAnd2lkdGgnOiB3aWR0aCxcclxuICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnOiAnJyxcclxuICAgICAgICAgICAgICAgICAgICAnaW5kaWNhdG9yJzogaW5kaWNhdG9yXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvdXQgPSAkaC5yZXBsYWNlVGFncyhvdXQsIHNlbGYucHJldmlld1RodW1iVGFncyk7XHJcbiAgICAgICAgICAgIHJldHVybiBvdXQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVuZGVyRmlsZUFjdGlvbnM6IGZ1bmN0aW9uIChcclxuICAgICAgICAgICAgc2hvd1VwbCxcclxuICAgICAgICAgICAgc2hvd0R3bixcclxuICAgICAgICAgICAgc2hvd0RlbCxcclxuICAgICAgICAgICAgc2hvd1pvb20sXHJcbiAgICAgICAgICAgIHNob3dEcmFnLFxyXG4gICAgICAgICAgICBkaXNhYmxlZCxcclxuICAgICAgICAgICAgdXJsLFxyXG4gICAgICAgICAgICBrZXksXHJcbiAgICAgICAgICAgIGlzSW5pdCxcclxuICAgICAgICAgICAgZFVybCxcclxuICAgICAgICAgICAgZEZpbGVcclxuICAgICAgICApIHtcclxuICAgICAgICAgICAgaWYgKCFzaG93VXBsICYmICFzaG93RHduICYmICFzaG93RGVsICYmICFzaG93Wm9vbSAmJiAhc2hvd0RyYWcpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHZVcmwgPSB1cmwgPT09IGZhbHNlID8gJycgOiAnIGRhdGEtdXJsPVwiJyArIHVybCArICdcIicsXHJcbiAgICAgICAgICAgICAgICB2S2V5ID0ga2V5ID09PSBmYWxzZSA/ICcnIDogJyBkYXRhLWtleT1cIicgKyBrZXkgKyAnXCInLCBidG5EZWxldGUgPSAnJywgYnRuVXBsb2FkID0gJycsIGJ0bkRvd25sb2FkID0gJycsXHJcbiAgICAgICAgICAgICAgICBidG5ab29tID0gJycsIGJ0bkRyYWcgPSAnJywgY3NzLCB0ZW1wbGF0ZSA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25zJyksXHJcbiAgICAgICAgICAgICAgICBjb25maWcgPSBzZWxmLmZpbGVBY3Rpb25TZXR0aW5ncyxcclxuICAgICAgICAgICAgICAgIG90aGVyQnV0dG9ucyA9IHNlbGYub3RoZXJBY3Rpb25CdXR0b25zLnNldFRva2Vucyh7J2RhdGFLZXknOiB2S2V5LCAna2V5Jzoga2V5fSksXHJcbiAgICAgICAgICAgICAgICByZW1vdmVDbGFzcyA9IGRpc2FibGVkID8gY29uZmlnLnJlbW92ZUNsYXNzICsgJyBkaXNhYmxlZCcgOiBjb25maWcucmVtb3ZlQ2xhc3M7XHJcbiAgICAgICAgICAgIGlmIChzaG93RGVsKSB7XHJcbiAgICAgICAgICAgICAgICBidG5EZWxldGUgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYWN0aW9uRGVsZXRlJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAncmVtb3ZlQ2xhc3MnOiByZW1vdmVDbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAncmVtb3ZlSWNvbic6IGNvbmZpZy5yZW1vdmVJY29uLFxyXG4gICAgICAgICAgICAgICAgICAgICdyZW1vdmVUaXRsZSc6IGNvbmZpZy5yZW1vdmVUaXRsZSxcclxuICAgICAgICAgICAgICAgICAgICAnZGF0YVVybCc6IHZVcmwsXHJcbiAgICAgICAgICAgICAgICAgICAgJ2RhdGFLZXknOiB2S2V5LFxyXG4gICAgICAgICAgICAgICAgICAgICdrZXknOiBrZXlcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93VXBsKSB7XHJcbiAgICAgICAgICAgICAgICBidG5VcGxvYWQgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYWN0aW9uVXBsb2FkJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAndXBsb2FkQ2xhc3MnOiBjb25maWcudXBsb2FkQ2xhc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3VwbG9hZEljb24nOiBjb25maWcudXBsb2FkSWNvbixcclxuICAgICAgICAgICAgICAgICAgICAndXBsb2FkVGl0bGUnOiBjb25maWcudXBsb2FkVGl0bGVcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93RHduKSB7XHJcbiAgICAgICAgICAgICAgICBidG5Eb3dubG9hZCA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25Eb3dubG9hZCcpLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAgICAgJ2Rvd25sb2FkQ2xhc3MnOiBjb25maWcuZG93bmxvYWRDbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAnZG93bmxvYWRJY29uJzogY29uZmlnLmRvd25sb2FkSWNvbixcclxuICAgICAgICAgICAgICAgICAgICAnZG93bmxvYWRUaXRsZSc6IGNvbmZpZy5kb3dubG9hZFRpdGxlLFxyXG4gICAgICAgICAgICAgICAgICAgICdkb3dubG9hZFVybCc6IGRVcmwgfHwgc2VsZi5pbml0aWFsUHJldmlld0Rvd25sb2FkVXJsXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIGJ0bkRvd25sb2FkID0gYnRuRG93bmxvYWQuc2V0VG9rZW5zKHsnZmlsZW5hbWUnOiBkRmlsZSwgJ2tleSc6IGtleX0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93Wm9vbSkge1xyXG4gICAgICAgICAgICAgICAgYnRuWm9vbSA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25ab29tJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnem9vbUNsYXNzJzogY29uZmlnLnpvb21DbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAnem9vbUljb24nOiBjb25maWcuem9vbUljb24sXHJcbiAgICAgICAgICAgICAgICAgICAgJ3pvb21UaXRsZSc6IGNvbmZpZy56b29tVGl0bGVcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93RHJhZyAmJiBpc0luaXQpIHtcclxuICAgICAgICAgICAgICAgIGNzcyA9ICdkcmFnLWhhbmRsZS1pbml0ICcgKyBjb25maWcuZHJhZ0NsYXNzO1xyXG4gICAgICAgICAgICAgICAgYnRuRHJhZyA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25EcmFnJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnZHJhZ0NsYXNzJzogY3NzLFxyXG4gICAgICAgICAgICAgICAgICAgICdkcmFnVGl0bGUnOiBjb25maWcuZHJhZ1RpdGxlLFxyXG4gICAgICAgICAgICAgICAgICAgICdkcmFnSWNvbic6IGNvbmZpZy5kcmFnSWNvblxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHRlbXBsYXRlLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAnZGVsZXRlJzogYnRuRGVsZXRlLFxyXG4gICAgICAgICAgICAgICAgJ3VwbG9hZCc6IGJ0blVwbG9hZCxcclxuICAgICAgICAgICAgICAgICdkb3dubG9hZCc6IGJ0bkRvd25sb2FkLFxyXG4gICAgICAgICAgICAgICAgJ3pvb20nOiBidG5ab29tLFxyXG4gICAgICAgICAgICAgICAgJ2RyYWcnOiBidG5EcmFnLFxyXG4gICAgICAgICAgICAgICAgJ290aGVyJzogb3RoZXJCdXR0b25zXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2Jyb3dzZTogZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoZSAmJiBlLmlzRGVmYXVsdFByZXZlbnRlZCgpIHx8ICFzZWxmLl9yYWlzZSgnZmlsZWJyb3dzZScpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNFcnJvciAmJiAhc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuY2xlYXIoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLmZvY3VzKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZmlsdGVyRHVwbGljYXRlOiBmdW5jdGlvbiAoZmlsZSwgZmlsZXMsIGZpbGVJZHMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBmaWxlSWQgPSBzZWxmLl9nZXRGaWxlSWQoZmlsZSk7XHJcblxyXG4gICAgICAgICAgICBpZiAoZmlsZUlkICYmIGZpbGVJZHMgJiYgZmlsZUlkcy5pbmRleE9mKGZpbGVJZCkgPiAtMSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gIC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AgICAgICAgIHRocm93RXJyb3IgPSBmdW5jdGlvbiAobWVzZywgZmlsZSwgcHJldmlld0lkLCBpbmRleCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBwMSA9ICQuZXh0ZW5kKHRydWUsIHt9LCBzZWxmLl9nZXRPdXREYXRhKHt9LCB7fSwgZmlsZXMpLCB7aWQ6IHByZXZpZXdJZCwgaW5kZXg6IGluZGV4fSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHAyID0ge2lkOiBwcmV2aWV3SWQsIGluZGV4OiBpbmRleCwgZmlsZTogZmlsZSwgZmlsZXM6IGZpbGVzfTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNBamF4VXBsb2FkID8gc2VsZi5fc2hvd1VwbG9hZEVycm9yKG1lc2csIHAxKSA6IHNlbGYuX3Nob3dFcnJvcihtZXNnLCBwMik7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgbWF4Q291bnRDaGVjayA9IGZ1bmN0aW9uIChuLCBtKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIG1zZyA9IHNlbGYubXNnRmlsZXNUb29NYW55LnJlcGxhY2UoJ3ttfScsIG0pLnJlcGxhY2UoJ3tufScsIG4pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuaXNFcnJvciA9IHRocm93RXJyb3IobXNnLCBudWxsLCBudWxsLCBudWxsKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKCcnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtaW5wdXQtbmV3IGZpbGUtaW5wdXQtYWpheC1uZXcnKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNlbGYucmVhZGVyID0gbnVsbDtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRVcGxvYWQoKTtcclxuICAgICAgICAgICAgc2VsZi5faGlkZUZpbGVJY29uKCk7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLmRyb3Bab25lRW5hYmxlZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlLWRyb3Atem9uZSAuJyArIHNlbGYuZHJvcFpvbmVUaXRsZUNsYXNzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uICh2S2V5LCB2RmlsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2ZpbHRlckR1cGxpY2F0ZSh2RmlsZSwgdGZpbGVzLCBmaWxlSWRzKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKGUudGFyZ2V0ICYmIGUudGFyZ2V0LmZpbGVzID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlcyA9IGUudGFyZ2V0LnZhbHVlID8gW3tuYW1lOiBlLnRhcmdldC52YWx1ZS5yZXBsYWNlKC9eLitcXFxcLywgJycpfV0gOiBbXTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZXMgPSBlLnRhcmdldC5maWxlcyB8fCB7fTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHRmaWxlcyA9IGZpbGVzO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KHRmaWxlcykgfHwgdGZpbGVzLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFpc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNsZWFyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXNlbGVjdG5vbmUnKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9yZXNldEVycm9ycygpO1xyXG4gICAgICAgICAgICBsZW4gPSB0ZmlsZXMubGVuZ3RoO1xyXG4gICAgICAgICAgICB0b3RhbCA9IHNlbGYuX2dldEZpbGVDb3VudChpc0FqYXhVcGxvYWQgPyAoc2VsZi5nZXRGaWxlU3RhY2soKS5sZW5ndGggKyBsZW4pIDogbGVuKTtcclxuICAgICAgICAgICAgaWYgKG1heENvdW50ID4gMCAmJiB0b3RhbCA+IG1heENvdW50KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuYXV0b1JlcGxhY2UgfHwgbGVuID4gbWF4Q291bnQpIHtcclxuICAgICAgICAgICAgICAgICAgICBtYXhDb3VudENoZWNrKChzZWxmLmF1dG9SZXBsYWNlICYmIGxlbiA+IG1heENvdW50ID8gbGVuIDogdG90YWwpLCBtYXhDb3VudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHRvdGFsID4gbWF4Q291bnQpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yZXNldFByZXZpZXdUaHVtYnMoaXNBamF4VXBsb2FkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmICghaXNBamF4VXBsb2FkIHx8IGZsYWdTaW5nbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yZXNldFByZXZpZXdUaHVtYnMoZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChmbGFnU2luZ2xlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQWpheFVwbG9hZCAmJiBjdHIgPT09IDAgJiYgKCFzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpIHx8IHNlbGYub3ZlcndyaXRlSW5pdGlhbCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzZXRQcmV2aWV3VGh1bWJzKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc1ByZXZpZXdhYmxlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnJlYWRGaWxlcyh0ZmlsZXMpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMoMSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9hYm9ydDogZnVuY3Rpb24gKHBhcmFtcykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGRhdGE7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLmFqYXhBYm9ydGVkICYmIHR5cGVvZiBzZWxmLmFqYXhBYm9ydGVkID09PSAnb2JqZWN0JyAmJiBzZWxmLmFqYXhBYm9ydGVkLm1lc3NhZ2UgIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgZGF0YSA9ICQuZXh0ZW5kKHRydWUsIHt9LCBzZWxmLl9nZXRPdXREYXRhKCksIHBhcmFtcyk7XHJcbiAgICAgICAgICAgICAgICBkYXRhLmFib3J0RGF0YSA9IHNlbGYuYWpheEFib3J0ZWQuZGF0YSB8fCB7fTtcclxuICAgICAgICAgICAgICAgIGRhdGEuYWJvcnRNZXNzYWdlID0gc2VsZi5hamF4QWJvcnRlZC5tZXNzYWdlO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCBzZWxmLiRwcm9ncmVzcywgc2VsZi5tc2dDYW5jZWxsZWQpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKHNlbGYuYWpheEFib3J0ZWQubWVzc2FnZSwgZGF0YSwgJ2ZpbGVjdXN0b21lcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5jYW5jZWwoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAhIXNlbGYuYWpheEFib3J0ZWQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVzZXRGaWxlU3RhY2s6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpID0gMCwgbmV3c3RhY2sgPSBbXSwgbmV3bmFtZXMgPSBbXSwgbmV3aWRzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGluZCA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpLCBmaWxlID0gc2VsZi5maWxlc3RhY2tbaW5kXSxcclxuICAgICAgICAgICAgICAgICAgICBwaWQgPSAkdGh1bWIuYXR0cignaWQnKTtcclxuICAgICAgICAgICAgICAgIGlmIChpbmQgPT09ICctMScgfHwgaW5kID09PSAtMSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChmaWxlICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBuZXdzdGFja1tpXSA9IGZpbGU7XHJcbiAgICAgICAgICAgICAgICAgICAgbmV3bmFtZXNbaV0gPSBzZWxmLl9nZXRGaWxlTmFtZShmaWxlKTtcclxuICAgICAgICAgICAgICAgICAgICBuZXdpZHNbaV0gPSBzZWxmLl9nZXRGaWxlSWQoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1iLmF0dHIoeydpZCc6IHNlbGYucHJldmlld0luaXRJZCArICctJyArIGksICdkYXRhLWZpbGVpbmRleCc6IGl9KTtcclxuICAgICAgICAgICAgICAgICAgICBpKys7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5hdHRyKHsnaWQnOiAndXBsb2FkZWQtJyArICRoLnVuaXFJZCgpLCAnZGF0YS1maWxlaW5kZXgnOiAnLTEnfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRwcmV2aWV3LmZpbmQoJyN6b29tLScgKyBwaWQpLmF0dHIoe1xyXG4gICAgICAgICAgICAgICAgICAgICdpZCc6ICd6b29tLScgKyAkdGh1bWIuYXR0cignaWQnKSxcclxuICAgICAgICAgICAgICAgICAgICAnZGF0YS1maWxlaW5kZXgnOiAkdGh1bWIuYXR0cignZGF0YS1maWxlaW5kZXgnKVxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVzdGFjayA9IG5ld3N0YWNrO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVuYW1lcyA9IG5ld25hbWVzO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVpZHMgPSBuZXdpZHM7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaXNGaWxlU2VsZWN0aW9uVmFsaWQ6IGZ1bmN0aW9uIChjbnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBjbnQgPSBjbnQgfHwgMDtcclxuICAgICAgICAgICAgaWYgKHNlbGYucmVxdWlyZWQgJiYgIXNlbGYuZ2V0RmlsZXNDb3VudCgpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5odG1sKCcnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihzZWxmLm1zZ0ZpbGVSZXF1aXJlZCk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYubWluRmlsZUNvdW50ID4gMCAmJiBzZWxmLl9nZXRGaWxlQ291bnQoY250KSA8IHNlbGYubWluRmlsZUNvdW50KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9ub0ZpbGVzRXJyb3Ioe30pO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYXJTdGFjazogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZXN0YWNrID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZW5hbWVzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZWlkcyA9IFtdO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHVwZGF0ZVN0YWNrOiBmdW5jdGlvbiAoaSwgZmlsZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZXN0YWNrW2ldID0gZmlsZTtcclxuICAgICAgICAgICAgc2VsZi5maWxlbmFtZXNbaV0gPSBzZWxmLl9nZXRGaWxlTmFtZShmaWxlKTtcclxuICAgICAgICAgICAgc2VsZi5maWxlaWRzW2ldID0gZmlsZSAmJiBzZWxmLl9nZXRGaWxlSWQoZmlsZSkgfHwgbnVsbDtcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBhZGRUb1N0YWNrOiBmdW5jdGlvbiAoZmlsZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZXN0YWNrLnB1c2goZmlsZSk7XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZW5hbWVzLnB1c2goc2VsZi5fZ2V0RmlsZU5hbWUoZmlsZSkpO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVpZHMucHVzaChzZWxmLl9nZXRGaWxlSWQoZmlsZSkpO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldEZpbGVTdGFjazogZnVuY3Rpb24gKHNraXBOdWxsKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuZmlsZXN0YWNrLmZpbHRlcihmdW5jdGlvbiAobikge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIChza2lwTnVsbCA/IG4gIT09IHVuZGVmaW5lZCA6IG4gIT09IHVuZGVmaW5lZCAmJiBuICE9PSBudWxsKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBnZXRGaWxlc0NvdW50OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgbGVuID0gc2VsZi5pc0FqYX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V4dC5qb2luKCcsICcpLFxyXG4gICAgICAgICAgICAgICAgbWF4UHJldmlld1NpemUgPSBzZWxmLm1heEZpbGVQcmV2aWV3U2l6ZSAmJiBwYXJzZUZsb2F0KHNlbGYubWF4RmlsZVByZXZpZXdTaXplKSxcclxuICAgICAgICAgICAgICAgIGNhblByZXZpZXcgPSAkcHJldmlldy5sZW5ndGggJiYgKCFtYXhQcmV2aWV3U2l6ZSB8fCBpc05hTihtYXhQcmV2aWV3U2l6ZSkpLFxyXG4gICAgICAgICAgICAgICAgdGhyb3dFcnJvciA9IGZ1bmN0aW9uIChtc2csIGZpbGUsIHByZXZpZXdJZCwgaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgcDEgPSAkLmV4dGVuZCh0cnVlLCB7fSwgc2VsZi5fZ2V0T3V0RGF0YSh7fSwge30sIGZpbGVzKSwge2lkOiBwcmV2aWV3SWQsIGluZGV4OiBpbmRleH0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBwMiA9IHtpZDogcHJldmlld0lkLCBpbmRleDogaW5kZXgsIGZpbGU6IGZpbGUsIGZpbGVzOiBmaWxlc30sICR0aHVtYjtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9wcmV2aWV3RGVmYXVsdChmaWxlLCBwcmV2aWV3SWQsIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2sodW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpbmRleCArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG51bUZpbGVzID0gMDtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdEZpbGVBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1iID0gJCgnIycgKyBwcmV2aWV3SWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlbGYucmVtb3ZlRnJvbVByZXZpZXdPbkVycm9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pc0Vycm9yID0gc2VsZi5pc0FqYXhVcGxvYWQgPyBzZWxmLl9zaG93VXBsb2FkRXJyb3IobXNnLCBwMSkgOiBzZWxmLl9zaG93RXJyb3IobXNnLCBwMik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudG90YWxJbWFnZXNDb3VudCA9IDA7XHJcblxyXG4gICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uIChrZXksIGZpbGUpIHtcclxuICAgICAgICAgICAgICAgIHZhciBmdW5jID0gc2VsZi5maWxlVHlwZVNldHRpbmdzLmltYWdlO1xyXG4gICAgICAgICAgICAgICAgaWYgKGZ1bmMgJiYgZnVuYyhmaWxlLnR5cGUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi50b3RhbEltYWdlc0NvdW50Kys7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICByZWFkRmlsZSA9IGZ1bmN0aW9uIChpKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eSgkZWwuYXR0cignbXVsdGlwbGUnKSkpIHtcclxuICAgICAgICAgICAgICAgICAgICBudW1GaWxlcyA9IDE7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoaSA+PSBudW1GaWxlcykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCAmJiBzZWxmLmZpbGVzdGFjay5sZW5ndGggPiAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlYmF0Y2hzZWxlY3RlZCcsIFtzZWxmLmdldEZpbGVTdGFjaygpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHNlbGVjdGVkJywgW2ZpbGVzXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdmFyIG5vZGUgPSBjdHIgKyBpLCBwcmV2aWV3SWQgPSBwcmV2aWV3SW5pdElkICsgJy0nICsgbm9kZSwgZmlsZSA9IGZpbGVzW2ldLCBmU2l6ZUtCLCBqLCBtc2csXHJcbiAgICAgICAgICAgICAgICAgICAgZm5UZXh0ID0gc2V0dGluZ3MudGV4dCwgZm5JbWFnZSA9IHNldHRpbmdzLmltYWdlLCBmbkh0bWwgPSBzZXR0aW5ncy5odG1sLCB0eXAsIGNoaywgdHlwMSwgdHlwMixcclxuICAgICAgICAgICAgICAgICAgICBjYXB0aW9uID0gc2VsZi5fZ2V0RmlsZU5hbWUoZmlsZSwgJycpLCBmaWxlU2l6ZSA9IChmaWxlICYmIGZpbGUuc2l6ZSB8fCAwKSAvIDEwMDAsXHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZUV4dEV4cHIgPSAnJywgcHJldmlld0RhdGEgPSAkaC5jcmVhdGVPYmplY3RVUkwoZmlsZSksIGZpbGVDb3VudCA9IDAsXHJcbiAgICAgICAgICAgICAgICAgICAgc3RyVHlwZXMgPSAnJyxcclxuICAgICAgICAgICAgICAgICAgICBmdW5jLCBrbm93blR5cGVzID0gMCwgaXNUZXh0LCBpc0h0bWwsIGlzSW1hZ2UsIHR4dEZsYWcsIHByb2Nlc3NGaWxlTG9hZGVkID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgbXNnID0gbXNnUHJvZ3Jlc3Muc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbmRleCc6IGkgKyAxLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ZpbGVzJzogbnVtRmlsZXMsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGVyY2VudCc6IDUwLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbChtc2cpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZEZpbGUoaSArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWxvYWRlZCcsIFtmaWxlLCBwcmV2aWV3SWQsIGksIHJlYWRlcl0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBpZiAoIWZpbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAodHlwTGVuID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCB0eXBMZW47IGorKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXAxID0gZmlsZVR5cGVzW2pdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXAyID0gc2VsZi5tc2dGaWxlVHlwZXNbdHlwMV0gfHwgdHlwMTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyVHlwZXMgKz0gaiA9PT0gMCA/IHR5cDIgOiAnLCAnICsgdHlwMjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoY2FwdGlvbiA9PT0gZmFsc2UpIHtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpICsgMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKGNhcHRpb24ubGVuZ3RoID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbXNnID0gc2VsZi5tc2dJbnZhbGlkRmlsZU5hbWUucmVwbGFjZSgne25hbWV9JywgJGguaHRtbEVuY29kZSgkaC5nZXRGaWxlTmFtZShmaWxlKSwgJ1t1bmtub3duXScpKTtcclxuICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoZmlsZUV4dCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlRXh0RXhwciA9IG5ldyBSZWdFeHAoJ1xcXFwuKCcgKyBmaWxlRXh0LmpvaW4oJ3wnKSArICcpJCcsICdpJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBmU2l6ZUtCID0gZmlsZVNpemUudG9GaXhlZCgyKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLm1heEZpbGVTaXplID4gMCAmJiBmaWxlU2l6ZSA+IHNlbGYubWF4RmlsZVNpemUpIHtcclxuICAgICAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ1NpemVUb29MYXJnZS5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAnbmFtZSc6IGNhcHRpb24sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdzaXplJzogZlNpemVLQixcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ21heFNpemUnOiBzZWxmLm1heEZpbGVTaXplXHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihtc2csIGZpbGUsIHByZXZpZXdJZCwgaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYubWluRmlsZVNpemUgIT09IG51bGwgJiYgZmlsZVNpemUgPD0gJGguZ2V0TnVtKHNlbGYubWluRmlsZVNpemUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbXNnID0gc2VsZi5tc2dTaXplVG9vU21hbGwuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IGZTaXplS0IsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdtaW5TaXplJzogc2VsZi5taW5GaWxlU2l6ZVxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHRocm93RXJyb3IobXNnLCBmaWxlLCBwcmV2aWV3SWQsIGkpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShmaWxlVHlwZXMpICYmICRoLmlzQXJyYXkoZmlsZVR5cGVzKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCBmaWxlVHlwZXMubGVuZ3RoOyBqICs9IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdHlwID0gZmlsZVR5cGVzW2pdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmdW5jID0gc2V0dGluZ3NbdHlwXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZmlsZUNvdW50ICs9ICFmdW5jIHx8ICh0eXBlb2YgZnVuYyAhPT0gJ2Z1bmN0aW9uJykgPyAwIDogKGZ1bmMoZmlsZS50eXBlLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGguZ2V0RmlsZU5hbWUoZmlsZSkpID8gMSA6IDApO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAoZmlsZUNvdW50ID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG1zZyA9IHNlbGYubXNnSW52YWxpZEZpbGVUeXBlLnNldFRva2Vucyh7J25hbWUnOiBjYXB0aW9uLCAndHlwZXMnOiBzdHJUeXBlc30pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChmaWxlQ291bnQgPT09IDAgJiYgISRoLmlzRW1wdHkoZmlsZUV4dCkgJiYgJGguaXNBcnJheShmaWxlRXh0KSAmJiAhJGguaXNFbXB0eShmaWxlRXh0RXhwcikpIHtcclxuICAgICAgICAgICAgICAgICAgICBjaGsgPSAkaC5jb21wYXJlKGNhcHRpb24sIGZpbGVFeHRFeHByKTtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlQ291bnQgKz0gJGguaXNFbXB0eShjaGspID8gMCA6IGNoay5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGVDb3VudCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ0ludmFsaWRGaWxlRXh0ZW5zaW9uLnNldFRva2Vucyh7J25hbWUnOiBjYXB0aW9uLCAnZXh0ZW5zaW9ucyc6IHN0ckV4dH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICghc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2soZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpICsgMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3VwZGF0ZUZpbGVEZXRhaWxzKG51bUZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlbG9hZGVkJywgW2ZpbGUsIHByZXZpZXdJZCwgaSwgcmVhZGVyXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCFjYW5QcmV2aWV3ICYmIGZpbGVTaXplID4gbWF4UHJldmlld1NpemUpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2soZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGNvbnRhaW5lci5hZGRDbGFzcygnZmlsZS10aHVtYi1sb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcHJldmlld0RlZmF1bHQoZmlsZSwgcHJldmlld0lkKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0RmlsZUFjdGlvbnMoKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl91cGRhdGVGaWxlRGV0YWlscyhudW1GaWxlcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmVhZEZpbGUoaSArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICgkcHJldmlldy5sZW5ndGggJiYgRmlsZVJlYWRlciAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNUZXh0ID0gZm5UZXh0KGZpbGUudHlwZSwgY2FwdGlvbik7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNIdG1sID0gZm5IdG1sKGZpbGUudHlwZSwgY2FwdGlvbik7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNJbWFnZSA9IGZuSW1hZ2UoZmlsZS50eXBlLCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICAkc3RhdHVzLmh0bWwobXNnTG9hZGluZy5yZXBsYWNlKCd7aW5kZXh9JywgaSArIDEpLnJlcGxhY2UoJ3tmaWxlc30nLCBudW1GaWxlcykpO1xyXG4gICAgICAgICAgICAgICAgICAgICRjb250YWluZXIuYWRkQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbmVycm9yID0gZnVuY3Rpb24gKGV2dCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9lcnJvckhhbmRsZXIoZXZ0LCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbmxvYWQgPSBmdW5jdGlvbiAodGhlRmlsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgaGV4LCBmaWxlSW5mbywgdWludCwgYnl0ZSwgYnl0ZXMgPSBbXSwgY29udGVudHMsIG1pbWUsIHJlYWRUZXh0SW1hZ2UgPSBmdW5jdGlvbiAodGV4dEZsYWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuZXdSZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3UmVhZGVyLm9uZXJyb3IgPSBmdW5jdGlvbiAodGhlRmlsZU5ldykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2Vycm9ySGFuZGxlcih0aGVGaWxlTmV3LCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdSZWFkZXIub25sb2FkID0gZnVuY3Rpb24gKHRoZUZpbGVOZXcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9wcmV2aWV3RmlsZShpLCBmaWxlLCB0aGVGaWxlTmV3LCBwcmV2aWV3SWQsIHByZXZpZXdEYXRhLCBmaWxlSW5mbyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdEZpbGVBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0ZpbGVMb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGV4dEZsYWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdSZWFkZXIucmVhZEFzVGV4dChmaWxlLCBzZWxmLnRleHRFbmNvZGluZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld1JlYWRlci5yZWFkQXNEYXRhVVJMKGZpbGUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlSW5mbyA9IHsnbmFtZSc6IGNhcHRpb24sICd0eXBlJzogZmlsZS50eXBlfTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJC5lYWNoKHNldHRpbmdzLCBmdW5jdGlvbiAoaywgZikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGsgIT09ICdvYmplY3QnICYmIGsgIT09ICdvdGhlcicgJiYgdHlwZW9mIGYgPT09ICdmdW5jdGlvbicgJiYgZihmaWxlLnR5cGUsIGNhcHRpb24pKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga25vd25UeXBlcysrO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGtub3duVHlwZXMgPT09IDApIHsvLyBhdXRvIGRldGVjdCBtaW1lIHR5cGVzIGZyb20gY29udGVudCBpZiBubyBrbm93biBmaWxlIHR5cGVzIGRldGVjdGVkXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50ID0gbmV3IFVpbnQ4QXJyYXkodGhlRmlsZS50YXJnZXQucmVzdWx0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCB1aW50Lmxlbmd0aDsgaisrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZSA9IHVpbnRbal0udG9TdHJpbmcoMTYpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVzLnB1c2goYnl0ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBieXRlcy5qb2luKCcnKS50b0xvd2VyQ2FzZSgpLnN1YnN0cmluZygwLCA4KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbWUgPSAkaC5nZXRNaW1lVHlwZShoZXgsICcnLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShtaW1lKSkgeyAvLyBsb29rIGZvciBhc2NpaSB0ZXh0IGNvbnRlbnRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50cyA9ICRoLmFycmF5QnVmZmVyMlN0cmluZyhyZWFkZXIucmVzdWx0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW1lID0gJGguaXNTdmcoY29udGVudHMpID8gJ2ltYWdlL3N2Zyt4bWwnIDogJGguZ2V0TWltZVR5cGUoaGV4LCBjb250ZW50cywgZmlsZS50eXBlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVJbmZvID0geyduYW1lJzogY2FwdGlvbiwgJ3R5cGUnOiBtaW1lfTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzVGV4dCA9IGZuVGV4dChtaW1lLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0h0bWwgPSBmbkh0bWwobWltZSwgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNJbWFnZSA9IGZuSW1hZ2UobWltZSwgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHh0RmxhZyA9IGlzVGV4dCB8fCBpc0h0bWw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHh0RmxhZyB8fCBpc0ltYWdlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZFRleHRJbWFnZSh0eHRGbGFnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcHJldmlld0ZpbGUoaSwgZmlsZSwgdGhlRmlsZSwgcHJldmlld0lkLCBwcmV2aWV3RGF0YSwgZmlsZUluZm8pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0RmlsZUFjdGlvbnMoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0ZpbGVMb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbnByb2dyZXNzID0gZnVuY3Rpb24gKGRhdGEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEubGVuZ3RoQ29tcHV0YWJsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGZhY3QgPSAoZGF0YS5sb2FkZWQgLyBkYXRhLnRvdGFsKSAqIDEwMCwgcHJvZ3Jlc3MgPSBNYXRoLmNlaWwoZmFjdCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2cgPSBtc2dQcm9ncmVzcy5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbmRleCc6IGkgKyAxLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmaWxlcyc6IG51bUZpbGVzLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwZXJjZW50JzogcHJvZ3Jlc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbChtc2cpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChpc1RleHQgfHwgaXNIdG1sKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRlci5yZWFkQXNUZXh0KGZpbGUsIHNlbGYudGV4dEVuY29kaW5nKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnJlYWRBc0RhdGFVUkwoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkZXIucmVhZEFzQXJyYXlCdWZmZXIoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3ByZXZpZXdEZWZhdWx0KGZpbGUsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRGaWxlKGkgKyAxKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVsb2FkZWQnLCBbZmlsZSwgcHJldmlld0lkLCBpLCByZWFkZXJdKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuYWRkVG9TdGFjayhmaWxlKTtcclxuICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHJlYWRGaWxlKDApO1xyXG4gICAgICAgICAgICBzZWxmLl91cGRhdGVGaWxlRGV0YWlscyhudW1GaWxlcywgZmFsc2UpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgbG9jazogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYuX3Jlc2V0RXJyb3JzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuZGlzYWJsZSgpO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93UmVtb3ZlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC1yZW1vdmUnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0NhbmNlbCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJykuc2hvdygpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlbG9jaycsIFtzZWxmLmZpbGVzdGFjaywgc2VsZi5fZ2V0RXh0cmFEYXRhKCldKTtcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICB1bmxvY2s6IGZ1bmN0aW9uIChyZXNldCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGlmIChyZXNldCA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICByZXNldCA9IHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5lbmFibGUoKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0NhbmNlbCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJykuaGlkZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dSZW1vdmUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5maW5kKCcuZmlsZWlucHV0LXJlbW92ZScpLnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAocmVzZXQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0RmlsZVN0YWNrKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGV1bmxvY2snLCBbc2VsZi5maWxlc3RhY2ssIHNlbGYuX2dldEV4dHJhRGF0YSgpXSk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgeGhyID0gc2VsZi5hamF4UmVxdWVzdHMsIGxlbiA9IHhoci5sZW5ndGgsIGk7XHJcbiAgICAgICAgICAgIGlmIChsZW4gPiAwKSB7XHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpICs9IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNhbmNlbGxpbmcgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgIHhocltpXS5hYm9ydCgpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGluZCA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuZmlsZXN0YWNrW2luZF0gIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5yZW1vdmVDbGFzcygnZGlzYWJsZWQnKS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKS5yZW1vdmVDbGFzcygnZGlzYWJsZWQnKS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi51bmxvY2soKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYXI6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBjYXA7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVjbGVhcicpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi4kYnRuVXBsb2FkLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmZpbmQoJ3ZpZGVvLGF1ZGlvLGltZycpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgJGguY2xlYW5NZW1vcnkoJCh0aGlzKSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICBzZWxmLl9yZXNldFVwbG9hZCgpO1xyXG4gICAgICAgICAgICBzZWxmLmNsZWFyU3RhY2soKTtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnModHJ1ZSk7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLl9oYXNJbml0aWFsUHJldmlldygpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93RmlsZUljb24oKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtaW5wdXQtbmV3Jyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9nZXRUaHVtYnMoKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9jbGVhck9iamVjdHMoJCh0aGlzKSk7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSB7fTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgICAgICBjYXAgPSAoIXNlbGYub3ZlcndyaXRlSW5pdGlhbCAmJiBzZWxmLmluaXRpYWxDYXB0aW9uLmxlbmd0aCA+IDApID8gc2VsZi5pbml0aWFsQ2FwdGlvbiA6ICcnO1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbi5hdHRyKCd0aXRsZScsICcnKS52YWwoY2FwKTtcclxuICAgICAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjb250YWluZXIsICdmaWxlLWlucHV0LW5ldycpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEZWZhdWx0UHJldmlldygpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLiRjb250YWluZXIuZmluZCgkaC5GUkFNRVMpLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLl9pbml0Q2FwdGlvbigpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2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ybWRhdGEgPSB7fTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0RmlsZURyb3Bab25lVGl0bGUoKTtcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBkaXNhYmxlOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi5pc0Rpc2FibGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICBzZWxmLiRlbGVtZW50LmF0dHIoJ2Rpc2FibGVkJywgJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5maW5kKCcua3YtZmlsZWlucHV0LWNhcHRpb24nKS5hZGRDbGFzcygnZmlsZS1jYXB0aW9uLWRpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5maW5kKCcuZmlsZWlucHV0LXJlbW92ZSwgLmZpbGVpbnB1dC11cGxvYWQsIC5maWxlLXByZXZpZXctZnJhbWUgYnV0dG9uJylcclxuICAgICAgICAgICAgICAgIC5hdHRyKCdkaXNhYmxlZCcsIHRydWUpO1xyXG4gICAgICAgICAgICAkaC5hZGRDc3Moc2VsZi4kY29udGFpbmVyLmZpbmQoJy5idG4tZmlsZScpLCAnZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgc2VsZi5faW5pdERyYWdEcm9wKCk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZW5hYmxlOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi5pc0Rpc2FibGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHNlbG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WxmLl9yZXNldFVwbG9hZCgpO1xyXG4gICAgICAgICAgICBpZiAodG90TGVuID09PSAwICYmICFoYXNFeHRyYURhdGEpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihzZWxmLm1zZ1VwbG9hZEVtcHR5KTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRwcm9ncmVzcy5zaG93KCk7XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZFN0YXR1cyA9IHt9O1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMik7XHJcbiAgICAgICAgICAgIGlmICh0b3RMZW4gPT09IDAgJiYgaGFzRXh0cmFEYXRhKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl91cGxvYWRFeHRyYU9ubHkoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBsZW4gPSBzZWxmLmZpbGVzdGFjay5sZW5ndGg7XHJcbiAgICAgICAgICAgIHNlbGYuaGFzSW5pdERhdGEgPSBmYWxzZTtcclxuICAgICAgICAgICAgaWYgKHNlbGYudXBsb2FkQXN5bmMpIHtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNocHJldXBsb2FkJywgW291dERhdGFdKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZENhY2hlID0ge2NvbnRlbnQ6IFtdLCBjb25maWc6IFtdLCB0YWdzOiBbXSwgYXBwZW5kOiB0cnVlfTtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQXN5bmNDb3VudCA9IHNlbGYuZ2V0RmlsZVN0YWNrKCkubGVuZ3RoO1xyXG4gICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbjsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb250ZW50W2ldID0gbnVsbDtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZENhY2hlLmNvbmZpZ1tpXSA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS50YWdzW2ldID0gbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuZmluZCgnLmZpbGUtcHJldmlldy1pbml0aWFsJykucmVtb3ZlQ2xhc3MoJGguU09SVF9DU1MpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmNhY2hlSW5pdGlhbFByZXZpZXcgPSBzZWxmLmdldFByZXZpZXcoKTtcclxuXHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5maWxlc3RhY2tbaV0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBsb2FkU2luZ2xlKGksIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl91cGxvYWRCYXRjaCgpO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGRlc3Ryb3k6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZm9ybSA9IHNlbGYuJGZvcm0sICRjb250ID0gc2VsZi4kY29udGFpbmVyLCAkZWwgPSBzZWxmLiRlbGVtZW50LCBucyA9IHNlbGYubmFtZXNwYWNlO1xyXG4gICAgICAgICAgICAkKGRvY3VtZW50KS5vZmYobnMpO1xyXG4gICAgICAgICAgICAkKHdpbmRvdykub2ZmKG5zKTtcclxuICAgICAgICAgICAgaWYgKCRmb3JtICYmICRmb3JtLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgJGZvcm0ub2ZmKG5zKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fY2xlYW51cCgpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0UHJldmlld0NhY2hlKCk7XHJcbiAgICAgICAgICAgICRlbC5pbnNlcnRCZWZvcmUoJGNvbnQpLm9mZihucykucmVtb3ZlRGF0YSgpO1xyXG4gICAgICAgICAgICAkY29udC5vZmYoKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgcmV0dXJuICRlbDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHJlZnJlc2g6IGZ1bmN0aW9uIChvcHRpb25zKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVsID0gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBvcHRpb25zICE9PSAnb2JqZWN0JyB8fCAkaC5pc0VtcHR5KG9wdGlvbnMpKSB7XHJcbiAgICAgICAgICAgICAgICBvcHRpb25zID0gc2VsZi5vcHRpb25zO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgb3B0aW9ucyA9ICQuZXh0ZW5kKHRydWUsIHt9LCBzZWxmLm9wdGlvbnMsIG9wdGlvbnMpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXQob3B0aW9ucywgdHJ1ZSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2xpc3RlbigpO1xyXG4gICAgICAgICAgICByZXR1cm4gJGVsO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgem9vbTogZnVuY3Rpb24gKGZyYW1lSWQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUgPSBzZWxmLl9nZXRGcmFtZShmcmFtZUlkKSwgJG1vZGFsID0gc2VsZi4kbW9kYWw7XHJcbiAgICAgICAgICAgIGlmICghJGZyYW1lKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGguaW5pdE1vZGFsKCRtb2RhbCk7XHJcbiAgICAgICAgICAgICRtb2RhbC5odG1sKHNlbGYuX2dldE1vZGFsQ29udGVudCgpKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0Wm9vbUNvbnRlbnQoJGZyYW1lKTtcclxuICAgICAgICAgICAgJG1vZGFsLm1vZGFsKCdzaG93Jyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9ucygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0RXhpZjogZnVuY3Rpb24gKGZyYW1lSWQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUgPSBzZWxmLl9nZXRGcmFtZShmcmFtZUlkKTtcclxuICAgICAgICAgICAgcmV0dXJuICRmcmFtZSAmJiAkZnJhbWUuZGF0YSgnZXhpZicpIHx8IG51bGw7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBnZXRGcmFtZXM6IGZ1bmN0aW9uIChjc3NGaWx0ZXIpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWVzO1xyXG4gICAgICAgICAgICBjc3NGaWx0ZXIgPSBjc3NGaWx0ZXIgfHwgJyc7XHJcbiAgICAgICAgICAgICRmcmFtZXMgPSBzZWxmLiRwcmV2aWV3LmZpbmQoJGguRlJBTUVTICsgY3NzRmlsdGVyKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYucmV2ZXJzZVByZXZpZXdPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgJGZyYW1lcyA9ICQoJGZyYW1lcy5nZXQoKS5yZXZlcnNlKCkpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAkZnJhbWVzO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0UHJldmlldzogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICBjb250ZW50OiBzZWxmLmluaXRpYWxQcmV2aWV3LFxyXG4gICAgICAgICAgICAgICAgY29uZmlnOiBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnLFxyXG4gICAgICAgICAgICAgICAgdGFnczogc2VsZi5pbml0aWFsUHJldmlld1RodW1iVGFnc1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcblxyXG4gICAgJC5mbi5maWxlaW5wdXQgPSBmdW5jdGlvbiAob3B0aW9uKSB7XHJcbiAgICAgICAgaWYgKCEkaC5oYXNGaWxlQVBJU3VwcG9ydCgpICYmICEkaC5pc0lFKDkpKSB7XHJcbiAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICB9XHJcbiAgICAgICAgdmFyIGFyZ3MgPSBBcnJheS5hcHBseShudWxsLCBhcmd1bWVudHMpLCByZXR2YWxzID0gW107XHJcbiAgICAgICAgYXJncy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wdCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmRhdGEoJ2ZpbGVpbnB1dCcsIGRhdGEpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbiA9PT0gJ3N0cmluZycpIHtcclxuICAgICAgICAgICAgICAgIHJldHZhbHMucHVzaChkYXRhW29wdGlvbl0uYXBwbHkoZGF0YSwgYXJncykpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgc3dpdGNoIChyZXR2YWxzLmxlbmd0aCkge1xyXG4gICAgICAgICAgICBjYXNlIDA6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcztcclxuICAgICAgICAgICAgY2FzZSAxOlxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJldHZhbHNbMF07XHJcbiAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gcmV0dmFscztcclxuICAgICAgICB9XHJcbiAgICB9O1xyXG5cclxuICAgICQuZm4uZmlsZWlucHV0LmRlZmF1bHRzID0ge1xyXG4gICAgICAgIGxhbmd1YWdlOiAnZW4nLFxyXG4gICAgICAgIHNob3dDYXB0aW9uOiB0cnVlLFxyXG4gICAgICAgIHNob3dCcm93c2U6IHRydWUsXHJcbiAgICAgICAgc2hvd1ByZXZpZXc6IHRydWUsXHJcbiAgICAgICAgc2hvd1JlbW92ZTogdHJ1ZSxcclxuICAgICAgICBzaG93VXBsb2FkOiB0cnVlLFxyXG4gICAgICAgIHNob3dDYW5jZWw6IHRydWUsXHJcbiAgICAgICAgc2hvd0Nsb3NlOiB0cnVlLFxyXG4gICAgICAgIHNob3dVcGxvYWRlZFRodW1iczogdHJ1ZSxcclxuICAgICAgICBicm93c2VPblpvbmVDbGljazogZmFsc2UsXHJcbiAgICAgICAgYXV0b1JlcGxhY2U6IGZhbHNlLFxyXG4gICAgICAgIGF1dG9PcmllbnRJbWFnZTogZn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AgICAgIF9jb25maWcgPSBfb2JqZWN0U3ByZWFkKHt9LCBfY29uZmlnLCBjb25maWcpO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGFjdGlvbiA9IHR5cGVvZiBjb25maWcgPT09ICdzdHJpbmcnID8gY29uZmlnIDogX2NvbmZpZy5zbGlkZTtcblxuICAgICAgICBpZiAoIWRhdGEpIHtcbiAgICAgICAgICBkYXRhID0gbmV3IENhcm91c2VsKHRoaXMsIF9jb25maWcpO1xuICAgICAgICAgICQodGhpcykuZGF0YShEQVRBX0tFWSQyLCBkYXRhKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0eXBlb2YgY29uZmlnID09PSAnbnVtYmVyJykge1xuICAgICAgICAgIGRhdGEudG8oY29uZmlnKTtcbiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgYWN0aW9uID09PSAnc3RyaW5nJykge1xuICAgICAgICAgIGlmICh0eXBlb2YgZGF0YVthY3Rpb25dID09PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihcIk5vIG1ldGhvZCBuYW1lZCBcXFwiXCIgKyBhY3Rpb24gKyBcIlxcXCJcIik7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgZGF0YVthY3Rpb25dKCk7XG4gICAgICAgIH0gZWxzZSBpZiAoX2NvbmZpZy5pbnRlcnZhbCAmJiBfY29uZmlnLnJpZGUpIHtcbiAgICAgICAgICBkYXRhLnBhdXNlKCk7XG4gICAgICAgICAgZGF0YS5jeWNsZSgpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9O1xuXG4gICAgQ2Fyb3VzZWwuX2RhdGFBcGlDbGlja0hhbmRsZXIgPSBmdW5jdGlvbiBfZGF0YUFwaUNsaWNrSGFuZGxlcihldmVudCkge1xuICAgICAgdmFyIHNlbGVjdG9yID0gVXRpbC5nZXRTZWxlY3RvckZyb21FbGVtZW50KHRoaXMpO1xuXG4gICAgICBpZiAoIX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AgICAub24oRXZlbnQkNS5GT0NVU0lOLCBmdW5jdGlvbiAoZXZlbnQpIHtcbiAgICAgICAgaWYgKGRvY3VtZW50ICE9PSBldmVudC50YXJnZXQgJiYgX3RoaXM0Ll9lbGVtZW50ICE9PSBldmVudC50YXJnZXQgJiYgJChfdGhpczQuX2VsZW1lbnQpLmhhcyhldmVudC50YXJnZXQpLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgIF90aGlzNC5fZWxlbWVudC5mb2N1cygpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9O1xuXG4gICAgX3Byb3RvLl9zZXRFc2NhcGVFdmVudCA9IGZ1bmN0aW9uIF9zZXRFc2NhcGVFdmVudCgpIHtcbiAgICAgIHZhciBfdGhpczUgPSB0aGlzO1xuXG4gICAgICBpZiAodGhpcy5faXNTaG93biAmJiB0aGlzLl9jb25maWcua2V5Ym9hcmQpIHtcbiAgICAgICAgJCh0aGlzLl9lbGVtZW50KS5vbihFdmVudCQ1LktFWURPV05fRElTTUlTUywgZnVuY3Rpb24gKGV2ZW50KSB7XG4gICAgICAgICAgaWYgKGV2ZW50LndoaWNoID09PSBFU0NBUEVfS0VZQ09ERSQxKSB7XG4gICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuXG4gICAgICAgICAgICBfdGhpczUuaGlkZSgpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICB9IGVsc2UgaWYgKCF0aGlzLl9pc1Nob3duKSB7XG4gICAgICAgICQodGhpcy5fZWxlbWVudCkub2ZmKEV2ZW50JDUuS0VZRE9XTl9ESVNNSVNTKTtcbiAgICAgIH1cbiAgICB9O1xuXG4gICAgX3Byb3RvLl9zZXRSZXNpemVFdmVudCA9IGZ1bmN0aW9uIF9zZXRSZXNpemVFdmVudCgpIHtcbiAgICAgIHZhciBfdGhpczYgPSB0aGlzO1xuXG4gICAgICBpZiAodGhpcy5faXNTaG93bikge1xuICAgICAgICAkKHdpbmRvdykub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Ch0aXAucXVlcnlTZWxlY3RvckFsbChTZWxlY3RvciQ2LlRPT0xUSVBfSU5ORVIpKSwgdGhpcy5nZXRUaXRsZSgpKTtcbiAgICAgICQodGlwKS5yZW1vdmVDbGFzcyhDbGFzc05hbWUkNi5GQURFICsgXCIgXCIgKyBDbGFzc05hbWUkNi5TSE9XKTtcbiAgICB9O1xuXG4gICAgX3Byb3RvLnNldEVsZW1lbnRDb250ZW50ID0gZnVuY3Rpb24gc2V0RWxlbWVudENvbnRlbnQoJGVsZW1lbnQsIGNvbnRlbnQpIHtcbiAgICAgIGlmICh0eXBlb2YgY29udGVudCA9PT0gJ29iamVjdCcgJiYgKGNvbnRlbnQubm9kZVR5cGUgfHwgY29udGVudC5qcXVlcnkpKSB7XG4gICAgICAgIC8vIENvbnRlbnQgaXMgYSBET00gbm9kZSBvciBhIGpRdWVyeVxuICAgICAgICBpZiAodGhpcy5jb25maWcuaHRtbCkge1xuICAgICAgICAgIGlmICghJChjb250ZW50KS5wYXJlbnQoKS5pcygkZWxlbWVudCkpIHtcbiAgICAgICAgICAgICRlbGVtZW50LmVtcHR5KCkuYXBwZW5kKGNvbnRlbnQpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAkZWxlbWVudC50ZXh0KCQoY29udGVudCkudGV4dCgpKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgaWYgKHRoaXMuY29uZmlnLmh0bWwpIHtcbiAgICAgICAgaWYgKHRoaXMuY29uZmlnLnNhbml0aXplKSB7XG4gICAgICAgICAgY29udGVudCA9IHNhbml0aXplSHRtbChjb250ZW50LCB0aGlzLmNvbmZpZy53aGl0ZUxpc3QsIHRoaXMuY29uZmlnLnNhbml0aXplRm4pO1xuICAgICAgICB9XG5cbiAgICAgICAgJGVsZW1lbnQuaHRtbChjb250ZW50KTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgICRlbGVtZW50LnRleHQoY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PT09ICdudW1iZXInKSB7XG4gICAgICAgIGNvbmZpZy50aXRsZSA9IGNvbmZpZy50aXRsZS50b1N0cmluZygpO1xuICAgICAgfVxuXG4gICAgICBpZiAodHlwZW9mIGNvbmZpZy5jb250ZW50ID09PSAnbnVtYmVyJykge1xuICAgICAgICBjb25maWcuY29udGVudCA9IGNvbmZpZy5jb250ZW50LnRvU3RyaW5nKCk7XG4gICAgICB9XG5cbiAgICAgIFV0aWwudHlwZUNoZWNrQ29uZmlnKE5BTUUkNiwgY29uZmlnLCB0aGlzLmNvbnN0cnVjdG9yLkRlZmF1bHRUeXBlKTtcblxuICAgICAgaWYgKGNvbmZpZy5zYW5pdGl6ZSkge1xuICAgICAgICBjb25maWcudGVtcGxhdGUgPSBzYW5pdGl6ZUh0bWwoY29uZmlnLnRlbXBsYXRlLCBjb25maWcud2hpdGVMaXN0LCBjb25maWcuc2FuaXRpemVGbik7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBjb25maWc7XG4gICAgfTtcblxuICAgIF9wcm90by5fZ2V0RGVsZWdhdGVDb25maWcgPSBmdW5jdGlvbiBfZ2V0RGVsZWdhdGVDb25maWcoKSB7XG4gICAgICB2YXIgY29uZmlnID0ge307XG5cbiAgICAgIGlmICh0aGlzLmNvbmZpZykge1xuICAgICAgICBmb3IgKHZhciBrZXkgaW4gdGhpcy5jb25maWcpIHtcbiAgICAgICAgICBpZiAodGhpcy5jb25zdHJ1Y3Rvci5EZWZhdWx0W2tleV0gIT09IHRoaXMuY29uZmlnW2tleV0pIHtcbiAgICAgICAgICAgIGNvbmZpZ1trZXldID0gdGhpcy5jb25maWdba2V5XTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgcmV0dXJuIGNvbmZpZztcbiAgICB9O1xuXG4gICAgX3Byb3RvLl9jbGVhblRpcENsYXNzID0gZnVuY3Rpb24gX2NsZWFuVGlwQ2xhc3MoKSB7XG4gICAgICB2YXIgJHRpcCA9ICQodGhpc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hdGEoREFUQV9LRVkkNywgZGF0YSk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodHlwZW9mIGNvbmZpZyA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgICBpZiAodHlwZW9mIGRhdGFbY29uZmlnXSA9PT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoXCJObyBtZXRob2QgbmFtZWQgXFxcIlwiICsgY29uZmlnICsgXCJcXFwiXCIpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGRhdGFbY29uZmlnXSgpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9O1xuXG4gICAgX2NyZWF0ZUNsYXNzKFBvcG92ZXIsIG51bGwsIFt7XG4gICAgICBrZXk6IFwiVkVSU0lPTlwiLFxuICAgICAgLy8gR2V0dGVyc1xuICAgICAgZ2V0OiBmdW5jdGlvbiBnZXQoKSB7XG4gICAgICAgIHJldHVybiBWRVJTSU9OJDc7XG4gICAgICB9XG4gICAgfSwge1xuICAgICAga2V5OiBcIkRlZmF1bHRcIixcbiAgICAgIGdldDogZnVuY3Rpb24gZ2V0KCkge1xuICAgICAgICByZXR1cm4gRGVmYXVsdCQ1O1xuICAgICAgfVxuICAgIH0sIHtcbiAgICAgIGtleTogXCJOQU1FXCIsXG4gICAgICBnZXQ6IGZ1bmN0aW9uIGdldCgpIHtcbiAgICAgICAgcmV0dXJuIE5BTUUkNztcbiAgICAgIH1cbiAgICB9LCB7XG4gICAgICBrZXk6IFwiREFUQV9LRVlcIixcbiAgICAgIGdldDogZnVuY3Rpb24gZ2V0KCkge1xuICAgICAgICByZXR1cm4gREFUQV9LRVkkNztcbiAgICAgIH1cbiAgICB9LCB7XG4gICAgICBrZXk6IFwiRXZlbnRcIixcbiAgICAgIGdldDogZnVuY3Rpb24gZ2V0KCkge1xuICAgICAgICByZXR1cm4gRXZlbnQkNztcbiAgICAgIH1cbiAgICB9LCB7XG4gICAgICBrZXk6IFw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3Bvc3RlcicsXHJcbiAgICAnc3JjJyxcclxuICAgICd4bGluazpocmVmJ1xyXG4gIF07XHJcblxyXG4gIHZhciBBUklBX0FUVFJJQlVURV9QQVRURVJOID0gL15hcmlhLVtcXHctXSokL2k7XHJcblxyXG4gIHZhciBEZWZhdWx0V2hpdGVsaXN0ID0ge1xyXG4gICAgLy8gR2xvYmFsIGF0dHJpYnV0ZXMgYWxsb3dlZCBvbiBhbnkgc3VwcGxpZWQgZWxlbWVudCBiZWxvdy5cclxuICAgICcqJzogWydjbGFzcycsICdkaXInLCAnaWQnLCAnbGFuZycsICdyb2xlJywgJ3RhYmluZGV4JywgJ3N0eWxlJywgQVJJQV9BVFRSSUJVVEVfUEFUVEVSTl0sXHJcbiAgICBhOiBbJ3RhcmdldCcsICdocmVmJywgJ3RpdGxlJywgJ3JlbCddLFxyXG4gICAgYXJlYTogW10sXHJcbiAgICBiOiBbXSxcclxuICAgIGJyOiBbXSxcclxuICAgIGNvbDogW10sXHJcbiAgICBjb2RlOiBbXSxcclxuICAgIGRpdjogW10sXHJcbiAgICBlbTogW10sXHJcbiAgICBocjogW10sXHJcbiAgICBoMTogW10sXHJcbiAgICBoMjogW10sXHJcbiAgICBoMzogW10sXHJcbiAgICBoNDogW10sXHJcbiAgICBoNTogW10sXHJcbiAgICBoNjogW10sXHJcbiAgICBpOiBbXSxcclxuICAgIGltZzogWydzcmMnLCAnYWx0JywgJ3RpdGxlJywgJ3dpZHRoJywgJ2hlaWdodCddLFxyXG4gICAgbGk6IFtdLFxyXG4gICAgb2w6IFtdLFxyXG4gICAgcDogW10sXHJcbiAgICBwcmU6IFtdLFxyXG4gICAgczogW10sXHJcbiAgICBzbWFsbDogW10sXHJcbiAgICBzcGFuOiBbXSxcclxuICAgIHN1YjogW10sXHJcbiAgICBzdXA6IFtdLFxyXG4gICAgc3Ryb25nOiBbXSxcclxuICAgIHU6IFtdLFxyXG4gICAgdWw6IFtdXHJcbiAgfVxyXG5cclxuICAvKipcclxuICAg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SxcclxuICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uIChjbGFzc2VzKSB7XHJcbiAgICAgICAgICAgICAgICBjbGFzc2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKS5qb2luKCcgJyk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJGVsZW0ucmVtb3ZlQ2xhc3MoY2xhc3Nlcyk7XHJcbiAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICB0b2dnbGU6IGZ1bmN0aW9uIChjbGFzc2VzLCBmb3JjZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuICRlbGVtLnRvZ2dsZUNsYXNzKGNsYXNzZXMsIGZvcmNlKTtcclxuICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgIGNvbnRhaW5zOiBmdW5jdGlvbiAoY2xhc3Nlcykge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuICRlbGVtLmhhc0NsYXNzKGNsYXNzZXMpO1xyXG4gICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgfTtcclxuXHJcbiAgICAgIGlmIChvYmpDdHIuZGVmaW5lUHJvcGVydHkpIHtcclxuICAgICAgICB2YXIgY2xhc3NMaXN0UHJvcERlc2MgPSB7XHJcbiAgICAgICAgICBnZXQ6IGNsYXNzTGlzdEdldHRlcixcclxuICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsXHJcbiAgICAgICAgICBjb25maWd1cmFibGU6IHRydWVcclxuICAgICAgICB9O1xyXG4gICAgICAgIHRyeSB7XHJcbiAgICAgICAgICBvYmpDdHIuZGVmaW5lUHJvcGVydHkoZWxlbUN0clByb3RvLCBjbGFzc0xpc3RQcm9wLCBjbGFzc0xpc3RQcm9wRGVzYyk7XHJcbiAgICAgICAgfSBjYXRjaCAoZXgpIHsgLy8gSUUgOCBkb2Vzbid0IHN1cHBvcnQgZW51bWVyYWJsZTp0cnVlXHJcbiAg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ZVxyXG4gICAgICAgIGlmIChzZWFyY2hMZW5ndGggKyBzdGFydCA+IHN0cmluZ0xlbmd0aCkge1xyXG4gICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgIH1cclxuICAgICAgICB2YXIgaW5kZXggPSAtMTtcclxuICAgICAgICB3aGlsZSAoKytpbmRleCA8IHNlYXJjaExlbmd0aCkge1xyXG4gICAgICAgICAgaWYgKHN0cmluZy5jaGFyQ29kZUF0KHN0YXJ0ICsgaW5kZXgpICE9IHNlYXJjaFN0cmluZy5jaGFyQ29kZUF0KGluZGV4KSkge1xyXG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICB9O1xyXG4gICAgICBpZiAoZGVmaW5lUHJvcGVydHkpIHtcclxuICAgICAgICBkZWZpbmVQcm9wZXJ0eShTdHJpbmcucHJvdG90eXBlLCAnc3RhcnRzV2l0aCcsIHtcclxuICAgICAgICAgICd2YWx1ZSc6IHN0YXJ0c1dpdGgsXHJcbiAgICAgICAgICAnY29uZmlndXJhYmxlJzogdHJ1ZSxcclxuICAgICAgICAgICd3cml0YWJsZSc6IHRydWVcclxuICAgICAgICB9KTtcclxuICAgICAgfSBlbHNlIHtcclxuICAgICAgICBTdHJpbmcucHJvdG90eXBlLnN0YXJ0c1dpdGggPSBzdGFydHNXaXRoO1xyXG4gICAgICB9XHJcbiAgICB9KCkpO1xyXG4gIH1cclxuXHJcbiAgaWYgKCFPYmplY3Qua2V5cykge1xyXG4gICAgT2JqZWN0LmtleXMgPSBmdW5jdGlvbiAoXHJcbiAgICAgIG8sIC8vIG9iamVjdFxyXG4gICAgICBrLCAvLyBrZXlcclxuICAgICAgciAgLy8gcmVzdWx0IGFycmF5XHJcbiAgICApIHtcclxuICAgICAgLy8gaW5pdGlhbGl6ZSBvYmplY3QgYW5kIHJlc3VsdFxyXG4gICAgICByID0gW107X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xyXG4gICAgICAgIGFjdGlvbnNib3ggPVxyXG4gICAgICAgICAgJzxkaXYgY2xhc3M9XCJicy1hY3Rpb25zYm94XCI+JyArXHJcbiAgICAgICAgICAgICc8ZGl2IGNsYXNzPVwiYnRuLWdyb3VwIGJ0bi1ncm91cC1zbSBidG4tYmxvY2tcIj4nICtcclxuICAgICAgICAgICAgICAnPGJ1dHRvbiB0eXBlPVwiYnV0dG9uXCIgY2xhc3M9XCJhY3Rpb25zLWJ0biBicy1zZWxlY3QtYWxsIGJ0biAnICsgY2xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5zZWxlY3RBbGxUZXh0ICtcclxuICAgICAgICAgICAgICAnPC9idXR0b24+JyArXHJcbiAgICAgICAgICAgICAgJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwiYWN0aW9ucy1idG4gYnMtZGVzZWxlY3QtYWxsIGJ0biAnICsgY2xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5kZXNlbGVjdEFsbFRleHQgK1xyXG4gICAgICAgICAgICAgICc8L2J1dHRvbj4nICtcclxuICAgICAgICAgICAgJzwvZGl2PicgK1xyXG4gICAgICAgICAgJzwvZGl2Pic7XHJcbiAgICAgIH1cclxuXHJcbiAgICAgIGlmICh0aGlzLm11bHRpcGxlICYmIHRoaXMub3B0aW9ucy5kb25lQnV0dG9uKSB7XHJcbiAgICAgICAgZG9uZWJ1dHRvbiA9XHJcbiAgICAgICAgICAnPGRpdiBjbGFzcz1cImJzLWRvbmVidXR0b25cIj4nICtcclxuICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJidG4tZ3JvdXAgYnRuLWJsb2NrXCI+JyArXHJcbiAgICAgICAgICAgICAgJzxidXR0b24gdHlwZT1cImJ1dHRvblwiIGNsYXNzPVwiYnRuIGJ0bi1zbSAnICsgY2xhc3NOYW1lcy5CVVRUT05DTEFTUyArICdcIj4nICtcclxuICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5kb25lQnV0dG9uVGV4dCArXHJcbiAgICAgICAgICAgICAgJzwvYnV0dG9uPicgK1xyXG4gICAgICAgICAgICAnPC9kaXY+JyArXHJcbiAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgfVxyXG5cclxuICAgICAgZHJvcCA9XHJcbiAgICAgICAgJzxkaXYgY2xhc3M9XCJkcm9wZG93biBib290c3RyYXAtc2VsZWN0JyArIHNob3dUaWNrICsgaW5wdXRHcm91cCArICdcIj4nICtcclxuICAgICAgICAgICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cIicgKyB0aGlzLm9wdGlvbnMuc3R5bGVCYXNlICsgJyBkcm9wZG93bi10b2dnbGVcIiAnICsgKHRoaXMub3B0aW9ucy5kaXNwbGF5ID09PSAnc3RhdGljJyA/ICdkYXRhLWRpc3BsYXk9XCJzdGF0aWNcIicgOiAnJykgKyAnZGF0YS10b2dnbGU9XCJkcm9wZG93blwiJyArIGF1dG9mb2N1cyArICcgcm9sZT1cImNvbWJvYm94XCIgYXJpYS1vd25zPVwiJyArIHRoaXMuc2VsZWN0SWQgKyAnXCIgYXJpYS1oYXNwb3B1cD1cImxpc3Rib3hcIiBhcmlhLWV4cGFuZGVkPVwiZmFsc2VcIj4nICtcclxuICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJmaWx0ZXItb3B0aW9uXCI+JyArXHJcbiAgICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJmaWx0ZXItb3B0aW9uLWlubmVyXCI+JyArXHJcbiAgICAgICAgICAgICAgICAnPGRpdiBjbGFzcz1cImZpbHRlci1vcHRpb24taW5uZXItaW5uZXJcIj48L2Rpdj4nICtcclxuICAgICAgICAgICAgICAnPC9kaXY+ICcgK1xyXG4gICAgICAgICAgICAnPC9kaXY+JyArXHJcbiAgICAgICAgICAgIChcclxuICAgICAgICAgICAgICB2ZXJzaW9uLm1ham9yID09PSAnNCcgPyAnJ1xyXG4gICAgICAgICAgICAgIDpcclxuICAgICAgICAgICAgICAnPHNwYW4gY2xhc3M9XCJicy1jYXJldFwiPicgK1xyXG4gICAgICAgICAgICAgICAgdGhpcy5vcHRpb25zLnRlbXBsYXRlLmNhcmV0ICtcclxuICAgICAgICAgICAgICAnPC9zcGFuPidcclxuICAgICAgICAgICAgKSArXHJcbiAgICAgICAgICAnPC9idXR0b24+JyArXHJcbiAgICAgICAgICAnPGRpdiBjbGFzcz1cIicgKyBjbGFzc05hbWVzLk1FTlUgKyAnICcgKyAodmVyc2lvbi5tYWpvciA9PT0gJzQnID8gJycgOiBjbGFzc05hbWVzLlNIT1cpICsgJ1wiPicgK1xyXG4gICAgICAgICAgICBoZWFkZXIgK1xyXG4gICAgICAgICAgICBzZWFyY2hib3ggK1xyXG4gICAgICAgICAgICBhY3Rpb25zYm94ICtcclxuICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJpbm5lciAnICsgY2xhc3NOYW1lcy5TSE9XICsgJ1wiIHJvbGU9XCJsaXN0Ym94XCIgaWQ9XCInICsgdGhpcy5zZWxlY3RJZCArICdcIiB0YWJpbmRleD1cIi0xXCIgJyArIG11bHRpc2VsZWN0YWJsZSArICc+JyArXHJcbiAgICAgICAgICAgICAgICAnPHVsIGNsYXNzPVwiJyArIGNsYXNzTmFtZXMuTUVOVSArICcgaW5uZXIgJyArICh2ZXJzaW9uLm1ham9yID09PSAnNCcgPyBjbGFzc05hbWVzLlNIT1cgOiAnJykgKyAnXCIgcm9sZT1cInByZXNlbnRhdGlvblwiPicgK1xyXG4gICAgICAgICAgICAgICAgJzwvdWw+JyArXHJcbiAgICAgICAgICAgICc8L2Rpdj4nICtcclxuICAgICAgICAgICAgZG9uZWJ1dHRvbiArXHJcbiAgICAgICAgICAnPC9kaXY+JyArXHJcbiAgICAgICAgJzwvZGl2Pic7XHJcblxyXG4gICAgICByZXR1cm4gJChkc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8vIG51bWJlciBvZiBjaHVua3NcclxuXHJcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaHVua0NvdW50OyBpKyspIHtcclxuICAgICAgICAgIHZhciBlbmRPZkNodW5rID0gKGkgKyAxKSAqIGNodW5rU2l6ZTtcclxuXHJcbiAgICAgICAgICBpZiAoaSA9PT0gY2h1bmtDb3VudCAtIDEpIHtcclxuICAgICAgICAgICAgZW5kT2ZDaHVuayA9IHNpemU7XHJcbiAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgY2h1bmtzW2ldID0gW1xyXG4gICAgICAgICAgICAoaSkgKiBjaHVua1NpemUgKyAoIWkgPyAwIDogMSksXHJcbiAgICAgICAgICAgIGVuZE9mQ2h1bmtcclxuICAgICAgICAgIF07XHJcblxyXG4gICAgICAgICAgaWYgKCFzaXplKSBicmVhaztcclxuXHJcbiAgICAgICAgICBpZiAoY3VycmVudENodW5rID09PSB1bmRlZmluZWQgJiYgc2Nyb2xsVG9wIC0gMSA8PSB0aGF0LnNlbGVjdHBpY2tlci5jdXJyZW50LmRhdGFbZW5kT2ZDaHVuayAtIDFdLnBvc2l0aW9uIC0gdGhhdC5zaXplSW5mby5tZW51SW5uZXJIZWlnaHQpIHtcclxuICAgICAgICAgICAgY3VycmVudENodW5rID0gaTtcclxuICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGlmIChjdXJyZW50Q2h1bmsgPT09IHVuZGVmaW5lZCkgY3VycmVudENodW5rID0gMDtcclxuXHJcbiAgICAgICAgcHJldlBvc2l0aW9ucyA9IFt0aGF0LnNlbGVjdHBpY2tlci52aWV3LnBvc2l0aW9uMCwgdGhhdC5zZWxlY3RwaWNrZXIudmlldy5wb3NpdGlvbjFdO1xyXG5cclxuICAgICAgICAvLyBhbHdheXMgZGlzcGxheSBwcmV2aW91cywgY3VycmVudCwgYW5kIG5leHQgY2h1bmtzXHJcbiAgICAgICAgZmlyc3RDaHVuayA9IE1hdGgubWF4KD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RlRG9jdW1lbnRGcmFnbWVudCgpLFxyXG4gICAgICAgICAgICAgICAgZW1wdHlNZW51ID0gbWVudUlubmVyLmZpcnN0Q2hpbGQuY2xvbmVOb2RlKGZhbHNlKSxcclxuICAgICAgICAgICAgICAgIG1hcmdpblRvcCxcclxuICAgICAgICAgICAgICAgIG1hcmdpbkJvdHRvbSxcclxuICAgICAgICAgICAgICAgIGVsZW1lbnRzID0gdGhhdC5zZWxlY3RwaWNrZXIudmlldy52aXNpYmxlRWxlbWVudHMsXHJcbiAgICAgICAgICAgICAgICB0b1Nhbml0aXplID0gW107XHJcblxyXG4gICAgICAgICAgICAvLyByZXBsYWNlIHRoZSBleGlzdGluZyBVTCB3aXRoIGFuIGVtcHR5IG9uZSAtIHRoaXMgaXMgZmFzdGVyIHRoYW4gJC5lbXB0eSgpXHJcbiAgICAgICAgICAgIG1lbnVJbm5lci5yZXBsYWNlQ2hpbGQoZW1wdHlNZW51LCBtZW51SW5uZXIuZmlyc3RDaGlsZCk7XHJcblxyXG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgdmlzaWJsZUVsZW1lbnRzTGVuID0gZWxlbWVudHMubGVuZ3RoOyBpIDwgdmlzaWJsZUVsZW1lbnRzTGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICB2YXIgZWxlbWVudCA9IGVsZW1lbnRzW2ldLFxyXG4gICAgICAgICAgICAgICAgICBlbFRleHQsXHJcbiAgICAgICAgICAgICAgICAgIGVsZW1lbnREYXRhO1xyXG5cclxuICAgICAgICAgICAgICBpZiAodGhhdC5vcHRpb25zLnNhbml0aXplKSB7XHJcbiAgICAgICAgICAgICAgICBlbFRleHQgPSBlbGVtZW50Lmxhc3RDaGlsZDtcclxuXHJcbiAgICAgICAgICAgICAgICBpZiAoZWxUZXh0KSB7XHJcbiAgICAgICAgICAgICAgICAgIGVsZW1lbnREYXRhID0gdGhhdC5zZWxlY3RwaWNrZXIuY3VycmVudC5kYXRhW2kgKyB0aGF0LnNlbGVjdHBpY2tlci52aWV3LnBvc2l0aW9uMF07XHJcblxyXG4gICAgICAgICAgICAgICAgICBpZiAoZWxlbWVudERhdGEgJiYgZWxlbWVudERhdGEuY29udGVudCAmJiAhZWxlbWVudERhdGEuc2FuaXRpemVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdG9TYW5pdGl6ZS5wdXNoKGVsVGV4dCk7XHJcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudERhdGEuc2FuaXRpemVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgbWVudUZyYWdtZW50LmFwcGVuZENoaWxkKGVsZW1lbnQpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAodGhhdC5vcHRpb25zLnNhbml0aXplICYmIHRvU2FuaXRpemUubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgc2FuaXRpemVIdG1sKHRvU2FuaXRpemUsIHRoYXQub3B0aW9ucy53aGl0ZUxpc3QsIHRoYXQub3B0aW9ucy5zYW5pdGl6ZUZuKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgaWYgKGlzVmlydHVhbCA9PT0gdHJ1ZSkge1xyXG4gICAgICAgICAgICAgIG1hcmdpblRvcCA9ICh0aGF0LnNlbGVjdHBpY2tlci52aWV3LnBvc2l0aW9uMCA9PT0gMCA/IDAgOiB0aGF0LnNlbGVjdHBpY2tlci5jdXJyZW50LmRhdGFbdGhhdC5zZWxlY3RwaWNrZXIudmlldy5wb3NpdGlvbjAgLSAxXS5wb3NpdGlvbik7XHJcbiAgICAgICAgICAgICAgbWFyZ2luQm90dG9tID0gKHRoYXQuc2VsZWN0cGlja2VyLnZpZXcucG9zaXRpb24xID4gc2l6ZSAtIDEgPyAwIDogdGhhdC5zZWxlY3RwaWNrZXIuY3VycmVudC5kYXRhW3NpemUgLSA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blxyXG4gICAgICAgICAgICAgIGlmIChpbml0ICYmIG1lbnVJbm5lcklubmVyV2lkdGggPCB0aGF0LnNpemVJbmZvLm1lbnVJbm5lcklubmVyV2lkdGggJiYgdGhhdC5zaXplSW5mby50b3RhbE1lbnVXaWR0aCA+IHRoYXQuc2l6ZUluZm8uc2VsZWN0V2lkdGgpIHtcclxuICAgICAgICAgICAgICAgIG1lbnVJbm5lci5maXJzdENoaWxkLnN0eWxlLm1pbldpZHRoID0gdGhhdC5zaXplSW5mby5tZW51SW5uZXJJbm5lcldpZHRoICsgJ3B4JztcclxuICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1lbnVJbm5lcklubmVyV2lkdGggPiB0aGF0LnNpemVJbmZvLm1lbnVJbm5lcklubmVyV2lkdGgpIHtcclxuICAgICAgICAgICAgICAgIC8vIHNldCB0byAwIHRvIGdldCBhY3R1YWwgd2lkdGggb2YgbWVudVxyXG4gICAgICAgICAgICAgICAgdGhhdC4kbWVudVswXS5zdHlsZS5taW5XaWR0aCA9IDA7XHJcblxyXG4gICAgICAgICAgICAgICAgdmFyIGFjdHVhbE1lbnVXaWR0aCA9IG1lbnVJbm5lci5maXJzdENoaWxkLm9mZnNldFdpZHRoO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmIChhY3R1YWxNZW51V2lkdGggPiB0aGF0LnNpemVJbmZvLm1lbnVJbm5lcklubmVyV2lkdGgpIHtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zaXplSW5mby5tZW51SW5uZXJJbm5lcldpZHRoID0gYWN0dWFsTWVudVdpZHRoO1xyXG4gICAgICAgICAgICAgICAgICBtZW51SW5uZXIuZmlyc3RDaGlsZC5zdHlsZS5taW5XaWR0aCA9IHRoYXQuc2l6ZUluZm8ubWVudUlubmVySW5uZXJXaWR0aCArICdweCc7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgLy8gcmVzZXQgdG8gZGVmYXVsdCBDU1Mgc3R5bGluZ1xyXG4gICAgICAgICAgICAgICAgdGhhdC4kbWVudVswXS5zdHlsZS5taW5XaWR0aCA9ICcnO1xyXG4gICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdGhhdC5wcmV2QWN0aXZlSW5kZXggPSB0aGF0LmFjdGl2ZUluZGV4O1xyXG5cclxuICAgICAgICBpZiAoIXRoYXQub3B0aW9ucy5saXZlU2VhcmNoKSB7XHJcbiAgICAgICAgICB0aGF0LiRtZW51SW5uZXIudHJpZ2dlcignZm9jdXMnKTtcclxuICAgICAgICB9IGVsc2UgaWYgKGlzU2VhcmNoaW5nICYmIGluaXQpIHtcclxuICAgICAgICAgIHZhciBpbmRleCA9IDAsXHJcbiAgICAgICAgICAgICAgbmV3QWN0aXZlO1xyXG5cclxuICAgICAgICAgIGlmICghdGhhdC5zZWxlY3RwaWNrZXIudmlldy5jYW5IaWdobGlnaHRbaW5kZXhdKSB7XHJcbiAgICAgICAgICAgIGluZGV4ID0gMSArIHRoYXQuc2VsZWN0cGlja2VyLnZpZXcuY2FuSGlnaGxpZ2h0LnNsaWNlKDEpLmluZGV4T2YodHJ1ZSk7XHJcbiAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgbmV3QWN0aXZlID0gdGhhdC5zZWxlY3RwaWNrZXIudmlldy52aXNpYmxlRWxlbWVudHNbaW5kZXhdO1xyXG5cclxuICAgICAgICAgIHRoYXQuZGVmb2N1c0l0ZW0odGhhdC5zZWxlY3RwaWNrZXIudmlldy5jdXJyZW50QWN0aXZlKTtcclxuXHJcbiAgICAgICAgICB0aGF0LmFjdGl2ZUluZGV4ID0gKHRoYXQuc2VsZWN0cGlja2VyLmN1cnJlbnQuZGF0YVtpbmRleF0gfHwge30pLmluZGV4O1xyXG5cclxuICAgICAgICAgIHRoYXQuZm9jdXNJdGVtKG5ld0FjdGl2ZSk7XHJcbiAgICAgICAgfVxyXG4gICAgICB9XH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HRncm91cCBkb2Vzbid0IGNyZWF0ZSBiYWNrLXRvLWJhY2sgZGl2aWRlcnNcclxuICAgICAgICBpZiAoXHJcbiAgICAgICAgICBwcmV2aW91c0RhdGEgJiZcclxuICAgICAgICAgIHByZXZpb3VzRGF0YS50eXBlID09PSAnZGl2aWRlcicgJiZcclxuICAgICAgICAgIChwcmV2aW91c0RhdGEub3B0SUQgfHwgY29uZmlnLm9wdElEKVxyXG4gICAgICAgICkge1xyXG4gICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgY29uZmlnID0gY29uZmlnIHx8IHt9O1xyXG4gICAgICAgIGNvbmZpZy50eXBlID0gJ2RpdmlkZXInO1xyXG5cclxuICAgICAgICBtYWluRWxlbWVudHMucHVzaChcclxuICAgICAgICAgIGdlbmVyYXRlT3B0aW9uLmxpKFxyXG4gICAgICAgICAgICBmYWxzZSxcclxuICAgICAgICAgICAgY2xhc3NOYW1lcy5ESVZJREVSLFxyXG4gICAgICAgICAgICAoY29uZmlnLm9wdElEID8gY29uZmlnLm9wdElEICsgJ2RpdicgOiB1bmRlZmluZWQpXHJcbiAgICAgICAgICApXHJcbiAgICAgICAgKTtcclxuXHJcbiAgICAgICAgbWFpbkRhdGEucHVzaChjb25maWcpO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBmdW5jdGlvbiBhZGRPcHRpb24gKG9wdGlvbiwgY29uZmlnKSB7XHJcbiAgICAgICAgY29uZmlnID0gY29uZmlnIHx8IHt9O1xyXG5cclxuICAgICAgICBjb25maWcuZGl2aWRlciA9IG9wdGlvbi5nZXRBdHRyaWJ1dGUoJ2RhdGEtZGl2aWRlcicpID09PSAndHJ1ZSc7XHJcblxyXG4gICAgICAgIGlmIChjb25maWcuZGl2aWRlcikge1xyXG4gICAgICAgICAgYWRkRGl2aWRlcih7XHJcbiAgICAgICAgICAgIG9wdElEOiBjb25maWcub3B0SURcclxuICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0gZW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AgICAgICAgIHRleHRFbGVtZW50LFxyXG4gICAgICAgICAgICAgIG9wdGlvbkNsYXNzLFxyXG4gICAgICAgICAgICAgIGlubGluZVN0eWxlXHJcbiAgICAgICAgICAgICksXHJcbiAgICAgICAgICAgICcnLFxyXG4gICAgICAgICAgICBjb25maWcub3B0SURcclxuICAgICAgICAgICk7XHJcblxyXG4gICAgICAgICAgaWYgKGxpRWxlbWVudC5maXJzdENoaWxkKSB7XHJcbiAgICAgICAgICAgIGxpRWxlbWVudC5maXJzdENoaWxkLmlkID0gdGhhdC5zZWxlY3RJZCArICctJyArIGxpSW5kZXg7XHJcbiAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgbWFpbkVsZW1lbnRzLnB1c2gobGlFbGVtZW50KTtcclxuXHJcbiAgICAgICAgICBvcHRpb24ubGlJbmRleCA9IGxpSW5kZXg7XHJcblxyXG4gICAgICAgICAgY29uZmlnLmRpc3BsYXkgPSBjb25maWcuY29udGVudCB8fCBjb25maWcudGV4dDtcclxuICAgICAgICAgIGNvbmZpZy50eXBlID0gJ29wdGlvbic7XHJcbiAgICAgICAgICBjb25maWcuaW5kZXggPSBsaUluZGV4O1xyXG4gICAgICAgICAgY29uZmlnLm9wdGlvbiA9IG9wdGlvbjtcclxuICAgICAgICAgIGNvbmZpZy5kaXNhYmxlZCA9IGNvbmZpZy5kaXNhYmxlZCB8fCBvcHRpb24uZGlzYWJsZWQ7XHJcblxyXG4gICAgICAgICAgbWFpbkRhdGEucHVzaChjb25maWcpO1xyXG5cclxuICAgICAgICAgIHZhciBjb21iaW5lZExlbmd0aCA9IDA7XHJcblxyXG4gICAgICAgICAgLy8gY291bnQgdGhlIG51bWJlciBvZiBjaGFyYWN0ZXJzIGluIHRoZSBvcHRpb24gLSBub3QgcGVyZmVjdCwgYnV0IHNob3VsZCB3b3JrIGluIG1vc3QgY2FzZXNcclxuICAgICAgICAgIGlmIChjb25maWcuZGlzcGxheSkgY29tYmluZWRMZW5ndGggKz0gY29uZmlnL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3VwQ2xhc3MsIG9wdElEKVxyXG4gICAgICAgICk7XHJcblxyXG4gICAgICAgIG1haW5EYXRhLnB1c2goe1xyXG4gICAgICAgICAgZGlzcGxheTogY29uZmlnLmxhYmVsLFxyXG4gICAgICAgICAgc3VidGV4dDogY29uZmlnLnN1YnRleHQsXHJcbiAgICAgICAgICB0eXBlOiAnb3B0Z3JvdXAtbGFiZWwnLFxyXG4gICAgICAgICAgb3B0SUQ6IG9wdElEXHJcbiAgICAgICAgfSk7XHJcblxyXG4gICAgICAgIGZvciAodmFyIGogPSAwLCBsZW4gPSBvcHRpb25zLmxlbmd0aDsgaiA8IGxlbjsgaisrKSB7XHJcbiAgICAgICAgICB2YXIgb3B0aW9uID0gb3B0aW9uc1tqXTtcclxuXHJcbiAgICAgICAgICBpZiAoaiA9PT0gMCkge1xyXG4gICAgICAgICAgICBoZWFkZXJJbmRleCA9IG1haW5EYXRhLmxlbmd0aCAtIDE7XHJcbiAgICAgICAgICAgIGxhc3RJbmRleCA9IGhlYWRlckluZGV4ICsgbGVuO1xyXG4gICAgICAgICAgfVxyXG5cclxuICAgICAgICAgIGFkZE9wdGlvbihvcHRpb24sIHtcclxuICAgICAgICAgICAgaGVhZGVySW5kZXg6IGhlYWRlckluZGV4LFxyXG4gICAgICAgICAgICBsYXN0SW5kZXg6IGxhc3RJbmRleCxcclxuICAgICAgICAgICAgb3B0SUQ6IG9wdElELFxyXG4gICAgICAgICAgICBvcHRncm91cENsYXNzOiBvcHRncm91cENsYXNzLFxyXG4gICAgICAgICAgICBkaXNhYmxlZDogb3B0Z3JvdXAuZGlzYWJsZWRcclxuICAgICAgICAgIH0pO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgaWYgKG5leHQpIHtcclxuICAgICAgICAgIGFkZERpdmlkZXIoeyBvcHRJRDogb3B0SUQgfSk7XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcblxyXG4gICAgICBmb3IgKHZhciBsZW4gPSBzZWxlY3RPcHRpb25zL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udGVudDogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1jb250ZW50JyksXHJcbiAgICAgICAgICAgICAgICAgICAgc3VidGV4dDogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1zdWJ0ZXh0JyksXHJcbiAgICAgICAgICAgICAgICAgICAgaWNvbjogb3B0aW9uLmdldEF0dHJpYnV0ZSgnZGF0YS1pY29uJylcclxuICAgICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgICAgaWYgKHRoaXMubXVsdGlwbGUgJiYgc2VsZWN0ZWRJbmRleCA+IDApIHtcclxuICAgICAgICAgICAgICAgIHRpdGxlRnJhZ21lbnQuYXBwZW5kQ2hpbGQobXVsdGlwbGVTZXBhcmF0b3IuY2xvbmVOb2RlKGZhbHNlKSk7XHJcbiAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICBpZiAob3B0aW9uLnRpdGxlKSB7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMudGV4dCA9IG9wdGlvbi50aXRsZTtcclxuICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXNEYXRhLmNvbnRlbnQgJiYgdGhhdC5vcHRpb25zLnNob3dDb250ZW50KSB7XHJcbiAgICAgICAgICAgICAgICB0aXRsZU9wdGlvbnMuY29udGVudCA9IHRoaXNEYXRhLmNvbnRlbnQudG9TdHJpbmcoKTtcclxuICAgICAgICAgICAgICAgIGhhc0NvbnRlbnQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAodGhhdC5vcHRpb25zLnNob3dJY29uKSB7XHJcbiAgICAgICAgICAgICAgICAgIHRpdGxlT3B0aW9ucy5pY29uID0gdGhpc0RhdGEuaWNvbjtcclxuICAgICAgICAgICAgICAgICAgdGl0bGVPcHRpb25zLmljb25CYXNlID0gdGhpcy5vcHRpb25zLmljb25CYXNlO1xyXG4gICAgICAgICAgICAgICAgfVx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RoaXMuc2l6ZUluZm8uc2VsZWN0SGVpZ2h0ID0gdGhpcy4kbmV3RWxlbWVudFswXS5vZmZzZXRIZWlnaHQ7XHJcblxyXG4gICAgICB0aGlzLnNldFBvc2l0aW9uRGF0YSgpO1xyXG4gICAgfSxcclxuXHJcbiAgICBnZXRTZWxlY3RQb3NpdGlvbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICB2YXIgdGhhdCA9IHRoaXMsXHJcbiAgICAgICAgICAkd2luZG93ID0gJCh3aW5kb3cpLFxyXG4gICAgICAgICAgcG9zID0gdGhhdC4kbmV3RWxlbWVudC5vZmZzZXQoKSxcclxuICAgICAgICAgICRjb250YWluZXIgPSAkKHRoYXQub3B0aW9ucy5jb250YWluZXIpLFxyXG4gICAgICAgICAgY29udGFpbmVyUG9zO1xyXG5cclxuICAgICAgaWYgKHRoYXQub3B0aW9ucy5jb250YWluZXIgJiYgJGNvbnRhaW5lci5sZW5ndGggJiYgISRjb250YWluZXIuaXMoJ2JvZHknKSkge1xyXG4gICAgICAgIGNvbnRhaW5lclBvcyA9ICRjb250YWluZXIub2Zmc2V0KCk7XHJcbiAgICAgICAgY29udGFpbmVyUG9zLnRvcCArPSBwYXJzZUludCgkY29udGFpbmVyLmNzcygnYm9yZGVyVG9wV2lkdGgnKSk7XHJcbiAgICAgICAgY29udGFpbmVyUG9zLmxlZnQgKz0gcGFyc2VJbnQoJGNvbnRhaW5lci5jc3MoJ2JvcmRlckxlZnRXaWR0aCcpKTtcclxuICAgICAgfSBlbHNlIHtcclxuICAgICAgICBjb250YWluZXJQb3MgPSB7IHRvcDogMCwgbGVmdDogMCB9O1xyXG4gICAgICB9XHJcblxyXG4gICAgICB2YXIgd2luUGFkID0gdGhhdC5vcHRpb25zLndpbmRvd1BhZGRpbmc7XHJcblxyXG4gICAgICB0aGlzLnNpemVJbmZvLnNlbGVjdE9mZnNldFRvcCA9IHBvcy50b3AgLSBjb250YWluZXJQb3MudG9wIC0gJHdpbmRvdy5zY3JvbG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cbiAgICAgICAgICAgICAgICAgIC8vIEJvb3RzdHJhcCAzIGRvZXNuJ3QgaGF2ZSAkLmZuLmRyb3Bkb3duLkNvbnN0cnVjdG9yLkRlZmF1bHRcclxuICAgICAgICAgICAgICAgICAgJC5mbi5kcm9wZG93bi5Db25zdHJ1Y3Rvci5EZWZhdWx0ID8gJC5mbi5kcm9wZG93bi5Db25zdHJ1Y3Rvci5EZWZhdWx0LmRpc3BsYXlcclxuICAgICAgICAgICAgICAgICAgOiBmYWxzZVxyXG4gICAgICAgICAgICAgICAgKTtcclxuXHJcbiAgICAgICAgICAgIHRoYXQuJGJzQ29udGFpbmVyLmFkZENsYXNzKCRlbGVtZW50LmF0dHIoJ2NsYXNzJykucmVwbGFjZSgvZm9ybS1jb250cm9sfGZpdC13aWR0aC9naSwgJycpKS50b2dnbGVDbGFzcyhjbGFzc05hbWVzLkRST1BVUCwgJGVsZW1lbnQuaGFzQ2xhc3MoY2xhc3NOYW1lcy5EUk9QVVApKTtcclxuICAgICAgICAgICAgcG9zID0gJGVsZW1lbnQub2Zmc2V0KCk7XHJcblxyXG4gICAgICAgICAgICBpZiAoISRjb250YWluZXIuaXMoJ2JvZHknKSkge1xyXG4gICAgICAgICAgICAgIGNvbnRhaW5lclBvcyA9ICRjb250YWluZXIub2Zmc2V0KCk7XHJcbiAgICAgICAgICAgICAgY29udGFpbmVyUG9zLnRvcCArPSBwYXJzZUludCgkY29udGFpbmVyLmNzcygnYm9yZGVyVG9wV2lkdGgnKSkgLSAkY29udGFpbmVyLnNjcm9sbFRvcCgpO1xyXG4gICAgICAgICAgICAgIGNvbnRhaW5lclBvcy5sZWZ0ICs9IHBhcnNlSW50KCRjb250YWluZXIuY3NzKCdib3JkZXJMZWZ0V2lkdGgnKSkgLSAkY29udGFpbmVyLnNjcm9sbExlZnQoKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICBjb250YWluZXJQb3MgPSB7IHRvcDogMCwgbGVmdDogMCB9O1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBhY3R1YWxIZWlnaHQgPSAkZWxlbWVudC5oYXNDbGFzcyhjbGFzc05hbWVzLkRST1BVUCkgPyAwIDogJGVsZW1lbnRbMF0ub2Zmc2V0SGVpZ2h0O1xyXG5cclxuICAgICAgICAgICAgLy8gQm9vdHN0cmFwIDQrIHVzZXMgUG9wcGVyIGZvciBtZW51IHBvc2l0aW9uaW5nXHJcbiAgICAgICAgICAgIGlmICh2ZXJzaW9uLm1ham9yIDwgNCB8fCBkaXNwbGF5ID09PSAnc3RhdGljJykge1xyXG4gICAgICAgICAgICAgIGNvbnRhaW5lclBvc2l0aW9uLnRvcCA9IHBvcy50b3AgLSBjb250YWluZXJQb3MudG9wICsgYWN0dWFsSGVpZ2h0O1xyXG4gICAgICAgICAgICAgIGNvbnRhaW5lclBvc2l0aW9uLmxlZnQgPSBwb3MubGVmdCAtIGNvbnRhaW5lclBvcy5sZWZ0O1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBjb250YWluZXJQb3NpdGlvbi53aWR0aCA9ICRlbGVtZW50WzBdLm9mZnNldFdpZHRoO1xyXG5cclxuICAgICAgICAgICAgdGhhdC4kYnNDb250YWluZXIuY3NzKGNvbnRhaW5lclBvc2l0aW9uKTtcclxuICAgICAgICAgIH07XHJcblxyXG4gICAgICB0aGlzLiRidXR0b24ub24oJ2NsaWNrLmJzLmRyb3Bkb3duLmRhdGEtYXBpJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgIGlmICh0aGF0LmlzRGlzYWJsZWQoKSkge1xyXG4gICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgZ2V0UGxhY2VtZW50KHRoYXQuJG5ld0VsZW1lbnQpO1xyXG5cclxuICAgICAgICB0aGF0LiRic0NvbnRhaW5lclxyXG4gICAgICAgICAgLmFwcGVuZFRvKHRoYXQub3B0aW9ucy5jb250YWluZXIpXHJcb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YWxzZTtcclxuXHJcbiAgICAgIGlmICh0aGF0LnNlbGVjdHBpY2tlci52aWV3LnZpc2libGVFbGVtZW50cyAmJiB0aGF0LnNlbGVjdHBpY2tlci52aWV3LnZpc2libGVFbGVtZW50cy5sZW5ndGgpIHtcclxuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHRoYXQuc2VsZWN0cGlja2VyLnZpZXcudmlzaWJsZUVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICB2YXIgbGlEYXRhID0gdGhhdC5zZWxlY3RwaWNrZXIuY3VycmVudC5kYXRhW2kgKyB0aGF0LnNlbGVjdHBpY2tlci52aWV3LnBvc2l0aW9uMF0sXHJcbiAgICAgICAgICAgICAgb3B0aW9uID0gbGlEYXRhLm9wdGlvbjtcclxuXHJcbiAgICAgICAgICBpZiAob3B0aW9uKSB7XHJcbiAgICAgICAgICAgIGlmIChzZWxlY3RlZE9ubHkgIT09IHRydWUpIHtcclxuICAgICAgICAgICAgICB0aGF0LnNldERpc2FibGVkKFxyXG4gICAgICAgICAgICAgICAgbGlEYXRhLmluZGV4LFxyXG4gICAgICAgICAgICAgICAgbGlEYXRhLmRpc2FibGVkXHJcbiAgICAgICAgICAgICAgKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgdGhhdC5zZXRTZWxlY3RlZChcclxuICAgICAgICAgICAgICBsaURhdGEuaW5kZXgsXHJcbiAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkXHJcbiAgICAgICAgICAgICk7XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcbiAgICB9LFxyXG5cclxuICAgIC8qKlxyXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGluZGV4IC0gdGhlIGluZGV4IG9mIHRoZSBvcHRpb24gdGhhdCBpcyBiZWluZyBjaGFuZ2VkXHJcbiAgICAgKiBAcGFyYW0ge2Jvb2xlYW59IHNlbGVjdGVkIC0gd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hc3RhdGU7XHJcblxyXG4gICAgICAgICAgICB0aGF0LnNldFNlbGVjdGVkKGNsaWNrZWRJbmRleCwgIXN0YXRlKTtcclxuICAgICAgICAgICAgJHRoaXMudHJpZ2dlcignYmx1cicpO1xyXG5cclxuICAgICAgICAgICAgaWYgKG1heE9wdGlvbnMgIT09IGZhbHNlIHx8IG1heE9wdGlvbnNHcnAgIT09IGZhbHNlKSB7XHJcbiAgICAgICAgICAgICAgdmFyIG1heFJlYWNoZWQgPSBtYXhPcHRpb25zIDwgZ2V0U2VsZWN0ZWRPcHRpb25zKGVsZW1lbnQpLmxlbmd0aCxcclxuICAgICAgICAgICAgICAgICAgbWF4UmVhY2hlZEdycCA9IG1heE9wdGlvbnNHcnAgPCAkb3B0Z3JvdXAuZmluZCgnb3B0aW9uOnNlbGVjdGVkJykubGVuZ3RoO1xyXG5cclxuICAgICAgICAgICAgICBpZiAoKG1heE9wdGlvbnMgJiYgbWF4UmVhY2hlZCkgfHwgKG1heE9wdGlvbnNHcnAgJiYgbWF4UmVhY2hlZEdycCkpIHtcclxuICAgICAgICAgICAgICAgIGlmIChtYXhPcHRpb25zICYmIG1heE9wdGlvbnMgPT0gMSkge1xyXG4gICAgICAgICAgICAgICAgICBlbGVtZW50LnNlbGVjdGVkSW5kZXggPSAtMTtcclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zZXRPcHRpb25TdGF0dXModHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1heE9wdGlvbnNHcnAgJiYgbWF4T3B0aW9uc0dycCA9PSAxKSB7XHJcbiAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgJG9wdGdyb3VwT3B0aW9ucy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBfb3B0aW9uID0gJG9wdGdyb3VwT3B0aW9uc1tpXTtcclxuICAgICAgICAgICAgICAgICAgICBfb3B0aW9uLnNlbGVjdGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhhdC5zZXRTZWxlY3RlZChfb3B0aW9uLmxpSW5kZXgsIGZhbHNlKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgdGhhdC5zZXRTZWxlY3RlZChjbGlja2VkSW5kZXgsIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgdmFyIG1heE9wdGlvbnNUZXh0ID0gdHlwZW9mIHRoYXQub3B0aW9ucy5tYXhPcHRpb25zVGV4dCA9PT0gJ3N0cmluZycgPyBbdGhhdC5vcHRpb25zLm1heE9wdGlvbnNUZXh0LCB0aGF0Lm9wdGlvbnMubWF4T3B0aW9uc1RleHRdIDogdGhhdC5vcHRpb25zLm1heE9wdGlvbnNUZXh0LFxyXG4gICAgICAgICAgICAgICAgICAgICAgbWF4T3B0aW9uc0FyciA9IHR5cGVvZiBtYXhPcHRpb25zVGV4dCA9PT0gJ2Z1bmN0aW9uJyA/IG1heE9wdGlvbnNUZXh0KG1heE9wdGlvbnMsIG1heE9wdGlvbnNHcnApIDogbWF4T3B0aW9uc1RleHQsXHJcbiAgICAgICAgICAgICAgICAgICAgICBtYXhUeHQgPSBtYXhPcHRpb25zQXJyWzBdLnJlcGxhY2UoJ3tufScsIG1heE9wdGlvbnMpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgbWF4VHh0R3JwID0gbWF4T3B0aW9uc0FyclsxXS5yZXBsYWNlKCd7bn0nLCBtYXhPcHRpb25zR3JwKSxcclxuICAgICAgICAgICAgICAgICAgICAgICRub3RpZnkgPSAkKCc8ZGl2IGNsYXNzPVwibm90aWZ5XCI+PC9kaXY+Jyk7XHJcbiAgICAgICAgICAgICAgICAgIC8vIElmIHt2YXJ9IGlzIHNldCBpbiBhcnJheSwgcmVwbGFjZSBpdFxyXG4gICAgICAgICAgICAgICAgICAvKiogQGRlcHJlY2F0ZWQgKi9cclxuICAgICAgICAgICAgICAgICAgaWYgKG1heE9wdGlvbnNBcnJbMl0pIHtcclxuICAgICAgICAgICAgICAgICAgICBtYXhUeHQgPSBtYXhUeHQucmVwbGFjZSgne3Zhcn0nLCBtYXhPcHRpb25zQXJyWzJdW21heE9wdGlvbnMgPiAxID8gMCA6IDFdKTtcclxuICAgICAgICAgICAgICAgICAgICBtYXhUeHRHcnAgPSBtYXhUeHRHcnAucmVwbGFjZSgne3Zhcn0nLCBtYXhPcHRpb25zQXJyWzJdW21heE9wdGlvbnNHcnAgPiAxID8gMCA6IDFdKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgb3B0aW9uLnNlbGVjdGVkID0gZmFsc2U7XHJcblxyXG4gICAgICAgICAgICAgICAgICB0aGF0LiRtZW51LmFwcGVuZCgkbm90aWZ5KTtcclxuXHJcbiAgICAgICAgICAgICAgICAgIGlmIChtYXhPcHRpb25zICYmIG1heFJlYWNoZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAkbm90aWZ5LmFwcGVuZCgkKCc8ZGl2PicgKyBtYXhUeHQgKyAnPC9kaXY+JykpO1xyXG4gICAgICAgICAgICAgICAgICAgIHRyaWdnZXJDaGFuZ2UgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB0aGF0LiRlbGVtZW50LnRyaWdnZXIoJ21heFJlYWNoZWQnICsgRVZFTlRfS0VZKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgaWYgKG1heE9wdGlvbnNHcnAgJiYgbWF4UmVhY2hlZEdycCkge1xyXG4gICAgICAgICAgICAgICAgICAgICRub3RpZnkuYXBwZW5kKCQoJzxkaXY+JyArIG1heFR4dEdycCArICc8L2Rpdj4nKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgdHJpZ2dlckNoYW5nZSA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIHRoYXQuJGVsZW1lbnQudHJpZ2dlcignbWF4UmVhY2hlZEdycCcgKyBFVkVOVF9LRVkpO1xyXG4gICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGF0LnNldFNlbGVjdGVkKGNsaWNrZWRJbmRleCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICB9LCAxMCk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAkbm90aWZ5WzBdLmNsYXNzTGlzdC5hZGQoJ2ZhZGVPdXQnKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICRub3RpZnkucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAgIH0sIDEwNTApO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgfVxyXG5cclxuICAgICAgICAgIGlmICghdGhhdC5tdWx0aXBsZSB8fCAodGhhdC5tdWx0aXBsZSAmJiB0aGF0Lm9wdGlvbnMubWF4T3B0aW9ucyA9PT0gMSkpIHtcclxuICAgICAgICAgICAgdGhhdC4kYnV0dG9uLnRyaWdnZXIoJ2ZvY3VzJyk7XHJcbiAgICAgICAgICB9IGVsc2UgaWYgKHRoYXQub3B0aW9ucy5saXZlU2VhcmNoKSB7XHJcbiAgICAgICAgICAgIHRoYXQuJHNlYXJjaGJveC50cmlnZ2VyKCdmb2N1cycpO1xyXG4gICAgICAgICAgfVxyXG5cclxuICAgICAgICAgIC8vIFRyaWdnZXIgc2VsZWN0ICdjaGFuZ2UnXHJcbiAgICAgICAgICBpZiAodHJ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gICAgICAgICAgICBjYWNoZUFyci5wdXNoKGxpLmhlYWRlckluZGV4KTtcclxuXHJcbiAgICAgICAgICAgICAgY2FjaGVbbGkubGFzdEluZGV4ICsgMV0gPSB0cnVlO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAoY2FjaGVbaV0gJiYgbGkudHlwZSAhPT0gJ29wdGdyb3VwLWxhYmVsJykgY2FjaGVBcnIucHVzaChpKTtcclxuICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICBmb3IgKHZhciBpID0gMCwgY2FjaGVMZW4gPSBjYWNoZUFyci5sZW5ndGg7IGkgPCBjYWNoZUxlbjsgaSsrKSB7XHJcbiAgICAgICAgICAgIHZhciBpbmRleCA9IGNhY2hlQXJyW2ldLFxyXG4gICAgICAgICAgICAgICAgcHJldkluZGV4ID0gY2FjaGVBcnJbaSAtIDFdLFxyXG4gICAgICAgICAgICAgICAgbGkgPSB0aGF0LnNlbGVjdHBpY2tlci5tYWluLmRhdGFbaW5kZXhdLFxyXG4gICAgICAgICAgICAgICAgbGlQcmV2ID0gdGhhdC5zZWxlY3RwaWNrZXIubWFpbi5kYXRhW3ByZXZJbmRleF07XHJcblxyXG4gICAgICAgICAgICBpZiAobGkudHlwZSAhPT0gJ2RpdmlkZXInIHx8IChsaS50eXBlID09PSAnZGl2aWRlcicgJiYgbGlQcmV2ICYmIGxpUHJldi50eXBlICE9PSAnZGl2aWRlcicgJiYgY2FjaGVMZW4gLSAxICE9PSBpKSkge1xyXG4gICAgICAgICAgICAgIHRoYXQuc2VsZWN0cGlja2VyLnNlYXJjaC5kYXRhLnB1c2gobGkpO1xyXG4gICAgICAgICAgICAgIHNlYXJjaE1hdGNoLnB1c2godGhhdC5zZWxlY3RwaWNrZXIubWFpbi5lbGVtZW50c1tpbmRleF0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgdGhhdC5hY3RpdmVJbmRleCA9IHVuZGVma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iAgICAgICAgIWlzQWN0aXZlICYmXHJcbiAgICAgICAgKFxyXG4gICAgICAgICAgaXNBcnJvd0tleSB8fFxyXG4gICAgICAgICAgKGUud2hpY2ggPj0gNDggJiYgZS53aGljaCA8PSA1NykgfHxcclxuICAgICAgICAgIChlLndoaWNoID49IDk2ICYmIGUud2hpY2ggPD0gMTA1KSB8fFxyXG4gICAgICAgICAgKGUud2hpY2ggPj0gNjUgJiYgZS53aGljaCA8PSA5MClcclxuICAgICAgICApXHJcbiAgICAgICkge1xyXG4gICAgICAgIHRoYXQuJGJ1dHRvbi50cmlnZ2VyKCdjbGljay5icy5kcm9wZG93bi5kYXRhLWFwaScpO1xyXG5cclxuICAgICAgICBpZiAodGhhdC5vcHRpb25zLmxpdmVTZWFyY2gpIHtcclxuICAgICAgICAgIHRoYXQuJHNlYXJjaGJveC50cmlnZ2VyKCdmb2N1cycpO1xyXG4gICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgIH1cclxuICAgICAgfVxyXG5cclxuICAgICAgaWYgKGUud2hpY2ggPT09IGtleUNvZGVzLkVTQ0FQRSAmJiBpc0FjdGl2ZSkge1xyXG4gICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICB0aGF0LiRidXR0b24udHJpZ2dlcignY2xpY2suYnMuZHJvcGRvd24uZGF0YS1hcGknKS50cmlnZ2VyKCdmb2N1cycpO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBpZiAoaXNBcnJvd0tleSkgeyAvLyBpZiB1cCBvciBkb3duXHJcbiAgICAgICAgaWYgKCEkaXRlbXMubGVuZ3RoKSByZXR1cm47XHJcblxyXG4gICAgICAgIGxpQWN0aXZlID0gdGhhdC5zZWxlY3RwaWNrZXIubWFpbi5lbGVtZW50c1t0aGF0LmFjdGl2ZUluZGV4XTtcclxuICAgICAgICBpbmRleCA9IGxpQWN0aXZlID8gQXJyYXkucHJvdG90eXBlLmluZGV4T2YuY2FsbChsaUFjdGl2ZS5wYXJlbnRFbG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PT09PT09PT09PT09PT09PT09XG5cbiAgZnVuY3Rpb24gZ2V0VmFsdWUoJGVsKSB7XG4gICAgcmV0dXJuICRlbC5pcygnW3R5cGU9XCJjaGVja2JveFwiXScpID8gJGVsLnByb3AoJ2NoZWNrZWQnKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6XG4gICAgICAgICAgICRlbC5pcygnW3R5cGU9XCJyYWRpb1wiXScpICAgID8gISEkKCdbbmFtZT1cIicgKyAkZWwuYXR0cignbmFtZScpICsgJ1wiXTpjaGVja2VkJykubGVuZ3RoIDpcbiAgICAgICAgICAgJGVsLmlzKCdzZWxlY3RbbXVsdGlwbGVdJykgID8gKCRlbC52YWwoKSB8fCBbXSkubGVuZ3RoICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRlbC52YWwoKVxuICB9XG5cbiAgdmFyIFZhbGlkYXRvciA9IGZ1bmN0aW9uIChlbGVtZW50LCBvcHRpb25zKSB7XG4gICAgdGhpcy5vcHRpb25zICAgID0gb3B0aW9uc1xuICAgIHRoaXMudmFsaWRhdG9ycyA9ICQuZXh0ZW5kKHt9LCBWYWxpZGF0b3IuVkFMSURBVE9SUywgb3B0aW9ucy5jdXN0b20pXG4gICAgdGhpcy4kZWxlbWVudCAgID0gJChlbGVtZW50KVxuICAgIHRoaXMuJGJ0biAgICAgICA9ICQoJ2J1dHRvblt0eXBlPVwic3VibWl0XCJdLCBpbnB1dFt0eXBlPVwic3VibWl0XCJdJylcbiAgICAgICAgICAgICAgICAgICAgICAgIC5maWx0ZXIoJ1tmb3JtPVwiJyArIHRoaXMuJGVsZW1lbnQuYXR0cignaWQnKSArICdcIl0nKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmFkZCh0aGlzLiRlbGVtZW50LmZpbmQoJ2lucHV0W3R5cGU9XCJzdWJtaXRcIl0sIGJ1dHRvblt0eXBlPVwic3VibWl0XCJdJyk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ZpbGVpbnB1dE1vZGFsJyxcclxuICAgICAgICBNT0RBTF9FVkVOVFM6IFsnc2hvdycsICdzaG93bicsICdoaWRlJywgJ2hpZGRlbicsICdsb2FkZWQnXSxcclxuICAgICAgICBvYmpVcmw6IHdpbmRvdy5VUkwgfHwgd2luZG93LndlYmtpdFVSTCxcclxuICAgICAgICBub3c6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgcmV0dXJuIG5ldyBEYXRlKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBzdG9wRXZlbnQ6IGZ1bmN0aW9uIChlKSB7XHJcbiAgICAgICAgICAgIGUuc3RvcFByb3BhZ2F0aW9uKCk7XHJcbiAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldEZpbGVOYW1lOiBmdW5jdGlvbiAoZmlsZSkge1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBmaWxlLmZpbGVOYW1lICovXHJcbiAgICAgICAgICAgIHJldHVybiBmaWxlID8gKGZpbGUuZmlsZU5hbWUgfHwgZmlsZS5uYW1lIHx8ICcnKSA6ICcnOyAvLyBzb21lIGNvbmZ1c2lvbiBpbiBkaWZmZXJlbnQgdmVyc2lvbnMgb2YgRmlyZWZveFxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY3JlYXRlT2JqZWN0VVJMOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICBpZiAoJGgub2JqVXJsICYmICRoLm9ialVybC5jcmVhdGVPYmplY3RVUkwgJiYgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuICRoLm9ialVybC5jcmVhdGVPYmplY3RVUkwoZGF0YSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgcmV2b2tlT2JqZWN0VVJMOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICBpZiAoJGgub2JqVXJsICYmICRoLm9ialVybC5yZXZva2VPYmplY3RVUkwgJiYgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgJGgub2JqVXJsLnJldm9rZU9iamVjdFVSTChkYXRhKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY29tcGFyZTogZnVuY3Rpb24gKGlucHV0LCBzdHIsIGV4YWN0KSB7XHJcbiAgICAgICAgICAgIHJldHVybiBpbnB1dCAhPT0gdW5kZWZpbmVkICYmIChleGFjdCA/IGlucHV0ID09PSBzdHIgOiBpbnB1dC5tYXRjaChzdHIpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGlzSUU6IGZ1bmN0aW9uICh2ZXIpIHtcclxuICAgICAgICAgICAgdmFyIGRpdiwgc3RhdHVzO1xyXG4gICAgICAgICAgICAvLyBjaGVjayBmb3IgSUUgdmVyc2lvbnMgPCAxMVxyXG4gICAgICAgICAgICBpZiAobmF2aWdhdG9yLmFwcE5hbWUgIT09ICdNaWNyb3NvZnQgSW50ZXJuZXQgRXhwbG9yZXInKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHZlciA9PT0gMTApIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUmVnRXhwKCdtc2llXFxcXHMnICsgdmVyLCAnaScpLnRlc3QobmF2aWdhdG9yLnVzZXJBZ2VudCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZGl2ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7XHJcbiAgICAgICAgICAgIGRpdi5pbm5lckhUTUwgPSAnPCEtLVtpZiBJRSAnICsgdmVyICsgJ10+IDxpPjwvaT4gPCFbZW5kaWZdLS0+JztcclxuICAgICAgICAgICAgc3RhdHVzID0gZGl2LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdpJykubGVuZ3RoO1xyXG4gICAgICAgICAgICBkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGRpdik7XHJcbiAgICAgICAgICAgIGRpdi5wYXJlbnROb2RlLnJlbW92ZUNoaWxkKGRpdik7XHJcbiAgICAgICAgICAgIHJldHVybiBzdGF0dXM7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBjYW5Bc3NpZ25GaWxlc1RvSW5wdXQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIGlucHV0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnaW5wdXQnKTtcclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIGlucHV0LnR5cGUgPSAnZmlsZSc7XHJcbiAgICAgICAgICAgICAgICBpbnB1dC5maWxlcyA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldERyYWdEcm9wRm9sZGVyczogZnVuY3Rpb24gKGl0ZW1zKSB7XHJcbiAgICAgICAgICAgIHZhciBpLCBpdGVtLCBsZW4gPSBpdGVtcyA/IGl0ZW1zLmxlbmd0aCA6IDAsIGZvbGRlcnMgPSAwO1xyXG4gICAgICAgICAgICBpZiAobGVuID4gMCAmJiBpdGVtc1swXS53ZWJraXRHZXRBc0VudHJ5KCkpIHtcclxuICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgIGl0ZW0gPSBpdGVtc1tpXS53ZWJraXRHZXRBc0VudHJ5KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0gJiYgaXRlbS5pc0RpcmVjdG9yeSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb2xkZXJzKys7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiBmb2xkZXJzO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaW5pdE1vZGFsOiBmdW5jdGlvbiAoJG1vZGFsKSB7XHJcbiAgICAgICAgICAgIHZhciAkYm9keSA9ICQoJ2JvZHknKTtcclxuICAgICAgICAgICAgaWYgKCRib2R5Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgJG1vZGFsLmFwcGVuZFRvKCRib2R5KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNFbXB0eTogZnVuY3Rpb24gKHZhbHVlLCB0cmltKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZSA9PT0gdW5kZWZpbmVkIHx8IHZhbHVlID09PSBudWxsIHx8IHZhbHVlLmxlbmd0aCA9PT0gMCB8fCAodHJpbSAmJiAkLnRyaW0odmFsdWUpID09PSAnJyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBpc0FycmF5OiBmdW5jdGlvbiAoYSkge1xyXG4gICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShhKSB8fCBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYSkgPT09ICdbb2JqZWN0IEFycmF5XSc7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBpZlNldDogZnVuY3Rpb24gKG5lZWRsZSwgaGF5c3RhY2ssIGRlZikge1xyXG4gICAgICAgICAgICBkZWYgPSBkZWYgfHwgJyc7XHJcbiAgICAgICAgICAgIHJldHVybiAoaGF5c3RhY2sgJiYgdHlwZW9mIGhheXN0YWNrID09PSAnb2JqZWN0JyAmJiBuZWVkbGUgaW4gaGF5c3RhY2spID8gaGF5c3RhY2tbbmVlZGxlXSA6IGRlZjtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGNsZWFuQXJyYXk6IGZ1bmN0aW9uIChhcnIpIHtcclxuICAgICAgICAgICAgaWYgKCEoYXJyIGluc3RhbmNlb2YgQXJyYXkpKSB7XHJcbiAgICAgICAgICAgICAgICBhcnIgPSBbXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gYXJyLmZpbHRlcihmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIChlICE9PSB1bmRlZmluZWQgJiYgZSAhPT0gbnVsbCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgc3BsaWNlQXJyYXk6IGZ1bmN0aW9uIChhcnIsIGluZGV4LCByZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgdmFyIGksIGogPSAwLCBvdXQgPSBbXSwgbmV3QXJyO1xyXG4gICAgICAgICAgICBpZiAoIShhcnIgaW5zdGFuY2VvZiBBcnJheSkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBbXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBuZXdBcnIgPSAkLmV4dGVuZCh0cnVlLCBbXSwgYXJyKTtcclxuICAgICAgICAgICAgaWYgKHJldmVyc2VPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgbmV3QXJyLnJldmVyc2UoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbmV3QXJyLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaSAhPT0gaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXRbal0gPSBuZXdBcnJbaV07XHJcbiAgICAgICAgICAgICAgICAgICAgaisrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChyZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgICAgIG91dC5yZXZlcnNlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldE51bTogZnVuY3Rpb24gKG51bSwgZGVmKSB7XHJcbiAgICAgICAgICAgIGRlZiA9IGRlZiB8fCAwO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIG51bSA9PT0gJ251bWJlcicpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBudW07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBudW0gPT09ICdzdHJpbmcnKSB7XHJcbiAgICAgICAgICAgICAgICBudW0gPSBwYXJzZUZsb2F0KG51bSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGlzTmFOKG51bSkgPyBkZWYgOiBudW07XHJcbiAgICAgICAgfSxcclxuICAgICAgICBoYXNGaWxlQVBJU3VwcG9ydDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICByZXR1cm4gISEod2luZG93LkZpbGUgJiYgd2luZG93LkZpbGVSZWFkZXIpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaGFzRHJhZ0Ryb3BTdXBwb3J0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBkaXYgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTtcclxuICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZGl2LmRyYWdnYWJsZSAqL1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkaXYub25kcmFnc3RhcnQgKi9cclxuICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZGl2Lm9uZHJvcCAqL1xyXG4gICAgICAgICAgICByZXR1cm4gISRoLmlzSUUoOSkgJiZcclxuICAgICAgICAgICAgICAgIChkaXYuZHJhZ2dhYmxlICE9PSB1bmRlZmluZWQgfHwgKGRpdi5vbmRyYWdzdGFydCAhPT0gdW5kZWZpbmVkICYmIGRpdi5vbmRyb3AgIT09IHVuZGVmaW5lZCkpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaGFzRmlsZVVwbG9hZFN1cHBvcnQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgcmV0dXJuICRoLmhhc0ZpbGVBUElTdXBwb3J0KCkgJiYgd2luZG93LkZvcm1EYXRhO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaGFzQmxvYlN1cHBvcnQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIHJldHVybiAhIXdpbmRvdy5CbG9iICYmIEJvb2xlYW4obmV3IEJsb2IoKSk7XHJcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaGFzQXJyYXlCdWZmZXJWaWV3U3VwcG9ydDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBCbG9iKFtuZXcgVWludDhBcnJheSgxMDApXSkuc2l6ZSA9PT0gMTAwO1xyXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIGRhdGFVUkkyQmxvYjogZnVuY3Rpb24gKGRhdGFVUkkpIHtcclxuICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSlNVbnJlc29sdmVkVmFyaWFibGVcclxuICAgICAgICAgICAgdmFyIEJsb2JCdWlsZGVyID0gd2luZG93LkJsb2JCdWlsZGVyIHx8IHdpbmRvdy5XZWJLaXRCbG9iQnVpbGRlciB8fCB3aW5kb3cuTW96QmxvYkJ1aWxkZXIgfHxcclxuICAgICAgICAgICAgICAgIHdpbmRvdy5NU0Jsb2JCdWlsZGVyLCBjYW5CbG9iID0gJGguaGFzQmxvYlN1cHBvcnQoKSwgYnl0ZVN0ciwgYXJyYXlCdWZmZXIsIGludEFycmF5LCBpLCBtaW1lU3RyLCBiYixcclxuICAgICAgICAgICAgICAgIGNhblByb2NlZWQgPSAoY2FuQmxvYiB8fCBCbG9iQnVpbGRlcikgJiYgd2luZG93LmF0b2IgJiYgd2luZG93LkFycmF5QnVmZmVyICYmIHdpbmRvdy5VaW50OEFycmF5O1xyXG4gICAgICAgICAgICBpZiAoIWNhblByb2NlZWQpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBudWxsO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChkYXRhVVJJLnNwbGl0KCcsJylbMF0uaW5kZXhPZignYmFzZTY0JykgPj0gMCkge1xyXG4gICAgICAgICAgICAgICAgYnl0ZVN0ciA9IGF0b2IoZGF0YVVSSS5zcGxpdCgnLCcpWzFdKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGJ5dGVTdHIgPSBkZWNvZGVVUklDb21wb25lbnQoZGF0YVVSSS5zcGxpdCgnLCcpWzFdKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBhcnJheUJ1ZmZlciA9IG5ldyBBcnJheUJ1ZmZlcihieXRlU3RyLmxlbmd0aCk7XHJcbiAgICAgICAgICAgIGludEFycmF5ID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlCdWZmZXIpO1xyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgYnl0ZVN0ci5sZW5ndGg7IGkgKz0gMSkge1xyXG4gICAgICAgICAgICAgICAgaW50QXJyYXlbaV0gPSBieXRlU3RyLmNoYXJDb2RlQXQoaSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgbWltZVN0ciA9IGRhdGFVUkkuc3BsaXQoJywnKVswXS5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AgICAgc3dpdGNoIChjID4+IDQpIHsgLy8ganNoaW50IGlnbm9yZTpsaW5lXHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDI6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNDpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDU6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gMHh4eHh4eHhcclxuICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gMTEweCB4eHh4ICAgMTB4eCB4eHh4XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIyID0gYXJyYXlbaSsrXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgb3V0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoKChjICYgMHgxRikgPDwgNikgfCAoY2hhcjIgJiAweDNGKSk7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICBjYXNlIDE0OlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyAxMTEwIHh4eHggIDEweHggeHh4eCAgMTB4eCB4eHh4XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIyID0gYXJyYXlbaSsrXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2hhcjMgPSBhcnJheVtpKytdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgoKGMgJiAweDBGKSA8PCAxMikgfCAvLyBqc2hpbnQgaWdub3JlOmxpbmVcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoY2hhcjIgJiAweDNGKSA8PCA2KSB8ICAvLyBqc2hpbnQgaWdub3JlOmxpbmVcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoY2hhcjMgJiAweDNGKSA8PCAwKSk7IC8vIGpzaGludCBpZ25vcmU6bGluZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNIdG1sOiBmdW5jdGlvbiAoc3RyKSB7XHJcbiAgICAgICAgICAgIHZhciBhID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7XHJcbiAgICAgICAgICAgIGEuaW5uZXJIVE1MID0gc3RyO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBjID0gYS5jaGlsZE5vZGVzLCBpID0gYy5sZW5ndGg7IGktLTspIHtcclxuICAgICAgICAgICAgICAgIGlmIChjW2ldLm5vZGVUeXBlID09PSAxKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaXNTdmc6IGZ1bmN0aW9uIChzdHIpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHN0ci5tYXRjaCgvXlxccyo8XFw/eG1sL2kpICYmIChzdHIubWF0Y2goLzwhRE9DVFlQRSBzdmcvaSkgfHwgc3RyLm1hdGNoKC88c3ZnL2kpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldE1pbWVUeXBlOiBmdW5jdGlvbiAoc2lnbmF0dXJlLCBjb250ZW50cywgdHlwZSkge1xyXG4gICAgICAgICAgICBzd2l0Y2ggKHNpZ25hdHVyZSkge1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTAnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTEnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmZkOGZmZTInOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2UvanBlZyc7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc4OTUwNEU0Nyc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdpbWFnZS9wbmcnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNDc0OTQ2MzgnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2UvZ2lmJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzQ5NDkyYTAwJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ltYWdlL3RpZmYnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTI0OTQ2NDYnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW1hZ2Uvd2VicCc7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc2Njc0Nzk3MCc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd2aWRlby8zZ3AnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNGY2NzY3NTMnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndmlkZW8vb2dnJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzFhNDVkZmEzJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3ZpZGVvL21rdic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICcwMDAwMDFiYSc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICcwMDAwMDFiMyc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd2aWRlby9tcGVnJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzMwMjZiMjc1JzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3ZpZGVvL3dtdic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICcyNTUwNDQ0Nic6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9wZGYnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnMjUyMTUwNTMnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vcHMnO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjAzMDQnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjA1MDYnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnNTA0YjA1MDgnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vemlwJztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzM3N2FiY2FmJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uLzd6JztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzc1NzM3NDYxJzpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uL3Rhcic7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc3ODAxNzMwZCc6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9kbWcnO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHNpZ25hdHVyZS5zdWJzdHJpbmcoMCwgNikpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnNDM1NzUzJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24veC1zaG9ja3dhdmUtZmxhc2gnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0OTQ0MzMnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhdWRpby9tcDMnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0MjVhNjgnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9iemlwJztcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc2lnbmF0dXJlLnN1YnN0cmluZygwLCA0KSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzQyNGQnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ltYWdlL2JtcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZmZmYic6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXVkaW8vbXAzJztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc0ZDVhJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcHBsaWNhdGlvbi9leGUnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzFmOWQnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzFmYTAnOlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FwcGxpY2F0aW9uL3ppcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnMWY4Yic6XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXBwbGljYXRpb24vZ3ppcCc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnRlbnRzICYmICFjb250ZW50cy5tYXRjaChcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9bXlxcdTAwMDAtXFx1MDA3Zl0vKSA/ICdhcHBsaWNhdGlvbi90ZXh0LXBsYWluJyA6IHR5cGU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBhZGRDc3M6IGZ1bmN0aW9uICgkZWwsIGNzcykge1xyXG4gICAgICAgICAgICAkZWwucmVtb3ZlQ2xhc3MoY3NzKS5hZGRDbGFzcyhjc3MpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0RWxlbWVudDogZnVuY3Rpb24gKG9wdGlvbnMsIHBhcmFtLCB2YWx1ZSkge1xyXG4gICAgICAgICAgICByZXR1cm4gKCRoLmlzRW1wdHkob3B0aW9ucykgfHwgJGguaXNFbXB0eShvcHRpb25zW3BhcmFtXSkpID8gdmFsdWUgOiAkKG9wdGlvbnNbcGFyYW1dKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHVuaXFJZDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICByZXR1cm4gTWF0aC5yb3VuZChuZXcgRGF0ZSgpLmdldFRpbWUoKSkgKyAnXycgKyBNYXRoLnJvdW5kKE1hdGgucmFuZG9tKCkgKiAxMDApO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaHRtbEVuY29kZTogZnVuY3Rpb24gKHN0ciwgdW5kZWZWYWwpIHtcclxuICAgICAgICAgICAgaWYgKHN0ciA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdW5kZWZWYWwgfHwgbnVsbDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gc3RyLnJlcGxhY2UoLyYvZywgJyZhbXA7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC88L2csICcmbHQ7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8+L2csICcmZ3Q7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cIi9nLCAnJnF1b3Q7JylcclxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8nL2csICcmYXBvczsnKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHJlcGxhY2VUYWdzOiBmdW5jdGlvbiAoc3RyLCB0YWdzKSB7XHJcbiAgICAgICAgICAgIHZhciBvdXQgPSBzdHI7XHJcbiAgICAgICAgICAgIGlmICghdGFncykge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkLmVhY2godGFncywgZnVuY3Rpb24gKGtleSwgdmFsdWUpIHtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdmdW5jdGlvbicpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YWx1ZSA9IHZhbHVlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBvdXQuc3BsaXQoa2V5KS5qb2luKHZhbHVlKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHJldHVybiBvdXQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBjbGVhbk1lbW9yeTogZnVuY3Rpb24gKCR0aHVtYikge1xyXG4gICAgICAgICAgICB2YXIgZGF0YSA9ICR0aHVtYi5pcygnaW1nJykgPyAkdGh1bWIuYXR0cignc3JjJykgOiAkdGh1bWIuZmluZCgnc291cmNlJykuYXR0cignc3JjJyk7XH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ICAgIC8qKiBAbmFtZXNwYWNlIGRvY3VtZW50LnJlcXVlc3RGdWxsc2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC5tc1JlcXVlc3RGdWxsc2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC5tb3pSZXF1ZXN0RnVsbFNjcmVlbiAqL1xyXG4gICAgICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZG9jdW1lbnQud2Via2l0UmVxdWVzdEZ1bGxzY3JlZW4gKi9cclxuICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIEVsZW1lbnQuQUxMT1dfS0VZQk9BUkRfSU5QVVQgKi9cclxuICAgICAgICAgICAgICAgIGlmIChkZS5yZXF1ZXN0RnVsbHNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGRlLnJlcXVlc3RGdWxsc2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkZS5tc1JlcXVlc3RGdWxsc2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlLm1zUmVxdWVzdEZ1bGxzY3JlZW4oKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGUubW96UmVxdWVzdEZ1bGxTY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlLm1velJlcXVlc3RGdWxsU2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGUud2Via2l0UmVxdWVzdEZ1bGxzY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZS53ZWJraXRSZXF1ZXN0RnVsbHNjcmVlbihFbGVtZW50LkFMTE9XX0tFWUJPQVJEX0lOUFVUKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIGRvY3VtZW50LmV4aXRGdWxsc2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC5tc0V4aXRGdWxsc2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC5tb3pDYW5jZWxGdWxsU2NyZWVuICovXHJcbiAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBkb2N1bWVudC53ZWJraXRFeGl0RnVsbHNjcmVlbiAqL1xyXG4gICAgICAgICAgICAgICAgaWYgKGRvYy5leGl0RnVsbHNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGRvYy5leGl0RnVsbHNjcmVlbigpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLm1zRXhpdEZ1bGxzY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZG9jLm1zRXhpdEZ1bGxzY3JlZW4oKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLm1vekNhbmNlbEZ1bGxTY3JlZW4pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvYy5tb3pDYW5jZWxGdWxsU2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jLndlYmtpdEV4aXRGdWxsc2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jLndlYmtpdEV4aXRGdWxsc2NyZWVuKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIG1vdmVBcnJheTogZnVuY3Rpb24gKGFyciwgb2xkSW5kZXgsIG5ld0luZGV4LCByZXZlcnNlT3JkZXIpIHtcclxuICAgICAgICAgICAgdmFyIG5ld0FyciA9ICQuZXh0ZW5kKHRydWUsIFtdLCBhcnIpO1xyXG4gICAgICAgICAgICBpZiAocmV2ZXJzZU9yZGVyKSB7XHJcbiAgICAgICAgICAgICAgICBuZXdBcnIucmV2ZXJzZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChuZXdJbmRleCA+PSBuZXdBcnIubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgayA9IG5ld0luZGV4IC0gbmV3QXJyLmxlbmd0aDtcclxuICAgICAgICAgICAgICAgIHdoaWxlICgoay0tKSArIDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBuZXdBcnIucHVzaCh1bmRlZmluZWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG5ld0Fyci5zcGxpY2UobmV3SW5kZXgsIDAsIG5ld0Fyci5zcGxpY2Uob2xkSW5kZXgsIDEpWzBdKTtcclxuICAgICAgICAgICAgaWYgKHJldmVyc2VPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgbmV3QXJyLnJldmVyc2UoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gbmV3QXJyO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYW5ab29tQ2FjaGU6IGZ1bmN0aW9uICgkZWwpIHtcclxuICAgICAgICAgICAgdmFyICRjYWNoZSA9ICRlbC5jbG9zZXN0KCcua3Ytem9vbS1jYWNoZS10aGVtZScpO1xyXG4gICAgICAgICAgICBpZiAoISRjYWNoZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRjYWNoZSA9ICRlbC5jbG9zZXN0KCcua3Ytem9vbS1jYWNoZScpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRjYWNoZS5yZW1vdmUoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGNsb3NlQnV0dG9uOiBmdW5jdGlvbiAoY3NzKSB7XHJcbiAgICAgICAgICAgIGNzcyA9IGNzcyA/ICdjbG9zZSAnICsgY3NzIDogJ2Nsb3NlJztcclxuICAgICAgICAgICAgcmV0dXJuICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cIicgKyBjc3MgKyAnXCIgYXJpYS1sYWJlbD1cIkNsb3NlXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICA8c3BhbiBhcmlhLWhpZGRlbj1cInRydWVcIj4mdGltZXM7PC9zcGFuPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzwvYnV0dG9uPic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBnZXRSb3RhdGlvbjogZnVuY3Rpb24gKHZhbHVlKSB7XHJcbiAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgMjpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3JvdGF0ZVkoMTgwZGVnKSc7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDM6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdyb3RhdGUoMTgwZGVnKSc7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdyb3RhdGUoMTgwZGVnKSByb3RhdGVZKDE4MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA1OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDI3MGRlZykgcm90YXRlWSgxODBkZWcpJztcclxuICAgICAgICAgICAgICAgIGNhc2UgNjpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3JvdGF0ZSg5MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA3OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDkwZGVnKSByb3RhdGVZKDE4MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA4OlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncm90YXRlKDI3MGRlZyknO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIHNldFRyYW5zZm9ybTogZnVuY3Rpb24gKGVsLCB2YWwpIHtcclxuICAgICAgICAgICAgaWYgKCFlbCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsLnN0eWxlLnRyYW5zZm9ybSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGUud2Via2l0VHJhbnNmb3JtID0gdmFsO1xyXG4gICAgICAgICAgICBlbC5zdHlsZVsnLW1vei10cmFuc2Zvcm0nXSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGVbJy1tcy10cmFuc2Zvcm0nXSA9IHZhbDtcclxuICAgICAgICAgICAgZWwuc3R5bGVbJy1vLXRyYW5zZm9ybSddID0gdmFsO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgc2V0SW1hZ2VPcmllbnRhdGlvbjogZnVuY3Rpb24gKCRpbWcsICR6b29tSW1nLCB2YWx1ZSkge1xyXG4gICAgICAgICAgICBpZiAoISRpbWcgfHwgISRpbWcubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGV2ID0gJ2xvYWQuZmlsZWlucHV0aW1hZ2VvcmllbnQnO1xyXG4gICAgICAgICAgICAkaW1nLm9mZihldikub24oZXYsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciBpbWcgPSAkaW1nLmdldCgwKSwgem9vbUltZyA9ICR6b29tSW1nICYmICR6b29tSW1nLmxlbmd0aCA/ICR6b29tSW1nLmdldCgwKSA6IG51bGwsXHJcbiAgICAgICAgICAgICAgICAgICAgaCA9IGltZy5vZmZzZXRIZWlnaHQsIHcgPSBpbWcub2Zmc2V0V2lkdGgsIHIgPSAkaC5nZXRSb3RhdGlvbih2YWx1ZSk7XHJcbiAgICAgICAgICAgICAgICAkaW1nLmRhdGEoJ29yaWVudGF0aW9uJywgdmFsdWUpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHpvb21JbWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAkem9vbUltZy5kYXRhKCdvcmllbnRhdGlvbicsIHZhbHVlKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA8IDUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkaC5zZXRUcmFuc2Zvcm0oaW1nLCByKTtcclxuICAgICAgICAgICAgICAgICAgICAkaC5zZXRUcmFuc2Zvcm0oem9vbUltZywgcik7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdmFyIG9mZnNldEFuZ2xlID0gTWF0aC5hdGFuKHcgLyBoKSwgb3JpZ0ZhY3RvciA9IE1hdGguc3FydChNYXRoLnBvdyhoLCAyKSArIE1hdGgucG93KHcsIDIpKSxcclxuICAgICAgICAgICAgICAgICAgICBzY2F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O1xyXG4gICAgLy9ub2luc3BlY3Rpb24gSlNVbnVzZWRHbG9iYWxTeW1ib2xzXHJcbiAgICBGaWxlSW5wdXQucHJvdG90eXBlID0ge1xyXG4gICAgICAgIGNvbnN0cnVjdG9yOiBGaWxlSW5wdXQsXHJcbiAgICAgICAgX2NsZWFudXA6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBzZWxmLnJlYWRlciA9IG51bGw7XHJcbiAgICAgICAgICAgIHNlbGYuZm9ybWRhdGEgPSB7fTtcclxuICAgICAgICAgICAgc2VsZi51cGxvYWRDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkU3RhdHVzID0ge307XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkTG9nID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQXN5bmNDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudG90YWxJbWFnZXNDb3VudCA9IDA7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheFJlcXVlc3RzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVCYXRjaENvbXBsZXRlZCA9IHRydWU7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5pc1ByZXZpZXdhYmxlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnNob3dQcmV2aWV3ID0gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5pc0Vycm9yID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgc2VsZi5jYW5jZWxsaW5nID0gZmFsc2U7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdDogZnVuY3Rpb24gKG9wdGlvbnMsIHJlZnJlc2hNb2RlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZiwgJGVsID0gc2VsZi4kZWxlbWVudCwgJGNvbnQsIHQsIHRtcDtcclxuICAgICAgICAgICAgc2VsZi5vcHRpb25zID0gb3B0aW9ucztcclxuICAgICAgICAgICAgJC5lYWNoKG9wdGlvbnMsIGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7XHJcbiAgICAgICAgICAgICAgICBzd2l0Y2ggKGtleSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21pbkZpbGVDb3VudCc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWF4RmlsZUNvdW50JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtaW5GaWxlU2l6ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWF4RmlsZVNpemUnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21heEZpbGVQcmV2aWV3U2l6ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAncmVzaXplSW1hZ2VRdWFsaXR5JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdyZXNpemVJZlNpemVNb3JlVGhhbic6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAncHJvZ3Jlc3NVcGxvYWRUaHJlc2hvbGQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2luaXRpYWxQcmV2aWV3Q291bnQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3pvb21Nb2RhbEhlaWdodCc6XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWluSW1hZ2VIZWlnaHQnOlxyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21heEltYWdlSGVpZ2h0JzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtaW5JbWFnZVdpZHRoJzpcclxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtYXhJbWFnZVdpZHRoJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZltrZXldID0gJGguZ2V0TnVtKHZhbHVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZltrZXldID0gdmFsdWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgaWYgKHNlbGYucnRsKSB7IC8vIHN3YXAgYnV0dG9ucyBmb3IgcnRsXHJcbiAgICAgICAgICAgICAgICB0bXAgPSBzZWxmLnByZXZpZXdab29tQnV0dG9uSWNvbnMucHJldjtcclxuICAgICAgICAgICAgICAgIHNlbGYucHJldmlld1pvb21CdXR0b25JY29ucy5wcmV2ID0gc2VsZi5wcmV2aWV3Wm9vbUJ1dHRvbkljb25zLm5leHQ7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdab29tQnV0dG9uSWNvbnMubmV4dCA9IHRtcDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIXJlZnJlc2hNb2RlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhbnVwKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi4kZm9ybSA9ICRlbC5jbG9zZXN0KCdmb3JtJyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRUZW1wbGF0ZURlZmF1bHRzKCk7XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkRmlsZUF0dHIgPSAhJGguaXNFbXB0eSgkZWwuYXR0cignbmFtZScpKSA/ICRlbC5hdHRyKCduYW1lJykgOiAnZmlsZV9kYXRhJztcclxuICAgICAgICAgICAgdCA9IHNlbGYuX2dldExheW91dFRlbX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ICBpZiAoJGguaXNFbXB0eSgkZWwuYXR0cignaWQnKSkpIHtcclxuICAgICAgICAgICAgICAgICRlbC5hdHRyKCdpZCcsICRoLnVuaXFJZCgpKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLm5hbWVzcGFjZSA9ICcuZmlsZWlucHV0XycgKyAkZWwuYXR0cignaWQnKS5yZXBsYWNlKC8tL2csICdfJyk7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLiRjb250YWluZXIgPT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyID0gc2VsZi5fY3JlYXRlQ29udGFpbmVyKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yZWZyZXNoQ29udGFpbmVyKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGNvbnQgPSBzZWxmLiRjb250YWluZXI7XHJcbiAgICAgICAgICAgIHNlbGYuJGRyb3Bab25lID0gJGNvbnQuZmluZCgnLmZpbGUtZHJvcC16b25lJyk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByb2dyZXNzID0gJGNvbnQuZmluZCgnLmt2LXVwbG9hZC1wcm9ncmVzcycpO1xyXG4gICAgICAgICAgICBzZWxmLiRidG5VcGxvYWQgPSAkY29udC5maW5kKCcuZmlsZWlucHV0LXVwbG9hZCcpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyID0gJGguZ2V0RWxlbWVudChvcHRpb25zLCAnZWxDYXB0aW9uQ29udGFpbmVyJywgJGNvbnQuZmluZCgnLmZpbGUtY2FwdGlvbicpKTtcclxuICAgICAgICAgICAgc2VsZi4kY2FwdGlvbiA9ICRoLmdldEVsZW1lbnQob3B0aW9ucywgJ2VsQ2FwdGlvblRleHQnLCAkY29udC5maW5kKCcuZmlsZS1jYXB0aW9uLW5hbWUnKSk7XHJcbiAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShzZWxmLm1zZ1BsYWNlaG9sZGVyKSkge1xyXG4gICAgICAgICAgICAgICAgZiA9ICRlbC5hdHRyKCdtdWx0aXBsZScpID8gc2VsZi5maWxlUGx1cmFsIDogc2VsZi5maWxlU2luZ2xlO1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbi5hdHRyKCdwbGFjZWhvbGRlcicsIHNlbGYubXNnUGxhY2Vob2xkZXIucmVwbGFjZSgne2ZpbGVzfScsIGYpKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uSWNvbiA9IHNlbGYuJGNhcHRpb25Db250YWluZXIuZmluZCgnLmZpbGUtY2FwdGlvbi1pY29uJyk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByZXZpZXdDb250YWluZXIgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbFByZXZpZXdDb250YWluZXInLCAkY29udC5maW5kKCcuZmlsZS1wcmV2aWV3JykpO1xyXG4gICAgICAgICAgICBzZWxmLiRwcmV2aWV3ID0gJGguZ2V0RWxlbWVudChvcHRpb25zLCAnZWxQcmV2aWV3SW1hZ2UnLCAkY29udC5maW5kKCcuZmlsZS1wcmV2aWV3LXRodW1ibmFpbHMnKSk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByZXZpZXdTdGF0dXMgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbFByZXZpZXdTdGF0dXMnLCAkY29udC5maW5kKCcuZmlsZS1wcmV2aWV3LXN0YXR1cycpKTtcclxuICAgICAgICAgICAgc2VsZi4kZXJyb3JDb250YWluZXIgPSAkaC5nZXRFbGVtZW50KG9wdGlvbnMsICdlbEVycm9yQ29udGFpbmVyJyxcclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXdDb250YWluZXIuZmluZCgnLmt2LWZpbGVpbnB1dC1lcnJvcicpKTtcclxuICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEaXNhYmxlZCgpO1xyXG4gICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoc2VsZi5tc2dFcnJvckNsYXNzKSkge1xyXG4gICAgICAgICAgICAgICAgJGguYWRkQ3NzKHNlbGYuJGVycm9yQ29udGFpbmVyLCBzZWxmLm1zZ0Vycm9yQ2xhc3MpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghcmVmcmVzaE1vZGUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGVycm9yQ29udGFpbmVyLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0luaXRJZCA9ICdwcmV2aWV3LScgKyAkaC51bmlxSWQoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3Q2FjaGUoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi4kcGFyZW50Lmhhc0NsYXNzKCdmaWxlLWxvYWRpbmcnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5pbnNlcnRCZWZvcmUoc2VsZi4kcGFyZW50KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRwYXJlbnQucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuX2Vycm9yc0V4aXN0KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fc2V0RmlsZURyb3Bab25lVGl0bGUoKTtcclxuICAgICAgICAgICAgaWYgK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ICAgICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJrdi11cGxvYWQtcHJvZ3Jlc3Mga3YtaGlkZGVuXCI+PC9kaXY+PGRpdiBjbGFzcz1cImNsZWFyZml4XCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPGRpdiBjbGFzcz1cImlucHV0LWdyb3VwIHtjbGFzc31cIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgIHtjYXB0aW9ufVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzxkaXYgY2xhc3M9XCJpbnB1dC1ncm91cC1idG4gaW5wdXQtZ3JvdXAtYXBwZW5kXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAge3JlbW92ZX1cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICB7Y2FuY2VsfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIHt1cGxvYWR9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAge2Jyb3dzZX1cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgICAgICAgdE1haW4yID0gJ3twcmV2aWV3fVxcbjxkaXYgY2xhc3M9XCJrdi11cGxvYWQtcHJvZ3Jlc3Mga3YtaGlkZGVuXCI+PC9kaXY+XFxuPGRpdiBjbGFzcz1cImNsZWFyZml4XCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAne3JlbW92ZX1cXG57Y2FuY2VsfVxcbnt1cGxvYWR9XFxue2Jyb3dzZX1cXG4nO1xyXG4gICAgICAgICAgICB0UHJldmlldyA9ICc8ZGl2IGNsYXNzPVwiZmlsZS1wcmV2aWV3IHtjbGFzc31cIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAge2Nsb3NlfScgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwie2Ryb3BDbGFzc31cIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtcHJldmlldy10aHVtYm5haWxzXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwiY2xlYXJmaXhcIj48L2Rpdj4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtcHJldmlldy1zdGF0dXMgdGV4dC1jZW50ZXIgdGV4dC1zdWNjZXNzXCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDxkaXYgY2xhc3M9XCJrdi1maWxlaW5wdXQtZXJyb3JcIj48L2Rpdj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgICAgICAgdENsb3NlID0gJGguY2xvc2VCdXR0b24oJ2ZpbGVpbnB1dC1yZW1vdmUnKTtcclxuICAgICAgICAgICAgdEZpbGVJY29uID0gJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGdseXBoaWNvbi1maWxlXCI+PC9pPic7XHJcbiAgICAgICAgICAgIC8vIG5vaW5zcGVjdGlvbiBIdG1sVW5rbm93bkF0dHJpYnV0ZVxyXG4gICAgICAgICAgICB0Q2FwdGlvbiA9ICc8ZGl2IGNsYXNzPVwiZmlsZS1jYXB0aW9uIGZvcm0tY29udHJvbCB7Y2xhc3N9XCIgdGFiaW5kZXg9XCI1MDBcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgIDxzcGFuIGNsYXNzPVwiZmlsZS1jYXB0aW9uLWljb25cIj48L3NwYW4+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICA8aW5wdXQgY2xhc3M9XCJmaWxlLWNhcHRpb24tbmFtZVwiIG9ua2V5ZG93bj1cInJldHVybiBmYWxzZTtc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PGRpdiBjbGFzcz1cIm1vZGFsLWRpYWxvZyBtb2RhbC1sZ3tydGx9XCIgcm9sZT1cImRvY3VtZW50XCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICA8ZGl2IGNsYXNzPVwibW9kYWwtY29udGVudFwiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwibW9kYWwtaGVhZGVyXCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgPGg1IGNsYXNzPVwibW9kYWwtdGl0bGVcIj57aGVhZGluZ308L2g1PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIDxzcGFuIGNsYXNzPVwia3Ytem9vbS10aXRsZVwiPjwvc3Bhbj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICA8ZGl2IGNsYXNzPVwia3Ytem9vbS1hY3Rpb25zXCI+e3RvZ2dsZWhlYWRlcn17ZnVsbHNjcmVlbn17Ym9yZGVybGVzc317Y2xvc2V9PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwibW9kYWwtYm9keVwiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgIDxkaXYgY2xhc3M9XCJmbG9hdGluZy1idXR0b25zXCI+PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgPGRpdiBjbGFzcz1cImt2LXpvb20tYm9keSBmaWxlLXpvb20tY29udGVudCB7em9vbUZyYW1lQ2xhc3N9XCI+PC9kaXY+XFxuJyArICd7cHJldn0ge25leHR9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIDwvZGl2PlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+XFxuJztcclxuICAgICAgICAgICAgdFByb2dyZXNzID0gJzxkaXYgY2xhc3M9XCJwcm9ncmVzc1wiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICA8ZGl2IGNsYXNzPVwie2NsYXNzfVwiIHJvbGU9XCJwcm9ncmVzc2JhclwiJyArXHJcbiAgICAgICAgICAgICAgICAnIGFyaWEtdmFsdWVub3c9XCJ7cGVyY2VudH1cIiBhcmlhLXZhbHVlbWluPVwiMFwiIGFyaWEtdmFsdWVtYXg9XCIxMDBcIiBzdHlsZT1cIndpZHRoOntwZXJjZW50fSU7XCI+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgICB7c3RhdHVzfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+JztcclxuICAgICAgICAgICAgdFNpemUgPSAnIDxzYW1wPih7c2l6ZVRleHR9KTwvc2FtcD4nO1xyXG4gICAgICAgICAgICB0Rm9vdGVyID0gJzxkaXYgY2xhc3M9XCJmaWxlLXRodW1ibmFpbC1mb290ZXJcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtZm9vdGVyLWNhcHRpb25cIiB0aXRsZT1cIntjYXB0aW9ufVwiPlxcbicgK1xyXG4gICAgICAgICAgICAgICAgJyAgICAgICAgPGRpdiBjbGFzcz1cImZpbGUtY2FwdGlvbi1pbmZvXCI+e2NhcHRpb259PC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgICAgICA8ZGl2IGNsYXNzPVwiZmlsZS1zaXplLWluZm9cIj57c2l6ZX08L2Rpdj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnICAgIHtwcm9ncmVzc31cXG57aW5kaWNhdG9yfVxcbnthY3Rpb25zfVxcbicgK1xyXG4gICAgICAgICAgICAgICAgJzwvZGl2Pic7XHJcbiAgICAgICAgICAgIHRBY3Rpb25zID0gJzxkaXYgY2xhc3M9XCJmaWxlLWFjdGlvbnNcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgPGRpdiBjbGFzcz1cImZpbGUtZm9vdGVyLWJ1dHRvbnNcIj5cXG4nICtcclxuICAgICAgICAgICAgICAgICcgICAgICAgIHtkb3dubG9hZH0ge3VwbG9hZH0ge2RlbGV0ZX0ge3pvb219IHtvdGhlcn0nICtcclxuICAgICAgICAgICAgICAgICcgICAgPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPC9kaXY+XFxuJyArXHJcbiAgICAgICAgICAgICAgICAne2RyYWd9XFxuJyArXHJcbiAgICAgICAgICAgICAgICAnPGRpdiBjbGFzcz1cImNsZWFyZml4XCI+PC9kaXY+JztcclxuICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSHRtbFVua25vd25BdHRyaWJ1dGVcclxuICAgICAgICAgICAgdEFjdGlvbkRlbGV0ZSA9ICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cImt2LWZpbGUtcmVtb3ZlIHtyZW1vdmVDbGFzc31cIiAnICtcclxuICAgICAgICAgICAgICAgICd0aXRsZT1cIntyZW1vdmVUaXRsZX1cIiB7ZGF0YVVybH17ZGF0YUtleX0+e3JlbW92ZUljb259PC9idXR0b24+XFxuJztcclxuICAgICAgICAgICAgdEFjdGlvblVwbG9hZCA9ICc8YnV0dG9uIHR5cGU9XCJidXR0b25cIiBjbGFzcz1cImt2LWZpbGUtdXBsb2FkIHt1cGxvYWRDbGFzc31cIiB0aXRsZT1cInt1cGxvYWRUaXRsZX1cIj4nICtcclxuICAgICAgICAgICAgICAgICd7dXBsb2FkSWNvbn08L2J1dHRvbj4nO1xyXG4gICAgICAgICAgICB0QWN0aW9uRG93bmxvYWQgPSAnPGEgY2xhc3M9XCJrdi1maWxlLWRvd25sb2FkIHtkb3dubG9hZENsYXNzfVwiIHRpdGxlPVwie2Rvd25sb2FkVGl0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n0nLCBzZWxmLl9lbmNvZGVVUkkoc2VsZi5wZGZSZW5kZXJlclVybCkpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuZGVmYXVsdHMgPSB7XHJcbiAgICAgICAgICAgICAgICBsYXlvdXRUZW1wbGF0ZXM6IHtcclxuICAgICAgICAgICAgICAgICAgICBtYWluMTogdE1haW4xLFxyXG4gICAgICAgICAgICAgICAgICAgIG1haW4yOiB0TWFpbjIsXHJcbiAgICAgICAgICAgICAgICAgICAgcHJldmlldzogdFByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAgICAgY2xvc2U6IHRDbG9zZSxcclxuICAgICAgICAgICAgICAgICAgICBmaWxlSWNvbjogdEZpbGVJY29uLFxyXG4gICAgICAgICAgICAgICAgICAgIGNhcHRpb246IHRDYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgIG1vZGFsTWFpbjogdE1vZGFsTWFpbixcclxuICAgICAgICAgICAgICAgICAgICBtb2RhbDogdE1vZGFsLFxyXG4gICAgICAgICAgICAgICAgICAgIHByb2dyZXNzOiB0UHJvZ3Jlc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgc2l6ZTogdFNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgZm9vdGVyOiB0Rm9vdGVyLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvcjogdEluZGljYXRvcixcclxuICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiB0QWN0aW9ucyxcclxuICAgICAgICAgICAgICAgICAgICBhY3Rpb25EZWxldGU6IHRBY3Rpb25EZWxldGUsXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uVXBsb2FkOiB0QWN0aW9uVXBsb2FkLFxyXG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbkRvd25sb2FkOiB0QWN0aW9uRG93bmxvYWQsXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uWm9vbTogdEFjdGlvblpvb20sXHJcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uRHJhZzogdEFjdGlvbkRyYWcsXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuRGVmYXVsdDogdEJ0bkRlZmF1bHQsXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuTGluazogdEJ0bkxpbmssXHJcbiAgICAgICAgICAgICAgICAgICAgYnRuQnJvd3NlOiB0QnRuQnJvd3NlLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21DYWNoZTogdFpvb21DYWNoZVxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHByZXZpZXdNYXJrdXBUYWdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQmVmb3JlMTogdFRhZ0JlZjEsXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQmVmb3JlMjogdFRhZ0JlZjIsXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnQWZ0ZXI6IHRUYWdBZnRcclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3Q29udGVudFRlbXBsYXRlczoge1xyXG4gICAgICAgICAgICAgICAgICAgIGdlbmVyaWM6IHRHZW5lcmljLFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IHRIdG1sLFxyXG4gICAgICAgICAgICAgICAgICAgIGltYWdlOiB0SW1hZ2UsXHJcbiAgICAgICAgICAgICAgICAgICAgdGV4dDogdFRleHQsXHJcbiAgICAgICAgICAgICAgICAgICAgb2ZmaWNlOiB0T2ZmaWNlLFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB0R2RvY3MsXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IHRWaWRlbyxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzogdEF1ZGlvLFxyXG4gICAgICAgICAgICAgICAgICAgIGZsYXNoOiB0Rmxhc2gsXHJcbiAgICAgICAgICAgICAgICAgICAgb2JqZWN0OiB0T2JqZWN0LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogdFBkZixcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjogdE90aGVyXHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgYWxsb3dlZFByZXZpZXdUeXBlczogWydpbWFnZScsICdodG1sJywgJ3RleHQnLCAndmlkZW8nLCAnYXVkaW8nLCAnZmxhc2gnLCAncGRmJywgJ29iamVjdCddLFxyXG4gICAgICAgICAgICAgICAgcHJldmlld1RlbXBsYXRlczoge30sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3U2V0dGluZ3M6IHtcclxuICAgICAgICAgICAgICAgICAgICBpbWFnZToge3dpZHRoOiAnYXV0bycsIGhlaWdodDogJ2F1dG8nLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWF4LWhlaWdodCc6ICcxMDAlJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgaHRtbDoge3dpZHRoOiAnMjEzcHgnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBnZG9jczoge3dpZHRoOiAnMjEzcHgnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHZpZGVvOiB7d2lkdGg6ICcyMTNweCcsIGhlaWdodDogJzE2MHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgYXVkaW86IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICczMHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgZmxhc2g6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IHt3aWR0aDogJzIxM3B4JywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBwZGY6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIG90aGVyOiB7d2lkdGg6ICcyMTNweCcsIGhlaWdodDogJzE2MHB4J31cclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3U2V0dGluZ3NTbWFsbDoge1xyXG4gICAgICAgICAgICAgICAgICAgIGltYWdlOiB7d2lkdGg6ICdhdXRvJywgaGVpZ2h0OiAnYXV0bycsICdtYXgtd2lkdGgnOiAnMTAwJScsICdtYXgtaGVpZ2h0JzogJzEwMCUnfSxcclxuICAgICAgICAgICAgICAgICAgICBodG1sOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICB0ZXh0OiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICcxNjBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICB2aWRlbzoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJ2F1dG8nfSxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzMwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBmbGFzaDoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJ2F1dG8nfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICdhdXRvJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgcGRmOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTYwcHgnfSxcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjoge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzE2MHB4J31cclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3Wm9vbVNldHRpbmdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICdhdXRvJywgJ21heC13aWR0aCc6ICcxMDAlJywgJ21heC1oZWlnaHQnOiAnMTAwJSd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IHZEZWZhdWx0RGltLFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IHZEZWZhdWx0RGltLFxyXG4gICAgICAgICAgICAgICAgICAgIG9mZmljZToge3dpZHRoOiAnMTAwJScsIGhlaWdodDogJzEwMCUnLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIGdkb2NzOiB7d2lkdGg6ICcxMDAlJywgaGVpZ2h0OiAnMTAwJScsICdtYXgtd2lkdGgnOiAnMTAwJScsICdtaW4taGVpZ2h0JzogJzQ4MHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICcxMDAlJywgJ21heC13aWR0aCc6ICcxMDAlJ30sXHJcbiAgICAgICAgICAgICAgICAgICAgYXVkaW86IHt3aWR0aDogJzEwMCUnLCBoZWlnaHQ6ICczMHB4J30sXHJcbiAgICAgICAgICAgICAgICAgICAgZmxhc2g6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIG9iamVjdDoge3dpZHRoOiAnYXV0bycsIGhlaWdodDogJzEwMCUnLCAnbWF4LXdpZHRoJzogJzEwMCUnLCAnbWluLWhlaWdodCc6ICc0ODBweCd9LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogdkRlZmF1bHREaW0sXHJcbiAgICAgICAgICAgICAgICAgICAgb3RoZXI6IHt3aWR0aDogJ2F1dG8nLCBoZWlnaHQ6ICcxMDAlJywgJ21pbi1oZWlnaHQnOiAnNDgwcHgnfVxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIG1pbWVUeXBlQWxpYXNlczoge1xyXG4gICAgICAgICAgICAgICAgICAgICd2aWRlby9xdWlja3RpbWUnOiAndmlkZW8vbXA0J1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIGZpbGVUeXBlU2V0dGluZ3M6IHtcclxuICAgICAgICAgICAgICAgICAgICBpbWFnZTogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCRoLmNvbXBhcmUodlR5cGUsICdpbWFnZS4qJykgJiYgISRoLmNvbXBhcmUodlR5cGUsIC8odGlmZj98d21mKSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4oZ2lmfHBuZ3xqcGU/ZykkL2kpKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIGh0bWw6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd0ZXh0L2h0bWwnKSB8fCAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKGh0bXxodG1sKSQvaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvZmZpY2U6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsIC8od29yZHxleGNlbHxwb3dlcnBvaW50fG9mZmljZSkkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKGRvY3g/fHhsc3g/fHBwdHg/fHBwc3xwb3R4PykkL2kpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgZ2RvY3M6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsIC8od29yZHxleGNlbHxwb3dlcnBvaW50fG9mZmljZXxpd29yay1wYWdlc3x0aWZmPykkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9cXC4oZG9jeD98eGxzeD98cHB0eD98cHBzfHBvdHg/fHJ0ZnxvZHN8b2R0fHBhZ2VzfGFpfGR4Znx0dGZ8dGlmZj98d21mfGU/cHMpJC9pKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIHRleHQ6IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd0ZXh0LionKSB8fCAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKHhtbHxqYXZhc2NyaXB0KSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4odHh0fG1kfGNzdnxuZm98aW5pfGpzb258cGhwfGpzfGNzcykkL2kpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgdmlkZW86IGZ1bmN0aW9uICh2VHlwZSwgdk5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRoLmNvbXBhcmUodlR5cGUsICd2aWRlby4qJykgJiYgKCRoLmNvbXBhcmUodlR5cGUsIC8ob2dnfG1wNHxtcD9nfG1vdnx3ZWJtfDNncCkkL2kpIHx8XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaC5jb21wYXJlKHZOYW1lLCAvXFwuKG9nP3xtcDR8d2VibXxtcD9nfG1vdnwzZ3ApJC9pKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBhdWRpbzogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGguY29tcGFyZSh2VHlwZSwgJ2F1ZGlvLionKSAmJiAoJGguY29tcGFyZSh2TmFtZSwgLyhvZ2d8bXAzfG1wP2d8d2F2KSQvaSkgfHxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNvbXBhcmUodk5hbWUsIC9cXC4ob2c/fG1wM3xtcD9nfHdhdikkL2kpKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIGZsYXNoOiBmdW5jdGlvbiAodlR5cGUsIHZOYW1lKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkaC5jb21wYXJlKHZUeXBlLCAnYXBwbGljYXRpb24veC1zaG9ja3dhdmUtZmxhc2gnLCB0cnVlKSB8fCAkaC5jb21wYXJlKHZOYW1lLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgL1xcLihzd2YpJC9pKTtcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIHBkZjogZnVuY3Rpb24gKHZUeXBlLCB2TmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGguY29tcGFyZSh2VHlwZSwgJ2FwcGxpY2F0aW9uL3BkZicsIHRydWUpIHx8ICRoLmNvbXBhcmUodk5hbWUsIC9cXC4ocGRmKSQvaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgICAgICBvdGhlcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZmlsZUFjdGlvblNldHRpbmdzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2hvd1JlbW92ZTogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93VXBsb2FkOiB0cnVlLFxyXG4gICAgICAgICAgICAgICAgICAgIHNob3dEb3dubG9hZDogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93Wm9vbTogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICBzaG93RHJhZzogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICByZW1vdmVJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXRyYXNoXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgcmVtb3ZlQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGVmYXVsdCBidG4tb3V0bGluZS1zZWNvbmRhcnknLFxyXG4gICAgICAgICAgICAgICAgICAgIHJlbW92ZUVycm9yQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGFuZ2VyJyxcclxuICAgICAgICAgICAgICAgICAgICByZW1vdmVUaXRsZTogJ1JlbW92ZSBmaWxlJyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXVwbG9hZFwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIHVwbG9hZENsYXNzOiAnYnRuIGJ0bi1zbSBidG4ta3YgYnRuLWRlZmF1bHQgYnRuLW91dGxpbmUtc2Vjb25kYXJ5JyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRUaXRsZTogJ1VwbG9hZCBmaWxlJyxcclxuICAgICAgICAgICAgICAgICAgICB1cGxvYWRSZXRyeUljb246ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tcmVwZWF0XCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgdXBsb2FkUmV0cnlUaXRsZTogJ1JldHJ5IHVwbG9hZCcsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRJY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLWRvd25sb2FkXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRDbGFzczogJ2J0biBidG4tc20gYnRuLWt2IGJ0bi1kZWZhdWx0IGJ0bi1vdXRsaW5lLXNlY29uZGFyeScsXHJcbiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRUaXRsZTogJ0Rvd25sb2FkIGZpbGUnLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21JY29uOiAnPGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXpvb20taW5cIj48L2k+JyxcclxuICAgICAgICAgICAgICAgICAgICB6b29tQ2xhc3M6ICdidG4gYnRuLXNtIGJ0bi1rdiBidG4tZGVmYXVsdCBidG4tb3V0bGluZS1zZWNvbmRhcnknLFxyXG4gICAgICAgICAgICAgICAgICAgIHpvb21UaXRsZTogJ1ZpZXcgRGV0YWlscycsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ0ljb246ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tbW92ZVwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGRyYWdDbGFzczogJ3RleHQtaW5mbycsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ1RpdGxlOiAnTW92ZSAvIFJlYXJyYW5nZScsXHJcbiAgICAgICAgICAgICAgICAgICAgZHJhZ1NldHRpbmdzOiB7fSxcclxuICAgICAgICAgICAgICAgICAgICBpbmRpY2F0b3JOZXc6ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tcGx1cy1zaWduIHRleHQtd2FybmluZ1wiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvclN1Y2Nlc3M6ICc8aSBjbGFzcz1cImdseXBoaWNvbiBnbHlwaGljb24tb2stc2lnbiB0ZXh0LXN1Y2Nlc3NcIj48L2k+JyxcclxuICAgICAgICAgICAgICAgICAgICBpbmRpY2F0b3JFcnJvcjogJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGdseXBoaWNvbi1leGNsYW1hdGlvbi1zaWduIHRleHQtZGFuZ2VyXCI+PC9pPicsXHJcbiAgICAgICAgICAgICAgICAgICAgaW5kaWNhdG9yTG9hZGluZzogJzxpIGNsYXNzPVwiZ2x5cGhpY29uIGdseXBoaWNvbi1ob3VyZ2xhc3MgdGV4dC1tdXRlZFwiPjwvaT4nLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvck5ld1RpdGxlOiAnTm90IHVwbG9hZGVkIHlldCcsXHJcbiAgICAgICAgICAgICAgICAgICAgaW5kaWNhdG9yU3VjY2Vzc1RpdGxlOiAnVXBsb2FkZWQnLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvckVycm9yVGl0bGU6ICdVcGxvYWQgRXJyb3InLFxyXG4gICAgICAgICAgICAgICAgICAgIGluZGljYXRvckxvYWRpbmdUaXRsZTogJ1VwbG9hZGluZyAuLi4nXHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICQuZWFjaChzZWxmLmRlZmF1bHRzLCBmdW5jdGlvbiAoa2V5LCBzZXR0aW5nKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSAnYWxsb3dlZFByZXZpZXdUeXBlcycpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzID0gc2V0dGluZztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZltrZXldID0gJC5leHRlbmQodHJ1ZSwge30sIHNldHRpbmcsIHNlbGZba2V5XSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0UHJldmlld1RlbXBsYXRlcygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3VGVtcGxhdGVzOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdGFncyA9IHNlbGYucHJldmlld01hcmt1cFRhZ3MsIHRhZ0JlZiwgdGFnQWZ0ID0gdGFncy50YWdBZnRlcjtcclxuICAgICAgICAgICAgJC5lYWNoKHNlbGYucHJldmlld0NvbnRlbnRUZW1wbGF0ZXMsIGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShzZWxmLnByZXZpZXdUZW1wbGF0ZXNba2V5XSkpIHtcclxuICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdzLnRhZ0JlZm9yZTI7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleSA9PT0gJ2dlbmVyaWMnIHx8IGtleSA9PT0gJ2ltYWdlJyB8fCBrZXkgPT09ICdodG1sJyB8fCBrZXkgPT09ICd0ZXh0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdzLnRhZ0JlZm9yZTE7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLl9pc1BkZlJlbmRlcmVkKCkgJiYga2V5ID09PSAncGRmJykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0YWdCZWYgPSB0YWdCZWYucmVwbGFjZSgna3YtZmlsZS1jb250ZW50JywgJ2t2LWZpbGUtY29udGVudCBrdi1wZGYtcmVuZGVyZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3VGVtcGxhdGVzW2tleV0gPSB0YWdCZWYgKyB2YWx1ZSArIHRhZ0FmdDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFByZXZpZXdDYWNoZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlID0ge1xyXG4gICAgICAgICAgICAgICAgZGF0YToge30sXHJcbiAgICAgICAgICAgICAgICBpbml0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNvbnRlbnQgPSBzZWxmLmluaXRpYWxQcmV2aWV3O1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChjb250ZW50Lmxlbmd0aCA+IDAgJiYgISRoLmlzQXJyYXkoY29udGVudCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudCA9IGNvbnRlbnQuc3BsaXQoc2VsZi5pbml0aWFsUHJldmlld0RlbGltaXRlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZzogc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGFnczogc2VsZi5pbml0aWFsUHJldmlld1RodW1iVGFnc1xyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgY291bnQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFzZWxmLnByZXZpZXdDYWNoZS5kYXRhICYmICEhc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50ID9cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50Lmxlbmd0aCA6IDA7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoaSwgaXNEaXNhYmxlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBpbmQgPSAnaW5pdF8nICsgaSwgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmRhdGEsIGNvbmZpZyA9IGRhdGEuY29uZmlnW2ldLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50ID0gZGF0YS5jb250ZW50W2ldLCBwcmV2aWV3SWQgPSBzZWxmLnByZXZpZXdJbml0SWQgKyAnLScgKyBpbmQsIG91dCwgJHRtcCwgY2F0LCBmdHIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZuYW1lLCBmdHlwZSwgZnJhbWVDbGFzcywgYXNEYXRhID0gJGguaWZTZXQoJ3ByZXZpZXdBc0RhdGEnLCBjb25maWcsIHNlbGYuaW5pdGlhbFByZXZpZXdBc0RhdGEpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBhID0gY29uZmlnID8ge3RpdGxlOiBjb25maWcudGl0bGUgfHwgbnVsbCwgYWx0OiBjb25maWcuYWx0IHx8IG51bGx9IDoge3RpdGxlOiBudWxsLCBhbHQ6IG51bGx9LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJzZVRlbXBsYXRlID0gZnVuY3Rpb24gKGNhdCwgZGF0LCBmbiwgZnQsIGlkLCBmdHIsIGluZCwgZmMsIHQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZjID0gJyBmaWxlLXByZXZpZXctaW5pdGlhbCAnICsgJGguU09SVF9DU1MgKyAoZmMgPyAnICcgKyBmYyA6ICcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzZWxmLl9nZW5lcmF0ZVByZXZpZXdUZW1wbGF0ZShjYXQsIGRhdCwgZm4sIGZ0LCBpZCwgZmFsc2UsIG51bGwsIGZjLCBmdHIsIGluZCwgdCwgYSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFjb250ZW50KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaXNEaXNhYmxlZCA9IGlzRGlzYWJsZWQgPT09IHVuZGVmaW5lZCA/IHRydWUgOiBpc0Rpc2FibGVkO1xyXG4gICAgICAgICAgICAgICAgICAgIGNhdCA9ICRoLmlmU2V0KCd0eXBlJywgY29uZmlnLCBzZWxmLmluaXRpYWxQcmV2aWV3RmlsZVR5cGUgfHwgJ2dlbmVyaWMnKTtcclxuICAgICAgICAgICAgICAgICAgICBmbmFtZSA9ICRoLmlmU2V0KCdmaWxlbmFtZScsIGNvbmZpZywgJGguaWZTZXQoJ2NhcHRpb24nLCBjb25maWcpKTtcclxuICAgICAgICAgICAgICAgICAgICBmdHlwZSA9ICRoLmlmU2V0KCdmaWxldHlwZScsIGNvbmZpZywgY2F0KTtcclxuICAgICAgICAgICAgICAgICAgICBmdHIgPSBzZWxmLnByZXZpZXdDYWNoZS5mb290ZXIoaSwgaXNEaXNhYmxlZCwgKGNvbmZpZyAmJiBjb25maWcuc2l6ZSB8fCBudWxsKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgZnJhbWVDbGFzcyA9ICRoLmlmU2V0KCdmcmFtZUNsYXNzJywgY29uZmlnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoYXNEYXRhKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9IHBhcnNlVGVtcGxhdGUoY2F0LCBjb250ZW50LCBmbmFtZSwgZnR5cGUsIHByZXZpZXdJZCwgZnRyLCBpbmQsIGZyYW1lQ2xhc3MpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9IHBhcnNlVGVtcGxhdGUoJ2dlbmVyaWMnLCBjb250ZW50LCBmbmFtZSwgZnR5cGUsIHByZXZpZXdJZCwgZnRyLCBpbmQsIGZyYW1lQ2xhc3MsIGNhdClcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRUb2tlbnMoeydjb250ZW50JzogZGF0YS5jb250ZW50W2ldfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLnRhZ3MubGVuZ3RoICYmIGRhdGEudGFnc1tpXSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSAkaC5yZXBsYWNlVGFncyhvdXQsIGRhdGEudGFnc1tpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIC8qKiBAbmFtZXNwYWNlIGNvbmZpZy5mcmFtZUF0dHIgKi9cclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoY29uZmlnKSAmJiAhJGguaXNFbXB0eShjb25maWcuZnJhbWVBdHRyKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSkuaHRtbChvdXQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wLmZpbmQoJy5maWxlLXByZXZpZXctaW5pdGlhbCcpLmF0dHIoY29uZmlnLmZyYW1lQXR0cik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9ICR0bXAuaHRtbCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdG1wLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIGFkZDogZnVuY3Rpb24gKGNvbnRlbnQsIGNvbmZpZywgdGFncywgYXBwZW5kKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRhdGEgPSBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLCBpbmRleDtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzQXJyYXkoY29udGVudCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudCA9IGNvbnRlbnQuc3BsaXQoc2VsZi5pbml0aWFsUHJldmlld0RlbGltaXRlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhcHBlbmQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBkYXRhLmNvbnRlbnQucHVzaChjb250ZW50KSAtIDE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnW2luZGV4XSA9IGNvbmZpZztcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS50YWdzW2luZGV4XSA9IHRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBjb250ZW50Lmxlbmd0aCAtIDE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29udGVudCA9IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnID0gY29uZmlnO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLnRhZ3MgPSB0YWdzO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhID0gZGF0YTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXg7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoY29udGVudCwgY29uZmlnLCB0YWdzLCBhcHBlbmQpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmRhdGEsIGksIGNoaztcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWNvbnRlbnQgfHwgIWNvbnRlbnQubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCEkaC5pc0FycmF5KGNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQgPSBjb250ZW50LnNwbGl0KHNlbGYuaW5pdGlhbFByZXZpZXdEZWxpbWl0ZXIpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBjaGsgPSBjb250ZW50LmZpbHRlcihmdW5jdGlvbiAobikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAhPT0gbnVsbDtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWNoay5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5jb250ZW50ID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb250ZW50ID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmNvbmZpZyA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLnRhZ3MgPT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLnRhZ3MgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGFwcGVuZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29udGVudC5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRlbnRbaV0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhLmNvbnRlbnQucHVzaChjb250ZW50W2ldKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29uZmlnLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29uZmlnW2ldKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWcucHVzaChjb25maWdbaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCB0YWdzLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGFnc1tpXSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudGFncy5wdXNoKHRhZ3NbaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb250ZW50ID0gY29udGVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWcgPSBjb25maWc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudGFncyA9IHRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSBkYXRhO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHVuc2V0OiBmdW5jdGlvbiAoaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgY2hrID0gc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSwgcmV2ID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghY2hrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNoayA9PT0gMSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLmNvbnRlbnQgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb25maWcgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS50YWdzID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXcgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50ID0gJGguc3BsaWNlQXJyYXkoc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YS5jb250ZW50LCBpbmRleCwgcmV2KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLmNvbmZpZyA9ICRoLnNwbGljZUFycmF5KHNlbGYucHJldmlld0NhY2hlLmRhdGEuY29uZmlnLCBpbmRleCwgcmV2KTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLnRhZ3MgPSAkaC5zcGxpY2VBcnJheShzZWxmLnByZXZpZXdDYWNoZS5kYXRhLnRhZ3MsIGluZGV4LCByZXYpO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIG91dDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBodG1sID0gJycsIGNhcHRpb24sIGxlbiA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCksIGksIGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxlbiA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge2NvbnRlbnQ6ICcnLCBjYXB0aW9uOiAnJ307XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50ID0gc2VsZi5wcmV2aWV3Q2FjaGUuZ2V0KGkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBodG1sID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyID8gKGNvbnRlbnQgKyBodG1sKSA6IChodG1sICsgY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNhcHRpb24gPSBzZWxmLl9nZXRNc2dTZWxlY3RlZChsZW4pO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7Y29udGVudDogaHRtbCwgY2FwdGlvbjogY2FwdGlvbn07XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgZm9vdGVyOiBmdW5jdGlvbiAoaSwgaXNEaXNhYmxlZCwgc2l6ZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBkYXRhID0gc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YSB8fCB7fTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhLmNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCRoLmlzRW1wdHkoZGF0YS5jb25maWcpIHx8ICRoLmlzRW1wdHkoZGF0YS5jb25maWdbaV0pKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29uZmlnW2ldID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlzRGlzYWJsZWQgPSBpc0Rpc2FibGVkID09PSB1bmRlZmluZWQgPyB0cnVlIDogaXNEaXNhYmxlZDtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgY29uZmlnID0gZGF0YS5jb25maWdbaV0sIGNhcHRpb24gPSAkaC5pZlNldCgnY2FwdGlvbicsIGNvbmZpZyksIGEsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoID0gJGguaWZTZXQoJ3dpZHRoJywgY29uZmlnLCAnYXV0bycpLCB1cmwgPSAkaC5pZlNldCgndXJsJywgY29uZmlnLCBmYWxzZSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGtleSA9ICRoLmlmU2V0KCdrZXknLCBjb25maWcsIG51bGwpLCBmcyA9IHNlbGYuZmlsZUFjdGlvblNldHRpbmdzLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0UHJldmlld1Nob3dEZWwgPSBzZWxmLmluaXRpYWxQcmV2aWV3U2hvd0RlbGV0ZSB8fCBmYWxzZSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgZFVybCA9IGNvbmZpZy5kb3dubG9hZFVybCB8fCBzZWxmLmluaXRpYWxQcmV2aWV3RG93bmxvYWRVcmwgfHwgJycsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRGaWwgPSBjb25maWcuZmlsZW5hbWUgfHwgY29uZmlnLmNhcHRpb24gfHwgJycsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRQcmV2aWV3U2hvd0R3bCA9ICEhKGRVcmwpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRGVsID0gJGguaWZTZXQoJ3Nob3dSZW1vdmUnLCBjb25maWcsICRoLmlmU2V0KCdzaG93UmVtb3ZlJywgZnMsIGluaXRQcmV2aWV3U2hvd0RlbCkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRHdsID0gJGguaWZTZXQoJ3Nob3dEb3dubG9hZCcsIGNvbmZpZywgJGguaWZTZXQoJ3Nob3dEb3dubG9hZCcsIGZzLCBpbml0UHJldmlld1Nob3dEd2wpKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgc1ptID0gJGguaWZTZXQoJ3Nob3dab29tJywgY29uZmlnLCAkaC5pZlNldCgnc2hvd1pvb20nLCBmcywgdHJ1ZSkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzRHJnID0gJGguaWZTZXQoJ3Nob3dEcmFnJywgY29uZmlnLCAkaC5pZlNldCgnc2hvd0RyYWcnLCBmcywgdHJ1ZSkpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXMgPSAodXJsID09PSBmYWxzZSkgJiYgaXNEaXNhYmxlZDtcclxuICAgICAgICAgICAgICAgICAgICBzRHdsID0gc0R3bCAmJiBjb25maWcuZG93bmxvYWRVcmwgIT09IGZhbHNlICYmICEhZFVybDtcclxuICAgICAgICAgICAgICAgICAgICBhID0gc2VsZi5fcmVuZGVyRmlsZUFjdGlvbnMoZmFsc2UsIHNEd2wsIHNEZWwsIHNabSwgc0RyZywgZGlzLCB1cmwsIGtleSwgdHJ1ZSwgZFVybCwgZEZpbCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdmb290ZXInKS5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnOiBzZWxmLl9yZW5kZXJUaHVtYlByb2dyZXNzKCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdhY3Rpb25zJzogYSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ2NhcHRpb24nOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IHNlbGYuX2dldFNpemUoc2l6ZSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICd3aWR0aCc6IHdpZHRoLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnaW5kaWNhdG9yJzogJydcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuaW5pdCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2lzUGRmUmVuZGVyZWQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCB1c2VMaWIgPSBzZWxmLnVzZVBkZlJlbmRlcmVyLFxyXG4gICAgICAgICAgICAgICAgZmxhZyA9IHR5cGVvZiB1c2VMaWIgPT09ICdmdW5jdGlvbicgPyB1c2VMaWIoKSA6ICEhdXNlTGliO1xyXG4gICAgICAgICAgICByZXR1cm4gZmxhZyAmJiBzZWxmLnBkZlJlbmRlcmVyVXJsO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2hhbmRsZXI6IGZ1bmN0aW9uICgkZWwsIGV2ZW50LCBjYWxsYmFjaykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIG5zID0gc2VsZi5uYW1lc3BhY2UsIGV2ID0gZXZlbnQuc3BsaXQoJyAnKS5qb2luKG5zICsgJyAnKSArIG5zO1xyXG4gICAgICAgICAgICBpZiAoISRlbCB8fCAhJGVsLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRlbC5vZmYoZXYpLm9uKGV2LCBjYWxsYmFjayk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZW5jb2RlVVJJOiBmdW5jdGlvbiAodlVybCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLmVuY29kZVVybCA/IGVuY29kZVVSSSh2VXJsKSA6IHZVcmw7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfbG9nOiBmdW5jdGlvbiAobXNnKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgaWQgPSBzZWxmLiRlbGVtZW50LmF0dHIoJ2lkJyk7XHJcbiAgICAgICAgICAgIGlmIChpZCkge1xyXG4gICAgICAgICAgICAgICAgbXNnID0gJ1wiJyArIGlkICsgJ1wiOiAnICsgbXNnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9ICdib290c3RyYXAtZmlsZWlucHV0OiAnICsgbXNnO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIHdpbmRvdy5jb25zb2xlLmxvZyAhPT0gJ3VuZGVmaW5lZCcpIHtcclxuICAgICAgICAgICAgICAgIHdpbmRvdy5jb25zb2xlLmxvZyhtc2cpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgd2luZG93LmFsZXJ0KG1zZyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHN0YXR1cyA9IHNlbGYuJGVsZW1lbnQuYXR0cigndHlwZScpID09PSAnZmlsZSc7XHJcbiAgICAgICAgICAgIGlmICghc3RhdHVzKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9sb2coJ1RoZSBpbnB1dCBcInR5cGVcIiBtdXN0IGJlIHNldCB0byBcImZpbGVcIiBmb3IgaW5pdGlhbGl6aW5nIHRoZSBcImJvb3RzdHJhcC1maWxlaW5wdXRcIiBwbHVnaW4uJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHN0YXR1cztcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9lcnJvcnNFeGlzdDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnIsICRlcnJMaXN0ID0gc2VsZi4kZXJyb3JDb250YWluZXIuZmluZCgnbGknKTtcclxuICAgICAgICAgICAgaWYgKCRlcnJMaXN0Lmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGVyciA9ICQoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2JykpLmh0bWwoc2VsZi4kZXJyb3JDb250YWluZXIuaHRtbCgpKTtcclxuICAgICAgICAgICAgJGVyci5maW5kKCcua3YtZXJyb3ItY2xvc2UnKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgJGVyci5maW5kKCd1bCcpLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICByZXR1cm4gISEkLnRyaW0oJGVyci50ZXh0KCkpLmxlbmd0aDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9lcnJvckhhbmRsZXI6IGZ1bmN0aW9uIChldnQsIGNhcHRpb24pIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlcnIgPSBldnQudGFyZ2V0LmVycm9yLCBzaG93RXJyb3IgPSBmdW5jdGlvbiAobXNnKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93RXJyb3IobXNnLnJlcGxhY2UoJ3tuYW1lfScsIGNhcHRpb24pKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZXJyLk5PVF9GT1VORF9FUlIgKi9cclxuICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZXJyLlNFQ1VSSVRZX0VSUiAqL1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBlcnIuTk9UX1JFQURBQkxFX0VSUiAqL1xyXG4gICAgICAgICAgICBpZiAoZXJyLmNvZGUgPT09IGVyci5OT1RfRk9VTkRfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICBzaG93RXJyb3Ioc2VsZi5tc2dGaWxlTm90Rm91bmQpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKGVyci5jb2RlID09PSBlcnIuU0VDVVJJVFlfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2hvd0Vycm9yKHNlbGYubXNnRmlsZVNlY3VyZWQpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoZXJyLmNvZGUgPT09IGVyci5OT1RfUkVBREFCTEVfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNob3dFcnJvcihzZWxmLm1zZ0ZpbGVOb3RSZWFkYWJsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVyci5jb2RlID09PSBlcnIuQUJPUlRfRVJSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG93RXJyb3Ioc2VsZi5tc2dGaWxlUHJldmlld0Fib3J0ZWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvd0Vycm9yKHNlbGYubXNnRmlsZVByZXZpZXdFcnJvcik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9hZGRFcnJvcjogZnVuY3Rpb24gKG1zZykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnJvciA9IHNlbGYuJGVycm9yQ29udGFpbmVyO1xyXG4gICAgICAgICAgICBpZiAobXNnICYmICRlcnJvci5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRlcnJvci5odG1sKHNlbGYuZXJyb3JDbG9zZUJ1dHRvbiArIG1zZyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRlcnJvci5maW5kKCcua3YtZXJyb3ItY2xvc2UnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldyAmJiAhc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuY2xlYXIoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZXJyb3IuZmFkZU91dCgnc2xvdycpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sIDEwKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2V0VmFsaWRhdGlvbkVycm9yOiBmdW5jdGlvbiAoY3NzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgY3NzID0gKGNzcyA/IGNzcyArICcgJyA6ICcnKSArICdoYXMtZXJyb3InO1xyXG4gICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoY3NzKS5hZGRDbGFzcygnaGFzLWVycm9yJyk7XHJcbiAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjYXB0aW9uQ29udGFpbmVyLCAnaXMtaW52YWxpZCcpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0RXJyb3JzOiBmdW5jdGlvbiAoZmFkZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlcnJvciA9IHNlbGYuJGVycm9yQ29udGFpbmVyO1xyXG4gICAgICAgICAgICBzZWxmLmlzRXJyb3IgPSBmYWxzZTtcclxuICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLnJlbW92ZUNsYXNzKCdoYXMtZXJyb3InKTtcclxuICAgICAgICAgICAgc2VsZi4kY2FwdGlvbkNvbnRhaW5lci5yZW1vdmVDbGFzcygnaXMtaW52YWxpZCcpO1xyXG4gICAgICAgICAgICAkZXJyb3IuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgIGlmIChmYWRlKSB7XHJcbiAgICAgICAgICAgICAgICAkZXJyb3IuZmFkZU91dCgnc2xvdycpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJGVycm9yLmhpZGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Nob3dGb2xkZXJFcnJvcjogZnVuY3Rpb24gKGZvbGRlcnMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZXJyb3IgPSBzZWxmLiRlcnJvckNvbnRhaW5lciwgbXNnO1xyXG4gICAgICAgICAgICBpZiAoIWZvbGRlcnMpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9IHNlbGYubXNnRm9sZGVyc05vdEFsbG93ZWQucmVwbGFjZSgne259JywgZm9sZGVycyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2FkZEVycm9yKG1zZyk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFZhbGlkYXRpb25FcnJvcigpO1xyXG4gICAgICAgICAgICAkZXJyb3IuZmFkZUluKDgwMCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlZm9sZGVyZXJyb3InLCBbZm9sZGVycywgbXNnXSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2hvd1VwbG9hZEVycm9yOiBmdW5jdGlvbiAobXNnLCBwYXJhbXMsIGV2ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVycm9yID0gc2VsZi4kZXJyb3JDb250YWluZXIsIGV2ID0gZXZlbnQgfHwgJ2ZpbGV1cGxvYWRlcnJvcicsIGUgPSBwYXJhbXMgJiYgcGFyYW1zLmlkID9cclxuICAgICAgICAgICAgICAgICc8bGkgZGF0YS10aHVtYi1pZD1cIicgKyBwYXJhbXMuaWQgKyAnXCI+JyArIG1zZyArICc8L2xpPicgOiAnPGxpPicgKyBtc2cgKyAnPC9saT4nO1xyXG4gICAgICAgICAgICBpZiAoJGVycm9yLmZpbmQoJ3VsJykubGVuZ3RoID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9hZGRFcnJvcignPHVsPicgKyBlICsgJzwvdWw+Jyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAkZXJyb3IuZmluZCgndWwnKS5hcHBlbmQoZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGVycm9yLmZhZGVJbig4MDApO1xyXG4gICAgICAgICAgICBzZWxmLl9yYWlzZShldiwgW3BhcmFtcywgbXNnXSk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFZhbGlkYXRpb25FcnJvcignZmlsZS1pbnB1dC1uZXcnKTtcclxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2hvd0Vycm9yOiBmdW5jdGlvbiAobXNnLCBwYXJhbXMsIGV2ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVycm9yID0gc2VsZi4kZXJyb3JDb250YWluZ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ICAgICAgIHNlbGYuaXNFcnJvciA9IHRydWU7XHJcbiAgICAgICAgICAgIHNlbGYuX3VwZGF0ZUZpbGVEZXRhaWxzKDApO1xyXG4gICAgICAgICAgICAkZXJyb3IuZmFkZUluKDgwMCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlZXJyb3InLCBbcGFyYW1zLCBtc2ddKTtcclxuICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0VmFsaWRhdGlvbkVycm9yKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcGFyc2VFcnJvcjogZnVuY3Rpb24gKG9wZXJhdGlvbiwganFYSFIsIGVycm9yVGhyb3duLCBmaWxlTmFtZSkge1xyXG4gICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBqcVhIUi5yZXNwb25zZUpTT04gKi9cclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlcnJNc2cgPSAkLnRyaW0oZXJyb3JUaHJvd24gKyAnJyksIHRleHRQcmUsXHJcbiAgICAgICAgICAgICAgICB0ZXh0ID0ganFYSFIucmVzcG9uc2VKU09OICE9PSB1bmRlZmluZWQgJiYganFYSFIucmVzcG9uc2VKU09OLmVycm9yICE9PSB1bmRlZmluZWQgP1xyXG4gICAgICAgICAgICAgICAgICAgIGpxWEhSLnJlc3BvbnNlSlNPTi5lcnJvciA6IGpxWEhSLnJlc3BvbnNlVGV4dDtcclxuICAgICAgICAgICAgaWYgKHNlbGYuY2FuY2VsbGluZyAmJiBzZWxmLm1zZ1VwbG9hZEFib3J0ZWQpIHtcclxuICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYubXNnVXBsb2FkQWJvcnRlZDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93QWpheEVycm9yRGV0YWlscyAmJiB0ZXh0KSB7XHJcbiAgICAgICAgICAgICAgICB0ZXh0ID0gJC50cmltKHRleHQucmVwbGFjZSgvXFxuXFxzKlxcbi9nLCAnXFxuJykpO1xyXG4gICAgICAgICAgICAgICAgdGV4dFByZSA9IHRleHQubGVuZ3RoID8gJzxwcmU+JyArIHRleHQgKyAnPC9wcmU+JyA6ICcnO1xyXG4gICAgICAgICAgICAgICAgZXJyTXNnICs9IGVyck1zZyA/IHRleHRQcmUgOiB0ZXh0O1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghZXJyTXNnKSB7XHJcbiAgICAgICAgICAgICAgICBlcnJNc2cgPSBzZWxmLm1zZ0FqYXhFcnJvci5yZXBsYWNlKCd7b3BlcmF0aW9ufScsIG9wZXJhdGlvbik7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5jYW5jZWxsaW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHJldHVybiBmaWxlTmFtZSA/ICc8Yj4nICsgZmlsZU5hbWUgKyAnOiA8L2I+JyArIGVyck1zZyA6IGVyck1zZztcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9wYXJzZUZpbGVUeXBlOiBmdW5jdGlvbiAodHlwZSwgbmFtZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGlzVmFsaWQsIHZUeXBlLCBjYXQsIGksIHR5cGVzID0gc2VsZi5hbGxvd2VkUHJldmlld1R5cGVzIHx8IFtdO1xyXG4gICAgICAgICAgICBpZiAodHlwZSA9PT0gJ2FwcGxpY2F0aW9uL3RleHQtcGxhaW4nKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RleHQnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCB0eXBlcy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY2F0ID0gdHlwZXNbaV07XHJcbiAgICAgICAgICAgICAgICBpc1ZhbGlkID0gc2VsZi5maWxlVHlwZVNldHRpbmdzW2NhdF07XHJcbiAgICAgICAgICAgICAgICB2VHlwZSA9IGlzVmFsaWQodHlwZSwgbmFtZSkgPyBjYXQgOiAnJztcclxuICAgICAgICAgICAgICAgIGlmICghJGguaXNFbXB0eSh2VHlwZSkpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlR5cGU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICdvdGhlcic7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0UHJldmlld0ljb246IGZ1bmN0aW9uIChmbmFtZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGV4dCwgb3V0ID0gbnVsbDtcclxuICAgICAgICAgICAgaWYgKGZuYW1lICYmIGZuYW1lLmluZGV4T2YoJy4nKSA+IC0xKSB7XHJcbiAgICAgICAgICAgICAgICBleHQgPSBmbmFtZS5zcGxpdCgnLicpLnBvcCgpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYucHJldmlld0ZpbGVJY29uU2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2V4dF0gfHwgc2VsZi5wcmV2aWV3RmlsZUljb25TZXR0aW5nc1tleHQudG9Mb3dlckNhc2UoKV0gfHwgbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLnByZXZpZXdGaWxlRXh0U2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgICAgICAkLmVhY2goc2VsZi5wcmV2aWV3RmlsZUV4dFNldHRpbmdzLCBmdW5jdGlvbiAoa2V5LCBmdW5jKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2tleV0gJiYgZnVuYyhleHQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdGaWxlSWNvblNldHRpbmdzW2tleV07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBVbm5lY2Vzc2FyeVJldHVyblN0YXRlbWVudEpTXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3BhcnNlRmlsZVByZXZpZXdJY29uOiBmdW5jdGlvbiAoY29udGVudCwgZm5hbWUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpY24gPSBzZWxmLl9nZXRQcmV2aWV3SWNvbihmbmFtZSkgfHwgc2VsZi5wcmV2aWV3RmlsZUljb24sIG91dCA9IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgIGlmIChvdXQuaW5kZXhPZigne3ByZXZpZXdGaWxlSWNvbn0nKSA+IC0xKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBvdXQuc2V0VG9rZW5zKHsncHJldmlld0ZpbGVJY29uQ2xhc3MnOiBzZWxmLnByZXZpZXdGaWxlSWNvbkNsYXNzLCAncHJldmlld0ZpbGVJY29uJzogaWNufSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yYWlzZTogZnVuY3Rpb24gKGV2ZW50LCBwYXJhbXMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBlID0gJC5FdmVudChldmVudCk7XHJcbiAgICAgICAgICAgIGlmIChwYXJhbXMgIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kZWxlbWVudC50cmlnZ2VyKGUsIHBhcmFtcyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRlbGVtZW50LnRyaWdnZXIoZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGUuaXNEZWZhdWx0UHJldmVudGVkKCkgfHwgZS5yZXN1bHQgPT09IGZhbHNlKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc3dpdGNoIChldmVudCkge1xyXG4gICAgICAgICAgICAgICAgLy8gaWdub3JlIHRoZXNlIGV2ZW50c1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWJhdGNodXBsb2FkY29tcGxldGUnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWJhdGNodXBsb2Fkc3VjY2Vzcyc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxldXBsb2FkZWQnOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWNsZWFyJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVjbGVhcmVkJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVyZXNldCc6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlZXJyb3InOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWZvbGRlcmVycm9yJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGV1cGxvYWRlcnJvcic6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlYmF0Y2h1cGxvYWRlcnJvcic6XHJcbiAgICAgICAgICAgICAgICBjYXNlICdmaWxlZGVsZXRlZXJyb3InOlxyXG4gICAgICAgICAgICAgICAgY2FzZSAnZmlsZWN1c3RvbWVycm9yJzpcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGVzdWNjZXNzcmVtb3ZlJzpcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIC8vIHJlY2VpdmUgZGF0YSByZXNwb25zZSB2aWEgYGZpbGVjdXN0b21lcnJvcmAgZXZlbnRgXHJcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5hamF4QWJvcnRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZS5yZXN1bHQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2xpc3RlbkZ1bGxTY3JlZW46IGZ1bmN0aW9uIChpc0Z1bGxTY3JlZW4pIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkbW9kYWwgPSBzZWxmLiRtb2RhbCwgJGJ0bkZ1bGwsICRidG5Cb3JkO1xyXG4gICAgICAgICAgICBpZiAoISRtb2RhbCB8fCAhJG1vZGFsLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRidG5GdWxsID0gJG1vZGFsICYmICRtb2RhbC5maW5kKCcuYnRuLWZ1bGxzY3JlZW4nKTtcclxuICAgICAgICAgICAgJGJ0bkJvcmQgPSAkbW9kYWwgJiYgJG1vZGFsLmZpbmQoJy5idG4tYm9yZGVybGVzcycpO1xyXG4gICAgICAgICAgICBpZiAoISRidG5GdWxsLmxlbmd0aCB8fCAhJGJ0bkJvcmQubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGJ0bkZ1bGwucmVtb3ZlQ2xhc3MoJ2FjdGl2ZScpL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WxmLiRjb250YWluZXIsIGZ1bGxTY3JlZW5FdmVudHM7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2xpY2snLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCRlbC5oYXNDbGFzcygnZmlsZS1uby1icm93c2UnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZWwuZGF0YSgnem9uZUNsaWNrZWQnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZWwuZGF0YSgnem9uZUNsaWNrZWQnLCBmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2hhbmdlJywgJC5wcm94eShzZWxmLl9jaGFuZ2UsIHNlbGYpKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0Jyb3dzZSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcihzZWxmLiRidG5GaWxlLCAnY2xpY2snLCAkLnByb3h5KHNlbGYuX2Jyb3dzZSwgc2VsZikpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGNvbnQuZmluZCgnLmZpbGVpbnB1dC1yZW1vdmU6bm90KFtkaXNhYmxlZF0pJyksICdjbGljaycsICQucHJveHkoc2VsZi5jbGVhciwgc2VsZikpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRjb250LmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJyksICdjbGljaycsICQucHJveHkoc2VsZi5jYW5jZWwsIHNlbGYpKTtcclxuICAgICAgICAgICAgc2VsZi5faW5pdERy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AgIHNlbGYuX2F1dG9GaXRDb250ZW50KCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRDbGlja2FibGUoKTtcclxuICAgICAgICAgICAgc2VsZi5fcmVmcmVzaFByZXZpZXcoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9hdXRvRml0Q29udGVudDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgd2lkdGggPSB3aW5kb3cuaW5uZXJXaWR0aCB8fCBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuY2xpZW50V2lkdGggfHwgZG9jdW1lbnQuYm9keS5jbGllbnRXaWR0aCxcclxuICAgICAgICAgICAgICAgIHNlbGYgPSB0aGlzLCBjb25maWcgPSB3aWR0aCA8IDQwMCA/IChzZWxmLnByZXZpZXdTZXR0aW5nc1NtYWxsIHx8IHNlbGYuZGVmYXVsdHMucHJldmlld1NldHRpbmdzU21hbGwpIDpcclxuICAgICAgICAgICAgICAgIChzZWxmLnByZXZpZXdTZXR0aW5ncyB8fCBzZWxmLmRlZmF1bHRzLnByZXZpZXdTZXR0aW5ncyksIHNlbDtcclxuICAgICAgICAgICAgJC5lYWNoKGNvbmZpZywgZnVuY3Rpb24gKGNhdCwgc2V0dGluZ3MpIHtcclxuICAgICAgICAgICAgICAgIHNlbCA9ICcuZmlsZS1wcmV2aWV3LWZyYW1lIC5maWxlLXByZXZpZXctJyArIGNhdDtcclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuZmluZChzZWwgKyAnLmt2LXByZXZpZXctZGF0YSwnICsgc2VsICsgJyAua3YtcHJldmlldy1kYXRhJykuY3NzKHNldHRpbmdzKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2NhbkRyb3BwZWRJdGVtczogZnVuY3Rpb24gKGl0ZW0sIGZpbGVzLCBwYXRoKSB7XHJcbiAgICAgICAgICAgIHBhdGggPSBwYXRoIHx8ICcnO1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGksIGRpclJlYWRlciwgcmVhZERpciwgZXJyb3JIYW5kbGVyID0gZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZygnRXJyb3Igc2Nhbm5pbmcgZHJvcHBlZCBmaWxlcyEnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZyhlKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgaWYgKGl0ZW0uaXNGaWxlKSB7XHJcbiAgICAgICAgICAgICAgICBpdGVtLmZpbGUoZnVuY3Rpb24gKGZpbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlcy5wdXNoKGZpbGUpO1xyXG4gICAgICAgICAgICAgICAgfSwgZXJyb3JIYW5kbGVyKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmIChpdGVtLmlzRGlyZWN0b3J5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZGlyUmVhZGVyID0gaXRlbS5jcmVhdGVSZWFkZXIoKTtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRGlyID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXJSZWFkZXIucmVhZEVudHJpZXMoZnVuY3Rpb24gKGVudHJpZXMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbnRyaWVzICYmIGVudHJpZXMubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBlbnRyaWVzLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NjYW5Ecm9wcGVkSXRlbXMoZW50cmllc1tpXSwgZmlsZXMsIHBhdGggKyBpdGVtLm5hbWUgKyAnLycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZWN1cnNpdmVseSBjYWxsIHJlYWREaXIoKSBhZ2Fpbiwgc2luY2UgYnJvd3NlciBjYW4gb25seSBoYW5kbGUgZmlyc3QgMTAwIGVudHJpZXMuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZERpcigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVycm9ySGFuZGxlcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRGlyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdERyYWdEcm9wOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJHpvbmUgPSBzZWxmLiRkcm9wWm9uZTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuZHJvcFpvbmVFbmFibGVkICYmIHNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHpvbmUsICdkcmFnZW50ZXIgZHJhZ292ZXInLCAkLnByb3h5KHNlbGYuX3pvbmVEcmFnRW50ZXIsIHNlbGYpKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHpvbmUsICdkcmFnbGVhdmUnLCAkLnByb3h5KHNlbGYuX3pvbmVEcmFnTGVhdmUsIHNlbGYpKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHpvbmUsICdkcm9wJywgJC5wcm94eShzZWxmLl96b25lRHJvcCwgc2VsZikpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkKGRvY3Vt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HtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jaGFuZ2VUcmlnZ2VyZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZWwuZ2V0KDApLmZpbGVzID0gZmlsZXM7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jaGFuZ2VUcmlnZ2VyZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRlbC50cmlnZ2VyKCdjaGFuZ2UnICsgc2VsZi5uYW1lc3BhY2UpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2hhbmdlKGUsIGZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kZHJvcFpvbmUucmVtb3ZlQ2xhc3MoJ2ZpbGUtaGlnaGxpZ2h0ZWQnKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNEaXNhYmxlZCB8fCAkaC5pc0VtcHR5KGZpbGVzKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVEcmFnRHJvcCcsIHsnc291cmNlRXZlbnQnOiBlLCAnZmlsZXMnOiBmaWxlc30pKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGZvbGRlcnMgPiAwKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd0ZvbGRlckVycm9yKGZvbGRlcnMpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGZpbGVzID0gW107XHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaXRlbXMubGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgaXRlbSA9IGl0ZW1zW2ldLndlYmtpdEdldEFzRW50cnkoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zY2FuRHJvcHBlZEl0ZW1zKGl0ZW0sIGZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzRmlsZXMoKTtcclxuICAgICAgICAgICAgICAgIH0sIDUwMCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBwcm9jZXNzRmlsZXMoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwbG9hZENsaWNrOiBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRidG4gPSBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC11cGxvYWQnKSwgJGZvcm0sXHJcbiAgICAgICAgICAgICAgICBpc0VuYWJsZWQgPSAhJGJ0bi5oYXNDbGFzcygnZGlzYWJsZWQnKSAmJiAkaC5pc0VtcHR5KCRidG4uYXR0cignZGlzYWJsZWQnKSk7XHJcbiAgICAgICAgICAgIGlmIChlICYmIGUuaXNEZWZhdWx0UHJldmVudGVkKCkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaXNFbmFibGVkICYmICRidG4uYXR0cigndHlwZScpICE9PSAnc3VibWl0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgICRmb3JtID0gJGJ0bi5jbG9zZXN0KCdmb3JtJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy8gZG93bmdyYWRlIHRvIG5vcm1hbCBmb3JtIHN1Ym1pdCBpZiBwb3NzaWJsZVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZm9ybS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGZvcm0udHJpZ2dlcignc3VibWl0Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XHJcbiAgICAgICAgICAgIGlmIChpc0VuYWJsZWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zdWJtaXRGb3JtOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2lzRmlsZVNlbGVjdGlvblZhbGlkKCkgJiYgIXNlbGYuX2Fib3J0KHt9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jbGVhclByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkcCA9IHNlbGYuJHByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAkdGh1bWJzID0gc2VsZi5zaG93VXBsb2FkZWRUaHVtYnMgPyBzZWxmLmdldEZyYW1lcygnOm5vdCguZmlsZS1wcmV2aWV3LXN1Y2Nlc3MpJykgOiBzZWxmLmdldEZyYW1lcygpO1xyXG4gICAgICAgICAgICAkdGh1bWJzLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyk7XHJcbiAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAkaC5jbGVhblpvb21DYWNoZSgkcC5maW5kKCcjem9vbS0nICsgJHRodW1iLmF0dHIoJ2lkJykpKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGggfHwgIXNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0VXBsb2FkKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEZWZhdWx0UHJldmlldygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRTb3J0YWJsZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRlbCA9IHNlbGYuJHByZXZpZXcsIHNldHRpbmdzLCBzZWxlY3RvciA9ICcuJyArICRoLlNPUlRfQ1NTLFxyXG4gICAgICAgICAgICAgICAgcmV2ID0gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyO1xyXG4gICAgICAgICAgICBpZiAoIXdpbmRvdy5LdlNvcnRhYmxlIHx8ICRlbC5maW5kKHNlbGVjdG9yKS5sZW5ndGggPT09IDApIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBKU1VudXNlZEdsb2JhbFN5bWJvbHNcclxuICAgICAgICAgICAgc2V0dGluZ3MgPSB7XHJcbiAgICAgICAgICAgICAgICBoYW5kbGU6ICcuZHJhZy1oYW5kbGUtaW5pdCcsXHJcbiAgICAgICAgICAgICAgICBkYXRhSWRBdHRyOiAnZGF0YS1wcmV2aWV3LWlkJyxcclxuICAgICAgICAgICAgICAgIHNjcm9sbDogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBkcmFnZ2FibGU6IHNlbGVjdG9yLFxyXG4gICAgICAgICAgICAgICAgb25Tb3J0OiBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBvbGRJbmRleCA9IGUub2xkSW5kZXgsIG5ld0luZGV4ID0gZS5uZXdJbmRleCwgaSA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlldyA9ICRoLm1vdmVBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3LCBvbGRJbmRleCwgbmV3SW5kZXgsIHJldik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9ICRoLm1vdmVBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnLCBvbGRJbmRleCwgbmV3SW5kZXgsIHJldik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuaW5pdCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuZ2V0RnJhbWVzKCcuZmlsZS1wcmV2aWV3LWluaXRpYWwnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS5hdHRyKCdkYXRhLWZpbGVpbmRleCcsICdpbml0XycgKyBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaSsrO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlc29ydGVkJywge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBwcmV2aWV3SWQ6ICQoZS5pdGVtKS5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnb2xkSW5kZXgnOiBvbGRJbmRleCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ25ld0luZGV4JzogbmV3SW5kZXgsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrOiBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnXHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGlmICgkZWwuZGF0YSgna3Zzb3J0YWJsZScpKSB7XHJcbiAgICAgICAgICAgICAgICAkZWwua3Zzb3J0YWJsZSgnZGVzdHJveScpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICQuZXh0ZW5kKHRydWUsIHNldHRpbmdzLCBzZWxmLmZpbGVBY3Rpb25TZXR0aW5ncy5kcmFnU2V0dGluZ3MpO1xyXG4gICAgICAgICAgICAkZWwua3Zzb3J0YWJsZShzZXR0aW5ncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfc2V0UHJldmlld0NvbnRlbnQ6IGZ1bmN0aW9uIChjb250ZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kcHJldmlldy5odG1sKGNvbnRlbnQpO1xyXG4gICAgICAgICAgICBzZWxmLl9hdXRvRml0Q29udGVudCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3OiBmdW5jdGlvbiAoaXNJbml0KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY2FwID0gc2VsZi5pbml0aWFsQ2FwdGlvbiB8fCAnJywgb3V0O1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYucHJldmlld0NhY2hlLmNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyUHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGlzSW5pdCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24oY2FwKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdENhcHRpb24oKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdDYWNoZS5vdXQoKTtcclxuICAgICAgICAgICAgY2FwID0gaXNJbml0ICYmIHNlbGYuaW5pdGlhbENhcHRpb24gPyBzZWxmLmluaXRpYWxDYXB0aW9uIDogb3V0LmNhcHRpb247XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdDb250ZW50KG91dC5jb250ZW50KTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0SW5pdFRodW1iQXR0cigpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGNhcCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRTb3J0YWJsZSgpO1xyXG4gICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkob3V0LmNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtaW5wdXQtbmV3Jyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRab29tQnV0dG9uOiBmdW5jdGlvbiAodHlwZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGxhYmVsID0gc2VsZi5wcmV2aWV3Wm9vbUJ1dHRvbkljb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uZnJhbWVDbGFzcyxcclxuICAgICAgICAgICAgICAgICdoZWFkaW5nJzogc2VsZi5tc2dab29tTW9kYWxIZWFkaW5nLFxyXG4gICAgICAgICAgICAgICAgJ3ByZXYnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdwcmV2JyksXHJcbiAgICAgICAgICAgICAgICAnbmV4dCc6IHNlbGYuX2dldFpvb21CdXR0b24oJ25leHQnKSxcclxuICAgICAgICAgICAgICAgICd0b2dnbGVoZWFkZXInOiBzZWxmLl9nZXRab29tQnV0dG9uKCd0b2dnbGVoZWFkZXInKSxcclxuICAgICAgICAgICAgICAgICdmdWxsc2NyZWVuJzogc2VsZi5fZ2V0Wm9vbUJ1dHRvbignZnVsbHNjcmVlbicpLFxyXG4gICAgICAgICAgICAgICAgJ2JvcmRlcmxlc3MnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdib3JkZXJsZXNzJyksXHJcbiAgICAgICAgICAgICAgICAnY2xvc2UnOiBzZWxmLl9nZXRab29tQnV0dG9uKCdjbG9zZScpXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2xpc3Rlbk1vZGFsRXZlbnQ6IGZ1bmN0aW9uIChldmVudCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRtb2RhbCA9IHNlbGYuJG1vZGFsLCBnZXRQYXJhbXMgPSBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgICAgICBzb3VyY2VFdmVudDogZSxcclxuICAgICAgICAgICAgICAgICAgICBwcmV2aWV3SWQ6ICRtb2RhbC5kYXRhKCdwcmV2aWV3SWQnKSxcclxuICAgICAgICAgICAgICAgICAgICBtb2RhbDogJG1vZGFsXHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAkbW9kYWwub24oZXZlbnQgKyAnLmJzLm1vZGFsJywgZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkYnRuRnVsbCA9ICRtb2RhbC5maW5kKCcuYnRuLWZ1bGxzY3JlZW4nKSwgJGJ0bkJvcmQgPSAkbW9kYWwuZmluZCgnLmJ0bi1ib3JkZXJsZXNzJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXpvb20nICsgZXZlbnQsIGdldFBhcmFtcyhlKSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQgPT09ICdzaG93bicpIHtcclxuICAgICAgICAgICAgICAgICAgICAkYnRuQm9yZC5yZW1vdmVDbGFzcygnYWN0aXZlJykuYXR0cignYXJpYS1wcmVzc2VkJywgJ2ZhbHNlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGJ0bkZ1bGwucmVtb3ZlQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICdmYWxzZScpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkbW9kYWwuaGFzQ2xhc3MoJ2ZpbGUtem9vbS1mdWxsc2NyZWVuJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkaC5jaGVja0Z1bGxTY3JlZW4oKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkZ1bGwuYWRkQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICd0cnVlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuQm9yZC5hZGRDbGFzcygnYWN0aXZlJykuYXR0cignYXJpYS1wcmVzc2VkJywgJ3RydWUnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFpvb206IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZGlhbG9nLCBtb2RhbE1haW4gPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnbW9kYWxNYWluJyksIG1vZGFsSWQgPSAnIycgKyAkaC5NT0RBTF9JRDtcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi4kbW9kYWwgPSAkKG1vZGFsSWQpO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuJG1vZGFsIHx8ICFzZWxmLiRtb2RhbC5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICRkaWFsb2cgPSAkKGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpKS5odG1sKG1vZGFsTWFpbikuaW5zZXJ0QWZ0ZXIoc2VsZi4kY29udGFpbmVyKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuJG1vZGFsID0gJChtb2RhbElkKS5pbnNlcnRCZWZvcmUoJGRpYWxvZyk7XHJcbiAgICAgICAgICAgICAgICAkZGlhbG9nLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRoLmluaXRNb2RhbChzZWxmLiRtb2RhbCk7XHJcbiAgICAgICAgICAgIHNlbGYuJG1vZGFsLmh0bWwoc2VsZi5fZ2V0TW9kYWxDb250ZW50KCkpO1xyXG4gICAgICAgICAgICAkLmVhY2goJGguTU9EQUxfRVZFTlRTLCBmdW5jdGlvbiAoa2V5LCBldmVudCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fbGlzdGVuTW9kYWxFdmVudChldmVudCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRab29tQnV0dG9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHByZXZpZXdJZCA9IHNlbGYuJG1vZGFsLmRhdGEoJ3ByZXZpZXdJZCcpIHx8ICcnLCAkZmlyc3QsICRsYXN0LFxyXG4gICAgICAgICAgICAgICAgdGh1bWJzID0gc2VsZi5nZXRGcmFtZXMoKS50b0FycmF5KCksIGxlbiA9IHRodW1icy5sZW5ndGgsICRwcmV2ID0gc2VsZi4kbW9kYWwuZmluZCgnLmJ0bi1wcmV2JyksXHJcbiAgICAgICAgICAgICAgICAkbmV4dCA9IHNlbGYuJG1vZGFsLmZpbmQoJy5idG4tbmV4dCcpO1xyXG4gICAgICAgICAgICBpZiAodGh1bWJzLmxlbmd0aCA8IDIpIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICRuZXh0LmhpZGUoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICRwcmV2LnNob3coKTtcclxuICAgICAgICAgICAgICAgICRuZXh0LnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIWxlbikge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRmaXJzdCA9ICQodGh1bWJzWzBdKTtcclxuICAgICAgICAgICAgJGxhc3QgPSAkKHRodW1ic1tsZW4gLSAxXSk7XHJcbiAgICAgICAgICAgICRwcmV2LnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICRuZXh0LnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIGlmICgkZmlyc3QubGVuZ3RoICYmICRmaXJzdC5hd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kgJiYgJGJvZHkubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICBkaWZmID0gJGJvZHkub3V0ZXJIZWlnaHQodHJ1ZSkgLSAkYm9keS5oZWlnaHQoKTtcclxuICAgICAgICAgICAgICAgIGggLT0gZGlmZjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkbW9kYWwuZmluZCgnLmt2LXpvb20tYm9keScpLmhlaWdodChoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZXNpemVab29tRGlhbG9nOiBmdW5jdGlvbiAoZnVsbFNjcmVlbikge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRtb2RhbCA9IHNlbGYuJG1vZGFsLCAkYnRuRnVsbCA9ICRtb2RhbC5maW5kKCcuYnRuLWZ1bGxzY3JlZW4nKSxcclxuICAgICAgICAgICAgICAgICRidG5Cb3JkID0gJG1vZGFsLmZpbmQoJy5idG4tYm9yZGVybGVzcycpO1xyXG4gICAgICAgICAgICBpZiAoJG1vZGFsLmhhc0NsYXNzKCdmaWxlLXpvb20tZnVsbHNjcmVlbicpKSB7XHJcbiAgICAgICAgICAgICAgICAkaC50b2dnbGVGdWxsU2NyZWVuKGZhbHNlKTtcclxuICAgICAgICAgICAgICAgIGlmICghZnVsbFNjcmVlbikge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJGJ0bkZ1bGwuaGFzQ2xhc3MoJ2FjdGl2ZScpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRtb2RhbC5yZW1vdmVDbGFzcygnZmlsZS16b29tLWZ1bGxzY3JlZW4nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi4kbW9kYWwuZmluZCgnLmt2LXpvb20tYm9keScpLmNzcygnaGVpZ2h0Jywgc2VsZi56b29tTW9kYWxIZWlnaHQpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5GdWxsLnJlbW92ZUNsYXNzKCdhY3RpdmUnKS5hdHRyKCdhcmlhLXByZXNzZWQnLCAnZmFsc2UnKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJGJ0bkZ1bGwuaGFzQ2xhc3MoJ2FjdGl2ZScpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRtb2RhbC5yZW1vdmVDbGFzcygnZmlsZS16b29tLWZ1bGxzY3JlZW4nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzaXplWm9vbURpYWxvZyh0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRidG5Cb3JkLmhhc0NsYXNzKCdhY3RpdmUnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkJvcmQucmVtb3ZlQ2xhc3MoJ2FjdGl2ZScpLmF0dHIoJ2FyaWEtcHJlc3NlZCcsICdmYWxzZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFmdWxsU2NyZWVuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbWF4aW1pemVab29tRGlhbG9nKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgJGgudG9nZ2xlRnVsbFNjcmVlbih0cnVlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkbW9kYWwuZm9jdXMoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zZXRab29tQ29udGVudDogZnVuY3Rpb24gKCRmcmFtZSwgYW5pbWF0ZSkge1xyXG4gICAgICAgICAg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JcbiAgICAgICAgICAgICRib2R5ID0gJG1vZGFsLmZpbmQoJy5rdi16b29tLWJvZHknKTtcclxuICAgICAgICAgICAgJG1vZGFsLnJlbW92ZUNsYXNzKCdrdi1zaW5nbGUtY29udGVudCcpO1xyXG4gICAgICAgICAgICBpZiAoYW5pbWF0ZSkge1xyXG4gICAgICAgICAgICAgICAgJHRtcCA9ICRib2R5LmFkZENsYXNzKCdmaWxlLXRodW1iLWxvYWRpbmcnKS5jbG9uZSgpLmluc2VydEFmdGVyKCRib2R5KTtcclxuICAgICAgICAgICAgICAgICRib2R5Lmh0bWwoYm9keSkuaGlkZSgpO1xyXG4gICAgICAgICAgICAgICAgJHRtcC5mYWRlT3V0KCdmYXN0JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICRib2R5LmZhZGVJbignZmFzdCcsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJvZHkucmVtb3ZlQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICR0bXAucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICRib2R5Lmh0bWwoYm9keSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgY29uZmlnID0gc2VsZi5wcmV2aWV3Wm9vbVNldHRpbmdzW3RtcGx0XTtcclxuICAgICAgICAgICAgaWYgKGNvbmZpZykge1xyXG4gICAgICAgICAgICAgICAgJGRhdGFFbCA9ICRib2R5LmZpbmQoJy5rdi1wcmV2aWV3LWRhdGEnKTtcclxuICAgICAgICAgICAgICAgICRoLmFkZENzcygkZGF0YUVsLCAnZmlsZS16b29tLWRldGFpbCcpO1xyXG4gICAgICAgICAgICAgICAgJC5lYWNoKGNvbmZpZywgZnVuY3Rpb24gKGtleSwgdmFsdWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkZGF0YUVsLmNzcyhrZXksIHZhbHVlKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoKCRkYXRhRWwuYXR0cignd2lkdGgnKSAmJiBrZXkgPT09ICd3aWR0aCcpIHx8ICgkZGF0YUVsLmF0dHIoJ2hlaWdodCcpICYmIGtleSA9PT0gJ2hlaWdodCcpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRkYXRhRWwucmVtb3ZlQXR0cihrZXkpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRtb2RhbC5kYXRhKCdwcmV2aWV3SWQnLCBwcmV2aWV3SWQpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbC5maW5kKCcuYnRuLXByZXYnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fem9vbVNsaWRlU2hvdygncHJldicsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbC5maW5kKCcuYnRuLW5leHQnKSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fem9vbVNsaWRlU2hvdygnbmV4dCcsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRidG5GdWxsLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yZXNpemVab29tRGlhbG9nKHRydWUpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkYnRuQm9yZCwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmVzaXplWm9vbURpYWxvZyhmYWxzZSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRidG5Ub2doLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgJGhlYWRlciA9ICRtb2RhbC5maW5kKCcubW9kYWwtaGVhZGVyJyksICRmbG9hdEJhciA9ICRtb2RhbC5maW5kKCcubW9kYWwtYm9keSAuZmxvYXRpbmctYnV0dG9ucycpLFxyXG4gICAgICAgICAgICAgICAgICAgIGh0LCAkYWN0aW9ucyA9ICRoZWFkZXIuZmluZCgnLmt2LXpvb20tYWN0aW9ucycpLCByZXNpemUgPSBmdW5jdGlvbiAoaGVpZ2h0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciAkYm9keSA9IHNlbGYuJG1vZGFsLmZpbmQoJy5rdi16b29tLWJvZHknKSwgaCA9IHNlbGYuem9vbU1vZGFsSGVpZ2h0O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJG1vZGFsLmhhc0NsYXNzKCdmaWxlLXpvb20tZnVsbHNjcmVlbicpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gJGJvZHkub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWhlaWdodCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBoIC0gJGhlYWRlci5vdXRlckhlaWdodCh0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYm9keS5jc3MoJ2hlaWdodCcsIGhlaWdodCA/IGggKyBoZWlnaHQgOiBoKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgaWYgKCRoZWFkZXIuaXMoJzp2aXNpYmxlJykpIHtcclxuICAgICAgICAgICAgICAgICAgICBodCA9ICRoZWFkZXIub3V0ZXJIZWlnaHQodHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGhlYWRlci5zbGlkZVVwKCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYWN0aW9ucy5maW5kKCcuYnRuJykuYXBwZW5kVG8oJGZsb2F0QmFyKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzaXplKGh0KTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZsb2F0QmFyLmZpbmQoJy5idG4nKS5hcHBlbmRUbygkYWN0aW9ucyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGhlYWRlci5zbGlkZURvd24oJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc2l6ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgJG1vZGFsLmZvY3VzKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRtb2RhbCwgJ2tleWRvd24nLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IGUud2hpY2ggfHwgZS5rZXlDb2RlLCAkcHJldiA9ICQodGhpcykuZmluZCgnLmJ0bi1wcmV2JyksICRuZXh0ID0gJCh0aGlzKS5maW5kKCcuYnRuLW5leHQnKSxcclxuICAgICAgICAgICAgICAgICAgICB2SWQgPSAkKHRoaXMpLmRhdGEoJ3ByZXZpZXdJZCcpLCB2UHJldktleSA9IHNlbGYucnRsID8gMzkgOiAzNywgdk5leHRLZXkgPSBzZWxmLnJ0bCA/IDM3IDogMzk7XHJcbiAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSB2UHJldktleSAmJiAkcHJldi5sZW5ndGggJiYgISRwcmV2LmF0dHIoJ2Rpc2FibGVkJykpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl96b29tU2xpZGVTaG93KCdwcmV2JywgdklkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChrZXkgPT09IHZOZXh0S2V5ICYmICRuZXh0Lmxlbmd0aCAmJiAhJG5leHQuYXR0cignZGlzYWJsZWQnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3pvb21TbGlkZVNob3coJ25leHQnLCB2SWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF96b29tUHJldmlldzogZnVuY3Rpb24gKCRidG4pIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUsICRtb2RhbCA9IHNlbGYuJG1vZGFsO1xyXG4gICAgICAgICAgICBpZiAoISRidG4ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICB0aHJvdyAnQ2Fubm90IHpvb20gdG8gZGV0YWlsZWQgcHJldmlldyEnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRoLmluaXRNb2RhbCgkbW9kYWwpO1xyXG4gICAgICAgICAgICAkbW9kYWwuaHRtbChzZWxmLl9nZXRNb2RhbENvbnRlbnQoKSk7XHJcbiAgICAgICAgICAgICRmcmFtZSA9ICRidG4uY2xvc2VzdCgkaC5GUkFNRVMpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRab29tQ29udGVudCgkZnJhbWUpO1xyXG4gICAgICAgICAgICAkbW9kYWwubW9kYWwoJ3Nob3cnKTtcclxuICAgICAgICAgICAgc2VsZi5faW5pdFpvb21CdXR0b25zKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfem9vbVNsaWRlU2hvdzogZnVuY3Rpb24gKGRpciwgcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGJ0biA9IHNlbGYuJG1vZGFsLmZpbmQoJy5rdi16b29tLWFjdGlvbnMgLmJ0bi0nICsgZGlyKSwgJHRhcmdGcmFtZSwgaSxcclxuICAgICAgICAgICAgICAgIHRodW1icyA9IHNlbGYuZ2V0RnJhbWVzKCkudG9BcnJheSgpLCBsZW4gPSB0aHVtYnMubGVuZ3RoLCBvdXQ7XHJcbiAgICAgICAgICAgIGlmICgkYnRuLmF0dHIoJ2Rpc2FibGVkJykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICAgIGlmICgkKHRodW1ic1tpXSkuYXR0cignaWQnKSA9PT0gcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgb3V0ID0gZGlyID09PSAncHJldicgPyBpIC0gMSA6IGkgKyAxO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChvdXQgPCAwIHx8IG91dCA+PSBsZW4gfHwgIXRodW1ic1tvdXRdKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJHRhcmdGcmFtZSA9ICQodGh1bWJzW291dF0pO1xyXG4gICAgICAgICAgICBpZiAoJHRhcmdGcmFtZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFpvb21Db250ZW50KCR0YXJnRnJhbWUsIHRydWUpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9ucygpO1xyXG4gICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXpvb20nICsgZGlyLCB7J3ByZXZpZXdJZCc6IHByZXZpZXdJZCwgbW9kYWw6IHNlbGYuJG1vZGFsfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFpvb21CdXR0b246IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBzZWxmLiRwcmV2aWV3LmZpbmQoJy5rdi1maWxlLXpvb20nKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkZWwsICdjbGljaycsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl96b29tUHJldmlldygkZWwpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2lucHV0RmlsZUNvdW50OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB0aGlzLiRlbGVtZW50LmdldCgwKS5maWxlcy5sZW5ndGg7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaFByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBmaWxlcztcclxuICAgICAgICAgICAgaWYgKCghc2VsZi5faW5wdXRGaWxlQ291bnQoKSAmJiAhc2VsZi5pc0FqYXhVcGxvYWQpIHx8ICFzZWxmLnNob3dQcmV2aWV3IHx8ICFzZWxmLmlzUHJldmlld2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIGZpbGVzID0gc2VsZi5nZXRGaWxlU3RhY2soKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZXN0YWNrID0gW107XHJcbiAgICAgICAgICAgICAgICBpZiAoZmlsZXMubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZXMgPSBzZWxmLiRlbGVtZW50LmdldCgwKS5maWxlcztcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGZpbGVzID0gc2VsZi4kZWxlbWVudC5nZXQoMCkuZmlsZXM7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGZpbGVzICYmIGZpbGVzLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5yZWFkRmlsZXMoZmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0RmlsZURyb3Bab25lVGl0bGUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NsZWFyT2JqZWN0czogZnVuY3Rpb24gKCRlbCkge1xyXG4gICAgICAgICAgICAkZWwuZmluZCgndmlkZW8gYXVkaW8nKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMucGF1c2UoKTtcclxuICAgICAgICAgICAgICAgICQodGhpcykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAkZWwuZmluZCgnaW1nIG9iamVjdCBkaXYnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICQodGhpcykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NsZWFyRmlsZUlucHV0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVsID0gc2VsZi4kZWxlbWVudCwgJHNyY0ZybSwgJHRtcEZybSwgJHRtcEVsO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuX2lucHV0RmlsZUNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkc3JjRnJtID0gJGVsLmNsb3Nlc3QoJ2Zvcm0nKTtcclxuICAgICAgICAgICAgJHRtcEZybSA9ICQoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZm9ybScpKTtcclxuICAgICAgICAgICAgJHRtcEVsID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSk7XHJcbiAgICAgICAgICAgICRlbC5iZWZvcmUoJHRtcEVsKTtcclxuICAgICAgICAgICAgaWYgKCRzcmNGcm0ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAkc3JjRnJtLmFmdGVyKCR0bXBGcm0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgJHRtcEVsLmFmdGVyKCR0bXBGcm0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICR0bXBGcm0uYXBwZW5kKCRlbCkudHJpZ2dlcigncmVzZXQnKTtcclxuICAgICAgICAgICAgJHRtcEVsLmJlZm9yZSgkZWwpLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAkdG1wRnJtLnJlbW92ZSgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0VXBsb2FkOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZSA9IHtjb250ZW50OiBbXSwgY29uZmlnOiBbXSwgdGFnczogW10sIGFwcGVuZDogdHJ1ZX07XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZFN0YXR1cyA9IHt9O1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZEFzeW5jQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLmxvYWRlZEltYWdlcyA9IFtdO1xyXG4gICAgICAgICAgICBzZWxmLnRvdGFsSW1hZ2VzQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLiRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMCk7XHJcbiAgICAgICAgICAgIHNlbGYuJHByb2dyZXNzLmhpZGUoKTtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnMoZmFsc2UpO1xyXG4gICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgIHNlbGYuYWpheFJlcXVlc3RzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuX3Jlc2V0Q2FudmFzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuY2FjaGVJbml0aWFsUHJldmlldyA9IHt9O1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3ID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gW107XHJcbiAgICAgICAgICAgICAgICBzZWxmLnByZXZpZXdDYWNoZS5kYXRhID0ge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFtdLFxyXG4gICAgICAgICAgICAgICAgICAgIGNvbmZpZzogW10sXHJcbiAgICAgICAgICAgICAgICAgICAgdGFnczogW11cclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZXNldENhbnZhczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLmNhbnZhcyAmJiBzZWxmLmltYWdlQ2FudmFzQ29udGV4dCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5pbWFnZUNhbnZhc0NvbnRleHQuY2xlYXJSZWN0KDAsIDAsIHNlbGYuY2FudmFzLndpZHRoLCBzZWxmLmNhbnZhcy5oZWlnaHQpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaGFzSW5pdGlhbFByZXZpZXc6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gIXNlbGYub3ZlcndyaXRlSW5pdGlhbCAmJiBzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Jlc2V0UHJldmlldzogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIG91dCwgY2FwO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSkge1xyXG4gICAgICAgICAgICAgICAgb3V0ID0gc2VsZi5wcmV2aWV3Q2FjaGUub3V0KCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3Q29udGVudChvdXQuY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRJbml0VGh1bWJBdHRyKCk7XHJcbiAgICAgICAgICAgICAgICBjYXAgPSBzZWxmLmluaXRpYWxDYXB0aW9uID8gc2VsZi5pbml0aWFsQ2FwdGlvbiA6IG91dC5jYXB0aW9uO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0Q2FwdGlvbihjYXApO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJQcmV2aWV3KCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0Q2FwdGlvbigpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0Wm9vbSgpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jbGVhckRlZmF1bHRQcmV2aWV3OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi4kcHJldmlldy5maW5kKCcuZmlsZS1kZWZhdWx0LXByZXZpZXcnKS5yZW1vdmUoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF92YWxpZGF0ZURlZmF1bHRQcmV2aWV3OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3IHx8ICRoLmlzRW1wdHkoc2VsZi5kZWZhdWx0UHJldmlld0NvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJldmlld0NvbnRlbnQoJzxkaXYgY2xhc3M9XCJmaWxlLWRlZmF1bHQtcHJldmlld1wiPicgKyBzZWxmLmRlZmF1bHRQcmV2aWV3Q29udGVudCArICc8L2Rpdj4nKTtcclxuICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLnJlbW92ZUNsYXNzKCdmaWxlLWlucHV0LW5ldycpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0Q2xpY2thYmxlKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVzZXRQcmV2aWV3VGh1bWJzOiBmdW5jdGlvbiAoaXNBamF4KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgb3V0O1xyXG4gICAgICAgICAgICBpZiAoaXNBamF4KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhclByZXZpZXcoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLl9oYXNJbml0aWFsUHJldmlldygpKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLnByZXZpZXdDYWNoZS5vdXQoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdDb250ZW50KG91dC5jb250ZW50KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldEluaXRUaHVtYkF0dHIoKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24ob3V0LmNhcHRpb24pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhclByZXZpZXcoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dldExheW91dFRlbXBsYXRlOiBmdW5jdGlvbiAodCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHRlbXBsYXRlID0gc2VsZi5sYXlvdXRUZW1wbGF0ZXNbdF07XHJcbiAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KHNlbGYuY3VzdG9tTGF5b3V0VGFncykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB0ZW1wbGF0ZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gJGgucmVwbGFjZVRhZ3ModGVtcGxhdGUsIHNlbGYuY3VzdG9tTGF5b3V0VGFncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0UHJldmlld1RlbXBsYXRlOiBmdW5jdGlvbiAodCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHRlbXBsYXRlID0gc2VsZi5wcmV2aWV3VGVtcGxhdGVzW3RdO1xyXG4gICAgICAgICAgICBpZiAoJGguaXNFbXB0eShzZWxmLmN1c3RvbVByZXZpZXdUYWdzKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRlbXBsYXRlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAkaC5yZXBsYWNlVGFncyh0ZW1wbGF0ZSwgc2VsZi5jdXN0b21QcmV2aWV3VGFncyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0T3V0RGF0YTogZnVuY3Rpb24gKGpxWEhSLCByZXNwb25zZURhdGEsIGZpbGVzRGF0YSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGpxWEhSID0ganFYSFIgfHwge307XHJcbiAgICAgICAgICAgIHJlc3BvbnNlRGF0YSA9IHJlc3BvbnNlRGF0YSB8fCB7fTtcclxuICAgICAgICAgICAgZmlsZXNEYXRhID0gZmlsZXNEYXRhIHx8IHNlbGYuZmlsZXN0YWNrLnNsaWNlKDApIHx8IHt9O1xyXG4gICAgICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICAgICAgZm9ybTogc2VsZi5mb3JtZGF0YSxcclxuICAgICAgICAgICAgICAgIGZpbGVzOiBmaWxlc0RhdGEsXHJcbiAgICAgICAgICAgICAgICBmaWxlbmFtZXM6IHNlbGYuZmlsZW5hbWVzLFxyXG4gICAgICAgICAgICAgICAgZmlsZXNjb3VudDogc2VsZi5nZXRGaWxlc0NvdW50KCksXHJcbiAgICAgICAgICAgICAgICBleHRyYTogc2VsZi5fZ2V0RXh0cmFEYXRhKCksXHJcbiAgICAgICAgICAgICAgICByZXNwb25zZTogcmVzcG9uc2VEYXRhLFxyXG4gICAgICAgICAgICAgICAgcmVhZGVyOiBzZWxmLnJlYWRlcixcclxuICAgICAgICAgICAgICAgIGpxWEhSOiBqcVhIUlxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dldE1zZ1NlbGVjdGVkOiBmdW5jdGlvbiAobikge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHN0ckZpbGVzID0gbiA9PT0gMSA/IHNlbGYuZmlsZVNpbmdsZSA6IHNlbGYuZmlsZVBsdXJhbDtcclxuICAgICAgICAgICAgcmV0dXJuIG4gPiAwID8gc2VsZi5tc2dTZWxlY3RlZC5yZXBsYWNlKCd7bn0nLCBuKS5yZXBsYWNlKCd7ZmlsZXN9Jywgc3RyRmlsZXMpIDogc2VsZi5tc2dOb0ZpbGVzU2VsZWN0ZWQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0RnJhbWU6IGZ1bmN0aW9uIChpZCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRmcmFtZSA9ICQoJyMnICsgaWQpO1xyXG4gICAgICAgICAgICBpZiAoISRmcmFtZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZygnSW52YWxpZCB0aHVtYiBmcmFtZSB3aXRoIGlkOiBcIicgKyBpZCArICdcIi4nKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiBudWxsO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAkZnJhbWU7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0VGh1bWJzOiBmdW5jdGlvbiAoY3NzKSB7XHJcbiAgICAgICAgICAgIGNzcyA9IGNzcyB8fCAnJztcclxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RnJhbWVzKCc6bm90KC5maWxlLXByZXZpZXctaW5pdGlhbCknICsgY3NzKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRFeHRyYURhdGE6IGZ1bmN0aW9uIChwcmV2aWV3SWQsIGluZGV4KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZGF0YSA9IHNlbGYudXBsb2FkRXh0cmFEYXRhO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIHNlbGYudXBsb2FkRXh0cmFEYXRhID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBkYXRhID0gc2VsZi51cGxvYWRFeHRyYURhdGEocHJldmlld0lkLCBpbmRleCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGRhdGE7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFhocjogZnVuY3Rpb24gKHhocm9iaiwgcHJldmlld0lkLCBmaWxlQ291bnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoeGhyb2JqLnVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgeGhyb2JqLnVwbG9hZC5hZGRFdmVudExpc3RlbmVyKCdwcm9ncmVzcycsIGZ1bmN0aW9uIChldmVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBwY3QgPSAwLCB0b3RhbCA9IGV2ZW50LnRvdGFsLCBwb3NpdGlvbiA9IGV2ZW50LmxvYWRlZCB8fCBldmVudC5wb3NpdGlvbjtcclxuICAgICAgICAgICAgICAgICAgICAvKiogQG5hbWVzcGFjZSBldmVudC5sZW5ndGhDb21wdXRhYmxlICovXHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50Lmxlbmd0aENvbXB1dGFibGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcGN0ID0gTWF0aC5mbG9vcihwb3NpdGlvbiAvIHRvdGFsICogMTAwKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByZXZpZXdJZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRBc3luY1VwbG9hZFN0YXR1cyhwcmV2aWV3SWQsIHBjdCwgZmlsZUNvdW50KTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzcyhwY3QpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0sIGZhbHNlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4geGhyb2JqO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRBamF4U2V0dGluZ3M6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBzZWxmLl9hamF4U2V0dGluZ3MgPSAkLmV4dGVuZCh0cnVlLCB7fSwgc2VsZi5hamF4U2V0dGluZ3MpO1xyXG4gICAgICAgICAgICBzZWxmLl9hamF4RGVsZXRlU2V0dGluZ3MgPSAkLmV4dGVuZCh0cnVlLCB7fSwgc2VsZi5hamF4RGVsZXRlU2V0dGluZ3MpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX21lcmdlQWpheENhbGxiYWNrOiBmdW5jdGlvbiAoZnVuY05hbWUsIHNyY0Z1bmMsIHR5cGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBzZXR0aW5ncyA9IHNlbGYuX2FqYXhTZXR0aW5ncywgZmxhZyA9IHNlbGYubWVyZ2VBamF4Q2FsbGJhY2tzLCB0YXJnRnVuYztcclxuICAgICAgICAgICAgaWYgKHR5cGUgPT09ICdkZWxldGUnKSB7XHJcbiAgICAgICAgICAgICAgICBzZXR0aW5ncyA9IHNlbGYuX2FqYXhEZWxldGVTZXR0aW5ncztcclxuICAgICAgICAgICAgICAgIGZsYWcgPSBzZWxmLm1lcmdlQWpheERlbGV0ZUNhbGxiYWNrcztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB0YXJnRnVuYyA9IHNldHRpbmdzW2Z1bmNOYW1lXTtcclxuICAgICAgICAgICAgaWYgKGZsYWcgJiYgdHlwZW9mIHRhcmdGdW5jID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoZmxhZyA9PT0gJ2JlZm9yZScpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZXR0aW5nc1tmdW5jTmFtZV0gPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdGdW5jLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNyY0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBzZXR0aW5nc1tmdW5jTmFtZV0gPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNyY0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ0Z1bmMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2V0dGluZ3NbZnVuY05hbWVdID0gc3JjRnVuYztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2FqYXhTdWJtaXQ6IGZ1bmN0aW9uIChmbkJlZm9yZSwgZm5TdWNjZXNzLCBmbkNvbXBsZXRlLCBmbkVycm9yLCBwcmV2aWV3SWQsIGluZGV4KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgc2V0dGluZ3MsIHZVcmw7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVwcmVhamF4JywgW3ByZXZpZXdJZCwgaW5kZXhdKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3VwbG9hZEV4dHJhKHByZXZpZXdJZCwgaW5kZXgpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0QWpheFNldHRpbmdzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX21lcmdlQWpheENhbGxiYWNrKCdiZWZvcmVTZW5kJywgZm5CZWZvcmUpO1xyXG4gICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnc3VjY2VzcycsIGZuU3VjY2Vzcyk7XHJcbiAgICAgICAgICAgIHNlbGYuX21lcmdlQWpheENhbGxiYWNrKCdjb21wbGV0ZScsIGZuQ29tcGxldGUpO1xyXG4gICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnZXJyb3InLCBmbkVycm9yKTtcclxuICAgICAgICAgICAgdlVybCA9IGluZGV4ICYmIHNlbGYudXBsb2FkVXJsVGh1bWIgPyBzZWxmLnVwbG9hZFVybFRodW1iIDogc2VsZi51cGxvYWRVcmw7XHJcbiAgICAgICAgICAgIHNldHRpbmdzID0gJC5leHRlbmQodHJ1ZSwge30sIHtcclxuICAgICAgICAgICAgICAgIHhocjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciB4aHJvYmogPSAkLmFqYXhTZXR0aW5ncy54aHIoKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2VsZi5faW5pdFhocih4aHJvYmosIHByZXZpZXdJZCwgc2VsZi5nZXRGaWxlU3RhY2soKS5sZW5ndGgpO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHVybDogc2VsZi5fZW5jb2RlVVJJKHZVcmwpLFxyXG4gICAgICAgICAgICAgICAgdHlwZTogJ1BPU1QnLFxyXG4gICAgICAgICAgICAgICAgZGF0YVR5cGU6ICdqc29uJyxcclxuICAgICAgICAgICAgICAgIGRhdGE6IHNlbGYuZm9ybWRhdGEsXHJcbiAgICAgICAgICAgICAgICBjYWNoZTogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBwcm9jZXNzRGF0YTogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICBjb250ZW50VHlwZTogZmFsc2VcclxuICAgICAgICAgICAgfSwgc2VsZi5fYWpheFNldHRpbmdzKTtcclxuICAgICAgICAgICAgc2VsZi5hamF4UmVxdWVzdHMucHVzaCgkLmFqYXgoc2V0dGluZ3MpKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9tZXJnZUFycmF5OiBmdW5jdGlvbiAocHJvcCwgY29udGVudCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGFycjEgPSAkaC5jbGVhbkFycmF5KHNlbGZbcHJvcF0pLCBhcnIyID0gJGguY2xlYW5BcnJheShjb250ZW50KTtcclxuICAgICAgICAgICAgc2VsZltwcm9wXSA9IGFycjEuY29uY2F0KGFycjIpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRVcGxvYWRTdWNjZXNzOiBmdW5jdGlvbiAob3V0LCAkdGh1bWIsIGFsbEZpbGVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgYXBwZW5kLCBkYXRhLCBpbmRleCwgJGRpdiwgJG5ld0NhY2hlLCBjb250ZW50LCBjb25maWcsIHRhZ3MsIGk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5zaG93UHJldmlldyB8fCB0eXBlb2Ygb3V0ICE9PSAnb2JqZWN0JyB8fCAkLmlzRW1wdHlPYmplY3Qob3V0KSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChvdXQuaW5pdGlhbFByZXZpZXcgIT09IHVuZGVmaW5lZCAmJiBvdXQuaW5pdGlhbFByZXZpZXcubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5oYXNJbml0RGF0YSA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBjb250ZW50ID0gb3V0LmluaXRpYWxQcmV2aWV3IHx8IFtdO1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gb3V0LmluaXRpYWxQcmV2aWV3Q29uZmlnIHx8IFtdO1xyXG4gICAgICAgICAgICAgICAgdGFncyA9IG91dC5pbml0aWFsUHJldmlld1RodW1iVGFncyB8fCBbXTtcclxuICAgICAgICAgICAgICAgIGFwcGVuZCA9IG91dC5hcHBlbmQgPT09IHVuZGVmaW5lZCB8fCBvdXQuYXBwZW5kO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvbnRlbnQubGVuZ3RoID4gMCAmJiAhJGguaXNBcnJheShjb250ZW50KSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQgPSBjb250ZW50LnNwbGl0KHNlbGYuaW5pdGlhbFByZXZpZXdEZWxpbWl0ZXIpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fbWVyZ2VBcnJheSgnaW5pdGlhbFByZXZpZXcnLCBjb250ZW50KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX21lcmdlQXJyYXkoJ2luaXRpYWxQcmV2aWV3Q29uZmlnJywgY29uZmlnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX21lcmdlQXJyYXkoJ2luaXRpYWxQcmV2aWV3VGh1bWJUYWdzJywgdGFncyk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJHRodW1iICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWFsbEZpbGVzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gc2VsZi5wcmV2aWV3Q2FjaGUuYWRkKGNvbnRlbnQsIGNvbmZpZ1swXSwgdGFnc1swXSwgYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IHNlbGYucHJldmlld0NhY2hlLmdldChpbmRleCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZGl2ID0gJChkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSkuaHRtbChkYXRhKS5oaWRlKCkuaW5zZXJ0QWZ0ZXIoJHRodW1iKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJG5ld0NhY2hlID0gJGRpdi5maW5kKCcua3Ytem9vbS1jYWNoZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJG5ld0NhY2hlICYmICRuZXdDYWNoZS5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRuZXdDYWNoZS5pbnNlcnRBZnRlcigkdGh1bWIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5mYWRlT3V0KCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyICRuZXdUaHVtYiA9ICRkaXYuZmluZCgnLmZpbGUtcHJldmlldy1mcmFtZScpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRuZXdUaHVtYiAmJiAkbmV3VGh1bWIubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJG5ld1RodW1iLmluc2VydEJlZm9yZSgkdGh1bWIpLmZhZGVJbignc2xvdycpLmNzcygnZGlzcGxheTppbmxpbmUtYmxvY2snKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3QWN0aW9ucygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmNsZWFuWm9vbUNhY2hlKHNlbGYuJHByZXZpZXcuZmluZCgnI3pvb20tJyArICR0aHVtYi5hdHRyKCdpZCcpKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZGl2LnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSAkdGh1bWIuYXR0cignZGF0YS1maWxlaW5kZXgnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb250ZW50W2ldID0gY29udGVudFswXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb25maWdbaV0gPSBjb25maWdbMF0gfHwgW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQ2FjaGUudGFnc1tpXSA9IHRhZ3NbMF0gfHwgW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQ2FjaGUuYXBwZW5kID0gYXBwZW5kO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5wcmV2aWV3Q2FjaGUuc2V0KGNvbnRlbnQsIGNvbmZpZywgdGFncywgYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRQcmV2aWV3QWN0aW9ucygpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaW5pdFN1Y2Nlc3NUaHVtYnM6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuc2hvd1ByZXZpZXcpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9nZXRUaHVtYnMoJGguRlJBTUVTICsgJy5maWxlLXByZXZpZXctc3VjY2VzcycpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldywgJHJlbW92ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICRyZW1vdmUucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJHJlbW92ZSwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBpZCA9ICR0aHVtYi5hdHRyKCdpZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBvdXQgPSBzZWxmLl9yYWlzZSgnZmlsZXN1Y2Nlc3NyZW1vdmUnLCBbaWQsICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGguY2xlYW5NZW1vcnkoJHRodW1iKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAob3V0ID09PSBmYWxzZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5mYWRlT3V0KCdzbG93JywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkaC5jbGVhblpvb21DYWNoZSgkcHJldmlldy5maW5kKCcjem9vbS0nICsgaWQpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuZ2V0RnJhbWVzKCkubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJlc2V0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jaGVja0FzeW5jQ29tcGxldGU6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBwcmV2aWV3SWQsIGk7XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzZWxmLmZpbGVzdGFjay5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuZmlsZXN0YWNrW2ldKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcHJldmlld0lkID0gc2VsZi5wcmV2aWV3SW5pdElkICsgJy0nICsgaTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJC5pbkFycmF5KHByZXZpZXdJZCwgc2VsZi51cGxvYWRMb2cpID09PSAtMSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAoc2VsZi51cGxvYWRBc3luY0NvdW50ID09PSBzZWxmLnVwbG9hZExvZy5sZW5ndGgpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwbG9hZEV4dHJhOiBmdW5jdGlvbiAocHJldmlld0lkLCBpbmRleCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGRhdGEgPSBzZWxmLl9nZXRFeHRyYURhdGEocHJldmlld0lkLCBpbmRleCk7XHJcbiAgICAgICAgICAgIGlmIChkYXRhLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICQuZWFjaChkYXRhLCBmdW5jdGlvbiAoa2V5LCB2YWx1ZSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5mb3JtZGF0YS5hcHBlbmQoa2V5LCB2YWx1ZSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3VwbG9hZFNpbmdsZTogZnVuY3Rpb24gKGksIGlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCB0b3RhbCA9IHNlbGYuZ2V0RmlsZVN0YWNrKCkubGVuZ3RoLCBmb3JtZGF0YSA9IG5ldyBGb3JtRGF0YSgpLCBvdXREYXRhLFxyXG4gICAgICAgICAgICAgICAgcHJldmlld0lkID0gc2VsZi5wcmV2aWV3SW5pdElkICsgJy0nICsgaSwgJHRodW1iLCBjaGtDb21wbGV0ZSwgJGJ0blVwbG9hZCwgJGJ0bkRlbGV0ZSxcclxuICAgICAgICAgICAgICAgIGhhc1Bvc3REYXRhID0gc2VsZi5maWxlc3RhY2subGVuZ3RoID4gMCB8fCAhJC5pc0VtcHR5T2JqZWN0KHNlbGYudXBsb2FkRXh0cmFEYXRhKSwgdXBsb2FkRmFpbGVkLFxyXG4gICAgICAgICAgICAgICAgJHByb2cgPSAkKCcjJyArIHByZXZpZXdJZCkuZmluZCgnLmZpbGUtdGh1bWItcHJvZ3Jlc3MnKSwgZm5CZWZvcmUsIGZuU3VjY2VzcywgZm5Db21wbGV0ZSwgZm5FcnJvcixcclxuICAgICAgICAgICAgICAgIHVwZGF0ZVVwbG9hZExvZywgcGFyYW1zID0ge2lkOiBwcmV2aWV3SWQsIGluZGV4OiBpfTtcclxuICAgICAgICAgICAgc2VsZi5mb3JtZGF0YSA9IGZvcm1kYXRhO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgJHRodW1iID0gJCgnIycgKyBwcmV2aWV3SWQgKyAnOm5vdCguZmlsZS1wcmV2aWV3LWluaXRpYWwpJyk7XHJcbiAgICAgICAgICAgICAgICAkYnRuVXBsb2FkID0gJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpO1xyXG4gICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICRwcm9nLnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAodG90YWwgPT09IDAgfHwgIWhhc1Bvc3REYXRhIHx8ICgkYnRuVXBsb2FkICYmICRidG5VcGxvYWQuaGFzQ2xhc3MoJ2Rpc2FibGVkJykpIHx8IHNlbGYuX2Fib3J0KHBhcmFtcykpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB1cGRhdGVVcGxvYWRMb2cgPSBmdW5jdGlvbiAoaSwgcHJldmlld0lkKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXVwbG9hZEZhaWxlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkTG9nLnB1c2gocHJldmlld0lkKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9jaGVja0FzeW5jQ29tcGxldGUoKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgY2hrQ29tcGxldGUgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgdSA9IHNlbGYudXBsb2FkQ2FjaGUsICRpbml0VGh1bWJzLCBpLCBqLCBsZW4gPSAwLCBkYXRhID0gc2VsZi5jYWNoZUluaXRpYWxQcmV2aWV3O1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLmZpbGVCYXRjaENvbXBsZXRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChkYXRhICYmIGRhdGEuY29udGVudCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGxlbiA9IGRhdGEuY29udGVudC5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgdHJpZ2dlclJlc2V0ID0gc2VsZi5nZXRGaWxlU3RhY2sodHJ1ZSkubGVuZ3RoID09PSAwO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLnNldCh1LmNvbnRlbnQsIHUuY29uZmlnLCB1LnRhZ3MsIHUuYXBwZW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHUuY29udGVudC5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPSBpICsgbGVuO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuY29udGVudFtqXSA9IHUuY29udGVudFtpXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL25vaW5zcGVjdGlvbiBKU1VucmVzb2x2ZWRWYXJpYWJsZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmNvbmZpZy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5jb25maWdbal0gPSB1LmNvbmZpZ1tpXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEudGFncy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS50YWdzW2pdID0gdS50YWdzW2ldO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXcgPSAkaC5jbGVhbkFycmF5KGRhdGEuY29udGVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnID0gJGguY2xlYW5BcnJheShkYXRhLmNvbmZpZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzID0gJGguY2xlYW5BcnJheShkYXRhLnRhZ3MpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlldyA9IHUuY29udGVudDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdDb25maWcgPSB1LmNvbmZpZztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdUaHVtYlRhZ3MgPSB1LnRhZ3M7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jYWNoZUluaXRpYWxQcmV2aWV3ID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmhhc0luaXREYXRhKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51bmxvY2sodHJpZ2dlclJlc2V0KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAodHJpZ2dlclJlc2V0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRpbml0VGh1bWJzID0gc2VsZi4kcHJldmlldy5maW5kKCcuZmlsZS1wcmV2aWV3LWluaXRpYWwnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi51cGxvYWRBc3luYyAmJiAkaW5pdFRodW1icy5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRpbml0VGh1bWJzLCAkaC5TT1JUX0NTUyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRTb3J0YWJsZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNodXBsb2FkY29tcGxldGUnLCBbc2VsZi5maWxlc3RhY2ssIHNlbGYuX2dldEV4dHJhRGF0YSgpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDb3VudCA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRTdGF0dXMgPSB7fTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5hamF4QWJvcnRlZCA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJHRodW1iLmhhc0NsYXNzKCdmaWxlLXByZXZpZXctc3VjY2VzcycpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0xvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCR0aHVtYiwgJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQuYXR0cignZGlzYWJsZWQnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAkYnRuRGVsZXRlLmF0dHIoJ2Rpc2FibGVkJywgdHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlcHJldXBsb2FkJywgW291dERhdGEsIHByZXZpZXdJZCwgaV0pO1xyXG4gICAgICAgICAgICAgICAgJC5leHRlbmQodHJ1ZSwgcGFyYW1zLCBvdXREYXRhKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydChwYXJhbXMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAganFYSFIuYWJvcnQoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJTdGF0dXMoJHRodW1iLCAnTmV3Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0blVwbG9hZC5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYnRuRGVsZXRlLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudW5sb2NrKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuU3VjY2VzcyA9IGZ1bmN0aW9uIChkYXRhLCB0ZXh0U3RhdHVzLCBqcVhIUikge1xyXG4gICAgICAgICAgICAgICAgdmFyIHBpZCA9IHNlbGYuc2hvd1ByZXZpZXcgJiYgJHRodW1iLmF0dHIoJ2lkJykgPyAkdGh1bWIuYXR0cignaWQnKSA6IHByZXZpZXdJZDtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSLCBkYXRhKTtcclxuICAgICAgICAgICAgICAgICQuZXh0ZW5kKHRydWUsIHBhcmFtcywgb3V0RGF0YSk7XHJcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShkYXRhKSB8fCAkaC5pc0VtcHR5KGRhdGEuZXJyb3IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRUaHVtYlN0YXR1cygkdGh1bWIsICdTdWNjZXNzJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuVXBsb2FkLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRVcGxvYWRTdWNjZXNzKGRhdGEsICR0aHVtYiwgaXNCYXRjaCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzcygxMDEsICRwcm9nKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXVwbG9hZGVkJywgW291dERhdGEsIHBpZCwgaV0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVVwbG9hZExvZyhpLCBwaWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdXBsb2FkRmFpbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIHBhcmFtcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdFcnJvcigkdGh1bWIsIGksIHNlbGYuZmlsZXN0YWNrW2ldLCBzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkYnRuVXBsb2FkLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNCYXRjaCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlVXBsb2FkTG9nKGksIHBpZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCAkKCcjJyArIHBpZCkuZmluZCgnLmZpbGUtdGh1bWItcHJvZ3Jlc3MnKSwgc2VsZi5tc2dVcGxvYWRFcnJvcik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5Db21wbGV0ZSA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghaXNCYXRjaCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnVubG9jayhmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2hrQ29tcGxldGUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdFN1Y2Nlc3NUaHVtYnMoKTtcclxuICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuRXJyb3IgPSBmdW5jdGlvbiAoanFYSFIsIHRleHRTdGF0dXMsIGVycm9yVGhyb3duKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgb3AgPSBzZWxmLmFqYXhPcGVyYXRpb25zLnVwbG9hZFRodW1iLFxyXG4gICAgICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bixcclxuICAgICAgICAgICAgICAgICAgICAgICAgKGlzQmF0Y2ggJiYgc2VsZi5maWxlc3RhY2tbaV0ubmFtZSA/IHNlbGYuZmlsZXN0YWNrW2ldLm5hbWUgOiBudWxsKSk7XHJcbiAgICAgICAgICAgICAgICB1cGxvYWRGYWlsZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQmF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlVXBsb2FkTG9nKGksIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkU3RhdHVzW3ByZXZpZXdJZF0gPSAxMDA7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJldmlld0Vycm9yKCR0aHVtYiwgaSwgc2VsZi5maWxlc3RhY2tbaV0sIHNlbGYucmV0cnlFcnJvclVwbG9hZHMpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5yZXRyeUVycm9yVXBsb2Fkcykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkYnRuVXBsb2FkLmhpZGUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgJC5leHRlbmQodHJ1ZSwgcGFyYW1zL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ay5sZW5ndGggPiAwIHx8ICEkLmlzRW1wdHlPYmplY3Qoc2VsZi51cGxvYWRFeHRyYURhdGEpLFxyXG4gICAgICAgICAgICAgICAgc2V0QWxsVXBsb2FkZWQ7XHJcbiAgICAgICAgICAgIHNlbGYuZm9ybWRhdGEgPSBuZXcgRm9ybURhdGEoKTtcclxuICAgICAgICAgICAgaWYgKHRvdGFsID09PSAwIHx8ICFoYXNQb3N0RGF0YSB8fCBzZWxmLl9hYm9ydChwYXJhbXMpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2V0QWxsVXBsb2FkZWQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uIChrZXkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGtleSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJGaWxlSW5wdXQoKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYubG9jaygpO1xyXG4gICAgICAgICAgICAgICAgdmFyIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciAkdGh1bWIgPSAkKHRoaXMpLCAkYnRuVXBsb2FkID0gJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZSA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEkdGh1bWIuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1zdWNjZXNzJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0xvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRoLmFkZENzcygkdGh1bWIsICdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQuYXR0cignZGlzYWJsZWQnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5hdHRyKCdkaXNhYmxlZCcsIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHByZXVwbG9hZCcsIFtvdXREYXRhXSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5fYWJvcnQob3V0RGF0YSkpIHtcclxuICAgICAgICAgICAgICAgICAgICBqcVhIUi5hYm9ydCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgJHRodW1iID0gJCh0aGlzKSwgJGJ0blVwbG9hZCA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRidG5EZWxldGUgPSAkdGh1bWIuZmluZCgnLmt2LWZpbGUtcmVtb3ZlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkdGh1bWIuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1sb2FkaW5nJykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ05ldycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRidG5VcGxvYWQucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGJ0bkRlbGV0ZS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZuU3VjY2VzcyA9IGZ1bmN0aW9uIChkYXRhLCB0ZXh0U3RhdHVzLCBqcVhIUikge1xyXG4gICAgICAgICAgICAgICAgLyoqIEBuYW1lc3BhY2UgZGF0YS5lcnJvcmtleXMgKi9cclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUiwgZGF0YSksIGtleSA9IDAsXHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1icyA9IHNlbGYuX2dldFRodW1icygnOm5vdCguZmlsZS1wcmV2aWV3LXN1Y2Nlc3MpJyksXHJcbiAgICAgICAgICAgICAgICAgICAga2V5cyA9ICRoLmlzRW1wdHkoZGF0YSkgfHwgJGguaXNFbXB0eShkYXRhLmVycm9ya2V5cykgPyBbXSA6IGRhdGEuZXJyb3JrZXlzO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KGRhdGEpIHx8ICRoLmlzRW1wdHkoZGF0YS5lcnJvcikpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNodXBsb2Fkc3VjY2VzcycsIFtvdXREYXRhXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2V0QWxsVXBsb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWJzLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRUaHVtYlN0YXR1cygkdGh1bWIsICdTdWNjZXNzJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIuZmluZCgnLmt2LWZpbGUtdXBsb2FkJykuaGlkZSgpLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0VXBsb2FkU3VjY2VzcyhkYXRhKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJlc2V0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYnMuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgJHRodW1iID0gJCh0aGlzKSwgaSA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRodW1iLmZpbmQoJy5rdi1maWxlLXVwbG9hZCcpLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGh1bWIuZmluZCgnLmt2LWZpbGUtcmVtb3ZlJykucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrZXlzLmxlbmd0aCA9PT0gMCB8fCAkLmluQXJyYXkoa2V5LCBrZXlzKSAhPT0gLTEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpLCBzZWxmLmZpbGVzdGFja1tpXSwgc2VsZi5yZXRyeUVycm9yVXBsb2Fkcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJTdGF0dXMoJHRodW1iLCAnU3VjY2VzcycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudXBkYXRlU3RhY2soaSwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghJHRodW1iLmhhc0NsYXNzKCdmaWxlLXByZXZpZXctZXJyb3InKSB8fCBzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5Kys7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0VXBsb2FkU3VjY2VzcyhkYXRhKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd1VwbG9hZEVycm9yKGRhdGEuZXJyb3IsIG91dERhdGEsICdmaWxlYmF0Y2h1cGxvYWRlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSwgc2VsZi4kcHJvZ3Jlc3MsIHNlbGYubXNnVXBsb2FkRXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkNvbXBsZXRlID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi51bmxvY2soKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2luaXRTdWNjZXNzVGh1bWJzKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHVwbG9hZGNvbXBsZXRlJywgW3NlbGYuZmlsZXN0YWNrLCBzZWxmLl9nZXRFeHRyYURhdGEoKV0pO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmbkVycm9yID0gZnVuY3Rpb24gKGpxWEhSLCB0ZXh0U3RhdHVzLCBlcnJvclRocm93bikge1xyXG4gICAgICAgICAgICAgICAgdmFyIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKGpxWEhSKSwgb3AgPSBzZWxmLmFqYXhPcGVyYXRpb25zLnVwbG9hZEJhdGNoLFxyXG4gICAgICAgICAgICAgICAgICAgIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93VXBsb2FkRXJyb3IoZXJyTXNnLCBvdXREYXRhLCAnZmlsZWJhdGNodXBsb2FkZXJyb3InKTtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkRmlsZUNvdW50ID0gdG90YWwgLSAxO1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGtleSA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5maWxlc3RhY2tba2V5XSAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldFByZXZpZXdFcnJvcigkdGh1bWIpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCkucmVtb3ZlQ2xhc3MoJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9nZXRUaHVtYnMoJyAua3YtZmlsZS11cGxvYWQnKS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fZ2V0VGh1bWJzKCcgLmt2LWZpbGUtZGVsZXRlJykucmVtb3ZlQXR0cignZGlzYWJsZWQnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDEwMSwgc2VsZi4kcHJvZ3Jlc3MsIHNlbGYubXNnQWpheFByb2dyZXNzRXJyb3IucmVwbGFjZSgne29wZXJhdGlvbn0nLCBvcCkpO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uIChrZXksIGRhdGEpIHtcclxuICAgICAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShmaWxlc1trZXldKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuZm9ybWRhdGEuYXBwZW5kKHNlbGYudXBsb2FkRmlsZUF0dHIsIGRhdGEsIHNlbGYuZmlsZW5hbWVzW2tleV0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgc2VsZi5fYWpheFN1Ym1pdChmbkJlZm9yZSwgZm5TdWNjZXNzLCBmbkNvbXBsZXRlLCBmbkVycm9yKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF91cGxvYWRFeHRyYU9ubHk6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBwYXJhbXMgPSB7fSwgZm5CZWZvcmUsIGZuU3VjY2VzcywgZm5Db21wbGV0ZSwgZm5FcnJvcjtcclxuICAgICAgICAgICAgc2VsZi5mb3JtZGF0YSA9IG5ldyBGb3JtRGF0YSgpO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5fYWJvcnQocGFyYW1zKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZuQmVmb3JlID0gZnVuY3Rpb24gKGpxWEhSKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqcVhIUik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNocHJldXBsb2FkJywgW291dERhdGFdKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzKDUwKTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy5kYXRhID0gb3V0RGF0YTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy54aHIgPSBqcVhIUjtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydChwYXJhbXMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAganFYSFIuYWJvcnQoKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcm9ncmVzc0NhbmNlbGxlZCgpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBmblN1Y2Nlc3MgPSBmdW5jdGlvbiAoZGF0YSwgdGV4dFN0YXR1cywganFYSFIpIHtcclxuICAgICAgICAgICAgICAgIHZhciBvdXREYXRhID0gc2VsZi5fZ2V0T3V0RGF0YShqc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vbnMudXBsb2FkRXh0cmEsXHJcbiAgICAgICAgICAgICAgICAgICAgZXJyTXNnID0gc2VsZi5fcGFyc2VFcnJvcihvcCwganFYSFIsIGVycm9yVGhyb3duKTtcclxuICAgICAgICAgICAgICAgIHBhcmFtcy5kYXRhID0gb3V0RGF0YTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihlcnJNc2csIG91dERhdGEsICdmaWxlYmF0Y2h1cGxvYWRlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCBzZWxmLiRwcm9ncmVzcywgc2VsZi5tc2dBamF4UHJvZ3Jlc3NFcnJvci5yZXBsYWNlKCd7b3BlcmF0aW9ufScsIG9wKSk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNlbGYuX2FqYXhTdWJtaXQoZm5CZWZvcmUsIGZuU3VjY2VzcywgZm5Db21wbGV0ZSwgZm5FcnJvcik7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZGVsZXRlRmlsZUluZGV4OiBmdW5jdGlvbiAoJGZyYW1lKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgaW5kID0gJGZyYW1lLmF0dHIoJ2RhdGEtZmlsZWluZGV4JyksIHJldiA9IHNlbGYucmV2ZXJzZVByZXZpZXdPcmRlcjtcclxuICAgICAgICAgICAgaWYgKGluZC5zdWJzdHJpbmcoMCwgNSkgPT09ICdpbml0XycpIHtcclxuICAgICAgICAgICAgICAgIGluZCA9IHBhcnNlSW50KGluZC5yZXBsYWNlKCdpbml0XycsICcnKSk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluaXRpYWxQcmV2aWV3ID0gJGguc3BsaWNlQXJyYXkoc2VsZi5pbml0aWFsUHJldmlldywgaW5kLCByZXYpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsUHJldmlld0NvbmZpZyA9ICRoLnNwbGljZUFycmF5KHNlbGYuaW5pdGlhbFByZXZpZXdDb25maWcsIGluZCwgcmV2KTtcclxuICAgICAgICAgICAgICAgIHNlbGYuaW5pdGlhbFByZXZpZXdUaHVtYlRhZ3MgPSAkaC5zcGxpY2VBcnJheShzZWxmLmluaXRpYWxQcmV2aWV3VGh1bWJUYWdzLCBpbmQsIHJldik7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmdldEZyYW1lcygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciAkbkZyYW1lID0gJCh0aGlzKSwgbkluZCA9ICRuRnJhbWUuYXR0cignZGF0YS1maWxlaW5kZXgnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAobkluZC5zdWJzdHJpbmcoMCwgNSkgPT09ICdpbml0XycpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgbkluZCA9IHBhcnNlSW50KG5JbmQucmVwbGFjZSgnaW5pdF8nLCAnJykpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobkluZCA+IGluZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbkluZC0tO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJG5GcmFtZS5hdHRyKCdkYXRhLWZpbGVpbmRleCcsICdpbml0XycgKyBuSW5kKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYudXBsb2FkQXN5bmMpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNhY2hlSW5pdGlhbFByZXZpZXcgPSBzZWxmLmdldFByZXZpZXcoKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRGaWxlQWN0aW9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5faW5pdFpvb21CdXR0b24oKTtcclxuICAgICAgICAgICAgc2VsZi5nZXRGcmFtZXMoJyAua3YtZmlsZS1yZW1vdmUnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpLCAkZnJhbWUgPSAkZWwuY2xvc2VzdCgkaC5GUkFNRVMpLCBoYXNFcnJvciwgaWQgPSAkZnJhbWUuYXR0cignaWQnKSxcclxuICAgICAgICAgICAgICAgICAgICBpbmQgPSAkZnJhbWUuYXR0cignZGF0YS1maWxlaW5kZXgnKSwgbiwgY2FwLCBzdGF0dXM7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCRlbCwgJ2NsaWNrJywgZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IHNlbGYuX3JhaXNlKCdmaWxlcHJlcmVtb3ZlJywgW2lkLCBpbmRdKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzID09PSBmYWxzZSB8fCAhc2VsZi5fdmFsaWRhdGVNaW5Db3VudCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaGFzRXJyb3IgPSAkZnJhbWUuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1lcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgICRoLmNsZWFuTWVtb3J5KCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLmZhZGVPdXQoJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRoLmNsZWFuWm9vbUNhY2hlKCRwcmV2aWV3LmZpbmQoJyN6b29tLScgKyBpZCkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGluZCwgdW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fY2xlYXJPYmplY3RzKCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRmcmFtZS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlkICYmIGhhc0Vycm9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5maW5kKCdsaVtkYXRhLXRodW1iLWlkPVwiJyArIGlkICsgJ1wiXScpLmZhZGVPdXQoJ2Zhc3QnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuX2Vycm9yc0V4aXN0KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnMoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmlsZXN0YWNrID0gc2VsZi5nZXRGaWxlU3RhY2sodHJ1ZSksIGNoayA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gPSBmaWxlc3RhY2subGVuZ3RoLCBoYXNUaHVtYiA9IHNlbGYuc2hvd1ByZXZpZXcgJiYgc2VsZi5nZXRGcmFtZXMoKS5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPT09IDAgJiYgY2hrID09PSAwICYmICFoYXNUaHVtYikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5yZXNldCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGNoayArIGxlbjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhcCA9IG4gPiAxID8gc2VsZi5fZ2V0TXNnU2VsZWN0ZWQobikgOiAoZmlsZXN0YWNrWzBdID8gc2VsZi5fZ2V0RmlsZU5hbWVzKClbMF0gOiAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGNhcCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVyZW1vdmVkJywgW2lkLCBpbmRdKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgc2VsZi5nZXRGcmFtZXMoJyAua3YtZmlsZS11cGxvYWQnKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faGFuZGxlcigkZWwsICdjbGljaycsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgJGZyYW1lID0gJGVsLmNsb3Nlc3QoJGguRlJBTUVTKSwgaW5kID0gJGZyYW1lLmF0dHIoJ2RhdGEtZmlsZWluZGV4Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kcHJvZ3Jlc3MuaGlkZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICgkZnJhbWUuaGFzQ2xhc3MoJ2ZpbGUtcHJldmlldy1lcnJvcicpICYmICFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBsb2FkU2luZ2xlKGluZCwgZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRQcmV2aWV3QWN0aW9uczogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldywgZGVsZXRlRXh0cmFEYXRhID0gc2VsZi5kZWxldGVFeHRyYURhdGEgfHwge30sXHJcbiAgICAgICAgICAgICAgICBidG5SZW1vdmUgPSAkaC5GUkFNRVMgKyAnIC5rdi1maWxlLXJlbW92ZScsIHNldHRpbmdzID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3MsXHJcbiAgICAgICAgICAgICAgICBvcmlnQ2xhc3MgPSBzZXR0aW5ncy5yZW1vdmVDbGFzcywgZXJyQ2xhc3MgPSBzZXR0aW5ncy5yZW1vdmVFcnJvckNsYXNzLFxyXG4gICAgICAgICAgICAgICAgcmVzZXRQcm9ncmVzcyA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgaGFzRmlsZXMgPSBzZWxmLmlzQWpheFVwbG9hZCA/IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCkgOiBzZWxmLl9pbnB1dEZpbGVDb3VudCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghJHByZXZpZXcuZmluZCgkaC5GUkFNRVMpLmxlbmd0aCAmJiAhaGFzRmlsZXMpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2V0Q2FwdGlvbignJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucmVzZXQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5pbml0aWFsQ2FwdGlvbiA9ICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9uKCk7XHJcbiAgICAgICAgICAgICRwcmV2aWV3LmZpbmQoYnRuUmVtb3ZlKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZhciAkZWwgPSAkKHRoaXMpLCB2VXJsID0gJGVsLmRhdGEoJ3VybCcpIHx8IHNlbGYuZGVsZXRlVXJsLCB2S2V5ID0gJGVsLmRhdGEoJ2tleScpLFxyXG4gICAgICAgICAgICAgICAgICAgIGZuQmVmb3JlLCBmblN1Y2Nlc3MsIGZuRXJyb3I7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eSh2VXJsKSB8fCB2S2V5ID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB2YXIgJGZyYW1lID0gJGVsLmNsb3Nlc3QoJGguRlJBTUVTKSwgY2FjaGUgPSBzZWxmLnByZXZpZXdDYWNoZS5kYXRhLFxyXG4gICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLCBwYXJhbXMsIGluZGV4ID0gJGZyYW1lLmF0dHIoJ2RhdGEtZmlsZWluZGV4JyksIGNvbmZpZywgZXh0cmFEYXRhO1xyXG4gICAgICAgICAgICAgICAgaW5kZXggPSBwYXJzZUludChpbmRleC5yZXBsYWNlKCdpbml0XycsICcnKSk7XHJcbiAgICAgICAgICAgICAgICBjb25maWcgPSAkaC5pc0VtcHR5KGNhY2hlLmNvbmZpZykgJiYgJGguaXNFbXB0eShjYWNoZS5jb25maWdbaW5kZXhdKSA/IG51bGwgOiBjYWNoZS5jb25maWdbaW5kZXhdO1xyXG4gICAgICAgICAgICAgICAgZXh0cmFEYXRhID0gJGguaXNFbXB0eShjb25maWcpIHx8ICRoLmlzRW1wdHkoY29uZmlnLmV4dHJhKSA/IGRlbGV0ZUV4dHJhRGF0YSA6IGNvbmZpZy5leHRyYTtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZXh0cmFEYXRhID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZXh0cmFEYXRhID0gZXh0cmFEYXRhKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBwYXJhbXMgPSB7aWQ6ICRlbC5hdHRyKCdpZCcpLCBrZXk6IHZLZXksIGV4dHJhOiBleHRyYURhdGF9O1xyXG4gICAgICAgICAgICAgICAgZm5CZWZvcmUgPSBmdW5jdGlvbiAoanFYSFIpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVwcmVkZWxldGUnLCBbdktleSwganFYSFIsIGV4dHJhRGF0YV0pO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLl9hYm9ydCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGpxWEhSLmFib3J0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGVsLnJlbW92ZUNsYXNzKGVyckNsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguYWRkQ3NzKCRmcmFtZSwgJ2ZpbGUtdXBsb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRoLmFkZENzcygkZWwsICdkaXNhYmxlZCAnICsgb3JpZ0NsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgZm5TdWNjZXNzID0gZnVuY3Rpb24gKGRhdGEsIHRleHRTdGF0dXMsIGpxWEhSKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGNhcDtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoZGF0YSkgJiYgISRoLmlzRW1wdHkoZGF0YS5lcnJvcikpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmpxWEhSID0ganFYSFI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5yZXNwb25zZSA9IGRhdGE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dFcnJvcihkYXRhLmVycm9yLCBwYXJhbXMsICdmaWxlZGVsZXRlZXJyb3InKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGZyYW1lLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZWwucmVtb3ZlQ2xhc3MoJ2Rpc2FibGVkICcgKyBvcmlnQ2xhc3MpLmFkZENsYXNzKGVyckNsYXNzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXRQcm9ncmVzcygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRmcmFtZS5yZW1vdmVDbGFzcygnZmlsZS11cGxvYWRpbmcnKS5hZGRDbGFzcygnZmlsZS1kZWxldGVkJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLmZhZGVPdXQoJ3Nsb3cnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gcGFyc2VJbnQoKCRmcmFtZS5hdHRyKCdkYXRhLWZpbGVpbmRleCcpKS5yZXBsYWNlKCdpbml0XycsICcnKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLnVuc2V0KGluZGV4KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fZGVsZXRlRmlsZUluZGV4KCRmcmFtZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXAgPSBuID4gMCA/IHNlbGYuX2dldE1zZ1NlbGVjdGVkKG4pIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NldENhcHRpb24oY2FwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVkZWxldGVkJywgW3ZLZXksIGpxWEhSLCBleHRyYURhdGFdKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJGguY2xlYW5ab29tQ2FjaGUoJHByZXZpZXcuZmluZCgnI3pvb20tJyArICRmcmFtZS5hdHRyKCdpZCcpKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyT2JqZWN0cygkZnJhbWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkZnJhbWUucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc2V0UHJvZ3Jlc3MoKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBmbkVycm9yID0gZnVuY3Rpb24gKGpxWEhSLCB0ZXh0U3RhdHVzLCBlcnJvclRocm93bikge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBvcCA9IHNlbGYuYWpheE9wZXJhdGlvbnMuZGVsZXRlVGh1bWIsIGVyck1zZyA9IHNlbGYuX3BhcnNlRXJyb3Iob3AsIGpxWEhSLCBlcnJvclRocm93bik7XHJcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmpxWEhSID0ganFYSFI7XHJcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zLnJlc3BvbnNlID0ge307XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd0Vycm9yKGVyck1zZywgcGFyYW1zLCAnZmlsZWRlbGV0ZWVycm9yJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGZyYW1lLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICRlbC5yZW1vdmVDbGFzcygnZGlzYWJsZWQgJyArIG9yaWdDbGFzcykuYWRkQ2xhc3MoZXJyQ2xhc3MpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJlc2V0UHJvZ3Jlc3MoKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9pbml0QWpheFNldHRpbmdzKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnYmVmb3JlU2VuZCcsIGZuQmVmb3JlLCAnZGVsZXRlJyk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9tZXJnZUFqYXhDYWxsYmFjaygnc3VjY2VzcycsIGZuU3VjY2VzcywgJ2RlbGV0ZScpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fbWVyZ2VBamF4Q2FsbGJhY2soJ2Vycm9yJywgZm5FcnJvciwgJ2RlbGV0ZScpO1xyXG4gICAgICAgICAgICAgICAgc2V0dGluZ3MgPSAkLmV4dGVuZCh0cnVlLCB7fSwge1xyXG4gICAgICAgICAgICAgICAgICAgIHVybDogc2VsZi5fZW5jb2RlVVJJKHZVcmwpLFxyXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6ICdQT1NUJyxcclxuICAgICAgICAgICAgICAgICAgICBkYXRhVHlwZTogJ2pzb24nLFxyXG4gICAgICAgICAgICAgICAgICAgIGRhdGE6ICQuZXh0ZW5kKHRydWUsIHt9LCB7a2V5OiB2S2V5fSwgZXh0cmFEYXRhKVxyXG4gICAgICAgICAgICAgICAgfSwgc2VsZi5fYWpheERlbGV0ZVNldHRpbmdzKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2hhbmRsZXIoJGVsLCAnY2xpY2snLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLl92YWxpZGF0ZU1pbkNvdW50KCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFqYXhBYm9ydGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViZWZvcmVkZWxldGUnLCBbdktleSwgZXh0cmFEYXRhXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy9ub2luc3BlY3Rpb24gSlNVbnJlc29sdmVkVmFyaWFibGUsSlNIaW50XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlbGYuYWpheEFib3J0ZWQgaW5zdGFuY2VvZiBQcm9taXNlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuYWpheEFib3J0ZWQudGhlbihmdW5jdGlvbiAocmVzdWx0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQuYWpheChzZXR0aW5ncyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghc2VsZi5hamF4QWJvcnRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJC5hamF4KHNldHRpbmdzKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9oaWRlRmlsZUljb246IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3Nob3dGaWxlSWNvbjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjYXB0aW9uQ29udGFpbmVyLCAnaWNvbi12aXNpYmxlJyk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0U2l6ZTogZnVuY3Rpb24gKGJ5dGVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgc2l6ZSA9IHBhcnNlRmxvYXQoYnl0ZXMpLCBpLCBmdW5jID0gc2VsZi5maWxlU2l6ZUdldHRlciwgc2l6ZXMsIG91dDtcclxuICAgICAgICAgICAgaWYgKCEkLmlzTnVtZXJpYyhieXRlcykgfHwgISQuaXNOdW1lcmljKHNpemUpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBmdW5jID09PSAnZnVuY3Rpb24nKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSBmdW5jKHNpemUpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKHNpemUgPT09IDApIHtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSAnMC4wMCBCJztcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaSA9IE1hdGguZmxvb3IoTWF0aC5sb2coc2l6ZSkgLyBNYXRoLmxvZygxMDI0KSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2l6ZXMgPSBbJ0InLCAnS0InLCAnTUInLCAnR0InLCAnVEInLCAnUEInLCAnRUInLCAnWkInLCAnWUInXTtcclxuICAgICAgICAgICAgICAgICAgICBvdXQgPSAoc2l6ZSAvIE1hdGgucG93KDEwMjQsIGkpKS50b0ZpeGVkKDIpICogMSArICcgJyArIHNpemVzW2ldO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnc2l6ZScpLnJlcGxhY2UoJ3tzaXplVGV4dH0nLCBvdXQpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dldEZpbGVUeXBlOiBmdW5jdGlvbiAoZnR5cGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi5taW1lVHlwZUFsaWFzZXNbZnR5cGVdIHx8IGZ0eXBlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2dlbmVyYXRlUHJldmlld1RlbXBsYXRlOiBmdW5jdGlvbiAoXHJcbiAgICAgICAgICAgIGNhdCxcclxuICAgICAgICAgICAgZGF0YSxcclxuICAgICAgICAgICAgZm5hbWUsXHJcbiAgICAgICAgICAgIGZ0eXBlLFxyXG4gICAgIC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csXHJcbiAgICAgICAgICAgICAgICBmb3JjZVByZXZJY29uID0gaGFzSWNvblNldHRpbmcgJiYgc2VsZi5wcmVmZXJJY29uaWNQcmV2aWV3LFxyXG4gICAgICAgICAgICAgICAgZm9yY2Vab29tSWNvbiA9IGhhc0ljb25TZXR0aW5nICYmIHNlbGYucHJlZmVySWNvbmljWm9vbVByZXZpZXcsIGdldENvbnRlbnQ7XHJcbiAgICAgICAgICAgIGlmIChjb25maWcpIHtcclxuICAgICAgICAgICAgICAgICQuZWFjaChjb25maWcsIGZ1bmN0aW9uIChrZXksIHZhbCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHN0eWxlQXR0cmlicyArPSBrZXkgKyAnOicgKyB2YWwgKyAnOyc7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBnZXRDb250ZW50ID0gZnVuY3Rpb24gKGMsIGQsIHpvb20sIGZyYW1lQ3NzKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgaWQgPSB6b29tID8gJ3pvb20tJyArIHByZXZpZXdJZCA6IHByZXZpZXdJZCwgdG1wbHQgPSBzZWxmLl9nZXRQcmV2aWV3VGVtcGxhdGUoYyksXHJcbiAgICAgICAgICAgICAgICAgICAgY3NzID0gKGZyYW1lQ2xhc3MgfHwgJycpICsgJyAnICsgZnJhbWVDc3M7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5mcmFtZUNsYXNzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY3NzID0gc2VsZi5mcmFtZUNsYXNzICsgJyAnICsgY3NzO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHpvb20pIHtcclxuICAgICAgICAgICAgICAgICAgICBjc3MgPSBjc3MucmVwbGFjZSgnICcgKyAkaC5TT1JUX0NTUywgJycpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdG1wbHQgPSBzZWxmLl9wYXJzZUZpbGVQcmV2aWV3SWNvbih0bXBsdCwgZm5hbWUpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGMgPT09ICd0ZXh0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgIGQgPSAkaC5odG1sRW5jb2RlKGQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKGNhdCA9PT0gJ29iamVjdCcgJiYgIWZ0eXBlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJC5lYWNoKHNlbGYuZGVmYXVsdHMuZmlsZVR5cGVTZXR0aW5ncywgZnVuY3Rpb24gKGtleSwgZnVuYykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoa2V5ID09PSAnb2JqZWN0JyB8fCBrZXkgPT09ICdvdGhlcicpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZnVuYyhmbmFtZSwgZnR5cGUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlQ3NzID0gJ3R5cGUtJyArIGtleTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCEkaC5pc0VtcHR5KGF0dHJzKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhdHRycy50aXRsZSAhPT0gdW5kZWZpbmVkICYmIGF0dHJzLnRpdGxlICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gYXR0cnMudGl0bGU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhdHRycy5hbHQgIT09IHVuZGVmaW5lZCAmJiBhdHRycy5hbHQgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSBhdHRycy5hbHQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRtcGx0LnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAgICAgJ3ByZXZpZXdJZCc6IGlkLFxyXG4gICAgICAgICAgICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICAgICAndGl0bGUnOiB0aXRsZSxcclxuICAgICAgICAgICAgICAgICAgICAnYWx0JzogYWx0LFxyXG4gICAgICAgICAgICAgICAgICAgICdmcmFtZUNsYXNzJzogY3NzLFxyXG4gICAgICAgICAgICAgICAgICAgICd0eXBlJzogc2VsZi5fZ2V0RmlsZVR5cGUoZnR5cGUpLFxyXG4gICAgICAgICAgICAgICAgICAgICdmaWxlaW5kZXgnOiBpbmQsXHJcbiAgICAgICAgICAgICAgICAgICAgJ2ZpbGVpZCc6IHNlbGYuX2dldEZpbGVJZHMoKVtpbmRdIHx8ICcnLFxyXG4gICAgICAgICAgICAgICAgICAgICd0eXBlQ3NzJzogdHlwZUNzcyxcclxuICAgICAgICAgICAgICAgICAgICAnZm9vdGVyJzogZm9vdGVyLFxyXG4gICAgICAgICAgICAgICAgICAgICdkYXRhJzogZCxcclxuICAgICAgICAgICAgICAgICAgICAndGVtcGxhdGUnOiB0ZW1wbCB8fCBjYXQsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3N0eWxlJzogc3R5bGVBdHRyaWJzID8gJ3N0eWxlPVwiJyArIHN0eWxlQXR0cmlicyArICdcIicgOiAnJ1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGluZCA9IGluZCB8fCBwcmV2aWV3SWQuc2xpY2UocHJldmlld0lkLmxhc3RJbmRleE9mKCctJykgKyAxKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuZmlsZUFjdGlvblNldHRpbmdzLnNob3dab29tKSB7XHJcbiAgICAgICAgICAgICAgICB6b29tQ29udGVudCA9IGdldENvbnRlbnQoKGZvcmNlWm9vbUljb24gPyAnb3RoZXInIDogY2F0KSwgZGF0YSwgdHJ1ZSwgJ2t2LXpvb20tdGh1bWInKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB6b29tQ29udGVudCA9ICdcXG4nICsgc2VsZi5fZ2V0TGF5b3V0VGVtcGxhdGUoJ3pvb21DYWNoZScpLnJlcGxhY2UoJ3t6b29tQ29udGVudH0nLCB6b29tQ29udGVudCk7XHJcbiAgICAgICAgICAgIHByZXZDb250ZW50ID0gZ2V0Q29udGVudCgoZm9yY2VQcmV2SWNvbiA/ICdvdGhlcicgOiBjYXQpLCBkYXRhLCBmYWxzZSwgJ2t2LXByZXZpZXctdGh1bWInKTtcclxuICAgICAgICAgICAgcmV0dXJuIHByZXZDb250ZW50ICsgem9vbUNvbnRlbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfYWRkVG9QcmV2aWV3OiBmdW5jdGlvbiAoJHByZXZpZXcsIGNvbnRlbnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi5yZXZlcnNlUHJldmlld09yZGVyID8gJHByZXZpZXcucHJlcGVuZChjb250ZW50KSA6ICRwcmV2aWV3LmFwcGVuZChjb250ZW50KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9wcmV2aWV3RGVmYXVsdDogZnVuY3Rpb24gKGZpbGUsIHByZXZpZXdJZCwgaXNEaXNhYmxlZCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRwcmV2aWV3ID0gc2VsZi4kcHJldmlldztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgIC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NhcHRpb24nOiBjYXB0aW9uLCAnc2l6ZSc6IHNpemV9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldEluaXRUaHVtYkF0dHI6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBkYXRhID0gc2VsZi5wcmV2aWV3Q2FjaGUuZGF0YSwgbGVuID0gc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSwgY29uZmlnLFxyXG4gICAgICAgICAgICAgICAgY2FwdGlvbiwgc2l6ZSwgcHJldmlld0lkO1xyXG4gICAgICAgICAgICBpZiAobGVuID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gZGF0YS5jb25maWdbaV07XHJcbiAgICAgICAgICAgICAgICBwcmV2aWV3SWQgPSBzZWxmLnByZXZpZXdJbml0SWQgKyAnLScgKyAnaW5pdF8nICsgaTtcclxuICAgICAgICAgICAgICAgIGNhcHRpb24gPSAkaC5pZlNldCgnY2FwdGlvbicsIGNvbmZpZywgJGguaWZTZXQoJ2ZpbGVuYW1lJywgY29uZmlnKSk7XHJcbiAgICAgICAgICAgICAgICBzaXplID0gJGguaWZTZXQoJ3NpemUnLCBjb25maWcpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fc2V0VGh1bWJBdHRyKHByZXZpZXdJZCwgY2FwdGlvbiwgc2l6ZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zbHVnRGVmYXVsdDogZnVuY3Rpb24gKHRleHQpIHtcclxuICAgICAgICAgICAgLy8gbm9pbnNwZWN0aW9uIFJlZ0V4cFJlZHVuZGFudEVzY2FwZVxyXG4gICAgICAgICAgICByZXR1cm4gJGguaXNFb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ICAgc2VsZi4kY2FwdGlvbkNvbnRhaW5lci5yZW1vdmVDbGFzcygnaWNvbi12aXNpYmxlJyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93RmlsZUljb24oKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGxvZywgc2VsZi5pc0Vycm9yKTtcclxuICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLnJlbW92ZUNsYXNzKCdmaWxlLWlucHV0LW5ldyBmaWxlLWlucHV0LWFqYXgtbmV3Jyk7XHJcbiAgICAgICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID09PSAxKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXNlbGVjdCcsIFtudW1GaWxlcywgbGFiZWxdKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5wcmV2aWV3Q2FjaGUuY291bnQoKSkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9zZXRUaHVtYlN0YXR1czogZnVuY3Rpb24gKCR0aHVtYiwgc3RhdHVzKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGljb24gPSAnaW5kaWNhdG9yJyArIHN0YXR1cywgbXNnID0gaWNvbiArICdUaXRsZScsXHJcbiAgICAgICAgICAgICAgICBjc3MgPSAnZmlsZS1wcmV2aWV3LScgKyBzdGF0dXMudG9Mb3dlckNhc2UoKSxcclxuICAgICAgICAgICAgICAgICRpbmRpY2F0b3IgPSAkdGh1bWIuZmluZCgnLmZpbGUtdXBsb2FkLWluZGljYXRvcicpLFxyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3M7XHJcbiAgICAgICAgICAgICR0aHVtYi5yZW1vdmVDbGFzcygnZmlsZS1wcmV2aWV3LXN1Y2Nlc3MgZmlsZS1wcmV2aWV3LWVycm9yIGZpbGUtcHJldmlldy1sb2FkaW5nJyk7XHJcbiAgICAgICAgICAgIGlmIChzdGF0dXMgPT09ICdTdWNjZXNzJykge1xyXG4gICAgICAgICAgICAgICAgJHRodW1iLmZpbmQoJy5maWxlLWRyYWctaGFuZGxlJykucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGluZGljYXRvci5odG1sKGNvbmZpZ1tpY29uXSk7XHJcbiAgICAgICAgICAgICRpbmRpY2F0b3IuYXR0cigndGl0bGUnLCBjb25maWdbbXNnXSk7XHJcbiAgICAgICAgICAgICR0aHVtYi5hZGRDbGFzcyhjc3MpO1xyXG4gICAgICAgICAgICBpZiAoc3RhdHVzID09PSAnRXJyb3InICYmICFzZWxmLnJldHJ5RXJyb3JVcGxvYWRzKSB7XHJcbiAgICAgICAgICAgICAgICAkdGh1bWIuZmluZCgnLmt2LWZpbGUtdXBsb2FkJykuYXR0cignZGlzYWJsZWQnLCB0cnVlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldFByb2dyZXNzQ2FuY2VsbGVkOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMTAxLCBzZWxmLiRwcm9ncmVzcywgc2VsZi5tc2dDYW5jZWxsZWQpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldFByb2dyZXNzOiBmdW5jdGlvbiAocCwgJGVsLCBlcnJvcikge1xyXG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Z3Jlc3NiYXJcIl0nKS5odG1sKGVycm9yKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldEZpbGVEcm9wWm9uZVRpdGxlOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJHpvbmUgPSBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGUtZHJvcC16b25lJyksIHRpdGxlID0gc2VsZi5kcm9wWm9uZVRpdGxlLCBzdHJGaWxlcztcclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNDbGlja2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHN0ckZpbGVzID0gJGguaXNFbXB0eShzZWxmLiRlbGVtZW50LmF0dHIoJ211bHRpcGxlJykpID8gc2VsZi5maWxlU2luZ2xlIDogc2VsZi5maWxlUGx1cmFsO1xyXG4gICAgICAgICAgICAgICAgdGl0bGUgKz0gc2VsZi5kcm9wWm9uZUNsaWNrVGl0bGUucmVwbGFjZSgne2ZpbGVzfScsIHN0ckZpbGVzKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkem9uZS5maW5kKCcuJyArIHNlbGYuZHJvcFpvbmVUaXRsZUNsYXNzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3IHx8ICR6b25lLmxlbmd0aCA9PT0gMCB8fCBzZWxmLmdldEZpbGVTdGFjaygpLmxlbmd0aCA+IDAgfHwgIXNlbGYuZHJvcFpvbmVFbmFibGVkIHx8XHJcbiAgICAgICAgICAgICAgICAoIXNlbGYuaXNBamF4VXBsb2FkICYmIHNlbGYuJGVsZW1lbnQuZmlsZXMpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCR6b25lLmZpbmQoJGguRlJBTUVTKS5sZW5ndGggPT09IDAgJiYgJ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2FkID8gc2VsZi5nZXRGaWxlU3RhY2soKS5sZW5ndGggOiBzZWxmLl9pbnB1dEZpbGVDb3VudCgpO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi52YWxpZGF0ZUluaXRpYWxDb3VudCAmJiBzZWxmLm1pbkZpbGVDb3VudCA+IDAgJiYgc2VsZi5fZ2V0RmlsZUNvdW50KGxlbiAtIDEpIDwgc2VsZi5taW5GaWxlQ291bnQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX25vRmlsZXNFcnJvcih7fSk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZ2V0RmlsZUNvdW50OiBmdW5jdGlvbiAoZmlsZUNvdW50KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgYWRkQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi52YWxpZGF0ZUluaXRpYWxDb3VudCAmJiAhc2VsZi5vdmVyd3JpdGVJbml0aWFsKSB7XHJcbiAgICAgICAgICAgICAgICBhZGRDb3VudCA9IHNlbGYucHJldmlld0NhY2hlLmNvdW50KCk7XHJcbiAgICAgICAgICAgICAgICBmaWxlQ291bnQgKz0gYWRkQ291bnQ7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZpbGVDb3VudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRGaWxlSWQ6IGZ1bmN0aW9uIChmaWxlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY3VzdG9tID0gc2VsZi5nZW5lcmF0ZUZpbGVJZCwgcmVsYXRpdmVQYXRoO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIGN1c3RvbSA9PT0gJ2Z1bmN0aW9uJykge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIGN1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MuZmlsdGVyKGZ1bmN0aW9uIChuKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gKHNraXBOdWxsID8gbiAhPT0gdW5kZWZpbmVkIDogbiAhPT0gdW5kZWZpbmVkICYmIG4gIT09IG51bGwpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRGaWxlTmFtZXM6IGZ1bmN0aW9uIChza2lwTnVsbCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLmZpbGVuYW1lcy5maWx0ZXIoZnVuY3Rpb24gKG4pIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiAoc2tpcE51bGwgPyBuICE9PSB1bmRlZmluZWQgOiBuICE9PSB1bmRlZmluZWQgJiYgbiAhPT0gbnVsbCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldFByZXZpZXdFcnJvcjogZnVuY3Rpb24gKCR0aHVtYiwgaSwgdmFsLCByZXBlYXQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoaSAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnVwZGF0ZVN0YWNrKGksIHZhbCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dQcmV2aWV3KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYucmVtb3ZlRnJvbVByZXZpZXdPbkVycm9yICYmICFyZXBlYXQpIHtcclxuICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3NldFRodW1iU3RhdHVzKCR0aHVtYiwgJ0Vycm9yJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmVmcmVzaFVwbG9hZEJ1dHRvbigkdGh1bWIsIHJlcGVhdCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaFVwbG9hZEJ1dHRvbjogZnVuY3Rpb24gKCR0aHVtYiwgcmVwZWF0KSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGJ0biA9ICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKSwgY2ZnID0gc2VsZi5maWxlQWN0aW9uU2V0dGluZ3MsXHJcbiAgICAgICAgICAgICAgICBpY29uID0gY2ZnLnVwbG9hZEljb24sIHRpdGxlID0gY2ZnLnVwbG9hZFRpdGxlO1xyXG4gICAgICAgICAgICBpZiAoISRidG4ubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHJlcGVhdCkge1xyXG4gICAgICAgICAgICAgICAgaWNvbiA9IGNmZy51cGxvYWRSZXRyeUljb247XHJcbiAgICAgICAgICAgICAgICB0aXRsZSA9IGNmZy51cGxvYWRSZXRyeVRpdGxlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICRidG4uYXR0cigndGl0bGUnLCB0aXRsZSkuaHRtbChpY29uKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9jaGVja0RpbWVuc2lvbnM6IGZ1bmN0aW9uIChpLCBjaGssICRpbWcsICR0aHVtYiwgZm5hbWUsIHR5cGUsIHBhcmFtcykge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIG1zZywgZGltLCB0YWcgPSBjaGsgPT09ICdTbWFsbCcgPyAnbWluJyA6ICdtYXgnLCBsaW1pdCA9IHNlbGZbdGFnICsgJ0ltYWdlJyArIHR5cGVdLFxyXG4gICAgICAgICAgICAgICAgJGltZ0VsLCBpc1ZhbGlkO1xyXG4gICAgICAgICAgICBpZiAoJGguaXNFbXB0eShsaW1pdCkgfHwgISRpbWcubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGltZ0VsID0gJGltZ1swXTtcclxuICAgICAgICAgICAgZGltID0gKHR5cGUgPT09ICdXaWR0aCcpID8gJGltZ0VsLm5hdHVyYWxXaWR0aCB8fCAkaW1nRWwud2lkdGggOiAkaW1nRWwubmF0dXJhbEhlaWdodCB8fCAkaW1nRWwuaGVpZ2h0O1xyXG4gICAgICAgICAgICBpc1ZhbGlkID0gY2hrID09PSAnU21hbGwnID8gZGltID49IGxpbWl0IDogZGltIDw9IGxpbWl0O1xyXG4gICAgICAgICAgICBpZiAoaXNWYWxpZCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG1zZyA9IHNlbGZbJ21zZ0ltYWdlJyArIHR5cGUgKyBjaGtdLnNldFRva2Vucyh7J25hbWUnOiBmbmFtZSwgJ3NpemUnOiBsaW1pdH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9zaG93VXBsb2FkRXJyb3IobXNnLCBwYXJhbXMpO1xyXG4gICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpLCBudWxsKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9nZXRFeGlmT2JqOiBmdW5jdGlvbiAoZGF0YSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGV4aWZPYmogPSBudWxsO1xyXG4gICAgICAgICAgICBpZiAoZGF0YS5zbGljZSgwLCAyMykgIT09ICdkYXRhOmltYWdlL2pwZWc7YmFzZTY0LCcgJiYgZGF0YS5zbGljZSgwLCAyMikgIT09ICdkYXRhOmltYWdlL2pwZztiYXNlNjQsJykge1xyXG4gICAgICAgICAgICAgICAgZXhpZk9iaiA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIGV4aWZPYmogPSB3aW5kb3cucGlleGlmID8gd2luZG93LnBpZXhpZi5sb2FkKGRhdGEpIDogbnVsbDtcclxuXHJcbiAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xyXG4gICAgICAgICAgICAgICAgZXhpZk9iaiA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9sb2coZXJyKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoIWV4aWZPYmopIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2xvZyhcclxuICAgICAgICAgICAgICAgICAgICAnVGhlIHBpZXhpZi5qcyBsaWJyYXJ5IHdhcyBub3QgZGV0ZWN0ZWQuIEVpdGhlciBsb2FkIHBpZXhpZi5qcyBvbiB5b3VyIHBhZ2UgT1Igc2V0IGBhdXRvT3JpZW50SW1hZ2VgIHRvIGBmYWxzZWAuJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGV4aWZPYmo7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfdmFsaWRhdGVJbWFnZU9yaWVudGF0aW9uOiBmdW5jdGlvbiAoJGltZywgZmlsZSwgcHJldmlld0lkLCBjYXB0aW9uLCBmdHlwZSwgZnNpemUsIGlEYXRhKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgZXhpZk9iaiwgdmFsdWUsIGF1dG9PcmllbnRJbWFnZSA9IHNlbGYuYXV0b09yaWVudEltYWdlO1xyXG4gICAgICAgICAgICBpZiAodHlwZW9mIGF1dG9PcmllbnRJbWFnZSA9PT0gJ2Z1bmN0aW9uJykge1xyXG4gICAgICAgICAgICAgICAgYXV0b09yaWVudEltYWdlID0gYXV0b09yaW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AkcHJldmlldy5maW5kKCcjJyArIHByZXZpZXdJZCksXHJcbiAgICAgICAgICAgICAgICBpID0gJHRodW1iLmF0dHIoJ2RhdGEtZmlsZWluZGV4JyksICRpbWcgPSAkdGh1bWIuZmluZCgnaW1nJyk7XHJcbiAgICAgICAgICAgIGZuYW1lID0gZm5hbWUgfHwgJ1VudGl0bGVkJztcclxuICAgICAgICAgICAgJGltZy5vbmUoJ2xvYWQnLCBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB3MSA9ICR0aHVtYi53aWR0aCgpO1xyXG4gICAgICAgICAgICAgICAgdzIgPSAkcHJldmlldy53aWR0aCgpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHcxID4gdzIpIHtcclxuICAgICAgICAgICAgICAgICAgICAkaW1nLmNzcygnd2lkdGgnLCAnMTAwJScpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgcGFyYW1zID0ge2luZDogaSwgaWQ6IHByZXZpZXdJZH07XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9jaGVja0RpbWVuc2lvbnMoaSwgJ1NtYWxsJywgJGltZywgJHRodW1iLCBmbmFtZSwgJ1dpZHRoJywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnU21hbGwnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnSGVpZ2h0JywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIGlmICghc2VsZi5yZXNpemVJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnTGFyZ2UnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnV2lkdGgnLCBwYXJhbXMpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2NoZWNrRGltZW5zaW9ucyhpLCAnTGFyZ2UnLCAkaW1nLCAkdGh1bWIsIGZuYW1lLCAnSGVpZ2h0JywgcGFyYW1zKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2Vsb2FkZWQnLCBbcHJldmlld0lkXSk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmxvYWRlZEltYWdlcy5wdXNoKHtcclxuICAgICAgICAgICAgICAgICAgICBpbmQ6IGksXHJcbiAgICAgICAgICAgICAgICAgICAgaW1nOiAkaW1nLFxyXG4gICAgICAgICAgICAgICAgICAgIHRodW1iOiAkdGh1bWIsXHJcbiAgICAgICAgICAgICAgICAgICAgcGlkOiBwcmV2aWV3SWQsXHJcbiAgICAgICAgICAgICAgICAgICAgdHlwOiBmdHlwZSxcclxuICAgICAgICAgICAgICAgICAgICBzaXo6IGZzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlZDogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICAgICAgaW1nRGF0YTogaURhdGEsXHJcbiAgICAgICAgICAgICAgICAgICAgZXhpZk9iajogZXhpZk9ialxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAkdGh1bWIuZGF0YSgnZXhpZicsIGV4aWZPYmopO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVBbGxJbWFnZXMoKTtcclxuICAgICAgICAgICAgfSkub25lKCdlcnJvcicsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2Vsb2FkZXJyb3InLCBbcHJldmlld0lkXSk7XHJcbiAgICAgICAgICAgIH0pLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuY29tcGxldGUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkKHRoaXMpLnRyaWdnZXIoJ2xvYWQnKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuZXJyb3IpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS50cmlnZ2VyKCdlcnJvcicpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfdmFsaWRhdGVBbGxJbWFnZXM6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpLCBjb3VudGVyID0ge3ZhbDogMH0sIG51bUltZ3MgPSBzZWxmLmxvYWRlZEltYWdlcy5sZW5ndGgsIGNvbmZpZyxcclxuICAgICAgICAgICAgICAgIGZzaXplLCBtaW5TaXplID0gc2VsZi5yZXNpemVJZlNpemVNb3JlVGhhbjtcclxuICAgICAgICAgICAgaWYgKG51bUltZ3MgIT09IHNlbGYudG90YWxJbWFnZXNDb3VudCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VzbG9hZGVkJyk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5yZXNpemVJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzZWxmLmxvYWRlZEltYWdlcy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICAgICAgY29uZmlnID0gc2VsZi5sb2FkZWRJbWFnZXNbaV07XHJcbiAgICAgICAgICAgICAgICBpZiAoY29uZmlnLnZhbGlkYXRlZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgZnNpemUgPSBjb25maWcuc2l6O1xyXG4gICAgICAgICAgICAgICAgaWYgKGZzaXpl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ICAgIHRocm93RXJyb3IgPSBmdW5jdGlvbiAobXNnLCBwYXJhbXMsIGV2KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9zaG93VXBsb2FkRXJyb3IobXNnLCBwYXJhbXMsIGV2KTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fc2hvd0Vycm9yKG1zZywgcGFyYW1zLCBldik7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zZXRQcmV2aWV3RXJyb3IoJHRodW1iLCBpbmQpO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuZmlsZXN0YWNrW2luZF0gfHwgIWlzVmFsaWRJbWFnZSB8fCAod2lkdGggPD0gbWF4V2lkdGggJiYgaGVpZ2h0IDw9IG1heEhlaWdodCkpIHtcclxuICAgICAgICAgICAgICAgIGlmIChpc1ZhbGlkSW1hZ2UgJiYgc2VsZi5maWxlc3RhY2tbaW5kXSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VyZXNpemVkJywgW3BpZCwgaW5kXSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBjb3VudGVyLnZhbCsrO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvdW50ZXIudmFsID09PSBudW1JbWdzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVpbWFnZXNyZXNpemVkJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoIWlzVmFsaWRJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRocm93RXJyb3Ioc2VsZi5tc2dJbWFnZVJlc2l6ZUVycm9yLCB7aWQ6IHBpZCwgJ2luZGV4JzogaW5kfSwgJ2ZpbGVpbWFnZXJlc2l6ZWVycm9yJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHR5cGUgPSB0eXBlIHx8IHNlbGYucmVzaXplRGVmYXVsdEltYWdlVHlwZTtcclxuICAgICAgICAgICAgY2hrV2lkdGggPSB3aWR0aCA+IG1heFdpZHRoO1xyXG4gICAgICAgICAgICBjaGtIZWlnaHQgPSBoZWlnaHQgPiBtYXhIZWlnaHQ7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnJlc2l6ZVByZWZlcmVuY2UgPT09ICd3aWR0aCcpIHtcclxuICAgICAgICAgICAgICAgIHJhdGlvID0gY2hrV2lkdGggPyBtYXhXaWR0aCAvIHdpZHRoIDogKGNoa0hlaWdodCA/IG1heEhlaWdodCAvIGhlaWdodCA6IDEpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgcmF0aW8gPSBjaGtIZWlnaHQgPyBtYXhIZWlnaHQgLyBoZWlnaHQgOiAoY2hrV2lkdGggPyBtYXhXaWR0aCAvIHdpZHRoIDogMSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRDYW52YXMoKTtcclxuICAgICAgICAgICAgd2lkdGggKj0gcmF0aW87XHJcbiAgICAgICAgICAgIGhlaWdodCAqPSByYXRpbztcclxuICAgICAgICAgICAgY2FudmFzLndpZHRoID0gd2lkdGg7XHJcbiAgICAgICAgICAgIGNhbnZhcy5oZWlnaHQgPSBoZWlnaHQ7XHJcbiAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICBjb250ZXh0LmRyYXdJbWFnZShpbWcsIDAsIDAsIHdpZHRoLCBoZWlnaHQpO1xyXG4gICAgICAgICAgICAgICAgZGF0YVVSSSA9IGNhbnZhcy50b0RhdGFVUkwodHlwZSwgc2VsZi5yZXNpemVRdWFsaXR5KTtcclxuICAgICAgICAgICAgICAgIGlmIChleGlmT2JqKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZXhpZlN0ciA9IHdpbmRvdy5waWV4aWYuZHVtcChleGlmT2JqKTtcclxuICAgICAgICAgICAgICAgICAgICBkYXRhVVJJID0gd2luZG93LnBpZXhpZi5pbnNlcnQoZXhpZlN0ciwgZGF0YVVSSSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBibG9iID0gJGguZGF0YVVSSTJCbG9iKGRhdGFVUkkpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5maWxlc3RhY2tbaW5kXSA9IGJsb2I7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWltYWdlcmVzaXplZCcsIFtwaWQsIGluZF0pO1xyXG4gICAgICAgICAgICAgICAgY291bnRlci52YWwrKztcclxuICAgICAgICAgICAgICAgIGlmIChjb3VudGVyLnZhbCA9PT0gbnVtSW1ncykge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlaW1hZ2VzcmVzaXplZCcsIFt1bmRlZmluZWQsIHVuZGVmaW5lZF0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCEoYmxvYiBpbnN0YW5jZW9mIEJsb2IpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihzZWxmLm1zZ0ltYWdlUmVzaXplRXJyb3IsIHtpZDogcGlkLCAnaW5kZXgnOiBpbmR9LCAnZmlsZWltYWdlcmVzaXplZXJyb3InKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBjYXRjaCAoZXJyKSB7XHJcbiAgICAgICAgICAgICAgICBjb3VudGVyLnZhbCsrO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvdW50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ja2FibGUpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAkem9uZSA9IHNlbGYuJGRyb3Bab25lO1xyXG4gICAgICAgICAgICBpZiAoIXNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAkdG1wWm9uZSA9IHNlbGYuJHByZXZpZXcuZmluZCgnLmZpbGUtZGVmYXVsdC1wcmV2aWV3Jyk7XHJcbiAgICAgICAgICAgICAgICBpZiAoJHRtcFpvbmUubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJHpvbmUgPSAkdG1wWm9uZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgJGguYWRkQ3NzKCR6b25lLCAnY2xpY2thYmxlJyk7XHJcbiAgICAgICAgICAgICR6b25lLmF0dHIoJ3RhYmluZGV4JywgLTEpO1xyXG4gICAgICAgICAgICBzZWxmLl9oYW5kbGVyKCR6b25lLCAnY2xpY2snLCBmdW5jdGlvbiAoZSkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0YXIgPSAkKGUudGFyZ2V0KTtcclxuICAgICAgICAgICAgICAgIGlmICghJChzZWxmLmVsRXJyb3JDb250YWluZXIgKyAnOnZpc2libGUnKS5sZW5ndGggJiZcclxuICAgICAgICAgICAgICAgICAgICAoISR0YXIucGFyZW50cygnLmZpbGUtcHJldmlldy10aHVtYm5haWxzJykubGVuZ3RoIHx8ICR0YXIucGFyZW50cyhcclxuICAgICAgICAgICAgICAgICAgICAgICAgJy5maWxlLWRlZmF1bHQtcHJldmlldycpLmxlbmd0aCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRlbGVtZW50LmRhdGEoJ3pvbmVDbGlja2VkJywgdHJ1ZSkudHJpZ2dlcignY2xpY2snKTtcclxuICAgICAgICAgICAgICAgICAgICAkem9uZS5ibHVyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2luaXRDYXB0aW9uOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgY2FwID0gc2VsZi5pbml0aWFsQ2FwdGlvbiB8fCAnJztcclxuICAgICAgICAgICAgaWYgKHNlbGYub3ZlcndyaXRlSW5pdGlhbCB8fCAkaC5pc0VtcHR5KGNhcCkpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGNhcHRpb24udmFsKCcnKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKGNhcCk7XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX3NldENhcHRpb246IGZ1bmN0aW9uIChjb250ZW50LCBpc0Vycm9yKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdGl0bGUsIG91dCwgaWNvbiwgbiwgY2FwLCBzdGFjayA9IHNlbGYuZ2V0RmlsZVN0YWNrKCk7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi4kY2FwdGlvbi5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgaWYgKGlzRXJyb3IpIHtcclxuICAgICAgICAgICAgICAgIHRpdGxlID0gJCgnPGRpdj4nICsgc2VsZi5tc2dWYWxpZGF0aW9uRXJyb3IgKyAnPC9kaXY+JykudGV4dCgpO1xyXG4gICAgICAgICAgICAgICAgbiA9IHN0YWNrLmxlbmd0aDtcclxuICAgICAgICAgICAgICAgIGlmIChuKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY2FwID0gbiA9PT0gMSAmJiBzdGFja1swXSA/IHNlbGYuX2dldEZpbGVOYW1lcygpWzBdIDogc2VsZi5fZ2V0TXNnU2VsZWN0ZWQobik7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGNhcCA9IHNlbGYuX2dldE1zZ1NlbGVjdGVkKHNlbGYubXNnTm8pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgb3V0ID0gJGguaXNFbXB0eShjb250ZW50KSA/IGNhcCA6IGNvbnRlbnQ7XHJcbiAgICAgICAgICAgICAgICBpY29uID0gJzxzcGFuIGNsYXNzPVwiJyArIHNlbGYubXNnVmFsaWRhdGlvbkVycm9yQ2xhc3MgKyAnXCI+JyArIHNlbGYubXNnVmFsaWRhdGlvbkVycm9ySWNvbiArICc8L3NwYW4+JztcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KGNvbnRlbnQpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdGl0bGUgPSAkKCc8ZGl2PicgKyBjb250ZW50ICsgJzwvZGl2PicpLnRleHQoKTtcclxuICAgICAgICAgICAgICAgIG91dCA9IHRpdGxlO1xyXG4gICAgICAgICAgICAgICAgaWNvbiA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdmaWxlSWNvbicpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuJGNhcHRpb25Db250YWluZXIuYWRkQ2xhc3MoJ2ljb24tdmlzaWJsZScpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uLmF0dHIoJ3RpdGxlJywgdGl0bGUpLnZhbChvdXQpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uSWNvbi5odG1sKGljb24pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NyZWF0ZUNvbnRhaW5lcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIGF0dHJpYnMgPSB7J2NsYXNzJzogJ2ZpbGUtaW5wdXQgZmlsZS1pbnB1dC1uZXcnICsgKHNlbGYucnRsID8gJyBrdi1ydGwnIDogJycpfSxcclxuICAgICAgICAgICAgICAgICRjb250YWluZXIgPSAkKGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpKS5hdHRyKGF0dHJpYnMpLmh0bWwoc2VsZi5fcmVuZGVyTWFpbigpKTtcclxuICAgICAgICAgICAgJGNvbnRhaW5lci5pbnNlcnRCZWZvcmUoc2VsZi4kZWxlbWVudCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRCcm93c2UoJGNvbnRhaW5lcik7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnRoZW1lKSB7XHJcbiAgICAgICAgICAgICAgICAkY29udGFpbmVyLmFkZENsYXNzKCd0aGVtZS0nICsgc2VsZi50aGVtZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuICRjb250YWluZXI7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVmcmVzaENvbnRhaW5lcjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsICRjb250YWluZXIgPSBzZWxmLiRjb250YWluZXIsICRlbCA9IHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgICAgICRlbC5pbnNlcnRBZnRlcigkY29udGFpbmVyKTtcclxuICAgICAgICAgICAgJGNvbnRhaW5lci5odG1sKHNlbGYuX3JlbmRlck1haW4oKSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRCcm93c2UoJGNvbnRhaW5lcik7XHJcbiAgICAgICAgICAgIHNlbGYuX3ZhbGlkYXRlRGlzYWJsZWQoKTtc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lLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAnY2xhc3MnOiBzZWxmLm1haW5DbGFzcyArICghc2VsZi5zaG93QnJvd3NlICYmIHNlbGYuc2hvd0NhcHRpb24gPyAnIG5vLWJyb3dzZScgOiAnJyksXHJcbiAgICAgICAgICAgICAgICAncHJldmlldyc6IHByZXZpZXcsXHJcbiAgICAgICAgICAgICAgICAnY2xvc2UnOiBjbG9zZSxcclxuICAgICAgICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICd1cGxvYWQnOiBzZWxmLl9yZW5kZXJCdXR0b24oJ3VwbG9hZCcpLFxyXG4gICAgICAgICAgICAgICAgJ3JlbW92ZSc6IHNlbGYuX3JlbmRlckJ1dHRvbigncmVtb3ZlJyksXHJcbiAgICAgICAgICAgICAgICAnY2FuY2VsJzogc2VsZi5fcmVuZGVyQnV0dG9uKCdjYW5jZWwnKSxcclxuICAgICAgICAgICAgICAgICdicm93c2UnOiBzZWxmLl9yZW5kZXJCdXR0b24oJ2Jyb3dzZScpXHJcbiAgICAgICAgICAgIH0pO1xyXG5cclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZW5kZXJCdXR0b246IGZ1bmN0aW9uICh0eXBlKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgdG1wbHQgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYnRuRGVmYXVsdCcpLCBjc3MgPSBzZWxmW3R5cGUgKyAnQ2xhc3MnXSxcclxuICAgICAgICAgICAgICAgIHRpdGxlID0gc2VsZlt0eXBlICsgJ1RpdGxlJ10sIGljb24gPSBzZWxmW3R5cGUgKyAnSWNvbiddLCBsYWJlbCA9IHNlbGZbdHlwZSArICdMYWJlbCddLFxyXG4gICAgICAgICAgICAgICAgc3RhdHVzID0gc2VsZi5pc0Rpc2FibGVkID8gJyBkaXNhYmxlZCcgOiAnJywgYnRuVHlwZSA9ICdidXR0b24nO1xyXG4gICAgICAgICAgICBzd2l0Y2ggKHR5cGUpIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgJ3JlbW92ZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dSZW1vdmUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2NhbmNlbCc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dDYW5jZWwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBjc3MgKz0gJyBrdi1oaWRkZW4nO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAndXBsb2FkJzpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIXNlbGYuc2hvd1VwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCAmJiAhc2VsZi5pc0Rpc2FibGVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRtcGx0ID0gc2VsZi5fZ2V0TGF5b3V0VGVtcGxhdGUoJ2J0bkxpbmsnKS5yZXBsYWNlKCd7aHJlZn0nLCBzZWxmLnVwbG9hZFVybCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYnRuVHlwZSA9ICdzdWJtaXQnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgJ2Jyb3dzZSc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWxmLnNob3dCcm93c2UpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB0bXBsdCA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdidG5Ccm93c2UnKTtcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBjc3MgKz0gdHlwZSA9PT0gJ2Jyb3dzZScgPyAnIGJ0bi1maWxlJyA6ICcgZmlsZWlucHV0LScgKyB0eXBlICsgJyBmaWxlaW5wdXQtJyArIHR5cGUgKyAnLWJ1dHRvbic7XHJcbiAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShsYWJlbCkpIHtcclxuICAgICAgICAgICAgICAgIGxhYmVsID0gJyA8c3BhbiBjbGFzcz1cIicgKyBzZWxmLmJ1dHRvbkxhYmVsQ2xhc3MgKyAnXCI+JyArIGxhYmVsICsgJzwvc3Bhbj4nO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiB0bXBsdC5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgJ3R5cGUnOiBidG5UeXBlLCAnY3NzJzogY3NzLCAndGl0bGUnOiB0aXRsZSwgJ3N0YXR1cyc6IHN0YXR1cywgJ2ljb24nOiBpY29uLCAnbGFiZWwnOiBsYWJlbFxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9yZW5kZXJUaHVtYlByb2dyZXNzOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgcmV0dX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1xyXG4gICAgICAgICAgICBzaXplID0gc2VsZi5fZ2V0U2l6ZShzaXplKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICBvdXQgPSB0ZW1wbGF0ZS5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICdhY3Rpb25zJzogc2VsZi5fcmVuZGVyRmlsZUFjdGlvbnModXBsLCBmYWxzZSwgcmVtLCB6b29tLCBkcmcsIGZhbHNlLCBmYWxzZSwgZmFsc2UpLFxyXG4gICAgICAgICAgICAgICAgICAgICdjYXB0aW9uJzogY2FwdGlvbixcclxuICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3dpZHRoJzogd2lkdGgsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3Byb2dyZXNzJzogc2VsZi5fcmVuZGVyVGh1bWJQcm9ncmVzcygpLFxyXG4gICAgICAgICAgICAgICAgICAgICdpbmRpY2F0b3InOiBpbmRpY2F0b3JcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgb3V0ID0gdGVtcGxhdGUuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnYWN0aW9ucyc6IHNlbGYuX3JlbmRlckZpbGVBY3Rpb25zKGZhbHNlLCBmYWxzZSwgZmFsc2UsIHpvb20sIGRyZywgZmFsc2UsIGZhbHNlLCBmYWxzZSksXHJcbiAgICAgICAgICAgICAgICAgICAgJ2NhcHRpb24nOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICdzaXplJzogc2l6ZSxcclxuICAgICAgICAgICAgICAgICAgICAnd2lkdGgnOiB3aWR0aCxcclxuICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnOiAnJyxcclxuICAgICAgICAgICAgICAgICAgICAnaW5kaWNhdG9yJzogaW5kaWNhdG9yXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvdXQgPSAkaC5yZXBsYWNlVGFncyhvdXQsIHNlbGYucHJldmlld1RodW1iVGFncyk7XHJcbiAgICAgICAgICAgIHJldHVybiBvdXQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVuZGVyRmlsZUFjdGlvbnM6IGZ1bmN0aW9uIChcclxuICAgICAgICAgICAgc2hvd1VwbCxcclxuICAgICAgICAgICAgc2hvd0R3bixcclxuICAgICAgICAgICAgc2hvd0RlbCxcclxuICAgICAgICAgICAgc2hvd1pvb20sXHJcbiAgICAgICAgICAgIHNob3dEcmFnLFxyXG4gICAgICAgICAgICBkaXNhYmxlZCxcclxuICAgICAgICAgICAgdXJsLFxyXG4gICAgICAgICAgICBrZXksXHJcbiAgICAgICAgICAgIGlzSW5pdCxcclxuICAgICAgICAgICAgZFVybCxcclxuICAgICAgICAgICAgZEZpbGVcclxuICAgICAgICApIHtcclxuICAgICAgICAgICAgaWYgKCFzaG93VXBsICYmICFzaG93RHduICYmICFzaG93RGVsICYmICFzaG93Wm9vbSAmJiAhc2hvd0RyYWcpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiAnJztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHZVcmwgPSB1cmwgPT09IGZhbHNlID8gJycgOiAnIGRhdGEtdXJsPVwiJyArIHVybCArICdcIicsXHJcbiAgICAgICAgICAgICAgICB2S2V5ID0ga2V5ID09PSBmYWxzZSA/ICcnIDogJyBkYXRhLWtleT1cIicgKyBrZXkgKyAnXCInLCBidG5EZWxldGUgPSAnJywgYnRuVXBsb2FkID0gJycsIGJ0bkRvd25sb2FkID0gJycsXHJcbiAgICAgICAgICAgICAgICBidG5ab29tID0gJycsIGJ0bkRyYWcgPSAnJywgY3NzLCB0ZW1wbGF0ZSA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25zJyksXHJcbiAgICAgICAgICAgICAgICBjb25maWcgPSBzZWxmLmZpbGVBY3Rpb25TZXR0aW5ncyxcclxuICAgICAgICAgICAgICAgIG90aGVyQnV0dG9ucyA9IHNlbGYub3RoZXJBY3Rpb25CdXR0b25zLnNldFRva2Vucyh7J2RhdGFLZXknOiB2S2V5LCAna2V5Jzoga2V5fSksXHJcbiAgICAgICAgICAgICAgICByZW1vdmVDbGFzcyA9IGRpc2FibGVkID8gY29uZmlnLnJlbW92ZUNsYXNzICsgJyBkaXNhYmxlZCcgOiBjb25maWcucmVtb3ZlQ2xhc3M7XHJcbiAgICAgICAgICAgIGlmIChzaG93RGVsKSB7XHJcbiAgICAgICAgICAgICAgICBidG5EZWxldGUgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYWN0aW9uRGVsZXRlJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAncmVtb3ZlQ2xhc3MnOiByZW1vdmVDbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAncmVtb3ZlSWNvbic6IGNvbmZpZy5yZW1vdmVJY29uLFxyXG4gICAgICAgICAgICAgICAgICAgICdyZW1vdmVUaXRsZSc6IGNvbmZpZy5yZW1vdmVUaXRsZSxcclxuICAgICAgICAgICAgICAgICAgICAnZGF0YVVybCc6IHZVcmwsXHJcbiAgICAgICAgICAgICAgICAgICAgJ2RhdGFLZXknOiB2S2V5LFxyXG4gICAgICAgICAgICAgICAgICAgICdrZXknOiBrZXlcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93VXBsKSB7XHJcbiAgICAgICAgICAgICAgICBidG5VcGxvYWQgPSBzZWxmLl9nZXRMYXlvdXRUZW1wbGF0ZSgnYWN0aW9uVXBsb2FkJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAndXBsb2FkQ2xhc3MnOiBjb25maWcudXBsb2FkQ2xhc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgJ3VwbG9hZEljb24nOiBjb25maWcudXBsb2FkSWNvbixcclxuICAgICAgICAgICAgICAgICAgICAndXBsb2FkVGl0bGUnOiBjb25maWcudXBsb2FkVGl0bGVcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93RHduKSB7XHJcbiAgICAgICAgICAgICAgICBidG5Eb3dubG9hZCA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25Eb3dubG9hZCcpLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAgICAgJ2Rvd25sb2FkQ2xhc3MnOiBjb25maWcuZG93bmxvYWRDbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAnZG93bmxvYWRJY29uJzogY29uZmlnLmRvd25sb2FkSWNvbixcclxuICAgICAgICAgICAgICAgICAgICAnZG93bmxvYWRUaXRsZSc6IGNvbmZpZy5kb3dubG9hZFRpdGxlLFxyXG4gICAgICAgICAgICAgICAgICAgICdkb3dubG9hZFVybCc6IGRVcmwgfHwgc2VsZi5pbml0aWFsUHJldmlld0Rvd25sb2FkVXJsXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIGJ0bkRvd25sb2FkID0gYnRuRG93bmxvYWQuc2V0VG9rZW5zKHsnZmlsZW5hbWUnOiBkRmlsZSwgJ2tleSc6IGtleX0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93Wm9vbSkge1xyXG4gICAgICAgICAgICAgICAgYnRuWm9vbSA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25ab29tJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnem9vbUNsYXNzJzogY29uZmlnLnpvb21DbGFzcyxcclxuICAgICAgICAgICAgICAgICAgICAnem9vbUljb24nOiBjb25maWcuem9vbUljb24sXHJcbiAgICAgICAgICAgICAgICAgICAgJ3pvb21UaXRsZSc6IGNvbmZpZy56b29tVGl0bGVcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzaG93RHJhZyAmJiBpc0luaXQpIHtcclxuICAgICAgICAgICAgICAgIGNzcyA9ICdkcmFnLWhhbmRsZS1pbml0ICcgKyBjb25maWcuZHJhZ0NsYXNzO1xyXG4gICAgICAgICAgICAgICAgYnRuRHJhZyA9IHNlbGYuX2dldExheW91dFRlbXBsYXRlKCdhY3Rpb25EcmFnJykuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAnZHJhZ0NsYXNzJzogY3NzLFxyXG4gICAgICAgICAgICAgICAgICAgICdkcmFnVGl0bGUnOiBjb25maWcuZHJhZ1RpdGxlLFxyXG4gICAgICAgICAgICAgICAgICAgICdkcmFnSWNvbic6IGNvbmZpZy5kcmFnSWNvblxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIHRlbXBsYXRlLnNldFRva2Vucyh7XHJcbiAgICAgICAgICAgICAgICAnZGVsZXRlJzogYnRuRGVsZXRlLFxyXG4gICAgICAgICAgICAgICAgJ3VwbG9hZCc6IGJ0blVwbG9hZCxcclxuICAgICAgICAgICAgICAgICdkb3dubG9hZCc6IGJ0bkRvd25sb2FkLFxyXG4gICAgICAgICAgICAgICAgJ3pvb20nOiBidG5ab29tLFxyXG4gICAgICAgICAgICAgICAgJ2RyYWcnOiBidG5EcmFnLFxyXG4gICAgICAgICAgICAgICAgJ290aGVyJzogb3RoZXJCdXR0b25zXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2Jyb3dzZTogZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoZSAmJiBlLmlzRGVmYXVsdFByZXZlbnRlZCgpIHx8ICFzZWxmLl9yYWlzZSgnZmlsZWJyb3dzZScpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYuaXNFcnJvciAmJiAhc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuY2xlYXIoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLmZvY3VzKCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfZmlsdGVyRHVwbGljYXRlOiBmdW5jdGlvbiAoZmlsZSwgZmlsZXMsIGZpbGVJZHMpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBmaWxlSWQgPSBzZWxmLl9nZXRGaWxlSWQoZmlsZSk7XHJcblxyXG4gICAgICAgICAgICBpZiAoZmlsZUlkICYmIGZpbGVJZHMgJiYgZmlsZUlkcy5pbmRleE9mKGZpbGVJZCkgPiAtMSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghZmlsZUlkcykge1xyXG4gICAgICAgICAgICAgICAgZmlsZUlkcyA9IFtdO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGZpbGVzLnB1c2goZmlsZSk7XHJcbiAgICAgICAgICAgIGZpbGVJZHMucHVzaChmaWxlSWQpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgX2NoYW5nZTogZnVuY3Rpb24gKGUpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5jaGFuZ2VUcmlnZ2VyZWQpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2Y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lc2csIHAxKSA6IHNlbGYuX3Nob3dFcnJvcihtZXNnLCBwMik7XHJcbiAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgbWF4Q291bnRDaGVjayA9IGZ1bmN0aW9uIChuLCBtKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIG1zZyA9IHNlbGYubXNnRmlsZXNUb29NYW55LnJlcGxhY2UoJ3ttfScsIG0pLnJlcGxhY2UoJ3tufScsIG4pO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuaXNFcnJvciA9IHRocm93RXJyb3IobXNnLCBudWxsLCBudWxsLCBudWxsKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLnJlbW92ZUNsYXNzKCdpY29uLXZpc2libGUnKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9zZXRDYXB0aW9uKCcnLCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtaW5wdXQtbmV3IGZpbGUtaW5wdXQtYWpheC1uZXcnKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNlbGYucmVhZGVyID0gbnVsbDtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRVcGxvYWQoKTtcclxuICAgICAgICAgICAgc2VsZi5faGlkZUZpbGVJY29uKCk7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLmRyb3Bab25lRW5hYmxlZCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlLWRyb3Atem9uZSAuJyArIHNlbGYuZHJvcFpvbmVUaXRsZUNsYXNzKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoaXNBamF4VXBsb2FkKSB7XHJcbiAgICAgICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uICh2S2V5LCB2RmlsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX2ZpbHRlckR1cGxpY2F0ZSh2RmlsZSwgdGZpbGVzLCBmaWxlSWRzKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaWYgKGUudGFyZ2V0ICYmIGUudGFyZ2V0LmZpbGVzID09PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlcyA9IGUudGFyZ2V0LnZhbHVlID8gW3tuYW1lOiBlLnRhcmdldC52YWx1ZS5yZXBsYWNlKC9eLitcXFxcLywgJycpfV0gOiBbXTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZXMgPSBlLnRhcmdldC5maWxlcyB8fCB7fTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHRmaWxlcyA9IGZpbGVzO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICgkaC5pc0VtcHR5KHRmaWxlcykgfHwgdGZpbGVzLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFpc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNsZWFyKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZXNlbGVjdG5vbmUnKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9yZXNldEVycm9ycygpO1xyXG4gICAgICAgICAgICBsZW4gPSB0ZmlsZXMubGVuZ3RoO1xyXG4gICAgICAgICAgICB0b3RhbCA9IHNlbGYuX2dldEZpbGVDb3VudChpc0FqYXhVcGxvYWQgPyAoc2VsZi5nZXRGaWxlU3RhY2soKS5sZW5ndGggKyBsZW4pIDogbGVuKTtcclxuICAgICAgICAgICAgaWYgKG1heENvdW50ID4gMCAmJiB0b3RhbCA+IG1heENvdW50KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXNlbGYuYXV0b1JlcGxhY2UgfHwgbGVuID4gbWF4Q291bnQpIHtcclxuICAgICAgICAgICAgICAgICAgICBtYXhDb3VudENoZWNrKChzZWxmLmF1dG9SZXBsYWNlICYmIGxlbiA+IG1heENvdW50ID8gbGVuIDogdG90YWwpLCBtYXhDb3VudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHRvdGFsID4gbWF4Q291bnQpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yZXNldFByZXZpZXdUaHVtYnMoaXNBamF4VXBsb2FkKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGlmICghaXNBamF4VXBsb2FkIHx8IGZsYWdTaW5nbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9yZXNldFByZXZpZXdUaHVtYnMoZmFsc2UpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChmbGFnU2luZ2xlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuY2xlYXJTdGFjaygpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQWpheFVwbG9hZCAmJiBjdHIgPT09IDAgJiYgKCFzZWxmLnByZXZpZXdDYWNoZS5jb3VudCgpIHx8IHNlbGYub3ZlcndyaXRlSW5pdGlhbCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmVzZXRQcmV2aWV3VGh1bWJzKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAg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gICAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAhIXNlbGYuYWpheEFib3J0ZWQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfcmVzZXRGaWxlU3RhY2s6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBpID0gMCwgbmV3c3RhY2sgPSBbXSwgbmV3bmFtZXMgPSBbXSwgbmV3aWRzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGluZCA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpLCBmaWxlID0gc2VsZi5maWxlc3RhY2tbaW5kXSxcclxuICAgICAgICAgICAgICAgICAgICBwaWQgPSAkdGh1bWIuYXR0cignaWQnKTtcclxuICAgICAgICAgICAgICAgIGlmIChpbmQgPT09ICctMScgfHwgaW5kID09PSAtMSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChmaWxlICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICBuZXdzdGFja1tpXSA9IGZpbGU7XHJcbiAgICAgICAgICAgICAgICAgICAgbmV3bmFtZXNbaV0gPSBzZWxmLl9nZXRGaWxlTmFtZShmaWxlKTtcclxuICAgICAgICAgICAgICAgICAgICBuZXdpZHNbaV0gPSBzZWxmLl9nZXRGaWxlSWQoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1iLmF0dHIoeydpZCc6IHNlbGYucHJldmlld0luaXRJZCArICctJyArIGksICdkYXRhLWZpbGVpbmRleCc6IGl9KTtcclxuICAgICAgICAgICAgICAgICAgICBpKys7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5hdHRyKHsnaWQnOiAndXBsb2FkZWQtJyArICRoLnVuaXFJZCgpLCAnZGF0YS1maWxlaW5kZXgnOiAnLTEnfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRwcmV2aWV3LmZpbmQoJyN6b29tLScgKyBwaWQpLmF0dHIoe1xyXG4gICAgICAgICAgICAgICAgICAgICdpZCc6ICd6b29tLScgKyAkdGh1bWIuYXR0cignaWQnKSxcclxuICAgICAgICAgICAgICAgICAgICAnZGF0YS1maWxlaW5kZXgnOiAkdGh1bWIuYXR0cignZGF0YS1maWxlaW5kZXgnKVxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVzdGFjayA9IG5ld3N0YWNrO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVuYW1lcyA9IG5ld25hbWVzO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVpZHMgPSBuZXdpZHM7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBfaXNGaWxlU2VsZWN0aW9uVmFsaWQ6IGZ1bmN0aW9uIChjbnQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgICAgICBjbnQgPSBjbnQgfHwgMDtcclxuICAgICAgICAgICAgaWYgKHNlbGYucmVxdWlyZWQgJiYgIXNlbGYuZ2V0RmlsZXNDb3VudCgpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRlcnJvckNvbnRhaW5lci5odG1sKCcnKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihzZWxmLm1zZ0ZpbGVSZXF1aXJlZCk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYubWluRmlsZUNvdW50ID4gMCAmJiBzZWxmLl9nZXRGaWxlQ291bnQoY250KSA8IHNlbGYubWluRmlsZUNvdW50KSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9ub0ZpbGVzRXJyb3Ioe30pO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYXJTdGFjazogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZXN0YWNrID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZW5hbWVzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZWlkcyA9IFtdO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHVwZGF0ZVN0YWNrOiBmdW5jdGlvbiAoaSwgZmlsZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZXN0YWNrW2ldID0gZmlsZTtcclxuICAgICAgICAgICAgc2VsZi5maWxlbmFtZXNbaV0gPSBzZWxmLl9nZXRGaWxlTmFtZShmaWxlKTtcclxuICAgICAgICAgICAgc2VsZi5maWxlaWRzW2ldID0gZmlsZSAmJiBzZWxmLl9nZXRGaWxlSWQoZmlsZSkgfHwgbnVsbDtcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBhZGRUb1N0YWNrOiBmdW5jdGlvbiAoZmlsZSkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZXN0YWNrLnB1c2goZmlsZSk7XHJcbiAgICAgICAgICAgIHNlbGYuZmlsZW5hbWVzLnB1c2goc2VsZi5fZ2V0RmlsZU5hbWUoZmlsZSkpO1xyXG4gICAgICAgICAgICBzZWxmLmZpbGVpZHMucHVzaChzZWxmLl9nZXRGaWxlSWQoZmlsZSkpO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGdldEZpbGVTdGFjazogZnVuY3Rpb24gKHNraXBOdWxsKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuZmlsZXN0YWNrLmZpbHRlcihmdW5jdGlvbiAobikge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIChza2lwTnVsbCA/IG4gIT09IHVuZGVmaW5lZCA6IG4gIT09IHVuZGVmaW5lZCAmJiBuICE9PSBudWxsKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBnZXRGaWxlc0NvdW50OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgbGVuID0gc2VsZi5pc0FqYXhVcGxvYWQgPyBzZWxmLmdldEZpbGVTdGFjaygpLmxlbmd0aCA6IHNlbGYuX2lucHV0RmlsZUNvdW50KCk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLl9nZXRGaWxlQ291bnQobGVuKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHJlYWRGaWxlczogZnVuY3Rpb24gKGZpbGVzKSB7XHJcbiAgICAgICAgICAgIHRoaXMucmVhZGVyID0gbmV3IEZpbGVSZWFkZXIoKTtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZWwgPSBzZWxmLiRlbGVtZW50LCAkcHJldmlldyA9IHNlbGYuJHByZXZpZXcsIHJlYWRlciA9IHNlbGYucmVhZGVyLFxyXG4gICAgICAgICAgICAgICAgJGNv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c2VsZi5fZ2V0T3V0RGF0YSh7fSwge30sIGZpbGVzKSwge2lkOiBwcmV2aWV3SWQsIGluZGV4OiBpbmRleH0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBwMiA9IHtpZDogcHJldmlld0lkLCBpbmRleDogaW5kZXgsIGZpbGU6IGZpbGUsIGZpbGVzOiBmaWxlc30sICR0aHVtYjtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9wcmV2aWV3RGVmYXVsdChmaWxlLCBwcmV2aWV3SWQsIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2sodW5kZWZpbmVkKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpbmRleCArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG51bUZpbGVzID0gMDtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdEZpbGVBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgJHRodW1iID0gJCgnIycgKyBwcmV2aWV3SWQpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlbGYucmVtb3ZlRnJvbVByZXZpZXdPbkVycm9yKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aHVtYi5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5pc0Vycm9yID0gc2VsZi5pc0FqYXhVcGxvYWQgPyBzZWxmLl9zaG93VXBsb2FkRXJyb3IobXNnLCBwMSkgOiBzZWxmLl9zaG93RXJyb3IobXNnLCBwMik7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHNlbGYubG9hZGVkSW1hZ2VzID0gW107XHJcbiAgICAgICAgICAgIHNlbGYudG90YWxJbWFnZXNDb3VudCA9IDA7XHJcblxyXG4gICAgICAgICAgICAkLmVhY2goZmlsZXMsIGZ1bmN0aW9uIChrZXksIGZpbGUpIHtcclxuICAgICAgICAgICAgICAgIHZhciBmdW5jID0gc2VsZi5maWxlVHlwZVNldHRpbmdzLmltYWdlO1xyXG4gICAgICAgICAgICAgICAgaWYgKGZ1bmMgJiYgZnVuYyhmaWxlLnR5cGUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi50b3RhbEltYWdlc0NvdW50Kys7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICByZWFkRmlsZSA9IGZ1bmN0aW9uIChpKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eSgkZWwuYXR0cignbXVsdGlwbGUnKSkpIHtcclxuICAgICAgICAgICAgICAgICAgICBudW1GaWxlcyA9IDE7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoaSA+PSBudW1GaWxlcykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCAmJiBzZWxmLmZpbGVzdGFjay5sZW5ndGggPiAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlYmF0Y2hzZWxlY3RlZCcsIFtzZWxmLmdldEZpbGVTdGFjaygpXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGViYXRjaHNlbGVjdGVkJywgW2ZpbGVzXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdmFyIG5vZGUgPSBjdHIgKyBpLCBwcmV2aWV3SWQgPSBwcmV2aWV3SW5pdElkICsgJy0nICsgbm9kZSwgZmlsZSA9IGZpbGVzW2ldLCBmU2l6ZUtCLCBqLCBtc2csXHJcbiAgICAgICAgICAgICAgICAgICAgZm5UZXh0ID0gc2V0dGluZ3MudGV4dCwgZm5JbWFnZSA9IHNldHRpbmdzLmltYWdlLCBmbkh0bWwgPSBzZXR0aW5ncy5odG1sLCB0eXAsIGNoaywgdHlwMSwgdHlwMixcclxuICAgICAgICAgICAgICAgICAgICBjYXB0aW9uID0gc2VsZi5fZ2V0RmlsZU5hbWUoZmlsZSwgJycpLCBmaWxlU2l6ZSA9IChmaWxlICYmIGZpbGUuc2l6ZSB8fCAwKSAvIDEwMDAsXHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZUV4dEV4cHIgPSAnJywgcHJldmlld0RhdGEgPSAkaC5jcmVhdGVPYmplY3RVUkwoZmlsZSksIGZpbGVDb3VudCA9IDAsXHJcbiAgICAgICAgICAgICAgICAgICAgc3RyVHlwZXMgPSAnJyxcclxuICAgICAgICAgICAgICAgICAgICBmdW5jLCBrbm93blR5cGVzID0gMCwgaXNUZXh0LCBpc0h0bWwsIGlzSW1hZ2UsIHR4dEZsYWcsIHByb2Nlc3NGaWxlTG9hZGVkID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgbXNnID0gbXNnUHJvZ3Jlc3Muc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbmRleCc6IGkgKyAxLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ZpbGVzJzogbnVtRmlsZXMsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGVyY2VudCc6IDUwLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbChtc2cpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZEZpbGUoaSArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWxvYWRlZCcsIFtmaWxlLCBwcmV2aWV3SWQsIGksIHJlYWRlcl0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBpZiAoIWZpbGUpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAodHlwTGVuID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCB0eXBMZW47IGorKykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXAxID0gZmlsZVR5cGVzW2pdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXAyID0gc2VsZi5tc2dGaWxlVHlwZXNbdHlwMV0gfHwgdHlwMTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyVHlwZXMgKz0gaiA9PT0gMCA/IHR5cDIgOiAnLCAnICsgdHlwMjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoY2FwdGlvbiA9PT0gZmFsc2UpIHtcclxuICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpICsgMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKGNhcHRpb24ubGVuZ3RoID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbXNnID0gc2VsZi5tc2dJbnZhbGlkRmlsZU5hbWUucmVwbGFjZSgne25hbWV9JywgJGguaHRtbEVuY29kZSgkaC5nZXRGaWxlTmFtZShmaWxlKSwgJ1t1bmtub3duXScpKTtcclxuICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAoISRoLmlzRW1wdHkoZmlsZUV4dCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlRXh0RXhwciA9IG5ldyBSZWdFeHAoJ1xcXFwuKCcgKyBmaWxlRXh0LmpvaW4oJ3wnKSArICcpJCcsICdpJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBmU2l6ZUtCID0gZmlsZVNpemUudG9GaXhlZCgyKTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLm1heEZpbGVTaXplID4gMCAmJiBmaWxlU2l6ZSA+IHNlbGYubWF4RmlsZVNpemUpIHtcclxuICAgICAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ1NpemVUb29MYXJnZS5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAnbmFtZSc6IGNhcHRpb24sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdzaXplJzogZlNpemVLQixcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ21heFNpemUnOiBzZWxmLm1heEZpbGVTaXplXHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihtc2csIGZpbGUsIHByZXZpZXdJZCwgaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYubWluRmlsZVNpemUgIT09IG51bGwgJiYgZmlsZVNpemUgPD0gJGguZ2V0TnVtKHNlbGYubWluRmlsZVNpemUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbXNnID0gc2VsZi5tc2dTaXplVG9vU21hbGwuc2V0VG9rZW5zKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAnc2l6ZSc6IGZTaXplS0IsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICdtaW5TaXplJzogc2VsZi5taW5GaWxlU2l6ZVxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHRocm93RXJyb3IobXNnLCBmaWxlLCBwcmV2aWV3SWQsIGkpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICghJGguaXNFbXB0eShmaWxlVHlwZXMpICYmICRoLmlzQXJyYXkoZmlsZVR5cGVzKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCBmaWxlVHlwZXMubGVuZ3RoOyBqICs9IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdHlwID0gZmlsZVR5cGVzW2pdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmdW5jID0gc2V0dGluZ3NbdHlwXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZmlsZUNvdW50ICs9ICFmdW5jIHx8ICh0eXBlb2YgZnVuYyAhPT0gJ2Z1bmN0aW9uJykgPyAwIDogKGZ1bmMoZmlsZS50eXBlLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJGguZ2V0RmlsZU5hbWUoZmlsZSkpID8gMSA6IDApO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAoZmlsZUNvdW50ID09PSAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG1zZyA9IHNlbGYubXNnSW52YWxpZEZpbGVUeXBlLnNldFRva2Vucyh7J25hbWUnOiBjYXB0aW9uLCAndHlwZXMnOiBzdHJUeXBlc30pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChmaWxlQ291bnQgPT09IDAgJiYgISRoLmlzRW1wdHkoZmlsZUV4dCkgJiYgJGguaXNBcnJheShmaWxlRXh0KSAmJiAhJGguaXNFbXB0eShmaWxlRXh0RXhwcikpIHtcclxuICAgICAgICAgICAgICAgICAgICBjaGsgPSAkaC5jb21wYXJlKGNhcHRpb24sIGZpbGVFeHRFeHByKTtcclxuICAgICAgICAgICAgICAgICAgICBmaWxlQ291bnQgKz0gJGguaXNFbXB0eShjaGspID8gMCA6IGNoay5sZW5ndGg7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGVDb3VudCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBtc2cgPSBzZWxmLm1zZ0ludmFsaWRGaWxlRXh0ZW5zaW9uLnNldFRva2Vucyh7J25hbWUnOiBjYXB0aW9uLCAnZXh0ZW5zaW9ucyc6IHN0ckV4dH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKG1zZywgZmlsZSwgcHJldmlld0lkLCBpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICghc2VsZi5zaG93UHJldmlldykge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2soZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZWFkRmlsZShpICsgMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3VwZGF0ZUZpbGVEZXRhaWxzKG51bUZpbGVzKTtcclxuICAgICAgICAgICAgICAgICAgICB9LCAxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlbG9hZGVkJywgW2ZpbGUsIHByZXZpZXdJZCwgaSwgcmVhZGVyXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKCFjYW5QcmV2aWV3ICYmIGZpbGVTaXplID4gbWF4UHJldmlld1NpemUpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmFkZFRvU3RhY2soZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJGNvbnRhaW5lci5hZGRDbGFzcygnZmlsZS10aHVtYi1sb2FkaW5nJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcHJldmlld0RlZmF1bHQoZmlsZSwgcHJldmlld0lkKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0RmlsZUFjdGlvbnMoKTtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl91cGRhdGVGaWxlRGV0YWlscyhudW1GaWxlcyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmVhZEZpbGUoaSArIDEpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmICgkcHJldmlldy5sZW5ndGggJiYgRmlsZVJlYWRlciAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNUZXh0ID0gZm5UZXh0KGZpbGUudHlwZSwgY2FwdGlvbik7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNIdG1sID0gZm5IdG1sKGZpbGUudHlwZSwgY2FwdGlvbik7XHJcbiAgICAgICAgICAgICAgICAgICAgaXNJbWFnZSA9IGZuSW1hZ2UoZmlsZS50eXBlLCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICAkc3RhdHVzLmh0bWwobXNnTG9hZGluZy5yZXBsYWNlKCd7aW5kZXh9JywgaSArIDEpLnJlcGxhY2UoJ3tmaWxlc30nLCBudW1GaWxlcykpO1xyXG4gICAgICAgICAgICAgICAgICAgICRjb250YWluZXIuYWRkQ2xhc3MoJ2ZpbGUtdGh1bWItbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbmVycm9yID0gZnVuY3Rpb24gKGV2dCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9lcnJvckhhbmRsZXIoZXZ0LCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbmxvYWQgPSBmdW5jdGlvbiAodGhlRmlsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgaGV4LCBmaWxlSW5mbywgdWludCwgYnl0ZSwgYnl0ZXMgPSBbXSwgY29udGVudHMsIG1pbWUsIHJlYWRUZXh0SW1hZ2UgPSBmdW5jdGlvbiAodGV4dEZsYWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuZXdSZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3UmVhZGVyLm9uZXJyb3IgPSBmdW5jdGlvbiAodGhlRmlsZU5ldykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2Vycm9ySGFuZGxlcih0aGVGaWxlTmV3LCBjYXB0aW9uKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdSZWFkZXIub25sb2FkID0gZnVuY3Rpb24gKHRoZUZpbGVOZXcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9wcmV2aWV3RmlsZShpLCBmaWxlLCB0aGVGaWxlTmV3LCBwcmV2aWV3SWQsIHByZXZpZXdEYXRhLCBmaWxlSW5mbyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdEZpbGVBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0ZpbGVMb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGV4dEZsYWcpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdSZWFkZXIucmVhZEFzVGV4dChmaWxlLCBzZWxmLnRleHRFbmNvZGluZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld1JlYWRlci5yZWFkQXNEYXRhVVJMKGZpbGUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlSW5mbyA9IHsnbmFtZSc6IGNhcHRpb24sICd0eXBlJzogZmlsZS50eXBlfTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJC5lYWNoKHNldHRpbmdzLCBmdW5jdGlvbiAoaywgZikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGsgIT09ICdvYmplY3QnICYmIGsgIT09ICdvdGhlcicgJiYgdHlwZW9mIGYgPT09ICdmdW5jdGlvbicgJiYgZihmaWxlLnR5cGUsIGNhcHRpb24pKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga25vd25UeXBlcysrO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGtub3duVHlwZXMgPT09IDApIHsvLyBhdXRvIGRldGVjdCBtaW1lIHR5cGVzIGZyb20gY29udGVudCBpZiBubyBrbm93biBmaWxlIHR5cGVzIGRldGVjdGVkXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50ID0gbmV3IFVpbnQ4QXJyYXkodGhlRmlsZS50YXJnZXQucmVzdWx0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCB1aW50Lmxlbmd0aDsgaisrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZSA9IHVpbnRbal0udG9TdHJpbmcoMTYpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVzLnB1c2goYnl0ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBieXRlcy5qb2luKCcnKS50b0xvd2VyQ2FzZSgpLnN1YnN0cmluZygwLCA4KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbWUgPSAkaC5nZXRNaW1lVHlwZShoZXgsICcnLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJGguaXNFbXB0eShtaW1lKSkgeyAvLyBsb29rIGZvciBhc2NpaSB0ZXh0IGNvbnRlbnRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50cyA9ICRoLmFycmF5QnVmZmVyMlN0cmluZyhyZWFkZXIucmVzdWx0KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW1lID0gJGguaXNTdmcoY29udGVudHMpID8gJ2ltYWdlL3N2Zyt4bWwnIDogJGguZ2V0TWltZVR5cGUoaGV4LCBjb250ZW50cywgZmlsZS50eXBlKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVJbmZvID0geyduYW1lJzogY2FwdGlvbiwgJ3R5cGUnOiBtaW1lfTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzVGV4dCA9IGZuVGV4dChtaW1lLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0h0bWwgPSBmbkh0bWwobWltZSwgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNJbWFnZSA9IGZuSW1hZ2UobWltZSwgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHh0RmxhZyA9IGlzVGV4dCB8fCBpc0h0bWw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHh0RmxhZyB8fCBpc0ltYWdlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZFRleHRJbWFnZSh0eHRGbGFnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fcHJldmlld0ZpbGUoaSwgZmlsZSwgdGhlRmlsZSwgcHJldmlld0lkLCBwcmV2aWV3RGF0YSwgZmlsZUluZm8pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0RmlsZUFjdGlvbnMoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0ZpbGVMb2FkZWQoKTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbnByb2dyZXNzID0gZnVuY3Rpb24gKGRhdGEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEubGVuZ3RoQ29tcHV0YWJsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGZhY3QgPSAoZGF0YS5sb2FkZWQgLyBkYXRhLnRvdGFsKSAqIDEwMCwgcHJvZ3Jlc3MgPSBNYXRoLmNlaWwoZmFjdCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2cgPSBtc2dQcm9ncmVzcy5zZXRUb2tlbnMoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbmRleCc6IGkgKyAxLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmaWxlcyc6IG51bUZpbGVzLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwZXJjZW50JzogcHJvZ3Jlc3MsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBjYXB0aW9uXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzdGF0dXMuaHRtbChtc2cpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChpc1RleHQgfHwgaXNIdG1sKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRlci5yZWFkQXNUZXh0KGZpbGUsIHNlbGYudGV4dEVuY29kaW5nKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNJbWFnZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnJlYWRBc0RhdGFVUkwoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkZXIucmVhZEFzQXJyYXlCdWZmZXIoZmlsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYuX3ByZXZpZXdEZWZhdWx0KGZpbGUsIHByZXZpZXdJZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRGaWxlKGkgKyAxKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBkYXRlRmlsZURldGFpbHMobnVtRmlsZXMpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGVsb2FkZWQnLCBbZmlsZSwgcHJldmlld0lkLCBpLCByZWFkZXJdKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuYWRkVG9TdGFjayhmaWxlKTtcclxuICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHJlYWRGaWxlKDApO1xyXG4gICAgICAgICAgICBzZWxmLl91cGRhdGVGaWxlRGV0YWlscyhudW1GaWxlcywgZmFsc2UpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgbG9jazogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHNlbGYuX3Jlc2V0RXJyb3JzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuZGlzYWJsZSgpO1xyXG4gICAgICAgICAgICBpZiAoc2VsZi5zaG93UmVtb3ZlKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIuZmluZCgnLmZpbGVpbnB1dC1yZW1vdmUnKS5oaWRlKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0NhbmNlbCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJykuc2hvdygpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlbG9jaycsIFtzZWxmLmZpbGVzdGFjaywgc2VsZi5fZ2V0RXh0cmFEYXRhKCldKTtcclxuICAgICAgICAgICAgcmV0dXJuIHNlbGYuJGVsZW1lbnQ7XHJcbiAgICAgICAgfSxcclxuICAgICAgICB1bmxvY2s6IGZ1bmN0aW9uIChyZXNldCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGlmIChyZXNldCA9PT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgICAgICByZXNldCA9IHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5lbmFibGUoKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYuc2hvd0NhbmNlbCkge1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY29udGFpbmVyLmZpbmQoJy5maWxlaW5wdXQtY2FuY2VsJykuaGlkZSgpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnNob3dSZW1vdmUpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuJGNvbnRhaW5lci5maW5kKCcuZmlsZWlucHV0LXJlbW92ZScpLnNob3coKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAocmVzZXQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0RmlsZVN0YWNrKCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fcmFpc2UoJ2ZpbGV1bmxvY2snLCBbc2VsZi5maWxlc3RhY2ssIHNlbGYuX2dldEV4dHJhRGF0YSgpXSk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2FuY2VsOiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgeGhyID0gc2VsZi5hamF4UmVxdWVzdHMsIGxlbiA9IHhoci5sZW5ndGgsIGk7XHJcbiAgICAgICAgICAgIGlmIChsZW4gPiAwKSB7XHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpICs9IDEpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLmNhbmNlbGxpbmcgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgIHhocltpXS5hYm9ydCgpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX3NldFByb2dyZXNzQ2FuY2VsbGVkKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgdmFyICR0aHVtYiA9ICQodGhpcyksIGluZCA9ICR0aHVtYi5hdHRyKCdkYXRhLWZpbGVpbmRleCcpO1xyXG4gICAgICAgICAgICAgICAgJHRodW1iLnJlbW92ZUNsYXNzKCdmaWxlLXVwbG9hZGluZycpO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuZmlsZXN0YWNrW2luZF0gIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS11cGxvYWQnKS5yZW1vdmVDbGFzcygnZGlzYWJsZWQnKS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICR0aHVtYi5maW5kKCcua3YtZmlsZS1yZW1vdmUnKS5yZW1vdmVDbGFzcygnZGlzYWJsZWQnKS5yZW1vdmVBdHRyKCdkaXNhYmxlZCcpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgc2VsZi51bmxvY2soKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgY2xlYXI6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCBjYXA7XHJcbiAgICAgICAgICAgIGlmICghc2VsZi5fcmFpc2UoJ2ZpbGVjbGVhcicpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi4kYnRuVXBsb2FkLnJlbW92ZUF0dHIoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2dldFRodW1icygpLmZpbmQoJ3ZpZGVvLGF1ZGlvLGltZycpLmVhY2goZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgJGguY2xlYW5NZW1vcnkoJCh0aGlzKSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBzZWxmLl9jbGVhckZpbGVJbnB1dCgpO1xyXG4gICAgICAgICAgICBzZWxmLl9yZXNldFVwbG9hZCgpO1xyXG4gICAgICAgICAgICBzZWxmLmNsZWFyU3RhY2soKTtcclxuICAgICAgICAgICAgc2VsZi5fcmVzZXRFcnJvcnModHJ1ZSk7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLl9oYXNJbml0aWFsUHJldmlldygpKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9zaG93RmlsZUljb24oKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Jlc2V0UHJldmlldygpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFByZXZpZXdBY3Rpb25zKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLiRjb250YWluZXIucmVtb3ZlQ2xhc3MoJ2ZpbGUtaW5wdXQtbmV3Jyk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9nZXRUaHVtYnMoKS5lYWNoKGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLl9jbGVhck9iamVjdHMoJCh0aGlzKSk7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIGlmIChzZWxmLmlzQWpheFVwbG9hZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNlbGYucHJldmlld0NhY2hlLmRhdGEgPSB7fTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuaHRtbCgnJyk7XHJcbiAgICAgICAgICAgICAgICBjYXAgPSAoIXNlbGYub3ZlcndyaXRlSW5pdGlhbCAmJiBzZWxmLmluaXRpYWxDYXB0aW9uLmxlbmd0aCA+IDApID8gc2VsZi5pbml0aWFsQ2FwdGlvbiA6ICcnO1xyXG4gICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbi5hdHRyKCd0aXRsZScsICcnKS52YWwoY2FwKTtcclxuICAgICAgICAgICAgICAgICRoLmFkZENzcyhzZWxmLiRjb250YWluZXIsICdmaWxlLWlucHV0LW5ldycpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5fdmFsaWRhdGVEZWZhdWx0UHJldmlldygpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChzZWxmLiRjb250YWluZXIuZmluZCgkaC5GUkFNRVMpLmxlbmd0aCA9PT0gMCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFzZWxmLl9pbml0Q2FwdGlvbigpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi4kY2FwdGlvbkNvbnRhaW5lci5yZW1vdmVDbGFzcygnaWNvbi12aXNpYmxlJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5faGlkZUZpbGVJY29uKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3JhaXNlKCdmaWxlY2xlYXJlZCcpO1xyXG4gICAgICAgICAgICBzZWxmLiRjYXB0aW9uQ29udGFpbmVyLmZvY3VzKCk7XHJcbiAgICAgICAgICAgIHNlbGYuX3NldEZpbGVEcm9wWm9uZVRpdGxlKCk7XHJcbiAgICAgICAgICAgIHJldHVybiBzZWxmLiRlbGVtZW50O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgcmVzZXQ6IGZ1bm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gICAgICAgICAgICBzZWxmLiRjb250YWluZXIuZmluZCgnLmJ0bi1maWxlJykucmVtb3ZlQ2xhc3MoJ2Rpc2FibGVkJyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXREcmFnRHJvcCgpO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHVwbG9hZDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXMsIHRvdExlbiA9IHNlbGYuZ2V0RmlsZVN0YWNrKCkubGVuZ3RoLCBpLCBvdXREYXRhLCBsZW4sXHJcbiAgICAgICAgICAgICAgICBoYXNFeHRyYURhdGEgPSAhJC5pc0VtcHR5T2JqZWN0KHNlbGYuX2dldEV4dHJhRGF0YSgpKTtcclxuICAgICAgICAgICAgaWYgKCFzZWxmLmlzQWpheFVwbG9hZCB8fCBzZWxmLmlzRGlzYWJsZWQgfHwgIXNlbGYuX2lzRmlsZVNlbGVjdGlvblZhbGlkKHRvdExlbikpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl9yZXNldFVwbG9hZCgpO1xyXG4gICAgICAgICAgICBpZiAodG90TGVuID09PSAwICYmICFoYXNFeHRyYURhdGEpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX3Nob3dVcGxvYWRFcnJvcihzZWxmLm1zZ1VwbG9hZEVtcHR5KTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLiRwcm9ncmVzcy5zaG93KCk7XHJcbiAgICAgICAgICAgIHNlbGYudXBsb2FkQ291bnQgPSAwO1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZFN0YXR1cyA9IHt9O1xyXG4gICAgICAgICAgICBzZWxmLnVwbG9hZExvZyA9IFtdO1xyXG4gICAgICAgICAgICBzZWxmLmxvY2soKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0UHJvZ3Jlc3MoMik7XHJcbiAgICAgICAgICAgIGlmICh0b3RMZW4gPT09IDAgJiYgaGFzRXh0cmFEYXRhKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl91cGxvYWRFeHRyYU9ubHkoKTtcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBsZW4gPSBzZWxmLmZpbGVzdGFjay5sZW5ndGg7XHJcbiAgICAgICAgICAgIHNlbGYuaGFzSW5pdERhdGEgPSBmYWxzZTtcclxuICAgICAgICAgICAgaWYgKHNlbGYudXBsb2FkQXN5bmMpIHtcclxuICAgICAgICAgICAgICAgIG91dERhdGEgPSBzZWxmLl9nZXRPdXREYXRhKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLl9yYWlzZSgnZmlsZWJhdGNocHJldXBsb2FkJywgW291dERhdGFdKTtcclxuICAgICAgICAgICAgICAgIHNlbGYuZmlsZUJhdGNoQ29tcGxldGVkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZENhY2hlID0ge2NvbnRlbnQ6IFtdLCBjb25maWc6IFtdLCB0YWdzOiBbXSwgYXBwZW5kOiB0cnVlfTtcclxuICAgICAgICAgICAgICAgIHNlbGYudXBsb2FkQXN5bmNDb3VudCA9IHNlbGYuZ2V0RmlsZVN0YWNrKCkubGVuZ3RoO1xyXG4gICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbjsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS5jb250ZW50W2ldID0gbnVsbDtcclxuICAgICAgICAgICAgICAgICAgICBzZWxmLnVwbG9hZENhY2hlLmNvbmZpZ1tpXSA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICAgICAgc2VsZi51cGxvYWRDYWNoZS50YWdzW2ldID0gbnVsbDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNlbGYuJHByZXZpZXcuZmluZCgnLmZpbGUtcHJldmlldy1pbml0aWFsJykucmVtb3ZlQ2xhc3MoJGguU09SVF9DU1MpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5faW5pdFNvcnRhYmxlKCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmNhY2hlSW5pdGlhbFByZXZpZXcgPSBzZWxmLmdldFByZXZpZXcoKTtcclxuXHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5maWxlc3RhY2tbaV0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5fdXBsb2FkU2luZ2xlKGksIHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBzZWxmLl91cGxvYWRCYXRjaCgpO1xyXG4gICAgICAgICAgICByZXR1cm4gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIGRlc3Ryb3k6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZm9ybSA9IHNlbGYuJGZvcm0sICRjb250ID0gc2VsZi4kY29udGFpbmVyLCAkZWwgPSBzZWxmLiRlbGVtZW50LCBucyA9IHNlbGYubmFtZXNwYWNlO1xyXG4gICAgICAgICAgICAkKGRvY3VtZW50KS5vZmYobnMpO1xyXG4gICAgICAgICAgICAkKHdpbmRvdykub2ZmKG5zKTtcclxuICAgICAgICAgICAgaWYgKCRmb3JtICYmICRmb3JtLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgJGZvcm0ub2ZmKG5zKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoc2VsZi5pc0FqYXhVcGxvYWQpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYuX2NsZWFyRmlsZUlucHV0KCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5fY2xlYW51cCgpO1xyXG4gICAgICAgICAgICBzZWxmLl9pbml0UHJldmlld0NhY2hlKCk7XHJcbiAgICAgICAgICAgICRlbC5pbnNlcnRCZWZvcmUoJGNvbnQpLm9mZihucykucmVtb3ZlRGF0YSgpO1xyXG4gICAgICAgICAgICAkY29udC5vZmYoKS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgcmV0dXJuICRlbDtcclxuICAgICAgICB9LFxyXG4gICAgICAgIHJlZnJlc2g6IGZ1bmN0aW9uIChvcHRpb25zKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcywgJGVsID0gc2VsZi4kZWxlbWVudDtcclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBvcHRpb25zICE9PSAnb2JqZWN0JyB8fCAkaC5pc0VtcHR5KG9wdGlvbnMpKSB7XHJcbiAgICAgICAgICAgICAgICBvcHRpb25zID0gc2VsZi5vcHRpb25zO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgb3B0aW9ucyA9ICQuZXh0ZW5kKHRydWUsIHt9LCBzZWxmLm9wdGlvbnMsIG9wdGlvbnMpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXQob3B0aW9ucywgdHJ1ZSk7XHJcbiAgICAgICAgICAgIHNlbGYuX2xpc3RlbigpO1xyXG4gICAgICAgICAgICByZXR1cm4gJGVsO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgem9vbTogZnVuY3Rpb24gKGZyYW1lSWQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUgPSBzZWxmLl9nZXRGcmFtZShmcmFtZUlkKSwgJG1vZGFsID0gc2VsZi4kbW9kYWw7XHJcbiAgICAgICAgICAgIGlmICghJGZyYW1lKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJGguaW5pdE1vZGFsKCRtb2RhbCk7XHJcbiAgICAgICAgICAgICRtb2RhbC5odG1sKHNlbGYuX2dldE1vZGFsQ29udGVudCgpKTtcclxuICAgICAgICAgICAgc2VsZi5fc2V0Wm9vbUNvbnRlbnQoJGZyYW1lKTtcclxuICAgICAgICAgICAgJG1vZGFsLm1vZGFsKCdzaG93Jyk7XHJcbiAgICAgICAgICAgIHNlbGYuX2luaXRab29tQnV0dG9ucygpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0RXhpZjogZnVuY3Rpb24gKGZyYW1lSWQpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWUgPSBzZWxmLl9nZXRGcmFtZShmcmFtZUlkKTtcclxuICAgICAgICAgICAgcmV0dXJuICRmcmFtZSAmJiAkZnJhbWUuZGF0YSgnZXhpZicpIHx8IG51bGw7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBnZXRGcmFtZXM6IGZ1bmN0aW9uIChjc3NGaWx0ZXIpIHtcclxuICAgICAgICAgICAgdmFyIHNlbGYgPSB0aGlzLCAkZnJhbWVzO1xyXG4gICAgICAgICAgICBjc3NGaWx0ZXIgPSBjc3NGaWx0ZXIgfHwgJyc7XHJcbiAgICAgICAgICAgICRmcmFtZXMgPSBzZWxmLiRwcmV2aWV3LmZpbmQoJGguRlJBTUVTICsgY3NzRmlsdGVyKTtcclxuICAgICAgICAgICAgaWYgKHNlbGYucmV2ZXJzZVByZXZpZXdPcmRlcikge1xyXG4gICAgICAgICAgICAgICAgJGZyYW1lcyA9ICQoJGZyYW1lcy5nZXQoKS5yZXZlcnNlKCkpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiAkZnJhbWVzO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgZ2V0UHJldmlldzogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICBjb250ZW50OiBzZWxmLmluaXRpYWxQcmV2aWV3LFxyXG4gICAgICAgICAgICAgICAgY29uZmlnOiBzZWxmLmluaXRpYWxQcmV2aWV3Q29uZmlnLFxyXG4gICAgICAgICAgICAgICAgdGFnczogc2VsZi5pbml0aWFsUHJldmlld1RodW1iVGFnc1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcblxyXG4gICAgJC5mbi5maWxlaW5wdXQgPSBmdW5jdGlvbiAob3B0aW9uKSB7XHJcbiAgICAgICAgaWYgKCEkaC5oYXNGaWxlQVBJU3VwcG9ydCgpICYmICEkaC5pc0lFKDkpKSB7XHJcbiAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICB9XHJcbiAgICAgICAgdmFyIGFyZ3MgPSBBcnJheS5hcHBseShudWxsLCBhcmd1bWVudHMpLCByZXR2YWxzID0gW107XHJcbiAgICAgICAgYXJncy5zaGlmdCgpO1xyXG4gICAgICAgIHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHZhciBzZWxmID0gJCh0aGlzKSwgZGF0YSA9IHNlbGYuZGF0YSgnZmlsZWlucHV0JyksIG9wdGlvbnMgPSB0eXBlb2Ygb3B0aW9uID09PSAnb2JqZWN0JyAmJiBvcHRpb24sXHJcbiAgICAgICAgICAgICAgICB0aGVtZSA9IG9wdGlvbnMudGhlbWUgfHwgc2VsZi5kYXRhKCd0aGVtZScpLCBsID0ge30sIHQgPSB7fSxcclxuICAgICAgICAgICAgICAgIGxhbmcgPSBvcHRpb25zLmxhbmd1YWdlIHx8IHNlbGYuZGF0YSgnbGFuZ3VhZ2UnKSB8fCAkLmZuLmZpbGVpbnB1dC5kZWZhdWx0cy5sYW5ndWFnZSB8fCAnZW4nLCBvcHQ7XHJcbiAgICAgICAgICAgIGlmICghZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgaWYgKHRoZW1lKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdCA9ICQuZm4uZmlsZWlucHV0VGhlbWVzW3RoZW1lXSB8fCB7fTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGlmIChsYW5nICE9PSAnZW4nICYmICEkaC5pc0VtcHR5KCQuZm4uZmlsZWlucHV0TG9jYWxlc1tsYW5nXSkpIHtcclxuICAgICAgICAgICAgICAgICAgICBsID0gJC5mbi5maWxlaW5wdXRMb2NhbGVzW2xhbmddIHx8IHt9O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgb3B0ID0gJC5leHRlbmQodHJ1ZSwge30sICQuZm4uZmlsZWlucHV0LmRlZmF1bHRzLCB0LCAkLmZuLmZpbGVpbnB1dExvY2FsZXMuZW4sIGwsIG9wdGlvbnMsIHNlbGYuZGF0YSgpKTtcclxuICAgICAgICAgICAgICAgIGRhdGEgPSBuZXcgRmlsZUlucHV0KHRoaXMsIG9wdCk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmRhdGEoJ2ZpbGVpbnB1dCcsIGRhdGEpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbiA9PT0gJ3N0cmluZycpIHtcclxuICAgICAgICAgICAgICAgIHJldHZhbHMucHVzaChkYXRhW29wdGlvbl0uYXBwbHkoZGF0YSwgYXJncykpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgc3dpdGNoIChyZXR2YWxzLmxlbmd0aCkge1xyXG4gICAgICAgICAgICBjYXNlIDA6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcztcclxuICAgICAgICAgICAgY2FzZSAxOlxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJldHZhbHNbMF07XHJcbiAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gcmV0dmFscztcclxuICAgICAgICB9XHJcbiAgICB9O1xyXG5cclxuICAgICQuZm4uZmlsZWlucHV0LmRlZmF1bHRzID0ge1xyXG4gICAgICAgIGxhbmd1YWdlOiAnZW4nLFxyXG4gICAgICAgIHNob3dDYXB0aW9uOiB0cnVlLFxyXG4gICAgICAgIHNob3dCcm93c2U6IHRydWUsXHJcbiAgICAgICAgc2hvd1ByZXZpZXc6IHRydWUsXHJcbiAgICAgICAgc2hvd1JlbW92ZTogdHJ1ZSxcclxuICAgICAgICBzaG93VXBsb2FkOiB0cnVlLFxyXG4gICAgICAgIHNob3dDYW5jZWw6IHRydWUsXHJcbiAgICAgICAgc2hvd0Nsb3NlOiB0cnVlLFxyXG4gICAgICAgIHNob3dVcGxvYWRlZFRodW1iczogdHJ1ZSxcclxuICAgICAgICBicm93c2VPblpvbmVDbGljazogZmFsc2UsXHJcbiAgICAgICAgYXV0b1JlcGxhY2U6IGZhbHNlLFxyXG4gICAgICAgIGF1dG9PcmllbnRJbWFnZTogZnVuY3Rpb24gKCkgeyAvLyBhcHBsaWNhYmxlIGZvciBKUEVHIGltYWdlcyBvbmx5IGFuZCBub24gaW9zIHNhZmFyaVxyXG4gICAgICAgICAgICB2YXIgdWEgPSB3aW5kb3cubmF2aWdhdG9yLnVzZXJBZ2VudCwgd2Via2l0ID0gISF1YS5tYXRjaCgvV2ViS2l0L2kpLFxyXG4gICAgICAgICAgICAgICAgaU9TID0gISF1YS5tYXRjaCgvaVAob2R8YWR8aG9uZSkvaSksIGlPU1NhZmFyaSA9IGlPUyAmJiB3ZWJraXQgJiYgIXVhLm1hdGNoKC9DcmlPUy9pKTtcclxuICAgICAgICAgICAgcmV0dXJuICFpT1NTYWZhcmk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICByZXF1aXJlZDogZmFsc2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icGFjay1wbHVnaW5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9ib290c3RyYXAtZmlsZWlucHV0L2Nzcy9maWxlaW5wdXQuY3NzXG4vLyBtb2R1bGUgaWQgPSAxMFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvLyByZW1vdmVkIGJ5IGV4dHJhY3QtdGV4dC13ZWJwYWNrLXBsdWdpblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL0Bmb3J0YXdlc29tZS9mb250YXdlc29tZS1mcmVlL2Nzcy9hbGwuY3NzXG4vLyBtb2R1bGUgaWQgPSAxMVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvLyByZW1vdmVkIGJ5IGV4dHJhY3QtdGV4dC13ZWJwYWNrLXBsdWdpblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vc3JjL3N0eWxlLmNzc1xuLy8gbW9kdWxlIGlkID0gMTJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sInNvdXJjZVJvb3QiOiIifQ== \ No newline at end of file diff --git a/dist/styles.css b/dist/styles.css index 3819101c..4ed72033 100644 --- a/dist/styles.css +++ b/dist/styles.css @@ -15443,4 +15443,8 @@ ul.karmen-related-elements { color: white; } +.uppercase:valid { + text-transform: uppercase; +} + /*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzdHlsZXMuY3NzIiwic291cmNlUm9vdCI6IiJ9*/ \ No newline at end of file diff --git a/errors/errors.go b/errors/errors.go new file mode 100644 index 00000000..ff060828 --- /dev/null +++ b/errors/errors.go @@ -0,0 +1,5 @@ +package errors + +import "errors" + +var RecordExists = errors.New("Record already exists!") diff --git a/orm/participant.go b/orm/participant.go index bb0e8997..9b605ea1 100644 --- a/orm/participant.go +++ b/orm/participant.go @@ -6,6 +6,7 @@ import ( "net/http" "strings" + "git.andreafazzi.eu/andrea/oef/errors" "git.andreafazzi.eu/andrea/oef/renderer" "github.com/jinzhu/gorm" ) @@ -38,7 +39,8 @@ func (model *Participant) sanitize(s string) string { } func (model *Participant) username() string { - return strings.Join([]string{model.sanitize(model.Firstname), model.sanitize(model.Lastname)}, ".") + // return strings.Join([]string{model.sanitize(model.Firstname), model.sanitize(model.Lastname)}, ".") + return strings.ToUpper(model.FiscalCode) } func (model *Participant) GetID() uint { return model.ID } @@ -48,8 +50,20 @@ func (model *Participant) String() string { } func (model *Participant) BeforeSave(tx *gorm.DB) error { + users := make([]*User, 0) + if err := tx.Where("username = ?", model.FiscalCode).Find(&users).Error; err != nil { + return err + } + + if len(users) > 0 { + return errors.RecordExists + } + var user User - if err := tx.FirstOrCreate(&user, &User{Username: model.username()}).Error; err != nil { + if err := tx.FirstOrCreate(&user, &User{ + Username: model.username(), + Role: "participant", + }).Error; err != nil { return err } model.UserID = user.ID @@ -92,6 +106,7 @@ func (model *Participant) Create(args map[string]string, r *http.Request) (inter if err != nil { return nil, err } + participant, err = CreateParticipant(participant) if err != nil { return nil, err @@ -192,6 +207,8 @@ func CreateParticipant(participant *Participant) (*Participant, error) { } func SaveParticipant(participant interface{}) (interface{}, error) { + participant.(*Participant).FiscalCode = strings.ToUpper(participant.(*Participant).FiscalCode) + if err := DB(). /*.Omit("Something")*/ Save(participant).Error; err != nil { return nil, err } diff --git a/renderer/funcmap.go b/renderer/funcmap.go index 0e2c02f6..32fa91ea 100644 --- a/renderer/funcmap.go +++ b/renderer/funcmap.go @@ -54,7 +54,7 @@ var ( ) func username(claims jwt.MapClaims) string { - return claims["name"].(string) + return claims["username"].(string) } func isAdmin(claims jwt.MapClaims) bool { diff --git a/renderer/renderer.go b/renderer/renderer.go index 67f239cf..17e77110 100644 --- a/renderer/renderer.go +++ b/renderer/renderer.go @@ -36,6 +36,7 @@ type htmlTemplateData struct { Data interface{} Options url.Values Claims jwt.MapClaims + Error error } type JsonResponse struct { @@ -240,12 +241,12 @@ func (rend *HTMLRenderer) writeError(w http.ResponseWriter, r *http.Request, dat func (rend *HTMLRenderer) Render(w http.ResponseWriter, r *http.Request, data interface{}, options ...url.Values) { if data != nil && isErrorType(data) { - rend.writeError(w, r, &htmlTemplateData{data.(error), nil, nil}) + rend.writeError(w, r, &htmlTemplateData{data.(error), nil, nil, data.(error)}) } else { t, ok := rend.templates[options[0]["tpl_content"][0]] if !ok { err := fmt.Errorf("Template %s not found", options[0]["tpl_content"][0]) - rend.writeError(w, r, &htmlTemplateData{err, nil, nil}) + rend.writeError(w, r, &htmlTemplateData{err, nil, nil, err}) } var claims jwt.MapClaims @@ -255,9 +256,9 @@ func (rend *HTMLRenderer) Render(w http.ResponseWriter, r *http.Request, data in } w.Header().Set("Content-Type", "text/html; charset=utf-8") - err := t.ExecuteTemplate(w, options[0]["tpl_layout"][0], &htmlTemplateData{data, options[0], claims}) + err := t.ExecuteTemplate(w, options[0]["tpl_layout"][0], &htmlTemplateData{data, options[0], claims, nil}) if err != nil { - rend.writeError(w, r, &htmlTemplateData{err, nil, nil}) + rend.writeError(w, r, &htmlTemplateData{err, nil, nil, err}) } } } diff --git a/src/style.css b/src/style.css index 185bdcc2..da42b3fb 100644 --- a/src/style.css +++ b/src/style.css @@ -93,3 +93,7 @@ ul.karmen-related-elements { background-color: black; color: white; } + +.uppercase:valid { + text-transform: uppercase; +} diff --git a/templates/participants_add_update.html.tpl b/templates/participants_add_update.html.tpl index 7d4c860e..90ddb0d9 100644 --- a/templates/participants_add_update.html.tpl +++ b/templates/participants_add_update.html.tpl @@ -30,7 +30,14 @@ - {{$options := ` { name: "FiscalCode",id: "participant_fiscalcode",label: "Codice fiscale del partecipante",placeholder: "Inserire il codice fiscale",type: "text",required: "true"} `}} + {{$options := ` + name: "FiscalCode" + id: "participant_fiscalcode" + label: "Codice fiscale del partecipante" + placeholder: "Inserire il codice fiscale" + type: "text" + inputClass: "form-control uppercase" + required: "true" `}} {{template "input" dict "options" ($options|yaml) "value" (.Data|field "FiscalCode") "update" $update}} {{$options := ` { name: "contest_ids", id: "contest_ids", label: "Gare a cui il partecipante รจ iscritto", title: "Seleziona le gare", multiple: "true"}`}}