Advertisement
xiaomianao666

邀您一起看:闪电侠〖4k〗最新版@

Jul 17th, 2023
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥闪电侠〖4k〗最新版@@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuinhOWImeWIl+ihqFwiLFwicGF0aFwiOlwiZGF0YVwiLFwicnVsZVwiOlwidmFyIHdyYXB1ID0gKHUpID0+IHtcXG4gICAgaWYgKC9hbGl5dW5kcml2ZS8udGVzdCh1KSkge1xcbiAgICAgICAgaWYgKGNvbmZpZy5tb2RlID09IFxcXCLmnKzlnLDovaznoIFcXFwiKSB7XFxuICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL3BhZ2UvYWxpeXVuP3BhZ2U9ZnlwYWdlJnJlYWx1cmw9JyArIGVuY29kZVVSSUNvbXBvbmVudCh1KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgY29uc3QgW2xpbmssIF9zaGFyZV9wd2RdID0gdS5zcGxpdCgnP3NoYXJlX3B3ZD0nKTtcXG4gICAgICAgICAgICBjb25zdCBbX2xpbmssIF9mb2xkZXJJRF0gPSBsaW5rLnNwbGl0KCcvZm9sZGVyLycpO1xcbiAgICAgICA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m9keToge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcInNoYXJlX2lkXFxcIjogc2hhcmVJZFxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGlmIChzaGFyZS5pbmNsdWRlcyhcXFwic2hhcmVfbGluayBpc1xcXCIpIHx8IHNoYXJlLmluY2x1ZGVzKFxcXCJzaGFyZV9saW5rIGNhbm5vdFxcXCIpKSByZXR1cm4gZmFsc2U7XFxuICAgICAgICB9XFxuICAgIH0gY2F0Y2ggKGUpIHt9XFxuICAgIHJldHVybiB0cnVlO1xcbn1cXG5cXG5sZXQgcnVsZXMgPSBbe1xcbiAgICAgICAgbmFtZTogXFxcIuS6keebmOi1hOa6kFxcXCIsXFxuICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFwiaHR0cHM6Ly9yZXMueXVucGFuLndpbi8/UGFnZUluZGV4PVxcXCIgKyBwYWdlICsgXFxcIiZQYWdlU2l6ZT0xMiZLZXl3b3JkPVxcXCIgKyBzICsgXFxcIiZUeXBlPSZUYWc9XFxcIjtcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QodXJsLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8vcmVzLnl1bnBhbi53aW4vXFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgbGV0IGFyciA9IHBkZmEoaHRtbCwgXFxcIm1haW4mJi5jYXJkXFxcIik7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICA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ICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sIHtcXG4gICAgICAgIG5hbWU6IFxcXCJVUOS6keaQnFxcXCIsXFxuICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFwiaHR0cHM6Ly9hcGkudXB5dW5zbzIuY29tL3NlYXJjaD9rZXl3b3JkPVxcXCIgKyBzICsgXFxcIiZwYWdlPVxcXCIgKyBwYWdlICsgXFxcIiZzX3R5cGU9MVxcXCI7XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KHVybCwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiUmVmZXJlclxcXCI6IFxcXCJodHRwczovL3d3dy51cHl1bnNvLmNvbVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBcXFwiQ29va2llXFxcIjogXFxcImNvZGU9MTkxOVxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIC8vbG9nKGJhc2U2NERlY29kZShodG1sKSk7XFxuICAgICAgICAgICAgbGV0IGFyciA9IEpTT04ucGFyc2UoYmFzZTY0RGVjb2RlKGh0bWwpKS5yZXN1bHQuaXRlbXM7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBpdC5wYWdlX3VybDtcXG4gICAgICAgICAgICAgICAgLy91ID0gdS5sZW5ndGggPiAwID8gdVswXSA6IHVybDtcXG4gICAgICAgICAgICAgICAgaWYgKCF1LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0LnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgLy91cmw6ICdoaWtlcjovL3BhZ2UvZGV0YWlsP3J1bGU95LqR55uY5rGH5b2xJnVybD0nICsgdSArICc/P2Z5cGFnZScsXFxuICAgICAgICAgICAgICAgICAgICAvL3VybDogJ2hpa2VyOi8vcGFnZS9wdXNoP3VybD1oaWtlcjovL2VtcHR5IyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KHUpICsgJz8/P2Z5cGFnZScsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHdyYXB1KHUpLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIuKAnOKAnOKAneKAnTxmb250IGNvbG9yPSNmMTNiNjZhPlVQ5LqR5pCcPC9mb250PiZuYnNwO1xcXCIgKyBcXFwiXFxcXG5cXFwiICsgKHUpLFxcbiAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sIHtcXG4gICAgICAgIG5hbWU6IFxcXCLnjKvni7jnm5jmkJxcXFwiLFxcbiAgICAgICAgcGFnZTogZmFsc2UsXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KFxcXCJodHRwczovL3d3dy5hbGlwYW5zb3UuY29tL3NlYXJjaD9rPVxcXCIgKyBzLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8vd3d3LmFsaXBhbnNvdS5jb20vc2VhcmNoP2s9XFxcIiArIHNcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBwZGZhKGh0bWwsIFxcXCIjYXBwJiZhXFxcIik7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IFxcXCI8ZGl2PlxcXCIgKyBhcnJbaV0gKyBcXFwiPC9kaXY+XFxcIjtcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBwZGZoKGl0LCBcXFwiYSYmaHJlZlxcXCIpO1xcbiAgICAgICAgICAgICAgICAvL2xvZyh1KTtcXG4gICAgICAgICAgICAgICAgaWYgKCF1LmluY2x1ZGVzKFxcXCIvcy9cXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdSA9IFxcXCJodHRwczovL3d3dy5hbGlwYW5zb3UuY29tXFxcIiArIHUucmVwbGFjZShcXFwiL3MvXFxcIiwgXFxcIi9jdi9cXFwiKTtcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwZGZoKGl0LCBcXFwidGVtcGxhdGUmJlRleHRcXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJCh1KS5sYXp5UnVsZSgod3JhcHUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoaW5wdXQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcIkNvb2tpZVxcXCI6IFxcXCJub19zaG93X2RvbmF0ZT0xXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogaW5wdXQucmVwbGFjZShcXFwiL2N2L1xcXCIsIFxcXCIvcy9cXFwiKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWRpcmVjdDogZmFsc2VcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBodG1sID0gcGFyc2VEb21Gb3JIdG1sKGh0bWwsICdhJiZocmVmJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgLy92YXIgX2xpbmtzID0gaHRtbC5tYXRjaCgvaHR0cHM6XFxcXC9cXFxcLyh3d3dcXFxcLmFsaXl1bmRyaXZlXFxcXC5jb21cXFxcL3N8YWx5d3BcXFxcLm5ldClcXFxcL1xcXFx3Ki9nKSB8fCBbXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhfbGlua3MpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChodG1sLmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9yZXR1cm4gJ2hpa2VyOi8vcGFnZS9kZXRhaWw/cnVsZT3kupHnm5jmsYflvbEmdXJsPScgKyBfbGlua3NbMF0gKyAnPz9meXBhZ2UnO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3JldHVybiAnaGlrZXI6Ly9wYWdlL3B1c2g/dXJsPWhpa2VyOi8vZW1wdHkjIycgKyBlbmNvZGVVUklDb21wb25lbnQoaHRtbCkgKyAnPz8/ZnlwYWdlJztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdyYXB1KGh0bWwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpbnB1dDtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9LCB3cmFwdSksXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFwi4oCc4oCc4oCd4oCdPGZvbnQgY29sb3I9I2YxM2I2NmE+54yr54u455uY5pCcPC9mb250PiZuYnNwO1xcXCIgKyBwZGZoKGl0LCBcXFwidGVtcGxhdGUsMSYmVGV4dFxcXCIpLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sIHtcXG4gICAgICAgIG5hbWU6IFxcXCLmmJPmkJxcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBldmFsKGdldENyeXB0b0pTKCkpO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGtleWVuKHN0cikge1xcbiAgICAgICAgICAgICAgICB2YXIga2V5ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoXFxcIjRPVG9TY1VGT2FlVlRySEVcXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgIGl2ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoXFxcIjlDTEdhbzF2SEtxbTE3T3pcXFwiKTtcXG4gICAgICAgICAgICAgICAgdmFyIGVuY3J5cHRlZCA9IENyeXB0b0pTLkFFUy5kZWNyeXB0KHtcXG4gICAgICAgICAgICAgICAgICAgIGNpcGhlcnRleHQ6IENyeXB0b0pTLmVuYy5CYXNlNjQucGFyc2Uoc3RyKVxcbiAgICAgICAgICAgICAgICB9LCBrZXksIHtcXG4gICAgICAgICAgICAgICAgICAgIGl2OiBpdixcXG4gICAgICAgICAgICAgICAgICAgIG1vZGU6IENyeXB0b0pTLm1vZGUuQ0JDLFxcbiAgICAgICAgICAgICAgICAgICAgcGFkZGluZzogQ3J5cHRvSlMucGFkLlBrY3M3XFxuICAgICAgICAgICAgICAgIH0pLnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVuY3J5cHRlZDtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KFxcXCJodHRwczovL3lpc28uZnVuL2FwaS9zZWFyY2g/bmFtZT1cXFwiICsgcyArIFxcXCImcGFnZU5vPVxcXCIgKyBwYWdlLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8veWlzby5mdW4vaW5mbz9zZWFyY2hLZXk9XFxcIiArIHMsXFxuICAgICAgICAgICAgICAgICAgICBcXFwiQ29va2llXFxcIjogZ2V0SXRlbSgneWlzb3Vjb29rZScsICcnKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgLy9sb2coaHRtbCk7XFxuICAgICAgICAgICAgaWYgKGh0bWwuaW5jbHVkZXMoJ+eZu+W9leeUqOaIt+aXoOmZkOWIticpKSB7XFxuICAgICAgICAgICAgICAgIHZhciBpID0gMDtcXG4gICAgICAgICAgICAgICAgZG8ge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHR5aW1nbGluID0gJ2h0dHBzOi8veWlzby5mdW4vYXBpL3VzZXIvbG9naW4vY2FwdGNoYT90PScgKyBwYXJzZUludChuZXcgRGF0ZSgpLmdldFRpbWUoKSkgKyAnJztcXG4gICAgICAgICAgICAgICAgICAgIGxldCBpbWcgPSBjb252ZXJ0QmFzZTY0SW1hZ2UodHlpbWdsaW4pLnNwbGl0KCcsJylbMV07XFxuICAgICAgICAgICAgICAgICAgICBsZXQgY29kID0gcmVxdWVzdCgnaHR0cHM6Ly9hcGkueGhvZmUudG9wL29jci9iNjQvdGV4dCcsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDb250ZW50LVR5cGUnOiAndGV4dC9wbGFpbidcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IGltZyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgdmVyID0gSlNPTi5wYXJzZShyZXF1ZXN0KCdodHRwczovL3lpc28uZnVuL2FwaS91c2VyL2xvZ2luJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbnRlbnQtdHlwZSc6ICdhcHBsaWNhdGlvbi9qc29uJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3JlZmVyZXInOiAnaHR0cHM6Ly95aXNvLmZ1bi9sb2dpbicsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDb29raWUnOiBnZXRDb29raWUodHlpbWdsaW4pXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBib2R5OiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJ1c2VyTmFtZVxcXCI6IFxcXCJ0dmJveDIwMjNcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwicGFzc3dvcmRcXFwiOiBcXFwiVHZib3gyMDIzXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcImNvZGVcXFwiOiBjb2RcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnXFxuICAgICAgICAgICAgICAgICAgICB9KSk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodmVyLmNvZGUgPT0gMjAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9nKCfmmJPmkJznmbvlhaXpqozor4HmiJDlip8nKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKCd5aXNvdWNvb2tlJywgZ2V0Q29va2llKCdodHRwczovL3lpc28uZnVuJykpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWwgPSByZXF1ZXN0KFxcXCJodHRwczovL3lpc28uZnVuL2FwaS9zZWFyY2g/bmFtZT1cXFwiICsgcyArIFxcXCImcGFnZU5vPVxcXCIgKyBwYWdlLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8veWlzby5mdW4vaW5mbz9zZWFyY2hLZXk9XFxcIiArIHMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwiQ29va2llXFxcIjogZ2V0SXRlbSgneWlzb3Vjb29rZScsICcnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBpKys7XFxuICAgICAgICAgICAgICAgIH0gd2hpbGUgKGkgPCA0KTtcXG5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGFyciA9IEpTT04ucGFyc2UoaHRtbCkuZGF0YS5saXN0O1xcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1ID0ga2V5ZW4oaXQudXJsKTtcXG4gICAgICAgICAgICAgICAgLy9sb2codSk7XFxuICAgICAgICAgICAgICAgIGlmICh1ID09IG51bGwgfHwgIXUuaW5jbHVkZXMoXFxcImFsaXl1blxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgaXQubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL2RldGFpbD9ydWxlPeS6keebmOaxh+W9sSZ1cmw9JyArIHUgKyAnPz9meXBhZ2UnLFxcbiAgICAgICAgICAgICAgICAgICAgLy91cmw6ICdoaWtlcjovL3BhZ2UvcHVzaD91cmw9aGlrZXI6Ly9lbXB0eSMjJyArIGVuY29kZVVSSUNvbXBvbmVudCh1KSArICc/Pz9meXBhZ2UnLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB3cmFwdSh1KSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCLigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT7mmJPmkJw8L2ZvbnQ+Jm5ic3A7XFxcIiArIChpdC5nbXRTaGFyZSB8fCBpdC5nbXRDcmVhdGUpICsgXFxcIlxcXFxuXFxcIiArICh1KSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBkO1xcbiAgICAgICAgfVxcbiAgICB9LCB7XFxuICAgICAgICBuYW1lOiBcXFwi5om+6LWE5rqQXFxcIixcXG4gICAgICAgIHBhZ2U6IHRydWUsXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxuICAgICAgICAgICAgZnVuY3Rpb24gZ2V0aHRtbCgpIHtcXG4gICAgICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KFxcXCJodHRwczovL3poYW96aXl1YW4ubGEvc28/ZmlsZW5hbWU9XFxcIiArIHMgKyBcXFwiJnBhZ2U9XFxcIiArIHBhZ2UsIHtcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwiUmVmZXJlclxcXCI6IFxcXCJodHRwczovL3poYW96aXl1YW4ubGEvc3RvcC5odG1sXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwib3JpZ2luXFxcIjogXFxcImh0dHBzOi8vemhhb3ppeXVhbi5sYVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcIkNvb2tpZVxcXCI6IGdldEl0ZW0oXFxcInp6eWNvb2tlXFxcIiwgXFxcIlxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJ1cGdyYWRlLWluc2VjdXJlLXJlcXVlc3RzXFxcIjogXFxcIjFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJjb250ZW50LXR5cGVcXFwiOiBcXFwiYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGh0bWw7XFxuICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICB2YXIgaHRtbCA9IGdldGh0bWwoKTtcXG4gICAgICAgICAgICBpZiAoIWh0bWwuaW5jbHVkZXMoXFxcInNlYXJjaF9ib3hcXFwiKSkge1xcbiAgICAgICAgICAgICAgICBsZXQgdXNlciA9ICdkWE5sY201aGJXVTllWEJxTWpBeU15WndZWE56ZDI5eVpEMTVjR295TURJeic7XFxuICAgICAgICAgICAgICAgIGxldCBjb29rID0gSlNPTi5wYXJzZShmZXRjaENvb2tpZSgnaHR0cHM6Ly96aGFveml5dWFuLmxhL2xvZ2l1Lmh0bWwnLCB7XFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiBNT0JJTEVfVUEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ0NvbnRlbnQtVHlwZSc6ICdhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdPcmlnaW4nOiAnaHR0cHM6Ly96aGFveml5dWFuLmxhJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3poYW96aXl1YW4ubGEvbG9naW4uaHRtbCcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcInVwZ3JhZGUtaW5zZWN1cmUtcmVxdWVzdHNcXFwiOiBcXFwiMVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICBib2R5OiBiYXNlNjREZWNvZGUodXNlciksXFxuICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcXG4gICAgICAgICAgICAgICAgICAgIG9ubHlIZWFkZXJzOiB0cnVlLFxcbiAgICAgICAgICAgICAgICAgICAgd2l0aEhlYWRlcnM6IHRydWVcXG4gICAgICAgICAgICAgICAgfSkpLmpvaW4oJzsnKTtcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFwienp5Y29va2VcXFwiLCBjb29rKTtcXG4gICAgICAgICAgICAgICAgbG9nKFxcXCLmib7otYTmupDnmbvlhaVcXFwiKTtcXG4gICAgICAgICAgICAgICAgaHRtbCA9IGdldGh0bWwoKTtcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgbGV0IGFyciA9IHBkZmEoaHRtbCwgXFxcImJvZHkmJi5uZXdzTGlzdCYmbGk6bm90KDpmaXJzdC1jaGlsZClcXFwiKTtcXG4gICAgICAgICAgICAvL2xvZyhhcnIpO1xcbiAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBkZmgoaXQsIFxcXCJhJiZocmVmXFxcIik7XFxuICAgICAgICAgICAgICAgIGlmICh1ID09IG51bGwpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHUgPSBcXFwiaHR0cHM6Ly96aGFveml5dWFuLmxhL1xcXCIgKyB1O1xcbiAgICAgICAgICAgICAgICAvL2xvZyh1KTtcXG4gICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gcGRmaChpdCwgXFxcIi5uZXdzX3RleHQmJmgzJiZUZXh0XFxcIik7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFwi4oCc4oCc4oCd4oCdPGZvbnQgY29sb3I9I2YxM2I2NmE+5om+6LWE5rqQPC9mb250PiZuYnNwO1xcXCIgKyAocGRmaChpdCwgXFxcIi5uZXdzX3RleHQmJnAmJlRleHRcXFwiKSksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6ICQodSkubGF6eVJ1bGUoKHdyYXB1KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgX2xpbmtzID0gaHRtbC5tYXRjaCgvaHR0cHM6XFxcXC9cXFxcLyh3d3dcXFxcLmFsaXl1bmRyaXZlXFxcXC5jb21cXFxcL3N8YWx5d3BcXFxcLm5ldClcXFxcL1xcXFx3Ki9nKSB8fCBbXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhfbGlua3MpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChfbGlua3MubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3JldHVybiAnaGlrZXI6Ly9wYWdlL2RldGFpbD9ydWxlPeS6keebmOaxh+W9sSZ1cmw9JyArIF9saW5rc1swXSArICc/P2Z5cGFnZSc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vcmV0dXJuICdoaWtlcjovL3BhZ2UvcHVzaD91cmw9aGlrZXI6Ly9lbXB0eSMjJyArIGVuY29kZVVSSUNvbXBvbmVudChfbGlua3NbMF0pICsgJz8/P2Z5cGFnZSc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3cmFwdShfbGlua3NbMF0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpbnB1dDtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9LCB3cmFwdSlcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBkO1xcbiAgICAgICAgfVxcbiAgICB9LCB7XFxuICAgICAgICBuYW1lOiBcXFwi5bCP57q45p2hXFxcIixcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGZ1bmN0aW9uIGdldHRva2VuKCkge1xcbiAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIoJ3h6eXRva2VuJywgJycpLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgdG9rZW4gPSBKU09OLnBhcnNlKHBvc3QoJ2h0dHBzOi8vZ2l0Y2FmZS5uZXQvdG9vbC9hbGlwYXBlci8nLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3UuZ2l0Y2FmZS5uZXQvJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246ICdnZXRfdG9rZW4nXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSkpLmRhdGE7XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcigneHp0dG9rZW4nLCB0b2tlbik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIGdldE15VmFyKCd4enR0b2tlbicsICcnKTtcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gY2F0X2NvZGUoYSkge1xcbiAgICAgICAgICAgICAgICB2YXIgZCwgZSwgYiA9IFtcXFwi5Y2O6K+t55S16KeGXFxcIiwgXFxcIuaXpemfqeeUteinhlxcXCIsIFxcXCLmrKfnvo7nlLXop4ZcXFwiLCBcXFwi5YW25LuW55S16KeGXFxcIiwgXFxcIuWNjuivreeUteW9sVxcXCIsIFxcXCLml6Xpn6nnlLXlvbFcXFwiLCBcXFwi5qyn576O55S15b2xXFxcIiwgXFxcIuWFtuS7lueUteW9sVxcXCIsIFxcXCLljY7or63liqjmvKtcXFwiLCBcXFwi5pel6Z+p5Yqo5ryrXFxcIiwgXFxcIuasp+e+juWKqOa8q1xcXCIsIFxcXCLnuqrlvZXniYdcXFwiLCBcXFwi57u86Im654mHXFxcIiwgXFxcIuaVmeiCsuWfueiurVxcXCIsIF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xcInpzcHhcXFwiLCBcXFwicXR3ZFxcXCIsIFxcXCJielxcXCIsIFxcXCJyd1xcXCIsIFxcXCJmalxcXCIsIFxcXCJxdHRwXFxcIiwgXFxcInF0XFxcIl07XFxuICAgICAgICAgICAgICAgIGZvciAoZCA9IDAsIGUgPSBjLmxlbmd0aDsgZSA+IGQ7IGQrKylcXG4gICAgICAgICAgICAgICAgICAgIGlmIChjW2RdID09IGEpIHJldHVybiBiW2RdO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcG9zdChcXFwiaHR0cHM6Ly9naXRjYWZlLm5ldC90b29sL2FsaXBhcGVyL1xcXCIsIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly91LmdpdGNhZmUubmV0LydcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgYm9keToge1xcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiBcXFwic2VhcmNoXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGZyb206IFxcXCJ3ZWJcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgdG9rZW46IGdldHRva2VuKCksXFxuICAgICAgICAgICAgICAgICAgICBrZXl3b3JkOiBzXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGxldCBsaXN0ID0gSlNPTi5wYXJzZShodG1sKTtcXG4gICAgICAgICAgICBpZiAobGlzdC5kYXRhKSB7XFxuICAgICAgICAgICAgICAgIGxpc3QgPSBsaXN0LmRhdGE7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGlzdC5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBsaXN0W2ldXFxuICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IGl0LnRpdGxlO1xcbiAgICAgICAgICAgICAgICBsZXQgbXVybCA9ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy8nICsgaXQua2V5XFxuICAgICAgICAgICAgICAgIGlmICghY2hlY2thbGkobXVybCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICh0aXRsZS5pbmNsdWRlcyhzKSkge1xcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKImiBcXFwiICsgdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIuKAnOKAnOKAneKAnTxmb250IGNvbG9yPSNmMTNiNjZhPuWwj+e6uOadoTwvZm9udD4mbmJzcDtcXFwiICsgY2F0X2NvZGUoaXQuY2F0KSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXM6IGl0LmRlc1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy91cmw6ICdoaWtlcjovL3BhZ2UvZGV0YWlsP3J1bGU95LqR55uY5rGH5b2xJnVybD1odHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy8nICsgbXVybCArICc/P2Z5cGFnZScsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB3cmFwdShtdXJsKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL3B1c2g/dXJsPWhpa2VyOi8vZW1wdHkjIycgKyBlbmNvZGVVUklDb21wb25lbnQoJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zLycgKyBtdXJsKSArICc/Pz9meXBhZ2UnLFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sIHtcXG4gICAgICAgIG5hbWU6IFxcXCLnjqnlgbblk6Xlk6VcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgdXJsID0gXFxcImh0dHA6Ly93b2dnLnh5ei9pbmRleC5waHAvdm9kc2VhcmNoL1xcXCIgKyBzICsgXFxcIi0tLS0tLS0tLS1cXFwiICsgcGFnZSArIFxcXCItLS0uaHRtbFxcXCI7XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KHVybCwge30pO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcubW9kdWxlLWl0ZW1zJiYubW9kdWxlLXNlYXJjaC1pdGVtJyk7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBiZXQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1dGl0bGUgPSBwYXJzZURvbUZvckh0bWwoaXQsICdoMyYmYSYmVGV4dCcpO1xcbiAgICAgICAgICAgICAgICBsZXQgdXNlcmlhbCA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJy52aWRlby1zZXJpYWwmJlRleHQnKTtcXG4gICAgICAgICAgICAgICAgbGV0IHVpbWFnZSA9IHBhcnNlRG9tKGl0LCAnLmxhenlsb2FkJiZkYXRhLXNyYycsICdodHRwOi8vd29nZy54eXovJyk7XFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGFyc2VEb20oaXQsICdoMyYmYSYmaHJlZicsICdodHRwOi8vd29nZy54eXovJyk7XFxuICAgICAgICAgICAgICAgIC8vbGV0IGRldCA9IHJlcXVlc3QodSwge30pO1xcbiAgICAgICAgICAgICAgICBiZXQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdXRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcbiAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHVpbWFnZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHVzZXJpYWxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChiZXQubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICBsZXQgYmV0aCA9IGJhdGNoRmV0Y2goYmV0KTtcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBiZXRoLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgbGlzdCA9IHBhcnNlRG9tRm9yQXJyYXkoYmV0aFtpXSwgJy5tb2R1bGUtcGxheWVyLWxpc3QmJnAnKVxcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBsaXN0Lmxlbmd0aDsgaisrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwobGlzdFtqXSwgJ3AmJlRleHQnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXUuaW5jbHVkZXMoXFxcIi9zL1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYmV0W2ldLnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBiZXRbaV0uaW1hZ2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL2RldGFpbD9ydWxlPeS6keebmOaxh+W9sSZ1cmw9JyArIHUgKyAnPz9meXBhZ2UnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3VybDogJ2hpa2VyOi8vcGFnZS9wdXNoP3VybD1oaWtlcjovL2VtcHR5IyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KHUpICsgJz8/P2Z5cGFnZScsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogd3JhcHUodSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCLigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT7njqnlgbblk6Xlk6U8L2ZvbnQ+Jm5ic3A7XFxcIiArIChiZXRbaV0uZGVzYykgKyAnXFxcXG4nICsgdSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH1cXG4gICAgfSwge1xcbiAgICAgICAgbmFtZTogXFxcIumYv+mHjOS6keebmOe9kVxcXCIsXFxuICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFwiaHR0cHM6Ly93d3cuYWx5cHcuY24vc2VhcmNoLnBocD9xPVxcXCIgKyBzICsgXFxcIiZwYWdlPVxcXCIgKyBwYWdlO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHt9KTtcXG4gICAgICAgICAgICBsZXQgYXJyID0gcGFyc2VEb21Gb3JBcnJheShodG1sLCAnLmxpc3QmJmxpJyk7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBiZXQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1dGl0bGUgPSBwYXJzZURvbUZvckh0bWwoaXQsICdhJiZ0aXRsZScpO1xcbiAgICAgICAgICAgICAgICBsZXQgdXNlcmlhbCA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJy5mYS1jbG9jay1vJiZUZXh0Jyk7XFxuICAgICAgICAgICAgICAgIGxldCB1aW1hZ2UgPSBwYXJzZURvbShpdCwgJ2ltZyYmc3JjJywgJ2h0dHBzOi8vd3d3LmFseXB3LmNuLycpO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBhcnNlRG9tKGl0LCAnYSYmaHJlZicsICdodHRwczovL3d3dy5hbHlwdy5jbi8nKTtcXG4gICAgICAgICAgICAgICAgLy9sZXQgZGV0ID0gcmVxdWVzdCh1LCB7fSk7XFxuICAgICAgICAgICAgICAgIGlmICghdXRpdGxlLmluY2x1ZGVzKHMpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBiZXQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdXRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcbiAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHVpbWFnZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHVzZXJpYWxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIC8vbG9nKGJldCk7XFxuICAgICAgICAgICAgaWYgKGJldC5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgIGxldCBiZXRoID0gYmF0Y2hGZXRjaChiZXQpO1xcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGJldGgubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBsaXN0ID0gcGFyc2VEb21Gb3JBcnJheShiZXRoW2ldLCAnYm9keSYmYVtocmVmXj1odHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9dJylcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKGxpc3QpO1xcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBsaXN0Lmxlbmd0aDsgaisrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwobGlzdFtqXSwgJ2EmJmhyZWYnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYmV0W2ldLnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBiZXRbaV0uaW1hZ2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL2RldGFpbD9ydWxlPeS6keebmOaxh+W9sSZ1cmw9JyArIHUgKyAnPz9meXBhZ2UnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3VybDogJ2hpa2VyOi8vcGFnZS9wdXNoP3VybD1oaWtlcjovL2VtcHR5IyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KHUpICsgJz8/P2Z5cGFnZScsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogd3JhcHUodSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCLigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT7pmL/ph4zkupHnm5jnvZE8L2ZvbnQ+Jm5ic3A7XFxcIiArIChiZXRbaV0uZGVzYykgKyAnXFxcXG4nICsgdSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH1cXG4gICAgfSwge1xcbiAgICAgICAgbmFtZTogXFxcIuWcn+aLqOm8oFxcXCIsXFxuICAgICAgICBwYWdlOiBmYWxzZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IGZldGNoKCdodHRwczovL3d3dy50YnNkeS5jb20vc2VhcmNoLmh0bWw/a2V5d29yZD0nICsgcyArICcmY2F0ZWdvcnk9OTgzOTIwJmRhdGFfdHlwZT05ODc5MTAnLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUFcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcuc2VhcmNoX3Jlc3VsdF9uZXRkaXNrX2xpc3QmJmEnKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgLy9sb2coaXQpO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJ2EmJmhyZWYnKTtcXG4gICAgICAgICAgICAg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gnaHR0cHM6Ly9hbGlzby5jYy9zLycgKyBzICsgJy0nICsgcGFnZSArICctMC5odG1sJywge30pO1xcblxcbiAgICAgICAgICAgIGxldCBsaXN0ID0gcGFyc2VEb21Gb3JBcnJheShodG1sLCAnLnNlYXJjaC1yZXN1bHQmJi5yZXNvdXJjZS1pdGVtJyk7XFxuICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBsaXN0Lmxlbmd0aDsgaisrKSB7XFxuICAgICAgICAgICAgICAgIGxldCB1ID0gbGlzdFtqXTtcXG4gICAgICAgICAgICAgICAgbGV0IHRpdCA9IHBhcnNlRG9tRm9ySHRtbCh1LCAnaDMmJlRleHQnKTtcXG4gICAgICAgICAgICAgICAgaWYgKCF0aXQuaW5jbHVkZXMocykpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0LFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKHBhcnNlRG9tKHUsICdoMyYmYSYmaHJlZicsICdodHRwczovL2FsaXNvLmNjLycpKS5sYXp5UnVsZSgod3JhcHUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKGdldENyeXB0b0pTKCkpO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRlY3J5KHN0cikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIga2V5ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoXFxcIjlFQjIwRERGRDZBRkJENjhcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGVuY3J5cHRlZCA9IENyeXB0b0pTLkFFUy5kZWNyeXB0KHN0ciwga2V5LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdjoga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kZTogQ3J5cHRvSlMubW9kZS5DQkMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOiBDcnlwdG9KUy5wYWQuUGtjczdcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudG9TdHJpbmcoQ3J5cHRvSlMuZW5jLlV0ZjgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW5jcnlwdGVkO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoaW5wdXQpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBidXQgPSBwYXJzZURvbShodG1sLCAnLmJ1dHRvbiYmaHJlZicsICdodHRwczovL2FsaXNvLmNjLycpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKGJ1dCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGdvdCA9IHJlcXVlc3QoYnV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhnb3QpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwocGFyc2VEb21Gb3JIdG1sKGdvdCwgJ2hlYWQmJnNjcmlwdCwxJiZIdG1sJykpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3cmFwdShkZWNyeShiYXNlNjQuc3BsaXQoJyEnKVswXSkpO1xcblxcbiAgICAgICAgICAgICAgICAgICAgfSwgd3JhcHUpLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIuKAnOKAnOKAneKAnTxmb250IGNvbG9yPSNmMTNiNjZhPumYv+mHjOaQnDwvZm9udD4mbmJzcDtcXFwiICsgcGFyc2VEb21Gb3JIdG1sKHUsICcudGltZSYmVGV4dCcpLFxcbiAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIC8qe1xcbiAgICAgICAgICAgbmFtZTogXFxcIuWcn+eLl+aQnFxcXCIsXFxuICAgICAgICAgICBwYWdlOiBmYWxzZSxcXG4gICAgICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoJ2h0dHBzOi8vd3d3LnR1Z291c291LmNvbS9zZWFyY2gnLCB7XFxuICAgICAgICAgICAgICAgICAgIGJvZHk6ICdrZXl3b3JkPScgKyBzLFxcbiAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcbiAgICAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcubGF5dWktY29udGFpbmVyLDEmJi5sYXl1aS1yb3c6aGFzKGEpJyk7XFxuICAgICAgICAgICAgICAgbGV0IGQgPSBbXTtcXG4gICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgICAgIGxldCB1ID0gcGFyc2VEb21Gb3JIdG1sKGl0LCAnYSYmaHJlZicpO1xcbiAgICAgICAgICAgICAgICAgICBpZiAoIXUuaW5jbHVkZXMoXFxcIi9zL1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAvL2xvZyh1KTtcXG4gICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwYXJzZURvbUZvckh0bWwoaXQsICdhJiZUZXh0JyksXFxuICAgICAgICAgICAgICAgICAgICAgICAvL3VybDog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cbiAgICAgICAgICAgICAgICAgICAgcGFkZGluZzogQ3J5cHRvSlMucGFkLlBrY3M3XFxuICAgICAgICAgICAgICAgIH0pLnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVuY3J5cHRlZDtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KCdodHRwczovL3d3dy55dW5wYW5mZW54aWFuZy5jbi9hcGkvYmJzL2FwaS9nZXRkYXRhP2tleT0nICsgcyArICcmdHlwZT12aWRlbycsIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly93d3cueXVucGFuZmVueGlhbmcuY24vXFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgbGV0IGpzb24gPSBkZWNyeShKU09OLnBhcnNlKGh0bWwpLmRhdGEpO1xcbiAgICAgICAgICAgIC8vbG9nKGpzb24pO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGpzb24pOyAvL1swXS5yZXN1bHQuaXRlbXM7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG5cXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBiZXQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSBpdC5waWQ7XFxuICAgICAgICAgICAgICAgIGJldC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vd3d3Lnl1bnBhbmZlbnhpYW5nLmNuL2FwaS9iYnMvYXBpL2dldGFydGljbGU/aWQ9JyArIHVybCxcXG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8vd3d3Lnl1bnBhbmZlbnhpYW5nLmNuL1xcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAvL2xvZyh1KTtcXG4gICAgICAgICAgICBsZXQgYmV0aCA9IGJhdGNoRmV0Y2goYmV0KTtcXG5cXG4gICAgICAgICAgICAvL2xvZyhhcnRpY2xlKTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGJldGgubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKGJldGhbaV0pLmRhdGE7XFxuICAgICAgICAgICAgICAgIC8vbG9nKGpzb24pO1xcbiAgICAgICAgICAgICAgICBsZXQgbGlzdCA9IGpzb24uZG93bmxvYWQuc3BsaXQoJ0AnKTtcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBsaXN0Lmxlbmd0aDsgaisrKSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgdSA9IGxpc3Rbal07XFxuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBqc29uLnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL2RldGFpbD9ydWxlPeS6keebmOaxh+W9sSZ1cmw9JyArIHUgKyAnPz9meXBhZ2UnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL3B1c2g/dXJsPWhpa2VyOi8vZW1wdHkjIycgKyBlbmNvZGVVUklDb21wb25lbnQodSkgKyAnPz8/ZnlwYWdlJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHdyYXB1KCdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy8nICsgdSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIuKAnOKAnOKAneKAnTxmb250IGNvbG9yPSNmMTNiNjZhPuS6keebmOWIhuS6q+ekvjwvZm9udD4mbmJzcDtcXFwiICsgKGpzb24uY3JlYXRldGltZSkgKyBcXFwiXFxcXG5cXFwiICsgKCdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy8nICsgdSksXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH1cXG4gICAgfSwge1xcbiAgICAgICAgbmFtZTogXFxcIuebmOaQnFxcXCIsXFxuICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIHBhZ2UgPSAocGFnZSAtIDEpICogMTA7XFxuICAgICAgICAgICAgbGV0IHVybCA9IFxcXCJodHRwczovL3d3dy5wYW5zZWFyY2gubWUvc2VhcmNoP2tleXdvcmQ9XFxcIiArIHMgKyBcXFwiJm9mZnNldD1cXFwiICsgcGFnZSArIFxcXCImcGFuPWFsaXl1bmRyaXZlXFxcIjtcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QodXJsLCB7fSk7XFxuXFxuICAgICAgICAgICAgbGV0IGFyciA9IHBhcnNlRG9tRm9yQXJyYXkoaHRtbCwgJy5ncmlkJiYuc2hhZG93OmhhcyhhW2hyZWZePWh0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zL10pJyk7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwoaXQsICdhW2hyZWZePWh0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zL10mJmhyZWYnKTtcXG4gICAgICAgICAgICAgICAgLy9sb2codSk7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGFyc2VEb21Gb3JIdG1sKGl0LCAnLmJyZWFrLWFsbCYmVGV4dCcpLnNwbGl0KCdodHRwJylbMF0sXFxuICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBwYXJzZURvbUZvckh0bWwoaXQsICdpbWcmJnNyYycpLFxcbiAgICAgICAgICAgICAgICAgICAgLy91cmw6ICdoaWtlcjovL3BhZ2UvZGV0YWlsP3J1bGU95LqR55uY5rGH5b2xJnVybD0nICsgdSArICc/P2Z5cGFnZScsXFxuICAgICAgICAgICAgICAgICAgICAvL3VybDogJ2hpa2VyOi8vcGFnZS9wdXNoP3VybD1oaWtlcjovL2VtcHR5IyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KHUpICsgJz8/P2Z5cGFnZScsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHdyYXB1KHUpLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIuKAnOKAnOKAneKAnTxmb250IGNvbG9yPSNmMTNiNjZhPuebmOaQnDwvZm9udD4mbmJzcDtcXFwiICsgKHBhcnNlRG9tRm9ySHRtbChpdCwgJ3AmJlRleHQnKSkgKyBcXFwiXFxcXG5cXFwiICsgKHUpLFxcbiAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCJET1ZY5pCcXFxcIixcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFwiaHR0cHM6Ly9hcGkuZG92eC50ay9hbGkvc2VhcmNoP3dkPVxcXCIgKyBzO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHt9KTtcXG4gICAgICAgICAgICAvL2xvZyhiYXNlNjREZWNvZGUoaHRtbCkpO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGh0bWwpLmxpc3Q7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBpdC52b2RfY29udGVudDtcXG4gICAgICAgICAgICAgICAgLy91ID0gdS5sZW5ndGggPiAwID8gdVswXSA6IHVybDtcXG4gICAgICAgICAgICAgICAgaWYgKCF1LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZiAoIWNoZWNrYWxpKHUpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLiiJogXFxcIiArIGl0LnZvZF9uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogaXQudm9kX3BpYyxcXG4gICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL2RldGFpbD9ydWxlPeS6keebmOaxh+W9sSZ1cmw9JyArIHUgKyAnPz9meXBhZ2UnLFxcbiAgICAgICAgICAgICAgICAgICAgLy91cmw6ICdoaWtlcjovL3BhZ2UvcHVzaD91cmw9aGlrZXI6Ly9lbXB0eSMjJyArIGVuY29kZVVSSUNvbXBvbmVudCh1KSArICc/Pz9meXBhZ2UnLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB3cmFwdSh1KSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCLigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT5ET1ZY5pCcPC9mb250PiZuYnNwO1xcXCIgKyBcXFwiXFxcXG5cXFwiICsgKHUpLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCLlv4XlupRcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgdXJsID0gXFxcImh0dHBzOi8vY24uYmluZy5jb20vc2VhcmNoP3E9XFxcIiArIHMgKyBcXFwiK2FsaXl1bmRyaXZlJnFzPWRzJmZvcm09UUJSRVxcXCI7XFxuICAgICAgICAgICAgaWYgKHBhZ2UgIT0gMSkge1xcbiAgICAgICAgICAgICAgICB1cmwgPSBnZXRNeVZhcihcXFwiYmluZ1xcXCIsIHVybCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHtcXG4gICAgICAgICAgICAgICAgaG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AgICAgICAgICAgICAgICAgIC8vbG9nKFxcXCJuZXh0IHBhZ2VcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKHUyKTtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJiaW5nXFxcIiwgdTIpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICh1ID09IG51bGwgfHwgdCA9PSBudWxsIHx8ICFpdC5pbmNsdWRlcyhzKSkge1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKCFpdC5pbmNsdWRlcyhcXFwi572R55uYXFxcIikgJiYgIWl0LmluY2x1ZGVzKFxcXCLkupHnm5hcXFwiKSAmJlxcbiAgICAgICAgICAgICAgICAgICAgIWl0LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpICYmICFpdC5pbmNsdWRlcyhcXFwieXVucGFuXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICh1LnN0YXJ0c1dpdGgoXFxcImh0dHBzOi8vY24uYmluZy5jb20vXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGxldCBkb20gPSBnZXRIb21lKHUpLnJlcGxhY2UoXFxcImh0dHA6Ly9cXFwiLCBcXFwiXFxcIikucmVwbGFjZShcXFwiaHR0cHM6Ly9cXFwiLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgIGxldCBfbGlua3MgPSB0Lm1hdGNoKC9odHRwczpcXFxcL1xcXFwvKHd3d1xcXFwuYWxpeXVuZHJpdmVcXFxcLmNvbVxcXFwvc3xhbHl3cFxcXFwubmV0KVxcXFwvXFxcXHcqL2cpIHx8IFtdO1xcbiAgICAgICAgICAgICAgICAvL2xvZyhfbGlua3MpO1xcbiAgICAgICAgICAgICAgICBsZXQgYyA9IG51bGw7XFxuICAgICAgICAgICAgICAgIC8vbG9nKF9saW5rcyk7XFxuICAgICAgICAgICAgICAgIC8vaWYgKF9saW5rcy5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgIC8vYyA9ICdoaWtlcjovL3BhZ2UvcHVzaD91cmw9aGlrZXI6Ly9lbXB0eSMjJyArIGVuY29kZVVSSUNvbXBvbmVudChfbGlua3NbMF0pICsgJz8/P2Z5cGFnZSc7XFxuICAgICAgICAgICAgICAgIC8vYz13cmFwdShfbGlua3NbMF0pXFxuICAgICAgICAgICAgICAgIC8vfVxcbiAgICAgICAgICAgICAgICBpZiAoX2xpbmtzLmxlbmd0aCA+IDEgJiYgX2xpbmtzWzFdLnJlcGxhY2UoX2xpbmtzWzBdLCBcXFwiXFxcIikucmVwbGFjZSgvW2EtekEtWjAtOV0rL2csIFxcXCJcXFwiKSA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgYyA9IHdyYXB1KF9saW5rc1sxXSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoX2xpbmtzLmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICAgICAgICAgIGMgPSB3cmFwdShfbGlua3NbMF0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdCxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCLigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT7lv4XlupQ8L2ZvbnQ+Jm5ic3A7XFxcIiArIGRvbSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogYyAhPSBudWxsID8gYyA6ICQodSkubGF6eVJ1bGUoKHdyYXB1LCBtb2RlKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgX2xpbmtzID0gaHRtbC5tYXRjaCgvaHR0cHM6XFxcXC9cXFxcLyh3d3dcXFxcLmFsaXl1bmRyaXZlXFxcXC5jb21cXFxcL3N8YWx5d3BcXFxcLm5ldClcXFxcL1xcXFx3Ki9nKSB8fCBbXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhfbGlua3MpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vaWYgKF9saW5rcy5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9yZXR1cm4gJ2hpa2VyOi8vcGFnZS9kZXRhaWw/cnVsZT3kupHnm5jmsYflvbEmdXJsPScgKyBfbGlua3NbMF0gKyAnPz9meXBhZ2UnO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vcmV0dXJuICdoaWtlcjovL3BhZ2UvcHVzaD91cmw9aGlrZXI6Ly9lbXB0eSMjJyArIGVuY29kZVVSSUNvbXBvbmVudChfbGlua3NbMF0pICsgJz8/P2Z5cGFnZSc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF9saW5rcy5sZW5ndGggPiAxICYmIF9saW5rc1sxXS5yZXBsYWNlKF9saW5rc1swXSwgXFxcIlxcXCIpLnJlcGxhY2UoL1thLXpBLVowLTldKy9nLCBcXFwiXFxcIikgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdyYXB1KF9saW5rc1sxXSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChfbGlua3MubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd3JhcHUoX2xpbmtzWzBdKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZSA9IE1ZX1JVTEUudGl0bGU7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL3lzZng/cnVsZT1cXFwiICsgcnVsZSArIFxcXCImcj1cXFwiICsgcnVsZSArIFxcXCImbW9kZT1cXFwiICsgbW9kZSArIFxcXCIjI1xcXCIgKyBpbnB1dDtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9LCB3cmFwdSwgY29uZmlnLm1vZGUpXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAge1xcbiAgICAgICAgbmFtZTogJ0NDT0YnLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdXFxuICAgICAgICAgICAgY29uc3Qge1xcbiAgICAgICAgICAgICAgICBieXRlc1RvU2l6ZSxcXG4gICAgICAgICAgICAgICAgY29sb3JcXG4gICAgICAgICAgICB9ID0gJC5yZXF1aXJlKCdoaWtlcjovL3BhZ2UvdG9vbHMnKTtcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IGZldGNoKCdodHRwczovL3Bhbi5jY29mLmNjL2FwaS9zZWFyY2gnLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJjb250ZW50LXR5cGVcXFwiOiAnYXBwbGljYXRpb24vanNvbicsXFxuICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3Bhbi5jY29mLmNjL3NlYXJjaD9rZXl3b3JkPScgKyBzXFxuICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIGJvZHk6IHtcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJwYWdlU2l6ZVxcXCI6IDIwLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcInBhZ2VOdW1cXFwiOiBwYWdlLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcImtleXdvcmRcXFwiOiBzLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcImZyb21Nb2JpbGVcXFwiOiB0cnVlXFxuICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IEpTT04ucGFyc2UoaHRtbClcXG4gICAgICAgICAgICAgICAgLmRhdGEucm93c1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGlzdC5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBsaXN0W2ldXFxuICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IGl0LmZpbGVOYW1lXFxuICAgICAgICAgICAgICAgIGxldCBtdXJsID0gaXQudXJsXFxuICAgICAgICAgICAgICAgIGxldCB0eXBlID0gaXQudHlwZS5yZXBsYWNlKC9mb2xkZXIvLCAn5paH5Lu25aS5JykucmVwbGFjZSgvZmlsZS8sICfmlofku7YnKVxcbiAgICAgICAgICAgICAgICBpZiAodGl0bGUuaW5jbHVkZXMocykpIHtcXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT5DQ09GPC9mb250PiZuYnNwOycgKyAn5paH5Lu257G75Z6L77yaJyArIHR5cGUgKyAn77yM5paH5Lu25aSn5bCP77yaJyArIGJ5dGVzVG9TaXplKGl0LnNpemUpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogd3JhcHUobXVybCl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tb2RlLFxcbiAgICAgICAgdXJsOiBcXFwic2VsZWN0Oi8vXFxcIiArIEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIumAieaLqeaooeW8j1xcXCIsXFxuICAgICAgICAgICAgb3B0aW9uczogW1xcXCLmnKzlnLDovaznoIFcXFwiLCBcXFwi5a6Y5pa5QVBQXFxcIiwgXFxcIueZu+W9lei0puWPtzFcXFwiLCBcXFwi55m75b2V6LSm5Y+3MlxcXCIsIFxcXCJUb2tlbueZu+mZhlxcXCJdLFxcbiAgICAgICAgICAgIGNvbDogMSxcXG4gICAgICAgICAgICBqczogJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgICAgICAgIGlmIChcXFwi55m75b2V6LSm5Y+3MVxcXCIgPT0gaW5wdXQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL2xvZ2luI25vUmVjb3JkSGlzdG9yeSMjbm9IaXN0b3J5Iz9wYWdlVGl0bGU955m75b2V6Zi/6YeM5LqR55uYXFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChcXFwi55m75b2V6LSm5Y+3MlxcXCIgPT0gaW5wdXQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL2xvZ2luI25vUmVjb3JkSGlzdG9yeSMjbm9IaXN0b3J5Iz9pbmRleD0wJnBhZ2VUaXRsZT3nmbvlvZXpmL/ph4zkupHnm5hcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYoXFxcIlRva2Vu55m76ZmGXFxcIiA9PSBpbnB1dCl7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwiXFxcIixcXFwi6L6T5YWlVG9rZW5cXFwiKS5pbnB1dCgoKT0+e1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBhbGlUb2tlbnNGaWxlcGF0aCA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL3Rva2VuUGF0aC5qc29uXFxcIikuYWxpVG9rZW5zRmlsZXBhdGg7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGFsaVRva2VuID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiBpbnB1dC50cmltKClcXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlRmlsZShhbGlUb2tlbnNGaWxlcGF0aCwgSlNPTi5zdHJpbmdpZnkoYWxpVG9rZW4pKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFwiZG1vZGVcXFwiLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBcXFwi5a6Y5pa5QVBQXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S/ruaUueaIkOWKn++8jOivt+ehruS/neaJi+acuuacieWuieijhemYv+mHjOS6keebmOWumOaWuUFQUFxcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSksXFxuICAgICAgICBjb2xfdHlwZTogXFxcImljb25fMl9yb3VuZFxcXCIsXFxuICAgICAgICBkZXNjOiBcXFwiXFxcIixcXG4gICAgICAgIHBpY191cmw6IFxcXCJoaWtlcjovL2ltYWdlcy9pY29uMVxcXCJcXG4gICAgfSk7XFxuXFxuICAgIGxldCBpZCA9IERhdGUubm93KCkgKyBNWV9SVUxFLnRpdGxlO1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICfmk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cjXFxcIikubGF6eVJ1bGUoKHMsIGlkKSA9PiB7XFxuICAgICAgICAgICAgbGV0IHFyID0gZ2V0SXRlbShcXFwiclxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICBjbGVhckl0ZW0oXFxcInJcXFwiKTtcXG4gICAgICAgICAgICBpZiAocykge1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcIuWFqOmDqFxcXCIgKyBpZCwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzlhajpg6jigJ3igJ1cXFwiXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBpZiAocXIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oaWQgKyBxciwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBxclxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgfSwgcywgaWQpLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgIGRlc2M6IFxcXCJcXFwiLFxcbiAgICAgICAgcGljX3VybDogXFxcIlxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGlkOiBcXFwi5YWo6YOoXFxcIiArIGlkXFxuICAgICAgICB9XFxuICAgIH0pO1xcbiAgICBmb3IgKGxldCBpdCBvZiBydWxlcykge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogaXQgPT0gciA/IFxcXCLigJzigJxcXFwiICsgaXQgKyBcXFwi4oCd4oCdXFxcIiA6IGl0LFxcbiAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgociwgcywgaWQpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IHFyID0gZ2V0SXRlbShcXFwiclxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFwiclxcXCIsIHIpO1xcbiAgICAgICAgICAgICAgICBpZiAocykge1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0ocXIgPyAoaWQgKyBxcikgOiAoXFxcIuWFqOmDqFxcXCIgKyBpZCksIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogcXIgfHwgXFxcIuWFqOmDqFxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShpZCArIHIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnFxcXCIgKyByICsgXFxcIuKAneKAnVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgICAgICB9LCBpdCwgcywgaWQpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgZGVzYzogXFxcIlxcXCIsXFxuICAgICAgICAgICAgcGljX3VybDogXFxcIlxcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IGlkICsgaXRcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG4gICAgfVxcbiAgICBpZiAoIXMpIHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICc8c3BhbiBzdHlsZT1cXFwiY29sb3I6I2ZmNjYwMVxcXCI+PGI+5Y6G5Y+y6K6w5b2VPC9iPjwvc3Bhbj4nLFxcbiAgICAgICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vdHViaWFvL21vdmllLzMuc3ZnXFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImF2YXRhclxcXCIsXFxuICAgICAgICAgICAgdXJsOiAkKFxcXCLnoa7lrprmuIXpmaTlhajpg6jmkJzntKLorrDlvZXvvJ9cXFwiKS5jb25maXJtKChpZCkgPT4ge1xcbiAgICAgICAgICAgICAgICBjbGVhckl0ZW0oXFxcInNlYXJjaEhpc3RvcnlcXFwiKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKGlkICsgXFxcIjprZXlcXFwiKTtcXG4gICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKGlkICsgXFxcIjpzZWFyY2hIaXN0b3J5XFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgXFxcIn5+fuS7gOS5iOmDveayoeacieWTpn5+flxcXCIuZm9udGNvbG9yKFxcXCJHcmF5XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogaWQgKyBcXFwiOmtleVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSwgaWQpLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiBpZCArIFxcXCI6c2VhcmNoSGlzdG9yeVxcXCJcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIGxldCBoaXN0b3J5ID0gc3RvcmFnZTAuZ2V0SXRlbShcXFwic2VhcmNoSGlzdG9yeVxcXCIsIFtdKTtcXG4gICAgICAgIGxldCBpID0gMDtcXG4gICAgICAgIGZvciAobGV0IGtleSBvZiBoaXN0b3J5KSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGtleSxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChpZCwga2V5KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgZXh0cmEgPSBmaW5kSXRlbShpZCArIFxcXCJzc1xcXCIpLmV4dHJhO1xcbiAgICAgICAgICAgICAgICAgICAgZXh0cmEuZGVmYXVsdFZhbHVlID0ga2V5O1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IGV4dHJhXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICAgICAgICAgIH0sIGlkLCBrZXkpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImZsZXhfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBpZCArIFxcXCI6a2V5OlxcXCIgKyBrZXksXFxuICAgICAgICAgICAgICAgICAgICBjbHM6IGlkICsgXFxcIjprZXlcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5Yig6Zmk5YWz6ZSu6K+NOlxcXCIgKyBrZXksXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGlkLCBrZXksIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGhpc3RvcnkgPSBzdG9yYWdlMC5nZXRJdGVtKFxcXCJzZWFyY2hIaXN0b3J5XFxcIiwgW10pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaXN0b3J5LnNwbGljZShpLCAxKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFwic2VhcmNoSGlzdG9yeVxcXCIsIGhpc3RvcnkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtKGlkICsgXFxcIjprZXk6XFxcIiArIGtleSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vdG9hc3QoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpZCwga2V5LCBpKVxcbiAgICAgICAgICAgICAgICAgICAgfV1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGkrKztcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChoaXN0b3J5Lmxlbmd0aCA9PT0gMCkge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBcXFwifn5+5LuA5LmI6YO95rKh5pyJ5ZOmfn5+XFxcIi5mb250Y29sb3IoXFxcIkdyYXlcXFwiKSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGNsczogaWQgKyBcXFwiOmtleVxcXC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YS5sZW5ndGgsXFxuICAgICAgICAgICAgdXJsOiBcXFwiXFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIGRlc2M6IFxcXCJcXFwiLFxcbiAgICAgICAgICAgIHBpY191cmw6IFxcXCJcXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiBwYWdlaWRcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG4gICAgfVxcbiAgICBzZXRSZXN1bHQoZCk7XFxuICAgIGlmIChkYXRhLmxlbmd0aCA+IDApIHtcXG4gICAgICAgIC8v5aSa57q/56iL5Yqg6L29ICAgICAgICBcXG4gICAgICAgIGxldCByZWFsUGFnZSA9IFxcXCJcXFwiID09IHIgPyAxIDogcDtcXG4gICAgICAgIGxldCB0YXNrcyA9IGRhdGEubWFwKGl0ID0+IHtcXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICBmdW5jOiBmdW5jdGlvbihydWxlKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gcnVsZS5maW5kKHMsIHJlYWxQYWdlKTtcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgcGFyYW06IGl0LFxcbiAgICAgICAgICAgICAgICBpZDogXFxcInJ1bGVAXFxcIiArIGl0Lm5hbWVcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIGJhdGNoRXhlY3V0ZSh0YXNrcywge1xcbiAgICAgICAgICAgIGZ1bmM6IGZ1bmN0aW9uKHBhcmFtLCBpZCwgZXJyb3IsIHJlc3VsdCkge1xcbiAgICAgICAgICAgICAgICAvL2xvZyhcXFwibGlzdGVuZXI6IFxcXCIgKyAocmVzdWx0IHx8IFtdKS5sZW5ndGgpXFxuICAgICAgICAgICAgICAgIHBhcmFtLmkgPSBwYXJhbS5pICsgMTtcXG4gICAgICAgICAgICAgICAgbGV0IHB1c2hDb3VudCA9IDA7XFxuICAgICAgICAgICAgICAgIGlmIChyZXN1bHQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgcmVzdWx0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtb2RlICYmICFzZWFyY2hDb250YWlucyhpdC50aXRsZSwgcywgdHJ1ZSkpIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXNoQ291bnQrKztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW0uaiA9IHBhcmFtLmogKyAxO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRJdGVtQmVmb3JlKHBhZ2VpZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0LnRpdGxlLmluY2x1ZGVzKFxcXCLigJzigJzigJ3igJ1cXFwiKSA/IGl0LnRpdGxlIDogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBpdC50aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAoXFxcIjxlbT58PC9lbT5cXFwiLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIikucmVwbGFjZShuZXcgUmVnRXhwKHMsIFxcXCJnXFxcIiksIFxcXCI8c3Ryb25nPjxzcGFuIHN0eWxlPVxcXFxcXFwiY29sb3I6ICMxRTkwRkZcXFxcXFxcIj5cXFwiICsgcyArIFxcXCI8L3NwYW4+PC9zdHJvbmc+XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBpdC5kZXNjLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBpdC51cmwsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBpdC5waWNfdXJsLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IGl0LnBpY191cmwgPyAnbW92aWVfMV92ZXJ0aWNhbF9waWMnIDogXFxcInRleHRfMVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBcXFwiX19hcHBcXFwiICsgTVlfUEFHRSArIFxcXCJAXFxcIiArIHBhcmFtLmosXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuXFxuICAgICAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtLmkgPj0gcGFyYW0uYWxsKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5sZW5ndGggPT09IDEgJiYgKCFyZXN1bHQgfHwgcHVzaENvdW50ID09PSAwKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0oXFxcIl9ub3RoYXZlXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYWRkSXRlbUJlZm9yZShwYWdlaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIFxcXCJ+fn7ku4DkuYjotYTmupDpg73msqHmnInlk6Z+fn5cXFwiLmZvbnRjb2xvcihcXFwiR3JheVxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IFxcXCJfbm90aGF2ZVxcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbShwYWdlaWQpO1xcblxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLliqDovb3nrKxcXFwiICsgTVlfUEFHRSArIFxcXCLpobXkuK3vvIzov5vluqbvvJpcXFwiICsgKHBhcmFtLmkgKyAxKSArIFxcXCIvXFxcIiArIHBhcmFtLmFsbCxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCJcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGljX3VybDogXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHBhZ2VpZFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICBwYXJhbToge1xcbiAgICAgICAgICAgICAgICB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LFxcbiAgICDkuIc6IHtcXG4gICAgICAgIHZhbHVlOiAxMDAwMCxcXG4gICAgICAgIHNlY1VuaXQ6IHRydWVcXG4gICAgfSxcXG4gICAg5Lq/OiB7XFxuICAgICAgICB2YWx1ZTogMTAwMDAwMDAwLFxcbiAgICAgICAgc2VjVW5pdDogdHJ1ZVxcbiAgICB9XFxufVxcblxcbmZ1bmN0aW9uIENoaW5lc2VUb051bWJlcihjaG5TdHIpIHtcXG4gICAgbGV0IHJ0biA9IDA7XFxuICAgIGxldCBzZWN0aW9uID0gMDtcXG4gICAgbGV0IG51bWJlciA9IDA7XFxuICAgIGxldCBzZWNVbml0ID0gZmFsc2U7XFxuICAgIGxldCBzdHIgPSBjaG5TdHIuc3BsaXQoJycpO1xcblxcbiAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgbGV0IG51bSA9IGNobk51bUNoYXJbc3RyW2ldXTtcXG4gICAgICAgIGlmICh0eXBlb2YgbnVtICE9PSAndW5kZWZpbmVkJykge1xcbiAgICAgICAgICAgIG51bWJlciA9IG51bTtcXG4gICAgICAgICAgICBpZiAoaSA9PT0gc3RyLmxlbmd0aCAtIDEpIHtcXG4gICAgICAgICAgICAgICAgc2VjdGlvbiArPSBudW1iZXI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgdW5pdCA9IGNobk5hbWVWYWx1ZVtzdHJbaV1dLnZhbHVlO1xcbiAgICAgICAgICAgIHNlY1VuaXQgPSBjaG5OYW1lVmFsdWVbc3RyW2ldXS5zZWNVbml0O1xcbiAgICAgICAgICAgIGlmIChzZWNVbml0KSB7XFxuICAgICAgICAgICAgICAgIHNlY3Rpb24gPSAoc2VjdGlvbiArIG51bWJlcikgKiB1bml0O1xcbiAgICAgICAgICAgICAgICBydG4gKz0gc2VjdGlvbjtcXG4gICAgICAgICAgICAgICAgc2VjdGlvbiA9IDA7XFx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cXG4gICAgICAgIHJldHVybiAxMDA7XFxuICAgIH1cXG4gICAgdmFyIGwgPSBzLmxlbmd0aCA+IHQubGVuZ3RoID8gcy5sZW5ndGggOiB0Lmxlbmd0aFxcbiAgICB2YXIgbiA9IHMubGVuZ3RoXFxuICAgIHZhciBtID0gdC5sZW5ndGhcXG4gICAgdmFyIGQgPSBbXVxcbiAgICBmID0gZiB8fCAyXFxuICAgIHZhciBtaW4gPSBmdW5jdGlvbiAoYSwgYiwgYykge1xcbiAgICAgICAgcmV0dXJuIGEgPCBiID8gKGEgPCBjID8gYSA6IGMpIDogKGIgPCBjID8gYiA6IGMpXFxuICAgIH1cXG4gICAgdmFyIGksIGosIHNpLCB0aiwgY29zdFxcbiAgICBpZiAobiA9PT0gMCkgcmV0dXJuIG1cXG4gICAgaWYgKG0gPT09IDApIHJldHVybiBuXFxuICAgIGZvciAoaSA9IDA7IGkgPD0gbjsgaSsrKSB7XFxuICAgICAgICBkW2ldID0gW11cXG4gICAgICAgIGRbaV1bMF0gPSBpXFxuICAgIH1cXG4gICAgZm9yIChqID0gMDsgaiA8PSBtOyBqKyspIHtcXG4gICAgICAgIGRbMF1bal0gPSBqXFxuICAgIH1cXG4gICAgZm9yIChpID0gMTsgaSA8PSBuOyBpKyspIHtcXG4gICAgICAgIHNpID0gcy5jaGFyQXQoaSAtIDEpXFxuICAgICAgICBmb3IgKGogPSAxOyBqIDw9IG07IGorKykge1xcbiAgICAgICAgICAgIHRqID0gdC5jaGFyQXQoaiAtIDEpXFxuICAgICAgICAgICAgaWYgKHNpID09PSB0aikge1xcbiAgICAgICAgICAgICAgICBjb3N0ID0gMFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGNvc3QgPSAxXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGRbaV1bal0gPSBtaW4oZFtpIC0gMV1bal0gKyAxLCBkW2ldW2ogLSAxXSArIDEsIGRbaSAtIDFdW2ogLSAxXSArIGNvc3Qp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cXCLmo4DmtYvliLDmlrDnmoTno4Hpk77lnLDlnYDvvIzngrnlh7vnoa7lrprmjInpkq7ljbPlj6/mkq3mlL7vvIzngrnlh7vlj5bmtojmjInpkq7lj6/ku6XlpI3liLbpk77mjqVcXFwiLFxcbiAgICAgICAgICAgICAgICBjb25maXJtOiAkLnRvU3RyaW5nKChtYWcpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBtYWc7XFxuICAgICAgICAgICAgICAgIH0sIGlucHV0KSxcXG4gICAgICAgICAgICAgICAgY2FuY2VsOiAkLnRvU3RyaW5nKChtYWcpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBtYWdcXG4gICAgICAgICAgICAgICAgfSwgaW5wdXQpXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcXG4gICAgICAgIH0gZWxzZSBpZiAoaW5wdXQuaW5jbHVkZXMoXFxcImFsaXl1bmRyaXZlLmNvbVxcXCIpICYmIG1vZGUgIT0gXFxcIuWumOaWuUFQUFxcXCIpIHtcXG4gICAgICAgICAgICBsb2coaW5wdXQpO1xcbiAgICAgICAgICAgIGlmIChpbnB1dC5pbmNsdWRlcygnY2hlY2t1cmw/dXJsPScpICYmIGlucHV0LmluY2x1ZGVzKCcmdXJscmVmZXInKSkge1xcbiAgICAgICAgICAgICAgICBpbnB1dCA9IGRlY29kZVVSSUNvbXBvbmVudChpbnB1dC5zcGxpdCgnJnVybHJlZmVyJylbMF0uc3BsaXQoJ2NoZWNrdXJsP3VybD0nKVsxXSk7XFxuICAgICAgICAgICAgICAgIC8vbG9nKCfotLTlkKcnK2lucHV0KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuICQudG9TdHJpbmcoKHVybCwgcnVsZSkgPT4ge1xcbiAgICAgICAgICAgICAgICBmeV9icmlkZ2VfYXBwLm9wZW4oSlNPTi5zdHJpbmdpZnkoe1xc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G5cXG5cXG4gICAgaWYgKGNhdGUgPT09IFxcXCJ2aWRlb1xcXCIpIHtcXG4gICAgICAgIGxldCBwbGF5TGlzdDtcXG4gICAgICAgIGlmIChnZXRJdGVtKFxcXCJhbGl5dW5fcGxheU1vZGVcXFwiLCBcXFwi6L2s56CBXFxcIikgPT09IFxcXCLovaznoIFcXFwiKSB7XFxuICAgICAgICAgICAgcGxheUxpc3QgPSBhbGlQbGF5QXBpLmdldFZpZGVvKHNoYXJlSWQsIHNoYXJlUHdkLCBmaWxlSWQsIHJlZnJlc2hUb2tlbikgfHwge307XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHRyeXtcXG4gICAgICAgICAgICAgICAgcGxheUxpc3QgPSB7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW1xcXCLljp/nlLtcXFwiXSxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtnZXRPcmlWaWRlbyhzaGFyZUlkLCBzaGFyZVB3ZCwgc2hhcmVUb2tlbiwgZmlsZUlkLCBhbGlUb2tlbildLFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW3tcXG4gICAgICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJ1xcbiAgICAgICAgICAgICAgICAgICAgfV1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1jYXRjaChlKXsgICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgIGxvZyhcXFwiI+WOn+eUu+aSreaUvuWksei0pSNcXFxcbumUmeivr+S/oeaBrz5cXFwiK2UudG9TdHJpbmcoKStcXFwiXFxcXG7plJnor6/ooYw+XFxcIitlLmxpbmVOdW1iZXIpO1xcbiAgICAgICAgICAgICAgICBpZihlLmNvZGU9PT1cXFwiSW52YWxpZFBhcmFtZXRlci5SZWZyZXNoVG9rZW5cXFwiKXtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcX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cXG4gICAgICAgICAgICBsZXQgc2hhcmVJbmZvID0gYWxpU2hhcmVBcGkuZ2V0U2hhcmVJbmZvKCk7XFxuICAgICAgICAgICAgbGV0IGZpbGVJbmZvID0gc2hhcmVJbmZvLmZpbGVfaW5mb3M7XFxuICAgICAgICAgICAgaWYgKGZpbGVJbmZvLmxlbmd0aCA9PT0gMSAmJiBmaWxlSW5mb1swXS50eXBlID09PSBcXFwiZm9sZGVyXFxcIiYmIWZpbGVJZCkge1xcbiAgICAgICAgICAgICAgICBmaWxlSWQgPSBmaWxlSW5mb1swXS5maWxlX2lkO1xcbiAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoZmlsZUluZm9bMF0uZmlsZV9uYW1lKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoc2hhcmVJbmZvLnNoYXJlX25hbWUpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHNoYXJlSW5mby5jcmVhdG9yX25hbWUgKyBcXFwiJm5ic3A7Jm5ic3A7PHNtYWxsPlxcXCIgKyBmb3JtYXREYXRlKHNoYXJlSW5mby51cGRhdGVkX2F0KSArIFxcXCI8L3NtYWxsPlxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogcmVhbHVybCArIFxcXCIjbm9IaXN0b3J5I1xcXCIsXFxuICAgICAgICAgICAgICAgIGltZzogc2hhcmVJbmZvLmF2YXRhcixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJhdmF0YXJcXFwiXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuS/neWtmOWIsOaIkeeahOe9keebmFxcXCIsXFxuICAgICAgICAgICAgdXJsOiBgc21hcnRkcml2ZTovL3NoYXJlL2Jyb3dzZT9zaGFyZUlkPSR7c2hhcmVJZH0mc2hhcmVQd2Q9JHtzaGFyZVB3ZH1gLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLlpI3liLbliIbkuqvpk77mjqVcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAganM6IEpTT04uc3RyaW5naWZ5KFxcXCJjb3B5Oi8vaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvXFxcIiArIHNoYXJlSWQpXFxuICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5aSN5Yi25paH5Lu25aS56ZO+5o6lXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGpzOiBKU09OLnN0cmluZ2lmeShcXFwiY29weTovL2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zL1xcXCIgKyBzaGFyZUlkICsgXFxcIi9mb2xkZXIvXFxcIiArIGZpbGVJZClcXG4gICAgICAgICAgICAgICAgfV1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi5qC35byPOlxcXCIgKyBzdHlsZSxcXG4gICAgICAgICAgICB1cmw6ICQoc3R5bGVzKS5zZWxlY3QoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJhbGl5dW5fc3R5bGVcXFwiLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lt7LliIfmjaJcXFwiO1xcbiAgICAgICAgICAgIH0sICksXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzNcXFwiXFxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLmjpLluo86XFxcIiArIG9yZGVyTmFtZSxcXG4gICAgICAgICAgICB1cmw6ICQob3JkZXJzS2V5cywgMikuc2VsZWN0KCgpID0+IHtcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFwiYWxpeXVuX29yZGVyXFxcIiwgaW5wdXQpO1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5YiH5o2i5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfM1xcXCJcXG4gICAgICAgIH0sIHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuaSreaUvjpcXFwiICsgZ2V0SXRlbShcXFwiYWxpeXVuX3BsYXlNb2RlXFxcIiwgXFxcIui9rOeggVxcXCIpLFxcbiAgICAgICAgICAgIHVybDogJChbXFxcIui9rOeggVxcXCIsXFxcIuWOn+eUu1xcXCJdKS5zZWxlY3QoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJhbGl5dW5fcGxheU1vZGVcXFwiLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/liIfmjaLmiJDlip9cXFwiO1xcbiAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8zXFxcIlxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZV9ibGFua1xcXCJcXG4gICAgICAgIH0pO1xcbiAgICB9XFxuICAgIGxldCByZXNjb2QgPSBhbGlTaGFyZUFwaS5nZXRMaXN0RmlsZShmaWxlSWQ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fdXJsLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZDogc2hhcmVJZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IE1ZX1BBUkFNUy5zaGFyZVRva2VuLFxcbiAgICAgICAgICAgICAgICAgICAgZmlsZUlkOiBmaWxlSXRlbS5maWxlX2lkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IHNoYXJlUHdkLFxcbiAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiBmaWxlSXRlbS5uYW1lXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgbGV0IHN1YnRpdGxlLCBsb25nYywgY2xzO1xcbiAgICAgICAgICAgIGxldCBuYW1lTm90RXh0ID0gZmlsZUl0ZW0ubmFtZS5yZXBsYWNlKCcuJyArIGZpbGVJdGVtLmZpbGVfZXh0ZW5zaW9uLCAnJyk7XFxuICAgICAgICAgICAgaWYgKGZpbGVUeXBlLnN1YnRpdGxlLmluY2x1ZGVzKGZpbGVJdGVtLmZpbGVfZXh0ZW5zaW9uKSkge1xcbiAgICAgICAgICAgICAgICBsb25nYyA9IFt7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuaMgui9veWtl+W5lVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoem0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignbW91bnR6aW11Jywgem0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/mjILovb3lrozmiJDvvIzlvZPliY3lrZfluZXmlofku7Y6ICcgKyB6bS5uYW1lICsgJy4nICsgem0uZXh0O1xcbiAgICAgICAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dDogZmlsZUl0ZW0uZmlsZV9leHRlbnNpb24sXFxuICAgICAgICAgICAgICAgICAgICAgICAgZmlsZV9pZDogZmlsZUl0ZW0uZmlsZV9pZCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBuYW1lTm90RXh0XFxuICAgICAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgICAgfV07XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChjYXRlID09PSBcXFwidmlkZW9cXFwiKSB7XFxuICAgICAgICAgICAgICAgIGlmICh6aW11bGlzdC5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gemltdWxpc3QuZmluZCh2ID0+IHYubmFtZS5pbmNsdWRlcyhuYW1lTm90RXh0KSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgY2xzID0gXFxcInBsYXlsaXN0XFxcIjtcXG4gICAgICAgICAgICAgICAgcGljX3VybCA9IGZpbGVJdGVtLnRodW1ibmFpbCB8fCBwaWNfdXJsO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBpZiAoc3R5bGUgPT09IFxcXCJ0ZXh0XzFcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGRlc2MgKz0gXFxcIlxcXFx0XFxcXHRcXFwiICsgZm9ybWF0U2l6ZShmaWxlSXRlbS5zaXplKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKHNoYXJlSWQsc2hhcmVQd2QsIHNoYXJlVG9rZW4sIGZpbGVJZCwgY2F0ZSwgc3VidGl0bGUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9hbGlsYXp5XFxcIikoc2hhcmVJZCwgc2hhcmVQd2QsIHNoYXJlVG9rZW4sIGZpbGVJZCwgY2F0ZSwgc3VidGl0bGUpO1xcbiAgICAgICAgICAgICAgICB9LCBzaGFyZUlkLCBzaGFyZVB3ZCwgTVlfUEFSQU1TLnNoYXJlVG9rZW4sIGZpbGVJdGVtLmZpbGVfaWQsIGNhdGUsIHN1YnRpdGxlKSxcXG4gICAgICAgICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogcGljX3VybCxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBmaWxlSXRlbS5maWxlX2lkLFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBsb25nYyxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogY2xzLFxcbiAgICAgICAgICAgICAgICAgICAgLy9pbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiBmaWxlSXRlbS5uYW1lXFxuICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICB9XFxuICAgIGlmIChjb250cy5sZW5ndGggPT09IDApIHtcXG4gICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgXFxcIn5+fuS7gOS5iOmDveayoeacieS6huWTpn5+flxcXCIuZm9udGNvbG9yKFxcXCJHcmF5XFxcIiksXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICB9XFxufVxcblxcbmxldCBpdGVtcyA9IFtdO1xcbnRyeSB7XFxuICAgIGlmIChNWV9QQUdFID4gMSAmJiAhbWFya2VyKSB7XFxuICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIFxcXCJ+fn7ku4DkuYjpg73msqHmnInkuoblk6Z+fn5cXFwiLmZvbnRjb2xvcihcXFwiR3JheVxcXCIpLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZSxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG4gICAgfSBlbHNlIHtcXG4gICAgICAgIGxvYWQoaXRlbXMpO1xcbiAgICB9XFxufSBjYXRjaCAoZSkge1xcbiAgICBpZiAoZS5uYW1lID09PSBcXFwiQWxpRXJyb3JcXFwiKSB7XFxuICAgICAgICBpZiAoZS5jb2RlID09PSBcXFwiSW52YWxpZFJlc291cmNlLlNoYXJlUHdkXFxcIikge1xcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuivt+i+k+WFpeaPkOWPlueggVxcXCIsXFxuICAgICAgICAgICAgICAgIGRlc2M6IHNoYXJlUHdkP1xcXCLigJzigJzmj5Dlj5bnoIHplJnor6/igJ3igJ1cXFwiOlxcXCJcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoKS5pbnB1dCgoTVlfUEFSQU1TKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBzZXRQYWdlUGFyYW1zKE9iamVjdC5hc3NpZ24oe30sIE1ZX1BBUkFNUywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkOiBpbnB1dFxcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgfSwgTVlfUEFSQU1TKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIlxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBpZiAoZS5zaWduaWZpY2FuY2UgPT09IDEpIHtcXG4gICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBlLm1lc3NhZ2UuYmlnKCkuYmlnKCkuZm9udGNvbG9yKFxcXCJyZWRcXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChlLnNpZ25pZmljYW5jZSA9PT0gMykge1xcbiAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIGUubWVzc2FnZS5iaWcoKS5mb250Y29sb3IoXFxcImdyZWVuXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMSdcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcblxcbiAgICB9IGVsc2Uge1xcbiAgICA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XRNaW51dGVzKClcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHl5ICsgJycgKyBkZCArICcnICsgSEggKyAnJyArIE1NICsgJycgKyBtbVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBsZXQgc2hhcmV0b2tlbiA9IEpTT04ucGFyc2UocmVxdWVzdCgnaHR0cHM6Ly9hcGkuYWxpeXVuZHJpdmUuY29tL3YyL3NoYXJlX2xpbmsvZ2V0X3NoYXJlX3Rva2VuJywge1xcbiAgICAgICAgICAgICAgICBib2R5OiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwic2hhcmVfcHdkXFxcIjogc2hhcmVQd2QsXFxuICAgICAgICAgICAgICAgICAgICBcXFwic2hhcmVfaWRcXFwiOiBzaGFyZV9pZFxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcXG4gICAgICAgICAgICAgICAgdGltZW91dDogMzAwMFxcbiAgICAgICAgICAgIH0pKS5zaGFyZV90b2tlbjtcXG4gICAgICAgICAgICBwdXRNeVZhcihcXFwiYWxpU2hhcmVUb2tlblxcXCIsIHNoYXJldG9rZW4pO1xcbiAgICAgICAgICAgIGxldCBoZWFkZXJzID0ge1xcbiAgICAgICAgICAgICAgICAnY29udGVudC10eXBlJzogJ2FwcGxpY2F0aW9uL2pzb247Y2hhcnNldD1VVEYtOCcsXFxuICAgICAgICAgICAgICAgIFxcXCJvcmlnaW5cXFwiOiBcXFwiaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tXFxcIixcXG4gICAgICAgICAgICAgICAgXFxcInJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL1xcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCJ1c2VyLWFnZW50XFxcIjogXFxcIk1vemlsbGEvNS4wIChXaW5kb3dzIE5UIDEwLjA7IFdpbjY0OyB4NjQpIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIENocm9tZS8xMTAuMC4wLjAgU2FmYXJpLzUzNy4zNiBFZGcvMTEwLjAuMTU4Ny40MVxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCJ4LWNhbmFyeVxcXCI6IFxcXCJjbGllbnQ9d2ViLGFwcD1hZHJpdmUsdmVyc2lvbj12My4xLjBcXFwiXFxuICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICBsZXQgbm93dGltZSA9IERhdGUubm93KCk7XFxuICAgICAgICAgICAgbGV0IG9sZHRpbWUgPSBwYXJzZUludChnZXRNeVZhcigndXNlcmluZm9DaGVja3RpbWUnLCAnMCcpLnJlcGxhY2UoJ3RpbWUnLCAnJykpO1xcbiAgICAgICAgICAgIGxldCB1c2VyaW5mbztcXG4gICAgICAgICAgICBsZXQgYWxpdXNlcmluZm8gPSBzdG9yYWdlMC5nZXRNeVZhcignYWxpdXNlcmluZm8nKTtcXG4gICAgICAgICAgICBpZiAoYWxpdXNlcmluZm8gJiYgYWxpdXNlcmluZm8udXNlcl9pZCAmJiBub3d0aW1lIDwgKG9sZHRpbWUgKyAxICogNjAgKiA2MCAqIDEwMDApKSB7XFxuICAgICAgICAgICAgICAgIHVzZXJpbmZvID0gYWxpdXNlcmluZm87XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdXNlcmluZm8gPSBKU09OLnBhcnNlKHJlcXVlc3QoJ2h0dHBzOi8vYXV0aC5hbGl5dW5kcml2ZS5jb20vdjIvYWNjb3VudC90b2tlbicsIHtcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxuICAgICAgICAgICAgICAgICAgICBib2R5OiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcInJlZnJlc2hfdG9rZW5cXFwiOiBhbGl0b2tlbixcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwiZ3JhbnRfdHlwZVxcXCI6IFxcXCJyZWZyZXNoX3Rva2VuXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxcbiAgICAgICAgICAgICAgICAgICAgdGltZW91dDogMzAwMFxcbiAgICAgICAgICAgICAgICB9KSk7XFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdhbGl1c2VyaW5mbycsIHVzZXJpbmZvKTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ3VzZXJpbmZvQ2hlY2t0aW1lJywgbm93dGltZSArICd0aW1lJyk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBhdXRob3JpemF0aW9uID0gJ0JlYXJlciAnICsgdXNlcmluZm8uYWNjZXNzX3Rva2VuO1xcbiAgICAgICAgICAgIGxldCBkZXZpY2VJZCA9IHVzZXJpbmZvLmRldmljZV9pZDtcXG4gICAgICAgICAgICBsZXQgdXNlcklkID0gdXNlcmluZm8udXNlcl9pZDtcXG4gICAgICAgICAgICBsZXQgc2lnbmF0dXJlO1xcbiAgICAgICAgICAgIGxldCBwdWJsaWNfa2V5O1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIHJlZnJlc2hUb2tlbjEoKSB7XFxuICAgICAgICAgICAgICAgIG5vd3RpbWUgPSBEYXRlLm5vdygpO1xcbiAgICAgICAgICAgICAgICB1c2VyaW5mbyA9IEpTT04ucGFyc2UocmVxdWVzdCgnaHR0cHM6Ly9hdXRoLmFsaXl1bmRyaXZlLmNvbS92Mi9hY2NvdW50L3Rva2VuJywge1xcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXG4gICAgICAgICAgICAgICAgICAgIGJvZHk6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwicmVmcmVzaF90b2tlblxcXCI6IGFsaXRva2VuLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJncmFudF90eXBlXFxcIjogXFxcInJlZnJlc2hfdG9rZW5cXFwiXFxuICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsXFxuICAgICAgICAgICAgICAgICAgICB0aW1lb3V0OiAzMDAwXFxuICAgICAgICAgICAgICAgIH0pKTtcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2FsaXVzZXJpbmZvJywgdXNlcmluZm8pO1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcigndXNlcmluZm9DaGVja3RpbWUnLCBub3d0aW1lICsgJ3RpbWUnKTtcXG4gICAgICAgICAgICAgICAgYXV0aG9yaXphdGlvbiA9ICdCZWFyZXIgJyArIHVzZXJpbmZvLmFjY2Vzc190b2tlbjtcXG4gICAgICAgICAgICAgICAgZGV2aWNlSWQgPSB1c2VyaW5mby5kZXZpY2VfaWQ7XFxuICAgICAgICAgICAgICAgIHVzZXJJZCA9IHVzZXJpbmZvLnVzZXJfaWQ7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGxldCBhID0ganVzdFRlc3RTaWduKFxcXCI1ZGRlNGUxYmRmOWU0OTY2YjM4N2JhNThmNGIzZmRjM1xcXCIsIGRldmljZUlkLCB1c2VySWQpO1xcbiAgICAgICAgICAgIC8vbGV0IGEgPSBqdXN0VGVzdFNpZ24oXFxcIjI1ZHpYM3ZiWXFrdFZ4eVhcXFwiLCBkZXZpY2VJZCwgdXNlcklkKTtcXG4gICAgICAgICAgICAvL2xvZyhhKTtcXG4gICAgICAgICAgICBsZXQgYiA9IGEuc3BsaXQoXFxcIiMjXFxcIik7XFxuICAgICAgICAgICAgbGV0IHNpZ24gPSBiWzBdO1xcbiAgICAgICAgICAgIGxldCBwdWJLZXkgPSBiW2IubGVuZ3RoIC0gMV07XFxuICAgICAgICAgICAgbGV0IGkgPSAwO1xcbiAgICAgICAgICAgIGRvIHtcXG4gICAgICAgICAgICAgICAgbGV0IHNlc3MgPSBmZXRjaCgnaHR0cHM6Ly9hcGkuYWxpeXVuZHJpdmUuY29tL3VzZXJzL3YxL3VzZXJzL2RldmljZS9jcmVhdGVfc2Vzc2lvbicsIHtcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAnQ29udGVudC1UeXBlJzogJ2FwcGxpY2F0aW9uL2pzb24nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnQXV0aG9yaXphdGlvbic6IGF1dGhvcml6YXRpb24sXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ1gtU2hhcmUtVG9rZW4nOiBzaGFyZXRva2VuLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICd4LWRldmljZS1pZCc6IGRldmljZUlkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICd4LXNpZ25hdHVyZSc6IHNpZ25cXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICBib2R5OiAne1xcXCJkZXZpY2VOYW1lXFxcIjpcXFwiRWRnZea1j+iniOWZqFxcXCIsXFxcIm1vZGVsTmFtZVxcXCI6XFxcIldpbmRvd3PnvZHpobXniYhcXFwiLFxcXCJub25jZVxcXCI6MCxcXFwicHViS2V5XFxcIjpcXFwiJyArIHB1YktleSArICdcXFwiLFxcXCJyZWZyZXNoVG9rZW5cXFwiOlxcXCInICsgYWxpdG9rZW4gKyAnXFxcIn0nLFxcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCdcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIGxvZyhzZXNzKTtcXG4gICAgICAgICAgICAgICAgaWYgKHNlc3MuaW5jbHVkZXMoJ3N1Y2Nlc3MnKSkge1xcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgamF2YS5sYW5nLlRocmVhZC5zbGVlcCgxNTApO1xcbiAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW4xKCk7XFxuICAgICAgICAgICAgICAgIGEgPSBqdXN0VGVzdFNpZ24oXFxcIjVkZGU0ZTFiZGY5ZTQ5NjZiMzg3YmE1OGY0YjNmZGMzXFxcIiwgZGV2aWNlSWQsIHVzZXJJZCk7XFxuICAgICAgICAgICAgICAgIC8vbG9nKGEpO1xcbiAgICAgICAgICAgICAgICBiID0gYS5zcGxpdChcXFwiIyNcXFwiKTtcXG4gICAgICAgICAgICAgICAgc2lnbiA9IGJbMF07XFxuICAgICAgICAgICAgICAgIHB1YktleSA9IGJbYi5sZW5ndGggLSAxXTtcXG4gICAgICAgICAgICAgICAgaSsrO1xcbiAgICAgICAgICAgIH0gd2hpbGUgKGkgPCA1KTtcXG4gICAgICAgICAgICBzaWduYXR1cmUgPSBzaWduO1xcbiAgICAgICAgICAgIHB1YmxpY19rZXkgPSBwdWJLZXk7XFxuICAgICAgICAgICAgLypcXG4gICAgICAgICAgICBsZXQgYSA9IGp1c3RUZXN0U2lnbignNWRkZTRlMWJkZjllNDk2NmIzODdiYTU4ZjRiM2ZkYzMnLGRldmljZUlkLHVzZXJJZCk7XFxuICAgICAgICAgICAgc2lnbmF0dXJlID0gYS5zcGxpdCgnIyMnKVswXTtcXG4gICAgICAgICAgICBwdWJsaWNfa2V5ID0gYS5zcGxpdCgnIyMnKVsxXTtcXG4gICAgICAgICAgICAqL1xcbiAgICAgICAgICAgIGhlYWRlcnNbJ2F1dGhvcml6YXRpb24nXSA9IGF1dGhvcml6YXRpb247XFxuICAgICAgICAgICAgaGVhZGVyc1sneC1kZXZpY2UtaWQnXSA9IGRldmljZUlkO1xcbiAgICAgICAgICAgIGhlYWRlcnNbJ3gtc2lnbmF0dXJlJ10gPSBzaWduYXR1cmU7XFxuICAgICAgICAgICAgbGV0IGRhdGEgPSB7XFxuICAgICAgICAgICAgICAgIFxcXCJkZXZpY2VOYW1lXFxcIjogXFxcIkVkZ2XmtY/op4jlmahcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwibW9kZWxOYW1lXFxcIjogXFxcIldpbmRvd3PnvZHpobXniYhcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwicHViS2V5XFxcIjogcHVibGljX2tleSxcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGFsaXl1blVybCA9IFtdO1xcbiAgICAgICAgICAgIGlmIChzaWduYXR1cmUgJiYgcHVibGljX2tleSkge1xcbiAgICAgICAgICAgICAgICBsZXQgcmVxID0gSlNPTi5wYXJzZShyZXF1ZXN0KFxcXCJodHRwczovL2FwaS5hbGl5dW5kcml2ZS5jb20vdXNlcnMvdjEvdXNlcnMvZGV2aWNlL2NyZWF0ZV9zZXNzaW9uXFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXG4gICAgICAgICAgICAgICAgICAgIGJvZHk6IGRhdGEsXFxuICAgICAgICAgICAgICAgICAgICB0aW1lb3V0OiAzMDAwXFxuICAgICAgICAgICAgICAgIH0pKTtcXG4gICAgICAgICAgICAgICAgaWYgKHJlcS5zdWNjZXNzKSB7XFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzWyd4LXNoYXJlLXRva2VuJ10gPSBzaGFyZXRva2VuO1xcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyc1snZmlsZWlkJ10gPSB1c2VySWQ7XFxuICAgICAgICAgICAgICAgICAgICBkYXRhID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJjYXRlZ29yeVxcXCI6IFxcXCJsaXZlX3RyYW5zY29kaW5nXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwiZmlsZV9pZFxcXCI6IGZpbGVfaWQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcImdldF9wcmV2aWV3X3VybFxcXCI6IHRydWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcInNoYXJlX2lkXFxcIjogc2hhcmVfaWQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcInRlbXBsYXRlX2lkXFxcIjogXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcImdldF9zdWJ0aXRsZV9pbmZvXFxcIjogdHJ1ZVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKHJlcXVlc3QoJ2h0dHBzOi8vYXBpLmFsaXl1bmRyaXZlLmNvbS92Mi9maWxlL2dldF9zaGFyZV9saW5rX3ZpZGVvX3ByZXZpZXdfcGxheV9pbmZvJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogZGF0YSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aW1lb3V0OiAzMDAwXFxuICAgICAgICAgICAgICAgICAgICB9KSk7XFxuICAgICAgICAgICAgICAgICAgICBhbGl5dW5VcmwgPSBqc29uLnZpZGVvX3ByZXZpZXdfcGxheV9pbmZvLmxpdmVfdHJhbnNjb2RpbmdfdGFza19saXN0O1xcbiAgICAgICAgICAgICAgICAgICAgYWxpeXVuVXJsLnJldmVyc2UoKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gYWxpeXVuVXJsO1xcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGxvZygn5qC55o2u5YWx5Lqr6ZO+5o6l6I635Y+W5pKt5pS+5Zyw5Z2A5aSx6LSlPicgKyBlLm1lc3NhZ2UpO1xcbiAgICAgICAgICAgIHJldHVybiBcXFwiXFxcIjtcXG4gICAgICAgIH1cXG4gICAgfVxcblxcbiAgICBmdW5jdGlvbiBnZXRBbGlVcmwoc2hhcmVfaWQsIHNoYXJlUHdkLCBmaWxlX2lkLCBhbGl0b2tlbikge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBsZXQgdXJscyA9IFtdO1xcbiAgICAgICAgICAgIGxldCBuYW1lcyA9IFtdO1xcbiAgICAgICAgICAgIGxldCBoZWFkcyA9IFtdO1xcbiAgICAgICAgICAgIGxldCB1ID0gc3RhcnRQcm94eVNlcnZlcigkLnRvU3RyaW5nKChhbGlTaGFyZVBsYXlVcmwsIGZpbGVfaWQsIHNoYXJlX2lkLCBzaGFyZVB3ZCwgYWxpdG9rZW4pID0+IHtcXG4gICAgICAgICAgICAgICAgZnVuY3Rpb24gZ2V0dXJsKGZpbGVpZCwgbGluZSkge1xcbiAgICAgICAgICAgICAgICAgICAgLy/pooTliqDovb3ml7bkvJrlj5hmaWxlX2lkLOaJgOS7pXRz6L+H5pyf5pu05paw5pe26L+Y5Y+W5Y6f5p2l55qEaWRcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsTGlzdCA9IGFsaVNoYXJlUGxheVVybChzaGFyZV9pZCwgc2hhcmVQd2QsIGZpbGVpZCwgYWxpdG9rZW4pIHx8IFtdO1xcbiAgICAgICAgICAgICAgICAgICAgLy9sb2cobGluZSk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgYWxpdXJsO1xcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwbGF5VXJsTGlzdC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLnRlbXBsYXRlX2lkID09IGxpbmUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaXVybCA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyphbGl1cmwgPSBKU09OLnBhcnNlKHJlcXVlc3QoaXRlbS51cmwsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS8nXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbmx5SGVhZGVyczogdHJ1ZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWRpcmVjdDogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogMzAwMFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLmhlYWRlcnMubG9jYXRpb25bMF07Ki9cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhlLnRvU3RyaW5nKCkpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgLy/kuIrpnaLmmK/ojrflj5bpmL/ph4znmoTmkq3mlL7lnLDlnYBcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi5oiR5Zyo5Luj55CGXFxcIiArIGFsaXVybCk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgaG9tZSA9IGFsaXVybC5zcGxpdCgnbWVkaWEubTN1OCcpWzBdO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGYgPSBmZXRjaChhbGl1cmwsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS8nXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aW1lb3V0OiAzMDAwXFxuICAgICAgICAgICAgICAgICAgICB9KS5zcGxpdChcXFwiXFxcXG5cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBmZiA9IGYubWFwKGl0ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXQuc3RhcnRzV2l0aChcXFwibWVkaWEtXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCIvcHJveHk/dXJsPVxcXCIgKyBiYXNlNjRFbmNvZGUoaG9tZSArIGl0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGl0O1xcbiAgICAgICAgICAgICAgICAgICAgfSkuam9pbihcXFwiXFxcXG5cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGxvZygndWZpZC0nICsgZmlsZWlkKTtcXG4gICAgICAgICAgICAgICAgICAgIHdyaXRlRmlsZSgnaGlrZXI6Ly9maWxlcy9jYWNoZS9fZmlsZVNlbGVjdF8nICsgZmlsZWlkICsgJy5tM3U4JywgZmYpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZmO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSBiYXNlNjREZWNvZGUoTVlfUEFSQU1TLnVybCk7XFxuICAgICAgICAgICAgICAgIGlmICh1cmwuaW5jbHVkZXMoXFxcIi50c1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgZmlkID0gdXJsLnNwbGl0KCcmZj0nKVsxXS5zcGxpdCgnJicpWzBdO1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKCdzZmlkLScgKyBmaWQpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGYgPSBmZXRjaCgnaGlrZXI6Ly9maWxlcy9jYWNoZS9fZmlsZVNlbGVjdF8nICsgZmlkICsgJy5tM3U4Jykuc3BsaXQoXFxcIlxcXFxuXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBmLmZvckVhY2goaXQgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdCAmJiBpdC5zdGFydHNXaXRoKCcvcHJveHk/dXJsPScpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBmdXJsID0gYmFzZTY0RGVjb2RlKGl0LnJlcGxhY2UoJy9wcm94eT91cmw9JywgJycpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5zdWJzdHIodXJsLmluZGV4T2YoJy9tZWRpYS0nKSwgdXJsLmluZGV4T2YoJy50cycpKSA9PSBmdXJsLnN1YnN0cihmdXJsLmluZGV4T2YoJy9tZWRpYS0nKSwgZnVybC5pbmRleE9mKCcudHMnKSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IGZ1cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGV4cGlyZXMgPSB1cmwuc3BsaXQoJ3gtb3NzLWV4cGlyZXM9JylbMV0uc3BsaXQoJyYnKVswXTtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGxhc3R0aW1lID0gcGFyc2VJbnQoZXhwaXJlcykgLSBEYXRlLm5vdygpIC8gMTAwMDtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChsYXN0dGltZSA8IDYwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coJ+i/h+acn+abtOaWsCcpXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGxpbmUgPSB1cmwuc3BsaXQoJy9tZWRpYScpWzBdOyAvL+WPluS5i+WJjeaSreaUvueahHRz5q6157q/6LevXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGluZSA9IGxpbmUuc3Vic3RyaW5nKGxpbmUubGFzdEluZGV4T2YoJy8nKSArIDEpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBmID0gZ2V0dXJsKGZpZCwgbGluZSkuc3BsaXQoXFxcIlxcXFxuXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZi5mb3JFYWNoKGl0ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0ICYmIGl0LnN0YXJ0c1dpdGgoJy9wcm94eT91cmw9JykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBmdXJsID0gYmFzZTY0RGVjb2RlKGl0LnJlcGxhY2UoJy9wcm94eT91cmw9JywgJycpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1cmwuc3Vic3RyKHVybC5pbmRleE9mKCcvbWVkaWEtJyksIHVybC5pbmRleE9mKCcudHMnKSkgPT0gZnVybC5zdWJzdHIoZnVybC5pbmRleE9mKCcvbWVkaWEtJyksIGZ1cmwuaW5kZXhPZignLnRzJykpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsID0gZnVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKCfmnKrov4fmnJ8nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi5Luj55CGdHPvvJpcXFwiICsgdXJsKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzQ29kZTogMzAyLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcIkxvY2F0aW9uXFxcIjogdXJsLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKCfpppbmrKHmm7TmlrAnKVxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGxpbmUgPSB1cmwuc3BsaXQoJ3wnKVsxXTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBmZiA9IGdldHVybChmaWxlX2lkLCBsaW5lKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmZjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0sIGFsaVNoYXJlUGxheVVybCwgZmlsZV9pZCwgc2hhcmVfaWQsIHNoYXJlUHdkLCBhbGl0b2tlbikpO1xcbiAgICAgICAgICAgIGxldCBwbGF5VXJsTGlzdCA9IGFsaVNoYXJlUGxheVVybChzaGFyZV9pZCwgc2hhcmVQd2QsIGZpbGVfaWQsIGFsaXRva2VuKSB8fCBbXTtcXG5cXG5cXG4gICAgICAgICAgICBpZiAocGxheVVybExpc3QubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICBwbGF5VXJsTGlzdC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICB1cmxzLnB1c2godSArIFxcXCI/dXJsPVxcXCIgKyBiYXNlNjRFbmNvZGUoaXRlbS51cmwgKyBcXFwifFxcXCIgKyBpdGVtLnRlbXBsYXRlX2lkKSArIFxcXCIjLm0zdThcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzLnB1c2godHJhbnNjb2RpbmdbaXRlbS50ZW1wbGF0ZV9pZF0gPyB0cmFuc2NvZGluZ1tpdGVtLnRlbXBsYXRlX2lkXSA6IGl0ZW0udGVtcGxhdGVfaGVpZ2h0KTtcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRzLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS8nXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfSlcXG5cXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IHVybHMsXFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogbmFtZXMsXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkcyxcXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBsb2coJ+acquiOt+WPlumYv+mHjOaSreaUvuWcsOWdgO+8jOW7uuiurumHjei/m+i9r+S7tuWGjeivleS4gOasoScpXFxuICAgICAgICAgICAgICAgIHJldHVybiB7fTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgbG9nKCfojrflj5blhbHkuqvpk77mjqXmkq3mlL7lnLDlnYDlpLHotKU+JyArIGUubWVzc2FnZSk7XFxuICAgICAgICAgICAgdGhyb3cgZTtcXG4gICAgICAgICAgICByZXR1cm4ge307XFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgcmV0dXJuIGdldEFsaVVybChcXG4gICAgICAgIHNoYXJlSWQsXFxuICAgICAgICBzaG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NvZGUgPT09IFxcXCJJbnZhbGlkUGFyYW1ldGVyLlJlZnJlc2hUb2tlblxcXCIpe1xcbiAgICAgICAgICAgICAgICBlLm1lc3NhZ2UgPSBcXFwiI+eZu+mZhui/h+acn+ivt+mHjeaWsOeZu+mZhiNcXFxcblxcXCIrZS5tZXNzYWdlO1xcbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgZGVsZXRlIHJlc3VsdC51c2VyX2RhdGE7XFxuICAgICAgICB0aGlzLmFsaVRva2VucyA9IE9iamVjdC5hc3NpZ24odGhpcy5hbGlUb2tlbnMsIHJlc3VsdCk7XFxuICAgICAgICB0aGlzLnJlYWNjZXNzVGsgPSB0aGlzLmFsaVRva2Vucy50b2tlbl90eXBlICsgJyAnICsgdGhpcy5hbGlUb2tlbnMuYWNjZXNzX3Rva2VuO1xcbiAgICAgICAgdGhpcy5yZWZyZXNoQWNjZXNzQ2FsbEJhY2socmVzdWx0LCB0aGlzKTtcXG4gICAgICAgIHJldHVybiB0aGlzLmFsaVRva2VucztcXG4gICAgfSxcXG4gICAgX2dldE9wZW5Ub2tlbihjb2RlKSB7XFxuICAgICAgICBsZXQgYm9keSA9IHt9LFxcbiAgICAgICAgICAgIGhlYWRlcnMgPSB7XFxuICAgICAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUEsXFxuICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS8nXFxuICAgICAgICAgICAgfTtcXG4gICAgICAgIGlmIChjb2RlKSB7XFxuICAgICAgICAgICAgYm9keSA9IHtcXG4gICAgICAgICAgICAgICAgY29kZTogY29kZSxcXG4gICAgICAgICAgICAgICAgZ3JhbnRfdHlwZTogXFxcImF1dGhvcml6YXRpb25fY29kZVxcXCJcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBib2R5ID0ge1xcbiAgICAgICAgICAgICAgICBncmFudF90eXBlOiBcXFwicmVmcmVzaF90b2tlblxcXCIsXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IHRoaXMub3BlblRva2Vucy5SZWZyZXNoVG9rZW5PcGVuLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBqc29uID0gcG9zdCgnaHR0cHM6Ly9hcGkueGhvZmUudG9wL2FsaXN0L2FsaV9vcGVuL2NvZGUnLCB7XFxuICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXG4gICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeShib2R5KSxcXG4gICAgICAgIH0pO1xcbiAgICAgICAgaWYgKCFqc29uKSB7XFxuICAgICAgICAgICAganNvbiA9IHBvc3QoJ2h0dHBzOi8vYXBpLWNmLm5uLmNpL2FsaXN0L2FsaV9vcGVuL2NvZGUnLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxuICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KGJvZHkpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGpzb24uaW5jbHVkZXMoJ1RvbyBNYW55IFJlcXVlc3RzJyl8fGpzb24uaW5jbHVkZXMoXFxcIjUwMiBCYWQgR2F0ZXdheVxcXCIpKSB7XFxuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLpopHnuYHor7fmsYLmmoLml7booqvlsIHnpoFcXFxcblxcXCIgKyBqc29uKTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgbGV0IG9wZW5SZXN1bHQgPSBKU09OLnBhcnNlKGpzb24pO1xcbiAgICAgICAgICAgIGlmIChvcGVuUmVzdWx0LnJlZnJlc2hfdG9rZW4pIHtcXG4gICAgICAgICAgICAgICAgdGhpcy5vcGVuVG9rZW5z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hdGU9Jywge1xcbiAgICAgICAgICAgIFxcXCJhdXRob3JpemVcXFwiOiAxLFxcbiAgICAgICAgICAgIFxcXCJzY29wZVxcXCI6IFxcXCJ1c2VyOmJhc2UsZmlsZTphbGw6cmVhZCxmaWxlOmFsbDp3cml0ZVxcXCJcXG4gICAgICAgIH0sIHtcXG4gICAgICAgICAgICAnVXNlci1BZ2VudCc6IFBDX1VBLFxcbiAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS8nLFxcbiAgICAgICAgICAgICdhdXRob3JpemF0aW9uJzogdGhpcy5yZWFjY2Vzc1RrLCAvL2dldEFjY2Vzc1Rva2VuXFxuICAgICAgICAgICAgJ3gtY2FuYXJ5JzogJ2NsaWVudD13ZWIsYXBwPXNoYXJlLHZlcnNpb249djIuMy4xJyxcXG4gICAgICAgICAgICAneC1zaGFyZS10b2tlbic6IHRoaXMuc2hhcmVUb2tlblxcbiAgICAgICAgfSwgKCkgPT4ge1xcbiAgICAgICAgICAgIHRoaXMud2FpdFNsZWVwKDIwKS5nZXRTaGFyZVRva2VuKCk7XFxuICAgICAgICAgICAgdGhpcy53YWl0U2xlZXAoMjApLnJlZnJlc2hBY2Nlc3NUb2tlbigpO1xcbiAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6e1xcbiAgICAgICAgICAgICAgICAgICAgJ2F1dGhvcml6YXRpb24nOiB0aGlzLnJlYWNjZXNzVGssXFxuICAgICAgICAgICAgICAgICAgICAneC1zaGFyZS10b2tlbic6IHRoaXMuc2hhcmVUb2tlblxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuXFxuICAgICAgICBsZXQgY29kZSA9IHJlc3VsdC5yZWRpcmVjdFVyaS5zcGxpdChcXFwiY29kZT1cXFwiKVsxXTtcXG4gICAgICAgIHJldHVybiB0aGlzLl9nZXRPcGVuVG9rZW4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FxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiBQQ19VQSxcXG4gICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJyxcXG4gICAgICAgICAgICAnYXV0aG9yaXphdGlvbic6IHRoaXMucmVhY2Nlc3NUayxcXG4gICAgICAgICAgICAvL2dldEFjY2Vzc1Rva2VuXFxuICAgICAgICAgICAgJ3gtY2FuYXJ5JzogJ2NsaWVudD13ZWIsYXBwPXNoYXJlLHZlcnNpb249djIuMy4xJyxcXG4gICAgICAgICAgICAneC1zaGFyZS10b2tlbic6IHRoaXMuc2hhcmVUb2tlblxcblxcbiAgICAgICAgfSwgKCkgPT4ge1xcbiAgICAgICAgICAgIHRoaXMud2FpdFNsZWVwKDIwKS5nZXRTaGFyZVRva2VuKCk7XFxuICAgICAgICAgICAgdGhpcy53YWl0U2xlZXAoMjApLnJlZnJlc2hBY2Nlc3NUb2tlbigpO1xcbiAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgIGJvZHk6e1xcbiAgICAgICAgICAgICAgICAgICAgJ2F1dGhvcml6YXRpb24nOiB0aGlzLnJlYWNjZXNzVGssXFxuICAgICAgICAgICAgICAgICAgICAneC1zaGFyZS10b2tlbic6IHRoaXMuc2hhcmVUb2tlblxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfTtcXG4gICAgICAgIH0pO1xcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcXG4gICAgfSxcXG4gICAgY29weUZpbGVUb0Nsb3VkRmlsZShmaWxlSWQsIHJldHJ5KSB7XFxuICAgICAgICBsZXQgcmVzdWx0ID0gdGhpcy5fY2xvdWRGaWxlT3BlcmF0ZSh7XFxuICAgICAgICAgICAgXFxcImZpbGVfaWRcXFwiOiBmaWxlSWQsXFxuICAgICAgICAgICAgXFxcInNoYXJlX2lkXFxcIjogdGhpcy5zaGFyZUlkLFxcbiAgICAg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XS5zcGxpdChcXFwiI1xcXCIpO1xcbiAgICBsZXQgc3R5bGVzID0gW1xcXCJ0ZXh0XzFcXFwiLCBcXFwibW92aWVfMlxcXCIsXFxcImNhcmRfcGljXzNcXFwiLCBcXFwiYXZhdGFyXFxcIl07XFxuICAgIGxldCBzdHlsZSA9IGdldEl0ZW0oXFxcImFsaXl1bl9zdHlsZVxcXCIsIHN0eWxlc1swXSk7XFxuICAgIGlmIChNWV9QQUdFID09PSAxKSB7XFxuICAgICAgICBpZiAoIWdldE15VmFyKFxcXCJtb3VudHppbXVcXFwiLCBcXFwiXFxcIikpIHtcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihcXFwibW91bnR6aW11XFxcIiwge30pO1xcbiAgICAgICAgICAgIGFkZExpc3RlbmVyKFxcXCJvbkNsb3NlXFxcIiwgJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcIm1vdW50emltdVxcXCIpO1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJhbGlTaGFyZVRva2VuXFxcIik7XFxuICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgfVxcbiAgICAgICAgc2V0TWFya2VyKCk7XFxuICAgICAgICBpZiAocmVhbHVybCkge1xcbiAgICAgICAgICAgIGxldCBzaGFyZUluZm8gPSBhbGlTaGFyZUFwaS5nZXRTaGFyZUluZm8oKTtcXG4gICAgICAgICAgICBsZXQgZmlsZUluZm8gPSBzaGFyZUluZm8uZmlsZV9pbmZvcztcXG4gICAgICAgICAgICBpZiAoZmlsZUluZm8ubGVuZ3RoID09PSAxICYmIGZpbGVJbmZvWzBdLnR5cGUgPT09IFxcXCJmb2xkZXJcXFwiJiYhZmlsZUlkKSB7XFxuICAgICAgICAgICAgICAgIGZpbGVJZCA9IGZpbGVJbmZvWzBdLmZpbGVfaWQ7XFxuICAgICAgICAgICAgICAgIHNldFBhZ2VUaXRsZShmaWxlSW5mb1swXS5maWxlX25hbWUpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHNldFBhZ2VUaXRsZShzaGFyZUluZm8uc2hhcmVfbmFtZSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogc2hhcmVJbmZvLmNyZWF0b3JfbmFtZSArIFxcXCImbmJzcDsmbmJzcDs8c21hbGw+XFxcIiArIGZvcm1hdERhdGUoc2hhcmVJbmZvLnVwZGF0ZWRfYXQpICsgXFxcIjwvc21hbGw+XFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiByZWFsdXJsICsgXFxcIiNub0hpc3RvcnkjXFxcIixcXG4gICAgICAgICAgICAgICAgaW1nOiBzaGFyZUluZm8uYXZhdGFyLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImF2YXRhclxcXCJcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi5L+d5a2Y5Yiw5oiR55qE572R55uYXFxcIixcXG4gICAgICAgICAgICB1cmw6IGBzbWFydGRyaXZlOi8vc2hhcmUvYnJvd3NlP3NoYXJlSWQ9JHtzaGFyZUlkfSZzaGFyZVB3ZD0ke3NoYXJlUHdkfWAsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuWkjeWItuWIhuS6q+mTvuaOpVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBqczogSlNPTi5zdHJpbmdpZnkoXFxcImNvcHk6Ly9odHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9cXFwiICsgc2hhcmVJZClcXG4gICAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLlpI3liLbmlofku7blpLnpk77mjqVcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAganM6IEpTT04uc3RyaW5naWZ5KFxcXCJjb3B5Oi8vaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvXFxcIiArIHNoYXJlSWQgKyBcXFwiL2ZvbGRlci9cXFwiICsgZmlsZUlkKVxcbiAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLmoLflvI86XFxcIiArIHN0eWxlLFxcbiAgICAgICAgICAgIHVybDogJChzdHlsZXMpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcImFsaXl1bl9zdHlsZVxcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3suWIh+aNolxcXCI7XFxuICAgICAgICAgICAgfSwgKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfM1xcXCJcXG4gICAgICAgIH0sIHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuaOkuW6jzpcXFwiICsgb3JkZXJOYW1lLFxcbiAgICAgICAgICAgIHVybDogJChvcmRlcnNLZXlzLCAyKS5zZWxlY3QoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJhbGl5dW5fb3JkZXJcXFwiLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/liIfmjaLmiJDlip9cXFwiO1xcbiAgICAgICAgICAgIH0pLFxcbiAgICA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2MgPSBmb3JtYXREYXRlKGZpbGVJdGVtLnVwZGF0ZWRfYXQpO1xcbiAgICAgICAgbGV0IHRpdGxlID0gKHN0eWxlID09PSBcXFwidGV4dF8xXFxcIiA/ICh0aXRsZUhlYWRbY2F0ZSB8fCBmaWxlSXRlbS50eXBlXSB8fCBcXFwi4p2TXFxcIikgOiBcXFwiXFxcIikgKyBmaWxlSXRlbS5uYW1lO1xcbiAgICAgICAgbGV0IHBpY191cmwgPSBnZXRJY29uKGZpbGVJdGVtLmZpbGVfZXh0ZW5zaW9uLCBmaWxlSXRlbS50eXBlKTtcXG4gICAgICAgIGlmIChmaWxlSXRlbS50eXBlID09PSBcXFwiZm9sZGVyXFxcIikge1xcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9hbGl5dW4/cGFnZT1meXBhZ2UnLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxuICAgICAgICAgICAgICAgIGRlc2M6IGZvcm1hdERhdGUoZmlsZUl0ZW0udXBkYXRlZF9hdCksXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IHBpY191cmwsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBzaGFyZUlkOiBzaGFyZUlkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogTVlfUEFSQU1TLnNoYXJlVG9rZW4sXFxuICAgICAgICAgICAgICAgICAgICBmaWxlSWQ6IGZpbGVJdGVtLmZpbGVfaWQsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2QsXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGZpbGVJdGVtLm5hbWVcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgc3VidGl0bGUsIGxvbmdjLCBjbHM7XFxuICAgICAgICAgICAgbGV0IG5hbWVOb3RFeHQgPSBmaWxlSXRlbS5uYW1lLnJlcGxhY2UoJy4nICsgZmlsZUl0ZW0uZmlsZV9leHRlbnNpb24sICcnKTtcXG4gICAgICAgICAgICBpZiAoZmlsZVR5cGUuc3VidGl0bGUuaW5jbHVkZXMoZmlsZUl0ZW0uZmlsZV9leHRlbnNpb24pKSB7XFxuICAgICAgICAgICAgICAgIGxvbmdjID0gW3tcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5oyC6L295a2X5bmVXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKCh6bSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdtb3VudHppbXUnLCB6bSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+aMgui9veWujOaIkO+8jOW9k+WJjeWtl+W5leaWh+S7tjogJyArIHptLm5hbWUgKyAnLicgKyB6bS5leHQ7XFxuICAgICAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiBmaWxlSXRlbS5maWxlX2V4dGVuc2lvbixcXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlX2lkOiBmaWxlSXRlbS5maWxlX2lkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IG5hbWVOb3RFeHRcXG4gICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICB9XTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGNhdGUgPT09IFxcXCJ2aWRlb1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgaWYgKHppbXVsaXN0Lmxlbmd0aCkge1xcbiAgICAgICAgICAgICAgICAgICAgc3VidGl0bGUgPSB6aW11bGlz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gICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IGxvbmdjLFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBjbHMsXFxuICAgICAgICAgICAgICAgICAgICAvL2luaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGZpbGVJdGVtLm5hbWVcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgaWYgKGNvbnRzLmxlbmd0aCA9PT0gMCkge1xcbiAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBcXFwifn5+5LuA5LmI6YO95rKh5pyJ5LqG5ZOmfn5+XFxcIi5mb250Y29sb3IoXFxcIkdyYXlcXFwiKSxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2UsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuICAgIH1cXG59XFxuXFxubGV0IGl0ZW1zID0gW107XFxudHJ5IHtcXG4gICAgaWYgKE1ZX1BBR0UgPiAxICYmICFtYXJrZXIpIHtcXG4gICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgXFxcIn5+fuS7gOS5iOmDveayoeacieS6huWTpn5+flxcXCIuZm9udGNvbG9yKFxcXCJHcmF5XFxcIiksXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgbG9hZChpdGVtcyk7XFxuICAgIH1cXG59IGNhdGNoIChlKSB7XFxuICAgIGlmIChlLm5hbWUgPT09IFxcXCJBbGlFcnJvclxcXCIpIHtcXG4gICAgICAgIGlmIChlLmNvZGUgPT09IFxcXCJJbnZhbGlkUmVzb3VyY2UuU2hhcmVQd2RcXFwiKSB7XFxuICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi6K+36L6T5YWl5o+Q5Y+W56CBXFxcIixcXG4gICAgICAgICAgICAgICAgZGVzYzogc2hhcmVQd2Q/XFxcIuKAnOKAnOaPkOWPlueggemUmeivr+KAneKAnVxcXCI6XFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJCgpLmlucHV0KChNWV9QQVJBTVMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHNldFBhZ2VQYXJhbXMoT2JqZWN0LmFzc2lnbih7fSwgTVlfUEFSQU1TLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IGlucHV0XFxuICAgICAgICAgICAgICAgICAgICB9KSk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICB9LCBNWV9QQVJBTVMpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGlmIChlLnNpZ25pZmljYW5jZSA9PT0gMSkge1xcbiAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIGUubWVzc2FnZS5iaWcoKS5iaWcoKS5mb250Y29sb3IoXFxcInJlZFxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGUuc2lnbmlmaWNhbmNlID09PSAzKSB7XFxuICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgZS5tZXNzYWdlLmJpZygpLmZvbnRjb2xvcihcXFwiZ3JlZW5cXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJ1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuXFxuICAgIH0gZWxzZSB7XFxuICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+asp+asp++8jOaKpemUmeS6huOAguWcqOWIt+aWsOWHoOasoe+8n+aIluiAheabtOaNouaWh+S7tuWkueOAgicsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgZGVzYzogZS50b1N0cmluZygpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMSdcXG4gICAgICAgIH0pO1xcbiAgICAgICAgLy90aHJvdyBlO1xcbiAgICB9XFxufVxcblxcbnNldFJlc3VsdChpdGVtcyk7XCIsXCJncm91cFw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RlbXM7XFxcXG4gICAgICAgICAgICAvL2xvZyhhcnIpO1xcXFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcXFxuICAgICAgICAgICAgICAgIGxldCB1ID0gaXQucGFnZV91cmw7XFxcXG4gICAgICAgICAgICAgICAgLy91ID0gdS5sZW5ndGggPiAwID8gdVswXSA6IHVybDtcXFxcbiAgICAgICAgICAgICAgICBpZiAoIXUuaW5jbHVkZXMoXFxcXFxcXCJhbGl5dW5kcml2ZVxcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0LnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICAvL3VybDogJ2hpa2VyOi8vcGFnZS9kZXRhaWw/cnVsZT3kupHnm5jmsYflvbEmdXJsPScgKyB1ICsgJz8/ZnlwYWdlJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgLy91cmw6ICdoaWtlcjovL3BhZ2UvcHVzaD91cmw9aGlrZXI6Ly9lbXB0eSMjJyArIGVuY29kZVVSSUNvbXBvbmVudCh1KSArICc/Pz9meXBhZ2UnLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHdyYXB1KHUpLFxcXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFxcXFxcIuKAnOKAnOKAneKAnTxmb250IGNvbG9yPSNmMTNiNjZhPlVQ5LqR5pCcPC9mb250PiZuYnNwO1xcXFxcXFwiICsgXFxcXFxcXCJcXFxcXFxcXG5cXFxcXFxcIiArICh1KSxcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcblxcXFxuIC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FxcIi9zL1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgdSA9IFxcXFxcXFwiaHR0cHM6Ly93d3cuYWxpcGFuc291LmNvbVxcXFxcXFwiICsgdS5yZXBsYWNlKFxcXFxcXFwiL3MvXFxcXFxcXCIsIFxcXFxcXFwiL2N2L1xcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGRmaChpdCwgXFxcXFxcXCJ0ZW1wbGF0ZSYmVGV4dFxcXFxcXFwiKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKHUpLmxhenlSdWxlKCh3cmFwdSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KGlucHV0LCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIkNvb2tpZVxcXFxcXFwiOiBcXFxcXFxcIm5vX3Nob3dfZG9uYXRlPTFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJSZWZlcmVyXFxcXFxcXCI6IGlucHV0LnJlcGxhY2UoXFxcXFxcXCIvY3YvXFxcXFxcXCIsIFxcXFxcXFwiL3MvXFxcXFxcXCIpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWRpcmVjdDogZmFsc2VcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaHRtbCA9IHBhcnNlRG9tRm9ySHRtbChodG1sLCAnYSYmaHJlZicpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy92YXIgX2xpbmtzID0gaHRtbC5tYXRjaCgvaHR0cHM6XFxcXFxcXFwvXFxcXFxcXFwvKHd3d1xcXFxcXFxcLmFsaXl1bmRyaXZlXFxcXFxcXFwuY29tXFxcXFxcXFwvc3xhbHl3cFxcXFxcXFxcLm5ldClcXFxcXFxcXC9cXFxcXFxcXHcqL2cpIHx8IFtdO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coX2xpbmtzKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChodG1sLmxlbmd0aCA+IDApIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3JldHVybiAnaGlrZXI6Ly9wYWdlL2RldGFpbD9ydWxlPeS6keebmOaxh+W9sSZ1cmw9JyArIF9saW5rc1swXSArICc/P2Z5cGFnZSc7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9yZXR1cm4gJ2hpa2VyOi8vcGFnZS9wdXNoP3VybD1oaWtlcjovL2VtcHR5IyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KGh0bWwpICsgJz8/P2Z5cGFnZSc7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdyYXB1KGh0bWwpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaW5wdXQ7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHdyYXB1KSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcXFxcXCLigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT7njKvni7jnm5jmkJw8L2ZvbnQ+Jm5ic3A7XFxcXFxcXCIgKyBwZGZoKGl0LCBcXFxcXFxcInRlbXBsYXRlLDEmJlRleHRcXFxcXFxcIiksXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gZDtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0sIHtcXFxcbiAgICAgICAgbmFtZTogXFxcXFxcXCLmmJPmkJxcXFxcXFxcIixcXFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcXFxuICAgICAgICAgICAgZXZhbChnZXRDcnlwdG9KUygpKTtcXFxcblxcXFxuICAgICAgICAgICAgZnVuY3Rpb24ga2V5ZW4oc3RyKSB7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IENyeXB0b0pTLmVuYy5VdGY4LnBhcnNlKFxcXFxcXFwiNE9Ub1NjVUZPYWVWVHJIRVxcXFxcXFwiKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaXYgPSBDcnlwdG9KUy5lbmMuVXRmOC5wYXJzZShcXFxcXFxcIjlDTEdhbzF2SEtxbTE3T3pcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGVuY3J5cHRlZCA9IENyeXB0b0pTLkFFUy5kZWNyeXB0KHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY2lwaGVydGV4dDogQ3J5cHRvSlMuZW5jLkJhc2U2NC5wYXJzZShzdHIpXFxcXG4gICAgICAgICAgICAgICAgfSwga2V5LCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGl2OiBpdixcXFxcbiAgICAgICAgICAgICAgICAgICAgbW9kZTogQ3J5cHRvSlMubW9kZS5DQkMsXFxcXG4gICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IENyeXB0b0pTLnBhZC5Qa2NzN1xcXFxuICAgICAgICAgICAgICAgIH0pLnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gZW5jcnlwdGVkO1xcXFxuICAgICAgICAgICAgfVxcXFx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FxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NvbnRlbnQtVHlwZSc6ICd0ZXh0L3BsYWluJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IGltZyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgdmVyID0gSlNPTi5wYXJzZShyZXF1ZXN0KCdodHRwczovL3lpc28uZnVuL2FwaS91c2VyL2xvZ2luJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb250ZW50LXR5cGUnOiAnYXBwbGljYXRpb24vanNvbicsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3JlZmVyZXInOiAnaHR0cHM6Ly95aXNvLmZ1bi9sb2dpbicsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0Nvb2tpZSc6IGdldENvb2tpZSh0eWltZ2xpbilcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBib2R5OiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJ1c2VyTmFtZVxcXFxcXFwiOiBcXFxcXFxcInR2Ym94MjAyM1xcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwicGFzc3dvcmRcXFxcXFxcIjogXFxcXFxcXCJUdmJveDIwMjNcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcImNvZGVcXFxcXFxcIjogY29kXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCdcXFxcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAodmVyLmNvZGUgPT0gMjAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsb2coJ+aYk+aQnOeZu+WFpemqjOivgeaIkOWKnycpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbSgneWlzb3Vjb29rZScsIGdldENvb2tpZSgnaHR0cHM6Ly95aXNvLmZ1bicpKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWwgPSByZXF1ZXN0KFxcXFxcXFwiaHR0cHM6Ly95aXNvLmZ1bi9hcGkvc2VhcmNoP25hbWU9XFxcXFxcXCIgKyBzICsgXFxcXFxcXCImcGFnZU5vPVxcXFxcXFwiICsgcGFnZSwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJSZWZlcmVyXFxcXFxcXCI6IFxcXFxcXFwiaHR0cHM6Ly95aXNvLmZ1bi9pbmZvP3NlYXJjaEtleT1cXFxcXFxcIiArIHMsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiQ29va2llXFxcXFxcXCI6IGdldEl0ZW0oJ3lpc291Y29va2UnLCAnJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIGkrKztcXFxcbiAgICAgICAgICAgICAgICB9IHdoaWxlIChpIDwgNCk7XFxcXG5cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGh0bWwpLmRhdGEubGlzdDtcXFxcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcXFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBrZXllbihpdC51cmwpO1xcXFxuICAgICAgICAgICAgICAgIC8vbG9nKHUpO1xcXFxuICAgICAgICAgICAgICAgIGlmICh1ID09IG51bGwgfHwgIXUuaW5jbHVkZXMoXFxcXFxcXCJhbGl5dW5cXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuKAnOKAnOKAneKAnVxcXFxcXFwiICsgaXQubmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgLy91cmw6ICdoaWtlcjovL3BhZ2UvZGV0YWlsP3J1bGU95LqR55uY5rGH5b2xJnVybD0nICsgdSArICc/P2Z5cGFnZScsXFxcXG4gICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL3B1c2g/dXJsPWhpa2VyOi8vZW1wdHkjIycgKyBlbmNvZGVVUklDb21wb25lbnQodSkgKyAnPz8/ZnlwYWdlJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB3cmFwdSh1KSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcXFxcXCLigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT7mmJPmkJw8L2ZvbnQ+Jm5ic3A7XFxcXFxcXCIgKyAoaXQuZ210U2hhcmUgfHwgaXQuZ210Q3JlYXRlKSArIFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIgKyAodSksXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBkO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSwge1xcXFxuICAgICAgICBuYW1lOiBcXFxcXFxcIuaJvui1hOa6kFxcXFxcXFwiLFxcXFxuICAgICAgICBwYWdlOiB0cnVlLFxcXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxcXG4gICAgICAgICAgICBmdW5jdGlvbiBnZXRodG1sKCkge1xcXFxuICAgICAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChcXFxcXFxcImh0dHBzOi8vemhhb3ppeXVhbi5sYS9zbz9maWxlbmFtZT1cXFxcXFxcIiArIHMgKyBcXFxcXFxcIiZwYWdlPVxcXFxcXFwiICsgcGFnZSwge1xcXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIjogXFxcXFxcXCJodHRwczovL3poYW96aXl1YW4ubGEvc3RvcC5odG1sXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIm9yaWdpblxcXFxcXFwiOiBcXFxcXFxcImh0dHBzOi8vemhhb3ppeXVhbi5sYVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJDb29raWVcXFxcXFxcIjogZ2V0SXRlbShcXFxcXFxcInp6eWNvb2tlXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJ1cGdyYWRlLWluc2VjdXJlLXJlcXVlc3RzXFxcXFxcXCI6IFxcXFxcXFwiMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJjb250ZW50LXR5cGVcXFxcXFxcIjogXFxcXFxcXCJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWRcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGh0bWw7XFxcXG4gICAgICAgICAgICB9O1xcXFxuICAgICAgICAgICAgdmFyIGh0bWwgPSBnZXRodG1sKCk7XFxcXG4gICAgICAgICAgICBpZiAoIWh0bWwuaW5jbHVkZXMoXFxcXFxcXCJzZWFyY2hfYm94XFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHVzZXIgPSAnZFhObGNtNWhiV1U5ZVhCcU1qQXlNeVp3WVhOemQyOXlaRDE1Y0dveU1ESXonO1xcXFxuICAgICAgICAgICAgICAgIGxldCBjb29rID0gSlNPTi5wYXJzZShmZXRjaENvb2tpZSgnaHR0cHM6Ly96aGFveml5dWFuLmxhL2xvZ2l1Lmh0bWwnLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdVc2VyLUFnZW50JzogTU9CSUxFX1VBLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ0NvbnRlbnQtVHlwZSc6ICdhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ09yaWdpbic6ICdodHRwczovL3poYW96aXl1YW4ubGEnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly96aGFveml5dWFuLmxhL2xvZ2luLmh0bWwnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJ1cGdyYWRlLWluc2VjdXJlLXJlcXVlc3RzXFxcXFxcXCI6IFxcXFxcXFwiMVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICAgICAgICAgIGJvZHk6IGJhc2U2NERlY29kZSh1c2VyKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsXFxcXG4gICAgICAgICAgICAgICAgICAgIG9ubHlIZWFkZXJzOiB0cnVlLFxcXFxuICAgICAgICAgICAgICAgICAgICB3aXRoSGVhZGVyczogdHJ1ZVxcXFxuICAgICAgICAgICAgICAgIH0pKS5qb2luKCc7Jyk7XFxcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFxcXFxcInp6eWNvb2tlXFxcXFxcXCIsIGNvb2spO1xcXFxuICAgICAgICAgICAgICAgIGxvZyhcXFxcXFxcIuaJvui1hOa6kOeZu+WFpVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICBodG1sID0gZ2V0aHRtbCgpO1xcXFxuICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICBsZXQgYXJyID0gcGRmYShodG1sLCBcXFxcXFxcImJvZHkmJi5uZXdzTGlzdCYmbGk6bm90KDpmaXJzdC1jaGlsZClcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAvL2xvZyhhcnIpO1xcXFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcXFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGRmaChpdCwgXFxcXFxcXCJhJiZocmVmXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIGlmICh1ID09IG51bGwpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHUgPSBcXFxcXFxcImh0dHBzOi8vemhhb3ppeXVhbi5sYS9cXFxcXFxcIiArIHU7XFxcXG4gICAgICAgICAgICAgICAgLy9sb2codSk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gcGRmaChpdCwgXFxcXFxcXCIubmV3c190ZXh0JiZoMyYmVGV4dFxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXFxcXFwi4oCc4oCc4oCd4oCdPGZvbnQgY29sb3I9I2YxM2I2NmE+5om+6LWE5rqQPC9mb250PiZuYnNwO1xcXFxcXFwiICsgKHBkZmgoaXQsIFxcXFxcXFwiLm5ld3NfdGV4dCYmcCYmVGV4dFxcXFxcXFwiKSksXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJCh1KS5sYXp5UnVsZSgod3JhcHUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChpbnB1dCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgX2xpbmtzID0gaHRtbC5tYXRjaCgvaHR0cHM6XFxcXFxcXFwvXFxcXFxcXFwvKHd3d1xcXFxcXFxcLmFsaXl1bmRyaXZlXFxcXFxcXFwuY29tXFxcXFxcXFwvc3xhbHl3cFxcXFxcXFxcLm5ldClcXFxcXFxcXC9cXFxcXFxcXHcqL2cpIHx8IFtdO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coX2xpbmtzKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChfbGlua3MubGVuZ3RoID4gMCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vcmV0dXJuICdoaWtlcjovL3BhZ2UvZGV0YWlsP3J1bGU95LqR55uY5rGH5b2xJnVybD0nICsgX2xpbmtzWzBdICsgJz8/ZnlwYWdlJztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3JldHVybiAnaGlrZXI6Ly9wYWdlL3B1c2g/dXJsPWhpa2VyOi8vZW1wdHkjIycgKyBlbmNvZGVVUklDb21wb25lbnQoX2xpbmtzWzBdKSArICc/Pz9meXBhZ2UnO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3cmFwdShfbGlua3NbMF0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaW5wdXQ7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHdyYXB1KVxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxcXG4gICAgICAgIH1cXFxcbiAgICB9LCB7XFxcXG4gICAgICAgIG5hbWU6IFxcXFxcXFwi5bCP57q45p2hXFxcXFxcXCIsXFxcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxcXG4gICAgICAgICAgICBmdW5jdGlvbiBnZXR0b2tlbigpIHtcXFxcbiAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIoJ3h6eXRva2VuJywgJycpLmxlbmd0aCA9PSAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCB0b2tlbiA9IEpTT04ucGFyc2UocG9zdCgnaHR0cHM6Ly9naXRjYWZlLm5ldC90b29sL2FsaXBhcGVyLycsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3UuZ2l0Y2FmZS5uZXQvJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246ICdnZXRfdG9rZW4nXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pKS5kYXRhO1xcXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcigneHp0dG9rZW4nLCB0b2tlbik7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiBnZXRNeVZhcigneHp0dG9rZW4nLCAnJyk7XFxcXG4gICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGNhdF9jb2RlKGEpIHtcXFxcbiAgICAgICAgICAgICAgICB2YXIgZCwgZSwgYiA9IFtcXFxcXFxcIuWNjuivreeUteinhlxcXFxcXFwiLCBcXFxcXFxcIuaXpemfqeeUteinhlxcXFxcXFwiLCBcXFxcXFxcIuasp+e+jueUteinhlxcXFxcXFwiLCBcXFxcXFxcIuWFtuS7lueUteinhlxcXFxcXFwiLCBcXFxcXFxcIuWNjuivreeUteW9sVxcXFxcXFwiLCBcXFxcXFxcIuaXpemfqeeUteW9sVxcXFxcXFwiLCBcXFxcXFxcIuasp+e+jueUteW9sVxcXFxcXFwiLCBcXFxcXFxcIuWFtuS7lueUteW9sVxcXFxcXFwiLCBcXFxcXFxcIuWNjuivreWKqOa8q1xcXFxcXFwiLCBcXFxcXFxcIuaXpemfqeWKqOa8q1xcXFxcXFwiLCBcXFxcXFxcIuasp+e+juWKqOa8q1xcXFxcXFwiLCBcXFxcXFxcIue6quW9leeJh1xcXFxcXFwiLCBcXFxcXFxcIue7vOiJuueJh1xcXFxcXFwiLCBcXFxcXFxcIuaVmeiCsuWfueiurVxcXFxcXFwiLCBcXFxcXFxcIuWFtuS7luinhumikVxcXFxcXFwiLCBcXFxcXFxcIuWNjuivremfs+S5kFxcXFxcXFwiLCBcXFxcXFxcIuaXpemfqemfs+S5kFx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Bib2R5OiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGFjdGlvbjogXFxcXFxcXCJzZWFyY2hcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgZnJvbTogXFxcXFxcXCJ3ZWJcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgdG9rZW46IGdldHRva2VuKCksXFxcXG4gICAgICAgICAgICAgICAgICAgIGtleXdvcmQ6IHNcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBKU09OLnBhcnNlKGh0bWwpO1xcXFxuICAgICAgICAgICAgaWYgKGxpc3QuZGF0YSkge1xcXFxuICAgICAgICAgICAgICAgIGxpc3QgPSBsaXN0LmRhdGE7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBsaXN0W2ldXFxcXG4gICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gaXQudGl0bGU7XFxcXG4gICAgICAgICAgICAgICAgbGV0IG11cmwgPSAnaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvJyArIGl0LmtleVxcXFxuICAgICAgICAgICAgICAgIGlmICghY2hlY2thbGkobXVybCkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGlmICh0aXRsZS5pbmNsdWRlcyhzKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi4oiaIFxcXFxcXFwiICsgdGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFxcXFxcIuKAnOKAnOKAneKAnTxmb250IGNvbG9yPSNmMTNiNjZhPuWwj+e6uOadoTwvZm9udD4mbmJzcDtcXFxcXFxcIiArIGNhdF9jb2RlKGl0LmNhdCksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlczogaXQuZGVzXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy91cmw6ICdoaWtlcjovL3BhZ2UvZGV0YWlsP3J1bGU95LqR55uY5rGH5b2xJnVybD1odHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy8nICsgbXVybCArICc/P2Z5cGFnZScsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHdyYXB1KG11cmwpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL3VybDogJ2hpa2VyOi8vcGFnZS9wdXNoP3VybD1oaWtlcjovL2VtcHR5IyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KCdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy8nICsgbXVybCkgKyAnPz8/ZnlwYWdlJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gZDtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0sIHtcXFxcbiAgICAgICAgbmFtZTogXFxcXFxcXCLnjqnlgbblk6Xlk6VcXFxcXFxcIixcXFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcXFxuICAgICAgICAgICAgbGV0IHVybCA9IFxcXFxcXFwiaHR0cDovL3dvZ2cueHl6L2luZGV4LnBocC92b2RzZWFyY2gvXFxcXFxcXCIgKyBzICsgXFxcXFxcXCItLS0tLS0tLS0tXFxcXFxcXCIgKyBwYWdlICsg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biAgICAgICAgICAgICAgICAgICAgZGVzYzogdXNlcmlhbFxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKGJldC5sZW5ndGggPiAwKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGJldGggPSBiYXRjaEZldGNoKGJldCk7XFxcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBiZXRoLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBsaXN0ID0gcGFyc2VEb21Gb3JBcnJheShiZXRoW2ldLCAnLm1vZHVsZS1wbGF5ZXItbGlzdCYmcCcpXFxcXG4gICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgbGlzdC5sZW5ndGg7IGorKykge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwobGlzdFtqXSwgJ3AmJlRleHQnKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdS5pbmNsdWRlcyhcXFxcXFxcIi9zL1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYmV0W2ldLnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IGJldFtpXS5pbWFnZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3VybDogJ2hpa2VyOi8vcGFnZS9kZXRhaWw/cnVsZT3kupHnm5jmsYflvbEmdXJsPScgKyB1ICsgJz8/ZnlwYWdlJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3VybDogJ2hpa2VyOi8vcGFnZS9wdXNoP3VybD1oaWtlcjovL2VtcHR5IyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KHUpICsgJz8/P2Z5cGFnZScsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB3cmFwdSh1KSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFxcXFxcIuKAnOKAnOKAneKAnTxmb250IGNvbG9yPSNmMTNiNjZhPueOqeWBtuWTpeWTpTwvZm9udD4mbmJzcDtcXFxcXFxcIiArIChiZXRbaV0uZGVzYykgKyAnXFxcXFxcXFxuJyArIHUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxcXG4gICAgICAgIH1cXFxcbiAgICB9LCB7XFxcXG4gICAgICAgIG5hbWU6IFxcXFxcXFwi6Zi/6YeM5LqR55uY572RXFxcXFxcXCIsXFxcXG4gICAgICAgIHBhZ2U6IHRydWUsXFxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXFxcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFxcXFxcImh0dHBzOi8vd3d3LmFseXB3LmNuL3NlYXJjaC5waHA/cT1cXFxcXFxcIiArIHMgKyBcXFxcXFxcIiZwYWdlPVxcXFxcXFwiICsgcGFnZTtcXFxcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHt9KTtcXFxcbiAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcubGlzdCYmbGknKTtcXFxcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcXFxuICAgICAgICAgICAgbGV0IGJldCA9IFtdO1xcXFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxcXG4gICAgICAgICAgICAgICAgbGV0IHV0aXRsZSA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJ2EmJnRpdGxlJyk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHVzZXJpYWwgPSBwYXJzZURvbUZvckh0bWwoaXQsICcuZmEtY2xvY2stbyYmVGV4dCcpO1xcXFxuICAgICAgICAgICAgICAgIGxldCB1aW1hZ2UgPSBwYXJzZURvbShpdCwgJ2ltZyYmc3JjJywgJ2h0dHBzOi8vd3d3LmFseXB3LmNuLycpO1xcXFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGFyc2VEb20oaXQsICdhJiZocmVmJywgJ2h0dHBzOi8vd3d3LmFseXB3LmNuLycpO1xcXFxuICAgICAgICAgICAgICAgIC8vbGV0IGRldCA9IHJlcXVlc3QodSwge30pO1xcXFxuICAgICAgICAgICAgICAgIGlmICghdXRpdGxlLmluY2x1ZGVzKHMpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBiZXQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB1dGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHVpbWFnZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogdXNlcmlhbFxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgLy9sb2coYmV0KTtcXFxcbiAgICAgICAgICAgIGlmIChiZXQubGVuZ3RoID4gMCkge1xcXFxuICAgICAgICAgICAgICAgIGxldCBiZXRoID0gYmF0Y2hGZXRjaChiZXQpO1xcXFxuICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYmV0aC5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgbGlzdCA9IHBhcnNlRG9tRm9yQXJyYXkoYmV0aFtpXSwgJ2JvZHkmJmFbaHJlZl49aHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvXScpXFxcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKGxpc3QpO1xcXFxuICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGxpc3QubGVuZ3RoOyBqKyspIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB1ID0gcGFyc2VEb21Gb3JIdG1sKGxpc3Rbal0sICdhJiZocmVmJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBiZXRbaV0udGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGljX3VybDogYmV0W2ldLmltYWdlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL2RldGFpbD9ydWxlPeS6keebmOaxh+W9sSZ1cmw9JyArIHUgKyAnPz9meXBhZ2UnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL3B1c2g/dXJsPWhpa2VyOi8vZW1wdHkjIycgKyBlbmNvZGVVUklDb21wb25lbnQodSkgKyAnPz8/ZnlwYWdlJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHdyYXB1KHUpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXFxcXFwi4oCc4oCc4oCd4oCdPGZvbnQgY29sb3I9I2YxM2I2NmE+6Zi/6YeM5LqR55uY572RPC9mb250PiZuYnNwO1xcXFxcXFwiICsgKGJldFtpXS5kZXNjKSArICdcXFxcXFxcXG4nICsgdSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gZDtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0sIHtcXFxcbiAgICAgICAgbmFtZTogXFxcXFxcXCLlnJ/mi6jpvKBcXFxcXFxcIixcXFxcbiAgICAgICAgcGFnZTogZmFsc2UsXFxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXFxcbiAgICAgICAgICAgIGxldCBodG1sID0gZmV0Y2goJ2h0dHBzOi8vd3d3LnRic2R5LmNvbS9zZWFyY2guaHRtbD9rZXl3b3JkPScgKyBzICsgJyZjYXRlZ29yeT05ODM5MjAmZGF0YV90eXBlPTk4NzkxMCcsIHtcXFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUFcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcblxcXFxuICAgICAgICAgICAgbGV0IGFyciA9IHBhcnNlRG9tRm9yQXJyYXkoaHRtbCwgJy5zZWFyY2hfcmVzdWx0X25ldGRpc2tfbGlzdCYmYScpO1xcXFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcXFxuICAgICAgICAgICAgICAgIC8vbG9nKGl0KTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBhcnNlRG9tRm9ySHRtbChp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cXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoJ2h0dHBzOi8vYWxpc28uY2Mvcy8nICsgcyArICctJyArIHBhZ2UgKyAnLTAuaHRtbCcsIHt9KTtcXFxcblxcXFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcuc2VhcmNoLXJlc3VsdCYmLnJlc291cmNlLWl0ZW0nKTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgbGlzdC5sZW5ndGg7IGorKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCB1ID0gbGlzdFtqXTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdGl0ID0gcGFyc2VEb21Gb3JIdG1sKHUsICdoMyYmVGV4dCcpO1xcXFxuICAgICAgICAgICAgICAgIGlmICghdGl0LmluY2x1ZGVzKHMpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0LFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6ICQocGFyc2VEb20odSwgJ2gzJiZhJiZocmVmJywgJ2h0dHBzOi8vYWxpc28uY2MvJykpLmxhenlSdWxlKCh3cmFwdSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbChnZXRDcnlwdG9KUygpKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZGVjcnkoc3RyKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGtleSA9IENyeXB0b0pTLmVuYy5VdGY4LnBhcnNlKFxcXFxcXFwiOUVCMjBEREZENkFGQkQ2OFxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZW5jcnlwdGVkID0gQ3J5cHRvSlMuQUVTLmRlY3J5cHQoc3RyLCBrZXksIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXY6IGtleSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kZTogQ3J5cHRvSlMubW9kZS5DQkMsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IENyeXB0b0pTLnBhZC5Qa2NzN1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW5jcnlwdGVkO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoaW5wdXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGJ1dCA9IHBhcnNlRG9tKGh0bWwsICcuYnV0dG9uJiZocmVmJywgJ2h0dHBzOi8vYWxpc28uY2MvJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhidXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGdvdCA9IHJlcXVlc3QoYnV0KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKGdvdCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKHBhcnNlRG9tRm9ySHRtbChnb3QsICdoZWFkJiZzY3JpcHQsMSYmSHRtbCcpKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3cmFwdShkZWNyeShiYXNlNjQuc3BsaXQoJyEnKVswXSkpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHdyYXB1KSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcXFxcXCLigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT7pmL/ph4zmkJw8L2ZvbnQ+Jm5ic3A7XFxcXFxcXCIgKyBwYXJzZURvbUZvckh0bWwodSwgJy50aW1lJiZUZXh0JyksXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBkO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSxcXFxcbiAgICAvKntcXFxcbiAgICAgICAgICAgbmFtZTogXFxcXFxcXCLlnJ/ni5fmkJxcXFxcXFxcIixcXFxcbiAgICAgICAgICAgcGFnZTogZmFsc2UsXFxcXG4gICAgICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXFxcbiAgICAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCgnaHR0cHM6Ly93d3cudHVnb3Vzb3UuY29tL3NlYXJjaCcsIHtcXFxcbiAgICAgICAgICAgICAgICAgICBib2R5OiAna2V5d29yZD0nICsgcyxcXFxcbiAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcXFxuICAgICAgICAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcubGF5dWktY29udGFpbmVyLDEmJi5sYXl1aS1yb3c6aGFzKGEpJyk7XFxcXG4gICAgICAgICAgICAgICBsZXQgZCA9IFtdO1xcXFxuICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxcXG4gICAgICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwoaXQsICdhJiZocmVmJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgaWYgKCF1LmluY2x1ZGVzKFxcXFxcXFwiL3MvXFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAvL2xvZyh1KTtcXFxcbiAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGFyc2VEb21Gb3JIdG1sKGl0LCAnYSYmVGV4dCcpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAvL3VybDogJ2hpa2VyOi8vcGFnZS9kZXRhaWw/cnVsZT3kupHnm5jmsYflvbEmdXJsPScgKyB1ICsgJz8/ZnlwYWdlJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgLy91cmw6ICdoaWtlcjovL3BhZ2UvcHVzaD91cmw9aGlrZXI6Ly9lbXB0eSMjJyArIGVuY29kZVVSSUNvbXBvbmVudCh1KSArICc/Pz9meXBhZ2UnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHdyYXB1KHUpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFxcXFxcIuKAnOKAnOKAneKAnTxmb250IGNvbG9yPSNmMTNiNjZhPuWcn+eLl+aQnDwvZm9udD4mbmJzcDtcXFxcXFxcIiArIHBhcnNlRG9tRm9ySHRtbChpdCwgJ3AsLTEmJlRleHQnKSArIFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIgKyB1LFxcXFxuICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgcmV0dXJuIGQ7XFxcXG4gICAgICAgICAgIH1cXFxcbiAgICAgICB9LCAqL1xcXFxuICAgIHtcXFxcbiAgICAgICAgbmFtZTogXFxcXFxcXCLkupHnm5jliIbkuqvnpL5cXFxcXFxcIix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bWwpLmRhdGEpO1xcXFxuICAgICAgICAgICAgLy9sb2coanNvbik7XFxcXG4gICAgICAgICAgICBsZXQgYXJyID0gSlNPTi5wYXJzZShqc29uKTsgLy9bMF0ucmVzdWx0Lml0ZW1zO1xcXFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXFxcblxcXFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXFxcbiAgICAgICAgICAgIGxldCBiZXQgPSBbXTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcXFxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSBpdC5waWQ7XFxcXG4gICAgICAgICAgICAgICAgYmV0LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL3d3dy55dW5wYW5mZW54aWFuZy5jbi9hcGkvYmJzL2FwaS9nZXRhcnRpY2xlP2lkPScgKyB1cmwsXFxcXG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIjogXFxcXFxcXCJodHRwczovL3d3dy55dW5wYW5mZW54aWFuZy5jbi9cXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAvL2xvZyh1KTtcXFxcbiAgICAgICAgICAgIGxldCBiZXRoID0gYmF0Y2hGZXRjaChiZXQpO1xcXFxuXFxcXG4gICAgICAgICAgICAvL2xvZyhhcnRpY2xlKTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYmV0aC5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShiZXRoW2ldKS5kYXRhO1xcXFxuICAgICAgICAgICAgICAgIC8vbG9nKGpzb24pO1xcXFxuICAgICAgICAgICAgICAgIGxldCBsaXN0ID0ganNvbi5kb3dubG9hZC5zcGxpdCgnQCcpO1xcXFxuICAgICAgICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgbGlzdC5sZW5ndGg7IGorKykge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgdSA9IGxpc3Rbal07XFxcXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZToganNvbi50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vdXJsOiAnaGlrZXI6Ly9wYWdlL2RldGFpbD9ydWxlPeS6keebmOaxh+W9sSZ1cmw9JyArIHUgKyAnPz9meXBhZ2UnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy91cmw6ICdoaWtlcjovL3BhZ2UvcHVzaD91cmw9aGlrZXI6Ly9lbXB0eSMjJyArIGVuY29kZVVSSUNvbXBvbmVudCh1KSArICc/Pz9meXBhZ2UnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB3cmFwdSgnaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvJyArIHUpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcXFxcXCLigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT7kupHnm5jliIbkuqvnpL48L2ZvbnQ+Jm5ic3A7XFxcXFxcXCIgKyAoanNvbi5jcmVhdGV0aW1lKSArIFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIgKyAoJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zLycgKyB1KSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICByZXR1cm4gZDtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0sIHtcXFxcbiAgICAgICAgbmFtZTogXFxcXFxcXCLnm5jmkJxcXFxcXFxcIixcXFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcXFxuICAgICAgICAgICAgcGFnZSA9IChwYWdlIC0gMSkgKiAxMDtcXFxcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFxcXFxcImh0dHBzOi8vd3d3LnBhbnNlYXJjaC5tZS9zZWFyY2g/a2V5d29yZD1cXFxcXFxcIiArIHMgKyBcXFxcXFxcIiZvZmZzZXQ9XFxcXFxcXCIgKyBwYWdlICsgXFxcXFxcXCImcGFuPWFsaXl1bmRyaXZlXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QodXJsLCB7fSk7XFxcXG5cXFxcbiAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcuZ3JpZCYmLnNoYWRvdzpoYXMoYVtocmVmXj1odHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9dKScpO1xcXFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJ2FbaHJlZl49aHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvXSYmaHJlZicpO1xcXFxuICAgICAgICAgICAgICAg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VybCA9IFxcXFxcXFwiaHR0cHM6Ly9hcGkuZG92eC50ay9hbGkvc2VhcmNoP3dkPVxcXFxcXFwiICsgcztcXFxcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHt9KTtcXFxcbiAgICAgICAgICAgIC8vbG9nKGJhc2U2NERlY29kZShodG1sKSk7XFxcXG4gICAgICAgICAgICBsZXQgYXJyID0gSlNPTi5wYXJzZShodG1sKS5saXN0O1xcXFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdSA9IGl0LnZvZF9jb250ZW50O1xcXFxuICAgICAgICAgICAgICAgIC8vdSA9IHUubGVuZ3RoID4gMCA/IHVbMF0gOiB1cmw7XFxcXG4gICAgICAgICAgICAgICAgaWYgKCF1LmluY2x1ZGVzKFxcXFxcXFwiYWxpeXVuZHJpdmVcXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGlmICghY2hlY2thbGkodSkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuKImiBcXFxcXFxcIiArIGl0LnZvZF9uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBpdC52b2RfcGljLFxcXFxuICAgICAgICAgICAgICAgICAgICAvL3VybDogJ2hpa2VyOi8vcGFnZS9kZXRhaWw/cnVsZT3kupHnm5jmsYflvbEmdXJ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FxcXFxcXFwi5LiL5LiA6aG1XFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCB1MiA9IHBkKGl0LCBcXFxcXFxcImEmJmhyZWZcXFxcXFxcIiwgdXJsKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9sb2coXFxcXFxcXCJuZXh0IHBhZ2VcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKHUyKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcXFxcXCJiaW5nXFxcXFxcXCIsIHUyKTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYgKHUgPT0gbnVsbCB8fCB0ID09IG51bGwgfHwgIWl0LmluY2x1ZGVzKHMpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpZiAoIWl0LmluY2x1ZGVzKFxcXFxcXFwi572R55uYXFxcXFxcXCIpICYmICFpdC5pbmNsdWRlcyhcXFxcXFxcIuS6keebmFxcXFxcXFwiKSAmJlxcXFxuICAgICAgICAgICAgICAgICAgICAhaXQuaW5jbHVkZXMoXFxcXFxcXCJhbGl5dW5kcml2ZVxcXFxcXFwiKSAmJiAhaXQuaW5jbHVkZXMoXFxcXFxcXCJ5dW5wYW5cXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGlmICh1LnN0YXJ0c1dpdGgoXFxcXFxcXCJodHRwczovL2NuLmJpbmcuY29tL1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgbGV0IGRvbSA9IGdldEhvbWUodSkucmVwbGFjZShcXF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xcXG4gICAgICAgICAgICAgICAgICAgIGMgPSB3cmFwdShfbGlua3NbMF0pO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdCxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcXFxcXCLigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT7lv4XlupQ8L2ZvbnQ+Jm5ic3A7XFxcXFxcXCIgKyBkb20sXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogYyAhPSBudWxsID8gYyA6ICQodSkubGF6eVJ1bGUoKHdyYXB1LCBtb2RlKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoaW5wdXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIF9saW5rcyA9IGh0bWwubWF0Y2goL2h0dHBzOlxcXFxcXFxcL1xcXFxcXFxcLyh3d3dcXFxcXFxcXC5hbGl5dW5kcml2ZVxcXFxcXFxcLmNvbVxcXFxcXFxcL3N8YWx5d3BcXFxcXFxcXC5uZXQpXFxcXFxcXFwvXFxcXFxcXFx3Ki9nKSB8fCBbXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKF9saW5rcyk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2lmIChfbGlua3MubGVuZ3RoID4gMCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9yZXR1cm4gJ2hpa2VyOi8vcGFnZS9kZXRhaWw/cnVsZT3kupHnm5jmsYflvbEmdXJsPScgKyBfbGlua3NbMF0gKyAnPz9meXBhZ2UnO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9yZXR1cm4gJ2hpa2VyOi8vcGFnZS9wdXNoP3VybD1oaWtlcjovL2VtcHR5IyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KF9saW5rc1swXSkgKyAnPz8/ZnlwYWdlJztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChfbGlua3MubGVuZ3RoID4gMSAmJiBfbGlua3NbMV0ucmVwbGFjZShfbGlua3NbMF0sIFxcXFxcXFwiXFxcXFxcXCIpLnJlcGxhY2UoL1thLXpBLVowLTldKy9nLCBcXFxcXFxcIlxcXFxcXFwiKSA9PSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdyYXB1KF9saW5rc1sxXSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKF9saW5rcy5sZW5ndGggPiAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdyYXB1KF9saW5rc1swXSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBydWxlID0gTVlfUlVMRS50aXRsZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJoaWtlcjovL3BhZ2UveXNmeD9ydWxlPVxcXFxcXFwiICsgcnVsZSArIFxcXFxcXFwiJnI9XFxcXFxcXCIgKyBydWxlICsgXFxcXFxcXCImbW9kZT1cXFxcXFxcIiArIG1vZGUgKyBcXFxcXFxcIiMjXFxcXFxcXCIgKyBpbnB1dDtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgd3JhcHUsIGNvbmZpZy5tb2RlKVxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxcXG4gICAgICAgIH1cXFxcbiAgICB9LFxcXFxuICAgIHtcXFxcbiAgICAgICAgbmFtZTogJ0NDT0YnLFxcXFxuICAgICAgICBwYWdlOiB0cnVlLFxcXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxcXG4gICAgICAgICAgICBsZXQgZCA9IFtdXFxcXG4gICAgICAgICAgICBjb25zdCB7XFxcXG4gICAgICAgICAgICAgICAgYnl0ZXNUb1NpemUsXFxcXG4gICAgICAgICAgICAgICAgY29sb3JcXFxcbiAgICAgICAgICAgIH0gPSAkLnJlcXVpcmUoJ2hpa2VyOi8vcGFnZS90b29scycpO1xcXFxuICAgICAgICAgICAgbGV0IGh0bWwgPSBmZXRjaCgnaHR0cHM6Ly9wYW4uY2NvZi5jYy9hcGkvc2VhcmNoJywge1xcXFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJjb250ZW50LXR5cGVcXFxcXFxcIjogJ2FwcGxpY2F0aW9uL2pzb24nLFxcXFxuICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3Bhbi5jY29mLmNjL3NlYXJjaD9rZXl3b3JkPScgKyBzXFxcXG4gICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICBib2R5OiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwicGFnZVNpemVcXFxcXFxcIjogMjAsXFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwicGFnZU51bVxcXFxcXFwiOiBwYWdlLFxcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcImtleXdvcmRcXFxcXFxcIjogcyxcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJmcm9tTW9iaWxlXFxcXFxcXCI6IHRydWVcXFxcbiAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnXFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBKU09OLnBhcnNlKGh0bWwpXFxcXG4gICAgICAgICAgICAgICAgLmRhdGEucm93c1xcXFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gbGlzdFtpXVxcXFxuICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IGl0LmZpbGVOYW1lXFxcXG4gICAgICAgICAgICAgICAgbGV0IG11cmwgPSBpdC51cmxcXFxcbiAgICAgICAgICAgICAgICBsZXQgdHlwZSA9IGl0LnR5cGUucmVwbGFjZSgvZm9sZGVyLywgJ+aWh+S7tuWkuScpLnJlcGxhY2UoL2ZpbGUvLCAn5paH5Lu2JylcXFxcbiAgICAgICAgICAgICAgICBpZiAodGl0bGUuaW5jbHVkZXMocykpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj0jZjEzYjY2YT5DQ09GPC9mb250PiZuYnNwOycgKyAn5paH5Lu257G75Z6L77yaJyArIHR5cGUgKyAn77yM5paH5Lu25aSn5bCP77yaJyArIGJ5dGVzVG9TaXplKGl0LnNpemUpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB3cmFwdShtdXJsKVxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBkXFxcXG4gICAgICAgIH1cXFxcbiAgICB9XFxcXG5dO1xcXFxuXFxcXG5cXFxcbi8v5bm25Y+R6KeE5YiZ5pWwXFxcXG5sZXQgc2l6ZSA9IDEwO1xcXFxuXFxcXG4kLmV4cG9ydHMgPSBmdW5jdGlvbihwYWdlLCBydWxlKSB7XFxcXG4gICAgaWYgKCFwYWdlIC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lcjovL3BhZ2UvbG9naW4jbm9SZWNvcmRIaXN0b3J5IyNub0hpc3RvcnkjP2luZGV4PTAmcGFnZVRpdGxlPeeZu+W9lemYv+mHjOS6keebmFxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGlmKFxcXFxcXFwiVG9rZW7nmbvpmYZcXFxcXFxcIiA9PSBpbnB1dCl7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXFxcXFwiXFxcXFxcXCIsXFxcXFxcXCLovpPlhaVUb2tlblxcXFxcXFwiKS5pbnB1dCgoKT0+e1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGFsaVRva2Vuc0ZpbGVwYXRoID0gJC5yZXF1aXJlKFxcXFxcXFwiaGlrZXI6Ly9wYWdlL3Rva2VuUGF0aC5qc29uXFxcXFxcXCIpLmFsaVRva2Vuc0ZpbGVwYXRoO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGFsaVRva2VuID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IGlucHV0LnRyaW0oKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlRmlsZShhbGlUb2tlbnNGaWxlcGF0aCwgSlNPTi5zdHJpbmdpZnkoYWxpVG9rZW4pKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXFxcXFwiZG1vZGVcXFxcXFxcIiwgaW5wdXQpO1xcXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0ID09IFxcXFxcXFwi5a6Y5pa5QVB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hajpg6hcXFxcXFxcIiArIGlkLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuKAnOKAnOWFqOmDqOKAneKAnVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHFyKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oaWQgKyBxciwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHFyXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vZW1wdHlcXFxcXFxcIlxcXFxuICAgICAgICB9LCBzLCBpZCksXFxcXG4gICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInNjcm9sbF9idXR0b25cXFxcXFxcIixcXFxcbiAgICAgICAgZGVzYzogXFxcXFxcXCJcXFxcXFxcIixcXFxcbiAgICAgICAgcGljX3VybDogXFxcXFxcXCJcXFxcXFxcIixcXFxcbiAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgIGlkOiBcXFxcXFxcIuWFqOmDqFxcXFxcXFwiICsgaWRcXFxcbiAgICAgICAgfVxcXFxuICAgIH0pO1xcXFxuICAgIGZvciAobGV0IGl0IG9mIHJ1bGVzKSB7XFxcXG4gICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICB0aXRsZTogaXQgPT0gciA/IFxcXFxcXFwi4oCc4oCcXFxcXFxcXCIgKyBpdCArIFxcXFxcXFwi4oCd4oCdXFxcXFxcXCIgOiBpdCxcXFxcbiAgICAgICAgICAgIHVybDogJChcXFxcXFxcIiNub0xvYWRpbmcjXFxcXFxcXCIpLmxhenlSdWxlKChyLCBzLCBpZCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIGxldCBxciA9IGdldEl0ZW0oXFxcXFxcXCJyXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcXFxcXCJyXFxcXFxcXCIsIHIpO1xcXFxuICAgICAgICAgICAgICAgIGlmIChzKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShxciA/IChpZCArIHFyKSA6IChcXFxcXFxcIuWFqOmDqFxcXFxcXFwiICsgaWQpLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogcXIgfHwgXFxcXFxcXCLlhajpg6hcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShpZCArIHIsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuKAnOKAnFxcXFxcXFwiICsgciArIFxcXFxcXFwi4oCd4oCdXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vZW1wdHlcXFxcXFxcIlxcXFxuICAgICAgICAgICAgfSwgaXQsIHMsIGlkKSxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInNjcm9sbF9idXR0b25cXFxcXFxcIixcXFxcbiAgICAgICAgICAgIGRlc2M6IFxcXFxcXFwiXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBwaWNfdXJsOiBcXFxcXFxcIlxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICBpZDogaWQgKyBpdFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB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cXFxcXFwiKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogaWQgKyBcXFxcXFxcIjprZXlcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9LCBpZCksXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGlkOiBpZCArIFxcXFxcXFwiOnNlYXJjaEhpc3RvcnlcXFxcXFxcIlxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KTtcXFxcblxcXFxuICAgICAgICBsZXQgaGlzdG9yeSA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcXFxcXCJzZWFyY2hIaXN0b3J5XFxcXFxcXCIsIFtdKTtcXFxcbiAgICAgICAgbGV0IGkgPSAwO1xcXFxuICAgICAgICBmb3IgKGxldCBrZXkgb2YgaGlzdG9yeSkge1xcXFxuICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZToga2V5LFxcXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFxcXFxcIiNub0xvYWRpbmcjXFxcXFxcXCIpLmxhenlSdWxlKChpZCwga2V5KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBleHRyYSA9IGZpbmRJdGVtKGlkICsgXFxcXFxcXCJzc1xcXFxcXFwiKS5leHRyYTtcXFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmEuZGVmYXVsdFZhbHVlID0ga2V5O1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiBleHRyYVxcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIH0sIGlkLCBrZXkpLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcImZsZXhfYnV0dG9uXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGlkICsgXFxcXFxcXCI6a2V5OlxcXFxcXFwiICsga2V5LFxcXFxuICAgICAgICAgICAgICAgICAgICBjbHM6IGlkICsgXFxcXFxcXCI6a2V5XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuWIoOmZpOWFs+mUruivjTpcXFxcXFxcIiArIGtleSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpZCwga2V5LCBpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGhpc3RvcnkgPSBzdG9yYWdlMC5nZXRJdGVtKFxcXFxcXFwic2VhcmNoSGlzdG9yeVxcXFxcXFwiLCBbXSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGlzdG9yeS5zcGxpY2UoaSwgMSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFxcXFxcInNlYXJjaEhpc3RvcnlcXFxcXFxcIiwgaGlzdG9yeSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbShpZCArIFxcXFxcXFwiOmtleTpcXFxcXFxcIiArIGtleSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy90b2FzdCgpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaWQsIGtleSwgaSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfV1cXFxcbiAgICAgICAgICA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gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0pO1xcXFxuICAgIH1cXFxcbiAgICBzZXRSZXN1bHQoZCk7XFxcXG4gICAgaWYgKGRhdGEubGVuZ3RoID4gMCkge1xcXFxuICAgICAgICAvL+Wkmue6v+eoi+WKoOi9vSAgICAgICAgXFxcXG4gICAgICAgIGxldCByZWFsUGFnZSA9IFxcXFxcXFwiXFxcXFxcXCIgPT0gciA/IDEgOiBwO1xcXFxuICAgICAgICBsZXQgdGFza3MgPSBkYXRhLm1hcChpdCA9PiB7XFxcXG4gICAgICAgICAgICByZXR1cm4ge1xcXFxuICAgICAgICAgICAgICAgIGZ1bmM6IGZ1bmN0aW9uKHJ1bGUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJ1bGUuZmluZChzLCByZWFsUGFnZSk7XFxcXG4gICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICBwYXJhbTogaXQsXFxcXG4gICAgICAgICAgICAgICAgaWQ6IFxcXFxcXFwicnVsZUBcXFxcXFxcIiArIGl0Lm5hbWVcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgYmF0Y2hFeGVjdXRlKHRhc2tzLCB7XFxcXG4gICAgICAgICAgICBmdW5jOiBmdW5jdGlvbihwYXJhbSwgaWQsIGVycm9yLCByZXN1bHQpIHtcXFxcbiAgICAgICAgICAgICAgICAvL2xvZyhcXFxcXFxcImxpc3RlbmVyOiBcXFxcXFxcIiArIChyZXN1bHQgfHwgW10pLmxlbmd0aClcXFxcbiAgICAgICAgICAgICAgICBwYXJhbS5pID0gcGFyYW0uaSArIDE7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHB1c2hDb3VudCA9IDA7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHJlc3VsdCkge1xcXFxuICAgICAgICAgICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgcmVzdWx0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1vZGUgJiYgIXNlYXJjaENvbnRhaW5zKGl0LnRpdGxlLCBzLCB0cnVlKSkgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVzaENvdW50Kys7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW0uaiA9IHBhcmFtLmogKyAxO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1CZWZvcmUocGFnZWlkLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdC50aXRsZS5pbmNsdWRlcyhcXFxcXFxcIuKAnOKAnOKAneKAnVxcXFxcXFwiKSA/IGl0LnRpdGxlIDogXFxcXFxcXCLigJzigJzigJ3igJ1cXFxcXFxcIiArIGl0LnRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cChcXFxcXFxcIjxlbT58PC9lbT5cXFxcXFxcIiwgXFxcXFxcXCJnXFxcXFxcXCIpLCBcXFxcXFxcIlxcXFxcXFwiKS5yZXBsYWNlKG5ldyBSZWdFeHAocywgXFxcXFxcXCJnXFxcXFxcXCIpLCBcXFxcXFxcIjxzdHJvbmc+PHNwYW4gc3R5bGU9XFxcXFxcXFxcXFxcXFxcImNvbG9yOiAjMUU5MEZGXFxcXFxcXFxcXFxcXFxcIj5cXFxcXFxcIiArIHMgKyBcXFxcXFxcIjwvc3Bhbj48L3N0cm9uZz5cXFxcXFxcIiksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IGl0LmRlc2MsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogaXQudXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBpdC5waWNfdXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogaXQucGljX3VybCA/ICdtb3ZpZV8xX3ZlcnRpY2FsX3BpYycgOiBcXFxcXFxcInRleHRfMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IFxcXFxcXFwiX19hcHBcXFxcXFxcIiArIE1ZX1BBR0UgKyBcXFxcXFxcIkBcXFxcXFxcIiArIHBhcmFtLmosXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpZiAocGFyYW0uaSA+PSBwYXJhbS5hbGwpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEubGVuZ3RoID09PSAxICYmICghcmVzdWx0IHx8IHB1c2hDb3VudCA9PT0gMCkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0oXFxcXFxcXCJfbm90aGF2ZVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1CZWZvcmUocGFnZWlkLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF9jZW50ZXJfMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi4oCc4oCc4oCd4oCdXFxcXFxcXCIgKyBcXFxcXFxcIn5+fuS7gOS5iOi1hOa6kOmDveayoeacieWTpn5+flxcXFxcXFwiLmZvbnRjb2xvcihcXFxcXFxcIkdyYXlcXFxcXFxcIiksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogXFxcXFxcXCJfbm90aGF2ZVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbShwYWdlaWQpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLliqDovb3nrKxcXFxcXFxcIiArIE1ZX1BBR0UgKyBcXFxcXFxcIumhteS4re+8jOi/m+W6pu+8mlxcXFxcXFwiICsgKHBhcmFtLmkgKyAxKSArIFxcXFxcXFwiL1xcXFxcXFwiICsgcGFyYW0uYWxsLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFxcXFxcIlxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF9jZW50ZXJfMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcXFxcXCJcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBpY191c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IHRydWVcXFxcbiAgICB9XFxcXG59XFxcXG5cXFxcbmZ1bmN0aW9uIENoaW5lc2VUb051bWJlcihjaG5TdHIpIHtcXFxcbiAgICBsZXQgcnRuID0gMDtcXFxcbiAgICBsZXQgc2VjdGlvbiA9IDA7XFxcXG4gICAgbGV0IG51bWJlciA9IDA7XFxcXG4gICAgbGV0IHNlY1VuaXQgPSBmYWxzZTtcXFxcbiAgICBsZXQgc3RyID0gY2huU3RyLnNwbGl0KCcnKTtcXFxcblxcXFxuICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgIGxldCBudW0gPSBjaG5OdW1DaGFyW3N0cltpXV07XFxcXG4gICAgICAgIGlmICh0eXBlb2YgbnVtICE9PSAndW5kZWZpbmVkJykge1xcXFxuICAgICAgICAgICAgbnVtYmVyID0gbnVtO1xcXFxuICAgICAgICAgICAgaWYgKGkgPT09IHN0ci5sZW5ndGggLSAxKSB7XFxcXG4gICAgICAgICAgICAgICAgc2VjdGlvbiArPSBudW1iZXI7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBsZXQgdW5pdCA9IGNobk5hbWVWYWx1ZVtzdHJbaV1dLnZhbHVlO1xcXFxuICAgICAgICAgICAgc2VjVW5pdCA9IGNobk5hbWVWYWx1ZVtzdHJbaV1dLnNlY1VuaXQ7XFxcXG4gICAgICAgICAgICBpZiAoc2VjVW5pdCkge1xcXFxuICAgICAgICAgICAgICAgIHNlY3Rpb24gPSAoc2VjdGlvbiArIG51bWJlcikgKiB1bml0O1xcXFxuICAgICAgICAgICAgICAgIHJ0biArPSBzZWN0aW9uO1xcXFxuICAgICAgICAgICAgICAgIHNlY3Rpb24gPSAwO1xcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICBzZWN0aW9uICs9IChudW1iZXIgKiB1bml0KTtcXFxcbiAgICAgICAg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ICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xcXFxuICAgICAgICB9IGVsc2UgaWYgKGlucHV0LmluY2x1ZGVzKFxcXFxcXFwiYWxpeXVuZHJpdmUuY29tXFxcXFxcXCIpICYmIG1vZGUgIT0gXFxcXFxcXCLlrpjmlrlBUFBcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgbG9nKGlucHV0KTtcXFxcbiAgICAgICAgICAgIGlmIChpbnB1dC5pbmNsdWRlcygnY2hlY2t1cmw/dXJsPScpICYmIGlucHV0LmluY2x1ZGVzKCcmdXJscmVmZXInKSkge1xcXFxuICAgICAgICAgICAgICAgIGlucHV0ID0gZGVjb2RlVVJJQ29tcG9uZW50KGlucHV0LnNwbGl0KCcmdXJscmVmZXInKVswXS5zcGxpdCgnY2hlY2t1cmw/dXJsPScpWzFdKTtcXFxcbiAgICAgICAgICAgICAgICAvL2xvZygn6LS05ZCnJytpbnB1dCk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gJC50b1N0cmluZygodXJsLCBydWxlKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgZnlfYnJpZGdlX2FwcC5vcGVuKEpTT04uc3RyaW5naWZ5KHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi6Zi/6YeM5LqR55uYXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL3BhZ2UvYWxpeXVuP3BhZ2U9ZnlwYWdlJnJlYWx1cmw9XFxcXFxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQodXJsKSxcXFxcbiAgICAgICAgICAgICAgICB9KSlcXFxcbiAgICAgICAgICAgIH0sIGlucHV0LCBydWxlKVxcXFxuICAgICAgICB9IGVsc2UgaWYgKC9cXFxcXFxcXC4obXAzfGZsYWN8bTRhKSQvLnRlc3QoaW5wdXQpKSB7XFxcXG4gICAgICAg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gICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJ1xcXFxuICAgICAgICAgICAgICAgICAgICB9XVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1jYXRjaChlKXsgICAgICAgICAgICAgICAgXFxcXG4gICAgICAgICAgICAgICAgbG9nKFxcXFxcXFwiI+WOn+eUu+aSreaUvuWksei0pSNcXFxcXFxcXG7plJnor6/kv6Hmga8+XFxcXFxcXCIrZS50b1N0cmluZygpK1xcXFxcXFwiXFxcXFxcXFxu6ZSZ6K+v6KGMPlxcXFxcXFwiK2UubGluZU51bWJlcik7XFxcXG4gICAgICAgICAgICAgICAgaWYoZS5jb2RlPT09XFxcXFxcXCJJbnZhbGlkUGFyYW1ldGVyLlJlZnJlc2hUb2tlblxcXFxcXFwiKXtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/nmbvpmYbov4fmnJ/vvIzor7fph43mlrDnmbvpmYZcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/mkq3mlL7lpLHotKXvvIzmkq3mlL7kv6Hmga/lt7LmiZPljbDjgIJcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgIGxldCBtb3VudHN1YiA9IHN0b3JhZ2UwLmdldE15VmFyKCdtb3VudHppbXUnLCB7fSk7XFxcXG4gICAgICAgIGlmIChPYmplY3Qua2V5cyhtb3VudHN1YikubGVuZ3RoID4gMCkge1xcXFxuICAgICAgICAgICAgemltdSA9IG1vdW50c3ViO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGxldCBzdWJ0aXRsZTtcXFxcbiAgICAgICAgaWYgKE9iamVjdC5rZXlzKHppbXUgfHwge30pLmxlbmd0aCA+IDA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FxcXFxcXFwibW91bnR6aW11XFxcXFxcXCIsIHt9KTtcXFxcbiAgICAgICAgICAgIGFkZExpc3RlbmVyKFxcXFxcXFwib25DbG9zZVxcXFxcXFwiLCAkLnRvU3RyaW5nKCgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXFxcXFwibW91bnR6aW11XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcXFxcXCJhbGlTaGFyZVRva2VuXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgfSkpO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHNldE1hcmtlcigpO1xcXFxuICAgICAgICBpZiAocmVhbHVybCkge1xcXFxuICAgICAgICAgICAgbGV0IHNoYXJlSW5mbyA9IGFsaVNoYXJlQXBpLmdldFNoYXJlSW5mbygpO1xcXFxuICAgICAgICAgICAgbGV0IGZpbGVJbmZvID0gc2hhcmVJbmZvLmZpbGVfaW5mb3M7XFxcXG4gICAgICAgICAgICBpZiAoZmlsZUluZm8ubGVuZ3RoID09PSAxICYmIGZpbGVJbmZvWzBdLnR5cGUgPT09IFxcXFxcXFwiZm9sZGVyXFxcXFxcXCImJiFmaWxlSWQpIHtcXFxcbiAgICAgICAgICAgICAgICBmaWxlSWQgPSBmaWxlSW5mb1swXS5maWxlX2lkO1xcXFxuICAgICAgICAgICAgICAgIHNldFBhZ2VUaXRsZShmaWxlSW5mb1swXS5maWxlX25hbWUpO1xcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoc2hhcmVJbmZvLnNoYXJlX25hbWUpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHNoYXJlSW5mby5jcmVhdG9yX25hbWUgKyBcXFxcXFxcIiZuYnNwOyZuYnNwOzxzbWFsbD5cXFxcXF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LFxcXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IHBpY191cmwsXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZDogc2hhcmVJZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogTVlfUEFSQU1TLnNoYXJlVG9rZW4sXFxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVJZDogZmlsZUl0ZW0uZmlsZV9pZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IHNoYXJlUHdkLFxcXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGZpbGVJdGVtLm5hbWVcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgIGxldCBzdWJ0aXRsZSwgbG9uZ2MsIGNscztcXFxcbiAgICAgICAgICAgIGxldCBuYW1lTm90RXh0ID0gZmlsZUl0ZW0ubmFtZS5yZXBsYWNlKCcuJyArIGZpbGVJdGVtLmZpbGVfZXh0ZW5zaW9uLCAnJyk7XFxcXG4gICAgICAgICAgICBpZiAoZmlsZVR5cGUuc3VidGl0bGUuaW5jbHVkZXMoZmlsZUl0ZW0uZmlsZV9leHRlbnNpb24pKSB7XFxcXG4gICAgICAgICAgICAgICAgbG9uZ2MgPSBbe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLmjILovb3lrZfluZVcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKHptKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignbW91bnR6aW11Jywgem0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+aMgui9veWujOaIkO+8jOW9k+WJjeWtl+W5leaWh+S7tjogJyArIHptLm5hbWUgKyAnLicgKyB6bS5leHQ7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dDogZmlsZUl0ZW0uZmlsZV9leHRlbnNpb24sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlX2lkOiBmaWxlSXRlbS5maWxlX2lkLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogbmFtZU5vdEV4dFxcXFxuICAgICAgICAgICAgICAgICAgICB9KSxcXFxcbiAgICAgICAgICAgICAgICB9XTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChjYXRlID09PSBcXFxcXFxcInZpZGVvXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICBpZiAoemltdWxpc3QubGVuZ3RoKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gemltdWxpc3QuZmluZCh2ID0+IHYubmFtZS5pbmNsdWRlcyhuYW1lTm90RXh0KSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGNscyA9IFxcXFxcXFwicGxheWxpc3RcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsID0gZmlsZUl0ZW0udGh1bWJuYWlsIHx8IHBpY191cmw7XFxcXG4gICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgIGlmIChzdHlsZSA9PT0gXFxcXFxcXCJ0ZXh0XzFcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgIGRlc2MgKz0gXFxcXFxcXCJcXFxcXFxcXHRcXFxcXFxcXHRcXFxcXFxcIiArIGZvcm1hdFNpemUoZmlsZUl0ZW0uc2l6ZSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKHNoYXJlSWQsc2hhcmVQd2QsIHNoYXJlVG9rZW4sIGZpbGVJZCwgY2F0ZSwgc3VidGl0bGUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQucmVxdWlyZShcXFxcXFxcImhpa2VyOi8vcGFnZS9hbGlsYXp5XFxcXFxcXCIpKHNoYXJlSWQsIHNoYXJlUHdkLCBzaGFyZVRva2VuLCBmaWxlSWQsIGNhdGUsIHN1YnRpdGxlKTtcXFxcbiAgICAgICAgICAgICAgICB9LCBzaGFyZUlkLCBzaGFyZVB3ZCwgTVlfUEFSQU1TLnNoYXJlVG9rZW4sIGZpbGVJdGVtLmZpbGVfaWQsIGNhdGUsIHN1YnRpdGxlKSxcXFxcbiAgICAgICAgICAgICAgICBkZXNjOiBkZXNjLFxcXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IHBpY191cmwsXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGZpbGVJdGVtLmZpbGVfaWQsXFxcXG4gICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogbG9uZ2MsXFxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogY2xzLFxcXFxuICAgICAgICAgICAgICAgICAgICAvL2luaGVyaXRUaXRsZTogZmFsc2UsXFxcXG4gICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogZmlsZUl0ZW0ubmFtZVxcXFxuICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlXFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfVxcXFxuICAgIH1cXFxcbiAgICBpZiAoY29udHMubGVuZ3RoID09PSAwKSB7XFxcXG4gICAgICAgIGl0ZW1zLnB1c2goe1xcXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF9j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cXFxcInJlZFxcXFxcXFwiKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFxcXFxcImhpa2VyOi8vZW1wdHlcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoZS5zaWduaWZpY2FuY2UgPT09IDMpIHtcXFxcbiAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi4oCc4oCc4oCd4oCdXFxcXFxcXCIgKyBlLm1lc3NhZ2UuYmlnKCkuZm9udGNvbG9yKFxcXFxcXFwiZ3JlZW5cXFxcXFxcIiksXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMSdcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfVxcXFxuXFxcXG4gICAgfSBlbHNlIHtcXFxcbiAgICAgICAgaXRlbXMucHVzaCh7XFxcXG4gICAgICAgICAgICB0aXRsZTogJ+asp+asp++8jOaKpemUmeS6huOAguWcqOWIt+aWsOWHoOasoe+8n+aIluiAheabtOaNouaWh+S7tuWkueOAgicsXFxcXG4gICAgICAgICAgICB1cmw6IFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgZGVzYzogZS50b1N0cmluZygpLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJ1xcXFxuICAgICAgICB9KTtcXFxcbiAgICAgICAgLy90aHJvdyBlO1xcXFxuICAgIH1cXFxcbn1cXFxcblxcXFxuc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GUoKSA6IG5ldyBEYXRlKCkuZ2V0RGF0ZSgpXFxcXG4gICAgICAgICAgICAgICAgY29uc3QgSEggPSBuZXcgRGF0ZSgpLmdldEhvdXJzKCkgPCAxMCA/ICcwJyArIG5ldyBEYXRlKCkuZ2V0SG91cnMoKSA6IG5ldyBEYXRlKCkuZ2V0SG91cnMoKVxcXFxuICAgICAgICAgICAgICAgIGNvbnN0IG1tID0gbmV3IERhdGUoKS5nZXRNaW51dGVzKCkgPCAxMCA/ICcwJyArIG5ldyBEYXRlKCkuZ2V0TWludXRlcygpIDogbmV3IERhdGUoKS5nZXRNaW51dGVzKClcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4geXkgKyAnJyArIGRkICsgJycgKyBISCArICcnICsgTU0gKyAnJyArIG1tXFxcXG4gICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgIGxldCBzaGFyZXRva2VuID0gSlNPTi5wYXJzZShyZXF1ZXN0KCdodHRwczovL2FwaS5hbGl5dW5kcml2ZS5jb20vdjIvc2hhcmVfbGluay9nZXRfc2hhcmVfdG9rZW4nLCB7XFxcXG4gICAgICAgICAgICAgICAgYm9keToge1xcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInNoYXJlX3B3ZFxcXFxcXFwiOiBzaGFyZVB3ZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJzaGFyZV9pZFxcXFxcXFwiOiBzaGFyZV9pZFxcXFxuICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsXFxcXG4gICAgICAgICAgICAgICAgdGltZW91dDogMzAwMFxcXFxuICAgICAgICAgICAgfSkpLnNoYXJlX3Rva2VuO1xcXFxuICAgICAgICAgICAgcHV0TXlWYXIoXFxcXFxcXCJhbGlTaGFyZVRva2VuXFxcXFxcXCIsIHNoYXJldG9rZW4pO1xcXFxuICAgICAgICAgICAgbGV0IGhlYWRlcnMgPSB7XFxcXG4gIC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XJpbmZvICYmIGFsaXVzZXJpbmZvLnVzZXJfaWQgJiYgbm93dGltZSA8IChvbGR0aW1lICsgMSAqIDYwICogNjAgKiAxMDAwKSkge1xcXFxuICAgICAgICAgICAgICAgIHVzZXJpbmZvID0gYWxpdXNlcmluZm87XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIHVzZXJpbmZvID0gSlNPTi5wYXJzZShyZXF1ZXN0KCdodHRwczovL2F1dGguYWxpeXVuZHJpdmUuY29tL3YyL2FjY291bnQvdG9rZW4nLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxcXG4gICAgICAgICAgICAgICAgICAgIGJvZHk6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwicmVmcmVzaF90b2tlblxcXFxcXFwiOiBhbGl0b2tlbixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiZ3JhbnRfdHlwZVxcXFxcXFwiOiBcXFxcXFxcInJlZnJlc2hfdG9rZW5cXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgdGltZW91dDogMzAwMFxcXFxuICAgICAgICAgICAgICAgIH0pKTtcXFxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignYWxpdXNlcmluZm8nLCB1c2VyaW5mbyk7XFxcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ3VzZXJpbmZvQ2hlY2t0aW1lJywgbm93dGltZSArICd0aW1lJyk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBsZXQgYXV0aG9yaXphdGlvbiA9ICdCZWFyZXIgJyArIHVzZXJpbmZvLmFjY2Vzc190b2tlbjtcXFxcbiAgICAgICAgICAgIGxldCBkZXZpY2VJZCA9IHVzZXJpbmZvLmRldmljZV9pZDtcXFxcbiAgICAgICAgICAgIGxldCB1c2VySWQgPSB1c2VyaW5mby51c2VyX2lkO1xcXFxuICAgICAgICAgICAgbGV0IHNpZ25hdHVyZTtcXFxcbiAgICAgICAgICAgIGxldCBwdWJsaWNfa2V5O1xcXFxuXFxcXG4gICAgICAgICAgICBmdW5jdGlvbiByZWZyZXNoVG9rZW4xKCkge1xcXFxuICAgICAgICAgICAgICAgIG5vd3RpbWUgPSBEYXRlLm5vdygpO1xcXFxuICAgICAgICAgICAgICAgIHVzZXJpbmZvID0gSlNPTi5wYXJzZShyZXF1ZXN0KCdodHRwczovL2F1dGguYWxpeXVuZHJpdmUuY29tL3YyL2FjY291bnQvdG9rZW4nLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxcXG4gICAgICAgICAgICAgICAgICAgIGJvZHk6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwicmVmcmVzaF90b2tlblxcXFxcXFwiOiBhbGl0b2tlbixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiZ3JhbnRfdHlwZVxcXFxcXFwiOiBcXFxcXFxcInJlZnJlc2hfdG9rZW5cXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgdGltZW91dDogMzAwMFxcXFxuICAgICAgICAgICAgICAgIH0pKTtcXFxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignYWxpdXNlcmluZm8nLCB1c2VyaW5mbyk7XFxcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ3VzZXJpbmZvQ2hlY2t0aW1lJywgbm93dGltZSArICd0aW1lJyk7XFxcXG4gICAgICAgICAgICAgICAgYXV0aG9yaXphdGlvbiA9ICdCZWFyZXIgJyArIH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0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbScsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnQXV0aG9yaXphdGlvbic6IGF1dGhvcml6YXRpb24sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnWC1TaGFyZS1Ub2tlbic6IHNoYXJldG9rZW4sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAneC1kZXZpY2UtaWQnOiBkZXZpY2VJZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICd4LXNpZ25hdHVyZSc6IHNpZ25cXFxcbiAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgYm9keTogJ3tcXFxcXFxcImRldmljZU5hbWVcXFxcXFxcIjpcXFxcXFxcIkVkZ2XmtY/op4jlmahcXFxcXFxcIixcXFxcXFxcIm1vZGVsTmFtZVxcXFxcXFwiOlxcXFxcXFwiV2luZG93c+e9kemhteeJiFxcXFxcXFwiLFxcXFxcXFwibm9uY2VcXFxcXFxcIjowLFxcXFxcXFwicHViS2V5XFxcXFxcXCI6XFxcXFxcXCInICsgcHViS2V5ICsgJ1xcXFxcXFwiLFxcXFxcXFwicmVmcmVzaFRva2VuXFxcXFxcXCI6XFxcXFxcXCInICsgYWxpdG9rZW4gKyAnXFxcXFxcXCJ9JyxcXFxcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCdcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICBsb2coc2Vzcyk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHNlc3MuaW5jbHVkZXMoJ3N1Y2Nlc3MnKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgamF2YS5sYW5nLlRocmVhZC5zbGVlcCgxNTApO1xcXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hUb2tlbjEoKTtcXFxcbiA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XFxcXCI6IFxcXFxcXFwiRWRnZea1j+iniOWZqFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIFxcXFxcXFwibW9kZWxOYW1lXFxcXFxcXCI6IFxcXFxcXFwiV2luZG93c+e9kemhteeJiFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIFxcXFxcXFwicHViS2V5XFxcXFxcXCI6IHB1YmxpY19rZXksXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBsZXQgYWxpeXVuVXJsID0gW107XFxcXG4gICAgICAgICAgICBpZiAoc2lnbmF0dXJlICYmIHB1YmxpY19rZXkpIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgcmVxID0gSlNPTi5wYXJzZShyZXF1ZXN0KFxcXFxcXFwiaHR0cHM6Ly9hcGkuYWxpeXVuZHJpdmUuY29tL3VzZXJzL3YxL3VzZXJzL2RldmljZS9jcmVhdGVfc2Vzc2lvblxcXFxcXFwiLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxcXG4gICAgICAgICAgICAgICAgICAgIGJvZHk6IGRhdGEsXFxcXG4gICAgICAgICAgICAgICAgICAgIHRpbWVvdXQ6IDMwMDBcXFxcbiAgICAgICAgICAgICAgICB9KSk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHJlcS5zdWNjZXNzKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnNbJ3gtc2hhcmUtdG9rZW4nXSA9IHNoYXJldG9rZW47XFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnNbJ2ZpbGVpZCddID0gdXNlcklkO1xcXFxuICAgICAgICAgICAgICAgICAgICBkYXRhID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJjYXRlZ29yeVxcXFxcXFwiOiBcXFxcXFxcImxpdmVfdHJhbnNjb2RpbmdcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiZmlsZV9pZFxcXFxcXFwiOiBmaWxlX2lkLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJnZXRfcHJldmlld191cmxcXFxcXFxcIjogdHJ1ZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwic2hhcmVfaWRcXFxcXFxcIjogc2hhcmVfaWQsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInRlbXBsYXRlX2lkXFxcXFxcXCI6IFxcXFxcXFwiXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcImdldF9zdWJ0aXRsZV9pbmZvXFxcXFxcXCI6IHRydWVcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UocmVxdWVzdCgnaHR0cHM6Ly9hcGkuYWxpeXVuZHJpdmUuY29tL3YyL2ZpbGUvZ2V0X3NoYXJlX2xpbmtfdmlkZW9fcHJldmlld19wbGF5X2luZm8nLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogZGF0YSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogMzAwMFxcXFxuICAgICAgICAgICAgICAgICAgICB9KSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGFsaXl1blVybCA9IGpzb24udmlkZW9fcHJldmlld19wbGF5X2luZm8ubGl2ZV90cmFuc2NvZGluZ190YXNrX2xpc3Q7XFxcXG4gICAgICAgICAgICAgICAgICAgIGFsaXl1blVybC5yZXZlcnNlKCk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIGFsaXl1blVybDtcXFxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgbG9nKCfmoLnmja7lhbHkuqvpk77mjqXojrflj5bmkq3mlL7lnLDlnYDlpLHotKU+JyArIGUubWVzc2FnZSk7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJcXFxcXFxcIjtcXFxcbiAgICAgICAgfVxcXFxuICAgIH1cXFxcblxcXFxuICAgIGZ1bmN0aW9uIGdldEFsaVVybChzaGFyZV9pZCwgc2hhcmVQd2QsIGZpbGVfaWQsIGFsaXRva2VuKSB7XFxcXG4gICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICBsZXQgdXJscyA9IFtdO1xcXFxuICAgICAgICAgICAgbGV0IG5hbWVzID0gW107XFxcXG4gICAgICAgICAgICBsZXQgaGVhZHMgPSBbXTtcXFxcbiAgICAgICAgICAgIGxldCB1ID0gc3RhcnRQcm94eVNlcnZlcigkLnRvU3RyaW5nKChhbGlTaGFyZVBsYXlVcmwsIGZpbGVfaWQsIHNoYXJlX2lkLCBzaGFyZVB3ZCwgYWxpdG9rZW4pID0+IHtcXFxcbiAgICAgICAgICAgICAgICBmdW5jdGlvbiBnZXR1cmwoZmlsZWlkLCBsaW5lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIC8v6aKE5Yqg6L295pe25Lya5Y+YZmlsZV9pZCzmiYDku6V0c+i/h+acn+abtOaWsOaXtui/mOWPluWOn+adpeeahGlkXFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsTGlzdCA9IGFsaVNoYXJlUGxheVVybChzaGFyZV9pZCwgc2hhcmVQd2QsIGZpbGVpZCwgYWxpdG9rZW4pIHx8IFtdO1xcXFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhsaW5lKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGFsaXVybDtcXFxcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsYXlVcmxMaXN0LmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS50ZW1wbGF0ZV9pZCA9PSBsaW5lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaXVybCA9IGl0ZW0udXJsO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKmFsaXVybCA9IEpTT04ucGFyc2UocmVxdWVzdChpdGVtLnVybCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS8nXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25seUhlYWRlcnM6IHRydWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWRpcmVjdDogZmFsc2UsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lb3V0OiAzMDAwXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5oZWFkZXJzLmxvY2F0aW9uWzBdOyovXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhlLnRvU3RyaW5nKCkpO1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIC8v5LiK6Z2i5piv6I635Y+W6Zi/6YeM55qE5pKt5pS+5Zyw5Z2AXFxcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhcXFxcXFxcIuaIkeWcqOS7o+eQhlxcXFxcXFwiICsgYWxpdXJsKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGhvbWUgPSBhbGl1cmwuc3BsaXQoJ21lZGlhLm0zdTgnKVswXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGYgPSBmZXRjaChhbGl1cmwsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVvdXQ6IDMwMDBcXFxcbiAgICAgICAgICAgICAgICAgICAgfSkuc3BsaXQoXFxcXFxcXCJcXFxcXFxcXG5cXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBmZiA9IGYubWFwKGl0ID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdC5zdGFydHNXaXRoKFxcXFxcXFwibWVkaWEtXFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiL3Byb3h5P3VybD1cXFxcXFxcIiArIGJhc2U2NEVuY29kZShob21lICsgaXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGl0O1xcXFxuICAgICAgICAgICAgICAgICAgICB9KS5qb2luKFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICBsb2coJ3VmaWQtJyArIGZpbGVpZCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHdyaXRlRmlsZSgnaGlrZXI6Ly9maWxlcy9jYWNoZS9fZmlsZVNlbGVjdF8nICsgZmlsZWlkICsgJy5tM3U4JywgZmYpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmY7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSBiYXNlNjREZWNvZGUoTVlfUEFSQU1TLnVybCk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHVybC5pbmNsdWRlcyhcXFxcXFxcIi50c1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgZmlkID0gdXJsLnNwbGl0KCcmZj0nKVsxXS5zcGxpdCgnJicpWzBdO1xcXFxuICAgICAgICAgICAgICAgICAgICBsb2coJ3NmaWQtJyArIGZpZCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBmID0gZmV0Y2goJ2hpa2VyOi8vZmlsZXMvY2FjaGUvX2ZpbGVTZWxlY3RfJyArIGZpZCArICcubTN1OCcpLnNwbGl0KFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICBmLmZvckVhY2goaXQgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0ICYmIGl0LnN0YXJ0c1dpdGgoJy9wcm94eT91cmw9JykpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZnVybCA9IGJhc2U2NERlY29kZShpdC5yZXBsYWNlKCcvcHJveHk/dXJsPScsICcnKSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5zdWJzdHIodXJsLmluZGV4T2YoJy9tZWRpYS0nKSwgdXJsLmluZGV4T2YoJy50cycpKSA9PSBmdXJsLnN1YnN0cihmdXJsLmluZGV4T2YoJy9tZWRpYS0nKSwgZnVybC5pbmRleE9mKCcudHMnKSkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsID0gZnVybDtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBleHBpcmVzID0gdXJsLnNwbGl0KCd4LW9zcy1leHBpcmVzPScpWzFdLnNwbGl0KCcmJylbMF07XFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGxhc3R0aW1lID0gcGFyc2VJbnQoZXhwaXJlcykgLSBEYXRlLm5vdygpIC8gMTAwMDtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxhc3R0aW1lIDwgNjApIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKCfov4fmnJ/mm7TmlrAnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGxpbmUgPSB1cmwuc3BsaXQoJy9tZWRpYScpWzBdOyAvL+WPluS5i+WJjeaSreaUvueahHRz5q6157q/6LevXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaW5lID0gbGluZS5zdWJzdHJpbmcobGluZS5sYXN0SW5kZXhPZignLycpICsgMSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZiA9IGdldHVybChmaWQsIGxpbmUpLnNwbGl0KFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZi5mb3JFYWNoKGl0ID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXQgJiYgaXQuc3RhcnRzV2l0aCgnL3Byb3h5P3VybD0nKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZnVybCA9IGJhc2U2NERlY29kZShpdC5yZXBsYWNlKCcvcHJveHk/dXJsPScsICcnKSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1cmwuc3Vic3RyKHVybC5pbmRleE9mKCcvbWVkaWEtJyksIHVybC5pbmRleE9mKCcudHMnKSkgPT0gZnVybC5zdWJzdHIoZnVybC5pbmRleE9mKCcvbWVkaWEtJyksIGZ1cmwuaW5kZXhPZignLnRzJykpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSBmdXJsO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coJ+acqui/h+acnycpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsb2coXFxcXFxcXCLku6PnkIZ0c++8mlxcXFxcXFwiICsgdXJsKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkoe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzQ29kZTogMzAyLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiTG9jYXRpb25cXFxcXFxcIjogdXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS8nXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxvZygn6aaW5qyh5pu05pawJylcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGxpbmUgPSB1cmwuc3BsaXQoJ3wnKVsxXTtcXFxcbiAgICAgICAg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HVybiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IHVybHMsXFxcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBuYW1lcyxcXFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZHMsXFxcXG4gICAgICAgICAgICAgICAgfTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgbG9nKCfmnKrojrflj5bpmL/ph4zmkq3mlL7lnLDlnYDvvIzlu7rorq7ph43ov5vova/ku7blho3or5XkuIDmrKEnKVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiB7fTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgbG9nKCfojrflj5blhbHkuqvpk77mjqXmkq3mlL7lnLDlnYDlpLHotKU+JyArIGUubWVzc2FnZSk7XFxcXG4gICAgICAgICAgICB0aHJvdyBlO1xcXFxuICAgICAgICAgICAgcmV0dXJuIHt9O1xcXFxuICAgICAgICB9XFxcXG4gICAgfVxcXFxuICAgIHJldHVybiBnZXRBbGlVcmwoXFxcXG4gICAgICAgIHNoYXJlSWQsXFxcXG4gICAgICAgIHNoYXJlUHdkLFxcXFxuICAgICAgICBmaWxlSWQsXFxcXG4gICAgICAgIHJlZnRva2VuXFxcXG4gICAgKTtcXFxcbn07XFxcXG5cXFxcbiQuZXhwb3J0cy5nZXRWaWRlbyA9IGdldFZpZGVvO1xcXFxuXFxcXG5mdW5jdGlvbiBwb3N0QXBpKGFwaSwgYm9keSwgaGVhZGVycywgYWdhaW5UcnksIHRyeUZyZSkge1xcXFxuICAgIGxldCByZXN1bHQ7XFxcXG4gICAgdHJ5IHtcXFxcbiAgICAgICAgcmVzdWx0ID0gcmVxdWVzdChhcGkuc3RhcnRzV2l0aChcXFxcXFxcImh0dHBcXFxcXFxcIikgPyBhcGkgOiAnaHR0cHM6Ly9hcGkuYWxpeXVuZHJpdmUuY29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XBlOiBcXFxcXFxcImF1dGhvcml6YXRpb25fY29kZVxcXFxcXFwiXFxcXG4gICAgICAgICAgICB9O1xcXFxuICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgYm9keSA9IHtcXFxcbiAgICAgICAgICAgICAgICBncmFudF90eXBlOiBcXFxcXFxcInJlZnJlc2hfdG9rZW5cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiB0aGlzLm9wZW5Ub2tlbnMuUmVmcmVzaFRva2VuT3BlbixcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBsZXQganNvbiA9IHBvc3QoJ2h0dHBzOi8vYXBpLnhob2ZlLnRvcC9hbGlzdC9hbGlfb3Blbi9jb2RlJywge1xcXFxuICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXFxcbiAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KGJvZHkpLFxcXFxuICAgICAgICB9KTtcXFxcbiAgICAgICAgaWYgKCFqc29uKSB7XFxcXG4gICAgICAgICAgICBqc29uID0gcG9zdCgnaHR0cHM6Ly9hcGktY2Yubm4uY2kvYWxpc3QvYWxpX29wZW4vY29kZScsIHtcXFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzLFxcXFxuICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KGJvZHkpLFxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgaWYgKGpzb24uaW5jbHVkZXMoJ1RvbyBNYW55IFJlcXVlc3RzJyl8fGpzb24uaW5jbHVkZXMoXFxcXFxcXCI1MDIgQmFkIEdhdGV3YXlcXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFxcXFxcIumikee5geivt+axguaaguaXtuiiq+WwgeemgVxcXFxcXFxcblxcXFxcXFwiICsganNvbik7X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9rZW4oKTtcXFxcbiAgICAgICAgICAgIHJldHVybiB7XFxcXG4gICAgICAgICAgICAgICAgaGVhZGVyczp7XFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiWC1TaGFyZS1Ub2tlblxcXFxcXFwiOiB0aGlzLnNoYXJlVG9rZW4sXFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiYXV0aG9yaXphdGlvblxcXFxcXFwiOiB0aGlzLmFsaVRva2Vucy5hY2Nlc3NfdG9rZW5cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9O1xcXFxuICAgICAgICB9KTtcXFxcblxcXFxuICAgICAgICByZXR1cm4gZG93bmxvYWRJbmZvLmRvd25sb2FkX3VybDtcXFxcbiAgICB9XFxcXG59KTtcXFxcblxcXFxuJC5leHBvcnRzLkFsaUFjY2Vzc0FwaSA9IEFsaUFjY2Vzc0FwaTtcXFwifSx7XFxcImNvbF90eXBlXFxcIjpcXFwibW92aWVfM1xcXCIsXFxcIm5hbWVcXFwiOlxcXCJUb2tlblBhdGhcXFwiLFxcXCJwYXRoXFxcIjpcXFwidG9rZW5QYXRoLmpzb25cXFwiLFxcXCJydWxlXFxcIjpcXFwie1xcXFxuICAgIFxcXFxcXFwib3BlblRva2Vuc0ZpbGVwYXRoXFxcXFxcXCI6IFxcXFxcXFwiaGlrZXI6Ly9maWxlcy9ydWxlcy9Mb3lEZ0lrL2FsaU9wZW5Ub2tlbi5qc29uXFxcXFxcXCIsXFxcXG4gICAgXFxcXFxcXCJhbGlUb2tlbnNGaWxlcGF0aFxcXFxcXFwiOiBcXFxcXFxcImhpa2VyOi8vZmlsZXMvcnVsZXMvTG95RGdJay9hbGlUb2tlbi5qc29uXFxcXFxcXCJcXFxcbn1cXFwifV1cIixcInByb3h5XCI6XCJcIn0iLCJ0aXRsZSI6IumXqueUteS+oOOAljRr44CX5pyA5paw54mIQCJ9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement