Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@云盘君.简@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoi5LqR55uY5ZCbLueugCIsImF1dGhvciI6IuWwj+ajieiihPCfjJ4mQExveURnSWsiLCJ1cmwiOiJoaWtlcjovL2VtcHR5IyNmeXBhZ2UiLCJ2ZXJzaW9uIjoxMjQsImNvbF90eXBlIjoibW92aWVfMyIsImNsYXNzX25hbWUiOiIiLCJ0eXBlIjoiYWxsIiwiY2xhc3NfdXJsIjoiIiwiYXJlYV9uYW1lIjoiIiwiYXJlYV91cmwiOiIiLCJzb3J0X25hbWUiOiIiLCJ5ZWFyX25hbWUiOiIiLCJzb3J0X3VybCI6IiIsInllYXJfdXJsIjoiIiwiZmluZF9ydWxlIjoianM6JC5yZXF1aXJlKFwiTWFpblwiKTsiLCJzZWFyY2hfdXJsIjoiaGlrZXI6Ly9lbXB0eT9zZWFyY2hUZXJtcz0qKiIsImdyb3VwIjoi4pGg572R55uYIiwic2VhcmNoRmluZCI6ImpzOlxubGV0IGtleSA9IGdldFBhcmFtKFwic2VhcmNoVGVybXNcIik7XG5zZXRSZXN1bHQoW3tcbiAgICB0aXRsZTogXCLngrnmiJHlvIDlp4vogZrlkIjmkJzntKJcIiArIGtleSxcbiAgICB1cmw6IFwiaGlrZXI6Ly9wYWdlL3NvdSNub0hpc3RvcnkjP3A9ZnlwYWdlXCIsXG4gICAgZXh0cmE6IHtcbiAgICAgICAgcGFnZVRpdGxlOiBcIuaQnOe0olwiICsga2V5LFxuICAgICAgICBzZWFyY2hUZXJtczoga2V5LFxuICAgICAgICBoaWRlU2V0dGluZzogdHJ1ZVxuICAgIH1cbn1dKTsiLCJkZXRhaWxfY29sX3R5cGUiOiJtb3ZpZV8xIiwiZGV0YWlsX2ZpbmRfcnVsZSI6IiIsInNkZXRhaWxfY29sX3R5cGUiOiJtb3ZpZV8xIiw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biAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoKSA9PiAkLnJlcXVpcmUoXFxcImxvZ2luTW9kZVxcXCIpKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzFcXFwiLFxcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuacquajgOa1i+WIsOeZu+W9leS/oeaBr++8jOeCueaIkei3s+i9rOeZu+W9lei0puWPt+mhtemdou+8jOeZu+W9lemYv+mHjOS6keebmOi0puWPt+WQjuaWueWPr+S9v+eUqOacrOWcsOi9rOeggeaooeW8j1xcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IFxcXCLnmbvlvZXpmL/ph4zkupHnm5hcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICBhZGRMaXN0ZW5lcihcXFwib25DbG9zZVxcXCIsICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICAgICAgY2xlYXJNeVZhcihcXFwic1xcXCIpO1xcbiAgICB9KSk7XFxuICAgIGFkZExpc3RlbmVyKFxcXCJvblJlZnJlc2hcXFwiLCAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgIGlmICghZ2V0TXlWYXIoXFxcInJlZnNcXFwiLCBcXFwiXFxcIikpIHtcXG4gICAgICAgICAgICBjbGVhck15VmFyKFxcXCJzXFxcIik7XFxuICAgICAgICB9XFxuICAgIH0pKTtcXG59XFxuXFxuZnVuY3Rpb24gc2V0SGVhZCgpIHtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBcXFwi5pCc57Si77yaXFxcIiArIFtcXFwi6buY6K6kXFxcIiwgXFxcIueyvuWHhlxcXCJdW3NlYXJjaE1vZGVdLFxc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dlI25vUmVjb3JkSGlzdG9yeSMjbm9IaXN0b3J5I1xcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKFxcXCLmlK/mjIHkvZzogIVcXFwiID09IGlucHV0KSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9Eb25hdGUudiNub1JlY29yZEhpc3RvcnkjI25vSGlzdG9yeSNcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChcXFwi55m75b2V6Zi/6YeM6LSm5Y+3XFxcIiA9PSBpbnB1dCkge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQucmVxdWlyZShcXFwibG9naW5Nb2RlXFxcIik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKFxcXCLnmbvlvZXkv6Hmga9cXFwiID09IGlucHV0KSB7XFxuICAgICAgICAgICAgICAgICAgICBjb25zdCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgb3BlblRva2Vuc0ZpbGVwYXRoLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGFsaVRva2Vuc0ZpbGVwYXRoXFxuICAgICAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXCJ0b2tlblBhdGhcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmICghZmlsZUV4aXN0KGFsaVRva2Vuc0ZpbGVwYXRoKSkgcmV0dXJuIFxcXCJ0b2FzdDovL+i/mOacqueZu+mZhlxcXCI7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgYWxpID0gcmVxdWVzdChhbGlUb2tlbnNGaWxlcGF0aCk7XFxuICAgICAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGFsaSA9IEpTT04ucGFyc2UoYWxpKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVGaWxlKGFsaVRva2Vuc0ZpbGVwYXRoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6I635Y+W5aSx6LSlXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGNvbmZpcm0oe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn55m75b2V5L+h5oGvJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFwi55So5oi3OlxcXCIgKyAoYWxpLm5pY2tfbmFtZSB8fCBhbGkudXNlcl9uYW1lIHx8IFxcXCJUb2tlbueZu+W9lVxcXCIpICsgXFxcIlxcXFxuVG9rZW46XFxcIiArIGFsaS5yZWZyZXNoX3Rva2VuICsgXFxcIlxcXFxuKOWPlua2iO+8muazqOmUgOeZu+W9le+8m+ehruWumu+8muWkjeWItlRva2VuKVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybTogJC50b1N0cmluZygodG9rZW4pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8vXFxcIiArIHRva2VuO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGFsaS5yZWZyZXNoX3Rva2VuKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYW5jZWw6ICQudG9TdHJpbmcoKHBhdGgxLCBwYXRoMikgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwi56Gu6K6k5rOo6ZSA55m75b2VXFxcIikuY29uZmlybSgocGF0aDEsIHBhdGgyKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVGaWxlKHBhdGgxKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZUZpbGUocGF0aDIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lt7LmiJDlip/pgIDlh7rnmbvpmYZcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBwYXRoMSwgcGF0aDIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGFsaVRva2Vuc0ZpbGVwYXRoLCBvcGVuVG9rZW5zRmlsZXBhdGgpXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpbnB1dCA9IGlucHV0LnJlcGxhY2UoXFxcIuaooeW8j++8mlxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFwib3Blbk1vZGVcXFwiLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBcXFwi5a6Y5pa5QVBQXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S/ruaUueaIkOWKn++8jOivt+ehruS/neaJi+acuuacieWuieijhemYv+mHjOS6keebmOWumOaWuUFQUFxcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSksXFxuICAgICAgICBjb2xfdHlwZTogXFxcImljb25fMl9yb3VuZFxcXCIsXFxuICAgICAgICBkZXNjOiBcXFwiXFxcIixcXG4gICAgICAgIHBpY191cmw6IFxcXCJoaWtlcjovL2ltYWdlcy9pY29uX21lbnU2XFxcIlxcbiAgICB9KTtcXG5cXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiAn5pCc57SiJyxcXG4gICAgICAgIGRlc2M6ICfor7fovpPlhaX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WV9SVUxFLnRpdGxlLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgfSwge1xcbiAgICAgICAgdGl0bGU6IFxcXCJcXFwiID09IHIgPyBcXFwi4oCc4oCc5YWo6YOo4oCd4oCdXFxcIiA6IFxcXCLlhajpg6hcXFwiLFxcbiAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChzLCBpZCkgPT4ge1xcbiAgICAgICAgICAgIGxldCBxciA9IGdldEl0ZW0oXFxcInJ1bGVcXFwiLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgY2xlYXJJdGVtKFxcXCJydWxlXFxcIik7XFxuICAgICAgICAgICAgaWYgKHMpIHtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKFxcXCLlhajpg6hcXFwiICsgaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc5YWo6YOo4oCd4oCdXFxcIlxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgaWYgKHFyKSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGlkICsgcXIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogcXJcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgIH0sIHMsIGlkKSxcXG4gICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGlkOiBcXFwi5YWo6YOoXFxcIiArIGlkXFxuICAgICAgICB9XFxuICAgIH0pO1xcbiAgICBmb3IgKGxldCBbaXQsIGJhc2ljVXJsXSBvZiBydWxlcykge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogaXQgPT0gciA/IFxcXCLigJzigJxcXFwiICsgaXQgKyBcXFwi4oCd4oCdXFxcIiA6IGl0LFxcbiAgICAgICAgICAgIHVybDogJCgoYmFzaWNVcmwgfHwgXFxcIlxcXCIpICsgXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKHIsIHMsIGlkKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBxciA9IGdldEl0ZW0oXFxcInJ1bGVcXFwiLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcInJ1bGVcXFwiLCByKTtcXG4gICAgICAgICAgICAgICAgaWYgKHMpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHFyID8gKGlkICsgcXIpIDogKFxcXCLlhajpg6hcXFwiICsgaWQpLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHFyIHx8IFxcXCLlhajpg6hcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oaWQgKyByLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJxcXFwiICsgciArIFxcXCLigJ3igJ1cXFwiXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgfSwgaXQsIHMsIGlkKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwi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vluqbvvJoxL1xcXCIgKyBkYXRhLmxlbmd0aCxcXG4gICAgICAgICAgICB1cmw6IFxcXCJcXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgZGVzYzogXFxcIlxcXCIsXFxuICAgICAgICAgICAgcGljX3VybDogXFxcIlxcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IHBhZ2VpZFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICB9XFxuICAgIHNldFJlc3VsdChkKTtcXG4gICAgaWYgKGRhdGEubGVuZ3RoID4gMCkge1xcbiAgICAgICAgLy/lpJrnur/nqIvliqDovb0gICAgICAgIFxcbiAgICAgICAgbGV0IHJlYWxQYWdlID0gXFxcIlxcXCIgPT0gciA/IDEgOiBwO1xcbiAgICAgICAgbGV0IHRhc2tzID0gZGF0YS5tYXAoaXQgPT4ge1xcbiAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgIGZ1bmM6IGZ1bmN0aW9uKHJ1bGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQucmVxdWlyZShcXFwiZGF0YVxcXCIpLmNhcnJ5UnVsZShydWxlLCBzLCByZWFsUGFnZSwgc2VhcmNoTW9kZSwgb3Blbk1vZGUpO1xcbiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhydWxlLm5hbWUgKyBcXFwiOlxcXCIgKyBlLnRvU3RyaW5nKCkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8qaWYoZGF0YS5sZW5ndGg9PT0xJiZwPT09MSl7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6XFxcIuKAnOKAnFxcXCIrcnVsZS5uYW1lK1xcXCIgRVJST1LigJ3igJ1cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogZS50b1N0cmluZygpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6XFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOlxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOntcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfV07XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSovXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAvL3JldHVybiBydWxlLmZpbmQocywgcmVhbFBhZ2UpO1xcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBwYXJhbTogaXQsXFxuICAgICAgICAgICAgICAgIGlkOiBcXFwicnVsZUBcXFwiICsgaXQubmFtZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgYmF0Y2hFeGVjdXRlKHRhc2tzLCB7XFxuICAgICAgICAgICAgZnVuYzogZnVuY3Rpb24ocGFyYW0sIGlkLCBlcnJvciwgcmVzdWx0KSB7XFxuICAgICAgICAgICAgICAgIHBhcmFtLmkgKz0gMTtcXG4gICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkocmVzdWx0KSkge1xcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbShcXFwiX25vdGhhdmVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1CZWZvcmUocGFnZWlkLCByZXN1bHQpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChwYXJhbS5pID09PSBwYXJhbS5hbGwpIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmICghcmVzdWx0IHx8ICFyZXN1bHQubGVuZ3RoKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbShcXFwiX25vdGhhdmVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBhZGRJdGVtQmVmb3JlKHBhZ2VpZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgXFxcIn5+fuS7gOS5iOi1hOa6kOmDveayoeacieWTpn5+flxcXCIuZm9udGNvbG9yKFxcXCJHcmF5XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogXFxcIl9ub3RoYXZlXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtKHBhZ2VpZCk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHBhZ2VpZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5Yqg6L2956ysXFxcIiArIE1ZX1BBR0UgKyBcXFwi6aG15Lit77yM6L+b5bqm77yaXFxcIiArIChwYXJhbS5pICsgMSkgKyBcXFwiL1xcXCIgKyBwYXJhbS5hbGwsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIHBhcmFtOiB7XFxuICAgICAgICAgICAgICAgIGFsbDogZGF0YS5sZW5ndGgsXFxuICAgICAgICAgICAgICAgIGk6IDAsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgfVxcbn1cXG5cXG5mdW5jdGlvbiBzZXRIaXN0b3J5KCkge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICc8c3BhbiBzdHlsZT1cXFwiY29sb3I6I2ZmNjYwMVxcXCI+PGI+5Y6G5Y+y6K6w5b2VPC9iPjwvc3Bhbj4nLFxcbiAgICAgICAgcGljX3VybDogXFxcImhpa2VyOi8vaW1hZ2VzL2ljb25fY2xvY2tcXFwiLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJhdmF0YXJcXFwiLFxcbiAgICAgICAgdXJsOiAkKFtcXFwi5riF6Zmk5pCc57Si6K6w5b2VXFxcIiwgXFxcIuaJk+W8gOingueci+iusOW9lVxcXCJdKS5zZWxlY3QoKGlkKSA9PiB7XFxuICAgICAgICAgICAgaWYgKGlucHV0ID09PSBcXFwi5riF6Zmk5pCc57Si6K6w5b2VXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwi56Gu5a6a5riF6Zmk5YWo6YOo5pCc57Si6K6w5b2V77yfXFxcIikuY29uZmlybSgoaWQpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFySXRlbShcXFwic2VhcmNoSGlzdG9yeVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKGlkICsgXFxcIjprZXlcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihpZCArIFxcXCI6c2VhcmNoSGlzdG9yeVxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIFxcXCJ+fn7ku4DkuYjpg73msqHmnInlk6Z+fn5cXFwiLmZvbnRjb2xvcihcXFwiR3JheVxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogaWQgKyBcXFwiOmtleVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9LCBpZCk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2hpc3Rvcnk/cnVsZT1cXFwiICsgTVlfUlVMRS50aXRsZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCBpZCksXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGlkOiBpZCArIFxcXCI6c2VhcmNoSGlzdG9yeVxcXCIsXFxuICAgICAgICB9XFxuICAgIH0pO1xcblxcbiAgICBsZXQgaGlzdG9yeSA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcInNlYXJjaEhpc3RvcnlcXFwiLCBbXSk7XFxuICAgIGxldCBpID0gMDtcXG4gICAgZm9yIChsZXQga2V5IG9mIGhpc3RvcnkpIHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IGtleSxcXG4gICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKGlkLCBrZXkpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGV4dHJhID0gZmluZEl0ZW0oaWQgKyBcXFwic3NcXFwiKS5leHRyYTtcXG4gICAgICAgICAgICAgICAgZXh0cmEuZGVmYXVsdFZhbHVlID0ga2V5O1xcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHtcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiBleHRyYVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICB9LCBpZCwga2V5KSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImZsZXhfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogaWQgKyBcXFwiOmtleTpcXFwiICsga2V5LFxcbiAgICAgICAgICAgICAgICBjbHM6IGlkICsgXFxcIjprZXlcXFwiLFxcbiAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuWIoOmZpOWFs+mUruivjTpcXFwiICsga2V5LFxcbiAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGlkLCBrZXksIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgaGlzdG9yeSA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcInNlYXJjaEhpc3RvcnlcXFwiLCBbXSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaGlzdG9yeS5zcGxpY2UoaSwgMSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFwic2VhcmNoSGlzdG9yeVxcXCIsIGhpc3RvcnkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0oaWQgKyBcXFwiOmtleTpcXFwiICsga2V5KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL3RvYXN0KCk7XFxuICAgICAgICAgICAgICAgICAgICB9LCBpZCwga2V5LCBpKVxcbiAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICAgICAgaSsrO1xcbiAgICB9XFxuICAgIGlmIChoaXN0b3J5Lmxlbmd0aCA9PT0gMCkge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIFxcXCJ+fn7ku4DkuYjpg73msqHmnInlk6Z+fn5cXFwiLmZvbnRjb2xvcihcXFwiR3JheVxcXCIpLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGNsczogaWQgKyBcXFwiOmtleVxcXCIsXFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICB9XFxufVxcblxcbmZ1bmN0aW9uIHNldFRyZW5kaW5nVGFiRW5kKCkge1xcbiAgICBsZXQgaG90Q2xhc3MgPSB7XFxuICAgICAgICBcXFwi55m+5bqmXFxcIjoge1xcbiAgICAgICAgICAgIFxcXCLnlLXop4bliadcXFwiOiBcXFwidGVsZXBsYXlcXFwiLFxcbiAgICAgICAgICA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FnZShmYWxzZSk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3suWIh+aNouS4ulxcXCIgKyBpbnB1dDtcXG4gICAgICAgIH0pLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJhdmF0YXJcXFwiLFxcbiAgICAgICAgcGljX3VybDogXFxcImhpa2VyOi8vaW1hZ2VzL2ljb25fZmlyZVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLliIfmjaLmlbDmja7mupBcXFwiLFxcbiAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoZGF0YVNvdXJjZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoZGF0YVNvdXJjZSwgMSwgXFxcIuWIh+aNouaVsOaNrua6kFxcXCIpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwiZGF0YVNvdXJjZVxcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbGVhckl0ZW0oXFxcImhvdGtleVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5bey5YiH5o2i5Li6XFxcIiArIGlucHV0O1xcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH0sIGRhdGFTb3VyY2UpXFxuICAgICAgICAgICAgfV1cXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogXFxcIuato+WcqOWKoOi9vS4uLlxcXCIsXFxuICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGlkOiBpZCArIFxcXCI6aG90a2V5XFxcIixcXG4gICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIHNldFJlc3VsdChkKTtcXG4gICAgbGV0IHNkID0gW107XFxuICAgIGxldCBzZXRTZWFyY2hLZXkgPSBuYW1lID0+IHtcXG4gICAgICAgIHB1dE15VmFyKCdzJywgbmFtZSk7XFxuICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICB9O1xcblxcbiAgICBsZXQgZ2V0VGl0bGUgPSAoaSwgbmFtZSkgPT4ge1xcbiAgICAgICAgbGV0IGNvbG9yO1xcbiAgICAgICAgc3dpdGNoIChpKSB7XFxuICAgICAgICAgICAgY2FzZSAwOlxcbiAgICAgICAgICAgICAgICBjb2xvciA9IFxcXCIjZmYzMzAwXFxcIjtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSAxOlxcbiAgICAgICAgICAgICAgICBjb2xvciA9IFxcXCIjZmY2NjAwXFxcIjtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSAyOlxcbiAgICAgICAgICAgICAgICBjb2xvciA9IFxcXCIjZmY5OTAwXFxcIlxcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICBjb2xvciA9IFxcXCJibGFja1xcXCI7XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBTdHJpbmcoaSArIDEpLmZvbnRjb2xvcihjb2xvcikgKyBcXFwiXFxcXHRcXFxcdFxcXFx0XFxcIiArIG5hbWU7XFxuICAgIH1cXG4gICAgdHJ5IHtcXG4gICAgICAgIHN3aXRjaCAoc2VsZWN0c291cmNlKSB7XFxuICAgICAgICAgICAgY2FzZSBcXFwi55m+5bqmXFxcIjpcXG4gICAgICAgICAgICAgICAgdmFyIGpzb24gPSByZXF1ZXN0KCdodHRwczovL3RvcC5iYWlkdS5jb20vYXBpL2JvYXJkP3BsYXRmb3JtPXdpc2UmdGFiPScgKyB0YWJrZXkgKyAnJnRhZz0lN0IlMjJjYXRlZ29yeSUyMjolMjIlRTUlODUlQTglRTklODMlQTglRTclQjElQkIlRTUlOUUlOEIlMjIlN0QnLCB7XFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiAnTW96aWxsYS81LjAgKExpbnV4OyBBbmRyb2lkIDYuMDsgTmV4dXMgNSBCdWlsZC9NUkE1OE4pIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIENocm9tZS85OS4wLjQ4NDQuNTEgTW9iaWxlIFNhZmFyaS81MzcuMzYnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdIb3N0JzogJ3RvcC5iYWlkdS5jb20nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdBY2NlcHQnOiAnYXBwbGljYXRpb24vanNvbiwgdGV4dC9wbGFpbiwgKi8qJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnQWNjZXB0LUxhbmd1YWdlJzogJ3poLUNOLHpoO3E9MC45LGVuLVVTO3E9MC44LGVuO3E9MC43JyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnQWNjZXB0LUVuY29kaW5nJzogJ2d6aXAsIGRlZmxhdGUsIGJyJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3RvcC5iYWlkdS5jb20vYm9hcmQ/dGFiPW5vdmVsJyxcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIC8vdmFyIHMgPSBEYXRlLm5vdygpO1xcbiAgICAgICAgICAgICAgICB2YXIgbGlzdCA9IEpTT04ucGFyc2UoanNvbikuZGF0YS5jYXJkc1swXS5jb250ZW50O1xcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBpdGVtID0gbGlzdFtpXTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBuYW1lID0gaXRlbS53b3JkICsgJyAoJyArIGl0ZW0uc2hvd1syXSArICcpJztcXG4gICAgICAgICAgICAgICAgICAgIGxldCBkZXMgPSBpdGVtLmRlc2M7XFxuICAgICAgICAgICAgICAgICAgICBzZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogZ2V0VGl0bGUoaSwgbmFtZSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKHNldFNlYXJjaEtleSwgaXRlbS53b3JkKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBkZXMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgaW1nOiBpdGVtLmltZyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcIm1vdmllXzFfdmVydGljYWxfcGljXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSBcXFwi5aS45YWLXFxcIjpcXG4gICAgICAgICAgICAgICAgdmFyIGpzb24gPSByZXF1ZXN0KFxcXCJodHRwczovL25ld3MubXlxdWFyay5jbi92Mi90b3BsaXN0L21vdmllPyZjaGFubmVsPVxcXCIgKyB0YWJrZXkgKyBcXFwiJnJhbmtfdHlwZT0lRTYlOUMlODAlRTclODMlQURcXFwiKTtcXG4gICAgICA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iKTtcXG5sZXQgcnVsZSA9IE1ZX1JVTEUudGl0bGU7XFxubGV0IHVybCA9IGRlY29kZVVSSUNvbXBvbmVudChnZXRQYXJhbShcXFwid2ViVXJsXFxcIixcXFwiXFxcIikpO1xcblxcbmZ1bmN0aW9uIGludGVyY2VwdChydWxlLCBvcmlnaW4sIG9wZW5Nb2RlKSB7XFxuICAgIGxldCBob3N0ID0gb3JpZ2luLnJlcGxhY2UobmV3IFJlZ0V4cChcXFwiaHR0cDovL3xodHRwczovL1xcXCIpLCBcXFwiXFxcIikuc3BsaXQoXFxcIi9cXFwiKVswXTtcXG4gICAgbGV0IGhvc3RzID0gaG9zdC5zcGxpdChcXFwiLlxcXCIpO1xcbiAgICBpZiAoaG9zdHMubGVuZ3RoID4gMikge1xcbiAgICAgICAgaG9zdCA9IGhvc3RzW2hvc3RzLmxlbmd0aCAtIDJdICsgXFxcIi5cXFwiICsgaG9zdHNbaG9zdHMubGVuZ3RoIC0gMV07XFxuICAgIH1cXG4gICAgaWYgKGlucHV0LnN0YXJ0c1dpdGgoXFxcIm1hZ25ldFxcXCIpKSB7XFxuICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIua4qemmqOaPkOekulxcXCIsXFxuICAgICAgICAgICAgY29udGVudDogXFxcIuajgOa1i+WIsOaWsOeahOejgemTvuWcsOWdgO+8jOeCueWHu+ehruWumuaMiemSruWNs+WPr+aSreaUvu+8jOeCueWHu+WPlua2iOaMiemSruWPr+S7peWkjeWItumTvuaOpVxcXCIsXFxuICAgICAgICAgICAgY29uZmlybTogJC50b1N0cmluZygobWFnKSA9PiB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBtYWc7XFxuICAgICAgICAgICAgfSwgaW5wdXQpLFxcbiAgICAgICAgICAgIGNhbmNlbDogJC50b1N0cmluZygobWFnKSA9PiB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBtYWdcXG4gICAgICAgICAgICB9LC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AgICAgZnlfYnJpZGdlX2FwcC5wbGF5VmlkZW8odXJsKTtcXG4gICAgICAgIH0sIGlucHV0LCBydWxlKTtcXG4gICAgfSBlbHNlIGlmICghaW5wdXQuaW5jbHVkZXMoaG9zdCkgJiYgaW5wdXQuc3RhcnRzV2l0aChcXFwiaHR0cFxcXCIpKSB7XFxuICAgICAgICBsb2coaW5wdXQpO1xcbiAgICAgICAgcmV0dXJuICQudG9TdHJpbmcoKHVybCwgcnVsZSkgPT4ge1xcbiAgICAgICAgICAgIGZ5X2JyaWRnZV9hcHAub3BlbihKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi6K+m5oOFXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL3lzZng/d2ViVXJsPVxcXCIrZW5jb2RlVVJJQ29tcG9uZW50KHVybCkrXFxcIiZydWxlPVxcXCIrcnVsZSxcXG4gICAgICAgICAgICB9KSlcXG4gICAgICAgIH0sIGlucHV0LCBydWxlKTtcXG4gICAgfSBlbHNlIGlmICghaW5wdXQuc3RhcnRzV2l0aChcXFwiaHR0cFxcXCIpKSB7XFxuICAgICAgICBsb2coaW5wdXQpO1xcbiAgICAgICAgLy/og73llKTotbdBUFDnmoTnmb3lkI3ljZVcXG4gICAgICAgIGxldCB3aGl0ZSA9IFtcXG4gICAgICAgICAgICBcXFwicWtsaW5rXFxcIixcXG4gICAgICAgICAgICBcXFwiYmRuZXRkaXNrXFxcIixcXG4gICAgICAgICAgICBcXFwieHVubGVpYXBwXFxcIixcXG4gICAgICAgICAgICBcXFwic21hcnRkcml2ZVxcXCJcXG4gICAgICAgIF07XFxuICAgICAgICBsZXQgaW5XaGl0ZSA9IHdoaXRlLmZpbHRlcihpdCA9PiBpbnB1dC5zdGFydHNXaXRoKGl0KSkubGVuZ3RoID4gMDtcXG4gICAgICAgIGlmICghaW5XaGl0ZSkge1xcbiAgICAgICAgICAgIHJldHVybiBmY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09IGxpbmUpIHtcXG4gICAgICAgICAgICAgICAgICAgIGFsaXVybCA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgbG9nKGUudG9TdHJpbmcoKSk7XFxuICAgICAgICAgICAgdGhyb3cgZTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBhbGl1cmw7XFxuICAgIH1cXG5cXG4gICAgZnVuY3Rpb24gZ2V0TTN1OENvbnRlbnQocGxheXVybCkge1xcblxcbiAgICAgICAgLy9sb2coXFxcIuaIkeWcqOS7o+eQhlxcXCIgKyBwbGF5dXJsKTtcXG4gICAgICAgIGxldCBob21lID0gcGxheXVybC5zcGxpdCgnbWVkaWEubTN1OCcpWzBdO1xcbiAgICAgICAgbGV0IGYgPSBmZXRjaChwbGF5dXJsLCB7XFxuICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGlwYW4uY29tLydcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIHRpbWVvdXQ6IDMwMDBcXG4gICAgICAgIH0pLnNwbGl0KFxcXCJcXFxcblxcXCIpO1xcbiAgICAgICAgbGV0IGZmID0gZi5tYXAoaXQgPT4ge1xcbiAgICAgICAgICAgIGlmIChpdC5zdGFydHNXaXRoKFxcXCJtZWRpYS1cXFwiKSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcIi9wcm94eT91cmw9XFxcIiArIGJhc2U2NEVuY29kZShob21lICsgaXQpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gaXQ7XFxuICAgICAgICB9KS5qb2luKFxcXCJcXFxcblxcXCIpO1xcbiAgICAgICAgLy9sb2coJ3VmaWQtJyArIGZpbGVpZCk7XFxuICAgICAgICB3cml0ZUZpbGUoJ2hpa2VyOi8vZmlsZXMvX2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+i/h+acn+abtOaWsCcpXFxuICAgICAgICAgICAgbGV0IGxpbmUgPSB1cmwuc3BsaXQoJy9tZWRpYScpWzBdOyAvL+WPluS5i+WJjeaSreaUvueahHRz5q6157q/6LevXFxuICAgICAgICAgICAgbGluZSA9IGxpbmUuc3Vic3RyaW5nKGxpbmUubGFzdEluZGV4T2YoJy8nKSArIDEpO1xcbiAgICAgICAgICAgIGxldCBmID0gZ2V0TTN1OENvbnRlbnQoZ2V0QWxpUGxheVVybChmaWQsIGxpbmUpKS5zcGxpdChcXFwiXFxcXG5cXFwiKTtcXG4gICAgICAgICAgICBmLmZvckVhY2goaXQgPT4ge1xcbiAgICAgICAgICAgICAgICBpZiAoaXQgJiYgaXQuc3RhcnRzV2l0aCgnL3Byb3h5P3VybD0nKSkge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGZ1cmwgPSBiYXNlNjREZWNvZGUoaXQucmVwbGFjZSgnL3Byb3h5P3VybD0nLCAnJykpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5zdWJzdHIodXJsLmluZGV4T2YoJy9tZWRpYS0nKSwgdXJsLmluZGV4T2YoJy50cycpKSA9PSBmdXJsLnN1YnN0cihmdXJsLmluZGV4T2YoJy9tZWRpYS0nKSwgZnVybC5pbmRleE9mKCcudHMnKSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSBmdXJsO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG5cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiB1cmw7XFxuICAgIH1cXG4gICAgdHJ5IHtcXG4gICAgICAgIGxldCB1cmwgPSBiYXNlNjREZWNvZGUoTVlfUEFSQU1TLnVybCk7XFxuICAgICAgICBpZiAodXJsLmluY2x1ZGVzKFxcXCIudHNcXFwiKSkge1xcbiAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICA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KGUuY29kZSA9PT0gXFxcIlF1b3RhRXhoYXVzdGVkLkRyaXZlXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v572R55uY56m66Ze05LiN6Laz77yM5peg5rOV5pKt5pS+6K+35riF55CG44CCXFxcIjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+aSreaUvuWksei0pe+8jOmUmeivr+S/oeaBr+W3suaJk+WNsOOAglxcXFxu6K+35p+l55yL5pel5b+XKExPRylcXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IG1vdW50c3ViID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ21vdW50emltdScsIHt9KTtcXG4gICAgICAgIGlmIChPYmplY3Qua2V5cyhtb3VudHN1YikubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgIHppbXUgPSBtb3VudHN1YjtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBzdWJ0aXRsZTtcXG4gICAgICAgIGlmIChPYmplY3Qua2V5cyh6aW11IHx8IHt9KS5sZW5ndGggPiAwICYmIHBsYXlMaXN0ICYmIHBsYXlMaXN0LnVybHMgJiYgcGxheUxpc3QudXJscy5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgamF2YS5sYW5nLlRocmVhZC5zbGVlcCgxMDApO1xcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIHZhciB6bXVybCA9IGFsaUFjY2Vzc0FwaS5nZXRGaWxlVG9Eb3duVXJsKHppbXUuZmlsZV9pZCk7XFxuICAgICAgICAgICAgICAgIGxldCBwYXRoID0gJ2hpa2VyOi8vZmlsZXMvY2FjaGUv5LqR55uY5ZCbL3N1Yi4nICsgemltdS5leHQ7XFxuICAgICAgICAgICAgICAgIGRvd25sb2FkRmlsZSh6bXVybCwgcGF0aCwge1xcbiAgICAgICAgICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly93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9zdHlsZVxcXCIsIHN0eWxlc1swXSk7XFxuICAgIGlmIChNWV9QQUdFID09PSAxKSB7XFxuICAgICAgICBpZiAoIWdldE15VmFyKFxcXCJtb3VudHppbXVcXFwiLCBcXFwiXFxcIikpIHtcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihcXFwibW91bnR6aW11XFxcIiwge30pO1xcbiAgICAgICAgICAgIGFkZExpc3RlbmVyKFxcXCJvbkNsb3NlXFxcIiwgJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcIm1vdW50emltdVxcXCIpO1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJhbGlTaGFyZVRva2VuXFxcIik7XFxuICAgICAgICAgICAgICAgIGNsZWFyVmFyKFxcXCJkbV9zaGFyZVxcXCIpO1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJkbWxpc3RcXFwiKTtcXG4gICAgICAgICAgICB9KSk7XFxuICAgICAgICB9XFxuICAgICAgICBzZXRNYXJrZXIoKTtcXG4gICAgICAgIGlmIChyZWFsdXJsICYmICFpc1NlYXJjaCkge1xcbiAgICAgICAgICAgIGxldCBzaGFyZUluZm8gPSBhbGlTaGFyZUFwaS5nZXRTaGFyZUluZm8oKTtcXG4gICAgICAgICAgICBsZXQgZmlsZUluZm8gPSBzaGFyZUluZm8uZmlsZV9pbmZvcyB8fCBbXTtcXG4gICAgICAgICAgICBpZiAoZmlsZUluZm8ubGVuZ3RoID09PSAxICYmIGZpbGVJbmZvWzBdLnR5cGUgPT09IFxcXCJmb2xkZXJcXFwiICYmICFmaWxlSWQpIHtcXG4gICAgICAgICAgICAgICAgZmlsZUlkID0gZmlsZUluZm9bMF0uZmlsZV9pZDtcXG4gICAgICAgICAgICAgICAgc2V0UGFnZVRpdGxlKGZpbGVJbmZvWzBdLmZpbGVfbmFtZSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgc2V0UGFnZVRpdGxlKHNoYXJlSW5mby5zaGFyZV9uYW1lKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGRlYWRsaW5lID0gXFxcIuawuOS5heacieaViFxcXCI7XFxuXFxuICAgICAgICAgICAgaWYgKHNoYXJlSW5mby5leHBpcmF0aW9uKSB7XFxuICAgICAgICAgICAgICAgIGRlYWRsaW5lID0gXFxcIuacieaViOiHs++8mlxcXCIgKyBmb3JtYXREYXRlKHNoYXJlSW5mby5leHBpcmF0aW9uKTtcXG4gICAgICAgICAgICAgICAgLy9zaGFyZUluZm8udXBkYXRlZF9hdFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IChzaGFyZUluZm8uY3JlYXRvcl9uYW1lIHx8IHNoYXJlSW5mby5jcmVhdG9yX3Bob25lKSArIFxcXCImbmJzcDsmbmJzcDtcXFwiICsgZGVhZGxpbmUuc21hbGwoKSxcXG4gICAgICAgICAgICAgICAgdXJsOiByZWFsdXJsICsgXFxcIiNub0hpc3RvcnkjXFxcIixcXG4gICAgICAgICAgICAgICAgaW1nOiBzaGFyZUluZm8uYXZhdGFyIHx8IFxcXCJoaWtlcjovL2ltYWdlcy9pY29uX3Vua25vd25cXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImF2YXRhclxcXCJcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmICghaXNTZWFyY2gpIHtcXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLmkJzntKJcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgaW5wdXQgPSBpbnB1dC50cmltKCk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoIWlucHV0KSByZXR1cm4gXFxcInRvYXN0Oi8v6K+36L6T5YWl5YWz6ZSu6K+NXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL2FsaXl1biNub0hpc3RvcnkjI2Z1bGxUaGVtZSM/cGFnZT1meXBhZ2Umc2VhcmNoS2V5PVxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQoaW5wdXQpO1xcbiAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJpbnB1dFxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2QsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZUlkOiBzaGFyZUlkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogc2hhcmVUb2tlblxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnFxcXCIgKyBzZWFyY2hLZXkgKyBcXFwi4oCd4oCd55qE5pCc57Si57uT5p6cXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IGZ1blN0eWxlID0gaXNTZWFyY2ggPyBcXFwiaWNvbl9zbWFsbF8zXFxcIiA6IFxcXCJpY29uX3JvdW5kX3N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ICAgICAgICAgICAgICAgICBzd2l0Y2ggKGlucHV0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcXFwi6L2s5a2Y5LqR55uYXFxcIjpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGBzbWFydGRyaXZlOi8vc2hhcmUvYnJvd3NlP3NoYXJlSWQ9JHtzaGFyZUlkfSZzaGFyZVB3ZD0ke3NoYXJlUHdkfHxcXFwiXFxcIn1gO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXFxcIueZu+mZhui0puWPt1xcXCI6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL2xvZ2luI25vUmVjb3JkSGlzdG9yeSMjbm9IaXN0b3J5I1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcXFwi5aSN5Yi25YiG5Lqr6ZO+5o6lXFxcIjpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoW1xcXCLlpI3liLbpk77mjqVcXFwiLCBcXFwi5aSN5Yi25rW36ZiU5Y+j5LukXFxcIl0sIDEsIFxcXCLliIbkuqvmlrnlvI9cXFwiKS5zZWxlY3QoKHVybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0ID09PSBcXFwi5aSN5Yi26ZO+5o6lXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyB1cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL+mYv+mHjOS6keebmOWIhuS6q+WPo+S7pOOAjFxcXCIgKyBnZXRQYWdlVGl0bGUoKSArIFxcXCLjgI1cXFxcblxcXCIgKyB1cmwgKyBcXFwiIEBpbXBvcnQ9anM6YGhpa2VyOi8vcGFnZS9hbGl5dW4/cmVhbHVybD0ke2lucHV0LnRyaW0oKX0mcnVsZT1cXFwiICsgTVlfUlVMRS50aXRsZSArIFxcXCJgO1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFxcXCJodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9cXFwiICsgc2hhcmVJZCArIChmaWxlSWQgPyBcXFwiL2ZvbGRlci9cXFwiICsgZmlsZUlkIDogXFxcIlxcXCIpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFxcXCLmibnph4/mjILovb3mnKzlnLDlvLnluZVcXFwiOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9kbU1vdW50I25vSGlzdG9yeSMjbm9SZWNvcmRIaXN0b3J5I1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcXFwi5p+l55yL5omL5Yqo5oyC6L295a2X5bmVXFxcIjpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHptID0gc3RvcmFnZTAuZ2V0TXlWYXIoXFxcIm1vdW50emltdVxcXCIsIHt9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHRpcCA9IHptLm5hbWUgPyBcXFwi5b2T5YmN5a2X5bmV5paH5Lu2XFxcXG5cXFwiICsgem0ubmFtZSArIFxcXCIuXFxcIiArIHptLmV4dCA6IFxcXCLov5jmnKrmiYvliqjmjILovb3lrZfluZVcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5omL5Yqo5oyC6L295a2X5bmVJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IHRpcCArIFxcXCJcXFxcbijngrnlh7vlj5bmtojlj6/ku6XmuIXpmaTmjILovb3lrZfluZUpXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbDogKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcIm1vdW50emltdVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lt7LmuIXpmaTmiYvliqjmjILovb3lrZfluZVcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXFxcIuiOt+WPluW8ueW5leaQnOe0ouinhOWImVxcXCI6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBydWxlID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcImpzXFxcIjogSlNPTi5zdHJpbmdpZnkoXFxcImhpa2VyOi8vcGFnZS9sb2FkRG0/cnVsZT1cXFwiICsgTVlfUlVMRS50aXRsZSArIFxcXCImdGl0bGU9XFxcIikgKyBcXFwiK2VuY29kZVVSSUNvbXBvbmVudChwbGF5ZGF0YS50aXRsZS5zcGxpdCgnLScpWzBdKTtcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcIm5hbWVcXFwiOiBNWV9SVUxFLnRpdGxlICsgXFxcIuW8ueW5leaQnOe0olxcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJydWxlOi8vXFxcIiArIGJhc2U2NEVuY29kZShcXFwi77+lcHJvamVjdGlvbl9zY3JlZW7vv6VcXFwiICsgSlNPTi5zdHJpbmdpZnkocnVsZSkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXFxcIuaOqOmAgeWIsFRWQm94XFxcIjpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvdHZib3hQdXNoI25vSGlzdG9yeSMjbm9SZWNvcmRIaXN0b3J5I1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcXFwi6K6+572u5pS26JeP5bCB6Z2iXFxcIjpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoW1xcXCLorr7nva7lsIHpnaLlnLDlnYBcXFwiLCBcXFwi5pCc57Si5bCB6Z2iXFxcIl0sIDEpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT09IFxcXCLorr7nva7lsIHpnaLlnLDlnYBcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIlxcXCIsIFxcXCLor7fovpPlhaXlm77niYflnLDlnYBcXFwiKS5pbnB1dCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0ID0gaW5wdXQudHJpbSgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlucHV0KSByZXR1cm4gXFxcInRvYXN0Oi8v6K+36L6T5YWl5Zyw5Z2AXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0UGFnZVBpY1VybChpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/kv67mlLnmiJDlip9cXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9mcm9udENvdmVyI25vSGlzdG9yeSMjbm9SZWNvcmRIaXN0b3J5I1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXFxcIuiOt+WPluaKleWxj0lQXFxcIjpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGlwID0gJC5yZXF1aXJlKFxcXCJhbGlVdGlsXFxcIikuZ2V0SVB2NEFkZHJlc3MoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlwLnN0YXJ0c1dpdGgoXFxcIjE5Mi4xNjguXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKGlwICsgXFxcIlxcXFxu6K+lSVDpgILnlKjkuo7mtYHph48r54Ot54K555qE5oqV5bGPXFxcXG7or7fmm7/mjaLpk77mjqXkuK3nmoQwLjAuMC4wXFxcIikuY29uZmlybSgoaXApID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImNvcHk6Ly9cXFwiICsgaXA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpcCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdChcXFwi6I635Y+W5aSx6LSl6Z2e56iz5a6aSVAs6K+35byA5ZCv54Ot54K55YaN5L2/55SoXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgc2hhcmVJZCwgc2hhcmVQd2QsIGZpbGVJZCksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaWNvbl9yb3VuZF9zbWFsbF80XFxcIixcXG4gICAgICAgICAgICAgICAgcGljX3VybDogXFxcImh0dHBzOi8vaGlrZXJmYW5zLmNvbS9pbWcvYWxpX2ZpbGVpbnRvLnN2Z1xcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBwYWdlSWQ6IHBhZ2VJZCxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVJZDogZmlsZUlkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZDogc2hhcmVJZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IHNoYXJlVG9rZW4sXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2QsXFxuICAgICAgICAgICAgICAgICAgICBmb2xkZXJOYW1lOiBnZXRQYWdlVGl0bGUoKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVfYmxhbmtcXFwiXFxuICAgICAgICB9KTtcXG4gICAgfVxcbiAgICBsZXQgcmVzY29kID0ge307XFxuICAgIGxldCBtYXJrZXIgPSBNWV9QQVJBTVMubWFya2VyO1xcbiAgICBpZiAoaXNTZWFyY2gpIHtcXG4gICAgICAgIHJlc2NvZCA9IGFsaVNoYXJlQXBpLmdldFNlYXJjaExpc3RGaWxlKHNlYXJjaEtleSwgbWFya2VyLCBvcmRlclswXSwgb3JkZXJbMV0pO1xcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgcmVzY29kID0gYWxpU2hhcmVBcGkuZ2V0TGlzdEZpbGUoZmlsZUlkLCBtYXJrZXIsIG9yZGVyWzBdLCBvcmRlclsxXSk7XFxuICA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IHBpY191cmwgPSBnZXRJY29uKGZpbGVJdGVtLmZpbGVfZXh0ZW5zaW9uLCBmaWxlSXRlbS50eXBlKTtcXG5cXG4gICAgICAgIGlmIChmaWxlSXRlbS50eXBlID09PSBcXFwiZm9sZGVyXFxcIikge1xcbiAgICAgICAgICAgIGxldCB0aXRsZSA9IChmb2xkZXJTdHlsZSA9PT0gXFxcInRleHRfMVxcXCIgPyB0aXRsZUhlYWQuZm9sZGVyIDogXFxcIlxcXCIpICsgZmlsZUl0ZW0ubmFtZTtcXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICB1cmw6ICdoaWtlcjovL3BhZ2UvYWxpeXVuP3BhZ2U9ZnlwYWdlJyxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IGZvbGRlclN0eWxlLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBmb3JtYXREYXRlKGZpbGVJdGVtLnVwZGF0ZWRfYXQpLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBwaWNfdXJsLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZDogc2hhcmVJZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IE1ZX1BBUkFNUy5zaGFyZVRva2VuLFxcbiAgICAgICAgICAgICAgICAgICAgZmlsZUlkOiBmaWxlSXRlbS5maWxlX2lkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IHNoYXJlUHdkLFxcbiAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiBmaWxlSXRlbS5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgbm9QaWM6IHRydWVcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgc3VidGl0bGUsIGxvbmdjLCBjbHM7XFxuICAgICAgICAgICAgbGV0IHRpdGxlID0gKGZpbGVTdHlsZSA9PT0gXFxcInRleHRfMVxcXCIgPyBnZXRIZWFkKGNhdGUsIGZpbGVJdGVtLmZpbGVfZXh0ZW5zaW9uKSA6IFxcXCJcXFwiKSArIGZpbGVJdGVtLm5hbWU7XFxuICAgICAgICAgICAgbGV0IG5hbWVOb3RFeHQgPSBmaWxlSXRlbS5uYW1lLnJlcGxhY2UoJy4nICsgZmlsZUl0ZW0uZmlsZV9leHRlbnNpb24sICcnKTtcXG4gICAgICAgICAgICBpZiAoc3ViRXh0cy5pbmNsdWRlcyhmaWxlSXRlbS5maWxlX2V4dGVuc2lvbikpIHtcXG4gICAgICAgICAgICAgICAgbG9uZ2MgPSBbe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLmjILovb3lrZfluZVcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKHptKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ21vdW50emltdScsIHptKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5oyC6L295a6M5oiQ77yM5b2T5YmN5a2X5bmV5paH5Lu2OiAnICsgem0ubmFtZSArICcuJyArIHptLmV4dDtcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHQ6IGZpbGVJdGVtLmZpbGVfZXh0ZW5zaW9uLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVfaWQ6IGZpbGVJdGVtLmZpbGVfaWQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogbmFtZU5vdEV4dFxcbiAgICAgICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgIH1dO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoY2F0ZSA9PT0gXFxc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XJlVG9rZW4sIGZpbGVJdGVtLmZpbGVfaWQsIGNhdGUsIHN1YnRpdGxlKSxcXG4gICAgICAgICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogcGljX3VybCxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBmaWxlSXRlbS5maWxlX2lkLFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBsb25nYyxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogY2xzLFxcbiAgICAgICAgICAgICAgICAgICAgLy9pbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiBmaWxlSXRlbS5uYW1lXFxuICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBmaWxlU3R5bGVcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICBpZiAoY29udHMubGVuZ3RoID09PSAwKSB7XFxuICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIFxcXCJ+fn7ku4DkuYjpg73msqHmnInkuoblk6Z+fn5cXFwiLmZvbnRjb2xvcihcXFwiR3JheVxcXCIpLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZSxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG4gICAgfVxcbn1cXG5cXG5sZXQgaXRlbXMgPSBbXTtcXG50cnkge1xcbiAgICBpZiAoTVlfUEFHRSA+IDEgJiYgIU1ZX1BBUkFNUy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ICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgfSwgTVlfUEFSQU1TKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIlxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBpZiAoZS5zaWduaWZpY2FuY2UgPT09IDEpIHtcXG4gICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBlLm1lc3NhZ2UuYmlnKCkuYmlnKCkuZm9udGNvbG9yKFxcXCJyZWRcXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChlLnNpZ25pZmljYW5jZSA9PT0gMykge1xcbiAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIGUubWVzc2FnZS5iaWcoKS5mb250Y29sb3IoXFxcImdyZWVuXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMSdcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcblxcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgbG9nKFxcXCLliJfooajliqDovb3lpLHotKUjXFxcXG7plJnor6/kv6Hmga8+XFxcIiArIGUudG9TdHJpbmcoKSArIFxcXCJcXFxcb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RoID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvdG9rZW5QYXRoXFxcIikuYWxpVG9rZW5zRmlsZXBhdGg7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgYWxpVG9rZW4gPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaF90b2tlbjogaW5mby5wZHNfbG9naW5fcmVzdWx0LnJlZnJlc2hUb2tlblxcbiAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgIHdyaXRlRmlsZShhbGlUb2tlbnNGaWxlcGF0aCwgSlNPTi5zdHJpbmdpZnkoYWxpVG9rZW4pKTtcXG4gICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihcXFwibG9naW55XFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi55m75b2V5oiQ5YqfKOeCueWHu+i/lOWbnilcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJhY2soZmFsc2UpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIGJhY2tIb21lKFxcXCLnmbvlvZXmiJDlip9cXFwiLCB0cnVlKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGJhY2tIb21lKFxcXCLnmbvlvZXlpLHotKUs6K+35bCd6K+V5YW25LuW55qE5pa55rOVXFxcIik7XFxuICAgICAgICAgICA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jtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCByYm9keSA9IHJlc3VsdCAmJiByZXN1bHQucmVzcG9uc2VzICYmIHJlc3VsdC5yZXNwb25zZXNbMF0gJiYgcmVzdWx0LnJlc3BvbnNlc1swXS5ib2R5IHx8IHt9O1xcbiAgICAgICAgaWYgKHJib2R5LmNvZGUpIHtcXG4gICAgICAgICAgICBsZXQgbXNnID0gcmJvZHkuZGlzcGxheV9tZXNzYWdlIHx8IHJib2R5Lm1lc3NhZ2U7XFxuICAgICAgICAgICAgbGV0IGVycm9yID0gbmV3IEVycm9yKGFwaSArIFxcXCI9PlxcXCIgKyByYm9keS5jb2RlICsgXFxcIjpcXFwiICsgbXNnKTtcXG4gICAgICAgICAgICBlcnJvci5jb2RlID0gcmJvZHkuY29kZTtcXG4gICAgICAgICAgICBlcnJvci5qdWRnZU1zZyA9IG1zZztcXG4gICAgICAgICAgICB0aHJvdyBlcnJvcjtcXG4gICAgICAgIH1cXG4gICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgdHJ5RnJlID0gdHJ5RnJlID09PSB1bmRlZmluZWQgPyAxIDogdHJ5RnJlO1xcbiAgICAgICAgaWYgKGFnYWluVHJ5ICYmIHRyeUZyZSA+IDApIHtcXG4gICAgICAgICAgICBpZiAodHlwZW9mIGFnYWluVHJ5ID09PSBcXFwiZnVuY3Rpb25cXFwiKSB7XFxuICAgICAgICAgICAgICAgIGxldCBuZXdEYXRhID0gYWdhaW5UcnkoZSwgcmVzdWx0LCBib2R5LCBoZWFkZXJzLCB0cnlGcmUpO1xcbiAgICAgICAgICAgICAgICBpZiAobmV3RGF0YSkge1xcbiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihib2R5LCBuZXdEYXRhLmJvZHkpO1xcbiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihoZWFkZXJzLCBuZXdEYXRhLmhlYWRlcnMpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgIC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gdGhpcyk7XFxuICAgICAgICByZXR1cm4gdGhpcy5hbGlUb2tlbnM7XFxuICAgIH0sXFxuICAgIGdldFVzZXJJbmZvKCkge1xcbiAgICAgICAgbGV0IGluZm8gPSBwb3N0QXBpKFxcXCJodHRwczovL3VzZXIuYWxpeXVuZHJpdmUuY29tL3YyL3VzZXIvZ2V0XFxcIiwge30sIHtcXG4gICAgICAgICAgICBcXFwiVXNlci1BZ2VudFxcXCI6IFBDX1VBLFxcbiAgICAgICAgICAgIFxcXCJhdXRob3JpemF0aW9uXFxcIjogdGhpcy5yZWFjY2Vzc1RrLFxcbiAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9cXFwiXFxuICAgICAgICB9LCAoZSkgPT4ge1xcbiAgICAgICAgICAgIHRoaXMudHJ5U29sdmUoZSk7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgJ2F1dGhvcml6YXRpb24nOiB0aGlzLnJlYWNjZXNzVGtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICAgICAgcmV0dXJuIGluZm87XFxuICAgIH0sXFxuICAgIF9nZXRPcGVuVG9rZW4oY29kZSkge1xcbiAgICAgICAgbGV0IGJvZHkgPSB7fSxcXG4gICAgICAgICAgICBoZWFkZXJzID0ge1xcbiAgICAgICAgICAgICAgICAnVXNlci1BZ2VudCc6IFBDX1VBLFxcbiAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJ1xcbiAgICAgICAgICAgIH07XFxuICAgICAgICBpZiAoY29kZSkge1xcbiAgICAgICAgICAgIGJvZHkgPSB7XFxuICAgICAgICAgICAgICAgIGNvZGU6IGNvZGUsXFxuICAgICAgICAgICAgICAgIGdyYW50X3R5cGU6IFxcXCJhdXRob3JpemF0aW9uX2NvZGVcXFwiXFxuICAgICAgICAgICAgfTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgYm9keSA9IHtcXG4gICAgICAgICAgICAgICAgZ3JhbnRfdHlwZTogXFxcInJlZnJlc2hfdG9rZW5cXFwiLFxcbiAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiB0aGlzLm9wZW5Ub2tlbnMuUmVmcmVzaFRva2VuT3BlbixcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBsZXQganNvbiA9IHBvc3QoJ2h0dHBzOi8vYXBpLnhob2ZlLnRvcC9hbGlzdC9hbGlfb3Blbi9jb2RlJywge1xcbiAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxuICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoYm9keSksXFxuICAgICAgICB9KTtcXG4gICAgICAgIGlmICghanNvbikge1xcbiAgICAgICAgICAgIGpzb24gPSBwb3N0KCdodHRwczovL2FwaS1jZi5ubi5jaS9hbGlzdC9hbGlfb3Blbi9jb2RlJywge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzLFxcbiAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeShib2R5KSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChqc29uLmluY2x1ZGVzKCdUb28gTWFueSBSZXF1ZXN0cycpIHx8IGpzb24uaW5jbHVkZXMoXFxcIjUwMiBCYWQgR2F0ZXdheVxcXCIpKSB7XFxuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLpopHnuYHor7fmsYLmmoLml7booqvlsIHnpoFcXFxcblxcXCIgKyBqc29uKTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgbGV0IG9wZW5SZXN1bHQgPSBKU09OLnBhcnNlKGpzb24pO1xcbiAgICA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yAnJnNjb3BlPXVzZXI6YmFzZSxmaWxlOmFsbDpyZWFkLGZpbGU6YWxsOndyaXRlJnN0YXRlPScsIHtcXG4gICAgICAgICAgICBcXFwiYXV0aG9yaXplXFxcIjogMSxcXG4gICAgICAgICAgICBcXFwic2NvcGVcXFwiOiBcXFwidXNlcjpiYXNlLGZpbGU6YWxsOnJlYWQsZmlsZTphbGw6d3JpdGVcXFwiXFxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiBQQ19VQSxcXG4gICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJyxcXG4gICAgICAgICAgICAnYXV0aG9yaXphdGlvbic6IHRoaXMucmVhY2Nlc3NUaywgLy9nZXRBY2Nlc3NUb2tlblxcbiAgICAgICAgICAgICd4LWNhbmFyeSc6ICdjbGllbnQ9d2ViLGFwcD1zaGFyZSx2ZXJzaW9uPXYyLjMuMScsXFxuICAgICAgICAgICAgJ3gtc2hhcmUtdG9rZW4nOiB0aGlzLnNoYXJlVG9rZW5cXG4gICAgICAgIH0sIChlKSA9PiB7XFxuICAgICAgICAgICAgdGhpcy50cnlTb2x2ZShlKTtcXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAnYXV0aG9yaXphdGlvbic6IHRoaXMucmVhY2Nlc3NUayxcXG4gICAgICAgICAgICAgICAgICAgICd4LXNoYXJlLXRva2VuJzogdGhpcy5zaGFyZVRva2VuXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG4gICAgICAgIGxldCBjb2RlID0gcmVzdWx0LnJlZGlyZWN0VXJpLnNwbGl0KFxcXCJjb2RlPVxcXCIpWzFdO1xcbiAgICAgICAgcmV0dXJuIHRoaXMuX2dldE9wZW5Ub2tlbihjb2RlKTtcXG4gICAgfSxcXG4gICAgcmVmcmVzaE9wZW5Ub2tlbigpIHtcXG4gICAgICAgIGlmICh0aGlzLm9wZW5Ub2tlbnMuaXNWMikge1xcbiAgICAgICAgICAgIGlmICh0aGlzLm9wZW5Ub2tlbnMuUmVmcmVzaFRva2VuT3Blbikge1xcbiAgICAgICAgICAgICAgICB0cnl7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZ2V0T3BlblRva2VuVjIoKTtcXG4gICAgICAgICAgICAgICAgfWNhdGNoKGUpe1xcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCJWMuWOn+eUu+eZu+W9leWkseaViOivt+mHjeaWsOeZu+W9lVxcXCIpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoXFxcIlYy5Y6f55S75pyq55m75b2VXFxcIik7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBpZiAodGhpcy5vcGVuVG9rZW5zLlJlZnJlc2hUb2tlbk9wZW4gJiYgdGhpcy5vcGVuVG9rZW5zLkJpbmRSZWZyZXNoVG9rZW4gPT09IHRoaXMuYWxpVG9rZW5zLnJlZnJlc2hfdG9rZW4pIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZ2V0T3BlblRva2VuKCk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY2FjaGVPcGVuVG9rZW4oKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIF9jbG91ZEZpbGVPcGVyYXRlKGJvZHksIGNsb3VkRmlsZUlkLCBvcGVyYXRlVXJsKSB7XFxuICAgICAgICBsZXQgcmVzdWx0ID0gcG9zdEFwaSgnaHR0cHM6Ly9hcGkuYWxpeXVuZHJpdmUuY29tL2Fkcml2ZS92Mi9iYXRjaCcsIHtcXG4gICAgICAgICAgICBcXFwicmVxdWVzdHNcXFwiOiBbe1xcbiAgICAgICAgICAgICAgICBcXFwiYm9keVxcXCI6IGJvZHksXFxuICAgICAgICAgICAgICAgIFxcXCJoZWFkZXJzXFxcIjoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIkNvbnRlbnQtVHlwZVxcXCI6IFxcXCJhcHBsaWNhdGlvbi9qc29uXFxcIlxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBcXFwiaWRcXFwiOiBjbG91ZEZpbGVJZCB8fCBcXFwiMFxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCJtZXRob2RcXFwiOiBcXFwiUE9TVFxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCJ1cmxcXFwiOiBvcGVyYXRlVXJsXFxuICAgICAgICAgICAgfV0sXFxuICAgICAgICAgICAgXFxcInJlc291cmNlXFxcIjogXFxcImZpbGVcXFwiXFxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiBQQ19VQSxcXG4gICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJyxcXG4gICAgICAgICAgICAnYXV0aG9yaXphdGlvbic6IHRoaXMucmVhY2Nlc3NUayxcXG4gICAgICAgICAgICAvL2dldEFjY2Vzc1Rva2VuXFxuICAgICAgICAgICAgJ3gtY2FuYXJ5JzogJ2NsaWVudD13ZWIsYXBwPXNoYXJlLHZlcnNpb249djIuMy4xJyxcXG4gICAgICAgICAgICAneC1zaGFyZS10b2tlbic6IHRoaXMuc2hhcmVUb2tlblxcblxcbiAgICAgICAgfSwgKGUsIHIsIGIpID0+IHtcXG4gICAgICAgICAgICBpZiAoZS5jb2RlID09PSBcXFwiUXVvdGFFeGhhdXN0ZWQuRHJpdmVcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRocm93IGU7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICghdGhpcy50cnlTb2x2ZShlKSkge1xcbiAgICAgICAgICAgICAgICB0aGlzLndhaXRTbGVlcCgyMCkucmVmcmVzaEFjY2Vzc1Rva2VuKCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBib2R5ID0gYi5yZXF1ZXN0c1swXS5ib2R5O1xcbiAgICAgICAgICAgIGlmIChib2R5LmRyaXZlX2lkKSB7XFxuICAgICAgICAgICAgICAgIGJvZHkuZHJpdmVfaWQgPSB0aGlzLmRlZkRyaXZlSWRcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGJvZHkudG9fZHJpdmVfaWQpIHtcXG4gICAgICAgICAgICAgICAgYm9keS50b19kcml2ZV9pZCA9IHRoaXMuZGVmRHJpdmVJZFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICBib2R5OiBiLFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAnYXV0aG9yaXphdGlvbic6IHRoaXMucmVhY2Nlc3NUayxcXG4gICAgICAgICAgICAgICAgICAgICd4LXNoYXJlLXRva2VuJzogdGhpcy5zaGFyZVRva2VuXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgfSk7XFxuICAgICAgICByZXR1cm4gcmVzdWx0O1xcbiAgICB9LFxcbiAgICBjb3B5RmlsZVRvQ2xvdWRGaWxlKGZpbGVJZCwgcmV0cnkpIHtcXG4gICAgICAgIGxldCByZXN1bHQgPSB0aGlzLl9jbG91ZEZpbGVPcGVyYXRlKHtcXG4gICAgICAgICAgICBcXFwiZmlsZV9pZFxcXCI6IGZpbGVJZCxcXG4gICAgICAgICAgICBcXFwic2hhcmVfaWRcXFwiOiB0aGlzLnNoYXJlSWQsXFxuICAgICAgICAgICAgXFxcImF1dG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PSBwb3N0QXBpKCdodHRwczovL29wZW4uYWxpeXVuZHJpdmUuY29tL2Fkcml2ZS92MS4wL29wZW5GaWxlL2dldERvd25sb2FkVXJsJywge1xcbiAgICAgICAgICAgICdmaWxlX2lkJzogY2xvdWRGaWxlSWQsXFxuICAgICAgICAgICAgJ2RyaXZlX2lkJzogdGhpcy5kZWZEcml2ZUlkXFxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiBQQ19VQSxcXG4gICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJyxcXG4gICAgICAgICAgICAnYXV0aG9yaXphdGlvbic6IHRoaXMub3BlblRva2Vucy5BY2Nlc3NUb2tlbk9wZW5cXG4gICAgICAgIH0sIChlKSA9PiB7XFxuICAgICAgICAgICAgdGhpcy53YWl0U2xlZXAoMzApLnRyeVNvbHZlKGUpO1xcbiAgICAgICAgICAgIHRoaXMud2FpdFNsZWVwKDMwKS5yZWZyZXNoT3BlblRva2VuKCk7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgYm9keToge1xcbiAgICAgICAgICAgICAgICAgICAgJ2RyaXZlX2lkJzogdGhpcy5kZWZEcml2ZUlkLFxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAnYXV0aG9yaXphdGlvbic6IHRoaXMub3BlblRva2Vucy5BY2Nlc3NUb2tlbk9wZW5cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH07XFxuICAgICAgICB9LCAyKTtcXG4gICAgICAgIGlmICghZmlsZUluZm8udXJsIHx8IGZpbGVJbmZvLmNvZGUpIHRocm93IG5ldyBFcnJvcihcXFwi5LiL6L296ZO+5o6l6I635Y+W5aSx6LSlXFxcXG5cXFwiICsgZmlsZUluZm8uY29kZSArIFxcXCI6XFxcIiArIGZpbGVJbm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QpIHtcXG4gICAgICAgIGxldCBkb3dubG9hZEluZm8gPSBwb3N0QXBpKFxcXCIvdjIvZmlsZS9nZXRfc2hhcmVfbGlua19kb3dubG9hZF91cmxcXFwiLCB7XFxuICAgICAgICAgICAgXFxcImV4cGlyZV9zZWNcXFwiOiA2MDAsXFxuICAgICAgICAgICAgXFxcImZpbGVfaWRcXFwiOiBmaWxlSWQsXFxuICAgICAgICAgICAgXFxcInNoYXJlX2lkXFxcIjogdGhpcy5zaGFyZUlkXFxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgXFxcIlgtU2hhcmUtVG9rZW5cXFwiOiB0aGlzLnNoYXJlVG9rZW4sXFxuICAgICAgICAgICAgXFxcImF1dGhvcml6YXRpb25cXFwiOiB0aGlzLmFsaVRva2Vucy5hY2Nlc3NfdG9rZW5cXG4gICAgICAgIH0sIChlKSA9PiB7XFxuICAgICAgICAgICAgdGhpcy50cnlTb2x2ZShlKTtcXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiWC1TaGFyZS1Ub2tlblxcXCI6IHRoaXMuc2hhcmVUb2tlbixcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJhdXRob3JpemF0aW9uXFxcIjogdGhpcy5hbGlUb2tlbnMuYWNjZXNzX3Rva2VuXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgfSk7XFxuICAgICAgICByZXR1cm4gZG93bmxvYWRJbmZvLmRvd25sb2FkX3VybDtcXG4gICAgfSxcXG4gICAgZ2V0U2lnbigpIHtcXG4gICAgICAgIGlmICghdGhpcy5hbGlUb2tlbnMuZGV2aWNlX2lkKSB7XFxuICAgICAgICAgICAgdGhpcy53YWl0U2xlZXAoMjApLnJlZnJlc2hBY2Nlc3NUb2tlbigpO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IGNhbGN1bGF0ZU5ld1NpZ24gPSAoKSA9PiB7XFxuICAgICAgICAgICAgbGV0IHNpZ24gPSBqdXN0VGVzdFNpZ24oXFxcIjVkZGU0ZTFiZGY5ZTQ5NjZiMzg3YmE1OGY0YjNmZGMzXFxcIiwgdGhpcy5hbGlUb2tlbnMuZGV2aWNlX2lkLCB0aGlzLmFsaVRva2Vucy51c2VyX2lkKS5zcGxpdChcXFwiIyNcXFwiKTtcXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICBzaWduYXR1cmU6IHNpZ24uYXQoMCksXFxuICAgICAgICAgICAgICAgIHB1YktleTogc2lnbi5hdCgtMSlcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgfTtcXG4gICAgICAgIGxldCBuZXdTaWduID0gY2FsY3VsYXRlTmV3U2lnbigpO1xcbiAgICAgICAgbGV0IHJlc3VsdCA9IHBvc3RBcGkoJy91c2Vycy92MS91c2Vycy9kZXZpY2UvY3JlYXRlX3Nlc3Npb24nLCB7XFxuICAgICAgICAgICAgXFxcImRldmljZU5hbWVcXFwiOiBcXFwiRWRnZea1j+iniOWZqFxcXCIsXFxuICAgICAgICAgICAgXFxcIm1vZGVsTmFtZVxcXCI6IFxcXCJXaW5kb3dz572R6aG154mIXFxcIixcXG4gICAgICAgICAgICBcXFwicHViS2V5XFxcIjogbmV3U2lnbi5wdWJLZXksXFxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiBQQ19VQSxcXG4gICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20nLFxcbiAgICAgICAgICAgICdBdXRob3JpemF0aW9uJzogdGhpcy5yZWFjY2Vzc1RrLFxcbiAgICAgICAgICAgICdYLVNoYXJlLVRva2VuJzogdGhpcy5zaGFyZVRva2VuLFxcbiAgICAgICAgICAgICd4LWRldmljZS1pZCc6IHRoaXMuYWxpVG9rZW5zLmRldmljZV9pZCxcXG4gICAgICAgICAgICAneC1zaWduYXR1cmUnOiBuZXdTaWduLnNpZ25hdHVyZVxcbiAgICAgICAgfSwgKGUpID0+IHtcXG4gICAgICAgICAgICBpZiAoZS5tZXNzYWdlID09PSBcXFwieC1kZXZpY2UtaWQgZW1wdHlcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRoaXMud2FpdFNsZWVwKDIwKS5yZWZyZXNoQWNjZXNzVG9rZW4oKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdGhpcy50cnlTb2x2ZShlKTtcXG4gICAgICAgICAgICB0aGlzLndhaXRTbGVlcCg1MCk7XFxuICAgICAgICAgICAgbmV3U2lnbiA9IGNhbGN1bGF0ZU5ld1NpZ24oKTtcXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICBib2R5OiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwicHViS2V5XFxcIjogbmV3U2lnbi5wdWJLZXlcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgJ0F1dGhvcml6YXRpb24nOiB0aGlzLnJlYWNjZXNzVGssXFxuICAgICAgICAgICAgICAgICAgICAnWC1TaGFyZS1Ub2tlbic6IHRoaXMuc2hhcmVUb2tlbixcXG4gICAgICAgICAgICAgICAgICAgICd4LWRldmljZS1pZCc6IHRoaXMuYWxpVG9rZW5zLmRldmljZV9pZCxcXG4gICAgICAgICAgICAgICAgICAgICd4LXNpZ25hdHVyZSc6IG5ld1NpZ24uc2lnbmF0dXJlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCAzKTtcXG4gICAgICAgIGlmIChyZXN1bHQuc3VjY2Vzcykge1xcbiAgICAgICAgICAgIHJldHVybiBuZXdTaWduO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIlNpZ27ojrflj5blpLHotKXvvIzor7fph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XG4gICAgICAgICAgICBpZiAoaSA9PSAzKSB7XFxuICAgICAgICAgICAgICAgIC8v6aKc6Imy5YC85Li6MOaXtu+8jOm7mOiupOiuvue9ruS4uueZveiJslxcbiAgICAgICAgICAgICAgICBpZiAocGFyYW1zW2ldID09IFxcXCIwXFxcIiB8fCBwYXJhbXNbaV0gPT0gXFxcIi0xXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zVC5wdXNoKFxcXCIxNjc3NzIxNVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWVcXG4gICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoaSA9PSAyKSB7XFxuICAgICAgICAgICAgICAgIHBhcmFtc1QucHVzaChcXFwiMjVcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcGFyYW1zVC5wdXNoKHBhcmFtc1tpXSk7XFxuXFxuICAgICAgICB9XFxuICAgICAgICBwYXJhbXNULnB1c2goXFxcIjBcXFwiLCBcXFwiMFxcXCIsIFxcXCIwXFxcIik7XFxuICAgICAgICBkTWNvbnRleHQgKz0gYDxkIHA9XFxcIiR7cGFyYW1zVC5qb2luKCcsJyl9XFxcIj4ke2VuY29kZUh0bWwoY29tbWVudFRleHQpfTwvZD5cXFxcbmA7XFxuICAgIH1cXG4gICAgaWYgKCFkTWNvbnRleHQpIHJldHVybjtcXG4gICAgZE1jb250ZXh0ID0gYDw/eG1sIHZlcnNpb249XFxcIjEuMFxcXCIgZW5jb2Rpbmc9XFxcIlVURi04XFxcIj8+PGk+XFxcXG4ke2RNY29udGV4dH08L2k+YDtcXG4gICAgbGV0IHBhdGggPSBzZXZlUGF0aCArIG5hbWUucmVwbGFjZSgvXFxcXC8vZyxcXFwiX1xcXCIpICsgXFxcIl9cXFwiICsgZXBpc29kZUlkICsgXFxcIi54bWxcXFwiO1xcbiAgICB3cml0ZUZpbGUocGF0aCwgZE1jb250ZXh0KTtc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ICAgICAgICAgICAgXFxcIm5hbWVcXFwiOiBuYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcInBvc1xcXCI6IHBvc1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgICAgIHVybEluZm8gPSBKU09OLnBhcnNlKHVybEluZm8pO1xcbiAgICAgICAgICAgIGlmICghdXJsSW5mby51cmwpIHRocm93IFxcXCLmmoLml7bmsqHmnInmib7liLDor6Xop4bpopHnmoTlvLnluZVcXFwiO1xcbiAgICAgICAgICAgIGxldCB4bWwgPSBmZXRjaChidWlsZFVybChcXFwiaHR0cHM6Ly9kYW5tdS5sbXRlYW0ucmVwbC5jby9kYW5tdVxcXCIsIHtcXG4gICAgICAgICAgICAgICAgcGFyYW1zOiB1cmxJbmZvXFxuICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgICAgIGhpZGVMb2FkaW5nKCk7XFxuICAgICAgICAgICAgaWYgKCF4bWwpIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgXFxcIui/mOayoeacieW8ueW5leWTn35cXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgcGF0aCA9IFxcXCJoaWtlcjovL2ZpbGVzL2NhY2hlL2Rhbm11L1xcXCIgKyB1cmxJbmZvLnBsYXRmb3JtICsgXFxcIl9cXFwiICsgbmFtZSArIFxcXCJfXFxcIiArIHBvcytcXFwiLnhtbFxcXCI7XFxuICAgICAgICAgICAgd3JpdGVGaWxlKHBhdGgsICc8P3htbCB2ZXJzaW9uPVxcXCIxLjBcXFwiIGVuY29kaW5nPVxcXCJVVEYtOFxcXCI/PlxcXFxuJyt4bWwpO1xcbiAgICAgICAgICAgIGlmIChvbmx5RG93bmxvYWQpIHJldHVybiBcXFwidG9hc3Q6Ly/kuIvovb3lrozmiJBcXFwiO1xcbiAgICAgICAgICAgIHJlZnJlc2hWaWRlb1VybCh7XFxuICAgICAgICAgICAgICAgIGRhbm11OiBwYXRoXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgYmFjayhmYWxzZSk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WKoOi9veWujOaIkFxcXCI7XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgaGlkZUxvYWRpbmcoKTtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8vXFxcIiArIGUudG9TdHJpbmcoKTtcXG4gICAgICAgIH1cXG4gICAgfSwgb25seURvd25sb2FkKSxcXG4gICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzNcXFwiXFxufSk7XFxuZC5wdXNoKHtcXG4gICAgdGl0bGU6IFxcXCJkbeebkuWtkOaQnOe0olxcXCIsXFxuICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoa2V5LCBvbmx5RG93bmxvYWQpID0+IHtcXG4gICAgICAgIGxldCBkbSA9IGdldFZhcihcXFwiZG1fc2hhcmVcXFwiKTtcXG4gICAgICAgIGlmIChkbSAmJiAhb25seURvd25sb2FkKSB7XFxuICAgICAgICAgICAgY2xlYXJWYXIoXFxcImRtX3NoYXJlXFxcIik7XFxuICAgICAgICAgICAgcmVmcmVzaFZpZGVvVXJsKHtcXG4gICAgICAgICAgICAgICAgZGFubXU6IGRtXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgYmFjayhmYWxzZSk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WKoOi9veWujOaIkFxcXCI7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHJldHVybiAkKGtleSwgXFxcImRt55uS5a2Q5pCc57SiXFxcIikuaW5wdXQoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICB0b2FzdChcXFwi5LiL6L295a6M5oiQ5by55bmV5ZCO6K+36YeN5paw54K55Ye75pCc57SiXFxcIik7XFxuICAgICAgICAgICAgICAgIHJldHVybiBc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cihhKSwgYiA9IE51bWJlcihiKTtcXG4gICAgICAgICAgICAgICAgaWYgKE51bWJlci5pc05hTihhKSB8fCBOdW1iZXIuaXNOYU4oYikpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/or7fmjInmoLzlvI/ovpPlhaXmlbDlrZdcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChhIDwgMSB8fCBiID4gZXBpc29kZXMubGVuZ3RoKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K+36L6T5YWl6KeE5a6a6IyD5Zu05YaF55qE5pWw5a2XXFxcIjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBjb25zdCBkYW5tdSA9ICQucmVxdWlyZShcXFwiZGFubXVcXFwiKTtcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSBhIC0gMSwgaiA9IDE7IGkgPCBiOyBpKyssIGorKykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBlcGlzb2RlID0gZXBpc29kZXNbaV07XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRtVGl0bGUgPSBhbmltZVRpdGxlICsgXFxcIl9cXFwiICsgZXBpc29kZS5lcGlzb2RlVGl0bGU7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2hvd0xvYWRpbmcoXFxcIuato+WcqOS4i+i9ve+8mlxcXCIgKyBlcGlzb2RlLmVwaXNvZGVUaXRsZSArIFxcXCJcXFxcdChcXFwiICsgaiArIFxcXCIvXFxcIiArIChiIC0gYSArIDEpICsgXFxcIilcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkYW5tdS5kb3dubG9hZERhbk11KGVwaXNvZGUuZXBpc29kZUlkLCBkbVRpdGxlKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKGUudG9TdHJpbmcoKSk7XFxuICAgICAgICAgICAgICAgICAgICBoaWRlTG9hZGluZygpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WTpuWTpuS4i+i9veWksei0pS4uLlxcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaGlkZUxvYWRpbmcoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S4i+i9veWujOaIkFxcXCI7XFxuICAgICAgICAgICAgfSwgYW5pbWUuYW5pbWVUaXRsZSwgYW5pbWUuZXBpc29kZXMpLFxcbiAgICAgICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vdHViaWFvL21vdmllLzE0LnN2Z1xcXCJcXG4gICAgICAgIH0pO1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVcXFwiXFxuICAgICAgICB9KTtcXG4gICAgICAgIGZvciAobGV0IGVwaXNvZGUgb2YgYW5pbWUuZXBpc29kZXMpIHtcXG4gICAgICAgICAgICBsZXQgZG1UaXRsZSA9IGFuaW1lLmFuaW1lVGl0bGUgKyBcXFwiX1xcXCIgKyBlcGlzb2RlLmVwaXNvZGVUaXRsZTtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogZXBpc29kZS5lcGlzb2RlVGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogJChlcGlzb2RlLmVwaXNvZGVJZCkubGF6eVJ1bGUoKHVybCwgdGl0bGUsIG9ubHlEb3dubG9hZCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZGFubXUgPSAkLnJlcXVpcmUoXFxcImRhbm11XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGF0aCA9IGRhbm11LmdldExvY2FsRGFuTXUoaW5wdXQsIHRpdGxlKSB8fCBkYW5tdS5kb3dubG9hZERhbk11KGlucHV0LCB0aXRsZSk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAob25seURvd25sb2FkKSByZXR1cm4gXFxcInRvYXN0Oi8v5LiL6L295a6M5oiQXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBkYW5tdVRleHQgPSBmZXRjaChwYXRoKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmICghZGFubXVUZXh0KSByZXR1cm4gXFxcInRvYXN0Oi8v6L+Y5rKh5pyJ5by55bmV5ZOfflxcXCI7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoVmlkZW9Vcmwoe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhbm11OiBwYXRoXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIGJhY2soZmFsc2UpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WKoOi9veWujOaIkFxcXCI7XFxuICAgICAgICAgICAgICAgIH0sIE1ZX1BBUkFNUy5kdXJsLCBkbVRpdGxlLCBvbmx5RG93bmxvYWQpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLlvLrliLbkuIvovb1cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChlcGlzb2RlVGl0bGUsIGVwaXNvZGVJZCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG93TG9hZGluZyhcXFwi6K+3562J5b6FXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGRhbm11ID0gJC5yZXF1aXJlKFxcXCJkYW5tdVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYW5tdS5kb3dubG9hZERhbk11KGVwaXNvZGVJZCwgZXBpc29kZVRpdGxlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGlkZUxvYWRpbmcoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+mHjeaWsOS4i+i9veWujOaIkO+8jOWNleWHu+aMgui9veOAglxcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgZG1UaXRsZSwgZXBpc29kZS5lcGlzb2RlSWQpXFxuICAgICAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZV9ibGFua1xcXCJcXG4gICAgICAgIH0pO1xcbiAgICB9XFxuICAgIGlmICghZG1MaXN0LmFuaW1lcy5sZW5ndGgpIHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLmsqHmnInmib7liLDkuI5bXFxcIiArIG5hbWUgKyBcXFwiXeebuOWFs+eahOW8ueW5lVxcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgZGVzYzogXFxcIuaQnOS4jeWIsOaAjuS5iOWKnu+8n1xcXFxu5qOA5p+l5ZCN56ew5piv5ZCm5q2j56Gu77yb5Y+v5Lul5bCd6K+V5Yig6Zmk6YOo5YiG6ZmQ5a6a6K+N77yM5aaC56ys5LiA5a2j562J77yb6ICM5LiU5Y+q6IO95pCc57Si55Wq5Ymn5ZOm77yB5YW25LuW5by55bmV5Y+v55SoZG3nm5LlrZDjgIJcXFwiLFxcbiAgICAgICAgICAgIGNvbF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AgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAnY29udGVudC10eXBlJzogJ2FwcGxpY2F0aW9uL2pzb24nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJVc2VyLUFnZW50XFxcIjogUENfVUEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL1xcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICBib2R5OiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcInNoYXJlX2lkXFxcIjogc2hhcmVJZFxcbiAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBpZiAoc2hhcmUuaW5jbHVkZXMoXFxcInNoYXJlX2xpbmsgaXNcXFwiKSB8fCBzaGFyZS5pbmNsdWRlcyhcXFwic2hhcmVfbGluayBjYW5ub3RcXFwiKSkgcmV0dXJuIGZhbHNlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGUpIHt9XFxuICAgICAgICByZXR1cm4gdHJ1ZTtcXG4gICAgfSxcXG4gICAgYnl0ZXNUb1NpemUoc2l6ZSkge1xcbiAgICAgICAgaWYgKCFzaXplKSB7XFxuICAgICAgICAgICAgcmV0dXJuICcwJztcXG4gICAgICAgIH1cXG4gICAgICAgIGNvbnN0IHVuaXRzID0gWydCJywgJ0tCJywgJ01CJywgJ0dCJywgJ1RCJywgJ1BCJywgJ0VCJywgJ1pCJywgJ1lCJ107XFxuICAgICAgICBsZXQgaSA9IDA7XFxuICAgICAgICB3aGlsZSAoc2l6ZSA+PSAxMDI0KSB7XFxuICAgICAgICAgICAgc2l6ZSAvPSAxMDI0O1xcbiAgIC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4ge1xcbiAgICAgICAgbGV0IGluZGV4YyA9IGlucHV0LnNwbGl0KC8sfO+8jC8pO1xcbiAgICAgICAgbGV0IGluZGV4cyA9IFtdO1xcbiAgICAgICAgbGV0IG1vID0gcGFyc2VJbnQoaW5kZXhjWzBdKTtcXG4gICAgICAgIGlmICghKGluZGV4Yy5sZW5ndGggPT09IDEgJiYgbW8gPCAwICYmIG1vID4gLTQpKSB7XFxuICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgaW5kZXhjKSB7XFxuICAgICAgICAgICAgICAgIGxldCBudW0gPSBwYXJzZUludChpdCk7XFxuICAgICAgICAgICAgICAgIGlmIChOdW1iZXIuaXNOYU4obnVtKSB8fCBudW0gPj0gbGVuZ3RoIHx8IG51bSA8IDApIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mlbDlrZfkuI3lkIjms5VcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGluZGV4cy5wdXNoKG51bSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuICQoW1xcXCJISUtFUlxcXCIsXFxcIlRYVFxcXCJdLmNvbmNhdChnZXRQYXN0ZXMoKSksIDIsIFxcXCLliIbkuqvmlrnlvI9cXFwiKS5zZWxlY3QoKG1vLCBpbmRleHMpID0+IHtcXG4gICAgICAgICAgICBmdW5jdGlvbiB1cChydWxlcykge1xcbiAgICAgICAgICAgICAgICBsZXQgcnVsZWI2NCA9IGJhc2U2NEVuY29kZShKU09OLnN0cmluZ2lmeShydWxlcykpO1xcbiAgICAgICAgICAgICAgICBsZXQgZ2V0UGFzcyA9IChsZW5ndGgsIHJ1bGUsIHR5cGUpID0+IFxcXCLmtbfpmJTop4bnlYzkupHnroDmkJzntKLlvJXmk47vvIzlhbHjgIxcXFwiICsgbGVuZ3RoICsgXFxcIuOAjeadoe+8jOWkjeWItuaVtOadoeWPo+S7pOaJk+W8gOi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KCk7XFxuXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChtbyA9PT0gLTIpIHtcXG4gICAgICAgICAgICAgICAgcnVsZXMgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRVc2VmdWxKc29uKCk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChtbyA9PT0gLTMpIHtcXG4gICAgICAgICAgICAgICAgcnVsZXMgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRGb3JiaWRkZW5Kc29uKCk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgcnVsZXMgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCkuZmlsdGVyKCh2LCBpKSA9PiBpbmRleHMuaW5jbHVkZXMoaSkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBydWxlcyA9IHJ1bGVzLm1hcCgodikgPT4ge1xcbiAgICAgICAgICAgICAgICB2LnVzZXIgPSB1bmRlZmluZWQ7XFxuICAgICAgICAgICAgICAgIHYuZm9yYmlkZGVuID0gdW5kZWZpbmVkO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdjtcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICByZXR1cm4gdXAocnVsZXMpO1xcbiAgICAgICAgfSwgbW8sIGluZGV4cyk7XFxuXFxuICAgIH0sIGxlbmd0aCksXFxuICAgIGNvbF90eXBlOiBcXFwidGV4dF8zXFxcIixcXG59KTtcXG5kLnB1c2goe1xcbiAgICB0aXRsZTogXFxcIumHjee9rlxcXCIsXFxuICAgIHVybDogJChcXFwi5L2g56Gu5a6a6YeN572u77yfXFxcXG7or6Xmk43kvZzkvJrliKDpmaTnjrDmnInop4TliJnvvIzmgaLlpI3oh6rluKbop4TliJnjgIJcXFwiKS5jb25maXJtKChwYXRoKSA9PiB7XFxuICAgICAgICBkZWxldGVGaWxlKHBhdGgpO1xcbiAgICAgICA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ZWN0KChpbmRleCwgbGVuZ3RoKSA9PiB7XFxuICAgICAgICAgICAgaWYgKGlucHV0ID09PSBcXFwi57yW6L6RXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9ydWxlRWRpdCNub1JlY29yZEhpc3RvcnkjI25vSGlzdG9yeSNcXFwiO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLotKblj7dcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL3Bhc3N3b3JkI25vUmVjb3JkSGlzdG9yeSMjbm9IaXN0b3J5I1xcXCI7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuWIhuS6q1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgbGV0IG9wcyA9IGdldFBhc3RlcygpO1xcbiAgICAgICAgICAgICAgICBvcHMudW5zaGlmdChcXFwi5a6M5pW05Y+j5LukXFxcIik7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkKG9wcywgMiwgXFxcIuWIhuS6q+aWueW8j1xcXCIpLnNlbGVjdCgoaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBydWxlID0gJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuZ2V0SnNvbigpW2luZGV4XTtcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGUudXNlciA9IHVuZGVmaW5lZDtcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGUuZm9yYmlkZGVuID0gdW5kZWZpbmVkO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJ1bGViNjQgPSBiYXNlNjRFbmNvZGUoSlNPTi5zdHJpbmdpZnkocnVsZSkpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGdldFBhc3MgPSAobmFtZSwgcnVsZSwgdHlwZSkgPT4gXFxcIua1t+mYlOinhueVjO+8jOOAjFxcXCIgKyBuYW1lICsgXFxcIuOAjeS6keeugOaQnOe0ouW8leaTju+8jOWkjeWItuaVtOadoeWPo+S7pOaJk+W8gOi9r+S7tuWwseS8muiHquWKqOWvvOWFpSRcXFwiICsgcnVsZSArIFxcXCIkXFxcIiArIHR5cGUgKyBcXFwiQGltcG9ydD1qczokLnJlcXVpcmUoJ2ltcG9ydD9ydWxlPScrXFxcIiArIEpTT04uc3RyaW5naWZ5KE1ZX1JVTEUudGl0bGUpICsgXFxcIikoaW5wdXQpXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBcXFwi5a6M5pW05Y+j5LukXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBnZXRQYXNzKHJ1bGUubmFtZSwgcnVsZWI2NCwgXFxcImFcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHUgPSBzaGFyZVBhc3RlKHJ1bGViNjQsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImNvcHk6Ly9cXFwiICsgZ2V0UGFzcyhydWxlLm5hbWUsIHUsIFxcXCJiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0sIGluZGV4KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi56e75YqoXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChpbmRleCArIFxcXCJcXFwiLCBcXFwi6L6T5YWl5L2N572uXFxcIikuaW5wdXQoKGluZGV4LCBsZW5ndGgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBuZXdJbmRleCA9IE51bWJlcihpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoTnVtYmVyLmlzTmFOKG5ld0luZGV4KSB8fCBuZXdJbmRleCA+PSBsZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5LiN5ZKM6KeE55qE5L2N572uXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGxldCBydWxlcyA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBydWxlID0gcnVsZXMuc3BsaWNlKGluZGV4LCAxKVswXTtcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVzLnNwbGljZShuZXdJbmRleCwgMCwgcnVsZSk7XFxuICAgICAgICAgICAgICAgICAgICAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5zYXZlSnNvbihydWxlcyk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgIH0sIGluZGV4LCBsZW5ndGgpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGxldCBhcnIgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCk7XFxuICAgICAgICAgICAgICAgIGxldCBydWxlID0gYXJyW2luZGV4XTtcXG4gICAgICAgICAgICAgICAgcnVsZS5mb3JiaWRkZW4gPSAhcnVsZS5mb3JiaWRkZW47XFxuICAgICAgICAgICAgICAgICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLnNhdmVKc29uKGFycik7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgLy9yZXR1cm4gXFxcInRvYXN0Oi8vXFxcIiArIChydWxlLmZvcmJpZGRlbiA/IFxcXCLnpoHnlKhcXFwiIDogXFxcIuWQr+eUqFxcXCIpICsgcnVsZS5uYW1lO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIGksIGxlbmd0aCksXFxuICAgIC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XFxuICAgIHRyeSB7XFxuICAgICAgICBvYmogPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vZmlsZXMvX2NhdGNoL3l1blNpbXBsZUltcG9ydC5qc29uXFxcIik7XFxuICAgICAgICBsZXQgdGlwID0gaW5kZXggIT09IHZvaWQoMCkgPyBcXFwi5pu05paw6KeE5YiZXFxcIiA6IFxcXCLlr7zlhaXop4TliJlcXFwiO1xcbiAgICAgICAgc2V0UGFnZVRpdGxlKHRpcCArIFxcXCI6XFxcIiArIG9iai5uYW1lKTtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLigJjigJhcXFwiICsgdGlwICsgXFxcIuKAmeKAmVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG5cXG4gICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgb2JqID0ge307XFxuICAgICAgICBiYWNrKCk7XFxuICAgICAgICB0b2FzdChcXFwi5a+85YWl6ZSZ6K+vXFxcIik7XFxuICAgIH1cXG59IGVsc2UgaWYgKGluZGV4ICE9PSB2b2lkKDApKSB7XFxuICAgIG9iaiA9IGFycltpbmRleF07XFxuICAgIHNldFBhZ2VUaXRsZShcXFwi57yW6L6R6KeE5YiZOlxcXCIgKyBvYmoubmFtZSk7XFxuICAgIGlmIChvYmoubGFzdE1vZGlmeSkge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuS4iuasoeS/ruaUue+8mlxcXCIgKyAkLmRhdGVGb3JtYXQob2JqLmxhc3RNb2RpZnksIFxcXCJ5eXl5LU1NLWRkwqBISDptb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KyAhaXNQYWdlXFxuICAgICAgICB9KTtcXG4gICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgIH0sIG9iai5wYWdlKSxcXG4gICAgZXh0cmE6IHtcXG4gICAgICAgIGlkOiBcXFwicnVsZWVkcHNfcGFnZVxcXCJcXG4gICAgfVxcbn0pO1xcbmQucHVzaCh7XFxuICAgIHRpdGxlOiBcXFwi5Yig6ZmkXFxcIixcXG4gICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChpbmRleCwgdXJsSW5kZXgpID0+IHtcXG4gICAgICAgIGlmIChpbmRleCA9PT0gdm9pZCgwKSkge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mraTpobnml6Dms5XliKDpmaRcXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKHVybEluZGV4ICE9PSB2b2lkKDApKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+ato+WcqOabtOaWsOinhOWIme+8jOWIoOmZpOivt+S7juinhOWImeeuoeeQhui/m+WFpVxcXCI7XFxuICAgICAgICB9XFxuICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIua4qemmqOaPkOekulxcXCIsXFxuICAgICAgICAgICAgY29udGVudDogXFxcIuehruWumuimgeWIoOmZpOatpOinhOWImeWQl++8n+azqOaEj+WIoOmZpOWQjuaXoOazleaBouWkjVxcXCIsXFxuICAgICAgICAgICAgY29uZmlybTogJC50b1N0cmluZygoaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGFyciA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKTtcXG4gICAgICAgICAgICAgICAgYXJyLnNwbGljZShpbmRleCwgMSk7XFxuICAgICAgICAgICAgICAgICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLnNhdmVKc29uKGFycik7XFxuICAgICAgICAgICAgICAgIGJhY2sodHJ1ZSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/liKDpmaTmiJDlip9cXFwiO1xcbiAgICAgICAgICAgIH0sIGluZGV4KVxcbiAgICAgICAgfSk7XFxuICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgIH0sIGluZGV4LCB1cmxJbmRleCksXFxuICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIixcXG59KTtcXG5cXG5kLnB1c2goe1xcbiAgICB0aXRsZTogXFxcIuS/neWtmFxcXCIsXFxuICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaW5kZXgsIHBhZ2UpID0+IHtcXG4gICAgICAgIGxldCBuYW1lID0gZ2V0TXlWYXIoXFxcInBzX25hbWVcXFwiLCBcXFwiXFxcIik7XFxuICAgICAgICBpZiAobmFtZSA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lkI3lrZflvpfmnInkuIDkuKrlkKdcXFwiXFxuICAgICAgICB9XFxuICAgICAgICBsZXQgZmluZCA9IGdldE15VmFyKFxcXCJwc19maW5kXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgaWYgKGZpbmQgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5pCc57Si6KeE5YiZ5LiN6IO95Li656m6XFxcIlxcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IGFyciA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKTtcXG4gICAgICAgIGxldCBvYmoxID0ge1xcbiAgICAgICAgICAgIG5hbWU6IG5hbWUsXFxuICAgICAgICAgICAgZmluZDogZmluZCxcXG4gICAgICAgICAgICBiYXNpY1VybDogZ2V0TXlWYXIoXFxcInBzX2Jhc2ljVXJsXFxcIiwgXFxcI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tcXG4gICAgICAgIH1cXG4gICAgICAgICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLnNhdmVKc29uKGFycik7XFxuICAgICAgICBiYWNrKHRydWUpO1xcbiAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S/neWtmOaIkOWKn1xcXCI7XFxuICAgIH0sIGluZGV4LCBvYmoucGFnZSksXFxuICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIixcXG59KTtcXG5cXG5zZXRSZXN1bHQoZCk7XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLop4TliJnotKblj7dcIixcInBhdGhcIjpcInBhc3N3b3JkXCIsXCJydWxlXCI6XCJqczpcXG4oZnVuY3Rpb24oKSB7XFxuICAgIHZhciBkID0gW107XFxuICAgIGFkZExpc3RlbmVyKFxcXCJvbkNsb3NlXFxcIiwgJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICBjbGVhck15VmFyKFxcXCJwc19hY2NvdW50XFxcIik7XFxuICAgICAgICBjbGVhck15VmFyKFxcXCJwc19wYXNzd29yZFxcXCIpO1xcbiAgICAgICAgY2xlYXJNeVZhcihcXFwicHNfZXh0cmFcXFwiKTtcXG4gICAgfSkpO1xcbiAgICBsZXQgaW5kZXggPSBNWV9QQVJBTVMuaTtcXG4gICAgbGV0IGFyciA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKTtcXG4gICAgbGV0IG9iaiA9IGFycltpbmRleF0gfHwge307XFxuICAgIHNldFBhZ2VUaXRsZShcXFwi6K6+572u6LSm5Y+3OlxcXCIgKyBvYmoubmFtZSk7XFxuICAgIGxldCByZWdpc3RlclVybCA9IG9iai5yZWdpc3RlclVybDtcXG4gICAgaWYgKHJlZ2lzdGVyVXJsKSB7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLliY3lvoDms6jlhoxcXFwiLFxcbiAgICAgICAgICAgIHVybDogJChcXFwiaGlrZXI6Ly9lbXB0eSNub1JlY29yZEhpc3RvcnkjI25vSGlzdG9yeSNcXFwiKS5ydWxlKChyZWdpc3RlclVybCk9PntcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KFt7XFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTpcXFwieDVfd2Vidmlld19zaW5nbGVcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOnJlZ2lzdGVyVXJsLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzpcXFwiZmxvYXQmJjEwMCVcXFwiXFxuICAgICAgICAgICAgICAgIH1dKTtcXG4gICAgICAgICAgICB9LCByZWdpc3RlclVybCksXFxuICAgICAgICAgICAgZXh0cmE6e1xcbiAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IFxcXCLms6jlhozotKblj7c6XFxcIiArIG9iai5uYW1lXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuICAgIH1cXG4gICAgb2JqID0gb2JqLnVzZXIgfHwge307XFxuICAgIGQucHVzaCh7XFxuICAgICAgICBjb2xfdHlwZTogXFxcImlucHV0XFxcIixcXG4gICAgICAgIGRlc2M6IFxcXCLnlKjmiLflkI1cXFwiLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBvbkNoYW5nZTogJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJwc19hY2NvdW50XFxcIiwgaW5wdXQpO1xcbiAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogb2JqLmFjY291bnQsXFxuICAgICAgICAgICAgdGl0bGVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgfVxcbiAgICB9KTtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgZGVzYzogXFxcIuWvhueggVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIHR5cGU6IFxcXCJwYXNzd29yZFxcXCIsXFxuICAgICAgICAgICAgb25DaGFuZ2U6ICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwicHNfcGFzc3dvcmRcXFwiLCBpbnB1dCk7XFxuICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBvYmoucGFzc3dvcmQsXFxuICAgICAgICAgICAgdGl0bGVWaXNpYmxlOiBmYWxzZSxcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICBjb2xfdHlwZTogXFxcImlucHV0XFxcIixcXG4gICAgICAgIGRlc2M6IFxcXCLpop3lpJZcXFwiLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICB0eXBlOiBcXFwidGV4dGFyZWFcXFwiLFxcbiAgICAgICAgICAgIG9uQ2hhbmdlOiAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcInBzX2V4dHJhXFxcIiwgaW5wdXQpO1xcbiAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogb2JqLmV4dHJhLFxcbiAgICAgICAgICAgIHRpdGxlVmlzaWJsZTogZmFsc2UsXFxuICAgICAgICAgICAgaGVpZ2h0OiAtMVxcbiAgICAgICAgfVxcbiAgICB9KTtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBcXFwi5L+d5a2YXFxcIixcXG4gICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaW5kZXgpID0+IHtcXG4gICAgICAgICAgICBsZXQgYWNjb3VudCA9IGdldE15VmFyKFxcXCJwc19hY2NvdW50XFx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24oKTtcXG4gICAgICAgIGxldCBuZXdJID0gMDtcXG4gICAgICAgIGZvciAobGV0IHJ1bGUgb2YgcnVsZXMpIHtcXG4gICAgICAgICAgICBsZXQgaW5kZXggPSBhcnIuZmluZEluZGV4KHYgPT4gdi5uYW1lID09PSBydWxlLm5hbWUpO1xcbiAgICAgICAgICAgIGlmIChpbmRleCA+IC0xKSB7XFxuICAgICAgICAgICAgICAgIHJ1bGUgPSBPYmplY3QuYXNzaWduKGFycltpbmRleF0sIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICBhcnIuc3BsaWNlKGluZGV4LCAxLCBydWxlKTtcXG4gICAgICAgICAgICAgICAgaWYgKHJ1bGVzLmxlbmd0aCA9PT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgc2F2ZUNhY2hlKHJ1bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvcnVsZUVkaXQjbm9IaXN0b3J5IyNub1JlY29yZEhpc3RvcnkjP2lzSW1wb3J0PXRydWUmaW5kZXg9XFxcIiArIGluZGV4ICsgXFxcIiZydWxlPVxcXCIgKyBydWxlVGl0bGU7XFxuICAgICAgICAgICAgICAgICAgICAvL3RvYXN0KFxcXCLlt7Lmm7TmlrDop4TliJnvvJpcXFwiICsgcnVsZS5uYW1lKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi5bey5pu05paw6KeE5YiZ77yaXFxcIiArIHJ1bGUubmFtZSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIG5ld0krKztcXG4gICAgICAgICAgICAgICAgYXJyLnVuc2hpZnQocnVsZSk7XFxuICAgICAgICAgICAgICAgIGlmIChydWxlcy5sZW5ndGggPT09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVDYWNoZShydWxlKTtcXG4gICAgICAgIC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ZHsyfSl7Mn0vLmV4ZWMocGRmaChpdGVtLCBcXFwiLmxheXVpLWNhcmQtYm9keSYmVGV4dFxcXCIpKSB8fCBbXTtcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIC8vZGVzYzogdGltZVswXSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogYmFzZTY0RGVjb2RlKHBkZmgoaXRlbSwgXFxcImEmJnVybFxcXCIpKVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sIHtcXG4gICAgICAgIG5hbWU6IFxcXCLmt7flkIjnm5hcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFwiaHR0cHM6Ly9hcGkuaHVuaGVwYW4uY29tL3YxL3NlYXJjaFxcXCI7XFxuICAgICAgICAgICAgbGV0IGpzb24gPSBwb3N0KHVybCwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBSZWZlcmVyOiBcXFwiaHR0cHM6Ly9odW5oZXBhbi5jb20vXFxcIlxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICBcXFwicVxcXCI6IHMsXFxuICAgICAgICAgICAgICAgICAgICBcXFwicGFnZVxcXCI6IHBhZ2UsXFxuICAgICAgICAgICAgICAgICAgICBcXFwic2l6ZVxcXCI6IDE1XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAganNvbiA9IEpTT04ucGFyc2UoanNvbik7XFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBqc29uLmRhdGEubGlzdDtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGlzdC5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBsaXN0W2ldO1xcbiAgICAgICAgICAgICAgICBpZiAoaXQuZGlza190eXBlICE9PSBcXFwiQUxZXFxcIiB8fCBpdC5zaGFyZV91c2VyID09PSBcXFwi5Li2Kioq5Li2XFxcIikgY29udGludWU7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXQuZGlza19uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogcGQoaXQsIFxcXCJpbWcmJnNyY1xcXCIsIHVybCksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IGl0LmxpbmssXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBpdC51cGRhdGVfdGltZSArIFxcXCJcXFxcblxcXCIgKyBpdC5saW5rLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sIHtcXG4gICAgICAgIG5hbWU6IFxcXCLotYTmupDluK5cXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQocywgcGFnZSkge1xcbiAgICAgICAgICAgIGZ1bmN0aW9uIHNlYXJjaCgpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJ0bkxpc3QgPSBbXTtcXG4gICAgICAgICAgICAgICAgbGV0IHJlc3AgPSByZXF1ZXN0KFxcXCJodHRwczovL3p5Yi51cHl1bnNvLmNvbS92MTUvc2VhcmNoP2tleXdvcmQ9XFxcIiArIGVuX2FlcyhzKSArIFxcXCImc190eXBlPTImcGFnZT1cXFwiICsgcGFnZSArIFxcXCImYXRrPSZkaWQ9XFxcIiArIGdlbmVyYXRlUmFuZG9tSGV4U3RyaW5nKDY0KSwge1xcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJ1c2VyLWFnZW50XFxcIjogXFxcIk1vemlsbGEvNS4wIChMaW51eDsgQW5kcm9pZCAxMDsgUmVkbWkgTm90ZSA3IEJ1aWxkL1FLUTEuMTkwOTEwLjAwMjsgd3YpIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIFZlcnNpb24vNC4wIENocm9tZS84MS4wLjQwNDQuMTM4IE1vYmlsZSBTYWZhcmkvNTM3LjM2IHVuaS1hcHAgSHRtbDVQbHVzLzEuMCAoSW1tZXJzZWQvMjkuMDkwOTEpXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBsZXQgcmVzcERhdGEgPSBkZV9hZXMocmVzcCk7XFxuICAgICAgICAgICAgICAgIGxldCBqc29uRGF0YSA9IEpTT04ucGFyc2UocmVzcERhdGEpIHx8IHt9O1xcbiAgICAgICAgICAgICAgICBsZXQgcmVzdWx0ID0ganNvbkRhdGEucmVzdWx0IHx8IHt9O1xcbiAgICAgICAgICAgICAgICBsZXQgaXRlbXMgPSByZXN1bHQuaXRlbXMgfHwgW107XFxuXFxuICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgaXRlbXMubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBpdGVtID0gaXRlbXNbaV07XFxuICAgICAgICAgICAgICAgICAgICBsZXQgY29udGVudCA9IGl0ZW0uY29udGVudCB8fCBbXTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChjb250ZW50Lmxlbmd0aCA9PSAwIHx8ICFpdGVtLnBhZ2VfdXJsKSBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCB1cmwgPSBkZV9hZXMoaXRlbS5wYWdlX3VybCkgfHwgXFxcIlxcXCI7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoIXVybCkgY29udGludWU7XFxuICAgICAgICAgICAgICAgICAgICBydG5MaXN0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAoaXRlbS50aXRsZS5sZW5ndGggPiAzMCA/IGl0ZW0udGl0bGUuc2xpY2UoMCwgMjcpICsgXFxcIi4uLlxcXCIgOiBpdGVtLnRpdGxlKSB8fCBcXFwiXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFwi5YiG5Lqr5pe26Ze077yaXFxcIiArIGl0ZW0uaW5zZXJ0X3RpbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB1cmxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgIHJldHVybiBydG5MaXN0O1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBnZW5lcmF0ZVJhbmRvbUhleFN0cmluZyhsZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJlc3VsdCA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgICBjb25zdCBjaGFyYWN0ZXJzID0gXFxcIjAxMjM0NTY3ODlhYmNkZWZcXFwiO1xcbiAgICAgICAgICAgICAgICBjb25zdCBjaGFyYWN0ZXJzTGVuZ3RoID0gY2hhcmFjdGVycy5sZW5ndGg7XFxuICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdCArPSBjaGFyYWN0ZXJzLmNoYXJBdChNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBjaGFyYWN0ZXJzTGVuZ3RoKSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGFsaVV0aWwgPSAkLnJlcXVpcmUoXFxcImFsaVV0aWxcXFwiKTtcXG4gICAgICAgICAgICBsZXQgQ3J5cHRvSlMgPSBhbGlVdGlsLmdldENyeXB0b0pTKCk7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gZW5fYWVzKGUpIHtcXG4gICAgICAgICAgICAgICAgbGV0IGkgPSBcXFwicXExOTIwNTIwNDYwcXF6elxcXCI7XFxuICAgICAgICAgICAgICAgIC8vIGVuX2Flc1xcbiAgICAgICAgICAgICAgICBsZXQga2V5ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoaSk7XFxuICAgICAgICAgICAgICAgIHZhciB0ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoZSksXFxuICAgICAgICAgICAgICAgICAgICByID0gQ3J5cHRvSlMuQUVTLmVuY3J5cHQodCwga2V5LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaXY6IGtleSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiBDcnlwdG9KUy5tb2RlLkNCQyxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gci5jaXBoZXJ0ZXh0LnRvU3RyaW5nKCk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGRlX2Flcyh2dikge1xcbiAgICAgICAgICAgICAgICBsZXQgaSA9IFxcXCJxcTE5MjA1MjA0NjBxcXp6XFxcIjtcXG4gICAgICAgICAgICAgICAgLy8gZGVfYWVzXFxuICAgICAgICAgICAgICAgIGxldCBrZXkgPSBDcnlwdG9KUy5lbmMuVXRmOC5wYXJzZShpKTtcXG4gICAgICAgICAgICAgICAgbGV0IGhleFZhbCA9IENyeXB0b0pTLmVuYy5IZXgucGFyc2UodnYpLFxcbiAgICAgICAgICAgICAgICAgICAgdmFsID0gQ3J5cHRvSlMuZW5jLkJhc2U2NC5zdHJpbmdpZnkoaGV4VmFsKSxcXG4gICAgICAgICAgICAgICAgICAgIGRlY3J5cHRlZCA9IENyeXB0b0pTLkFFUy5kZWNyeXB0KHZhbCwga2V5LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaXY6IGtleSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiBDcnlwdG9KUy5tb2RlLkNCQyxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gZGVjcnlwdGVkLnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHNlYXJjaCgpO1xcbiAgICAgICAgfVxcbiAgICB9LCB7XFxuICAgICAgICBuYW1lOiBcXFwi5LqR55uY6LWE5rqQXFxcIixcXG4gICAgICAgIHBhZ2U6IHRydWUsXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxuICAgICAgICAgICAgbGV0IHVybCA9IFxcXCJodHRwczovL3Jlcy55dW5wYW4ud2luLz9QYWdlSW5kZXg9XFxcIiArIHBhZ2UgKyBcXFwiJlBhZ2VTaXplPTEyJktleXdvcmQ9XFxcIiArIHMgKyBcXFwiJlR5cGU9JlRhZz1cXFwiO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly9yZXMueXVucGFuLndpbi9cXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICBsZXQgYXJyID0gcGRmYShodG1sLCBcXFwibWFpbiYmLmNhcmRcXFwiKTtcXG4gICAgICAgICAgICAvL2xvZyhhcnIpO1xcbiAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBkZmgoaXQsIFxcXCIuY2FyZC1saW5rLDEmJm9uY2xpY2tcXFwiKS5tYXRjaCgvaHR0cHM6XFxcXC9cXFxcLyh3d3dcXFxcLmFsaXl1bmRyaXZlXFxcXC5jb21cXFxcL3N8YWx5d3BcXFxcLm5ldClcXFxcL1xcXFx3Ki9nKSB8fCBbXTtcXG4gICAgICAgICAgICAgICAgdSA9IHUubGVuZ3RoID4gMCA/IHVbMF0gOiB1cmw7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGRmaChpdCwgXFxcIi5jYXJkLXRpdGxlJiZUZXh0XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBwZChpdCwgXFxcImltZyYmc3JjXFxcIiwgdXJsKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHBkZmgoaXQsIFxcXCIuY2FyZC10ZXh0LC0xJiZUZXh0XFxcIikgKyBcXFwiXFxcXG5cXFwiICsgdSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBkO1xcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICB7XFxuICAgICAgICBuYW1lOiBcXFwiVVDkupHmkJxcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgdXJsID0gXFxcImh0dHBzOi8vYXBpLnVweXVuc28yLmNvbS9zZWFyY2g/a2V5d29yZD1cXFwiICsgcyArIFxcXCImcGFnZT1cXFwiICsgcGFnZSArIFxcXCImc190eXBlPTFcXFwiO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly93d3cudXB5dW5zby5jb21cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcIkNvb2tpZVxcXCI6IFxcXCJjb2RlPTE5MTlcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAvL2xvZyhiYXNlNjREZWNvZGUoaHRtbCkpO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGJhc2U2NERlY29kZShodG1sKSkucmVzdWx0Lml0ZW1zO1xcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXG4gICAgICAgICAgICBpZiAoIWFycikgcmV0dXJuIFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBpdC5wYWdlX3VybDtcXG4gICAgICAgICAgICAgICAgLy91ID0gdS5sZW5ndGggPiAwID8gdVswXSA6IHVybDtcXG4gICAgICAgICAgICAgICAgaWYgKCF1LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0LnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIlxcXFxuXFxcIiArICh1KSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBkO1xcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICB7XFxuICAgICAgICBuYW1lOiBcXFwi54yr54u455uY5pCcXFxcIixcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChcXFwiaHR0cHM6Ly93d3cuYWxpcGFuc291LmNvbS9zZWFyY2g/az1cXFwiICsgcywge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiUmVmZXJlclxcXCI6IFxcXCJodHRwczovL3d3dy5hbGlwYW5zb3UuY29tL3NlYXJjaD9rPVxcXCIgKyBzXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBsZXQgYXJyID0gcGRmYShodG1sLCBcXFwiI2FwcCYmYVxcXCIpO1xcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBcXFwiPGRpdj5cXFwiICsgYXJyW2ldICsgXFxcIjwvZGl2PlxcXCI7XFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGRmaChpdCwgXFxcImEmJmhyZWZcXFwiKTtcXG4gICAgICAgICAgICAgICAgLy9sb2codSk7XFxuICAgICAgICAgICAgICAgIGlmICghdS5pbmNsdWRlcyhcXFwiL3MvXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHUgPSBcXFwiaHR0cHM6Ly93d3cuYWxpcGFuc291LmNvbVxcXCIgKyB1LnJlcGxhY2UoXFxcIi9zL1xcXCIsIFxcXCIvY3YvXFxcIik7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGRmaChpdCwgXFxcInRlbXBsYXRlJiZUZXh0XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHUsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBwZGZoKGl0LCBcXFwidGVtcGxhdGUsMSYmVGV4dFxcXCIpLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9LFxcbiAgICAgICAgZmluZEFsaVVybChpbnB1dCkge1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChpbnB1dCwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiQ29va2llXFxcIjogXFxcIm5vX3Nob3dfZG9uYXRlPTFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBpbnB1dC5yZXBsYWNlKFxcXCIvY3YvXFxcIiwgXFxcIi9zL1xcXCIpXFxuICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIHJlZGlyZWN0OiBmYWxzZVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGh0bWwgPSBwYXJzZURvbUZvckh0bWwoaHRtbCwgJ2EmJmhyZWYnKTtcXG4gICAgICAgICAgICBpZiAoaHRtbC5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBodG1sO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBpbnB1dDtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCLmmJPmkJxcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgYWxpVXRpbCA9ICQucmVxdWlyZShcXFwiYWxpVXRpbFxcXCIpO1xcbiAgICAgICAgICAgIGxldCBDcnlwdG9KUyA9IGFsaVV0aWwuZ2V0Q3J5cHRvSlMoKTtcXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBrZXllbihzdHIpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IENyeXB0b0pTLmVuYy5VdGY4LnBhcnNlKFxcXCI0T1RvU2NVRk9hZVZUckhFXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICBpdiA9IENyeXB0b0pTLmVuYy5VdGY4LnBhcnNlKFxcXCI5Q0xHYW8xdkhLcW0xN096XFxcIik7XFxuICAgICAgICAgICAgICAgIHZhciBlbmNyeXB0ZWQgPSBDcnlwdG9KUy5BRVMuZGVjcnlwdCh7XFxuICAgICAgICAgICAgICAgICAgICBjaXBoZXJ0ZXh0OiBDcnlwdG9KUy5lbmMuQmFzZTY0LnBhcnNlKHN0cilcXG4gICAgICAgICAgICAgICAgfSwga2V5LCB7XFxuICAgICAgICAgICAgICAgICAgICBpdjogaXYsXFxuICAgICAgICAgICAgICAgICAgICBtb2RlOiBDcnlwdG9KUy5tb2RlLkNCQyxcXG4gICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IENyeXB0b0pTLnBhZC5Qa2NzN1xcbiAgICAgICAgICAgICAgICB9KS50b1N0cmluZyhDcnlwdG9KUy5lbmMuVXRmOCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBlbmNyeXB0ZWQ7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChcXFwiaHR0cHM6Ly95aXNvLmZ1bi9hcGkvc2VhcmNoP25hbWU9XFxcIiArIHMgKyBcXFwiJnBhZ2VObz1cXFwiICsgcGFnZSwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiUmVmZXJlclxcXCI6IFxcXCJodHRwczovL3lpc28uZnVuL2luZm8/c2VhcmNoS2V5PVxcXCIgKyBzLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcIkNvb2tpZVxcXCI6IGdldEl0ZW0oJ3lpc291Y29va2UnLCAnJylcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIC8vbG9nKGh0bWwpO1xcbiAgICAgICAgICAgIGlmIChodG1sLmluY2x1ZGVzKCfnmbvlvZXnlKjmiLfml6DpmZDliLYnKSkge1xcbiAgICAgICAgICAgICAgICB2YXIgaSA9IDA7XFxuICAgICAgICAgICAgICAgIGRvIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciB0eWltZ2xpbiA9ICdodHRwczovL3lpc28uZnVuL2FwaS91c2VyL2xvZ2luL2NhcHRjaGE/dD0nICsgcGFyc2VJbnQobmV3IERhdGUoKS5nZXRUaW1lKCkpICsgJyc7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgaW1nID0gY29udmVydEJhc2U2NEltYWdlKHR5aW1nbGluKS5zcGxpdCgnLCcpWzFdO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNvZCA9IHJlcXVlc3QoJ2h0dHBzOi8vYXBpLnhob2ZlLnRvcC9vY3IvYjY0L3RleHQnLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ29udGVudC1UeXBlJzogJ3RleHQvcGxhaW4nXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBpbWcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCdcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHZlciA9IEpTT04ucGFyc2UocmVxdWVzdCgnaHR0cHM6Ly95aXNvLmZ1bi9hcGkvdXNlci9sb2dpbicsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb250ZW50LXR5cGUnOiAnYXBwbGljYXRpb24vanNvbicsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdyZWZlcmVyJzogJ2h0dHBzOi8veWlzby5mdW4vbG9naW4nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ29va2llJzogZ2V0Q29va2llKHR5aW1nbGluKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwidXNlck5hbWVcXFwiOiBcXFwidHZib3gyMDIzXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcInBhc3N3b3JkXFxcIjogXFxcIlR2Ym94MjAyM1xcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJjb2RlXFxcIjogY29kXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHZlci5jb2RlID09IDIwMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZygn5piT5pCc55m75YWl6aqM6K+B5oiQ5YqfJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbSgneWlzb3Vjb29rZScsIGdldENvb2tpZSgnaHR0cHM6Ly95aXNvLmZ1bicpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBodG1sID0gcmVxdWVzdChcXFwiaHR0cHM6Ly95aXNvLmZ1bi9hcGkvc2VhcmNoP25hbWU9XFxcIiArIHMgKyBcXFwiJnBhZ2VObz1cXFwiICsgcGFnZSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwiUmVmZXJlclxcXCI6IFxcXCJodHRwczovL3lpc28uZnVuL2luZm8/c2VhcmNoS2V5PVxcXCIgKyBzLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcIkNvb2tpZVxcXCI6IGdldEl0ZW0oJ3lpc291Y29va2UnLCAnJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgaSsrO1xcbiAgICAgICAgICAgICAgICB9IHdoaWxlIChpIDwgNCk7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGh0bWwpLmRhdGEubGlzdDtcXG4gICAgICAgICAgICAvL2xvZyhhcnIpO1xcbiAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IGtleWVuKGl0LnVybCk7XFxuICAgICAgICAgICAgICAgIC8vbG9nKHUpO1xcbiAgICAgICAgICAgICAgICBpZiAodSA9PSBudWxsIHx8ICF1LmluY2x1ZGVzKFxcXCJhbGl5dW5cXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdC5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogKGl0LmdtdFNoYXJlIHx8IGl0LmdtdENyZWF0ZSkgKyBcXFwiXFxcXG5cXFwiICsgKHUpLFxcbiAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCLlsI/nurjmnaFcXFwiLFxcbiAgICAgICAgcGFnZTogZmFsc2UsXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxuICAgICAgICAgICAgbGV0IGFsaVV0aWwgPSAkLnJlcXVpcmUoXFxcImFsaVV0aWxcXFwiKTtcXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBnZXR0b2tlbigpIHtcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKCd4enl0b2tlbicsICcnKS5sZW5ndGggPT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRva2VuID0gSlNPTi5wYXJzZShwb3N0KCdodHRwczovL2dpdGNhZmUubmV0L3Rvb2wvYWxpcGFwZXIvJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly91LmdpdGNhZmUuaW5rLydcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiAnZ2V0X3Rva2VuJ1x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0Y2FmZS5uZXQvdG9vbC9hbGlwYXBlci9cXFwiLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vdS5naXRjYWZlLmluay8nXFxuICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIGJvZHk6IHtcXG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbjogXFxcInNlYXJjaFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBmcm9tOiBcXFwid2ViXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIHRva2VuOiBnZXR0b2tlbigpLFxcbiAgICAgICAgICAgICAgICAgICAga2V5d29yZDogc1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IEpTT04ucGFyc2UoaHRtbCk7XFxuICAgICAgICAgICAgaWYgKGxpc3QuZGF0YSkge1xcbiAgICAgICAgICAgICAgICBsaXN0ID0gbGlzdC5kYXRhO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gbGlzdFtpXVxcbiAgICAgICAgICAgICAgICBsZXQgdGl0bGUgPSBpdC50aXRsZTtcXG4gICAgICAgICAgICAgICAgbGV0IG11cmwgPSAnaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvJyArIGl0LmFsaWtleVxcbiAgICAgICAgICAgICAgICBpZiAoIWFsaVV0aWwuY2hlY2thbGkobXVybCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICh0aXRsZS5pbmNsdWRlcyhzKSkge1xcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKImiBcXFwiICsgdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogY2F0X2NvZGUoaXQuY2F0KSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXM6IGl0LmRlc1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBtdXJsXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAge1xcbiAgICAgICAgbmFtZTogXFxcIueOqeWBtuWTpeWTpVxcXCIsXFxuICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgYmFzaWNVcmw6IFxcXCJodHRwOi8vd29nZy54eXpcXFwiLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBiYXNpY1VybCArIFxcXCIvaW5kZXgucGhwL3ZvZHNlYXJjaC9cXFwiICsgcyArIFxcXCItLS0tLS0tLS0tXFxcIiArIHBhZ2UgKyBcXFwiLS0tLmh0bWxcXFwiO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwpO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsIFxcXCIubW9kdWxlLWl0ZW1zJiYubW9kdWxlLXNlYXJjaC1pdGVtXFxcIik7XFxuXFxuICAgICAgICAgICAgbGV0IGJldCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAg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AgICAgIGxldCB1cmwgPSBiYXNpY1VybCArIFxcXCIvc2VhcmNoLnBocD9xPVxcXCIgKyBzICsgXFxcIiZwYWdlPVxcXCIgKyBwYWdlO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHt9KTtcXG4gICAgICAgICAgICBsZXQgYXJyID0gcGRmYShodG1sLCBcXFwiLmxpc3QmJmxpXFxcIik7XFxuICAgICAgICAgICAgbGV0IGJldCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHV0aXRsZSA9IHBkZmgoaXQsIFxcXCJhJiZ0aXRsZVxcXCIpO1xcbiAgICAgICAgICAgICAgICBsZXQgdXNlcmlhbCA9IHBkZmgoaXQsIFxcXCIuZmEtY2xvY2stbyYmVGV4dFxcXCIpO1xcbiAgICAgICAgICAgICAgICBsZXQgdWltYWdlID0gcGRmaChpdCwgXFxcImltZyYmc3JjXFxcIik7XFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGQoaXQsIFxcXCJhJiZocmVmXFxcIiwgYmFzaWNVcmwpO1xcbiAgICAgICAgICAgICAgICBpZiAoIXV0aXRsZS5pbmNsdWRlcyhzKSkge1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgYmV0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHV0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgIHBpY191cmw6IHVpbWFnZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHVzZXJpYWxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIHJldHVybiBiZXQ7XFxuICAgICAgICB9LFxcbiAgICAgICAgZmluZEFsaVVybChpbnB1dCkge1xcbiAgICAgICAgICAgIHJldHVybiBwZGZhKHJlcXVlc3QoaW5wdXQpLCBcXFwiYm9keSYmYVtocmVmXj1odHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9dXFxcIikubWFwKHYgPT4gcGRmaCh2LCBcXFwiYSYmaHJlZlxcXCIpKTtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAge1xcbiAgICAgICAgbmFtZTogXFxcIuWcn+aLqOm8oFxcXCIsXFxuICAgICAgICBwYWdlOiBmYWxzZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IGZldGNoKCdodHRwczovL3d3dy50YnNkeS5jb20vc2VhcmNoLmh0bWw/a2V5d29yZD0nICsgcyArICcmY2F0ZWdvcnk9OTgzOTIwJmRhdGFfdHlwZT05ODc5MTAnLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUFcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcuc2VhcmNoX3Jlc3VsdF9uZXRkaXNrX2xpc3QmJmEnKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgLy9sb2coaXQpO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJ2EmJmhyZWYnKTtcXG4gICAgICAgICAgICAgICAgbGV0IHRpdCA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJy5uZXRkaXNrX2l0ZW1fZGV0YWlsX25hbWUmJlRleHQnKTtcXG4gICAgICAgICAgICAgICAgaWYgKCF0aXQuaW5jbHVkZXMocykpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8vbG9nKHUpO1xcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdCxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCJcXFxcblxcXCIgKyB1LFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCLpmL/ph4zmkJxcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCgnaHR0cHM6Ly9hbGlzby5jYy9zLycgKyBzICsgJy0nICsgcGFnZSArICctMC5odG1sJywge30pO1xcblxcbiAgICAgICAgICAgIGxldCBsaXN0ID0gcGFyc2VEb21Gb3JBcnJheShodG1sLCAnLnNlYXJjaC1yZXN1bHQmJi5yZXNvdXJjZS1pdGVtJyk7XFxuICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBsaXN0Lmxlbmd0aDsgaisrKSB7XFxuICAgICAgICAgICAgICAgIGxldCB1ID0gbGlzdFtqXTtcXG4gICAgICAgICAgICAgICAgbGV0IHRpdCA9IHBhcnNlRG9tRm9ySHRtbCh1LCAnaDMmJlRleHQnKTtcXG4gICAgICAgICAgICAgICAgaWYgKCF0aXQuaW5jbHVkZXMocykpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0LFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBwYXJzZURvbSh1LCAnaDMmJmEmJmhyZWYnLCAnaHR0cHM6Ly9hbGlzby5jYy8nKSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHBhcnNlRG9tRm9ySHRtbCh1LCAnLnRpbWUmJlRleHQnKSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBkO1xcbiAgICAgICAgfSxcXG4gICAgICAgIGZpbmRBbGlVcmwoaW5wdXQpIHtcXG4gICAgICAgICAgICBldmFsKGdldENyeXB0b0pTKCkpO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGRlY3J5KHN0cikge1xcbiAgICAgICAgICAgICAgICB2YXIga2V5ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoXFxcIjlFQjIwRERGRDZBRkJENjhcXFwiKTtcXG4gICAgICAgICAgICAgICAgdmFyIGVuY3J5cHRlZCA9IENyeXB0b0pTLkFFUy5kZWNyeXB0KHN0ciwga2V5LCB7XFxuICAgICAgICAgICAgICAgICAgICBpdjoga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgbW9kZTogQ3J5cHRvSlMubW9kZS5DQkMsXFxuICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOiBDcnlwdG9KUy5wYWQuUGtjczdcXG4gICAgICAgICAgICAgICAgfSkudG9TdHJpbmcoQ3J5cHRvSlMuZW5jLlV0ZjgpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gZW5jcnlwdGVkO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBsZX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gICAgIH0pLnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVuY3J5cHRlZDtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KFxcXCJodHRwczovL3d3dy55dW5wYW5mZW54aWFuZy5jbi9hcGkvYmJzL2FwaS9nZXRkYXRhP2tleT1cXFwiICsgcyArIFxcXCImdHlwZT12aWRlb1xcXCIsIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly93d3cueXVucGFuZmVueGlhbmcuY24vXFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgbGV0IGpzb24gPSBkZWNyeShKU09OLnBhcnNlKGh0bWwpLmRhdGEpO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGpzb24pO1xcblxcbiAgICAgICAgICAgIGxldCBiZXQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSBpdC5waWQ7XFxuICAgICAgICAgICAgICAgIGJldC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcImh0dHBzOi8vd3d3Lnl1bnBhbmZlbnhpYW5nLmNuL2FwaS9iYnMvYXBpL2dldGFydGljbGU/aWQ9XFxcIiArIHVybCxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdC50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IGl0LmNyZWF0ZXRpbWVcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIHJldHVybiBiZXQ7XFxuICAgICAgICB9LFxcbiAgICAgICAgZmluZEFsaVVybChpbnB1dCkge1xcbiAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShyZXF1ZXN0KGlucHV0LCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8vd3d3Lnl1bnBhbmZlbnhpYW5nLmNuL1xcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pKS5kYXRhO1xcbiAgICAgICAgICAgIGxldCBsaXN0ID0ganNvbi5kb3dubG9hZC5zcGxpdChcXFwiQFxcXCIpO1xcbiAgICAgICAgICAgIGxldCBhbGlzdCA9IG5ldyBTZXQoKTtcXG4gICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGxpc3QubGVuZ3RoOyBqKyspIHtcXG4gICAgICAgICAgICAgICAgYWxpc3QuYWRkKFxcXCJodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9cXFwiICsgbGlzdFtqXSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBBcnJheS5mcm9tKGFsaXN0KTtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAge1xcbiAgICAgICAgbmFtZTogXFxcIuebmOaQnFxcXCIsXFxuICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIHBhZ2UgPSAocGFnZSAtIDEpICogMTA7XFxuICAgICAgICAgICAgbGV0IHVybCA9IFxcXCJodHRwczovL3d3dy5wYW5zZWFyY2gubWUvc2VhcmNoP2tleXdvcmQ9XFxcIiArIHMgKyBcXFwiJm9mZnNldD1cXFwiICsgcGFnZSArIFxcXCImcGFuPWFsaXl1bmRyaXZlXFxcIjtcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QodXJsLCB7fSk7XFxuXFxuICAgICAgICAgICAgbGV0IGFyciA9IHBhcnNlRG9tRm9yQXJyYXkoaHRtbCwgJy5ncmlkJiYuc2hhZG93OmhhcyhhW2hyZWZePWh0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zL10pJyk7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwoaXQsICdhW2hyZWZePWh0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zL10mJmhyZWYnKTtcXG4gICAgICAgICAgICAgICAgbGV0IHBpY191cmwgPSBwYXJzZURvbUZvckh0bWwoaXQsICdpbWcmJnNyYycpO1xcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBhcnNlRG9tRm9ySHRtbChpdCwgJy5icmVhay1hbGwmJlRleHQnKS5zcGxpdCgnaHR0cCcpWzBdLFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogcGljX3VybCA9PT0gXFxcIi9mYXZpY29uLnBuZ1xcXCIgPyBcXFwiaHR0cHM6Ly93d3cucGFuc2VhcmNoLm1lL1xcXCIgKyBwaWNfdXJsIDogcGljX3VybCxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHBhcnNlRG9tRm9ySHRtbChpdCwgJ3AmJlRleHQnKSArIFxcXCJcXFxcblxcXCIgKyB1LFxcbiAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCJET1ZY5pCcXFxcIixcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFwiaHR0cHM6Ly9hcGkuZG92eC50ay9hbGkvc2VhcmNoP3dkPVxcXCIgKyBzO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwpO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGh0bWwpLmxpc3Q7XFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXG4gICAgICAgICAgICBsZXQgYWxpVXRpbCA9ICQucmVxdWlyZShcXFwiYWxpVXRpbFxcXCIpO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBpdC52b2RfY29udGVudDtcXG4gICAgICAgICAgICAgICAgaWYgKCF1LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpIHx8ICFhbGlVdGlsLmNoZWNrYWxpKHUpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLiiJogXFxcIiArIGl0LnZvZF9uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogaXQudm9kX3BpYyxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCJcXFxcblxcXCIgKyB1LFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9X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YVxcXCIpO1xcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGQoaXQsIFxcXCJhJiZocmVmXFxcIiwgdXJsKTtcXG4gICAgICAgICAgICAgICAgbGV0IHQgPSBwZGZoKGl0LCBcXFwiYSYmVGV4dFxcXCIpO1xcbiAgICAgICAgICAgICAgICBpZiAoaXQuaW5jbHVkZXMoXFxcIk5leHQgcGFnZVxcXCIpIHx8IGl0LmluY2x1ZGVzKFxcXCLkuIvkuIDpobVcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHUyID0gcGQoaXQsIFxcXCJhJiZocmVmXFxcIiwgdXJsKTtcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKFxcXCJuZXh0IHBhZ2VcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKHUyKTtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJiaW5nXFxcIiwgdTIpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICh1ID09IG51bGwgfHwgdCA9PSBudWxsIHx8ICFpdC5pbmNsdWRlcyhzKSkge1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKCFpdC5pbmNsdWRlcyhcXFwi572R55uYXFxcIikgJiYgIWl0LmluY2x1ZGVzKFxcXCLkupHnm5hcXFwiKSAmJlxcbiAgICAgICAgICAgICAgICAgICAgIWl0LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpICYmICFpdC5pbmNsdWRlcyhcXFwieXVucGFuXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICh1LnN0YXJ0c1dpdGgoXFxcImh0dHBzOi8vY24uYmluZy5jb20vXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGxldCBkb20gPSBnZXRIb21lKHUpLnJlcGxhY2UoXFxcImh0dHA6Ly9cXFwiLCBcXFwiXFxcIikucmVwbGFjZShcXFwiaHR0cHM6Ly9cXFwiLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgIGxldCBfbGlua3MgPSB0Lm1hdGNoKC9odHRwczpcXFxcL1xcXFwvKHd3d1xcXFwuYWxpeXVuZHJpdmVcXFxcLmNvbVxcXFwvc3xhbHl3cFxcXFwubmV0KVxcXFwvXFxcXHcqL2cpIHx8IFtdO1xcbiAgICAgICAgICAgICAgICBsZXQgYyA9IG51bGw7XFxuICAgICAgICAgICAgICAgIGlmIChfbGlua3MubGVuZ3RoID4gMSAmJiBfbGlua3NbMV0ucmVwbGFjZShfbGlua3NbMF0sIFxcXCJcXFwiKS5yZXBsYWNlKC9bYS16QS1aMC05XSsvZywgXFxcIlxcXCIpID09IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBjID0gX2xpbmtzWzFdO1xcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKF9saW5rcy5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgICAgICBjID0gX2xpbmtzWzBdO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdCxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IGRvbSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogYyAhPSBudWxsID8gYyA6IHUsXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLov5vlhaXnvZHnq5lcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqczogSlNPTi5zdHJpbmdpZnkoXFxcImhpa2VyOi8vcGFnZS95c2Z4P3dlYlVybD1cXFwiICsgZW5jb2RlVVJJQ29tcG9uZW50KHUpKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1dXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH0sXFxuICAgICAgICBmaW5kQWxpVXJsKGlucHV0KSB7XFxuICAgICAgICAgICAgaWYgKGlucHV0LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpKSByZXR1cm4gaW5wdXQ7XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KGlucHV0KTtcXG4gICAgICAgICAgICB2YXIgX2xpbmtzID0gaHRtbC5tYXRjaCgvaHR0cHM6XFxcXC9cXFxcLyh3d3dcXFxcLmFsaXl1bmRyaXZlXFxcXC5jb21cXFxcL3N8YWx5d3BcXFxcLm5ldClcXFxcL1xcXFx3Ki9nKSB8fCBbXTtcXG4gICAgICAgICAgICBpZiAoX2xpbmtzLmxlbmd0aCA+IDEgJiYgX2xpbmtzWzFdLnJlcGxhY2UoX2xpbmtzWzBdLCBcXFwiXFxcIikucmVwbGFjZSgvW2EtekEtWjAtOV0rL2csIFxcXCJcXFwiKSA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gX2xpbmtzWzFdO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoX2xpbmtzLmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIF9saW5rc1swXTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS95c2Z4P3dlYlVybD1cXFwiICsgZW5jb2RlVVJJQ29tcG9uZW50KGlucHV0KTtcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6ICdDQ09GJyxcXG4gICAgICAgIHBhZ2U6IHRydWUsXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxuICAgICAgICAgICAgbGV0IGQgPSBbXVxcbiAgICAgICAgICAgIGxldCBhbGlVdGlsID0gJC5yZXF1aXJlKFxcXCJhbGlVdGlsXFxcIik7XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSBmZXRjaCgnaHR0cHM6Ly9wYW4uY2NvZi5jYy9hcGkvc2VhcmNoJywge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiY29udGVudC10eXBlXFxcIjogJ2FwcGxpY2F0aW9uL2pzb24nLFxcbiAgICAgICAgICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly9wYW4uY2NvZi5jYy9zZWFyY2g/a2V5d29yZD0nICsgc1xcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBib2R5OiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwicGFnZVNpemVcXFwiOiAyMCxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJwYWdlTnVtXFxcIjogcGFnZSxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJrZXl3b3JkXFxcIjogcyxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJmcm9tTW9iaWxlXFxcIjogdHJ1ZVxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBKU09OLnBhcnNlKGh0bWwpXFxuICAgICAgICAgICAgICAgIC5kYXRhLnJvd3NcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gbGlzdFtpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gaXQuZmlsZU5hbWVcXG4gICAgICAgICAgICAgICAgbGV0IG11cmwgPSBpdC51cmxcXG4gICAgICAgICAgICAgICAgbGV0IHR5cGUgPSBpdC50eXBlLnJlcGxhY2UoL2ZvbGRlci8sICfmlofku7blpLknKS5yZXBsYWNlKC9maWxlLywgJ+aWh+S7ticpXFxuICAgICAgICAgICAgICAgIGlmICh0aXRsZS5pbmNsdWRlcyhzKSkge1xcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogJ+aWh+S7tuexu+Wei++8micgKyB0eXBlICsgJ++8jOaWh+S7tuWkp+Wwj++8micgKyBhbGlVdGlsLmJ5dGVzVG9TaXplKGl0LnNpemUpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbXVybFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZFxcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICB7XFxuICAgICAgICBuYW1lOiAn6Zi/6YeM5bCP56uZJyxcXG4gICAgICAgIHBhZ2U6IHRydWUsXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxuICAgICAgICAgICAgbGV0IGhvbWUgPSBcXFwiaHR0cHM6Ly9wYW42NjYubmV0XFxcIjtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChidWlsZFVybChob21lICsgXFxcIi9hcGkvZGlzY3Vzc2lvbnNcXFwiLCB7XFxuICAgICAgICAgICAgICAgIFxcXCJpbmNsdWRlXFxcIjogXFxcInVzZXIsbGFzdFBvc3RlZFVzZXIsbW9zdFJlbGV2YW50UG9zdCxtb3N0UmVsZXZhbnRQb3N0LnVzZXIsdGFncyx0YWdzLnBhcmVudCxmaXJzdFBvc3RcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiZmlsdGVyW3FdXFxcIjogcyAvKiArIFxcXCIgdGFnOnZpZGVvLGNvbWljXFxcIiovICxcXG4gICAgICAgICAgICAgICAgLy9cXFwiZmlsdGVyW3RhZ11cXFwiOiBcXFwidmlkZW8sY29taWNcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwicGFnZVtvZmZzZXRdXFxcIjogMjAgKiAocGFnZSAtIDEpXFxuICAgICAgICAgICAgfSksIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcImNvbnRlbnQtdHlwZVxcXCI6IFxcXCJhcHBsaWNhdGlvbi9qc29uXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8vcGFuNjY2Lm5ldC8/cT1cXFwiICsgc1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBKU09OLnBhcnNlKGh0bWwpLmRhdGE7XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdGVtID0gbGlzdFtpXS5hdHRyaWJ1dGVzO1xcbiAgICAgICAgICAgICAgICBsZXQgdXJsID0gaG9tZSArIFxcXCIvZC9cXFwiICsgaXRlbS5zbHVnO1xcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0udGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiAn5Y+R5biD5pe26Ze077yaJyArICQuZGF0ZUZvcm1hdChuZXcgRGF0ZShpdGVtLmNyZWF0ZWRBdCksIFxcXCJ5eXl5LU1NLWRkIEhIOm1tOnNzXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIui/m+WFpeW4luWtkFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzOiBKU09OLnN0cmluZ2lmeShcXFwiaGlrZXI6Ly9wYWdlL3lzZng/d2ViVXJsPVxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQodXJsKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9LFxcbiAgICAgICAgZmluZEFsaVVybChpbnB1dCkge1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcGRmaChyZXF1ZXN0KGlucHV0KSwgXFxcIlRleHRcXFwiKTtcXG4gICAgICAgICAgICBsZXQgX2xpbmtzID0gaHRtbC5tYXRjaCgvaHR0cHM6XFxcXC9cXFxcLyh3d3dcXFxcLmFsaXl1bmRyaXZlXFxcXC5jb21cXFxcL3N8YWx5d3BcXFxcLm5ldClcXFxcL1xcXFx3Ki9nKSB8fCBbXTtcXG4gICAgICAgICAgICBsZXQgc2hhcmVQd2QgPSBodG1sLm1hdGNoKC/mj5Dlj5bnoIFbOu+8ml1cXFxccyo/KFxcXFx3ezR9KS8pO1xcbiAgICAgICAgICAgIHNoYXJlUHdkID0gQXJyYXkuaXNBcnJheShzaGFyZVB3ZCkgJiYgc2hhcmVQd2QubGVuZ3RoID4gMCA/IHNoYXJlUHdkWzFdIDogXFxcIlxcXCI7XFxuICAgICAgICAgICAgaWYgKF9saW5rcy5sZW5ndGggPiAxICYmIF9saW5rc1sxXS5yZXBsYWNlKF9saW5rc1swXSwgXFxcIlxcXCIpLnJlcGxhY2UoL1thLXpBLVowLTldKy9nLCBcXFwiXFxcIikgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgICAgIGFsaVVybDogX2xpbmtzWzFdLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IHNoYXJlUHdkXFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChfbGlua3MubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgYWxpVXJsOiBfbGlua3NbMF0sXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2RcXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS95c2Z4P3dlYlVybD1cXFwiICsgZW5jb2RlVVJJQ29tcG9uZW50KGlucHV0KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6ICfkupHnm5jliIbkuqvnpL7ljLonLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgaG9tZSA9IFxcXCJodHRwczovL3l1bnBhbjEuY2NcXFwiO1xcbiAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KGJ1aWxkVXJsKGhvbWUgKyBcXFwiL2FwaS9kaXNjdXNzaW9uc1xcXCIsIHtcXG4gICAgICAgICAgICAgICAgXFxcImluY2x1ZGVcXFwiOiBcXFwidXNlcixsYXN0UG9zdGVkVXNlcixtb3N0UmVsZXZhbnRQb3N0LG1vc3RSZWxldmFudFBvc3QudXNlcix0YWdzLHRhZ3MucGFyZW50LGZpcnN0UG9zdFxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCJmaWx0ZXJbcV1cXFwiOiBzIC8qICsgXFxcIiB0YWc6dmlkZW8sY29taWNcXFwiKi8gLFxcbiAgICAgICAgICAgICAgICAvL1xcXCJmaWx0ZXJbdGFnXVxcXCI6IFxcXCJ2aWRlbyxjb21pY1xcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCJwYWdlW29mZnNldF1cXFwiOiAyMCAqIChwYWdlIC0gMSlcXG4gICAgICAgICAgICB9KSwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiY29udGVudC10eXBlXFxcIjogXFxcImFwcGxpY2F0aW9uL2pzb25cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly9wYW42NjYubmV0Lz9xPVxcXCIgKyBzXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IEpTT04ucGFyc2UoaHRtbCkuZGF0YTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ZW0gPSBsaXN0W2ldLmF0dHJpYnV0ZXM7XFxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSBob21lICsgXFxcIi9kL1xcXCIgKyBpdGVtLnNsdWc7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6ICflj5HluIPml7bpl7TvvJonICsgJC5kYXRlRm9ybWF0KG5ldyBEYXRlKGl0ZW0uY3JlYXRlZEF0KSwgXFxcInl5eXktTU0tZGQgSEg6bW06c3NcXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi6L+b5YWl5biW5a2QXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganM6IEpTT04uc3RyaW5naWZ5KFxcXCJoaWtlcjovL3BhZ2UveXNmeD93ZWJVcmw9XFxcIiArIGVuY29kZVVSSUNvbXBvbmVudCh1cmwpKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1dXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH0sXFxuICAgICAgICBmaW5kQWxpVXJsKGlucHV0KSB7XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSBwZGZoKHJlcXVlc3QoaW5wdXQpLCBcXFwiVGV4dFxcXCIpO1xcbiAgICAgICAgICAgIGxldCBfbGlua3MgPSBodG1sLm1hdGNoKC9odHRwczpcXFxcL1xcXFwvKHd3d1xcXFwuYWxpeXVuZHJpdmVcXFxcLmNvbVxcXFwvc3xhbHl3cFxcXFwubmV0KVxcXFwvXFxcXHcqL2cpIHx8IFtdO1xcbiAgICAgICAgICAgIGxldCBzaGFyZVB3ZCA9IGh0bWwubWF0Y2goL+aPkOWPlueggVs677yaXVxcXFxzKj8oXFxcXHd7NH0pLyk7XFxuICAgICAgICAgICAgc2hhcmVQd2QgPSBBcnJheS5pc0FycmF5KHNoYXJlUHdkKSAmJiBzaGFyZVB3ZC5sZW5ndGggPiAwID8gc2hhcmVQd2RbMV0gOiBcXFwiXFxcIjtcXG4gICAgICAgICAgICBpZiAoX2xpbmtzLmxlbmd0aCA+IDEgJiYgX2xpbmtzWzFdLnJlcGxhY2UoX2xpbmtzWzBdLCBcXFwiXFxcIikucmVwbGFjZSgvW2EtekEtWjAtOV0rL2csIFxcXCJcXFwiKSA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgYWxpVXJsOiBfbGlua3NbMV0sXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2RcXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKF9saW5rcy5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgICAgICBhbGlVcmw6IF9saW5rc1swXSxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkOiBzaGFyZVB3ZFxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL3lzZng/d2ViVXJsPVxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQoaW5wdXQpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgfSwge1xcbiAgICAgICAgbmFtZTogXFxcIueIseeci+e+juWJp1xcXCIsXFxuICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFwiaHR0cHM6Ly93d3cuMmttai5jbi9zZWFyY2gucGhwP3E9XFxcIiArIHMgKyBcXFwiJnBhZ2UvXFxcIiArIHBhZ2UgKyBcXFwiL1xcXCI7XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KHVybCk7XFxuICAgICAgICAgICAgbGV0IGFyciA9IHBhcnNlRG9tRm9yQXJyYXkoaHRtbCwgXFxcIi5saXN0LWl0JiZsaVxcXCIpO1xcblxcbiAgICAgICAgICAgIGxldCBiZXQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1dGl0bGUgPSBwYXJzZURvbUZvckh0bWwoaXQsIFxcXCJhJiZ0aXRsZVxcXCIpO1xcbiAgICAgICAgICAgICAgICBsZXQgdXNlcmlhbCA9IHBhcnNlRG9tRm9ySHRtbChpdCwgXFxcIi5pbmZvJiZzcGFuOm5vdCg6aGFzKGEpKS0taSYmVGV4dFxcXCIpO1xcbiAgICAgICAgICAgICAgICBsZXQgdWltYWdlID0gcGFyc2VEb20oaXQsIFxcXCJpbWcmJnNyY1xcXCIpO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBhcnNlRG9tKGl0LCBcXFwiYSYmaHJlZlxcXCIpO1xcbiAgICAgICAgICAgICAgICBiZXQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdXRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogdWltYWdlLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogdXNlcmlhbFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgcmV0dXJuIGJldDtcXG5cXG4gICAgICAgIH0sXFxuICAgICAgICBmaW5kQWxpVXJsKGlucHV0KSB7XFxuICAgICAgICAgICAgcmV0dXJuIHBkZmEocmVxdWVzdChpbnB1dCksIFxcXCJib2R5JiYjZG93bmxvYWRcXFwiKS5tYXAodiA9PiBwZGZoKHYsIFxcXCIuZG93biYmaHJlZlxcXCIpKTtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAge1xcbiAgICAgICAgbmFtZTogXFxcIuWlh+WmmeaQnOe0olxcXCIsXFxuICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgZmluZChzLCBwYWdlKSB7XFxuICAgICAgICAgICAgbGV0IHVybDtcXG4gICAgICAgICAgICBpZiAocGFnZSA9PT0gMSkge1xcbiAgICAgICAgICAgICAgICB1cmwgPSBidWlsZFVybChcXFwiaHR0cHM6Ly93d3cubWFnaWNhbHNlYXJjaC50b3AvYXBpL3BzaG91L2dldERhdGFcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICB3b3JkOiBzLFxcbiAgICAgICAgICAgICAgICAgICAgdHlwZTogXFxcIumYv+mHjOe9keebmFxcXCJcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gYnVpbGRVcmwoXFxcImh0dHBzOi8vd3d3Lm1hZ2ljYWxzZWFyY2gudG9wL2FwaS9wc2hvdS9nZXROZXh0UGFnZVxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcImh0dHBzOi8vYXBpLnVweXVuc28yLmNvbS9zZWFyY2g/c190eXBlPTJAcGFnZT1cXFwiICsgcGFnZSArIFxcXCJAa2V5d29yZD1cXFwiICsgZW5jb2RlVVJJQ29tcG9uZW50KHMpLFxcbiAgICAgICAgICAgICAgICAgICAgd2Vic2l0ZTogXFxcIumYv+mHjOe9keebmFxcXCJcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCByZXN1bHQgPSByZXF1ZXN0KHVybCwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBSZWZlcmVyOiBidWlsZFVybChcXFwiaHR0cHM6Ly93d3cubWFnaWNhbHNlYXJjaC50b3Avc2VhcmNoXFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHdvcmQ6IHMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY3BhZ2U6IDBcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICByZXN1bHQgPSBKU09OLnBhcnNlKEpTT04ucGFyc2UocmVzdWx0KSk7XFxuICAgICAgICAgICAgbGV0IGxpc3QgPSByZXN1bHQucmVzdWx0Lml0ZW1zO1xcbiAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgbGlzdCkge1xcbiAgICAgICAgICAgICAgICBpZiAoaXQuaWQgPT0gLTEpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXQudGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFwi5pel5pyf77yaXFxcIiArIGl0Lmluc2VydF90aW1lICsgXFxcIlxcXFxu6Lev5b6E77yaXFxcIiArIGl0LnBhdGgsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IGl0LnBhZ2VfdXJsXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH1cXG4gICAgfVxcbl07XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLmlofku7bmjpLluo9cIixcInBhdGhcIjpcIkZpbGVTb3J0aW5nXCIsXCJydWxlXCI6XCJsZ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bmVkJykge1xcbiAgICAgICAgICAgIG51bWJlciA9IG51bTtcXG4gICAgICAgICAgICBpZiAoaSA9PT0gc3RyLmxlbmd0aCAtIDEpIHtcXG4gICAgICAgICAgICAgICAgc2VjdGlvbiArPSBudW1iZXI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgdW5pdCA9IGNobk5hbWVWYWx1ZVtzdHJbaV1dLnZhbHVlO1xcbiAgICAgICAgICAgIHNlY1VuaXQgPSBjaG5OYW1lVmFsdWVbc3RyW2ldXS5zZWNVbml0O1xcbiAgICAgICAgICAgIGlmIChzZWNVbml0KSB7XFxuICAgICAgICAgICAgICAgIHNlY3Rpb24gPSAoc2VjdGlvbiArIG51bWJlcikgKiB1bml0O1xcbiAgICAgICAgICAgICAgICBydG4gKz0gc2VjdGlvbjtcXG4gICAgICAgICAgICAgICAgc2VjdGlvbiA9IDA7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgc2VjdGlvbiArPSAobnVtYmVyICogdW5pdCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIG51bWJlciA9IDA7XFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgcmV0dXJuIHJ0biArIHNlY3Rpb247XFxufVxcblxcbmZ1bmN0aW9uIG5hbWVDb21wYXJlKGEsIGIpIHtcXG4gICAgaWYgKGEgPT0gbnVsbCB8fCBiID09IG51bGwpXFxuICAgICAgICByZXR1cm4gYSA9PSBudWxsID8gYiA9PSBudWxsID8gMCA6IC0xIDogMTtcXG5cXG4gICAgYSA9IGEucmVwbGFjZSgvKFvpm7bkuIDkuozkuInlm5vkupTlha3kuIPlhavkuZ3ljYHnmb7ljYPkuIfkur9dKS9nLCBmdW5jdGlvbihtYXRjaCwgcDEsIHAyLCBwMywgb2Zmc2V0LCBzdHJpbmcpIHtcXG4gICAgICAgIC8vIHAxIGlzIG5vbmRpZ2l0cywgcDIgZGlnaXRz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iLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcImNvZGVcXFwiOiBjb2RlLFxcbiAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBsZXQgZGF0YSA9IEpTT04ucGFyc2UocmVzKTtcXG4gICAgICAgICAgICByZXR1cm4gZGF0YVtcXFwicmVmcmVzaF90b2tlblxcXCJdO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IHJlcyA9IHBvc3QoXFxcImh0dHBzOi8vYWxpeXVuZHJpdmUtb2F1dGgubWVzc2Vuc2UubWUvb2F1dGgvYXV0aG9yaXplL3FyY29kZVxcXCIsIHtcXG4gICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgIFxcXCJzY29wZXNcXFwiOiBbXFxcInVzZXI6YmFzZVxcXCIsIFxcXCJmaWxlOmFsbDpyZWFkXFxcIiwgXFxcImZpbGU6YWxsOndyaXRlXFxcIl0sXFxuICAgICAgICAgICAgICAgIFxcXCJ3aWR0aFxcXCI6IDMwMCxcXG4gICAgICAgICAgICAgICAgXFxcImhlaWdodFxcXCI6IDMwMCxcXG4gICAgICAgICAgICB9KSxcXG4gICAgICAgIH0pO1xcbiAgICAgICAgbGV0IGRhdGEgPSBKU09OLnBhcnNlKHJlcyk7XFxuICAgICAgICBsZXQgc2lkID0gZGF0YVtcXFwic2lkXFxcIl07XFxuICAgICAgICBsZXQgcXJjb2RlX3VybCA9IGRhdGFbXFxcInFyQ29kZVVybFxcXCJdO1xcbiAgICAgICAgdXBkYXRlSXRlbShcXFwiaW5mb091dHB1dFxcXCIsIHtcXG4gICAgICAgICAgICBwaWNfdXJsOiBxcmNvZGVfdXJsLFxcbiAgICAgICAgICAgIHVybDogcXJjb2RlX3VybCArIFxcXCIjLmpwZ1xcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJwaWNfMV9mdWxsXFxcIlxcbiAgICAgICAgfSk7XFxuICAgICAgICBhZGRJdGVtQWZ0ZXIoXFxcImluZm9PdXRwdXRcXFwiLCB7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLigJjigJjigJnigJlcXFwiICsgXFxcIuS9v+eUqOmYv+mHjOS6keebmCBBcHAg5omr56CBXFxcIi5mb250Y29sb3IoXFxcImdyZXlcXFwiKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGNsczogXFxcImxvZ2luXFxcIlxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICAgICAgZGVsZXRlSXRlbShcXFwiZ2V0UUNcXFwiKTtcXG4gICAgICAgIGhpZGVMb2FkaW5nKCk7XFxuICAgICAgICBsZXQgcmVmcmVzaF90b2tlbjtcXG4gICAgICAgIHdoaWxlICh0cnVlKSB7XFxuICAgICAgICAgICAgbGV0IGRhdGE7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgZGF0YSA9IGdldF9xcmNvZGVfc3RhdHVzKHNpZCk7XFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5p+l6K+i5omr56CB57uT5p6c6LaF5pe2LCDlj6/og73mmK/op6blj5HkuobpmL/ph4zkupHnm5jmjqXlj6PpmZDliLYsIOivt+eojeWQjuWGjeivlS5cXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgc3RhdHVzID0gZGF0YVtcXFwic3RhdHVzXFxcIl07XFxuICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBcXFwiTG9naW5TdWNjZXNzXFxcIikge1xcbiAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuID0gZ2V0X3JlZnJlc2hfdG9rZW4oZGF0YVtcXFwiYXV0aENvZGVcXFwiXSk7XFxuICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0dXMgPT0gXFxcIlFSQ29kZUV4cGlyZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/kuoznu7TnoIHlt7Lov4fmnJ8sIOivt+WIt+aWsOmhtemdouWQjumHjeivlVxcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICghZ2V0TXlWYXIoXFxcIkxvZ2dpbmdpblxcXCIsIFxcXCJcXFwiKSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8vY2FuY2VsXFxcIjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgamF2YS5sYW5nLlRocmVhZC5zbGVlcCgxNTAwKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChyZWZyZXNoX3Rva2VuKSB7XFxuICAgICAgICAgICAgY29uc3Qge1xcbiAgICAgICAgICAgICAgICBvcGVuVG9rZW5zRmlsZXBhdGgsXFxuICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFwidG9rZW5QYXRoXFxcIik7XFxuICAgICAgICAgICAgbGV0IG9wZW4gPSB7XFxuICAgICAgICAgICAgICAgIFJlZnJlc2hUb2tlbk9wZW46IHJlZnJlc2hfdG9rZW4sXFxuICAgICAgICAgICAgICAgIGlzVjI6IHRydWVcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIHdyaXRlRmlsZShvcGVuVG9rZW5zRmlsZXBhdGgsIEpTT04uc3RyaW5naWZ5KG9wZW4pKTtcXG4gICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoXFxcImluZm9PdXRwdXRcXFwiLCB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi55m75b2V5oiQ5YqfKOeCueWHu+i/lOWbnilcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6JChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoKT0+e1xcbiAgICAgICAgICAgICAgICAgICAgYmFjayhmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoXFxcImxvZ2luXFxcIik7XFxuXFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL3N1Y2Nlc3NcXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL2ZhaWxcXFwiO1xcbiAgICB9KVxcbn0pO1xcblxcbmQucHVzaCh7XFxuICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiLFxcbiAgICBleHRyYToge1xcbiAgICAgICAgaWQ6IFxcXCJpbmZvT3V0cHV0XFxcIixcXG4gICAgICAgIGNsczogXFxcImxvZ2luXFxcIlxcbiAgICB9XFxufSk7XFxuXFxuc2V0UmVzdWx0KGQpO1wifV0iLCJpY29uIjoiIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment