xiaomianao666

邀您一起看:好学电子课本网-人教版一年级语文下册

Jul 12th, 2024
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥好学电子课本网-人教版一年级语文下册@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuS4gOe6p+WIhuexu1wiLFwicGF0aFwiOlwieWlcIixcInJ1bGVcIjpcImpzOlxcbi8qXFxuYnkgzrEoemV0YWxwaGEpXFxu5LiA57qn5bCB6KOFXFxu5Yqo5oCB5YiG57G7IOWIl+ihqOWIm+W7uiDoh6rliqjkuIvkuIDpobVcXG52ZXIgMjAyMzEwMTcgMS4wXFxuKi9cXG5cXG4vL+maj+acuuminOiJslxcbnZhciBnZXRSYW5nZUNvbG9ycyA9IGZ1bmN0aW9uKCkge1xcbiAgICByZXR1cm4gJyMnICsgKCcwMDAwMCcgKyAoTWF0aC5yYW5kb20oKSAqIDB4MTAwMDAwMCA8PCAwKS50b1N0cmluZygxNikpLnN1YnN0cigtNik7XFxufVxcblxcbi8v5Yqo5oCB5YiG57G7XFxuZnVuY3Rpb24gZHluYW1pY0NsYXNzKG9wdGlvbnMpIHtcXG4gICAgY29uc3Qgb2JqID0ge1xcbiAgICAgICAgLy/pu5jorqTlgL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gICAgICAgICAgICAgdGhpc1twcm9wZXJ0eV0gPSB2YWx1ZTtcXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVidWcpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHByb3BlcnR5ICsgXFxcIjpcXFwiICsgdmFsdWUpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9LFxcbiAgICAgICAgZXZhbEpTUnVsZShpdGVtLFxcbiAgICAgICAgICAgIGpzUnVsZSkge1xcbiAgICAgICAgICAgIGxldCBydWxlID0ganNSdWxlLnJlcGxhY2UoXFxcIkBqczpcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiXFxcIik7XFxuICAgICAgICAgICAgcnVsZSA9IHJ1bGUudHJpbSgpO1xcbiAgICAgICAgICAgIC8vbG9nKCQuc3RyaW5naWZ5KHJ1bGUpKVxcbiAgICAgICAgICAgIGxldCBpbnB1dCA9IGl0ZW07XFxuICAgICAgICAgICAgaWYgKHJ1bGUuc3RhcnRzV2l0aChcXFwiKFxcXCIpKSB7XFxuICAgICAgICAgICAgICAgIGV2YWwoXFxcInJlc3VsdCA9IFxcXCIgKyBydWxlKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAvKipcXG4gICAgICAgICAgICAgICAgICog6L+Y5Y6f5oiQICQudG9TdHJpbmcoLi4uKSDnmoTmnIDnu4jnu5PmnpzvvIzovr7liLDmnIDnu4jlpITnkIbmlrnlvI/ot5/kuIrpnaLnmoQgaWYg5LiA6Ie055qE55uu55qEXFxuICAgICAgICAgICAgICAgICAqL1xcbiAgICAgICAgICAgICAgICBldmFsKFxcXCJyZXN1bHQgPSBcXFwiICsgXFxcIigoKSA9PiB7XFxcIiArIHJ1bGUgKyBcXFwifSkoKVxcXCIpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0IHx8IFxcXCJcXFwiO1xcb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E55CGKHVybCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiB1cmwgfHwgXFxcIlxcXCI7XFxuICAgICAgICB9LFxcbiAgICAgICAgaXNOdWxsKHBhcmFtKSB7XFxuICAgICAgICAgICAgaWYgKHBhcmFtID09IG51bGwpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcXG4gICAgICAgIH0sXFxuICAgICAgICBpc0Jvb2xlYW4odmFyaWFibGUpIHtcXG4gICAgICAgICAgICBpZiAodHlwZW9mIHZhcmlhYmxlICE9PSBcXFwiYm9vbGVhblxcXCIpIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLlvIDlkK/mipjlj6Dor7fkvKDlhaXluIPlsJTlgLxcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LFxcbiAgICAgICAg5riF6ZmkKGxpc3QpIHtcXG4gICAgICAgICAgICBpZiAodGhpcy5pc051bGwobGlzdCkpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChsaXN0LmNvbnN0cnVjdG9yID09IFN0cmluZykge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIua4hemZpOaKpemUmTror7fkvKDliJfooahcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdGhpcy5jbGVhcnMgPSBsaXN0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOWFqOa4hShsaXN0KSB7XFxuICAgICAgICAgICAgaWYgKHRoaXMuaXNOdWxsKGxpc3QpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB2YXIgYyA9IHRoaXMuY2xlYXJhbGw7XFxuICAgICAgICAgICAgbGlzdCA9IGMuY29uY2F0KGxpc3QpO1xcbiAgICAgICAgICAgIHRoaXMuY2xlYXJhbGwgPSBsaXN0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOa6kOeggShpbnB1dCkge1xcbiAgICAgICAgICAgIHRoaXMuaHRtbCA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOeVjOmdoihpbnB1dCkge1xcbiAgICAgICAgICAgIHRoaXMubGF5b3V0ID0gaW5wdXQ7XFxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgICB9LFxcbiAgICAgICAg6aG156CBKGlucHV0KSB7XFxuICAgICAgICAgICAgdGhpcy5wYWdlID0gaW5wdXQ7XFxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgICB9LFxcbiAgICAgICAg54q25oCBKGlucHV0KSB7XFxuICAgICAgICAgICAgdGhpcy5zdGF0ZSA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOW8gOWQr+aQnOe0oihpbnB1dCkge1xcbiAgICAgICAgICAgIGlmIChpbnB1dCA9PSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICAgICAgaW5wdXQgPSB0cnVlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0aGlzLnNlYXJjaCA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOW8gOWQr+aKmOWPoChpbnB1dCkge1xcbiAgICAgICAgICAgIGlmIChpbnB1dCA9PSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICAgICAgaW5wdXQgPSB0cnVlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0aGlzLmlzQm9vbGVhbihpbnB1dCk7XFxuICAgICAgICAgICAgdGhpcy5vcGVuID0gaW5wdXQ7XFxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgICB9LFxcbiAgICAgICAgc2V0VGl0bGUoaywgaSwgdCkge1xcbiAgICAgICAgICAgIHJldHVybiBrID09IGkgPyBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIHQuZm9udGNvbG9yKHRoaXMu5YiG57G76aKc6ImyKSA6IHQ7XFxuICAgICAgICB9LFxcbiAgICAgICAgYWN0aW9uKG9iaikge1xcbiAgICAgICAgICAgIHJldHVybiBbe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIua4hemZpOeKtuaAgVxcXCIsXFxuICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChvYmopID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhvYmopO1xcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihvYmouc3RhdGUpO1xcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwiaGVhZC5jYXRlXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdjYXRlX2J1dHRvbicpO1xcbiAgICAgICAgICAgICAgICAgICAgb2JqLmFsbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgb2JqLmNsLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICB9LCBvYmopLFxcbiAgICAgICAgICAgIH0sIF07XFxuICAgICAgICB9LFxcbiAgICAgICAgY2hlY2tQYXJhbSgpIHtcXG4gICAgICAgICAgICB2YXIgb2JqID0ge307XFxuICAgICAgICAgICAgaWYgKHRoaXMucGFnZSA9PSAwICYmIHR5cGVvZiBwYWdlID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi6K+35Lyg5YWl6aG156CBXFxcIik7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBwYWdlID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBvYmpbXFxcIumhteeggVxcXCJdID0gdGhpcy5wYWdlO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLpobXnoIFcXFwiXSA9IHBhZ2U7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHRoaXMuaHRtbCA9PSBcXFwiZW1wdHlcXFwiICYmIHR5cGVvZiBodG1sID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi6K+35Lyg5YWl5rqQ56CBXFxcIik7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBodG1sID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBvYmpbXFxcIua6kOeggVxcXCJdID0gdGhpcy5odG1sO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLmupDnoIFcXFwiXSA9IGh0bWw7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHRoaXMubGF5b3V0ID09IFxcXCJ1bmRlZmluZWRcXFwiICYmIHR5cGVvZiBkID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi6K+35Lyg5YWl55WM6Z2iXFxcIik7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBkID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBvYmpbXFxcIueVjOmdolxcXCJdID0gdGhpcy5sYXlvdXQ7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBvYmpbXFxcIueVjOmdolxcXCJdID0gZDtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gb2JqO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOWIm+W7uuWKqOaAgeWIhuexuyhydWxlT2JqKSB7XFxuICAgICAgICAgICAgbGV0IGl0ZW1zID0gW107XFxuICAgICAgICAgICAgbGV0IGNhdGVzID0gW107XFxuICAgICAgICAgICAgaWYgKHJ1bGVPYmogPT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgIHJ1bGVPYmogPSBbXTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgLy/liJ3lp4vljJblj5jph4/lvIDlp4tcXG4gICAgICAgICAgICBjb25zdCBwYXJhbSA9IHRoaXMuY2hlY2tQYXJhbSgpO1xcbiAgICAgICAgICAgIGNvbnN0IHBhZ2UgPSBwYXJhbS7pobXnoIE7XFxuICAgICAgICAgICAgY29uc3QgaHRtbCA9IHBhcmFtLua6kOeggTtcXG4gICAgICAgICAgICBjb25zdCBkID0gcGFyYW0u55WM6Z2iO1xcbiAgICAgICAgICAgIGNvbnN0IOeKtuaAgSA9IHRoaXMuc3RhdGU7XFxuICAgICAgICAgICAgY29uc3Qgc2VhcmNoID0gdGhpcy5zZWFyY2g7XFxuICAgICAgICAgICAgY29uc3QgZW1wdHkgPSBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICAgICAgY29uc3Qg5oqY5Y+g54q25oCBID0gdGhpcy5vcGVuO1xcbiAgICAgICAgICAgIHZhciDlsZXlvIAgPSB0aGlzLuWxleW8gDtcXG4gICAgICAgICAgICB2YXIg5oqY5Y+gID0gdGhpcy7mipjlj6A7XFxuICAgICAgICAgICAgdmFyIOWFqOa4hSA9IHRoaXMuY2xlYXJhbGw7XFxuICAgICAgICAgICAgdmFyIOa4hemZpCA9IHRoaXMuY2xlYXJzO1xcbiAgICAgICAgICAgIC8v5Yid5aeL5YyW5Y+Y6YeP57uT5p2fXFxuICAgICAgICAgICAgbGV0IGluaXRfY2F0ZSA9IG5ldyBBcnJheSgyMCkuZmlsbChcXFwiMFxcXCIpO1xcbiAgICAgICAgICAgIGNvbnN0IGZvbGQgPSBnZXRNeVZhcihNWV9SVUxFLmdyb3VwLCBcXFwiMFxcXCIpO1xcbiAgICAgICAgICAgIGNvbnN0IGNhdGVfdGVtcCA9IEpTT04ucGFyc2UoXFxuICAgICAgICAgICAgICAgIGdldE15VmFyKFxcXCJoZWFkLmNhdGVcXFwiLCBKU09OLnN0cmluZ2lmeShpbml0X2NhdGUpKVxcbiAgICAgICAgICAgICk7XFxuICAgICAgICAgICAgaWYgKHNlYXJjaCAmJiBwYWdlID09IDEpIHtcXG4gICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCInaGlrZXI6Ly9zZWFyY2g/cnVsZT1cXFwiICsgTVlfUlVMRS50aXRsZSArIFxcXCImcz0nK2lucHV0XFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCLmkJzntKLlhbPplK7or41cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJpbnB1dFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZ2V0TXlWYXIoXFxcImtleXdvcmRcXFwiLCBcXFwiXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgb25DaGFuZ2U6ICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwia2V5d29yZFxcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBjb25zdCBjYXRlZ29yaWVzID0gW107XFxuICAgICAgICAgICAgcnVsZU9iai5mb3JFYWNoKCh4KSA9PiB7XFxuICAgICAgICAgICAgICAgIHZhciBsaXN0ID0gW107XFxuICAgICAgICAgICAgICAgIC8vbG9nKHgpXFxuICAgICAgICAgICAgICAgIGlmICh4Lmpzb24gIT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgICAgICB4Lmpzb24ubWFwKGsgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVnb3JpZXMucHVzaChKU09OLnN0cmluZ2lmeShrKS5yZXBsYWNlKC9eXFxcXFt8XFxcXF0kL2csICcnKSlcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAvL2NhdGVnb3JpZXMucHVzaCh4Lmpzb24pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKHgu5LiA57qn5a6a5L2NKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoeC7kuIDnuqflrprkvY0uc3RhcnRzV2l0aChcXFwiQGpzOlxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShodG1sLCB4LuS4gOe6p+WumuS9jSk7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3QgPSBwZGZhKGh0bWwsIHgu5LiA57qn5a6a5L2NKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZiAoeC7lpKfnsbvlrprkvY0pIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmICh4LuWkp+exu+WumuS9jS5zdGFydHNXaXRoKFxcXCJAanM6XFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaXN0ID0gdGhpcy5ldmFsSlNSdWxlKGh0bWwsIHgu5aSn57G75a6a5L2NKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGlzdCA9IFtwZGZhKGh0bWwsIHgu5aSn57G75a6a5L2NKS5qb2luKCdcXFxcbicpXTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcblxcblxcbiAgICAgICAgdmFyIOS4gOe6pyA9IGxpc3QubWFwKChzKSA9PiB7XFxuICAgICAgICAgIHZhciBzbGlzdCA9IFtdO1xcbiAgICAgICAgICBpZiAoIShcXFwi5bCP57G7XFxcIiBpbiB4KSkge1xcbiAgICAgICAgICAgIHgu5bCP57G7ID0gXFxcImJvZHkmJmE6bm90KDptYXRjaGVzKOmmlumhtSkpOm5vdChhOm5vdChbaHJlZl0pKVxcXCI7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgaWYgKHgu5bCP57G7LnN0YXJ0c1dpdGgoXFxcIkBqczpcXFwiKSkge1xcbiAgICAgICAgICAgIHNsaXN0ID0gdGhpcy5ldmFsSlNSdWxlKHMsIHgu5bCP57G7KTtcXG4gICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBzbGlzdCA9IHBkZmEocywgeC7lsI/nsbspO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIC8vLS3pop3lpJblpITnkIYtLVxcbiAgICAgICAgICBpZiAoKCflop7liqAnIGluIHgpKSB7XFxuICAgICAgICAgICAgaWYgKHgu5aKe5YqgLmNvbnN0cnVjdG9yID09IFN0cmluZykge1xcbiAgICAgICAgICAgICAgeC7lop7liqAgPSBldmFsKHgu5aKe5YqgKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgc2xpc3QgPSB4LuWinuWKoC5jb25jYXQoc2xpc3QpO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIGlmICgoJ+ihpeWFhScgaW4geCkpIHtcXG4gICAgICAgICAgICBpZiAoeC7ooaXlhYUuY29uc3RydWN0b3IgPT0gU3RyaW5nKSB7XFxuICAgICAgICAgICAgICB4LuihpeWFhSA9IGV2YWwoeC7ooaXlhYUpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBzbGlzdCA9IHNsaXN0LmNvbmNhdCh4LuihpeWFhSk7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgLy8tLemineWkluWkhOeQhi0tXFxuICAgICAgICAgIHZhciDlrprkvY0gPSBzbGlzdC5tYXAoKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSB0aGlzLmdldFRpdGxlKGl0ZW0sIHgu5qCH6aKYKTtcXG4gICAgICAgICAgICB2YXIgdXJsID0gdGhpcy5nZXRVcmwoaXRlbSwgeCk7XFxuICAgICAgICAgICAgdmFyIG9iaiA9IHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSwgdXJsOiB1cmxcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIGlmICgoJ2V4dCcgaW4geCkpIHtcXG4gICAgICAgICAgICAgIG9ialsnZXh0J10gPSB4LmV4dDtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KG9iaik7XFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICByZXR1cm4g5a6a5L2NO1xcbiAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIC8vbG9nKOS4gOe6pylcXG4gICAgICAgICAgICAgICAgLy9sb2co5LiA57qnLmxlbmd0aClcXG4gICAgICAgICAgICAgICAgaWYgKOS4gOe6py5sZW5ndGggPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKOS4gOe6py5qb2luKFxcXCJcXFxcblxcXCIpKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIOS4gOe6py5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKGl0ZW0uam9pbihcXFwiLFxcXCIpKTtcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8vbG9nKGNhdGVnb3JpZXMpXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgaWYgKOaKmOWPoOeKtuaAgSkge1xcbiAgICAgICAgICAgICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogZm9sZCA9PT0gXFxcIjFcXFwiID8g5oqY5Y+gIDog5bGV5byALFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZShcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKHRpdGxlLCBmb2xkLCB1LCBhbGwsIGV4cHMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmb2xkID0gZ2V0TXlWYXIoTVlfUlVMRS5ncm91cCwgZm9sZCk7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgW+WxleW8gCwg5oqY5Y+gXSA9IGV4cHM7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZm9sZCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGN4ID0gZmluZEl0ZW1zQnlDbHModGl0bGUgKyAnY2F0ZV9idXR0b24nKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignY2F0ZV9idXR0b24nLCBjeCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHRpdGxlICsgJ2NhdGVfYnV0dG9uJyk7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjeCA9IHN0b3JhZ2UwLmdldE15VmFyKCdjYXRlX2J1dHRvbicsIFtdKS5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhbJ2NvbF90eXBlJ10gPSB4Wydjb2xfdHlwZSddID8geFsnY29sX3R5cGUnXSA6IHhbJ3R5cGUnXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHg7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKHRpdGxlICsgJ2NhdGVfbGluZScsIGN4KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyphbGwuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7Ki9cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0odGl0bGUgKyAnY2F0ZV9leHAnLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGZvbGQgPT0gMSA/IOWxleW8gCA6IOaKmOWPoCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihNWV9SVUxFLmdyb3VwLCBmb2xkID09PSBcXFwiMVxcXCIgPyBcXFwiMFxcXCIgOiBcXFwiMVxcXCIpO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9yZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBNWV9SVUxFLnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb2xkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICDnirbmgIEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIOWFqOa4hSwgW+WxleW8gCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIOaKmOWPoFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICksXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogTVlfUlVMRS50aXRsZSArICdjYXRlX2V4cCcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogdGhpcy5hY3Rpb24oe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IOeKtuaAgSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbDog5YWo5riFLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2w6IOa4hemZpCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5mb3JFYWNoKChjYXRlZ29yeSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKGNhdGVnb3J5KVxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHN1Yl9jYXRlZ29yaWVzID0gW107XFxuICAgICAgICAgICAgICAgICAgICAvKmlmICjlsI/nsbvlrprkvY0uaW5jbHVkZXMoXFxcIjtcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jS5zcGxpdChcXFwiO1xcXCIpWzBdKTtcXG4gICAgICAgICAgICAgICAgICAgICAgaWYgKHN1Yl9jYXRlZ29yaWVzLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMgPSBwZGZhKGNhdGVnb3J5LCDlsI/nsbvlrprkvY0uc3BsaXQoXFxcIjtcXFwiKVsxXSk7XFxuICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ki9cXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKGluZGV4KVxcbiAgICAgICAgICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMgPSBKU09OLnBhcnNlKGBbJHtjYXRlZ29yeX1dYCk7XFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhzdWJfY2F0ZWdvcmllcylcXG4gICAgICAgICAgICAgICAgICAgIC8vIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NKTtcXG4gICAgICAgICAgICAgICAgICAgIC8vfVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGluZGV4ID09PSAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgLy/lpKfnsbtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sZXQgdGl0bGUgPSBwZGZoKGl0ZW0sIF/lpKfnsbvmoIfpopgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdGl0bGUgPSBpdGVtLnRpdGxlO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIOaOkumZpCAhPSBcXFwidW5kZWZpbmVkXFxcIiAmJiDmjpLpmaQgIT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gdGl0bGUucmVwbGFjZShuZXdSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGpzb24gPSAnJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBwYXJhbXMgPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleToga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyczog5riF6ZmkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbjoganNvbixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sZXQgdXJsID0gcGQoaXRlbSwgX+Wkp+exu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB1cmwgPSBpdGVtLnVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLyppZiAo5aSn57G75aSE55CGKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsID0g5LiA57qn5YiG57G75aSE55CGKHVybCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0qL1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyh1cmwpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRoaXMuc2V0VGl0bGUoa2V5LnRvU3RyaW5nKCksIGNhdGVfdGVtcFtpbmRleF0sIHRpdGxlKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQoXFxcImhpa2VyOi8vZW1wdHkjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5ld19jYXRlID0gW107XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5jbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2NhdGVfYnV0dG9uJyk7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXAuZm9yRWFjaCgoY2F0ZSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld19jYXRlLnB1c2goaW5kZXggPT09IDAgPyBwYXJhbXMua2V5LnRvU3RyaW5nKCkgOiBcXFwiMFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIsIEpTT04uc3RyaW5naWZ5KG5ld19jYXRlKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYXJhbXMuanNvbi5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiZHRfXFxcIiArIHBhcmFtcy5qc29uLnR5cGUsIHBhcmFtcy5qc29uLnZhbHVlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHBhcmFtcy5zdGF0ZSwgcGFyYW1zLmpzb24pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKHRydWUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IE1ZX1JVTEUudGl0bGUgKyAnY2F0ZV9saW5lJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL+Wwj+exu1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzLmZvckVhY2goKGl0ZW0sIGtleSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZXh0cmFwb3MgPSBmYWxzZTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLyppZiAoaXRlbS5pbmNsdWRlcygndHlwZT1cXFwiQGV4dHJhXFxcIicpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFwb3MgPSB0cnVlO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKCfpmYTliqDlrprkvY0nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ki9cXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGV4dHJhcG9zKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSBwZGZoKGl0ZW0sIFxcXCJhJiZUZXh0XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIOaOkumZpCAhPSBcXFwidW5kZWZpbmVkXFxcIiAmJiDmjpLpmaQgIT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBqc29uID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHBkZmgoaXRlbSwgXFxcImEmJnN0YXRlXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwgXFxcImEmJnZhbHVlXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy92YXIgdGl0bGUgPSBwZGZoKGl0ZW0sIOWIhuexu+agh+mimCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSBpdGVtLnRpdGxlO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiDmjpLpmaQgIT0gXFxcInVuZGVmaW5lZFxcXCIgJiYg5o6S6ZmkICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIganNvbiA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLypzd2l0Y2ggKHRydWUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSDliIbnsbvpk77mjqUuaW5jbHVkZXMoXFxcIkBAQFxcXCIpOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBAXFxcIilbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXCJAQEBcXFwiKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSDliIbnsbvpk77mjqUuaW5jbHVkZXMoXFxcIkBAXFxcIik6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBcXFwiKVswXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBcXFwiKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8ganNvbiA9IHBkKGl0ZW0sIOWIhuexu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ki9cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qdmFyIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQEAnKT97XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzFdKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTpwZChpdGVtLOWIhuexu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQCcpP3tcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU65YiG57G76ZO+5o6lLnNwbGl0KCdAQCcpWzBdLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH06cGQoaXRlbSzliIbnsbvpk77mjqUpOyovXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHBhcmFtcyA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiBrZXksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBwYWdlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbjoganNvbixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGhpcy5zZXRUaXRsZShrZXkudG9TdHJpbmcoKSwgY2F0ZV90ZW1wW2luZGV4XSwgdGl0bGUpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB0aXRsZSA9PSBcXFwi8J2QhfCdkILwnZ+QXFxcIiA/IFxcXCJoaWtlcjovL3BhZ2UvZmMyP3VybD1cXFwiICsgZ2V0TXlWYXIoXFxcImZjMlxcXCIpICsgXFxcIiNmeXBhZ2Ujbm9IaXN0b3J5I1xcXCIgOiAkKFxcXCJoaWtlcjovL2VtcHR5XFxcIiArIFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmFsbGNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcignY2F0ZV9idXR0b24nKTtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmNhdGVfdGVtcFtwYXJhbXMuaW5kZXhdID0gcGFyYW1zLmtleS50b1N0cmluZygpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaGVhZC5jYXRlXFxcIiwgSlNPTi5zdHJpbmdpZnkocGFyYW1zLmNhdGVfdGVtcCkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmpzb24uY29uc3RydWN0b3IgPT09IE9iamVjdCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImR0X1xcXCIgKyBwYXJhbXMuanNvbi50eXBlLCBwYXJhbXMuanNvbi52YWx1ZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIHBhcmFtcy5qc29uKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogTVlfUlVMRS50aXRsZSArICdjYXRlX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVzLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogTVlfUlVMRS50aXRsZSArICdjYXRlX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChmb2xkID09PSBcXFwiMVxcXCIgfHwg5oqY5Y+g54q25oCBID09IGZhbHNlKSB7XFxuICAgICAgICAgICAgICAgIGl0ZW1zID0gaXRlbXMuY29uY2F0KGNhdGVzKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGZvbGQgPT09IFxcXCIwXFxcIikge1xcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignY2F0ZV9idXR0b24nLCBjYXRlcylcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHR5cGVvZiBzZXRQcmVSZXN1bHQgIT0gJ3VuZGVmaW5lZCcpIHtcXG4gICAgICAgICAgICAgICAgaXRlbXMgPSBkLmNvbmNhdChpdGVtcyk7XFxuICAgICAgICAgICAgICAgIC8v5riF56m657un5om/5pWw57uEXFxuICAgICAgICAgICAgICAgIGQubGVuZ3RoID0gMDtcXG4gICAgICAgICAgICAgICAgc2V0UHJlUmVzdWx0KGl0ZW1zKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBpdGVtcy5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sXFxuICAgIH07XFxuICAgIG9iai7pooTorr4ob3B0aW9ucyk7XFxuICAgIHJldHVybiBvYmo7XFxufVxcblxcbnZhciDnirbmgIEgPVxcbiAgICB0eXBlb2Yg54q25oCB5qCH6K6wICE9IFxcXCJ1bmRlZmluZWRcXFwiICYmIOeKtuaAgeagh+iusCAhPSBcXFwiXFxcIiA/IOeKtuaAgeagh+iusCA6IE1ZX1JVTEUudXJsO1xcblxcbmxldCBkdF9kZWJ1ZyA9IGZhbHNlO1xcblxcbmFkZExpc3RlbmVyKFxcbiAgICBcXFwib25DbG9zZVxcXCIsXFxuICAgICQudG9TdHJpbmcoKCkgPT4ge30pXFxuKTtcXG5cXG52YXIgQ3JlYXRlID0ge1xcbiAgICBuZXh0UGFnZTogZnVuY3Rpb24oKSB7XFxuICAgICAgICB2YXIgcmVzdWx0ID0gZmFsc2U7XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIHZhciBuZXh0ID0gZXZhbCjkuIvkuIDpobUpO1xcbiAgICAgICAgICAgIC8vbG9nKCduOicrbmV4dClcXG4gICAgICAgICAgICBpZiAobmV4dCA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ+S4i+S4gOmhtemTvuaOpeS4uuepuicpXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJlc3VsdCA9IHRydWU7XFxuICAgICAgICAgICAgaWYgKHRydWVfdXJsID09IG5leHQpIHtcXG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIC8vbG9nKFxcXCLlj6/og73kuI3lrZjlnKjkuIvkuIDpobXmiJbogIXkuIvkuIDpobXlrprkvY3mnInpl67pophcXFwiKTtcXG4gICAgICAgICAgICAvL2xvZyhcXFwi6ZSZ6K+v5L+h5oGvOlxcXCIgKyBlLm1lc3NhZ2UpO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKChuZXh0ID09IFxcXCJcXFwiIHx8IG5leHQgPT0gdW5kZWZpbmVkKSAmJiBwYWdlID09IDEpIHtcXG4gICAgICAgICAgICBuZXh0ID0gdHJ1ZV91cmw7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIC8vcmVzdWx0PWZhbHNlO1xcbiAgICAgICAgICAgIG5leHQgPSBnZXRNeVZhcijnirbmgIEpO1xcbiAgICAgICAgfVxcbiAgICAgICAgLy9sb2coJ2wnK3RydWVfdXJsKVxcbiAgICAgICAgLy9sb2coJ24nK25leHQpXFxuICAgICAgICBpZiAocGFnZSAhPSAxKSB7XFxuICAgICAgICAgICAgaWYgKHRydWVfdXJsID09IG5leHQgJiYgIXJlc3VsdCkge1xcbiAgICAgICAgICAgICAgICByZXN1bHQgPSBmYWxzZTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICByZXN1bHQgPSB0cnVlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiByZXN1bHQ7XFxuICAgICAgICAvL3B1dE15VmFyKOeKtuaAgSwgbmV4dCk7XFxuICAgIH0sXFxuICAgIGdldEJhY2tJbWFnZTogZnVuY3Rpb24oaW1ndXJsKSB7XFxuICAgICAgICB2YXIgcmVzdWx0ID0gaW1ndXJsO1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICByZXN1bHQgPSAvdXJsKD86XFxcXHMrKT9cXFxcKCguKj8pXFxcXCkvZ1xcbiAgICAgICAgICAgICAgICAuZXhlYyhpbWd1cmwpWzFdXFxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8oJ3xcXFwifCZxdW90OykvZ20sIFxcXCJcXFwiKTtcXG4gICAgICAgIH0gY2F0Y2gge31cXG4gICAgICAgIHJldHVybiByZXN1bHQ7XFxuICAgIH0sXFxuICAgIGh0dHBIYW5kbGU6IGZ1bmN0aW9uKGlucHV0KSB7XFxuICAgICAgICBpZ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Dnu5Pmnpw6ICAke29iai5pbWd9YCArXFxuICAgICAgICAgICAgKHJ1bGUuY29udGVudCAhPSB1bmRlZmluZWQgPyBgXFxcXG5cXFxcdGNvbnRlbnTlrprkvY06ICAke3J1bGUuY29udGVudH0gIC0tLT4g57uT5p6cOiAgJHtvYmouY29udGVudH1gIDogJycpICtcXG4gICAgICAgICAgICBgXFxcXG5cXFxcdHVybOWumuS9jTogICR7cnVsZS51cmx9ICAtLS0+IOe7k+aenDogICR7b2JqLnVybH1gXFxuICAgICAgICApO1xcbiAgICAgICAgbG9nKCctLS0tLS0tLS0tJyArIChpICsgMSkgKyAnOuiwg+ivlee7k+adny0tLS0tLS0tLS0nKTtcXG4gICAgfSxcXG4gICAganNvbkxpc3Q6IGZ1bmN0aW9uKGFyciwganNvbiwgcnVsZSkge1xcbiAgICAgICAgaWYgKGpzb24uY29uc3RydWN0b3IgIT0gT2JqZWN0KSB7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAganNvbiA9IEpTT04ucGFyc2UoanNvbik7XFxuICAgICAgICAgICAgfSBjYXRjaCB7fVxcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGpzb25bcnVsZS5saXN0XSA9PSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICBhcnIucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdPGZvbnQgY29sb3I9XFxcImdyZXlcXFwiPjxzbWFsbD7ml6DlhoXlrrk8L3NtYWxsPjwvZm9udD4nLFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHt9LFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBkZWJ1ZyA9IHRoaXMuZ2V0Qm9vbGVhblZhbHVlKHJ1bGUuZGVidWcsIGZhbHNlKTtcXG4gICAgICAgIHZhciBlbXB0eSA9IHRoaXMuZ2V0Qm9vbGVhblZhbHVlKHJ1bGUuZW1wdHkpO1xcbiAgICAgICAgaWYgKGRlYnVnKSB7XFxuICAgICAgICAgICAgbG9nKCflrprkvY3liJfooag6JyArIHJ1bGUubGlzdCk7XFxuICAgICAgICB9XFxuICAgICAgICBqc29uW3J1bGUubGlzdF0uZm9yRWFjaCgoaXRlbSwgaSkgPT4ge1xcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IGV2YWwocnVsZS50aXRsZSk7XFxuICAgICAgICAgICAgdmFyIGRlc2MgPSBldmFsKHJ1bGUuZGVzYyk7XFxuICAgICAgICAgICAgdmFyIGNvbnRlbnQgPSBldmFsKHJ1bGUuY29udGVudCk7XFxuICAgICAgICAgICAgdmFyIGltZyA9IGV2YWwocnVsZS5pbWcpICsgcnVsZS5yZWY7XFxuICAgICAgICAgICAgdmFyIGhyZWYgPSBldmFsKHJ1bGUudXJsKTtcXG4gICAgICAgICAgICB2YXIgdXJsID0gcnVsZS5pbXQgPyBocmVmICsgXFxcIiNpbW1lcnNpdmVUaGVtZSNcXFwiIDogaHJlZjtcXG4gICAgICAgICAgICB2YXIgbGF6eSA9IHJ1bGUubGF6eSA/IHJ1bGUubGF6eSA6IFxcXCJcXFwiO1xcblxcbiAgICAgICAgICAgIHZhciBkZCA9IHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBkZXNjLFxcbiAgICAgICAgICAgICAgICBjb250ZW50OiBjb250ZW50LFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBpbWcsXFxuICAgICAgICAgICAgICAgIHVybDogKGVtcHR5ID8gXFxcImhpa2VyOi8vZW1wdHkjI1xcXCIgOiAnJykgKyB1cmwsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBydWxlLmNvbF90eXBlLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIH07XFxuXFxuICAgICAgICAgICAgaWYgKGRlYnVnKSB7XFxuICAgICAgICAgICAgICAgIHZhciByeCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYyxcXG4gICAgICAgICAgICAgICAgICAgIGltZyxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICB1cmxcXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgdGhpcy5kZWJ1Z2xvZyhpLCBpdGVtLCBydWxlLCByeCk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGlmIChsYXp5ICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGRkW1xcXCJ1cmxcXFwiXSA9IGhyZWYgKyBsYXp5O1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBhcnIucHVzaChkZCk7XFxuICAgICAgICB9KTtcXG4gICAgfSxcXG4gICAgcnVsZUxpc3Q6IGZ1bmN0aW9uKGFyciwgaHRtbCwgcnVsZSkge1xcbiAgICAgICAgdmFyIGxpc3QgPSBwZGZhKGh0bWwsXFxuICAgICAgICAgICAgcnVsZS5saXN0KTtcXG4gICAgICAgIHZhciBkZWJ1ZyA9IHRoaXMuZ2V0Qm9vbGVhblZhbHVlKHJ1bGUuZGVidWcsXFxuICAgICAgICAgICAgZmFsc2UpO1xcbiAgICAgICAgdmFyIGVtcHR5ID0gdGhpcy5nZXRCb29sZWFuVmFsdWUocnVsZS5lbXB0eSk7XFxuICAgICAgICBpZiAoZGVidWcpIHtcXG4gICAgICAgICAgICBsb2coJ+WumuS9jeWIl+ihqDonICsgcnVsZS5saXN0KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGxpc3QuZm9yRWFjaCgoaXRlbSwgaSkgPT4ge1xcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLnRpdGxlKTtcXG4gICAgICAgICAgICB2YXIgZGVzYyA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmRlc2MpO1xcbiAgICAgICAgICAgIHZhciBkZXNjMSA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmRlc2MxKTtcXG4gICAgICAgICAgICB2YXIgZGVzYzIgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS5kZXNjMik7XFxuICAgICAgICAgICAgdmFyIGltZyA9IHRoaXMuaW1nSGFuZGxlKGl0ZW0sIHJ1bGUpO1xcbiAgICAgICAgICAgIHZhciB1cmwgPSB0aGlzLnVybEhhbmRsZShpdGVtLCBydWxlKTtcXG4gICAgICAgICAgICB2YXIgY29udGVudCA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmNvbnRlbnQpO1xcblxcbiAgICAgICAgICAgIGlmIChkZWJ1Zykge1xcbiAgICAgICAgICAgICAgICB2YXIgcnggPSB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2MsXFxuICAgICAgICAgICAgICAgICAgICBpbWcsXFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50LFxcbiAgICAgICAgICAgICAgICAgICAgdXJsXFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgIHRoaXMuZGVidWdsb2coaSwgaXRlbSwgcnVsZSwgcngpO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICB2YXIgbGF6eSA9IHJ1bGUubGF6eSA/IHJ1bGUubGF6eSA6IFxcXCJcXFwiO1xcbiAgICAgICAgICAgIHZhciBkZCA9IHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBkZXNjMSArIFxcXCJcXFxcdFxcXFx0XFxcXHRcXFxcdFxcXCIgKyBkZXNjLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBpbWcsXFxuICAgICAgICAgICAgICAgIHVybDogKGVtcHR5ID8gJ2hpa2VyOi8vZW1wdHkjIycgOiAnJykgKyB1cmwgKyAnI25vSGlzdG9yeSNAcnVsZT1qczokLnJlcXVpcmUoXFxcImVqXFxcIiknLFxcbiAgICAgICAgICAgICAgICBjb250ZW50OiBjb250ZW50LFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogcnVsZS5jb2xfdHlwZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn44CQ6Lez6aG144CRJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygodHJ1ZV91cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoJycsICcx5YiwODHkuYvpl7TnmoTnmoTpobXnoIEnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmlucHV0KCh0cnVlX3VybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhcnNlSW50KGlucHV0KSA+IDEgJiYgcGFyc2VJbnQoaW5wdXQpIDwgODEgJiYgcGFyc2VJbnQoaW5wdXQpICUgMSA9PSAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGp1bXB1ID0gdHJ1ZV91cmwucmVwbGFjZSgvKFxcXFw/cGFnZT1cXFxcZCt8XFxcXCZwYWdlPVxcXFxkK3wkKS8sIChtYXRjaCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobWF0Y2guc3RhcnRzV2l0aCgnP3BhZ2U9JykgfHwgbWF0Y2guc3RhcnRzV2l0aCgnJnBhZ2U9JykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtYXRjaC5jaGFyQXQoMCkgKyAncGFnZT0nICsgaW5wdXQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHRydWVfdXJsLmluY2x1ZGVzKCc/JykgPyAnJnBhZ2U9JyA6ICc/cGFnZT0nKSArIGlucHV0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0VmFyKE1ZX1JVTEUudXJsLCBqdW1wdSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ3lpX2ZpcnN0cGFnZScsIGp1bXB1KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+S9oOW3sue7j+epv+i2iuWIsOS6hicgKyBpbnB1dCArICfpobUnXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/or7fovpPlhaXmraPnoa7nmoTpobXnoIFcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRydWVfdXJsKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgdHJ1ZV91cmwpXFxuICAgICAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICBpZiAobGF6eSAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICBkZFtcXFwidXJsXFxcIl0gPSB1cmwgKyBsYXp5O1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBhcnIucHVzaChkZCk7XFxuICAgICAgICB9KTtcXG4gICAgfSxcXG4gICAgTGlzdDogZnVuY3Rpb24oYXJyLCBodG1sLCBydWxlLCBwYXJhbSkge1xcbiAgICAgICAgcGFyYW0gPSBwYXJhbSA/IHBhcmFtIDoge307XFxuICAgICAgICB2YXIgYXV0byA9IHBhcmFtLmF1dG8gPyBwYXJhbS5hdXRvIDogZmFsc2U7XFxuICAgICAgICB2YXIgc2hvdyA9IHBhcmFtLnNob3cgPyBwYXJhbS5zaG93IDogZmFsc2U7XFxuICAgICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgLy90aGlzLnNwYWdlLnNldCh0cnVlX3VybCk7XFxuICAgICAgICB9XFxuICAgICAgICB0aGlzLnJlZnJlc2goKTtcXG4gICAgICAgIHZhciBkZWJ1ZyA9IHRoaXMuZ2V0Qm9vbGVhblZhbHVlKHJ1bGUuZGVidWcsIGZhbHNlKTtcXG4gICAgICAgIHZhciBlbXB0eSA9IHRoaXMuZ2V0Qm9vbGVhblZhbHVlKHJ1bGUuZW1wdHkpO1xcbiAgICAgICAgdmFyIGxpc3QgPSBwZGZhKGh0bWwsIHJ1bGUubGlzdCk7XFxuICAgICAgICBpZiAoZGVidWcpIHtcXG4gICAgICAgICAgICBsb2coJ+WumuS9jeWIl+ihqDonICsgcnVsZS5saXN0KTtcXG4gICAgICAgIH1cXG4gICAgICAgIC8vbG9nKHRoaXMubmV4dFBhZ2UoKSlcXG4gICAgICAgIGlmICgoc3RvcmFnZTAuZ2V0TXlWYXIoJ3lpX2lzbmV4dCcsICd0JykgPT0gJ3QnICYmIGxpc3QubGVuZ3RoID4gMCkgfHwgcGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgbGlzdC5mb3JFYWNoKChpdGVtLCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0oXFxcInBhZ2VudW1cXFwiKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbShcXFwicGFnZWxpbmVcXFwiKTtcXG4gICAgICAgICAgICAgICAgdmFyIGlkID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgICAgIHZhciBjbHMgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUudGl0bGUpO1xcbiAgICAgICAgICAgICAgICB2YXIgZGVzYyA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmRlc2MpO1xcbiAgICAgICAgICAgICAgICB2YXIgaW1nID0gdGhpcy5pbWdIYW5kbGUoaXRlbSwgcnVsZSk7XFxuICAgICAgICAgICAgICAgIHZhciB1cmwgPSB0aGlzLnVybEhhbmRsZShpdGVtLCBydWxlKTtcXG4gICAgICAgICAgICAgICAgdmFyIGNvbnRlbnQgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS5jb250ZW50KTtcXG5cXG4gICAgICAgICAgICAgICAgaWYgKGRlYnVnKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcnggPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbWcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudCxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmxcXG4gICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICB0aGlzLmRlYnVnbG9nKGksIGl0ZW0sIHJ1bGUsIHJ4KTtcXG4gICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICBpZiAoaSA9PSBsaXN0Lmxlbmd0aCAtIDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIGlkID0gXFxcImxhc3RpZF9cXFwiICsgcGFnZTtcXG4gICAgICAgICAgICAgICAgICAgIGNscyA9IFxcXCJsYXN0bWFya1xcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBpbWcsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IChlbXB0eSA/IFxcXCJoaWtlcjovL2VtcHR5IyNcXFwiIDogJycpICsgdXJsICsgJz9wYWdlPWZ5cGFnZSNub0hpc3RvcnkjQHJ1bGU9anM6JC5yZXF1aXJlKFxcXCJ5alxcXCIpJyxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogcnVsZS5jb2xfdHlwZSxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZDogaWQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBjbHMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn44CQ6Lez6aG144CRJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygodHJ1ZV91cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoJycsICcx5YiwMzHkuYvpl7TnmoTnmoTpobXnoIEnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmlucHV0KCh0cnVlX3VybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhcnNlSW50KGlucHV0KSA+IDEgJiYgcGFyc2VJbnQoaW5wdXQpIDwgODEgJiYgcGFyc2VJbnQoaW5wdXQpICUgMSA9PSAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGp1bXB1ID0gdHJ1ZV91cmwucmVwbGFjZSgvKFxcXFw/cGFnZT1cXFxcZCt8XFxcXCZwYWdlPVxcXFxkK3wkKS8sIChtYXRjaCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobWF0Y2guc3RhcnRzV2l0aCgnP3BhZ2U9JykgfHwgbWF0Y2guc3RhcnRzV2l0aCgnJnBhZ2U9JykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtYXRjaC5jaGFyQXQoMCkgKyAncGFnZT0nICsgaW5wdXQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHRydWVfdXJsLmluY2x1ZGVzKCc/JykgPyAnJnBhZ2U9JyA6ICc/cGFnZT0nKSArIGlucHV0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0VmFyKE1ZX1JVTEUudXJsLCBqdW1wdSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ3lpX2ZpcnN0cGFnZScsIGp1bXB1KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+S9oOW3sue7j+epv+i2iuWIsOS6hicgKyBpbnB1dCArICfpobUnXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/or7fovpPlhaXmraPnoa7nmoTpobXnoIFcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRydWVfdXJsKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgdHJ1ZV91cmwpXFxuICAgICAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIGlmIChpID09IGxpc3QubGVuZ3RoIC0gMSAmJiBzaG93KSB7XFxuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IFxcXCJwYWdlbGluZVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnTxzbWFsbD7liqDovb3kuK0uLi48L3NtYWxsPlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogXFxcInBhZ2VudW1cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKFxcXCJwYWdlbnVtXFxcIiwge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnTxmb250IGNvbG9yPVxcXCJncmV5XFxcIj48c21hbGw+5Yiw5bqV5LqGPC9zbWFsbD48L2ZvbnQ+JyxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogXFxcImxhc3RcXFwiLFxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbi8qXFxuICAgICAgICBpZiAobGlzdC5sZW5ndGggPT0gMCAmJiBwYWdlID09IDEpIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVcXFwiLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdPGZvbnQgY29sb3I9XFxcImdyZXlcXFwiPjxzbWFsbD7ml6DlhoXlrrk8L3NtYWxsPjwvZm9udD4nLFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHt9LFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSovXFxuICAgICAgICBpZiAodGhpcy5uZXh0UGFnZSgpKSB7XFxuICAgICAgICAgICAgLy9sb2coJ3QnKTtcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcigneWlfaXNuZXh0JywgJ3QnKTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgLy9sb2coJ2YnKTtcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcigneWlfaXNuZXh0JywgJ2YnKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChhdXRvKSB7XFxuICAgICAgICAgICAgLy9jcmVhdGVOZXh0UGFnZSgpO1xcbiAgICAgICAgICAgIGF1dG9QYWdlKCk7XFxuICAgICAgICB9XFxuICAgIH0sXFxufTtcXG5cXG52YXIgZXh0TWV0aG9kID0ge1xcbiAgICBUb1BhcmFtczogZnVuY3Rpb24oKSB7XFxuICAgICAgICB2YXIganNvbiA9IGFyZ3VtZW50c1swXTtcXG4gICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhqc29uKVxcbiAgICAgICAgICAgIC5tYXAoKGtleSkgPT4ga2V5ICsgXFxcIj1cXFwiICsganNvbltrZXldKVxcbiAgICAgICAgICAgIC5qb2luKFxcXCImXFxcIik7XFxuICAgIH0sXFxuICAgIHVybFBhcnNlOiBmdW5jdGlvbih1KSB7XFxuICAgICAgICB2YXIgZGljdCA9IHt9O1xcbiAgICAgICAgZGljdC5Tb3VyY2UgPSB1O1xcbiAgICAgICAgbGV0IHBhcmFtcyA9ICh1cmwpID0+IHtcXG4gICAgICAgICAgICBsZXQgcXVlcnlQYXJhbXMgPSB7fTtcXG4gICAgICAgICAgICBsZXQgcmVnID0gLyhbXj89Jl0rKT0oW14/PSZdKykvZztcXG4gICAgICAgICAgICB1cmwucmVwbGFjZShyZWcsIGZ1bmN0aW9uKCkge1xcbiAgICAgICAgICAgICAgICBxdWVyeVBhcmFtc1thcmd1bWVudHNbMV1dID0gYXJndW1lbnRzWzJdO1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIHJldHVybiBxdWVyeVBhcmFtcztcXG4gICAgICAgIH07XFxuICAgICAgICB2YXIgamF2YVVybCA9IEphdmFJbXBvcnRlcihqYXZhLm5ldC5VUkwpO1xcbiAgICAgICAgd2l0aChqYXZhVXJsKSB7XFxuICAgICAgICAgICAgdmFyIHVybCA9IG5ldyBVUkwodSk7XFxuICAgICAgICAgICAgZGljdC5Qcm90b2NvbCA9IHVybC5nZXRQcm90b2NvbCgpO1xcbiAgICAgICAgICAgIGRpY3QuSG9zdCA9IHVybC5nZXRIb3N0KCk7XFxuICAgICAgICAgICAgZGljdC5Qb3J0ID0gdXJsLmdldFBvcnQoKTtcXG4gICAgICAgICAgICBkaWN0LkZpbGUgPSB1cmwuZ2V0RmlsZSgpO1xcbiAgICAgICAgICAgIGRpY3QuUGF0aCA9IHVybC5nZXRQYXRoKCk7XFxuICAgICAgICAgICAgZGljdC5SZWYgPSB1cmwuZ2V0UmVmKCk7XFxuICAgICAgICAgICAgZGljdC5Ib3N0cyA9IGAke2RpY3QuUHJvdG9jb2x9Oi8vJHt1cmwuZ2V0SG9zdCgpfWA7XFxuICAgICAgICB9XFxuICAgICAgICBkaWN0LlBhcmFtcyA9IHBhcmFtcyh1KTtcXG4gICAgICAgIHJldHVybiBkaWN0O1xcbiAgICB9LFxcbiAgICBpc0VxdWFsOiBmdW5jdGlvbih4LCB5KSB7XFxuICAgICAgICBjb25zdCBvayA9IE9iamVjdC5rZXlzLFxcbiAgICAgICAgICAgIHR4ID0gdHlwZW9mIHgsXFxuICAgICAgICAgICAgdHkgPSB0eXBlb2YgeTtcXG4gICAgICAgIHJldHVybiB4ICYmIHkgJiYgdHggPT09IFxcXCJvYmplY3RcXFwiICYmIHR4ID09PSB0eSA/XFxuICAgICAgICAgICAgb2soeCkubGVuZ3RoID09PSBvayh5KS5sZW5ndGggJiZcXG4gICAgICAgICAgICBvayh4KS5ldmVyeSgoa2V5KSA9PiB0aGlzLmlzRXF1YWwoeFtrZXldLCB5W2tleV0pKSA6IHggPT09IHk7XFxuICAgIH0sXFxuICAgIGZpbmREaWZmZXJlbnRJbmRleDogZnVuY3Rpb24oc3RyMSwgc3RyMikge1xcbiAgICAgICAgY29uc3QgZGlmZkNoYXJzID0gW107XFxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0cjIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICBpZiAoc3RyMVtpXSAhPT0gc3RyMltpXSkge1xcbiAgICAgICAgICAgICAgICBkaWZmQ2hhcnMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICBpbmRleDogaSxcXG4gICAgICAgICAgICAgICAgICAgIHMxOiBzdHIxW2ldLFxcbiAgICAgICAgICAgICAgICAgICAgczI6IHN0cjJbaV0sXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBkaWZmQ2hhcnM7XFxuICAgIH0sXFxuICAgIHJlcGxhY2VDaGFyQXQ6IGZ1bmN0aW9uKHN0ciwgaW5kZXgsIHJlcGxhY2VtZW50KSB7XFxuICAgICAgICBpZiAoaW5kZXggPCAwIHx8IGluZGV4ID49IHN0ci5sZW5ndGgpIHtcXG4gICAgICAgICAgICByZXR1cm4gc3RyO1xcbiAgICAgICAgfVxcbiAgICAgICAgLy9sb2coaW5kZXgpXFxuICAgICAgICBjb25zdCBhcnIgPSBzdHIuc3BsaXQoXFxcIlxcXCIpO1xcbiAgICAgICAgYXJyW2luZGV4XSA9IHJlcGxhY2VtZW50O1xcbiAgICAgICAgcmV0dXJuIGFyci5qb2luKFxcXCJcXFwiKTtcXG4gICAgfSxcXG4gICAgZ2V0T2JqZWN0S2V5c0RpZmY6IGZ1bmN0aW9uKG9iajEsIG9iajIpIHtcXG4gICAgICAgIGNvbnN0IGRpZmZlcmVudEtleXMgPSBbXTtcXG4gICAgICAgIGZvciAobGV0IGtleSBpbiBvYmoxKSB7XFxuICAgICAgICAgICAgaWYgKCFvYmoyLmhhc093blByb3BlcnR5KGtleSkgfHwgb2JqMVtrZXldICE9PSBvYmoyW2tleV0pIHtcXG4gICAgICAgICAgICAgICAgZGlmZmVyZW50S2V5cy5wdXNoKGtleSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgZm9yIChsZXQga2V5IGluIG9iajIpIHtcXG4gICAgICAgICAgICBpZiAoIW9iajEuaGFzT3duUHJvcGVydHkoa2V5KSkge1xcbiAgICAgICAgICAgICAgICBkaWZmZXJlbnRLZXlzLnB1c2goa2V5KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gZGlmZmVyZW50S2V5cztcXG4gICAgfSxcXG4gICAgZ2V0TmV4dFVybDogZnVuY3Rpb24oc291cmNlLCB0YXJnZXQsIHBhcmFtcykge1xcbiAgICAgICAgdmFyIHUxID0gdGhpcy51cmxQYXJzZShzb3VyY2UpO1xcbiAgICAgICAgdmFyIHUyID0gdGhpcy51cmxQYXJzZSh0YXJnZXQpO1xcb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9XFxuICAgICAgICAgICAgICAgIGlmIChkZi5sZW5ndGggPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlID0gZGZbMF0uaW5kZXg7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGRmLmZpbHRlcigoeCkgPT4gL1xcXFxkKy8udGVzdCh4LnMyKSk7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcmUgPSBmWzBdLmluZGV4O1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHZhciBlcSA9IHRoaXMucmVwbGFjZUNoYXJBdChTdHJpbmcodTIuUGF0aCksIHJlLCBcXFwiZnlwYWdlXFxcIik7XFxuICAgICAgICAgICAgICAgIG5leHR1cmwgPSB1Mi5Ib3N0cyArIGVxICsgY2EgKyB0aGlzLlRvUGFyYW1zKHUyLlBhcmFtcyk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdmFyIGVwID0gdGhpcy5nZXRPYmplY3RLZXlzRGlmZih1MS5QYXJhbXMsIHUyLlBhcmFtcylcXG4gICAgICAgICAgICAgICAgaWYgKGVwLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICB1MS5QYXJhbXNbZXBbMF1dID0gJ2Z5cGFnZSdcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhlcCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIGVxID0gU3RyaW5nKHUxLlBhdGgpLnJlcGxhY2UoL1xcXFxkKy8sIFxcXCJmeXBhZ2VcXFwiKTtcXG4gICAgICAgICAgICAgICAgbmV4dHVybCA9IHUxLkhvc3RzICsgZXEgKyBjYSArIHRoaXMuVG9QYXJhbXModTEuUGFyYW1zKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICAvL2xvZygnbmV4dDonK25leHR1cmwpXFxuICAgICAgICByZXR1cm4gbmV4dHVybDtcXG4gICAgfSxcXG59O1xcblxcbmZ1bmN0aW9uIGdldFRydWVsaW5rKG1hcmssIHVybCwgcGFnZSkge1xcbiAgICB2YXIgcCA9IGdldE15VmFyKG1hcmssIHVybCkucmVwbGFjZShcXFwiZnlwYWdlXFxcIiwgcGFnZSk7XFxuICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICAgIHJldHVybiBnZXRNeVZhcihcXFwieWlfZmlyc3RwYWdlXFxcIiwgcCk7XFxuICAgIH0gZWxzZSBpZiAocCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgcmV0dXJuIHA7XFxuICAgIH0gZWxzZSB7XFxuICAgICAgICByZXR1cm4gdXJsO1xcbiAgICB9XFxufVxcbi8v5p6E5bu6XFxuZnVuY3Rpb24gY3JlYXRlTmV4dFBhZ2UoKSB7XFxuICAgIGxldCBzdGFydG51bSA9IDE7XFxuICAgIHZhciBvYmogPSBhcmd1bWVudHNbMF07XFxuICAgIGlmICh0cnVlX3VybCAhPSBnZXRNeVZhcihcXFwieWlfcGFnZXVybFxcXCIsIFxcXCJcXFwiKSkge1xcbiAgICAgICAgY2xlYXJNeVZhcihcXFwieWlfcGFnZXVybFxcXCIpO1xcbiAgICB9XFxuICAgIGlmIChwYWdlID09IHN0YXJ0bnVtICYmIGdldE15VmFyKFxcXCJ5aV9wYWdldXJsXFxcIikgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgIHB1dE15VmFyKFxcXCJ5aV9maXJzdHBhZ2VcXFwiLCB0cnVlX3VybCk7XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIHZhciBuZXh0ID0gZXZhbCjkuIvkuIDpobUpO1xcbiAgICAgICAgICAgIC8vbG9nKFxcXCJuZXh0XFxcIik7XFxuICAgICAgICAgICAgLy9sb2cobmV4dCk7XFxuICAgICAgICB9IGNhdGNoIHtcXG4gICAgICAgICAgICBsb2coXFxcIuWPr+iDveS4jeWtmOWcqOS4i+S4gOmhteaIluiAheS4i+S4gOmhteWumuS9jeaciemXrumimFxcXCIpO1xcbiAgICAgICAgICAgIG5leHQgPSBcXFwiXFxcIjtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChuZXh0ICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgdmFyIG54dXJsID0gZXh0TWV0aG9kLmdldE5leHRVcmwodHJ1ZV91cmwsIG5leHQsIG9iaik7XFxuICAgICAgICAgICAgLy9sb2coXFxcIm54dXJsOlxcXCIgKyBueHVybCk7XFxuICAgICAgICAgICAgcHV0TXlWYXIo54q25oCBLCBueHVybCk7XFxuICAgICAgICAgICAgcHV0TXlWYXIoXFxcInlpX3BhZ2V1cmxcXFwiLCBueHVybCk7XFxuICAgICAgICB9XFxuICAgIH1cXG59XFxuXFxuZnVuY3Rpb24gYXV0b1BhZ2UoKSB7XFxuICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICAgIHB1dE15VmFyKFxcXCJ5aV9maXJzdHBhZ2VcXFwiLCB0cnVlX3VybCk7XFxuICAgIH1cXG4gICAgdHJ5IHtcXG4gICAgICAgIHZhciBuZXh0ID0gZXZhbCjkuIvkuIDpobUpO1xcbiAgICAgICAgLy9sb2coXFxcIm5leHRcXFwiKTtcXG4gICAgICAgIC8vbG9nKCduZXh0OicrbmV4dCk7XFxuICAgIH0gY2F0Y2gge1xcbiAgICAgICAgbG9nKFxcXCLlj6/og73kuI3lrZjlnKjkuIvkuIDpobXmiJbogIXkuIvkuIDpobXlrprkvY3mnInpl67pophcXFwiKTtcXG4gICAgICAgIG5leHQgPSBcXFwiXFxcIjtcXG4gICAgfVxcbiAgICBpZiAobmV4dCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgcHV0TXlWYXIo54q25oCBLCBuZXh0KTtcXG4gICAgfVxcbn1cIn1dLFwic2F2ZWRcIjpmYWxzZSxcInRpdGxlXCI6XCLlpb3lrabnlLXlrZDor77mnKznvZFc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BvcGVuOiB0cnVlLFxcXFxuICAgICAgICBzdGF0ZTogTVlfUlVMRS51cmwsXFxcXG4gICAgICAgIHNlYXJjaDogZmFsc2UsXFxcXG4gICAgICAgIGNsZWFyczogW10sXFxcXG4gICAgICAgIGNsZWFyYWxsOiBbXFxcXFxcXCJ5aV9maXJzdHBhZ2VcXFxcXFxcIl0sXFxcXG4gICAgICAgIGRlYnVnOiBmYWxzZSxcXFxcblxcXFxuICAgICAgICDpooTorr4ocGFyYW0pIHtcXFxcbiAgICAgICAgICAgIGlmIChwYXJhbSA9PSB1bmRlZmluZWQpIHtcXFxcbiAgICAgICAgICAgICAgICBwYXJhbSA9IFtdO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgT2JqZWN0LmtleXMocGFyYW0pLmZvckVhY2goKHByb3BlcnR5KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgLy8g5a+55q+P5Liq5bGe5oCn5ZCN5omn6KGM5pON5L2cXFxcXG4gICAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSBwYXJhbVtwcm9wZXJ0eV07IC8vIOiOt+WPluWxnuaAp+WAvFxcXFxuICAgICAgICAgICAgICAgIC8vIOWcqOi/memHjOaJp+ihjOaCqOeahOaTjeS9nFxcXFxuICAgICAgICAgICAgICAgIHRoaXNbcHJvcGVydHldID0gdmFsdWU7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVidWcpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocHJvcGVydHkgKyBcXFxcXFxcIjpcXFxcXFxcIiArIHZhbHVlKTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfSxcXFxcbiAgICAgICAgZXZhbEpTUnVsZShpdGVtLFxcXFxuICAgICAgICAgICAganNSdWxlKSB7XFxcXG4gICAgICAgICAgICBsZXQgcnVsZSA9IGpzUnVsZS5yZXBsYWNlKFxcXFxcXFwiQ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jtcXFxcbiAgICAgICAgfSxcXFxcbiAgICAgICAgaXNOdWxsKHBhcmFtKSB7XFxcXG4gICAgICAgICAgICBpZiAocGFyYW0gPT0gbnVsbCkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xcXFxuICAgICAgICB9LFxcXFxuICAgICAgICBpc0Jvb2xlYW4odmFyaWFibGUpIHtcXFxcbiAgICAgICAgICAgIGlmICh0eXBlb2YgdmFyaWFibGUgIT09IFxcXFxcXFwiYm9vbGVhblxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXFxcXFwi5byA5ZCv5oqY5Y+g6K+35Lyg5YWl5biD5bCU5YC8XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9LFxcXFxuICAgICAgICDmuIXpmaQobGlzdCkge1xcXFxuICAgICAgICAgICAgaWYgKHRoaXMuaXNOdWxsKGxpc3QpKSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAobGlzdC5jb25zdHJ1Y3RvciA9PSBTdHJpbmcpIHtcXFxcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcXFxcXCLmuIXpmaTmiqXplJk66K+35Lyg5YiX6KGoXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgdGhpcy5jbGVhcnMgPSBsaXN0O1xcXFxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxcXG4gICAgICAgIH0sXFxcXG4gICAgICAgIOWFqOa4hShsaXN0KSB7XFxcXG4gICAgICAgICAgICBpZiAodGhpcy5pc051bGwobGlzdCkpIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcztcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHZhciBjID0gdGhpcy5jbGVhcmFsbDtcXFxcbiAgICAgICAgICAgIGxpc3QgPSBjLmNvbmNhdChsaXN0KTtcXFxcbiAgICAgICAgICAgIHRoaXMuY2xlYXJhbGwgPSBsaXN0O1xcXFxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxcXG4gICAgICAgIH0sXFxcXG4gICAgICAgIOa6kOeggShpbnB1dCkge1xcXFxuICAgICAgICAgICAgdGhpcy5odG1sID0gaW5wdXQ7XFxcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXFxcbiAgICAgICAgfSxcXFxcbiAgICAgICAg55WM6Z2iKGlucHV0KSB7XFxcXG4gICAgICAgICAgICB0aGlzLmxheW91dCA9IGlucHV0O1xcXFxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxcXG4gICAgICAgIH0sXFxcXG4gICAgICAgIOmhteeggShpbnB1dCkge1xcXFxuICAgICAgICAgICAgdGhpcy5wYWdlID0gaW5wdXQ7XFxcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXFxcbiAgICAgICAgfSxcXFxcbiAgICAgICAg54q25oCBKGlucHV0KSB7XFxcXG4gICAgICAgICAgICB0aGlzLnN0YXRlID0gaW5wdXQ7XFxcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXFxcbiAgICAgICAgfSxcXFxcbiAgICAgICAg5byA5ZCv5pCc57SiKGlucHV0KSB7XFxcXG4gICAgICAgICAgICBpZiAoaW5wdXQgPT0gdW5kZWZpbmVkKSB7XFxcXG4gICAgICAgICAgICAgICAgaW5wdXQgPSB0cnVlO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgdGhpcy5zZWFyY2ggPSBpbnB1dDtcXFxcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcXFxuICAgICAgICB9LFxcXFxuICAgICAgICDlvIDlkK/mipjlj6AoaW5wdXQpIHtcXFxcbiAgICAgICAgICAgIGlmIChpbnB1dCA9PSB1bmRlZmluZWQpIHtcXFxcbiAgICAgICAgICAgICAgICBpbnB1dCA9IHRydWU7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB0aGlzLmlzQm9vbGVhbihpbnB1dCk7XFxcXG4gICAgICAgICAgICB0aGlzLm9wZW4gPSBpbnB1dDtcXFxcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcXFxuICAgICAgICB9LFxcXFxuICAgICAgICBzZXRUaXRsZShrLCBpLCB0KSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gayA9PSBpID8gXFxcXFxcXCLigJzigJzigJ3igJ1cXFxcXFxcIiArIHQuZm9udGNvbG9yKHRoaXMu5YiG57G76aKc6ImyKSA6IHQ7XFxcXG4gICAgICAgIH0sXFxcXG4gICAgICAgIGFjdGlvbihvYmopIHtcXFxcbiAgICAgICAgICAgIHJldHVybiBbe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIua4hemZpOeKtuaAgVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChvYmopID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbG9nKG9iaik7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIob2JqLnN0YXRlKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFxcXFxcImhlYWQuY2F0ZVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcignY2F0ZV9idXR0b24nKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgb2JqLmFsbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgb2JqLmNsLmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcXFxuICAgICAgICAgICAgICAgIH0sIG9iaiksXFxcXG4gICAgICAgICAgICB9LCBdO1xcXFxuICAgICAgICB9LFxcXFxuICAgICAgICBjaGVja1BhcmFtKCkge1xcXFxuICAgICAgICAgICAgdmFyIG9iaiA9IHt9O1xcXFxuICAgICAgICAgICAgaWYgKHRoaXMucGFnZSA9PSAwICYmIHR5cGVvZiBwYWdlID09IFxcXFxcXFwidW5kZWZpbmVkXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcXFxcXCLor7fkvKDlhaXpobXnoIFcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcGFnZSA9PSBcXFxcXFxcInVuZGVmaW5lZFxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG9ialtcXFxcXFxcIumhteeggVxcXFxcXFwiXSA9IHRoaXMucGFnZTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICBvYmpbXFxcXFxcXCLpobXnoIFcXFxcXFxcIl0gPSBwYWdlO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmICh0aGlzLmh0bWwgPT0gXFxcXFxcXCJlbXB0eVxcXFxcXFwiICYmIHR5cGVvZiBodG1sID09IFxcXFxcXFwidW5kZWZpbmVkXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcXFxcXCLor7fkvKDlhaXmupDnoIFcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgaHRtbCA9PSBcXFxcXFxcInVuZGVmaW5lZFxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG9ialtcXFxcXFxcIua6kOeggVxcXFxcXFwiXSA9IHRoaXMuaHRtbDtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICBvYmpbXFxcXFxcXCLmupDnoIFcXFxcXFxcIl0gPSBodG1sO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmICh0aGlzLmxheW91dCA9PSBcXFxcXFxcInVuZGVmaW5lZFxcXFxcXFwiICYmIHR5cGVvZiBkID09IFxcXFxcXFwidW5kZWZpbmVkXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcXFxcXCLor7fkvKDlhaXnlYzpnaJcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZCA9PSBcXFxcXFxcInVuZGVmaW5lZFxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG9ialtcXFxcXFxcIueVjOmdolxcXFxcXFwiXSA9IHRoaXMubGF5b3V0O1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG9ialtcXFxcXFxcIueVjOmdolxcXFxcXFwiXSA9IGQ7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIG9iajtcXFxcbiAgICAgICAgfSxcXFxcbiAgICAgICAg5Yib5bu65Yqo5oCB5YiG57G7KHJ1bGVPYmopIHtcXFxcbiAgICAgICAgICAgIGxldCBpdGVtcyA9IFtdO1xcXFxuICAgICAgICAgICAgbGV0IGNhdGVzID0gW107XFxcXG4gICAgICAgICAgICBpZiAocnVsZU9iaiA9PSB1bmRlZmluZWQpIHtcXFxcbiAgICAgICAgICAgICAgICBydWxlT2JqID0gW107XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAvL+WIneWni+WMluWPmOmHj+W8gOWni1xcXFxuICAgICAgICAgICAgY29uc3QgcGFyYW0gPSB0aGlzLmNoZWNrUGFyYW0oKTtcXFxcbiAgICAgICAgICAgIGNvbnN0IHBhZ2UgPSBwYXJhbS7pobXnoIE7XFxcXG4gICAgICAgICAgICBjb25zdCBodG1sID0gcGFyYW0u5rqQ56CBO1xcXFxuICAgICAgICAgICAgY29uc3QgZCA9IHBhcmFtLueVjOmdojtcXFxcbiAgICAgICAgICAgIGNvbnN0IOeKtuaAgSA9IHRoaXMuc3RhdGU7XFxcXG4gICAgICAgICAgICBjb25zdCBzZWFyY2ggPSB0aGlzLnNlYXJjaDtcXFxcbiAgICAgICAgICAgIGNvbnN0IGVtcHR5ID0gXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCI7XFxcXG4gICAgICAgICAgICBjb25zdCDmipjlj6DnirbmgIEgPSB0aGlzLm9wZW47XFxcXG4gICAgICAgICAgICB2YXIg5bGV5byAID0gdGhpcy7lsZXlvIA7XFxcXG4gICAgICAgICAgICB2YXIg5oqY5Y+gID0gdGhpcy7mipjlj6A7XFxcXG4gICAgICAgICAgICB2YXIg5YWo5riFID0gdGhpcy5jbGVhcmFsbDtcXFxcbiAgICAgICAgICAgIHZhciDmuIXpmaQgPSB0aGlzLmNsZWFycztcXFxcbiAgICAgICAgICAgIC8v5Yid5aeL5YyW5Y+Y6YeP57uT5p2fXFxcXG4gICAgICAgICAgICBsZXQgaW5pdF9jYXRlID0gbmV3IEFycmF5KDIwKS5maWxsKFxcXFxcXFwiMFxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgIGNvbnN0IGZvbGQgPSBnZXRNeVZhcihNWV9SVUxFLmdyb3VwLCBcXFxcXFxcIjBcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICBjb25zdCBjYXRlX3RlbXAgPSBKU09OLnBhcnNlKFxcXFxuICAgICAgICAgICAgICAgIGdldE15VmFyKFxcXFxcXFwiaGVhZC5jYXRlXFxcXFxcXCIsIEpTT04uc3RyaW5naWZ5KGluaXRfY2F0ZSkpXFxcXG4gICAgICAgICAgICApO1xcXFxuICAgICAgICAgICAgaWYgKHNlYXJjaCAmJiBwYWdlID09IDEpIHtcXFxcbiAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwiXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcXFxcXCInaGlrZXI6Ly9zZWFyY2g/cnVsZT1cXFxcXFxcIiArIE1ZX1JVTEUudGl0bGUgKyBcXFxcXFxcIiZzPScraW5wdXRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcXFxcXCLmkJzntKLlhbPplK7or41cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwiaW5wdXRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZ2V0TXlWYXIoXFxcXFxcXCJrZXl3b3JkXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgb25DaGFuZ2U6ICQudG9TdHJpbmcoKCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXFxcXFwia2V5d29yZFxcXFxcXFwiLCBpbnB1dCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGNvbnN0IGNhdGVnb3JpZXMgPSBbXTtcXFxcbiAgICAgICAgICAgIHJ1bGVPYmouZm9yRWFjaCgoeCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHZhciBsaXN0ID0gW107XFxcXG4gICAgICAgICAgICAgICAgLy9sb2coeClcXFxcbiAgICAgICAgICAgICAgICBpZiAoeC5qc29uICE9IHVuZGVmaW5lZCkge1xcXFxuICAgICAgICAgICAgICAgICAgICB4Lmpzb24ubWFwKGsgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKEpTT04uc3RyaW5naWZ5KGspLnJlcGxhY2UoL15cXFxcXFxcXFt8XFxcXFxcXFxdJC9nLCAnJykpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIC8vY2F0ZWdvcmllcy5wdXNoKHguanNvbilcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYgKHgu5LiA57qn5a6a5L2NKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmICh4LuS4gOe6p+WumuS9jS5zdGFydHNXaXRoKFxcXFxcXFwiQGpzOlxcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShodG1sLCB4LuS4gOe6p+WumuS9jSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaXN0ID0gcGRmYShodG1sLCB4LuS4gOe6p+WumuS9jSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYgKHgu5aSn57G75a6a5L2NKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmICh4LuWkp+exu+WumuS9jS5zdGFydHNXaXRoKFxcXFxcXFwiQGpzOlxcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShodG1sLCB4LuWkp+exu+WumuS9jSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaXN0ID0gW3BkZmEoaHRtbCwgeC7lpKfnsbvlrprkvY0pLmpvaW4oJ1xcXFxcXFxcbicpXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcblxcXFxuXFxcXG4gICAgICAgIHZhciDkuIDnuqcgPSBsaXN0Lm1hcCgocykgPT4ge1xcXFxuICAgICAgICAgIHZhciBzbGlzdCA9IFtdO1xcXFxuICAgICAgICAgIGlmICghKFxcXFxcXFwi5bCP57G7XFxcXFxcXCIgaW4geCkpIHtcXFxcbiAgICAgICAgICAgIHgu5bCP57G7ID0gXFxcXFxcXCJib2R5JiZhOm5vdCg6bWF0Y2hlcyjpppbpobUpKTpub3QoYTpub3QoW2hyZWZdKSlcXFxcXFxcIjtcXFxcbiAgICAgICAgICB9XFxcXG4gICAgICAgICAgaWYgKHgu5bCP57G7LnN0YXJ0c1dpdGgoXFxcXFxcXCJAanM6XFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICBzbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShzLCB4LuWwj+exuyk7XFxcXG4gICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgIHNsaXN0ID0gcGRmYShzLCB4LuWwj+exuyk7XFxcXG4gICAgICAgICAgfVxcXFxuICAgICAgICAgIC8vLS3pop3lpJblpITnkIYtLVxcXFxuICAgICAgICAgIGlmICgoJ+WinuWKoCcgaW4geCkpIHtcXFxcbiAgICAgICAgICAgIGlmICh4LuWinuWKoC5jb25zdHJ1Y3RvciA9PSBTdHJpbmcpIHtcXFxcbiAgICAgICAgICAgICAgeC7lop7liqAgPSBldmFsKHgu5aKe5YqgKTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHNsaXN0ID0geC7lop7liqAuY29uY2F0KHNsaXN0KTtcXFxcbiAgICAgICAgICB9XFxcXG4gICAgICAgICAgaWYgKCgn6KGl5YWFJyBpbiB4KSkge1xcXFxuICAgICAgICAgICAgaWYgKHgu6KGl5YWFLmNvbnN0cnVjdG9yID09IFN0cmluZykge1xcXFxuICAgICAgICAgICAgICB4LuihpeWFhSA9IGV2YWwoeC7ooaXlhYUpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgc2xpc3QgPSBzbGlzdC5jb25jYXQoeC7ooaXlhYUpO1xcXFxuICAgICAgICAgIH1cXFxcbiAgICAgICAgICAvLy0t6aKd5aSW5aSE55CGLS1cXFxcbiAgICAgICAgICB2YXIg5a6a5L2NID0gc2xpc3QubWFwKChpdGVtKSA9PiB7XFxcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSB0aGlzLmdldFRpdGxlKGl0ZW0sIHgu5qCH6aKYKTtcXFxcbiAgICAgICAgICAgIHZhciB1cmwgPSB0aGlzLmdldFVybChpdGVtLCB4KTtcXFxcbiAgICAgICAgICAgIHZhciBvYmogPSB7XFxcXG4gICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSwgdXJsOiB1cmxcXFxcbiAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICBpZiAoKCdleHQnIGluIHgpKSB7XFxcXG4gICAgICAgICAgICAgIG9ialsnZXh0J10gPSB4LmV4dDtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShvYmopO1xcXFxuICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgIHJldHVybiDlrprkvY07XFxcXG4gICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIC8vbG9nKOS4gOe6pylcXFxcbiAgICAgICAgICAgICAgICAvL2xvZyjkuIDnuqcubGVuZ3RoKVxcXFxuICAgICAgICAgICAgICAgIGlmICjkuIDnuqcubGVuZ3RoID09IDEpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKOS4gOe6py5qb2luKFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIpKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICDkuIDnuqcuZm9yRWFjaCgoaXRlbSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKGl0ZW0uam9pbihcXFxcXFxcIixcXFxcXFxcIikpO1xcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgLy9sb2coY2F0ZWdvcmllcylcXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgaWYgKOaKmOWPoOeKtuaAgSkge1xcXFxuICAgICAgICAgICAgICAgIGlmIChwYWdlID09IDEpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogZm9sZCA9PT0gXFxcXFxcXCIxXFxcXFxcXCIgPyDmipjlj6AgOiDlsZXlvIAsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQoXFxcXFxcXCIjbm9Mb2FkaW5nI1xcXFxcXFwiKS5sYXp5UnVsZShcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAodGl0bGUsIGZvbGQsIHUsIGFsbCwgZXhwcykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZm9sZCA9IGdldE15VmFyKE1ZX1JVTEUuZ3JvdXAsIGZvbGQpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBb5bGV5byALCDmipjlj6BdID0gZXhwcztcXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZm9sZCA9PSAxKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgY3ggPSBmaW5kSXRlbXNCeUNscyh0aXRsZSArICdjYXRlX2J1dHRvbicpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2NhdGVfYnV0dG9uJywgY3gpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHRpdGxlICsgJ2NhdGVfYnV0dG9uJyk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjeCA9IHN0b3JhZ2UwLmdldE15VmFyKCdjYXRlX2J1dHRvbicsIFtdKS5tYXAoeCA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeFsnY29sX3R5cGUnXSA9IHhbJ2NvbF90eXBlJ10gPyB4Wydjb2xfdHlwZSddIDogeFsndHlwZSddO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIodGl0bGUgKyAnY2F0ZV9saW5lJywgY3gpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKmFsbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7Ki9cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh0aXRsZSArICdjYXRlX2V4cCcsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBmb2xkID09IDEgPyDlsZXlvIAgOiDmipjlj6AsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG5cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoTVlfUlVMRS5ncm91cCwgZm9sZCA9PT0gXFxcXFxcXCIxXFxcXFxcXCIgPyBcXFxcXFxcIjBcXFxcXFxcIiA6IFxcXFxcXFwiMVxcXFxcXFwiKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3JlZnJlc2hQYWdlKGZhbHNlKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgTVlfUlVMRS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb2xkLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIOeKtuaAgSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICDlhajmuIUsIFvlsZXlvIAsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIOaKmOWPoFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICApLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwic2Nyb2xsX2J1dHRvblxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogTVlfUlVMRS50aXRsZSArICdjYXRlX2V4cCcsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiB0aGlzLmFjdGlvbih7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbDog5YWo5riFLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbDog5riF6ZmkLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcXFxuICAgICAgICAgICAgICAgIGNhdGVnb3JpZXMuZm9yRWFjaCgoY2F0ZWdvcnksIGluZGV4KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKGNhdGVnb3J5KVxcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgc3ViX2NhdGVnb3JpZXMgPSBbXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgLyppZiAo5bCP57G75a6a5L2NLmluY2x1ZGVzKFxcXFxcXFwiO1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NLnNwbGl0KFxcXFxcXFwiO1xcXFxcXFwiKVswXSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgaWYgKHN1Yl9jYXRlZ29yaWVzLmxlbmd0aCA9PSAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jS5zcGxpdChcXFxcXFxcIjtcXFxcXFxcIilbMV0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsqL1xcXFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhpbmRleClcXFxcbiAgICAgICAgICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMgPSBKU09OLnBhcnNlKGBbJHtjYXRlZ29yeX1dYCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKHN1Yl9jYXRlZ29yaWVzKVxcXFxuICAgICAgICAgICAgICAgICAgICAvLyBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIC8vfVxcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoaW5kZXggPT09IDApIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8v5aSn57G7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbGV0IHRpdGxlID0gcGRmaChpdGVtLCBf5aSn57G75qCH6aKYKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdGl0bGUgPSBpdGVtLnRpdGxlO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiDmjpLpmaQgIT0gXFxcXFxcXCJ1bmRlZmluZWRcXFxcXFxcIiAmJiDmjpLpmaQgIT0gXFxcXFxcXCJcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3UmVnRXhwKOaOkumZpCwgXFxcXFxcXCJnXFxcXFxcXCIpLCBcXFxcXFxcIlxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGpzb24gPSAnJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBwYXJhbXMgPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGtleSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJzOiDmuIXpmaQsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb246IGpzb24sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbGNsZWFyczog5YWo5riFLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxcXG5cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2xldCB1cmwgPSBwZChpdGVtLCBf5aSn57G76ZO+5o6lKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gaXRlbS51cmw7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLyppZiAo5aSn57G75aSE55CGKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSDkuIDnuqfliIbnsbvlpITnkIYodXJsKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ki9cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyh1cmwpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aGlzLnNldFRpdGxlKGtleS50b1N0cmluZygpLCBjYXRlX3RlbXBbaW5kZXhdLCB0aXRsZSksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInNjcm9sbF9idXR0b25cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKFxcXFxcXFwiaGlrZXI6Ly9lbXB0eSNub0xvYWRpbmcjXFxcXFxcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgbmV3X2NhdGUgPSBbXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuYWxsY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdjYXRlX2J1dHRvbicpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmNhdGVfdGVtcC5mb3JFYWNoKChjYXRlLCBpbmRleCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdfY2F0ZS5wdXNoKGluZGV4ID09PSAwID8gcGFyYW1zLmtleS50b1N0cmluZygpIDogXFxcXFxcXCIwXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXFxcXFwiaGVhZC5jYXRlXFxcXFxcXCIsIEpTT04uc3RyaW5naWZ5KG5ld19jYXRlKSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhcmFtcy5qc29uLmNvbnN0cnVjdG9yID09PSBPYmplY3QpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcXFxcXCJkdF9cXFxcXFxcIiArIHBhcmFtcy5qc29uLnR5cGUsIHBhcmFtcy5qc29uLnZhbHVlKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIHBhcmFtcy5qc29uKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UodHJ1ZSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcyksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcImJsYW5rX2Jsb2NrXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IE1ZX1JVTEUudGl0bGUgKyAnY2F0ZV9saW5lJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8v5bCP57G7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZXh0cmFwb3MgPSBmYWxzZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKmlmIChpdGVtLmluY2x1ZGVzKCd0eXBlPVxcXFxcXFwiQGV4dHJhXFxcXFxcXCInKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFwb3MgPSB0cnVlO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coJ+mZhOWKoOWumuS9jScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSovXFxcXG5cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXh0cmFwb3MpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gcGRmaChpdGVtLCBcXFxcXFxcImEmJlRleHRcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2Yg5o6S6ZmkICE9IFxcXFxcXFwidW5kZWZpbmVkXFxcXFxcXCIgJiYg5o6S6ZmkICE9IFxcXFxcXFwiXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gdGl0bGUucmVwbGFjZShuZXcgUmVnRXhwKOaOkumZpCwgXFxcXFxcXCJnXFxcXFxcXCIpLCBcXFxcXFxcIlxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIganNvbiA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHBkZmgoaXRlbSwgXFxcXFxcXCJhJiZzdGF0ZVxcXFxcXFwiKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIFxcXFxcXFwiYSYmdmFsdWVcXFxcXFxcIiksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy92YXIgdGl0bGUgPSBwZGZoKGl0ZW0sIOWIhuexu+agh+mimCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0aXRsZSA9IGl0ZW0udGl0bGU7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2Yg5o6S6ZmkICE9IFxcXFxcXFwidW5kZWZpbmVkXFxcXFxcXCIgJiYg5o6S6ZmkICE9IFxcXFxcXFwiXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gdGl0bGUucmVwbGFjZShuZXcgUmVnRXhwKOaOkumZpCwgXFxcXFxcXCJnXFxcXFxcXCIpLCBcXFxcXFxcIlxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBqc29uID0gXFxcXFxcXCJcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLypzd2l0Y2ggKHRydWUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIOWIhuexu+mTvuaOpS5pbmNsdWRlcyhcXFxcXFxcIkBAQFxcXFxcXFwiKTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXFxcXFwiQEBAXFxcXFxcXCIpWzBdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXFxcXFwiQEBAXFxcXFxcXCIpWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIOWIhuexu+mTvuaOpS5pbmNsdWRlcyhcXFxcXFxcIkBAXFxcXFxcXCIpOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbiA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTog5YiG57G76ZO+5o6lLnNwbGl0KFxcXFxcXFwiQEBcXFxcXFxcIilbMF0sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFxcXFxcIkBAXFxcXFxcXCIpWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8ganNvbiA9IHBkKGl0ZW0sIOWIhuexu+mTvuaOpSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSovXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyp2YXIganNvbj3liIbnsbvpk77mjqUuaW5jbHVkZXMoJ0BAQCcpP3tcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVswXSksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OnBkKGl0ZW0s5YiG57G76ZO+5o6lKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEAnKT97XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU65YiG57G76ZO+5o6lLnNwbGl0KCdAQCcpWzBdLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQCcpWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OnBkKGl0ZW0s5YiG57G76ZO+5o6lKTsqL1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBwYXJhbXMgPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleDogaW5kZXgsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleToga2V5LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBwYWdlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uOiBqc29uLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVzLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGhpcy5zZXRUaXRsZShrZXkudG9TdHJpbmcoKSwgY2F0ZV90ZW1wW2luZGV4XSwgdGl0bGUpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHRpdGxlID09IFxcXFxcXFwi8J2QhfCdkILwnZ+QXFxcXFxcXCIgPyBcXFxcXFxcImhpa2VyOi8vcGFnZS9mYzI/dXJsPVxcXFxcXFwiICsgZ2V0TXlWYXIoXFxcXFxcXCJmYzJcXFxcXFxcIikgKyBcXFxcXFxcIiNmeXBhZ2Ujbm9IaXN0b3J5I1xcXFxcXFwiIDogJChcXFxcXFxcImhpa2VyOi8vZW1wdHlcXFxcXFxcIiArIFxcXFxcXFwiI25vTG9hZGluZyNcXFxcXFxcIikubGF6eVJ1bGUoKHBhcmFtcykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2NhdGVfYnV0dG9uJyk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wW3BhcmFtcy5pbmRleF0gPSBwYXJhbXMua2V5LnRvU3RyaW5nKCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcXFxcXCJoZWFkLmNhdGVcXFxcXFxcIiwgSlNPTi5zdHJpbmdpZnkocGFyYW1zLmNhdGVfdGVtcCkpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYXJhbXMuanNvbi5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXFxcXFwiZHRfXFxcXFxcXCIgKyBwYXJhbXMuanNvbi50eXBlLCBwYXJhbXMuanNvbi52YWx1ZSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLnN0YXRlLCBwYXJhbXMuanNvbik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcyksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInNjcm9sbF9idXR0b25cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogTVlfUlVMRS50aXRsZSArICdjYXRlX2J1dHRvbicsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZXMucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwiYmxhbmtfYmxvY2tcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHM6IE1ZX1JVTEUudGl0bGUgKyAnY2F0ZV9idXR0b24nLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAoZm9sZCA9PT0gXFxcXFxcXCIxXFxcXFxcXCIgfHwg5oqY5Y+g54q25oCBID09IGZhbHNlKSB7XFxcXG4gICAgICAgICAgICAgICAgaXRlbXMgPSBpdGVtcy5jb25jYXQoY2F0ZXMpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKGZvbGQgPT09IFxcXFxcXFwiMFxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2NhdGVfYnV0dG9uJywgY2F0ZXMpXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAodHlwZW9mIHNldFByZVJlc3VsdCAhPSAndW5kZWZpbmVkJykge1xcXFxuICAgICAgICAgICAgICAgIGl0ZW1zID0gZC5jb25jYXQoaXRlbXMpO1xcXFxuICAgICAgICAgICAgICAgIC8v5riF56m657un5om/5pWw57uEXFxcXG4gICAgICAgICAgICAgICAgZC5sZW5ndGggPSAwO1xcXFxuICAgICAgICAgICAgICAgIHNldFByZVJlc3VsdChpdGVtcyk7XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIGl0ZW1zLmZvckVhY2goaXRlbSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaChpdGVtKTtcXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9LFxcXFxuICAgIH07XFxcXG4gICAgb2JqLumihOiuvihvcHRpb25zKTtcXFxcbiAgICByZXR1cm4gb2JqO1xcXFxufVxcXFxuXFxcXG52YXIg54q25oCBID1cXFxcbiAgICB0eXBlb2Yg54q25oCB5qCH6K6wICE9IFxcXFxcXFwidW5kZWZpbmVkXFxcXFxcXCIgJiYg54q25oCB5qCH6K6wICE9IFxcXFxcXFwiXFxcXFxcXCIgPyDnirbmgIHmoIforrAgOiBNWV9SVUxFLnVybDtcXFxcblxcXFxubGV0IGR0X2RlYnVnID0gZmFsc2U7XFxcXG5cXFxcbmFkZExpc3RlbmVyKFxcXFxuICAgIFxcXFxcXFwib25DbG9zZVxcXFxcXFwiLFxcXFxuICAgICQudG9TdHJpbmcoKCkgPT4ge30pXFxcXG4pO1xcXFxuXFxcXG52YXIgQ3JlYXRlID0ge1xcXFxuICAgIG5leHRQYWdlOiBmdW5jdGlvbigpIHtcXFxcbiAgICAgICAgdmFyIHJlc3VsdCA9IGZhbHNlO1xcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgdmFyIG5leHQgPSBldmFsKOS4i+S4gOmhtSk7XFxcXG4gICAgICAgICAgICAvL2xvZygnbjonK25leHQpXFxcXG4gICAgICAgICAgICBpZiAobmV4dCA9PSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCfkuIvkuIDpobXpk77mjqXkuLrnqbonKVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmVzdWx0ID0gdHJ1ZTtcXFxcbiAgICAgICAgICAgIGlmICh0cnVlX3VybCA9P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iAgICAgICAgICAgIGBcXFxcXFxcXG5cXFxcXFxcXHR1cmzlrprkvY06ICAke3J1bGUudXJsfSAgLS0tPiDnu5Pmnpw6ICAke29iai51cmx9YFxcXFxuICAgICAgICApO1xcXFxuICAgICAgICBsb2coJy0tLS0tLS0tLS0nICsgKGkgKyAxKSArICc66LCD6K+V57uT5p2fLS0tLS0tLS0tLScpO1xcXFxuICAgIH0sXFxcXG4gICAganNvbkxpc3Q6IGZ1bmN0aW9uKGFyciwganNvbiwgcnVsZSkge1xcXFxuICAgICAgICBpZiAoanNvbi5jb25zdHJ1Y3RvciAhPSBPYmplY3QpIHtcXFxcbiAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAganNvbiA9IEpTT04ucGFyc2UoanNvbik7XFxcXG4gICAgICAgICAgICB9IGNhdGNoIHt9XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgaWYgKGpzb25bcnVsZS5saXN0XSA9PSB1bmRlZmluZWQpIHtcXFxcbiAgICAgICAgICAgIGFyci5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnTxmb250IGNvbG9yPVxcXFxcXFwiZ3JleVxcXFxcXFwiPjxzbWFsbD7ml6DlhoXlrrk8L3NtYWxsPjwvZm9udD4nLFxcXFxuICAgICAgICAgICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF9jZW50ZXJfMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7fSxcXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgcmV0dXJuO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHZhciBkZWJ1ZyA9IHRoaXMuZ2V0Qm9vbGVhblZhbHVlKHJ1bGUuZGVidWcsIGZhbHNlKTtcXFxcbiAgICAgICAgdmFyIGVtcHR5ID0gdGhpcy5nZXRCb29sZWFuVmFsdWUocnVsZS5lbXB0eSk7XFxcXG4gICAgICAgIGlmIChkZWJ1Zykge1xcXFxuICAgICAgICAgICAgbG9nKCflrprkvY3liJfooag6JyArIHJ1bGUubGlzdCk7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAganNvbltydWxlLmxpc3RdLmZvckVhY2goKGl0ZW0sIGkpID0+IHtcXFxcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IGV2YWwocnVsZS50aXRsZSk7XFxcXG4gICAgICAgICAgICB2YXIgZGVzYyA9IGV2YWwocnVsZS5kZXNjKTtcXFxcbiAgICAgICAgICAgIHZhciBjb250ZW50ID0gZXZhbChydWxlLmNvbnRlbnQpO1xcXFxuICAgICAgICAgICAgdmFyIGltZyA9IGV2YWwocnVsZS5pbWcpICsgcnVsZS5yZWY7XFxcXG4gICAgICAgICAgICB2YXIgaHJlZiA9IGV2YWwocnVsZS51cmwpO1xcXFxuICAgICAgICAgICAgdmFyIHVybCA9IHJ1bGUuaW10ID8gaHJlZiArIFxcXFxcXFwiI2ltbWVyc2l2ZVRoZW1lI1xcXFxcXFwiIDogaHJlZjtcXFxcbiAgICAgICAgICAgIHZhciBsYXp5ID0gcnVsZS5sYXp5ID8gcnVsZS5sYXp5IDogXFxcXFxcXCJcXFxcXFxcIjtcXFxcblxcXFxuICAgICAgICAgICAgdmFyIGRkID0ge1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICBkZXNjOiBkZXNjLFxcXFxuICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXFxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogaW1nLFxcXFxuICAgICAgICAgICAgICAgIHVybDogKGVtcHR5ID8gXFxcXFxcXCJoaWtlcjovL2VtcHR5IyNcXFxcXFxcIiA6ICcnKSArIHVybCxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogcnVsZS5jb2xfdHlwZSxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IHRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGltZyxcXFxcbiAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgfTtcXFxcblxcXFxuICAgICAgICAgICAgaWYgKGRlYnVnKSB7XFxcXG4gICAgICAgICAgICAgICAgdmFyIHJ4ID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYyxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW1nLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50LFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmxcXFxcbiAgICAgICAgICAgICAgICB9O1xcXFxuICAgICAgICAgICAgICAgIHRoaXMuZGVidWdsb2coaSwgaXRlbSwgcnVsZSwgcngpO1xcXFxuICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICBpZiAobGF6eSAhPSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgZGRbXFxcXFxcXCJ1cmxcXFxcXFxcIl0gPSBocmVmICsgbGF6eTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGFyci5wdXNoKGRkKTtcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgfSxcXFxcbiAgICBydWxlTGlzdDogZnVuY3Rpb24oYXJyLCBodG1sLCBydWxlKSB7XFxcXG4gICAgICAgIHZhciBsaXN0ID0gcGRmYShodG1sLFxcXFxuICAgICAgICAgICAgcnVsZS5saXN0KTtcXFxcbiAgICAgICAgdmFyIGRlYnVnID0gdGhpcy5nZXRCb29sZWFuVmFsdWUocnVsZS5kZWJ1ZyxcXFxcbiAgICAgICAgICAgIGZhbHNlKTtcXFxcbiAgICAgICAgdmFyIGVtcHR5ID0gdGhpcy5nZXRCb29sZWFuVmFsdWUocnVsZS5lbXB0eSk7XFxcXG4gICAgICAgIGlmIChkZWJ1Zykge1xcXFxuICAgICAgICAgICAgbG9nKCflrprkvY3liJfooag6JyArIHJ1bGUubGlzdCk7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgbGlzdC5mb3JFYWNoKChpdGVtLCBpKSA9PiB7XFxcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS50aXRsZSk7XFxcXG4gICAgICAgICAgICB2YXIgZGVzYyA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmRlc2MpO1xcXFxuICAgICAgICAgICAgdmFyIGRlc2MxID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUuZGVzYzEpO1xcXFxuICAgICAgICAgICAgdmFyIGRlc2MyID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUuZGVzYzIpO1xcXFxuICAgICAgICAgICAgdmFyIGltZyA9IHRoaXMuaW1nSGFuZGxlKGl0ZW0sIHJ1bGUpO1xcXFxuICAgICAgICAgICAgdmFyIHVybCA9IHRoaXMudXJsSGFuZGxlKGl0ZW0sIHJ1bGUpO1xcXFxuICAgICAgICAgICAgdmFyIGNvbnRlbnQgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS5jb250ZW50KTtcXFxcblxcXFxuICAgICAgICAgICAgaWYgKGRlYnVnKSB7XFxcXG4gICAgICAgICAgICAgICAgdmFyIHJ4ID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYyxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW1nLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50LFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmxcXFxcbiAgICAgICAgICAgICAgICB9O1xcXFxuICAgICAgICAgICAgICAgIHRoaXMuZGVidWdsb2coaSwgaXRlbSwgcnVsZSwgcngpO1xcXFxuICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICB2YXIgbGF6eSA9IHJ1bGUubGF6eSA/IHJ1bGUubGF6eSA6IFxcXFxcXFwiXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB2YXIgZGQgPSB7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MxICsgXFxcXFxcXCJcXFxcXFxcXHRcXFxcXFxcXHRcXFxcXFxcXHRcXFxcXFxcXHRcXFxcXFxcIiArIGRlc2MsXFxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogaW1nLFxcXFxuICAgICAgICAgICAgICAgIHVybDogKGVtcHR5ID8gJ2hpa2VyOi8vZW1wdHkjIycgOiAnJykgKyB1cmwgKyAnI25vSGlzdG9yeSNAcnVsZT1qczokLnJlcXVpcmUoXFxcXFxcXCJlalxcXFxcXFwiKScsXFxcXG4gICAgICAgICAgICAgICAgY29udGVudDogY29udGVudCxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogcnVsZS5jb2xfdHlwZSxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IHRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGltZyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+OAkOi3s+mhteOAkScsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygodHJ1ZV91cmwpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJCgnJywgJzHliLA4MeS5i+mXtOeahOeahOmhteeggScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5pbnB1dCgodHJ1ZV91cmwpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhcnNlSW50KGlucHV0KSA+IDEgJiYgcGFyc2VJbnQoaW5wdXQpIDwgODEgJiYgcGFyc2VJbnQoaW5wdXQpICUgMSA9PSAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIganVtcHUgPSB0cnVlX3VybC5yZXBsYWNlKC8oXFxcXFxcXFw/cGFnZT1cXFxcXFxcXGQrfFxcXFxcXFxcJnBhZ2U9XFxcXFxcXFxkK3wkKS8sIChtYXRjaCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXRjaC5zdGFydHNXaXRoKCc/cGFnZT0nKSB8fCBtYXRjaC5zdGFydHNXaXRoKCcmcGFnZT0nKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWF0Y2guY2hhckF0KDApICsgJ3BhZ2U9JyArIGlucHV0O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAodHJ1ZV91cmwuaW5jbHVkZXMoJz8nKSA/ICcmcGFnZT0nIDogJz9wYWdlPScpICsgaW5wdXQ7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRWYXIoTVlfUlVMRS51cmwsIGp1bXB1KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCd5aV9maXJzdHBhZ2UnLCBqdW1wdSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5L2g5bey57uP56m/6LaK5Yiw5LqGJyArIGlucHV0ICsgJ+mhtSdcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6K+36L6T5YWl5q2j56Gu55qE6aG156CBXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRydWVfdXJsKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRydWVfdXJsKVxcXFxuICAgICAgICAgICAgICAgICAgICB9XVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICBpZiAobGF6eSAhPSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgZGRbXFxcXFxcXCJ1cmxcXFxcXFxcIl0gPSB1cmwgKyBsYXp5O1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgYXJyLnB1c2goZGQpO1xcXFxuICAgICAgICB9KTtcXFxcbiAgICB9LFxcXFxuICAgIExpc3Q6IGZ1bmN0aW9uKGFyciwgaHRtbCwgcnVsZSwgcGFyYW0pIHtcXFxcbiAgICAgICAgcGFyYW0gPSBwYXJhbSA/IHBhcmFtIDoge307XFxcXG4gICAgICAgIHZhciBhdXRvID0gcGFyYW0uYXV0byA/IHBhcmFtLmF1dG8gOiBmYWxzZTtcXFxcbiAgICAgICAgdmFyIHNob3cgPSBwYXJhbS5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0sIHJ1bGUudGl0bGUpO1xcXFxuICAgICAgICAgICAgICAgIHZhciBkZXNjID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUuZGVzYyk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGltZyA9IHRoaXMuaW1nSGFuZGxlKGl0ZW0sIHJ1bGUpO1xcXFxuICAgICAgICAgICAgICAgIHZhciB1cmwgPSB0aGlzLnVybEhhbmRsZShpdGVtLCBydWxlKTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgY29udGVudCA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmNvbnRlbnQpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgaWYgKGRlYnVnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciByeCA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGltZyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmxcXFxcbiAgICAgICAgICAgICAgICAgICAgfTtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWJ1Z2xvZyhpLCBpdGVtLCBydWxlLCByeCk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICAgICAgaWYgKGkgPT0gbGlzdC5sZW5ndGggLSAxKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlkID0gXFxcXFxcXCJsYXN0aWRfXFxcXFxcXCIgKyBwYWdlO1xcXFxuICAgICAgICAgICAgICAgICAgICBjbHMgPSBcXFxcXFxcImxhc3RtYXJrXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogZGVzYyxcXFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogaW1nLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IChlbXB0eSA/IFxcXFxcXFwiaGlrZXI6Ly9lbXB0eSMjXFxcXFxcXCIgOiAnJykgKyB1cmwgKyAnP3BhZ2U9ZnlwYWdlI25vSGlzdG9yeSNAcnVsZT1qczokLnJlcXVpcmUoXFxcXFxcXCJ5alxcXFxcXFwiKScsXFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBydWxlLmNvbF90eXBlLFxcXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiB0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGltZzogaW1nLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGlkLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBjbHMsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+OAkOi3s+mhteOAkScsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygodHJ1ZV91cmwpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJCgnJywgJzHliLAzMeS5i+mXtOeahOeahOmhteeggScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5pbnB1dCgodHJ1ZV91cmwpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhcnNlSW50KGlucHV0KSA+IDEgJiYgcGFyc2VJbnQoaW5wdXQpIDwgODEgJiYgcGFyc2VJbnQoaW5wdXQpICUgMSA9PSAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIganVtcHUgPSB0cnVlX3VybC5yZXBsYWNlKC8oXFxcXFxcXFw/cGFnZT1cXFxcXFxcXGQrfFxcXFxcXFxcJnBhZ2U9XFxcXFxcXFxkK3wkKS8sIChtYXRjaCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXRjaC5zdGFydHNXaXRoKCc/cGFnZT0nKSB8fCBtYXRjaC5zdGFydHNXaXRoKCcmcGFnZT0nKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWF0Y2guY2hhckF0KDApICsgJ3BhZ2U9JyArIGlucHV0O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAodHJ1ZV91cmwuaW5jbHVkZXMoJz8nKSA/ICcmcGFnZT0nIDogJz9wYWdlPScpICsgaW5wdXQ7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRWYXIoTVlfUlVMRS51cmwsIGp1bXB1KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCd5aV9maXJzdHBhZ2UnLCBqdW1wdSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5L2g5bey57uP56m/6LaK5Yiw5LqGJyArIGlucHV0ICsgJ+mhtSdcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6K+36L6T5YWl5q2j56Gu55qE6aG156CBXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRydWVfdXJsKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRydWVfdXJsKVxcXFxuICAgICAgICAgICAgICAgICAgICB9XVxcXFxuICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIGlmIChpID09IGxpc3QubGVuZ3RoIC0gMSAmJiBzaG93KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJsaW5lXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBcXFxcXFxcInBhZ2VsaW5lXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi4oCc4oCc4oCd4oCdPHNtYWxsPuWKoOi9veS4rS4uLjwvc21hbGw+XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF9jZW50ZXJfMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogXFxcXFxcXCJwYWdlbnVtXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcXFxcXCJwYWdlbnVtXFxcXFxcXCIsIHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnTxmb250IGNvbG9yPVxcXFxcXFwiZ3JleVxcXFxcXFwiPjxzbWFsbD7liLDlupXkuoY8L3NtYWxsPjwvZm9udD4nLFxcXFxuICAgICAgICAgICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF9jZW50ZXJfMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBcXFxcXFxcImxhc3RcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgIH1cXFxcbi8qXFxcXG4gICAgICAgIGlmIChsaXN0Lmxlbmd0aCA9PSAwICYmIHBhZ2UgPT0gMSkge1xcXFxuICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJsaW5lXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFxcXFxcImdyZXlcXFxcXFxcIj48c21hbGw+5peg5YaF5a65PC9zbWFsbD48L2ZvbnQ+JyxcXFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge30sXFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfSovXFxcXG4gICAgICAgIGlmICh0aGlzLm5leHRQYWdlKCkpIHtcXFxcbiAgICAgICAgICAgIC8vbG9nKCd0Jyk7XFxcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcigneWlfaXNuZXh0JywgJ3QnKTtcXFxcbiAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgIC8vbG9nKCdmJyk7XFxcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcigneWlfaXNuZXh0JywgJ2YnKTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBpZiAoYXV0bykge1xcXFxuICAgICAgICAgICAgLy9jcmVhdGVOZXh0UGFnZSgpO1xcXFxuICAgICAgICAgICAgYXV0b1BhZ2UoKTtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0sXFxcXG59O1xcXFxuXFxcXG52YXIgZXh0TWV0aG9kID0ge1xcXFxuICAgIFRvUGFyYW1zOiBmdW5jdGlvbigpIHtcXFxcbiAgICAgICAgdmFyIGpzb24gPSBhcmd1bWVudHNbMF07XFxcXG4gICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhqc29uKVxcXFxuICAgICAgICAgICAgLm1hcCgoa2V5KSA9PiBrZXkgKyBcXFxcXFxcIj1cXFxc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RSZWYoKTtcXFxcbiAgICAgICAgICAgIGRpY3QuSG9zdHMgPSBgJHtkaWN0LlByb3RvY29sfTovLyR7dXJsLmdldEhvc3QoKX1gO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGRpY3QuUGFyYW1zID0gcGFyYW1zKHUpO1xcXFxuICAgICAgICByZXR1cm4gZGljdDtcXFxcbiAgICB9LFxcXFxuICAgIGlzRXF1YWw6IGZ1bmN0aW9uKHgsIHkpIHtcXFxcbiAgICAgICAgY29uc3Qgb2sgPSBPYmplY3Qua2V5cyxcXFxcbiAgICAgICAgICAgIHR4ID0gdHlwZW9mIHgsXFxcXG4gICAgICAgICAgICB0eSA9IHR5cGVvZiB5O1xcXFxuICAgICAgICByZXR1cm4geCAmJiB5ICYmIHR4ID09PSBcXFxcXFxcIm9iamVjdFxcXFxcXFwiICYmIHR4ID09PSB0eSA/XFxcXG4gICAgICAgICAgICBvayh4KS5sZW5ndGggPT09IG9rKHkpLmxlbmd0aCAmJlxcXFxuICAgICAgICAgICAgb2soeCkuZXZlcnkoKGtleSkgPT4gdGhpcy5pc0VxdWFsKHhba2V5XSwgeVtrZXldKSkgOiB4ID09PSB5O1xcXFxuICAgIH0sXFxcXG4gICAgZmluZERpZmZlcmVudEluZGV4OiBmdW5jdGlvbihzdHIxLCBzdHIyKSB7XFxcXG4gICAgICAgIGNvbnN0IGRpZmZDaGFycyA9IFtdO1xcXFxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0cjIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgIGlmIChzdHIxW2ldICE9PSBzdHIyW2ldKSB7XFxcXG4gICAgICAgICAgICAgICAgZGlmZkNoYXJzLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICBpbmRleDogaSxcXFxcbiAgICAgICAgICAgICAgICAgICAgczE6IHN0cjFbaV0sXFxcXG4gICAgICAgICAgICAgICAgICAgIHMyOiBzdHIyW2ldLFxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHJldHVybiBkaWZmQ2hhcnM7XFxcXG4gICAgfSxcXFxcbiAgICByZXBsYWNlQ2hhckF0OiBmdW5jdGlvbihzdHIsIGluZGV4LCByZXBsYWNlbWVudCkge1xcXFxuICAgICAgICBpZiAoaW5kZXggPCAwIHx8IGluZGV4ID49IHN0ci5sZW5ndGgpIHtcXFxcbiAgICAgICAgICAgIHJldHVybiBzdHI7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgLy9sb2coaW5kZXgpXFxcXG4gICAgICAgIGNvbnN0IGFyciA9IHN0ci5zcGxpdChcXFxcXFxcIlxcXFxcXFwiKTtcXFxcbiAgICAgICAgYXJyW2luZGV4XSA9IHJlcGxhY2VtZW50O1xcXFxuICAgICAgICByZXR1cm4gYXJyLmpvaW4oXFxcXFxcXCJcXFxcXFxcIik7XFxcXG4gICAgfSxcXFxcbiAgICBnZXRPYmplY3RLZXlzRGlmZjogZnVuY3Rpb24ob2JqMSwgb2JqMikge1xcXFxuICAgICAgICBjb25zdCBkaWZmZXJlbnRLZXlzID0gW107XFxcXG4gICAgICAgIGZvciAobGV0IGtleSBpbiBvYmoxKSB7XFxcXG4gICAgICAgICAgICBpZiAoIW9iajIuaGFzT3duUHJvcGVydHkoa2V5KSB8fCBvYmoxW2tleV0gIT09IG9iajJba2V5XSkge1xcXFxuICAgICAgICAgICAgICAgIGRpZmZlcmVudEtleXMucHVzaChrZXkpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGZvciAobGV0IGtleSBpbiBvYmoyKSB7XFxcXG4gICAgICAgICAgICBpZiAoIW9iajEuaGFzT3duUHJvcGVydHkoa2V5KSkge1xcXFxuICAgICAgICAgICAgICAgIGRpZmZlcmVudEtleXMucHVzaChrZXkpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHJldHV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AgICAgICAgICAgICAgICAgIGxvZyh1MS5QYXRoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgbG9nKHUyLlBhdGgpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB2YXIgZGYgPSB0aGlzLmZpbmREaWZmZXJlbnRJbmRleChTdHJpbmcodTEuUGF0aCksIFN0cmluZyh1Mi5QYXRoKSk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKGR0X2RlYnVnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhkZik7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGlmIChkZi5sZW5ndGggPT0gMSkge1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgcmUgPSBkZlswXS5pbmRleDtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGRmLmZpbHRlcigoeCkgPT4gL1xcXFxcXFxcZCsvLnRlc3QoeC5zMikpO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgcmUgPSBmWzBdLmluZGV4O1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB2YXIgZXEgPSB0aGlzLnJlcGxhY2VDaGFyQXQoU3RyaW5nKHUyLlBhdGgpLCByZSwgXFxcXFxcXCJmeXBhZ2VcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgbmV4dHVybCA9IHUyLkhvc3RzICsgZXEgKyBjYSArIHRoaXMuVG9QYXJhbXModTIuUGFyYW1zKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGVwID0gdGhpcy5nZXRPYmplY3RLZXlzRGlmZih1MS5QYXJhbXMsIHUyLlBhcmFtcylcXFxcbiAgICAgICAgICAgICAgICBpZiAoZXAubGVuZ3RoID09IDEpIHtcXFxcbiAgICAgICAgICAgICAgICAgIC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