Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:网页插件¥js_url¥global_全网VIP视频自动解析播放器(已适配手机)@base64://Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgICAgICDlhajnvZFWSVDop4bpopHoh6rliqjop6PmnpDmkq3mlL7lmago5bey6YCC6YWN5omL5py6KQovLyBAbmFtZXNwYWNlICAgIGh0dHBzOi8vd3d3LnRhbXBlcm1vbmtleS5uZXQvCi8vIEB2ZXJzaW9uICAgICAgMS4xLjAKLy8gQGhvbWVwYWdlICAgICBodHRwczovL2dyZWFzeWZvcmsub3JnL3poLUNOL3VzZXJzLzg0MDY4OAovLyBAbGljZW5zZSAgICAgIEFHUEwtMy4wCi8vIEBkZXNjcmlwdGlvbiAg5peg6ZyA6Lez6L2s5paw572R5Z2A77yM5omT5byA5a6Y572R55u05o6l55yL77yM6LaF5riFIOaXoOW5v+WRiiDpmo/mnLrljrvmsLTljbDjgILmlK/mjIHvvJrohb7orq/vvIzniLHlpYfoibrvvIzkvJjphbfvvIzlk5Tlk6nlk5Tlk6nvvIzlkqrlkpXvvIzkuZDop4bvvIzmkJzni5DvvIzoipLmnpzvvIzopb/nk5zvvIxQUFRW77yMMTkwNeeUteW9see9ke+8jOWNjuaVsOOAguaUr+aMgeino+aekOWksei0peiHquWKqOWIh+aNouaOqOiNkOino+aekOa6kOOAgumAgumFjeWQhOenjea1j+iniOWZqO+8jOmFt+edv2k1LTgzMDAgQ1BV5oCn6IO95rWL6K+V5raI6ICX5LuFMSXjgILor7flhbPpl63mtY/op4jlmajpmLvmraLnrKzkuInmlrlDb29raWXnmoTlip/og73vvIzlkKbliJnop6PmnpDmupDkvJrop6PmnpDlpLHotKXvvIzop6PmnpDmupDop6PmnpDlpLHotKXkvZzogIXml6Dlipvop6PlhrPjgIIKLy8gQGljb24gICAgICAgICBkYXRhOmltYWdlL3N2Zyt4bWw7YmFzZTY0LFBEOTRiV3dnZG1WeWMybHZ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gICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAvLyDpmLLmraLohJrmnKzph43lpI3miafooYwKICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICB9CgogICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIGNvbnN0IGFwcGVuZENoaWxkID0gTm9kZS5wcm90b3R5cGUuYXBwZW5kQ2hpbGQ7CiAgICAgICAgICAgIE5vZGUucHJvdG90eXBlLmFwcGVuZENoaWxkID0gZnVuY3Rpb24gKG5vZGUpIHsKICAgICAgICAgICAgICAgIGlmIChub2RlLmNvbnN0cnVjdG9yLm5hbWUgPT09ICJIVE1MSUZyYW1lRWxlbWVudCIpIHsKICAgICAgICAgICAgICAgICAgICBjb25zdCBzcmMgPSBub2RlLnNyYzsKICAgICAgICAgICAgICAgICAgICBub2RlLnJlbW92ZUF0dHJpYnV0ZSgic3JjIik7CiAgICAgICAgICAgICAgICAgICAgbm9kZS5yZW1vdmVBdHRyaWJ1dGUoInNhbmRib3giKTsKICAgICAgICAgICAgICAgICAgICBhcHBlbmRDaGlsZC5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgIGlmIChkb2N1bWVudC5jb250YWlucyhub2RlKSkgewogICAgICAgICAgICAgICAgICAgICAgICBub2RlLmNvbnRlbnRXaW5kb3cubmFtZSA9IHdpbmRvdy5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhzcmMgKyAiID0gIiArIG5vZGUuY29udGVudFdpbmRvdy5uYW1lKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgLy8g56m655qEc3Jj5Lya5a+86Ie0572R6aG15Yi35paw77yM5omA5Lul6ZyA6KaB5o6S6ZmkCiAgICAgICAgICAgICAgICAgICAgaWYgKEJvb2xlYW4oc3JjKSkgbm9kZS5zcmMgPSBzcmM7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBub2RlLmdldEVsZW1lbnRzQnlUYWdOYW1lID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3JjID0gW10sIGlmcmFtZXMgPSBub2RlLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJpZnJhbWUiKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGlmcmFtZXMubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3JjW2ldID0gaWZyYW1lc1tpXS5zcmM7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZXNbaV0ucmVtb3ZlQXR0cmlidXRlKCJzcmMiKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWZyYW1lc1tpXS5yZW1vdmVBdHRyaWJ1dGUoInNhbmRib3giKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYXBwZW5kQ2hpbGQuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQuY29udGFpbnMobm9kZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBpZnJhbWVzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZnJhbWVzW2ldLmNvbnRlbnRXaW5kb3cubmFtZSA9IHdpbmRvdy5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coc3JjW2ldICsgIiA9ICIgKyBpZnJhbWVzW2ldLmNvbnRlbnRXaW5kb3cubmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQm9vbGVhbihzcmNbaV0pKSBpZnJhbWVzW2ldLnNyYyA9IHNyY1tpXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgaWZyYW1lcy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEJvb2xlYW4oc3JjW2ldKSkgaWZyYW1lc1tpXS5zcmMgPSBzcmNbaV07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGFwcGVuZENoaWxkLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShjb25zb2xlLCAiY2xlYXIiLCB7CiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcigi56aB5q2i5riF6Zmk5o6n5Yi25Y+wIik7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihlLm1lc3NhZ2UpOwogICAgICAgICAgICB9CiAgICAgICAgfSkoKTsKCiAgICAgICAgLy8g6K+75Y+W6YWN572u5ZCO5omn6KGMCiAgICAgICAgZnVuY3Rpb24gY29uZmlnKCkgewogICAgICAgICAgICAvLyDojrflj5bmoYbmnrblvqrnjq/ml7bpl7TvvIxDUFXmgKfog73lpb3nmoTlj6/ku6Xorr7nva7kuLoxMDDvvIxDUFXmgKfog73kuI3lpb3nmoTlj6/ku6Xorr7nva7kuLoxMDAwCiAgICAgICAgICAgIHNldHRpbmdzLmdldEVsZW1lbnRUaW1lcyA9IDUwMDsKICAgICAgICAgICAgLy8gbG9n6L6T5Ye65a2X5L2T5biD5bGACiAgICAgICAgICAgIHNldHRpbmdzLmZvbnRTdHlsZSA9IHsKICAgICAgICAgICAgICAgIG9rOiAiZm9udC1mYW1pbHk6IOW+rui9r+mbhem7kSzpu5HkvZMsRHJvaWQgU2VyaWYsQXJpYWwsc2Fucy1zZXJpZjsgY29sb3I6ICMwZjA7IiwKICAgICAgICAgICAgICAgIG1heDogImZvbnQtZmFtaWx5OiDlvq7ova/pm4Xpu5Es6buR5L2TLERyb2lkIFNlcmlmLEFyaWFsLHNhbnMtc2VyaWY7IGZvbnQtc2l6ZTogMzBweDsgYmFja2dyb3VuZC1jb2xvcjogIzIyMjsgdGV4dC1zaGFkb3c6IDBweCAwcHggMTJweCAjZmZmOyBjb2xvcjogI2ZmZjsiCiAgICAgICAgICAgIH07CgogICAgICAgICAgICBpZiAod2luZG93ID09PSB0b3ApIHsKICAgICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgICAqICAgICgpOiDlsI/mi6zlj7fmi6zkvY/nmoTooajnpLrmjqjojZDop6PmnpAg55S76LSo6auYIOmAn+W6puW/qwogICAgICAgICAgICAgICAgKiAgICA6IOaXoOaLrOWPt+eahOihqOekuuinhumikeW4puawtOWNsCDmiJYg5Y6f6aG16Z2i55S76LSoCiAgICAgICAgICAgICAgICAqICAgIFtdOiDmlrnmi6zlj7fooajnpLrmoIfmuIXnlLvotKgg5LiN5o6o6I2QCiAgICAgICAgICAgICAgICAqLwogICAgICAgICAgICAgICAgc2V0dGluZ3MuTm9BROino+aekCA9IHsgICAgLy8gVE9ETyBieSAxN2t5dW4uY29tL2FwaS5waHA/dXJsPSAgICAvLyBUT0RPIGJ5IHR2Lmh6d2RkLmNuCiAgICAgICAgICAgICAgICAgICAgLy8g5L2g5Y+v5Lul5Zyo6L+Z6YeM5a6a5LmJ6Ieq5bex55qE6Kej5p6Q5o6l5Y+j77yM6ISa5pys5Lya6Ieq5Yqo6YCC6YWN44CC5qC85byP5aaC5LiL77yaCiAgICAgICAgICAgICAgICAgICAgLy8gIuino+aekOWQjeensCI6ICLop6PmnpDmjqXlj6PnmoTpk77mjqUiLCAgICAgICAgICAgICAvLyBUT0RPIOazqOaEjyA6IOWSjCAiIOS7peWPiiAsIOmDveaYr+iLseaWh+eahOespuWPt+OAggogICAgICAgICAgICAgICAgICAgICLlpKnnv7zop6PmnpAiOiAiaHR0cHM6Ly9qc2FwLmF0dGFraWRzLmNvbS8/dXJsPSIsICAgIC8vIFRPRE8g6IW+6K6vICjoipLmnpwpIChC56uZKQogICAgICAgICAgICAgICAgICAgICLlsI/kuIPop6PmnpAiOiAiaHR0cHM6Ly8yLjA4YmsuY29tLz91cmw9IiwgICAgLy8gVE9ETyAo5b6F5rWL6K+VKQogICAgICAgICAgICAgICAgICAgICJCTOino+aekCI6ICJodHRwczovL3ZpcC5ibGppZXguY29tLz92PSIsICAgIC8vIFRPRE8gKOW+hea1i+ivlSkKICAgICAgICAgICAgIjgwOTDop6PmnpAiOiAiaHR0cHM6Ly93d3cuODA5MGcuY24vamlleGkvP3VybD0iLCAgICAvLyBUT0RPICjlvoXmtYvor5UpCiAgICAgICAgICAgICI3Nzfop6PmnpAiOiAiaHR0cHM6Ly9qeC43NzdqaWV4aS5jb20vcGxheWVyLz91cmw9IiwgICAgLy8gVE9ETyAo5b6F5rWL6K+VKQogICAgICAgICAgICAieHlmbHbop6PmnpAiOiAiaHR0cHM6Ly9qeC54eWZsdi5jb20vP3VybD0iLCAgICAvLyBUT0RPICjlvoXmtYvor5UpCiAgICAgICAgICAgICAgICAgICAgIueIseino+aekCI6ICJodHRwczovL2ppZXhpLnQ3Zy5jbi8/dXJsPSIsICAgIC8vIFRPRE8g6IW+6K6vICjoipLmnpwpCiAgICAgICAgICAgICAgICAgICAgIk9L6Kej5p6QIjogImh0dHBzOi8vYXBpLm9ranguY2M6MzM4OS9qeC5waHA/dXJsPSIgfHwgImh0dHBzOi8vb2tqeC5jYy8/dXJsPSIgfHwgImh0dHBzOi8vbTIwOTAuY29tLz91cmw9IiwgICAgLy8gVE9ETyDkvJjotKg6IOiFvuiuryAo54ix5aWH6Im6KSDkvJjphbcg5LmQ6KeGIOiKkuaenCBQUFRWICjljY7mlbApCiAgICAgICAgICAgICAgICAgICAgIuWFqOawkeino+aekCI6ICJodHRwczovL2p4LnF1YW5taW5namlleGkuY29tLz91cmw9IiB8fCAiaHR0cHM6Ly9jaGF4dW4udHJ1ZWNoYXQzNjUuY29tLz91cmw9IiwgICAgLy8gVE9ETyDlt7LlpLHmlYgKICAgICAgICAgICAgICAgICAgICAi5LqR6Kej5p6QIjogImh0dHBzOi8vanguYWlkb3Vlci5uZXQvP3VybD0iIHx8ICJodHRwczovL2p4LnBwZmx2LmNvbS8/dXJsPSIsICAgIC8vIFRPRE8g6IW+6K6vIFvniLHlpYfoibpdIOS8mOmFtyAo5LmQ6KeGKSDoipLmnpwgKDE5MDXnlLXlvbHnvZEpIFvljY7mlbBdCiAgICAgICAgICAgICAgICAgICAgLy8gIuS5heaSreino+aekCI6ICJodHRwczovL2p4LmppdWJvanguY29tL3ZpcC8/dXJsPSIgfHwgImh0dHBzOi8vd3d3LnFpYW55aWNwLmNvbS92aXAvdmlwX2cucGhwP3VybD0iLCAgICAvLyBfNEvop6PmnpA6ICJodHRwczovL3ZpcC5qeDRrLmNvbS92aXAvP3VybD0iLCAgICAvLyBUT0RPIOW3suWkseaViAogICAgICAgICAgICAgICAgICAgICLomb7nsbPop6PmnpAiOiAiaHR0cHM6Ly9qeC54bWZsdi5jb20vP3VybD0iIHx8ICJodHRwczovL25iangudmlwL2luZGV4LnBocD91cmw9IiwgICAgLy8gVE9ETyAo5Zyf6LGGKSAo5ZKq5ZKVKSDmkJzni5AgKOiKkuaenCkKICAgICAgICAgICAgICAgICAgICAi5aSc5bmV6Kej5p6QIjogImh0dHBzOi8vd3d3LnllbXUueHl6Lz91cmw9IiwKICAgICAgICAgICAgICAgICAgICAiUGFyd2l46Kej5p6QIjogImh0dHBzOi8vanguYm96cmMuY29tOjQ0MzMvcGxheWVyLz91cmw9IiB8fCAiaHR0cHM6Ly9qeC5wYXJ3aXguY29tOjQ0MzMvcGxheWVyL2FuYWx5c2lzLnBocD92PSIgfHwgImh0dHBzOi8vdmlwLnBhcndpeC5jb206NDQzMy9wbGF5ZXIvP3VybD0iLCAgICAvLyBUT0RPIOiFvuiuryAoQuermSkKICAgICAgICAgICAgICAgICAgICAi5LiD5ZOl6Kej5p6QIjogImh0dHBzOi8vangubm54di5jbi90di5waHA/dXJsPSIsCiAgICAgICAgICAgICAgICAgICAgIuWGsOixhuino+aekCI6ICJodHRwczovL2JkLmp4LmNuLz91cmw9IgogICAgICAgICAgICAgICAgICAgIC8vICLkupHljZrop6PmnpAiOiAiaHR0cHM6Ly9qeC55dW5ib3lzLmNuLz91cmw9IiAgICAvLyBUT0RPIOW3suWkseaViCAgICAvLyBieSB3d3cueXVuYm95cy5jbgogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHNldHRpbmdzLkFE6Kej5p6QID0geyAgICAvLyBUT0RPICjmnInotYzljZrlub/lkYrvvIzor7fli7/nm7jkv6HvvIzov5nkuYjnroDljZXnmoTpqpfmnK/kuI3kvJrmnInkurrkuIrlvZPlkKcpCiAgICAgICAgICAgICAgICAgICAgIlRW6Kej5p6QIjogImh0dHBzOi8vZG1qeC5tM3U4LnR2Lz91cmw9IiwgICAgLy8gVE9ETyDohb7orq8gKOiKkuaenCkgICAgLy8gYnkgaHR0cHM6Ly93d3cubTN1OC50di8KICAgICAgICAgICAgICAgICAgICAiSlnop6PmnpAiOiAiaHR0cHM6Ly9qeC5wbGF5ZXJqeS5jb20vP3VybD0iLCAgICAvLyBUT0RPIOiFvuiurwogICAgICAgICAgICAgICAgICAgICLor7rorq/op6PmnpAiOiAiaHR0cHM6Ly93d3cubnhmbHYuY29tLz91cmw9IiwgICAgLy8gVE9ETyAo6IW+6K6vKSAo54ix5aWH6Im6KSAo5LyY6YW3KQogICAgICAgICAgICAgICAgICAgICJ6Meino+aekCI6ICJodHRwczovL3oxLm0xOTA3LmNuP2p4PSIsCiAgICAgICAgICAgICAgICAgICAgIuS5kOWkmuino+aekCI6ICJodHRwczovL2FwaS5sZWR1b3R2LmNvbS93cC1hcGkvaWZyLnBocD9pc0RwPTEmdmlkPSIsICAgIC8vIFRPRE8gKELnq5kpCiAgICAgICAgICAgICAgICAgICAgIk1hb+ino+aekCI6ICJodHRwczovL3d3dy5tdG9zei5jb20vbTN1OC5waHA/dXJsPSIgICAgLy8gVE9ETyDml6DmsLTljbAo5L2G5LiN56iz5a6aKTog6IW+6K6vIOeIseWlh+iJuiDkvJjphbcg5LmQ6KeGIFvoipLmnpxdIChQUFRWKSAo5Y2O5pWwKQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHNldHRpbmdzLkRlZmF1bHTop6PmnpAgPSB7ICAgICAgLy8g6YWN572u5LyY5YWI6Kej5p6Q5rqQCiAgICAgICAgICAgICAgICAgICAgIuiFvuiur+inhumikSI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIueUteiEkeerryI6IFtzZXR0aW5ncy5Ob0FE6Kej5p6QWyJPS+ino+aekCJdLCBzZXR0aW5ncy5BROino+aekFsiSlnop6PmnpAiXSwgc2V0dGluZ3MuQUTop6PmnpBbIlRW6Kej5p6QIl1dLAogICAgICAgICAgICAgICAgICAgICAgICAi5omL5py656uvIjogW3NldHRpbmdzLk5vQUTop6PmnpBbIk9L6Kej5p6QIl1dCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAi54ix5aWH6Im6IjogewogICAgICAgICAgICAgICAgICAgICAgICAi55S16ISR56uvIjogW3NldHRpbmdzLk5vQUTop6PmnpBbIk9L6Kej5p6QIl0sIHNldHRpbmdzLkFE6Kej5p6QWyJKWeino+aekCJdLCBzZXR0aW5ncy5BROino+aekFsiVFbop6PmnpAiXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICLmiYvmnLrnq68iOiBbc2V0dGluZ3MuTm9BROino+aekFsiT0vop6PmnpAiXV0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICLkvJjphbfop4bpopEiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICLnlLXohJHnq68iOiBbc2V0dGluZ3MuQUTop6PmnpBbIkpZ6Kej5p6QIl0sIHNldHRpbmdzLkFE6Kej5p6QWyJUVuino+aekCJdXSwKICAgICAgICAgICAgICAgICAgICAgICAgIuaJi+acuuerryI6IFtdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAi5ZOU5ZOp5ZOU5ZOpIjogewogICAgICAgICAgICAgICAgICAgICAgICAi55S16ISR56uvIjogW3NldHRpbmdzLk5vQUTop6PmnpBbIuWknOW5leino+aekCJdLCBzZXR0aW5ncy5Ob0FE6Kej5p6QWyJQYXJ3aXjop6PmnpAiXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICLmiYvmnLrnq68iOiBbc2V0dGluZ3MuTm9BROino+aekFsi5aSc5bmV6Kej5p6QIl0sIHNldHRpbmdzLk5vQUTop6PmnpBbIlBhcndpeOino+aekCJdXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgIuWSquWSleinhumikSI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIueUteiEkeerryI6IFtzZXR0aW5ncy5BROino+aekFsiSlnop6PmnpAiXSwgc2V0dGluZ3MuQUTop6PmnpBbIlRW6Kej5p6QIl1dLAogICAgICAgICAgICAgICAgICAgICAgICAi5omL5py656uvIjogW10KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICLkuZDop4ZUViI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIueUteiEkeerryI6IFtzZXR0aW5ncy5BROino+aekFsiSlnop6PmnpAiXSwgc2V0dGluZ3MuQUTop6PmnpBbIlRW6Kej5p6QIl1dLAogICAgICAgICAgICAgICAgICAgICAgICAi5omL5py656uvIjogW3NldHRpbmdzLk5vQUTop6PmnpBbIuS6keino+aekCJdXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgIuaQnOeLkOinhumikSI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIueUteiEkeerryI6IFtzZXR0aW5ncy5Ob0FE6Kej5p6QWyLlpJzluZXop6PmnpAiXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICLmiYvmnLrnq68iOiBbc2V0dGluZ3MuTm9BROino+aekFsi5aSc5bmV6Kej5p6QIl1dCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAi6IqS5p6cVFYiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICLnlLXohJHnq68iOiBbc2V0dGluZ3MuTm9BROino+aekFsi54ix6Kej5p6QIl0sIHNldHRpbmdzLk5vQUTop6PmnpBbIk9L6Kej5p6QIl0sIHNldHRpbmdzLk5vQUTop6PmnpBbIuS6keino+aekCJdLCBzZXR0aW5ncy5Ob0FE6Kej5p6QWyLomb7nsbPop6PmnpAiXSwgc2V0dGluZ3MuTm9BROino+aekFsi5aSc5bmV6Kej5p6QIl1dLAogICAgICAgICAgICAgICAgICAgICAgICAi5omL5py656uvIjogW3NldHRpbmdzLk5vQUTop6PmnpBbIueIseino+aekCJdLCBzZXR0aW5ncy5Ob0FE6Kej5p6QWyJPS+ino+aekCJdLCBzZXR0aW5ncy5Ob0FE6Kej5p6QWyLkupHop6PmnpAiXSwgc2V0dGluZ3MuTm9BROino+aekFsi6Jm+57Gz6Kej5p6QIl0sIHNldHRpbmdzLk5vQUTop6PmnpBbIuWknOW5leino+aekCJdXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgIuilv+eTnOinhumikSI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIueUteiEkeerryI6IFtzZXR0aW5ncy5Ob0FE6Kej5p6QWyLlpJzluZXop6PmnpAiXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICLmiYvmnLrnq68iOiBbc2V0dGluZ3MuTm9BROino+aekFsi5aSc5bmV6Kej5p6QIl1dCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiUFBUViI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIueUteiEkeerryI6IFtzZXR0aW5ncy5Ob0FE6Kej5p6QWyJPS+ino+aekCJdXSwKICAgICAgICAgICAgICAgICAgICAgICAgIuaJi+acuuerryI6IFtzZXR0aW5ncy5Ob0FE6Kej5p6QWyJPS+ino+aekCJdXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgIjE5MDXnlLXlvbHnvZEiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICLnlLXohJHnq68iOiBbc2V0dGluZ3MuTm9BROino+aekFsi5LqR6Kej5p6QIl1dLAogICAgICAgICAgICAgICAgICAgICAgICAi5omL5py656uvIjogW3NldHRpbmdzLk5vQUTop6PmnpBbIuS6keino+aekCJdXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgIuWNjuaVsFRWIjogewogICAgICAgICAgICAgICAgICAgICAgICAi55S16ISR56uvIjogW3NldHRpbmdzLk5vQUTop6PmnpBbIk9L6Kej5p6QIl1dLAogICAgICAgICAgICAgICAgICAgICAgICAi5omL5py656uvIjogW3NldHRpbmdzLk5vQUTop6PmnpBbIk9L6Kej5p6QIl1dCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHNldHRpbmdzLmFkZHJlc3MgPSBbXTsKICAgICAgICAgICAgICAgIHRvcC5zZXRJbnRlcnZhbCA9IGZ1bmN0aW9uIChoYW5kbGVyLCB0aW1lb3V0ID0gMCkgewogICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHsKICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlcjogaGFuZGxlciwKICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogdGltZW91dCwKICAgICAgICAgICAgICAgICAgICAgICAgYXJndW1lbnRzOiBPYmplY3QudmFsdWVzKGFyZ3VtZW50cykuc3BsaWNlKDIsIGFyZ3VtZW50cy5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmVhZHkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHN0YXJ0KCk7CiAgICAgICAgICAgICAgICB9LCAiY29tcGxldGUiKTsKICAgICAgICAgICAgfSBlbHNlIGlmIChzZXR0aW5ncy5pc1BhcnNlKSB7CiAgICAgICAgICAgICAgICB0b3AucG9zdE1lc3NhZ2Uoc2V0dGluZ3Mua2V5LmVuY3J5cHQoIuWuneWhlOmVh+ays+Wmllx4MDDnu5nkuohceDAwMFx4MDAiICsgbG9jYXRpb24uaHJlZiksICIqIik7CiAgICAgICAgICAgICAgICBzZXR0aW5ncy5wYXJzZURCID0gbmV3IFByb21pc2UoZnVuY3Rpb24gKHJlc29sdmUpIHsKICAgICAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIGZ1bmN0aW9uIChldmVudCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXZlbnQuc291cmNlICE9PSB3aW5kb3cpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHNxbCA9IHNldHRpbmdzLmtleS5kZWNyeXB0KGV2ZW50LmRhdGEpLnNwbGl0KCJceDAwIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChzcWxbMF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAi5aSp546L55uW5Zyw6JmOIjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc3FsWzFdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAi57uZ5LqIIjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChzcWxbMl0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgIueUqOaIt+aVsOaNruW6kyI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZShKU09OLnBhcnNlKHNxbFszXSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOaOkumZpCDkuIvmoIfotornlYzplJnor68g5Y+KIOaMh+S7pOWkhOeQhumUmeivrwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgdHJ1ZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIC8vIOmcgOimgeWFiOebkeWQrOWGjeWPkemAgeaVsOaNrgogICAgICAgICAgICAgICAgdG9wLnBvc3RNZXNzYWdlKHNldHRpbmdzLmtleS5lbmNyeXB0KCLlrp3loZTplYfmsrPlppZceDAw6K+35rGCXHgwMOeUqOaIt+aVsOaNruW6kyIpLCAiKiIpOwogICAgICAgICAgICAgICAgcmVhZHkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHN0YXJ0KCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgLy8g5rWP6KeI5Zmo5Yqf6IO95YyFCiAgICAgICAgcmVxdWlyZShsb2NhdGlvbi5wcm90b2NvbCArICIvL2dyZWFzeWZvcmsub3JnL3NjcmlwdHMvNDUyMjUzL2NvZGUvdXNlci5qcyIpOwogICAgICAgIC8vIOiHqueUqOeul+azleWMhQogICAgICAgIHJlcXVpcmUobG9jYXRpb24ucHJvdG9jb2wgKyAiLy9ncmVhc3lmb3JrLm9yZy9zY3JpcHRzLzQ1MzM4My9jb2RlL3VzZXIuanMiKTsKICAgICAgICByZWFkeShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIGZvciAoY29uc3QgaWZyYW1lIG9mIGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJpZnJhbWUiKSkgewogICAgICAgICAgICAgICAgaWZyYW1lLnBhcmVudE5vZGUuYXBwZW5kQ2hpbGQoaWZyYW1lKTsKICAgICAgICAgICAgfQogICAgICAgIH0pOwoKICAgICAgICAvLyDmnInkurrlj43ppojoi7nmnpznq6/kuI3og73nnIvvvIzlsJ3or5Xkv67mlLlVQeino+WGswogICAgICAgIGlmIChuYXZpZ2F0b3IudXNlckFnZW50Lm1hdGNoKG5ldyBSZWdFeHAoIihpUGhvbmV8aVBvZHxpb3N8aVBhZCkiLCAiaSIpKSkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgLy8g5L+u5pS55omL5py656uvVUHvvIzkvLzkuY7mlLnlrozov5nkuKpVQei/mOaYr+ayoeacieaViOaenOOAguivtOaYjuiLueaenOerr+mhtemdouS7juaVsOaNruivt+axguWwseW8gOWni+ajgOa1i1VB5LqG44CC6K+35omL5Yqo5L+u5pS55rWP6KeI5ZmoVUHjgIIKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShuYXZpZ2F0b3IsICd1c2VyQWdlbnQnLCB7CiAgICAgICAgICAgICAgICAgICAgLy8g6L+Z5LiqVUHkvJrlsY/olL3nmb7luqbmkJzntKLnmoTlub/lkYrvvJ8KICAgICAgICAgICAgICAgICAgICB2YWx1ZTogIk1vemlsbGEvNS4wIChMaW51eDsgQW5kcm9pZCA4LjA7IE1JIDYgQnVpbGQvT1BSMS4xNzA2MjMuMDI3OyB3dikgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgVmVyc2lvbi80LjAgQ2hyb21lLzQ4LjAuMjU2NC4xMTYgTW9iaWxlIFNhZmFyaS81MzcuMzYgVDcvMTAuMyBTZWFyY2hDcmFmdC8yLjYuMyAoQmFpZHU7IFAxIDguMC4wKSIsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihlLm1lc3NhZ2UpOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICAvLyDmoLjlv4PpqbHliqjku6PnoIEKICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAvLyDlr7nnrKblkIjmnaHku7bnmoTln5/lkI3miafooYzohJrmnKwKICAgICAgICAgICAgLy8g6LCD55So6Ieq5YaZ5Yqg5a+G566X5rOV77yM55Sf5oiQ5a6e5L6L57G7CiAgICAgICAgICAgIHNldHRpbmdzLmtleSA9IG5ldyBLZXkocGFyc2VJbnQod2luZG93Lm5hbWUsIDM2KSk7CiAgICAgICAgICAgIGlmICh3aW5kb3cgPT09IHRvcCkgewogICAgICAgICAgICAgICAgeG1sSHR0cFJlcXVlc3QoewogICAgICAgICAgICAgICAgICAgIHVybDogbG9jYXRpb24ucHJvdG9jb2wgKyAiLy9ncmVhc3lmb3JrLm9yZy96aC1DTi9zY3JpcHRzLzQ1MzgyMy9jb2RlL3VzZXIuanMiLAogICAgICAgICAgICAgICAgICAgIG9ubG9hZDogZnVuY3Rpb24gKHtyZXNwb25zZX0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBicm93c2VyIG9mIGV2YWwocmVzcG9uc2UpKSB4bWxIdHRwUmVxdWVzdChsb2NhdGlvbi5wcm90b2NvbCArIEtleS5kZWNyeXB0KGJyb3dzZXIpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHNldHRpbmdzLnBhcnNlREIgPSB7CiAgICAgICAgICAgICAgICAgICAg6Kej5p6Q5byA5YWzOiAiXHgwMSIsIOiHquWKqOWFqOWxjzogIlx4MDEiLCDlvLnluZXlvIDlhbM6ICJceDAxIiwgRElZ6Kej5p6Q5qCPOiAiXHgwMSIKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmb3IgKGxldCBuYW1lIGluIHNldHRpbmdzLnBhcnNlREIpIHsKICAgICAgICAgICAgICAgICAgICBsZXQgZGF0YSA9IGxvY2FsU3RvcmFnZS5nZXRJdGVtKCJwYXJzZS4iICsgbmFtZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEgIT09IG51bGwpIHNldHRpbmdzLnBhcnNlREJbbmFtZV0gPSBkYXRhOwogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgIHNldHRpbmdzLnBhcnNlREJGdW50aW9ucyA9IHsKICAgICAgICAgICAgICAgICAgICDop6PmnpDlvIDlhbM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZXR0aW5ncy5wYXJzZURCLuino+aekOW8gOWFsykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9jYXRpb24ucmVsb2FkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB3aW5kb3cg5Yi35paw5pe25Lya6Ieq5Yqo5riF6Zmk57yT5a2YCiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLnBhcnNlREIu6Kej5p6Q5byA5YWzID0gIlx4MDEiOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICDoh6rliqjlhajlsY86IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgc2hvd1RpcCgi6K6+572u5bey55Sf5pWIIik7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICDlvLnluZXlvIDlhbM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgc2hvd1RpcCgi5Yi35paw6aG16Z2i5Y2z5Y+v55Sf5pWIIik7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBESVnop6PmnpDmoI86IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBzZXR0aW5ncy5ESVlfaWZyYW1lRnVuY3Rpb24gPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLkRJWV9pZnJhbWVGdW5jdGlvbigpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICA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pbmdCbG9ja1N3aXRjaHNbaV0ucXVlcnlTZWxlY3RvcigiYmciKS5hZGRFdmVudExpc3RlbmVyKCJ0cmFuc2l0aW9uZW5kIiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hlY2tCb3guY2hlY2tlZCAhPT0gQm9vbGVhbihzZXR0aW5ncy5wYXJzZURCW3BhcnNlREJLZXlzW2ldXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOWmguaenOacieWPmOWMluaJjeS8muaJp+ihjO+8jOWQpuWImeS8mumHjeWkjeaJp+ihjO+8jOWboOS4uuWKqOeUu+S8muacieW7tui/n++8jOWImuaJk+W8gOe9kemhteaXtuS5n+S8muinpuWPkeatpOebkeWQrOS6i+S7tgogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoZWNrQm94LmNoZWNrZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5ncy5wYXJzZURCW3BhcnNlREJLZXlzW2ldXSA9ICJceDAxIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3MucGFyc2VEQltwYXJzZURCS2V5c1tpXV0gPSAiIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsU3RvcmFnZS5zZXRJdGVtKCJwYXJzZS4iICsgcGFyc2VEQktleXNbaV0sIHNldHRpbmdzLnBhcnNlREJbcGFyc2VEQktleXNbaV1dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLnBhcnNlREJGdW50aW9uc1twYXJzZURCS2V5c1tpXV0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgbGV0IFNldHRpbmdzQnRuID0gc2V0dGluZ3MudG9vbHNCYXIucXVlcnlTZWxlY3Rvcigic2V0dGluZ3M+YnV0dG9uIik7CiAgICAgICAgICAgICAgICBTZXR0aW5nc0J0bi5hZGRFdmVudExpc3RlbmVyKCJjbGljayIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoU2V0dGluZ3NCbG9jay5zdHlsZS5vcGFjaXR5ID09PSAiMCIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3NCdG4uaW5uZXJUZXh0ID0gIuWFs+mXrSI7CiAgICAgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzQmxvY2suc3R5bGUub3BhY2l0eSA9ICIxIjsKICAgICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3NCbG9jay5zdHlsZS53aWR0aCA9ICIyMDBweCI7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3NCdG4uaW5uZXJUZXh0ID0gIuiuvue9riI7CiAgICAgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzQmxvY2suc3R5bGUub3BhY2l0eSA9ICIwIjsKICAgICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3NCbG9jay5zdHlsZS53aWR0aCA9ICIwIjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIFNldHRpbmdzQnRuLmFkZEV2ZW50TGlzdGVuZXIoImJsdXIiLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3NCdG4uaW5uZXJUZXh0ID0gIuiuvue9riI7CiAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3NCbG9jay5zdHlsZS5vcGFjaXR5ID0gIjAiOwogICAgICAgICAgICAgICAgICAgIFNldHRpbmdzQmxvY2suc3R5bGUud2lkdGggPSAiMCI7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGlmIChzZXR0aW5ncy5wYXJzZURCLuino+aekOW8gOWFsykgewogICAgICAgICAgICAgICAgICAgIGlmICghc2Vzc2lvblN0b3JhZ2UuZ2V0SXRlbSgicGFyc2UudGlw6K6+572uIikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgc2hvd1RpcCgi5Y+z5LiL6KeS5Y+v5Lul57yW6L6RIOiuvue9riIpOwogICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uU3RvcmFnZS5zZXRJdGVtKCJwYXJzZS50aXDorr7nva4iLCAiXHgwMSIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBjb25maWcoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRvY3VtZW50LnJvb3QuYXBwZW5kQ2hpbGQoc2V0dGluZ3MudG9vbHNCYXIpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgY29uZmlnKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9KSgpOwoKICAgICAgICAvLyDlkK/liqjop6PmnpDku6PnoIEKICAgICAgICBmdW5jdGlvbiBzdGFydCgpIHsKICAgICAgICAgICAgZnVuY3Rpb24gZGV0ZWN0TW9iaWxlKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIG5hdmlnYXRvci51c2VyQWdlbnQubWF0Y2gobmV3IFJlZ0V4cCgiKGlQaG9uZXxpUG9kfGlvc3xpUGFkfEFuZHJvaWR8TW9iaWxlfEJsYWNrQmVycnl8SUVNb2JpbGV8TVFRQnJvd3NlcnxKVUN8RmVubmVjfHdPU0Jyb3dzZXJ8QnJvd3Nlck5HfFdlYk9TfFN5bWJpYW58V2luZG93cyBQaG9uZSkiLCAiaSIpKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgY29uc3QgaXNNb2JpbGUgPSBCb29sZWFuKGRldGVjdE1vYmlsZSgpKTsKCiAgICAgICAgICAgIGZ1bmN0aW9uIGRvRWxlbWVudChjc3NTdHJpbmcsIGRvRnVuY3Rpb24sIHdhaXRNUyA9IDAsIGZhaWxGdW5jdGlvbiA9IG51bGwpIHsKICAgICAgICAgICAgICAgIGxldCBFbGVtZW50ID0gZG9jdW1lbnQucXVlcnlTZWxlY3Rvcihjc3NTdHJpbmcpOwogICAgICAgICAgICAgICAgaWYgKEVsZW1lbnQgJiYgRWxlbWVudC5ub2RlVHlwZSA9PT0gMSkgewogICAgICAgICAgICAgICAgICAgIGRvRnVuY3Rpb24oRWxlbWVudCk7CiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coIiVj5bey5Li6ICIgKyBjc3NTdHJpbmcgKyAiIOi/m+ihjOS6huaTjeS9nCIsIHNldHRpbmdzLmZvbnRTdHlsZS5vayk7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGRvY3VtZW50LnJlYWR5U3RhdGUgIT09ICJjb21wbGV0ZSIgfHwgd2FpdE1TID4gMCkgewogICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCLmraPlnKjmn6Xmib4gIiArIGNzc1N0cmluZyk7ICAgIC8vIFRPRE8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTDmr6vnp5Lnuqblh73mlbDmiafooYzml7bpl7QKICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvRWxlbWVudChjc3NTdHJpbmcsIGRvRnVuY3Rpb24sIGRvY3VtZW50LnJlYWR5U3RhdGUgIT09ICJjb21wbGV0ZSIgPyB3YWl0TVMgOiB3YWl0TVMgLSAxMCAtIHNldHRpbmdzLmdldEVsZW1lbnRUaW1lcywgZmFpbEZ1bmN0aW9uKTsKICAgICAgICAgICAgICAgICAgICB9LCBzZXR0aW5ncy5nZXRFbGVtZW50VGltZXMpOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCLmnKrmib7liLAgIiArIGNzc1N0cmluZyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBmYWlsRnVuY3Rpb24gPT09ICJmdW5jdGlvbiIpIHJldHVybiBmYWlsRnVuY3Rpb24oKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQoKICAgICAgICAgICAgZnVuY3Rpb24gZG9FbGVtZW50cyhjc3NTdHJpbmcsIGRvRnVuY3Rpb24sIHdhaXRNUyA9IDAsIGluZGV4ID0gMCkgewogICAgICAgICAgICAgICAgbGV0IEVsZW1lbnRzID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbChjc3NTdHJpbmcpOwogICAgICAgICAgICAgICAgaWYgKEVsZW1lbnRzW2luZGV4XSAmJiBFbGVtZW50c1tpbmRleF0ubm9kZVR5cGUgPT09IDEpIHsKICAgICAgICAgICAgICAgICAgICBkb0Z1bmN0aW9uKEVsZW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygiJWPlt7LkuLogQWxsWyIgKyBpbmRleCArICJdICIgKyBjc3NTdHJpbmcgKyAiIOi/m+ihjOS6huaTjeS9nCIsIHNldHRpbmdzLmZvbnRTdHlsZS5vayk7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGRvY3VtZW50LnJlYWR5U3RhdGUgIT09ICJjb21wbGV0ZSIgfHwgd2FpdE1TID4gMCkgewogICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCLmraPlnKjmn6Xmib4gQWxsWyIgKyBpbmRleCArICJdICIgKyBjc3NTdHJpbmcpOyAgICAvLyBUT0RPICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTDmr6vnp5Lnuqblh73mlbDmiafooYzml7bpl7QKICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvRWxlbWVudHMoY3NzU3RyaW5nLCBkb0Z1bmN0aW9uLCBkb2N1bWVudC5yZWFkeVN0YXRlICE9PSAiY29tcGxldGUiID8gd2FpdE1TIDogd2FpdE1TIC0gMTAgLSBzZXR0aW5ncy5nZXRFbGVtZW50VGltZXMsIGluZGV4KTsKICAgICAgICAgICAgICAgICAgICB9LCBzZXR0aW5ncy5nZXRFbGVtZW50VGltZXMpOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCLmnKrmib7liLAgQWxsWyIgKyBpbmRleCArICJdICIgKyBjc3NTdHJpbmcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBmb3JFbGVtZW50cyhjc3NTdHJpbmcsIGRvRnVuY3Rpb24sIHdhaXRNUyA9IDAsIGZhaWxGdW5jdGlvbiA9IG51bGwpIHsKICAgICAgICAgICAgICAgIGxldCBmb3JFbGVtZW50SW50ZXJ2YWwgPSBzZXRJbnRlcnZhbChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGRvY3VtZW50LnJlYWR5U3RhdGUgIT09ICJjb21wbGV0ZSIgfHwgd2FpdE1TID4gMCkgewogICAgICAgICAgICAgICAgICAgICAgICBsZXQgRWxlbWVudHMgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKGNzc1N0cmluZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChFbGVtZW50cyAmJiBFbGVtZW50cy5sZW5ndGggPiAwICYmIEVsZW1lbnRzWzBdLm5vZGVUeXBlID09PSAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb0Z1bmN0aW9uKEVsZW1lbnRzLCBmb3JFbGVtZW50SW50ZXJ2YWwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coIiVjZm9yRWxlbWVudHPlt7LkuLogIiArIGNzc1N0cmluZyArICIg6L+b6KGM5LqG5pON5L2cIiwgc2V0dGluZ3MuZm9udFN0eWxlLm9rKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQucmVhZHlTdGF0ZSA9PT0gImNvbXBsZXRlIikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2FpdE1TID0gd2FpdE1TIC0gMTAgLSBzZXR0aW5ncy5nZXRFbGVtZW50VGltZXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGZhaWxGdW5jdGlvbiA9PT0gImZ1bmN0aW9uIikgZmFpbEZ1bmN0aW9uKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCLlt7LmuIXpmaQgZm9yRWxlbWVudHMgSW50ZXJ2YWzorqHml7blmagiKTsKICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJJbnRlcnZhbChmb3JFbGVtZW50SW50ZXJ2YWwpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHNldHRpbmdzLmdldEVsZW1lbnRUaW1lcyk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGZ1bmN0aW9uIHJlbW92ZUVsZW1lbnRzKEVsZW1lbnRzU3RyaW5ncykgewogICAgICAgICAgICAgICAgY29uc29sZS5sb2coIuato+WcqOajgOa1i+W5tuenu+mZpCAiICsgRWxlbWVudHNTdHJpbmdzKTsKICAgICAgICAgICAgICAgIGxldCByZW1vdmVFbGVtZW50c0ludGVydmFsID0gc2V0SW50ZXJ2YWwoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmIChFbGVtZW50c1N0cmluZ3MubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpIGluIEVsZW1lbnRzU3RyaW5ncykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgRWxlbWVudHMgPSBldmFsKEVsZW1lbnRzU3RyaW5nc1tpXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEVsZW1lbnRzICYmIEVsZW1lbnRzLm5vZGVUeXBlID09PSAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCIlY3JlbW92ZUVsZW1ldHMg5omn6KGM5LqG56e76ZmkICIgKyBFbGVtZW50c1N0cmluZ3NbaV0sIHNldHRpbmdzLmZvbnRTdHlsZS5vayk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVsZW1lbnRzLnJlbW92ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbGVtZW50c1N0cmluZ3Muc3BsaWNlKGksIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoRWxlbWVudHNbMF0gJiYgRWxlbWVudHNbMF0ubm9kZVR5cGUgPT09IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coIiVjcmVtb3ZlRWxlbWV0cyDmiafooYzkuobnp7vpmaQgIiArIEVsZW1lbnRzU3RyaW5nc1tpXSwgc2V0dGluZ3MuZm9udFN0eWxlLm9rKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgRWxlbWVudCBvZiBFbGVtZW50cykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWxlbWVudC5yZW1vdmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbGVtZW50c1N0cmluZ3Muc3BsaWNlKGksIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDmjpLpmaQgbnVsbOWAvOacquaJvuWIsOaWueazlSDplJnor68KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQucmVhZHlTdGF0ZSA9PT0gImNvbXBsZXRlIikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcigicmVtb3ZlRWxlbWV0cyDnp7vpmaTlpLHotKUgIiArIEVsZW1lbnRzU3RyaW5ncyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhckludGVydmFsKHJlbW92ZUVsZW1lbnRzSW50ZXJ2YWwpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJJbnRlcnZhbChyZW1vdmVFbGVtZW50c0ludGVydmFsKTsKICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coIkVsZW1lbnRzIOenu+mZpOWujOavlSIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIDIwMCk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGlmICh3aW5kb3cgPT09IHRvcCkgewogICAgICAgICAgICAgICAgLy8g6Ieq5a6a5LmJcHVsbOaWueazlSjkuI5wdXNo55u45a+5KQogICAgICAgICAgICAgICAgQXJyYXkucHJvdG90eXBlLnB1bGwgPSBmdW5jdGlvbiAoLi4uaXRlbXMpIHsKICAgICAgICAgICAgICAgICAgICBsZXQgcmVzdWx0ID0ge3JlbW92ZWQ6IFtdLCBmYWlsZWQ6IFtdfTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGl0ZW0gb2YgaXRlbXMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGluZGV4ID0gdGhpcy5pbmRleE9mKGl0ZW0pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5kZXggIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQucmVtb3ZlZC5wdXNoKHRoaXMuc3BsaWNlKGluZGV4LCAxKVswXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQuZmFpbGVkLnB1c2goaXRlbSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQucmVtb3ZlZCkgZGVsZXRlIHJlc3VsdC5yZW1vdmVkOwogICAgICAgICAgICAgICAgICAgIGlmICghcmVzdWx0LmZhaWxlZCkgZGVsZXRlIHJlc3VsdC5mYWlsZWQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0b3AuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIGZ1bmN0aW9uIChldmVudCkgewogICAgICAgICAgICAgICAgICAgIGlmIChldmVudC5zb3VyY2UgIT09IHdpbmRvdykgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHNxbCA9IHNldHRpbmdzLmtleS5kZWNyeXB0KGV2ZW50LmRhdGEpLnNwbGl0KCJceDAwIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHNxbFswXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgIuWuneWhlOmVh+ays+WmliI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc3FsWzFdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICLlh73mlbAiOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbnNvbGUubG9nKCJ0b3DmiafooYzkuoblh73mlbA6ICIgKyBzcWxbMl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoc3FsWzJdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgIuivt+axgiI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChzcWxbMl0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAi55So5oi35pWw5o2u5bqTIjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50LnNvdXJjZS5wb3N0TWVzc2FnZShzZXR0aW5ncy5rZXkuZW5jcnlwdCgi5aSp546L55uW5Zyw6JmOXHgwMOe7meS6iFx4MDDnlKjmiLfmlbDmja7lupNceDAwIiArIEpTT04uc3RyaW5naWZ5KHNldHRpbmdzLnBhcnNlREIpKSwgIioiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgIue7meS6iCI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNldHRpbmdzLmFkZHJlc3MgIT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChzcWxbMl0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgIjAiOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLmFkZHJlc3MucHVzaChzcWxbM10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAiLTEiOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLmFkZHJlc3MucHVsbChzcWxbM10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZXR0aW5ncy5hZGRyZXNzLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5ncy5yYW5kb21TZWxlY2VQYXJzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgIjEiOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLmFkZHJlc3MgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsU3RvcmFnZS5zZXRJdGVtKCdwYXJzZS5oaXN0b3J5UGFyc2UnLCBzZXR0aW5ncy5zcmMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAi5oyJ5LiLRW50ZXLojrflj5bnhKbngrkiOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50LnNvdXJjZS5mb2N1cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9ua2V5ZG93biA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmtleSA9PT0gJ0VudGVyJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQuc291cmNlLmZvY3VzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDmjpLpmaQgc3FsIOWkhOeQhumUmeivrwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdHJ1ZSk7CgogICAgICAgICAgICAgICAgaWYgKCFpc01vYmlsZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoInYucXEuY29tIikgIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWR5UGxheWVyQm94KCLohb7orq/op4bpopEiLCBbIiNtYXNrX2xheWVyIiwgIi5tb2RfdmlwX3BvcHVwLGRpdi5wYW5lbC10aXAtcGF5IiwgIiNtYXNrX2xheWVyIiwgImRpdi50aHVtYnBsYXllci1iYXJyYWdlIl0sIHNldHRpbmdzLkRlZmF1bHTop6PmnpBbIuiFvuiur+inhumikSJdWyLnlLXohJHnq68iXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJkaXYjcGxheWVyLGRpdi5wYW5lbC10aXAtcGF5LnBhbmVsLXRpcC1wYXktdmlkZW8iLCBudWxsKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxvY2F0aW9uLmhvc3QuaW5kZXhPZigiaXFpeWkuY29tIikgIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvRWxlbWVudCgiZGl2LnNpZGUtY29udC50dmciLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVhZHlQbGF5ZXJCb3goIueIseWlh+iJuiIsIFsiI3BsYXllclBvcHVwIiwgImRpdltjbGFzc149cXktaGVhZGVyLWxvZ2luLXBvcF0iXSwgc2V0dGluZ3MuRGVmYXVsdOino+aekFsi54ix5aWH6Im6Il1bIueUteiEkeerryJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpcXBkaXYuaXFwLXBsYXllcltkYXRhLXBsYXllci1ob29rJD1lcl0iLCBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoInlvdWt1LmNvbSIpICE9PSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICByZWFkeVBsYXllckJveCgi5LyY6YW36KeG6aKRIiwgWyIjaWZyYW1hV3JhcHBlciJdLCBzZXR0aW5ncy5EZWZhdWx06Kej5p6QWyLkvJjphbfop4bpopEiXVsi55S16ISR56uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZGl2I3BsYXllciIsIG51bGwpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobG9jYXRpb24uaG9zdC5pbmRleE9mKCJiaWxpYmlsaS5jb20iKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZG9FbGVtZW50cygiZGl2W3JvbGU9dG9vbHRpcF06bm90KFtjbGFzcyo9cG9wb3Zlci1dKSIsIGZ1bmN0aW9uIChsb2dpblRpcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRpc3BsYXlOb25lKFsiIyIgKyBsb2dpblRpcFs2XS5pZF0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDAwLCA2KTsKICAgICAgICAgICAgICAgICAgICAgICAgZG9FbGVtZW50KCJkaXYuYnB4LXBsYXllci12aWRlby1hcmVhLHN2Z1thcmlhLWhpZGRlbj10cnVlXSxkaXYubGlzdC13cmFwcGVyLnNpbXBsZT51bC5jbGVhcmZpeCIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZWFkeVBsYXllckJveCgi5ZOU5ZOp5ZOU5ZOpIiwgWyJkaXYubG9naW4tcGFuZWwtcG9wb3ZlcixkaXYudmlwLXBhbmVsLXBvcG92ZXIiLCAiZGl2LmxvZ2luLXRpcCJdLCBzZXR0aW5ncy5EZWZhdWx06Kej5p6QWyLlk5Tlk6nlk5Tlk6kiXVsi55S16ISR56uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImRpdi5icHgtcGxheWVyLXZpZGVvLWFyZWEsZGl2Lm1hc2stY29udGFpbmVyLGRpdiNwbGF5ZXJfbW9kdWxlIiwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOyAgICAvLyBUT0RPIHx8IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJiaWxpYmlsaVBsYXllciIpIHx8IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJsaXZlLXBsYXllci1jdG5yIikKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxvY2F0aW9uLmhvc3QuaW5kZXhPZigibWlndXZpZGVvLmNvbSIpICE9PSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICByZWFkeVBsYXllckJveCgi5ZKq5ZKV6KeG6aKRIiwgbnVsbCwgc2V0dGluZ3MuRGVmYXVsdOino+aekFsi5ZKq5ZKV6KeG6aKRIl1bIueUteiEkeerryJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgInNlY3Rpb24jbW9kLXBsYXllciIsIG51bGwpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobG9jYXRpb24uaG9zdC5pbmRleE9mKCJsZS5jb20iKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVhZHlQbGF5ZXJCb3goIuS5kOinhlRWIiwgbnVsbCwgc2V0dGluZ3MuRGVmYXVsdOino+aekFsi5LmQ6KeGVFYiXVsi55S16ISR56uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiI2xlX3BsYXlib3giLCBudWxsKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxvY2F0aW9uLmhvc3QubWF0Y2gobmV3IFJlZ0V4cCgiKD86dHZ8ZmlsbSlcXC5zb2h1XFwuY29tIikpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWR5UGxheWVyQm94KCLmkJzni5Dop4bpopEiLCBudWxsLCBzZXR0aW5ncy5EZWZhdWx06Kej5p6QWyLmkJzni5Dop4bpopEiXVsi55S16ISR56uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiI3BsYXllciwjc29odXBsYXllciwucGxheWVyLXZpZXciLCBudWxsKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxvY2F0aW9uLmhvc3QuaW5kZXhPZigibWd0di5jb20iKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVhZHlQbGF5ZXJCb3goIuiKkuaenFRWIiwgbnVsbCwgc2V0dGluZ3MuRGVmYXVsdOino+aekFsi6IqS5p6cVFYiXVsi55S16ISR56uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiI21ndHYtcGxheWVyLXdyYXAiLCBudWxsKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxvY2F0aW9uLmhvc3QuaW5kZXhPZigiaXhpZ3VhLmNvbSIpICE9PSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICByZWFkeVBsYXllckJveCgi6KW/55Oc6KeG6aKRIiwgbnVsbCwgc2V0dGluZ3MuRGVmYXVsdOino+aekFsi6KW/55Oc6KeG6aKRIl1bIueUteiEkeerryJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgImRpdi50ZWxlcGxheVBhZ2VfX3BsYXllclNlY3Rpb24iLCBudWxsKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxvY2F0aW9uLmhvc3QuaW5kZXhPZigicHB0di5jb20iKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVhZHlQbGF5ZXJCb3goIlBQVFYiLCBudWxsLCBzZXR0aW5ncy5EZWZhdWx06Kej5p6QWyJQUFRWIl1bIueUteiEkeerryJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgImRpdi53LXZpZGVvIiwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoInZpcC4xOTA1LmNvbSIpICE9PSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICByZWFkeVBsYXllckJveCgiMTkwNeeUteW9see9kSIsIG51bGwsIHNldHRpbmdzLkRlZmF1bHTop6PmnpBbIjE5MDXnlLXlvbHnvZEiXVsi55S16ISR56uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZGl2I3BsYXlCb3giLCBudWxsKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxvY2F0aW9uLmhvc3QuaW5kZXhPZigid3d3Lndhc3UuY24iKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVhZHlQbGF5ZXJCb3goIuWNjuaVsFRWIiwgbnVsbCwgc2V0dGluZ3MuRGVmYXVsdOino+aekFsi5Y2O5pWwVFYiXVsi55S16ISR56uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZGl2I3BjcGxheWVyIiwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBpZiAobG9jYXRpb24uaG9zdC5pbmRleE9mKCJ2LnFxLmNvbSIpICE9PSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICByZWFkeVBsYXllckJveCgi6IW+6K6v6KeG6aKRIiwgWyIubW9kX3ZpcF9wb3B1cCIsICJbY2xhc3NePWFwcF9dLFtjbGFzc149YXBwLV0sW2NsYXNzKj1fYXBwX10sW2NsYXNzKj0tYXBwLV0sW2NsYXNzJD1fYXBwXSxbY2xhc3MkPS1hcHBdIiwgImRpdltkdC1laWQ9b3Blbl9hcHBfYm90dG9tXSIsICJkaXYudmlkZW9fZnVuY3Rpb24udmlkZW9fZnVuY3Rpb25fbmV3IiwgImFbb3Blbi1hcHBdIiwgInNlY3Rpb24ubW9kX3NvdXJjZSIsICJzZWN0aW9uLm1vZF9ib3gubW9kX3NpZGVzbGlwX2gubW9kX211bHRpX2ZpZ3VyZXNfaCxzZWN0aW9uLm1vZF9zaWRlc2xpcF9wcml2aWxlZ2VzLHNlY3Rpb24ubW9kX2dhbWVfcmVjIiwgImRpdiN2aXBQb3N0ZXJDb250ZW50Il0sIHNldHRpbmdzLkRlZmF1bHTop6PmnpBbIuiFvuiur+inhumikSJdWyLmiYvmnLrnq68iXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJkaXYubW9kX3BsYXk6bm90KFtzdHlsZSo9J2Rpc3BsYXk6IG5vbmU7J10pIHNlY3Rpb24ubW9kX3BsYXllcj5kaXYjcGxheWVyLGRpdi5wbGF5ZXIiLCBudWxsLCBmdW5jdGlvbiAoaHJlZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBsb2NhdGlvbiA9IGhyZWZUb0xvY2F0aW9uKGhyZWYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhyZWYgPSBzZWFyY2hUb0pTT04obG9jYXRpb24uc2VhcmNoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaHJlZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaHJlZlsiY2lkIl0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChocmVmWyJpZCJdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxvY2F0aW9uLnByb3RvY29sICsgJy8vdi5xcS5jb20vZGV0YWlsLycgKyBocmVmWyJjaWQiXVswXSArICcvJyArIGhyZWZbImNpZCJdICsgJy5odG1sJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaHJlZlsidmlkIl0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbG9jYXRpb24ucHJvdG9jb2wgKyAnLy92LnFxLmNvbS94L2NvdmVyLycgKyBocmVmWyJjaWQiXSArICcvJyArIGhyZWZbInZpZCJdICsgJy5odG1sJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxvY2F0aW9uLnByb3RvY29sICsgJy8vdi5xcS5jb20veC9jb3Zlci8nICsgaHJlZlsiY2lkIl0gKyAnLmh0bWwnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGhyZWZbInZpZCJdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbG9jYXRpb24ucHJvdG9jb2wgKyAnLy92LnFxLmNvbS94L3BhZ2UvJyArIGhyZWZbInZpZCJdICsgJy5odG1sJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChocmVmWyJsaWQiXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxvY2F0aW9uLnByb3RvY29sICsgJy8vdi5xcS5jb20vZGV0YWlsLycgKyBocmVmWyJsaWQiXVswXSArICcvJyArIGhyZWZbImxpZCJdICsgJy5odG1sJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoImlxaXlpLmNvbSIpICE9PSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICByZWFkeShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkeVBsYXllckJveCgi54ix5aWH6Im6IiwgWyJkaXYubS1pcXlHdWlkZS1sYXllciIsICJhW2Rvd24tYXBwLWFuZHJvaWQtdXJsXSIsICJbbmFtZT1tLWV4dGVuZEJhcl0iLCAiW2NsYXNzKj1DaGFubmVsSG9tZUJhbm5lcl0iLCAic2VjdGlvbi5tLWhvdFdvcmRzLWJvdHRvbSJdLCBzZXR0aW5ncy5EZWZhdWx06Kej5p6QWyLniLHlpYfoiboiXVsi5omL5py656uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImRpdi5tLXZpZGVvLXBsYXllci13cmFwIiwgbnVsbCkKICAgICAgICAgICAgICAgICAgICAgICAgfSwgImNvbXBsZXRlIik7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoInlvdWt1LmNvbSIpICE9PSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICByZWFkeVBsYXllckJveCgi5LyY6YW36KeG6aKRIiwgWyIjaWZyYW1hV3JhcHBlciIsICIuYWQtYmFubmVyLXdyYXBwZXIiLCAiLmg1LWRldGFpbC1ndWlkZSwuaDUtZGV0YWlsLXZpcC1ndWlkZSxbY2xhc3MkPWFkXSwuQ29ybmVyLWNvbnRhaW5lciIsICJbZGF0YS1zcG09J2Rvd25sb2FkQXBwJ10sLmRvd25sb2FkQXBwIiwgIi5jYWxsRW5kX2JveCJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3MuRGVmYXVsdOino+aekFsi5LyY6YW36KeG6aKRIl1bIuaJi+acuuerryJdLCAiI3BsYXllciIsIG51bGwpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobG9jYXRp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LWl0ZW0ucHJvZ3JhbWdyb3VwIC5wLWNvbW1vbiJdLCBzZXR0aW5ncy5EZWZhdWx06Kej5p6QWyLlkqrlkpXop4bpopEiXVsi5omL5py656uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAic2VjdGlvbiNtb2QtcGxheWVyIiwgbnVsbCwgZnVuY3Rpb24gKGhyZWYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaHJlZi5yZXBsYWNlKCJtLm1pZ3V2aWRlby5jb20iLCAid3d3Lm1pZ3V2aWRlby5jb20iKS5yZXBsYWNlKCJtc2l0ZSIsICJ3ZWJzaXRlIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxvY2F0aW9uLmhvc3QuaW5kZXhPZigibGUuY29tIikgIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoYmxvY2tfc2hvdykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2tfc2hvdy5pbm5lckhUTUwgPSAiZGl2LmxheW91dHt2aXNpYmlsaXR5OiB2aXNpYmxlICFpbXBvcnRhbnQ7IGRpc3BsYXk6YmxvY2sgIWltcG9ydGFudDt9ZGl2LmxheW91dD4qOm5vdChzdHlsZSxzY3JpcHQsI2otdm90ZSwjai1mb2xsb3cpe3Zpc2liaWxpdHk6IHZpc2libGUgIWltcG9ydGFudDsgZGlzcGxheTogYmxvY2sgIWltcG9ydGFudDt9IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmhlYWQuaW5zZXJ0QmVmb3JlKGJsb2NrX3Nob3csIGRvY3VtZW50LmhlYWQuZmlyc3RDaGlsZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoInN0eWxlIikpOwogICAgICAgICAgICAgICAgICAgICAgICBkb0VsZW1lbnQoImEuai1jbG9zZS1nZHQiLCBmdW5jdGlvbiAoanVtcF9vdmVyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqdW1wX292ZXIuY2xpY2soKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWR5UGxheWVyQm94KCLkuZDop4ZUViIsIFsiYS5sZWFwcF9idG4iLCAiZGl2LmZ1bGxfZ2R0X2JpdHNbaWRePWZ1bGxdW2RhdGEtdXJsXSIsICJbY2xhc3MqPURhb2xpdV0sW2NsYXNzKj1kYW9saXVdLFtjbGFzcyo9Z2FtZV0iLCAiZGl2Lm0tc3RhcnQiLCAiW2NsYXNzKj1pY29uX3VzZXJdIl0sIHNldHRpbmdzLkRlZmF1bHTop6PmnpBbIuS5kOinhlRWIl1bIuaJi+acuuerryJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgImRpdi5jb2x1bW4ucGxheSIsIG51bGwpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobG9jYXRpb24uaG9zdC5pbmRleE9mKCJtLnR2LnNvaHUuY29tIikgIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWR5UGxheWVyQm94KCLmkJzni5Dop4bpopEiLCBbImRpdltjbGFzc149YmFubmVyXSIsICJkaXYuanMtb3Blci1wb3MiLCAiZGl2W2lkXj1hZF0sZGl2W2lkXj1hZF0gKiIsICJbaWQqPWxvZ2luXSxbY2xhc3MqPWxvZ2luXSIsICJbY2xhc3MkPS1hcHBdIiwgImRpdi5hcHAtdmJveC5waC12Ym94LGRpdi5hcHAtdmJveC5hcHAtZ3Vlc3MtdmJveCIsICJkaXYudHdpbmZvX2ljb253cmFwIiwgImRpdltjbGFzcyQ9YmFubmVyXSxkaXZbaWQkPWJhbm5lcl0iXSwgc2V0dGluZ3MuRGVmYXVsdOino+aekFsi5pCc54uQ6KeG6aKRIl1bIuaJi+acuuerryJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIiNwbGF5ZXIsI3NvaHVwbGF5ZXIsLnBsYXllci12aWV3IiwgbnVsbCwgYXN5bmMgZnVuY3Rpb24gKGhyZWYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgbmV3IFByb21pc2UoZnVuY3Rpb24gKHJlc29sdmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeG1sSHR0cFJlcXVlc3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAiR0VUIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogaHJlZiwgb25sb2FkOiBmdW5jdGlvbiAoe3Jlc3BvbnNlVGV4dH0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgcmVzdWx0ID0gcmVzcG9uc2VUZXh0Lm1hdGNoKG5ldyBSZWdFeHAoInZhciB2aWRlb0RhdGEgPSBce1teXHgwMF0rdHZVcmw6XCIoaHR0cC4rKVwiLFtcXHJcXG5dIikpWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUocmVzdWx0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVycm9yOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc29sdmUoaHJlZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoIm1ndHYuY29tIikgIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWR5UGxheWVyQm94KCLoipLmnpxUViIsIFsiZGl2LmFkRml4ZWRDb250YWluLGRpdi5hZC1iYW5uZXIsZGl2Lm0tbGlzdC1ncmFwaGljeGN5LmZzdHAtbWFyayIsICJkaXZbY2xhc3NePW1nLWFwcF0sZGl2I2NvbW1lbnQtaWQudmlkZW8tY29tbWVudCBkaXYuZnQsZGl2LmJkLmNsZWFyZml4LGRpdi52LWZvbGxvd2VyLWluZm8iLCAiZGl2Lmh0Lm1ndWktYnRuLm1ndWktYnRuLW5vd2VsdCIsICJkaXYucGVyc29uYWwiLCAiZGl2W2RhdGEtdi00MWM5YTY0ZV0iXSwgc2V0dGluZ3MuRGVmYXVsdOino+aekFsi6IqS5p6cVFYiXVsi5omL5py656uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZGl2LnZpZGVvLXBvc3RlcixkaXYudmlkZW8tYXJlYSIsIG51bGwpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobG9jYXRpb24uaG9zdC5pbmRleE9mKCJpeGlndWEuY29tIikgIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWR5UGxheWVyQm94KCLopb/nk5zop4bpopEiLCBbImRpdi54aWd1YS1kb3dubG9hZCIsICJkaXYueGlndWEtZ3VpZGUtYnV0dG9uIiwgImRpdi5jLWxvbmctdmlkZW8tcmVjb21tZW5kLmMtbG9uZy12aWRlby1yZWNvbW1lbmQtdW5mb2xkIl0sIHNldHRpbmdzLkRlZmF1bHTop6PmnpBbIuilv+eTnOinhumikSJdWyLmiYvmnLrnq68iXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJkaXYueGlndWEtZGV0YWlsdmlkZW8tdmlkZW8iLCBudWxsKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxvY2F0aW9uLmhvc3QuaW5kZXhPZigicHB0di5jb20iKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVhZHlQbGF5ZXJCb3goIlBQVFYiLCBbIltkYXRhLWRhcmtyZWFkZXItaW5saW5lLWJnaW1hZ2VdW2RhdGEtZGFya3JlYWRlci1pbmxpbmUtYmdjb2xvcl0iLCAiZGl2W2NsYXNzXj1wcC1tLWRpdmVyc2lvbl0iLCAic2VjdGlvbiNwcG1vYi1kZXRhaWwtcGljc3dpcGVyIiwgInNlY3Rpb24ubGF5b3V0LmxheW91dF9hZHMiLCAiZGl2LmZvb3RfYXBwIiwgImRpdlttb2R1bGVuYW1lPeWvvOa1geS9jV0iLCAiYVtjbGFzcyo9dXNlcl0iLCAiZGl2Lm1vZF92aWRlb19pbmZvIGRpdi52aWRlb19mdW5jIl0sIHNldHRpbmdzLkRlZmF1bHTop6PmnpBbIlBQVFYiXVsi5omL5py656uvIl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAic2VjdGlvbi5wcC1kZXRhaWxzLXZpZGVvIiwgbnVsbCwgZnVuY3Rpb24gKGhyZWYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaHJlZi5yZXBsYWNlKCJtLnBwdHYuY29tIiwgInYucHB0di5jb20iKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobG9jYXRpb24uaG9zdC5pbmRleE9mKCJ2aXAuMTkwNS5jb20iKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uIChtb3ZpZV9pbmZvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb3ZpZV9pbmZvLmlubmVySFRNTCA9ICJzZWN0aW9uI21vdmllX2luZm97cGFkZGluZy10b3A6IDIwcHggIWltcG9ydGFudDt9IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZ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KICAgICAgICAgICAgICAgICAgICAgICAgICAgICJkaXYjcGxheWVyLGRpdiNwb3AiLCBudWxsKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgZnVuY3Rpb24gcmVhZHlQbGF5ZXJCb3goVGlwLCBkaXNwbGF5Tm9uZXMsIHNyY3MsIGNzc1N0cmluZywgZG9GdW5jdGlvbiwgZG9IcmVmID0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNvbnN0IFNSQ1MgPSBzcmNzOwogICAgICAgICAgICAgICAgICAgIGlmIChUaXApIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coIiVj5bey6L+b5YWlIiArIFRpcCwgc2V0dGluZ3MuZm9udFN0eWxlLm1heCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGxldCBvdGhlcnM7CiAgICAgICAgICAgICAgICAgICAgbG9jYXRpb24ub25jaGFuZ2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNyY3MgPSBTUkNTOwogICAgICAgICAgICAgICAgICAgICAgICBvdGhlcnMgPSBPYmplY3QudmFsdWVzKHNldHRpbmdzLk5vQUTop6PmnpApLmZpbHRlcihmdW5jdGlvbiAodmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOaxguWHuiBzcmNzIOWcqCBOb0FE6Kej5p6QIOS4reeahOihpembhgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNyY3MuaW5kZXhPZih2YWx1ZSkgPT09IC0xOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgLy8gbm9pbnNwZWN0aW9uIFNpbGx5QXNzaWdubWVudEpTIOiwg+eUqOeahOaYr3NldOWSjGdldOaWueazlQogICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5ncy5zcmMgPSBzZXR0aW5ncy5zcmM7CiAgICAgICAgICAgICAgICAgICAgfTsgICAgLy8gVE9ETyAs55uR5ZCsdXJs5Y+Y5YyWLOWmguaenOe9kemhtXJ1bOWPmOS6huWwseino+aekOaWsOWcsOWdgAoKICAgICAgICAgICAgICAgICAgICBpZiAoZGlzcGxheU5vbmVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOb25lKGRpc3BsYXlOb25lcyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGRvRWxlbWVudChjc3NTdHJpbmcsIGZ1bmN0aW9uIChwbGF5ZXJCb3gpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBsYXllckJveC5zdHlsZS5kaXNwbGF5ID09PSAibm9uZSIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsYXllckJveC5zdHlsZS5kaXNwbGF5ID0gIiI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBpZnJhbWUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJpZnJhbWUiKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWZyYW1lLmFsbG93RnVsbHNjcmVlbiA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZS5pbXBvcnRhbmNlID0gImhpZ2giOyAgICAgIC8vIGF1dG8gKGRlZmF1bHQpIOS4jeaMh+WumuS8mOWFiOe6p+OAgua1j+iniOWZqOagueaNruiHqui6q+aDheWGteWGs+Wumui1hOa6kOeahOWKoOi9vemhuuW6jyBoaWdoIOi1hOa6kOeahOWKoOi9veS8mOWFiOe6p+i+g+mrmCBsb3cg6LWE5rqQ55qE5Yqg6L295LyY5YWI57qn6L6D5L2OCiAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZS5mcmFtZUJvcmRlciA9ICIwIjsgICAvLyBIVE1MNeW3suW8g+eUqOatpOWxnuaAp++8jOW5tuS9v+eUqHN0eWxlLm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kcmVzcy5sZW5ndGggPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5ncy5yYW5kb21TZWxlY2VQYXJzZSgi6Kej5p6Q5bey5aSx5pWI77yM5q2j5Zyo5YiH5o2i6Kej5p6Q5rqQIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CgogICAgICAgICAgICAgICAgICAgICAgICBvdGhlcnMgPSBPYmplY3QudmFsdWVzKHNldHRpbmdzLk5vQUTop6PmnpApLmZpbHRlcihmdW5jdGlvbiAodmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOaxguWHuiBzcmNzIOWcqCBOb0FE6Kej5p6QIOS4reeahOihpembhgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNyY3MuaW5kZXhPZih2YWx1ZSkgPT09IC0xOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKCiAgICAgICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoRElZX2lmcmFtZV9zZWxlY3QpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIERJWV9pZnJhbWVfc2VsZWN0LnNldEF0dHJpYnV0ZSgic3R5bGUiLCAiYm9yZGVyOiAwOyBiYWNrZ3JvdW5kLWNvbG9yOiAjZGRkOyB0ZXh0LWFsaWduOiBjZW50ZXI7IHdpZHRoOiA4MHB4OyBoZWlnaHQ6IDEwMCU7IGJvcmRlci1ib3R0b20tbGVmdC1yYWRpdXM6IDE1cHg7IGJvcmRlci10b3AtbGVmdC1yYWRpdXM6IDE1cHg7Iik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBzcmMgPSAiIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoc2V0dGluZ3MsICJzcmMiLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNyYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAodmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdmFsdWUpIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYyA9IERJWV9pZnJhbWVfc2VsZWN0LnZhbHVlID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmNzLnB1bGwodmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3MuYWRkcmVzcyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gY29uc3QgbmV3aWZyYW1lID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiaWZyYW1lW2lkKj1wbGF5ZXJdIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpZiAobmV3aWZyYW1lKSBpZnJhbWUgPSBuZXdpZnJhbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGRvSHJlZiA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBocmVmID0gZG9IcmVmKGxvY2F0aW9uLmhyZWYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZS5zcmMgPSB2YWx1ZSA/IHZhbHVlICsgKGhyZWYgPyBocmVmIDogbG9jYXRpb24uaHJlZikgOiAiIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyYW1lLnNyYyA9IHZhbHVlID8gdmFsdWUgKyBsb2NhdGlvbi5ocmVmIDogIiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBuYW1lIGluIHNldHRpbmdzLk5vQUTop6PmnpApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBESVlfaWZyYW1lX3NlbGVjdC5pbm5lckhUTUwgKz0gIjxvcHRpb24gdmFsdWU9JyIgKyBzZXR0aW5ncy5Ob0FE6Kej5p6QW25hbWVdICsgIicgc3R5bGU9J3RleHQtYWxpZ246IGNlbnRlcic+IiArIG5hbWUgKyAiPC9vcHRpb24+IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobGV0IG5hbWUgaW4gc2V0dGluZ3MuQUTop6PmnpApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBESVlfaWZyYW1lX3NlbGVjdC5pbm5lckhUTUwgKz0gIjxvcHRpb24gdmFsdWU9JyIgKyBzZXR0aW5ncy5BROino+aekFtuYW1lXSArICInIHN0eWxlPSd0ZXh0LWFsaWduOiBjZW50ZXI7IGNvbG9yOiAjZmEwOyAnPuKaoCIgKyBuYW1lICsgIjwvb3B0aW9uPiI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBESVlfaWZyYW1lX3NlbGVjdC5hZGRFdmVudExpc3RlbmVyKCJjaGFuZ2UiLCBmdW5jdGlvbiAoZXZlbnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5ncy5zcmMgPSBESVlfaWZyYW1lX3NlbGVjdC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXZlbnQuaXNUcnVzdGVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOmihOWFiOiuvue9ruWOhuWPsuino+aekOa6kO+8iOeUqOS6jumAgumFjeS4jeaUr+aMgWlmcmFtZeaJp+ihjOiEmuacrOeahOa1j+iniOWZqO+8iQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2NhbFN0b3JhZ2Uuc2V0SXRlbSgncGFyc2UuaGlzdG9yeVBhcnNlJywgc2V0dGluZ3Muc3JjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKnNldHRpbmdzLnJhbmRvbVNlbGVjZVBhcnNlID0gZnVuY3Rpb24gKG1lc3NhZ2UpIHsqLwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFyZ3VtZW50cyDku6PooajovpPlhaXnmoTmiYDmnInlj4LmlbDvvIznnIvkuI3mh4Llj6/ku6Xnmb7luqbmkJzntKIg4oCcanMg5Y+C5pWwIGFyZ3VtZW50c+KAnQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJldHVybiBhcmd1bWVudHMgPyBhcmd1bWVudHNbTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogYXJndW1lbnRzLmxlbmd0aCldIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKmlmIChzcmNzLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvd1RpcChtZXNzYWdlID8gbWVzc2FnZSA6ICLop6PmnpDlpLHotKXvvIzmraPlnKjliIfmjaLop6PmnpDmupAiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHJhbmRvbSA9IE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIHNyY3MubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3Muc3JjID0gc3Jjcy5zcGxpY2UocmFuZG9tLCAxKVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG90aGVycykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG93VGlwKG1lc3NhZ2UgPyBtZXNzYWdlIDogIuino+aekOWksei0pe+8jOato+WcqOWwneivleWFtuS7luino+aekOa6kCIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmNzID0gb3RoZXJzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdGhlcnMgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgcmFuZG9tID0gTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogc3Jjcy5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5ncy5zcmMgPSBzcmNzLnNwbGljZShyYW5kb20sIDEpWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNob3dUaXAoIuivpeinhumikeWPr+iDveaXoOazleino+aekFxu6K+35bCd6K+V5L2/55So4pqg5bm/5ZGK6Kej5p6QXG7lpoLmnInnlpHpl67or7flj43ppogiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07Ki8KCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IERJWV9pZnJhbWVfYnV0dG9uID0gc2V0dGluZ3MudG9vbHNCYXIucXVlcnlTZWxlY3RvcigiYnV0dG9uIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3MuRElZX2lmcmFtZUZ1bmN0aW9uID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2V0dGluZ3MucGFyc2VEQi5ESVnop6PmnpDmoI8gJiYgRElZX2lmcmFtZV9zZWxlY3Quc3R5bGUuZGlzcGxheSA9PT0gIm5vbmUiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBESVlfaWZyYW1lX3NlbGVjdC5zdHlsZS5kaXNwbGF5ID0gRElZX2lmcmFtZV9zZWxlY3Quc3R5bGUudmlzaWJpbGl0eSA9ICIiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRElZX2lmcmFtZV9idXR0b24uc3R5bGUuYm9yZGVyUmFkaXVzID0gIjBweCAxNXB4IDE1cHggMHB4IjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICghc2V0dGluZ3MucGFyc2VEQi5ESVnop6PmnpDmoI8gJiYgRElZX2lmcmFtZV9zZWxlY3Quc3R5bGUuZGlzcGxheSAhPT0gIm5vbmUiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBESVlfaWZyYW1lX3NlbGVjdC5zdHlsZS5kaXNwbGF5ID0gIm5vbmUiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRElZX2lmcmFtZV9zZWxlY3Quc3R5bGUudmlzaWJpbGl0eSA9ICJoaWRkZW4iOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRElZX2lmcmFtZV9idXR0b24uc3R5bGUuYm9yZGVyUmFkaXVzID0gIjE1cHgiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLkRJWV9pZnJhbWVGdW5jdGlvbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvb2xzQmFyU2V0dGluZ3MgPSBzZXR0aW5ncy50b29sc0Jhci5xdWVyeVNlbGVjdG9yKCJzZXR0aW5ncyIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvb2xzQmFyU2V0dGluZ3MuaW5zZXJ0QmVmb3JlKERJWV9pZnJhbWVfc2VsZWN0LCB0b29sc0JhclNldHRpbmdzLmZpcnN0Q2hpbGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic2VsZWN0IikpOwoKICAgICAgICAgICAgICAgICAgICAgICAgLy8g6I635Y+W5Y6G5Y+y6Kej5p6QCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLnNyYyA9IGxvY2FsU3RvcmFnZS5nZXRJdGVtKCJwYXJzZS5oaXN0b3J5UGFyc2UiKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZXR0aW5ncy5zcmMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLnJhbmRvbVNlbGVjZVBhcnNlKCLmraPlnKjlvJXlhaXop6PmnpDmupAiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBwbGF5ZXJCb3guc3R5bGUuekluZGV4ID0gIjEiOwogICAgICAgICAgICAgICAgICAgICAgICBwbGF5ZXJCb3guYXBwZW5kQ2hpbGQoaWZyYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coIiVjcGxheWVyQm945bey5bu656uL6Kej5p6Q6L+e5o6lIiwgc2V0dGluZ3MuZm9udFN0eWxlLm1heCk7CgogICAgICAgICAgICAgICAgICAgICAgICBzZXRJbnRlcnZhbChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgbmV3UGxheWVyQm94ID0gZG9jdW1lbnQucXVlcnlTZWxlY3Rvcihjc3NTdHJpbmcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5ld1BsYXllckJveCAhPT0gbnVsbCAmJiAobmV3UGxheWVyQm94ICE9PSBwbGF5ZXJCb3ggfHwgbmV3UGxheWVyQm94LnF1ZXJ5U2VsZWN0b3IoImlmcmFtZVtzcmM9JyIgKyBpZnJhbWUuc3JjICsgIiddIikgPT09IG51bGwpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coInBsYXllckJveOmHjeaWsOW7uueri+i/nuaOpSIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBzcmMgPSBpZnJhbWUuc3JjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZS5zcmMgPSAiIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZnJhbWUgPSBpZnJhbWUuY2xvbmVOb2RlKHRydWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZS5zcmMgPSBzcmM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3UGxheWVyQm94LnN0eWxlLnpJbmRleCA9ICIxIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdQbGF5ZXJCb3guYXBwZW5kQ2hpbGQoaWZyYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgc2V0dGluZ3MuZ2V0RWxlbWVudFRpbWVzKTsKCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGNsb3NlT2xkTWVkaWEoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyh0b3ApLmZvckVhY2goZnVuY3Rpb24gKHByb3BlcnR5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB3aW5kb3dbcHJvcGVydHldID09PSAiZnVuY3Rpb24iICYmIEJvb2xlYW4od2luZG93W3Byb3BlcnR5XS5wcm90b3R5cGUpICYmIHR5cGVvZiB3aW5kb3dbcHJvcGVydHldLnByb3RvdHlwZS5hZGRTb3VyY2VCdWZmZXIgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJGFkZFNvdXJjZUJ1ZmZlciA9IHdpbmRvd1twcm9wZXJ0eV0ucHJvdG90eXBlLmFkZFNvdXJjZUJ1ZmZlcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93W3Byb3BlcnR5XS5wcm90b3R5cGUuYWRkU291cmNlQnVmZmVyID0gZnVuY3Rpb24gYWRkU291cmNlQnVmZmVyKG1pbWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cgPT09IHRvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucmVtb3ZlU291cmNlQnVmZmVyKCRhZGRTb3VyY2VCdWZmZXIuY2FsbCh0aGlzLCBtaW1lKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkYWRkU291cmNlQnVmZmVyLmNhbGwodGhpcywgbWltZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IG5vZGUgb2YgcGxheWVyQm94LnF1ZXJ5U2VsZWN0b3JBbGwoIioiKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChub2RlICE9PSBpZnJhbWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5hZGRFdmVudExpc3RlbmVyKCJsb2FkZWRkYXRhIiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5zcmMgPSBVUkwuY3JlYXRlT2JqZWN0VVJMKG5ldyBCbG9iKG5ldyBBcnJheSgwKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5zcmMgPSBVUkwuY3JlYXRlT2JqZWN0VVJMKG5ldyBCbG9iKG5ldyBBcnJheSgwKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlLnJlbW92ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICAgICAgY2xvc2VPbGRNZWRpYSgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQucmVhZHlTdGF0ZS50b0xvd2VyQ2FzZSgpICE9ICJjb21wbGV0ZSIpIHJlYWR5KGNsb3NlT2xkTWVkaWEsICJjb21wbGV0ZSIpOwoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRvRnVuY3Rpb24pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvRnVuY3Rpb24ocGxheWVyQm94LCBpZnJhbWUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgICAgICAgICBzZXRJbnRlcnZhbChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBvdGhlcl9pZnJhbWUgb2YgZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgiaWZyYW1lIikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3RoZXJfaWZyYW1lLnNyYyAhPT0gaWZyYW1lLnNyYyB8fCBvdGhlcl9pZnJhbWUuY29uc3RydWN0b3IubmFtZSAhPT0gaWZyYW1lLmNvbnN0cnVjdG9yLm5hbWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3RoZXJfaWZyYW1lLnJlbW92ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpZnJhbWUuZ2V0QXR0cmlidXRlKCJzdHlsZSIpICE9PSBpZnJhbWVfc3R5bGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZnJhbWUuc2V0QXR0cmlidXRlKCJzdHlsZSIsIGlmcmFtZV9zdHlsZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHNldHRpbmdzLmdldEVsZW1lbnRUaW1lcyk7CgogICAgICAgICAgICAgICAgICAgICAgICBbJ2Z1bGxzY3JlZW5jaGFuZ2UnLCAnd2Via2l0ZnVsbHNjcmVlbmNoYW5nZScsICdtb3pmdWxsc2NyZWVuY2hhbmdlJ10uZm9yRWFjaChmdW5jdGlvbiAoaXRlbSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoaXRlbSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkb2N1bWVudC5mdWxsU2NyZWVuIHx8IGRvY3VtZW50Lm1vekZ1bGxTY3JlZW4gfHwgZG9jdW1lbnQud2Via2l0SXNGdWxsU2NyZWVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLnRvb2xzQmFyLnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3MudG9vbHNCYXIuc3R5bGUuZGlzcGxheSA9ICdibG9jayc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgY29uc29sZS5sb2cobG9jYXRpb24uaHJlZiArICIgMW9rIik7CgogICAgICAgICAgICAgICAgZnVuY3Rpb24gc2V0UGFyc2VWaWRlbygpIHsKICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhsb2NhdGlvbi5ocmVmICsgIiAyb2siKTsKICAgICAgICAgICAgICAgICAgICBmb3JFbGVtZW50cygidmlkZW8iLCBhc3luYyBmdW5jdGlvbiAodmlkZW9zLCB0aGlzSW50ZXJ2YWwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCB2aWRlbyBvZiB2aWRlb3MpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby5wb3N0ZXIpIHZpZGVvLnJlbW92ZUF0dHJpYnV0ZSgicG9zdGVyIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodmlkZW8uc3JjICYmIHZpZGVvLmR1cmF0aW9uID4gNykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOa4hemZpOebkeWQrHZpZGVv6K6h5pe25ZmoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJJbnRlcnZhbCh0aGlzSW50ZXJ2YWwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbnNvbGUubG9nKCLop6PmnpDmiJDlip/vvIzmuIXnqbrop6PmnpDliJfooajnvJPlrZgiKTsKCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wLnBvc3RNZXNzYWdlKHNldHRpbmdzLmtleS5lbmNyeXB0KCLlrp3loZTplYfmsrPlppZceDAw57uZ5LqIXHgwMDEiKSwgIioiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3AucG9zdE1lc3NhZ2Uoc2V0dGluZ3Mua2V5LmVuY3J5cHQoIuWuneWhlOmVh+ays+Wmllx4MDDmjInkuItFbnRlcuiOt+WPlueEpueCuSIpLCAiKiIpOwoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjb25zb2xlLmxvZygi56e76Zmk5bm/5ZGK5qih5Z2XIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlRWxlbWVudHMoWydkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiQURwbGF5ZXIiKScsICdkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiQUR0aXAiKSddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjb25zb2xlLmxvZygi562J5b6F5pWw5o2u5b6X5Yiw5ZON5bqU77yM56e76Zmk5by55bmV5qih5Z2XIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3MucGFyc2VEQiA9IGF3YWl0IHNldHRpbmdzLnBhcnNlREI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZXR0aW5ncy5wYXJzZURCLuW8ueW5leW8gOWFsykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjb25zb2xlLmxvZygi5q2j5Zyo56e76Zmk5by55bmV5Yqf6IO9Iik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZUVsZW1lbnRzKFsnZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiZGl2W2NsYXNzJD1wbGF5ZXItdmlkZW8td3JhcF0iKS5nZXRFbGVtZW50c0J5VGFnTmFtZSgiZGl2IiknLCAnZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiZGl2W2NsYXNzJD1wbGF5ZXItZGFubXVdIiknLCAnZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiZGl2W2NsYXNzJD1wbGF5ZXItZGFubWFrdV0iKScsICdkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJkaXZbY2xhc3MqPXBsYXllci1jb21tZW50LWJveF0iKScsICdkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJkaXZbY2xhc3MqPXBsYXllci1jb250cm9sbGVyLW1hc2tdIiknLCAnZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiW2NsYXNzKj1wbGF5ZXItbGlzdC1pY29uXSIpJywgJ2RvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoImRpdltjbGFzcyQ9cGxheWVyLW1lbnVdIiknXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLmxvb3AgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8uYXV0b3BpY3R1cmVpbnBpY3R1cmUgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBwbGF5YmFja1JhdGUgPSBsb2NhbFN0b3JhZ2UuZ2V0SXRlbSgicGFyc2UucGxheWJhY2tSYXRlIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwbGF5YmFja1JhdGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLnBsYXliYWNrUmF0ZSA9IHBhcnNlRmxvYXQocGxheWJhY2tSYXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHBsYXliYWNrUmF0ZUVsZW1lbnQgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJbY2xhc3MqPXNwZWVkc10gW2NsYXNzKj1sYXllci1sYWJlbF0udGl0bGUiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby5wbGF5YmFja1JhdGUgIT09IDEgJiYgcGxheWJhY2tSYXRlRWxlbWVudCAhPT0gbnVsbCkgcGxheWJhY2tSYXRlRWxlbWVudC5pbm5lclRleHQgPSBwbGF5YmFja1JhdGUgKyAieCI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8uYWRkRXZlbnRMaXN0ZW5lcigicmF0ZWNoYW5nZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsU3RvcmFnZS5zZXRJdGVtKCJwYXJzZS5wbGF5YmFja1JhdGUiLCB2aWRlby5wbGF5YmFja1JhdGUudG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKCk7CgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbnNvbGUubG9nKCLov5vlhaUv6YCA5Ye6IOWFqOWxjyIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IG9wZW5GdWxsc2NyZWVuID0gSFRNTFZpZGVvRWxlbWVudC5wcm90b3R5cGUuUmVxdWVzdEZ1bGxTY3JlZW4gPyBIVE1MVmlkZW9FbGVtZW50LnByb3RvdHlwZS5SZXF1ZXN0RnVsbFNjcmVlbiA6IC8v5YW85a65RmlyZWZveAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIVE1MVmlkZW9FbGVtZW50LnByb3RvdHlwZS5tb3pSZXF1ZXN0RnVsbFNjcmVlbiA/IEhUTUxWaWRlb0VsZW1lbnQucHJvdG90eXBlLm1velJlcXVlc3RGdWxsU2NyZWVuIDovL+WFvOWuuUNocm9tZSwgU2FmYXJpIGFuZCBPcGVyYeetiQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSFRNTFZpZGVvRWxlbWVudC5wcm90b3R5cGUud2Via2l0UmVxdWVzdEZ1bGxTY3JlZW4gPyBIVE1MVmlkZW9FbGVtZW50LnByb3RvdHlwZS53ZWJraXRSZXF1ZXN0RnVsbFNjcmVlbiA6IC8v5YW85a65SUUvRWRnZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEhUTUxWaWRlb0VsZW1lbnQucHJvdG90eXBlLm1zUmVxdWVzdEZ1bGxzY3JlZW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZXhpdEZ1bGxzY3JlZW4gPSBkb2N1bWVudC5leGl0RnVsbFNjcmVlbiA/IGRvY3VtZW50LmV4aXRGdWxsU2NyZWVuIDogLy/lhbzlrrlGaXJlZm94CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50Lm1vekNhbmNlbEZ1bGxTY3JlZW4gPyBkb2N1bWVudC5tb3pDYW5jZWxGdWxsU2NyZWVuIDogLy/lhbzlrrlDaHJvbWUsIFNhZmFyaSBhbmQgT3BlcmHnrYkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LndlYmtpdEV4aXRGdWxsc2NyZWVuID8gZG9jdW1lbnQud2Via2l0RXhpdEZ1bGxzY3JlZW4gOiAvL+WFvOWuuUlFL0VkZ2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5ib2R5Lm1zRXhpdEZ1bGxzY3JlZW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2V0RnVsbHNjcmVlbkVsZW1lbnQgPSB0eXBlb2YgZG9jdW1lbnQuZnVsbHNjcmVlbkVsZW1lbnQgIT09ICJ1bmRlZmluZWQiID8gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuZnVsbHNjcmVlbkVsZW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IHR5cGVvZiBkb2N1bWVudC5tb3pGdWxsU2NyZWVuRWxlbWVudCAhPT0gInVuZGVmaW5lZCIgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkb2N1bWVudC5tb3pGdWxsU2NyZWVuRWxlbWVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogdHlwZW9mIGRvY3VtZW50Lm1zRnVsbFNjcmVlbkVsZW1lbnQgIT09ICJ1bmRlZmluZWQiID8gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQubXNGdWxsU2NyZWVuRWxlbWVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQud2Via2l0RnVsbHNjcmVlbkVsZW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZnVsbHNjcmVlbiA9IChmdW5jdGlvbiAobm9kZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSAidW5kZWZpbmVkIiA/CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQm9vbGVhbihnZXRGdWxsc2NyZWVuRWxlbWVudCgpKSA6ICF2YWx1ZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4aXRGdWxsc2NyZWVuLmFwcGx5KGRvY3VtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3BlbkZ1bGxzY3JlZW4uYXBwbHkobm9kZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby5mb2N1cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKGlzTW9iaWxlID8gdmlkZW8gOiBkb2N1bWVudC5ib2R5KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby5hZGRFdmVudExpc3RlbmVyKCJwYXVzZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh2aWRlby5jdXJyZW50VGltZSAtIHZpZGVvLmR1cmF0aW9uKSA+IC01KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjb25zb2xlLmxvZygi6KeG6aKR5pKt5pS+57uT5p2f5LqGIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdWxsc2NyZWVuKGZhbHNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzTW9iaWxlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmdWxsc2NyZWVuX2J0biA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIltjbGFzcyo9ZnVsbHNjcmVlbl1bY2xhc3MqPU9uXSxbY2xhc3MkPXBsYXllci1mdWxsXSBidXR0b25bY2xhc3MkPWZ1bGwtaWNvbl0iKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmdWxsc2NyZWVuX2J0biAmJiBmdWxsc2NyZWVuX2J0bi5ub2RlVHlwZSA9PT0gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGxzY3JlZW4gPSBmdW5jdGlvbiAodmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gInVuZGVmaW5lZCIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGxzY3JlZW5fYnRuLmNsaWNrKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodmFsdWUgJiYgIUJvb2xlYW4oZ2V0RnVsbHNjcmVlbkVsZW1lbnQoKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGxzY3JlZW5fYnRuLmNsaWNrKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIXZhbHVlICYmIEJvb2xlYW4oZ2V0RnVsbHNjcmVlbkVsZW1lbnQoKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGxzY3JlZW5fYnRuLmNsaWNrKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKGlzRnVsbHNjcmVlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoImtleWRvd24iLCBmdW5jdGlvbiAoZXZlbnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXZlbnQua2V5ID09PSAiRW50ZXIiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRnVsbHNjcmVlbiA9IEJvb2xlYW4oZ2V0RnVsbHNjcmVlbkVsZW1lbnQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigia2V5dXAiLCBmdW5jdGlvbiAoZXZlbnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXZlbnQua2V5ID09PSAiRW50ZXIiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc0Z1bGxzY3JlZW4gPT09IEJvb2xlYW4oZ2V0RnVsbHNjcmVlbkVsZW1lbnQoKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGxzY3JlZW4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby5wYXVzZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby5wbGF5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmYWxzZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNob3dUaXAoIuWbnui9pu+8jOi/m+WFpeWFqOWxj+aSreaUviIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNob3dUaXAoIuino+aekOaIkOWKnyIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVsbHNjcmVlbihzZXR0aW5ncy5wYXJzZURCLuiHquWKqOWFqOWxjyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZpZGVvLnBhdXNlZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby5wbGF5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgNTAwMCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhsb2NhdGlvbi5ocmVmICsgIiAzb2siKTsKICAgICAgICAgICAgICAgICAgICAgICAgdG9wLnBvc3RNZXNzYWdlKHNldHRpbmdzLmtleS5lbmNyeXB0KCLlrp3loZTplYfmsrPlppZceDAw57uZ5LqIXHgwMC0xXHgwMCIgKyBsb2NhdGlvbi5ocmVmKSwgIioiKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBpZiAobG9jYXRpb24uaG9zdC5pbmRleE9mKCJqaWV4aS50N2cuY24iKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAvLyDnp7vpmaTniLHop6PmnpBwMnDmj5DnpLoKICAgICAgICAgICAgICAgICAgICBkaXNwbGF5Tm9uZShbImJvZHk+ZGl2I3N0YXRzIl0pOwogICAgICAgICAgICAgICAgICAgIHNldFBhcnNlVmlkZW8oKTsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobG9jYXRpb24uaG9zdC5pbmRleE9mKCJhcGkub2tqeC5jYzozMzg5IikgIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgLy8g5Yig6ZmkT0vop6PmnpDnur/ot6/pgInmi6nlip/og70KICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKHN0eWxlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0eWxlLmlubmVySFRNTCA9ICIuc2xpZGUsLnBhbmVsLC5zbGlkZSAqLC5wYW5lbCAqe3dpZHRoOiAwICFpbXBvcnRhbnQ7IG1heC13aWR0aDogMCAhaW1wb3J0YW50OyBvcGFjaXR5OiAwICFpbXBvcnRhbnQ7fSI7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmhlYWQuYXBwZW5kQ2hpbGQoc3R5bGUpOwogICAgICAgICAgICAgICAgICAgIH0pKGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoInN0eWxlIikpOwogICAgICAgICAgICAgICAgICAgIHNldFBhcnNlVmlkZW8oKTsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobG9jYXRpb24uaG9zdC5pbmRleE9mKCJhcGkuaml1Ym9qeC5jb20iKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICBkaXNwbGF5Tm9uZSgiZGl2LmFkdl93cmFwX2hoIik7CiAgICAgICAgICAgICAgICAgICAgc2V0UGFyc2VWaWRlbygpOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoInllbXUueHl6IikgIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGxvY2F0aW9uLnBhdGhuYW1lLmluZGV4T2YoImp4LnBocCIpID09PSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAobG9jYXRpb24uaG9zdC5pbmRleE9mKCJ3d3cueWVtdS54eXoiKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOWIoOmZpOWknOW5leino+aekOe6v+i3r+mAieaLqeWKn+iDvQogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uIChzdHlsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0eWxlLmlubmVySFRNTCA9ICIuc2xpZGUsLnBhbmVsLC5zbGlkZSAqLC5wYW5lbCAqe3dpZHRoOiAwICFpbXBvcnRhbnQ7IG1heC13aWR0aDogMCAhaW1wb3J0YW50OyBvcGFjaXR5OiAwICFpbXBvcnRhbnQ7fSI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChzdHlsZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KShkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJzdHlsZSIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoImp4LnllbXUueHl6IikgIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDnp7vpmaTop4bpopHliIbnsbvmj5DnpLog5Y+KIOino+aekOahhuaetuWkhOeQhgogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5vbmUoWyJkaXYuYWR2aXNvcnkiXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRQYXJzZVZpZGVvKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAvLyDnp7vpmaTog4zmma/lm77niYcKICAgICAgICAgICAgICAgICAgICAgICAgZG9FbGVtZW50KCJkaXZbc3R5bGUqPSd3aWR0aDoxMDAlO2hlaWdodDoxMDAlOyddW3N0eWxlKj0nLmpwZyddIiwgZnVuY3Rpb24gKGJhY2tncm91bmQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmQuc2V0QXR0cmlidXRlKCJzdHlsZSIsICJ3aWR0aDoxMDAlOyBoZWlnaHQ6MTAwJTsgcG9zaXRpb246cmVsYXRpdmU7IHotaW5kZXg6MjE0NzQ4MzY0Nzk4NzsiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgNTAwMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoJ3d3dy5tdG9zei5jb20nKSAhPT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICBkaXNwbGF5Tm9uZShbIi52aWRlby1wYW5lbC1ibHVyLWltYWdlIl0pOyAgICAvLyDkvLzkuY7kuI3nrqHnlKjvvJ8KICAgICAgICAgICAgICAgICAgICBkb0VsZW1lbnQoIi52aWRlby1wYW5lbC1ibHVyLWltYWdlIiwgZnVuY3Rpb24gKGVsZW1lbnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zZXRBdHRyaWJ1dGUoInN0eWxlIiwgImRpc3BsYXk6IG5vbmU7IGhlaWdodDogMDsgd2lkdGg6IDA7Iik7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgc2V0UGFyc2VWaWRlbygpOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoJ3Yuc3VwZXJjaGVuLnRvcDozMzg5JykgIT09IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgc2V0UGFyc2VWaWRlbygpOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsb2NhdGlvbi5ob3N0LmluZGV4T2YoJ2p4LnBhcndpeC5jb206NDQzMycpICE9PSAtMSkgewogICAgICAgICAgICAgICAgICAgIHNldFBhcnNlVmlkZW8oKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgc2V0UGFyc2VWaWRlbygpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBkaXNwbGF5Tm9uZShUYWdzKSB7CiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBsZXQgc3R5bGUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJzdHlsZSIpOwogICAgICAgICAgICAgICAgICAgIHN0eWxlLmlubmVySFRNTCA9ICJcbiI7CiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBUYWdzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0eWxlLmlubmVySFRNTCArPSBUYWdzW2ldICsgIntkaXNwbGF5OiBub25lICFpbXBvcnRhbnQ7IGhlaWdodDogMCAhaW1wb3J0YW50OyB3aWR0aDogMCAhaW1wb3J0YW50OyB2aXNpYmlsaXR5OiBoaWRkZW4gIWltcG9ydGFudDsgbWF4LWhlaWdodDogMCAhaW1wb3J0YW50OyBtYXgtd2lkdGg6IDAgIWltcG9ydGFudDsgb3BhY2l0eTogMCAhaW1wb3J0YW50O31cbiI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmhlYWQuaW5zZXJ0QmVmb3JlKHN0eWxlLCBkb2N1bWVudC5oZWFkLmZpcnN0Q2hpbGQpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIGZ1bmN0aW9uIHNob3dUaXAobXNnLCBzdHlsZSA9ICIiKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAvLyDor6Xlh73mlbDpnIDopoHlnKh0b3DlhoXov5DooYzvvIzlkKbliJnlj6/og73mmL7npLrlvILluLgKICAgICAgICAgICAgICAgIGlmICh3aW5kb3cgPT09IHRvcCkgewogICAgICAgICAgICAgICAgICAgIGxldCB0aXAgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCI6cm9vdD50aXAiKTsKICAgICAgICAgICAgICAgICAgICBpZiAodGlwICYmIHRpcC5ub2RlVHlwZSA9PT0gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAvLyDpmLLmraLkuK3pgJTmlrDnmoRzaG93VGlw5LqL5Lu25Yib5bu65aSa5LiqdGlw6YCg5oiQ5Y2h6aG/CiAgICAgICAgICAgICAgICAgICAgICAgIHRpcC5yZW1vdmUoKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdGlwID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgidGlwIik7CiAgICAgICAgICAgICAgICAgICAgLy8gcG9pbnRlci1ldmVudHM6IG5vbmU7IOemgeeUqOm8oOagh+S6i+S7tu+8jGlucHV05qCH562+5L2/55SoIGRpc2FibGVkPSdkaXNhYmxlZCcg56aB55SoaW5wdXTmoIfnrb4KICAgICAgICAgICAgICAgICAgICB0aXAuc2V0QXR0cmlidXRlKCJzdHlsZSIsIHN0eWxlICsgInBvaW50ZXItZXZlbnRzOiBub25lOyBvcGFjaXR5OiAwOyBiYWNrZ3JvdW5kLWNvbG9yOiAjMjIyYTsgY29sb3I6ICNmZmY7IGZvbnQtZmFtaWx5OiDlvq7ova/pm4Xpu5Es6buR5L2TLERyb2lkIFNlcmlmLEFyaWFsLHNhbnMtc2VyaWY7IGZvbnQtc2l6ZTogMjBweDsgdGV4dC1hbGlnbjogY2VudGVyOyBwYWRkaW5nOiA2cHg7IGJvcmRlci1yYWRpdXM6IDE2cHg7IHBvc2l0aW9uOiBmaXhlZDsgdHJhbnNmb3JtOiB0cmFuc2xhdGUoLTUwJSwgLTUwJSk7IGxlZnQ6IDUwJTsgYm90dG9tOiAxNSU7IHotaW5kZXg6IDIxNDc0ODM2NDc7Iik7CiAgICAgICAgICAgICAgICAgICAgdGlwLmlubmVySFRNTCA9ICI8c3R5bGU+QGtleWZyYW1lcyBzaG93VGlwIHswJXtvcGFjaXR5OiAwO30gMzMuMzQle29wYWNpdHk6IDE7fSA2Ni42NyV7b3BhY2l0eTogMTt9IDEwMCV7b3BhY2l0eTogMDt9fTwvc3R5bGU+XG4iICsgbXNnOwogICAgICAgICAgICAgICAgICAgIGxldCB0aW1lID0gbXNnLnJlcGxhY2UobmV3IFJlZ0V4cCgiXFxzIiksICIiKS5sZW5ndGggLyAyOyAgIC8vIFRPRE8gMuS4quWtly/np5IKICAgICAgICAgICAgICAgICAgICAvLyBjdWJpYy1iZXppZXIo6LW35aeL54K5LCDotbflp4vngrnlgY/np7vph48sIOe7k+adn+eCueWBj+enu+mHjywg57uT5p2f54K5Ke+8jOi/memHjOeahCBjdWJpYy1iZXppZXLlh73mlbAg6KGo56S65Yqo55S76YCf5bqm55qE5Y+Y5YyW6KeE5b6LCiAgICAgICAgICAgICAgICAgICAgdGlwLnN0eWxlLmFuaW1hdGlvbiA9ICJzaG93VGlwICIgKyAodGltZSA+IDIgPyB0aW1lIDogMikgKyAicyBjdWJpYy1iZXppZXIoMCwiICsgKCh0aW1lIC0gMSkgPiAwID8gKHRpbWUgLSAxKSAvIHRpbWUgOiAwKSArICIsIiArICgxIC0gKCh0aW1lIC0gMSkgPiAwID8gKHRpbWUgLSAxKSAvIHRpbWUgOiAwKSkgKyAiLDEpIDEgbm9ybWFsIjsKICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5yb290LmFwcGVuZENoaWxkKHRpcCk7CiAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXAucmVtb3ZlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOaOkumZpHJvb3TmsqHmnInmib7liLB0aXAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIHRpbWUgKiAxMDAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdG9wLnBvc3RNZXNzYWdlKHNldHRpbmdzLmtleS5lbmNyeXB0KCLlrp3loZTplYfmsrPlppZceDAw5Ye95pWwXHgwMHNob3dUaXAoJyIgKyBtc2cgKyAiJykiKSwgIioiKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgY29uc29sZS5sb2cobXNnKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0pKCk7CgogICAgZnVuY3Rpb24gcmVxdWlyZSh1cmwpIHsKICAgICAgICBjb25zdCByZXF1ZXN0ID0gbmV3IFhNTEh0dHBSZXF1ZXN0KCk7CiAgICAgICAgbGV0IHJlc3VsdDsKICAgICAgICByZXF1ZXN0Lm9wZW4oIkdFVCIsIHVybCwgZmFsc2UpOwogICAgICAgIHJlcXVlc3Qub25sb2FkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICByZXN1bHQgPSBldmFsKHJlcXVlc3QucmVzcG9uc2UpOwogICAgICAgICAgICBjb25zb2xlLmxvZygidXNlLXNjcnlwdC5sZW5ndGggPSAiICsgcmVxdWVzdC5yZXNwb25zZS5sZW5ndGgpOwogICAgICAgIH07CiAgICAgICAgcmVxdWVzdC5zZW5kKCk7CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgIH0KfSkoKTs=
Add Comment
Please, Sign In to add comment