Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥斗鱼直播@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcInRleHRfMVwiLFwibmFtZVwiOlwiQ2xhc3NUYWJcIixcInBhdGhcIjpcIkNsYXNzVGFiXCIsXCJydWxlXCI6XCJjb25zdCBDbGFzc1RhYiA9IGZ1bmN0aW9uKGNsYXNzQXJyYXksIHBhcmFtcykge1xcbiAgICBPYmplY3QuYXNzaWduKHRoaXMsIHBhcmFtcylcXG4gICAgdGhpcy5hcnIgPSBjbGFzc0FycmF5Lm1hcCh2ID0+IHRoaXMuaW5pdCh2KSlcXG4gICAgdGhpcy5zaWduID0gJyQnICsgUUlOR19USVRMRSArICdfJyArICh0aGlzLm5hbWUgfHwgJycpICsgJ18nXFxuICAgIHRoaXMuY29sb3IgPSB0aGlzLmNvbG9yIHx8ICcjMTJiNjY4J1xcbiAgICB0aGlzLmJvdW5kYXJ5ID0gdGhpcy5ib3VuZGFyeSB8fCAnYmxhbmtfYmxvY2snXFxufVxcbkNsYXNzVGFiLnByb3RvdHlwZSA9IHtcXG4gICAgY29uc3RydWN0b3I6IENsYXNzVGFiLFxcbiAgICBsb2FkKGVsKSB7XFxuICAgICAgICBsZXQgZm9sZGVkID0gdGhpcy5mb2xkICYmIGdldFZhcignZm9sZF8nICsgdGhpcy5zaWduLCAnJylcXG4gICAgICAgIGlmICh0aGlzLmFyci5sZW5ndGggPiAxICYmIHRoaXMuZm9sZCkgZWwucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgKGZvbGRlZCA/ICfilrYnIDogJ+KWvCcpLmZvbnRjb2xvcignIzA0OWVmZicpLFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2lnbiwgZm9sZGVkKSA9PiB7XFxuICAgICAgICAgICAgICAgIHB1dFZhcignZm9sZF8nICsgc2lnbiwgeyAnJzogJ1QnLCAnVCc6ICcnIH0gW2ZvbGRlZF0pXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxuICAgICAgICAgICAgfSwgdGhpcy5zaWduLCBmb2xkZWQpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbidcXG4gICAgICAgIH0pXFxuICAgICAgICBsZXQgYXJyID0gZm9sZGVkID8gW3RoaXMuYXJyWzBdXSA6IHRoaXMuYXJyXFxuICAgICAgICBhcnIuZm9yRWFjaCgodikgPT4ge1xcbiAgICAgICAgICAgIGxldCB7IGlkLCBjbGFzc19uYW1lLCBjbGFzc191cmwgfSA9IHYsXFxuICAgICAgICAgICAgc2VsZWN0ZWQgPSBKU09OLnN0cmluZ2lmeSh0aGlzLmdldENsYXNzKGlkKSlcXG4gICAgICAgICAgICBjbGFzc19uYW1lLmZvckVhY2goKG5hbWUsIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IHVybCA9IGNsYXNzX3VybFtpXSxcXG4gICAgICAgICAgICAgICAgICAgIG5vdyA9IEpTT04uc3RyaW5naWZ5KHsgbmFtZTogbmFtZSwgdXJsOiB1cmwgfSlcXG4gICAgICAgICAgICAgICAgZWwucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogc2VsZWN0ZWQgPT0gbm93ID8gJ+KAnOKAnOKAneKAnScgKyBuYW1lLmZvbnRjb2xvcih0aGlzLmNvbG9yKS5ib2xkKCkgOiBuYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBzZWxlY3RlZCA9PSBub3cgPyAnaGlrZXI6Ly9lbXB0eScgOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChzaWduLCBpZCwgbm93KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0VmFyKHNpZ24gKyBpZCwgbm93KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuc2lnbiwgaWQsIG5vdyksXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBlbC5wdXNoKHsgY29sX3R5cGU6IHRoaXMuYm91bmRhcnkgfSlcXG4gICAgICAgIH0pXFxuICAgIH0sXFxuICAgIGluaXQoY2xhc3NPYmplY3QpIHtcXG4gICAgICAgIGlmICh0eXBlb2YgY2xhc3NPYmplY3QuY2xhc3NfbmFtZSA9PSAnc3RyaW5nJylcXG4gICAgICAgICAgICBjbGFzc09iamVjdC5jbGFzc19uYW1lID0gY2xhc3NPYmplY3QuY2xhc3NfbmFtZS5zcGxpdCgnJicpXFxuICAgICAgICBpZiAodHlwZW9mIGNsYXNzT2JqZWN0LmNsYXNzX3VybCA9PSAnc3RyaW5nJylcXG4gICAgICAgICAgICBjbGFzc09iamVjdC5jbGFzc191cmwgPSBjbGFzc09iamVjdC5jbGFzc191cmwuc3BsaXQoJyYnKS5tYXAoKH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R1cm4gJCgnaGlrZXI6Ly9maWxlcy90bXAvJyArIFFJTkdfVElUTEUgKyAnX2JhY2t1cC5qc29uJywgJ+i+k+WFpeWkh+S7vei3r+W+hCcpXFxuICAgICAgICAgICAgLmlucHV0KCh1cmwsIHVwZGF0ZUludGVydmFsLCBuZXdXaW5kb3csIHRhYkZvbGQsIGRpc2FibGVDdXN0b20pID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gcmVxdWVzdCh1cmwpLFxcbiAgICAgICAgICAgICAgICAgICAgY3VzdG9tRGF0YSA9IHJlYWRGaWxlKCdjdXN0b21EYXRhJylcXG4gICAgICAgICAgICAgICAgd3JpdGVGaWxlKGlucHV0LCBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJbnRlcnZhbDogdXBkYXRlSW50ZXJ2YWwsXFxuICAgICAgICAgICAgICAgICAgICBuZXdXaW5kb3c6IG5ld1dpbmRvdyxcXG4gICAgICAgICAgICAgICAgICAgIHRhYkZvbGQ6IHRhYkZvbGQsXFxuICAgICAgICAgICAgICAgICAgICBkaXNhYmxlQ3VzdG9tOiBkaXNhYmxlQ3VzdG9tLFxcbiAgICAgICAgICAgICAgICAgICAgY3VzdG9tRGF0YTogY3VzdG9tRGF0YSxcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVzOiBydWxlc1xcbiAgICAgICAgICAgICAgICB9KSlcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3suWkh+S7ve+8jOazqOaEj+iLpeS7k+W6k+S4uuWtkOmhtemdouWImeS4jeWkh+S7vSdcXG4gICAgICAgICAgICB9LCB1cmwsIHVwZGF0ZUludGVydmFsLCBuZXdXaW5kb3csIHRhYkZvbGQsIGRpc2FibGVDdXN0b20pXFxuICAgICAgICBlbHNlIHJldHVybiAkKCdoaWtlcjovL2ZpbGVzL3RtcC8nICsgUUlOR19USVRMRSArICdfYmFja3VwLmpzb24nLCAn6L6T5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gYnJlYWtcXG4gICAgICAgIGNhc2UgJ+mHjeaWsOaOkuW6jyc6XFxuICAgICAgICAgICAgbGV0IHNvcnRGbGFnID0gcGFyc2VJbnQoZ2V0TXlWYXIoJ3NvcnRGbGFnJywgJy0xJykpXFxuICAgICAgICAgICAgZC50aXRsZSA9IChzb3J0RmxhZyA9PSBpID8gJ/CflIMgICcgOiAnJykgKyBkLnRpdGxlXFxuICAgICAgICAgICAgaWYgKHNvcnRGbGFnID09IC0xKVxcbiAgICAgICAgICAgICAgICBkLnVybCA9ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdzb3J0RmxhZycsIGkudG9TdHJpbmcoKSlcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+mAieaLqeimgeenu+WKqOWIsOeahOS9jee9ridcXG4gICAgICAgICAgICAgICAgfSwgaSlcXG4gICAgICAgICAgICBlbHNlXFxuICAgICAgICAgICAgICAgIGQudXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgob2xkSW5kZXgsIG5ld0luZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZXMgPSBKU09OLnBhcnNlKHJlYWRGaWxlKCdjdXN0b21EYXRhJykgfHwgJ1tdJylcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVzLnNwbGljZShuZXdJbmRleCwgMCwgcnVsZXMuc3BsaWNlKG9sZEluZGV4LCAxKVswXSlcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKCdjdXN0b21EYXRhJywgSlNPTi5zdHJpbmdpZnkocnVsZXMpKVxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ3NvcnRGbGFnJywgJy0xJylcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgICAgICAgICB9LCBzb3J0RmxhZywgaSlcXG4gICAgICAgICAgICBicmVha1xcbiAgICAgICAgY2FzZSAn5pu05pS55Zu+5qCHJzpcXG4gICAgICAgICAgICBkLnVybCA9ICQodi5pY29uIHx8ICcnLCAn6L6T5YWl5paw5Zu+5qCH5Zyw5Z2A5oiW6aKc6Imy5Luj56CB77yaJykuaW5wdXQoKGkpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnY3VzdG9tRGF0YScpIHx8ICdbXScpXFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dClcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVzW2ldLmljb24gPSBpbnB1dFxcbiAgICAgICAgICAgICAgICBlbHNlXFxuICAgICAgICAgICAgICAgICAgICBkZWxldGUgcnVsZXNbaV0uaWNvblxcbiAgICAgICAgICAgICAgICBzYXZlRmlsZSgnY3VzdG9tRGF0YScsIEpTT04uc3RyaW5naWZ5KHJ1bGVzKSlcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICB9LCBpKVxcbiAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICBjYXNlICflr7zlhaXmtbfpmJQnOlxcbiAgICAgICAgICAgIGQudXJsID0gJ3J1bGU6Ly8nICsgYmFzZTY0RW5jb2RlKEpTT04uc3RyaW5naWZ5KGRhdGFbaV0pKVxcbiAgICAgICAgICAgIGJyZWFrXFxuICAgIH1cXG4gICAgZWwucHVzaChkKVxcbn0pXFxuc2V0UmVzdWx0KGVsKVxcblwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi6aG16Z2i6L295YWlXCIsXCJ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gICAgICAgICAgICBkZXNjOiBcXFwi5pCc5L2g5oOz6KaB55qELi4uXFxcIixcXG4gICAgICAgICAgICB1cmw6ICdcXFwiaGlrZXI6Ly9zZWFyY2g/cz1cXFwiK2lucHV0JyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBydWxlczogJC50b1N0cmluZygoUUlOR19USVRMRSwgdGl0bGUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBydWxlcyA9ICQucmVxdWlyZSgnaGlrZXI6Ly9wYWdlL2RhdGFMb2FkP3J1bGU9JyArIFFJTkdfVElUTEUpKClcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVzID0gW3J1bGVzLmZpbmQoKHYpID0+IHYudGl0bGUgPT0gdGl0bGUpXVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHJ1bGVzKVxcbiAgICAgICAgICAgICAgICB9LCBRSU5HX1RJVExFLCBSVUxFLnRpdGxlKSxcXG4gICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBnZXRNeVZhcignc2VhcmNoS2V5JywgJycpLFxcbiAgICAgICAgICAgICAgICBvbkNoYW5nZTogXFxcInB1dE15VmFyKCdzZWFyY2hLZXknLGlucHV0KVxcXCJcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgfSlcXG4gICAgfVxcbiAgICAvLyDlpITnkIZNWV9SVUxFXFxuICAgIE1ZX1JVTEUudXJsID0gUlVMRS51cmxcXG4gICAgTVlfUlVMRS5jb2xfdHlwZSA9IFJVTEUuY29sX3R5cGVcXG4gICAgTVlfUlVMRS5kZXRhaWxfY29sX3R5cGUgPSBSVUxFLmRldGFpbF9jb2xfdHlwZVxcbiAgICBNWV9SVUxFLmZpbmRfcnVsZSA9IFJVTEUuZmluZF9ydWxlXFxuICAgIE1ZX1JVTEUuZGV0YWlsX2Z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ICAgICAgICAgICAgICAgIE1ZX19SVUxFLmRldGFpbF9jb2xfdHlwZSA9IHN1YlBhZ2UuY29sX3R5cGVcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKHYudXJsLmluY2x1ZGVzKCdAbGF6eVJ1bGU9JykpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJlSW5kZXggPSB2LnVybC5pbmRleE9mKCcuanM6JylcXG4gICAgICAgICAgICAgICAgaWYgKHJlSW5kZXggPj0gMCkgdi51cmwgPSB2LnVybC5zbGljZSgwLCByZUluZGV4KSArICcuanM6XFxcXG5pZihNWV9SVUxFKU9iamVjdC5hc3NpZ24oTVlfUlVMRSwgJyArIGFzc2lnbkxhenlSdWxlICsgJyk7JyArIHYudXJsLnNsaWNlKHJlSW5kZXggKyA0KVxcbiAgICAgICAgICAgICAgICByZXR1cm4gdlxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNJbmRleCkge1xcbiAgICAgICAgICAgICAgICBpZiAoIU1ZX1JVTEUuZGV0YWlsX2ZpbmRfcnVsZSB8fCAvaGlrZXI6XFxcXC9cXFxcLyg/IWVtcHR5LiskKS8udGVzdCh2LnVybCkpIHJldHVybiB2XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHZcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdi5leHRyYSA9IHtcXG4gICAgICAgICAgICAgICAgdXJsOiBnZW5FeFVybCh2LnVybCksXFxuICAgICAgICAgICAgICAgIFJVTEU6IE1ZX19SVUxFLFxcbiAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGlzSW5kZXggJiYgdi50aXRsZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB2LnVybCA9ICdoaWtlcjovL3BhZ2UvZnJhbWVMb2FkP3J1bGU9JyArIFFJTkdfVElUTEVcXG4gICAgICAgICAgICByZXR1cm4gdlxcbiAgICAgICAgfSkpXFxuICAgICAgICBtZXRob2Rfc2V0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fSksXFxuICAgICAgICAgICAgcmVzID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBkZXNjLCBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IE1ZX1JVTEUuY29sX3R5cGVcXG4gICAgICAgICAgICB9XFxuICAgICAgICBpZiAocmVzLnVybCkge1xcbiAgICAgICAgICAgIGlmIChyZXMudXJsLmluY2x1ZGVzKCdAbGF6eVJ1bGU9JykpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJlSW5kZXggPSByZXMudXJsLmluZGV4T2YoJy5qczonKVxcbiAgICAgICAgICAgICAgICBpZiAocmVJbmRleCA+PSAwKSByZXMudXJsID0gcmVzLnVybC5zbGljZSgwLCByZUluZGV4KSArICcuanM6XFxcXG5pZihNWV9SVUxFKU9iamVjdC5hc3NpZ24oTVlfUlVMRSwgJyArIGFzc2lnbkxhenlSdWxlICsgJyk7JyArIHJlcy51cmwuc2xpY2UocmVJbmRleCArIDQpXFxuICAgICAgICAgICAgfSBlbHNlICBpZiAoZGV0YWlsRmluZFJ1bGUpIHtcXG4gICAgICAgICAgICAgICAgcmVzLmV4dHJhID0ge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBnZW5FeFVybCh1cmwpLFxcbiAgICAgICAgICAgICAgICAgICAgUlVMRTogT2JqZWN0LmFzc2lnbihnZW5NeVJ1bGUoKSwgeyBkZXRhaWxfZmluZF9ydWxlOiBkZXRhaWxGaW5kUnVsZSB9KSxcXG4gICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogaXNJbmRleCAmJiB0aXRsZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlcy51cmwgPSAnaGlrZXI6Ly9wYWdlL2ZyYW1lTG9hZD9ydWxlPScgKyBRSU5HX1RJVExFXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChNWV9SVUxFLmRldGFpbF9maW5kX3J1bGUpIHtcXG4gICAgICAgICAgICAgICAgcmVzLmV4dHJhID0ge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBnZW5FeFVybCh1cmwpLFxcbiAgICAgICAgICAgICAgICAgICAgUlVMRTogZ2VuTXlSdWxlKCksXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGlzSW5kZXggJiYgdGl0bGVcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXMudXJsID0gJ2hpa2VyOi8vcGFnZS9mcmFtZUxvYWQ/cnVsZT0nICsgUUlOR19USVRMRVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIG15Q29sbGVjdGlvbl9lbC5wdXNoKHJlcylcXG4gICAgfSlcXG4gICAgc2V0UmVzdWx0KG15Q29sbGVjdGlvbl9lbClcXG59XFxuXCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLmlbDmja7ovb3lhaVcIixcInBhdGhcIjpcImRhdGFMb2FkXCIsXCJydWxlXCI6XCIkLmV4cG9ydHMgPSBmdW5jdGlvbihzaG93QWxsKSB7XFxuICAgIGxldCB1cmwgPSBnZXRNeVZhcigncmVtb3RlVXJsJyksXFxuICAgICAgICBkYXRhID0gW11cXG4gICAgaWYgKHVybC5zdGFydHNXaXRoKCdoaWtlcjovLycpIHx8IHVybC5zdGFydHNXaXRoKCdmaWxlOi8vJykpIHtcXG4gICAgICAgIC8vIOWmguaenOS4uuacrOWcsOaWh+S7tuWImeS4jei/m+ihjOe8k+WtmFxcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBsZXQgb3JpRGF0YSA9IGZldGNoKHVybClcXG4gICAgICAgICAgICBpZiAodXJsLnN0YXJ0c1dpdGgoJ2hpa2VyOi8vcGFnZS8nKSlcXG4gICAgICAgICAgICAgICAgb3JpRGF0YSA9IEpTT04ucGFyc2Uob3JpRGF0YSkucnVsZVxcbiAgICAgICAgICAgIGRhdGEgPSBKU09OLnBhcnNlKG9yaURhdGEpXFxuICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgLy8g6I635Y+W6L+c56iL5pWw5o2u77yM5qOA5p+l6Ze06ZqU6buY6K6k5LiA5aSpXFxuICAgICAgICBsZXQgaW50ZXJ2YWwgPSBwYXJzZUludChyZWFkRmlsZSgndXBkYXRlSW50ZXJ2YWwnKSB8fCAnMScpLFxcbiAgICAgICAgICAgIG9sZERhdGEgPSBmZXRjaCgnaGlrZXI6Ly9maWxlcy9saWJzLycgKyBtZDUodXJsKSArICcuanMnKSxcXG4gICAgICAgICAgICByZW1vdGVEYXRhID0gW11cXG4gICAgICAgIGlmKGludGVydmFsID09IDApIGludGVydmFsID0gLTFcXG4gICAgICAgIHRyeSB7IHJlbW90ZURhdGEgPSBKU09OLnBhcnNlKGZldGNoQ2FjaGUodXJsLCAyNCAqIGludGVydmFsLCB7dGltZW91dDo1MDAwMH0pKSB9IGNhdGNoKGUpIHt9XFxuICAgICAgICBpZighQXJyYXkuaXNBcnJheShyZW1vdGVEYXRhKSkgcmVtb3RlRGF0YSA9IFtdXFxuICAgICAgICBpZiAocmVtb3RlRGF0YS5sZW5ndGggPCAzKSB7XFxuICAgICAgICAgICAgbG9nKCfmnKrojrflj5bliLDmlbDmja4nKVxcbiAgICAgICAgICAgIGlmIChvbGREYXRhKSB3cml0ZUZpbGUoJ2hpa2VyOi8vZmlsZXMvbGlicy8nICsgbWQ1KHVybCkgKyAnLmpzJywgb2xkRGF0YSlcXG4gICAgICAgICAgICBkYXRhID0gSlNPTi5wYXJzZShvbGREYXRhIHx8ICdbXScpXFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGxvZygn5bey6I635Y+W5Yiw5pWw5o2uJylcXG4gICAgICAgICAgICBkYXRhID0gcmVtb3RlRGF0YVxcbiAgICAgICAgfVxcbiAgICB9XFxuICAgIGRhdGEgP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b25kcygpKzE7XFxuICAgICAgICAgICAgaWYgKG1vbnRoID49IDEgJiYgbW9udGggPD0gOSkge1xcbiAgICAgICAgICAgICAgICBtb250aCA9IFxcXCIwXFxcIiArIG1vbnRoXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChzdHJEYXRlID49IDAgJiYgc3RyRGF0ZSA8PSA5KSB7XFxuICAgICAgICAgICAgICAgIHN0ckRhdGUgPSBcXFwiMFxcXCIgKyBzdHJEYXRlXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChzdHJIb3VycyA+PSAwICYmIHN0ckhvdXJzIDw9IDkpIHtcXG4gICAgICAgICAgICAgICAgc3RySG91cnMgPSBcXFwiMFxcXCIgKyBzdHJIb3Vyc1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoc3RyTWludXRlcyA+PSAwICYmIHN0ck1pbnV0ZXMgPD0gOSkge1xcbiAgICAgICAgICAgICAgICBzdHJNaW51dGVzID0gXFxcIjBcXFwiICsgc3RyTWludXRlc1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoc3RyU2Vjb25kcyA+PSAwICYmIHN0clNlY29uZHMgPD0gOSkge1xcbiAgICAgICAgICAgICAgICBzdHJTZWNvbmRzID0gXFxcIjBcXFwiICsgc3RyU2Vjb25kc1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAvL2xldCBjdXJyZW50ZGF0ZSA9IGRhdGUuZ2V0RnVsbFllYXIoKSArIHNlcGVyYXRvcjEgKyBtb250aCArIHNlcGVyYXRvcjEgKyBzdHJEYXRlICsgXFxcIiBcXFwiICsgc3RySG91cnMgKyBzZXBlcmF0b3IyICsgc3RyTWludXRlcyArIHNlcGVyYXRvcjIgKyBzdHJTZWNvbmRzO1xcbiAgICAgICAgICAgIGxldCBjdXJyZW50ZGF0ZSA9IChkYXRlLmdldEZ1bGxZZWFyKCktMjAyMCkrJycrIG1vbnRoICsnJysgc3RyRGF0Z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cbiAgICBmaW5kUnVsZSA9IGZpbmRSdWxlLnNwbGl0KCc7JylcXG4gICAgcGFyc2VEb21Gb3JBcnJheShnZXRSZXNDb2RlKCksIGZpbmRSdWxlLnNoaWZ0KCkpLmZvckVhY2goKGRhdGEpID0+IHtcXG4gICAgICAgIGxldCBbdGl0bGUsIGltZywgZGVzYywgdXJsXSA9IGZpbmRSdWxlLm1hcCgodiwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHYgPT0gJyonKSByZXR1cm4gJydcXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgdiA9IChpID09IDEgfHwgaSA9PSAzKSA/XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VEb20oZGF0YSwgdikgOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tRm9ySHRtbChkYXRhLCB2KVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgIT0gMykgdiA9IHJ1bkNvZGUodilcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2XFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsgcmV0dXJuICcnIH1cXG4gICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICByZXMgPSB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSwgdXJsOiB1cmwsXFxuICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsIGltZzogaW1nLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogTVlfUlVMRS5jb2xfdHlwZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIGlmIChyZXMudXJsKSB7XFxuICAgICAgICAgICAgaWYgKHJlcy51cmwuaW5jbHVkZXMoJ0BsYXp5UnVsZT0nKSkge1xcbiAgICAgICAgICAgICAgICBsZXQgcmVJbmRleCA9IHJlcy51cmwuaW5kZXhPZignLmpzOicpXFxuICAgICAgICAgICAgICAgIGlmIChyZUluZGV4ID49IDApIHJlcy51cmwgPSByZXMudXJsLnNsaWNlKDAsIHJlSW5kZXgpICsgJy5qczpcXFxcbmlmKE1ZX1JVTEUpT2JqZWN0LmFzc2lnbihNWV9SVUxFLCAnICsgYXNzaWduTGF6eVJ1bGUgKyAnKTsnICsgcmVzLnVybC5zbGljZShyZUluZGV4ICsgNClcXG4gICAgICAgICAgICB9IGVsc2UgIGlmIChkZXRhaWxGaW5kUnVsZSkge1xcbiAgICAgICAgICAgICAgICByZXMuZXh0cmEgPSB7XFxuICAgICAgICAgICAgICAgICAgICB1cmw6IGdlbkV4VXJsKHVybCksXFxuICAgICAgICAgICAgICAgICAgICBSVUxFOiBPYmplY3QuYXNzaWduKGdlbk15UnVsZSgpLCB7IGRldGFpbF9maW5kX3J1bGU6IGRldGFpbEZpbmRSdWxlIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiBpc0luZGV4ICYmIHRpdGxlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmVzLnVybCA9ICdoaWtlcjovL3BhZ2UvZnJhbWVMb2FkP3J1bGU9JyArIFFJTkdfVElUTEVcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKE1ZX1JVTEUuZGV0YWlsX2ZpbmRfcnVsZSkge1xcbiAgICAgICAgICAgICAgICByZXMuZXh0cmEgPSB7XFxuICAgICAgICAgICAgICAgICAgICB1cmw6IGdlbkV4VXJsKHVybCksXFxuICAgICAgICAgICAgICAgICAgICBSVUxFOiBnZW5NeVJ1bGUoKSxcXG4gICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogaXNJbmRleCAmJiB0aXRsZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlcy51cmwgPSAnaGlrZXI6Ly9wYWdlL2ZyYW1lTG9hZD9ydWxlPScgKyBRSU5HX1RJVExFXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgbXlDb2xsZWN0aW9uX2V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SlNPTi5zdHJpbmdpZnkoeyBuYW1lOiBuYW1lLCB1cmw6IHVybCB9KVxcXFxuICAgICAgICAgICAgICAgIGVsLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogc2VsZWN0ZWQgPT0gbm93ID8gJ+KAnOKAnOKAneKAnScgKyBuYW1lLmZvbnRjb2xvcih0aGlzLmNvbG9yKS5ib2xkKCkgOiBuYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHNlbGVjdGVkID09IG5vdyA/ICdoaWtlcjovL2VtcHR5JyA6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHNpZ24sIGlkLCBub3cpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dFZhcihzaWduICsgaWQsIG5vdylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcXFxuICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLnNpZ24sIGlkLCBub3cpLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nXFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICBlbC5wdXNoKHsgY29sX3R5cGU6IHRoaXMuYm91bmRhcnkgfSlcXFxcbiAgICAgICAgfSlcXFxcbiAgICB9LFxcXFxuICAgIGluaXQoY2xhc3NPYmplY3QpIHtcXFxcbiAgICAgICAgaWYgKHR5cGVvZiBjbGFzc09iamVjdC5jbGFzc19uYW1lID09ICdzdHJpbmcnKVxcXFxuICAgICAgICAgICAgY2xhc3NPYmplY3QuY2xhc3NfbmFtZSA9IGNsYXNzT2JqZWN0LmNsYXNzX25hbWUuc3BsaXQoJyYnKVxcXFxuICAgICAgICBpZiAodHlwZW9mIGNsYXNzT2JqZ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J2N1c3RvbURhdGEnKSB8fCAnW10nKSkuZm9yRWFjaCgodiwgaSkgPT4ge1xcXFxuICAgIGxldCBkID0geyB0aXRsZTogdi50aXRsZSwgaW1nOiBkYXRhW2ldLmljb24gfVxcXFxuICAgIHN3aXRjaCAoZWRpdE1vZGUpIHtcXFxcbiAgICAgICAgY2FzZSAn5ZCv55SoL+emgeeUqCc6XFxcXG4gICAgICAgICAgICBkLnRpdGxlID0gKHYudmlzaWJsZSA/ICfwn5+iICAnIDogJ/CflLQgICcpICsgZC50aXRsZVxcXFxuICAgICAgICAgICAgZC51cmwgPSAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnY3VzdG9tRGF0YScpIHx8ICdbXScpXFxcXG4gICAgICAgICAgICAgICAgcnVsZXNbaV0udmlzaWJsZSA9ICFydWxlc1tpXS52aXNpYmxlXFxcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ2N1c3RvbURhdGEnLCBKU09OLnN0cmluZ2lmeShydWxlcykpXFxcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcXFxuICAgICAgICAgICAgfSwgaSlcXFxcbiAgICAgICAgICAgIGJyZWFrXFxcXG4gICAgICAgIGNhc2UgJ+mHjeaWsOaOkuW6jyc6XFxcXG4gICAgICAgICAgICBsZXQgc29ydEZsYWcgPSBwYXJzZUludChnZXRNeVZhcignc29ydEZsYWcnLCAnLTEnKSlcXFxcbiAgICAgICAgICAgIGQudGl0bGUgPSAoc29ydEZsYWcgPT0gaSA/ICfwn5SDICAnIDogJycpICsgZC50aXRsZVxcXFxuICAgICAgICAgICAgaWYgKHNvcnRGbGFnID09IC0xKVxcXFxuICAgICAgICAgICAgICAgIGQudXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignc29ydEZsYWcnLCBpLnRvU3RyaW5nKCkpXFxcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6YCJ5oup6KaB56e75Yqo5Yiw55qE5L2N572uJ1xcXFxuICAgICAgICAgICAgICAgIH0sIGkpXFxcXG4gICAgICAgICAgICBlbHNlXFxcXG4gICAgICAgICAgICAgICAgZC51cmwgPSAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChvbGRJbmRleCwgbmV3SW5kZXgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnY3VzdG9tRGF0YScpIHx8ICdbXScpXFxcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVzLnNwbGljZShuZXdJbmRleCwgMCwgcnVsZXMuc3BsaWNlKG9sZEluZGV4LCAxKVswXSlcXFxcbiAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ2N1c3RvbURhdGEnLCBKU09OLnN0cmluZ2lmeShydWxlcykpXFxcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdzb3J0RmxhZycsICctMScpXFxcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxcXG4gICAgICAgICAgICAgICAgfSwgc29ydEZsYWcsIGkpXFxcXG4gICAgICAgICAgICBicmVha1xcXFxuICAgICAgICBjYXNlICfmm7TmlLnlm77moIcnOlxcXFxuICAgICAgICAgICAgZC51cmwgPSAkKHYuaWNvbiB8fCAnJywgJ+i+k+WFpeaWsOWbvuagh+WcsOWdgOaIluminOiJsuS7o+egge+8micpLmlucHV0KChpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnY3VzdG9tRGF0YScpIHx8ICdbXScpXFxcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICBydWxlc1tpXS5pY29uID0gaW5wdXRcXFxcbiAgICAgICAgICAgICAgICBlbHNlXFxcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBydWxlc1tpXS5pY29uXFxcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ2N1c3RvbURhdGEnLCBKU09OLnN0cmluZ2lmeShydWxlcykpXFxcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcXFxuICAgICAgICAgICAgfSwgaSlcXFxcbiAgICAgICAgICAgIGJyZWFrXFxcXG4gICAgICAgIGNhc2UgJ+WvvOWFpea1t+mYlCc6XFxcXG4gICAgICAgICAgICBkLnVybCA9ICdydWxlOi8vJyArIGJhc2U2NEVuY29kZShKU09OLnN0cmluZ2lmeShkYXRhW2ldKSlcXFxcbiAgICAgICAgICAgIGJyZWFrXFxcXG4gICAgfVxcXFxuICAgIGVsLnB1c2goZClcXFxcbn0pXFxcXG5zZXRSZXN1bHQoZWwpXFxcXG5cXFwifSx7XFxcImNvbF90eXBlXFxcIjpcXFwibW92aWVfM1xcXCIsXFxcIm5hbWVcXFwiOlxcXCLpobXpnaLovb3lhaVcXFwiLFxcXCJwYXRoXFxcIjpcXFwiZnJhbWVMb2FkXFxcIixcXFwicnVsZVxcXCI6XFxcImpzOlxcXFxuY29uc3QgUUlOR19USVRMRSA9IGdldE15VmFyKCdteUNvbGxlY3Rpb24nKVxcXFxubGV0IG15Q29sbGVjdGlvbl9lbCA9IFtdLFxcXFxuICAgIHsgUlVMRSwga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gICAgICAgICAgICAgICAgICAgZWxzZSB2ID0gKGkgPT0gMSB8fCBpID09IDMpID9cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tKGRhdGEsIHYpIDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tRm9ySHRtbChkYXRhLCB2KVxcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoaSAhPSAzKSB2ID0gcnVuQ29kZSh2KVxcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlxcXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsgcmV0dXJuICcnIH1cXFxcbiAgICAgICAgICAgIH0pLFxcXFxuICAgICAgICAgICAgcmVzID0ge1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSwgdXJsOiB1cmwsXFxcXG4gICAgICAgICAgICAgICAgZGVzYzogZGVzYywgaW1nOiBpbWcsXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IE1ZX1JVTEUuY29sX3R5cGVcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgaWYgKHJlcy51cmwpIHtcXFxcbiAgICAgICAgICAgIGlmIChyZXMudXJsLmluY2x1ZGVzKCdAbGF6eVJ1bGU9JykpIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgcmVJbmRleCA9IHJlcy51cmwuaW5kZXhPZignLmpzOicpXFxcXG4gICAgICAgICAgICAgICAgaWYgKHJlSW5kZXggPj0gMCkgcmVzLnVybCA9IHJlcy51cmwuc2xpY2UoMCwgcmVJbmRleCkgKyAnLmpzOlxcXFxcXFxcbmlmKE1ZX1JVTEUpT2JqZWN0LmFzc2lnbihNWV9SVUxFLCAnICsgYXNzaWduTGF6eVJ1bGUgKyAnKTsnICsgcmVzLnVybC5zbGljZShyZUluZGV4ICsgNClcXFxcbiAgICAgICAgICAgIH0gZWxzZSAgaWYgKGRldGFpbEZpbmRSdWxlKSB7XFxcXG4gICAgICAgICAgICAgICAgcmVzLmV4dHJhID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IGdlbkV4VXJsKHVybCksXFxcXG4gICAgICAgICAgICAgICAgICAgIFJVTEU6IE9iamVjdC5hc3NpZ24oZ2VuTXlSdWxlKCksIHsgZGV0YWlsX2ZpbmRfcnVsZTogZGV0YWlsRmluZFJ1bGUgfSksXFxcXG4gICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogaXNJbmRleCAmJiB0aXRsZVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICByZXMudXJsID0gJ2hpa2VyOi8vcGFnZS9mcmFtZUxvYWQ/cnVsZT0nICsgUUlOR19USVRMRVxcXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChNWV9SVUxFLmRldGFpbF9maW5kX3J1bGUpIHtcXFxcbiAgICAgICAgICAgICAgICByZXMuZXh0cmEgPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogZ2VuRXhVcmwodXJsKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgUlVMRTogZ2VuTXlSdWxlKCksXFxcXG4gICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogaXNJbmRleCAmJiB0aXRsZVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICByZXMudXJsID0gJ2hpa2VyOi8vcGFnZS9mcmFtZUxvYWQ/cnVsZT0nICsgUUlOR19USVRMRVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIG15Q29sbGVjdGlvbl9lbC5wdXNoKHJlcylcXFxcbiAgICB9KVxcXFxuICAgIHNldFJlc3VsdChteUNvbGxlY3Rpb25fZWwpXFxcXG59XFxcXG5cXFwifSx7XFxcImNvbF90eXBlXFxcIjpcXFwibW92aWVfM1xcXCIsXFxcIm5hbWVcXFwiOlxcXCLmlbDmja7ovb3lhaVcXFwiLFxcXCJwYXRoXFxcIjpcXFwiZGF0YU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AgICAgICBsZXQgc2VwZXJhdG9yMiA9IFxcXFxcXFwiOlxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgbGV0IG1vbnRoID0gZGF0ZS5nZXRNb250aCgpICsgMTtcXFxcbiAgICAgICAgICAgIGxldCBzdHJEYXRlID0gZGF0ZS5nZXREYXRlKCk7XFxcXG4gICAgICAgICAgICBsZXQgc3RySG91cnMgPSBkYXRlLmdldEhvdXJzKCk7XFxcXG4gICAgICAgICAgICBsZXQgc3RyTWludXRlcyA9IGRhdGUuZ2V0TWludXRlcygpO1xcXFxuICAgICAgICAgICAgbGV0IHN0clNlY29uZHMgPSBkYXRlLmdldFNlY29uZHMoKSsxO1xcXFxuICAgICAgICAgICAgaWYgKG1vbnRoID49IDEgJiYgbW9udGggPD0gOSkge1xcXFxuICAgICAgICAgICAgICAgIG1vbnRoID0gXFxcXFxcXCIwXFxcXFxcXCIgKyBtb250aFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKHN0ckRhdGUgPj0gMCAmJiBzdHJEYXRlIDw9IDkpIHtcXFxcbiAgICAgICAgICAgICAgICBzdHJEYXRlID0gXFxcXFxcXCIwXFxcXFxcXCIgKyBzdHJEYXRlXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAoc3RySG91cnMgPj0gMCAmJiBzdHJIb3VycyA8PSA5KSB7XFxcXG4gICAgICAgICAgICAgICAgc3RySG91cnMgPSBcXFxcXFxcIjBcXFxcXFxcIiArIHN0ckhvdXJzXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAoc3RyTWludXRlcyA+PSAwICYmIHN0ck1pbnV0ZXMgPD0gOSkge1xcXFxuICAgICAgICAgICAgICAgIHN0ck1pbnV0ZXMgPSBcXFxcXFxcIjBcXFxcXFxcIiArIHN0ck1pbnV0ZXNcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChzdHJTZWNvbmRzID49IDAgJiYgc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