Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:网页插件¥js_url¥global_ImageDownloader@base64://Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgICAgICBJbWFnZSBEb3dubG9hZGVyCi8vIEBuYW1lOnpoLUNOICAg5Zu+54mH5LiL6L295ZmoCi8vIEBuYW1lOnpoLVRXICAg5Zu+54mH5LiL6L295ZmoCi8vIEBuYW1lOmphICAg55S75YOP44OA44Km44Oz44Ot44O844OA44O8Ci8vIEBuYW1lOmtvICAg7J2066+47KeAIOuLpOyatOuhnOuNlAovLyBAbmFtZTpkZSAgIEltYWdlIERvd25sb2FkZXIKLy8gQG5hbWU6ZXMgICBJbWFnZSBEb3dubG9hZGVyCi8vIEBuYW1lOmVvICAgSW1hZ2UgRG93bmxvYWRlcgovLyBAbmFtZTpmciAgIEltYWdlIERvd25sb2FkZXIKLy8gQG5hbWU6aXQgICBJbWFnZSBEb3dubG9hZGVyCi8vIEBuYW1lOnJ1ICAgSW1hZ2UgRG93bmxvYWRlcgovLyBAbmFtZTp2aSAgIEltYWdlIERvd25sb2FkZXIKLy8gQG5hbWU6cHQtQlIgICBJbWFnZSBEb3dubG9hZGVyCi8vIEBuYW1lOmlkICAgSW1hZ2UgRG93bmxvYWRlcgovLyBAbmFtZTphciAgIEltYWdlIERvd25sb2FkZXIKLy8gQG5hbWU6YmcgICBJbWFnZSBEb3dubG9hZGVyCi8vIEBuYW1lOmNzICAgSW1hZ2UgRG93bmxvYWRlcgovLyBAbmFtZTp0ciAgIEltYWdlIERvd25sb2FkZXIKLy8gQG5hbWU6ZWwgICBJbWFnZSBEb3dubG9hZGVyCi8vIEBuYW1lOmh1ICAgSW1hZ2UgRG93bmxvYWRlcgovLyBAbmFtZTp0aCAgIEltYWdlIERvd25sb2FkZXIKLy8gQG5hbWVzcGFjZSAgICAgICBodHRwOi8vdGFtcGVybW9ua2V5Lm5ldC8KLy8gQGRlc2NyaXB0aW9uIC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nID0gbmF2aWdhdG9yLmFwcE5hbWUgPT0gIk5ldHNjYXBlIiA/IG5hdmlnYXRvci5sYW5ndWFnZSA6IG5hdmlnYXRvci51c2VyTGFuZ3VhZ2U7CiAgICB2YXIgbGFuZ1NldDsKICAgIHZhciBsb2NhbGl6YXRpb24gPSB7CiAgICAgICAgemg6IHsKICAgICAgICAgICAgc2VsZWN0QWxsOiAi5YWo6YCJIiwKICAgICAgICAgICAgZG93bmxvYWRCdG46ICLkuIvovb0iLAogICAgICAgICAgICBkb3dubG9hZE1lbnVUZXh0OiAi5omT5byA6ISa5pysKEFsdCt3KSIsCiAgICAgICAgICAgIHppcERvd25sb2FkQnRuOiAiemlw5LiL6L29IiwKICAgICAgICAgICAgc2VsZWN0QWxlcnQ6Iuivt+iHs+WwkemAieS4reS4gOW8oOWbvueJh+OAgiIsCiAgICAgICAgICAgIGZldGNoVGlwOiLlh4blpIfmipPlj5ZjYW52YXPlm77niYciLAogICAgICAgICAgICBmZXRjaENvdW50MTpg5oqT5Y+WY2FudmFz5Zu+54mH56ysYCwKICAgICAgICAgICAgZmV0Y2hDb3VudDI6J+W8oCcsCiAgICAgICAgICAgIGZldGNoRG9uZVRpcDE6IuW3sumAiSgwLyIsCiAgICAgICAgICAgIGZldGNoRG9uZVRpcDFUeXBlMjoi5bey6YCJKCIsCiAgICAgICAgICAgIGZldGNoRG9uZVRpcDI6IinlvKDlm77niYciLAogICAgICAgICAgICByZWdSdWxlUGxhY2U6Iui+k+WFpeW+heabv+aNouato+WImSIsCiAgICAgICAgICAgIHJlZ1JlcGxhY2VQbGFjZToi6L6T5YWl5pu/5o2i5a6D55qE5a2X56ym5Liy5oiW6ICF5Ye95pWwIiwKICAgICAgICAgICAgemlwT3B0aW9uRGVzYzoi5Yu+6YCJ5L2/55Soemlw5LiL6L295ZCO77yM5Lya6K+35rGC6Leo5Z+f5p2D6ZmQ77yM5ZCm5YiZemlw5LiL6L295Z+65pys5LiL6L295LiN5Yiw5Zu+54mH44CCIiwKICAgICAgICAgICAgemlwQ2hlY2tUZXh0OiLkvb/nlKh6aXDkuIvovb0iLAogICAgICAgICAgICBkb3dubG9hZFVybEZpbGU6IuS4i+i9veWbvueJh+WcsOWdgCIsCiAgICAgICAgICAgIG1vcmVTZXR0aW5nOiLmm7TlpJrorr7nva4iLAogICAgICAgICAgICBhdXRvQml0SW1nTW9kdWxlOiLoh6rliqjlpKflm77orr7nva7mqKHlnZciLAogICAgICAgICAgICBkZWZhdWx0U2V0dGluZ1J1bGU6Iuiuvue9rum7mOiupOinhOWImSIsCiAgICAgICAgICAgIGV4cG9ydEN1c3RvbVJ1bGU6IuWvvOWHuuiHquWumuinhOWImSIsCiAgICAgICAgICAgIGltcG9ydEN1c3RvbVJ1bGU6IuWvvOWFpeiHquWumuinhOWImSIsCiAgICAgICAgICAgIGZvbGQ6IuaUtui1tyIsCiAgICAgICAgICAgIGlucHV0RmlsZW5hbWVUaXA6Iui+k+WFpeaWh+S7tuWQjSIsCgogICAgICAgIH0sCiAgICAgICAgZW46IHsKICAgICAgICAgICAgc2VsZWN0QWxsOiAic2VsZWN0QWxsIiwKICAgICAgICAgICAgZG93bmxvYWRCdG46ICJkb3dubG9hZCIsCiAgICAgICAgICAgIGRvd25sb2FkTWVudVRleHQ6ICJPcGVuKEFsdCt3KSIsCiAgICAgICAgICAgIHppcERvd25sb2FkQnRuOiAiemlwIERvd25sb2FkIiwKICAgICAgICAgICAgc2VsZWN0QWxlcnQ6IlBsZWFzZSBhdCBsYXN0IHNlbGVjdCBvbmUgaW1hZ2UuIiwKICAgICAgICAgICAgZmV0Y2hUaXA6IlJlYWR5IHRvIGZldGNoIGNhbnZhcyBpbWFnZS4iLAogICAgICAgICAgICBmZXRjaENvdW50MTpgRmV0Y2ggdGhlYCwKICAgICAgICAgICAgZmV0Y2hDb3VudDI6JyBjYW52YXMgaW1hZ2UuJywKICAgICAgICAgICAgZmV0Y2hEb25lVGlwMToiKDAvIiwKICAgICAgICAgICAgZmV0Y2hEb25l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odXJsU3RyLHVybEluZGV4KXsKICAgICAgICAgICAgICAgIC8vaWYoIXVybFN0cilyZXR1cm47CiAgICAgICAgICAgICAgICBpZih1cmxTdHIuaW5jbHVkZXMoImRhdGE6aW1hZ2UvIikpewogICAgICAgICAgICAgICAgICAgIHRoYXQuYmlnSW1hZ2VBcnJheS5wdXNoKHVybFN0cik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhhdC5kZWZhdWx0UnVsZXMuZm9yRWFjaCgocnVsZSxydWxlSW5kZXgpPT57CiAgICAgICAgICAgICAgICAgICAgaWYodGhhdC5kZWZhdWx0UnVsZXNDaGVja2VkW3J1bGVJbmRleF0hPT0iY2hlY2tlZCIpewogICAgICAgICAgICAgICAgICAgICAgICB0aGF0LmJpZ0ltYWdlQXJyYXkucHVzaCh1cmxTdHIpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICBsZXQgYmlnSW1hZ2U9dXJsU3RyLnJlcGxhY2UocnVsZS5vcmlnaW5SZWcscnVsZS5yZXBsYWNlbWVudCk7CiAgICAgICAgICAgICAgICAgICAgaWYoYmlnSW1hZ2UhPT11cmxTdHIpewogICAgICAgICAgICAgICAgICAgICAgICB0aGF0LmJpZ0ltYWdlQXJyYXkucHVzaCh1cmxTdHIpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGF0LmJpZ0ltYWdlQXJyYXkucHVzaChiaWdJbWFnZSk7CiAgICAgICAgICAgICAgICAgICAgfWVsc2V7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoYXQuYmlnSW1hZ2VBcnJheS5wdXNoKHVybFN0cik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgIHRoYXQudXNlclJ1bGVzLmZvckVhY2goKHJ1bGUscnVsZUluZGV4KT0+ewogICAgICAgICAgICAgICAgICAgIGlmKHRoYXQudXNlclJ1bGVzQ2hlY2tlZFtydWxlSW5kZXhdIT09ImNoZWNrZWQiKXsKICAgICAgICAgICAgICAgICAgICAgICAgdGhhdC5iaWdJbWFnZUFycmF5LnB1c2godXJsU3RyKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICAgICAgbGV0IGJpZ0ltYWdlPXVybFN0ci5yZXBsYWNlKHJ1bGUub3JpZ2luUmVnLHJ1bGUucmVwbGFjZW1lbnQpOwogICAgICAgICAgICAgICAgICAgIGlmKGJpZ0ltYWdlIT09dXJsU3RyKXsKICAgICAgICAgICAgICAgICAgICAgICAgdGhhdC5iaWdJbWFnZUFycmF5LnB1c2godXJsU3RyKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhhdC5iaWdJbWFnZUFycmF5LnB1c2goYmlnSW1hZ2UpOwogICAgICAgICAgICAgICAgICAgIH1lbHNlewogICAgICAgICAgICAgICAgICAgICAgICB0aGF0LmJpZ0ltYWdlQXJyYXkucHVzaCh1cmxTdHIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIGdldEJpZ0ltYWdlQXJyYXkob3JpZ2luSW1nVXJscyl7CiAgICAgICAgICAgIHRoaXMucmVwbGFjZShvcmlnaW5JbWdVcmxzKTsKICAgICAgICAgICAgbGV0IHVuaXF1ZUFycmF5PUFycmF5LmZyb20obmV3IFNldCh0aGlzLmJpZ0ltYWdlQXJyYXkpKTsKICAgICAgICAgICAgcmV0dXJuIHVuaXF1ZUFycmF5OwogICAgICAgIH0sCiAgICAgICAgc2hvd0RlZmF1bHRSdWxlcygpewogICAgICAgICAgICBsZXQgdGhhdD10aGlzOwogICAgICAgICAgICBsZXQgZGVmYXVsdENvbnRhaW5lcj1kb2N1bWVudC5ib2R5LnF1ZXJ5U2VsZWN0b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Y2V9IiBjbGFzcz0idHljLXNlYXJjaC11cmwiIHZhbHVlPSIke3YucmVwbGFjZW1lbnR9Ij4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxzcGFuIGNsYXNzPSJ0eWMtZGVmYXVsdC10aXAiPiR7di50aXB9PC9zcGFuPgogICAgICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAgYAogICAgICAgICAgICAgICAgQ29udGFpbmVyLmluc2VydEFkamFjZW50SFRNTCgiYmVmb3JlZW5kIixydWxlc0h0bWwpOwogICAgICAgICAgICB9KQogICAgICAgIH0sCiAgICAgICAgb25jbGlja1Nob3dEZWZhdWx0QnRuKCl7CiAgICAgICAgICAgIGxldCBkZWZhdWx0Q29udGFpbmVyPWRvY3VtZW50LmJvZHkucXVlcnlTZWxlY3RvcigiLnR5Yy1zZXQtZG9tYWluLWRlZmF1bHQiKTsKICAgICAgICAgICAgaWYoZGVmYXVsdENvbnRhaW5lci5zdHlsZS5kaXNwbGF5PT09Im5vbmUifHxkZWZhdWx0Q29udGFpbmVyLnN0eWxlLmRpc3BsYXk9PT0nJyl7CiAgICAgICAgICAgICAgICBkZWZhdWx0Q29udGFpbmVyLnN0eWxlLmRpc3BsYXk9ImZsZXgiOwogICAgICAgICAgICB9ZWxzZXsKICAgICAgICAgICAgICAgIGRlZmF1bHRDb250YWluZXIuc3R5bGUuZGlzcGxheT0ibm9uZSI7CiAgICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIG9uY2hlY2tDaGFuZ2UoKXsKICAgICAgICAgICAgbGV0IGNoZWNrcz1kb2N1bWVudC5ib2R5LnF1ZXJ5U2VsZWN0b3JBbGwoIi50eWMtZGVmYXVsdC1hY3RpdmUiKTsKICAgICAgICAgICAgdGhpcy5kZWZhdWx0UnVsZXNDaGVja2VkPVtdOwoKICAgICAgICAgICAgY2hlY2tzLmZvckVhY2goKHYsaSk9PnsKICAgICAgICAgICAgICAgIGlmKHYuY2hlY2tlZCl7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWZhdWx0UnVsZXNDaGVja2VkLnB1c2goImNoZWNrZWQiKTsKICAgICAgICAgICAgICAgIH1lbHNlewogICAgICAgICAgICAgICAgICAgIHRoaXMuZGVmYXVsdFJ1bGVzQ2hlY2tlZC5wdXNoKCIiKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSkKCiAgICAgICAgICAgIEdNX3NldFZhbHVlKCJkZWZhdWx0UnVsZXNDaGVja2VkIix0aGlzLmRlZmF1bHRSdWxlc0NoZWNrZWQpOwogICAgICAgIH0sCiAgICAgICAgb25jaGVja0NoYW5nZUN1c3RvbSgpewogICAgICAgICAgICBsZXQgY2hlY2tzPWRvY3VtZW50LmJvZHkucXVlcnlTZWxlY3RvckFsbCgiLnR5Yy1jdXN0b20tYWN0aXZlIik7CiAgICAgICAgICAgIHRoaXMudXNlclJ1bGVzQ2hlY2tlZD1bXTsKCiAgICAgICAgICAgIGNoZWNrcy5mb3JFYWNoKCh2LGkpPT57CiAgICAgICAgICAgICAgICBpZih2LmNoZWNrZWQpewogICAgICAgICAgICAgICAgICAgIHRoaXMudXNlclJ1bGVzQ2hlY2tlZC5wdXNoKCJjaGVja2VkIik7CiAgICAgICAgICAgICAgICB9ZWxzZXsKICAgICAgICAgICAgICAgICAgICB0aGlzLnVzZXJSdWxlc0NoZWNrZWQucHVzaCgiIik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pCgogICAgICAgICAgICBHTV9zZXRWYWx1ZSgidXNlclJ1bGVzQ2hlY2tlZCIsdGhpcy51c2VyUnVsZXNDaGVja2VkKTsKICAgICAgICB9LAogICAgICAgIHNldFJ1bGVzQ2hlY2tlZCgpewogICAgICAgICAgICBpZihHTV9nZXRWYWx1ZSgiZGVmYXVsdFJ1bGVzQ2hlY2tlZCIpKXsKICAgICAgICAgICAgICAgIHRoaXMuZGVmYXVsdFJ1bGVzQ2hlY2tlZD1HTV9nZXRWYWx1ZSgiZGVmYXVsdF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QucHVzaCgiY2hlY2tlZCIpOwogICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgIEdNX3NldFZhbHVlKCJ1c2VyUnVsZXNDaGVja2VkIix0aGlzLnVzZXJSdWxlc0NoZWNrZWQpOwogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBnZXRDdXN0b21SdWxlcyhldmVudCl7CiAgICAgICAgICAgIGxldCB0aGF0PWF1dG9CaWdJbWFnZTsKICAgICAgICAgICAgbGV0IGZpbGU9ZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiI3R5Y2ZpbGVFbGVtIikuZmlsZXNbMF07CiAgICAgICAgICAgIGxldCBmaWxlUmVhZGVyPW5ldyBGaWxlUmVhZGVyKCk7CiAgICAgICAgICAgIGZpbGVSZWFkZXIub25sb2FkPShlKT0+ewogICAgICAgICAgICAgICAgbGV0IHJlc3VsdD1lLnRhcmdldC5yZXN1bHQ7CiAgICAgICAgICAgICAgICB0aGF0LnVzZXJSdWxlcz1ldmFsKHJlc3VsdCk7CgogICAgICAgICAgICAgICAgR01fZGVsZXRlVmFsdWUoInVzZXJSdWxlc0NoZWNrZWQiKQogICAgICAgICAgICAgICAgdGhhdC5zZXRSdWxlc0NoZWNrZWQoKTsKICAgICAgICAgICAgICAgIEdNX3NldFZhbHVlKCJ1c2VyUnVsZXMiLHJlc3VsdCk7CiAgICAgICAgICAgICAgICAvL2NvbnNvbGUubG9nKEdNX2dldFZhbHVlKCd1c2VyUnVsZXMnKSk7CiAgICAgICAgICAgICAgICBkb2N1bWVudC5ib2R5LnF1ZXJ5U2VsZWN0b3IoIi50eWMtc2V0LWRvbWFpbi1jdXN0b20iKS5pbm5lckhUTUw9IiI7CiAgICAgICAgICAgICAgICB0aGF0LnNob3dSdWxlcygidHljLXNldC1kb21haW4tY3VzdG9tIiwidXNlclJ1bGVzIiwidXNlclJ1bGVzQ2hlY2tlZCIsInR5Yy1jdXN0b20tYWN0aXZlIik7CiAgICAgICAgICAgIH0KICAgICAg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udWxsKXsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi50eWMtaW1hZ2UtY29udGFpbmVyIikucmVtb3ZlKCk7CiAgICAgICAgICAgIH0gY2F0Y2ggewogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGVsc2V7CiAgICAgICAgICAgIHdyYXBwZXIoKTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gd3JhcHBlcigpIHsKICAgICAgICBkb3dubG9hZEZpbGVOYW1lPWRvbWFpbk5hbWVbZG9tYWluTmFtZS5sZW5ndGgtMl07CiAgICAgICAgdmFyIHRpbWVTdGFtcD1uZXcgRGF0ZSgpLmdldFRpbWUoKS50b1N0cmluZygpOwogICAgICAgIGRvd25sb2FkRmlsZU5hbWU9ZG93bmxvYWRGaWxlTmFtZSt0aW1lU3RhbXAuc3Vic3RyaW5nKDcsdGltZVN0YW1wLmxlbmd0aCk7CgogICAgICAgIHRyeSB7CiAgICAgICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi50eWMtaW1hZ2UtY29udGFpbmVyIikucmVtb3ZlKCk7CiAgICAgICAgfSBjYXRjaCB7CiAgICAgICAgfQogICAgICAgIHZhciBpbWdVcmxzID0gW107CiAgICAgICAgdmFyIGJvZHlTdHIgPSBkb2N1bWVudC5ib2R5LmlubmVySFRNTDsKICAgICAgICB2YXIgaW1nU2VsZWN0ZWQgPSBbXTsKICAgICAgICB2YXIgemlwSW1nU2VsZWN0ZWQgPSBbXTsKICAgICAgICB2YXIgaW1nV2FpdERvd25sb2FkID0gW107CiAgICAgICAgdmFyIHppcEltZ1dhaXREb3dubG9hZCA9IFtdOwogICAgICAgIHZhciB3aWR0aEZpbHRlciA9IHsgbWluOiAwLCBtYXg6IDMwMDAgfTsKICAgICAgICB2YXIgaGVpZ2h0RmlsdGVyID0geyBtaW46IDAsIG1heDogMzAwMCB9OwogICAgICAgIHZhciBmaWx0ZXJlZEltZ1VybHMgPSBbXTsKICAgICAgICB2YXIgemlwRmlsdGVyZWRJbWdVcmxzID0gW107CiAgICAgICAgdHJ5ewogICAgICAgICAgICB2YXIgemlwRm9sZGVyID0gbmV3IEpTWmlwKCk7CiAgICAgICAgICAgIHZhciB6aXBTdWJGb2xlciA9IHppcEZvbGRlci5mb2xkZXIoJ3BpY3MnKTsKICAgICAgICB9CiAgICAgICAgY2F0Y2h7CgogICAgICAgIH0KCiAgICAgICAgdmFyIGZldGNoVGlwPScnOwoKICAgICAgICB0cnkgewogICAgICAgICAgICBsZXQgaW1nRWxlcyA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJpbWciKTsKICAgICAgICAgICAgbGV0IGNhbnZhc0VsZXM9ZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoImNhbnZhcyIpOwogICAgICAgICAgICAvL2NvbnNvbGUubG9nKGNhbnZhc0VsZXMpOwoKICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBpbWdFbGVzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICAvLy8vY29uc29sZS5sb2coaW1nRWxlc1tpXS5zcmMpOwogICAgICAgICAgICAgICAgaWYgKCFpbWdVcmxzLmluY2x1ZGVzKGltZ0VsZXNbaV0uc3JjKSkgewogICAgICAgICAgICAgICAgICAgIGltZ1VybHMucHVzaChpbWdFbGVzW2ldLnNyYyk7CiAgICAgICAgICAgICAgICB9LyogZWxzZSBpZiAoIWltZ1VybHMuaW5jbHVkZXMoaW1nRWxlc1tpXS5zcmNzZXQpKSB7CiAgICAgICAgICAgICAgICAgICAgaW1nVXJscy5wdXNoKGltZ0VsZXNbaV0uc3Jjc2V0KTsKICAgICAgICAgICAgICAgIH0qLwoKICAgICAgICAgICAgICAgIGlmKGltZ0VsZXNbaV0uc3Jjc2V0IT09JycpewogICAgICAgICAgICAgICAgICAgIGxldCBzcmNBcnI9aW1nRWxlc1tpXS5zcmNzZXQuc3BsaXQoIiwiKTsKCiAgICAgICAgICAgICAgICAgICAgbGV0IHNyY1VybD1zcmNBcnJbMF0ubWF0Y2goL1xTKy9naSlbMF07CiAgICAgICAgICAgICAgICAgICAgZm9yKGxldCBrPTA7azxzcmNBcnIubGVuZ3RoLTE7aysrKXsKICAgICAgICAgICAgICAgICAgICAgICAgLy9zcmNBcnJba10ubWF0Y2goL1xTKy9naSks5q2j5YiZ55qE57uT5p6c5LiA5Liq5pWw57uE77yMMOaYr3VybO+8jDHmmK/muIXmmbDluqYKICAgICAgICAgICAgICAgICAgICAgICAgLy/miYDku6XnlKjmuIXmmbDluqbvvIzpgInlh7rmnIDmuIXmmbDnmoTpgqPlvKAKICAgICAgICAgICAgICAgICAgICAgICAgaWYocGFyc2VJbnQoc3JjQXJyW2tdLm1hdGNoKC9cUysvZ2kpWzFdKT5wYXJzZUludChzcmNBcnJbaysxXS5tYXRjaCgvXFMrL2dpKVsxXSkpewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjVXJsPXNyY0FycltrXS5tYXRjaCgvXFMrL2dpKVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICB9ZWxzZXsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyY1VybD1zcmNBcnJbaysxXS5tYXRjaCgvXFMrL2dpKVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICAgICAgLy/lsIZpbWd1cmxzIOS4reS4jeWMheWQq+eahHNyY3VybCDliqDlhaXliLDmlbDnu4TkuK0KICAgICAgICAgICAgICAgICAgICBpZighaW1nVXJscy5pbmNsdWRlcyhzcmNVcmwpKXsKICAgICAgICAgICAgICAgICAgICAgICAgaW1nVXJscy5wdXNoKHNyY1VybCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CgogICAgICAgICAgICBsZXQgaW1nUmVncyA9IGJvZHlTdHIubWF0Y2goLyg/PD1iYWNrZ3JvdW5kLWltYWdlOlxzKnVybFwoKShcUyspKD89XCkpL2cpOwoKICAgICAgICAgICAgdHJ5ewogICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBpbWdSZWdzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgLy8vL2NvbnNvbGUubG9nKGltZ1JlZ3NbaV0pOwogICAgICAgICAgICAgICAgICAgIGlmKGltZ1JlZ3NbaV0uaW5jbHVkZXMoJyZxdW90OycpKXsKICAgICAgICAgICAgICAgICAgICAgICAgaW1nVXJscy5wdXNoKGltZ1JlZ3NbaV0ucmVwbGFjZSgvJnF1b3Q7L2csICIiKSk7CiAgICAgICAgICAgICAgICAgICAgfWVsc2UgaWYoaW1nUmVnc1tpXS5pbmNsdWRlcygiJyIpKXsKICAgICAgICAgICAgICAgICAgICAgICAgaW1nVXJscy5wdXNoKGltZ1JlZ3NbaV0ucmVwbGFjZSgvJy9nLCAiIikpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfWNhdGNoKGUpewogICAgICAgICAgICAgICAgY29uc29sZS5sb2coZSk7CiAgICAgICAgICAgIH0KCgogICAgICAgICAgICBpZiAod2luZG93LmxvY2F0aW9uLmhyZWYuaW5jbHVkZXMoImhhdGhpdHJ1c3Qub3JnIikpIHsKICAgICAgICAgICAgICAgIGxldCBpbWdzID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgiLmltYWdlIGltZyIpOwogICAgICAgICAgICAgICAgaWYgKGltZ3MubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgICAgIGxldCBjYW52YXMgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJjYW52YXMiKTsKICAgICAgICAgICAgICAgICAgICBpbWdVcmxzID0gW107CiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgcGkgPSAwOyBwaSA8IGltZ3MubGVuZ3RoOyBwaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy53aWR0aCA9IGltZ3NbcGldLndpZHRoOwogICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuaGVpZ2h0ID0gaW1nc1twaV0uaGVpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuZ2V0Q29udGV4dCgiMmQiKS5kcmF3SW1hZ2UoaW1nc1twaV0sIDAsIDApOwogICAgICAgICAgICAgICAgICAgICAgICBpbWdVcmxzLnB1c2goY2FudmFzLnRvRGF0YVVSTCgiaW1hZ2UvcG5nIikpOwogICAgICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLnNlbGVjdC1hbGwiKS5zdHlsZSA9ICJwb3NpdGlvbjpyZWxhdGl2ZTt3aWR0aDoxNXB4O2hlaWdodDoxNXB4OyIKICAgICAgICAgICAgICAgIH0gZWxzZSB7CgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CgogICAgICAgICAgICBpZih3aW5kb3cubG9jYXRpb24uaHJlZi50b1N0cmluZygpLmluY2x1ZGVzKCJtYW5nYS5iaWxpYmlsaS5jb20vIikpewogICAgICAgICAgICAgICAgbGV0IGlmcmFtZUNhbnZhcz1gPGlmcmFtZSBzdHlsZT0iZGlzcGxheTpub25lOyIgaWQ9InR5Yy1pbnNlcnQtaWZyYW1lIj48L2lmcmFtZT5gOwogICAgICAgICAgICAgICAgaWYoZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoInR5Yy1pbnNlcnQtaWZyYW1lIik9PW51bGwpewogICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuaW5zZXJ0QWRqYWNlbnRIVE1MKCJhZnRlcmJlZ2luIixpZnJhbWVDYW52YXMpOwogICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJ0eWMtaW5zZXJ0LWlmcmFtZSIpLmNvbnRlbnREb2N1bWVudC5ib2R5Lmluc2VydEFkamFjZW50SFRNTCgiYWZ0ZXJiZWdpbiIsYDxjYW52YXMgaWQ9InR5Yy1pbnNlcnQtY2FudmFzIj48L2NhbnZhcz5gKTsKICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5ib2R5LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdjYW52YXMnKVswXS5fX3Byb3RvX18udG9CbG9iPWRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJ0eWMtaW5zZXJ0LWlmcmFtZSIpLmNvbnRlbnREb2N1bWVudC5nZXRFbGVtZW50QnlJZCgidHljLWluc2VydC1jYW52YXMiKS5fX3Byb3RvX18udG9CbG9iOwogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgfQoKICAgICAgICAgICAgbGV0IG9sZExlbmd0aD1pbWdVcmxzLmxlbmd0aDsKICAgICAgICAgICAgaWYoY2FudmFzRWxlcy5sZW5ndGg+MCl7CiAgICAgICAgICAgICAgICAvL2NvbnNvbGUubG9nKGNhbnZhc0VsZXMpOwogICAgICAgICAgICAgICAgZmV0Y2hUaXA9bGFuZ1NldC5mZXRjaFRpcDsKICAgICAgICAgICAgICAgIHZhciBjb21wbGV0ZUZsYWc9MDsKICAgICAgICAgICAgICAgIGZvcihsZXQgaj0wO2o8Y2FudmFzRWxlcy5sZW5ndGg7aisrKXsKICAgICAgICAgICAgICAgICAgICBjYW52YXNFbGVzW2pdLnRvQmxvYihibG9iQ2FsbGJhY2spOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGJsb2JDYWxsYmFjayhibG9iKXsKICAgICAgICAgICAgICAgICAgICAgICAgLy9jb25zb2xlLmxvZyhibG9iKTsKICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG9GaWxlUmVhZGVyID0gbmV3IEZpbGVSZWFkZXIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgb0ZpbGVSZWFkZXIub25sb2FkZW5kID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBiYXNlNjQgPSBlLnRhcmdldC5yZXN1bHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYmFzZTY0LmluY2x1ZGVzKCJkYXRhOmltYWdlIikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWltZ1VybHMuaW5jbHVkZXMoYmFzZTY0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2ltZ1VybHMucHVzaChiYXNlNjQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbWdVcmxzW29sZExlbmd0aCtqXT1iYXNlNjQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vY29uc29sZS5sb2coYmFzZTY0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcGxldGVGbGFnKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLm51bS10aXAiKS5pbm5lclRleHQ9YCR7bGFuZ1NldC5mZXRjaENvdW50MX0gJHtjb21wbGV0ZUZsYWd9LyR7Y2FudmFzRWxlcy5sZW5ndGh9ICR7bGFuZ1NldC5mZXRjaENvdW50Mn1gOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGNvbXBsZXRlRmxhZz09PWNhbnZhc0VsZXMubGVuZ3RoKXsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYW4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKCiAgICAgICAgICAgICAgICAgICAgICAgIG9GaWxlUmVhZGVyLnJlYWRBc0RhdGFVUkwoYmxvYik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9ZWxzZXsKICAgICAgICAgICAgICAgIGZldGNoVGlwPWAke2xhbmdTZXQuZmV0Y2hEb25lVGlwMX0ke2ltZ1VybHMubGVuZ3RofSR7bGFuZ1NldC5mZXRjaERvbmVUaXAyfWA7CiAgICAgICAgICAgIH0KCiAgICAgICAgfSBjYXRjaChlKSB7CiAgICAgICAgICAgIC8vYWxlcnQoImVycm9yIik7CiAgICAgICAgICAgIGNvbnNvbGUubG9nKGUpOwogICAgICAgIH0KCiAgICAgICAgbGV0IGltZ0NvbnRhaW5lciA9IGA8c3R5bGU+CiAgICAgICAgLnR5Yy1pbWFnZS1jb250YWluZXJ7CiAgICAgICAgICAgIGNvbG9yOmJsYWNrOwogICAgICAgICAgICBwb3NpdGlvbjpmaXhlZDsKICAgICAgICAgICAgdG9wOjBweDsKICAgICAgICAgICAgbGVmdDoxMCU7CiAgICAgICAgICAgIHdpZHRoOjgwdnc7CiAgICAgICAgICAgIHotaW5kZXg6MjE0NzQ4MzY0NTsKICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogI2RlZGVkZTsKICAgICAgICAgICAgYm9yZGVyOiAxcHggc29saWQgI2FhYTsKICAgICAgICAgICAgb3ZlcmZsb3c6c2Nyb2xsO2hlaWdodDoxMDAlOwogICAgICAgIH0KCiAgICAgICAgLnR5Yy1pbWFnZS1jb250YWluZXIgYnV0dG9uewogICAgICAgICAgICBib3JkZXI6MXB4IHNvbGlkICNhYWE7CiAgICAgICAgICAgIGJvcmRlci1yYWRpdXM6NXB4OwogICAgICAgICAgICBoZWlnaHQ6MzJweDtsaW5lLWhlaWdodDozMnB4OwogICAgICAgICAgICBtYXJnaW46MHB4O3BhZGRpbmc6MCA1cHg7CiAgICAgICAgfQoKICAgICAgICAudHljLWltYWdlLWNvbnRhaW5lciBidXR0b246aG92ZXJ7CiAgICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6ICNmNTA7CiAgICAgICAgICAgIGNvbG9yOiAjZmZmOwogICAgICAgIH0KCiAgICAgICAgLmNvbnRyb2wtc2VjdGlvbnsKICAgICAgICAgICAgd2lkdGg6ODB2dzsKICAgICAgICAgICAgei1pbmRleDoyMTQ3NDgzNjQ2OwogICAgICAgICAgICBwb3NpdGlvbjpmaXhlZDsKICAgICAgICAgICAgdG9wOjBweDsKICAgICAgICAgICAgbGVmdDoxMCU7CiAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgICAgICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47CiAgICAgICAgICAgIGp1c3RpZnktY29udGVudDogY2VudGVyOwogICAgICAgICAgICBsaW5lLWhlaWdodDo0MHB4OwogICAgICAgICAgICBiYWNrZ3JvdW5kOiNlZWU7Ym9yZGVyOjFweCBzb2xpZCAjYWFhO2JvcmRlci1yYWRpdXM6MnB4OwogICAgICAgIH0KCiAgICAgICAgLmNvbnRyb2wtc2VjdGlvbi1zdWJ7CiAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgICAgICAgIG1hcmdpbi1ib3R0b206IDVweDsKICAgICAgICB9CgogICAgICAgIC50eWMtbm9ybWFsLXNlY3Rpb257CiAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgICAgICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgICAgICAgICAgIGZsZXgtZGlyZWN0aW9uOiByb3c7CiAgICAgICAgICAgIGZsZXgtd3JhcDogd3JhcDsKICAgICAgICAgICAgYWxpZ24tY29udGVudDogbm9ybWFsOwogICAgICAgICAgICBqdXN0aWZ5LWNvbnRlbnQ6IGZsZXgtc3RhcnQ7CiAgICAgICAgICAgIGZvbnQtc2l6ZToxMHB4OwogICAgICAgIH0KCiAgICAgICAgLnR5Yy1ub3JtYWwtc2VjdGlvbiAqewogICAgICAgICAgICBwYWRkaW5nLXRvcDoycHg7CiAgICAgICAgfQoKICAgICAgICAuYnRuLWRvd25sb2FkewogICAgICAgICAgICBib3JkZXI6MXB4IHNvbGlkICNhYWE7Ym9yZGVyLXJhZGl1czo1cHg7CiAgICAgICAgICAgIGhlaWdodDozMnB4O2xpbmUtaGVpZ2h0OjMycHg7CiAgICAgICAgICAgIG1hcmdpbjowcHg7cGFkZGluZzowIDVweDsKICAgICAgICB9CiAgICAgICAgLmJ0bi16aXBEb3dubG9hZHsKICAgICAgICAgICAgYm9yZGVyOjFweCBzb2xpZCAjYWFhO2JvcmRlci1yYWRpdXM6NXB4OwogICAgICAgICAgICBoZWlnaHQ6MzJweDtsaW5lLWhlaWdodDozMnB4OwogICAgICAgICAgICBtYXJnaW46MHB4O3BhZGRpbmc6MCA1cHg7CiAgICAgICAgfQogICAgICAgIC5idG4tY2xvc2V7CiAgICAgICAgICAgIGZvbnQtc2l6ZToyMHB4O3Bvc2l0aW9uOmFic29sdXRlOwogICAgICAgICAgICByaWdodDozMHB4O3RvcDo0cHg7CiAgICAgICAgICAgIGhlaWdodDozMnB4O2xpbmUtaGVpZ2h0OjMycHg7CiAgICAgICAgICAgIG1hcmdpbjowcHg7CiAgICAgICAgICAgIGJvcmRlci1yYWRpdXM6MTBweDtib3JkZXI6MXB4IHNvbGlkICNhYWE7CiAgICAgICAgICAgIHdpZHRoOjMwcHg7CiAgICAgICAgfQoKICAgICAgICAudHljLWltYWdlLXdyYXBwZXJ7CiAgICAgICAgICAgIG1hcmdpbi10b3A6ODJweDtkaXNwbGF5OmZsZXg7anVzdGlmeS1jb250ZW50OmNlbnRlcjsKICAgICAgICAgICAgYWxpZ24taXRlbXM6Y2VudGVyO2ZsZXgtd3JhcDp3cmFwOwogICAgICAgIH0KCiAgICAgICAgLnR5Yy1pbnB1dC1jaGVja2JveHsKICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogaW5pdGlhbDsKICAgICAgICAgICAgY3Vyc29yOiBkZWZhdWx0OwogICAgICAgICAgICBhcHBlYXJhbmNlOiBhdXRvOwogICAgICAgICAgICBib3gtc2l6aW5nOiBib3JkZXItYm94OwogICAgICAgICAgICBtYXJnaW46IDNweCAzcHggM3B4IDRweDsKICAgICAgICAgICAgcGFkZGluZzogaW5pdGlhbDsKICAgICAgICAgICAgYm9yZGVyOiBpbml0aWFsOwogICAgICAgIH0KCiAgICAgICAgLnR5Yy1leHRlbmQtc2V0ewogICAgICAgICAgICBwYWRkaW5nOiAxMHB4OwogICAgICAgICAgICBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgxMDAsMTAwLDEwMCwwLjEpOwogICAgICAgIH0KCiAgICAgICAgLnR5Yy1leHRlbmQtc2V0ewogICAgICAgICAgICBkaXNwbGF5OiBub25lOwogICAgICAgICAgICBhbGlnbi1pdGVtczogc3RyZXRjaDsKICAgICAgICAgICAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjsKICAgICAgICAgICAganVzdGlmeS1jb250ZW50OiBmbGV4LXN0YXJ0OwogICAgICAgICAgICBmbGV4LXdyYXA6IG5vd3JhcDsKICAgICAgICAgICAgcGFkZGluZzogNXB4OwogICAgICAgICAgICB3aWR0aDogYXV0bzsKICAgICAgICB9CgogICAgICAgIC50eWMtZXh0ZW5kLXNldC1jb250YWluZXJ7CiAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgICAgICAgIGFsaWduLWl0ZW1zOiBmbGV4LXN0YXJ0OwogICAgICAgICAgICBmbGV4LWRpcmVjdGlvbjogY29sdW1uOwogICAgICAgICAgICBqdXN0aWZ5LWNvbnRlbnQ6IGZsZXgtc3RhcnQ7CiAgICAgICAgICAgIGZsZXgtd3JhcDogbm93cmFwOwogICAgICAgICAgICBhbGlnbi1jb250ZW50OiBub3JtYWw7CiAgICAgICAgICAgIGJvcmRlcjogMXB4IHNvbGlkIHJnYmEoMTAwLDEwMCwxMDAsMC41KTsKICAgICAgICAgICAgcGFkZGluZzogNXB4OwogICAgICAgICAgICBtYXJnaW4tYm90dG9tOiA1cHg7CiAgICAgICAgfQoKICAgICAgICAudHljLWF1dG9iaWdpbWctc2V0ewogICAgICAgICAgICBkaXNwbGF5OiBmbGV4OwogICAgICAgICAgICBhbGlnbi1pdGVtczogZmxleC1zdGFydDsKICAgICAgICAgICAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjsKICAgICAgICAgICAganVzdGlmeS1jb250ZW50OiBmbGV4LXN0YXJ0OwogICAgICAgICAgICBmbGV4LXdyYXA6IG5vd3JhcDsKICAgICAgICAgICAgYWxpZ24tY29udGVudDogbm9ybWFsOwogICAgICAgICAgICBib3JkZXI6IDFweCBzb2xpZCByZ2JhKDEwMCwxMDAsMTAwLDAuNSk7CiAgICAgICAgICAgIHBhZGRpbmc6IDVweDsKICAgICAgICB9CgogICAgICAgIC50eWMtc2V0LWRvbWFpbnsKICAgICAgICAgICAgZGlzcGxheTogZmxleDsKICAgICAgICAgICAgYWxpZ24taXRlbXM6IGZsZXgtc3RhcnQ7CiAgICAgICAgICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47CiAgICAgICAgICAgIGp1c3RpZnktY29udGVudDogZmxleC1zdGFydDsKICAgICAgICAgICAgZmxleC13cmFwOiBub3dyYXA7CiAgICAgICAgICAgIGFsaWduLWNvbnRlbnQ6IG5vcm1hbDsKICAgICAgICAgICAgbWFyZ2luOiA1cHg7CiAgICAgICAgICAgIHBhZGRpbmc6IDVweDsKICAgICAgICAgICAgYm9yZGVyOiAxcHggc29saWQgcmdiYSgxMDAsMTAwLDEwMCwwLjMpOwogICAgICAgICAgICB3aWR0aDogOTUlOwogICAgICAgICAgICBtYXgtaGVpZ2h0OiAxNTBweDsKICAgICAgICAgICAgb3ZlcmZsb3c6IHNjcm9sbDsKICAgICAgICB9CgogICAgICAgIC50eWMtYWJpLXRpdGxlewogICAgICAgICAgICBkaXNwbGF5OiBmbGV4OwogICAgICAgICAgICBmbGV4LWRpcmVjdGlvbjogcm93OwogICAgICAgICAgICBhbGlnbi1pdGVtczogY2VudGVyOwogICAgICAgICAgICBqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWFyb3VuZDsKICAgICAgICAgICAgd2lkdGg6IDEwMCU7CiAgICAgICAgfQoKICAgICAgICAudHljLWFiaS1kb21haW4tdGl0bGV7CiAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgICAgICAgIGZsZXgtZGlyZWN0aW9uOiByb3c7CiAgICAgICAgICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgICAgICAgICAgIGp1c3RpZnktY29udGVudDogc3BhY2UtYmV0d2VlbjsKICAgICAgICAgICAgd2lkdGg6IDk1JTsKICAgICAgICAgICAgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkICNkZGQ7CiAgICAgICAgfQogICAgICAgIC50eWMtc2V0LXJlcGxhY2VydWxlewogICAgICAgICAgICBkaXNwbGF5OiBmbGV4OwogICAgICAgICAgICBmbGV4LWRpcmVjdGlvbjogcm93OwogICAgICAgICAgICBqdXN0aWZ5LWNvbnRlbnQ6IGZsZXgtc3RhcnQ7CiAgICAgICAgICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgICAgICAgICAgIG1hcmdpbi1ib3R0b206IDNweDsKICAgICAgICAgICAgZmxleC13cmFwOiB3cmFwOwogICAgICAgIH0KCiAgICAgICAgLnR5Yy1zZXQtcmVwbGFjZXJ1bGUgKiwudHljLXNldC1yZXBsYWNlcnVsZSBidXR0b257CiAgICAgICAgICAgIG1hcmdpbi1sZWZ0OiA1cHg7CiAgICAgICAgfQoKICAgICAgICAudHljLXNldC1kb21haW4tZGVmYXVsdHsKICAgICAgICAgICAgaGVpZ2h0OiAyMDBweDsKICAgICAgICAgICAgb3ZlcmZsb3c6IHNjcm9sbDsKICAgICAgICAgICAgZGlzcGxheTogbm9uZTsKICAgICAgICB9CiAgICA8L3N0eWxlPgogICAgPGRpdiBjbGFzcz0idHljLWltYWdlLWNvbnRhaW5lciI+CiAgICAg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psZWZ0O21hcmdpbi1sZWZ0OjMwcHg7ZGlzcGxheTpibG9jazsiPgogICAgICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBlPSJjaGVja2JveCIgY2xhc3M9ImhlaWdodC1jaGVjayBpbWctY2hlY2sgdHljLWlucHV0LWNoZWNrYm94IiBuYW1lPSJoZWlnaHQtY2hlY2siIHZhbHVlPSJoZWlnaHQtY2hlY2siPkhlaWdodDoKICAgICAgICAgICAgICAgICAgICA8aW5wdXQgdHlwZT0idGV4dCIgY2xhc3M9ImhlaWdodC12YWx1ZS1taW4iIHNpemU9IjEiIHN0eWxlPSJoZWlnaHQ6MTVweDt3aWR0aDo1MHB4OyIKICAgICAgICAgICAgICAgICAgICAgICAgbWluPSIwIiBtYXg9Ijk5OTkiIHZhbHVlPSIwIj4tCiAgICAgICAgICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBlPSJ0ZXh0IiBjbGFzcz0iaGVpZ2h0LXZhbHVlLW1heCIgc2l6ZT0iMSIgc3R5bGU9ImhlaWdodDoxNXB4O3dpZHRoOjUwcHg7IgogICAgICAgICAgICAgICAgICAgICAgICBtaW49IjAiIG1heD0iOTk5OSIgdmFsdWU9IjMwMDAiPgogICAgICAgICAgICAgICAgPC9kaXY+CgogICAgICAgICAgICAgICAgPGRpdiBzdHlsZT0iZmxvYXQ6bGVmdDttYXJnaW4tbGVmdDozMHB4O2Rpc3BsYXk6YmxvY2s7IiBjbGFzcz0idHljLWNvcnMiPgogICAgICAgICAgICAgICAgICAgIDxzcGFuIGNsYXNzPSJ0eWMtdGlwIiBzdHlsZT0iZGlzcGxheTogbm9uZTsKICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7CiAgICAgICAgICAgICAgICAgICAgdG9wOiA1cHg7CiAgICAgICAgICAgICAgICAgICAgbGVmdDogNTBweDsKICAgICAgICAgICAgICAgICAgICB3aGl0ZS1zcGFjZTogbm93cmFwOwogICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmQ6IHJnYigyMDQsIDIwNCwgMjA0KTsKICAgICAgICAgICAgICAgICAgICBib3JkZXI6IDFweCBzb2xpZCByZ2IoMTUwLCAxNTAsIDE1MCk7CiAgICAgICAgICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogM3B4OwogICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IDVweDsiPiR7bGFuZ1NldC56aXBPcHRpb25EZXNjfQogICAgICAgICAgICAgICAgICAgIDwvc3Bhbj4KICAgICAgICAgICAgICAgICAgICA8aW5wdXQgdHlwZT0iY2hlY2tib3giIGNsYXNzPSJjb3JzLWNoZWNrIGltZy1jaGVjayB0eWMtaW5wdXQtY2hlY2tib3giIG5hbWU9ImNvcnMtY2hlY2siIHZhbHVlPSJjb3JzLWNoZWNrIj4KICAgICAgICAgICAgICAgICAgICA8c3Bhbj4ke2xhbmdTZXQuemlwQ2hlY2tUZXh0fTwvc3Bhbj4KICAgICAgICAgICAgICAgIDwvZGl2PgoKICAgICAgICAgICAgICAgIDxkaXYgc3R5bGU9ImZsb2F0OmxlZnQ7bWFyZ2luLWxlZnQ6MzBweDtkaXNwbGF5OmJsb2NrOyIgY2xhc3M9InR5Yy1kb3dubG9hZC11cmwiPgogICAgICAgICAgICAgICAgICAgIDxidXR0b24gY2xhc3M9InR5Yy1kb3dubG9hZC11cmwtYnRuIj4ke2xhbmdTZXQuZG93bmxvYWRVcmxGaWxlfTwvYnV0dG9uPgogICAgICAgICAgICAgICAgPC9kaXY+CgoKICAgICAgICAgICAgICAgIDxkaXYgc3R5bGU9ImZsb2F0OmxlZnQ7bWFyZ2luLWxlZnQ6MzBweDtkaXNwbGF5OmJsb2NrOyIgY2xhc3M9InR5Yy1leHRlbmQtYnRuIj4KICAgICAgICAgICAgICAgICAgICA8c3Bhbj4ke2xhbmdTZXQubW9yZVNldHRpbmd9IDwvc3Bhbj4KICAgICAgICAgICAgICAgICAgICA8c3BhbiBzdHlsZT0idG9wOiAzcHg7cG9zaXRpb246IHJl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ICAgICAgPGRpdj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICR7bGFuZ1NldC5hdXRvQml0SW1nTW9kdWxlfQogICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj4KICAgICAgICAgICAgICAgICAgICAgICAgPGRpdj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxidXR0b24gY2xhc3M9InR5Yy1kZWZhdWx0LXJ1bGUtc2hvdyI+JHtsYW5nU2V0LmRlZmF1bHRTZXR0aW5nUnVsZX08L2J1dHRvbj4KICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+CgogICAgICAgICAgICAgICAgICAgICAgICA8ZGl2PgogICAgICAgICAgICAgICAgICAgICAgICA8YnV0dG9uPiR7bGFuZ1NldC5leHBvcnRDdXN0b21SdWxlfTwvYnV0dG9uPgogICAgICAgICAgICAgICAgICAgIDwvZGl2PgoKICAgICAgICAgICAgICAgICAgICAgICAgPGRpdj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBlPSJmaWxlIiBpZD0idHljZmlsZUVsZW0iIG11bHRpcGxlIGFjY2VwdD0idGV4dC9wbGFpbiIgc3R5bGU9ImRpc3BsYXk6bm9uZSI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8YnV0dG9uIGlkPSJ0eWMtZmlsZS1zZWxlY3QiPiR7bGFuZ1NldC5pbXBvcnRDdXN0b21SdWxlfTwvYnV0dG9uPgogICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj4KCiAgICAgICAgICAgICAgICAgICAgPC9kaXY+CiAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz0idHljLXNldC1kb21haW4gdHljLXNldC1kb21haW4tY3VzdG9tIj4KICAgICAgICAgICAgICAgICAgICA8L2Rpdj4KICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJ0eWMtc2V0LWRvbWFpbiB0eWMtc2V0LWRvbWFpbi1kZWZhdWx0Ij4KICAgICAgICAgICAgICAgICAgIC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gICBpZiAoaW1nU2VsZWN0ZWQuaW5jbHVkZXMoY3VycmVudEltZ0luZGV4KSkgewogICAgICAgICAgICAgICAgICAgIGltZ1NlbGVjdGVkLnNwbGljZShpbWdTZWxlY3RlZC5pbmRleE9mKGN1cnJlbnRJbWdJbmRleCksIDEpOwogICAgICAgICAgICAgICAgICAgIGNvbnRhaW5lci5zdHlsZS5ib3JkZXIgPSAiMXB4IHNvbGlkICM5OWQiOwogICAgICAgICAgICAgICAgICAgIGluZm9Db250YWluZXIuc3R5bGUuYmFja2dyb3VuZENvbG9yPSdyZ2JhKDEwMCwxMDAsMTAwLDAuNiknOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBpbWdTZWxlY3RlZC5wdXNoKGN1cnJlbnRJbWdJbmRleCk7CiAgICAgICAgICAgICAgICAgICAgY29udGFpbmVyLnN0eWxlLmJvcmRlciA9ICIxcHggc29saWQgI2Y1MCI7CiAgICAgICAgICAgICAgICAgICAgaW5mb0NvbnRhaW5lci5zdHlsZS5iYWNrZ3JvdW5kQ29sb3I9J3JnYmEoODgsIDE1OCwgMjU1LCAwLjgpJzsKCiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgemlwSW1nU2VsZWN0ZWQ9aW1nU2VsZWN0ZWQ7CgogICAgICAgICAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLm51bS10aXAiKS5pbm5lclRleHQgPSBgJHtsYW5nU2V0LmZldGNoRG9uZVRpcDFUeXBlMn0ke2ltZ1NlbGVjdGVkLmxlbmd0aH0vJHtpbWdVcmxzLmxlbmd0aH0ke2xhbmdTZXQuZmV0Y2hEb25lVGlwMn1gOwogICAgICAgICAgICAgICAgaW1nV2FpdERvd25sb2FkPXRyYW5zSW5kZXhUb0xpbmsoZmlsdGVyZWRJbWdVcmxzLGltZ1NlbGVjdGVkKTsKICAgICAgICAgICAgICAgIHppcEltZ1dhaXREb3dubG9hZD10cmFuc0luZGV4VG9MaW5rKHppcEZpbHRlcmVkSW1nVXJscyx6aXBJbWdTZWxlY3RlZCk7CiAgICAgICAgICAgICAgICB6aXBJbWdXYWl0RG93bmxvYWQ9Y3V0b2ZmTm90QmFzZTY0SW1nKHppcEltZ1dhaXREb3dubG9hZCk7CgoKICAgICAgICAgICAgfSBlbHNlIGlmIChlLnRhcmdldC5wYXJlbnRFbGVtZW50LmNsYXNzTmFtZSA9PT0gInNob3ctYmlnLWltYWdlIikgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIuc2hvdy1iaWctaW1hZ2UiKS5yZW1vdmUoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGNhdGNoCiAgICAgICAgICAgICAgICB7CgogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgfSBlbHNlIGlmIChlLnRhcmdldC5jbGFzc0xpc3RbMV0gPT0gImJpLWRvd25sb2FkIiB8fCBlUGF0aC5maW5kKGlzRG93bmxvYWQpICE9IHVuZGVmaW5lZCkgewogICAgICAgICAgICAgICAgbGV0IGltZ0NvbnRhaW5lciA9IGVQYXRoLmZpbmQoCiAgICAgICAgICAgICAgICAgICAgKGVsZSkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9jb25zb2xlLmxvZyhlbGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVsZS5jbGFzc05hbWUuaW5jbHVkZXMoInR5Yy1pbWctaXRlbS1jb250YWluZXIiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBjYXRjaCB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgbGV0IHBhdGggPSBpbWdDb250YWluZXIuZ2V0RWxlbWVudHNCeVRhZ05hbWUoImltZyIpWzBdLnNyYzsKICAgICAgICAgICAgICAgIGxldCBmaWxlbmFtZTsKICAgICAgICAgICAgICAgIGlmIChwYXRoLmluZGV4T2YoIi8iKSA+IDApLy/lpoLmnpzljIXlkKvmnIkiLyLlj7cg5LuO5pyA5ZCO5LiA5LiqIi8i5Y+3KzHnmoTkvY3nva7lvIDlp4vmiKrlj5blrZfnrKbkuLIKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBmaWxlbmFtZSA9IHBhdGguc3Vic3RyaW5nKHBhdGgubGFzdEluZGV4T2YoIi8iKSArIDEsIHBhdGgubGFzdEluZGV4T2YoIi4iKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBmaWxlbmFtZSA9IHBhdGg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAvL2NvbnNvbGUubG9nKCJkb3dubG9hZCBzdGFydCIgKyBwYXRoICsgIiAiICsgZmlsZW5hbWUpOwogICAgICAgICAgICAgICAgLy9HTV9kb3dubG9hZChwYXRoLCAicGljIik7CiAgICAgICAgICAgICAgICBsZXQgc2F2ZUZpbGVOYW1lPWRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi50eWMtZmlsZS1uYW1lIikudmFsdWV8fCJwaWMiOwogICAgICAgICAgICAgICAgc2F2ZUFzKHBhdGgsc2F2ZUZpbGVOYW1lKTsKICAgICAgICAgICAgfSBlbHNlIGlmIChlLnRhcmdldC5jbGFzc0xpc3RbMV0gPT0gImJpLWFycm93cy1mdWxsc2NyZWVuIiB8fCBlUGF0aC5maW5kKGlzU2VsZWN0KSAhPSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgIGxldCBpbWdDb250YWluZXIgPSBlUGF0aC5maW5kKAogICAgICAgICAgICAgICAgICAgIChlbGUpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vY29uc29sZS5sb2coZWxlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbGUuY2xhc3NOYW1lLmluY2x1ZGVzKCJ0eWMtaW1nLWl0ZW0tY29udGFpbmVyIik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgY2F0Y2ggewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgbGV0IHBhdGggPSBpbWdDb250YWluZXIuZ2V0RWxlbWVudHNCeVRhZ05hbWUoImltZyIpWzBdLnNyYzsKCiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGxldCBjb250YWluZXIgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIuc2hvdy1iaWctaW1hZ2UiKTsKICAgICAgICAgICAgICAgICAgICBpZiAoY29udGFpbmVyLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJpbWciKVswXS5zcmMgPT09IHBhdGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29udGFpbmVyLnJlbW92ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29udGFpbmVyLnJlbW92ZSgpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGNhdGNoIHsKCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkb2N1bWVudC5ib2R5Lmluc2VydEFkamFjZW50SFRNTCgiYmVmb3JlZW5kIiwgc2hvd0JpZ0ltYWdlKTsKCiAgICAgICAgICAgICAgICBsZXQgc2hvd0l0ZW0gPSBgPGltZyBzcmM9IiR7cGF0aH0iLz5gCgogICAgICAgICAgICAgICAgZG9jdW1lbnQucXVlcnlTZ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JpZy1pbWFnZSIpLnN0eWxlLndpZHRoPXdpbmRvdy5pbm5lcldpZHRoKyJweCI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmKHRlbXBJbWcuaGVpZ2h0PndpbmRvdy5pbm5lckhlaWdodCl7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi5zaG93LWJpZy1pbWFnZSIpLnN0eWxlLnRvcD0iMHB4IjsKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLnNob3ctYmlnLWltYWdlIikuc3R5bGUuaGVpZ2h0PXdpbmRvdy5pbm5lckhlaWdodCsicHgiOwogICAgICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIuYnRuLWNsb3NlIikub25jbGljayA9IChlKSA9PiB7CiAgICAgICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi50eWMtaW1hZ2UtY29udGFpbmVyIikucmVtb3ZlKCk7CiAgICAgICAgfQoKICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIuYnRuLWRvd25sb2FkIikub25jbGljayA9IGFzeW5jIChlKSA9PiB7CiAgICAgICAgICAgIGlmIChpbWdXYWl0RG93bmxvYWQubGVuZ3RoID49IDEpIHsKICAgICAgICAgICAgICAgIC8vY29uc29sZS5sb2coaW1nV2FpdERvd25sb2FkKTsKLyogICAgICAgICAgICAgICAgIGltZ1dhaXREb3dubG9hZC5mb3JFYWNoKGFzeW5jIChpbWcsIGluZGV4KSA9PiB7CiAgICAgICAgICAgICAgICAgICAgLy9sZXQgZmlsZW5hbWUgPSBgcGljLSR7aW5kZXh9LmpwZ2A7CiAgICAgICAgICAgICAgICAgICAgLy9maWxlbmFtZT1maWxlbmFtZS5yZXBsYWNlKC9cXC9nLCAnLycpLnJlcGxhY2UoL1wvezIsfS9nLCAnLycpOwogICAgICAgICAgICAgICAgICAgIC8vYXdhaXQgR01fZG93bmxvYWQoaW1nLCBgcGljLSR7aW5kZXh9YCk7CgogICAgICAgICAgICAgICAgfSk7ICovCiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzbGVlcCgpewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSxyZWplY3QpPT57CiAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgxKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgMjAwKTsKICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZm9yKGxldCBpPTA7aTxpbWdXYWl0RG93bmxvYWQubGVuZ3RoO2krKyl7CiAgICAgICAgICAgICAgICAgICAgYXdhaXQgc2xlZXAoKTsKICAgICAgICAgICAgICAgICAgICBsZXQgc2F2ZUZpbGVOYW1lPWRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi50eWMtZmlsZS1uYW1lIikudmFsdWV8fCJwaWMiOwogICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGAke3NhdmVGaWxlTmFtZX0tJHtpfWApOwogICAgICAgICAgICAgICAgICAgIHNhdmVBcyhpbWdXYWl0RG93bmxvYWRbaV0sYCR7c2F2ZUZpbGVOYW1lfS0ke2l9YCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBhbGVydChgJHtsYW5nU2V0LnNlbGVjdEFsZXJ0fWApOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIuYnRuLXppcERvd25sb2FkIikub25jbGljayA9IChlKSA9PiB7CiAgICAgICAgICAgIC8vY29uc29sZS5sb2coemlwSW1nV2FpdERvd25sb2FkKTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIGlmICh6aXBJbWdXYWl0RG93bmxvYWQubGVuZ3RoID49IDEpIHsKICAgICAgICAgICAgICAgICAgICAvL2NvbnNvbGUubG9nKHppcEltZ1dhaXREb3dubG9hZCk7CiAgICAgICAgICAgICAgICAgICAgemlwSW1nV2FpdERvd25sb2FkLmZvckVhY2goYXN5bmMgKGltZywgaW5kZXgpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGZpbGVFeHQgPSBpbWcuc3Vic3RyaW5nKGltZy5pbmRleE9mKCJpbWFnZS8iKSArIDYsIGltZy5pbmRleE9mKCI7IikpCiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVFeHQ9ZmlsZUV4dC5pbmNsdWRlcygic3ZnIik/InN2ZyI6ZmlsZUV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHNhdmVGaWxlTmFtZT1kb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIudHljLWZpbGUtbmFtZSIpLnZhbHVlfHwicGljIjsKICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGZpbGVuYW1lID0gYCR7c2F2ZUZpbGVOYW1lfS0ke2luZGV4fS4ke2ZpbGVFeHR9YDsKICAgICAgICAgICAgICAgICAgICAgICAgemlwU3ViRm9sZXIuZmlsZShmaWxlbmFtZSwgaW1nLnNwbGl0KCIsIilbMV0sIHsgYmFzZTY0OiB0cnVlIH0pOwogICAgICAgICAgICAgICAgICAgIH0pOwoKICAgICAgICAgICAgICAgICAgICB6aXBGb2xkZXIuZ2VuZXJhdGVBc3luYyh7IHR5cGU6ICJibG9iIiB9KQogICAgICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbiAoY29udGVudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2VlIEZpbGVTYXZlci5qcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHNhdmVGaWxlTmFtZT1kb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIudHljLWZpbGUtbmFtZSIpLnZhbHVlfHwicGljIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVBcyhjb250ZW50LCBgJHtzYXZlRmlsZU5hbWV9cy56aXBgKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHppcEZvbGRlci5yZW1vdmUoInBpY3MiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHppcFN1YkZvbGVyID0gemlwRm9sZGVyLmZvbGRlcigncGljcycpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKCiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGFsZXJ0KGAke2xhbmdTZXQuc2VsZWN0QWxlcnR9YCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gY2F0Y2ggKGVycm9yKSB7CiAgICAgICAgICAgICAgICAvL2NvbnNvbGUubG9nKGVycm9yKTsKICAgICAgICAgICAgfQoKCiAgICAgICAgfQoKICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIudHljLWNvcnMiKS5vbm1vdXNlb3Zlcj1lPT57CiAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKTsKICAgICAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLnR5Yy10aXAiKS5zdHlsZS5kaXNwbGF5PSJibG9jayI7CiAgICAgICAgfQoKICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIudHljLWNvcnMiKS5vbm1vdXNlb3V0PWU9PnsKICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpOwogICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIudHljLXRpcCIpLnN0eWxlLmRpc3BsYXk9Im5vbmUiOwogICAgICAgIH0KCiAgICAgICAgZG9jdW1lbnQuYm9keS5vbmNoYW5nZSA9IChlKSA9PiB7CiAgICAgICAgICAgIGlmIChlLnRhcmdldC5jbGFzc05hbWUuaW5jbHVkZXMoIndpZHRoLWNoZWNrIikpIHsKICAgICAgICAgICAgICAgIEdNX3NldFZhbHVlKCd3aWR0aC1jaGVjaycsIGUudGFyZ2V0LmNoZWNrZWQpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChlLnRhcmdldC5jbGFzc05hbWUuaW5jbHVkZXMoImhlaWdodC1jaGVjayIpKSB7CiAgICAgICAgICAgICAgICBHTV9zZXRWYWx1ZSgnaGVpZ2h0LWNoZWNrJywgZS50YXJnZXQuY2hlY2tlZCk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGlmIChlLnRhcmdldC5jbGFzc05hbWUuaW5jbHVkZXMoImNvcnMtY2hlY2siKSkgewogICAgICAgICAgICAgICAgR01fc2V0VmFsdWUoJ2NvcnMtY2hlY2snLCBlLnRhcmdldC5jaGVja2VkKTsKICAgICAgICAgICAgICAgIGlmIChkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIuY29ycy1jaGVjayIpLmNoZWNrZWQpIHsKICAgICAgICAgICAgICAgICAgICBmZXRjaEJhc2U2NEltZ3NUaGVuUHVzaFRvWmlwQXJyYXkoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQoKICAgICAgICAgICAgaWYoZS50YXJnZXQuY2xhc3NOYW1lLmluY2x1ZGVzKCJ0eWMtZGVmYXVsdC1hY3RpdmUiKSl7CiAgICAgICAgICAgICAgICBhdXRvQmlnSW1hZ2Uub25jaGVja0NoYW5nZSgpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBpZihlLnRhcmdldC5jbGFzc05hbWUuaW5jbHVkZXMoInR5Yy1jdXN0b20tYWN0aXZlIikpewogICAgICAgICAgICAgICAgYXV0b0JpZ0ltYWdlLm9uY2hlY2tDaGFuZ2VDdXN0b20oKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgaWYgKGUudGFyZ2V0Lm5vZGVOYW1lID09PSAiSU5QVVQiICYmIGUudGFyZ2V0LnR5cGUgPT09ICJ0ZXh0IiAmJiBlLnRhcmdldC5jbGFzc05hbWUuaW5jbHVkZXMoInZhbHVlIikpIHsKICAgICAgICAgICAgICAgIEdNX3NldFZhbHVlKGUudGFyZ2V0LmNsYXNzTmFtZSwgZS50YXJnZXQudmFsdWUpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBpZiAoZS50YXJnZXQubm9kZU5hbWUgPT09ICJJTlBVVCIgJiYgZS50YXJnZXQudHlwZSA9PT0gInRleHQiICYmIGUudGFyZ2V0LmNsYXNzTmFtZS5pbmNsdWRlcygic2hvcnRDdXRTdHJpbmciKSkgewogICAgICAgICAgICAgICAgR01fc2V0VmFsdWUoZS50YXJnZXQuY2xhc3NOYW1lLCBlLnRhcmdldC52YWx1ZSk7CiAgICAgICAgICAgICAgICBob3RrZXlzKGUudGFyZ2V0LnZhbHVlLCB3cmFwcGVyKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgKGUudGFyZ2V0LmNsYXNzTmFtZS5pbmNsdWRlcygid2lkdGgtY2hlY2siKSB8fCBlLnRhcmdldC5jbGFzc05hbWUuaW5jbHVkZXMoImhlaWdodC1jaGVjayIpIHx8CgogICAgICAgICAgICAgICAgKGUudGFyZ2V0Lm5vZGVOYW1lID09PSAiSU5QVVQiICYmIGUudGFyZ2V0LnR5cGUgPT09ICJ0ZXh0IiAmJiBlLnRhcmdldC5jbGFzc05hbWUuaW5jbHVkZXMoInZhbHVlIikpKQogICAgICAgICAgICAgICAgJiYgKGNsZWFuKCksIGluaXQoKSk7CgogICAgICAgIH0KCiAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLnNlbGVjdC1hbGwiKS5vbmNoYW5nZSA9IChlKSA9PiB7CiAgICAgICAgICAgIGlmIChkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIuc2VsZWN0LWFsbCIpLmNoZWNrZWQpIHsKICAgICAgICAgICAgICAgIGltZ1dh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UTUwgPSAiIjsKICAgICAgICB9CgogICAgICAgIGZ1bmN0aW9uIGlzRG93bmxvYWQoZWxlKSB7CiAgICAgICAgICAgIHJldHVybiBlbGUuY2xhc3NOYW1lID09ICJkb3dubG9hZC1kaXJlY3QiOwogICAgICAgIH0KCiAgICAgICAgZnVuY3Rpb24gaXNTZWxlY3QoZWxlKSB7CiAgICAgICAgICAgIHJldHVybiBlbGUuY2xhc3NOYW1lID09ICJmdWxsc2NyZWVuLWltYWdlIjsKICAgICAgICB9CgogICAgICAgIGZ1bmN0aW9uIHRyYW5zSW5kZXhUb0xpbmsoV2hvbGVJbWdzLHNlbGVjdGVkSW1ncykgewogICAgICAgICAgICBsZXQgdHJhbnNlZEltZ3M9W107CiAgICAgICAgICAgIHNlbGVjdGVkSW1ncy5mb3JFYWNoKChpbWdJbmRleCwgaW5kZXgpID0+IHsKICAgICAgICAgICAgICAgIHRyYW5zZWRJbWdzLnB1c2goV2hvbGVJbWdzW2ltZ0luZGV4XSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICByZXR1cm4gdHJhbnNlZEltZ3M7CiAgICAgICAgfQoKICAgICAgICBmdW5jdGlvbiBzaG93SW1hZ2UoZmlsdGVkSW1nVXJscykgewogICAgICAgICAgICBmaWx0ZWRJbWdVcmxzLmZvckVhY2goKGltZywgaW5kZXgpID0+IHsKICAgICAgICAgICAgICAgIGlmICh3aW5kb3cubG9jYXRpb24uaHJlZi5pbmNsdWRlcygiaHVhYmFuLmNvbSIpKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGltZy5pbmNsdWRlcygiL3dlYnAiKSkgewogICAgICAgICAgICAgICAgICAgICAgICBpbWcgPSBpbWcucmVwbGFjZSgvXC93ZWJwL2csICIvcG5nIik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgbGV0IGluc2VydEltZyA9IGA8ZGl2IGNsYXNzPSJ0eWMtaW1nLWl0ZW0tY29udGFpbmVyL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3JlZW5kIiwgZG93bkFuZEZ1bGxCdG4pOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChyZWN0V2lkdGggPD0gMTIwICYmIHJlY3RXaWR0aCA+PSA1MCkgewogICAgICAgICAgICAgICAgICAgIHRoaXNJbWdJbmZvQ29udGFpbmVyLmluc2VydEFkamFjZW50SFRNTCgiYmVmb3JlZW5kIiwgZG93bkFuZEZ1bGxCdG4pOwogICAgICAgICAgICAgICAgICAgIHRoaXNJbWdJbmZvQ29udGFpbmVyLmdldEVsZW1lbnRzQnlDbGFzc05hbWUoImZ1bGxzY3JlZW4taW1hZ2UiKVswXS5zdHlsZS5yaWdodCA9ICI1MCUiOwogICAgICAgICAgICAgICAgICAgIHRoaXNJbWdJbmZvQ29udGFpbmVyLmdldEVsZW1lbnRzQnlDbGFzc05hbWUoImRvd25sb2FkLWRpcmVjdCIpWzBdLnN0eWxlLnJpZ2h0ID0gImNhbGMoNTAlIC0gMzBweCkiOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB0aGlzSW1nSW5mb0NvbnRhaW5lci5pbnNlcnRBZGphY2VudEhUTUwoImJlZm9yZWVuZCIsIGRvd25sb2FkQnRuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC8vLy9jb25zb2xlLmxvZyhpbWcpOwogICAgICAgICAgICB9KTsKICAgICAgICB9CgogICAgICAgIGZ1bmN0aW9uIGZpbHRlckJ5V2lkdGgoc3JjKSB7CiAgICAgICAgICAgIGxldCB0ZW1wSW1nID0gbmV3IEltYWdlKCk7CiAgICAgICAgICAgIHRlbXBJbWcuc3JjID0gc3JjOwogICAgICAgICAgICBpZiAodGVtcEltZy53aWR0aCA+PSBwYXJzZUludChkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIud2lkdGgtdmFsdWUtbWluIikudmFsdWUpCiAgICAgICAgICAgICAgICAmJiB0ZW1wSW1nLndpZHRoIDw9IHBhcnNlSW50KGRvY3VtZW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sdWUgPSBHTV9nZXRWYWx1ZSgic2hvcnRDdXRTdHJpbmciKSk7CiAgICAgICAgfQoKICAgICAgICBmdW5jdGlvbiBmZXRjaEJhc2U2NEltZ3NUaGVuUHVzaFRvWmlwQXJyYXkoKSB7CiAgICAgICAgICAgIHppcEZpbHRlcmVkSW1nVXJscy5mb3JFYWNoKChpbWdVcmwsIHVybEluZGV4KSA9PiB7CiAgICAgICAgICAgICAgICBpZiAoaW1nVXJsLmluY2x1ZGVzKCJkYXRhOmltYWdlIikpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9CgovKiAgICAgICAgICAgICAgICAgZmV0Y2goaW1nVXJsLHsKICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICJnZXQiLAogICAgICAgICAgICAgICAgICAgIG1vZGU6ICdjb3JzJwogICAgICAgICAgICAgICAgfSkudGhlbihyZXNwb25zZT0+ewogICAgICAgICAgICAgICAgICAgIGlmICghcmVzcG9uc2Uub2spIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdOZXR3b3JrIHJlc3BvbnNlIHdhcyBub3QgT0snKTsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXNwb25zZS5ibG9iKCk7CiAgICAgICAgICAgICAgICAgICAgfSkudGhlbihteUJsb2I9PnsKICAgICAgICAgICAgICAgICAgICB2YXIgYmxvYiA9IG15QmxvYgogICAgICAgICAgICAgICAgICAgICAgICBsZXQgb0ZpbGVSZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpOwogICAgICAgICAgICAgICAgICAgICAgICBvRmlsZVJlYWRlci5vbmxvYWRlbmQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGJhc2U2NCA9IGUudGFyZ2V0LnJlc3VsdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vY29uc29sZS5sb2coIuOAi+OAiyIsIGJhc2U2NCkKCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYmFzZTY0LmluY2x1ZGVzKCJkYXRhOmltYWdlIikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6aXBGaWx0ZXJlZEltZ1VybHNbdXJsSW5kZXhdID0gYmFzZTY0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vemlwSW1nV2FpdERvd25sb2FkLnB1c2goYmFzZTY0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgb0ZpbGVSZWFkZXIucmVhZEFzRGF0YVVSTChibG9iKTsKICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yKT0+eyAqLwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBsZXQgaG9zdD13aW5kb3cubG9jYXRpb24ub3JpZ2luKyIvIjsKICAgICAgICAgICAgICAgICAgICBHTV94bWxodHRwUmVxdWVzdCh7CiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogImdldCIsCiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogaW1nVXJsLAogICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7cmVmZXJlcjogaG9zdH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlVHlwZTogImJsb2IiLAogICAgICAgICAgICAgICAgICAgICAgICBvbmxvYWQ6IGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYmxvYiA9IHIucmVzcG9uc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgb0ZpbGVSZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb0ZpbGVSZWFkZXIub25sb2FkZW5kID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgYmFzZTY0ID0gZS50YXJnZXQucmVzdWx0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiYXNlNjQuc3RhcnRzV2l0aCgiZGF0YTppbWFnZSIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHppcEZpbHRlcmVkSW1nVXJsc1t1cmxJbmRleF0gPSBiYXNlNjQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vemlwSW1nV2FpdERvd25sb2FkLnB1c2goYmFzZTY0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb0ZpbGVSZWFkZXIucmVhZEFzRGF0YVVSTChibG9iKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHsKCiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgLy99KQogICAgICAgICAgICB9KQogICAgICAgIH0KCiAgICAgICAgZnVuY3Rpb24gY3V0b2ZmTm90QmFzZTY0SW1nKGltZ3NVcmxBcnJheSkgewogICAgICAgICAgICBsZXQgcmVzdWx0QXJyID0gW107CiAgICAgICAgICAgIGltZ3NVcmxBcnJheS5mb3JFYWNoKChpbWdVcmwsIHVybEluZGV4KSA9PiB7CiAgICAgICAgICAgICAgICBpZiAoaW1nVXJsLnN0YXJ0c1dpdGgoImRhdGE6aW1hZ2UiKSYmaW1nVXJsLmluY2x1ZGVzKCJiYXNlNjQiKSkgewogICAgICAgICAgICAgICAgICAgIHJlc3VsdEFyci5wdXNoKGltZ1VybCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgKTsKICAgICAgICAgICAgcmV0dXJuIHJlc3VsdEFycjsKICAgICAgICB9CiAgICAvL+S4i+mdoui/meS4quaLrOWPt+aYr3dyYXBwZXLnmoTmi6zlj7cKICAgIH0KfSkoKTs=
Add Comment
Please, Sign In to add comment