Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@AlistPro@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoiQWxpc3RQcm8iLCJhdXRob3IiOiJATG95RGdJayIsInVybCI6Imhpa2VyOi8vZW1wdHkiLCJ2ZXJzaW9uIjoxMiwiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ0b29sIiwiY2xhc3NfdXJsIjoiIiwiYXJlYV9uYW1lIjoiIiwiYXJlYV91cmwiOiIiLCJzb3J0X25hbWUiOiIiLCJ5ZWFyX25hbWUiOiIiLCJzb3J0X3VybCI6IiIsInllYXJfdXJsIjoiIiwiZmluZF9ydWxlIjoianM6JC5yZXF1aXJlKFwiaGlrZXI6Ly9wYWdlL21haW4udlwiKTsiLCJzZWFyY2hfdXJsIjoiIiwiZ3JvdXAiOiLlt6XlhbciLCJzZWFyY2hGaW5kIjoiIiwiZGV0YWlsX2NvbF90eXBlIjoibW92aWVfMSIsImRldGFpbF9maW5kX3J1bGUiOiIiLCJzZGV0YWlsX2NvbF90eXBlIjoibW92aWVfMSIsInNkZXRhaWxfZmluZF9ydWxlIjoiIiwidWEiOiJtb2JpbGUiLCJwcmVSdWxlIjoiIiwicGFnZXMiOiJbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIumFjee9rlwiLFwicGF0aFwiOlwiY29uZmlnXCIsXCJydWxlXCI6XCJqczpcXG5sZXQgc3ViTGlzdCA9IG51bGw7XFxuT2JqZWN0LmRlZmluZVByb3BlcnR5KCQuZXhwb3J0cywgXFxcInN1Ykxpc3RcXFwiLCB7XFxuICAgIGdldCgpIHtcXG4gICAgICAgIGlmICghc3ViTGlzdCkge1xcbiAgICAgICAgICAgIHN1Ykxpc3QgPSBzdG9yYWdlMC5nZXRJdGVtKFxcXCJzdWJMaXN0XFxcIiwgW10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WFkRmlsZShcXFwicGFzc3dvcmQuanNvblxcXCIsIDApfHxcXFwiW11cXFwiKSk7XFxuICAgICAgICAgICAgfWNhdGNoKGUpe1xcbiAgICAgICAgICAgICAgICBwYXNEaWMgPSBbXTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gcGFzRGljO1xcbiAgICB9LFxcbiAgICBzZXQocGFzRGljcykge1xcbiAgICAgICAgbGV0IHBhc0RpY1N0ciA9IEpTT04uc3RyaW5naWZ5KEFycmF5LmZyb20ocGFzRGljcyksIHVuZGVmaW5lZCwgMik7XFxuICAgICAgICBzYXZlRmlsZShcXFwicGFzc3dvcmQuanNvblxcXCIscGFzRGljU3RyLDApO1xcbiAgICB9XFxufSk7XFxuZnVuY3Rpb24gZ2V0SWQobGVuZ3RoKSB7XFxuICAgIHJldHVybiBOdW1iZXIoTWF0aC5yYW5kb20oKS50b1N0cmluZygpLnN1YnN0cigzLCBsZW5ndGgpICsgRGF0ZS5ub3coKSkudG9TdHJpbmcoMzYpO1xcbn1cXG5sZXQgdWlkID0gbnVsbDtcXG5PYmplY3QuZGVmaW5lUHJvcGVydHkoJC5leHBvcnRzLCBcXFwidWlkXFxcIiwge1xcbiAgICBnZXQoKSB7XFxuICAgICAgICBpZiAoIXVpZCkge1xcbiAgICAgICAgICAgIHVpZCA9IGdldE15VmFyKFxcXCJ1aWRcXFwiKTtcXG4gICAgICAgICAgICBpZiAoIXVpZCkge1xcbiAgICAgICAgICAgICAgICB1aWQgPSBnZXRJZCg2KTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcInVpZFxcXCIsIHVpZCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIHVpZDtcXG4gICAgfVxcbn0pO1wifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwiQVBJXCIsXCJwYXRoXCI6XCJBUElcIixcInJ1bGVcIjpcImpzOlxcbmNvbnN0IGNvbmZpZ3MgPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9jb25maWdcXFwiKTtcXG5cXG4kLmV4cG9ydHMuZ2V0RmlsZXMgPSBmdW5jdGlvbihob3N0LCBwYXRoLCBwYXNzd29yZCkge1xcbiAgICBsZXQgcmVzID0gcG9zdChob3N0ICsgXFxcIi9hcGkvcHVibGljL3BhdGhcXFwiLCB7XFxuICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgXFxcIkNvbnRlbnQtVHlwZVxcXCI6IFxcXCJhcHBsaWNhdGlvbi9qc29uXFxcIlxcbiAgICAgICAgfSxcXG4gICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICBwYXRoOiBwYXRoLFxcbiAgICAgICAgICAgIHBhc3N3b3JkOiBwYXNzd29yZCxcXG4gICAgICAgIH0pLFxcbiAgICAgICAgdGltZW91dDogY29uZmlncy5zZXR0aW5ncy50aW1lb3V0XFxuICAgIH0pO1xcbiAgICB0cnkge1xcbiAgICAgICAgcmVzID0gSlNPTi5wYXJzZShyZXMpO1xcbiAgICAgICAgbGV0IG1zZyA9IHJlcy5tZXNzYWdlLnRyaW0oKTtcXG4gICAgICAgIHN3aXRjaCAobXNnKSB7XFxuICAgICAgICAgICAgY2FzZSBcXFwic3VjY2Vzc1xcXCI6XFxuICAgICAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgICAgICBzdGF0dXM6IDEsXFxuICAgICAgICAgICAgICAgICAgICBmaWxlczogcmVzLmRhdGEuZmlsZXMsXFxuICAgICAgICAgICAgICAgICAgICB1cGxvYWQ6IHJlcy5kYXRhLm1ldGEudXBsb2FkXFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgY2FzZSBcXFwiV3JvbmcgcGFzc3dvcmRcXFwiOlxcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiAyLFxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi6ZSZ6K+v5L+h5oGvOlxcXCIgKyBtc2cpO1xcbiAgICAgICAgfVxcbiAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgIHN0YXR1czogMCxcXG4gICAgICAgICAgICBkZXNjOiBlLnRvU3RyaW5nKClcXG4gICAgICAgIH07XFxuICAgIH1cXG59XFxuJC5leHBvcnRzLmdldEZpbGUgPSBmdW5jdGlvbihob3N0LCBwYXRoLCBwYXNzd29yZCkge1xcbiAgICBsZXQgcmVzID0gcG9zdChob3N0ICsgXFxcIi9hcGkvcHVibGljL3BhdGhcXFwiLCB7XFxuICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgXFxcIkNvbnRlbnQtVHlwZVxcXCI6IFxcXCJhcHBsaWNhdGlvbi9qc29uXFxcIlxcbiAgICAgICAgfSxcXG4gICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICBwYXRoOiBwYXRoLFxcbiAgICAgICAgICAgIHBhc3N3b3JkOiBwYXNzd29yZCxcXG4gICAgICAgIH0pLFxcbiAgICAgICAgdGltZW91dDogY29uZmlncy5zZXR0aW5ncy50aW1lb3V0XFxuICAgIH0pO1xcbiAgICB0cnkge1xcbiAgICAgICAgcmVzID0gSlNPTi5wYXJzZShyZXMpO1xcbiAgICAgICAgbGV0IG1zZyA9IHJlcy5tZXNzYWdlLnRyaW0oKTtcXG4gICAgICAgIHN3aXRjaCAobXNnKSB7XFxuICAgICAgICAgICAgY2FzZSBcXFwic3VjY2Vzc1xcXCI6XFxuICAgICAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgICAgICBzdGF0dXM6IDEsXFxuICAgICAgICAgICAgICAgICAgICBmaWxlczogcmVzLmRhdGEuZmlsZXNbMF0sXFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgY2FzZSBcXFwiV3JvbmcgcGFzc3dvcmRcXFwiOlxcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiAyLFxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi6ZSZ6K+v5L+h5oGvOlxcXCIgKyBtc2cpO1xcbiAgICAgICAgfVxcbiAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgIHN0YXR1czogMCxcXG4gICAgICAgICAgICBkZXNjOiBlLnRvU3RyaW5nKClcXG4gICAgICAgIH07XFxuICAgIH1cXG59XFxuJC5leHBvcnRzLmZpbmRGaWxlcyA9IGZ1bmN0aW9uKGhvc3QsIHBhdGgsIGtleXdvcmQpIHtcXG4gICAgbGV0IHJlcyA9IHBvc3QoaG9zdCArIFxcXCIvYXBpL3B1YmxpYy9zZWFyY2hcXFwiLCB7XFxuICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgXFxcIkNvbnRlbnQtVHlwZVxcXCI6IFxcXCJhcHBsaWNhdGlvbi9qc29uXFxcIlxcbiAgICAgICAgfSxcXG4gICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICBwYXRoOiBwYXRofHxcXFwiL1xcXCIsXFxuICAgICAgICAgICAga2V5d29yZDoga2V5d29yZFxcbiAgICAgICAgfSksXFxuICAgICAgICB0aW1lb3V0OiBjb25maWdzLnNldHRpbmdzLnRpbWVvdXRcXG4gICAgfSk7XFxuXFxuICAgIHRyeSB7XFxuICAgICAgICByZXMgPSBKU09OLnBhcnNlKHJlcyk7XFxuICAgICAgICBsZXQgbXNnID0gcmVzLm1lc3NhZ2UudHJpbSgpO1xcbiAgIC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ZSkgPT4ge1xcbiAgICAgICAgICAgIGNvbnN0IGNvbmZpZ3MgPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9jb25maWdcXFwiKTtcXG4gICAgICAgICAgICBsZXQgcmFua01ldGhvZCA9IGdldE15VmFyKFxcXCJyYW5rTWV0aG9kXFxcIik7XFxuICAgICAgICAgICAgbGV0IHJhbmtPcmRlciA9IGdldE15VmFyKFxcXCJyYW5rT3JkZXJcXFwiKTtcXG4gICAgICAgICAgICBsZXQgaWQgPSBjb25maWdzLnVpZCArIFxcXCIjcmFuazpcXFwiICsgbW5hbWU7XFxuICAgICAgICAgICAgaWYgKHJhbmtNZXRob2QgPT09IG1uYW1lKSB7XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCY4oCYXFxcIiArIG1uYW1lICsgXFxcIuKAmeKAmVxcXCIgKyAocmFua09yZGVyICE9PSBcXFwiUFxcXCIgPyBcXFwi4oioXFxcIiA6IFxcXCLiiKdcXFwiKSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJyYW5rT3JkZXJcXFwiLCByYW5rT3JkZXIgIT09IFxcXCJQXFxcIiA/IFxcXCJQXFxcIiA6IFxcXCJJXFxcIik7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShpZCwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJjigJhcXFwiICsgbW5hbWUgKyBcXFwi4oCZ4oCZ4oioXFxcIlxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShjb25maWdzLnVpZCArIFxcXCIjcmFuazpcXFwiICsgcmFua01ldGhvZCwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHJhbmtNZXRob2RcXG4gICAg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ICAgICAgICBpZiAoaSA9PT0gc3RyLmxlbmd0aCAtIDEpIHtcXG4gICAgICAgICAgICAgICAgc2VjdGlvbiArPSBudW1iZXI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgdW5pdCA9IGNobk5hbWVWYWx1ZVtzdHJbaV1dLnZhbHVlO1xcbiAgICAgICAgICAgIHNlY1VuaXQgPSBjaG5OYW1lVmFsdWVbc3RyW2ldXS5zZWNVbml0O1xcbiAgICAgICAgICAgIGlmIChzZWNVbml0KSB7XFxuICAgICAgICAgICAgICAgIHNlY3Rpb24gPSAoc2VjdGlvbiArIG51bWJlcikgKiB1bml0O1xcbiAgICAgICAgICAgICAgICBydG4gKz0gc2VjdGlvbjtcXG4gICAgICAgICAgICAgICAgc2VjdGlvbiA9IDA7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgc2VjdGlvbiArPSAobnVtYmVyICogdW5pdCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIG51bWJlciA9IDA7XFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgcmV0dXJuIHJ0biArIHNlY3Rpb247XFxufVxcblxcbmZ1bmN0aW9uIG5hbWVDb21wYXJlKGEsIGIpIHtcXG4gICAgaWYgKGEgPT0gbnVsbCB8fCBiID09IG51bGwpXFxuICAgICAgICByZXR1cm4gYSA9PSBudWxsID8gYiA9PSBudWxsID8gMCA6IC0xIDogMTtcXG5cXG4gICAgYSA9IGEucmVwbGFjZSgvKFvpm7bkuIDkuozkuInlm5vkupTlha3kuIPlhavkuZ3ljYHnmb7ljYPkuIfkur9dKS9nLCBmdW5jdGlvbihtYXRjaCwgcDEsIHAyLCBwMywgb2Zmc2V0LCBzdHJpbmcpIHtcXG4gICAgICAgIC8vIHAxIGlzIG5vbmRpZ2l0cywgcDIgZGlnaXRzLCBhbmQgcDMgbm9uLWFscGhhbnVtZXJpY3NcXG4gICAgICAgIH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4gICAgICAgIH0gZWxzZSBpZiAoZmlsZXMuc3RhdHVzID09PSAyKSB7XFxuXFxuICAgICAgICAgICAgaWYgKCFwYXNzd29yZCkge1xcbiAgICAgICAgICAgICAgICBsZXQgbWFwS2V5ID0gaG9zdCArIHBhdGg7XFxuICAgICAgICAgICAgICAgIHBhc3N3b3JkID0gcGFzc3dvcmRNYXAuZ2V0KG1hcEtleSwgZmlnKyspIHx8IGNvbmZpZ3MucGFzRGljLmdldChtYXBLZXksIGZpZysrKTtcXG4gICAgICAgICAgICAgICAgaWYgKHBhc3N3b3JkICE9PSB2b2lkIDApIHtcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVzID0gYXBpLmdldEZpbGVzKGhvc3QsIHBhdGgsIHBhc3N3b3JkKTtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpID09PSAwKSB7XFxuICAgICAgICAgICAgICAgIHRvYXN0KFxcXCLlr4bnoIHplJnor69cXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdXBkYXRlSXRlbShjb25maWdzLnVpZCArIFxcXCIjZmlsZUxvYWRlZFxcXCIsIHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLor7fovpPlhaXlr4bnoIFcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIlxcXCIpLmlucHV0KChwYXRoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9sb2FkXFxcIikubG9hZChwYXRoLCBpbnB1dCwgdHJ1ZSk7XFxuICAgICAgICAgICAgICAgIH0sIHBhdGgpXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICByZXR1cm47XFxuICAgICAgICB9XFxuICAgICAgICBicmVhaztcXG4gICAgfVxcbiAgICBpZiAocGFzc3dvcmQpIHtcXG4gICAgICAgIGlmICg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4gICAgICAgICAgICAgICAgICAgIGNsczogY29uZmlncy51aWQgKyBcXFwiLmZpbGVcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgbGV0IHR5cGUgPSBnZXRFeHRlbnNpb24oZmlsZS5uYW1lKTtcXG4gICAgICAgICAgICBmaWxlTGlzdC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGZpbGUubmFtZSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlVHlwZSxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogZ2V0SWNvbih0eXBlLCBmaWxlLnR5cGUpLFxcbiAgICAgICAgICAgICAgICB1cmw6IChjbGlja3VybCA9ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoY2xpY2tGaWxlLCBob3N0LCB0cGF0aCwgcGFzc3dvcmQsIGZpbGUubmFtZSwgdHlwZSkpLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBjb25maWdzLnVpZCArIFxcXCIuZmlsZVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBpZDogaG9zdCArIHRwYXRoXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChzdHlsZVR5cGUgPT09IFxcXCJhdmF0YXJcXFwiICYmIGNvbmZpZ3Muc2V0dGluZ3MuaGFzRGVzYykge1xcbiAgICAgICAgICAgIGxldCBzaXplID0gZmlsZS5zaXplIHx8IE51bWJlcihmaWxlLnNpemVfc3RyKSB8fCAwO1xcblxcbiAgICAgICAgICAgIGxldCBkYXRlID0gZ2V0VGltZShmaWxlKTtcXG4gICAgICAgICAgICBpZiAoZmlsZS50eXBlID09PSAxKSB7XFxuICAgICAgICAgICAgICAgIGRpckxpc3QucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnTxzbWFsbD48Zm9udCBjb2xvcj0nZ3JheSc+XFxcIiArIGRhdGUgKyBcXFwiIFxcXCIgKyBnZXRGaWxlU2l6ZShzaXplKSArIFxcXCI8L2ZvbnQ+PC9zbWFsbD5cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKGNsaWNrRGlyLCB0cGF0aCwgaG9zdCksXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogY29uZmlncy51aWQgKyBcXFwiLmZpbGVcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGZpbGVMaXN0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ08c21hbGw+PGZvbnQgY29sb3I9J2dyYXknPlxcXCIgKyBkYXRlICsgXFxcIiBcXFwiICsgZ2V0RmlsZVNpemUoc2l6ZSkgKyBcXFwiPC9mb250Pjwvc21hbGw+XFxcIixcXG4gICAgICAgICAgICAgICAgICAgIHVybDogY2xpY2t1cmwsXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogY29uZmlncy51aWQgKyBcXFwiLmZpbGVcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBob3N0ICsgdHBhdGhcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB9KTtcXG4gICAgaWYgKE51bWJlcihnZXRNeVZhcihcXFwiY291bnRcXFwiLCBcXFwiMFxcXCIpKSAhPT0gY291bnQpIHtcXG4gICAgICAgIHJldHVybjtcXG4gICAgfVxcbiAgICBkZWxldGVJdGVtQnlDbHMoY29uZmlncy51aWQgKyBcXFwiLmZpbGVcXFwiKTtcXG4gICAgLy9kZWxldGVJdGVtKGNvbmZpZ3MudWlkICsgXFxcIiNmaWxlTG9hZGVkXFxcIik7XFxuICAgIGlmIChmaWxlcy51cGxvYWQpIHtcXG4gICAgICAgIGFkZEl0ZW1CZWZvcmUoY29uZmlncy51aWQgKyBcXFwiI2RpclxcXCIsIHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuKYgeS4iuS8oOaWh+S7tlxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICB1cmw6IGhvc3QgKyBwYXRoLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGNsczogY29uZmlncy51aWQgKyBcXFwiLmZpbGVcXFwiLFxcbiAgICAgICAgICAgICAgICAvL2xpbmVWaXNpYmxlOmZhbHNlXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuICAgIH1cXG4gICAgbGV0IGZhID0gZGlyTGlzdC5sZW5ndGggPiAwO1xcbiAgICBsZXQgZmIgPSBmaWxlTGlzdC5sZW5ndGggPiAwO1xcbiAgICBpZiAoZmEgJiYgZmIpIHtcXG4gICAgICAgIGFkZEl0ZW1BZnRlcihjb25maWdzLnVpZCArIFxcXCIjZGlyXFxcIiwge1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZV9ibGFua1xcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgY2xzOiBjb25maWdzLnVpZCArIFxcXCIuZmlsZV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QgY2xpY2t1cmw7XFxuICAgICAgICBpZiAoZmlsZS50eXBlID09PSAxKSB7XFxuICAgICAgICAgICAgZGlyTGlzdC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGZpbGUubmFtZSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlVHlwZSxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogZ2V0SWNvbigxKSxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKGNsaWNrU2VhcmNoRGlyLCB0cGF0aCksXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBjbHM6IGNvbmZpZ3MudWlkICsgXFxcIi5zZmlsZVxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgdHlwZSA9IGdldEV4dGVuc2lvbihmaWxlLm5hbWUpO1xcbiAgICAgICAgICAgIGZpbGVMaXN0LnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogZmlsZS5uYW1lLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGVUeXBlLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBnZXRJY29uKHR5cGUsIGZpbGUudHlwZSksXFxuICAgICAgICAgICAgICAgIHVybDogKGNsaWNrdXJsID0gJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZShjbGlja0ZpbGUsIGhvc3QsIHRwYXRoLCB1bmRlZmluZWQsIGZpbGUubmFtZSwgdHlwZSkpLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBjb25maWdzLnVpZCArIFxcXCIuc2ZpbGVcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGhvc3QgKyB0cGF0aFxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICB9XFxuICAgICAgICBpZiAoc3R5bGVUeXBlID09PSBcXFwiYXZhdGFyXFxcIiAmJiBjb25maWdzLnNldHRpbmdzLmhhc0Rlc2MpIHtcXG4gICAgICAgICAgICBsZXQgc2l6ZSA9IGZpbGUuc2l6ZSB8fCBOdW1iZXIoZmlsZS5zaXplX3N0cikgfHwgMDtcXG4gICAgICAgICAgICBsZXQgZGF0ZSA9IGdldFRpbWUoZmlsZSk7XFxuICAgICAgICAgICAgaWYgKGZpbGUudHlwZSA9PT0gMSkge1xcbiAgICAgICAgICAgICAgICBkaXJMaXN0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ08c21hbGw+PGZvbnQgY29sb3I9J2dyYXknPlxcXCIgKyBkYXRlICsgXFxcIiBcXFwiICsgZ2V0RmlsZVNpemUoc2l6ZSkgKyBcXFwiPC9mb250Pjwvc21hbGw+XFxcIixcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZShjbGlja0RpciwgdHBhdGgpLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGNvbmZpZ3MudWlkICsgXFxcIi5zZmlsZVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgZmlsZUxpc3QucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnTxzbWFsbD48Zm9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XRlSXRlbShjb25maWdzLnVpZCArIFxcXCIj6K6+572uX+etieW+hVxcXCIsIHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIui2heaXtuetieW+hTpcXFwiICsgaW5wdXRcXG4gICAgICAgIH0pO1xcbiAgICB9KSxcXG4gICAgZXh0cmE6IHtcXG4gICAgICAgIGlkOiBjb25maWdzLnVpZCArIFxcXCIj6K6+572uX+etieW+hVxcXCJcXG4gICAgfVxcbn0pO1xcblxcbmxheW91dC5wdXNoKHtcXG4gICAgdGl0bGU6IFxcXCLor6bnu4bliJfooag6XFxcIiArIGNvbmZpZ3Muc2V0dGluZ3MuaGFzRGVzYyxcXG4gICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzJcXFwiLFxcbiAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKCkgPT4ge1xcbiAgICAgICAgY29uc3QgY29uZmlncyA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2NvbmZpZ1xcXCIpO1xcbiAgICAgICAgbGV0IGhhc0Rlc2MgPSBmaW5kSXRlbShjb25maWdzLnVpZCArIFxcXCIj6K6+572uX+ivpue7hlxcXCIpLmV4dHJhLmhhc0Rlc2M7XFxuXFxuICAgICAgICBsZXQgc2V0dGluZ3MgPSBjb25maWdzLnNldHRpbmdzO1xcbiAgICAgICAgc2V0dGluZ3MuaGFzRGVzYyA9ICFoYXNEZXNjO1xcbiAgICAgICAgY29uZmlncy5zZXR0aW5ncyA9IHNldHRpbmdzO1xcbiAgICAgICAgdXBkYXRlSXRlbShjb25maWdzLnVpZCArIFxcXCIj6K6+572uX+ivpue7hlxcXCIsIHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuivpue7huWIl+ihqDpcXFwiICsgc2V0dGluZ3MuaGFzRGVzYyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogY29uZmlncy51aWQgKyBcXFwiI+iuvue9rl/or6bnu4Zc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XRlbShpZCkuZXh0cmEuaXRlbS5ob3N0O1xcbiAgICAgICAgICAgIGxldCBpbmRleCA9IHN1Ykxpc3QuZmluZEluZGV4KHRJdGVtID0+IHRJdGVtLmhvc3QgPT09IGhvc3QpO1xcbiAgICAgICAgICAgIGxldCBpdGVtID0gc3ViTGlzdFtpbmRleF07XFxuICAgICAgICAgICAgc3dpdGNoIChpbnB1dCkge1xcbiAgICAgICAgICAgICAgICBjYXNlIFxcXCLnva7pobZcXFwiOlxcbiAgICAgICAgICAgICAgICAgICAgaWYoaW5kZXg9PT0wKSBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgIHN1Ykxpc3Quc3BsaWNlKGluZGV4LCAxKTtcXG4gICAgICAgICAgICAgICAgICAgIHN1Ykxpc3Quc3BsaWNlKDAsIDAsIGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbShpZCk7XFxuICAgICAgICAgICAgICAgICAgICBhZGRJdGVtQmVmb3JlKGNvbmZpZ3MudWlkICtcXFwiI1xcXCIrIHN1Ykxpc3RbMV0uaG9zdCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IGl0ZW0uaG9zdCxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQoW1xcXCLnva7pobZcXFwiLCBcXFwi5Yig6ZmkXFxcIiwgXFxcIue8lui+kVxcXCJdLCAxKS5zZWxlY3QoYyxpZCksXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6e1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogaWQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vaG9zdDogaXRlbS5ob3N0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW06aXRlbVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgY29uZmlncy5zdWJMaXN0ID0gc3ViTGlzdDtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJpc0JhY2tSZWZyZXNoXFxcIiwgXFxcInRydWVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgICAgICAgICAgY2FzZSBcXFwi5Yig6ZmkXFxcIjpcXG4gICAgICAgICAgICAgICAgICAgIHN1Ykxpc3Quc3BsaWNlKGluZGV4LCAxKTtcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0oaWQpO1xcbiAgICAgICAgICAgICAgICAgICAgY29uZmlncy5zdWJMaXN0ID0gc3ViTGlzdDtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJpc0JhY2tSZWZyZXNoXFxcIiwgXFxcInRydWVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcihcXFwic3ViSG9zdFxcXCIpID09PSBpdGVtLmhvc3QpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJzdWJIb3N0XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwicGF0aENhY2hlXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwicGF0aENhY2hlMlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xcbiAgICAgICAgICAgICAgICBjYXNlIFxcXCLnvJbovpFcXFwiOlxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvbmV3QW5kTW9kaWZ5LnZcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgXFxuICAgICAgIC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gICAgICBqc29uID0gSlNPTi5wYXJzZShqc29uKTtcXG4gICAgICAgICAgICBqc29uLmZvckVhY2goaXRlbSA9PiB7XFxuICAgICAgICAgICAgICAgIGlmKCEoaXRlbS5uYW1lJiZpdGVtLmhvc3QpKSByZXR1cm4gZmkrKztcXG4gICAgICAgICAgICAgICAgaWYgKHN1Ykxpc3Quc29tZShpdCA9PiBpdC5ob3N0ID09PSBpdGVtLmhvc3QpKSByZXR1cm4gZmkrKztcXG4gICAgICAgICAgICAgICAgaXRlbS5ob3N0PWl0ZW0uaG9zdC5yZXBsYWNlKC9cXFxcLyQvLFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgc3ViTGlzdC5wdXNoKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICBzaSsrO1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGNvbmZpZ3Muc3ViTGlzdD1zdWJMaXN0O1xcbiAgICAgICAgICAgIGlmKHNpPjApe1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaXNCYWNrUmVmcmVzaFxcXCIsIFxcXCJ0cnVlXFxcIik7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHRvYXN0KFxcXCLmiJDlip/lr7zlhaU6XFxcIitzaStcXFwi5p2hO1xcXCIrZmkrXFxcIuadoeWvvOWFpeWksei0pVxcXCIpO1xcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIHRvYXN0KFxcXCLlr7zlhaXlpLHotKU6XFxcIitlLnRvU3RyaW5nKCkpO1xcbiAgICAgICAgfVxcblxcbiAgICB9KVxcbn0pO1xcbmxheW91dC5wdXNoKHtcXG4gICAgdGl0bGU6IFxcXCLliIbkuqtcXFwiLFxcbiAgICBjb2xfdHlwZTogXFxcInRleHRfMlxcXCIsXFxuICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoKSA9PiB7XFxuICAgICAgICBjb25zdCBjb25maWdzID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gIGNvbmZpZ3MucGFzRGljID0gcGFzRGljO1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIlxcXCIsIFxcXCLovpPlhaXmlrDnmoTlr4bnoIFcXFwiKS5pbnB1dCgoa2V5KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBpbnB1dCA9IGlucHV0LnRyaW0oKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmICghaW5wdXQpIHJldHVybiBcXFwidG9hc3Q6Ly/kuI3mlK/mjIHnqbpcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgY29uZmlncyA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2NvbmZpZ1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHBhc0RpYyA9IGNvbmZpZ3MucGFzRGljO1xcbiAgICAgICAgICAgICAgICAgICAgcGFzRGljLnNldChrZXksIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgIGNvbmZpZ3MucGFzRGljID0gcGFzRGljO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICB9LCBrZXkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIGtleSlcXG4gICAgfSk7XFxufSk7XFxuc2V0UmVzdWx0KGxheW91dCk7XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCJ2LuaWsOWini/nvJbovpHorqLpmIVcIixcInBhdGhcIjpcIm5ld0FuZE1vZGlmeS52XCIsXCJydWxlXCI6XCJqczpcXG5jb25zdCBjb25maWdzID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvY29uZmlnXFxcIik7XFxubGV0IGxheW91dCA9IFtdO1xcbmxldCBsaXN0ZW4gPSAkLnRvU3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AgIHRpdGxlOiBzdHIsXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdsb25nX3RleHQnLFxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vZW1wdHknXFxuICAgICAgICB9XSk7XFxuICAgIH0sIGZpbGUudXJsLCBmaWxlLm5hbWUpO1xcbn1cXG5cXG5mdW5jdGlvbiBwX21hcmtkb3duKGZpbGUpIHtcXG4gICAgcmV0dXJuICQoXFxcImhpa2VyOi8vZW1wdHkjbm9SZWNvcmRIaXN0b3J5IyNub0hpc3RvcnkjXFxcIikucnVsZSgodXJsLCBuYW1lKSA9PiB7XFxuICAgICAgICBjb25zdCBjb25maWdzID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvY29uZmlnXFxcIik7XFxuICAgICAgICBzZXRQYWdlVGl0bGUoXFxcIumihOiniE1EOlxcXCIgKyBuYW1lKVxcbiAgICAgICAgbGV0IGh0bWw7XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIGh0bWwgPSByZXF1ZXN0KHVybCwge1xcbiAgICAgICAgICAgICAgICB0aW1lb3V0OiBjb25maWdzLnNldHRpbmdzLnRpbWVvdXRcXG4gICAgICAgICAgICB9KSB8fCBcXFwiXFxcIjtcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBodG1sID0gJ+mihOiniOWksei0pTonICsgZS5tZXNzYWdlXFxuICAgICAgICB9XFxuICAgICAgICByZXF1aXJlKCdodHRwOi8vaGlrZXIubm9raWEucHJlc3MvaGlrZXJ1bGUvcnVsZWxpc3QuanNvbj9pZD0zMTg3Jyk7XFxuICAgICAgICBzZXRSZXN1bHQoW3tcXG4gICAgICAgICAgICB0aXRsZTogbWFya2VkLnBhcnNlKGh0bWwpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAncmljaF90ZXh0JyxcXG4gICAgICAgICAgICB1cmw6ICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgfV0pO1xcbiAgICB9LCB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7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBcXFwid2ViOi8vXFxcIiArIGhvc3QgKyBwYXRoO1xcbiAgICB9XFxufVwifV0iLCJpY29uIjoiaHR0cHM6Ly9jZG4uanNkZWxpdnIubmV0L2doL2FsaXN0LW9yZy9sb2dvQG1haW4vY2FuX2NpcmNsZS5zdmciLCJwcm94eSI6IiJ9
Add Comment
Please, Sign In to add comment