Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@Alist@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoiQWxpc3QiLCJhdXRob3IiOiJKb2Um6YGT6ZW/6a2U5pS5IiwidXJsIjoiaGlrZXI6Ly9lbXB0eSIsInZlcnNpb24iOjI5LCJjb2xfdHlwZSI6InBpY18xIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxuICAgIHZhciBkID0gW107XG5pZiAoZ2V0QXBwVmVyc2lvbigpIDwgMzIwNCkge1xuICAgIHNldFJlc3VsdChbe1xuICAgICAgICB0aXRsZTogXCLmgqjlvZPliY3niYjmnKzkuI3mlK/mjIHmnKzlsI/nqIvluo/vvIzor7fmm7TmlrDoh7PmnIDmlrDniYjmnKxcIixcbiAgICAgICAgdXJsOiBcImh0dHBzOi8vaGFpa3VvLmxhbnpvdWkuY29tL3UvR29sZFJpdmVyXCJcbiAgICB9XSlcbn0gZWxzZSB7XG4gICAgY29uc3Qge1xuICAgICAgICBnZXRGaWxlcyxcbiAgICAgICAgZ2V0TGlua1xuICAgIH0gPSAkLnJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9hcGknKTtcbiAgICBjb25zdCB7Y29sb3Isc21hbGx9PSQucmVxdWlyZSgnaGlrZXI6Ly9wYWdlL3V0aWxzJyk7XG4gICAgdmFyIHBhdGggPSBnZXRNeVZhcihcInBhdGhcIiwgXCIvXCIpO1xuICAgIGQucHVzaCh7XG4gICAgICAgIHRpdGxlOiAn4pqZ77iP6K6+572uJyxcbiAgICAgICAgY29sX3R5cGU6ICdzY3JvbG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xuICAgICAgICAgICAgICAgIHJldHVybiBcInRvYXN0Oi8v5YiH5o2i5oiQ5YqfXCJcbiAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgY29sX3R5cGU6IFwic2Nyb2xsX2J1dHRvblwiXG4gICAgICAgIH0pO1xuICAgIH0pO1xuICAgIGQucHVzaCh7XG4gICAgICAgIGNvbF90eXBlOiBcImJsYW5rX2Jsb2NrXCJcbiAgICB9KTtcbiAgICBkLnB1c2goe1xuICAgICAgICB0aXRsZTogXCLigJjigJjigJnigJk8c3Ryb25nPjxmb250IGNvbG9yPScjMUU5MEZGJz4uLi48L2Zyb250Pjwvc3Ryb25nPlwiLFxuICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHBhdGgpID0+IHtcbiAgICAgICAgICAgIC8vIOi/lOWbnuS4iue6p1xuICAgICAgICAgICAgcGF0aC5wb3AoKTtcbiAgICAgICAgICAgIHB1dE15VmFyKFwicGF0aFwiLCBwYXRoLmpvaW4oXCIvXCIpKTtcbiAgICAgICAgICAgIGlmKGdldEl0ZW0oJ2NsZWFyX2NoYW5nZScsJycpKXtcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdzZWFyY2gnLCcnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcbiAgICAgICAgICAgIHJldHVybiBcImhpa2VyOi8vZW1wdHlcIlxuICAgICAgICB9LCBwYXRoLnNwbGl0KFwiL1wiKSksXG4gICAgICAgIGNvbF90eXBlOiBcInNjcm9sbF9idXR0b25cIlxuICAgIH0pO1xuICAgIGQucHVzaCh7XG4gICAgICAgIHRpdGxlOiBcIvCfj6DpppbpobVcIixcbiAgICAgICAgY29sX3R5cGU6IFwic2Nyb2xsX2J1dHRvblwiLFxuICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKCkgPT4ge1xuICAgICAgICAgICAgcHV0TXlWYXIoXCJwYXRoXCIsIFwiL1wiKTtcbiAgICAgICAgICAgIGlmKGdldEl0ZW0oJ2NsZWFyX3JlZnJlc2gnLCcnKSl7XG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcignc2VhcmNoJywnJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XG4gICAgICAgICAgICByZXR1cm4gXCJoaWtlcjovL2VtcHR5XCJcbiAgICAgICAgfSksXG4gICAgfSk7XG4gICAgbGV0IHBhdGhzID0gXCJcIjtcbiAgICBmb3IgKGl0ZW0gb2YgcGF0aC5zcGxpdChcIi9cIikpIHtcbiAgICAgICAgaWYgKGl0ZW0gIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHBhdGhzICs9IFwiL1wiICsgaXRlbTtcbiAgICAgICAgICAgIGQucHVzaCh7XG4gICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0sXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFwic2Nyb2xsX2J1dHRvblwiLFxuICAgICAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgocGF0aHMpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXCJwYXRoXCIsIHBhdGhzKTtcbiAgICAgICAgICAgICAgICAgICAgaWYoZ2V0SXRlbSgnY2xlYXJfY2hhbmdlJywnJykpe1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcignc2VhcmNoJywnJyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJoaWtlcjovL2VtcHR5XCJcbiAgICAgICAgICAgICAgICB9LCBwYXRocylcbiAgICAgICAgICAgIH0pXG4gICAgICAgIH1cbiAgICB9XG4gICAgbGV0IHNvcnRzID0gW1wi5ZCN56ewXCIsIFwi57G75Z6LXCIsIFwi5aSn5bCPXCIsICfml7bpl7QnXTtcbiAgICBsZXQgbnNvcnQgPSBnZXRNeVZhcignc29ydCcsICflkI3np7AnKTtcbiAgICBsZXQgbnNlYXJjaCA9IGdldE15VmFyKCdzZWFyY2gnLCcnKTtcbiAgICBzb3J0cy5mb3JFYWNoKGl0ZW0gPT4ge1xuICAgICAgICBsZXQgY2MgPSBuc29ydCA9PT0gaXRlbSArIFwiLVwiO1xuICAgICAgICBsZXQgaXNDbGlja2VkID0gbnNvcnQgPT09IGl0ZW07XG4gICAgICAgIGQucHVzaCh7XG4gICAgICAgICAgICB0aXRsZTogY2MgfHwgaXNDbGlja2VkID8gXCLigJjigJjigJnigJk8c3Ryb25nPjxmb250IGNvbG9yPScjMUU5MEZGJz5cIiArIGl0ZW0gKyAoY2MgPyBcIuKIp1wiIDogXCLiiKhcIikgKyBcIjwvZnJvbnQ+PC9zdHJvbmc+XCIgOiBpdGVtLFxuICAgICAgICAgICAgY29sX3R5cGU6IFwiZmxleF9idXR0b25cIixcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoaXRlbSwgaXNDbGlja2VkKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKGlzQ2xpY2tlZCkge1xuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcInNvcnRcIiwgaXRlbSArIFwiLVwiKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcInNvcnRcIiwgaXRlbSk7XG4gICAgICAgICAgICAgICAgICAgIGlmKGdldEl0ZW0oJ2NsZWFyX2NoYW5nZScsJycpKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ3NlYXJjaCcsJycpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcbiAgICAgICAgICAgICAgICByZXR1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aWtlcjovL3BhZ2Uvc3VwZXJTZXR0aW5ncyNub0hpc3RvcnkjI25vUmVjb3JkSGlzdG9yeSMnXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZihmaWx0ZXJPcHRpb24hPT1pbnB1dCl7XG4gICAgICAgICAgICAgICAgc2V0SXRlbSgnZmlsdGVyT3B0aW9uJyxpbnB1dCk7XG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xuICAgICAgICB9LGZpbHRlck9wdGlvbiksXG4gICAgfSk7XG4gICAgZC5wdXNoKHtcbiAgICAgICAgdGl0bGU6bnNlYXJjaD9cIvCflI1cIitzbWFsbChjb2xvcignOicrbnNlYXJjaCwnIzEyYjY2OCcpKTon8J+UjScsXG4gICAgICAgIGNvbF90eXBlOidmbGV4X2J1dHRvbicsXG4gICAgICAgIHVybDokKG5zZWFyY2gsJ+i+k+WFpeimgeaQnOe0oueahOWGheWuueOAguaUr+aMgeato+WImeOAguWmglxcXFwuanMnKS5pbnB1dCgobnNlYXJjaCk9PntcbiAgICAgICAgICAgIGlmKGlucHV0IT09bnNlYXJjaCl7XG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ3NlYXJjaCcsaW5wdXQpO1xuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcbiAgICAgICAgfSxuc2VhcmNoKSxcbiAgICB9KTtcbiAgICBkLnB1c2goe1xuICAgICAgICB0aXRsZTogY29sb3IoXCLop4LlvbHljoblj7Lwn5WTXCIsXCIjZDk2NzE1XCIpLFxuICAgICAgICB1cmw6IFwiaGlrZXI6Ly9wYWdlL2hpc3Rvcnkjbm9IaXN0b3J5IyNub1JlY29yZEhpc3RvcnkjXCIsXG4gICAgICAgIGNvbF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w6IGl0ZW0udXJsLFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBpdGVtLmNvbF90eXBlLFxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAvLyBsZXQgaXRfdHlwZSA9IGl0ZW0uZXh0cmEudHlwZTtcbiAgICAgICAgICAgIGxldCBpdF90eXBlID0gaXRlbS50eXBlO1xuICAgICAgICAgICAgbGV0IHVybCA9ICdoaWtlcjovL2VtcHR5JztcbiAgICAgICAgICAgIGxldCB0aXRsZSA9IGl0ZW0uZXh0cmEubmFtZSB8fCBpdGVtLnRpdGxlO1xuICAgICAgICAgICAgbGV0IGlkPWl0ZW0uZXh0cmEuaWQ7XG4gICAgICAgICAgICBpZiAoaXRfdHlwZSA9PT0gMSkge1xuICAgICAgICAgICAgICAgIHVybCA9ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGl0ZW0sIHRpdGxlKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcihcInBhdGhcIikgPT09IFwiL1wiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcInBhdGhcIiwgZ2V0TXlWYXIoXCJwYXRoXCIsIFwiXCIpICsgdGl0bGUpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXCJwYXRoXCIsIGdldE15VmFyKFwicGF0aFwiLCBcIlwiKSArIFwiL1wiICsgdGl0bGUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmKGdldEl0ZW0oJ2NsZWFyX2NoYW5nZScsJycpKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ3NlYXJjaCcsJycpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwiaGlrZXI6Ly9lbXB0eVwiXG4gICAgICAgICAgICAgICAgfSwgaXRlbSwgdGl0bGUpO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChpdF90eXBlID09PSAzIHx8IC9cXC5tM3U4JC8udGVzdCh0aXRsZSkpIHsgLy8z5piv5aqS5L2TLOemgeeUqOS4i+i9veWSjOi3s+i9rFxuICAgICAgICAgICAgICAgIHVybCA9IGdldExpbmsodGl0bGUsIG51bGwsJ+aJk+W8gCcsIHNob3daaW11LCcjaXNWaWRlbz10cnVlIycpO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChpdF90eXBlID09PSA2KSB7XG4gICAgICAgICAgICAgICAgdXJsID0gZ2V0TGluayh0aXRsZSwgbnVsbCwn5omT5byAJywgc2hvd1ppbXUsXCIjLmpwZ1wiKTtcbiAgICAgICAgICAgIH0gZWxzZSB7IC8v6Lef6ZqP57O757uf6aKE6KeI5ZKM5LiL6L29XG4gICAgICAgICAgICAgICAgdXJsID0gZ2V0TGluayh0aXRsZSwgbnVsbCxjbGlja09wdGlvbixzaG93WmltdSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkLnB1c2goe1xuICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLFxuICAgICAgICAgICAgICAgIGltZzogaXRlbS5pbWcsXG4gICAgICAgICAgICAgICAgdXJsOiB1cmwsXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IGl0ZW0uY29sX3R5cGUsXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcbiAgICAgICAgICAgICAgICAgICAgaWQ6aWQsXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IGl0X3R5cGUsXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH0pO1xuICAgIHNldFJlc3VsdChkKTtcbn0iLCJzZWFyY2hfd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LFxuICAgICAgICBsc3RyaXAoc3RyaW5nLGNoYXIpey8v5Y676Zmk5bem6L655oyH5a6a5a2X56ymXG4gICAgICAgICAgICByZXR1cm4gc3RyaW5nLnJlcGxhY2UobmV3IFJlZ0V4cCgnXlxcXFwnK2NoYXIrJysnLCAnZycpLCAnJyk7XG4gICAgICAgIH0sXG4gICAgICAgIHJzdHJpcChzdHJpbmcsY2hhcil7Ly/ljrvpmaTlj7PovrnmjIflrprlrZfnrKZcbiAgICAgICAgICAgIHJldHVybiBzdHJpbmcucmVwbGFjZShuZXcgUmVnRXhwKCdcXFxcJytjaGFyKycrJCcsICdnJyksICcnKTtcbiAgICAgICAgfSxcbiAgICAgICAgc3RyaXAoc3RyaW5nLGNoYXIpey8v5Y676Zmk5Lik6L655oyH5a6a5a2X56ymXG4gICAgICAgICAgICByZXR1cm4gc3RyaW5nLnJlcGxhY2UobmV3IFJlZ0V4cCgnXlxcXFwnK2NoYXIrJyt8XFxcXCcrY2hhcisnKyQnLCAnZycpLCAnJyk7XG4gICAgICAgIH0sXG4gICAgICAgIGdldFRpbWVPdXQoKXtcbiAgICAgICAgICAgIHJldHVybiBOdW1iZXIoZ2V0SXRlbSgndGltZW91dCcsdGhpcy50aW1lb3V0KycnKSlcbiAgICAgICAgfSxcbiAgICAgICAgdGltZW91dDozNTAwLFxuICAgICAgICBzdWJfdXJsczogW3tcbiAgICAgICAgICAgIG5hbWU6ICflsI/mo4noooTku5PlupMnLFxuICAgICAgICAgICAgdXJsOiAnaHR0cDovL3Bhbi5oYWlrdW9zaGlqaWUuY24vJyxcbiAgICAgICAgfSwge1xuICAgICAgICAgICAgbmFtZTogJ+WXqOe/uycsXG4gICAgICAgICAgICB1cmw6ICdodHRwczovL3Bhbi5oaWtlcmZhbnMuY29tLycsXG4gICAgICAgIH0sIHtcbiAgICAgICAgICAgIG5hbWU6ICfpnZ7nm5gnLFxuICAgICAgICAgICAgdXJsOiAnaHR0cDovL3d3dy5mZWlmd3AudG9wLycsXG4g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SB8fCAnW10nKTtcXG4gICAgICAgICAgICAgICAgbGV0IGZpbHRlcl9ydWxlID0gZmlsdGVyX3J1bGVzLmZpbmQoeCA9PiB4Lm5hbWUgPT09IGZpbHRlck9wdGlvbik7XFxuICAgICAgICAgICAgICAgIGlmIChmaWx0ZXJfcnVsZSAmJiBmaWx0ZXJfcnVsZS5ydWxlKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoZmlsdGVyX3J1bGUucnVsZS5zdGFydHNXaXRoKCchJykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaXN0ID0gbGlzdC5maWx0ZXIoeCA9PiAhKG5ldyBSZWdFeHAoZmlsdGVyX3J1bGUucnVsZS5zbGljZSgxKSkpLnRlc3QoeC5uYW1lKSk7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3QgPSBsaXN0LmZpbHRlcih4ID0+IChuZXcgUmVnRXhwKGZpbHRlcl9ydWxlLnJ1bGUpKS50ZXN0KHgubmFtZSkpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGlmIChzZWFyY2gpIHtcXG4gICAgICAgICAgICAgICAgbGlzdCA9IGxpc3QuZmlsdGVyKHggPT4gKG5ldyBSZWdFeHAoc2VhcmNoKSkudGVzdCh4Lm5hbWUpKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoWyflpKflsI8nLCAn57G75Z6LJywgJ+WQjeensCcsICfml7bpl7QnXS5pbmNsdWRlcyhzb3J0KSkge1xcbiAgICAgICAgICAgICAgICBzb3J0cyhsaXN0LCBzb3J0KTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBzb3J0cyhsaXN0LCBzb3J0LnJlcGxhY2UoJy0nLCAnJykpLnJldmVyc2UoKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGlzdC5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgZXh0ID0gaXRlbS5uYW1lLnNwbGl0KCcuJykuc2xpY2UoLTEpWzBdO1xcbiAgICAgICAgICAgICAgICBsZXQgaW1nID0gaXRlbS50eXBlID09PSAxID8gaWNvbl9kaWN0WycxJ10gOiAoaWNvbnNbZXh0XSB8fCBpY29uX2RpY3RbaXRlbS50eXBlICsgJyddKTtcXG4gICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgdHlwZTogaXRlbS50eXBlLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJhdmF0YXJcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZDogYmFzZXVybCArIHBhdGggKyBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogaXRlbS50eXBlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIGlmIChzaG93RGV0YWlsKSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgZGF0ZSA9IGdldFRpbWUoaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgc2l6ZSA9IGl0ZW0uc2l6ZV9zdHI7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoIXNpemUgfHwgc2l6ZSA9PT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzaXplID0gaXRlbS5zaXplID09PSAwID8gXFxcIi9cXFwiIDogYnl0ZXNUb1NpemUoaXRlbS5zaXplKVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNpemUgJiYgc2l6ZSAhPT0gXFxcIlxcXCIgJiYgc2l6ZSAhPT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNpemUgPSBcXFwiJm5ic3A7Jm5ic3A7Jm5ic3A7XFxcIiArIHNpemU7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNpemUgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGxldCBkZXNjID0gZGF0ZSArIHNpemU7XFxuICAgICAgICAgICAgICAgICAgICByZXN1bHQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogaXRlbS50eXBlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBzbWFsbChjb2xvcihkZXNjLCAnI2FhYWFhYScpKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGJhc2V1cmwgKyBwYXRoICsgaXRlbS5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBpdGVtLnR5cGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2UgaWYgKG1zZyA9PT0gXFxcIldyb25nIHBhc3N3b3JkXFxcIikge1xcbiAgICAgICAgICAgIHJlc3VsdC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLngrnmiJHovpPlhaXlr4bnoIFcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJChnZXRNeVZhcihcXFwicGFzc3dvcmRcXFwiLCBcXFwiXFxcIikpLmlucHV0KChwYXRoLCBiYXNldXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgc3ViX3VybHMgPSAkLmdldF9zdWJfdXJscygpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGlkZXggPSBzdWJfdXJscy5maW5kSW5kZXgoeCA9PiB4LnVybC5pbmNsdWRlcyhiYXNldXJsKSk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoaWRleCA+IC0xKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzdWJfdXJsc1tpZGV4XS5wYXNzd29yZCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJfdXJsc1tpZGV4XS5wYXNzd29yZCA9IHt9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN1Yl91cmxzW2lkZXhdLnBhc3N3b3JkW3BhdGhdID0gaW5wdXQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ3N1Yl91cmxzLmpzb24nLCBKU09OLnN0cmluZ2lmeShzdWJfdXJscyksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJwYXNzd29yZFxcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN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TT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICAgICAgcGF0aDogbnBhdGgsXFxuICAgICAgICAgICAgICAgIHBhc3N3b3JkOiBwYXNzd29yZFtucGF0aF0gfHwgJycsXFxuICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgdGltZW91dDogJC5nZXRUaW1lT3V0KCksXFxuICAgICAgICB9KSk7XFxuICAgICAgICBpZiAocmVzLmRhdGEpIHtcXG4gICAgICAgICAgICBsZXQgdSA9IHJlcy5kYXRhLmZpbGVzWzBdLnVybDtcXG4gICAgICAgICAgICB1ID0gIS9eaHR0cC8udGVzdCh1KSA/IGJhc2V1cmwuc3BsaXQoJy8vJylbMF0gKyB1IDogdTtcXG4gICAgICAgICAgICBpZiAoZXh0KSB7XFxuICAgICAgICAgICAgICAgIHUgPSB1ICsgZXh0O1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gdVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8vXFxcIiArIHJlcy5tZXNzYWdlXFxuICAgICAgICB9XFxuICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgIHJldHVybiAndG9hc3Q6Ly/mlofku7YnICsgbnBhdGggKyAn5L+h5oGv6I635Y+W5Y+R55Sf6ZSZ6K+vOicgKyBlLm1lc3NhZ2U7XFxuICAgIH1cXG59XFxuXFxuJC5leHBvcnRzLmdldEZpbGVzID0gZ2V0RmlsZXM7XFxuJC5leHBvcnRzLmdldExpbmsgPSBnZXRMaW5rO1xcbiQuZXhwb3J0cy5nZXRVID0gZ2V0VTtcIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuiuvue9rlwiLFwicGF0aFwiOlwic2V0dGluZ3NcIixcInJ1bGVcIjpcImpzOlxcbmxldCBkID0gW107XFxuc2V0UGFnZVRpdGxlKCdBbGlzdHzorr7nva4nKTtcXG5jb25zdCB7Y29sb3Isc21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gIGlmIChzdWJfdXJsc1tpZGV4XS51cmwgIT09IGFfdXJsfHxzdWJfdXJsc1tpZGV4XS5uYW1lICE9PSBhX25hbWUpIHtcXG4gICAgICAgICAgICAgICAgc3ViX3VybHNbaWRleF0udXJsID0gYV91cmw7XFxuICAgICAgICAgICAgICAgIHN1Yl91cmxzW2lkZXhdLm5hbWUgPSBhX25hbWU7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkKCfmo4DmtYvliLDmnKzlnLDmnInph43lpI3nmoQnICsgYV9uYW1lICsgJyzmmK/lkKbopobnm5Y/JykuY29uZmlybSgoc3ViX3VybHMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKCdzdWJfdXJscy5qc29uJywgSlNPTi5zdHJpbmdpZnkoc3ViX3VybHMpLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/lt7Lkv53lrZgnXFxuICAgICAgICAgICAgICAgIH0sIHN1Yl91cmxzKVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/msqHmnInmk43kvZwnXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBzdWJfdXJscy51bnNoaWZ0KHtcXG4gICAgICAgICAgICAgICAgbmFtZTogYV9uYW1lLFxcbiAgICAgICAgICAgICAgICB1cmw6IGFfdXJsLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIHNhdmVGaWxlKCdzdWJfdXJscy5qc29uJywgSlNPTi5zdHJpbmdpZnkoc3ViX3VybHMpLCAwKTtcXG4gICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3suS/neWtmCdcXG4gICAgICAgIH1cXG4gICAgfWVsc2UgaWYo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vliqjovpPlhaXlj6Pku6RcXFwiKS5pbnB1dCgoc2F2ZVN1Yik9PntcXG4gICAgICAgIGlucHV0PWlucHV0LnRyaW0oKTtcXG4gICAgICAgIGxldCBjb2RlPWlucHV0LnNwbGl0KCdcXFxcbicpWzFdO1xcbiAgICAgICAgaWYoIS9BbGlzdOiuoumYhee8lueggeWIhuS6qy8udGVzdChpbnB1dCkpe1xcbiAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/lr7zlhaXlj6Pku6TmnInor68nXFxuICAgICAgICB9XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIGNvZGUgPSBiYXNlNjREZWNvZGUoY29kZSk7XFxuICAgICAgICAgICAgbG9nKGNvZGUpO1xcbiAgICAgICAgfWNhdGNoIChlKSB7XFxuICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WPkeeUn+mUmeivrzpcXFxcbicrZS5tZXNzYWdlO1xcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIHNhdmVTdWIoY29kZSk7XFxuICAgIH0sc2F2ZVN1YilcXG59KTtcXG5kLnB1c2goe1xcbiAgICB0aXRsZTogJ+WFqOe8lueggeWIhuS6qycsXFxuICAgIGNvbF90eXBlOiBvcENvbCxcXG4gICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKCgpID0+IHtcXG4gICAgICAgIGxldCBzdWJfdXJscyA9IEpTT04ucGFyc2UocmVhZEZpbGUoJ3N1Yl91cmxzLmpzb24nLCAwKSB8fCAnW10nKTtcXG4gICAgICAgIGNvbmZpcm0oe3RpdGxlOifmuKnppqjmj5DnpLonLFxcbiAgICAgICAgICAgIGNvbnRlbnQ6J+WwhuS4gOmUruWIhuS6q+acrOWcsOeahOaJgOacieiuoumYhSzmmK/lkKblsIblr4bnoIHkuIDotbfliIbkuqvvvJ8nLFxcbiAgICAgICAgICAgIGNvbmZpcm06JC50b1N0cmluZygoc3ViX3VybHMpPT57XFxuICAgICAgICAgICAgICAgIGxldCBjb2RlID0gJ0FsaXN06K6i6ZiF57yW56CB5YiG5LqrICcrc3ViX3VybHNbMF0ubmFtZSsn562JJytzdWJfdXJscy5sZW5ndGgrJ+adoScrJzpcXFxcbicrYmFzZTY0RW5jb2RlKEpTT04uc3RyaW5naWZ5KHN1Yl91cmxzKSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiAnY29weTovLycrY29kZVxcbiAgICAgICAgICAgIH0sc3ViX3VybHMpLFxcbiAgICAgICAgICAgIGNhbmNlbDokLnRvU3RyaW5nKChzdWJfdXJscyk9PntcXG4gICAgICAgICAgICAgICAgc3ViX3VybHMgPSBzdWJfdXJscy5tYXAoKGl0KT0+e3JldHVybiB7bmFtZTppdC5uYW1lLHVybDppdC51cmx9fSk7XFxuICAgICAgICAgICAgICAgIGxldCBjb2RlID0gJ0FsaXN06K6i6ZiF57yW56CB5YiG5LqrICcrc3ViX3VybHNbMF0ubmFtZSsn562JJytzdWJfdXJscy5sZW5ndGgrJ+adoScrJzpcXFxcbicrYmFzZTY0RW5jb2RlKEpTT04uc3RyaW5naWZ5KHN1Yl91cmxzKSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiAnY29weTovLycrY29kZVxcbiAgICAgICAgICAgIH0sc3ViX3VybHMpfSk7XFxuICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxuICAgIH0pLFxcbn0pO1xcbmQucHVzaCh7XFxuICAgIHRpdGxlOiAn5YWo5paH5Lu25YiG5LqrJyxcXG4gICAgY29sX3R5cGU6IG9wQ29sLFxcbiAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKCkgPT4ge1xcbiAgICAgICAgbGV0IHN1Yl91cmxzID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnc3ViX3VybHMuanNvbicsIDApIHx8ICdbXScpO1xcbiAgICAgICAgbGV0IHNoYXJlUGF0aCA9ICdoaWtlcjovL2ZpbGVzL2NhY2hlL2FsaXN06K6i6ZiFLnR4dCc7XFxuICAgICAgICBjb25maXJtKHt0aXRsZTon5rip6aao5o+Q56S6JyxcXG4gICAgICAgICAgICBjb250ZW50OiflsIbkuIDplK7liIbkuqvmnKzlnLDnmoTmiYDmnInorqLpmIUs5piv5ZCm5bCG5a+G56CB5LiA6LW35YiG5Lqr77yfJyxcXG4gICAgICAgICAgICBjb25maXJtOiQudG9TdHJpbmcoKHN1Yl91cmxzLHNoYXJlUGF0aCk9PntcXG4gICAgICAgICAgICAgICAgd3JpdGVGaWxlKHNoYXJlUGF0aCxKU09OLnN0cmluZ2lmeShzdWJfdXJscykpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3NoYXJlOi8vJytzaGFyZVBhdGhcXG4gICAgICAgICAgICB9LHN1Yl91cmxzLHNoYXJlUGF0aCksXFxuICAgICAgICAgICAgY2FuY2VsOiQudG9TdHJpbmcoKHN1Yl91cmxzLHNoYXJlUGF0aCk9PntcXG4gICAgICAgICAgICAgICAgc3ViX3VybHMgPSBzdWJfdXJscy5tYXAoKGl0KT0+e3JldHVybiB7bmFtZTppdC5uYW1lLHVybDppdC51cmx9fSk7XFxuICAgICAgICAgICAgICAgIC8vIGxvZyhzdWJfdXJscyk7XFxuICAgICAgICAgICAgICAgIHdyaXRlRmlsZShzaGFyZVBhdGgsSlNPTi5zdHJpbmdpZnkoc3ViX3VybHMpKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdzaGFyZTovLycrc2hhcmVQYXRoXFxuICAgICAgICAgICAgfSxzdWJfdXJscyxzaGFyZVBhdGgpfSk7XFxuICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxuICAgIH0pLFxcbn0pO1xcbmxldCBzdWJQYXRoID0gYGhpa2VyOi8vZmlsZXMvcnVsZXMvZmlsZXMvJHtNWV9SVUxFLnRpdGxlfS9zdWJfdXJscy5qc29uYDtcXG5sZXQgY2FjaGVQYXRoID0gJ2hpa2VyOi8vZmlsZXMvY2FjaGUvc3ViX3VybHMuanNvbic7X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ywn5L+u5pS55Zyw5Z2AJywn5b+r5o236L6T5YWlJywn5a+G56CB566h55CGJywn5YiG5LqrKOWQq+WvhueggSknLCfliIbkuqso5peg5a+G56CBKSddLCAyLCAn6K+36YCJ5oupMeS4quaTjeS9nCcpLnNlbGVjdCgoaXQsIHN1Yl91cmxzLCBpZGV4KSA9PiB7XFxuICAgICAgICAgICAgaWYgKGlucHV0ID09PSAn572u6aG2Jykge1xcbiAgICAgICAgICAgICAgICBzdWJfdXJscy5zcGxpY2UoaWRleCwgMSk7XFxuICAgICAgICAgICAgICAgIHN1Yl91cmxzLnVuc2hpZnQoaXQpO1xcbiAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIoXFxcImJhc2V1cmxcXFwiLCBcXFwiXFxcIikgIT09IGl0LnVybCkge1xcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImJhc2V1cmxcXFwiLCBpdC51cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwicGF0aFxcXCIpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGVsc2UgaWYgKGlucHV0ID09PSAn5Yig6ZmkJykge1xcbiAgICAgICAgICAgICAgICBzdWJfdXJscy5zcGxpY2UoaWRleCwgMSk7XFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcihcXFwiYmFzZXVybFxcXCIsIFxcXCJcXFwiKSA9PT0gaXQudXJsKSB7XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiYmFzZXVybFxcXCIsIHN1Yl91cmxzWzBdLnVybCk7XFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJwYXRoXFxcIik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9ZWxzZSBpZiAoaW5wdXQgPT09ICfkv67mlLnlkI3np7AnKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkKGl0Lm5hbWUsJ+e7meatpOiuoumYheaUueS4quWQjeWtl+WQpycpLmlucHV0KChzdWJfdXJscyxpZGV4KT0+e1xcbiAgICAgICAgICAgICAgICAgICAgaW5wdXQgPSBpbnB1dC50cmltKCk7XFxuICAgICAgICAgICAgICAgICAgICBpZihpbnB1dCl7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3ViX3VybHNbaWRleF0ubmFtZSA9IGlucHV0O1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKCdzdWJfdXJscy5qc29uJywgSlNPTi5zdHJpbmdpZnkoc3ViX3VybHMpLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+S/ruaUueaIkOWKnydcXG4gICAgICAgICAgICAgICAgICAgIH1lbHNle1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/kv67mlLnlpLHotKUnXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0sc3ViX3VybHMsaWRleCk7XFxuICAgICAgICAgICAgfWVsc2UgaWYgKGlucHV0ID09PSAn5L+u5pS55Zyw5Z2AJykge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChpdC51cmwsJ+e7meatpOiuoumYheaUueS4quWcsOWdgOWQpycpLmlucHV0KChzdWJfdXJscyxpZGV4KT0+e1xcbiAgICAgICAgICAgICAgICAgICAgaW5wdXQgPSBpbnB1dC50cmltKCk7XFxuICAgICAgICAgICAgICAgICAgICBpZihpbnB1dCYmL15odHRwLy50ZXN0KGlucHV0KSl7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3ViX3VybHNbaWRleF0udXJsID0gaW5wdXQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ3N1Yl91cmxzLmpzb24nLCBKU09OLnN0cmluZ2lmeShzdWJfdXJscyksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5L+u5pS55oiQ5YqfJ1xcbiAgICAgICAgICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+S/ruaUueWksei0pSdcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSxzdWJfdXJscyxpZGV4KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSAn5b+r5o236L6T5YWlJykge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiYWxpc3RfbmFtZVxcXCIsaXQubmFtZSk7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJhbGlzdF91cmxcXFwiLGl0LnVybCk7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgICAgIH1lbHNlIGlmIChpbnB1dCA9PT0gJ+WvhueggeeuoeeQhicpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL3BhZ2UvcGFzc3dvcmRNYW5hZ2U/aWRleD0nK2lkZXhcXG4gICAgICAgICAgICB9ZWxzZSBpZiAoL+WIhuS6qy8udGVzdChpbnB1dCkpIHtcXG4gICAgICAgICAgICAgICAgaWYoaW5wdXQuaW5jbHVkZXMoJ+aXoOWvhueggScpKXtcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBpdC5wYXNzd29yZDtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBsZXQgY29kZSA9ICdBbGlzdOiuoumYhee8lueggeWIhuS6qyAnK2l0Lm5hbWUrJzpcXFxcbicrYmFzZTY0RW5jb2RlKEpTT04uc3RyaW5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lmICghcyB8fCAhdCkge1xcbiAgICAgICAgcmV0dXJuIDBcXG4gICAgfVxcbiAgICBpZihzID09PSB0KXtcXG4gICAgICAgIHJldHVybiAxMDA7XFxuICAgIH1cXG4gICAgdmFyIGwgPSBzLmxlbmd0aCA+IHQubGVuZ3RoID8gcy5sZW5ndGggOiB0Lmxlbmd0aFxcbiAgICB2YXIgbiA9IHMubGVuZ3RoXFxuICAgIHZhciBtID0gdC5sZW5ndGhcXG4gICAgdmFyIGQgPSBbXVxcbiAgICBmID0gZiB8fCAyXFxuICAgIHZhciBtaW4gPSBmdW5jdGlvbiAoYSwgYiwgYykge1xcbiAgICAgICAgcmV0dXJuIGEgPCBiID8gKGEgPCBjID8gYSA6IGMpIDogKGIgPCBjID8gYiA6IGMpXFxuICAgIH1cXG4gICAgdmFyIGksIGosIHNpLCB0aiwgY29zdFxcbiAgICBpZiAobiA9PT0gMCkgcmV0dXJuIG1cXG4gICAgaWYgKG0gPT09IDApIHJldHVybiBuXFxuICAgIGZvciAoaSA9IDA7IGkgPD0gbjsgaSsrKSB7XFxuICAgICAgICBkW2ldID0gW11cXG4gICAgICAgIGRbaV1bMF0gPSBpXFxuICAgIH1cXG4gICAgZm9yIChqID0gMDsgaiA8PSBtOyBqKyspIHtcXG4gICAgICAgIGRbMF1bal0gPSBqXFxuICAgIH1cXG4gICAgZm9yIChpID0gMTsgaSA8PSBuOyBpKyspIHtcXG4gICAgICAgIHNpID0gcy5jaGFyQXQoaSAtIDEpXFxuICAgICAgICBmb3IgKGogPSAxOyBqIDw9IG07IGorKykge1xcbiAgICAgICAgICAgIHRqID0gdC5jaGFyQXQoaiAtIDEpXFxuICAgICAgICAgICAgaWYgKHNpID09PSB0aikge1xcbiAgICAgICAgICAgICAgICBjb3N0ID0gMFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGNvc3QgPSAxXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGRbaV1bal0gPSBtaW4oZF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ydWxlKChyZWFsVXJsLHR5cGUpID0+IHtcXG4gICAgICAgIGxldCBkID0gW107XFxuICAgICAgICBsZXQgaHRtbDtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgaHRtbCA9IHJlcXVlc3QocmVhbFVybCwge1xcbiAgICAgICAgICAgICAgICB0aW1lb3V0OiAkLmdldFRpbWVPdXQoKVxcbiAgICAgICAgICAgIH0pIHx8ICcnO1xcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGh0bWwgPSAn6aKE6KeI5aSx6LSlOicgKyBlLm1lc3NhZ2VcXG4gICAgICAgIH1cXG4gICAgICAgIGlmKC9tZHxjb2RlLy50ZXN0KHR5cGUpKXtcXG4gICAgICAgICAgICByZXF1aXJlKCdodHRwOi8vaGlrZXIubm9raWEucHJlc3MvaGlrZXJ1bGUvcnVsZWxpc3QuanNvbj9pZD0zMTg3Jyk7XFxuICAgICAgICAgICAgaHRtbCA9IHR5cGU9PT0nbWQnP21hcmtlZC5wYXJzZShodG1sKTptYXJrZWQucGFyc2UoXFxcImBgYFxcXFxuXFxcIiArIGh0bWwgKyBcXFwiXFxcXG5gYGBcXFwiKTtcXG4gICAgICAgIH1lbHNlIGlmICh0eXBlPT09J3R4dCcmJiBodG1sLmxlbmd0aCA+IDYwMDApIHtcXG4gICAgICAgICAgICBodG1sID0gaHRtbC5zbGljZSgwLCA2MDAwKSArIFxcXCIuLi5cXFxcbmVycm9yOuaWh+S7tui/h+Wkp+S4jeaUr+aMgemihOiniFxcXCI7XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgY29sID0gL21kfGNvZGUvLnRlc3QodHlwZSkgPyAncmljaF90ZXh0JyA6ICdsb25nX3RleHQnO1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogaHRtbCxcXG4gICAgICAgICAgICBjb2xfdHlwZTogY29sLFxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vZW1wdHknXFxuICAg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gICBuZXdSdWxlcy5mb3JFYWNoKChpdCk9PntcXG4gICAgICAgICAgICAgICAgbGV0IGlkZXggPSBmaWx0ZXJfcnVsZXMuZmluZEluZGV4KHg9PiQucnN0cmlwKHgubmFtZSkgPT09ICQucnN0cmlwKGl0Lm5hbWUpKTtcXG4gICAgICAgICAgICAgICAgaWRleD4tMT9maWx0ZXJfcnVsZXNbaWRleF0gPSBpdDpmaWx0ZXJfcnVsZXMudW5zaGlmdChpdCk7XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgbGV0IG5ld19jbnQgPSBmaWx0ZXJfcnVsZXMubGVuZ3RoIC0gZmlsdGVyX2NudDtcXG4gICAgICAgICAgICBpZihuZXdfY250ID4gMCApe1xcbiAgICAgICAgICAgICAgICBzYXZlRmlsZSgnZmlsdGVyX3J1bGVzLmpzb24nLCBKU09OLnN0cmluZ2lmeShmaWx0ZXJfcnVsZXMpLCAwKTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bey5L+d5a2YJytuZXdfY250KyfmnaHorrDlvZUnXFxuICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/msqHmnInlvoXkv53lrZjnmoTlhoXlrrknXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfWNhdGNoIChlKSB7XFxuICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WvvOWFpeWksei0pSFcXFxcbicrIGUubWVzc2FnZTtcXG4gICAgICAgIH1cXG4gICAgfSksXFxufSk7XFxuZC5wdXNoKHtcXG4gICAgdGl0bGU6J+WIhuS6q+inhOWImScsXFxuICAgIGNvbF90eXBlOiAndGV4dF8zJyxcXG4gICAgdXJsOiQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKCk9PntcXG4gICAgICAgIGxldCBmaWx0ZXJfcnVsZXMgPSBKU09OLnB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JknLCflv6vmjbfovpPlhaUnLCflkK/nlKgnLCfnpoHnlKgnXSwgMiwgJ+ivt+mAieaLqTHkuKrmk43kvZwnKS5zZWxlY3QoKGl0LCBmaWx0ZXJfcnVsZXMsIGlkZXgpID0+IHtcXG4gICAgICAgICAgICBpZiAoaW5wdXQgPT09ICfliKDpmaQnKSB7XFxuICAgICAgICAgICAgICAgIGxldCBmaWx0ZXJPcHRpb24gPSBnZXRJdGVtKCdmaWx0ZXJPcHRpb24nLCflhajpg6gnKTtcXG4gICAgICAgICAgICAgICAgaWYoZmlsdGVyT3B0aW9uPT09aXQubmFtZSl7XFxuICAgICAgICAgICAgICAgICAgICBjbGVhckl0ZW0oJ2ZpbHRlck9wdGlvbicpXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgZmlsdGVyX3J1bGVzLnNwbGljZShpZGV4LCAxKTtcXG4gICAgICAgICAgICB9ZWxzZSBpZiAoaW5wdXQgPT09ICfkv67mlLnlkI3np7AnKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkKGl0Lm5hbWUsJ+e7meatpOinhOWImeaUueS4quWQjeWtl+WQpycpLmlucHV0KChmaWx0ZXJfcnVsZXMsaWRleCk9PntcXG4gICAgICAgICAgICAgICAgICAgIGlucHV0ID0gaW5wdXQudHJpbSgpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYoaW5wdXQpe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpbHRlcl9ydWxlc1tpZGV4XS5uYW1lID0gaW5wdXQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ2ZpbHRlcl9ydWxlcy5qc29uJywgSlNPTi5zdHJpbmdpZnkoZmlsdGVyX3J1bGVzKSwgMCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/kv67mlLnmiJDlip8nXFxuICAgICAgICAgICAgICAgICAgICB9ZWxzZXtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5L+u5pS55aSx6LSlJ1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LGZpbHRlcl9ydWxlcyxpZGV4KTtcXG4gICAgICAgICAgICB9ZWxzZSBpZiAoaW5wdXQgPT09ICfkv67mlLnop4TliJknKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkKGl0LnJ1bGUsJ+e7meatpOinhOWImeaUueS4quWMuemFjeWGheWuueWQpycpLmlucHV0KChmaWx0ZXJfcnVsZXMsaWRleCk9PntcXG4gICAgICAgICAgICAgICAgICAgIGlucHV0ID0gaW5wdXQudHJpbSgpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYoaW5wdXQpe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpbHRlcl9ydWxlc1tpZGV4XS5ydWxlID0gaW5wdXQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ2ZpbHRlcl9ydWxlcy5qc29uJywgSlNPTi5zdHJpbmdpZnkoZmlsdGVyX3J1bGVzKSwgMCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/kv67mlLnmiJDlip8nXFxuICAgICAgICAgICAgICAgICAgICB9ZWxzZXtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5L+u5pS55aSx6LSlJ1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LGZpbHRlcl9ydWxlcyxpZGV4KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSAn5b+r5o236L6T5YWlJykge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiZmlsdGVyX25h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ICAgICAgICAgIGZvcm0uYXBwZW5kKFxcXCJwYXRoXFxcIiwgb2JqLnBhdGgpO1xcbiAgICAgICAgICAgIGZvcm0uYXBwZW5kKFxcXCJwYXNzd29yZFxcXCIsIG9iai5wYXNzd29yZCk7XFxuICAgICAgICAgICAgdmFyIHhociA9IG5ldyBYTUxIdHRwUmVxdWVzdCgpO1xcbiAgICAgICAgICAgIC8veGhyLnNldFJlcXVlc3RIZWFkZXIoJ0NvbnRlbnQtVHlwZScsICdhcHBsaWNhdGlvbi9qc29uJyk7XFxuICAgICAgICAgICAgdmFyIGFjdGlvbiA9IG9iai5iYXNlX3VybCArIFxcXCIvYXBpL3B1YmxpYy91cGxvYWRcXFwiOyAvL+S4iuS8oOaOpeWPo1xcbiAgICAgICAgICAgIC8vIGZiYS5sb2coXFxcIuato+WcqOS4iuS8oFxcXCIpO1xcbiAgICAgICAgICAgIHhoci5vbmxvYWQgPSBmdW5jdGlvbigpIHtcXG4gICAgICAgICAgICAgICAgZmJhLmhpZGVMb2FkaW5nKCk7XFxuICAgICAgICAgICAgICAgIGlmICh4aHIucmVhZHlTdGF0ZSA9PT0gNCAmJiB4aHIuc3RhdHVzID09PSAyMDApIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHRPYmogPSBKU09OLnBhcnNlKHhoci5yZXNwb25zZVRleHQpO1xcbiAgICAgICAgICAgICAgICAgICAgZmJhLmxvZyh4aHIucmVzcG9uc2VUZXh0KTtcXG4gICAgICAgICAgICAgICAgICAgIGFsZXJ0KFxcXCLkuIrkvKDmiJDlip9cXFxcblxcXCIgKyByZXN1bHRPYmoubWVzc2FnZSk7XFxuICAgICAgICAgICAgICAgICAgICBmYmEuYmFjayh0cnVlKTtcXG4gICAgICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgICAgICAgICBhbGVydChcXFwi5LiK5Lyg5aSx6LSlXFxcIik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgIC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ICAgICAgICAgICAgICAgICAgIHBhdGg6IHBhdGgsXFxuICAgICAgICAgICAgICAgICAgICBrZXl3b3JkOiBuc2VhcmNoLFxcbiAgICAgICAgICAgICAgICAgICAgcGFzc3dvcmQ6IHBhc3N3b3JkW3BhdGhdIHx8ICcnXFxuICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICB0aW1lb3V0OiAkLmdldFRpbWVPdXQoKSxcXG4gICAgICAgICAgICB9KSk7XFxuXFxuICAgICAgICAgICAgbGV0IGxpc3QgPSByZXMuZGF0YTtcXG4gICAgICAgICAgICBpZiAobGlzdC5sZW5ndGggPCAxKSB7XFxuICAgICAgICAgICAgICAgIHNlYXJjaFJlc3VsdC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5om+5LiN5Yiw5L2g5oOz6KaB55qEypXCt+G0pcK3ypRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaWYoZmlsdGVyT3B0aW9uPT09J+aWh+S7ticpe1xcbiAgICAgICAgICAgICAgICAgICAgbGlzdCA9IGxpc3QuZmlsdGVyKHg9PngudHlwZSE9PTEpXFxuICAgICAgICAgICAgICAgIH1lbHNlIGlmKGZpbHRlck9wdGlvbj09PSfmlofku7blpLknKXtcXG4gICAgICAgICAgICAgICAgICAgIGxpc3QgPSBsaXN0LmZpbHRlcih4PT54LnR5cGU9PT0xKVxcbiAgICAgICAgICAgICAgICB9ZWxzZSBpZihmaWx0ZXJPcHRpb24hPT0n5YWo6YOoJyl7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgZmlsdGVyX3J1bGVzID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnZmlsdGVyX3J1bGVzLmpzb24nLCAwKSB8fCAnW10nKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBmaWx0ZXJfcnVsZSA9IGZpbHRlcl9ydWxlcy5maW5kKHg9PngubmFtZT09PWZpbHRlck9wdGlvbik7XFxuICAgICAgICAgICAgICAgICAgICBpZihmaWx0ZXJfcnVsZSYmZmlsdGVyX3J1bGUucnVsZSl7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYoZmlsdGVyX3J1bGUucnVsZS5zdGFydHNXaXRoKCchJykpe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0ID0gbGlzdC5maWx0ZXIoeD0+IShuZXcgUmVnRXhwKGZpbHRlcl9ydWxlLnJ1bGUuc2xpY2UoMSkpKS50ZXN0KHgubmFtZSkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1lbHNle1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0ID0gbGlzdC5maWx0ZXIoeD0+KG5ldyBSZWdFeHAoZmlsdGVyX3J1bGUucnVsZSkpLnRlc3QoeC5uYW1lKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHNob3dMb2FkaW5nKCfmkJzntKLliLAnICsgbGlzdC5sZW5ndGggKyAn5p2h57uT5p6cLOWKoOi9veS4rScpO1xcbiAgICAgICAgICAgICAgICBsaXN0LmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBpdF90eXBlID0gaXRlbS50eXBlOy8v6LWE5rqQ57G75Z6LXFxuICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gJ2hpa2VyOi8vZW1wdHknO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gaXRlbS5uYW1lOy8v6LWE5rqQ5ZCN56ewXFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGF0aCA9IGl0ZW0ucGF0aDsvL+i1hOa6kOi3r+W+hFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGlkID0gYmFzZXVybCArIHBhdGggKyB0aXRsZTsvL+i1hOa6kOWUr+S4gOagh+W/l1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGV4dCA9IHRpdGxlLnNwbGl0KCcuJykuc2xpY2UoLTEpWzBdO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGltZyA9IGl0X3R5cGUgPT09IDEgPyBpY29uX2RpY3RbJzEnXSA6IChpY29uc1tleHRdIHx8IGljb25fZGljdFtpdF90eXBlICsgJyddKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpdF90eXBlID09PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwicGF0aFxcXCIsIGl0ZW0ucGF0aCArIFxcXCIvXFxcIiArIGl0ZW0ubmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFjaygpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGl0X3R5cGUgPT09IDMgfHwgL1xcXFwubTN1OCQvLnRlc3QodGl0bGUpKSB7IC8vM+aYr+WqkuS9kyznpoHnlKjkuIvovb3lkozot7PovaxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSBnZXRMaW5rKHRpdGxlLHBhdGgsICfmiZPlvIAnLCBzaG93WmltdSwgJyNpc1ZpZGVvPXRydWUjJyx0cnVlKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaXRfdHlwZSA9PT0gNikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IGdldExpbmsodGl0bGUscGF0aCwgJ+aJk+W8gCcsIHNob3daaW11LCBcXFwiIy5qcGdcXFwiLHRydWUpO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsgLy/ot5/pmo/ns7vnu5/pooTop4jlkozkuIvovb1cXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSBnZXRMaW5rKHRpdGxlLHBhdGgsIGNsaWNrT3B0aW9uLCBzaG93WmltdSx0cnVlKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHNlYXJjaFJlc3VsdC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBuYW1lOnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImF2YXRhclxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGlkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBpdF90eXBlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAvLyBsb2coaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoc2hvd0RldGFpbCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRlID0gKGl0ZW0udXBkYXRlZF9hdCB8fCBpdGVtLnRpbWVfc3RyKSA/IGdldFRpbWUoaXRlbSkgOiAnXFxcXHRcXFxcdFxcXFx0XFxcXHQnO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBzaXplID0gaXRlbS5zaXplX3N0cjtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNpemUgfHwgc2l6ZSA9PT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZSA9IGl0ZW0uc2l6ZSA9PT0gMCA/IFxcXCIvXFxcIiA6IGJ5dGVzVG9TaXplKGl0ZW0uc2l6ZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNpemUgJiYgc2l6ZSAhPT0gXFxcIlxcXCIgJiYgc2l6ZSAhPT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplID0gXFxcIiZuYnNwOyZuYnNwOyZuYnNwO1xcXCIgKyBzaXplO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemUgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRlc2MgPSBkYXRlICsgc2l6ZTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWFyY2hSZXN1bHQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6dGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBzbWFsbChjb2xvcihkZXNjLCAnI2FhYWFhYScpKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBpZCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGl0X3R5cGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgdG9hc3QoJ+aQnOe0oue7k+adn++8jOWNs+WwhuWKoOi9veWujOavlS4uLicpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBwdXRNeVZhcignbGFzdFNlYXJjaCcsIGxhc3RTZWFyY2gpO1xcbiAgICAgICAgICAgIGlmKCFzaG93RGV0YWlsKXsvL+mdnuivpue7huaooeW8j+aJjeiHquWKqOaMieWQjeensOaOkuW6j1xcbiAgICAgICAgICAgICAgICBzb3J0cyhzZWFyY2hSZXN1bHQsJ+WQjeensCcpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBzYXZlRmlsZSgnc2VhcmNoX3Jlc3VsdHMuanNvbicsIEpTT04uc3RyaW5naWZ5KHNlYXJjaFJlc3VsdCksIDApO1xcblxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIHNlYXJjaFJlc3VsdC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLlpb3lg4/kuI3og73mkJzntKIs54K55Ye76L+U5ZueXFxcIixcXG4gICAgICAgICAgICAgICAgZGVzYzogZS5tZXNzYWdlLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgYmFjaygpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIHB1dE15VmFyKCdsYXN0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gICAgIHUgPSBwbGF5VXJsOyAvLyDml6LnhLbojrflj5Z15rKh5oql6ZSZLOS4uuS6huWPr+S7peiuqeinhumikeaKleWxjyzpgqPkuYh16KaG5YaZ5Li6MzAy55u06ZO+XFxuICAgICAgICAgICAgaWYoZXh0JiYvaXNWaWRlby8udGVzdChleHQpJiZzaG93WmltdT09PSflvIAnKXsvL+WIpOaWreaJk+W8gOeahOaYr+WqkuS9k+aWh+S7tuaJjei1sOWtl+W5lemAu+i+kVxcbiAgICAgICAgICAgICAgICBsZXQgaWQgPSBiYXNldXJsICsgbnBhdGg7Ly/lvZPliY3mlofku7bnmoTllK/kuIDmoIfor4ZcXG4gICAgICAgICAgICAgICAgbGV0IGRhdGEgPSB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaW5wdXQsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBpZCxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOntcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZDppZCxcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgdmFyIG5vd19maWxlcyA9IHN0b3JhZ2UwLmdldE15VmFyKFxcXCJub3dfZmlsZXNcXFwiLFtdKTsvL+iOt+WPlue8k+WtmOeahCzpgb/lhY3kuozmrKHor7fmsYJcXG4gICAgICAgICAgICAgICAgLy8gbG9nKCflkIznm67lvZXmlofku7bmlbDkuLo6Jytub3dfZmlsZXMubGVuZ3RoKTtcXG4gICAgICAgICAgICAgICAgaWYobm93X2ZpbGVzLmxlbmd0aCA8IDF8fCByZWxvYWQpey8v5LuO5pCc57Si6L+b5Y6755qELOWPquiDvemHjeaWsOiOt+WPluS6hlxcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qge2dldEZpbGVzfSA9ICQucmVxdWlyZSgnaGlrZXI6Ly9wYWdlL2FwaScpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRpckluZm8gPSBnZXRGaWxlcyhwYXRoLCfmlofku7YnKTtcXG4gICAgICAgICAgICAgICAgICAgIG5vd19maWxlcyA9IGRpckluZm8ucmVzdWx0fHxbXTtcXG4gICAgICAgICAgICAgICAgICAgIC8vIGxvZygn6YeN5paw6I635Y+W5ZCM55uu5b2V5paH5Lu2Oicrbm93X2ZpbGVzLmxlbmd0aCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgbGV0IGZpbGVzO1xcbiAgICAgICAgICAgICAgICBpZihyZWxvYWQpe1xcbiAgICAgICAgICAgICAgICAgICAgZmlsZXMgPSBub3dfZmlsZXMuZmlsdGVyKHg9PngudHlwZSE9PTEmJi9cXFxcLnNydCR8XFxcXC52dHQkfFxcXFwuYXNzJHxcXFxcLnNzYSQvLnRlc3QoeC50aXRsZSkpLm1hcCh4PT54LnRpdGxlKTsgLy8g562b6YCJ5paH5Lu25bm25LiU5ZCN56ew5ZCr5a2X5bmV5ZCO57yA55qEXFxuICAgICAgICAgICAgICAgIH1lbHNle1xcbiAgICAgICAgICAgICAgICAgICAgZmlsZXMgPSBub3dfZmlsZXMuZmlsdGVyKHg9PngudHlwZSE9PTEmJi9cXFxcLnNydCR8XFxcXC52dHQkfFxcXFwuYXNzJHxcXFxcLnNzYSQvLnRlc3QoeC5uYW1lKSkubWFwKHg9PngubmFtZSk7IC8vIOetm+mAieaWh+S7tuW5tuS4lOWQjeensOWQq+Wtl+W5leWQjue8gOeahFxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8vIGxvZyhub3dfZmlsZXMpO1xcbiAgICAgICAgICAgICAgICBpZihmaWxlcy5sZW5ndGggPiAwKXsvL+W9k+WJjeebruW9leacieWtl+W5leaWh+S7tlxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGJlc3RGaWxlID0gZmlsZXMuZmluZCh4PT4kLnJlbW92ZUV4dChpbnB1dCkuaW5jbHVkZXMoJC5yZW1vdmVFeHQoeCkpKTsvL+inhumikeaWh+S7tuWOu+aOieWQjue8gOWujOe+juWMheWQq+Wtl+W5leaWh+S7tuWOu+WQjue8gFxcbiAgICAgICAgICAgICAgICAgICAgaWYoYmVzdEZpbGUpey8v5om+5Yiw5LqG5pyA56ym5ZCI55qE5paH5Lu25ZCN56ewXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9nKGAke2lucHV0feiHquWKqOWMuemFjeacgOS9s+WkluaMguWtl+W5leaWh+S7tjoke2Jlc3RGaWxlfWApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByZWFsVXJsID0gYmFzZXVybCArICcvZCcgKyBwYXRoICsgYmVzdEZpbGU7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS51cmwgPSBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybHM6IFtwbGF5VXJsXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VidGl0bGU6IHJlYWxVcmxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAkLnNhdmVIaXN0b3J5KGlkLGRhdGEpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybHM6IFt1XSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VidGl0bGU6IHJlYWxVcmxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIH1lbHNle1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVzID0gZmlsZXMuZmlsdGVyKHg9PiQuc2ltaWxhcigkLnJlbW92ZUV4dChpbnB1dCksJC5yZW1vdmVFeHQoeCkpPj0zMCk7Ly/nrZvpgInnm7jkvLzluqY+MzDnmoTmlofku7ZcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmlsZXMubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlcy51bnNoaWZ0KCfkuI3pnIDopoHlrZfluZUnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoZmlsZXMsIDEsIFxcXCLor7fpgInmi6nlrZfluZVcXFwiKS5zZWxlY3QoKGJhc2V1cmwsIHBhdGgsIHUsZXh0LGlkLHBsYXlVcmwsZGF0YSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoaW5wdXQ9PT0n5LiN6ZyA6KaB5a2X5bmVJyl7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS51cmwgPSBwbGF5VXJsK2V4dDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkLnNhdmVIaXN0b3J5KGlkLGRhdGEpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1K2V4dFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHJlYWxVcmwgPSBiYXNldXJsICsgJy9kJyArIHBhdGggKyBpbnB1dDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudXJsID0gSlNPTi5zdHJpbmdpZnkoe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybHM6IFtwbGF5VXJsXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJ0aXRsZTogcmVhbFVybFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkLnNhdmVIaXN0b3J5KGlkLGRhdGEpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmxzOiBbdV0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VidGl0bGU6IHJlYWxVcmxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBiYXNldXJsLCBwYXRoLCB1LGV4dCxpZCxwbGF5VXJsLGRhdGEpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudXJsID0gcGxheVVybCArIGV4dDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJC5zYXZlSGlzdG9yeShpZCxkYXRhKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUgKyBleHRcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1lbHNle1xcbiAgICAgICAgICAgICAgICAgICAgZGF0YS51cmwgPSBwbGF5VXJsICsgZXh0O1xcbiAgICAgICAgICAgICAgICAgICAgJC5zYXZlSGlzdG9yeShpZCxkYXRhKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB1ICsgZXh0XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9ZWxzZSBpZihleHQmJi9pc1ZpZGVvLy50ZXN0KGV4dCkmJnNob3daaW11IT09J+W8gCcpe1xcbiAgICAgICAgICAgICAgICBsZXQgaWQgPSBiYXNldXJsICsgbnBhdGg7Ly/lvZPliY3mlofku7bnmoTllK/kuIDmoIfor4ZcXG4gICAgICAgICAgICAgICAgbGV0IGRhdGEgPSB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaW5wdXQsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBpZCxcXG4gICAgICAgICAgICAgICAgICAgIHVybDpwbGF5VXJsICsgZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6e1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlkOmlkLFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICAkLnNhdmVIaXN0b3J5KGlkLGRhdGEpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdSArIGV4dFxcbiAgICAgICAgICAgIH1lbHNle1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdSArIGV4dFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChjbGlja09wdGlvbiA9PT0gJ+aJk+W8gCcpIHtcXG4gICAgICAgICAgICByZXR1cm4gdVxcbiAgICAgICAgfSBlbHNlIGlmIChjbGlja09wdGlvbiA9PT0gJ+S4i+i9vScpIHtcXG4gICAgICAgICAgICByZXR1cm4gJ2Rvd25sb2FkOi8vJyArIHVcXG4gICAgICAgIH1cXG4gICAgfWVsc2V7XFxuXFxuICAgICAgICByZXR1cm4gJChbJ+aJk+W8gCcsICfkuIvovb0nLCAn6aKE6KeIJywgJ+WkjeWItuebtOmTviddLCAyLCAn6K+36YCJ5oupMeS4quaWh+S7tuaTjeS9nCcpLnNlbGVjdCgoYmFzZXVybCwgbnBhdGgsZXh0KSA9PiB7XFxuICAgICAgICAgICAgbGV0IHU9JC5nZXRVKGJhc2V1cmwsbnBhdGgsZXh0KTtcXG4gICAgICAgICAgICBpZigvdG9hc3Q6Ly50ZXN0KHUpKXtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHVcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IHJlYWxVcmwgPSBiYXNldXJsICsgJy9kJyArIG5wYXRoO1xcbiAgICAgICAgICAgIGlmIChpbnB1dCA9PT0gJ+aJk+W8gCcpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHU7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gJ+S4i+i9vScpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdkb3dubG9hZDovLycgKyB1XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gJ+WkjeWItuebtOmTvicpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdjb3B5Oi8vJyArIHJlYWxVcmxcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSAn6aKE6KeIJykge1xcbiAgICAgICAgICAgICAgICBpZiAoL1xcXFwubWQkLy50ZXN0KHJlYWxVcmwpKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJC5yZW5kZXJUZXh0KHJlYWxVcmwsJ21kJyk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoL1xcXFwuaHRtbCR8XFxcXC5qc29uJHxcXFxcLmpzJHxcXFxcLmNzcyR8XFxcXC5weSR8XFxcXC5waHAkfFxcXFwuZ28kLy50ZXN0KHJlYWxVcmwpKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJC5yZW5kZXJUZXh0KHJlYWxVcmwsJ2NvZGUnKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICgvXFxcXC50eHQkLy50ZXN0KHJlYWxVcmwpKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJC5yZW5kZXJUZXh0KHJlYWxVcmwsJ3R4dCcpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKC9cXFxcLnBkZiQvLnRlc3QocmVhbFVybCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwieDU6Ly9odHRwczovL2FsaXN0LW9yZy5naXRodWIuaW8vcGRmLmpzL3dlYi92aWV3ZXIuaHRtbD9maWxlPVxcXCIgKyByZWFsVXJsXFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoJC5pc09mZmljZShyZWFsVXJsKSkge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ4NTovL2h0dHBzOi8vdmlldy5vZmZpY2VhcHBzLmxpdmUuY29tL29wL3ZpZXcuYXNweD9zcmM9XFxcIiArIHJlYWxVcmxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBzdWJfdXJscyA9ICQuZ2V0X3N1Yl91cmxzKCk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGFzc3dvcmQgPSBzdWJfdXJscy5maW5kKHggPT4geC51cmwuaW5jbHVkZXMoYmFzZXVybCkpLnBhc3N3b3JkIHx8IHt9O1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJlcyA9IEpTT04ucGFyc2UocG9zdChiYXNldXJsICsgXFxcIi9hcGkvcHVibGljL3ByZXZpZXdcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwiQ29udGVudC1UeXBlXFxcIjogXFxcImFwcGxpY2F0aW9uL2pzb25cXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGg6IG5wYXRoLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXNzd29yZDogcGFzc3dvcmRbbnBhdGhdIHx8IFxcXCJcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVvdXQ6ICQuZ2V0VGltZU91dCgpLFxcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlcy5kYXRhKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlcy5kYXRhLnByZXZpZXdfdXJsICsgJyZhY2Nlc3NfdG9rZW49JyArIHJlcy5kYXRhLmFjY2Vzc190b2tlbjtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovLycgKyByZXMubWVzc2FnZTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/ml6DmlYjmk43kvZwnXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSxiYXNldXJsLCBucGF0aCxleHQpO1xcblxcbiAgICB9XFxufVxcblxcbiQuZXhwb3J0cy5jbGlja0xhenkgPSBjbGlja0xhenk7XCJ9XSIsImljb24iOiJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvZ2gvYWxpc3Qtb3JnL2xvZ29AbWFpbi9jYW5fY2lyY2xlLnN2ZyIsInByb3h5IjoiIn0=
Add Comment
Please, Sign In to add comment