xiaomianao666

小程序:Quark.简

Jun 26th, 2024
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@Quark.简@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoiUXVhcmsu566AIiwiYXV0aG9yIjoiQExveURnSWsiLCJ1cmwiOiJoaWtlcjovL2VtcHR5IyMiLCJ2ZXJzaW9uIjoxOCwiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxubGV0IGQgPSBbXTtcblxubGV0IGNvb2tpZSA9IGdldEl0ZW0oXCJxdWFya0Nvb2tpZVwiLCBcIlwiKTtcblxuaWYgKCEkLnJlcXVpcmUoXCJ0b29sXCIpLmlzTG9naW5Db29raWUoY29va2llKSkge1xuICAgIGNsZWFySXRlbShcInF1YXJrQ29va2llXCIpO1xuICAgIGQucHVzaCh7XG4gICAgICAgIHRpdGxlOiAnPGZvbnQgY29sb3I9XCIjMTNCNjFCXCI+4paQIDwvZm9udD48Yj7muKnppqjmj5DnpLo8Yj4nLFxuICAgICAgICBjb2xfdHlwZTogXCJyaWNoX3RleHRcIixcbiAgICB9KTtcbiAgICBkLnB1c2goe1xuICAgICAgICB1cmw6ICQucmVxdWlyZShcImFjY291bnRcIiwgdHJ1ZSksXG4gICAgICAgIGNvbF90eXBlOiBcInRleHRfMVwiLFxuICAgICAgICB0aXRsZTogXCLmnKrmo4DmtYvliLDnmbvlvZXkv6Hmga/vvIzngrnmiJHot7PovaznmbvlvZXotKblj7fpobXpnaLvvIzojrflj5ZRdWFyayBDb29raWXlkI7mlrnl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WxkUGFyYW0pOnRoaXMudXJsLCBvcHRpb25zKSk7XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIGlmIChyZXMuc3RhdHVzQ29kZSA+PSAyMDAgJiYgcmVzLnN0YXR1c0NvZGUgPD0gMzAwKSB7XFxuICAgICAgICAgICAgICAgIGxldCBib2R5ID0gcmVzLmJvZHk7XFxuICAgICAgICAgICAgICAgIGlmICh0b0pzb24pIHtcXG4gICAgICAgICAgICAgICAgICAgIGJvZHkgPSBKU09OLnBhcnNlKGJvZHkpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN1Y2Nlc3NDYWxsYmFjayhib2R5LCByZXMpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihTdHJpbmcocmVzLnN0YXR1c0NvZGUpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlcnIpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBlcnIgPSB0aGlzLmVycm9yVHlwZUNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0aGlzLnJldHJ5Q291bnQpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHRyeVJlc3VsdCA9IHRoaXMuZXJyb3JDYWxsYmFja1dpdGhSZXRyeShlcnIsIHJlcywgdGhpcyk7XFxuICAgICAgICAgICAgICAgIGlmICh0cnlSZXN1bHQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudC0tO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQodG9Kc29uKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudCA9IDA7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lcnJvckNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVycm9yQ2FsbGJhY2soZXJyLCByZXMpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAgc2V0T3B0aW9ucyhvcHRpb25zKSB7XFxuICAgICAgICB0aGlzLm9wdGlvbnMgPSBPYmplY3QuYXNzaWduKHt9LCBvcHRpb25zLCB7XFxuICAgICAgICAgICAgd2l0aEhlYWRlcnM6IHRydWVcXG4gICAgICAgIH0pO1xcbiAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgIH0sXFxuICAgIG1lcmdlSGVhZEFuZEJvZHkob3B0aW9ucykge1xcbiAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307XFxuICAgICAgICBPYmplY3QuYXNzaWduKHRoaXMub3B0aW9ucy5oZWFkZXJzfHx7fSwgb3B0aW9ucy5oZWFkZXJzKTtcXG4gICAgICAgIGlmICh0eXBlb2YgdGhpcy5vcHRpb25zLmJvZHkgPT09IFxcXCJvYmplY3RcXFwiICYmIHR5cGVvZiBvcHRpb25zLmJvZHkgPT09IFxcXCJvYmplY3RcXFwiKSB7XFxuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbih0aGlzLm9wdGlvbnMuYm9keXx8e30sIG9wdGlvbnMuYm9keSk7XFxuICAgICAgICB9XFxuICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMuYnVpbGRVcmwgPT09IFxcXCJvYmplY3RcXFwiKSB7XFxuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbih0aGlzLmJ1aWxkUGFyYW18fHt9LCBvcHRpb25zLmJ1aWxkVXJsKTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiB0aGlzO1xcbiAgICB9XF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fdHlwZTogc3R5bGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBzaGFyZUlkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2QsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVRva2VuOiBxdWFya1NoYXJlQXBpLmdldFRva2VuKCksXFxuICAgICAgICAgICAgICAgICAgICBmaWxlSWQ6IGl0ZW0uZmlkLFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRIZWFkKGl0ZW0ub2JqX2NhdGVnb3J5KSArIGl0ZW0uZmlsZV9uYW1lLFxcbiAgICAgICAgICAgICAgICBkZXNjOiAkLmRhdGVGb3JtYXQoaXRlbS51cGRhdGVkX2F0LCAneXl5eS1NTS1kZCcpICsgJyAgJyArIGZvcm1hdFNpemUoaXRlbS5zaXplKSxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogaXRlbS50aHVtYm5haWwsXFxuICAgICAgICAgICAgICAgIHVybDogJCgpLmxhenlSdWxlKChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGxheVVybENhY2hlID0gc3RvcmFnZTAuZ2V0TXlWYXIoXFxcInBsYXlVcmxDYWNoZVxcXCIsIHt9KTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChwbGF5VXJsQ2FjaGVbZmlkXSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwbGF5VXJsQ2FjaGVbZmlkXTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHVybCA9ICQucmVxdWlyZShcXFwicGxheVxcXCIpLmdldFBsYXlVcmwoZmlkLCBmaWRfdG9rZW4sIHB3ZF9pZCwgc3Rva2VuLCBjYXRlZ29yeSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxheVVybENhY2hlW2ZpZF0gPSB1cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoXFxcInBsYXlVcmxDYWNoZVxcXCIsIHBsYXlVcmxDYWNoZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybDtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgaXRlbS5maWQsIGl0ZW0uc2hhcmVfZmlkX3Rva2VuLCBzaGFyZUlkLCBxdWFya1NoYXJlQXBpLmdldFRva2VuKCksIGl0ZW0ub2JqX2NhdGVnb3J5KSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGl0ZW0uZmlkLFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogJ3BsYXlsaXN0ICcgKyBpdGVtLm9ial9jYXRlZ29yeVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6ICdsaW5lJ1xcbiAgICAgICAgfSk7XFxuICAgIH0pO1xcbn0gY2F0Y2ggKGUpIHtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBlLm1lc3NhZ2UsXFxuICAgICAgICB1cmw6ICdoaWtlcjovL2VtcHR5JyxcXG4gICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgICBleHRyYToge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09IFxcXCJ2aWRlb1xcXCIpIHtcXG4gICAgICAgICAgICBsZXQgcGxheU1vZGUgPSBnZXRJdGVtKFxcXCJxdWFya19wbGF5TW9kZVxcXCIsIFxcXCLovaznoIFcXFwiKTtcXG4gICAgICAgICAgICBpZiAocGxheU1vZGUgPT09IFxcXCLovaznoIFcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGxldCB2aWRlb1JlcyA9IGdldFByZXZpZXdWaWRlbyhhc2ZpZCk7XFxuICAgICAgICAgICAgICAgIGxldCB2aWRlb0xpc3QgPSB2aWRlb1Jlcy5kYXRhLnZpZGVvX2xpc3Q7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbXSxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtdLFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW11cXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgdmlkZW9MaXN0LmZpbHRlcih2ID0+IHYuYWNjZXNzYWJsZSkuZm9yRWFjaCh2ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlMaXN0Lm5hbWVzLnB1c2godi5yZXNvbHV0aW9uKTtcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlMaXN0LnVybHMucHVzaCh2LnZpZGVvX2luZm8udXJsICsgXFxcIiNpc1ZpZGVvPXRydWUjXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBwbGF5TGlzdC5oZWFkZXJzLnB1c2gocGxheUhlYWRlcnMpO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlVcmwgPSBnZXREb3dubG9hZFVybChhc2ZpZCkuZGF0YVswXS5kb3dubG9hZF91cmw7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbXFxcIuWOn+eUu1xcXCJdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW3BsYXlVcmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSMjZmFzdFBsYXlNb2RlIyN0aHJlYWRzPVxcXCIgKyBnZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFxcXCIxMFxcXCIpICsgXFxcIiNcXFwiXSxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtwbGF5SGVhZGVyc11cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBjcmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHBsYXlMaXN0KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGxldCBwbGF5VXJsID0gZ2V0RG93bmxvYWRVcmwoYXNmaWQpLmRhdGFbMF0uZG93bmxvYWRfdXJsO1xcbiAgICAgICAgICAgIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcbiAgICAgICAgICAgIGlmIChjYXRlZ29yeSA9PT0gJ2F1ZGlvJykge1xcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW1xcXCLpn7PpopFcXFwiXSxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtwbGF5VXJsICsgXFxcIiNpc1ZpZGVvPXRydWUjXFxcIl0sXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbcGxheUhlYWRlcl0sXFxuICAgICAgICAgICAgICAgICAgICBseXJpYzogXFxcIlxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2F0ZWdvcnkgPT09ICdpbWFnZScpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQocGxheVVybCwgcGxheUhlYWRlcikuaW1hZ2UoKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBwbGF5SGVhZGVyID0gT2JqZWN0LmtleXMocGxheUhlYWRlcikubWFwKGtleSA9PiBrZXkgKyBcXFwiQFxcXCIgKyBTdHJpbmcocGxheUhlYWRlcltrZXldKS5yZXBsYWNlKC87L2csIFxcXCLvvJvvvJtcXFwiKSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiZG93bmxvYWQ6Ly9cXFwiICsgcGxheVVybCArIFxcXCI7e1xcXCIgKyBwbGF5SGVhZGVyLmpvaW4oXFxcIiYmXFxcIikgKyBcXFwifVxcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICBpZiAoZS5tZXNzYWdlLmluY2x1ZGVzKFxcXCJyZXF1aXJlIGxvZ2luXFxcIikpIHtcXG4gICAgICAgICAgICB0b2FzdChcXFwi5pyq55m75b2V5oiW55m75b2V6L+H5pyf77yM6K+36YeN5paw55m75b2VXFxcIik7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvbG9naW5cXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL1xcXCIgKyBlLnRvU3RyaW5nKCk7XFxuICAgIH1cXG59XFxuXFxuJC5leHBvcnRzID0ge1xcbiAgICBnZXRQbGF5VXJsXFxufTtcIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIueZu+W9lei0puWPt1wiLFwicGF0aFwiOlwibG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ktOWDj+WPr+S7pemAgOWHuui0puWPt+mHjeaWsOeZu+W9lTwvc21hbGw+XFxcIixcXG4gICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIlxcbn0pO1xcbmQucHVzaCh7XFxuICAgIGNvbF90eXBlOiBcXFwibGluZV9ibGFua1xcXCJcXG59KTtcXG5kLnB1c2goe1xcbiAgICBjb2xfdHlwZTogXFxcIng1X3dlYnZpZXdfc2luZ2xlXFxcIixcXG4gICAgdXJsOiBcXFwiaHR0cHM6Ly9wYW4ucXVhcmsuY25cXFwiLFxcbiAgICBkZXNjOiBcXFwibGlzdCYmc2NyZWVuLTE1MFxcXCIsXFxuICAgIGV4dHJhOiB7XFxuICAgICAgICB1YTogUENfVUEsXFxuICAgICAgICBqczogJC50b1N0cmluZygodGl0bGUpID0+IHtcXG4gICAgICAgICAgICBsZXQgY29va2llID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgc2V0SW50ZXJ2YWwoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICBjb29raWUgPSBmYmEuZ2V0Q29va2llKFxcXCJodHRwczovL3Bhbi5xdWFyay5jblxcXCIpO1xcbiAgICAgICAgICAgICAgICBmYmEucHV0VmFyKHRpdGxlICsgXFxcIkBjb29raWVcXFwiLCBjb29raWUpO1xcbiAgICAgICAgICAgIH0sIDIwMCk7XFxuICAgICAgICB9LCBNWV9SVUxFLnRpdGxlKVxcbiAgICB9XFxufSk7XFxuc2V0UmVzdWx0KGQpXCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLlt6XlhbdcIixcInBhdGhcIjpcInRvb2xcIixcInJ1bGVcIjpcImpzOlxcblxcbiQuZXhwb3J0cz17XFxuICAgIGlzTG9naW5Db29raWUoY29va2llKXtcXG4gICAgICAgIHJldHVybiAhIShjb29raWUgICYmIGNvb2tpZS5pbmNsdWRlcyhcXFwiX191aWQ9XFxcIikgJiYgY29va2llLmluY2x1ZGVzK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cbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIGlzcik7XFxuICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLku45UVkJPWOiOt+WPlkNvb2tpZVxcXCIpIHtcXG4gICAgICAgIGxldCBwYXRoID0gXFxcIi9zdG9yYWdlL2VtdWxhdGVkLzAvVFYvLnF1YXJrX3VzZXJcXFwiO1xcbiAgICAgICAgaWYgKGZpbGVFeGlzdChcXFwiZmlsZTovL1xcXCIgKyBwYXRoKSkge1xcbiAgICAgICAgICAgIGlmICghbmV3IGphdmEuaW8uRmlsZShwYXRoKS5jYW5SZWFkKCkpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIuayoeacieadg+mZkOivu+WPlkNvb2tpZeaWh+S7tu+8jOivt+aJk+W8gOaJgOacieaWh+S7tuadg+mZkFxcXFxu5rW36ZiU6K6+572uLT7mm7TlpJrlip/og70tPuWGhemDqOaWh+S7tueuoeeQhi0+5Y+z5LiK6KeSXFxcIikuY29uZmlybSgoKSA9PiB7fSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShmZXRjaChcXFwiZmlsZTovL1xcXCIgKyBwYXRoKSk7XFxuICAgICAgICAgICAgICAgIGxldCBjb29raWUgPSBqc29uLmNvb2tpZTtcXG4gICAgICAgICAgICAgICAgaWYgKCQucmVxdWlyZShcXFwidG9vbFxcXCIpLmlzTG9naW5Db29raWUoY29va2llKSkge1xcbiAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwicXVhcmtDb29raWVcXFwiLCBjb29raWUpO1xcbiAgICAgICAgICAgICAgICAgICAgaXNyICYmIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K6+572u5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly9Db29raWXmoLzlvI/plJnor69cXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6I635Y+W5aSx6LSl5YWx5Lqr5paH5Lu25o2f5Z2PXFxcIjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHJldHVybiAkKFxcXCLmnKrmo4DmtYvliLBUVkJPWOeahENvb2tpZeaWh+S7tlxcXFxu6K+35L2/55So6L+H5ZCO5YaN5bCd6K+VXFxcIikuY29uZmlybSgoKSA9PiB7fSk7XFxuICAgICAgICB9XFxuICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLlpI3liLZDb29raWVcXFwiKSB7XFxuICAgICAgICBsZXQgY29va2llID0gZ2V0SXRlbShcXFwicXVhcmtDb29raWVcXFwiLCBcXFwiXFxcIik7XFxuICAgICAgICBpZiAoY29va2llKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8vXFxcIiArIGNvb2tpZTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+acqueZu+W9lVxcXCI7XFxuICAgICAgICB9XFxuICAgIH0gZWxzZSB7XFxuICAgICAgICBjbGVhckl0ZW0oXFxcInF1YXJrQ29va2llXFxcIik7XFxuICAgICAgICBpc3IgJiYgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/pgIDlh7rnmbvlvZVcXFwiO1xcbiAgICB9XFxufSwgJC5pbXBvcnRQYXJhbSk7XCJ9XSIsImljb24iOiJoaWtlcjovL2ltYWdlcy9pY29uX2t1YWtlIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment