Advertisement
xiaomianao666

邀您一起看:解析管理

Jun 6th, 2024
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥解析管理@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcImRycHlcIixcInBhdGhcIjpcImRycHlcIixcInJ1bGVcIjpcImZ1bmN0aW9uIGluaXRIaWtlcigpIHtcXG4gICAgY29uc3QgaXNDbG9zZUxvZyA9ICFnZXRJdGVtKFxcXCJ1c2VMb2dcXFwiLCBcXFwiXFxcIik7XFxuICAgIGNvbnN0IGxvY2FsS2V5ID0gXFxcImRycHlcXFwiO1xcbiAgICBjb25zdCBDcnlwdG9VdGlsID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL2Fzc2V0cy9jcnlwdG8tamF2YS5qc1xcXCIpO1xcbiAgICBnbG9iYWxUaGlzLmxvY2FsID0ge1xcbiAgICAgICAgc2V0KHJ1bGVrZXksIGssIHYpIHtcXG4gICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKGxvY2FsS2V5ICsgXFxcIkBcXFwiICsgcnVsZWtleSArIFxcXCJAXFxcIiArIGssIHYpO1xcbiAgICAgICAgfSxcXG4gICAgICAgIGdldChydWxla2V5LCBrLCB2KSB7XFx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PYmplY3QuYXNzaWduKHtcXG4gICAgICAgICAgICAgICAgQ29va2llOiBcXFwiI25vQ29va2llI1xcXCJcXG4gICAgICAgICAgICB9LCBvYmouaGVhZGVycyk7XFxuICAgICAgICAgICAgaWYgKHVybCA9PT0gXFxcImh0dHBzOi8vYXBpLm5uLmNpL29jci9iNjQvdGV4dFxcXCIgJiYgb2JqLmhlYWRlcnMpIHtcXG4gICAgICAgICAgICAgICAgb2JqLmhlYWRlcnNbXFxcIkNvbnRlbnQtVHlwZVxcXCJdID0gXFxcInRleHQvcGxhaW5cXFwiO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBpZiAodXJsLnN0YXJ0c1dpdGgoXFxcImZpbGU6Ly9cXFwiKSAmJiAodXJsLmluY2x1ZGVzKFxcXCI/dHlwZT1cXFwiKSB8fCB1cmwuaW5jbHVkZXMoXFxcIj9wYXJhbXM9XFxcIikpKSB7XFxuICAgICAgICAgICAgICAgIHVybCA9IHVybC5zbGljZSgwLCB1cmwubGFzdEluZGV4T2YoXFxcIj9cXFwiKSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGZvciAobGV0IGtleSBpbiBvYmouaGVhZGVycykge1xcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIG9iai5oZWFkZXJzW2tleV0gIT09IFxcXCJzdHJpbmdcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBvYmouaGVhZGVyc1trZXldID0gU3RyaW5nKG9iai5oZWFkZXJzW2tleV0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCByID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgLyogaWYgKFN0cmluZyhvYmoubWV0aG9kKS50b0xvd2VyQ2FzZSgpID09PSBcXFwicG9zdFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgIHIgPSAkcG9zdCh1cmwsIG9iaik7XFxuICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICByID0gJHJlcXVlc3QodXJsLCBvYmopO1xcbiAgICAgICAgICAgICB9Ki9cXG4gICAgICAgICAgICByID0gJHJlcXVlc3QodXJsLCBvYmopO1xcbiAgICAgICAgICAgIGlmIChvYmoud2l0aEhlYWRlcnMpIHtcXG4gICAgICAgICAgICAgICAgciA9IEpTT04ucGFyc2Uocik7XFxuICAgICAgICAgICAgICAgIHJlcy5jb250ZW50ID0gci5ib2R5O1xcbiAgICAgICAgICAgICAgICByZXMuaGVhZGVycyA9IHt9O1xcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBbaywgdl0gb2YgT2JqZWN0LmVudHJpZXMoci5oZWFkZXJzIHx8IHt9KSkge1xcbiAgICAgICAgICAgICAgICAgICAgcmVzLmhlYWRlcnNba10gPSB2WzBdO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgcmVzLmNvbnRlbnQgPSByO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAob2JqLmJ1ZmZlciA9PT0gMikge1xcbiAgICAgICAgICAgICAgICByZXMuY29udGVudCA9IENyeXB0b1V0aWwuRGF0YS5wYXJzZUhleChyZXMuY29udGVudCkudG9CYXNlNjQoX2Jhc2U2NC5OT19XUkFQKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHJlcztcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBsb2coXFxcIkVycm9yXFxcIiArIGUudG9TdHJpbmcoKSk7XFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgLypcXG4gICAgY29uc3QgSmluSmEgPSAkLnJlcXVpcmUoXFxcImh0dHBzOi8vY2RuLmJvb3RjZG4ubmV0L2FqYXgvbGlicy9tdXN0YWNoZS5qcy80LjEuMC9tdXN0YWNoZS5qc1xcXCIpO1xcbiAgXFxuICAgIGNvbnN0IEpQID0gJC5yZXF1aXJlKFxcXCJodHRwczovL2pzb25wYXRoLXBsdXMuZ2l0aHViLmlvL0pTT05QYXRoL2Rpc3QvaW5kZXgtYnJvd3Nlci11bWQuY2pzXFxcIik7XFxuICAgIGdsb2JhbFRoaXMuY2hlZXJpbyA9IHtcXG4gICAgICAgIGppbmphMih0ZW1wbGF0ZSwgb2JqKSB7XFxuICAgICAgICAgICAgXFxuICAgICAgICAgICAgcmV0dXJuICQubG9nKEppbkphLnJlbmRlcih0ZW1wbGF0ZSwgb2JqKSk7XFxuICAgICAgICB9LFxcbiAgICAgICAganAocGF0aCwganNvbikge1xcbiAgICAgICAgICAgIHJldHVybiBKUC5KU09OUGF0aCh7XFxuICAgICAgICAgICAgICAgIHBhdGgsXFxuICAgICAgICAgICAgICAgIGpzb25cXG4gICAgICAgICAgICB9KVswXTtcXG4gICAgICAgIH1cXG4gICAgfSovXFxuICAgIGdsb2JhbFRoaXMucGRmYSA9IF9wZGZhO1xcbiAgICBnbG9iYWxUaGlzLnBkID0gX3BkO1xcbiAgICBnbG9iYWxUaGlzLnBkZmggPSBfcGRmaDtcXG4gICAgU3RyaW5nLnByb3RvdHlwZS5yZXBsYWNlQWxsID0gZnVuY3Rpb24gKHNlYXJjaCwgcmVwbGFjZW1lbnQpIHtcXG4gICAgICAgIHJldHVybiB0aGlzLnNwbGl0KHNlYXJjaCkuam9pbihyZXBsYWNlbWVudCk7XFxuICAgIH07XFxuICAgIGxldCAkdG9TdHJpbmcgPSBGdW5jdGlvbi5wcm90b3R5cGUudG9TdHJpbmc7XFxuICAgIEZ1bmN0aW9uLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHtcXG4gICAgICAgIHJldHVybiAkdG9TdHJpbmcuYXBwbHkodGhpcykudHJpbSgpO1xcbiAgICB9O1xcbiAgICBpZiAoaXNDbG9zZUxvZykge1xcbiAgICAgICAgLy8g6YeN5YaZY29uc29sZS5sb2flh73mlbBcXG4gICAgICAgIGNvbnNvbGUubG9nID0gZnVuY3Rpb24gKCkge1xcbiAgICAgICAgICAgIC8vIOajgOafpeS8oOWFpeWPguaVsOeahOaVsOmHj1xcbiAgICAgICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID4gMSkge1xcbiAgICAgICAgICAgICAgICAvLyDlpoLmnpzlj4LmlbDmlbDph4/lpKfkuo4x77yM6LCD55So5Y6f5aeL55qEY29uc29sZS5sb2flh73mlbBcXG4gICAgICAgICAgICAgICAgLy9vcmlnaW5hbExvZy5hcHBseShjb25zb2xlLCBhcmd1bWVudHMpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgLy8g5aaC5p6c5Y+C5pWw5Y+q5pyJ5LiA5Liq77yM5YiZ5LiN5YGa5Lu75L2V5pON5L2cXFxuICAgICAgICB9O1xcbiAgICB9XFxufVxcbmluaXRIaWtlcigpO1xcbmNvbnN0IGRycHlQYXRoID0gZ2V0UGF0aChcXFwiaGlrZXI6Ly9maWxlcy9kYXRhL1xcXCIgKyBNWV9SVUxFLnRpdGxlICsgXFxcIi9saWJzX2hpa2VyL2RycHkyLmpzXFxcIik7XFxuXFxuaWYgKCFmaWxlRXhpc3QoZHJweVBhdGgpKSB7XFxuICAgIHRocm93IG5ldyBFcnJvcihcXFwi57y65bCRZHJweS5qc+i/kOihjOW6k1xcXCIpO1xcbn1cXG5sZXQgZHJweSA9ICQucmVxdWlyZShkcnB5UGF0aCk7XFxuLypcXG5sZXQgY3VycmVudFBhdGggPSBcXFwiXFxcIjtcXG5sZXQgJGluaXQgPSBkcnB5LmluaXQ7XFxuZHJweS5pbml0ID0gZnVuY3Rpb24oZXh0KSB7XFxuICAgIGlmIChleHQgPT09IGN1cnJlbnRQYXRoKSByZXR1cm47XFxuICAgICRpbml0LmNhbGwodGhpcywgZXh0KTtcXG4gICAgY3VycmVudFBhdGggPSBleHQ7XFxufSovXFxuJC5leHBvcnRzID0gZHJweTtcI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cInRleHRfM1xcXCI7XFxuICAgICAgfSBlbHNlIGlmICh0YyA+PSAxNSkge1xcbiAgICAgICAgY29sID0gXFxcInRleHRfMlxcXCI7XFxuICAgICAgICB0ZXh0YWxpZ24gPSBcXFwibGVmdFxcXCI7XFxuICAgICAgfVxcbiAgICAgIGxldCBwbGF5b2JqID0gdC5zcGxpdChcXFwiI1xcXCIpLm1hcCgoaikgPT4ge1xcbiAgICAgICAgbGV0IGsgPSBqLnNwbGl0KFxcXCIkXFxcIik7XFxuICAgICAgICBsZXQgdCA9IGtbMF07XFxuICAgICAgICBsZXQgdWlkID0gKGtbMV18fGtbMF0pO1xcbiAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgdGl0bGU6IGZvbnRzdHlsZSh0LCB7XFxuICAgICAgICAgICAgdGFnczogXFxcInNtYWxsXFxcIlxcbiAgICAgICAgICB9KSxcXG4gICAgICAgICAgdXJsOiAgdWlkKyBcXFwiI1xcXCIgKyBmcm9tW2ldICsgcGxheUxhenkucmVwbGFjZSgnXFxcImlkXFxcIicsICdcXFwiJyArdWlkICsgJ1xcXCInKSxcXG4gICAgICAgICAgY29sX3R5cGU6IGNvbCxcXG4gICAgICAgICAgaW1nOiBpbWcsXFxuICAgICAgICAgIC8qZXh0cmE6IE9iamVjdC5hc3NpZ24oe30sIGV4dHJhLCB7XFxuICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBkZWNvZGVVUklDb21wb25lbnQoa1sxXSksXFxuICAgICAgICAgICAgaWQ6IGtbMV0sXFxuICAgICAgICAgICAgLy9saW5lVmlzaWJsZTogZmFsc2UsXFxuICAgICAgICAgICAgdGV4dEFsaWduOiB0ZXh0YWxpZ24sXFxuICAgICAgICAgICAgY2xzOiBcXFwicGxheWxpc3RcXFwiLFxcbiAgICAgICAgICB9KSovXFxuICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgaWQ6IHVpZCxcXG4gICAgICAgICAgICBibG9ja1J1bGVzOiBbJ2JiL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XlwLm1hcCgoeCwgaSkgPT4ge1xcbiAgICAgICAgIGxldCBvYmogPSBPYmplY3QuYXNzaWduKHt9LCB0ZW1wLCB7XFxuICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyAocGFnZW51bSA9PSBpID8geC5mb250Y29sb3IoXFxcInJlZFxcXCIpIDogeCksXFxuICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGkpID0+IHtcXG4gICAgICAgICAgICAgaWYgKGdldE15VmFyKFxcXCJwYWdlbnVtXFxcIikgPT0gaSkge1xcbiAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICBwdXRNeVZhcihcXFwicGFnZW51bVxcXCIsIFN0cmluZyhpKSk7XFxuICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhcXFwicGxheWxpc3RcXFwiKTtcXG4gICAgICAgICAgICAgYWRkSXRlbUFmdGVyKFxcXCJwbGF5bGlzdHNcXFwiLCAkLnRlbXBfbGlzdFtpXSk7XFxuICAgICAgICAgICAgIGZpbmRJdGVtc0J5Q2xzKFxcXCJwbGF5cGFnZVxcXCIpLmZvckVhY2goKHgsIGlpKSA9PiB7XFxuICAgICAgICAgICAgICAgbGV0IHRpdGxlID0geC50aXRsZS5yZXBsYWNlKC/igJh84oCZfOKAnHzigJ18PFtePl0rPi9nLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgaWYgKGlpID09IGkpIHtcXG4gICAgICAgICAgICAgICAgIHRpdGxlID0gJ+KAnOKAnOKAneKAnScgKyB0aXRsZS5mb250Y29sb3IoXFxcInJlZFxcXCIpO1xcbiAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAg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XJsOiBcXFwiaGlrZXI6Ly9pbWFnZXMvaWNvbl9kb21haW5fY29uZmlnXFxcIixcXG4gICAgZXh0cmE6IHtcXG4gICAgICAgIHBhZ2VUaXRsZTogXFxcIuaWsOWinuino+aekFxcXCJcXG4gICAgfVxcbn0pO1xcblxcbmQucHVzaCh7XFxuICAgIHRpdGxlOiBcXFwi5YiG5LqrXFxcIixcXG4gICAgdXJsOiAkKFxcXCItMVxcXCIsIFxcXCLovpPlhaXkvaDopoHliIbkuqvop6PmnpDnmoTluo/lj7dcXFxcbi0x5YWo6YOo77yMLTLlt7LlkK/nlKjnmoTvvIwtM+W3suemgeeUqOeahFxcXCIpLmlucHV0KChsZW5ndGgpID0+IHtcXG4gICAgICAgIGxldCBpbmRleGMgPSBpbnB1dC5zcGxpdCgvLHzvvIwvKTtcXG4gICAgICAgIGxldCBpbmRleHMgPSBbXTtcXG4gICAgICAgIGxldCBtbyA9IHBhcnNlSW50KGluZGV4Y1swXSk7XFxuICAgICAgICBpZiAoIShpbmRleGMubGVuZ3RoICE9PSAwICYmIG1vIDwgMCAmJiBtbyA+IC01KSkge1xcbiAgICAgICAgICAgIGZvciAobGV0IGl0IG9mIGluZGV4Yykge1xcbiAgICAgICAgICAgICAgICBsZXQgbnVtID0gcGFyc2VJbnQoaXQpO1xcbiAgICAgICAgICAgICAgICBpZiAoTnVtYmVyLmlzTmFOKG51bSkgfHwgbnVtID49IGxlbmd0aCB8fCBudW0gPCAwKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5pWw5a2X5LiN5ZCI5rOVXFxcIjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpbmRleHMucHVzaChudW0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiAkKFtcXFwiSElLRVJcXFwiLCBcXFwiVFhUXFxcIl0uY29uY2F0KGdldFBhc3RlcygpKSwgMiwgXFxcIuWIhuS6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5wdXQpXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBcXFwi5a6M5pW05Y+j5LukXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBnZXRQYXNzKHJ1bGUubmFtZSwgcnVsZWI2NCwgXFxcImFcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHUgPSBzaGFyZVBhc3RlKHJ1bGViNjQsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImNvcHk6Ly9cXFwiICsgZ2V0UGFzcyhydWxlLm5hbWUsIHUsIFxcXCJiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0sIGluZGV4KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi56e75YqoXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChpbmRleCArIFxcXCJcXFwiLCBcXFwi6L6T5YWl5L2N572uXFxcIikuaW5wdXQoKGluZGV4LCBsZW5ndGgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBuZXdJbmRleCA9IE51bWJlcihpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoTnVtYmVyLmlzTmFOKG5ld0luZGV4KSB8fCBuZXdJbmRleCA+PSBsZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5LiN5ZKM6KeE55qE5L2N572uXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGxldCBydWxlcyA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBydWxlID0gcnVsZXMuc3BsaWNlKGluZGV4LCAxKVswXTtcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVzLnNwbGljZShuZXdJbmRleCwgMCwgcnVsZSk7XFxuICAgICAgICAgICAgICAgICAgICAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5zYXZlSnNvbihydWxlcyk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgIH0sIGluZGV4LCBsZW5ndGgpO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLnva7pobZcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGxldCBuZXdJbmRleCA9IDA7XFxuICAgICAgICAgICAgICAgIGxldCBydWxlcyA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKTtcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGUgPSBydWxlcy5zcGxpY2UoaW5kZXgsIDEpWzBdO1xcbiAgICAgICAgICAgICAgICBydWxlcy5zcGxpY2UobmV3SW5kZXgsIDAsIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5zYXZlSnNvbihydWxlcyk7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi5Yig6ZmkXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwi56Gu6K6k5Yig6Zmk77yfXFxcIikuY29uZmlybSgoaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBydWxlcyA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBydWxlID0gcnVsZXMuc3BsaWNlKGluZGV4LCAxKVswXTtcXG4gICAgICAgICAgICAgICAgICAgICQucmVxdWlyZSh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BpZiAoaGVhZGVycykge1xcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVycyA9IEpTT04ucGFyc2UoaGVhZGVycyk7XFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGVhZGVyc+agvOW8j+mUmeivrzpcXFwiICsgZS50b1N0cmluZygpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiAkLnJlcXVpcmUoXFxcInZpZGVvVXJsXFxcIikucHJlcGFyZVBhcnNlcyhbe1xcbiAgICAgICAgICAgICAgICBuYW1lLFxcbiAgICAgICAgICAgICAgICB1cmwsXFxuICAgICAgICAgICAgICAgIGZsYWcsXFxuICAgICAgICAgICAgICAgIGhlYWRlcnMsXFxuICAgICAgICAgICAgICAgIHJ1blR5cGUsXFxuICAgICAgICAgICAgICAgIG1ldGhvZCxcXG4gICAgICAgICAgICAgICAganNvblBhdGgsXFxuICAgICAgICAgICAgICAgIGpzXFxuICAgICAgICAgICAgfV0sIGlucHV0LG51bGwsIHRydWUpO1xcbiAgICAgICAgfSk7XFxuICAgIH0pLFxcbiAgICBjb2xfdHlwZTogXFxcInRleHRfM1xcXCIsXFxufSk7XFxuXFxuZC5wdXNoKHtcXG4gICAgdGl0bGU6IFxcXCLkv53lrZhcXFwiLFxcbiAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKGluZGV4LCBpc0ltcG9ydCkgPT4ge1xcbiAgICAgICAgbGV0IG5hbWUgPSBnZXRNeVZhcihcXFwicHNfbmFtZVxcXCIsIFxcXCJcXFwiKS50cmltKCk7XFxuICAgICAgICBpZiAoIW5hbWUpIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5ZCN5a2X5b6X5pyJ5LiA5Liq5ZCnXFxcIjtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCB1cmwgPSBnZXRNeVZhcihcXFwicHNfdXJsXFxcIiwgXFxcIlxcXCIpLnRyaW0oKTtcXG4gICAgICAgIGlmICghdXJsKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+ino+aekOWcsOWdgOS4jeiDveS4uuepulxcXCI7XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgZmxhZyA9IGdldE15VmFyKFxcXCJwc19mbGFnXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgaWYgKCFmbGFnKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+ino+aekOWcsOWdgOagh+ivhuS4jeiDveS4uuepulxcXCI7XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgaGVhZGVycyA9IGdldE15VmFyKFxcXCJwc19oZWFkZXJzXFxcIiwgXFxcIlxcXCIpLnRyaW0oKTtcXG4gICAgICAgIGlmIChoZWFkZXJzKSB7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgaGVhZGVycyA9IEpTT04ucGFyc2UoaGVhZGVycyk7XFxuICAgICAgICAgICAgICAgIGlmKHR5cGVvZiBoZWFkZXJzIT09XFxcIm9iamVjdFxcXCIpIHRocm93IG5ldyBFcnJvcihcXFwi6ZSZ6K+v57G75Z6L77yM5b+F6aG75Li6T2JqZWN0XFxcIik7XFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhlYWRlcnPmoLzlvI/plJnor686XFxcIiArIGUudG9TdHJpbmcoKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgcnVuVHlwZSA9IGdldE15VmFyKFxcXCJwc19ydW5UeXBlXFxcIiwgXFxcIldFQlxcXCIpO1xcbiAgICAgICAgbGV0IG1ldGhvZCA9IGdldE15VmFyKFxcXCJwc19tZXRob2RcXFwiLCBcXFwiR0VUXFxcIik7XFxuICAgICAgICBsZXQganNvblBhdGggPSBnZXRNeVZhcihcXFwicHNfanNvblBhdGhcXFwiLCBcXFwiXFxcIikudHJpbSgpIHx8IHZvaWQgMDtcXG4gICAgICAgIGxldCBqcyA9IGdldE15VmFyKFxcXCJwc19qc1xcXCIsIFxcXCJcXFwiKSB8fCB2b2lkIDA7XFxuICAgICAgICBpZiAocnVuVHlwZSA9PT0gXFxcIkpTT05cXFwiICYmICFqc29uUGF0aCkge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly9KU09O5qih5byP5LiL5b+F6aG75aGranNvblBhdGhcXFwiO1xcbiAgICAgICAgfSBlbHNlIGlmIChydW5UeXBlID09PSBcXFwiSlNcXFwiICYmICFqcykge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly9KU+aooeW8j+S4i+W/hemhu+Whq2pzXFxcIjtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBhcnIgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCk7XFxuICAgICAgICBsZXQgb2JqMSA9IHtcXG4gICAgICAgICAgICBuYW1lLFxcbiAgICAgICAgICAgIHVybCxcXG4gICAgICAgICAgICBmbGFnLFxcbiAgICAgICAgICAgIGhlYWRlcnMsXFxuICAgICAgICAgICAgcnVuVHlwZSxcXG4gICAgICAgICAgICBtZXRob2QsXFxuICAgICAgICAgICAganNvblBhdGgsXFxuICAgICAgICAgICAganNcXG4gICAgICAgIH07XFxuICAgICAgICBpZiAoaW5kZXggPT09IHZvaWQoMCkpIHtcXG4gICAgICAgICAgICBpZiAoYXJyLnNvbWUodiA9PiB2Lm5hbWUgPT09IG5hbWUpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lt7Lnu4/lrZjlnKjor6Xop6PmnpBcXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAob2JqMS5ncm91cCkge1xcbiAgICAgICAgICAgICAgICBsZXQgZ3JvdXAgPSBvYmoxLmdyb3VwO1xcbiAgICAgICAgICAgICAgICBsZXQgaW5kZXggPSBhcnIuZmluZEluZGV4KHYgPT4gdi5ncm91cCA9PT0gZ3JvdXApO1xcbiAgICAgICAgICAgICAgICBpZiAoaW5kZXggPT09IC0xKSB7XFxuICAgICAgICAgICAgICAgICAgICBhcnIudW5zaGlmdChvYmoxKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGFyci5zcGxpY2UoaW5kZXgsIDAsIG9iajEpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaWYgKGlzSW1wb3J0KSB7XFxuICAgICAgICAgICAgICAgICAgICBhcnIucHVzaChvYmoxKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGFyci51bnNoaWZ0KG9iajEpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgbmFtZXkgPSBhcnJbaW5kZXhdLm5hbWU7XFxuICAgICAgICAgICAgaWYgKG5hbWUgIT09IG5hbWV5KSB7XFxuICAgICAgICAgICAgICAgIGlmIChhcnIuc29tZSh2ID0+IHYubmFtZSA9PT0gbmFtZSkpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lt7Lnu4/lrZjlnKjor6Xop6PmnpBcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIG9iajEgPSBPYmplY3QuYXNzaWduKGFycltpbmRleF0sIG9iajEpO1xcbiAgICAgICAgICAgIGFyci5zcGxpY2UoaW5kZXgsIDEsIG9iajEpO1xcbiAgICAgICAgfVxcbiAgICAgICAgJC5yZXF1aXJlKFxcX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XFwiKTtcXG4gICAgICAgIGxldCBhcnIgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3M/cnVsZT1cXFwiICsgcnVsZVRpdGxlKS5nZXRKc29uKCk7XFxuICAgICAgICBsZXQgbmV3SSA9IDA7XFxuICAgICAgICBmb3IgKGxldCBydWxlIG9mIHJ1bGVzKSB7XFxuICAgICAgICAgICAgbGV0IGluZGV4ID0gYXJyLmZpbmRJbmRleCh2ID0+IHYubmFtZSA9PT0gcnVsZS5uYW1lKTtcXG4gICAgICAgICAgICBpZiAoaW5kZXggPiAtMSkge1xcbiAgICAgICAgICAgICAgICBydWxlID0gT2JqZWN0LmFzc2lnbihhcnJbaW5kZXhdLCBydWxlKTtcXG4gICAgICAgICAgICAgICAgYXJyLnNwbGljZShpbmRleCwgMSwgcnVsZSk7XFxuICAgICAgICAgICAgICAgIGlmIChydWxlcy5sZW5ndGggPT09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVDYWNoZShydWxlKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL3J1bGVFZGl0I25vSGlzdG9yeSMjbm9SZWNvcmRIaXN0b3J5Iz9pc0ltcG9ydD10cnVlJmluZGV4PVxcXCIgKyBpbmRleCArIFxcXCImcnVsZT1cXFwiICsgcnVsZVRpdGxlO1xcbiAgICAgICAgICAgICAgICAgICAgLy90b2FzdChcXFwi5bey5pu05paw6KeE5YiZ77yaXFxcIiArIHJ1bGUubmFtZSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBsb2coXFxcIuW3suabtOaWsOinhOWIme+8mlxcXCIgKyBydWxlLm5hbWUpXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBuZXdJKys7XFxuICAgICAgICAgICAgICAgIGFyci5wdXNoKHJ1bGUpO1xcbiAgICAgICAgICAgICAgICBpZiAocnVsZXMubGVuZ3RoID09PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICBzYXZlQ2FjaGUocnVsZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9ydWxlRWRpdCNub0hpc3RvcnkjI25vUmVjb3JkSGlzdG9yeSM/aXNJbXBvcnQ9dHJ1ZSZydWxlPVxcXCIgKyBydWxlVGl0bGU7XFxuICAgICAgICAgICAgICAgICAgICAvL3RvYXN0KFxcXCLlt7Llr7zlhaXop4TliJnvvJpcXFwiICsgcnVsZS5uYW1lKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi5bey5a+85YWl6KeE5YiZ77yaXFxcIiArIHJ1bGUubmFtZSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChydWxlcy5sZW5ndGggPiAxKSB7XFxuICAgICAgICAgICAgJC5yZXF1aXJlKFxcXCJjb25maWdzP3J1bGU9XFxcIiArIHJ1bGVUaXRsZSkuc2F2ZUpzb24oYXJyKTtcXG4gICAgICAgICAgICB0b2FzdChcXFwi5paw5aKe77yaXFxcIiArIG5ld0kgKyBcXFwiIOimhuebluabtOaWsO+8mlxcXCIgKyAocnVsZXMubGVuZ3RoIC0gbmV3SSkpO1xcbiAgICAgICAgfVxcbiAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICBsb2coZS50b1N0cmluZygpKTtcXG4gICAgICAgIHRvYXN0KFxcXCLlr7zlhaXlpLHotKVcXFwiKTtcXG4gICAgfVxcbn1cIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuinhumikeino+aekFwiLFwicGF0aFwiOlwidmlkZW9VcmxcIixcInJ1bGVcIjpcImZ1bmN0aW9uIGlzb2ZmaWNpYWwodXJsKSB7XFxuICBsZXQgZmxhZyA9IG5ldyBSZW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wgXFxcIiNyZXBvLWNvbnRlbnQtcGpheC1jb250YWluZXImJnNjcmlwdCYmSHRtbFxcXCIpO1xcbiAgICBcXG4gICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKGpzb25UZXh0KTtcXG4gICAgbGV0IGxpc3QgPSBqc29uLnBheWxvYWQudHJlZS5pdGVtcztcXG4gICAgbGV0IHJ1bGVzID0gW107XFxuICAgIGxldCBjb3VudCA9IDA7XFxuICAgIGZvciAobGV0IGl0IG9mIGxpc3QpIHtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgbGV0IG5hbWUgPSBpdC5uYW1lO1xcbiAgICAgICAgICAgIGxldCBzcGF0aCA9IGl0LnBhdGg7XFxuICAgICAgICAgICAgaWYgKCFuYW1lLmVuZHNXaXRoKFxcXCIuanNcXFwiKSkgY29udGludWU7XFxuICAgICAgICAgICAgbmFtZSA9IG5hbWUuc2xpY2UoMCwgbmFtZS5sYXN0SW5kZXhPZihcXFwiLlxcXCIpKTtcXG4gICAgICAgICAgICBsZXQgcnVsZSA9IGZldGNoKGBodHRwczovL3Jhdy5naXRtaXJyb3IuY29tLyR7cm9wZX0vbWFzdGVyLyR7c3BhdGh9YCk7XFxuICAgICAgICAgICAgaWYgKCEoKCFydWxlIHx8ICFydWxlLmluY2x1ZGVzKFxcXCJydWxlXFxcIikpICYmICFmaWxlRXhpc3QocGF0aCArIGl0Lm5hbWUpKSkge1xcbiAgICAgICAgICAgICAgICB3cml0ZUZpbGUocGF0aCArIGl0Lm5hbWUsIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICBydWxlcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICdrZXknOiBgaGlweV9qc18ke25hbWV9YCxcXG4gICAgICAgICAgICAgICAgICAgICduYW1lJzogYCR7bmFtZX1gLFxcbiAgICAgICAgICAgICAgICAgICAgJ3R5cGUnOiAzLFxcbiAgICAgICAgICAgICAgICAgICAgJ2FwaSc6Jy4uL2xpYnMvZHJweTIuanMnL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29tcG9uZW50KGl0LmV4dC5zcGxpdChcXFwiL1xcXCIpLmF0KC0xKSkgOiAoaXQubmFtZSArIFxcXCIuanNcXFwiKTtcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGU7XFxuICAgICAgICAgICAgICAgIGlmIChTdHJpbmcoaXQuZXh0KS5zdGFydHNXaXRoKFxcXCJodHRwXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGUgPSByZXF1ZXN0KGl0LmV4dCk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBydWxlID0gcmVxdWVzdChqb2luVXJsKHVybCwgaXQuZXh0KSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaXQuZXh0ID0gXFxcIi4vXFxcIiArIG5hbWU7XFxuICAgICAgICAgICAgICAgIGlmICghcnVsZSB8fCAhcnVsZS5pbmNsdWRlcyhcXFwicnVsZVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoIWZpbGVFeGlzdChwYXRoICsgbmFtZSkpXFxuICAgICAgICAgICAgICAgICAgICAgICAgYXJyLnNwbGljZShpLCAxKTtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICB3cml0ZUZpbGUocGF0aCArIG5hbWUsIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICBjb3VudCsrO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBsb2coZS50b1N0cmluZygpKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGkrKztcXG4gICAgfVxcbiAgICB3cml0ZUZpbGUocGF0aCArIFxcXCJpbmRleC5qc29uXFxcIiwgSlNPTi5zdHJpbmdpZnkoanNvbikpO1xcbiAgICByZXR1cm4gXFxcInRvYXN0Oi8v5oiQ5Yqf5pu05pawXFxcIiArIG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ZXIoanNvbi5zaXRlcyk7XFxuICAgICAgICAgICAgY29uZmlnLnR5cGUgPSBcXFwiaW5kZXhcXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgZmlsZSA9IHZvaWQgMDtcXG4gICAgICAgIGxldCBjdXJyZW50U291cmNlLCBzZWFyY2hBbGxvdztcXG4gICAgICAgIGlmIChjb25maWcuY0tleSkge1xcbiAgICAgICAgICAgIGN1cnJlbnRTb3VyY2UgPSBzb3VyY2VMaXN0LmZpbmQodiA9PiB2LmtleSA9PT0gY29uZmlnLmNLZXkpO1xcbiAgICAgICAgICAgIGlmICghY3VycmVudFNvdXJjZSkge1xcbiAgICAgICAgICAgICAgICBjdXJyZW50U291cmNlID0gc291cmNlTGlzdFswXTtcXG4gICAgICAgICAgICAgICAgLy9jdXJyZW50Q29uZmlnLmNLZXkgPSBzb3VyY2VMaXN0WzBdLmtleTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGN1cnJlbnRTb3VyY2UgPSBzb3VyY2VMaXN0WzBdO1xcbiAgICAgICAgICAgIC8vY29uZmlnLmNLZXkgPSBzb3VyY2VMaXN0WzBdLmtleTtcXG4gICAgICAgIH1cXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgc2VhcmNoQWxsb3cgPSBKU09OLnBhcnNlKGZldGNoKHNlYXJjaEFsbG93UGF0aCkgfHwgXFxcIltdXFxcIik7XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgZGVsZXRlRmlsZShzZWFyY2hBbGxvd1BhdGgpO1xcbiAgICAgICAgICAgIHNlYXJjaEFsbG93ID0gW107XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgIGN1cnJlbnRTb3VyY2UsXFxuICAgICAgICAgICAgc2VhcmNoQWxsb3csXFxuICAgICAgICAgICAgc291cmNlTGlzdFxcbiAgICAgICAgfTtcXG4gICAgfSBjYXRjaCAo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cbiAgICAgICAgICBpZiAoZGlyLmlzRmlsZSgpICYmIGZpbGVFeGlzdChvYmoudXJsKSkge1xcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICBqc29uID0gSlNPTi5wYXJzZShyZWFkRmlsZShvYmoudXJsKSk7XFxuICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShqc29uLnNpdGVzKSB8fCBqc29uLnNpdGVzLmxlbmd0aCkge1xcbiAgICAgICAgICAgICAgICBjb3VudCA9IGZpbHRlck90aGVyKGpzb24uc2l0ZXMpLmxlbmd0aDtcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICAgICAgICAgIGNvZGUgPSBcXFwib2tcXFwiO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIGlmIChqc0ZpbGVzLmxlbmd0aCA+PSA1KSB7XFxuICAgICAgICAgICAgY291bnQgPSBqc0ZpbGVzLmxlbmd0aDtcXG4gICAgICAgICAgICBjb2RlID0gXFxcIm9rXFxcIjtcXG4gICAgICAgICAgfVxcbiAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgIHRpbWU6IChEYXRlLm5vdygpIC0gcyksXFxuICAgICAgICAgICAgdXJsOiBvYmoudXJsLFxcbiAgICAgICAgICAgIGNvdW50OiBjb3VudCxcXG4gICAgICAgICAgICBjb2RlOiBjb2RlLFxcbiAgICAgICAgICAgIGluZGV4OiBvYmouaVxcbiAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICB2YXIgaiA9IEpTT04ucGFyc2UoZmV0Y2gob2JqLnVybCwge1xcbiAgICAgICAgICB3aXRoSGVhZGVyczogdHJ1ZSxcXG4gICAgICAgICAgdGltZW91dDogNTAwMCxcXG4gICAgICAgIH0pKTtcXG4gICAgICAgIGxldCBlID0gRGF0ZS5ub3coKTtcXG4gICAgICAgIGxldCBjID0gZSAtIHM7XFxuICAgICAgICBpZiAob2JqLnVybC5pbmNsdWRlcyhcXFwiZ2l0aHViLmNvbVxcXCIpICYmIGouc3RhdHVzQ29kZSA9PSAyMDApIHtcXG4gICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICB2YXIgaHRtbCA9IGouYm9keTtcXG4gICAgICAgICAgICB2YXIganNvbiA9IEpTT04ucGFyc2UocGRmaChodG1sLCBcXFwiI3JlcG8tY29udGVudC1wamF4LWNvbnRhaW5lciYmc2NyaXB0JiZIdG1sXFxcIikpO1xcbiAgICAgICAgICAgIGxldCBsaXN0ID0ganNvbi5wYXlsb2FkLnRyZWUuaXRlbXM7XFxuICAgICAgICAgICAgY291bnQgPSBsaXN0LmZpbHRlcih4ID0+IHgubmFtZS5lbmRzV2l0aChcXFwiLmpzXFxcIikpLmxlbmd0aDtcXG4gICAgICAgICAgfSBjYXRjaCB7fVxcbiAgICAgICAgfVxcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKHRvQ29ycmVjdEpTT05TdHJpbmcoai5ib2R5KSB8fCBcXFwie31cXFwiKTtcXG4gICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoanNvbi5zaXRlcykgfHwganNvbi5zaXRlcy5sZW5ndGgpIHtcXG4gICAgICAgICAgICBjb3VudCA9IGZpbHRlck90aGVyKGpzb24uc2l0ZXMpLmxlbmd0aDtcXG4gICAgICAgICAgfVxcbiAgICAgICAgfSBjYXRjaCAoZSkge31cXG5cXG4gICAgICAgIHJldHVybiB7XFxuICAgICAgICAgIHRpbWU6IGMsXFxuICAgICAgICAgIHVybDogai51cmwsXFxuICAgICAgICAgIGNvdW50OiBjb3VudCxcXG4gICAgICAgICAgY29kZTogai5zdGF0dXNDb2RlLFxcbiAgICAgICAgICBpbmRleDogb2JqLmksXFxuICAgICAgICB9XFxuICAgICAgfTtcXG4gICAgICBsZXQgdGFza3MgPSBsaXN0Lm1hcCgoeCwgaSkgPT4ge1xcbiAgICAgICAgaSA9IGkgKyAxO1xcbiAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgZnVuYzogdGFzayxcXG4gICAgICAgICAgcGFyYW06IHtcXG4gICAgICAgICAgICB1cmw6IHgsXFxuICAgICAgICAgICAgaTogaSAtIDEsXFxuICAgICAgICAgIH0sXFxuICAgICAgICAgIGlkOiAndGFza2lkJyArIGlcXG4gICAgICAgIH1cXG4gICAgICB9KTtcXG4gICAgICB2YXIgY291bnQgPSBzdWNjZXNzID0gdGFza3MubGVuZ3RoO1xcbiAgICAgIGJlKHRhc2tzLCB7XFxuICAgICAgICBmdW5jOiBmdW5jdGlvbihvYmosIGlkLCBlcnJvciwgdGFza1Jlc3VsdCkge1xcbiAgICAgICAgICBvYmoucmVzdWx0cy5wdXNoKHRhc2tSZXN1bHQpXFxuICAgICAgICAgIGNvdW50ID0gY291bnQgLSAxO1xcbiAgICAgICAgICBpZiAoY291bnQgPiAwKSB7XFxuICAgICAgICAgICAgc2hvd0xvYWRpbmcoXFxcIuajgOa1i+S4rS4uLuWJqeS9meWcsOWdgO+8mlxcXCIgKyBjb3VudClcXG4gICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBoaWRlTG9hZGluZygpO1xcbiAgICAgICAgICB9XFxuICAgICAgICB9LFxcbiAgICAgICAgcGFyYW06IHtcXG4gICAgICAgICAgaGk6ICdjY2MnLFxcbiAgICAgICAgICByZXN1bHRzOiByZXN1bHRzXFxuICAgICAgICB9XFxuICAgICAgfSwgc3VjY2Vzcyk7XFxuICAgICAgLy9sb2cocmVzdWx0cylcXG4gICAgICByZXN1bHRzID0gcmVzdWx0cy5maWx0ZXIoZiA9PiBmKTtcXG4gICAgICByZXN1bHRzLmZvckVhY2goKHgsIGkpID0+IHtcXG4gICAgICAgIGxldCBpdGVtID0gZmluZEl0ZW0oXFxcInBhdGhcXFwiICsgeC5pbmRleCk7XFxuICAgICAgICBsZXQgcmVnZXggPSAvKOWQjeensDouKj8pKFxcXFxzKyk/XFxcXG4vZztcXG4gICAgICAgIGxld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Gl0bGU6IFxcXCLnrZvpgInmupBcXFwiLFxcbiAgICAgICAgICAgICAgaGludDogXFxcIua6kOWFs+mUruWtl1xcXCIsXFxuICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IHNlYXJjaEtleSxcXG4gICAgICAgICAgICAgIHRleHRhcmVhOiBmYWxzZSwgLy/lpJrooYzmqKHlvI9cXG4gICAgICAgICAgICAgIG1heFRleHRhcmVhOiB0cnVlLFxcbiAgICAgICAgICAgICAgbm9BdXRvU29mdDogZmFsc2UsXFxuICAgICAgICAgICAgICAvL2hpZGVDYW5jZWw6IHRydWUsXFxuICAgICAgICAgICAgICBjb25maXJtKHRleHQpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bnRpbWVDb25maWcgPSBHTS5kZWZpbmVNb2R1bGUoXFxcInJ1bnRpbWVDb25maWdcXFwiLCBcXFwicnVudGltZUNvbmZpZ1xcXCIpO1xcbiAgICAgICAgICAgICAgICBzZWFyY2hLZXkgPSB0ZXh0O1xcbiAgICAgICAgICAgICAgICBsZXQgbGlzdCA9IHJ1bnRpbWVDb25maWcuZ2V0QWxsU291cmNlKCkubWFwKHggPT4geC5uYW1lKTtcXG4gICAgICAgICAgICAgICAgbGV0IGZsaXN0ID0gbGlzdC5maWx0ZXIoeCA9PiB4LmluY2x1ZGVzKHRleHQpKTtcXG4gICAgICAgICAgICAgICAgbWFuYWdlLmxpc3QubGVuZ3RoID0gMDtcXG4gICAgICAgICAgICAgICAgZmxpc3QuZm9yRWFjaCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5wdXNoKHgpO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcbiAgICAgICAgICAgICAgICAvL3JldHVybiBcXFwidG9hc3Q6Ly/ovpPlhaXkuoZcXFwiICsgdGV4dDtcXG4gICAgICAgICAgICAgIH0sXFxuXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgIH0gZWxzZSBpZiAoaSA9PT0gMikge1xcbiAgICAgICAgICAgIGxldCBsaXN0ID0gT2JqZWN0LmFzc2lnbihbXSwgbWFuYWdlLmxpc3QpO1xcbiAgICAgICAgICAgIGxldCBuYXR1cmFsID0gZ2V0SXRlbShcXFwibmF0dXJhbFxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICBpZiAobmF0dXJhbCA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgbWFuYWdlLmxpc3QubGVuZ3RoID0gMDtcXG4gICAgICAgICAgICAgIGxpc3Quc29ydChuYXR1cmFsU29ydCkuZm9yRWFjaCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgbWFuYWdlLmxpc3QucHVzaCh4KTtcXG4gICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5sZW5ndGggPSAwO1xcbiAgICAgICAgICAgICAgc25hbWUuZm9yRWFjaCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgbWFuYWdlLmxpc3QucHVzaCh4KTtcXG4gICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIG1hbmFnZS5jaGFuZ2UoKTtcXG4gICAgICAgICAgICBzZXRJdGVtKFxcXCJuYXR1cmFsXFxcIiwgbmF0dXJhbCA/IFxcXCJcXFwiIDogXFxcIjFcXFwiKTtcXG4gICAgICAgICAgfSBlbHNlIGlmIChpID09IDMpIHtcXG4gICAgICAgICAgICBtYW5hZ2UubGlzdC5yZXZlcnNlKCk7XFxuICAgICAgICAgICAgbmFtZXMucmV2ZXJzZSgpO1xcbiAgICAgICAgICAgIG1hbmFnZS5jaGFuZ2UoKTtcXG4gICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBmdW5jdGlvbiBhcnJheURpZmZlcmVuY2UoYXJyMSwgYXJyMikge1xcbiAgICAgICAgICAgICAgY29uc3QgbWFwID0gbmV3IE1hcChhcnIyLm1hcChpdGVtID0+IFtpdGVtLmtleSwgaXRlbV0pKTtcXG4gICAgICAgICAgICAgIHJldHVybiBhcnIxLmZpbHRlcihpdGVtID0+ICFtYXAuaGFzKGl0ZW0ua2V5KSk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGxldCBydW50aW1lQ29uZmlnID0gR00uZGVmaW5lTW9kdWxlKFxcXCJydW50aW1lQ29uZmlnXFxcIiwgXFxcInJ1bnRpbWVDb25maWdcXFwiKTtcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IHJ1bnRpbWVDb25maWcuZ2V0QWxsU291cmNlKCk7XFxuICAgICAgICAgICAgbGV0IENrZXkgPSBydW50aW1lQ29uZmlnLmdldEN1cnJlbnRTb3VyY2UoKS5rZXk7XFxuICAgICAgICAgICAgLy9sb2coQ2tleSlcXG4gICAgICAgICAgICBsZXQgY2ZnID0gcnVudGltZUNvbmZpZy5nZXRDdXJyZW50Q29uZmlnKClcXG4gICAgICAgICAgICBsZXQge1xcbiAgICAgICAgICAgICAgcGF0aCxcXG4gICAgICAgICAgICAgIG5hbWVcXG4gICAgICAgICAgICB9ID0gY2ZnO1xcbiAgICAgICAgICAgIHJ1bnRpbWVDb25maWcuc2V0Q3VycmVudENvbmZpZyh7XFxuICAgICAgICAgICAgICBwYXRoLFxcbiAgICAgICAgICAgICAgbmFtZSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBydW50aW1lQ29uZmlnLnNldEN1cnJlbnRTb3VyY2UoQ2tleSk7XFxuICAgICAgICAgICAgbGV0IG5zb3VyY2VzID0gcnVudGltZUNvbmZpZy5nZXRBbGxTb3VyY2UoKTtcXG5cXG4gICAgICAgICAgICBsZXQgYWxpc3QgPSBhcnJheURpZmZlcmVuY2UobnNvdXJjZXMsIGxpc3QpO1xcbiAgICAgICAgICAgIGxldCBkbGlzdCA9IGFycmF5RGlmZmVyZW5jZShsaXN0LCBuc291cmNlcyk7XFxuXFxuICAgICAgICAgICAgaWYgKGFsaXN0Lmxlbmd0aCA+IDAgfHwgZGxpc3QubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgbGV0IG1zZyA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgaWYgKGFsaXN0Lmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICAgICAgYWxpc3QuZm9yRWFjaCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5wdXNoKHgubmFtZSk7XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIGxvZyhcXFwi5paw5aKeOlxcXCIgKyBhbGlzdC5tYXAoayA9PiBrLm5hbWUpLmpvaW4oXFxcIixcXFwiKSlcXG4gICAgICAgICAgICAgICAgbXNnICs9IFxcXCLmlrDlop5cXFwiICsgYWxpc3QubGVuZ3RoICsgXFxcIuS4qua6kFxcXCI7XFxuICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICBpZiAoZGxpc3QubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICBkbGlzdC5mb3JFYWNoKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0LnNwbGljZShtYW5hZ2UubGlzdC5pbmRleE9mKHgubmFtZSksIDEpO1xcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBsb2coXFxcIuenu+mZpDpcXFwiICsgZGxpc3QubWFwKGsgPT4gay5uYW1lKS5qb2luKFxcXCIsXFxcIikpXFxuICAgICAgICAgICAgICAgIG1zZyArPSBcXFwiIOenu+mZpFxcXCIgKyBkbGlzdC5sZW5ndGggKyBcXFwi5Liq5rqQXFxcIjtcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgIG1hbmFnZS5jaGFuZ2UoKTtcXG4gICAgICAgICAgICAgIHRvYXN0KG1zZyArIFxcXCIg5pu05aSa6K+m5oOF55yLbG9nXFxcIik7XFxuICAgICAgIC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IFxcXCLor7fpgInmi6lcXFwiLFxcbiAgICAgICAgY2xpY2socywgaSkge1xcbiAgICAgICAgICBpZiAoaSA9PT0gMCkge1xcbiAgICAgICAgICAgIHNwZW4gPSBzcGVuID09IDMgPyAxIDogMztcXG4gICAgICAgICAgICBtYW5hZ2UuY2hhbmdlQ29sdW1ucyhzcGVuKTtcXG4gICAgICAgICAgfSBlbHNlIGlmIChpID09PSAxKSB7XFxuICAgICAgICAgICAgaGlrZXJQb3AuaW5wdXRDb25maXJtKHtcXG4gICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXCLovpPlhaXlhbPplK7lrZcg56m65pi+56S65YWo6YOoXFxcIixcXG4gICAgICAgICAgICAgIHRpdGxlOiBcXFwi562b6YCJ5rqQXFxcIixcXG4gICAgICAgICAgICAgIGhpbnQ6IFxcXCLmupDlhbPplK7lrZcg5aSa5Liq55SofOmalOW8gFxcXCIsXFxuICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IHNlYXJjaEtleSxcXG4gICAgICAgICAgICAgIHRleHRhcmVhOiBmYWxzZSwgLy/lpJrooYzmqKHlvI9cXG4gICAgICAgICAgICAgIG1heFRleHRhcmVhOiB0cnVlLFxcbiAgICAgICAgICAgICAgbm9BdXRvU29mdDogZmFsc2UsXFxuICAgICAgICAgICAgICAvL2hpZGVDYW5jZWw6IHRydWUsXFxuICAgICAgICAgICAgICBjb25maXJtKHRleHQpIHtcXG4gICAgICAgICAgICAgICAgc2VhcmNoS2V5ID0gdGV4dDtcXG4gICAgICAgICAgICAgICAgbWFuYWdlLmxpc3QubGVuZ3RoID0gMDtcXG4gICAgICAgICAgICAgICAgZHluYW1pY1NvdXJjZS5sZW5ndGggPSAwO1xcbiAgICAgICAgICAgICAgICBpZiAodGV4dCkge1xcbiAgICAgICAgICAgICAgICAgIGNhblNlYXJjaFNvdXJjZS5mb3JFYWNoKCh2LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodGV4dC5zcGxpdCgvXFxcXHwvKS5maWx0ZXIoZiA9PiBmKS5zb21lKHggPT4gdi5uYW1lLmluY2x1ZGVzKHgpKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICBkeW5hbWljU291cmNlLnB1c2godik7XFxuICAgICAgICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0LnB1c2goc2VhcmNoQWxsb3cuaW5jbHVkZXModi5rZXkpID8gXFxcIuKAnOKAnOKAneKAnVxcXCIgKyAodi5uYW1lICsgXFxcIlxcXCIpLmZvbnRjb2xvcihcXFwiIzAwOTk2NlxcXCIpIDogdi5uYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgIGR5bmFtaWNTb3VyY2UgPSBjYW5TZWFyY2hTb3VyY2Uuc2xpY2UoKTtcXG4gICAgICAgICAgICAgICAgICBPYmplY3QuYXNzaWduKG1hbmFnZS5saXN0LCBnZXROYW1lcygpKTtcXG5cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgICAgICAgIC8vcmV0dXJuIFxcXCJ0b2FzdDovL+i+k+WFpeS6hlxcXCIgKyB0ZXh0O1xcbiAgICAgICAgICAgICAgfSxcXG5cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgfSBlbHNlIGlmIChpID09PSAyKSB7XFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBPYmplY3QuYXNzaWduKFtdLCBtYW5hZ2UubGlzdCk7XFxuICAgICAgICAgICAgbWFuYWdlLmxpc3QubGVuZ3RoID0gMDtcXG5cXG5cXG4gICAgICAgICAgICBkeW5hbWljU291cmNlLnNvcnQoKGEsIGIpID0+IHtcXG4gICAgICAgICAgICAgIHJldHVybiBTdHJpbmcoYS5uYW1lKS5sb2NhbGVDb21wYXJlKFN0cmluZyhiLm5hbWUpLCB1bmRlZmluZWQsIHtcXG4gICAgICAgICAgICAgICAgbnVtZXJpYzogdHJ1ZSxcXG4gICAgICAgICAgICAgICAgc2Vuc2l0aXZpdHk6ICdiYXNlJ1xcbiAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihtYW5hZ2UubGlzdCwgZ2V0TmFtZXMoKSk7XFxuICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcbiAgICAgICAgICB9IGVsc2UgaWYgKGkgPT0gMykge1xcbiAgICAgICAgICAgIG1hbmFnZS5saXN0LnJldmVyc2UoKTtcXG4gICAgICAgICAgICBkeW5hbWljU291cmNlLnJldmVyc2UoKTtcXG5cXG4gICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgIH0gZWxzZSBpZiAoaSA9PSA0KSB7XFxuICAgICAgICAgICAgZHluYW1pY1NvdXJjZS5mb3JFYWNoKHYgPT4ge1xcbiAgICAgICAgICAgICAgaWYgKCFzZWFyY2hBbGxvdy5pbmNsdWRlcyh2KSkge1xcbiAgICAgICAgICAgICAgICBzZWFyY2hBbGxvdy5wdXNoKHYua2V5KTtcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBPYmplY3QuYXNzaWduKG1hbmFnZS5saXN0LCBnZXROYW1lcygpKTtcXG4gICAgICAgICAgICBydW50aW1lQ29uZmlnLnNldFNlYXJjaEFsbG93KCk7XFxuICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcbiAgICAgICAgICB9IGVsc2UgaWYgKGkgPT0gNSkge1xcbiAgICAgICAgICAgIGxldCB0ZW1saXN0ID0gc2VhcmNoQWxsb3cuc2xpY2UoKTtcXG4gICAgICAgICAgICBzZWFyY2hBbGxvdy5sZW5ndGggPSAwO1xcbiAgICAgICAgICAgIGR5bmFtaWNTb3VyY2UuZm9yRWFjaCh2ID0+IHtcXG4gICA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Cc4oCd4oCdJyArIHQsXFxuICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKG8pID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGkgPSBvLmk7XFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKFxcXCJpc19kZWZcXFwiLCBcXFwiMVxcXCIpO1xcbiAgICAgICAgICAgICAgICBsZXQgY2F0ZV9vYmogPSBzdG9yYWdlMC5nZXRNeVZhcihcXFwiY2F0ZV9vYmpcXFwiLCB7fSk7XFxuXFxuICAgICAgICAgICAgICAgIGxldCBjYXRlX3RlbXAgPSBvLmNhdGVfdGVtcDtcXG4gICAgICAgICAgICAgICAgaWYgKGNhdGVfdGVtcC5jb25zdHJ1Y3RvciAhPSBBcnJheSkge1xcbiAgICAgICAgICAgICAgICAgIGNhdGVfdGVtcCA9IFtdO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGxldCBpbmRleCA9IG8uaW5kZXg7XFxuICAgICAgICAgICAgICAgIGxldCBjID0gY2F0ZV90ZW1wW2luZGV4XSB8fCBcXFwiLTFcXFwiO1xcbiAgICAgICAgICAgICAgICAvL2xvZyhjKVxcbiAgICAgICAgICAgICAgICBpZiAoYyA9PSBpKSB7XFxuICAgICAgICAgICAgICAgICAgby5jYXRlX3RlbXBbaW5kZXhdID0gXFxcIi0xXFxcIjtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICBvLmNhdGVfdGVtcFtpbmRleF0gPSBpICsgXFxcIlxcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgY2F0ZV9vYmpbby5jYXRlXSA9IGNhdGVfdGVtcDtcXG4gICAgICAgICAgICAgICAgLy9sb2coY2F0ZV90ZW1wKVxcbiAgICAgICAgICAgICAgICAvL3N0b3JhZ2UwLnB1dE15VmFyKFxcXCJjYXRlX3RlbXB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biAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBydWxlcztcXG4gICAgICAgICAgICBpZiAobW8gPT09IC0xKSB7XFxuICAgICAgICAgICAgICAgIHJ1bGVzID0gJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuZ2V0SnNvbigpO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobW8gPT09IC0yKSB7XFxuICAgICAgICAgICAgICAgIHJ1bGVzID0gJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuZ2V0VXNlZnVsSnNvbigpO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobW8gPT09IC0zKSB7XFxuICAgICAgICAgICAgICAgIHJ1bGVzID0gJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuZ2V0Rm9yYmlkZGVuSnNvbigpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJ1bGVzID0gJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuZ2V0SnNvbigpLmZpbHRlcigodiwgaSkgPT4gaW5kZXhzLmluY2x1ZGVzKGkpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcnVsZXMgPSBydWxlcy5tYXAoKHYpID0+IHtcXG4gICAgICAgICAgICAgICAgdi5mb3JiaWRkZW4gPSB1bmRlZmluZWQ7XFxuICAgICAgICAgICAgICAgIHJldHVybiB2O1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIHJldHVybiB1cChydWxlcyk7XFxuICAgICAgICB9LCBtbywgaW5kZXhzLCBpbmRleGNbMV0pO1xcblxcbiAgICB9LCBsZW5ndGgpLFxcbiAgICBjb2xfdHlwZTogXFxcImljb25fc21hbGxfNFxcXCIsXFxuICAgIHBpY191cmw6IFxcXCJoaWtlcjovL2ltYWdlcy9pY29uX3NoYXJlX2dyZWVuXFxcIlxcbn0pO1xcbmQucHVzaCh7XFxuICAgIHRpdGxlOiB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AgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB1ID0gc2hhcmVQYXN0ZShydWxlYjY0LCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8vXFxcIiArIGdldFBhc3MocnVsZS5uYW1lLCB1LCBcXFwiYlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LCBpbmRleCk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuenu+WKqFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoaW5kZXggKyBcXFwiXFxcIiwgXFxcIui+k+WFpeS9jee9rlxcXCIpLmlucHV0KChpbmRleCwgbGVuZ3RoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgbmV3SW5kZXggPSBOdW1iZXIoaW5wdXQpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKE51bWJlci5pc05hTihuZXdJbmRleCkgfHwgbmV3SW5kZXggPj0gbGVuZ3RoKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S4jeWSjOinhOeahOS9jee9rlxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZXMgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZSA9IHJ1bGVzLnNwbGljZShpbmRleCwgMSlbMF07XFxuICAgICAgICAgICAgICAgICAgICBydWxlcy5zcGxpY2UobmV3SW5kZXgsIDAsIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuc2F2ZUpzb24ocnVsZXMpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICB9LCBpbmRleCwgbGVuZ3RoKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi572u6aG2XFxcIikge1xcbiAgICAgICAgICAgICAgICBsZXQgbmV3SW5kZXggPSAwO1xcbiAgICAgICAgICAgICAgICBsZXQgcnVsZXMgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCk7XFxuICAgICAgICAgICAgICAgIGxldCBydWxlID0gcnVsZXMuc3BsaWNlKGluZGV4LCAxKVswXTtcXG4gICAgICAgICAgICAgICAgcnVsZXMuc3BsaWNlKG5ld0luZGV4LCAwLCBydWxlKTtcXG4gICAgICAgICAgICAgICAgJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuc2F2ZUpzb24ocnVsZXMpO1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuWIoOmZpFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIuehruiupOWIoOmZpO+8n1xcXCIpLmNvbmZpcm0oKGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZXMgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZSA9IHJ1bGVzLnNwbGljZShpbmRleCwgMSlbMF07XFxuICAgICAgICAgICAgICAgICAgICAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5zYXZlSnNvbihydWxlcyk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5bey5Yig6ZmkXFxcIiArIHJ1bGUubmFtZTtcXG4gICAgICAgICAgICAgICAgfSwgaW5kZXgpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGxldCBhcnIgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCk7XFxuICAgICAgICAgICAgICAgIGxldCBydWxlID0gYXJyW2luZGV4XTtcXG4gICAgICAgICAgICAgICAgcnVsZS5mb3JiaWRkZW4gPSAhcnVsZS5mb3JiaWRkZW47XFxuICAgICAgICAgICAgICAgICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLnNhdmVKc29uKGFycik7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgLy9yZXR1cm4gXFxcInRvYXN0Oi8vXFxcIiArIChydWxlLmZvcmJpZGRlbiA/IFxcXCLnpoHnlKhcXFwiIDogXFxcIuWQr+eUqFxcXCIpICsgcnVsZS5uYW1lO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIGksIGxlbmd0aCksXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGk6IGksXFxuICAgICAgICAgICAgcGFnZVRpdGxlOiBpdC5uYW1lXFxuICAgICAgICB9XFxuICAgIH0pO1xcbn1cXG5jb3VudFRpdGxlLnRpdGxlID0gJzxmb250IGNvbG9yPVxcXCIjMTNCNjFCXFxcIj7ilpAgPC9mb250PjxiPuino+aekOWIl+ihqDxiPiAoJyArICgoZC5sZW5ndGggLSBjb3VudCkgKyBcXFwiL1xcXCIgKyBsZW5ndGgpLmZvbnRjb2xvcihcXFwiI2ZmNjYwMVxcXCIpICsgXFxcIilcXFwiO1xcbnNldFJlc3VsdChkKTtcIixcImdyb3VwXCI6XCLlvIDlj5HkuK3lv4NcIixcInVhXCI6XCJtb2JpbGVcIixcInByZVJ1bGVcIjpcIi8qPCQ+XFxuQGluY2x1ZGUgc3RhcnRcX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AgICAgICAgICAgICAgICBDb29raWU6IFxcXFxcXFwiI25vQ29va2llI1xcXFxcXFwiXFxcXG4gICAgICAgICAgICB9LCBvYmouaGVhZGVycyk7XFxcXG4gICAgICAgICAgICBpZiAodXJsID09PSBcXFxcXFxcImh0dHBzOi8vYXBpLm5uLmNpL29jci9iNjQvdGV4dFxcXFxcXFwiICYmIG9iai5oZWFkZXJzKSB7XFxcXG4gICAgICAgICAgICAgICAgb2JqLmhlYWRlcnNbXFxcXFxcXCJDb250ZW50LVR5cGVcXFxcXFxcIl0gPSBcXFxcXFxcInRleHQvcGxhaW5cXFxcXFxcIjtcXFxcbiAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgaWYgKHVybC5zdGFydHNXaXRoKFxcXFxcXFwiZmlsZTovL1xcXFxcXFwiKSAmJiAodXJsLmluY2x1ZGVzKFxcXFxcXFwiP3R5cGU9XFxcXFxcXCIpIHx8IHVybC5pbmNsdWRlcyhcXFxcXFxcIj9wYXJhbXM9XFxcXFxcXCIpKSkge1xcXFxuICAgICAgICAgICAgICAgIHVybCA9IHVybC5zbGljZSgwLCB1cmwubGFzdEluZGV4T2YoXFxcXFxcXCI/XFxcXFxcXCIpKTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGZvciAobGV0IGtleSBpbiBvYmouaGVhZGVycykge1xcXFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2Ygb2JqLmhlYWRlcnNba2V5XSAhPT0gXFxcXFxcXCJzdHJpbmdcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgICAgICBvYmouaGVhZGVyc1trZXldID0gU3RyaW5nKG9iai5oZWFkZXJzW2tleV0pO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGxldCByID0gXFxcXFxcXCJcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgIC8qIGlmIChTdHJpbmcob2JqLm1ldGhvZCkudG9Mb3dlckNhc2UoKSA9PT0gXFxcXFxcXCJwb3N0XFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICAgciA9ICRwb3N0KHVybCwgb2JqKTtcXFxcbiAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICByID0gJHJlcXVlc3QodXJsLCBvYmopO1xcXFxuICAgICAgICAgICAgIH0qL1xcXFxuICAgICAgICAgICAgciA9ICRyZXF1ZXN0KHVybCwgb2JqKTtcXFxcbiAgICAgICAgICAgIGlmIChvYmoud2l0aEhlYWRlcnMpIHtcXFxcbiAgICAgICAgICAgICAgICByID0gSlNPTi5wYXJzZShyKTtcXFxcbiAgICAgICAgICAgICAgICByZXMuY29udGVudCA9IHIuYm9keTtcXFxcbiAgICAgICAgICAgICAgICByZXMuaGVhZGVycyA9IHt9O1xcXFxuICAgICAgICAgICAgICAgIGZvciAobGV0IFtrLCB2XSBvZiBPYmplY3QuZW50cmllcyhyLmhlYWRlcnMgfHwge30pKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJlcy5oZWFkZXJzW2tdID0gdlswXTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIHJlcy5jb250ZW50ID0gcjtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChvYmouYnVmZmVyID09PSAyKSB7XFxcXG4gICAgICAgICAgICAgICAgcmVzLmNvbnRlbnQgPSBDcnlwdG9VdGlsLkRhdGEucGFyc2VIZXgocmVzLmNvbnRlbnQpLnRvQmFzZTY0KF9iYXNlNjQuTk9fV1JBUCk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gcmVzO1xcXFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxcXG4gICAgICAgICAgICBsb2coXFxcXFxcXCJFcnJvclxcXFxcXFwiICsgZS50b1N0cmluZygpKTtcXFxcbiAgIC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LnNwbGl0KFxcXFxcXFwiJFxcXFxcXFwiKTtcXFxcbiAgICAgICAgbGV0IHQgPSBrWzBdO1xcXFxuICAgICAgICBsZXQgdWlkID0gKGtbMV18fGtbMF0pO1xcXFxuICAgICAgICByZXR1cm4ge1xcXFxuICAgICAgICAgIHRpdGxlOiBmb250c3R5bGUodCwge1xcXFxuICAgICAgICAgICAgdGFnczogXFxcXFxcXCJzbWFsbFxcXFxcXFwiXFxcXG4gICAgICAgICAgfSksXFxcXG4gICAgICAgICAgdXJsOiAgdWlkKyBcXFxcXFxcIiNcXFxcXFxcIiArIGZyb21baV0gKyBwbGF5TGF6eS5yZXBsYWNlKCdcXFxcXFxcImlkXFxcXFxcXCInLCAnXFxcXFxcXCInICt1aWQgKyAnXFxcXFxcXCInKSxcXFxcbiAgICAgICAgICBjb2xfdHlwZTogY29sLFxcXFxuICAgICAgICAgIGltZzogaW1nLFxcXFxuICAgICAgICAgIC8qZXh0cmE6IE9iamVjdC5hc3NpZ24oe30sIGV4dHJhLCB7XFxcXG4gICAgICAgICAgICBcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIjogZGVjb2RlVVJJQ29tcG9uZW50KGtbMV0pLFxcXFxuICAgICAgICAgICAgaWQ6IGtbMV0sXFxcXG4gICAgICAgICAgICAvL2xpbmVWaXNpYmxlOiBmYWxzZSxcXFxcbiAgICAgICAgICAgIHRleHRBbGlnbjogdGV4dGFsaWduLFxcXFxuICAgICAgICAgICAgY2xzOiBcXFxcXFxcInBsYXlsaXN0XFxcXFxcXCIsXFxcXG4gICAgICAgICAgfSkqL1xcXFxuICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICBpZDogdWlkLFxcXFxuICAgICAgICAgICAgYmxvY2tSdWxlczogWydiYi4qLnBuZycsICcuanBnJywgXFxcXFxcXCJobVxcXFxcXFxcLmJhaWR1XFxcXFxcXFwuY29tXFxcXFxcXFwvaG0uanNcXFxcXFxcIl0sXFxcXG4gICAgICAgICAgICB2aWR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FxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgd3JpdGVGaWxlKHBhdGgsIGdldFBhc3MocnVsZXMubGVuZ3RoLCBydWxlYjY0LCBcXFxcXFxcImFcXFxcXFxcIikpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJzaGFyZTovL1xcXFxcXFwiICsgcGF0aDtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBsZXQgcnVsZXM7XFxcXG4gICAgICAgICAgICBpZiAobW8gPT09IC0xKSB7XFxcXG4gICAgICAgICAgICAgICAgcnVsZXMgPSAkLnJlcXVpcmUoXFxcXFxcXCJjb25maWdzXFxcXFxcXCIpLmdldEpzb24oKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobW8gPT09IC0yKSB7XFxcXG4gICAgICAgICAgICAgICAgcnVsZXMgPSAkLnJlcXVpcmUoXFxcXFxcXCJjb25maWdzXFxcXFxcXCIpLmdldFVzZWZ1bEpzb24oKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobW8gPT09IC0zKSB7XFxcXG4gICAgICAgICAgICAgICAgcnVsZXMgPSAkLnJlcXVpcmUoXFxcXFxcXCJjb25maWdzXFxcXFxcXCIpLmdldEZvcmJpZGRlbkpzb24oKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgcnVsZXMgPSAkLnJlcXVpcmUoXFxcXFxcXCJjb25maWdzXFxcXFxcXCIpLmdldEpzb24oKS5maWx0ZXIoKHYsIGkpID0+IGluZGV4cy5pbmNsdWRlcyhpKSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBydWxlcyA9IHJ1bGVzLm1hcCgodikgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHYuZm9yYmlkZGVuID0gdW5kZWZpbmVkO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybi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JldHVybiBcXFxcXFxcImNvcHk6Ly9cXFxcXFxcIiArIGdldFBhc3MocnVsZS5uYW1lLCB1LCBcXFxcXFxcImJcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9LCBpbmRleCk7XFxcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFxcXFxcIuenu+WKqFxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoaW5kZXggKyBcXFxcXFxcIlxcXFxcXFwiLCBcXFxcXFxcIui+k+WFpeS9jee9rlxcXFxcXFwiKS5pbnB1dCgoaW5kZXgsIGxlbmd0aCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgbmV3SW5kZXggPSBOdW1iZXIoaW5wdXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoTnVtYmVyLmlzTmFOKG5ld0luZGV4KSB8fCBuZXdJbmRleCA+PSBsZW5ndGgpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5LiN5ZKM6KeE55qE5L2N572uXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gJC5yZXF1aXJlKFxcXFxcXFwiY29uZmlnc1xcXFxcXFwiKS5nZXRKc29uKCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBydWxlID0gcnVsZXMuc3BsaWNlKGluZGV4LCAxKVswXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcnVsZXMuc3BsaWNlKG5ld0luZGV4LCAwLCBydWxlKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgJC5yZXF1aXJlKFxcXFxcXFwiY29uZmlnc1xcXFxcXFwiKS5zYXZlSnNvbihydWxlcyk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXFxcbiAgICAgICAgICAgICAgICB9LCBpbmRleCwgbGVuZ3RoKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXFxcXFwi572u6aG2XFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgbmV3SW5kZXggPSAwO1xcXFxuICAgICAgICAgICAgICAgIGxldCBydWxlcyA9ICQucmVxdWlyZShcXFxcXFxcImNvbmZpZ3NcXFxcXFxcIikuZ2V0SnNvbigpO1xcXFxuICAgICAgICAgICAgICAgIGxldCBydWxlID0gcnVsZXMuc3BsaWNlKGluZGV4LCAxKVswXTtcXFxcbiAgICAgICAgICAgICAgICBydWxlcy5zcGxpY2UobmV3SW5kZXgsIDAsIHJ1bGUpO1xcXFxuICAgICAgICAgICAgICAgICQucmVxdWlyZShcXFxcXFxcImNvbmZpZ3NcXFxcXFxcIikuc2F2ZUpzb24ocnVsZXMpO1xcXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXFxcXFwi5Yig6ZmkXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gJChcXFxcXFxcIuehruiupOWIoOmZpO+8n1xcXFxcXFwiKS5jb25maXJtKChpbmRleCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZXMgPSAkLnJlcXVpcmUoXFxcXFxcXCJjb25maWdzXFxcXFxcXCIpLmdldEpzb24oKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJ1bGUgPSBydWxlcy5zcGxpY2UoaW5kZXgsIDEpWzBdO1xcXFxuICAgICAgICAgICAgICAgICAgICAkLnJlcXVpcmUoXFxcXFxcXCJjb25maWdzXFxcXFxcXCIpLnNhdmVKc29uKHJ1bGVzKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmV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Jwc19qc1xcXFxcXFwiLCBpbnB1dCk7XFxcXG4gICAgICAgIH0pLFxcXFxuICAgICAgICBkZWZhdWx0VmFsdWU6IG9iai5qcyxcXFxcbiAgICAgICAgdGl0bGVWaXNpYmxlOiBmYWxzZSxcXFxcbiAgICB9XFxcXG59KTtcXFxcbmQucHVzaCh7XFxcXG4gICAgY29sX3R5cGU6IFxcXFxcXFwibGluZV9ibGFua1xcXFxcXFwiXFxcXG59KTtcXFxcbmQucHVzaCh7XFxcXG4gICAgdGl0bGU6IFxcXFxcXFwi5Yig6ZmkXFxcXFxcXCIsXFxcXG4gICAgdXJsOiAkKFxcXFxcXFwiI25vTG9hZGluZyNcXFxcXFxcIikubGF6eVJ1bGUoKGluZGV4LCB1cmxJbmRleCkgPT4ge1xcXFxuICAgICAgICBpZiAoaW5kZXggPT09IHZvaWQoMCkpIHtcXFxcbiAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5q2k6aG55peg5rOV5Yig6ZmkXFxcXFxcXCI7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgaWYgKHVybEluZGV4ICE9PSB2b2lkKDApKSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+ato+WcqOabtOaWsOino+aekO+8jOWIoOmZpOivt+S7juino+aekOeuoeeQhui/m+WFpVxcXFxcXFwiO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGNvbmZpcm0oe1xcXFxuICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5rip6aao5o+Q56S6XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBjb250ZW50OiBcXFxcXFxcIuehruWumuimgeWIoOmZpOatpOino+aekOWQl++8n+azqOaEj+WIoOmZpOWQjuaXoOazleaBouWkjVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgY29uZmlybTogJC50b1N0cmluZygoaW5kZXgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgYXJyID0gJC5y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Jnor686XFxcXFxcXCIgKyBlLnRvU3RyaW5nKCk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuICQucmVxdWlyZShcXFxcXFxcInZpZGVvVXJsXFxcXFxcXCIpLnByZXBhcmVQYXJzZXMoW3tcXFxcbiAgICAgICAgICAgICAgICBuYW1lLFxcXFxuICAgICAgICAgICAgICAgIHVybCxcXFxcbiAgICAgICAgICAgICAgICBmbGFnLFxcXFxuICAgICAgICAgICAgICAgIGhlYWRlcnMsXFxcXG4gICAgICAgICAgICAgICAgcnVuVHlwZSxcXFxcbiAgICAgICAgICAgICAgICBtZXRob2QsXFxcXG4gICAgICAgICAgICAgICAganNvblBhdGgsXFxcXG4gICAgICAgICAgICAgICAganNcXFxcbiAgICAgICAgICAgIH1dLCBpbnB1dCxudWxsLCB0cnVlKTtcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgfSksXFxcXG4gICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF8zXFxcXFxcXCIsXFxcXG59KTtcXFxcblxcXFxuZC5wdXNoKHtcXFxcbiAgICB0aXRsZTogXFxcXFxcXCLkv53lrZhcXFxcXFxcIixcXFxcbiAgICB1cmw6ICQoXFxcXFxcXCIjbm9Mb2FkaW5nI1xcXFxcXFwiKS5sYXp5UnVsZSgoaW5kZXgsIGlzSW1wb3J0KSA9PiB7XFxcXG4gICAgICAgIGxldCBuYW1lID0gZ2V0TXlWYXIoXFxcXFxcXCJwc19uYW1lXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpLnRyaW0oKTtcXFxcbiAgICAgICAgaWYgKCFuYW1lKSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WQjeWtl+W+l+acieS4gOS4quWQp1xcXFxcXFwiO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGxldCB1cmwgPSBnZXRNeVZhcihcXFxcXFxcInBzX3Vyb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ZXRob2QsXFxcXG4gICAgICAgICAgICBqc29uUGF0aCxcXFxcbiAgICAgICAgICAgIGpzXFxcXG4gICAgICAgIH07XFxcXG4gICAgICAgIGlmIChpbmRleCA9PT0gdm9pZCgwKSkge1xcXFxuICAgICAgICAgICAgaWYgKGFyci5zb21lKHYgPT4gdi5uYW1lID09PSBuYW1lKSkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5bey57uP5a2Y5Zyo6K+l6Kej5p6QXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAob2JqMS5ncm91cCkge1xcXFxuICAgICAgICAgICAgICAgIGxldCBncm91cCA9IG9iajEuZ3JvdXA7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGluZGV4ID0gYXJyLmZpbmRJbmRleCh2ID0+IHYuZ3JvdXAgPT09IGdyb3VwKTtcXFxcbiAgICAgICAgICAgICAgICBpZiAoaW5kZXggPT09IC0xKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGFyci51bnNoaWZ0KG9iajEpO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGFyci5zcGxpY2UoaW5kZXgsIDAsIG9iajEpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgaWYgKGlzSW1wb3J0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGFyci5wdXNoKG9iajEpO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGFyci51bnNoaWZ0KG9iajEpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgIGxldCBuYW1leSA9IGFycltpbmRleF0ubmFtZTtcXFxcbiAgICAg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gb2YgYXJyKSB7XFxcXG4gICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICBpZiAoKFN0cmluZyhpdC5hcGkpLmluY2x1ZGVzKFxcXFxcXFwiZHJweTIubWluLmpzXFxcXFxcXCIpIHx8IFN0cmluZyhpdC5hcGkpLmluY2x1ZGVzKFxcXFxcXFwiZHJweTIuanNcXFxcXFxcIikpKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IG5hbWUgPSBpdC5leHQuZW5kc1dpdGgoXFxcXFxcXCIuanNcXFxcXFxcIikgPyBkZWNvZGVVUklDb21wb25lbnQoaXQuZXh0LnNwbGl0KFxcXFxcXFwiL1xcXFxcXFwiKS5hdCgtMSkpIDogKGl0Lm5hbWUgKyBcXFxcXFxcIi5qc1xcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgcnVsZTtcXFxcbiAgICAgICAgICAgICAgICBpZiAoU3RyaW5nKGl0LmV4dCkuc3RhcnRzV2l0aChcXFxcXFxcImh0dHBcXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcnVsZSA9IHJlcXVlc3QoaXQuZXh0KTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICBydWxlID0gcmVxdWVzdChqb2luVXJsKHVybCwgaXQuZXh0KSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGl0LmV4dCA9IFxcXFxcXFwiLi9cXFxcXFxcIiArIG5hbWU7XFxcXG4gICAgICAgICAgICAgICAgaWYgKCFydWxlIHx8ICFydWxlLmluY2x1ZGVzKFxcXFxcXFwicnVsZVxcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoIWZpbGVFeGlzdChwYXRoICsgbmFtZSkpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBhcnIuc3BsaWNlKGksIDEpO1xcXFxuICAgICAgICAgICAgICAgICAgICBjb250aW51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5KTtcXFxcbiAgICAgICAgICAgIGlmICghY3VycmVudFNvdXJjZSkge1xcXFxuICAgICAgICAgICAgICAgIGN1cnJlbnRTb3VyY2UgPSBzb3VyY2VMaXN0WzBdO1xcXFxuICAgICAgICAgICAgICAgIC8vY3VycmVudENvbmZpZy5jS2V5ID0gc291cmNlTGlzdFswXS5rZXk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBjdXJyZW50U291cmNlID0gc291cmNlTGlzdFswXTtcXFxcbiAgICAgICAgICAgIC8vY29uZmlnLmNLZXkgPSBzb3VyY2VMaXN0WzBdLmtleTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgc2VhcmNoQWxsb3cgPSBKU09OLnBhcnNlKGZldGNoKHNlYXJjaEFsbG93UGF0aCkgfHwgXFxcXFxcXCJbXVxcXFxcXFwiKTtcXFxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgZGVsZXRlRmlsZShzZWFyY2hBbGxvd1BhdGgpO1xcXFxuICAgICAgICAgICAgc2VhcmNoQWxsb3cgPSBbXTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICByZXR1cm4ge1xcXFxuICAgICAgICAgICAgY3VycmVudFNvdXJjZSxcXFxcbiAgICAgICAgICAgIHNlYXJjaEFsbG93LFxcXFxuICAgICAgICAgICAgc291cmNlTGlzdFxcXFxuICAgICAgICB9O1xcXFxuICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgbG9nKGUudG9TdHJpbmcoKSk7XFxcXG4gICAgfVxcXFxuICAgIHJldHVybiBudWxsO1xcXFxufVxcXFxuXFxcXG5mdW5jdGlvbiBnZW5lcmF0ZUNvbmZpZ0J5TG9jYWwoZGlyRmlsZSkge1xcXFxuICAgIGxldCBsaXN0ID0gZGlyRmlsZS5saXN0RmlsZXMoKTtcXFxcbiAgICBsZXQgcnV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XFxcbiAgICAgICAgaWYgKG9iai51cmwuc3RhcnRzV2l0aChcXFxcXFxcImZpbGU6XFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgbGV0IGNvZGUgPSBcXFxcXFxcIm5vXFxcXFxcXCI7XFxcXG4gICAgICAgICAgbGV0IHBhdGggPSBvYmoudXJsLnJlcGxhY2UoXFxcXFxcXCJmaWxlOi8vXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpO1xcXFxuICAgICAgICAgIGxldCBkaXIgPSBuZXcgamF2YS5pby5GaWxlKHBhdGgpO1xcXFxuICAgICAgICAgIGlmIChkaXIuaXNEaXJlY3RvcnkoKSkge1xcXFxuICAgICAgICAgICAgbGV0IGZsaXN0ID0gZGlyLmxpc3RGaWxlcygpO1xcXFxuICAgICAgICAgICAgZm9yICh2YXIgZiBvZiBmbGlzdCkge1xcXFxuICAgICAgICAgICAgICAvLyDmo4Dmn6Xmlofku7blkI3mmK/lkKbku6UuanPnu5PlsL5cXFxcbiAgICAgICAgICAgICAgaWYgKGYuaXNGaWxlKCkgJiYgZi5nZXROYW1lKCkudG9Mb3dlckNhc2UoKS5lbmRzV2l0aChcXFxcXFxcIi5qc1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgIGpzRmlsZXMucHVzaChmKTtcXFxcbiAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgIH1cXFxcbiAgICAgICAgICBpZiAoZGlyLmlzRmlsZSgpICYmIGZpbGVFeGlzdChvYmoudXJsKSkge1xcXFxuICAgICAgICAgICAgdHJ5IHtcXFxcbiAgICAgICAgICAgICAganNvbiA9IEpTT04ucGFyc2UocmVhZEZpbGUob2JqLnVybCkpO1xcXFxuICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShqc29uLnNpdGVzKSB8fCBqc29uLnNpdGVzLmxlbmd0aCkge1xcXFxuICAgICAgICAgICAgICAgIGNvdW50ID0gZmlsdGVyT3RoZXIoanNvbi5zaXRlcykubGVuZ3RoO1xcXFxuICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcXFxuICAgICAgICAgICAgY29kZSA9IFxcXFxcXFwib2tcXFxcXFxcIjtcXFxcbiAgICAgICAgICB9XFxcXG4gICAgICAgICAgaWYgKGpzRmlsZXMubGVuZ3RoID49IDUpIHtcXFxcbiAgICAgICAgICAgIGNvdW50ID0ganNGaWxlcy5sZW5ndGg7XFxcXG4gICAgICAgICAgICBjb2RlID0gXFxcXFxcXCJva1xcXFxcXFwiO1xcXFxuICAgICAgICAgIH1cXFxcbiAgICAgICAgICByZXR1cm4ge1xcXFxuICAgICAgICAgICAgdGltZTogKERhdGUubm93KCkgLSBzKSxcXFxcbiAgICAgICAgICAgIHVybDogb2JqLnVybCxcXFxcbiAgICAgICAgICAgIGNvdW50OiBjb3VudCxcXFxcbiAgICAgICAgICAgIGNvZGU6IGNvZGUsXFxcXG4gICAgICAgICAgICBpbmRleDogb2JqLmlcXFxcbiAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgdmFyIGogPSBKU09OLnBhcnNlKGZldGNoKG9iai51cmwsIHtcXFxcbiAgICAgICAgICB3aXRoSGVhZGVyczogdHJ1ZSxcXFxcbiAgICAgICAgICB0aW1lb3V0OiA1MDAwLFxcXFxuICAgICAgICB9KSk7XFxcXG4gICAgICAgIGxldCBlID0gRGF0ZS5ub3coKTtcXFxcbiAgICAgICAgbGV0IGMgPSBlIC0gcztcXFxcbiAgICAgICAgaWYgKG9iai51cmwuaW5jbHVkZXMoXFxcXFxcXCJnaXRodWIuY29tXFxcXFxcXCIpICYmIGouc3RhdHVzQ29kZSA9PSAyMDApIHtcXFxcbiAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgdmFyIGh0bWwgPSBqLmJvZHk7XFxcXG4gICAgICAgICAgICB2YXIganNvbiA9IEpTT04ucGFyc2UocGRmaChodG1sLCBcXFxcXFxcIiNyZXBvLWNvbnRlbnQtcGpheC1jb250YWluZXImJnNjcmlwdCYmSHRtbFxcXFxcXFwiKSk7XFxcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IGpzb24ucGF5bG9hZC50cmVlLml0ZW1zO1xcXFxuICAgICAgICAgICAgY291bnQgPSBsaXN0LmZpbHRlcih4ID0+IHgubmFtZS5lbmRzV2l0aChcXFxcXFxcIi5qc1xcXFxcXFwiKSkubGVuZ3RoO1xcXFxuICAgICAgICAgIH0gY2F0Y2gge31cXFxcbiAgICAgICAgfVxcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZSh0b0NvcnJlY3RKU09OU3RyaW5nKGouYm9keSkgfHwgXFxcXFxcXCJ7fVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShqc29uLnNpdGVzKSB8fCBqc29uLnNpdGVzLmxlbmd0aCkge1xcXFxuICAgICAgICAgICAgY291bnQgPSBmaWx0ZXJPdGhlcihqc29uLnNpdGVzKS5sZW5ndGg7XFxcXG4gICAgICAgICAgfVxcXFxuICAgICAgICB9IGNhdGNoIChlKSB7fVxcXFxuXFxcXG4gICAgICAgIHJldHVybiB7XFxcXG4gICAgICAgICAgdGltZTogYyxcXFxcbiAgICAgICAgICB1cmw6IGoudXJsLFxcXFxuICAgICAgICAgIGNvdW50OiBjb3VudCxcXFxcbiAgICAgICAgICBjb2RlOiBqLnN0YXR1c0NvZGUsXFxcXG4gICAgICAgICAgaW5kZXg6IG9iai5pLFxcXFxuICAgICAgICB9XFxcXG4gICAgICB9O1xcXFxuICAgICAgbGV0IHRhc2tzID0gbGlzdC5tYXAoKHgsIGkpID0+IHtcXFxcbiAgICAgICAgaSA9IGkgKyAxO1xcXFxuICAgICAgICByZXR1cm4ge1xcXFxuICAgICAgICAgIGZ1bmM6IHRhc2ssXFxcXG4gICAgICAgICAgcGFyYW06IHtcXFxcbiAgICAgICAgICA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ZetXFxcXFxcXCIgOiBcXFxcXFxcIuWQr+eUqFxcXFxcXFwiKSwgXFxcXFxcXCLlgJLluo9cXFxcXFxcIiwgXFxcXFxcXCLliLfmlrDphY3nva5cXFxcXFxcIl0sXFxcXG4gICAgICAgIGNvbHVtbnM6IDIsXFxcXG4gICAgICAgIHRpdGxlOiBcXFxcXFxcIuivt+mAieaLqVxcXFxcXFwiLFxcXFxuICAgICAgICBjbGljayhzLCBpKSB7XFxcXG4gICAgICAgICAgaWYgKGkgPT09IDApIHtcXFxcbiAgICAgICAgICAgIHNwZW4gPSBzcGVuID09IDMgPyAxIDogMztcXFxcbiAgICAgICAgICAgIG1hbmFnZS5jaGFuZ2VDb2x1bW5zKHNwZW4pO1xcXFxuICAgICAgICAgIH0gZWxzZSBpZiAoaSA9PT0gMSkge1xcXFxuICAgICAgICAgICAgaGlrZXJQb3AuaW5wdXRDb25maXJtKHtcXFxcbiAgICAgICAgICAgICAgY29udGVudDogXFxcXFxcXCLovpPlhaXlhbPplK7lrZcg56m65pi+56S65YWo6YOoXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuetm+mAiea6kFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICBoaW50OiBcXFxcXFxcIua6kOWFs+mUruWtl1xcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IHNlYXJjaEtleSxcXFxcbiAgICAgICAgICAgICAgdGV4dGFyZWE6IGZhbHNlLCAvL+WkmuihjOaooeW8j1xcXFxuICAgICAgICAgICAgICBtYXhUZXh0YXJlYTogdHJ1ZSxcXFxcbiAgICAgICAgICAgICAgbm9BdXRvU29mdDogZmFsc2UsXFxcXG4gICAgICAgICAgICAgIC8vaGlkZUNhbmNlbDogdHJ1ZSxcXFxcbiAgICAgICAgICAgICAgY29uZmlybSh0ZXh0KSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bnRpbWVDb25maWcgPSBHTS5kZ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ydW50aW1lQ29uZmlnID0gR00uZGVmaW5lTW9kdWxlKFxcXFxcXFwicnVudGltZUNvbmZpZ1xcXFxcXFwiLCBcXFxcXFxcInJ1bnRpbWVDb25maWdcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IHJ1bnRpbWVDb25maWcuZ2V0QWxsU291cmNlKCk7XFxcXG4gICAgICAgICAgICBsZXQgQ2tleSA9IHJ1bnRpbWVDb25maWcuZ2V0Q3VycmVudFNvdXJjZSgpLmtleTtcXFxcbiAgICAgICAgICAgIC8vbG9nKENrZXkpXFxcXG4gICAgICAgICAgICBsZXQgY2ZnID0gcnVudGltZUNvbmZpZy5nZXRDdXJyZW50Q29uZmlnKClcXFxcbiAgICAgICAgICAgIGxldCB7XFxcXG4gICAgICAgICAgICAgIHBhdGgsXFxcXG4gICAgICAgICAgICAgIG5hbWVcXFxcbiAgICAgICAgICAgIH0gPSBjZmc7XFxcXG4gICAgICAgICAgICBydW50aW1lQ29uZmlnLnNldEN1cnJlbnRDb25maWcoe1xcXFxuICAgICAgICAgICAgICBwYXRoLFxcXFxuICAgICAgICAgICAgICBuYW1lLFxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICBydW50aW1lQ29uZmlnLnNldEN1cnJlbnRTb3VyY2UoQ2tleSk7XFxcXG4gICAgICAgICAgICBsZXQgbnNvdXJjZXMgPSBydW50aW1lQ29uZmlnLmdldEFsbFNvdXJjZSgpO1xcXFxuXFxcXG4gICAgICAgICAgICBsZXQgYWxpc3QgPSBhcnJheURpZmZlcmVuY2UobnNvdXJjZXMsIGxpc3QpO1xcXFxuICAgICAgICAgICAgbGV0IGRsaXN0ID0gYXJyYXlEaWZmZXJlbmNlKGxpc3QsIG5zb3VyY2VzKTtcXFxcblxcXFxuICAgICAgICAgICAgaWYgKGFsaXN0Lmxlbmd0aCA+IDAgfHwgZGxpc3QubGVuZ3RoID4gMCkge1xcXFxuICAgICAgICAgICAgICBsZXQgbXNnID0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biAgICAgICAgICAgICAgICBzZWFyY2hLZXkgPSB0ZXh0O1xcXFxuICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0Lmxlbmd0aCA9IDA7XFxcXG4gICAgICAgICAgICAgICAgZHluYW1pY1NvdXJjZS5sZW5ndGggPSAwO1xcXFxuICAgICAgICAgICAgICAgIGlmICh0ZXh0KSB7XFxcXG4gICAgICAgICAgICAgICAgICBjYW5TZWFyY2hTb3VyY2UuZm9yRWFjaCgodiwgaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAodGV4dC5zcGxpdCgvXFxcXFxcXFx8LykuZmlsdGVyKGYgPT4gZikuc29tZSh4ID0+IHYubmFtZS5pbmNsdWRlcyh4KSkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICBkeW5hbWljU291cmNlLnB1c2godik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgbWFuYWdlLmxpc3QucHVzaChzZWFyY2hBbGxvdy5pbmNsdWRlcyh2LmtleSkgPyBcXFxcXFxcIuKAnOKAnOKAneKAnVxcXFxcXFwiICsgKHYubmFtZSArIFxcXFxcXFwiXFxcXFxcXCIpLmZvbnRjb2xvcihcXFxcXFxcIiMwMDk5NjZcXFxcXFxcIikgOiB2Lm5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICBkeW5hbWljU291cmNlID0gY2FuU2VhcmNoU291cmNlLnNsaWNlKCk7XFxcXG4gICAgICAgICAgICAgICAgICBPYmplY3QuYXNzaWduKG1hbmFnZS5saXN0LCBnZXROYW1lcygpKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxcXG4gICAgICAgICAgICAgICAgLy9yZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+i+k+WFpeS6hlxcXFxcXFwiICsgdGV4dDtcXFxcbiAgICAgICAgICAgICAgfSxcXFxcblxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgfSBlbHNlIGlmIChpID09PSAyKSB7XFxcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IE9iamVjdC5hc3NpZ24oW10sIG1hbmFnZS5saXN0KTtcXFxcbiAgICAgICAgICAgIG1hbmFnZS5saXN0Lmxlbmd0aCA9IDA7XFxcXG5cXFxcblxcXFxuICAgICAgICAgICAgZHluYW1pY1NvdXJjZS5zb3J0KChhLCBiKSA9PiB7XFxcXG4gICAgICAgICAgICAgIHJldHVybiBTdHJpbmcoYS5uYW1lKS5sb2NhbGVDb21wYXJlKFN0cmluZyhiLm5hbWUpLCB1bmRlZmluZWQsIHtcXFxcbiAgICAgICAgICAgICAgICBudW1lcmljOiB0cnVlLFxcXFxuICAgICAgICAgICAgICAgIHNlbnNpdGl2aXR5OiAnYmFzZSdcXFxcbiAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIE9iamVjdC5hc3NpZ24obWFuYWdlLmxpc3QsIGdldE5hbWVzKCkpO1xcXFxuICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcXFxuICAgICAgICAgIH0gZWxzZSBpZiAoaSA9PSAzKSB7XFxcXG4gICAgICAgICAgICBtYW5hZ2UubGlzdC5yZXZlcnNlKCk7XFxcXG4gICAgICAgICAgICBkeW5hbWljU291cmNlLnJldmVyc2UoKTtcXFxcblxcXFxuICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcXFxuICAgICAgICAgIH0gZWxzZSBpZiAoaSA9PSA0KSB7XFxcXG4gICAgICAgICAgICBkeW5hbWljU291cmNlLmZvckVhY2godiA9PiB7XFxcXG4gICAgICAgICAgICAgIGlmICghc2VhcmNoQWxsb3cuaW5jbHVkZXModikpIHtcXFxcbiAgICAgICAgICAgICAgICBzZWFyY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GV4O1xcXFxuICAgICAgICAgICAgICAgIGxldCBjID0gY2F0ZV90ZW1wW2luZGV4XSB8fCBcXFxcXFxcIi0xXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgLy9sb2coYylcXFxcbiAgICAgICAgICAgICAgICBpZiAoYyA9PSBpKSB7XFxcXG4gICAgICAgICAgICAgICAgICBvLmNhdGVfdGVtcFtpbmRleF0gPSBcXFxcXFxcIi0xXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgIG8uY2F0ZV90ZW1wW2luZGV4XSA9IGkgKyBcXFxcXFxcIlxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBjYXRlX29ialtvLmNhdGVdID0gY2F0ZV90ZW1wO1xcXFxuICAgICAgICAgICAgICAgIC8vbG9nKGNhdGVfdGVtcClcXFxcbiAgICAgICAgICAgICAgICAvL3N0b3JhZ2UwLnB1dE15VmFyKFxcXFxcXFwiY2F0ZV90ZW1wXFxcXFxcXCIsIGNhdGVfdGVtcCk7XFxcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoXFxcXFxcXCJjYXRlX29ialxcXFxcXFwiLCBjYXRlX29iaik7XFxcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICBpbmRleDogaW5kZXgsXFxcXG4gICAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxcXG4gICAgICAgICAgICAgICAgaTogaSxcXFxcbiAgICAgICAgICAgICAgICBjYXRlOiBjYXRlXFxcXG4gICAgICAgICAgICAgIH0pLFxcXFxuICAgICAgICAgICAgICBjb2xfdHlwZTog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