xiaomianao666

邀您一起看:你还没有书哦~~点我进入设置

Sep 8th, 2024
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥你还没有书哦~~点我进入设置@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcInRleHRfMVwiLFwibmFtZVwiOlwi5rqQ55uu5b2VXCIsXCJwYXRoXCI6XCJzb3VyY2VcIixcInJ1bGVcIjpcImpzOlxcbnZhciBkID0gW107XFxudmFyIG0gPSBNWV9QQVJBTVMucnVsZXNcXG52YXIgYmFzZXVybCA9IG0uYm9va1NvdXJjZVVybFxcbmlmIChtLnJ1bGVFeHBsb3JlLmJvb2tMaXN0KSB7XFxuICAgIHZhciBydWxlID0gbS5ydWxlRXhwbG9yZVxcbn0gZWxzZSB7XFxuICAgIHZhciBydWxlID0gbS5ydWxlU2VhcmNoXFxufVxcbmQucHVzaCh7XFxuICAgIHRpdGxlOiBcXFwi5pCc57SiXFxcIixcXG4gICAgZGVzYzogXFxcIuivt+i+k+WFpeaQnOe0ouWFs+mUruivjVxcXCIsXFxuICAgIHVybDogJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICBwdXRNeVZhcihcXFwia3dcXFwiLCBpbnB1dCk7XFxuICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcG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cInRleHRfMVxcXCIpLFxcbiAgICAgICAgICAgICAgICB0aXRsZTogcGRmaDEoaXRlbSwgbmFtZSksXFxuICAgICAgICAgICAgICAgIGltZzogKGNvdmVyID8gcGQxKGl0ZW0sIGNvdmVyKSArIFxcXCJAUmVmZXJlcj1cXFwiIDogXFxcImhpa2VyOi8vZW1wdHlcXFwiKSxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL21lbnVcXFwiLFxcbiAgICAgICAgICAgICAgICBkZXNjOiAoYXV0aG9yID8gcGRmaDEoaXRlbSwgYXV0aG9yKSA6IFxcXCJcXFwiKSArIFxcXCJcXFxcblxcXCIgKyAoaW50cm8gPyBwZGZoMShpdGVtLCBpbnRybykgOiBcXFwiXFxcIiksXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiYm9va05hbWVcXFwiOiBwZGZoMShpdGVtLCBuYW1lKSxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJjb3ZlclxcXCI6IChjb3ZlciA/IHBkMShpdGVtLCBjb3ZlcikgKyBcXFwiQFJlZmVyZXI9XFxcIiA6IFxcXCJoaWtlcjovL2VtcHR5XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICBcXFwiVG9jXFxcIjogTVlfUEFSQU1TLmFsbC5ydWxlVG9jLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcImNvbnRlbnRcXFwiOiBNWV9QQVJBTVMuYWxsLnJ1bGVDb250ZW50LFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBuZXh0dG9jID8gXFxcImhpa2VyOi8vZW1wdHkjXFxcIiArIHUxIDogdTEsXFxuICAgICAgICAgICAgICAgICAgICB1MTogbmV4dHRvYyA/IHUxIDogbnVsbCxcXG4gICAgICAgICAgICAgICAgICAgIGNoYXJzZXQ6IG0uY2hhcnNldCxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9KVxcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuWIl+ihqOWKoOi9veWksei0pe+8mlxcXCIgKyBsaXN0cnVsZSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICB9KVxcbiAgICB9XFxufSBjYXRjaCAoZSkge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6IFxcXCLliqDovb3lpLHotKXvvJpcXFwiICsgZS5tZXNzYWdlLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgIH0pXFxufVxcbnNldFJlc3VsdChkKTtcIn0se1wiY29sX3R5cGVcIjpcInRleHRfY2VudGVyXzFcIixcIm5hbWVcIjpcIuiuvue9rlwiLFwicGF0aFwiOlwiY29uZmlnXCIsXCJydWxlXCI6XCJqczpcXG52YXIgZCA9IFtdO1xcbnRyeSB7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogXFxcIua3u+WKoOiuoumYhVxcXCIsXFxuICAgICAgICB1cmw6ICQoXFxcIlxcXCIsIFxcXCLor7fovpPlhaXorqLpmIXlkI3np7DvvIzlj5bkuKrlkI3lkKfvvIjms6jmhI/kuI3opoHloavlnLDlnYDvvIlcXFwiKS5pbnB1dCgoKSA9PiB7XFxuICAgICAgICAgICAgaWYgKGlucHV0ID09IG51bGwgfHwgaW5wdXQgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S4jeWhq+aAjuS5iOiDveihjOWRolxcXCJcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGlucHV0LmluY2x1ZGVzKFxcXCI6Ly9cXFwiKSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5LiN6IO95aGr5Zyw5Z2A5ZOm77yM5YK75a6d6LSdXFxcIlxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gJChcXFwiXFxcIiwgXFxcIuivt+i+k+WFpeiuoumYheWcsOWdgFxcXCIpLmlucHV0KChuYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCB7XFxuICAgICAgICAgICAgICAgICAgICBhZGQsXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVcXG4gICAgICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcIik7XFxuICAgICAgICAgICAgICAgIGFkZChuYW1lLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGUobmFtZSwgaW5wdXQpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lr7zlhaXmiJDlip9cXFwiXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lr7zlhaXlpLHotKVcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCBpbnB1dClcXG4gICAgICAgIH0pLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzJcXFwiXFxuICAgIH0pXFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogXFxcIua3u+WKoOacrOWcsFxcXCIsXFxuICAgICAgICB1cmw6ICQoXFxcIlxcXCIsIFxcXCLor7fovpPlhaXorqLpm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CIgKyBmbmFtZTtcXG4gICAgICAgICAgICAgICAgbGV0IGMgPSBmZXRjaChcXFwiZmlsZTovL1xcXCIgKyBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIGlmICghYy5pbmNsdWRlcyhcXFwiYm9va1NvdXJjZVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5qC85byP5LiN5a+577yM5LuF5pSv5oyB5Lmm5rqQ5paH5Lu2XFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHdyaXRlRmlsZSh1cmwsIGMpO1xcbiAgICAgICAgICAgICAgICBsZXQge1xcbiAgICAgICAgICAgICAgICAgICAgYWRkLFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlXFxuICAgICAgICAgICAgICAgIH0gPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXCIpO1xcbiAgICAgICAgICAgICAgICBhZGQobmFtZSwgdXJsKTtcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZShuYW1lLCB1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lr7zlhaXmiJDlip9cXFwiXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lr7zlhaXlpLHotKVcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCBpbnB1dCk7XFxuICAgICAgICB9KSxcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIlxcbiAgICB9KVxcbiAgICBsZXQgbGlzdCA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcIikubG9hZCgpO1xcbiAgICBsaXN0LmZvckVhY2goKGl0ZW0sIGkpID0+IHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICBkZXNjOiBpdGVtLnVybCxcXG4gICAgICAgICAgICB1cmw6ICQoW1xcXCLliKDpmaTorqLpmIVcXFwiLCBcXFwi57yW6L6R5ZCN56ewXFxcIiwgXFxcIuWIhuS6q+iuoumYhVxcXCIsIFxcXCLmm7TmlrDmlbDmja5cXFwiXSkuc2VsZWN0KChuYW1lLCB1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0ID09IFxcXCLliKDpmaTorqLpmIVcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwi56Gu6K6k5Yig6Zmk77yfXFxcIikuY29uZmlybSgobmFtZSwgdXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5zdGFydHNXaXRoKFxcXCJoaWtlcjovL2ZpbGVzL1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZUZpbGUodXJsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlRmlsZShcXFwiaGlrZXI6Ly9maWxlcy95dWVkdS9cXFwiICsgbWQ1KG5hbWUpICsgXFxcIi5qc29uXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXCIpLnJlbW92ZSh1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3suWIoOmZpFxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0sIG5hbWUsIHVybClcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PSBcXFwi57yW6L6R5ZCN56ewXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIlxcXCIpLmlucHV0KChuYW1lLCB1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVGaWxlKFxcXCJoaWtlcjovL2ZpbGVzL3l1ZWR1L1xcXCIgKyBtZDUobmFtZSkgKyBcXFwiLmpzb25cXFwiKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlKGlucHV0LCB1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbmFtZSh1cmwsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0sIG5hbWUsIHVybClcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PSBcXFwi5YiG5Lqr6K6i6ZiFXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5zdGFydHNXaXRoKFxcXCJoaWtlcjovL2ZpbGVzL1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W9k+WJjeiuoumYheS4uuacrOWcsOaWh+S7tu+8jOaXoOazleWIhuS6q1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgobmFtZSwgdXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVcXG4gICAgICAgICAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2hhcmUobmFtZSwgdXJsKVxcbiAgICAgICAgICAgICAgICAgICAgfSwgbmFtZSwgdXJsKVxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVcXG4gICAgICAgICAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGUobmFtZSwgdXJsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5pu05paw5oiQ5YqfXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mm7TmlrDlpLHotKVcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCBpdGVtLm5hbWUsIGl0ZW0udXJsKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCJcXG4gICAgICAgIH0pXFxuICAgIH0pXFxufSBjYXRjaCAoZSkge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6IFxcXCLplJnor6/vvJpcXFwiICsgZS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ICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYy5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgIGlmIChjW2ldLnVybCA9PSBjaGUudXJsKSB7XFxuICAgICAgICAgICAgICAgIGNbaV0gPSBjaGU7XFxuICAgICAgICAgICAgICAgIGxvZyhcXFwiY2xlYXI6XFxcIiArIHVybClcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoXFxcImNoYXB0ZXIuanNvblxcXCIsIEpTT04uc3RyaW5naWZ5KGMpKVxcbiAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgfSwgdXJsKSlcXG4gICAgZm9yIChsZXQgaXQgb2YgY2FjaGVzKSB7XFxuICAgICAgICBpZiAoaXQudXJsID09IHVybCkge1xcbiAgICAgICAgICAgIHJldHVybiBpdDtcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICByZXR1cm4ge1xcbiAgICAgICAgdXJsOiB1cmwsXFxuICAgICAgICBuZXh0OiBcXFwiXFxcIixcXG4gICAgICAgIGNoYXB0ZXJzOiBbXVxcbiAgICB9XFxufVxcblxcbmZ1bmN0aW9uIHNhdmVDYWNoZShjaGUpIHtcXG4gICAgbGV0IGMgPSBjYWNoZXNcXG4gICAgaWYgKGMubGVuZ3RoID4gMTApIHtcXG4gICAgICAgIGMuc2hpZnQoKVxcbiAgICB9XFxuICAgIGxldCBleGlzdCA9IGZhbHNlXFxuICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYy5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgaWYgKGNbaV0udXJsID09IGNoZS51cmwpIHtcXG4gICAgICAgICAgICBjW2ldID0gY2hlO1xcbiAgICAgICAgICAgIGV4aXN0ID0gdHJ1ZTtcXG4gICAgICAgICAgICBicmVha1xcbiAgICAgICAgfVxcbiAgICB9XFxuICAgIGlmICghZXhpc3QpIHtcXG4gICAgICAgIGMucHVzaChjaGUpXFxuICAgIH1cXG4gICAgc2F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yhcXFwiY2xlYXI6IFxcXCIgKyBhaWQpO1xcbiAgICAgICAgY2xlYXJNeVZhcihhaWQpO1xcbiAgICB9LCBhaWQpKTtcXG4gICAgbGV0IGFyciA9IGNhY2hlLmNoYXB0ZXJzIHx8IFtdO1xcbiAgICB2YXIgY2MgPSAoYSkgPT4ge1xcbiAgICAgICAgcmV0dXJuIGEubWFwKGl0ZW0gPT4ge1xcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IGdldFRleHQoaXRlbSwgVG9jLmNoYXB0ZXJOYW1lKVxcbiAgICAgICAgICAgIGlmICh0aXRsZSAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICBsZXQgdTEgPSBnZXRVcmwwKGl0ZW0sIFRvYy5jaGFwdGVyTGlzdCwgVG9jLmNoYXB0ZXJVcmwpICsgXFxcIiNhdXRvUGFnZSMjcmVhZFRoZW1lI1xcXCI7XFxuICAgICAgICAgICAgICAgIGlmIChNWV9QQVJBTVMuY2hhcnNldCkge1xcbiAgICAgICAgICAgICAgICAgICAgdTEgPSB1MSArIFxcXCI7Z2V0O1xcXCIgKyBNWV9QQVJBTVMuY2hhcnNldDtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL2NvbnRlbnRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogTVlfUEFSQU1TLmNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB1MVxcbiAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8xXFxcIlxcbi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AgfVxcbiAgICB2YXIgdXJscyA9IFtudXJsXTtcXG4gICAgd2hpbGUgKHRydWUpIHtcXG4gICAgICAgIGxldCBhID0gW107XFxuICAgICAgICBmb3IgKGxldCBpdCBvZiBhcnIpIHtcXG4gICAgICAgICAgICBhLnB1c2goaXQpO1xcbiAgICAgICAgfVxcbiAgICAgICAgY2FjaGUuY2hhcHRlcnMgPSBhO1xcbiAgICAgICAgbGV0IGFycjEgPSBnZXRBcnJheShyZXMsIFRvYy5jaGFwdGVyTGlzdCk7XFxuICAgICAgICAvL2xvZyhhcnIxKTtcXG4gICAgICAgIGlmIChhcnIxICYmIGFycjEubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgIGZvciAobGV0IGl0IG9mIGFycjEpIHtcXG4gICAgICAgICAgICAgICAgYXJyLnB1c2goaXQpXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgYWRkSXRlbUJlZm9yZShpZCwgY2MoYXJyMSkpO1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBpZiAoZ2V0TXlWYXIoYWlkLCBcXFwiMFxcXCIpICE9IFxcXCIxXFxcIikge1xcbiAgICAgICAgICAgICAgICBsb2coXFxcImJyZWFrOiBcXFwiICsgYWlkKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGphdmEubGFuZy5UaHJlYWQuc2xlZXAoNTApO1xcbiAgICAgICAgICAgIGxldCBudXJsMiA9IHBkKHJlcywgXFxcImJvZHkmJlxcXCIgKyBuZXh0KTtcXG4gICAgICAgICAgICBpZiAobnVybDIgJiYgbnVybDIgIT0gXFxcIlxcXCIgJiYgIXVybHMuaW5jbHVkZXMobnVybDIpKSB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnNbXFxcIlJlZmVyZXJcXFwiXSA9IGNhY2hlLm5leHQuc3BsaXQoXFxcIiNcXFwiKVswXTtcXG4gICAgICAgICAgICAgICAgdXJscy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FwiICsgTVlfUEFSQU1TLmNoYXJzZXQ7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL2NvbnRlbnRcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgY29udGVudDogTVlfUEFSQU1TLmNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHUxXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcbiAgICB9KTtcXG5cXG4gICAgdmFyIGNwID0gZC5tYXAoZnVuY3Rpb24oaXRlbSkge1xcbiAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICBcXFwidGl0bGVcXFwiOiBpdGVtLnRpdGxlLFxcbiAgICAgICAgICAgIFxcXCJ1cmxcXFwiOiBpdGVtLmV4dHJhLnVybC5yZXBsYWNlKFxcXCIjYXV0b1BhZ2UjI3JlYWRUaGVtZSNcXFwiLCBcXFwiXFxcIilcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGlmIChsaXN0Lmxlbmd0aCA+IDApIHtcXG4gICAgICAgIGQudW5zaGlmdCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLkuIvovb1cXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9kb3dubG9hZC52aWV3I25vUmVjb3JkSGlzdG9yeSMjbm9SZWZyZXNoIyNub0hpc3RvcnkjP3J1bGU95pys5Zyw6LWE5rqQ566h55CGXFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGNoYXB0ZXJMaXN0OiBjcCxcXG4gICAgICAgICAgICAgICAgZGVmYXVsdFZpZXc6IFxcXCIxXFxcIixcXG4gICAgICAgICAgICAgICAgaW5mbzoge1xcbiAgICAgICAgICAgICAgICAgICAgYm9va05hbWU6IE1ZX1BBUkFNUy5ib29rTmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIGJvb2tUb3BQaWM6IE1ZX1BBUkFNUy5jb3ZlcixcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVOYW1lOiBcXFwi5oKm6K+7XFxcIixcXG4gICAgICAgICAgICAgICAgICAgIHBhcnNlQ29kZTogJC50b1N0cmluZygoTVlfUEFSQU1TLCByMCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnZlcnRcXG4gICAgICAgICAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvY29udmVydGVyP3J1bGU9XFxcIiArIHIwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVzID0gcmVxdWVzdChpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJ1bGUgPSBNWV9QQVJBTVMuY29udGVudDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgciA9IGNvbnZlcnQocnVsZS5jb250ZW50KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcjEgPSByLnNwbGl0KFxcXCImJlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByMiA9IHIxLnNsaWNlKDAsIHIxLmxlbmd0aCAtIDEpLmpvaW4oXFxcIiYmXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGFyciA9IHBkZmEocmVzLCBcXFwiYm9keSYmXFxcIiArIHIyKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhhcnIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0dCA9IFxcXCJcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgYXJyKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ID0gaXQucmVwbGFjZShuZXcgUmVnRXhwKFxcXCJcXFxcblxcXCIsIFxcXCJnXFxcIiksIFxcXCItLWJyLS1cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coaXQpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHBkZmgoaXQsIFxcXCJUZXh0XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0LnJlcGxhY2UobmV3IFJlZ0V4cChcXFwiLS1ici0tXFxcIiwgXFxcImdcXFwiKSwgXFxcIjxicj5cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHQyID0gdC5zcGxpdChcXFwiPGJyPlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpdDIgb2YgdDIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdDIgPT0gXFxcIlxcXCIgfHwgaXQyLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWVcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaXQyLnN0YXJ0c1dpdGgoXFxcIuOAgFxcXCIpICYmICFpdDIuc3RhcnRzV2l0aChcXFwiJm5ic3A7Jm5ic3A7XFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdDIgPSBcXFwiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7XFxcIiArIGl0Mi50cmltKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocnVsZS5yZXBsYWNlUmVnZXgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdDIgPSBpdDIucmVwbGFjZShuZXcgUmVnRXhwKHJ1bGUucmVwbGFjZVJlZ2V4LnJlcGxhY2UoXFxcIiMjXFxcIiwgXFxcIlxcXCIpLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdDIgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHQgKz0gaXQyICsgXFxcIlxcXFxuXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0dFxcbiAgICAgICAgICAgICAgICAgICAgfSwgTVlfUEFSQU1TLCBNWV9SVUxFLnRpdGxlKSxcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IFxcXCJub3ZlbFxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgZC51bnNoaWZ0KHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuacquino+aekOWIsOebruW9leWIl+ihqFxcXC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ChcXFwiIVxcXCIpWzBdLnNwbGl0KFxcXCJ8fFxcXCIpO1xcbiAgICBsZXQgYyA9IGNvbnZlcnQocjFbMF0pO1xcbiAgICBpZiAoYy5pbmNsdWRlcyhcXFwiJiZsaSYmYVxcXCIpICYmIGNbYy5sZW5ndGggLSAxXSA9PSBcXFwiYVxcXCIpIHtcXG4gICAgICAgIGMgPSBjLnJlcGxhY2UoXFxcIiYmbGkmJmFcXFwiLCBcXFwiJiZsaVxcXCIpO1xcbiAgICB9XFxuICAgIGxvZyhjKTtcXG4gICAgbGV0IGFyciA9IHBkZmEoaHRtbCwgXFxcImJvZHkmJlxcXCIgKyBjKTtcXG4gICAgaWYgKHIxLmxlbmd0aCA+IDEpIHtcXG4gICAgICAgIGxldCByMiA9IHIxWzFdLnNwbGl0KFxcXCI6XFxcIik7XFxuICAgICAgICBsZXQgcjMgPSBbXTtcXG4gICAgICAgIGZvciAobGV0IGl0IG9mIHIyKSB7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgbGV0IGkgPSBwYXJzZUludChpdCk7XFxuICAgICAgICAgICAgICAgIGlmIChpc05hTihpKSkge1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcjMucHVzaChpKTtcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IGFycjIgPSBbXTtcXG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgaWYgKHIzLmluZGV4T2YoaSkgPCAwKSB7XFxuICAgICAgICAgICAgICAgIGFycjIucHVzaChhcnJbaV0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBhcnIyO1xcbiAgICB9XFxuICAgIGxvZyhcXFwi6I635Y+W5aSx6LSl77yM5aSx6LSl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XAoaXQgPT4ge1xcbiAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICBmdW5jOiBmdW5jdGlvbihydWxlKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBzZWFyY2gocnVsZSwgcywgMSk7XFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICBwYXJhbTogaXQsXFxuICAgICAgICAgICAgaWQ6IFxcXCJydWxlQFxcXCIgKyBpdC5uYW1lXFxuICAgICAgICB9XFxuICAgIH0pO1xcblxcbiAgICBiYXRjaEV4ZWN1dGUodGFza3MsIHtcXG4gICAgICAgIGZ1bmM6IGZ1bmN0aW9uKHBhcmFtLCBpZCwgZXJyb3IsIHJlc3VsdCkge1xcbiAgICAgICAgICAgIC8vbG9nKFxcXCJsaXN0ZW5lcjogXFxcIiArIChyZXN1bHQgfHwgW10pLmxlbmd0aClcXG4gICAgICAgICAgICBwYXJhbS5pID0gcGFyYW0uaSArIDE7XFxuICAgICAgICAgICAgaWYgKHJlc3VsdCkge1xcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgcmVzdWx0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW0uaiA9IHBhcmFtLmogKyAxO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXRjaE11c3QpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWFyY2hDb250YWlucyhpdC50aXRsZSwgcykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBleHRyYSA9IGl0LmV4dHJhIHx8IHt9O1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLmlkID0gXFxcIl9fYXBwXFxcIiArIE1ZX1BBR0UgKyBcXFwiQFxcXCIgKyBwYXJhbS5qO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLmJvb2tOYW1lID0gaXQudGl0bGVcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYS5jb3ZlciA9IGl0LnBpY191cmwgfHwgaXQuaW1nXFxuICAgICAgICAgICAgICAgICAgICAgICAgYWRkSXRlbUJlZm9yZShwYWdlaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0LnRpdGxlLmluY2x1ZGVzKFxcXCLigJzigJzigJ3igJ1cXFwiKSA/IGl0LnRpdGxlIDogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBpdC50aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAoXFxcIjxlbT58PC9lbT5cXFwiLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIikucmVwbGFjZShuZXcgUmVnRXhwKHMsIFxcXCJnXFxcIiksIFxcXCI8c3Ryb25nPjxzcGFuIHN0eWxlPVxcXFxcXFwiY29sb3I6ICMxRTkwRkZcXFxcXFxcIj5cXFwiICsgcyArIFxcXCI8L3NwYW4+PC9zdHJvbmc+XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IGl0LmRlc2MsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogaXQudXJsLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBpdC5waWNfdXJsIHx8IGl0LmltZyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IGl0LnBpY191cmwgfHwgaXQuaW1nID8gJ21vdmllXzFfdmVydGljYWxfcGljJyA6IFxcXCJ0ZXh0XzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYTogZXh0cmFcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcblxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAocGFyYW0uaSA+PSBwYXJhbS5hbGwpIHtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbShwYWdlaWQpXFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuWKoOi9veesrFxcXCIgKyBNWV9QQUdFICsgXFxcIumhteS4re+8jOi/m+W6pu+8mlxcXCIgKyAocGFyYW0uaSArIDEpICsgXFxcIi9cXFwiICsgcGFyYW0uYWxsLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBcXFwiXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHBhZ2VpZFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sXFxuICAgICAgICBwYXJhbToge1xcbiAgICAgICAgICAgIGFsbDogZGF0YS5sZW5ndGgsXFxuICAgICAgICAgICAgaTogMCxcXG4gICAgICAgICAgICBqOiAtMVxcbiAgICAgICAgfVxcbiAgICB9KTtcXG59XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLmkJzntKLovoXliqlcIixcInBhdGhcIjpcInNzXCIsXCJydWxlXCI6XCJ2YXIge1xcbiAgICBjb252ZXJ0LFxcbiAgICBwYXJzZVVybCxcXG4gICAgZ2V0Q2h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IHVybCksXFxuICAgICAgICAgICAgICAgIHVybDogbmV4dHRvYyA/IFxcXCJoaWtlcjovL2VtcHR5I1xcXCIgKyB1MSA6IHUxLFxcbiAgICAgICAgICAgICAgICB1MTogbmV4dHRvYyA/IHUxIDogbnVsbCxcXG4gICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgY2hhcnNldDogY1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgIH0pO1xcbiAgICByZXR1cm4gZDtcXG59XFxuJC5leHBvcnRzID0ge1xcbiAgICBjb252ZXJ0OiBjb252ZXJ0LFxcbiAgICBzZWFyY2g6IHNlYXJjaCxcXG4gICAgbGlzdFJ1bGVzOiAocGFnZSwgcnVsZSkgPT4ge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAvL+W5tuWPkeaVsOmHj1xcbiAgICAgICAgICAgIGxldCBzaXplID0gMTY7XFxuICAgICAgICAgICAgbGV0IHtcXG4gICAgICAgICAgICAgICAgbG9hZCxcXG4gICAgICAgICAgICAgICAgbG9hZFJ1bGVzLFxcbiAgICAgICAgICAgICAgICBnZXRTZWxlY3RcXG4gICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFwiKTtcXG4gICAgICAgICAgICBsZXQgZGF0YSA9IGxvYWQoKTtcXG4gICAgICAgICAgICBsZXQgc2VsZWN0ID0gZ2V0U2VsZWN0KGRhdGEpO1xcbiAgICAgICAgICAgIGxldCBydWxlcyA9IGRhdGEubGVuZ3RoID4gMCA/IGxvYWRSdWxlcyhzZWxlY3QubmFtZSkgOiBbXTtcXG4gICAgICAgICAgICBpZiAoIXBhZ2UgJiYgIXJ1bGUpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJ1bGVzLm1hcChpdCA9PiBpdC5uYW1lKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHJ1bGUgIT0gbnVsbCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gcnVsZXMuZmlsdGVyKGkgPT4gaS5uYW1lID09IHJ1bGUpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgc3RhcnQgPSAocGFnZSAtIDEpICogc2l6ZTtcXG4gICAgICAgICAgICBpZiAocnVsZXMubGVuZ3RoIDwgc3RhcnQgKyAxKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBbXTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGxlbiA9IHNpemU7XFxuICAgICAgICAgICAgaWYgKHJ1bGVzLmxlbmd0aCA8IHBhZ2UgKiBzaXplKSB7XFxuICAgICAgICAgICAgICAgIGxlbiA9IHJ1bGVzLmxlbmd0aCAtIHN0YXJ0XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBhbGwgPSBydWxlcy5sZW5ndGg7XFxuICAgICAgICAgICAgbGV0IHVzZSA9IChwYWdlIC0gMSkgKiBzaXplICsgbGVuO1xcbiAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgIGFsbDogYWxsLFxcbiAgICAgICAgICAgICAgICB1c2U6IHVzZSxcXG4gICAgICAgICAgICAgICAgZGF0YTogcnVsZXMuc2xpY2Uoc3RhcnQsIHN0YXJ0ICsgbGVuKVxcbiAgICAgICAgICAgIH07XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgYWxsOiAwLFxcbiAgICAgICAgICAgICAgICB1c2U6IDAsXFxuICAgICAgICAgICAgICAgIGRhdGE6IFtdXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB9XFxufVwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi5pWw5o2uXCIsXCJwYXRoXCI6XCJkYXRhdFwiLFwicnVsZVwiOlwibGV0IGxvYWQgP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AgICAgICAgIHJldHVybiAkKFxcXCJcXFwiLCBcXFwi6K+36L6T5YWl6K6i6ZiF5Zyw5Z2AXFxcIikuaW5wdXQoKG5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IHtcXG4gICAgICAgICAgICAgICAgICAgIGFkZCxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZVxcbiAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFwiKTtcXG4gICAgICAgICAgICAgICAgYWRkKG5hbWUsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZShuYW1lLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WvvOWFpeaIkOWKn1xcXCJcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WvvOWFpeWksei0pVxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0sIGlucHV0KVxcbiAgICAgICAgfSksXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMlxcXCJcXG4gICAgfSlcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBcXFwi5re75Yqg5pys5ZywXFxcIixcXG4gICAgICAgIHVybDogJChcXFwiXFxcIiwgXFxcIuivt+i+k+WFpeiuoumYheWQjeensO+8jOWPluS4quWQjeWQp++8iOi+k+WujOeCueWHu+ehruWumuWQjuS8mui3s+i9rOmAieaLqeS5pua6kOaWh+S7tueVjOmdou+8iVxcXCIpLmlucHV0KCgpID0+IHtcXG4gICAgICAgICAgICBpZiAoaW5wdXQgPT0gbnVsbCB8fCBpbnB1dCA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5LiN5aGr5oCO5LmI6IO96KGM5ZGiXFxcIlxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoaW5wdXQuaW5jbHVkZXMoXFxcIjovL1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/kuI3og73loavlnLDlnYDlk6bvvIzlgrvlrp3otJ1cXFwiXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBcXFwiZmlsZVNlbGVjdDovL1xcXCIgKyAkLnRvU3RyaW5nKChuYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBzID0gaW5wdXQuc3BsaXQoXFxcIi9cXFwiKVxcbiAgICAgICAgICAgICAgICBsZXQgZm5hbWUgPSBzW3MubGVuZ3RoIC0gMV0ucmVwbGFjZShcXFwiX2ZpbGVTZWxlY3RfXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICBpZiAoIWZuYW1lLmluY2x1ZGVzKFxcXCIuanNvblxcXCIpICYmICFmbmFtZS5pbmNsdWRlcyhcXFwiLnR4dFxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5qC85byP5LiN5a+577yM5LuF5pSv5oyBanNvbuaIlnR4dOagvOW8j+eahOS5pua6kOaWh+S7tlxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBsZXQgdXJsID0gXFxcImhpa2VyOi8vZmlsZXMveXVlZHUvXFxcIiArIGZuYW1lO1xcbiAgICAgICAgICAgICAgICBsZXQgYyA9IGZldGNoKFxcXCJmaWxlOi8vXFxcIiArIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgaWYgKCFjLmluY2x1ZGVzKFxcXCJib29rU291cmNlXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/moLzlvI/kuI3lr7nvvIzku4XmlK/mjIHkuabmupDmlofku7ZcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgd3JpdGVGaWxlKHVybCwgYyk7XFxuICAgICAgICAgICAgICAgIGxldCB7XFxuICAgICAgICAgICAgICAgICAgICBhZGQsXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVcXG4gICAgICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcIik7XFxuICAgICAgICAgICAgICAgIGFkZChuYW1lLCB1cmwpO1xcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlKG5hbWUsIHVybCk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WvvOWFpeaIkOWKn1xcXCJcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WvvOWFpeWksei0pVxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0sIGlucHV0KTtcXG4gICAgICAgIH0pLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzJcXFwiXFxuICAgIH0pXFxuICAgIGxldCBsaXN0ID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFwiKS5sb2FkKCk7XFxuICAgIGxpc3QuZm9yRWFjaCgoaXRlbSwgaSkgPT4ge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogaXRlbS5uYW1lLFxcbiAgICAgICAgICAgIGRlc2M6IGl0ZW0udXJsLFxcbiAgICAgICAgICAgIHVybDogJChbXFxcIuWIoOmZpOiuoumYhVxcXCIsIFxcXCLnvJbovpHlkI3np7BcXFwiLCBcXFwi5YiG5Lqr6K6i6ZiFXFxcIiwgXFxcIuabtOaWsOaVsOaNrlxcXCJdKS5zZWxlY3QoKG5hbWUsIHVybCkgPT4ge1xcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gXFxcIuWIoOmZpOiuoumYhVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXCLnoa7orqTliKDpmaTvvJ9cXFwiKS5jb25maXJtKChuYW1lLCB1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodXJsLnN0YXJ0c1dpdGgoXFxcImhpa2VyOi8vZmlsZXMvXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlRmlsZSh1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVGaWxlKFxcXCJoaWtlcjovL2ZpbGVzL3l1ZWR1L1xcXCIgKyBtZDUobmFtZSkgKyBcXFwiLmpzb25cXFwiKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcIikucmVtb3ZlKHVybCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5bey5Yig6ZmkXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSwgbmFtZSwgdXJsKVxcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09IFxcXCLnvJbovpHlkI3np7BcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwiXFxcIikuaW5wdXQoKG5hbWUsIHVybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZUZpbGUoXFxcImhpa2VyOi8vZmlsZXMveXVlZHUvXFxcIiArIG1kNShuYW1lKSArIFxcXCIuanNvblxcXCIpXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVuYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVcXG4gICAgICAgICAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGUoaW5wdXQsIHVybCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVuYW1lKHVybCwgaW5wdXQpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSwgbmFtZSwgdXJsKVxcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09IFxcXCLliIbkuqvorqLpmIVcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodXJsLnN0YXJ0c1dpdGgoXFxcImhpa2VyOi8vZmlsZXMvXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5b2T5YmN6K6i6ZiF5Li65pys5Zyw5paH5Lu277yM5peg5rOV5YiG5LqrXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChuYW1lLCB1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaGFyZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzaGFyZShuYW1lLCB1cmwpXFxuICAgICAgICAgICAgICAgICAgICB9LCBuYW1lLCB1cmwpXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZShuYW1lLCB1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mm7TmlrDmiJDlip9cXFwiXFxuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+abtOaWsOWksei0pVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0sIGl0ZW0ubmFtZSwgaXRlbS51cmwpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8xXFxcIlxcbiAgICAgICAgfSlcXG4gICAgfSlcXG59IGNhdGNoIChlKSB7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogXFxcIumUmeivr++8mlxcXCIgKyBlLm1lc3NhZ2UsXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgfSlcXG59XFxuc2V0UmVzdWx0KGQpO1wiLFwiZ3JvdXBcIjpcIumYheivu1wiLFwidWFcIjpcIm1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gICAgICBpZiAoaW5wdXQgPT0gbnVsbCB8fCBpbnB1dCA9PSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/kuI3loavmgI7kuYjog73ooYzlkaJcXFxcXFxcIlxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKGlucHV0LmluY2x1ZGVzKFxcXFxcXFwiOi8vXFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/kuI3og73loavlnLDlnYDlk6bvvIzlgrvlrp3otJ1cXFxcXFxcIlxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuICQoXFxcXFxcXCJcXFxcXFxcIiwgXFxcXFxcXCLor7fovpPlhaXorqLpmIXlnLDlnYBcXFxcXFxcIikuaW5wdXQoKG5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBsZXQge1xcXFxuICAgICAgICAgICAgICAgICAgICBhZGQsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZVxcXFxuICAgICAgICAgICAgICAgIH0gPSAkLnJlcXVpcmUoXFxcXFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgYWRkKG5hbWUsIGlucHV0KTtcXFxcbiAgICAgICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGUobmFtZSwgaW5wdXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WvvOWFpeaIkOWKn1xcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b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GlmIChpbnB1dCA9PSBcXFxcXFxcIuWIoOmZpOiuoumYhVxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXFxcXFwi56Gu6K6k5Yig6Zmk77yfXFxcXFxcXCIpLmNvbmZpcm0oKG5hbWUsIHVybCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5zdGFydHNXaXRoKFxcXFxcXFwiaGlrZXI6Ly9maWxlcy9cXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVGaWxlKHVybCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVGaWxlKFxcXFxcXFwiaGlrZXI6Ly9maWxlcy95dWVkdS9cXFxcXFxcIiArIG1kNShuYW1lKSArIFxcXFxcXFwiLmpzb25cXFxcXFxcIilcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICQucmVxdWlyZShcXFxcXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXFxcXFwiKS5yZW1vdmUodXJsKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+W3suWIoOmZpFxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIG5hbWUsIHVybClcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09IFxcXFxcXFwi57yW6L6R5ZCN56ewXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcXFxcXCJcXFxcXFxcIikuaW5wdXQoKG5hbWUsIHVybCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlRmlsZShcXFxcXFxcImhpa2VyOi8vZmlsZXMveXVlZHUvXFxcXFxcXCIgKyBtZDUobmFtZSkgKyBcXFxcXFxcIi5qc29uXFxcXFxcXCIpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gPSAkLnJlcXVpcmUoXFxcXFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGUoaW5wdXQsIHVybCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZW5hbWUodXJsLCBpbnB1dCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIG5hbWUsIHVybClcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09IFxcXFxcXFwi5YiG5Lqr6K6i6ZiFXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5zdGFydHNXaXRoKFxcXFxcXFwiaGlrZXI6Ly9maWxlcy9cXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5b2T5YmN6K6i6ZiF5Li65pys5Zyw5paH5Lu277yM5peg5rOV5YiG5LqrXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcXFxcXCIjbm9Mb2FkaW5nI1xcXFxcXFwiKS5sYXp5UnVsZSgobmFtZSwgdXJsKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXFxcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNoYXJlKG5hbWUsIHVybClcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgbmFtZSwgdXJsKVxcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFxcXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZShuYW1lLCB1cmwpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/mm7TmlrDmiJDlip9cXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+abtOaWsOWksei0pVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9LCBpdGVtLm5hbWUsIGl0ZW0udXJsKSxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfMVxcXFxcXFwiXFxcXG4gICAgICAgIH0pXFxcXG4gICAgfSlcXFxcbn0gY2F0Y2ggKGUpIHtcXFxcbiAgICBkLnB1c2goe1xcX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jaGFwdGVyLmpzb25cXFxcXFxcIikgfHwgXFxcXFxcXCJbXVxcXFxcXFwiO1xcXFxuICAgICAgICBjID0gSlNPTi5wYXJzZShjKVxcXFxuICAgICAgICBsZXQgY2hlID0ge1xcXFxuICAgICAgICAgICAgdXJsOiB1cmwsXFxcXG4gICAgICAgICAgICBuZXh0OiBcXFxcXFxcIlxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgY2hhcHRlcnM6IFtdXFxcXG4gICAgICAgIH07XFxcXG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYy5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgaWYgKGNbaV0udXJsID09IGNoZS51cmwpIHtcXFxcbiAgICAgICAgICAgICAgICBjW2ldID0gY2hlO1xcXFxuICAgICAgICAgICAgICAgIGxvZyhcXFxcXFxcImNsZWFyOlxcXFxcXFwiICsgdXJsKVxcXFxuICAgICAgICAgICAgICAgIHNhdmVGaWxlKFxcXFxcXFwiY2hhcHRlci5qc29uXFxcXFxcXCIsIEpTT04uc3RyaW5naWZ5KGMpKVxcXFxuICAgICAgICAgICAgICAgIGJyZWFrXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICB9LCB1cmwpKVxcXFxuICAgIGZvciAobGV0IGl0IG9mIGNhY2hlcykge1xcXFxuICAgICAgICBpZiAoaXQudXJsID09IHVybCkge1xcXFxuICAgICAgICAgICAgcmV0dXJuIGl0O1xcXFxuICAgICAgICB9XFxcXG4gICAgfVxcXFxuICAgIHJldHVybiB7XFxcXG4gICAgICAgIHVybDogdXJsLFxcXFxuICAgICAgICBuZXh0OiBcXFxcXFxcIlxcXFxcXFwiLFxcXFxuICAgICAgICBjaGFwdGVyczogW11cXFxcbiAgICB9XFxcXG59XFxcXG5cXFxcbmZ1bmN0aW9uIHNhdmVDYWNoZShjaGUpIHtcXFxcbiAgICBsZXQgYyA9IGNhY2hlc1xcXFxuICAgIGlmIChjLmxlbmd0aCA+ID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uY2hhcHRlclVybCkgKyBcXFxcXFxcIiNhdXRvUGFnZSMjcmVhZFRoZW1lI1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIGlmIChNWV9QQVJBTVMuY2hhcnNldCkge1xcXFxuICAgICAgICAgICAgICAgICAgICB1MSA9IHUxICsgXFxcXFxcXCI7Z2V0O1xcXFxcXFwiICsgTVlfUEFSQU1TLmNoYXJzZXQ7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFxcXFxcImhpa2VyOi8vcGFnZS9jb250ZW50XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBNWV9QQVJBTVMuY29udGVudCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogdTFcXFxcbiAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF8xXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICB9O1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KTtcXFxcbiAgICB9XFxcXG4gICAgLy9sb2coY2FjaGUubmV4dCArIFxcXFxcXFwiOlxcXFxcXFwiICsgY2FjaGUuY2hhcHRlcnMubGVuZ3RoKTtcXFxcbiAgICBsZXQgZDIgPSBjYyhhcnIpO1xcXFxuICAgIGQyLnB1c2goe1xcXFxuICAgICAgICB0aXRsZTogXFxcXFxcXCLliqDovb3kuK3vvIzor7fnqI3lgJkuLi5cXFxcXFxcIixcXFxcbiAgICAgICAgdXJsOiBcXFxcXFxcIlxcXFxcXFwiLFxcX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gICAgIH1cXFxcbiAgICAgICAgY2FjaGUuY2hhcHRlcnMgPSBhO1xcXFxuICAgICAgICBsZXQgYXJyMSA9IGdldEFycmF5KHJlcywgVG9jLmNoYXB0ZXJMaXN0KTtcXFxcbiAgICAgICAgLy9sb2coYXJyMSk7XFxcXG4gICAgICAgIGlmIChhcnIxICYmIGFycjEubGVuZ3RoID4gMCkge1xcXFxuICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgYXJyMSkge1xcXFxuICAgICAgICAgICAgICAgIGFyci5wdXNoKGl0KVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGFkZEl0ZW1CZWZvcmUoaWQsIGNjKGFycjEpKTtcXFxcbiAgICAgICAgdHJ5IHtcXFxcbiAgICAgICAgICAgIGlmIChnZXRNeVZhcihhaWQsIFxcXFxcXFwiMFxcXFxcXFwiKSAhPSBcXFxcXFxcIjFcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgIGxvZyhcXFxcXFxcImJyZWFrOiBcXFxcXFxcIiArIGFpZCk7XFxcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBqYXZhLmxhbmcuVGhyZWFkLnNsZWVwKDUwKTtcXFxcbiAgICAgICAgICAgIGxldCBudXJsMiA9IHBkKHJlcywgXFxcXFxcXCJib2R5JiZcXFxcXFxcIiArIG5leHQpO1xcXFxuICAgICAgICAgICAgaWYgKG51cmwyICYmIG51cmwyICE9IFxcXFxcXFwiXFxcXFxcXCIgJiYgIXVybHMuaW5jbHVkZXMobnVybDIpKSB7XFxcXG4gICAgICAgICAgICAgICAgaGVhZGVyc1tcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIl0gPSBjYWNoZS5uZXh0LnNwbGl0KFxcXFxcXFwiI1xcXFxcXFwiKVswXTtcXFxcbiAgICAgICAgICAgICAgICB1cmxzLnB1c2gobnVybDIpO1xcXFxuICAgICAgICAgICA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25sb2FkLnZpZXcjbm9SZWNvcmRIaXN0b3J5IyNub1JlZnJlc2gjI25vSGlzdG9yeSM/cnVsZT3mnKzlnLDotYTmupDnrqHnkIZcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgY2hhcHRlckxpc3Q6IGNwLFxcXFxuICAgICAgICAgICAgICAgIGRlZmF1bHRWaWV3OiBcXFxcXFxcIjFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBpbmZvOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGJvb2tOYW1lOiBNWV9QQVJBTVMuYm9va05hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgIGJvb2tUb3BQaWM6IE1ZX1BBUkFNUy5jb3ZlcixcXFxcbiAgICAgICAgICAgICAgICAgICAgcnVsZU5hbWU6IFxcXFxcXFwi5oKm6K+7XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgIHBhcnNlQ29kZTogJC50b1N0cmluZygoTVlfUEFSQU1TLCByMCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb252ZXJ0XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXFxcXFwiaGlrZXI6Ly9wYWdlL2NvbnZlcnRlcj9ydWxlPVxcXFxcXFwiICsgcjApO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IHJlcXVlc3QoaW5wdXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJ1bGUgPSBNWV9QQVJBTVMuY29udGVudDtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByID0gY29udmVydChydWxlLmNvbnRlbnQpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHIxID0gci5zcGxpdChcXFxcXFxcIiYmXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHIyID0gcjEuc2xpY2UoMCwgcjEubGVuZ3RoIC0gMSkuam9pbihcXFxcXFxcIiYmXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGFyciA9IHBkZmEocmVzLCBcXFxcXFxcImJvZHkmJlxcXFxcXFwiICsgcjIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coYXJyKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0dCA9IFxcXFxcXFwiXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGl0IG9mIGFycikge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ID0gaXQucmVwbGFjZShuZXcgUmVnRXhwKFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIsIFxcXFxcXFwiZ1xcXFxcXFwiKSwgXFxcXFxcXCItLWJyLS1cXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coaXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcGRmaChpdCwgXFxcXFxcXCJUZXh0XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0LnJlcGxhY2UobmV3IFJlZ0V4cChcXFxcXFxcIi0tYnItLVxcXFxcXFwiLCBcXFxcXFxcImdcXFxcXFxcIiksIFxcXFxcXFwiPGJyPlxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9PSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB0MiA9IHQuc3BsaXQoXFxcXFxcXCI8YnI+XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGl0MiBvZiB0Mikge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXQyID09IFxcXFxcXFwiXFxcXFxcXCIgfHwgaXQyLmxlbmd0aCA9PSAxKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaXQyLnN0YXJ0c1dpdGgoXFxcXFxcXCLjgIBcXFxcXFxcIikgJiYgIWl0Mi5zdGFydHNXaXRoKFxcXFxcXFwiJm5ic3A7Jm5ic3A7XFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdDIgPSBcXFxcXFxcIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwO1xcXFxcXFwiICsgaXQyLnRyaW0oKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocnVsZS5yZXBsYWNlUmVnZXgpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0MiA9IGl0Mi5yZXBsYWNlKG5ldyBSZWdFeHAocnVsZS5yZXBsYWNlUmVnZXgucmVwbGFjZShcXFxcXFxcIiMjXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpLCBcXFxcXFxcImdcXFxcXFxcIiksIFxcXFxcXFwiXFxcXFxcXCIpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0MiA9PSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR0ICs9IGl0MiArIFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHRcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgTVlfUEFSQU1TLCBNWV9SVUxFLnRpdGxlKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdHlwZTogXFxcXFxcXCJub3ZlbFxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KTtcXFxcbiAgICB9IGVsc2Uge1xcXFxuICAgICAgICBkLnVuc2hpZnQoe1xcXFxuICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5pyq6Kej5p6Q5Yiw55uu5b2V5YiX6KGoXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICB1cmw6IE1ZX1VSTCxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIixcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgfVxcXFxuICAgIGQudW5zaGlmdCh7XFxcXG4gICAgICAgIHRpdGxlOiBNWV9QQVJBTVMuYm9va05hbWUsXFxcXG4gICAgICAgIGltZzogTVlfUEFSQU1TLmNvdmVyLFxcXFxuICAgICAgICB1cmw6IE1ZX1VSTCxcXFxcbiAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwibW92aWVfMV92ZXJ0aWNhbF9waWNfYmx1clxcXFxc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FwiKSAmJiBjW2MubGVuZ3RoIC0gMV0gPT0gXFxcXFxcXCJhXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgYyA9IGMucmVwbGFjZShcXFxcXFxcIiYmbGkmJmFcXFxcXFxcIiwgXFxcXFxcXCImJmxpXFxcXFxcXCIpO1xcXFxuICAgIH1cXFxcbiAgICBsb2coYyk7XFxcXG4gICAgbGV0IGFyciA9IHBkZmEoaHRtbCwgXFxcXFxcXCJib2R5JiZcXFxcXFxcIiArIGMpO1xcXFxuICAgIGlmIChyMS5sZW5ndGggPiAxKSB7XFxcXG4gICAgICAgIGxldCByMiA9IHIxWzFdLnNwbGl0KFxcXFxcXFwiOlxcXFxcXFwiKTtcXFxcbiAgICAgICAgbGV0IHIzID0gW107XFxcXG4gICAgICAgIGZvciAobGV0IGl0IG9mIHIyKSB7XFxcXG4gICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpID0gcGFyc2VJbnQoaXQpO1xcXFxuICAgICAgICAgICAgICAgIGlmIChpc05hTihpKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcjMucHVzaChpKTtcXFxcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHt9XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgbGV0IGFycjIgPSBbXTtcXFxcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgIGlmIChyMy5pbmRleE9mKGkpIDwgMCkge1xcXFxuICAgICAgICAgICAgICAgIGFycjIucHVzaChhcnJbaV0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHJldHVybiBhcnIyO1xcXFxuICAgIH1cXFxcbiAgICBsb2coXFxcXFxcXCLojrflj5blpLHotKXvvIzlpLHotKXlrprkvY3vvJpc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WVcXFxcbiAgICAgICAgfVxcXFxuICAgIH0pO1xcXFxuXFxcXG4gICAgYmF0Y2hFeGVjdXRlKHRhc2tzLCB7XFxcXG4gICAgICAgIGZ1bmM6IGZ1bmN0aW9uKHBhcmFtLCBpZCwgZXJyb3IsIHJlc3VsdCkge1xcXFxuICAgICAgICAgICAgLy9sb2coXFxcXFxcXCJsaXN0ZW5lcjogXFxcXFxcXCIgKyAocmVzdWx0IHx8IFtdKS5sZW5ndGgpXFxcXG4gICAgICAgICAgICBwYXJhbS5pID0gcGFyYW0uaSArIDE7XFxcXG4gICAgICAgICAgICBpZiAocmVzdWx0KSB7XFxcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgcmVzdWx0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbS5qID0gcGFyYW0uaiArIDE7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobWF0Y2hNdXN0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWFyY2hDb250YWlucyhpdC50aXRsZSwgcykpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGV4dHJhID0gaXQuZXh0cmEgfHwge307XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYS5pZCA9IFxcXFxcXFwiX19hcHBcXFxcXFxcIiArIE1ZX1BBR0UgKyBcXFxcXFxcIkBcXFxcXFxcIiArIHBhcmFtLmo7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYS5ib29rTmFtZSA9IGl0LnRpdGxlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYS5jb3ZlciA9IGl0LnBpY191cmwgfHwgaXQuaW1nXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBhZGRJdGVtQmVmb3JlKHBhZ2VpZCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdC50aXRsZS5pbmNsdWRlcyhcXFxcXFxcIuKAnOKAnOKAneKAnVxcXFxcXFwiKSA/IGl0LnRpdGxlIDogXFxcXFxcXCLigJzigJzigJ3igJ1cXFxcXFxcIiArIGl0LnRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cChcXFxcXFxcIjxlbT58PC9lbT5cXFxcXFxcIiwgXFxcXFxcXCJnXFxcXFxcXCIpLCBcXFxcXFxcIlxcXFxcXFwiKS5yZXBsYWNlKG5ldyBSZWdFeHAocywgXFxcXFxcXCJnXFxcXFxcXCIpLCBcXFxcXFxcIjxzdHJvbmc+PHNwYW4gc3R5bGU9XFxcXFxcXFxcXFxcXFxcImNvbG9yOiAjMUU5MEZGXFxcXFxcXFxcXFxcXFxcIj5cXFxcXFxcIiArIHMgKyBcXFxcXFxcIjwvc3Bhbj48L3N0cm9uZz5cXFxcXFxcIiksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogaXQuZGVzYyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGl0LnVybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBpdC5waWNfdXJsIHx8IGl0LmltZyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogaXQucGljX3VybCB8fCBpdC5pbWcgPyAnbW92aWVfMV92ZXJ0aWNhbF9waWMnIDogXFxcXFxcXCJ0ZXh0XzFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYTogZXh0cmFcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcXFxuXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAocGFyYW0uaSA+PSBwYXJhbS5hbGwpIHtcXFxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtKHBhZ2VpZClcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuWKoOi9veesrFxcXFxcXFwiICsgTVlfUEFHRSArIFxcXFxcXFwi6aG15Lit77yM6L+b5bqm77yaXFxcXFxcXCIgKyAocGFyYW0uaSArIDEpICsgXFxcXFxcXCIvXFxcXFxcXCIgKyBwYXJhbS5hbGwsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcXFxcXCJcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogXFxcXFxcXCJcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBwYWdlaWRcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0sXFxcXG4gICAgICAgIHBhcmFtOiB7XFxcXG4gICAgICAgICAgICBhbGw6IGRhdGEubGVuZ3RoLFxcXFxuICAgICAgICAgICAgaTogMCxcXFxcbiAgICAgICAgICAgIGo6IC0xXFxcXG4gICAgICAgIH1cXFxcbiAgICB9KTtcXFxcbn1cXFwifSx7XFxcImNvbF90eXBlXFxc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0+IGl0Lm5hbWUpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKHJ1bGUgIT0gbnVsbCkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBydWxlcy5maWx0ZXIoaSA9PiBpLm5hbWUgPT0gcnVsZSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBsZXQgc3RhcnQgPSAocGFnZSAtIDEpICogc2l6ZTtcXFxcbiAgICAgICAgICAgIGlmIChydWxlcy5sZW5ndGggPCBzdGFydCArIDEpIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gW107XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBsZXQgbGVuID0gc2l6ZTtcXFxcbiAgICAgICAgICAgIGlmIChydWxlcy5sZW5ndGggPCBwYWdlICogc2l6ZSkge1xcXFxuICAgICAgICAgICAgICAgIGxlbiA9IHJ1bGVzLmxlbmd0aCAtIHN0YXJ0XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBsZXQgYWxsID0gcnVsZXMubGVuZ3RoO1xcXFxuICAgICAgICAgICAgbGV0IHVzZSA9IChwYWdlIC0gMSkgKiBzaXplICsgbGVuO1xcXFxuICAgICAgICAgICAgcmV0dXJuIHtcXFxcbiAgICAgICAgICAgICAgICBhbGw6IGFsbCxcXFxcbiAgICAgICAgICAgICAgICB1c2U6IHVzZSxcXFxcbiAgICAgICAgICAgICAgICBkYXRhOiBydWxlcy5zbGljZShzdGFydCwgc3RhcnQgKyBsZW4pXFxcXG4gICAgICAgICAgICB9O1xcXFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxcXG4gICAgICAgICAgICByZXR1cm4ge1xcXFxuICAgICAgICAgICAgICAgIGFsbDogMCxcXFxcbiAgICAgICAgICAgICAgICB1c2U6IDAsXFxcXG4gICAgICAgICAgICAgICAgZGF0YTogW11cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfVxcXFxuICAgIH1cXF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