Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥败犬女主太多了@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuWkuOWFi+WIl+ihqEFQSVwiLFwicGF0aFwiOlwiUXVhcmtTaGFyZUFwaVwiLFwicnVsZVwiOlwianM6XFxuLy9AYXV0aG9yIExveURnSWtcXG5sZXQgaHR0cFJlcXVlc3QgPSAkLnJlcXVpcmUoXFxcImh0dHBSZXF1ZXN0XFxcIik7XFxubGV0IGZyb21Ecml2ZSA9IG1vZHVsZS5pbXBvcnRQYXJhbTtcXG5sZXQgcHIsIGJhc2VVcmxcXG5pZiAoZnJvbURyaXZlID09PSBcXFwidWNcXFwiKSB7XFxuICAgIGJhc2VVcmwgPSBcXFwiaHR0cHM6Ly9wYy1hcGkudWMuY25cXFwiO1xcbiAgICBwciA9IFxcXCJVQ0Jyb3dzZXJcXFwiO1xcbn0gZWxzZSB7XFxuICAgIGJhc2VVcmwgPSBcXFwiaHR0cHM6Ly9wYW4ucXVhcmsuY25cXFwiO1xcbiAgICBwciA9IFxcXCJ1Y3Byb1xcXCI7XFxufVxcblxcbmZ1bmN0aW9uIFF1YXJrU2hhcmVBcGkoc2hhcmVJZCwgc2hhcmVQd2Qp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pzb24pIHtcXG4gICAgICAgICAgICAgICAgICAgIGJvZHkgPSBKU09OLnBhcnNlKGJvZHkpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN1Y2Nlc3NDYWxsYmFjayhib2R5LCByZXMpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihTdHJpbmcocmVzLnN0YXR1c0NvZGUpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlcnIpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBlcnIgPSB0aGlzLmVycm9yVHlwZUNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0aGlzLnJldHJ5Q291bnQpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHRyeVJlc3VsdCA9IHRoaXMuZXJyb3JDYWxsYmFja1dpdGhSZXRyeShlcnIsIHJlcywgdGhpcyk7XFxuICAgICAgICAgICAgICAgIGlmICh0cnlSZXN1bHQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudC0tO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQodG9Kc29uKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudCA9IDA7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lcnJvckNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVycm9yQ2FsbGJhY2soZXJyLCByZXMpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICA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dDovL+iuvue9ruS4jeWQiOazlVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFN0cmluZyhzcGVlZFRocmVhZCkpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLlpI3liLbliIbkuqvpk77mjqVcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGlmIChmcm9tRHJpdmUgPT09IFxcXCJ1Y1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBidWlsZFVybChcXFwiaHR0cHM6Ly9kcml2ZS51Yy5jbi9zL1xcXCIgKyBzaGFyZUlkICsgXFxcIj9wdWJsaWM9MSMvbGlzdC9zaGFyZVxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2RcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8vXFxcIiArIGJ1aWxkVXJsKFxcXCJodHRwczovL3Bhbi5xdWFyay5jbi9zL1xcXCIgKyBzaGFyZUlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFzc2NvZGU6IHNoYXJlUHdkXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHNoYXJlSWQsIHNoYXJlUHdkLCBmcm9tRHJpdmUpLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJpY29uXzVcXFwiLFxcbiAgICAgICAgcGljX3VybDogXFx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Lu25aS5XFxuICAgICAgICBpZiAoaXRlbS5kaXIpIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIvCfk4JcXFwiICsgaXRlbS5maWxlX25hbWUsXFxuICAgICAgICAgICAgICAgIGRlc2M6ICQuZGF0ZUZvcm1hdChpdGVtLnVwZGF0ZWRfYXQsICd5eXl5LU1NLWRkJykgKyAnICAnICsgaXRlbS5pbmNsdWRlX2l0ZW1zICsgJ+mhuSAgJyxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogXFxcImh0dHBzOi8vaGlrZXJmYW5zLmNvbS90dWJpYW8vbWVzc3kvMjcuc3ZnXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL3F1YXJrTGlzdD9wYWdlPWZ5cGFnZVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlSWQsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVJZDogaXRlbS5maWQsXFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgZnJvbURyaXZlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGdldEhlYWQoaXRlbS5vYmpfY2F0ZWdvcnkpICsgaXRlbS5maWxlX25hbWUsXFxuICAgICAgICAgICAgICAgIGRlc2M6ICQuZGF0ZUZvcm1hdChpdGVtLn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dmUpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogaXRlbS5maWQsXFxuICAgICAgICAgICAgICAgICAgICAvL2luaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICBjbHM6ICdwbGF5bGlzdCAnICsgaXRlbS5vYmpfY2F0ZWdvcnlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuXFxuICAgIH0pO1xcbn0gY2F0Y2ggKGUpIHtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBlLm1lc3NhZ2UsXFxuICAgICAgICB1cmw6ICdoaWtlcjovL2VtcHR5JyxcXG4gICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgfVxcbiAgICB9KTtcXG4gICAgaWYgKGUubWVzc2FnZS5pbmNsdWRlcyhcXFwi5o+Q5Y+W56CBXFxcIikpIHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLovpPlhaXmj5Dlj5bnoIFcXFwiLFxcbiAgICAgICAgICAgIHVybDogJCgpLmlucHV0KChNWV9QQVJBTVMpID0+IHtcXG4gICAgICAgICAgICAgICAgc2V0UGFnZVBhcmFtcyhPYmplY3QuYXNzaWduKHt9LCBNWV9QQVJBTVMsIHtcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkOiBpbnB1dFxcbiAgICAgICAgICAgICAgICB9KSk7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgfSwgTVlfUEFSQU1TKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXz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bih7fSwgcGxheUhlYWRlciwge1xcbiAgICAgICAgICAgIFxcXCJVc2VyLUFnZW50XFxcIjogXFxcIkxvZ1N0YXRpc3RpY1xcXCJcXG4gICAgICAgIH0pO1xcbiAgICAgICAgaWYgKGNhdGVnb3J5ID09IFxcXCJ2aWRlb1xcXCIpIHtcXG4gICAgICAgICAgICBsZXQgcGxheU1vZGUgPSBnZXRJdGVtKFxcXCJxdWFya19wbGF5TW9kZVxcXCIsIFxcXCLovaznoIFcXFwiKTtcXG4gICAgICAgICAgICBpZiAocGxheU1vZGUgPT09IFxcXCLovaznoIFcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGxldCB2aWRlb1JlcyA9IGdldFByZXZpZXdWaWRlbyhhc2ZpZCk7XFxuXFxuICAgICAgICAgICAgICAgIGxldCB2aWRlb0xpc3QgPSB2aWRlb1Jlcy5kYXRhLnZpZGVvX2xpc3Q7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbXSxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtdLFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW11cXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgdmlkZW9MaXN0LmZpbHRlcih2ID0+IHYuYWNjZXNzYWJsZSkuZm9yRWFjaCh2ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlMaXN0Lm5hbWVzLnB1c2godi5yZXNvbHV0aW9uKTtcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlMaXN0LnVybHMucHVzaCh2LnZpZGVvX2luZm8udXJsICsgXFxcIiNpc1ZpZGVvPXRydWUjXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBwbGF5TGlzdC5oZWFkZXJzLnB1c2gocGxheUhlYWRlcnMpO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG5cXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlVcmwgPSBnZXREb3dubG9hZFVybChhc2ZpZCkuZGF0YVswXS5kb3dubG9hZF91cmw7XFxuICAgICAgICAgICAgICAgIHBsYXlIZWFkZXJzLmNvb2tpZT1jb29raWVNYW5hZ2UuZ2V0KCk7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbcGxheU1vZGVdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW3BsYXlVcmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiKyhwbGF5TW9kZT09PVxcXCLljp/nlLtcXFwiP1xcXCIjZmFzdFBsYXlNb2RlIyN0aHJlYWRzPVxcXCIgKyBnZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFxcXCIxMFxcXCIpICsgXFxcIiNcXFwiOlxcXCJcXFwiKV0sXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbcGxheUhlYWRlcnNdXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgcGxheVVybCA9IGdldERvd25sb2FkVXJsKGFzZmlkKS5kYXRhWzBdLmRvd25sb2FkX3VybDtcXG5cXG4gICAgICAgICAgICBjcmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXG4gICAgICAgICAgICBpZiAoY2F0ZWdvcnkgPT09ICdhdWRpbycpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtcXFwi6Z+z6aKRXFxcIl0sXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbcGxheVVybCArIFxcXCIjaXNWaWRlbz10cnVlI1xcXCJdLFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW3BsYXlIZWFkZXJdLFxcbiAgICAgICAgICAgICAgICAgICAgbHlyaWM6IFxcXCJcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHBsYXlMaXN0KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNhdGVnb3J5ID09PSAnaW1hZ2UnKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkKHBsYXlVcmwsIHBsYXlIZWFkZXIpLmltYWdlKCk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgcGxheUhlYWRlciA9IE9iamVjdC5rZXlzKHBsYXlIZWFkZXIpLm1hcChrZXkgPT4ga2V5ICsgXFxcIkBcXFwiICsgU3RyaW5nKHBsYXlIZWFkZXJba2V5XSkucmVwbGFjZSgvOy9nLCBcXFwi77yb77ybXFxcIikpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImRvd25sb2FkOi8vXFxcIiArIHBsYXlVcmwgKyBcXFwiO3tcXFwiICsgcGxheUhlYWRlci5qb2luKFxcXCImJlxcXCIpICsgXFxcIn1cXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgaWYgKGUubWVzc2FnZS5pbmNsdWRlcyhcXFwicmVxdWlyZSBsb2dpblxcXCIpKSB7XFxuICAgICAgICAgICAgdG9hc3QoXFxcIuacqueZu+W9leaIlueZu+W9lei/h+acn++8jOivt+mHjeaWsOeZu+W9lVxcXCIpO1xcbiAgICAgICA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HBhdGgpLmNhblJlYWQoKSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwi5rKh5pyJ5p2D6ZmQ6K+75Y+WQ29va2ll5paH5Lu277yM6K+35omT5byA5omA5pyJ5paH5Lu25p2D6ZmQXFxcXG7mtbfpmJTorr7nva4tPuabtOWkmuWKn+iDvS0+5YaF6YOo5paH5Lu2566h55CGLT7lj7PkuIrop5JcXFwiKS5jb25maXJtKCgpID0+IHt9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKGZldGNoKFxcXCJmaWxlOi8vXFxcIiArIHBhdGgpKTtcXG4gICAgICAgICAgICAgICAgbGV0IGNvb2tpZSA9IGpzb24uY29va2llO1xcbiAgICAgICAgICAgICAgICBpZiAoJC5yZXF1aXJlKFxcXCJ0b29sXFxcIikuaXNMb2dpbkNvb2tpZShjb29raWUpKSB7XFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJxdWFya0Nvb2tpZVxcXCIsIGNvb2tpZSk7XFxuICAgICAgICAgICAgICAgICAgICBpc3IgJiYgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/orr7nva7miJDlip9cXFwiO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL0Nvb2tpZeagvOW8j+mUmeivr1xcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/ojrflj5blpLHotKXlhbHkuqvmlofku7bmjZ/lnY9cXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgcmV0dXJuICQoXFxcIuac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dCA9PT0gXFxcIui3s+i9rOWkuOWFi0FQUFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJxa2xpbms6Ly93d3cudWMuY24vYjIwYjg0ZmQ3MzVhOGRkM2Y3NTQxMTI5YmFjYzRlOWE/YWN0aW9uPW9wZW5fdXJsJnVybD1odHRwczovL3Bhbi5xdWFyay5jbi9zL1xcXCIgKyBzaGFyZUlkO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLkuKrkurrotKblj7fnrqHnkIZcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkLnJlcXVpcmUoXFxcImFjY291bnRcXFwiKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi5Y6f55S75LiL6L2957q/56iLXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChnZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFxcXCIxMFxcXCIpLCBcXFwi6K+36L6T5YWlMy0zMuS5i+mXtOeahOaVtOaVsFxcXCIpLmlucHV0KCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBzcGVlZFRocmVhZCA9IHBhcnNlSW50KGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChzcGVlZFRocmVhZCA8IDMgfHwgc3BlZWRUaHJlYWQgPiAzMikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/orr7nva7kuI3lkIjms5VcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwic3BlZWRUaHJlYWRcXFwiLCBTdHJpbmcoc3BlZWRUaHJlYWQpKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/orr7nva7miJDlip9cXFwiO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi5aSN5Yi25YiG5Lqr6ZO+5o6lXFxcIikge1xcbiAgICAgICAgICAgICAgICBpZiAoZnJvbURyaXZlID09PSBcXFwidWNcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImNvcHk6Ly9cXFwiICsgYnVpbGRVcmwoXFxcImh0dHBzOi8vZHJpdmUudWMuY24vcy9cXFwiICsgc2hhcmVJZCArIFxcXCI/cHVibGljPTEjL2xpc3Qvc2hhcmVcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IHNoYXJlUHdkXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBidWlsZFVybChcXFwiaHR0cHM6Ly9wYW4ucXVhcmsuY24vcy9cXFwiICsgc2hhcmVJZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhc3Njb2RlOiBzaGFyZVB3ZFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCBzaGFyZUlkLCBzaGFyZVB3ZCwgZnJvbURyaXZlKSxcXG4gICAgICAgIGNvbF90eXBlOiBcXFwiaWNvbl81XFxcIixcXG4gICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vaW1nL2FsaV9maWxlaW50by5zdmdcXFwiLFxcbiAgICB9KTtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIGNvbF90eXBlOiAnbGluZV9ibGFuaydcXG4gICAgfSk7XFxufVxcblxcblxcbmxldCBRdWFya1NoYXJlQXBpID0gJC5yZXF1aXJlKFxcXCJRdWFya1NoYXJlQXBpXFxcIiwgZnJvbURyaXZlKTtcXG5sZXQgcXVhcmtTaGFyZUFwaS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w6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vdHViaWFvL21lc3N5LzI3LnN2Z1xcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9xdWFya0xpc3Q/cGFnZT1meXBhZ2VcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBzaGFyZUlkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2QsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVRva2VuOiBxdWFya1NoYXJlQXBpLmdldFRva2VuKCksXFxuICAgICAgICAgICAgICAgICAgICBmaWxlSWQ6IGl0ZW0uZmlkLFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgICAgIGZyb21Ecml2ZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRIZWFkKGl0ZW0ub2JqX2NhdGVnb3J5KSArIGl0ZW0uZmlsZV9uYW1lLFxcbiAgICAgICAgICAgICAgICBkZXNjOiAkLmRhdGVGb3JtYXQoaXRlbS51cGRhdGVkX2F0LCAneXl5eS1NTS1kZCcpICsgJyAgJyArIGZvcm1hdFNpemUoaXRlbS5zaXplKSxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogaXRlbS50aHVtYm5haWwsXFxuICAgICAgICAgICAgICAgIHVybDogJCgpLmxhenlSdWxlKChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5LCBmcm9tRHJpdmUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsQ2FjaGUgPSBzdG9yYWdlMC5nZXRNeVZhcihcXFwicGxheVVybENhY2hlXFxcIiwge30pO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBsYXlVcmxDYWNoZVtmaWRdKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsYXlVcmxDYWNoZVtmaWRdO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gJC5yZXF1aXJlKFxcXCJwbGF5XFxcIiwgZnJvbURyaXZlKS5nZXRQbGF5VXJsKGZpZCwgZmlkX3Rva2VuLCBwd2RfaWQsIHN0b2tlbiwgY2F0ZWdvcnkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsYXlVcmxDYWNoZVtmaWRdID0gdXJsO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKFxcXCJwbGF5VXJsQ2FjaGVcXFwiLCBwbGF5VXJsQ2FjaGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmw7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0sIGl0ZW0uZmlkLCBpdGVtLnNoYXJlX2ZpZF90b2tlbiwgc2hhcmVJZCwgcXVhcmtTaGFyZUFwaS5nZXRUb2tlbigpLCBpdGVtLm9ial9jYXRlZ29yeSwgZnJvbURyaXZlKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGl0ZW0uZmlkLFxcbiAgICAgICAgICAgICAgICAgICAgLy9pbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiAncGxheWxpc3QgJyArIGl0ZW0ub2JqX2NhdGVnb3J5XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcblxc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AgICBpZiAocmVzLnN0YXR1c0NvZGUgPj0gMjAwICYmIHJlcy5zdGF0dXNDb2RlIDw9IDMwMCkge1xcXFxuICAgICAgICAgICAgICAgIGxldCBib2R5ID0gcmVzLmJvZHk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHRvSnNvbikge1xcXFxuICAgICAgICAgICAgICAgICAgICBib2R5ID0gSlNPTi5wYXJzZShib2R5KTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3VjY2Vzc0NhbGxiYWNrKGJvZHksIHJlcyk7XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihTdHJpbmcocmVzLnN0YXR1c0NvZGUpKTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSBjYXRjaCAoZXJyKSB7XFxcXG4gICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgIGVyciA9IHRoaXMuZXJyb3JUeXBlQ2FsbGJhY2soZXJyLCByZXMpO1xcXFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAodGhpcy5yZXRyeUNvdW50KSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHRyeVJlc3VsdCA9IHRoaXMuZXJyb3JDYWxsYmFja1dpdGhSZXRyeShlcnIsIHJlcywgdGhpcyk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHRyeVJlc3VsdCkge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnJldHJ5Q291bnQtLTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQodG9Kc29uKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnJldHJ5Q291bnQgPSAwO1xcXFxuICAg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sgaXRlbS5pbmNsdWRlX2l0ZW1zICsgJ+mhuSAgJyxcXFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBcXFxcXFxcImh0dHBzOi8vaGlrZXJmYW5zLmNvbS90dWJpYW8vbWVzc3kvMjcuc3ZnXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFxcXFxcImhpa2VyOi8vcGFnZS9xdWFya0xpc3Q/cGFnZT1meXBhZ2VcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2QsXFxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZmlsZUlkOiBpdGVtLmZpZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZnJvbURyaXZlXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRIZWFkKGl0ZW0ub2JqX2NhdGVnb3J5KSArIGl0ZW0uZmlsZV9uYW1lLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6ICQuZGF0ZUZvcm1hdChpdGVtLnVwZGF0ZWRfYXQsICd5eXl5LU1NLWRkJykgKyAnICAnICsgZm9ybWF0U2l6ZShpdGVtLnNpemUpLFxcXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IGl0ZW0udGh1bWJuYWlsLFxcXFxuICAgICAgICAgICAgICAgIHVybDogJCgpLmxhenlSdWxlKChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5LCBmcm9tRHJpdmUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHBsYXlVcmxDYWNoZSA9IHN0b3JhZ2UwLmdldE15VmFyKFxcXFxcXFwicGxheVVybENhY2hlXFxcXFxcXCIsIHt9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBsYXlVcmxDYWNoZVtmaWRdKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGxheVVybENhY2hlW2ZpZF07XFxcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gJC5yZXF1aXJlKFxcXFxcXFwicGxheVxcXFxcXFwiLCBmcm9tRHJpdmUpLmdldFBsYXlVcmwoZmlkLCBmaWRfdG9rZW4sIHB3ZF9pZCwgc3Rva2VuLCBjYXRlZ29yeSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwbGF5VXJsQ2FjaGVbZmlkXSA9IHVybDtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKFxcXFxcXFwicGxheVVybENhY2hlXFxcXFxcXCIsIHBsYXlVcmxDYWNoZSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXJsO1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSwgaXRlbS5maWQsIGl0ZW0uc2hhcmVfZmlkX3Rva2VuLCBzaGFyZUlkLCBxdWFya1NoYXJlQXBpLmdldFRva2VuKCksIGl0ZW0ub2JqX2NhdGVnb3J5LCBmcm9tRHJpdmUpLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAg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2llID0ge307XFxcXG4gICAgdGhpcy5hZGQoY29va2llKTtcXFxcbn1cXFxcbk9iamVjdC5hc3NpZ24oQ29va2llTWFuYWdlLnByb3RvdHlwZSwge1xcXFxuICAgIGFkZChjb29raWUpIHtcXFxcbiAgICAgICAgbGV0IGNvb2tpZXMgPSBbXTtcXFxcbiAgICAgICAgaWYgKHR5cGVvZiBjb29raWUgPT09IFxcXFxcXFwic3RyaW5nXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgIGNvb2tpZXMgPSBjb29raWUuc3BsaXQoXFxcXFxcXCI7XFxcXFxcXCIpO1xcXFxuICAgICAgICB9IGVsc2UgaWYgKEFycmF5LmlzQXJyYXkoY29va2llKSkge1xcXFxuICAgICAgICAgICAgY29va2llcyA9IGNvb2tpZTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBjb29raWVzLmZvckVhY2godiA9PiB7XFxcXG4gICAgICAgICAgICB2ID0gdi5zcGxpdChcXFxcXFxcIj1cXFxcXFxcIik7XFxcXG4gICAgICAgICAgICBpZiAodi5sZW5ndGggPCAyKSByZXR1cm47XFxcXG4gICAgICAgICAgICBsZXQga2V5ID0gdi5zaGlmdCgpLnRyaW0oKTtcXFxcbiAgICAgICAgICAgIHRoaXMuY29va2llW2tleV0gPSB2LmpvaW4oXFxcXFxcXCI9XFxcXFxcXCIpLnRyaW0oKTtcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgfSxcXFxcbiAgICBnZXQoKSB7XFxcXG4gICAgICAgIHJldHVybiBPYmplY3QuZW50cmllcyh0aGlzLmNvb2tpZSkubWFwKHYgPT4gdlswXSArIFxcXFxcXFwiPVxcXFxcXFwiICsgdlsxXSkuam9pbihcXFxcXFxcIjtcXFxcXFxcIik7XFxcXG4gICAgfVxcXFxufSk7XFxcXG5jb25zdCBjb29raWVNYW5hZ2UgPSBuZXcgQ29va2llTWFuYWdlKGNvb2tpZSk7XFxcXG5sZXQgaHR0cFJlcXVlc3QgPSAkLnJlcXVpcm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cmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgbGV0IHBsYXlVcmwgPSBnZXREb3dubG9hZFVybChhc2ZpZCkuZGF0YVswXS5kb3dubG9hZF91cmw7XFxcXG5cXFxcbiAgICAgICAgICAgIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcXFxuICAgICAgICAgICAgaWYgKGNhdGVnb3J5ID09PSAnYXVkaW8nKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW1xcXFxcXFwi6Z+z6aKRXFxcXFxcXCJdLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbcGxheVVybCArIFxcXFxcXFwiI2lzVmlkZW89dHJ1ZSNcXFxcXFxcIl0sXFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtwbGF5SGVhZGVyXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgbHlyaWM6IFxcXFxcXFwiXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHBsYXlMaXN0KTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2F0ZWdvcnkgPT09ICdpbWFnZScpIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gJChwbGF5VXJsLCBwbGF5SGVhZGVyKS5pbWFnZSgpO1xcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICBwbGF5SGVhZGVyID0gT2JqZWN0LmtleXMocGxheUhlYWRlcikubWFwKGtleSA9PiBrZXkgKyBcXFxcXFxcIkBcXFxcXFxcIiArIFN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gICAgICAgICAgICAgIGlzciAmJiByZWZyZXNoUGFnZSgpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8vQ29va2ll5qC85byP6ZSZ6K+vXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6I635Y+W5aSx6LSl5YWx5Lqr5paH5Lu25o2f5Z2PXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gJChcXFxcXFxcIuacquajgOa1i+WIsFRWQk9Y55qEQ29va2ll5paH5Lu2XFxcXFxcXFxu6K+35L2/55So6L+H5ZCO5YaN5bCd6K+VXFxcXFxcXCIpLmNvbmZpcm0oKCkgPT4ge30pO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcXFxcXCLlpI3liLZDb29raWVcXFxcXFxcIikge1xcXFxuICAgICAgICBsZXQgY29va2llID0gZ2V0SXRlbShcXFxcXFxcInF1YXJrQ29va2llXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpO1xcXFxuICAgICAgICBpZiAoY29va2llKSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJjb3B5Oi8vXFxcXFxcXCIgKyBjb29raWU7XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+acqueZu+W9lVxcXFxcXFwiO1xcXFxuICAgICAgICB9XFxcXG4gICAgf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gIHJldHVybiBcXFxcXFxcInRvYXN0Oi8vQ29va2ll5qC85byP6ZSZ6K+vXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0sIGlzcik7XFxcXG4gICAgfWVsc2UgaWYgKGlucHV0ID09PSBcXFxcXFxcIuWkjeWItlVDQ29va2llXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgbGV0IGNvb2tpZSA9IGdldEl0ZW0oXFxcXFxcXCJ1Y0Nvb2tpZVxcXFxcXFwiLCBcXFxcXFxcIlxcXFxcXFwiKTtcXFxcbiAgICAgICAgaWYgKGNvb2tpZSkge1xcXFxuICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiY29weTovL1xcXFxcXFwiICsgY29va2llO1xcXFxuICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/mnKrnmbvlvZVcXFxcXFxcIjtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0gZWxzZSBpZihpbnB1dD09PVxcXFxcXFwi5riF6ZmkVUNDb29raWVcXFxcXFxcIil7XFxcXG4gICAgICAgIGNsZWFySXRlbShcXFxcXFxcInVjQ29va2llXFxcXFxcXCIpO1xcXFxuICAgICAgICBpc3IgJiYgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/pgIDlh7rnmbvlvZVcXFxcXFxcIjtcXFxcbiAgICB9XFxcXG59LCAkLmltcG9ydFBhcmFtKTtcXFwifV1cIixcInByb3h5XCI6XCJcIn0iLCJwaWNVcmwiOiJodHRwczovL2hpa2VyZmFucy5jb20vdHViaWFvL21lc3N5LzI3LnN2ZyIsInRpdGxlIjoi6LSl54qs5aWz5Li75aSq5aSa5LqGIn0=
Add Comment
Please, Sign In to add comment