xiaomianao666

小程序:轻订阅

Oct 28th, 2023
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@轻订阅@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoi6L276K6i6ZiFIiwiYXV0aG9yIjoiSm9rZXIiLCJ1cmwiOiJoaWtlcjovL2VtcHR5IiwidmVyc2lvbiI6MTA1LCJjb2xfdHlwZSI6Imljb25fc21hbGxfNCIsImNsYXNzX25hbWUiOiIiLCJ0eXBlIjoiYWxsIiwiY2xhc3NfdXJsIjoiIiwiYXJlYV9uYW1lIjoiIiwiYXJlYV91cmwiOiIiLCJzb3J0X25hbWUiOiIiLCJ5ZWFyX25hbWUiOiIiLCJzb3J0X3VybCI6IiIsInllYXJfdXJsIjoiIiwiZmluZF9ydWxlIjoianM6XG5jb25zdCBRSU5HX1RJVExFID0gZ2V0TXlWYXIoJ215Q29sbGVjdGlvbicpLFxuICAgIG5ld1dpbmRvdyA9IHJlYWRGaWxlKCduZXdXaW5kb3cnKSxcbiAgICB0eXBlcyA9IHt9LFxuICAgIHRlbXBUeXBlcyA9IHsgJ2FsbCc6ICfogZrlkIgnLCAndmlkZW8nOiAn6KeG6aKRJywgJ211c2ljJzogJ+mfs+mikScsICdsaXZlJzogJ+ebtOaSrScsICdjYXJ0b29uJzogJ+a8q+eUuycsICdyZWFkJzogJ+mYheivuycsICdwaWN0dXJlJzogJ+WbvumbhicsICduZXdzJzogJ+i1hOiurycsICd0b29sJzogJ+W3peWFtycsICdvdGhlcic6ICflhbblroMnIH07XG5sZXQgdHlwZVNob3cgPSBnZXRNeVZhcigndHlwZVNob3cnLCAnZmluZDonKSxcbiAgICAgZWwgPSBbe1xuICAgICAgICB0aXRsZTogJyAnICsgUUlOR19USVRMRS5ib2xkKCkgKyAnICZuYnNwICZuYnNwICcgKyAn4pqZIOi9u+WQiOmbhuiuvue9riDimpknLnNtYWxsKCksXG4gICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9Db25maWc/cnVsZT0nICsgUUlOR19USVRMRSArICcmI25vUmVjb3JkSGlzdG9yeSMnLFxuICAgICAgICBpbWc6IE1ZX1JVTEUuaWNvbiB8fCAnaGlrZXI6Ly9pbWFnZXMvaWNvbjEnLFxuICAgICAgICBjb2xfdHlwZTogJ2F2YXRhcidcbiAgICB9LCB7XG4gICAgICAgIHVybDogJ1wiaGlrZXI6Ly9zZWFyY2g/cz1cIitpbnB1dCcsXG4gICAgICAgIGRlc2M6ICfmkJzkvaDmg7PopoHnmoQuLi4nLFxuICAgICAgICB0aXRsZTogJ+aQnOe0oicsXG4gICAgICAgIGNvbF90eXBlOiAnaW5wdXQnLFxuICAgICAgICBleHRyYToge1xuICAgICAgICAgICAgcnVsZXM6ICQudG9TdHJpbmcoKFFJTkdfVElUTEUsIHR5cGVTaG93KSA9PiB7XG4gICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gJC5yZXF1aXJlKCdoaWtlcjovL3BhZ2UvZGF0YUxvYWQ/cnVsZT0nICsgUUlOR19USVRMRSkoKVxuICAgICAgICAgICAgICAgIGlmICh0eXBlU2hvdy5zdGFydHNXaXRoKCdmaW5kOicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBmaWx0ZXJLZXkgPSB0eXBlU2hvdy5zbGljZSg1KVxuICAgICAgICAgICAgICAgICAgICBpZiAoZmlsdGVyS2V5KSBydWxlcyA9IHJ1bGVzLmZpbHRlcigodikgPT4gdi50aXRsZS5pbmNsdWRlcyhmaWx0ZXJLZXkpKVxuICAgICAgICAgICAgICAgIH0gZWxzZSBydWxlcyA9IHJ1bGVzLmZpbHRlcigodikgPT4gdi50eXBlID09IHR5cGVTaG93KVxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShydWxlcylcbiAgICAgICAgICAgIH0sIFFJTkdfVElUTEUsIHR5cGVTaG93KSxcbiAgICAgICAgICAgIGRlZmF1bHRW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gICAgICAgICAgcHV0TXlWYXIoJ3R5cGVTaG93JywgaylcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcbiAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXG4gICAgICAgICAgICB9LCBrKSxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbidcbiAgICAgICAgfSlcbiAgICB9XG59XG5pZiAoIXR5cGVTaG93LnN0YXJ0c1dpdGgoJ2ZpbmQ6JykpIHJ1bGVzID0gcnVsZXNUeXBlW3R5cGVTaG93XVxuZXZhbChKU09OLnBhcnNlKGZldGNoKCdoaWtlcjovL3BhZ2UvdXJsUGFyc2U/cnVsZT0nICsgUUlOR19USVRMRSkpLnJ1bGUpXG5ydWxlcy5mb3JFYWNoKCh2KSA9PiB7XG4gICAgbGV0IHVybFBhcmFtID0gdi51cmwuc3BsaXQoJzsnKSxcbiAgICAgICAgcnVsZVRtcCA9IHtcbiAgICAgICAgICAgIHRpdGxlOiB2LnRpdGxlLFxuICAgICAgICAgICAgdXJsOiB1cmxQYXJhbS5zaGlmdCgpLFxuICAgICAgICAgICAgY2xhc3NfbmFtZTogdi5jbGFzc19uYW1lLFxuICAgICAgICAgICAgY2xhc3NfdXJsOiB2LmNsYXNzX3VybCxcbiAgICAgICAgICAgIGFyZWFfbmFtZTogdi5hcmVhX25hbWUsXG4gICAgICAgICAgICBhcmVhX3VybDogdi5hcmVhX3VybCxcbiAgICAgICAgICAgIHllYXJfbmFtZTogdi55ZWFyX25hbWUsXG4gICAgICAgICAgICB5ZWFyX3VybDogdi55ZWFyX3VybCxcbiAgICAgICAgICAgIHNvcnRfbmFtZTogdi5zb3J0X25hbWUsXG4gICAgICAgICAgICBzb3J0X3VybDogdi5zb3J0X3VybFxuICAgICAgICB9LFxuICAgICAgICBmeXBhZ2UgPSBydWxlVG1wLnVybC5pbmNsdWRlcygnZnlwYWdlJykgPyAnZnlwYWdlJyA6ICcxJyxcbiAgICAgICAgZG9tYWluID0gKC9eKGh0dHBzPzpcXC9cXC8uKz8pKD86I3xcXD98XFwvfCQpL2kuZXhlYyhydWxlVG1wLnVybCkgfHwgWywgJ2hpa2VyOi8vZW1wdHknXSlbMV0sXG4gICAgICAgIGQgPSB7XG4gICAgICAgICAgICB0aXRsZTogdi50aXRsZSxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9mcmFtZUxvYWQnLFxuICAgICAgICAgICAgaW1nOiB2Lmljb24gfHwgJ2hpa2VyOi8vaW1hZ2VzL2ljb24xJyxcbiAgICAgICAgICAgIGV4dHJhOiB7XG4gICAgICAgICAgICAgICAgdXJsOiBkb21haW4gKyAnLyNub0hpc3RvcnkjI25vUmVjb3JkSGlzdG9yeSMjIyMnICsgSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgICAgICAgICAgICAgICBSVUxFOiBiYXNlNjRFbmNvZGUoSlNPTi5zdHJpbmdpZnkocnVsZVRtcCkpLFxuICAgICAgICAgICAgICAgICAgICBwYWdlTnVtOiBmeXBhZ2UsXG4gICAgICAgICAgICAgICAgICAgIFFJTkdfVElUTEU6IGdldE15VmFyKCdteUNvbGxlY3Rpb24nKVxuICAgICAgICAgICAgICAgIH0pICsgJy5qczpldmFsKEpTT04ucGFyc2UoZmV0Y2goXCJoaWtlcjovL3BhZ2UvdXJsUGFyc2XvvJ/vvJ9ydWxlPScgKyBRSU5HX1RJVExFICsgJ1wiKSkucnVsZSnvvJvvvJtpbmRleFVybChpbnB1dCk7JyArIHBhcmFtSGFuZGxlKHVybFBhcmFtLCB2LnVhKSxcbiAgICAgICAgICAgICAgICBSVUxFOiB7XG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB2LnRpdGxlXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBpc0luZGV4OiB0cnVlXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICBpZiAobmV3V2luZG93KSB7XG4gICAgICAgIE9iam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lZCksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJ1xcbiAgICAgICAgfSlcXG4gICAgICAgIGxldCBhcnIgPSBmb2xkZWQgPyBbdGhpcy5hcnJbMF1dIDogdGhpcy5hcnJcXG4gICAgICAgIGFyci5mb3JFYWNoKCh2KSA9PiB7XFxuICAgICAgICAgICAgbGV0IHsgaWQsIGNsYXNzX25hbWUsIGNsYXNzX3VybCB9ID0gdixcXG4gICAgICAgICAgICBzZWxlY3RlZCA9IEpTT04uc3RyaW5naWZ5KHRoaXMuZ2V0Q2xhc3MoaWQpKVxcbiAgICAgICAgICAgIGNsYXNzX25hbWUuZm9yRWFjaCgobmFtZSwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgdXJsID0gY2xhc3NfdXJsW2ldLFxcbiAgICAgICAgICAgICAgICAgICAgbm93ID0gSlNPTi5zdHJpbmdpZnkoeyBuYW1lOiBuYW1lLCB1cmw6IHVybCB9KVxcbiAgICAgICAgICAgICAgICBlbC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBzZWxlY3RlZCA9PSBub3cgPyAn4oCc4oCc4oCd4oCdJyArIG5hbWUuZm9udGNvbG9yKHRoaXMuY29sb3IpLmJvbGQoKSA6IG5hbWUsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHNlbGVjdGVkID09IG5vdyA/ICdoaWtlcjovL2VtcHR5JyA6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHNpZ24sIGlkLCBub3cpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRWYXIoc2lnbiArIGlkLCBub3cpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5zaWduLCBpZCwgbm93KSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbidcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGVsLnB1c2goeyBjb2xfdHlwZTogdGhpcy5ib3VuZGFyeSB9KVxcbiAgICAgICAgfSlcXG4gICAgfSxcXG4gICAgaW5pdChjbGFzc09iamVjdCkge1xcbiAgICAgICAgaWYgKHR5cGVvZiBjbGFzc09iamVjdC5jbGFzc19uYW1lID09ICdzdHJpbmcnKVxcbiAgICAgICAgICAgIGNsYXNzT2JqZWN0LmNsYXNzX25hbWUgPSBjbGFzc09iamVjdC5jbGFzc19uYW1lLnNwbGl0KCcmJylcXG4gICAgICAgIGlmICh0eXBlb2YgY2xhc3NPYmplY3QuY2xhc3NfdXJsID09ICdzdHJpbmcnKVxcbiAgICAgICAgICAgIGNsYXNzT2JqZWN0LmNsYXNzX3VybCA9IGNsYXNzT2JqZWN0LmNsYXNzX3VybC5zcGxpdCgnJicpLm1hcCgodikgPT4gdi50cmltKCkpXFxuICAgICAgICByZXR1cm4gY2xhc3NPYmplY3RcXG4gICAgfSxcXG4gICAgcHVzaChjbGFzc09iamVjdCkge1xcbiAgICAgICAgdGhpcy5hcnIucHVzaCh0aGlzLmluaXQoY2xhc3NPYmplY3QpKVxcbiAgICB9LFxcbiAgICBnZXRDbGFzcyhpZCkge1xcbiAgICAgICAgbGV0IGRlZmF1bHRDbGFzcyA9IHRoaXMuYXJyLmZpbmQoaXRlbSA9PiBpdGVtLmlkID09IGlkKVxcbiAgICAgICAgZGVmYXVsdENsYXNzID0gSlNPTi5zdHJpbmdpZnkoZGVmYXVsdENsYXNzID8ge1xcbiAgICAgICAgICAgIG5hbWU6IGRlZmF1bHRDbGFzcy5jbGFzc19uYW1lWzBdLFxcbiAgICAgICAgICAgIHVybDogZGVmYXVsdENsYXNzLmNsYXNzX3VybFswXVxcbiAgICAgICAgfSA6IHsgbmFtZTogICdjYW5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UqC/npoHnlKjjgIHph43mlrDmjpLluo/nrYnmk43kvZzlnYfkuI3kvJrkvZPnjrDlnKjpppbpobXlsI/nqIvluo/liJfooajkuK0nXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/lt7InICsgaW5wdXRcXG4gICAgICAgIH0sIHVybCksXFxuICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIChkaXNhYmxlQ3VzdG9tID8gWyflr7zlhaXmtbfpmJQnXSA6IFsn5ZCv55SoL+emgeeUqCcsICfph43mlrDmjpLluo8nLCAn5pu05pS55Zu+5qCHJywgJ+WvvOWFpea1t+mYlCddKS5mb3JFYWNoKCh2KSA9PiB7XFxuICAgICAgICBlbC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogdiA9PSBlZGl0TW9kZSA/ICfigJzigJzigJ3igJ0nICsgdi5ib2xkKCkuZm9udGNvbG9yKCcjMTJiNjY4JykgOiB2LFxcbiAgICAgICAgICAgIHVybDogdiA9PSBlZGl0TW9kZSA/ICQoZmlsdGVyS2V5LCAn5p+l5om+5bCP56iL5bqP5YWz6ZSu6K+NJykuaW5wdXQoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcignZmlsdGVyS2V5JywgaW5wdXQpXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxuICAgICAgICAgICAgfSkgLypnZyovIDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgodikgPT4ge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcignZWRpdE1vZGUnLCB2KVxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgICAgIH0sIHYpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbidcXG4gICAgICAgIH0pXFxuICAgIH0pO1xcbiAgICAoZGlzYWJsZUN1c3RvbSA/IGRhdGEgOiBjdXN0b21EYXRhKS5mb3JFYWNoKCh2LCBpKSA9PiB7XFxuICAgICAgICBsZXQgZCA9IHtcXG4gICAgICAgICAgICB0aXRsZTogdi50aXRsZSxcXG4gICAgICAgICAgICBpbWc6IGRhdGFbaV0uaWNvblxcbiAgICAgICAgfTtcXG4gICAgICAgIHN3aXRjaCAoZWRpdE1vZGUpIHtcXG4gICAgICAgICAgICBjYXNlICflkK/nlKgv56aB55SoJzpcXG4gICAgICAgICAgICAgICAgZC50aXRsZSA9ICh2LnZpc2libGUgPyAn8J+foiAgJyA6ICfwn5S0ICAnKSArIGQudGl0bGU7XFxuICAgICAgICAgICAgICAgIGQudXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoaSwgdXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZXMgPSBKU09OLnBhcnNlKHJlYWRGaWxlKCdjdXN0b21EYXRhXycgKyBtZDUodXJsKSkgfHwgJ1tdJylcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVzW2ldLnZpc2libGUgPSAhcnVsZXNbaV0udmlzaWJsZVxcbiAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ2N1c3RvbURhdGFfJyArIG1kNSh1cmwpLCBKU09OLnN0cmluZ2lmeShydWxlcykpXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICAgICAgfSwgaSwgdXJsKTtcXG4gICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICBjYXNlICfph43mlrDmjpLluo8nOlxcbiAgICAgICAgICAgICAgICBsZXQgc29ydEZsYWcgPSBwYXJzZUludChnZXRNeVZhcignc29ydEZsYWcnLCAnLTEnKSlcXG4gICAgICAgICAgICAgICAgZC50aXRsZSA9IChzb3J0RmxhZyA9PSBpID8gJ/CflIMgICcgOiAnJykgKyBkLnRpdGxlXFxuICAgICAgICAgICAgICAgIGlmIChzb3J0RmxhZyA9PSAtMSlcXG4gICAgICAgICAgICAgICAgICAgIGQudXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdzb3J0RmxhZycsIGkudG9TdHJpbmcoKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6YCJ5oup6KaB56e75Yqo5Yiw55qE5L2N572uJ1xcbiAgICAgICAgICAgICAgICAgICAgfSwgaSlcXG4gICAgICAgICAgICAgICAgZWxzZVxcbiAgICAgICAgICAgICAgICAgICAgZC51cmwgPSAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChvbGRJbmRleCwgbmV3SW5kZXgsIHVybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBydWxlcyA9IEpTT04ucGFyc2UocmVhZEZpbGUoJ2N1c3RvbURhdGFfJyArIG1kNSh1cmwpKSB8fCAnW10nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVzLnNwbGljZShuZXdJbmRleCwgMCwgcnVsZXMuc3BsaWNlKG9sZEluZGV4LCAxKVswXSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZSgnY3VzdG9tRGF0YV8nICsgbWQ1KHVybCksIEpTT04uc3RyaW5naWZ5KHJ1bGVzKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignc29ydEZsYWcnLCAnLTEnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICAgICAgICAgIH0sIHNvcnRGbGFnLCBpLCB1cmwpXFxuICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgY2FzZSAn5pu05pS55Zu+5qCHJzpcXG4gICAgICAgICAgICAgICAgZC51cmwgPSAkKHYuaWNvbiB8fCAnJywgJ+i+k+WFpeaWsOWbvuagh+WcsOWdgOaIluminOiJsuS7o+egge+8micpLmlucHV0KChpLCB1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBydWxlcyA9IEpTT04ucGFyc2UocmVhZEZpbGUoJ2N1c3RvbURhdGFfJyArIG1kNSh1cmwpKSB8fCAnW10nKVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVzW2ldLmljb24gPSBpbnB1dFxcbiAgICAgICAgICAgICAgICAgICAgZWxzZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBydWxlc1tpXS5pY29uXFxuICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZSgnY3VzdG9tRGF0YV8nICsgbWQ1KHVybCksIEpTT04uc3RyaW5naWZ5KHJ1bGVzKSlcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgICAgICAgICB9LCBpLCB1cmwpXFxuICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgY2FzZSAn5a+85YWl5rW36ZiUJzpcXG4gICA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nXS5maW5kKCh2dikgPT4gdi51cmwuc3RhcnRzV2l0aCh2diArICc6Ly8nKSkgfHwgWyd4NV93ZWJ2aWV3X3NpbmdsZScsICdpbnB1dCddLmZpbmQoKHZ2KSA9PiB2LmNvbF90eXBlID09IHZ2KSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdlxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodi51cmwuaW5jbHVkZXMoJ0BydWxlPScpKSB7XFxuICAgICAgICAgICAgICAgIGxldCBbXywgdXJsLCBydWxlXSA9IHYudXJsLm1hdGNoKC9eKFtcXFxcc1xcXFxTXSo/KUBydWxlPShbXFxcXHNcXFxcU10qKSQvKVxcbiAgICAgICAgICAgICAgICB2LnVybCA9IHVybFxcbiAgICAgICAgICAgICAgICBNWV9fUlVMRS5kZXRhaWxfZmluZF9ydWxlID0gcnVsZVxcbiAgICAgICAgICAgICAgICBNWV9fUlVMRS5kZXRhaWxfY29sX3R5cGUgPSBNWV9SVUxFLmNvbF90eXBlXFxuICAgICAgICAgICAgfSBlbHNlIGlmICh2LnVybC5zdGFydHNXaXRoKCdoaWtlcjovL3BhZ2UvJykpIHtcXG4gICAgICAgICAgICAgICAgaWYgKHYudXJsLmluY2x1ZGVzKCdydWxlPScpIHx8IHYuZXh0cmEucnVsZSlcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2XFxuICAgICAgICAgICAgICAgIGxldCBbXywgcGF0aCwgZmxhZywgcGFyYW1zXSA9IHYudXJsLm1hdGNoKC9eaGlrZXI6XFxcXC9cXFxcL3BhZ2VcXFxcLyguKz8pKCMuKj8pPyg/OlxcXFw/KC4qKSk/JC8pLFxcbiAgICAgICAgICAgICAgICAgICAgc3ViUGFnZSA9IE1ZX1JVTEUucGFnZUxpc3QuZmluZCgodikgPT4gdi5wYXRoID09IHBhdGgpLFxcbiAgICAgICAgICAgICAgICAgICAgc3ViVXJsID0gKHBhcmFtcyB8fCAnJykuc3BsaXQoJyYnKS5maW5kKCh2KSA9PiB2LnN0YXJ0c1dpdGgoJ3VybD0nKSlcXG4gICAgICAgICAgICAgICAgdi51cmwgPSAoc3ViVXJsID8gc3ViVXJsLnNsaWNlKDQpLnJlcGxhY2UoL++8n++8ny9nLCAnPycpLnJlcGxhY2UoL++8hu+8hi9nLCAnJicpIDogKHYuZXh0cmEgfHwge30pLnVybCkgfHwgJ2hpa2VyOi8vZW1wdHknICsgZmxhZyArICc/JyArIChwYXJhbXMgfHwgJycpXFxuICAgICAgICAgICAgICAgIE1ZX19SVUxFLmRldGFpbF9maW5kX3J1bGUgPSBzdWJQYWdlLnJ1bGVcXG4gICAgICAgICAgICAgICAgTVlfX1JVTEUuZGV0YWlsX2NvbF90eXBlID0gc3ViUGFnZS5jb2xfdHlwZVxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodi51cmwuaW5jbHVkZXMoJ0BsYXp5UnVsZT0nKSkge1xcbiAgICAgICAgICAgICAgICBsZXQgcmVJbmRleCA9IHYudXJsLmluZGV4T2YoJy5qczonKVxcbiAgICAgICAgICAgICAgICBpZiAocmVJbmRleCA+PSAwKSB2LnVybCA9IHYudXJsLnNsaWNlKDAsIHJlSW5kZXgpICsgJy5qczpcXFxcbmlmKE1ZX1JVTEUpT2JqZWN0LmFzc2lnbihNWV9SVUxFLCAnICsgYXNzaWduTGF6eVJ1bGUgKyAnKTsnICsgdi51cmwuc2xpY2UocmVJbmRleCArIDQpXFxuICAgICAgICAgICAgICAgIHJldHVybiB2XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpc0luZGV4KSB7XFxuICAgICAgICAgICAgICAgIGlmICghTVlfUlVMRS5kZXRhaWxfZmluZF9ydWxlIHx8IC9oaWtlcjpcXFxcL1xcXFwvKD8hZW1wdHkuKyQpLy50ZXN0KHYudXJsKSkgcmV0dXJuIHZcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdlxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB2LmV4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ICh2ID09ICcqJykgcmV0dXJuICcnXFxuICAgICAgICAgICAgICAgICAgICBlbHNlIHYgPSAoaSA9PSAxIHx8IGkgPT0gMykgP1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tKGRhdGEsIHYpIDpcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJzZURvbUZvckh0bWwoZGF0YSwgdilcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpICE9IDMpIHYgPSBydW5Db2RlKHYpXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7IHJldHVybiAnJyB9XFxuICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgcmVzID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBkZXNjLCBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IE1ZX1JVTEUuY29sX3R5cGVcXG4gICAgICAgICAgICB9XFxuICAgICAgICBpZiAocmVzLnVybCkge1xcbiAgICAgICAgICAgIGlmIChyZXMudXJsLmluY2x1ZGVzKCdAbGF6eVJ1bGU9JykpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJlSW5kZXggPSByZXMudXJsLmluZGV4T2YoJy5qczonKVxcbiAgICAgICAgICAgICAgICBpZiAocmVJbmRleCA+PSAwKSByZXMudXJsID0gcmVzLnVybC5zbGljZSgwLCByZUluZGV4KSArICcuanM6XFxcXG5pZihNWV9SVUxFKU9iamVjdC5hc3NpZ24oTVlfUlVMRSwgJyArIGFzc2lnbkxhenlSdWxlICsgJyk7JyArIHJlcy51cmwuc2xpY2UocmVJbmRleCArIDQpXFxuICAgICAgICAgICAgfSBlbHNlICBpZiAoZGV0YWlsRmluZFJ1bGUpIHtcXG4gICAgICAgICAgICAgICAgcmVzLmV4dHJhID0ge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBnZW5FeFVybCh1cmwpLFxcbiAgICAgICAgICAgICAgICAgICAgUlVMRTogT2JqZWN0LmFzc2lnbihnZW5NeVJ1bGUoKSwgeyBkZXRhaWxfZmluZF9ydWxlOiBkZXRhaWxGaW5kUnVsZSB9KSxcXG4gICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogaXNJbmRleCAmJiB0aXRsZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlcy51cmwgPSAnaGlrZXI6Ly9wYWdlL2ZyYW1lTG9hZD9ydWxlPScgKyBRSU5HX1RJVExFXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChNWV9SVUxFLmRldGFpbF9maW5kX3J1bGUpIHtcXG4gICAgICAgICAgICAgICAgcmVzLmV4dHJhID0ge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBnZW5FeFVybCh1cmwpLFxcbiAgICAgICAgICAgICAgICAgICAgUlVMRTogZ2VuTXlSdWxlKCksXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGlzSW5kZXggJiYgdGl0bGVcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXMudXJsID0gJ2hpa2VyOi8vcGFnZS9mcmFtZUxvYWQ/cnVsZT0nICsgUUlOR19USVRMRVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIG15Q29sbGVjdGlvbl9lbC5wdXNoKHJlcylcXG4gICAgfSlcXG4gICAgc2V0UmVzdWx0KG15Q29sbGVjdGlvbl9lbClcXG59XFxuXCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLmlbDmja7ovb3lhaVcIixcInBhdGhcIjpcImRhdGFMb2FkXCIsXCJydWxlXCI6XCIkLmV4cG9ydHMgPSBmdW5jdGlvbihzaG93QWxsKSB7XFxuICAgIGxldCB1cmwgPSBnZXRNeVZhcigncmVtb3RlVXJsJyksXFxuICAgICAgICBk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VybiBkYXRhXFxuICAgIGVsc2UgeyAvLyDlhpnlhaXoh6rlrprkuYnmlbDmja5cXG4gICAgICAgIGxldCBjdXN0b21EYXRhID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnY3VzdG9tRGF0YV8nICsgbWQ1KHVybCkpIHx8ICdbXScpLC8qZ2cqL1xcbiAgICAgICAgICAgIHJld3JpdGVEYXRhID0gW107XFxuICAgICAgICBjdXN0b21EYXRhID0gY3VzdG9tRGF0YS5yZWR1Y2UoKHNlbGYsIHYpID0+IHtcXG4gICAgICAgICAgICBsZXQgaW5kZXggPSBkYXRhLmZpbmRJbmRleCgodnYpID0+IHYudGl0bGUgPT0gdnYudGl0bGUpXFxuICAgICAgICAgICAgaWYgKGluZGV4ID49IDApIHtcXG4gICAgICAgICAgICAgICAgc2VsZi5wdXNoKHYpXFxuICAgICAgICAgICAgICAgIGxldCBydWxlID0gZGF0YS5zcGxpY2UoaW5kZXgsIDEpWzBdXFxuICAgICAgICAgICAgICAgIGlmIChzaG93QWxsIHx8IHYudmlzaWJsZSlcXG4gICAgICAgICAgICAgICAgICAgIHJld3JpdGVEYXRhLnB1c2goT2JqZWN0LmFzc2lnbihydWxlLCB2KSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHNlbGZcXG4gICAgICAgIH0sIFtdKVxcbiAgICAgICAgZGF0YS5mb3JFYWNoKCh2KSA9PiBjdXN0b21EYXRhLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiB2LnRpdGxlLFxcbiAgICAgICAgICAgIHZpc2libGU6IHRydWVcXG4gICAgICAgIH0pKVxcbiAgICAgICAgc2F2ZUZpbGUoJ2N1c3RvbURhdGFfJyArIG1kNSh1cmwpLCBKU09OLnN0cmluZ2lmeShjdXN0b21EYXRhKSkvKmdnKi9cXG4gICAgICAgIHJldHVybiByZXdyaXRlRGF0YS5jb25jYXQoZGF0YSlcXG4gICAgfVxcbn1cIn0se1wiY29sX3R5cGVcIjpcIm1v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5leHRsaW5rO1xcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IHBpYyArICdAUmVmZXJlcj0nLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBzdGF0ZSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdtb3ZpZV8zX21hcnF1ZWUnLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNpbW1lcnNpdmVUaGVtZSNoaWtlcjovL2VtcHR5P2FwcFVybD1cXFwiICsgYXBwVXJsICtcXFwiJmhyZWY9XFxcIiArIGJhc2U2NEVuY29kZSh1cmwpKS5ydWxlKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKGZldGNoKCdoaWtlcjovL3BhZ2UvY3JlYXRvcicpKS5ydWxlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBtb3ZsaXN0KCk7XFxuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9nKFxcXCLlvbHniYfor6bmg4Xlh7rplJk6XFxcIiArIGUubWVzc2FnZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KFtdKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBpdGVtcztcXG4gICAgfTtcXG4gICAgdmFyIGZpbmRfcnVsZSA9IGZ1bmN0aW9uKCkge1xcbiAgICAgICAgbGV0IGl0ZW1zID0gW107XFxuICAgICAgICBpZiAoTVlfUEFHRSA9PSAxKSB7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgbGV0IHR5cGVKc29uID0gSlNPTi5wYXJzZShmZXRjaChhcHBVcmwgKyBcXFwiP2FjPWZsaXR0ZXJcXFwiKSwgeyBoZWFkZXJzOiB7IFxcXCJVc2VyLUFnZW50XFxcIjogYXBwVWEgfSB9KTtcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQga2V5IGluIHR5cGVKc29uKSB7XFxuICAgICAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZToga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiZmxleF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJChcXFwiaGlrZXI6Ly9lbXB0eT9hcHBVcmw9XFxcIiArIGFwcFVybCArICcmcGFnZT1meXBhZ2UmaHJlZj0nICsgYmFzZTY0RW5jb2RlKGFwcFVybCArIFxcXCI/YWM9bGlzdCZjbGFzcz1cXFwiICsga2V5KSkucnVsZSgodHlwZUpzb24sIGFwcFVhKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZExpc3RlbmVyKFxcXCJvbkNsb3NlXFxcIiwgXFxcImNsZWFyVmFyKCdmaWx0ZXInKVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgaXRlbXMgPSBbXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleXMgPSB7fSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5a2V5cyA9IFtdLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsdGVyID0ge30sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xvciA9IFxcXCIjRkE3Mjk4XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaW5kZXggaW4gdHlwZUpzb24pIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlSnNvbltpbmRleF0udmFsdWVzLmxlbmd0aCA9PSAxKSBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBrZXkgPSB0eXBlSnNvbltpbmRleF0uZmllbGQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsdGVyTmFtZSA9IFxcXCLlhajpg6hcXFwiICsgdHlwZUpzb25baW5kZXhdLm5hbWU7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eWtleXMucHVzaChrZXkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5c1tcXFwiZlxcXCIgKyBrZXldID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWx0ZXJbXFxcImZcXFwiICsga2V5XSA9IFtmaWx0ZXJOYW1lXS5jb25jYXQodHlwZUpzb25baW5kZXhdLnZhbHVlcyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFnZXRWYXIoXFxcImZpbHRlclxcXCIsIFxcXCJcXFwiKSkgeyBwdXRWYXIoXFxcImZpbHRlclxcXCIsIEpTT04uc3RyaW5naWZ5KGtleXMpKSB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB0ZW1wID0gSlNPTi5wYXJzZShnZXRWYXIoXFxcImZpbHRlclxcXCIpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1ZX1BBR0UgPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXRlbSBpbiBmaWx0ZXIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpbmRleCA9IDA7IGluZGV4IDwgZmlsdGVyW2l0ZW1dLmxlbmd0aDsgaW5kZXgrKykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0ZW1wW2l0ZW1dID09IFxcXCJcXFwiID8gKGluZGV4ID09PSAwID8gXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBmaWx0ZXJbaXRlbV1bMF0uYm9sZCgpLmZvbnRjb2xvcihjb2xvcikgOiBmaWx0ZXJbaXRlbV1baW5kZXhdKSA6ICh0ZW1wW2l0ZW1dID09IGZpbHRlcltpdGVtXVtpbmRleF0gPyBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIGZpbHRlcltpdGVtXVtpbmRleF0uYm9sZCgpLmZvbnRjb2xvcihjb2xvcikgOiBmaWx0ZXJbaXRlbV1baW5kZXhdKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQoJ2hpa2VyOi8vZW1wdHkjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChkZXMsIG5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdGVtcCA9IEpTT04ucGFyc2UoZ2V0VmFyKFxcXCJmaWx0ZXJcXFwiKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVtcFtuYW1lXSA9IGRlcy5pbmRleE9mKFxcXCLlhajpg6hcXFwiKSAhPSAtMSA/IFxcXCJcXFwiIDogZGVzO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dFZhcihcXFwiZmlsdGVyXFxcIiwgSlNPTi5zdHJpbmdpZnkodGVtcCkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmaWx0ZXJbaXRlbV1baW5kZXhdLCBpdGVtKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHsgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCIgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gYmFzZTY0RGVjb2RlKGdldFBhcmFtKCdocmVmJykpICsgJyZwYWdlPScgKyBNWV9QQUdFICsgXFxcIiZcXFwiICsgdHlrZXlzLm1hcChjdXIgPT4gY3VyICsgXFxcIj1mXFxcIiArIGN1cikuam9pbihcXFwiJlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpdGVtIGluIHRlbXApIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IHVybC5yZXBsYWNlKGl0ZW0sIHRlbXBbaXRlbV0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCByZXNjb2RlID0gZmV0Y2godXJsLCB7IGhlYWRlcnM6IHsgXFxcIlVzZXItQWdlbnRcXFwiOiBhcHBVYSB9IH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzY29kZS5pbmRleE9mKCfmo4DmtYvkuK0nKSAhPSAtMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzY29kZSA9IGZldGNoKHVybCArICcmYnR3YWYnICsgcmVzY29kZS5tYXRjaCgvYnR3YWYoLio/KVxcXFxcXFwiLylbMV0sIHsgaGVhZGVyczogeyBcXFwiVXNlci1BZ2VudFxcXCI6IGFwcFVhIH0gfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGh0bWwgPSBKU09OLnBhcnNlKHJlc2NvZGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKGZldGNoKCdoaWtlcjovL3BhZ2UvY3JlYXRvcicpKS5ydWxlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW1zID0gbGlzdGRhdGEoaXRlbXMsIGh0bWwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2coXFxcIuinhumikeWIl+ihqOWHuumUmTpcXFwiICsgZS5tZXNzYWdlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRSZXN1bHQoaXRlbXMpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHR5cGVKc29uW2tleV0sIGFwcFVhKVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgbG9nKFxcXCLpppbpobXliIbnsbvlh7rplJk6XFxcIiArIGUubWVzc2FnZSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICA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3VybCk7XFxuICAgICAgICAgICAgICAgIGxvZyhcXFwiXFxcXG7osIPnlKjmlq3mj5Lop6PmnpA6XFxcIiArIHZsaW5rKTtcXG4gICAgICAgICAgICAgICAgZXZhbChcXFwibGV0IGNvbmZpZyA9XFxcIiArIGZldGNoKFxcXCJoaWtlcjovL2ZpbGVzL2NhY2hlL015UGFyc2VTZXQuanNvblxcXCIpKTtcXG4gICAgICAgICAgICAgICAgZXZhbChmZXRjaChjb25maWcuY2opKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGF5dG1QYXJzZSh2bGluayk7XFxuICAgICAgICAgICAgfSwgdmxpbmssIHNyY3VybClcXG4gICAgICAgIH0gZWxzZSBpZiAocGFyc2Vtb2RlID09IFxcXCLlvLrliLbnvZHpobXmiZPlvIBcXFwiKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ3ZWI6Ly9cXFwiICsgdmxpbms7XFxuICAgICAgICB9IGVsc2UgaWYgKHBhcnNlbW9kZSA9PSBcXFwi5by65Yi25YaF572u6Kej5p6QXFxcIikge1xcbiAgICAgICAgICAgIHJldHVybiAkKCdoaWtlcjovL2VtcHR5JykubGF6eVJ1bGUoKHZsaW5rKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxvZyhcXFwi5L2/55So5YaF572u6Kej5p6QXFxcIik7XFxuICAgICAgICAgICAgICAgIGxvZyhcXFwi6KeG6aKR6ZO+5o6lOlxcXCIgKyB2bGluayk7XFxuICAgICAgICAgICAgICAgIGV2YWwoSlNPTi5wYXJzZShmZXRjaCgnaGlrZXI6Ly9wYWdlL215UGFyc2UnKSkucnVsZSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBteVBhcnNlKHZsaW5rKTtcXG4gICAgICAgICAgICB9LCB2bGluayk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHJldHVybiAkKFxcXCJoaWtlcjovL2VtcHR5XFxcIikubGF6eVJ1bGUoKHB0YWIsIHNyY3VybCkgPT4ge1xcbiAgICAgICAgICAgICAgICBsb2coXFxcIlxcXFxu6LWE5rqQ6ZO+5o6lOlxcXCIgKyBzcmN1cmwpO1xcbiAgICAgICAgICAgICAgICAvL+WKqOaAgeino+aekOS7o+eggeW8gOWni1xcbiAgICAgICAgICAgICAgICBmdW5jdGlvbiBjaGFuZ2VWaWRlb1VybCh1cmwpIHtcXG4gICAgICAgICAgICAgICAgICAgIC8v5pS55Y+Y54m55a6a5Zyw5Z2A55qEUmVmZXJlclxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5pbmNsdWRlcyhcXFwid2tmaWxlXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwgKyAnO3tSZWZlcmVyQGh0dHBzOi8vZmFudHVhbi53a2ZpbGUuY29tL30nO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwdGFiID09ICdiaWxpYmlsaScpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwgKyAnO3tSZWZlcmVyQGh0dHBzOi8vd3d3LmJpbGliaWxpLmNvbS8mJlVzZXItQWdlbnRATW96aWxsYS81LjB9JztcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAocHRhYiA9PSAnbWd0dicpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwgKyAnO3tSZWZlcmVyQHd3dy5tZ3R2LmNvbSYmVXNlci1BZ2VudEBNb3ppbGxhLzUuMH0nO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh1cmwuaW5jbHVkZXMoXFxcIm9qYmtcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IHVybCArICc7e1JlZmVyZXJAaHR0cHM6Ly9iYWsub2pia2p4LmNvbS99JztcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIC8v6L+U5Zue6KeG6aKR6ZO+5o6lXFxuICAgICAgICAgICAgICAgICAgICBpZiAoIXVybC5pbmNsdWRlcyhcXFwiaHR0cFxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLpk77mjqXkuI3mmK/ku6VodHRw5byA5aS0KOWPr+iDveWKoOWvhuS6hilcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC9cXFxcLm0zdTgvLnRlc3QodXJsKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2FjaGVNM3U4KHVybCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybCArICcjaXNWaWRlbz10cnVlIyc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGxldCBwYXJzZW1vZGUgPSBnZXRNeVZhcihcXFwicGFyc2Vtb2RlXFxcIiwgXFxcIuaZuuiDveivhuWIq+mTvuaOpVxcXCIpO1xcbiAgICAgICAgICAgICAgICBpZiAocGFyc2Vtb2RlID09IFxcXCLlvLrliLbnm7Tpk77miZPlvIBcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjaGFuZ2VWaWRlb1VybChzcmN1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/pk77mjqXkuI3mmK/ku6VodHRw5byA5aS0KOWPr+iDveWKoOWvhuS6hilcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAocGFyc2Vtb2RlID09IFxcXCLmmbrog73or4bliKvpk77mjqVcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC9cXFxcLm0zdTh8XFxcXC5tcDR8b2JqXFxcXC90b3N8bmV0ZWFzZVxcXFwuY29tLy50ZXN0KHNyY3VybCkgJiYgL2h0dHAvLnRlc3Qoc3JjdXJsKSAmJiAhL1xcXFwuaHRtbC8udGVzdChzcmN1cmwpICYmICEvKHVybHx2fHZpZClcXFxcPS8udGVzdChzcmN1cmwpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghL2ZlblxcXFwubGFvZGl8c3VveW9cXFxcLmNjLy50ZXN0KHNyY3VybCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi5qOA5rWL5Yiw6LWE5rqQ5Zyw5Z2A5Y+v6IO95piv6KeG6aKR6ZO+5o6lXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2hhbmdlVmlkZW9Vcmwoc3JjdXJsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIC8vLS0tLeWIhuWJsue6vy0tLS0vL1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKFxcXCLkvb/nlKjoh6rluKbop6PmnpBcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBzY29kZSA9IEpTT04ucGFyc2UoZmV0Y2goc3JjdXJsLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwiVXNlci1BZ2VudFxcXCI6IE1PQklMRV9VQVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVkaXJlY3Q6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHdpdGhTdGF0dXNDb2RlOiB0cnVlXFxuICAgICAgICAgICAgICAgICAgICB9KSk7XFxuICAgICAgICAgICAgICAgICAgICAvL+i/lOWbnumHjeWumuWQkeeahOmTvuaOpSBcXG4gICAgICAgICAgICAgICAgICAgIGlmIChzY29kZS5zdGF0dXNDb2RlID09ICczMDInIHx8IHNjb2RlLnN0YXR1c0NvZGUgPT0gJzMwMScpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcmVkdXJsID0gc2NvZGUuaGVhZGVycy5sb2NhdGlvblswXS5yZXBsYWNlKC9cXFxcXFxcXC9nLCAnJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9nKCfph43lrprlkJE6JyArIHJlZHVybCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEvKHVybHx2aWR8dilcXFxcPS8udGVzdChyZWR1cmwpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjaGFuZ2VWaWRlb1VybChyZWR1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAvKmVsc2UgaWYgKC9cXFxcPWh0dHAvLnRlc3QocmVkdXJsKSAmJiAvXFxcXC5tM3U4fFxcXFwubXA0fFxcXFwuZmx2Ly50ZXN0KHJlZHVybCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVybCA9IHJlZHVybC5zdWJzdHJpbmcocmVkdXJsLmluZGV4T2YoJz1odHRwJykgKyAxKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9Ki9cXG4gICAgICAgICAgICAgICAgICAgICAgICBzY29kZS5ib2R5ID0gZmV0Y2gocmVkdXJsKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIC8v5byA5aeL5ZeF5o6iXFxuICAgICAgICAgICAgICAgICAgICBsZXQgaHRtbCA9IHNjb2RlLmJvZHk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoLzQwNCBOb3QgRm91bmR85aSH5qGI5ZCO5Y+v57un57ut6K6/6ZeuLy50ZXN0KGh0bWwpIHx8IHNjb2RlLnN0YXR1c0NvZGUgPT0gXFxcIjQwNFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIjQwNOS6hlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgvXFxcXDxib2R5Ly50ZXN0KGh0bWwpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoW1xcXCLlvIDlp4vop4bpopHll4XmjqJcXFwiLCBcXFwi5omT5byA6Kej5p6Q572R6aG1XFxcIl0sIDEsIFxcXCLmo4DmtYvliLDop6PmnpDkuLrnvZHpobXmlbDmja5cXFwiKS5zZWxlY3QoKHNyY3VybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gXFxcIuW8gOWni+inhumikeWXheaOolxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmVDYWNoZSgnaHR0cHM6Ly9jb2RlLmFsaXl1bi5jb20vbHprMjM1NTkvUHVibGljUnVsZS9yYXcvbWFzdGVyL3g1cnVsZS5qcycsIDI0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4NXJ1bGUoc3JjdXJsLCBzcmN1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09IFxcXCLmiZPlvIDop6PmnpDnvZHpobVcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcIndlYjovL1xcXCIgKyBzcmN1cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBzcmN1cmwpXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKCflsJ3or5Xku45qc29u5pWw5o2u6I635Y+WJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHB1cmwgPSAnJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uID0gSlNPTi5wYXJzZShodG1sKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoanNvbi51cmwpe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVybCA9IGpzb24udXJsO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoYW5nZVZpZGVvVXJsKHB1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9ZWxzZXtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cmwgPSBqc29uLmRhdGEudXJsO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoYW5nZVZpZGVvVXJsKHB1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKmxldCBwdXJsID0gaHRtbC5tYXRjaCgvW1xcXFwnXFxcXFxcXCJddXJsW1xcXFwnXFxcXFxcXCJdOi4qP1tcXFxcJ1xcXFxcXFwiXSguKj8pW1xcXFwnXFxcXFxcXCJdLylbMV0ucmVwbGFjZSgvXFxcXFxcXFwvZywgJycpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2hhbmdlVmlkZW9VcmwocHVybCk7Ki9cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCfop6PmnpDlj6/og73liqDlr4bkuoYnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZygn5pyq6IO95oiQ5Yqf6I635Y+W6KeG6aKR5Zyw5Z2AOicgKyBlLm1lc3NhZ2UpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBhcnNlbW9kZSA9PSBcXFwi5pm66IO96K+G5Yir6ZO+5o6lXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB2bGluayA9IHNyY3VybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoLyh1cmx8dmlkfHYpXFxcXD0vLnRlc3Qoc3JjdXJsKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2bGluayA9IHNyY3VybC5zdWJzdHJpbmcoc3JjdXJsLnNlYXJjaCgvKHVybHx2aWR8dilcXFxcPS8pKS5zcGxpdCgnPScpWzFdLnNwbGl0KCcmJylbMF07XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi5L2/55So5YaF572u6Kej5p6QXFxcXG7op4bpopHpk77mjqU6XFxcIiArIHZsaW5rKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKEpTT04ucGFyc2UoZmV0Y2goJ2hpa2VyOi8vcGFnZS9jcmVhdG9yJykpLnJ1bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBteVBhcnNlKHZsaW5rKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+acquiDveaIkOWKn+iOt+WPluinhumikeWcsOWdgFxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAvL+WKqOaAgeino+aekOS7o+eggee7k+adn1xcbiAgICAgICAgICAgIH0sIHB0YWIsIHNyY3VybCk7XFxuICAgICAgICB9XFxuICAgIH07XFxufSBlbHNlIHtcXG4gICAgdmFyIGluZGV4ZGF0YSA9IGZ1bmN0aW9uKGl0ZW1zKSB7XFxuICAgICAgICBsZXQgbGlzdCA9IFtdO1xcbiAgICAgICAgaWYgKGFwcFVybC5pbmNsdWRlcygnYXBpLnBocC9hcHAnKSkge1xcbiAgICAgICAgICAgIGxpc3QgPSBodG1sLmxpc3Q7XFxuICAgICAgICB9IGVsc2UgaWYgKGFwcFVybC5pbmNsdWRlcygneGdhcHAnKSkge1xcbiAgICAgICAgICAgIGxpc3QgPSBodG1sLmRhdGE7XFxuICAgICAgICB9IGVsc2UgaWYgKGFwcFVybC5pbmNsdWRlcyhcXFwiLnZvZFxcXCIpKSB7XFxuICAgICAgICAgICAgbGlzdCA9IGh0bWwuZGF0YS5saXN0O1xcbiAgICAgICAgfVxcblxcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgbGV0IGxpc3RzID0gW10sXFxuICAgICAgICAgICAgICAgIHR5cGVuYW1lID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgaWYgKGFwcFVybC5pbmNsdWRlcygnYXBpLnBocC9hcHAnKSB8fCBhcHBVcmwuaW5jbHVkZXMoJ3hnYXBwJykpIHtcXG4gICAgICAgICAgICAgICAgbGlzdHMgPSBsaXN0W2ldLnZsaXN0O1xcbiAgICAgICAgICAgICAgICB0eXBlbmFtZSA9IGxpc3RbaV0udHlwZV9uYW1lO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoYXBwVXJsLmluY2x1ZGVzKFxcXCIudm9kXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgbGlzdHMgPSBsaXN0W2ldLnZvZF9saXN0O1xcbiAgICAgICAgICAgICAgICB0eXBlbmFtZSA9IGxpc3RbaV0udm9kX3R5cGVfbmFtZTtcXG5cXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0eXBlbmFtZSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0XzEnLFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgbGlzdHMubGVuZ3RoOyBqKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IHsgdm9kX25hbWUsIHZvZF9waWMsIHZvZF9pZCwgdm9kX3JlbWFya3MgfSA9IGxpc3RzW2pdO1xcbiAgICAgICAgICAgICAgICBsZXQgbGluayA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgICBpZiAoYXBwVXJsLmluY2x1ZGVzKCdhcGkucGhwL2FwcCcpIHx8IGFwcFVybC5pbmNsdWRlcygneGdhcHAnKSkge1xcbiAgICAgICAgICAgICAgICAgICAgbGluayA9IGFwcFVybCArICd2aWRlb19kZXRhaWw/aWQ9JyArIHZvZF9pZCArICcma2V5PSc7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYXBwVXJsLmluY2x1ZGVzKFxcXCIudm9kXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBkYXRlID0gbmV3IERhdGUoKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBrZXkgPSAnJyArIChkYXRlLmdldE1vbnRoKCkgKyAxKSArIChkYXRlLmdldERhdGUoKSA8IDEwID8gJzAnICsgZGF0ZS5nZXREYXRlKCkgOiBkYXRlLmdldERhdGUoKSk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQga2V5dGltZSA9ICgnJyArIGRhdGUuZ2V0VGltZSgpKS5zbGljZSgwLC0zKTtcXG4gICAgICAgICAgICAgICAgICAgIGxpbmsgPSBhcHBVcmwgKyAnL2RldGFpbD92b2RfaWQ9JyArIHZvZF9pZCArICcma2V5PScgKyBrZXkgKyAnJmtleXRpbWU9JyArIGtleXRpbWU7XFxuICAgICAgICAgICAgICAgIH07XFxuXFxuICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHZvZF9uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogdm9kX3BpYyArICdAUmVmZXJlcj0nLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogdm9kX3JlbWFya3MsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzNfbWFycXVlZScsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNpbW1lcnNpdmVUaGVtZSNoaWtlcjovL2VtcHR5P2FwcFVybD1cXFwiK2FwcFVybCtcXFwiJmhyZWY9XFxcIiArIGJhc2U2NEVuY29kZShsaW5rKSkucnVsZSgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKGZldGNoKCdoaWtlcjovL3BhZ2UvY3JlYXRvcicpKS5ydWxlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbW92bGlzdCgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nKFxcXCLlvbHniYfor6bmg4Xlh7rplJk6XFxcIiArIGUubWVzc2FnZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFJlc3VsdChbXSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIGl0ZW1zO1xcbiAgICB9O1xcbiAgICB2YXIgZmluZF9ydWxlID0gZnVuY3Rpb24oKSB7XFxuICAgICAgICBsZXQgaXRlbXMgPSBbXTtcXG4gICAgICAgIC8v6I635Y+W5YiG57G75YaF5a65XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIGxldCB0eXBlSnNvbiA9IFtdO1xcbiAgICAgICAgICAgIGlmIChhcHBVcmwuaW5jbHVkZXMoXFxcImFwaS5waHAvYXBwXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHR5cGVVcmwgPSBhcHBVcmwgKyBcXFwibmF2XFxcIjtcXG4gICAgICAgICAgICAgICAgbGV0IHR5cGNvZGUgPSByZXF1ZXN0KHR5cGVVcmwsIHsgaGVhZGVyczogeyBcXFwiVXNlci1BZ2VudFxcXCI6IGFwcFVhIH0gfSk7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBjb2RlLmluZGV4T2YoJ+ajgOa1i+S4rScpICE9IC0xKSB7XFxuICAgICAgICAgICAgICAgICAgICB0eXBjb2RlID0gZmV0Y2godHlwZVVybCArICcmYnR3YWYnICsgdHlwY29kZS5tYXRjaCgvYnR3YWYoLio/KVxcXFxcXFwiLylbMV0sIHsgaGVhZGVyczogeyBcXFwiVXNlci1BZ2VudFxcXCI6IGFwcFVhIH0gfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdHlwZUpzb24gPSBKU09OLnBhcnNlKHR5cGNvZGUpLmxpc3Q7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChhcHBVcmwuaW5jbHVkZXMoXFxcInhnYXBwXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHR5cGVVcmwgPSBhcHBVcmwgKyBcXFwibmF2XFxcIjtcXG4gICAgICAgICAgICAgICAgbGV0IHR5cGNvZGUgPSByZXF1ZXN0KHR5cGVVcmwsIHsgaGVhZGVyczogeyBcXFwiVXNlci1BZ2VudFxcXCI6IGFwcFVhIH0gfSk7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBjb2RlLmluZGV4T2YoJ+ajgOa1i+S4rScpICE9IC0xKSB7XFxuICAgICAgICAgICAgICAgICAgICB0eXBjb2RlID0gZmV0Y2godHlwZVVybCArICcmYnR3YWYnICsgdHlwY29kZS5tYXRjaCgvYnR3YWYoLio/KVxcXFxcXFwiLylbMV0sIHsgaGVhZGVyczogeyBcXFwiVXNlci1BZ2VudFxcXCI6IGFwcFVhIH0gfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdHlwZUpzb24gPSBKU09OLnBhcnNlKHR5cGNvZGUpLmRhdGE7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChhcHBVcmwuaW5jbHVkZXMoXFxcIi52b2RcXFwiKSkge1xcbiAgICAgICAgICAgICAgICBsZXQgdHlwZVVybCA9IGFwcFVybCArIFxcXCIvdHlwZXNcXFwiO1xcbiAgICAgICAgICAgICAgICBsZXQgdHlwY29kZSA9IHJlcXVlc3QodHlwZVVybCwgeyBoZWFkZXJzOiB7IFxcXCJVc2VyLUFnZW50XFxcIjogYXBwVWEgfSB9KTtcXG4gICAgICAgICAgICAgICAgaWYgKHR5cGNvZGUuaW5kZXhPZign5qOA5rWL5LitJykgIT0gLTEpIHtcXG4gICAgICAgICAgICAgICAgICAgIHR5cGNvZGUgPSBmZXRjaCh0eXBlVXJsICsgJz9idHdhZicgKyB0eXBjb2RlLm1hdGNoKC9idHdhZiguKj8pXFxcXFxcXCIvKVsxXSwgeyBoZWFkZXJzOiB7IFxcXCJVc2VyLUFnZW50XFxcIjogYXBwVWEgfSB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB0eXBlSnNvbiA9IEpTT04ucGFyc2UodHlwY29kZSkuZGF0YS5saXN0O1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAvL+iOt+WPluWIhuexu+WIl+ihqFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgdHlwZUpzb24ubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgLy/liIbnsbvop4bpopHlnLDlnYBcXG4gICAgICAgICAgICAgICAgbGV0IHR5dXJsID0gXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICB0eXBlQXJyYXkgPSBPYmplY3Qua2V5cyh0eXBlSnNvbltpXS50eXBlX2V4dGVuZCkuZmlsdGVyKGN1ciA9PiBbXFxcImNsYXNzXFxcIiwgXFxcImFyZWFcXFwiLCBcXFwibGFuZ1xcXCIsIFxcXCJ5ZWFyXFxcIl0uaW5jbHVkZXMoY3VyKSksXFxuICAgICAgICAgICAgICAgICAgICB0eXBlVXJsID0gdHlwZUFycmF5Lm1hcChjdXIgPT4gY3VyICsgXFxcIj1mXFxcIiArIGN1cikuam9pbihcXFwiJlxcXCIpO1xcbiAgICAgICAgICAgICAgICBpZiAoYXBwVXJsLmluY2x1ZGVzKCdhcGkucGhwL2FwcCcpKSB7XFxuICAgICAgICAgICAgICAgICAgICB0eXVybCA9IGFwcFVybCArICd2aWRlbz90aWQ9JyArIHR5cGVKc29uW2ldLnR5cGVfaWQgKyAnJicgKyB0eXBlVXJsO1xcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGFwcFVybC5pbmNsdWRlcygneGdhcHAnKSkge1xcbiAgICAgICAgICAgICAgICAgICAgdHl1cmwgPSBhcHBVcmwgKyAndmlkZW8/dGlkPScgKyB0eXBlSnNvbltpXS50eXBlX2lkICsgJyYnICsgdHlwZVVybDtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChhcHBVcmwuaW5jbHVkZXMoXFxcIi52b2RcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgdHl1cmwgPSBhcHBVcmwgKyAnP3R5cGU9JyArIHR5cGVKc29uW2ldLnR5cGVfaWQgKyAnJmJ5PWZieSZsaW1pdD05JicgKyB0eXBlVXJsO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8v5p6E5bu65Yqo5oCB5YiG57G7XFxuICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHR5cGVKc29uW2ldLnR5cGVfbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJChcXFwiaGlrZXI6Ly9lbXB0eT9wYWdlPWZ5cGFnZSZhcHBVcmw9XFxcIithcHBVcmwrXFxcIiZocmVmPVxcXCIgKyBiYXNlNjRFbmNvZGUodHl1cmwpKS5ydWxlKChhcHBVcmwsIHR5cGVfZXh0ZW5kLCAgYXBwVWEpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBhZGRMaXN0ZW5lcihcXFwib25DbG9zZVxcXCIsIFxcXCJjbGVhclZhcignZmlsdGVyJylcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgaXRlbXMgPSBbXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoTVlfUEFHRSA9PSAxKSB7IC8v5Yqo5oCB5YiG57G7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBrZXlzID0ge30sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWx0ZXIgPSB7fSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbHRlck5hbWVzID0geyBjbGFzczogXFxcIuexu+Wei1xcXCIsIGFyZWE6IFxcXCLlnLDljLpcXFwiLCBsYW5nOiBcXFwi6K+t6KiAXFxcIiwgeWVhcjogXFxcIuW5tOS7vVxcXCIsIHN0YXI6IFxcXCLmmI7mmJ9cXFwiLCBkaXJlY3RvcjogXFxcIuWvvOa8lFxcXCIsIHN0YXRlOiBcXFwi54q25oCBXFxcIiwgdmVyc2lvbjogXFxcIueJiOacrFxcXCIgfSxcXG4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aW5jbHVkZXMoa2V5KSkgY29udGludWU7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlzW1xcXCJmXFxcIiArIGtleV0gPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleXNbXFxcImZieVxcXCJdID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZmlsdGVyTmFtZSA9IFxcXCLlhajpg6hcXFwiICsgZmlsdGVyTmFtZXNba2V5XTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbHRlcltcXFwiZlxcXCIgKyBrZXldID0gW2ZpbHRlck5hbWVdLmNvbmNhdCh0eXBlX2V4dGVuZFtrZXldLnNwbGl0KFxcXCIsXFxcIikpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZpbHRlcltcXFwiZlxcXCIgKyBrZXldLmxlbmd0aCA9PSAyKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsdGVyW1xcXCJmXFxcIiArIGtleV0gPSBkZWZhdWx0RmlsdGVyW1xcXCJmXFxcIiArIGtleV1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWdldFZhcihcXFwiZmlsdGVyXFxcIiwgXFxcIlxcXCIpKSB7IHB1dFZhcihcXFwiZmlsdGVyXFxcIiwgSlNPTi5zdHJpbmdpZnkoa2V5cykpIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRlbXAgPSBKU09OLnBhcnNlKGdldFZhcihcXFwiZmlsdGVyXFxcIikpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sb3IgPSBcXFwiI0ZBNzI5OFxcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGl0ZW0gaW4gZmlsdGVyKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpbmRleCA9IDA7IGluZGV4IDwgZmlsdGVyW2l0ZW1dLmxlbmd0aDsgaW5kZXgrKykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGVtcFtpdGVtXSA9PSBcXFwiXFxcIiA/IChpbmRleCA9PT0gMCA/IFxcXCLigJzigJzigJ3igJ1cXFwiICsgZmlsdGVyW2l0ZW1dWzBdLmJvbGQoKS5mb250Y29sb3IoY29sb3IpIDogZmlsdGVyW2l0ZW1dW2luZGV4XSkgOiAodGVtcFtpdGVtXSA9PSBmaWx0ZXJbaXRlbV1baW5kZXhdID8gXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBmaWx0ZXJbaXRlbV1baW5kZXhdLmJvbGQoKS5mb250Y29sb3IoY29sb3IpIDogZmlsdGVyW2l0ZW1dW2luZGV4XSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJCgnaGlrZXI6Ly9lbXB0eSNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGRlcywgbmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHRlbXAgPSBKU09OLnBhcnNlKGdldFZhcihcXFwiZmlsdGVyXFxcIikpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVtcFtuYW1lXSA9IGRlcy5pbmRleE9mKFxcXCLlhajpg6hcXFwiKSAhPSAtMSA/IFxcXCJcXFwiIDogZGVzO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0VmFyKFxcXCJmaWx0ZXJcXFwiLCBKU09OLnN0cmluZ2lmeSh0ZW1wKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZpbHRlcltpdGVtXVtpbmRleF0sIGl0ZW0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goeyBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIiB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBieSA9IHsg6buY6K6k6aG65bqPOiBcXFwiXFxcIiwg5pyA5pawOiBcXFwidGltZVxcXCIsIOacgOeDrTogXFxcImhpdHNcXFwiLCDor4TliIY6IFxcXCJzY29yZVxcXCIgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFwcFVybC5pbmRleE9mKCdhcGkucGhwL2FwcCcpID09IC0xICYmIGFwcFVybC5pbmRleE9mKCd4Z2FwcCcpID09IC0xKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpdGVtIGluIGJ5KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0ZW1wW1xcXCJmYnlcXFwiXSA9PSBieVtpdGVtXSA/IFxcXCLigJzigJzigJ3igJ1cXFwiICsgaXRlbS5ib2xkKCkuZm9udGNvbG9yKGNvbG9yKSA6IGl0ZW0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJCgpLmxhenlSdWxlKChkZXMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB0ZW1wID0gSlNPTi5wYXJzZShnZXRWYXIoXFxcImZpbHRlclxcXCIpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRlbXBbXFxcImZieVxcXCJdID0gZGVzO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0VmFyKFxcXCJmaWx0ZXJcXFwiLCBKU09OLnN0cmluZ2lmeSh0ZW1wKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGJ5W2l0ZW1dKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGVtcCA9IEpTT04ucGFyc2UoZ2V0VmFyKFxcXCJmaWx0ZXJcXFwiKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB1cmwgPSBiYXNlNjREZWNvZGUoZ2V0UGFyYW0oXFxcImhyZWZcXFwiKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXRlbSBpbiB0ZW1wKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IHVybC5yZXBsYWNlKGl0ZW0sIHRlbXBbaXRlbV0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwgKyAoYXBwVXJsLmluY2x1ZGVzKFxcXCIudm9kXFxcIikgPyBcXFwiJnBhZ2U9XFxcIiA6IFxcXCImcGc9XFxcIiApKyBNWV9QQUdFO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByZXNjb2RlID0gZmV0Y2godXJsLCB7IGhlYWRlcnM6IHsgXFxcIlVzZXItQWdlbnRcXFwiOiBhcHBVYSB9IH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXNjb2RlLmluZGV4T2YoJ+ajgOa1i+S4rScpICE9IC0xKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc2NvZGUgPSBmZXRjaCh1cmwgKyAnJmJ0d2FmJyArIHJlc2NvZGUubWF0Y2goL2J0d2FmKC4qPylcXFxcXFxcIi8pWzFdLCB7IGhlYWRlcnM6IHsgXFxcIlVzZXItQWdlbnRcXFwiOiBhcHBVYSB9IH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgaHRtbCA9IEpTT04ucGFyc2UocmVzY29kZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKGZldGNoKCdoaWtlcjovL3BhZ2UvY3JlYXRvcicpKS5ydWxlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRlbXMgPSBsaXN0ZGF0YShpdGVtcywgaHRtbCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2coXFxcIuinhumikeWIl+ihqOWHuumUmTpcXFwiICsgZS50b1N0cmluZygpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KGl0ZW1zKTtcXG4gICAgICAgICAgICAgICAgICAgIH0sIGFwcFVybCwgdHlwZUpzb25baV0udHlwZV9leHRlbmQsIGFwcFVhKSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnZmxleF9idXR0b24nXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGxvZygn6aaW6aG15YiG57G75Ye66ZSZOicgKyBlLm1lc3NhZ2UpO1xcbiAgICAgICAgfVxcbiAgICAgICAgLy/ojrflj5bmjqjojZDop4bpopHliJfooahcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgbGV0IHVybCA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgIGlmIChhcHBVcmwuaW5jbHVkZXMoXFxcImFwaS5waHAvYXBwXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gYXBwVXJsICsgXFxcImluZGV4X3ZpZGVvXFxcIjtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGFwcFVybC5pbmNsdWRlcyhcXFwieGdhcHBcXFwiKSkge1xcbiAgICAgICAgICAgICAgICB1cmwgPSBhcHBVcmwgKyBcXFwiaW5kZXhfdmlkZW9cXFwiO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHVybCA9IGFwcFVybCArIFxcXCIvdm9kUGhiQWxsXFxcIjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KHVybCwgeyBoZWFkZXJzOiB7IFxcXCJVc2VyLUFnZW50XFxcIjogYXBwVWEgfSB9KTtcXG4gICAgICAgICAgICBpZiAoaHRtbC5pbmRleE9mKCfmo4DmtYvkuK0nKSAhPSAtMSkge1xcbiAgICAgICAgICAgICAgICBodG1sID0gZmV0Y2godXJsICsgJyZidHdhZicgKyBodG1sLm1hdGNoKC9idHdhZiguKj8pXFxcXFxcXCIvKVsxXSwgeyBoZWFkZXJzOiB7IFxcXCJVc2VyLUFnZW50XFxcIjogYXBwVWEgfSB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaHRtbCA9IEpTT04ucGFyc2UoaHRtbCk7XFxuICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKGZldGNoKCdoaWtlcjovL3BhZ2UvY3JlYXRvcicpKS5ydWxlKTtcXG4gICAgICAgICAgICBpdGVtcyA9IGluZGV4ZGF0YShpdGVtcywgaHRtbCk7XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgbG9nKCfpppbpobXmjqjojZDlh7rplJk6JyArIGUubWVzc2FnZSk7XFxuICAgICAgICB9XFxuICAgICAgICBzZXRSZXN1bHQoaXRlbXMpO1xcbiAgICB9O1xcblxcbiAgICB2YXIgbGlzdGRhdGEgPSBmdW5jdGlvbihpdGVtcywgaHRtbCkge1xcbiAgICAgICAgbGV0IGxpc3QgPSBbXTtcXG4gICAgICAgIGlmIChhcHBVcmwuaW5jbHVkZXMoJ2FwaS5waHAvYXBwJykpIHtcXG4gICAgICAgICAgICBsaXN0ID0gaHRtbC5saXN0O1xcbiAgICAgICAgfSBlbHNlIGlmIChhcHBVcmwuaW5jbHVkZXMoJ3hnYXBwJykpIHtcXG4gICAgICAgICAgICBsaXN0ID0gaHRtbC5kYXRhO1xcbiAgICAgICAgfSBlbHNlIGlmIChh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U6IHZvZF9uYW1lLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiB2b2RfcGljICsgJ0BSZWZlcmVyPScsXFxuICAgICAgICAgICAgICAgIGRlc2M6IHZvZF9yZW1hcmtzLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzNfbWFycXVlZScsXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiI2ltbWVyc2l2ZVRoZW1lI2hpa2VyOi8vZW1wdHk/YXBwVXJsPVxcXCIrYXBwVXJsK1xcXCImaHJlZj1cXFwiICsgYmFzZTY0RW5jb2RlKGxpbmspKS5ydWxlKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKGZldGNoKCdoaWtlcjovL3BhZ2UvY3JlYXRvcicpKS5ydWxlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBtb3ZsaXN0KCk7XFxuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9nKFxcXCLlvbHniYfor6bmg4Xlh7rplJk6XFxcIiArIGUubWVzc2FnZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KFtdKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBpdGVtcztcXG4gICAgfTtcXG4gICAgdmFyIG1vdmxpc3QgPSBmdW5jdGlvbigpIHtcXG4gICAgICAgIGFkZExpc3RlbmVyKFxcXCJvbkNsb3NlXFxcIiwgJC50b1N0cmluZygodXJsKSA9PiB7XFxuICAgICAgICAgICAgY2xlYXJWYXIoJ2FwcG5vdycpO1xcbiAgICAgICAgICAgIGNsZWFyVmFyKHVybCk7XFxuICAgICAgICAgICAgY2xlYXJNeVZhcignamlleGknKTtcXG4gICAgICAgICAgICBjbGVhck15VmFyKFxcXCJwYXJzZW1vZGVcXFwiKTtcXG4gICAgICAgIH0sIE1ZX1VSTCkpO1xcbiAgICAgICAgbGV0IGl0ZW1zID0gW10sXFxuICAgICAgICAgICAgaHRtbCA9IGdldFZhcihNWV9VUkwsIFxcXCJcXFwiKSxcXG4gICAgICAgICAgICBkYXRhID0ge307XFxuICAgICAgICBpZiAoaHRtbCA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBiYXNlNjREZWNvZGUoZ2V0UGFyYW0oXFxcImhyZWZcXFwiKSk7ICAgICAgICAgICAgXFxuICAgICAgICAgICAgaHRtbCA9IGZldGNoKHVybCwgeyBoZWFkZXJzOiB7IFxcXCJVc2VyLUFnZW50XFxcIjogYXBwVWEgfSB9KTtcXG4gICAgICAgICAgICBwdXRWYXIoTVlfVVJMLCBodG1sKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChhcHBVcmwuaW5jbHVkZXMoXFxcInhnYXBwXFxcIikpIHtcXG4gICAgICAgICAgICBkYXRhID0gSlNPTi5wYXJzZShodG1sKS5kYXRhLnZvZF9pbmZvO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBkYXRhID0gSlNPTi5wYXJzZShodG1sKS5kYXRhO1xcbiAgICAgICAgfVxcblxcbiAgICAgICAgLy/nroDku4tcXG4gICAgICAgIGxldCB7IHZvZF9uYW1lLCB2b2RfcGljLCB2b2RfY29udGVudCwgdm9kX2NsYXNzLCB2b2RfcmVtYXJrcywgdm9kX2RpcmVjdG9yLCB2b2RfYWN0b3IsIHZvZF9hcmVhLCB2b2RfbGFuZywgdm9kX3llYXIgfSA9IGRhdGE7XFxuICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogdm9kX25hbWUgKyAnXFxcXG4nICsgdm9kX2NsYXNzICsgXFxcIixcXFwiICsgdm9kX3JlbWFya3MgKyBcXFwiXFxcXG5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ICAgICAgIGV4dHJhOiB7IGxpbmVWaXNpYmxlOiBmYWxzZSB9XFxuICAgICAgICB9KTtcXG4gICAgICAgIC8v57q/6Lev5YiX6KGoXFxuICAgICAgICBsZXQgY29udHMgPSBbXSxcXG4gICAgICAgICAgICB0YWJzID0gW107XFxuICAgICAgICBpZiAoYXBwVXJsLmluY2x1ZGVzKFxcXCJhcGkucGhwL2FwcFxcXCIpIHx8IGFwcFVybC5pbmNsdWRlcyhcXFwieGdhcHBcXFwiKSkge1xcbiAgICAgICAgICAgIGNvbnRzID0gZGF0YS52b2RfdXJsX3dpdGhfcGxheWVyO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBjb250cyA9IGRhdGEudm9kX3BsYXlfbGlzdDtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmICghY29udHMgfHwgY29udHMubGVuZ3RoIDwgMSkge1xcbiAgICAgICAgICAgIGNvbnRzID0gZGF0YS52b2RfcGxheV91cmwuc3BsaXQoJyQkJCcpO1xcbiAgICAgICAgICAgIHRhYnMgPSBkYXRhLnZvZF9wbGF5X2Zyb20uc3BsaXQoJyQkJCcpO1xcbiAgICAgICAgfVxcbiAgICAgICAgLy/orr7nva7poblcXG4gICAgICAgIGxldCBwYXJzZW1vZGUgPSBnZXRNeVZhcihcXFwicGFyc2Vtb2RlXFxcIiwgXFxcIuaZuuiDveivhuWIq+mTvuaOpVxcXCIpLFxcbiAgICAgICAgICAgIHNlbHMgPSBbXFxcIuaZuuiDveivhuWIq+mTvuaOpVxcXCIsIFxcXCLlvLrliLboh6rluKbop6PmnpBcXFwiLCBcXFwi5by65Yi25pat5o+S6Kej5p6QXFxcIiwgXFxcIuW8uuWItuWGhee9ruino+aekFxcXCIsIFxcXCLlvLrliLbnm7Tpk77miZPlvIBcXFwiLCBcXFwi5by65Yi2572R6aG15omT5byAXFxcIiwn5aSN5Yi25o6l5Y+j5Zyw5Z2AJ107XFxuICAgICAgICBmb3IgKGxldCBpIGluIHNlbHMpIHtcXG4gICAgICAgICAgICBpZiAoc2Vsc1tpXSA9PSBwYXJzZW1vZGUpIHsgc2Vsc1tpXSA9IFxcXCLinaTvuI9cXFwiICsgc2Vsc1tpXSB9XFxuICAgICAgICB9XFxuICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuino+aekOiuvue9rlxcXCIsXFxuICAgICAgICAgICAgcGljX3VybDogJ2h0dHBzOi8vbGFubWVpZ3VvamlhbmcuY29tL3R1Ymlhby9tZXNzeS8zNy5zdmcnLFxcbiAgICAgICAgICAgIHVybDogJChzZWxzLCAxLCBcXFwi6K+36YCJ5oupXFxcIikuc2VsZWN0KChhcHBVcmwpID0+IHtcXG4gICAgICAgICAgICAgICAgaWYoaW5wdXQgPT0gJ+WkjeWItuaOpeWPo+WcsOWdgCcpe3JldHVybiAnY29weTovLycgK2FwcFVybH1cXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcInBhcnNlbW9kZVxcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgIH0sYXBwVXJsKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2ljb25fc21hbGxfMydcXG4gICAgICAgIH0pO1xcbiAgICAgICAgbGV0IHNvcnRtb2RlID0gZ2V0VmFyKCdhcHBtYXBwc29ydCcsICcxJyk7XFxuICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuWIl+ihqFxcXCIgKyAoc29ydG1vZGUgPT0gJzEnID8gJ+ato+W6jycgOiAn6YCG5bqPJyksXFxuICAgICAgICAgICAgcGljX3VybDogJ2h0dHBzOi8vbGFubWVpZ3VvamlhbmcuY29tL3R1Ymlhby9xLzEyNy5wbmcnLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8v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cXFwieGdhcHBcXFwiKSkge1xcbiAgICAgICAgICAgIGxpc3QgPSBjb250c1tpbmRleF0udXJsLnNwbGl0KFxcXCIjXFxcIik7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIGxpc3QgPSBjb250c1tpbmRleF0udXJscyA/IGNvbnRzW2luZGV4XS51cmxzIDogY29udHNbaW5kZXhdLnVybC5zcGxpdChcXFwiI1xcXCIpO1xcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgbGlzdCA9IGNvbnRzW2luZGV4XS5zcGxpdCgnIycpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH07XFxuICAgICAgICBpZiAoZ2V0VmFyKCdhcHBtYXBwc29ydCcsICcxJykgPT0gJzAnKSB7XFxuICAgICAgICAgICAgbGlzdC5yZXZlcnNlKCk7XFxuICAgICAgICB9XFxuICAgICAgICAvL+ino+aekOaOpeWPo1xcbiAgICAgICAgbGV0IGppZWsgPSBbXTtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgaWYgKGFwcFVybC5pbmNsdWRlcyhcXFwiYXBpLnBocC9hcHBcXFwiKSB8fCBhcHBVcmwuaW5jbHVkZXMoXFxcInhnYXBwXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgamllay5wdXNoKGNvbnRzW2luZGV4XS5wYXJzZV9hcGkgfHwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGppZWsgPSAoY29udHNbaW5kZXhdLnBsYXllcl9pbmZvLnBhcnNlMiB8fCBcXFwiXFxcIikuc3BsaXQoXFxcIixcXFwiKS5jb25jYXQoKGNvbnRzW2luZGV4XS5wbGF5ZXJfaW5mby5wYXJzZSB8fCBcXFwiXFxcIikuc3BsaXQoXFxcIixcXFwiKSk7XFxuICAgICAgICAgICAgICAgIGppZWsgPSBqaWVrLm1hcChjdXIgPT4gY3VyLnJlcGxhY2UoXFxcIi4uXFxcIiwgXFxcIi5cXFwiKS5yZXBsYWNlKCdqc29uYnMnLCAnJykpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGUpIHt9XFxuICAgICAgICBqaWVrID0gQXJyYXkuZnJvbShuZXcgU2V0KGppZWsuZmlsdGVyKGN1ciA9PiAhIWN1cikpKTtcXG4gICAgICAgIGlmIChqaWVrLmxlbmd0aCA9PSAwKSBqaWVrLnB1c2goJycpO1xcbiAgICAgICAgaWYgKFtcXFwi5pm66IO96K+G5Yir6ZO+5o6lXFxcIiwgXFxcIuW8uuWItuiHquW4puino+aekFxcXCJdLmluY2x1ZGVzKHBhcnNlbW9kZSkpIHtcXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICflvZPliY3op6PmnpA6JyArIGdldE15VmFyKCdqaWV4aScsIGppZWtbMF0pLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoamllaywgMSkuc2VsZWN0KCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdqaWV4aScsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/lt7Lmm7TmlLnop6PmnpAnXFxuICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfMScsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7IGxpbmVWaXNpYmxlOiBmYWxzZSB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG5cXG4gICAgICAgIGxldCBqeFVybCA9IGdldE15VmFyKCdqaWV4aScsIGppZWtbMF0pIHx8IFxcXCJcXFwiO1xcbiAgICAgICAgLy/op4bpopHliJfooahcXG4gICAgICAgIGV2YWwoSlNPTi5wYXJzZShmZXRjaCgnaGlrZXI6Ly9wYWdlL2NyZWF0b3InKSkucnVsZSk7XFxuICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGxpc3QubGVuZ3RoOyBqKyspIHtcXG4gICAgICAgICAgICBsZXQgdmxpbmsgPSBcXFwiXFxcIixcXG4gICAgICAgICAgICAgICAgdGl0bGUgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICBpZiAobGlzdFtqXS51cmwpIHtcXG4gICAgICAgICAgICAgICAgdmxpbmsgPSBsaXN0W2pdLnVybC5yZXBsYWNlKC8jNDU2Iy9nLCAnaHR0cCcpLnJlcGxhY2UoLyMxMjMjL2csICcuJykucmVwbGFjZSgvIzc4OSMvZywgJzonKTtcXG4gICAgICAgICAgICAgICAgdGl0bGUgPSBsaXN0W2pdLm5hbWU7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdmxpbmsgPSBsaXN0W2pdLnNwbGl0KFxcXCIkXFxcIilbMV07XFxuICAgICAgICAgICAgICAgIHRpdGxlID0gbGlzdFtqXS5zcGxpdChcXFwiJFxcXCIpWzBdO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfNFxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogbGF6eVBhcnNlKHZsaW5rLCBqeFVybClcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIHNldFJlc3VsdChpdGVtcyk7XFxuICAgIH07XFxuXFxuICAgIHZhciBsYXp5UGFyc2UgPSBmdW5jdGlvbih2bGluaywganhVcmwpIHtcXG4gICAgICAgIGxldCBwYXJzZW1vZGUgPSBnZXRNeVZhcihcXFwicGFyc2Vtb2RlXFxcIiwgXFxcIuaZuuiDveivhuWIq+mTvuaOpVxcXCIpXFxuICAgICAg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1xcbiAgICAgICAgICAgIHJldHVybiAkKCdoaWtlcjovL2VtcHR5JykubGF6eVJ1bGUoKHZsaW5rKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxvZyhcXFwiXFxcXG7otYTmupDpk77mjqU6XFxcIiArIHZsaW5rKTtcXG4gICAgICAgICAgICAgICAgbG9nKFxcXCLkvb/nlKjlhoXnva7op6PmnpBcXFwiKTtcXG4gICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKGZldGNoKCdoaWtlcjovL3BhZ2UvbXlQYXJzZScpKS5ydWxlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIG15UGFyc2UodmxpbmspO1xcbiAgICAgICAgICAgIH0sIHZsaW5rKVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICByZXR1cm4gJCgnaGlrZXI6Ly9lbXB0eScpLmxhenlSdWxlKChwdGFiLCB2bGluaywganhVcmwpID0+IHtcXG4gICAgICAgICAgICAgICAgbG9nKFxcXCJcXFxcbui1hOa6kOmTvuaOpTpcXFwiICsgdmxpbmspO1xcbiAgICAgICAgICAgICAgICAvL+inhumikemTvuaOpeWkhOeQhlxcbiAgICAgICAgICAgICAgICBmdW5jdGlvbiBjaGFuZ2VWaWRlb1VybCh1cmwpIHtcXG4gICAgICAgICAgICAgICAgICAgIC8v5pS55Y+Y54m55a6a5Zyw5Z2A55qEUmVmZXJlclxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5pbmNsdWRlcyhcXFwid2tmaWxlXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwgKyAnO3tSZWZlcmVyQGh0dHBzOi8vZmFudHVhbi53a2ZpbGUuY29tL30nO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwdGFiID09ICdiaWxpYmlsaScpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwgKyAnO3tSZWZlcmVyQGh0dHBzOi8vd3d3LmJpbGliaWxpLmNvbS8mJlVzZXItQWdlbnRATW96aWxsYS81LjB9JztcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAocHRhYiA9PSAnbWd0dicpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwgKyAnO3tSZWZlcmVyQHd3dy5tZ3R2LmNvbSYmVXNlci1BZ2VudEBNb3ppbGxhLzUuMH0nO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgLy/ov5Tlm57op4bpopHpk77mjqVcXG4gICAgICAgICAgICAgICAgICAgIGlmICghdXJsLmluY2x1ZGVzKFxcXCJodHRwXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIumTvuaOpeS4jeaYr+S7pWh0dHDlvIDlpLQo5Y+v6IO95Yqg5a+G5LqGKVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoL1xcXFwubTN1OC8udGVzdCh1cmwpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjYWNoZU0zdTgodXJsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXJsICsgJyNpc1ZpZGVvPXRydWUjJztcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgbGV0IHBhcnNlbW9kZSA9IGdldE15VmFyKFxcXCJwYXJzZW1vZGVcXFwiLCBcXFwi5pm66IO96K+G5Yir6ZO+5o6lXFxcIik7XFxuICAgICAgICAgICAgICAgIGlmIChwYXJzZW1vZGUgPT0gXFxcIuW8uuWItuebtOmTvuaJk+W8gFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoYW5nZVZpZGVvVXJsKHZsaW5rKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6ZO+5o6l5LiN5piv5LulaHR0cOW8gOWktCjlj6/og73liqDlr4bkuoYpXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAvL+WKqOaAgeino+aekOS7o+eggeW8gOWni1xcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgLy/lpITnkIbop4bpopHmoLflvI/nmoTotYTmupDpk77mjqVcXG4gICAgICAgICAgICAgICAgICAgIGlmIChwYXJzZW1vZGUgPT0gXFxcIuaZuuiDveivhuWIq+mTvuaOpVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoL1xcXFwubTN1OHxcXFxcLm1wNHxvYmpcXFxcL3Rvc3xuZXRlYXNlXFxcXC5jb20vLnRlc3QodmxpbmspICYmIC9odHRwLy50ZXN0KHZsaW5rKSAmJiAhL1xcXFwuaHRtbC8udGVzdCh2bGluaykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEvZmVuXFxcXC5sYW9kaXxzdW95b1xcXFwuY2MvLnRlc3QodmxpbmspKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2coXFxcIuajgOa1i+WIsOi1hOa6kOWcsOWdgOWPr+iDveaYr+inhumikemTvuaOpVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoYW5nZVZpZGVvVXJsKHZsaW5rKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIC8v5peg5Y+v55So6Kej5p6Q55u05o6l5oql6ZSZXFxuICAgICAgICAgICAgICAgICAgICBpZiAoIWp4VXJsIHx8IC94XFxcXC1uXFxcXC5jYy8udGVzdChqeFVybCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIuaXoOWPr+eUqOino+aekFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgLy/kvb/nlKjop6PmnpBcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi5L2/55So6Kej5p6QOlxcXCIgKyBqeFVybCk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgbGluayA9IGp4VXJsICsgdmxpbmssXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2NvZGUgPSBKU09OLnBhcnNlKGZldGNoKGxpbmssIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcIlVzZXItQWdlbnRcXFwiOiBcXFwiRGFydC8yLjEzIChkYXJ0OmlvKVxcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVkaXJlY3Q6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aXRoU3RhdHVzQ29kZTogdHJ1ZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTtcXG4gICAgICAgICAgICAgICAgICAgIC8v6L+U5Zue6YeN5a6a5ZCR55qE6ZO+5o6lIFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNjb2RlLnN0YXR1c0NvZGUgPT0gJzMwMicgfHwgc2NvZGUuc3RhdHVzQ29kZSA9PSAnMzAxJykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByZWR1cmwgPSBzY29kZS5oZWFkZXJzLmxvY2F0aW9uWzBdLnJlcGxhY2UoL1xcXFxcXFxcL2csICcnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsb2coJ+mHjeWumuWQkTonICsgcmVkdXJsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIS8odXJsfHZpZHx2KVxcXFw9Ly50ZXN0KHJlZHVybCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoYW5nZVZpZGVvVXJsKHJlZHVybCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb2RlLmJvZHkgPSBmZXRjaChyZWR1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgLy/lvIDlp4vll4XmjqJcXG4gICAgICAgICAgICAgICAgICAgIGxldCBodG1sID0gc2NvZGUuYm9keTtcXG4gICAgICAgICAgICAgICAgICAgIGlmICgvNDA0IE5vdCBGb3VuZHzlpIfmoYjlkI7lj6/nu6fnu63orr/pl64vLnRlc3QoaHRtbCkgfHwgc2NvZGUuc3RhdHVzQ29kZSA9PSBcXFwiNDA0XFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwiNDA05LqGXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKC9cXFxcPGJvZHkvLnRlc3QoaHRtbCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChbXFxcIuW8gOWni+inhumikeWXheaOolxcXCIsIFxcXCLmiZPlvIDop6PmnpDnvZHpobVcXFwiXSwgMSwgXFxcIuajgOa1i+WIsOino+aekOS4uue9kemhteaVsOaNrlxcXCIpLnNlbGVjdCgobGluaykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gXFxcIuW8gOWni+inhumikeWXheaOolxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmVDYWNoZSgnaHR0cHM6Ly9jb2RlLmFsaXl1bi5jb20vbHprMjM1NTkvUHVibGljUnVsZS9yYXcvbWFzdGVyL3g1cnVsZS5qcycsIDI0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4NXJ1bGUobGluaywgbGluayk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT0gXFxcIuaJk+W8gOino+aekOe9kemhtVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwid2ViOi8vXFxcIiArIGxpbms7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBsaW5rKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9nKCflsJ3or5Xku6Vqc29u5qC85byP6I635Y+W6KeG6aKR6ZO+5o6lJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHB1cmwgPSBKU09OLnBhcnNlKGh0bWwpLnVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoYW5nZVZpZGVvVXJsKHB1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCfop6PmnpDlj6/og73liqDlr4bkuoYnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZygnXFxcXG7mnKrog73miJDlip/ojrflj5bop4bpopHlnLDlnYA6JyArIGUubWVzc2FnZSk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAocGFyc2Vtb2RlID09IFxcXCLmmbrog73or4bliKvpk77mjqVcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9nKFxcXCLkvb/nlKjlhoXnva7op6PmnpBcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKEpTT04ucGFyc2UoZmV0Y2goJ2hpa2VyOi8vcGFnZS9jcmVhdG9yJykpLnJ1bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBteVBhcnNlKHZsaW5rKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+acquiDveaIkOWKn+iOt+WPluinhumikeWcsOWdgFxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAvL+WKqOaAgeino+aekOS7o+eggee7k+adn1xcbiAgICAgICAgICAgIH0sIHB0YWIsIHZsaW5rLCBqeFVybCk7XFxuICAgICAgICB9XFxuICAgIH07XFxufVxcblxcbnNlYXJjaEZpbmQgPSBmdW5jdGlvbigpIHtcXG4gICAgbGV0IGl0ZW1zID0gW10sXFxuICAgICAgICBzZWFyY2hfdXJsID0gXFxcIlxcXCIsXFxuICAgICAgICBiaHRtbCA9IFxcXCJcXFwiLFxcbiAgICAgICAgd29yZCA9IGdldFBhcmFtKFxcXCJ3b3JkXFxcIikvKixcXG4gICAgICAgIGFwcFVybCA9IGdldFBhcmFtKFxcXCJocmVmXFxcIikqLztcXG4gICAgaWYgKGFwcFVybC5pbmNsdWRlcyhcXFwiL3ZvZFxcXCIpKSB7XFxuICAgICAgICBpZiAoL2hmeXM4fHR2enkuXFxcXGNjfDE3NVxcXFwuMTc4XFxcXC43XFxcXC4zNXxqcHN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sID0gYXBwVXJsICsgJy9kZXRhaWw/dm9kX2lkPScgKyBsaXN0W2ldLnZvZF9pZCArICcma2V5PScgKyBrZXkgKyAnJmtleXRpbWU9JyArIGtleXRpbWU7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcblxcbiAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgIHBpY191cmw6IHBpYyArICdAUmVmZXJlcj0nLFxcbiAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdtb3ZpZV8xX3ZlcnRpY2FsX3BpYycsXFxuICAgICAgICAgICAgdXJsOiAkKFxcXCIjaW1tZXJzaXZlVGhlbWUjaGlrZXI6Ly9lbXB0eT9hcHBVcmw9XFxcIithcHBVcmwrXFxcIiZocmVmPVxcXCIgKyBiYXNlNjRFbmNvZGUodXJsKSkucnVsZSgoKSA9PiB7XFxuICAgICAgICAgICAgICAgIGV2YWwoSlNPTi5wYXJzZShmZXRjaCgnaGlrZXI6Ly9wYWdlL2NyZWF0b3InKSkucnVsZSk7XFxuICAgICAgICAgICAgICAgIG1vdmxpc3QoKTtcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSk7XFxuICAgIH1cXG5cXG4gICAgc2V0UmVzdWx0KGl0ZW1zKTtcXG59O1xcblxcbmxhc3RfY2hhcHRlcl9ydWxlID0gZnVuY3Rpb24oKSB7XFxuICAgIGxldCBjaHAgPSBbXTtcXG4gICAgdHJ5IHtcXG4gICAgICAgIGxldCBjb250cyA9IFtdLFxcbiAgICAgICAgICAgIGh0bWwgPSBKU09OLnBhcnNlKGZldGNoKGdldFBhcmFtKFxcXCJocmVmXFxcIiksIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIlVzZXItQWdlbnRcXFwiOiBhcHBVYVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgaWYgKGFwcFVybC5pbmNsdWRlcyhcXFwiL3ZvZFxcXCIpKSB7XFxuICAgICAgICAgICAgY29udHMgPSBPYmplY3Qua2V5cyhodG1sLnZpZGVvbGlzdCk7XFxuICAgICAgICB9IGVsc2UgaWYgKGFwcFVybC5pbmNsdWRlcyhcXFwiYXBpLnBocC9hcHBcXFwiKSkge1xcbiAgICAgICAgICAgIGNvbnRzID0gaHRtbC5kYXRhLnZvZF91cmxfd2l0aF9wbGF5ZXI7XFxuICAgICAgICAgICAgaWYgKGNvbnRzLmxlbmd0aCA8IDEpIHtcXG4gICAgICAgICAgICAgICAgY29udHMgPSBodG1sLmRhdGEudm9kX3BsYXlfdXJsLnNwbGl0KCckJCQnKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2UgaWYgKGFwcFVybC5pbmNsdWRlcyhcXFwieGdhcHBcXFwiKSkge1xcbiAgICAgICAgICAgIGNvbnRzID0gaHRtbC5kYXRhLnZvZF9pbmZvLnZvZF91cmxfd2l0aF9wbGF5ZXI7XFxuICAgICAgICAgICAgaWYgKGNvbnRzLmxlbmd0aCA8IDEpIHtcXG4gICAgICAgICAgICAgICAgY29udHMgPSBodG1sLmRhdGEudm9kX2luZm8udm9kX3BsYXlfdXJsLnNwbGl0KCckJCQnKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGNvbnRzID0gaHRtbC5kYXRhLnZvZF9wbGF5X2xpc3Q7XFxuICAgICAgICAgICAgaWYgKGNvbnRzLmxlbmd0aCA8IDEpIHtcXG4gICAgICAgICAgICAgICAgY29udHMgPSBodG1sLmRhdGEudm9kX3BsYXlfdXJsLnNwbGl0KCckJCQnKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuXFxuICAgICAgICBsZXQgbGlzdCA9IFtdO1xcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBjb250cy5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgIGlmIChhcHBVcmwuaW5jbHVkZXMoXFxcIi92b2RcXFwiKSkge1xcbiAgICAgICAgICAgICAgICBsaXN0ID0gaHRtbC52aWRlb2xpc3RbY29udHNbaV1dO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY29udHNbaV0udXJscykge1xcbiAgICAgICAgICAgICAgICBsaXN0ID0gY29udHNbaV0udXJscztcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNvbnRzW2ldLnVybCkge1xcbiAgICAgICAgICAgICAgICBsaXN0ID0gY29udHNbaV0udXJsLnNwbGl0KFxcXCIjXFxcIik7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgbGlzdCA9IGNvbnRzW2ldLnNwbGl0KFxcXCIjXFxcIik7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGNocC5wdXNoKGxpc3QubGVuZ3RoKTtcXG4gICAgICAgIH1cXG4gICAgfSBjYXRjaCAoZSkge31cXG4gICAgc2V0UmVzdWx0KCfmm7TmlrDoh7M6JyArIChNYXRoLm1heC5hcHBseShNYXRoLCBjaHApKSk7XFxufTtcIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIueUn+aIkOinhOWImeWIl+ihqFwiLFwicGF0aFwiOlwiYXBwSnNvblwiLFwicnVsZVwiOlwiZnVuY3Rpb24gZ2V0UnVsZXMocmVtb3RlRGF0YSkge1xcbiAgICBsZXQgcnVsZXMgPSBbXSxcXG4gICAgICAgICBkYXRhID0gW10sXFxuICAgICAgICAgYXBwU3ViID0gSlNPTi5wYXJzZShyZWFkRmlsZShcXFwiYXBwU3ViXFxcIikgfHwgJ1tdJykuZmlsdGVyKHYgPT4gIXYuaW5WaXNpYmxlKSxcXG4gICAgICAgICBzdWJub3cgPSBwYXJzZUludChnZXRJdGVtKCdzdWJub3cnLCcnKSk7XFxuICAgIGlmKHN1Ym5vdyA9PT0gX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jovL3BhZ2UvZWRpdFxcXCI7XFxuICAgICAgICB9KVxcbiAgICB9KTtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBcXFwi5a+85YWl6K6i6ZiFXFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIixcXG4gICAgICAgIHVybDogJCgnJykuaW5wdXQoKCkgPT4ge1xcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIGlucHV0ID0gaW5wdXQudHJpbSgpO1xcbiAgICAgICAgICAgICAgICBsZXQgaHJlZiA9IGlucHV0Lm1hdGNoKC/ovbvorqLpmIU6Lio/XFxcXG4oaHR0cC4qPykoPzpcXFxcbnwkKS8pWzFdLFxcbiAgICAgICAgICAgICAgICAgICAgdGV4dCA9IHBhcnNlUGFzdGUoaHJlZiksXFxuICAgICAgICAgICAgICAgICAgICBbdHlwZSwgbmFtZSwgdXJsLCBjb2RlLCBdID0gdGV4dC5zcGxpdCgn4piF4piF4piFJyk7XFxuICAgICAgICAgICAgICAgIHB1dFZhcignbmFtZScsIG5hbWUpO1xcbiAgICAgICAgICAgICAgICBwdXRWYXIoJ3VybCcsIHVybCk7XFxuICAgICAgICAgICAgICAgIHB1dFZhcignY29kZScsIGNvZGUpO1xcbiAgICAgICAgICAgICAgICBwdXRWYXIoJ3R5cGUnLCB0eXBlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvZWRpdFxcXCI7XFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5qC85byP5LiN5a+5JztcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9KTtcXG4gICAgLy/nrqHnkIborqLpmIUo5Yig6Zmk44CB5o6S5bqPKVxcbiAgICBbJ+e8lui+kScsICflkK/lgZwnLCAgJ+WIoOmZpCcsICfmjpLluo8nLCAn5a+85Ye6JywgJ+afpeeciyddLmZvckVhY2goKHYpID0+IHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IHYgPT0gc3ViRWRpdE1vZGUgPyAn4oCc4oCc4oCd4oCdJyArIHYuYm9sZCgpLmZvbnRjb2xvcignIzEyYjY2OCcpIDogdixcXG4gICAgICAgICAgICB1cmw6IHYgPT0gc3ViRWRpdE1vZGUgPyAnaGlrZXI6Ly9lbXB0eScgOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKCh2KSA9PiB7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCdzdWJFZGl0TW9kZScsIHYpO1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSc7XFxuICAgICAgICAgICAgfSwgdiksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJ1xcbiAgICAgICAgfSlcXG4gICAgfSk7XFxuICAgIEpTT04ucGFyc2UocmVhZEZpbGUoJ2FwcFN1YicpIHx8IFxcXCJbXVxcXCIpLmZvckVhY2goKHYsIGkpID0+IHtcXG4gICAgICAgIGxldCBpdGVtID0ge1xcbiAgICAgICAgICAgIHRpdGxlOiB2Lm5hbWUsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzNcXFwiXFxuICAgICAgICB9O1xcbiAgICAgICAgc3dpdGNoIChzdWJFZGl0TW9kZSkge1xcbiAgICAgICAgICAgIGNhc2UgJ+e8lui+kSc6XFxuICAgICAgICAgICAgICAgIGl0ZW0udXJsID0gJCgpLmxhenlSdWxlKCh2LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBwdXRWYXIoJ25hbWUnLCB2Lm5hbWUpO1xcbiAgICAgICAgICAgICAgICAgICAgcHV0VmFyKCd1cmwnLCB2LnVybCk7XFxuICAgICAgICAgICAgICAgICAgICBwdXRWYXIoJ2NvZGUnLCB2LmNvZGUpO1xcbiAgICAgICAgICAgICAgICAgICAgcHV0VmFyKCd0eXBlJywgdi50eXBlKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL2VkaXQ/bW9kZT3nvJbovpEmaW5kZXg9XFxcIiArIGk7XFxuICAgICAgICAgICAgICAgIH0sIHYsIGkpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlICflkK/lgZwnOlxcbiAgICAgICAgICAgICAgICBpdGVtLnRpdGxlID0gKHYuaW5WaXNpYmxlID8gJ/CflLQnIDogJ/Cfn6InKSArIGl0ZW0udGl0bGU7XFxuICAgICAgICAgICAgICAgIGl0ZW0udXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoaSk9PntcXG4gICAgICAgICAgICAgICAgICAgIGxldCBzdWJzY3JpcHRpb25zID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnYXBwU3ViJykgfHwgXFxcIltdXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBzdWJzY3JpcHRpb25zW2ldLmluVmlzaWJsZSA9ICFzdWJzY3JpcHRpb25zW2ldLmluVmlzaWJsZTtcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKCdhcHBTdWInLCBKU09OLnN0cmluZ2lmeShzdWJzY3JpcHRpb25zKSk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknO1xcbiAgICAgICAgICAgICAgICB9LGkpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlICfliKDpmaQnOlxcbiAgICAgICAgICAgICAgICBpdGVtLnVybCA9ICQoJ+ehruWumuWIoOmZpOKAnCcgKyB2Lm5hbWUgKyAn4oCd6K6i6ZiFPycpLmNvbmZpcm0oKGksdikgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHN1YnNjcmlwdGlvbnMgPSBKU09OLnBhcnNlKHJlYWRGaWxlKCdhcHBTdWInKSB8fCBcXFwiW11cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIHN1YnNjcmlwdGlvbnMuc3BsaWNlKGksIDEpO1xcbiAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ2FwcFN1YicsIEpTT04uc3RyaW5naWZ5KHN1YnNjcmlwdGlvbnMpKTtcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZUNhY2hlKHYudXJsKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSc7XFxuICAgICAgICAgICAgICAgIH0sIGksIHYpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlICfmjpLluo8nOlxcbiAgICAgICAgICAgICAgICBsZXQgc29ydEZsYWcgPSBwYXJzZUludChnZXRNeVZhcignYXBwU29ydEZsYWcnLCAnLTEnKSk7XFxuICAgICAgICAgICAgICAgIGl0ZW0udGl0bGUgPSAoc29ydEZsYWcgPT0gaSA/ICfwn5SDICAnIDogJycpICsgaXRlbS50aXRsZTtcXG4gICAgICAgICAgICAgICAgaWYgKHNvcnRGbGFnID09IC0xKSB7XFxuICAgICAgICAgICAgICAgICAgICBpdGVtLnVybCA9ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignYXBwU29ydEZsYWcnLCBpLnRvU3RyaW5nKCkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6YCJ5oup6KaB56e75Yqo5Yiw55qE5L2N572uJztcXG4gICAgICAgICAgICAgICAgICAgIH0sIGkpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgaXRlbS51cmwgPSAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChvbGRJbmRleCwgbmV3SW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgc3Vic2NyaXB0aW9ucyA9IEpTT04ucGFyc2UocmVhZEZpbGUoJ2FwcFN1YicpIHx8ICdbXScpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN1YnNjcmlwdGlvbnMuc3BsaWNlKG5ld0luZGV4LCAwLCBzdWJzY3JpcHRpb25zLnNwbGljZShvbGRJbmRleCwgMSlbMF0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKCdhcHBTdWInLCBKU09OLnN0cmluZ2lmeShzdWJzY3JpcHRpb25zKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2FwcFNvcnRGbGFnJywgJy0xJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSc7XFxuICAgICAgICAgICAgICAgICAgICB9LCBzb3J0RmxhZywgaSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSAn5a+85Ye6JzpcXG4gICAgICAgICAgICAgICAgaXRlbS51cmwgPSAkKCfnoa7lrprlr7zlh7rigJwnICsgdi5uYW1lICsgJ+KAneiuoumYhT8nKS5jb25maXJtKCh2KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgdGV4dCA9IHYudHlwZSArICfimIXimIXimIUnICsgdi5uYW1lICsgJ+KYheKYheKYhScgKyB2LnVybCArICfimIXimIXimIUnICsgdi5jb2RlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhyZWYgPSBzaGFyZVBhc3RlKHRleHQpO1xcbiAgICAgICAgICAgICAgICAgICAgY29weSgn6L276K6i6ZiFOicgKyB2Lm5hbWUgKyAnXFxcXG4nICsgaHJlZik7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxuICAgICAgICAgICAgICAgIH0sIHYpXFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgIGNhc2UgJ+afpeeciyc6XFxuICAgICAgICAgICAgICAgIGl0ZW0udXJsID0gICdlZGl0RmlsZTovL2hpa2VyOi8vZmlsZXMvbGlicy8nICsgbWQ1KHYudXJsKSArICcuanMnO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgIH1cXG4gICAgICAgIGQucHVzaChpdGVtKTtcXG4gICAgfSk7XFxuICAgIHJldHVybiBkO1xcbn1cIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIue8lui+keiuoumYhVwiLFwicGF0aFwiOlwiZWRpdFwiLFwicnVsZVwiOlwianM6XFxuc2V0UGFnZVRpdGxlKCfnvJbovpHorqLpmIUnKTtcXG5hZGRMaXN0ZW5lcignb25DbG9zZScsICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICBjbGVhclZhcignbmFtZScpO1xcbiAgICBjbGVhclZhcigndXJsJyk7XFxuICAgIGNsZWFyVmFyKCdjb2RlJyk7XFxuICAgIGNsZWFyVmFyKCd0eXBlJyk7XFxufSkpO1xcbmxldCBkID0gW10sXFxuICAgIG1vZGUgPSBnZXRQYXJhbSgnbW9kZScpLFxcbiAgICBpbmRleCA9IGdldFBhcmFtKCdpbmRleCcpO1xcbmQucHVzaCh7XFxuICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArICforqLpmIXnsbvlnos6JyArIGdldFZhcigndHlwZScsICdhcHDmjqXlj6MnKS5mb250Y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ICAgICAgICAgY29kZSA9IGdldFZhcignY29kZScpLFxcbiAgICAgICAgICAgICAgICAgZGF0YSA9ICcnLFxcbiAgICAgICAgICAgICAgICAgcmVtb3RlRGF0YSA9ICcnO1xcbiAgICAgICAgICAgIGlmKCF1cmwpIHtyZXR1cm4gJ3RvYXN0Oi8v6L+Y5rKh5YaZ6K6i6ZiF6ZO+5o6lJ31cXG4gICAgICAgICAgICBpZighL15odHRwfF5oaWtlcnxeZmlsZS8udGVzdCh1cmwpKSB7cmV0dXJuICd0b2FzdDovL+mTvuaOpeS4jeWkquWvueWViid9XFxuICAgICAgICAgICAgdHJ5e1xcbiAgICAgICAgICAgICAgICByZW1vdGVEYXRhID0gZmV0Y2godXJsKTtcXG4gICAgICAgICAgICB9Y2F0Y2goZSl7XFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/orr/pl67pk77mjqXlh7rkuobpl67popgnXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChjb2RlID09PSAnJykge1xcbiAgICAgICAgICAgICAgICB0cnl7XFxuICAgICAgICAgICAgICAgICAgICBkYXRhID0gIEpTT04ucGFyc2UocmVtb3RlRGF0YSk7XFxuICAgICAgICAgICAgICAgIH1jYXRjaChlKXtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/ov5znqIvmlbDmja7kuI3kuLpqc29u5qC85byPJ1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgICAgIHRyeXtcXG4gICAgICAgICAgICAgICAgICAgIGV2YWwoJ3ZhciBmdW4gPScgKyBjb2RlKTtcXG4gICAgICAgICAgICAgICAgICAgIGRhdGEgPSBmdW4ocmVtb3RlRGF0YSk7XFxuICAgICAgICAgICAgICAgIH1jYXRjaChlKXtcXG4gICAgICAgICAgICAgICAgICAgIGxvZygn5Luj56CB6Zeu6aKYOlxcXFxuJyArIGUudG9TdHJpbmcoKSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6L2s5o2i5Luj56CB5pyJ6Zeu6aKYLOivpuingeaXpeW/lydcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsb2coZGF0YSk7XFxuICAgICAgICAgICAgaWYoIUFycmF5LmlzQXJyYXkoZGF0YSkpe1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v57uT5p6c5LiN5piv5pWw57uE5ZWKJ1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZihkYXRhLmxlbmd0aCA9PT0gMCB8fCAoIWRhdGFbMF0udGl0bGUgfHwgIWRhdGFbMF0udXJsKSl7XFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/nu5PmnpzmlbDnu4TkuI3ljIXlkKt0aXRsZeaIlnVybCdcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+a1i+ivleaIkOWKnyznu5PmnpzmmL7npLrlnKjml6Xlv5fkuK0nXFxuICAgIH0pXFxufSk7XFxuZC5wdXNoKHtcXG4gICAgdGl0bGU6ICfkv53lrZgnLFxcbiAgICB1cmw6ICQoKS5sYXp5UnVsZSgobW9kZSwgaW5kZXgpID0+IHtcXG4gICAgICAgIGxldCBuYW1lID0gZ2V0VmFyKCduYW1lJyksXFxuICAgICAgICAgICAgdXJsID0gZ2V0VmFyKCd1cmwnKSxcXG4gICAgICAgICAgICBjb2RlID0gZ2V0VmFyKCdjb2RlJyksXFxuICAgICAgICAgICAgdHlwZSA9IGdldFZhcigndHlwZScsICcnKSxcXG4gICAgICAgICAgICBzdWJzID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnYXBwU3ViJykgfHwgJ1tdJyk7XFxuICAgICAgICBpZighdHlwZSkge3JldHVybiAndG9hc3Q6Ly/ov5jmsqHpgInorqLpmIXnsbvlnosnfVxcbiAgICAgICAgaWYoIW5hb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FxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgdHlwZS5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgdHlwZV9uYW1lID0gXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICB0eXBlX2lkID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgICAgIGlmICgvbGlzdF9uYW1lLy50ZXN0KHJlc2NvZCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIHR5cGVfbmFtZSA9IHR5cGVbaV0ubGlzdF9uYW1lO1xcbiAgICAgICAgICAgICAgICAgICAgdHlwZV9pZCA9IHR5cGVbaV0ubGlzdF9pZDtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICgvdm9kX3BsYXlfZnJvbS8udGVzdChyZXNjb2QpKSB7XFxuICAgICAgICAgICAgICAgICAgICB0eXBlX25hbWUgPSB0eXBlW2ldLnR5cGVfbmFtZTtcXG4gICAgICAgICAgICAgICAgICAgIHR5cGVfaWQgPSB0eXBlW2ldLnR5cGVfaWQ7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB0eXBlX25hbWUgPSBwYXJzZURvbUZvckh0bWwodHlwZVtpXSwgXFxcImJvZHkmJlRleHRcXFwiKS5zcGxpdCgneycpWzBdO1xcbiAgICAgICAgICAgICAgICAgICAgdHlwZV9pZCA9IHBhcnNlRG9tRm9ySHRtbCh0eXBlW2ldLCBcXFwiYm9keSYmdHkmJmlkXFxcIik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdHlwZV9uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKCdoaWtlcjovL2VtcHR5P2FwcFVybD0nICsgYXBwVXJsICsgXFxcIiZwZz1meXBhZ2UmaHJlZj1cXFwiICsgYmFzZTY0RW5jb2RlKGFwcFVybCArIFxcXCI/YWM9bGlzdCZ0PVxcXCIgKyB0eXBlX2lkKSkucnVsZSgoYXBwVXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGh0bWwgPSBmZXRjaChiYXNlNjREZWNvZGUoZ2V0UGFyYW0oJ2hyZWYnKSkgKyAnJnBnPScgKyBNWV9QQUdFKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgaXRlbXMgPSBbXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKEpTT04ucGFyc2UoZmV0Y2goXFxcImhpa2VyOi8vcGFnZS9jcmVhdG9yMlxcXCIpKS5ydWxlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC92b2RfcGxheV9mcm9tLy50ZXN0KGh0bWwpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBodG1sID0gSlNPTi5wYXJzZShodG1sKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW1zID0ganNvbmxpc3QoaXRlbXMsIGh0bWwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRlbXMgPSBsaXN0ZnVuKGl0ZW1zLCBodG1sKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nKCfliIbnsbvliJfooajlh7rplJk6JyArIGUubWVzc2FnZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNldFJlc3VsdChpdGVtcyk7XFxuICAgICAgICAgICAgICAgICAgICB9LCBhcHBVcmwpLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJ1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaXRlbXMudW5zaGlmdCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiAn4oCY4oCY4oCZ4oCZJyArICfliIfmjaLmoLflvI8nLmZvbnRjb2xvcihcXFwiI0ZBNzI5OFxcXCIpLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoJ2hpa2VyOi8vZW1wdHkjbm9Mb2FkaW5nIycpLmxhenlSdWxlKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBsaXN0bW9kZSA9IGdldEl0ZW0oXFxcImxpc3Rtb2RlXFxcIiwgXFxcInRleHRcXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBhbHQgPSBsaXN0bW9kZSA9PSBcXFwidGV4dFxcXCIgPyBcXFwidmlkZW9cXFwiIDogXFxcInRleHRcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwibGlzdG1vZGVcXFwiLCBhbHQpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly8nICsgKGFsdCA9PSBcXFwidGV4dFxcXCIgPyAn5bey5YiH5o2i5Li65paH5pys5qC35byPJyA6IFxcXCLlt7LliIfmjaLkuLrlm77mlofmoLflvI9cXFwiKTtcXG4gICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbidcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBsb2coJ+mmlumhteWIhuexu+WHuumUmTonICsgZS5tZXNzYWdlKTtcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICB0cnkge1xcbiAgICAgICAgZXZhbChKU09OLnBhc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XQgbGFzdCA9IHBkZmgobGlzdFtqXSwgXFxcImJvZHkmJmxhc3QmJlRleHRcXFwiKTtcXG4gICAgICAgIGxldCBkdCA9IHBkZmgobGlzdFtqXSwgXFxcImJvZHkmJmR0JiZUZXh0XFxcIik7XFxuICAgICAgICBsZXQgaXRlbSA9IHt9O1xcbiAgICAgICAgaWYgKGh0bWwuaW5jbHVkZXMoXFxcIjwvcGljPlxcXCIpICYmIGxpc3Rtb2RlID09IFxcXCJ2aWRlb1xcXCIpIHtcXG4gICAgICAgICAgICBsZXQgcGljID0gcGRmaChsaXN0W2pdLCBcXFwiYm9keSYmcGljJiZUZXh0XFxcIik7XFxuICAgICAgICAgICAgaXRlbSA9IHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBwaWMgKyAnQFJlZmVyZXI9JyxcXG4gICAgICAgICAgICAgICAgZGVzYzogZHQsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibW92aWVfM1xcXCJcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBpdGVtID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUgKyAobm90ZSA/IFxcXCIgIOeKtuaAgTpcXFwiICsgbm90ZSA6ICcnKSxcXG4gICAgICAgICAgICAgICAgZGVzYzogbGFzdCArICcgJyArIHR5cCArICcgJyArIGR0LFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCJcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgfVxcbiAgICAgICAgaXRlbS51cmwgPSAkKFxcXCIjaW1tZXJzaXZlVGhlbWUjaGlrZXI6Ly9lbXB0eT9hcHBVcmw9XFxcIiArIGFwcFVybCArICcmaHJlZj0nICsgYmFzZTY0RW5jb2RlKGFwcFVybCArIFxcXCI/YWM9dmlkZW9saXN0Jmlkcz1cXFwiICsgdXJsKS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IDFdIDogbGlzdFtqXS5zcGxpdCgnJCcpWzBdLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoJ2hpa2VyOi8vZW1wdHkjIycgKyBmbGFnICsgJyMjJyArIHVybC5yZXBsYWNlKC9cXFxcbiovZywgJycpKS5sYXp5UnVsZSgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgZmxhZyA9IGlucHV0LnNwbGl0KCcjIycpWzFdO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGxpbmsgPSAoaW5wdXQuc3BsaXQoJyMjJylbMl0pLnJlcGxhY2UoL2FtcDsvZywgXFxcIlxcXCIpLnJlcGxhY2UoL15cXFxccyovLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcmVhbFVybCA9IGxpbmsuc3BsaXQoJ1xcXCInKVswXTtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi6LWE5rqQ6ZO+5o6lOlxcXCIgKyByZWFsVXJsKTtcXG5cXG4gICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGNoYW5nZVZpZGVvVXJsKHVybCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8v5pS55Y+Y54m55a6a5Zyw5Z2A55qEUmVmZXJlclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1cmwuaW5jbHVkZXMoXFxcIndrZmlsZVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IHVybCArICc7e1JlZmVyZXJAaHR0cHM6Ly9mYW50dWFuLndrZmlsZS5jb20vfSc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChmbGFnID09ICdiaWxpYmlsaScpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsID0gdXJsICsgJzt7UmVmZXJlckBodHRwczovL3d3dy5iaWxpYmlsaS5jb20vJiZVc2VyLUFnZW50QE1vemlsbGEvNS4wfSc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChmbGFnID09ICdtZ3R2Jykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSB1cmwgKyAnO3tSZWZlcmVyQHd3dy5tZ3R2LmNvbSYmVXNlci1BZ2VudEBNb3ppbGxhLzUuMH0nO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAvL+i/lOWbnuinhumikemTvuaOpVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgvXFxcXC5tM3U4Ly50ZXN0KHVybCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlTTN1OCh1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmwgKyAnI2lzVmlkZW89dHJ1ZSMnO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGxldCBwYXJzZW1vZGUgPSBnZXRNeVZhcihcXFwicGFyc2Vtb2RlXFxcIiwgXFxcIuaZuuiDveivhuWIq+mTvuaOpVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBhcnNlbW9kZSA9PSBcXFwi5pm66IO96K+G5Yir6ZO+5o6lXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgvXFxcXC5tM3U4fFxcXFwubXA0fG9ialxcXFwvdG9zfG5ldGVhc2VcXFxcLmNvbS8udGVzdChyZWFsVXJsKSAmJiAvaHR0cC8udGVzdChyZWFsVXJsKSAmJiAhL1xcXFwuaHRtbC8udGVzdChyZWFsVXJsKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIS9mZW5cXFxcLmxhb2RpfHJ1aWZlbmdsYnxzdW95b1xcXFwuY2MvLnRlc3QocmVhbFVybCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi5qOA5rWL5Yiw6LWE5rqQ5Zyw5Z2A5Y+v6IO95piv6KeG6aKR6ZO+5o6lXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2hhbmdlVmlkZW9VcmwocmVhbFVybCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHRlc3QxID0gL3lvdWt1fG1ndHZ8aXhpZ3VhfHFxLmNvbXxxaXlpfG1pZ3V8YmlsaWJpbGl8c29odXxwcHR2fGxlfDE5MDUuY29tLy50ZXN0KHJlYWxVcmwpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVzdDIgPSAvTFRcXFxcLXxSb25nWGluZ1ZSXFxcXC18cmVucmVubWlcXFxcLXx4ZnlcXFxcLXxzdW95b1xcXFwuY2N8ZmVuXFxcXC5sYW9kaXx4dWVyZW5cXFxcLXxjYW5nbGFuLS8udGVzdChyZWFsVXJsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZih0ZXN0MSB8fCB0ZXN0Mil7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZygn6LCD55So5pat5o+S6Kej5p6QJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoXFxcInZhciBjb25maWcgPVxcXCIgKyBmZXRjaChcXFwiaGlrZXI6Ly9maWxlcy9jYWNoZS9NeVBhcnNlU2V0Lmpzb25cXFwiKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoZmV0Y2goY29uZmlnLmNqKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBheXRtUGFyc2UocmVhbFVybCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/mnKrog73or4bliKvnmoTotYTmupDpk77mjqUnO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwYXJzZW1vZGUgPT0gXFxcIuW8uuWItuaWreaPkuino+aekFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsb2coJ+iwg+eUqOaWreaPkuino+aekCcpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoXFxcInZhciBjb25maWcgPVxcXCIgKyBmZXRjaChcXFwiaGlrZXI6Ly9maWxlcy9jYWNoZS9NeVBhcnNlU2V0Lmpzb25cXFwiKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbChmZXRjaChjb25maWcuY2opKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXl0bVBhcnNlKHJlYWxVcmwpO1xcbiAgICAgICAgICAgICAgICAgICAgfWVsc2UgaWYgKHBhcnNlbW9kZSA9PSBcXFwi5by65Yi25YaF572u6Kej5p6QXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vcmV0dXJuICQoJ2hpa2VyOi8vZW1wdHknKS5sYXp5UnVsZSgocmVhbFVybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2coXFxcIuS9v+eUqOWGhee9ruino+aekFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKEpTT04ucGFyc2UoZmV0Y2goJ2hpa2VyOi8vcGFnZS9teVBhcnNlJykpLnJ1bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXlQYXJzZShyZWFsVXJsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL30sIHJlYWxVcmwpO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwYXJzZW1vZGUgPT0gXFxcIuW8uuWItuebtOmTvuaJk+W8gFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2hhbmdlVmlkZW9VcmwocmVhbFVybCk7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHBhcnNlbW9kZSA9PSBcXFwi5by65Yi2572R6aG15omT5byAXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwid2ViOi8vXFxcIiArIHJlYWxVcmw7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfNFxcXCJcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICBzZXRSZXN1bHQoZCk7XFxufTtcXG4vL+aQnOe0ouinhOWImVxcbmZ1bmN0aW9uIHNlYXJjaEZpbmQoKSB7XFxuICAgIGxldCBkID0gW107XFxuICAgIHZhciAgaHRtbCA9IHJlcXVlc3QoYXBwVXJsICsgXFxcIj9hYz1saXN0JnBhZ2U9XFxcIiArIE1ZX1BBR0UgKyBcXFwiJndkPVxcXCIgKyBnZXRQYXJhbShcXFwid2RcXFwiKSk7XFxuICAgIGlmICgvbGlzdF9uYW1lLy50ZXN0KGh0bWwpKSB7XFxuICAgICAgICB2YXIgbGlzdCA9IEpTT04ucGFyc2UoaHRtbCkuZGF0YTtcXG4gICAgfSBlbHNlIGlmICgvdm9kX25hbWUvLnRlc3QoaHRtbCkpIHtcXG4gICAgICAgIHZhciBsaXN0ID0gSlNPTi5wYXJzZShodG1sKS5saXN0O1xcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgdmFyIGxpc3QgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICdyc3MmJnZpZGVvJyk7XFxuICAgIH1cXG4gICAgZm9yICh2YXIgaiA9IDA7IGogPCBsaXN0Lmxlbmd0aDsgaisrKSB7XFxuICAgICAgICBpZiAoL3ZvZF9uYW1lLy50ZXN0KGh0bWwpKSB7XFxuICAgICAgICAgIC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ICB0aXRsZTogdGl0bGUgKyAobm90ZSA/ICcg4oCiICcgKyBub3RlIDogJycpLFxcbiAgICAgICAgICAgIGRlc2M6IGxhc3QgKyAnIMK3ICAnICsgdHlwICsgJyDCtyAgJyArIGR0LFxcbiAgICAgICAgICAgIHVybDogJCgnI2ltbWVyc2l2ZVRoZW1lI2hpa2VyOi8vZW1wdHk/YXBwVXJsPScgKyBhcHBVcmwgKyAnJmhyZWY9JyArYmFzZTY0RW5jb2RlKGFwcFVybCArIFxcXCI/YWM9dmlkZW9saXN0Jmlkcz1cXFwiICsgaWRzICkpLnJ1bGUoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKGZldGNoKFxcXCJoaWtlcjovL3BhZ2UvY3JlYXRvcjJcXFwiKSkucnVsZSk7XFxuICAgICAgICAgICAgICAgICAgICBkZXRhaWxfcnVsZSgpO1xcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICBzZXRSZXN1bHQoW10pO1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKFxcXCLotYTmupDor6bmg4Xlh7rplJk6XFxcIiArIGUubWVzc2FnZSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnXFxuICAgICAgICB9KTtcXG4gICAgfVxcbiAgICBzZXRSZXN1bHQoZCk7XFxufTtcXG4vL+acgOaWsOeroOiKguinhOWImVxcbmZ1bmN0aW9uIGxhc3RfY2hhcHRlcl9ydWxlKCkge1xcbiAgICB2YXIgY2hwID0gW107XFxuICAgIHZhciBodG1sID0gcmVxdWVzdChiYXNlNjREZWNvZGUoZ2V0UGFyYW0oJ2hyZWYnKSkpO1xcbiAgICBpZiAoL3ZvZF9wbGF5X2Zyb20vLnRlc3QoaHRtbCkpIHtcXG4gICAgICAgIHZhciBqaHRtbCA9IEpTT04ucGFyc2UoaHRtbCk7XFxuICAgICAgICBpZiAoL2xpc3RfbmFtZS8udGVzdChodG1sKSkge1xcbiAgICAgICAgICAgIHZhciBjb250cyA9IGpodG1sLmRhdGFbMF0udm9kX3BsYXlfdXJsLnNwbGl0KCckJCQnKTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgdmFyIGNvbnRzID0gamh0bWwubGlzdFswXS52b2RfcGxheV91cmwuc3BsaXQoJyQkJCcpO1xcbiAgICAgICAgfVxcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgdmFyIGNvbnRzID0gcGFyc2VEb21Gb3JBcnJheShodG1sLCAncnNzJiZkbCYmZGQnKTtcXG4gICAgfTtcXG4gICAgZm9yICh2YXIgaiA9IDA7IGogPCBjb250cy5sZW5ndGg7IGorKykge1xcbiAgICAgICAgaWYgKC9kZCBmbGFnLy50ZXN0KGNvbnRzKSkge1xcbiAgICAgICAgICAgIHZhciBsaXN0ID0gY29udHNbal0ubWF0Y2goLy4qXFxcXFsoLio/KVxcXFxdLylbMV0uc3BsaXQoJyMnKTtcXG4gICAgICAgIH0gZWxzZSBpZiAoL1xcXFxyLy50ZXN0KGNvbnRzKSkge1xcbiAgICAgICAgICAgIHZhciBsaXN0ID0gY29udHNbal0uc3BsaXQoXFxcIlxcXFxyXFxcIik7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHZhciBsaXN0ID0gY29udHNbal0uc3BsaXQoXFxcIiNcXFwiKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGNocC5wdXNoKGxpc3QubGVuZ3RoKTtcXG4gICAgfVxcbiAgICBzZXRSZXN1bHQoJ+abtOaWsOiHszonICsgKE1hdGgubWF4LmFwcGx5KE1hdGgsIGNocCkpKTtcXG59O1wifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi5YaF572u6Kej5p6QXCIsXCJwYXRoXCI6XCJteVBhcnNlX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ICAgICAgICAgICAgICAgIHJlZGlyZWN0OiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgd2l0aFN0YXR1c0NvZGU6IHRydWVcXG4gICAgICAgICAgICB9KSk7XFxuICAgICAgICAgICAgbGV0IHVybCA9IHNjb2RlLmhlYWRlcnMubG9jYXRpb25bMF0ucmVwbGFjZSgvXFxcXFxcXFwvZywgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgIHJldHVybiBjaGFuZ2VWaWRlb1VybCh1cmwpO1xcbiAgICAgICAgfSBlbHNlIGlmICh2bGluay5pbmNsdWRlcyhcXFwibmV0ZmxpeG1vbS1cXFwiKSkge1xcbiAgICAgICAgICAgIGxldCBodG1sID0gZmV0Y2goJ2h0dHBzOi8vcGxheWVyLjRreWEuY29tLz91cmw9JyArIHZsaW5rLCB7XFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXJlcjogJ2h0dHBzOi8vbmV0ZmxpeC5tb20nXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICBsZV90b2tlbiA9IGh0bWwubWF0Y2goL2xlX3Rva2VuXFxcXHMqPVxcXFxzKlxcXCIoLiopXFxcIi8pWzFdLFxcbiAgICAgICAgICAgICAgICB1cmwgPSBodG1sLm1hdGNoKC9cXFwidXJsXFxcIlxcXFxzKjpcXFxccypcXFwiKC4qKVxcXCIvKVsxXTtcXG4gICAgICAgICAgICByZXR1cm4gY2hhbmdlVmlkZW9VcmwoRGUodXJsLCAnMzMzMTgwQjNFRjBFRDlEMCcsIGxlX3Rva2VuKSk7XFxuICAgICAgICB9IGVsc2UgaWYgKHZsaW5rLmluY2x1ZGVzKFxcXCJmZW4ubGFvZGlcXFwiKSkge1xcbiAgICAgICAgICAgIGxldCBodG1sID0gZmV0Y2goXFxcImh0dHBzOi8vcGxheS50a3lzLnR2L2xhb2RpLnBocC8/dXJsPVxcXCIgKyB2bGluayksXFxuICAgICAgICAgICAgICAgIHVybCA9IGh0bWwubWF0Y2goL3Z1cmxcXFxccyo9XFxcXHMqJyguKiknLylbMV07XFxuICAgICAgICAgICAgcmV0dXJuIGNoYW5nZVZpZGVvVXJsKHVybCk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHJldHVybiB2bGluaztcXG4gICAgICAgIH1cXG4gICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgcmV0dXJuICd0b2FzdDovL+aXoOazleino+aekOWHuuinhumikSdcXG4gICAgfVxcbn1cIn1dIiwiaWNvbiI6Imh0dHBzOi8vbGFubWVpZ3VvamlhbmcuY29tL3R1Ymlhby9xLzUyLnBuZyIsInByb3h5IjoiIn0=
Add Comment
Please, Sign In to add comment