Advertisement
xiaomianao666

邀您一起看:热舞.dm

Jan 4th, 2022
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥热舞.dm@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcInRleHRfMVwiLFwibmFtZVwiOlwiQ2xhc3NUYWJcIixcInBhdGhcIjpcIkNsYXNzVGFiXCIsXCJydWxlXCI6XCJmdW5jdGlvbiBDbGFzc1RhYihjbGFzc0FycmF5LCBwYXJhbXMpIHtcXG4gICAgT2JqZWN0LmFzc2lnbih0aGlzLCBwYXJhbXMpXFxuICAgIHRoaXMuYXJyID0gY2xhc3NBcnJheS5tYXAodiA9PiB0aGlzLmluaXQodikpXFxuICAgIHRoaXMuc2lnbiA9ICckJyArIE1ZX1JVTEUudGl0bGUgKyAnXycgKyAodGhpcy5uYW1lIHx8ICcnKSArICdfJ1xcbiAgICB0aGlzLmNvbG9yID0gdGhpcy5jb2xvciB8fCAnIzEyYjY2OCdcXG4gICAgdGhpcy5ib3VuZGFyeSA9IHRoaXMuYm91bmRhcnkgfHwgJ2JsYW5rX2Jsb2NrJ1xcbn1cXG5DbGFzc1RhYi5wcm90b3R5cGUgPSB7XFxuICAgIGNvbnN0cnVjdG9yOiBDbGFzc1RhYixcXG4gICAgbG9hZChlbCkge1xcbiAgICAgICAgbGV0IGZvbGRlZCA9IGdldFZhcignZm9sZF8nICsgdGhpcy5zaWduLCAnJylcXG4gICAgICAgIGlmICh0aGlzLmZvbGQpIGVsLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdPHNwYW4gc3R5bGU9XFxcImNvbG9yOiMwNDllZmZcXFwiPicgKyAoZm9sZGVkID8gJ+KWticgOiAn4pa8JyksXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChzaWduLCBmb2xkZWQpID0+IHtcXG4gICAgICAgICAgICAgICAgcHV0VmFyKCdmb2xkXycgKyBzaWduLCB7ICcnOiAnVCcsICdUJzogJycgfSBbZm9sZGVkXSlcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICB9LCB0aGlzLnNpZ24sIGZvbGRlZCksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJ1xcbiAgICAgICAgfSlcXG4gICAgICAgIGxldCBhcnIgPSBmb2xkZWQgPyBbdGhpcy5hcnJbMF1dIDogdGhpcy5hcnJcXG4gICAgICAgIGFyci5mb3JFYWNoKCh2KSA9PiB7XFxuICAgICAgICAgICAgbGV0IHsgaWQsIGNsYXNzX25hbWUsIGNsYXNzX3VybCB9ID0gdixcXG4gICAgICAgICAgICAgICAgc2VsZWN0ZWQgPSBKU09OLnN0cmluZ2lmeSh0aGlzLmdldENsYXNzKGlkKSlcXG4gICAgICAgICAgICBjbGFzc19uYW1lLmZvckVhY2goKG5hbWUsIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IHVybCA9IGNsYXNzX3VybFtpXSxcXG4gICAgICAgICAgICAgICAgICAgIG5vdyA9IEpTT04uc3RyaW5naWZ5KHsgbmFtZTogbmFtZSwgdXJsOiB1cmwgfSlcXG4gICAgICAgICAgICAgICAgZWwucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogKHNlbGVjdGVkID09IG5vdyA/ICfigJzigJzigJ3igJ08c3BhbiBzdHlsZT1cXFwiY29sb3I6JyArIHRoaXMuY29sb3IgKyAnXFxcIj48Yj4nIDogJycpICsgbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2lnbiwgaWQsIG5vdykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dFZhcihzaWduICsgaWQsIG5vdylcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRWYXIoc2lnbiwgbm93KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuc2lnbiwgaWQsIG5vdyksXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBlbC5wdXNoKHsgY29sX3R5cGU6IHRoaXMuYm91bmRhcnkgfSlcXG4gICAgICAgIH0pXFxuICAgIH0sXFxuICAgIGluaXQoY2xhc3NPYmplY3QpIHtcXG4gICAgICAgIGlmICh0eXBlb2YgY2xhc3NPYmplY3QuY2xhc3NfbmFtZSA9PSAnc3RyaW5nJylcXG4gICAgICAgICAgICBjbGFzc09iamVjdC5jbGFzc19uYW1lID0gY2xhc3NPYmplY3QuY2xhc3NfbmFtZS5zcGxpdCgnJicpXFxuICAgICAgICBpZiAodHlwZW9mIGNsYXNzT2JqZWN0LmNsYXNzX3VybCA9PSAnc3RyaW5nJylcXG4gICAgICAgICAgICBjbGFzc09iamVjdC5jbGFzc191cmwgPSBjbGFzc09iamVjd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JykgfHwgKHYuZXh0cmEgfHwge30pLnJ1bGUpXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlxcbiAgICAgICAgICAgICAgICBsZXQgW18sIHBhdGgsIGZsYWcsIHBhcmFtc10gPSB2LnVybC5tYXRjaCgvXmhpa2VyOlxcXFwvXFxcXC9wYWdlXFxcXC8oLis/KSgjLio/KT8oPzpcXFxcPyguKikpPyQvKSxcXG4gICAgICAgICAgICAgICAgICAgIHN1YlBhZ2UgPSBNWV9SVUxFLnBhZ2VMaXN0LmZpbmQoKHYpID0+IHYucGF0aCA9PSBwYXRoKSxcXG4gICAgICAgICAgICAgICAgICAgIHN1YlVybCA9IChwYXJhbXMgfHwgJycpLnNwbGl0KCcmJykuZmluZCgodikgPT4gdi5zdGFydHNXaXRoKCd1cmw9JykpXFxuICAgICAgICAgICAgICAgIHYudXJsID0gc3ViVXJsID8gc3ViVXJsLnNsaWNlKDQpLnJlcGxhY2UoL++8n++8ny9nLCAnPycpLnJlcGxhY2UoL++8hu+8hi9nLCAnJicpIDogKHYuZXh0cmEgfHwge30pLnVybCB8fCAnaGlrZXI6Ly9lbXB0eScgKyBmbGFnICsgJz8nICsgKHBhcmFtcyB8fCAnJylcXG4gICAgICAgICAgICAgICAgTVlfX1JVTEUuZGV0YWlsX2ZpbmRfcnVsZSA9IHN1YlBhZ2UucnVsZVxcbiAgICAgICAgICAgICAgICBNWV9fUlVMRS5kZXRhaWxfY29sX3R5cGUgPSBzdWJQYWdlLmNvbF90eXBlXFxuICAgICAgICAgICAgICAgIE1ZX19SVUxFLnBhcmFtcyA9IHYuZXh0cmEgfHwge31cXG4gICAgICAgICAgICB9IGVsc2UgaWYgKHYudXJsLmluY2x1ZGVzKCdAbGF6eVJ1bGU9JykpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJlSW5kZXggPSB2LnVybC5pbmRleE9mKCcuanM6JylcXG4gICAgICAgICAgICAgICAgaWYgKHJlSW5kZXggPj0gMCkgdi51cmwgPSB2LnVybC5zbGljZSgwLCByZUluZGV4KSArICcuanM6XFxcXG5pZihNWV9SVUxFKXtNWV9SVUxFLnBhZ2VzPScgKyBKU09OLnN0cmluZ2lmeShNWV9SVUxFLnBhZ2VzKSArICd8fFxcXCJbXVxcXCI7TVlfUlVMRS5wYWdlTGlzdD1KU09OLnBhcnNlKE1ZX1JVTEUucGFnZXMpO30nICsgdi51cmwuc2xpY2UocmVJbmRleCArIDQpXFxuICAgICAgICAgICAgICAgIHJldHVybiB2XFxuICAgICAgICAgICAgfSBlbHNlIGlmICghTVlfUlVMRS5kZXRhaWxfZmluZF9ydWxlIHx8IHYudXJsLnN0YXJ0c1dpdGgoJ2hpa2VyOi8vJykpIHtcXG4gICAgICAgICAgICAgICAgaWYgKCF2LnVybC5zdGFydHNXaXRoKCdoaWtlcjovL2VtcHR5IycpKVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdi5leHRyYSA9IHtcXG4gICAgICAgICAgICAgICAgdXJsOiB2LnVybCxcXG4gICAgICAgICAgICAgICAgUlVMRTogTVlfX1JVTEUsXFxuICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogdi50aXRsZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB2LnVybCA9ICdoaWtlcjovL3BhZ2UvZGV0YWlsTG9hZD9ydWxlPScgKyBnZXRJdGVtKCdteUNvbGxlY3Rpb24nKVxcbiAgICAgICAgICAgIGlmICh2LmV4dHJhLlJVTEUudXJsLmluY2x1ZGVzKCcjaW1tZXJzaXZlVGhlbWUjJykpIHYudXJsICs9ICcmI2ltbWVyc2l2ZVRoZW1lIydcXG4gICAgICAgICAgICByZXR1cm4gdlxcbiAgICAgICAgfSkpXFxuICAgICAgICBtZXRob2Rfc2V0UmVzdWx0Lmludm9rZShqYXZhQ29udGV4dCwgbXlDb2xsZWN0aW9uX2VsLCBwYXJhbTEsIHBhcmFtMiwgcGFyYW0zKVxcbiAgICB9XFxuICAgIHNldEhvbWVSZXN1bHQgPSBzZXRSZXN1bHRcXG4gICAgc2V0U2VhcmNoUmVzdWx0ID0gc2V0UmVzdWx0XFxuXFxuICAgIGV2YWwoTVlfUlVMRS5maW5kX3J1bGUuc2xpY2UoMykpXFxufSBlbHNlIHtcXG4gICAgbGV0IGZpbmRSdWxlID0gTVlfUlVMRS5maW5kX3J1bGUuc3BsaXQoJzsnKVxcbiAgICBwYXJzZURvbUZvckFycmF5KGluZGV4SHRtbCwgZmluZFJ1bGUuc2hpZnQoKSkuZm9yRWFjaCgoZGF0YSkgPT4ge1xcbiAgICAgICAgbGV0IFt0aXRsZSwgaW1nLCBkZXNjLCB1cmxdID0gZmluZFJ1bGUubWFwKCh2LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodiA9PSAnKicpIHJldHVybiAnJ1xcbiAgICAgICAgICAgICAgICAgICAgZWxzZSB2ID0gKGkgPT0gMSB8fCBpID09IDMpID9cXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJzZURvbShkYXRhLCB2KSA6XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VEb21Gb3JIdG1sKGRhdGEsIHYpXFxuICAgICAgICAgICAgICAgICAgICBpZiAoaSAhPSAzKSB2ID0gcnVuQ29kZSh2KVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICByZXMgPSB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgdXJsOiB1cmwsXFxuICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogTVlfUlVMRS5jb2xfdHlwZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIGlmIChyZXMudXJsKSB7XFxuICAgICAgICAgICAgaWYgKHJlcy51cmwuaW5jbHVkZXMoJ0BsYXp5UnVsZT0nKSkge1xcbiAgICAgICAgICAgICAgICAgbGV0IHJlSW5kZXggPSByZXMudXJsLmluZGV4T2YoJy5qczonKVxcbiAgICAgICAgICAgICAgICBpZiAocmVJbmRleCA+PSAwKSByZXMudXJsID0gcmVzLnVybC5zbGljZSgwLCByZUluZGV4KSArICcuanM6XFxcXG5pZihNWV9SVUxFKXtNWV9SVUxFLnBhZ2VzPScgKyBKU09OLnN0cmluZ2lmeShNWV9SVUxFLnBhZ2VzKSArICd8fFxcXCJbXVxcXCI7TVlfUlVMRS5wYWdlTGlzdD1KU09OLnBhcnNlKE1ZX1JVTEUucGFnZXMpO30nICsgcmVzLnVybC5zbGljZShyZUluZGV4ICsgNClcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKE1ZX1JVTEUuZGV0YWlsX2ZpbmRfcnVsZSkge1xcbiAgICAgICAgICAgICAgICByZXMuZXh0cmEgPSB7XFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICAgICAgICAgIFJVTEU6IE1ZX1JVTEUsXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IHRpdGxlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmVzLnVybCA9ICdoaWtlcjovL3BhZ2UvZGV0YWlsTG9hZD9ydWxlPScgKyBnZXRJdGVtKCdteUNvbGxlY3Rpb24nKVxcbiAgICAgICAgICAgICAgICBpZiAocmVzLmV4dHJhLlJVTEUudXJsLmluY2x1ZGVzKCcjaW1tZXJzaXZlVGhlbWUjJykpIHJlcy51cmwgKz0gJyYjaW1tZXJzaXZlVGhlbWUjJ1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gIC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ICAgICAgICAgICAgICAgIHYudXJsID0gdXJsXFxuICAgICAgICAgICAgICAgIE1ZX19SVUxFLmRldGFpbF9maW5kX3J1bGUgPSBydWxlXFxuICAgICAgICAgICAgICAgIE1ZX19SVUxFLmRldGFpbF9jb2xfdHlwZSA9IE1ZX1JVTEUuY29sX3R5cGVcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKHYudXJsLnN0YXJ0c1dpdGgoJ2hpa2VyOi8vcGFnZS8nKSkge1xcbiAgICAgICAgICAgICAgICBpZiAodi51cmwuaW5jbHVkZXMoJ3J1bGU9JykgfHwgKHYuZXh0cmEgfHwge30pLnJ1bGUpXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlxcbiAgICAgICAgICAgICAgICBsZXQgW18sIHBhdGgsIGZsYWcsIHBhcmFtc10gPSB2LnVybC5tYXRjaCgvXmhpa2VyOlxcXFwvXFxcXC9wYWdlXFxcXC8oLis/KSgjLio/KT8oPzpcXFxcPyguKikpPyQvKSxcXG4gICAgICAgICAgICAgICAgICAgIHN1YlBhZ2UgPSBNWV9SVUxFLnBhZ2VMaXN0LmZpbmQoKHYpID0+IHYucGF0aCA9PSBwYXRoKSxcXG4gICAgICAgICAgICAgICAgICAgIHN1YlVybCA9IChwYXJhbXMgfHwgJycpLnNwbGl0KCcmJykuZmluZCgodikgPT4gdi5zdGFydHNXaXRoKCd1cmw9JykpXFxuICAgICAgICAgICAgICAgIHYudXJsID0gc3ViVXJsID8gc3ViVXJsLnNsaWNlKDQpLnJlcGxhY2UoL++8n++8ny9nLCAnPycpLnJlcGxhY2UoL++8hu+8hi9nLCAnJicpIDogKHYuZXh0cmEgfHwge30pLnVybCB8fCAnaGlrZXI6Ly9lbXB0eScgKyBmbGFnICsgJz8nICsgKHBhcmFtcyB8fCAnJylcXG4gICAgICAgICAgICAgICAgTVlfX1JVTEUuZGV0YWlsX2ZpbmRfcnVsZSA9IHN1YlBhZ2UucnVsZVxcbiAgICAgICAgICAgICAgICBNWV9fUlVMRS5kZXRhaWxfY29sX3R5cGUgPSBzdWJQYWdlLmNvbF90eXBlXFxuICAgICAgICAgICAgICAgIE1ZX19SVUxFLnBhcmFtcyA9IHYuZXh0cmEgfHwge31cXG4gICAgICAgICAgICB9IGVsc2UgaWYgKHYudXJsLmluY2x1ZGVzKCdAbGF6eVJ1bGU9JykpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJlSW5kZXggPSB2LnVybC5pbmRleE9mKCcuanM6JylcXG4gICAgICAgICAgICAgICAgaWYgKHJlSW5kZXggPj0gMCkgdi51cmwgPSB2LnVybC5zbGljZSgwLCByZUluZGV4KSArICcuanM6XFxcXG5pZihNWV9SVUxFKXtNWV9SVUxFLnBhZ2VzPScgKyBKU09OLnN0cmluZ2lmeShNWV9SVUxFLnBhZ2VzKSArICd8fFxcXCJbXVxcXCI7TVlfUlVMRS5wYWdlTGlzdD1KU09OLnBhcnNlKE1ZX1JVTEUucGFnZXMpO30nICsgdi51cmwuc2xpY2UocmVJbmRleCArIDQpXFxuICAgICAgICAgICAgICAgIHJldHVybiB2XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHZcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdi5leHRyYSA9IHtcXG4gICAgICAgICAgICAgICAgdXJsOiB2LnVybCxcXG4gICAgICAgICAgICAgICAgUlVMRTogTVlfX1JVTEVcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdi51cmwgPSAnaGlrZXI6Ly9wYWdlL2RldGFpbExvYWQ/cnVsZT0nICsgZ2V0SXRlbSgnbXlDb2xsZWN0aW9uJylcXG4gICAgICAgICAgICBpZiAodi5leHRyYS5SVUxFLnVybC5pbmNsdWRlcygnI2ltbWVyc2l2ZVRoZW1lIycpKSB2LnVybCArPSAnJiNpbW1lcnNpdmVUaGVtZSMnXFxuICAgICAgICAgICAgcmV0dXJuIHZcXG4gICAgICAgIH0pKVxcbiAgICAgICAgbWV0aG9kX3NldFJlc3VsdC5pbnZva2UoamF2YUNvbnRleHQsIG15Q29sbGVjdGlvbl9lbCwgcGFyYW0xLCBwYXJhbTIsIHBhcmFtMylcXG4gICAgfVxcbiAgICBzZXRIb21lUmVzdWx0ID0gc2V0UmVzdWx0XFxuICAgIHNldFNlYXJjaFJlc3VsdCA9IHNldFJlc3VsdFxcblxcbiAgICBldmFsKE1ZX1JVTEUuZmluZF9ydWxlLnNsaWNlKDMpKVxcbn0gZWxzZSB7XFxuICAgIGxldCBbXywgZmluZFJ1bGUsIGRldGFpbEZpbmRSdWxlXSA9IE1ZX1JVTEUuZmluZF9ydWxlLm1hdGNoKC9eKC4qPykoPzo9PT4oLiopKT8kLylcXG4gICAgZmluZFJ1bGUgPSBmaW5kUnVsZS5zcGxpdCgnOycpXFxuICAgIHBhcnNlRG9tRm9yQXJyYXkoaW5kZXhIdG1sLCBmaW5kUnVsZS5zaGlmdCgpKS5mb3JFYWNoKChkYXRhKSA9PiB7XFxuICAgICAgICBsZXQgW3RpdGxlLCBpbWcsIGRlc2MsIHVybF0gPSBmaW5kUnVsZS5tYXAoKHYsIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIGlmICh2ID09ICcqJykgcmV0dXJuICcnXFxuICAgICAgICAgICAgICAgICAgICBlbHNlIHYgPSAoaSA9PSAxIHx8IGkgPT0gMykgP1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tKGRhdGEsIHYpIDpcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJzZURvbUZvckh0bWwoZGF0YSwgdilcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpICE9IDMpIHYgPSBydW5Db2RlKHYpXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJydcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgIHJlcyA9IHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgICAgICAgaW1nOiBpbWcsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBNWV9SVUxFLmNvbF90eXBlXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgaWYgKHJlcy51cmwpIHtcXG4gICAgICAgICAgICBpZiAocmVzLnVybC5pbmNsdWRlcygnQGxhenlSdWxlPScpKSB7XFxuICAgICAgICAgICAgICAgICBsZXQgcmVJbmRleCA9IHJlcy51cmwuaW5kZXhPZignLmpzOicpXFxuICAgICAgICAgICAgICAgIGlmIChyZUluZGV4ID49IDApIHJlcy51cmwgPSByZXMudXJsLnNsaWNlKDAsIHJlSW5kZXgpICsgJy5qczpcXFxcbmlmKE1ZX1JVTEUpe01ZX1JVTEUucGFnZXM9JyArIEpTT04uc3RyaW5naWZ5KE1ZX1JVTEUucGFnZXMpICsgJ3x8XFxcIltdXFxcIjtNWV9SVUxFLnBhZ2VMaXN0PUpTT04ucGFyc2UoTVlfUlVMRS5wYWdlcyk7fScgKyByZXMudXJsLnNsaWNlKHJlSW5kZXggKyA0KVxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoZGV0YWlsRmluZFJ1bGUpIHtcXG4gICAgICAgICAgICAgICAgcmVzLmV4dHJhID0ge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1cmwsXFxuICAgICAgICAgICAgICAgICAgICBSVUxFOiBPYmplY3QuYXNzaWduKHt9LCBNWV9SVUxFLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGV0YWlsX2ZpbmRfcnVsZTogZGV0YWlsRmluZFJ1bGVcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICA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VVcmwnKVxcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIGxldCByZW1vdGVEYXRhID0gZmV0Y2godXJsKVxcbiAgICAgICAgICAgICAgICBpZiAodXJsLnN0YXJ0c1dpdGgoJ2hpa2VyOi8vcGFnZS8nKSlcXG4gICAgICAgICAgICAgICAgICAgIHJlbW90ZURhdGEgPSBKU09OLnBhcnNlKHJlbW90ZURhdGEpLnJ1bGVcXG4gICAgICAgICAgICAgICAgZGF0YSA9IEpTT04ucGFyc2UocmVtb3RlRGF0YSlcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICAgICAgICAgIGlmKGRhdGEubGVuZ3RoID09IDApIHtcXG4gICAgICAgICAgICAgICAgZGF0YSA9IEpTT04ucGFyc2UocmVhZEZpbGUoJ2RhdGFDYWNoZScpIHx8ICdbXScpXFxuICAgICAgICAgICAgICAgIGxvZygn5rKh5pyJ6I635Y+W5Yiw5pu05paw5pWw5o2uJylcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBkYXRhID0gZGF0YS5maWx0ZXIoKHYpID0+IHsgcmV0dXJuIHYudGl0bGUgIT0gZ2V0SXRlbSgnbXlDb2xsZWN0aW9uJykgJiYgIXYuYXV0aG9yLmluY2x1ZGVzKCfovbvlkIjpm4bnlJ/miJDlmagnKSB9KVxcbiAgICAgICAgICAgICAgICBzYXZlRmlsZSgnZGF0YUNhY2hlJywgSlNPTi5zdHJpbmdpZnkoZGF0YSkpXFxuICAgICAgICAgICAgICAgIHNhdmVGaWxlKCd1cGRhdGVUaW1lJywgbm93LnRvU3RyaW5nKCkpXFxuICAgICAgICAgICAgICAgIGxvZygn5pu05paw5pWw5o2u5bey5YaZ5YWl5pys5ZywJylcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGRhdGEgPSBKU09OLnBhcnNlKHJlYWRGaWxlKCdkYXRhQ2FjaGUnKSB8fCAnW10nKVxcbiAgICAgICAgfVxcbiAgICAgICAgLy8g5YaZ5YWl6Ieq5a6a5LmJ5pWw5o2uXFxuICAgICAgICBsZXQgY3VzdG9tRGF0YSA9IEpTT04ucGFyc2UocmVhZEZpbGUoJ2N1c3RvbURhdGEnKSB8fCAnW10nKSxcXG4gICAgICAgICAgICByZXdyaXRlRGF0YSA9IFtdXFxuICAgICAgICBjdXN0b21EYXRhID0gY3VzdG9tRGF0YS5yZWR1Y2UoKHNlbGYsIHYpID0+IHtcXG4gICAgICAgICAgICBsZXQgaW5kZXggPSBkYXRhLmZpbmRJbmRleCgodnYpID0+IHYudGl0bGUgPT0gdnYudGl0bGUpXFxuICAgICAgICAgICAgaWYgKGluZGV4ID49IDApIHtcXG4gICAgICAgICAgICAgICAgc2VsZi5wdXNoKHYpXFxuICAgICAgICAgICAgICAgIGxldCBydWxlID0gZGF0YS5zcGxpY2UoaW5kZXgsIDEpWzBdXFxuICAgICAgICAgICAgICAgIGlmKHNob3dBbGwgfHwgdi52aXNpYmxlKVxcbiAgICAgICAgICAgICAgICAgICAgcmV3cml0ZURhdGEucHVzaChPYmplY3QuYXNzaWduKHJ1bGUsIHYpKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gc2VsZlxcbiAgICAgICAgfSwgW10pXFxuICAgICAgICBkYXRhLmZvckVhY2goKHYpID0+IGN1c3RvbURhdGEucHVzaCh7IHRpdGxlOiB2LnRpdGxlLCB2aXNpYmxlOiB0cnVlIH0pKVxcbiAgICAgICAgc2F2ZUZpbGUoJ2N1c3RvbURhdGEnLCBKU09OLnN0cmluZ2lmeShjdXN0b21EYXRhKSlcXG4gICAgICAgIHJldHVybiByZXdyaXRlRGF0YS5jb25jYXQoZGF0YSlcXG4gICAgfSxcXG4gICAgcnVuQ29kZTogZnVuY3Rpb24ocnVsZSkge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBsZXQgW2lucHV0LCBjb2RlXSA9IHJ1bGUuc3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vcmlVcmwucmVwbGFjZSgv77yf77yfL2csICc/JylcXG4gICAgICAgICAgICBpZiAoYm9keS5zdGFydHNXaXRoKCdKc29uQm9keT0nKSkgYm9keSA9IGJvZHkuc2xpY2UoOSlcXG4gICAgICAgICAgICBvcHRpb25zWydib2R5J10gPSBib2R5XFxuICAgICAgICB9XFxuICAgICAgICBpZiAodXJsWzJdKSBvcHRpb25zLmhlYWRlcnNbJ0NvbnRlbnQtVHlwZSddID0gJ3RleHQvcGxhaW47Y2hhcnN0PScgKyB1cmxbMl1cXG4gICAgICAgIGlmICh1cmxbM10pIHVybFszXS5tYXRjaCgveyguKil9LylbMV0uc3BsaXQoJyYmJykuZm9yRWFjaCgodikgPT4ge1xcbiAgICAgICAgICAgIGxldCBba2V5LCB2YWx1ZV0gPSB2LnNwbGl0KCdAJylcXG4gICAgICAgICAgICBvcHRpb25zLmhlYWRlcnNba2V5XSA9IHJ1bkNvZGUodmFsdWUpXFxuICAgICAgICB9KVxcbiAgICAgICAgLy8g5re75Yqg5YWo5bGAVUFcXG4gICAgICAgIGlmICghb3B0aW9ucy5oZWFkZXJzWydVc2VyLUFnZW50J10pIHtcXG4gICAgICAgICAgICBpZiAoTVlfUlVMRS51YSA9PSAncGMnKVxcbiAgICAgICAgICAgICAgICBvcHRpb25zLmhlYWRlcnNbJ1VzZXItQWdlbnQnXSA9IFBDX1VBXFxuICAgICAgICAgICAgZWxzZSBpZiAoTVlfUlVMRS51YSA9PSAnbW9iaWxlJylcXG4gICAgICAgICAgICAgICAgb3B0aW9ucy5oZWFkZXJzWydVc2VyLUFnZW50J10gPSBNT0JJTEVfVUFcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiB7IE1ZX1VSTDogdXJsWzBdLCBNWV9VUkxfT3B0aW9uczogb3B0aW9ucyB9XFxuICAgIH1cXG59XFxuXCJ9LHtcImNvbF90eXBlXCI6XCJpY29uXzJfcm91bmRcIixcIm5hbWVcIjpcIuiuvue9rlwiLFwicGF0aFwiOlwi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ICAgICBpZiAoc29ydEZsYWcgPT0gLTEpXFxuICAgICAgICAgICAgICAgIGQudXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcHV0VmFyKCdteUNvbGxlY3Rpb24tc29ydEZsYWcnLCBpLnRvU3RyaW5nKCkpXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/pgInmi6nopoHnp7vliqjliLDnmoTkvY3nva4nXFxuICAgICAgICAgICAgICAgIH0sIGkpXFxuICAgICAgICAgICAgZWxzZVxcbiAgICAgICAgICAgICAgICBkLnVybCA9ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKG9sZEluZGV4LCBuZXdJbmRleCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnY3VzdG9tRGF0YScpIHx8ICdbXScpXFxuICAgICAgICAgICAgICAgICAgICBydWxlcy5zcGxpY2UobmV3SW5kZXgsIDAsIHJ1bGVzLnNwbGljZShvbGRJbmRleCwgMSlbMF0pXFxuICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZSgnY3VzdG9tRGF0YScsIEpTT04uc3RyaW5naWZ5KHJ1bGVzKSlcXG4gICAgICAgICAgICAgICAgICAgIHB1dFZhcignbXlDb2xsZWN0aW9uLXNvcnRGbGFnJywgJy0xJylcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgICAgICAgICB9LCBzb3J0RmxhZywgaSlcXG4gICAgICAgICAgICBicmVha1xcbiAgICAgICAgY2FzZSAn5pu05pS55Zu+5qCHJzpcXG4gICAgICAgICAgICBkLnVybCA9ICQodi5pY29uIHx8ICcnLCAn6L6T5YWl5paw5Zu+5qCH5Zyw5Z2A5oiW6aKc6Imy5Luj56CB77yaJykuaW5wdXQoKHJ1bGUpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnY3VzdG9tRGF0YScpIHx8ICdbXScpLFxcbiAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBydWxlcy5maW5kSW5kZXgoKHYpID0+IHYudGl0bGUgPT0gcnVsZS50aXRsZSlcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0KVxcbiAgICAgICAgICAgICAgICAgICAgcnVsZXNbaW5kZXhdLmljb24gPSBpbnB1dFxcbiAgICAgICAgICAgICAgICBlbHNlXFxuICAgICAgICAgICAgICAgICAgICBkZWxldGUgcnVsZXNbaW5kZXhdLmljb25cXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ2N1c3RvbURhdGEnLCBKU09OLnN0cmluZ2lmeShydWxlcykpXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxuICAgICAgICAgICAgfSwgdilcXG4gICAgICAgICAgICBicmVha1xcbiAgICAgICAgY2FzZSAn5a+85YWl5rW36ZiUJzpcXG4gICAgICAgICAgICBkLnVybCA9ICdydWxlOi8vJyArIGJhc2U2NEVuY29kZShKU09OLnN0cmluZ2lmeShkYXRhW2ldKSlcXG4gICAgICAgICAgICBicmVha1xcbiAgICB9XFxuICAgIGVsLnB1c2goZClcXG59KVxcbnNldFJlc3VsdChlbClcXG5cIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIumHjeWGmeS7o+eggVwiLFwicGF0aFwiOlwicmVzZXRcIixcInJ1bGVcIjpcImZ1bmN0aW9uIGNvbW1vbigpIHtcXG4gICAgbGV0IHJDYWNoZSA9IHt9O1xcbiAgICByZXF1aXJ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ICAgICBjb21tb24oKTtcXG4gICAgfSxcXG4gICAgc2VhcmNoOiBmdW5jdGlvbigpIHtcXG4gICAgICAgIGNvbW1vbigpO1xcbiAgICB9LFxcbiAgICBjOiBmdW5jdGlvbigpIHtcXG4gICAgICAgIGNvbW1vbigpO1xcbiAgICB9LFxcbiAgICBkZXRhaWw6IGZ1bmN0aW9uKCkge1xcbiAgICAgICAgY29tbW9uKCk7XFxuICAgICAgICBsZXQgX3ByZSA9IE1ZX1JVTEUucHJlUnVsZTtcXG4gICAgICAgIGxldCBfbXljID0gZ2V0SXRlbSgnbXlDb2xsZWN0aW9uJylcXG4gICAgICAgIC8v57uZ5pyA5paw56ug6IqC6KeE5YiZ5rOo5YWl6aKE5aSE55CG5Luj56CBXFxuICAgICAgICBzZXRMYXN0Q2hhcHRlclJ1bGUgPSBmdW5jdGlvbihwYXJhbTApIHtcXG4gICAgICAgICAgICBpZiAoIXBhcmFtMCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHBhcmFtMC5zdGFydHNXaXRoKFxcXCJqczpcXFwiKSAmJiBNWV9SVUxFLnByZVJ1bGUpIHtcXG4gICAgICAgICAgICAgICAgbGV0IGluamVjdCA9IFxcXCJsZXQgX3IgPSBmZXRjaChcXFxcXFxcImhpa2VyOi8vcGFnZS9yZXNldD9ydWxlPVxcXCIgKyBfbXljICsgXFxcIlxcXFxcXFwiKTtcXFxcblxcXCIgK1xcbiAgICAgICAgICAgICAgICAgICAgXFxcImV2YWwoSlNPTi5wYXJzZShfcikucnVsZSkuYygpO1xcXFxuXFxcIiArXFxuICAgICAgICAgICAgICAgICAgICBcXFwiZXZhbCh1bmVzY2FwZSgnXFxcIiArIGVzY2FwZShfcHJlKSArIFxcXCInKSk7XFxcXG5cXFwiICtcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJsZXQgX2NmZyA9IGdldE15VmFyKCdpbml0Q29uZmlnJywgJ3t9Jyk7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cXG4gICAgICAgICAgICAgICAgc3RyRGF0ZSA9IFxcXCIwXFxcIiArIHN0ckRhdGVcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHN0ckhvdXJzID49IDAgJiYgc3RySG91cnMgPD0gOSkge1xcbiAgICAgICAgICAgICAgICBzdHJIb3VycyA9IFxcXCIwXFxcIiArIHN0ckhvdXJzXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChzdHJNaW51dGVzID49IDAgJiYgc3RyTWludXRlcyA8PSA5KSB7XFxuICAgICAgICAgICAgICAgIHN0ck1pbnV0ZXMgPSBcXFwiMFxcXCIgKyBzdHJNaW51dGVzXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChzdHJTZWNvbmRzID49IDAgJiYgc3RyU2Vjb25kcyA8PSA5KSB7XFxuICAgICAgICAgICAgICAgIHN0clNlY29uZHMgPSBcXFwiMFxcXCIgKyBzdHJTZWNvbmRzXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIC8vbGV0IGN1cnJlbnRkYXRlID0gZGF0ZS5nZXRGdWxsWWVhcigpICsgc2VwZXJhdG9yMSArIG1vbnRoICsgc2VwZXJhdG9yMSArIHN0ckRhdGUgKyBcXFwiIFxcXCIgKyBzdHJIb3VycyArIHNlcGVyYXRvcjIgKyBzdHJNaW51dGVzICsgc2VwZXJhdG9yMiArIHN0clNlY29uZHM7XFxuICAgICAgICAgICAgbGV0IGN1cnJlbnRkYXRlID0gKGRhdGUuZ2V0RnVsbFllYXIoKS0yMDIwKSsnJysgbW9udGggKycnKyBzdHJEYXRlICsnJysgc3RySG91cnMrJycgKyBzdHJNaW51dGVzICsnJysgTWF0aC5jZWlsKHN0clNlY29uZHMvNyk7XFxuICAgICAgICAgICAgcmV0dXJuIHBhcnNlSW50KGN1cnJlbnRkYXRlKVxcbiAgICAgICAgfVxcbiQuZXhwb3J0cy5nZXROb3dGb3JtYXREYXRlID0gZ2V0Tm93Rm9ybWF0R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AgICAgICAgICAgICAgbW9udGggPSBcXFwiMFxcXCIgKyBtb250aFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoc3RyRGF0ZSA+PSAwICYmIHN0ckRhdGUgPD0gOSkge1xcbiAgICAgICAgICAgICAgICBzdHJEYXRlID0gXFxcIjBcXFwiICsgc3RyRGF0ZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoc3RySG91cnMgPj0gMCAmJiBzdHJIb3VycyA8PSA5KSB7XFxuICAgICAgICAgICAgICAgIHN0ckhvdXJzID0gXFxcIjBcXFwiICsgc3RySG91cnNcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHN0ck1pbnV0ZXMgPj0gMCAmJiBzdHJNaW51dGVzIDw9IDkpIHtcXG4gICAgICAgICAgICAgICAgc3RyTWludXRlcyA9IFxcXCIwXFxcIiArIHN0ck1pbnV0ZXNcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHN0clNlY29uZHMgPj0gMCAmJiBzdHJTZWNvbmRzIDw9IDkpIHtcXG4gICAgICAgICAgICAgICAgc3RyU2Vjb25kcyA9IFxcXCIwXFxcIiArIHN0clNlY29uZHNcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgLy9sZXQgY3VycmVudGRhdGUgPSBkYXRlLmdldEZ1bGxZZWFyKCkgKyBzZXBlcmF0b3IxICsgbW9udGggKyBzZXBlcmF0b3IxICsgc3RyRGF0ZSArIFxcXCIgXFxcIiArIHN0ckhvdXJzICsgc2VwZXJhdG9yMiArIHN0ck1pbnV0ZXMgKyBzZXBlcmF0b3IyICsgc3RyU2Vjb25kcztcXG4gICAgICAgICAgICBsZXQgY3VycmVudGRhdGUgPSAoZGF0ZS5nZXRGdWxsWWVhcigpLTIwMjApKycnKyBtb250aCArJycrIHN0ckRhdGUgKycnKyBzdHJIb3VycysnJyArIHN0ck1pbnV0ZXMgKycnKyBNYXRoLmNlaWwoc3RyU2Vjb25kcy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HlwZSB8fCBNWV9SVUxFLmNvbF90eXBlXFxuXFxuICAgICAgICAgICAgaWYgKCF2LnVybCB8fCBbJ3J1bGUnLCAncGljcycsICd0b2FzdCcsICdpbnB1dCcsICdjb3B5JywgJ2VkaXRGaWxlJywgJ3g1JywgJ3g1V2ViVmlldycsICd4NVBsYXknLCAnd2ViJywgJ3NlbGVjdCcsICd4NVJ1bGUnLCAnd2ViUnVsZSddLmZpbmQoKHZ2KSA9PiB2LnVybC5zdGFydHNXaXRoKHZ2ICsgJzovLycpKSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdlxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodi51cmwuaW5jbHVkZXMoJ0BydWxlPScpKSB7XFxuICAgICAgICAgICAgICAgIGxldCBbXywgdXJsLCBydWxlXSA9IHYudXJsLm1hdGNoKC9eKFtcXFxcc1xcXFxTXSo/KUBydWxlPShbXFxcXHNcXFxcU10qKSQvKVxcbiAgICAgICAgICAgICAgICB2LnVybCA9IHVybFxcbiAgICAgICAgICAgICAgICBNWV9fUlVMRS5kZXRhaWxfZmluZF9ydWxlID0gcnVsZVxcbiAgICAgICAgICAgICAgICBNWV9fUlVMRS5kZXRhaWxfY29sX3R5cGUgPSBNWV9SVUxFLmNvbF90eXBlXFxuICAgICAgICAgICAgfSBlbHNlIGlmICh2LnVybC5zdGFydHNXaXRoKCdoaWtlcjovL3BhZ2UvJykpIHtcXG4gICAgICAgICAgICAgICAgaWYgKHYudXJsLmluY2x1ZGVzKCdydWxlPScpIHx8ICh2LmV4dHJhIHx8IHt9KS5ydWxlKVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZcXG4gICAgICAgICAgICAgICAgbGV0IFtfLCBwYXRoLCBmbGFnLCBwYXJhbXNdID0gdi51cmwubWF0Y2goL15oaWtlcjpcXFxcL1xcXFwvcGFnZVxcXFwvKC4rPykoIy4qPyk/KD86XFxcXD8oLiopKT8kLyksXFxuICAgICAgICAgICAgICAgICAgICBzdWJ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b3JBcnJheShpbmRleEh0bWwsIGZpbmRSdWxlLnNoaWZ0KCkpLmZvckVhY2goKGRhdGEpID0+IHtcXG4gICAgICAgIGxldCBbdGl0bGUsIGltZywgZGVzYywgdXJsXSA9IGZpbmRSdWxlLm1hcCgodiwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHYgPT0gJyonKSByZXR1cm4gJydcXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgdiA9IChpID09IDEgfHwgaSA9PSAzKSA/XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VEb20oZGF0YSwgdikgOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tRm9ySHRtbChkYXRhLCB2KVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgIT0gMykgdiA9IHJ1bkNvZGUodilcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2XFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnJ1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgcmVzID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBkZXNjLFxcbiAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IE1ZX1JVTEUuY29sX3R5cGVcXG4gICAgICAgICAgICB9XFxuICAgICAgICBpZiAocmVzLnVybCkge1xcbiAgICAgICAgICAgIGlmIChyZXMudXJsLmluY2x1ZGVzKCdAbGF6eVJ1bGU9JykpIHtcXG4gICAgICAgICAgICAgICAgIGxldCByZUluZGV4ID0gcmVzLnVybC5pbmRleE9mKCcuanM6JylcXG4gICAgICAgICAgICAgICAgaWYgKHJlSW5kZX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ICAgICAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2lnbiwgaWQsIG5vdykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0VmFyKHNpZ24gKyBpZCwgbm93KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0VmFyKHNpZ24sIG5vdylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcXFxuICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLnNpZ24sIGlkLCBub3cpLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nXFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICBlbC5wdXNoKHsgY29sX3R5cGU6IHRoaXMuYm91bmRhcnkgfSlcXFxcbiAgICAgICAgfSlcXFxcbiAgICB9LFxcXFxuICAgIGluaXQoY2xhc3NPYmplY3QpIHtcXFxcbiAgICAgICAgaWYgKHR5cGVvZiBjbGFzc09iamVjdC5jbGFzc19uYW1lID09ICdzdHJpbmcnKVxcXFxuICAgICAgICAgICAgY2xhc3NPYmplY3QuY2xhc3NfbmFtZSA9IGNsYXNzT2JqZWN0LmNsYXNzX25hbWUuc3BsaXQoJyYnKVxcXFxuICAgICAgICBpZiAodHlwZW9mIGNsYXNzT2JqZWN0LmNsYXNzX3VybCA9PSAnc3RyaW5nJylcXFxcbiAgICAgICAgICAgIGNsYXNzT2JqZWN0LmNsYXNzX3VybCA9IGNsYXNzT2JqZWN0LmNsYXNzX3VybC5zcGxpdCgnJicpLm1hcCgodikgPT4gdi50cmltKCkpXFxcXG4gICAgICAgIHJldHVybiBjbGFzc09iamVjdFxcXFxuICAgIH0sXFxcXG4gICAgcHVzaChjbGFzc09iam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Jz8nICsgKHBhcmFtcyB8fCAnJylcXFxcbiAgICAgICAgICAgICAgICBNWV9fUlVMRS5kZXRhaWxfZmluZF9ydWxlID0gc3ViUGFnZS5ydWxlXFxcXG4gICAgICAgICAgICAgICAgTVlfX1JVTEUuZGV0YWlsX2NvbF90eXBlID0gc3ViUGFnZS5jb2xfdHlwZVxcXFxuICAgICAgICAgICAgICAgIE1ZX19SVUxFLnBhcmFtcyA9IHYuZXh0cmEgfHwge31cXFxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodi51cmwuaW5jbHVkZXMoJ0BsYXp5UnVsZT0nKSkge1xcXFxuICAgICAgICAgICAgICAgIGxldCByZUluZGV4ID0gdi51cmwuaW5kZXhPZignLmpzOicpXFxcXG4gICAgICAgICAgICAgICAgaWYgKHJlSW5kZXggPj0gMCkgdi51cmwgPSB2LnVybC5zbGljZSgwLCByZUluZGV4KSArICcuanM6XFxcXFxcXFxuaWYoTVlfUlVMRSl7TVlfUlVMRS5wYWdlcz0nICsgSlNPTi5zdHJpbmdpZnkoTVlfUlVMRS5wYWdlcykgKyAnfHxcXFxcXFxcIltdXFxcXFxcXCI7TVlfUlVMRS5wYWdlTGlzdD1KU09OLnBhcnNlKE1ZX1JVTEUucGFnZXMpO30nICsgdi51cmwuc2xpY2UocmVJbmRleCArIDQpXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHZcXFxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoIU1ZX1JVTEUuZGV0YWlsX2ZpbmRfcnVsZSB8fCB2LnVybC5zdGFydHNXaXRoKCdoaWtlcjovLycpKSB7XFxcXG4gICAgICAgICAgICAgICAgaWYgKCF2LnVybC5zdGFydHNXaXRoKCdoaWtlcjovL2VtcHR5IycpKVxcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgdi5leHRyYSA9IHtcXFxcbiAgICAgICAgICAgICAgICB1cmw6IHYudXJsLFxcXF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AgZWxzZSB2ID0gKGkgPT0gMSB8fCBpID09IDMpID9cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tKGRhdGEsIHYpIDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tRm9ySHRtbChkYXRhLCB2KVxcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoaSAhPSAzKSB2ID0gcnVuQ29kZSh2KVxcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlxcXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSksXFxcXG4gICAgICAgICAgICByZXMgPSB7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcXFxuICAgICAgICAgICAgICAgIHVybDogdXJsLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxcXG4gICAgICAgICAgICAgICAgaW1nOiBpbWcsXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IE1ZX1JVTEUuY29sX3R5cGVcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgaWYgKHJlcy51cmwpIHtcXFxcbiAgICAgICAgICAgIGlmIChyZXMudXJsLmluY2x1ZGVzKCdAbGF6eVJ1bGU9JykpIHtcXFxcbiAgICAgICAgICAgICAgICAgbGV0IHJlSW5kZXggPSByZXMudXJsLmluZGV4T2YoJy5qczonKVxcXFxuICAgICAgICAgICAgICAgIGlmIChyZUluZGV4ID49IDApIHJlcy51cmwgPSByZXMudXJsLnNsaWNlKDAsIHJlSW5kZXgpICsgJy5qczpcXFxcXFxcXG5pZihNWV9SVUxFKXtNWV9SVUxFLnBhZ2VzPScgKyBKU09OLnN0cmluZ2lmeShNWV9SVUxFLnBhZ2VzKSArICd8fFxcXFxcXFwiW11cXFxcXFxcIjtNWV9SVUxFLn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eXBlID0gTVlfUlVMRS5jb2xfdHlwZVxcXFxuICAgICAgICAgICAgfSBlbHNlIGlmICh2LnVybC5zdGFydHNXaXRoKCdoaWtlcjovL3BhZ2UvJykpIHtcXFxcbiAgICAgICAgICAgICAgICBpZiAodi51cmwuaW5jbHVkZXMoJ3J1bGU9JykgfHwgKHYuZXh0cmEgfHwge30pLnJ1bGUpXFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2XFxcXG4gICAgICAgICAgICAgICAgbGV0IFtfLCBwYXRoLCBmbGFnLCBwYXJhbXNdID0gdi51cmwubWF0Y2goL15oaWtlcjpcXFxcXFxcXC9cXFxcXFxcXC9wYWdlXFxcXFxcXFwvKC4rPykoIy4qPyk/KD86XFxcXFxcXFw/KC4qKSk/JC8pLFxcXFxuICAgICAgICAgICAgICAgICAgICBzdWJQYWdlID0gTVlfUlVMRS5wYWdlTGlzdC5maW5kKCh2KSA9PiB2LnBhdGggPT0gcGF0aCksXFxcXG4gICAgICAgICAgICAgICAgICAgIHN1YlVybCA9IChwYXJhbXMgfHwgJycpLnNwbGl0KCcmJykuZmluZCgodikgPT4gdi5zdGFydHNXaXRoKCd1cmw9JykpXFxcXG4gICAgICAgICAgICAgICAgdi51cmwgPSBzdWJVcmwgPyBzdWJVcmwuc2xpY2UoNCkucmVwbGFjZSgv77yf77yfL2csICc/JykucmVwbGFjZSgv77yG77yGL2csICcmJykgOiAodi5leHRyYSB8fCB7fSkudXJsIHx8ICdoaWtlcjovL2VtcHR5JyArIGZsYWcgKyAnPycgKyAocGFyYW1zIHx8ICcnKVxcXFxuICAgICAgICAgICAgICAgIE1ZX19SVUxFLmRldGFpbF9maW5kX3J1bGUgPSBzdWJQYWdlLnJ1bGVcXFxcbiAgICAgICAgICAgICAgICBNWV9fUlVMRS5kZXRhaWxfY29sX3R5cGUgPSBzdWJQYWdlLmNvbF90eXBlXFxcXG4gICAgICAgICAgICAgICAgTVlfX1JVTEUucGFyYW1zID0gdi5leHRyYSB8fCB7fVxcXFxuICAgICAgICAgICAgfSBlbHNlIGlmICh2LnVybC5pbmNsdWRlcygnQGxhenlSdWxlPScpKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHJlSW5kZXggPSB2LnVybC5pbmRleE9mKCcuanM6JylcXFxcbiAgICAgICAgICAgICAgICBpZiAocmVJbmRleCA+PSAwKSB2LnVybCA9IHYudXJsLnNsaWNlKDAsIHJlSW5kZXgpICsgJy5qczpcXFxcXFxcXG5pZihNWV9SVUxFKXtNWV9SVUxFLnBhZ2VzPScgKyBKU09OLnN0cmluZ2lmeShNWV9SVUxFLnBhZ2VzKSArICd8fFxcXFxcXFwiW11cXFxcXFxcIjtNWV9SVUxFLnBhZ2VMaXN0PUpTT04ucGFyc2UoTVlfUlVMRS5wYWdlcyk7fScgKyB2LnVybC5zbGljZShyZUluZGV4ICsgNClcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gdlxcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gdlxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgdi5leHRyYSA9IHtcXFxcbiAgICAgICAgICAgICAgICB1cmw6IHYudXJsLFxcXFxuICAgICAgICAgICAgICAgIFJVTEU6IE1ZX19SVUxFXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB2LnVybCA9ICdoaWtlcjovL3BhZ2UvZGV0YWlsTG9hZD9ydWxlPScgKyBnZXRJdGVtKCdteUNvbGxlY3Rpb24nKVxcXFxuICAgICAgICAgICAgaWYgKHYuZXh0cmEuUlVMRS51cmwuaW5jbHVkZXMoJyNpbW1lcnNpdmVUaGVtZSMnKSkgdi51cmwgKz0gJyYjaW1tZXJzaXZlVGhlbWUjJ1xcXFxuICAgICAgICAgICAgcmV0dXJuIHZcXFxcbiAgICAgICAgfSkpXFxcXG4gICAgICAgIG1ldGhvZF9zZXRSZXN1bHQuaW52b2tlKGphdmFDb250ZXh0LCBteUNvbGxlY3Rpb25fZWwsIHBhcmFtMSwgcGFyYW0yLCBwYXJhbTMpXFxcXG4gICAgfVxcXFxuICAgIHNldEhvbWVSZXN1bHQgPSBzZXRSZXN1bHRcXFxcbiAgICBzZXRTZWFyY2hSZXN1bHQgPSBzZXRSZXN1bHRcXFxcblxcXFxuICAgIGV2YWwoTVlfUlVMRS5maW5kX3J1bGUuc2xpY2UoMykpXFxcXG59IGVsc2Uge1xcXFxuICAgIGxldCBbXywgZmluZFJ1bGUsIGRldGFpbEZpbmRSdWxlXSA9IE1ZX1JVTEUuZmluZF9ydWxlLm1hdGNoKC9eKC4qPykoPzo9PT4oLiopKT8kLylcXFxcbiAgICBmaW5kUnVsZSA9IGZpbmRSdWxlLnNwbGl0KCc7JylcXFxcbiAgICBwYXJzZURvbUZvckFycmF5KGluZGV4SHRtbCwgZmluZFJ1bGUuc2hpZnQoKSkuZm9yRWFjaCgoZGF0YSkgPT4ge1xcXFxuICAgICAgICBsZXQgW3RpdGxlLCBpbWcsIGRlc2MsIHVybF0gPSBmaW5kUnVsZS5tYXAoKHYsIGkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAodiA9PSAnKicpIHJldHVybiAnJ1xcXFxuICAgICAgICAgICAgICAgICAgICBlbHNlIHYgPSAoaSA9PSAxIHx8IGkgPT0gMykgP1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VEb20oZGF0YSwgdikgOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VEb21Gb3JIdG1sKGRhdGEsIHYpXFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpICE9IDMpIHYgPSBydW5Db2RlKHYpXFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2XFxcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJydcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KSxcXFxcbiAgICAgICAgICAgIHJlcyA9IHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiB1cmwsXFxcXG4gICAgICAgICAgICAgICAgZGVzYzogZGVzYyxcXFxcbiAgICAgICAgICAgICAgICBpbWc6IGltZyxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogTVlfUlVMRS5jb2xfdHlwZVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICBpZiAocmVzLnVybCkge1xcXFxuICAgICAgICAgICAgaWYgKHJlcy51cmwuaW5jbHVkZXMoJ0BsYXp5UnVsZT0nKSkge1xcXFxuICAgICAgICAgICAgICAgICBsZXQgcmVJbmRleCA9IHJlcy51cmwuaW5kZXhPZignLmpzOicpXFxcXG4gICAgICAgICAgICAgICAgaWYgKHJlSW5kZXggPj0gMCkgcmVzLnVybCA9IHJlcy51cmwuc2xpY2UoMCwgcmVJbmRleCkgKyAnLmpzOlxcXFxcXFxcbmlmKE1ZX1JVTEUpe01ZX1JVTEUucGFnZXM9JyArIEpTT04uc3RyaW5naWZ5KE1ZX1JVTEUucGFnZXMpICsgJ3x8XFxcXFxcXCJbXVxcXFxcXFwiO01ZX1JVTEUucGFnZUxpc3Q9SlNPTi5wYXJzZShNWV9SVUxFLnBhZ2VzKTt9JyArIHJlcy51cmwuc2xpY2UocmVJbmRleCArIDQpXFxcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGRldGFpbEZpbmRSdWxlKSB7XFxcXG4gICAgICAgICAgICAgICAgcmVzLmV4dHJhID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgUlVMRTogT2JqZWN0LmFzc2lnbih7fSwgTVlfUlVMRSwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGV0YWlsX2ZpbmRfcnVsZTogZGV0YWlsRmluZFJ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m93IC0gdGltZSA+IDEwMDAgKiA2MCAqIDYwICogMjQgKiBpbnRlcnZhbCkge1xcXFxuICAgICAgICAgICAgLy8g6I635Y+W6L+c56iL5pWw5o2uXFxcXG4gICAgICAgICAgICBsZXQgdXJsID0gZ2V0SXRlbSgncmVtb3RlVXJsJylcXFxcbiAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHJlbW90ZURhdGEgPSBmZXRjaCh1cmwpXFxcXG4gICAgICAgICAgICAgICAgaWYgKHVybC5zdGFydHNXaXRoKCdoaWtlcjovL3BhZ2UvJykpXFxcXG4gICAgICAgICAgICAgICAgICAgIHJlbW90ZURhdGEgPSBKU09OLnBhcnNlKHJlbW90ZURhdGEpLnJ1bGVcXFxcbiAgICAgICAgICAgICAgICBkYXRhID0gSlNPTi5wYXJzZShyZW1vdGVEYXRhKVxcXFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge31cXFxcbiAgICAgICAgICAgIGlmKGRhdGEubGVuZ3RoID09IDApIHtcXFxcbiAgICAgICAgICAgICAgICBkYXRhID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnZGF0YUNhY2hlJykgfHwgJ1tdJylcXFxcbiAgICAgICAgICAgICAgICBsb2coJ+ayoeacieiOt+WPluWIsOabtOaWsOaVsOaNricpXFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhLmZpbHRlcigodikgPT4geyByZXR1cm4gdi50aXRsZSAhPSBnZXRJdGVtKCdteUNvbGxlY3Rpb24nKSAmJiAhdi5hdXRob3IuaW5jbHVkZXMoJ+i9u+WQiOmbhueUn+aIkOWZqCcpIH0pXFxcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoJ2RhdGFDYWNoZScsIEpTT04uc3RyaW5naWZ5KGRhdGEpKVxcXFxuICAgICAgICAgICAgICAgIHNhdmVGaWxlKCd1cGRhdGVUaW1lJywgbm93LnRvU3RyaW5nKCkpXFxcXG4gICAgICAgICAgICAgICAgbG9nKCfmm7TmlrDmlbDmja7lt7LlhpnlhaXmnKzlnLAnKVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgZGF0YSA9IEpTT04ucGFyc2UocmVhZEZpbGUoJ2RhdGFDYWNoZScpIHx8ICdbXScpXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgLy8g5YaZ5YWl6Ieq5a6a5LmJ5pWw5o2uXFxcXG4gICAgICAgIGxldCBjdXN0b21EYXRhID0gSlNPTi5wYXJzZShyZWFkRmlsZSgnY3VzdG9tRGF0YScpIHx8ICdbXScpLFxcXFxuICAgICAgICAgICAgcmV3cml0ZURhdGEgPSBbXVxcXFxuICAgICAgICBjdXN0b21EYXRhID0gY3VzdG9tRGF0YS5yZWR1Y2UoKHNlbGYsIHYpID0+IHtcXFxcbiAgICAgICAgICAgIGxldCBpbmRleCA9IGRhdGEuZmluZEluZGV4KCh2dikgPT4gdi50aXRsZSA9PSB2di50aXRsZSlcXFxcbiAgICAgICAgICAgIGlmIChpbmRleCA+PSAwKSB7XFxcXG4gICAgICAgICAgICAgICAgc2VsZi5wdXNoKHYpXFxcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGUgPSBkYXRhLnNwbGljZShpbmRleCwgMSlbMF1cXFxcbiAgICAgICAgICAgICAgICBpZihzaG93QWxsIHx8IHYudmlzaWJsZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV3cml0ZURhdGEucHVzaChPYmplY3QuYXNzaWduKHJ1bGUsIHYpKVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIHNlbGZcXFxcbiAgICAgICAgfSwgW10pXFxcXG4gICAgICAgIGRhdGEuZm9yRWFjaCgodikgPT4gY3VzdG9tRGF0YS5wdXNoKHsgdGl0bGU6IHYudGl0bGUsIHZpc2libGU6IHRydWUgfSkpXFxcXG4gICAgICAgIHNhdmVG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xID8gdXJsWzBdWzJdIDogdXJsWzBdWzFdKVxcXFxuICAgICAgICBsZXQgb3B0aW9ucyA9IHsgaGVhZGVyczogaGVhZGVycywgbWV0aG9kOiB1cmxbMV0gfVxcXFxuICAgICAgICAvLyBwb3N05pa55rOV5pe26L2s5o2i5Y+C5pWwXFxcXG4gICAgICAgIGlmICgvXnBvc3QkL2kudGVzdChvcHRpb25zWydtZXRob2QnXSkpIHtcXFxcbiAgICAgICAgICAgIGxldCBbb3JpVXJsLCBib2R5XSA9IHVybFswXS5zcGxpdCgnPycpXFxcXG4gICAgICAgICAgICB1cmxbMF0gPSBvcmlVcmwucmVwbGFjZSgv77yf77yfL2csICc/JylcXFxcbiAgICAgICAgICAgIGlmIChib2R5LnN0YXJ0c1dpdGgoJ0pzb25Cb2R5PScpKSBib2R5ID0gYm9keS5zbGljZSg5KVxcXFxuICAgICAgICAgICAgb3B0aW9uc1snYm9keSddID0gYm9keVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGlmICh1cmxbMl0pIG9wdGlvbnMuaGVhZGVyc1snQ29udGVudC1UeXBlJ10gPSAndGV4dC9wbGFpbjtjaGFyc3Q9JyArIHVybFsyXVxcXFxuICAgICAgICBpZiAodXJsWzNdKSB1cmxbM10ubWF0Y2goL3soLiopfS8pWzFdLnNwbGl0KCcmJicpLmZvckVhY2goKHYpID0+IHtcXFxcbiAgICAgICAgICAgIGxldCBba2V5LCB2YWx1ZV0gPSB2LnNwbGl0KCdAJylcXFxcbiAgICAgICAgICAgIG9wdGlvbnMuaGVhZGVyc1trZXldID0gcnVuQ29kZSh2YWx1ZSlcXFxcbiAgICAgICAgfSlcXFxcbiAgICAgICAgLy8g5re75Yqg5YWo5bGAVUFcXFxcbiAgICAgICAgaWYgKCFvcHRpb25zLmhlYWRlcnNbJ1VzZXItQWdlbnQnXSkge1xcXFxuICAgICAgICAgICAgaWYgKE1ZX1JVTEUudWEgPT0gJ3BjJylcXFxcbiAgICAgICAgICAgICAgICBvcHRpb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8fCAnW10nKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBydWxlcy5maW5kSW5kZXgoKHYpID0+IHYudGl0bGUgPT0gcnVsZS50aXRsZSlcXFxcbiAgICAgICAgICAgICAgICBydWxlc1tpbmRleF0udmlzaWJsZSA9ICFydWxlc1tpbmRleF0udmlzaWJsZVxcXFxuICAgICAgICAgICAgICAgIHNhdmVGaWxlKCdjdXN0b21EYXRhJywgSlNPTi5zdHJpbmdpZnkocnVsZXMpKVxcXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXFxcbiAgICAgICAgICAgIH0sIHYpXFxcXG4gICAgICAgICAgICBicmVha1xcXFxuICAgICAgICBjYXNlICfph43mlrDmjpLluo8nOlxcXFxuICAgICAgICAgICAgbGV0IHNvcnRGbGFnID0gcGFyc2VJbnQoZ2V0VmFyKCdteUNvbGxlY3Rpb24tc29ydEZsYWcnLCAnLTEnKSlcXFxcbiAgICAgICAgICAgIGQudGl0bGUgPSAoc29ydEZsYWcgPT0gaSA/ICfwn5SDICAnIDogJycpICsgZC50aXRsZVxcXFxuICAgICAgICAgICAgaWYgKHNvcnRGbGFnID09IC0xKVxcXFxuICAgICAgICAgICAgICAgIGQudXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBwdXRWYXIoJ215Q29sbGVjdGlvbi1zb3J0RmxhZycsIGkudG9TdHJpbmcoKSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/pgInmi6nopoHnp7vliqjliLDnmoTkvY3nva4nXFxcXG4gICAgICAgICAgICAgICAgfSwgaSlcXFxcbiAgICAgICAgICAgIGVsc2VcXFxcbiAgICAgICAgICAgICAgICBkLnVybCA9ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKG9sZEluZGV4LCBuZXdJbmRleCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZXMgPSBKU09OLnBhcnNlKHJlYWRGaWxlKCdjdXN0b21EYXRhJykgfHwgJ1tdJylcXFxcbiAgICAgICAgICAgICAgICAgICAgcnVsZXMuc3BsaWNlKG5ld0luZGV4LCAwLCBydWxlcy5zcGxpY2Uob2xkSW5kZXgsIDEpWzBdKVxcXFxuICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZSgnY3VzdG9tRGF0YScsIEpTT04uc3RyaW5naWZ5KHJ1bGVzKSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcHV0VmFyKCdteUNvbGxlY3Rpb24tc29ydEZsYWcnLCAnLTEnKVxcXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcXFxuICAgICAgICAgICAgICAgIH0sIHNvcnRGbGFnLCBpKVxcXFxuICAgICAgICAgICAgYnJlYWtcXFxcbiAgICAgICAgY2FzZSAn5pu05pS55Zu+5qCHJzpcXFxcbiAgICAgICAgICAgIGQudXJsID0gJCh2Lmljb24gfHwgJycsICfovpPlhaXmlrDlm77moIflnLDlnYDmiJbpopzoibLku6PnoIHvvJonKS5pbnB1dCgocnVsZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIGxldCBydWxlcyA9IEpTT04ucGFyc2UocmVhZEZpbGUoJ2N1c3RvbURhdGEnKSB8fCAnW10nKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBydWxlcy5maW5kSW5kZXgoKHYpID0+IHYudGl0bGUgPT0gcnVsZS50aXRsZSlcXFxcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQpXFxcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVzW2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XFxcXG4gICAgICAgICAgICBsZXQgc3RySG91cnMgPSBkYXRlLmdldEhvdXJzKCk7XFxcXG4gICAgICAgICAgICBsZXQgc3RyTWludXRlcyA9IGRhdGUuZ2V0TWludXRlcygpO1xcXFxuICAgICAgICAgICAgbGV0IHN0clNlY29uZHMgPSBkYXRlLmdldFNlY29uZHMoKSsxO1xcXFxuICAgICAgICAgICAgaWYgKG1vbnRoID49IDEgJiYgbW9udGggPD0gOSkge1xcXFxuICAgICAgICAgICAgICAgIG1vbnRoID0gXFxcXFxcXCIwXFxcXFxcXCIgKyBtb250aFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKHN0ckRhdGUgPj0gMCAmJiBzdHJEYXRlIDw9IDkpIHtcXFxcbiAgICAgICAgICAgICAgICBzdHJEYXRlID0gXFxcXFxcXCIwXFxcXFxcXCIgKyBzdHJEYXRlXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAoc3RySG91cnMgPj0gMCAmJiBzdHJIb3VycyA8PSA5KSB7XFxcXG4gICAgICAgICAgICAgICAgc3RySG91cnMgPSBcXFxcXFxcIjBcXFxcXFxcIiArIHN0ckhvdXJzXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAoc3RyTWludXRlcyA+PSAwICYmIHN0ck1pbnV0ZXMgPD0gOSkge1xcXFxuICAgICAgICAgICAgICAgIHN0ck1pbnV0ZXMgPSBcXFxcXFxcIjBcXFxcXFxcIiArIHN0ck1pbnV0ZXNcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChzdHJTZWNvbmRzID49IDAgJiYgc3RyU2Vjb25kcyA8PSA5KSB7XFxcXG4gICAgICAgICAgICAgICAgc3RyU2Vjb25kcyA9IFxcXFxcXFwiMFxcXFxcXFwiICsgc3RyU2Vjb25kc1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgLy9sZXQgY3VycmVudGRhdGUgPSBkY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BcXFxcXFxcIjBcXFxcXFxcIiArIHN0ckRhdGVcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChzdHJIb3VycyA+PSAwICYmIHN0ckhvdXJzIDw9IDkpIHtcXFxcbiAgICAgICAgICAgICAgICBzdHJIb3VycyA9IFxcXFxcXFwiMFxcXFxcXFwiICsgc3RySG91cnNcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChzdHJNaW51dGVzID49IDAgJiYgc3RyTWludXRlcyA8PSA5KSB7XFxcXG4gICAgICAgICAgICAgICAgc3RyTWludXRlcyA9IFxcXFxcXFwiMFxcXFxcXFwiICsgc3RyTWludXRlc1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKHN0clNlY29uZHMgPj0gMCAmJiBzdHJTZWNvbmRzIDw9IDkpIHtcXFxcbiAgICAgICAgICAgICAgICBzdHJTZWNvbmRzID0gXFxcXFxcXCIwXFxcXFxcXCIgKyBzdHJTZWNvbmRzXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAvL2xldCBjdXJyZW50ZGF0ZSA9IGRhdGUuZ2V0RnVsbFllYXIoKSArIHNlcGVyYXRvcjEgKyBtb250aCArIHNlcGVyYXRvcjEgKyBzdHJEYXRlICsgXFxcXFxcXCIgXFxcXFxcXCIgKyBzdHJIb3VycyArIHNlcGVyYXRvcjIgKyBzdHJNaW51dGVzICsgc2VwZXJhdG9yMiArIHN0clNlY29uZHM7XFxcXG4gICAgICAgICAgICBsZXQgY3VycmVudGRhdGUgPSAoZGF0ZS5nZXRGdWxsWWVhcigpLTIwMjApKycnKyBtb250aCArJycrIHN0ckRhdGUgKycnKyBzdHJIb3VycysnJyArIHN0ck1pbnV0ZXMgKycnKyBNYXRoLmNlaWwoc3RyU2Vjb25kcy83KTtcXFxcbiAgICAgICAgICAgIHJldHVybiBwYXJzZUludChjdXJyZW50ZGF0ZSlcXFxcbiAgICAgICAgfVxcXFxuJC5leHBvcnRzLmdldE5vd0Zvcm1hdERhdGUgPSBnZXROb3dGb3JtYXREYXRlO1xcXFxuJC5leHBvcnRzLmh0bWxUYWcgPSBodG1sVGFnO1xcXFxuJC5leHBvcnRzLnNtYWxsID0gZnVuY3Rpb24odGV4dCkge1xcXFxuICAgIHJldHVybiBodG1sVGFnKFxcXFxcXFwic21hbGxcXFxcXFxcIiwgdGV4dCk7XFxcXG59XFxcXG4kLmV4cG9ydHMudW5pcXVlMiA9IGZ1bmN0aW9uIHVuaXF1ZTIoYXJyYXkpe1xcXFxuICAgIHJldHVybiBBcnJheS5mcm9tKG5ldyBTZXQoYXJyYXkpKTtcXFxcbn1cXFxcbiQuZXhwb3J0cy5zdHJEZWFsID0gZnVuY3Rpb24gc3RyRGVhbChzdHIpe1xcXFxuICAgIHN0ciA9IHN0ci5zcGxpdCgnJyk7XFxcXG4gICAgc3RyID0gc3RyLmZpbHRlcihlID0+IChlID49IDAgJiYgZSA8PSA5KSB8fCAoZSA+PSAnYScgJiYgZSA8PSAneicpIHx8IChlID49ICdBJyAmJiBlIDw9ICdaJykgfHwgKGUgPj0gJ1xcXFxcXFxcdTRlMDAnICYmIGUgPD0gJ1xcXFxcXFxcdTlmYTUnKSk7XFxcXG4gICAgc3RyID0gc3RyLmpvaW4oJycpO1xcXFxuICAgIHJldHVybiBzdHJcXFxcbn1cXFwifV1cIn0iLCJwaWNVcmwiOiJodHRwczovL2xhbm1laWd1b2ppYW5nLmNvbS90dWJpYW8vMDgvNzIucG5nIiwidGl0bGUiOiLng63oiJ4uZG0ifQ==
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement