Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@Quark.简@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoiUXVhcmsu566AIiwiYXV0aG9yIjoiQExveURnSWsiLCJ1cmwiOiJoaWtlcjovL2VtcHR5IyMiLCJ2ZXJzaW9uIjoxNywiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxubGV0IGQgPSBbXTtcblxubGV0IGNvb2tpZSA9IGdldEl0ZW0oXCJxdWFya0Nvb2tpZVwiLCBcIlwiKTtcblxuaWYgKCEkLnJlcXVpcmUoXCJ0b29sXCIpLmlzTG9naW5Db29raWUoY29va2llKSkge1xuICAgIGNsZWFySXRlbShcInF1YXJrQ29va2llXCIpO1xuICAgIGQucHVzaCh7XG4gICAgICAgIHRpdGxlOiAnPGZvbnQgY29sb3I9XCIjMTNCNjFCXCI+4paQIDwvZm9udD48Yj7muKnppqjmj5DnpLo8Yj4nLFxuICAgICAgICBjb2xfdHlwZTogXCJyaWNoX3RleHRcIixcbiAgICB9KTtcbiAgICBkLnB1c2goe1xuICAgICAgICB1cmw6ICQucmVxdWlyZShcImFjY291bnRcIiwgdHJ1ZSksXG4gICAgICAgIGNvbF90eXBlOiBcInRleHRfMVwiLFxuICAgICAgICB0aXRsZTogXCLmnKrmo4DmtYvliLDnmbvlvZXkv6Hmga/vvIzngrnmiJHot7PovaznmbvlvZXotKblj7fpobXpnaLvvIzojrflj5ZRdWFyayBDb29raWXlkI7mlrnlj6/kvb/nlKhcIixcbiAgICAgICAgZXh0cmE6IHtc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wiKSxcXG4gICAgICAgICAgICBwZGlyX2ZpZDogZmlsZUlkIHx8IFxcXCJcXFwiLFxcbiAgICAgICAgICAgIGZvcmNlOiAwLFxcbiAgICAgICAgICAgIF9wYWdlOiBwYWdlLFxcbiAgICAgICAgICAgIF9zaXplOiA1MCxcXG4gICAgICAgICAgICBfZmV0Y2hfYmFubmVyOiAxLFxcbiAgICAgICAgICAgIF9mZXRjaF9zaGFyZTogMSxcXG4gICAgICAgICAgICBfZmV0Y2hfdG90YWw6IDEsXFxuICAgICAgICAgICAgX3NvcnQ6IFxcXCJmaWxlX3R5cGU6YXNjLFxcXCIgKyBvcmRlckJ5XFxuICAgICAgICB9KS5lcnJvcldpdGhSZXRyeSgoZXJyLCByZXMsIGh0dHApID0+IHtcXG4gICAgICAgICAgICBpZiAoSlNPTi5wYXJzZShyZXMuYm9keSkubWVzc2FnZS5pbmNsdWRlcygnc3Rva2VuJykpIHtcXG4gICAgICAgICAgICAgICAgaHR0cC5tZXJnZUhlYWRBbmRCb2R5KHtcXG4gICAgICAgICAgICAgICAgICAgIGJ1aWxkVXJsOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3Rva2VuOiBlbmNvZGVVUklDb21wb25lbnQodGhpcy5nZXRTaGFyZVRva2VuKCl8fFxcXCJcXFwiKVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSkuc3RhcnQodHJ1ZSk7XFxuICAgICAgICByZXR1cm4gcmVzdWx0O1xcbiAgICB9XFxufSk7XFxuJC5leHBvcnRzID0gUXVhcmtTaGFyZUFwaTtcIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcImh0dHBSZXF1ZXN0XCIsXCJwYXRoXCI6XCJodHRwUmVxdWVzdFwiLFwicnVsZVwiOlwiZnVuY3Rpb24gaHR0cFJlcX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cmwsIG9wdGlvbnMpKTtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgaWYgKHJlcy5zdGF0dXNDb2RlID49IDIwMCAmJiByZXMuc3RhdHVzQ29kZSA8PSAzMDApIHtcXG4gICAgICAgICAgICAgICAgbGV0IGJvZHkgPSByZXMuYm9keTtcXG4gICAgICAgICAgICAgICAgaWYgKHRvSnNvbikge1xcbiAgICAgICAgICAgICAgICAgICAgYm9keSA9IEpTT04ucGFyc2UoYm9keSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3VjY2Vzc0NhbGxiYWNrKGJvZHksIHJlcyk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFN0cmluZyhyZXMuc3RhdHVzQ29kZSkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGVycikge1xcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIGVyciA9IHRoaXMuZXJyb3JUeXBlQ2FsbGJhY2soZXJyLCByZXMpO1xcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHRoaXMucmV0cnlDb3VudCkge1xcbiAgICAgICAgICAgICAgICBsZXQgdHJ5UmVzdWx0ID0gdGhpcy5lcnJvckNhbGxiYWNrV2l0aFJldHJ5KGVyciwgcmVzLCB0aGlzKTtcXG4gICAgICAgICAgICAgICAgaWYgKHRyeVJlc3VsdCkge1xcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXRyeUNvdW50LS07XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdGFydCh0b0pzb24pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXRyeUNvdW50ID0gMDtcXG4gICAgICAg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bF90eXBlOiBzdHlsZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlSWQsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVJZDogaXRlbS5maWQsXFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGdldEhlYWQoaXRlbS5vYmpfY2F0ZWdvcnkpICsgaXRlbS5maWxlX25hbWUsXFxuICAgICAgICAgICAgICAgIGRlc2M6ICQuZGF0ZUZvcm1hdChpdGVtLnVwZGF0ZWRfYXQsICd5eXl5LU1NLWRkJykgKyAnICAnICsgZm9ybWF0U2l6ZShpdGVtLnNpemUpLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBpdGVtLnRodW1ibmFpbCxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKGZpZCwgZmlkX3Rva2VuLCBwd2RfaWQsIHN0b2tlbiwgY2F0ZWdvcnkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsQ2FjaGUgPSBzdG9yYWdlMC5nZXRNeVZhcihcXFwicGxheVVybENhY2hlXFxcIiwge30pO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBsYXlVcmxDYWNoZVtmaWRdKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsYXlVcmxDYWNoZVtmaWRdO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gJC5yZXF1aXJlKFxcXCJwbGF5XFxcIikuZ2V0UGxheVVybChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwbGF5VXJsQ2FjaGVbZmlkXSA9IHVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihcXFwicGxheVVybENhY2hlXFxcIiwgcGxheVVybENhY2hlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXJsO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LCBpdGVtLmZpZCwgaXRlbS5zaGFyZV9maWRfdG9rZW4sIHNoYXJlSWQsIHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSwgaXRlbS5vYmpfY2F0ZWdvcnkpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogaXRlbS5maWQsXFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiAncGxheWxpc3QgJyArIGl0ZW0ub2JqX2NhdGVnb3J5XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2xpbmUnXFxuICAgICAgICB9KTtcXG4gICAgfSk7XFxufSBjYXRjaCAoZSkge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6IGUubWVzc2FnZSxcXG4gICAgICAgIHVybDogJ2hpa2VyOi8vZW1wdHknLFxcbiAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICB9XFxuICAgIH0pO1xcbiAgICBpZiAoZS5tZXNzYWdlLmluY2x1ZGVzKFxcXCLmj5Dlj5bnoIFcXFwiKSkge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIui+k+WFpeaPkOWPlueggVxcXCIsXFxuICAgICAgICAgICAgdXJsOiAkKCkuaW5wdXQoKE1ZX1BBUkFNUykgPT4ge1xcbiAgICAgICAgICAgICAgICBzZXRQYWdlUGFyYW1zKE9iamVjdC5hc3NpZ24oe30sIE1ZX1BBUkFNUywge1xcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IGlucHV0XFxuICAgICAgICAgICAgICAgIH0pKTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICB9LCBNWV9QQVJBTVMpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCJcXG4gICAgICAgIH0pO1xcbiAgICB9XFxufVxcbnNldFJlc3VsdChkKTtcIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcInBsYXlcIixcInBhdGhcIjpcInBsYXlcIixcInJ1bGVcIjpcImpzOlxcbmNvbnN0IGNvb2tpZSA9IGdldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgXFxcIlxcXCIpO1xcbmxldCBodHRwUmVxdWVzdCA9ICQucmVxdWlyZShcXFwiaHR0cFJlcXVlc3RcXFwiKTtcXG5cXG5mdW5jdGlvbiBDb29raWVNYW5hZ2UoY29va2llKSB7XFxuICAgIHRoaXMuY29va2llID0ge307XFxuICAgIHRoaXMuYWRkKGNvb2tpZSk7XFxufVxcbk9iamVjdC5hc3NpZ24oQ29va2llTWFuYWdlLnByb3RvdHlwZSwge1xcbiAgICBhZGQoY29va2llKSB7XFxuICAgICAgIC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pZGVvXFxcIikge1xcbiAgICAgICAgICAgIGxldCBwbGF5TW9kZSA9IGdldEl0ZW0oXFxcInF1YXJrX3BsYXlNb2RlXFxcIiwgXFxcIui9rOeggVxcXCIpO1xcbiAgICAgICAgICAgIGlmIChwbGF5TW9kZSA9PT0gXFxcIui9rOeggVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHZpZGVvUmVzID0gZ2V0UHJldmlld1ZpZGVvKGFzZmlkKTtcXG4gICAgICAgICAgICAgICAgbGV0IHZpZGVvTGlzdCA9IHZpZGVvUmVzLmRhdGEudmlkZW9fbGlzdDtcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW10sXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbXVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICB2aWRlb0xpc3QuZmlsdGVyKHYgPT4gdi5hY2Nlc3NhYmxlKS5mb3JFYWNoKHYgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QubmFtZXMucHVzaCh2LnJlc29sdXRpb24pO1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QudXJscy5wdXNoKHYudmlkZW9faW5mby51cmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlMaXN0LmhlYWRlcnMucHVzaChwbGF5SGVhZGVycyk7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBjcmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHBsYXlMaXN0KTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBsZXQgcGxheVVybCA9IGdldERvd25sb2FkVXJsKGFzZmlkKS5kYXRhWzBdLmRvd25sb2FkX3VybDtcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtcXFwi5Y6f55S7XFxcIl0sXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbcGxheVVybCArIFxcXCIjaXNWaWRlbz10cnVlIyNmYXN0UGxheU1vZGUjI3RocmVhZHM9XFxcIiArIGdldEl0ZW0oXFxcInNwZWVkVGhyZWFkXFxcIiwgXFxcIjEwXFxcIikgKyBcXFwiI1xcXCJdLFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW3BsYXlIZWFkZXJzXVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgbGV0IHBsYXlVcmwgPSBnZXREb3dubG9hZFVybChhc2ZpZCkuZGF0YVswXS5kb3dubG9hZF91cmw7XFxuICAgICAgICAgICAgY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgaWYgKGNhdGVnb3J5ID09PSAnYXVkaW8nKSB7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbXFxcIumfs+mikVxcXCJdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW3BsYXlVcmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiXSxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtwbGF5SGVhZGVyXSxcXG4gICAgICAgICAgICAgICAgICAgIGx5cmljOiBcXFwiXFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAg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sb2dpblwiLFwicnVsZVwiOlwianM6XFxubGV0IGQgPSBbXTtcXG5zZXRQYWdlVGl0bGUoXFxcIueZu+W9leWkuOWFi+i0puWPt1xcXCIpO1xcbmFkZExpc3RlbmVyKFxcXCJvbkNsb3NlXFxcIiwgKCkgPT4gY2xlYXJNeVZhcihcXFwiY29va2llXFxcIikpO1xcbmQucHVzaCh7XFxuICAgIHRpdGxlOiBcXFwi4oCc4oCc56Gu6K6k55m75b2V4oCd4oCdXFxcIixcXG4gICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKCgpID0+IHtcXG4gICAgICAgIC8vbGV0IGNtID0gYW5kcm9pZC53ZWJraXQuQ29va2llTWFuYWdlci5nZXRJbnN0YW5jZSgpO1xcbiAgICAgICAgLy9sZXQgY20gPSBjb20udGVuY2VudC5zbXR0LnNkay5Db29raWVNYW5hZ2VyLmdldEluc3RhbmNlKCk7XFxuICAgICAgICAvL2xldCBjb29raWUgPSBTdHJpbmcoY20uZ2V0Q29va2llKFxcXCJodHRwczovL3Bhbi5xdWFyay5jblxcXCIpIHx8IFxcXCJcXFwiKTtcXG4gICAgICAgIGxldCBjb29raWUgPSBnZXRNeVZhcihcXFwiY29va2llXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgaWYgKCQucmVxdWlyZShcXFwidG9vbFxcXCIpLmlzTG9naW5Db29raWUoY29va2llKSkge1xcbiAgICAgICAgICAgIHNldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgY29va2llKTtcXG4gICAgICAgICAgICBiYWNrKCk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+eZu+W9leaIkOWKn1xcXCI7XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5pyq55m75b2VXFxcIjtcXG4gICAgfSksXFxuICAgIGRlc2M6IFxcXCLigJzigJzigJ3igJ08c21hbGw+54K55Ye75aS05YOP5Y+v5Lul6Y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ZeagvOW8j+mUmeivr1xcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwgaXNyKTtcXG4gICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuS7jlRWQk9Y6I635Y+WQ29va2llXFxcIikge1xcbiAgICAgICAgbGV0IHBhdGggPSBcXFwiL3N0b3JhZ2UvZW11bGF0ZWQvMC9UVi8ucXVhcmtfdXNlclxcXCI7XFxuICAgICAgICBpZiAoZmlsZUV4aXN0KFxcXCJmaWxlOi8vXFxcIiArIHBhdGgpKSB7XFxuICAgICAgICAgICAgaWYgKCFuZXcgamF2YS5pby5GaWxlKHBhdGgpLmNhblJlYWQoKSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwi5rKh5pyJ5p2D6ZmQ6K+75Y+WQ29va2ll5paH5Lu277yM6K+35omT5byA5omA5pyJ5paH5Lu25p2D6ZmQXFxcXG7mtbfpmJTorr7nva4tPuabtOWkmuWKn+iDvS0+5YaF6YOo5paH5Lu2566h55CGLT7lj7PkuIrop5JcXFwiKS5jb25maXJtKCgpID0+IHt9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKGZldGNoKFxcXCJmaWxlOi8vXFxcIiArIHBhdGgpKTtcXG4gICAgICAgICAgICAgICAgbGV0IGNvb2tpZSA9IGpzb24uY29va2llO1xcbiAgICAgICAgICAgICAgICBpZiAoJC5yZXF1aXJlKFxcXCJ0b29sXFxcIikuaXNMb2dpbkNvb2tpZShjb29raWUpKSB7XFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJxdWFya0Nvb2tpZVxcXCIsIGNvb2tpZSk7XFxuICAgICAgICAgICAgICAgICAgICBpc3IgJiYgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/orr7nva7miJDlip9cXFwiO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL0Nvb2tpZeagvOW8j+mUmeivr1xcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/ojrflj5blpLHotKXlhbHkuqvmlofku7bmjZ/lnY9cXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgcmV0dXJuICQoXFxcIuacquajgOa1i+WIsFRWQk9Y55qEQ29va2ll5paH5Lu2XFxcXG7or7fkvb/nlKjov4flkI7lho3lsJ3or5VcXFwiKS5jb25maXJtKCgpID0+IHt9KTtcXG4gICAgICAgIH1cXG4gICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuWkjeWItkNvb2tpZVxcXCIpIHtcXG4gICAgICAgIGxldCBjb29raWUgPSBnZXRJdGVtKFxcXCJxdWFya0Nvb2tpZVxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgIGlmIChjb29raWUpIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcImNvcHk6Ly9cXFwiICsgY29va2llO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5pyq55m75b2VXFxcIjtcXG4gICAgICAgIH1cXG4gICAgfSBlbHNlIHtcXG4gICAgICAgIGNsZWFySXRlbShcXFwicXVhcmtDb29raWVcXFwiKTtcXG4gICAgICAgIGlzciAmJiByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+mAgOWHuueZu+W9lVxcXCI7XFxuICAgIH1cXG59LCAkLmltcG9ydFBhcmFtKTtcIn1dIiwiaWNvbiI6Imhpa2VyOi8vaW1hZ2VzL2ljb25fa3Vha2UiLCJwcm94eSI6IiJ9
Add Comment
Please, Sign In to add comment