Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥玩偶哥哥-庆余年第二季@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuS6jOe6p+WGheWuuVwiLFwicGF0aFwiOlwiZXJcIixcInJ1bGVcIjpcImpzOlxcbi8qdmVyIDIwMjMwOTMwIDIuMFxcbiAqL1xcbmNvbnN0IGN1c3RvbXMgPSB7fTtcXG5cXG4vL+mihOiuvlxcbmZ1bmN0aW9uIGN1c3RvbURhdGEoY3VzdG9tKSB7XFxuICBPYmplY3Qua2V5cyhjdXN0b20pLmZvckVhY2goKGspID0+IHtcXG4gICAgY3VzdG9tc1trXSA9IGN1c3RvbVtrXTtcXG4gIH0pXFxufVxcblxcblxcbmxldCBFcmppID0ge1xcbiAg6YCa5YWNOiAkKCcnKS5sYXp5UnVsZSgoKSA9PiB7XFxuICAgIHRyeSB7XFxuICAgICAgdmFyIGh0bWwgPSBKU09OLnBhcnNlKHJlcXVlc3QoaW5wdXQpLm1hdGNoKC9yIHBsYXllcl8uKj89KC4qPyk8LylbMV0pXFxuICAgICAgdmFyIHVybCA9IGh0bWwudXJsXFxuICAgICAgaWYgKGh0bWwuZW5jcnlwdCA9PSAnMScpIHtcXG4gICAgICA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ikvLCckMScrY3MuaGlkZSsnJDInKVxcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgdXBkYXRlSXRlbSgnZHNob3cnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoJ+aUtui1tycsICflsZXlvIAnKSAgICAgICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICB9LG1hcmssIGRlc2MsIHNkZXNjLGNvbG9ycyksXFxuICAgICAgZXh0cmE6IHtcXG4gICAgICAgIGlkOiAnZHNob3cnLFxcbiAgICAgIH1cXG4gICAgfSlcXG4gICAgdmFyIHNjPXN0b3JhZ2UwLmdldEl0ZW0obWFyaywgJzAnKSA9PSAnMCcgPyBzZGVzYy5mb250Y29sb3IoY29sb3JzLmhpZGUpIDogZGVzYy5mb250Y29sb3IoY29sb3JzLnNob3cpO1xcbiAgICBkLnB1c2goe1xcbiAgICAgIHRpdGxlOnNjLFxcbiAgICAgIGNvbF90eXBlOiAncmljaF90ZXh0JyxcXG4gICAgICBleHRyYToge1xcbiAgICAgICAgaWQ6ICdkY29udGVudCcsXFxuICAgICAgICBsaW5lU3BhY2luZzogNixcXG4gICAgICAgIHRleHRTaXplOiAxNSxcXG4gICAgICAgIGxpbmVWaXNpYmxlOiB0cnVlLFxcbiAgICAgIH1cXG4gICAgfSlcXG4gIH0sXFxuICBzdHJDb252ZXJ0OmZ1bmN0aW9uKGFyciwgc3ApIHtcXG4gICAgICBzcCA9IHNwICE9IHVuZGVmaW5lZCA/IHNwIDogJy8nO1xcbiAgICAgIHZhciByZWcgPSBuZXcgUmVnRXhwKHNwKTtcXG5cXG4gICAgICByZXR1cm4gYXJyLm1hcCh4ID0+IHtcXG4gICAgICAgIHN0ciA9IHg7XFxuICAgICAgICBpZiAocmVnLnRlc3Qoc3RyKSkge1xcbiAgICAgICAgICBzdHIgPSBzdHIuc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gICAgIHJpZ2h0LnB1c2goJzwvZm9udD4nKTtcXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICAgICAgbGVmdC5wdXNoKGA8JHtrfT5gKTtcXG4gICAgICAgICAgICAgICAgICAgIHJpZ2h0LnB1c2goYDwvJHtrfT5gKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICBsaXN0W2ldID0gbGVmdC5qb2luKCcnKSArIHN0ciArIHJpZ2h0LmpvaW4oJycpO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgIHJldHVybiBsaXN0O1xcbiAgICAgIH1cXG4gICAgICB0aXRsZXM9dGV4dEFycmF5KGZpcnN0SGFsZix0aXRsZXMpO1xcbiAgICAgIGRlc2NzPXRleHRBcnJheShzZWNvbmRIYWxmLGRlc2NzKTtcXG4gICAgICBcXG4gICAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6J+KAnOKAnOKAneKAnScrdGl0bGVzWzBdKydcXFxcbicrdGl0bGVzLnNsaWNlKDEsMykuam9pbignXFxcXG4nKSxcXG4gICAgICAgIGRlc2M6J+KAnOKAnOKAneKAnScrZGVzY3Muam9pbignXFxcXG4nKSxcXG4gICAgICAgIGltZzppbWcrJ0BSZWZlcmVyPScraW1nLFxcbiAgICAgICAgdXJsOk1ZX1VSTCxcXG4gICAgICAgIGNvbF90eXBlOidtb3ZpZV8xX3ZlcnRpY2FsX3BpY19ibHVyJyxcXG4gICAgICAgIGV4dHJhOntcXG4gICAgICAgICAgaWQ6XFxcImRldGFpbGlkXFxcIixcXG4gICAgICAgIH1cXG4gICAgICB9KVxcbiAgICAgIFxcbiAgICB9IGVsc2Uge1xcbiAgICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogdGl0bGVzWzBdICsgJ1xcXFxuJyArIH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AgZXh0cmE6IHtcXG4gICAgICAgICAgICAgIGNsczogc2hzb3J0XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICB9KVxcbiAgICAgICAgICB4bGlzdCA9ICQuZnVuYyhpLCBpbmZvKTtcXG4gICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19saXN0JywgeGxpc3QpO1xcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIHBsYXlzID0geGxpc3QubWFwKHggPT4ge1xcbiAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcbiAgICAgICAgICAgIHVybDogeC51cmwsXFxuICAgICAgICAgICAgY29sX3R5cGU6IGNvbCxcXG4gICAgICAgICAgICBwaWM6IHBpYyxcXG4gICAgICAgICAgICBleHRyYTogT2JqZWN0LmFzc2lnbih7fSwgZXh0cmEsIHtcXG4gICAgICAgICAgICAgIGlkOiB4LnVybC5yZXBsYWNlKC9AbGF6eVJ1bGVbXFxcXHNcXFxcU10rL2csICcnKSxcXG4gICAgICAgICAgICAgIGNsczogY2xzLFxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgICAgICBpZiAoZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JykgPT0gJzEnKSB7XFxuICAgICAgICAgIHBsYXlzLnJldmVyc2UoKTtcXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBwY2ZnID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ19wdXNoY2ZnJywgJ3t9Jyk7XFxuICAgICAgICBpZiAocGNmZ1sn5Y2V5o6oJ10pIHtcXG4gICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2gnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IHBjZmdbJ29iaiddWyfljZXmjqgnXVswXVxcbiAgICAgICAgICB9KVxcbiAgICAgICAgICBwY2ZnWyfljZXmjqgnXS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Wxpc3QnXS5tYXAoKHgpID0+IHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgIHVybDogeC51cmwsXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgfSlcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNoJywge1xcbiAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIHRpdGxlc1sxXSxcXG4gICAgICAgICAgfSlcXG4gICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2hzJywge1xcbiAgICAgICAgICAgIHRpdGxlOiBwb2JqWyfpgInmjqgnXVswXSxcXG4gICAgICAgICAgfSlcXG4gICAgICAgICAgcGNmZ1sn5Y2V5o6oJ10gPSB0cnVlO1xcbiAgICAgICAgICBwY2ZnWyfpgInmjqgnXSA9IGZhbHNlO1xcbiAgICAgICAgICB2YXIgcGxheWxpc3QgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICBwY2ZnWydwbGF5bGlzdCddID0gcGxheWxpc3Q7XFxuICAgICAgICAgIGZpbmRJdGVtc0J5Q2xzKHNoc29ydCkubWFwKHggPT4ge1xcbiAgICAgICAgICAgIHZhciBkcHVzaCA9IHtcXG4gICAgICAgICAgICAgIG5hbWU6IGdldFBhZ2VUaXRsZSgpLFxcbiAgICAgICAgICAgICAgdXJsOiB4LnRpdGxlICsgJyQnICsgeC5leHRyYS5pZFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgIHVybDogJCgnJykubGF6eVJ1bGUoKGRwdXNoKSA9PiB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9wYWdlL3B1c2g/cnVsZT1YWVHmjqjpgIEmcHVzaHVybD0nICsgZW5j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AgICAgICAgaWYgKOmAieaOqCkge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHMnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlc1swXSxcXG4gICAgICAgICAgfSlcXG4gICAgICAgICAgcGNmZ1sn6YCJ5o6oJ10gPSBmYWxzZTtcXG4gICAgICAgICAgcGNmZ1sncGxheWxpc3QnXS5tYXAoKHgpID0+IHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcbiAgICAgICAgICAgICAgdXJsOiB4LnVybCxcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICB9KVxcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHRvJywge1xcbiAgICAgICAgICAgIHRpdGxlOiAn5o6o6YCB5pys6aG1PT5UVkJveCcsXFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICBjbGVhck15VmFyKHNoc29ydCArICdfZHVvc2VsZWN0Jyk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHMnLCB7XFxuICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgdGl0bGVzWzFdLFxcbiAgICAgICAgICB9KVxcbiAgICAgICAgICBwY2ZnWyfpgInmjqgnXSA9IHRydWU7XFxuICAgICAgICAgIHBjZmdbJ+WNleaOqCddID0gZmFsc2U7XFxuICAgICAgICAgIHZhciBwbGF5bGlzdCA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgIHBjZmdbJ3BsYXlsaXN0J10gPSBwbGF5bGlzdDtcXG4gICAgICAgICAgbGV0IElkcyA9IHBsYXlsaXN0Lm1hcChpdCA9PiBpdC5leHRyYS5pZCk7XFxuICAgICAgICAgIElkcy5mb3JFYWNoKHggPT4ge1xcbiA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ne30nKTtcXG4gICAgICAgIHZhciDljZXmjqggPSBwY2ZnWyfljZXmjqgnXSA/IHBjZmdbJ+WNleaOqCddIDogZmFsc2U7XFxuICAgICAgICB2YXIg6YCJ5o6oID0gcGNmZ1sn6YCJ5o6oJ10gPyBwY2ZnWyfpgInmjqgnXSA6IGZhbHNlO1xcbiAgICAgICAgaWYgKCHljZXmjqggJiYgIemAieaOqCkge1xcbiAgICAgICAgICB2YXIgdGFicyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfdGFicycsICdbXScpO1xcbiAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIHZhciBwbHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX2xpc3QnLCAnW10nKS5tYXAobGkgPT4ge1xcbiAgICAgICAgICAgICAgcmV0dXJuIGxpLm1hcChpdGVtID0+IGl0ZW0udGl0bGUgKyAnJCcgKyBpdGVtLnVybC5yZXBsYWNlKC9AbGF6eVJ1bGVbXFxcXHNcXFxcU10rL2csICcnKSkuam9pbignIycpXFxuICAgICAgICAgICAgfSkuam9pbignJCQkJyk7XFxuICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICB2YXIgcGxzID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgXFxcIl9saXN0XFxcIiwgJ1tdJykubWFwKHggPT4geC50aXRsZSArIFxcXCIkXFxcIiArIHgudXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcc1xcXFxTXSsvZywgJycpKS5qb2luKFxcXCIjXFxcIik7XFxuICAgICAgICAgICAgdmFyIHRhYnMgPSBbdGFic1tnZXRNeVZhcih2YXJpLCAnMCcpXV07XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgLy9sb2cocGxzKVxcbiAgICAgICAgICAvL2xvZyh0YWJzKVxcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKOmAieaOqCkge1xcbiAgICAgICAgICB2YXIgcGxzID0gc3Rv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IH1cXG4gICAgfSwge1xcbiAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snLFxcbiAgICAgIGV4dHJhOiB7XFxuICAgICAgICBjbHM6IHNoc29ydCArICdfcHVzaHRhYicsXFxuICAgICAgfVxcbiAgICB9KVxcbiAgfSxcXG4gIHNldExvbmdjbGljazogZnVuY3Rpb24gKHNoc29ydCwgY3VzdG9tKSB7XFxuICAgIHJldHVybiBbe1xcbiAgICAgIHRpdGxlOiAn5qC35byP8J+OqCcsXFxuICAgICAganM6ICQudG9TdHJpbmcoKHNoc29ydCkgPT4ge1xcbiAgICAgICAgbGV0IGFsbF9jb2xzID0gWycnXS5jb25jYXQoZ2V0Q29sVHlwZXMoKSk7XFxuICAgICAgICBhbGxfY29scyA9IGFsbF9jb2xzLmZpbHRlcih4ID0+XFxuICAgICAgICAgIC8odGV4dF98ZmxleCkuKi8udGVzdCh4KSAmJiB4ICE9ICd0ZXh0X2ljb24nKTtcXG4gICAgICAgIC8vbG9nKGFsbF9jb2xzKVxcbiAgICAgICAgbGV0IGNscyA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKSB8fFxcbiAgICAgICAgICAnJztcXG4gICAgICAgIGlmIChjbHNbc2hzb3J0XSAhPSAnJykge1xcbiAgICAgICAgICBjb2wgPSBjbHNbc2hzb3J0XS5jb2xfdHlwZTtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCDmjInpkq7moLflvI8gPSBhbGxfY29scy5tYXAoKGl0KSA9PiB7XFxuICAgICAgICAgIHJldHVybiBpdCA9PT0gY29sID8gJ+Keoe+4jycgKyBpdCA6IGl0O1xcbiAgICAgICAgfSk7XFxuICAgICAgICBsZXQgdGlwcyA9ICfor7fpgInmi6npgInpm4bmjInpkq7moLflvI8nO1xcbiAgICAgICAgcmV0dXJuICQo5oyJ6ZKu5qC35byPLCAyLCB0aXBzKS5zZWxlY3QoKHNoc29ydCwgY2xzKSA9PiB7XFxuICAgICAgIC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dGVtKHNoc29ydCArICdfYXZhdGFyJylcXG5cXG4gICAgICAgIGlmIChjb25mID09ICcxJykge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcbiAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMV0sIHRpdGxlc1swXSksXFxuICAgICAgICAgIH0pXFxuICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJyk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcbiAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMF0sIHRpdGxlc1sxXSksXFxuICAgICAgICAgIH0pXFxuICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcxJyk7XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5YiH5o2i5o6S5bqP5oiQ5YqfJztcXG4gICAgICB9LCBzaHNvcnQsIHZhcmksIGN1c3RvbSksXFxuICAgICAgY29sX3R5cGU6ICdhdmF0YXInLFxcbiAgICAgIGltZzogY3VzdG9tLuWbvuaghyxcXG4gICAgICBleHRyYToge1xcbiAgICAgICAgaWQ6IHNoc29ydCArICdfYXZhdGFyJyxcXG4gICAgICAgIGxvbmdDbGljazogdGhpcy5zZXRMb25nY2xpY2soc2hzb3J0KSxcXG4gICAgICB9XFxuICAgIH0pXFxuICAgIHZhciDmipjlj6AgPSAn4oCc4oCc4oCd4oCdPGI+JyArICfimLcnLmZvbnRjb2xvcihcXFwiI0QzRDNEM1xcXCIpO1xcbiAgICB2YXIg5bGV5byAID0gJ+KAnOKAnOKAneKAnTxiPicgKyAn4piwJy5mb250Y29sb3IoXFxcIiNGRkE1MDBcXFwiKTtcXG4gICAgdmFyIGZvbGRuYW1lID0gJ2VyXycgKyB2YXJpICsgJ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mm7/mjaLlh73mlbAgPSAnJztcXG4gICAgdmFyIOmAiembhuWQjeensCA9IHBhcnNlLumAiembhuWQjeensCA/IHBhcnNlLumAiembhuWQjeensCA6ICdhJiZUZXh0JztcXG4gICAgaWYgKOmAiembhuWQjeensC5pbmNsdWRlcygnQEAnKSkge1xcbiAgICAgIOmAiembhuWQjeensCA9IHBhcnNlLumAiembhuWQjeensC5zcGxpdCgnQEAnKVswXTtcXG4gICAgICDmm7/mjaLlh73mlbAgPSBwYXJzZS7pgInpm4blkI3np7Auc3BsaXQoJ0BAJylbMV07XFxuICAgIH1cXG5cXG4gICAgdmFyIOmAiembhumTvuaOpSA9IHBhcnNlLumAiembhumTvuaOpSA/IHBhcnNlLumAiembhumTvuaOpSA6ICdhJiZocmVmJztcXG4gICAgdmFyIOino+aekCA9IHBhcnNlLuino+aekCA/IHBhcnNlLuino+aekCA6ICcnO1xcbiAgICB2YXIgdGVtcCA9IFtdO1xcblxcbiAgICBmb3IgKHZhciBpIGluIGNvbnRzKSB7XFxuICAgICAgaWYgKHBhcnNlLumAiembhuWIl+ihqCAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgIGlmIChwYXJzZS7pgInpm4bliJfooaggPT0gJ29iamVjdCcpIHtcXG4gICAgICAgICAgbGlzdHMucHVzaChjb250c1tpXS5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcbiAgICAgICAgICAgICAgdXJsOiB4LnVybCArIOino+aekCxcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgIH0pKVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgbGlzdHMucHVzaChwZGZhKGNvbnRzW2ldLCBwYXJzZS7pgInpm4bliJfooagpLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgdGl0bGU6IHBkZmgoeCwg6YCJ6ZuG5ZCN56ewKSxcXG4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OiBpdGVtLnRpdGxlLFxcbiAgICAgICAgdXJsOiBpdGVtLnVybCxcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgaWQ6IGlkKydiYXInLFxcbiAgICAgICAgfVxcbiAgICB9KVxcblxcbiAgICBpZiAoc3RhcnQgPT0gZmFsc2UgfHwgZ2V0TXlWYXIoJ2JlbnN0YXJ0JywgJ3RydWUnKSA9PSAnZmFsc2UnKSB7XFxuICAgICAgICB1blJlZ2lzdGVyVGFzayhpZClcXG4gICAgICAgIHJldHVyblxcbiAgICB9XFxuICAgIFxcbiAgICAvL2xvZyhkYXRhKVxcblxcbiAgICBsZXQgb2JqID0ge1xcbiAgICAgICAgZGF0YTogZGF0YSxcXG4gICAgfTtcXG5cXG4gICAgcmVnaXN0ZXJUYXNrKGlkLCB0aW1lLCAkLnRvU3RyaW5nKChvYmosaWQpID0+IHtcXG4gICAgICAgIHZhciBkYXRhID0gb2JqLmRhdGE7XFxuICAgICAgICB2YXIgcnVtID0gZ2V0TXlWYXIoJ3JudW0nKTtcXG5cXG4gICAgICAgIHZhciBpID0gTnVtYmVyKGdldE15VmFyKCdiYW5uZXJpJywgJzAnKSk7XFxuICAgICAgICBpZiAocnVtICE9ICcnKSB7XFxuICAgICAgICAgICAgaSA9IE51bWJlcihydW0pICsgMVxcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoJ3JudW0nKVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBpID0gaSArIDE7XFxuICAgICAgICB9XFxuICAgICAgICAvL2xvZyhpKVxcbiAgICAgICAgLy9sb2coZGF0YS5sZW5ndGgpXFxuXFxuICAgICAgICBpZiAoaSA+IGRhdGEubGVuZ3RoIC0gMSkge1xcbiAgICAgICAgICAgIGkgPSAwXFxuICAgICAgICB9XFxuICAgICAgICB2YXIgaXRlbSA9IGRhdGFbaV07XFxuICAgICAgICAvL2xvZyhpdGVtKVxcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKGlkKydiYXInLCB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLFxcbiAgICAgICAgICAgICAgICBpbWc6IGl0ZW0uaW1nLFxcbiAgICAgICAgICAgICAgICB1cmw6IGl0ZW0udXJsLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgLy9uYW1lOiBpdGVtLnRpdGxlLnJlcGxhY2UoLzxbXj5dKz4vZywgJycpLFxcbiAgICAgICAgICAgICAgICAgICAgLy9zbmFtZTogaXRlbS5leHRyYS5zbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIC8vc3R5cGU6IGl0ZW0uZXh0cmEuc3R5cGUsXFxuICAgICAgICAgICAgICAgICAgICAvL3N1cmw6IGl0ZW0udXJsLFxcbiAgICAgICAgICAgICAgICAgICAgLy9pbWc6aXRlbS5pbWcsXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZS5yZXBsYWNlKC88W14+XSs+L2csICcnKSxcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgbG9nKGUubWVzc2FnZSlcXG4gICAgICAgICAgICB1blJlZ2lzdGVyVGFzayhpZClcXG4gICAgICAgIH1cXG4gICAgICAgIHB1dE15VmFyKCdiYW5uZXJpJywgaSk7XFxuXFxuICAgIH0sIG9iaixpZCkpXFxufVwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi5LiA57qnXCIsXCJwYXRoXCI6XCJ5aVwiLFwicnVsZVwiOlwidmFyIEljb25fcHJlZml4ID0gJ2h0dHBzOi8vaGlrZXJmYW5zLmNvbS90dWJpYW8vY2lyY2xlLyc7XFxuLy/ova7mkq1cXG52YXIgbHVuZGF0YSA9IHBkZmEoaHRtbCwg6L2u5pKt5YiX6KGoKS5tYXAoKHgpID0+IHtcXG4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fbGlzdC5sZW5ndGggLyAyKTsgXFxcXG4gICAgICB2YXIgZmlyc3RIYWxmID0gY29sb3JfbGlzdC5zbGljZSgwLCBtaWRJbmRleCk7XFxcXG4gICAgICB2YXIgc2Vjb25kSGFsZiA9IGNvbG9yX2xpc3Quc2xpY2UobWlkSW5kZXgpO1xcXFxuICAgICAgICAgICBcXFxcbiAgICAgIGZ1bmN0aW9uIHRleHRBcnJheShzdHlsZSx0ZXh0QXJyYXkpIHtcXFxcbiAgICAgICAgdmFyIGxpc3Q9W107XFxcXG4gICAgICAgIHN0eWxlLmZvckVhY2goKHgsIGkpID0+IHtcXFxcbiAgICAgICAgdmFyIGxlZnQgPSBbXTtcXFxcbiAgICAgICAgdmFyIHJpZ2h0ID0gW107XFxcXG4gICAgICAgIHZhciBzdHIgPSB0ZXh0QXJyYXlbaV07XFxcXG4gICAgICAgIE9iamVjdC5rZXlzKHgpLmZvckVhY2goayA9PiB7XFxcXG4gICAgICAgICAgICBzd2l0Y2ggKGspIHtcXFxcbiAgICAgICAgICAgICAgICBjYXNlICdjb2xvcic6XFxcXG4gICAgICAgICAgICAgICAgICAgIGxlZnQucHVzaCgnPGZvbnQgY29sb3I9XFxcXFxcXCInICsgeFtrXSArICdcXFxcXFxcIj4nKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmlnaHQucHVzaCgnPC9mb250PicpO1xcXFxuICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxcXFxuICAgICAgICAgICAgICAgICAgICBsZWZ0LnB1c2goYDwke2t9PmApO1xcXFxuICAgICAgICAgICAgICAgICAgICByaWdodC5wdXNoKGA8LyR7a30+YCk7XFxcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICBsaXN0W2ldID0gbGVmdC5qb2luKCcnKSArIHN0ciArIHJpZ2h0Lmpva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1xcXFxuICAgICAgICAgICAgICByZXR1cm4gbGkubWFwKGl0ZW0gPT4gaXRlbS50aXRsZSArICckJyArIGl0ZW0udXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcXFxcXHNcXFxcXFxcXFNdKy9nLCAnJykpLmpvaW4oJyMnKVxcXFxuICAgICAgICAgICAgfSkuam9pbignJCQkJyk7XFxcXG4gICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgdmFyIHBscyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArIFxcXFxcXFwiX2xpc3RcXFxcXFxcIiwgJ1tdJykubWFwKHggPT4geC50aXRsZSArIFxcXFxcXFwiJFxcXFxcXFwiICsgeC51cmwucmVwbGFjZSgvQGxhenlSdWxlW1xcXFxcXFxcc1xcXFxcXFxcU10rL2csICcnKSkuam9pbihcXFxcXFxcIiNcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICB2YXIgdGFicyA9IFt0YWJzW2dldE15VmFyKHZhcmksICcwJyldXTtcXFxcbiAgICAgICAgICB9XFxcXG4gICAgICAgICAgLy9sb2cocGxzKVxcXFxuICAgICAgICAgIC8vbG9nKHRhYnMpXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgaWYgKOmAieaOqCkge1xcXFxuICAgICAgICAgIHZhciBwbHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyBcXFxcXFxcIl9kdW9zZWxlY3RcXFxcXFxcIiwgJ1tdJykubWFwKHggPT4geC50aXRsZSArIFxcXFxcXFwiJFxcXFxcXFwiICsgeC51cmwpLmpvaW4oXFxcXFxcXCIjXFxcXFxcXCIpO1xcXFxuICAgICAgICAgIGlmIChwbHMubGVuZ3RoID09IDApIHtcXFxcbiAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/pgInmi6nkuLrnqbonO1xcXFxuICAgICAgICAgIH1cXFxcbiAgICAgICAgICB2YXIgdGFicyA9IFsn5pKt5pS+5YiX6KGoJ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ICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICBpZDogaWQrJ2JhcicsXFxcXG4gICAgICAgIH1cXFxcbiAgICB9KVxcXFxuXFxcXG4gICAgaWYgKHN0YXJ0ID09IGZhbHNlIHx8IGdldE15VmFyKCdiZW5zdGFydCcsICd0cnVlJykgPT0gJ2ZhbHNlJykge1xcXFxuICAgICAgICB1blJlZ2lzdGVyVGFzayhpZClcXFxcbiAgICAgICAgcmV0dXJuXFxcXG4gICAgfVxcXFxuICAgIFxcXFxuICAgIC8vbG9nKGRhdGEpXFxcXG5cXFxcbiAgICBsZXQgb2JqID0ge1xcXFxuICAgICAgICBkYXRhOiBkYXRhLFxcXFxuICAgIH07XFxcXG5cXFxcbiAgICByZWdpc3RlclRhc2soaWQsIHRpbWUsICQudG9TdHJpbmcoKG9iaixpZCkgPT4ge1xcXFxuICAgICAgICB2YXIgZGF0YSA9IG9iai5kYXRhO1xcXFxuICAgICAgICB2YXIgcnVtID0gZ2V0TXlWYXIoJ3JudW0nKTtcXFxcblxcXFxuICAgICAgICB2YXIgaSA9IE51bWJlcihnZXRNeVZhcignYmFubmVyaScsICcwJykpO1xcXFxuICAgICAgICBpZiAocnVtICE9ICcnKSB7XFxcXG4gICAgICAgICAgICBpID0gTnVtYmVyKHJ1bSkgKyAxXFxcXG4gICAgICAgICAgICBjbGVhck15VmFyKCdybnVtJylcXFxcbiAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgIGkgPSBpICsgMTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICAvL2xvZyhpKVxcXFxuICAgICAgICAvL2xvZyhkYXRhLmxlbmd0aClcXFxcblxcXFxuICAgICAgICBpZiAoaSA+IGRhdGEubGVuZ3RoIC0gMSkge1xcXFxuICAgICAgICAgICAgaSA9IDBcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICB2YXIgaXRlbSA9IGRhdGFbaV07XFxcXG4gICAgICAgIC8vbG9nKGl0ZW0pXFxcXG4gICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKGlkKydiYXInLCB7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0udGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgaW1nOiBpdGVtLmltZyxcXFxcbiAgICAgICAgICAgICAgICB1cmw6IGl0ZW0udXJsLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIC8vbmFtZTogaXRlbS50aXRsZS5yZXBsYWNlKC88W14+XSs+L2csICcnKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9zbmFtZTogaXRlbS5leHRyYS5zbmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9zdHlwZTogaXRlbS5leHRyYS5zdHlwZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9zdXJsOiBpdGVtLnVybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9pbWc6aXRlbS5pbWcsXFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLnJlcGxhY2UoLzxbXj5dKz4vZywgJycpLFxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgICAgIGxvZyhlLm1lc3NhZ2UpXFxcXG4gICAgICAgICAgICB1blJlZ2lzdGVyVGFzayhpZClcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBwdXRNeVZhcignYmFubmVyaScsIGkpO1xcXFxuXFxcXG4gICAgfSwgb2JqLGlkKSlcXFxcbn1cXFwifSx7XFxcImNvbF90eXBlXFxcIjpcXFwibW92aWVfM1xcXCIsXFxcIm5hbWVcXFwiOlxcXCLkuIDnuqdcXFwiLFxcXCJwYXRoXFxcIjpcXFwieWlcXFwiLFxcXCJydWxlXFxcIjpcXFwidmFyIEljb25fcHJlZml4ID0gJ2h0dHBzOi8va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