Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:网页插件¥js_url¥global_海角社区免费版@base64://Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgICAgICDmtbfop5LnpL7ljLrlhY3otLnniYgKLy8gQG5hbWVzcGFjZSAgICBodHRwOi8vdGFtcGVybW9ua2V5Lm5ldC8KLy8gQHZlcnNpb24gICAgICAwLjEuMgovLyBAZGVzY3JpcHRpb24gIOWPr+S7peWFjei0ueingueci+a1t+inkuekvuWMuumSu+efs+WSjOmHkeW4geS7mOi0ueW4luWtkOOAgXZpcOW4luWtkO+8jOWMheaLrOinhumikeOAgeWbvueJh+OAgemfs+mikeOAggovLyBAYXV0aG9yICAgICAgIEphbVRvZGF5Ci8vIEBtYXRjaCAgICAgICAgaHR0cHM6Ly8qLmhhaWppYW8uY29tLyoKLy8gQGluY2x1ZGUgICAgICAqOi8vaGoqLiovKgovLyBAaW5jbHVkZSAgICAgICo6Ly8qLmhqKi4qLyoKLy8gQGluY2x1ZGUgICAgICAqOi8vKi5oYWkqLiovKgovLyBAaW5jbHVkZSAgICAgICo6Ly9oYWkqLiovKgovLyBAaW5jbHVkZSAgICAgICo6Ly9oaiovKgovLyBAaW5jbHVkZSAgICAgICo6Ly8qLmhqKi8qCi8vIEBpbmNsdWRlICAgICAgKi9wb3N0L2RldGFpbHMvKgovLyBAbWF0Y2ggICAgICAgICo6Ly8qL3Bvc3QvZGV0YWlscyoKLy8gQGV4Y2x1ZGUgICAgICAqOi8vaGphaSovKgovLyBAZXhjbHVkZSAgICAgICo6Ly9oYWlqaWFvLmFpLyoKLy8gQGV4Y2x1ZGUgICAgICAqOi8vaGFpamlhby5wcm8vKgovLyBAZXhjbHVkZSAgICAgICo6Ly8qLmtpdHR5bWFvLnh5ei8qCi8vIEBleGNsdWRlICAgICAgaHR0cHM6Ly9oamZiLm9yZy8qCi8vIEBleGNsdWRlICAgICAgKjovL3Rvb2wubGl1bWluZ3ll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uYXBwZW5kQ2hpbGQoYXBwZW5kRGl2KTsKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0KICAgICAgfSwKICAgIH0pOwogICAgZnVuY3Rpb24ga2l0dHlfc2V0Q29va2llKGNuYW1lLCBjdmFsdWUsIGV4ZGF5cykgewogICAgICB2YXIgZCA9IG5ldyBEYXRlKCk7CiAgICAgIGQuc2V0VGltZShkLmdldFRpbWUoKSArIGV4ZGF5cyAqIDI0ICogNjAgKiA2MCAqIDEwMDApOwogICAgICB2YXIgZXhwaXJlcyA9ICJleHBpcmVzPSIgKyBkLnRvR01UU3RyaW5nKCk7CiAgICAgIGRvY3VtZW50LmNvb2tpZSA9IGNuYW1lICsgIj0iICsgY3ZhbHVlICsgIjsgIiArIGV4cGlyZXM7CiAgICB9CiAgICBmdW5jdGlvbiBraXR0eV9pbnNlcnRTdHlsZSgpIHsKICAgICAgbGV0IHN0eWxlID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic3R5bGUiKTsKICAgICAgc3R5bGUuaW5uZXJIVE1MID0gYAogICAgICAgICAgICAgICAgLyog5pW05L2TLXN0YXJ0ICovCiAgICAgICAgICAgICAgICAja2l0dHlfdmlwUGFuZWwgewogICAgICAgICAgICAgICAgICAgIHdpZHRoOiAzMTBweDsKICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IDUwMHB4OwogICAgICAgICAgICAgICAgICAgIGJveC1zaGFkb3c6IDAgMCAwIDFweCByZ2IoMCAwIDAgLyA1JSksIDAgMnB4IDRweCAxcHggcmdiKDAgMCAwIC8gOSUpOwogICAgICAgICAgICAgICAgICAgIGJvcmRlci1sZWZ0OiAxcHggc29saWQgdHJhbnNwYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgYm9yZGVyLXJpZ2h0OiBub25lOwogICAgICAgICAgICAgICAgICAgIGJvcmRlci10b3A6IDFweCBzb2xpZCB0cmFuc3BhcmVudDsKICAgICAgICAgICAgICAgICAgICBib3JkZXItYm90dG9tOiAxcHggc29saWQgdHJhbnNwYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogI0ZGRkZGRjsKICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbjogZml4ZWQ7CiAgICAgICAgICAgICAgICAgICAgbGVmdDogNnB4OwogICAgICAgICAgICAgICAgICAgIGJvdHRvbTogNnB4OwogICAgICAgICAgICAgICAgICAgIHotaW5kZXg6IDk5OTk5OwogICAgICAgICAgICAgICAgICAgIGZvbnQtc2l6ZTogMTZweDsKICAgICAgICAgICAgICAgICAgICAtLXNjcmlwdC1wYW5lbC1tYWluLWNvbG9yOiAjNDE3OGIwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgI2tpdHR5X3ZpcFBhbmVsIGEgewogICAgICAgICAgICAgICAgICAgIHRleHQtZGVjb3JhdGlvbjogdW5kZXJsaW5lOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgLmtpdHR5X3BhbmVsTWFpbiB7CiAgICAgICAgICAgICAgICAgICAgZm9udC1zaXplOiAwLjg1ZW07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAua2l0dHlfaGlkZGVuUGFuZWwgewogICAgICAgICAgICAgICAgICAgIGxlZnQ6IC0zMTBweCAhaW1wb3J0YW50OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgLyog5pW05L2TLWVuZCAqLwogICAgICAgICAgICAgICAgLyogcGFuZWxIZWFkLXN0YXJ0ICovCiAgICAgICAgICAgICAgICAua2l0dHlfcGFuZWxIZWFkIHsKICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiBmbGV4OwogICAgICAgICAgICAgICAgICAgIGJvcmRlci1ib3R0b206IDFweCBzb2xpZCAjZWNlY2VjOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgLmtpdHR5X3BhbmVsSGVhZD5kaXYgewogICAgICAgICAgICAgICAgICAgIGNvbG9yOiAjNDQ0OwogICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IDAgMTBweDsKICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IDQwcHg7CiAgICAgICAgICAgICAgICAgICAgbGluZS1oZWlnaHQ6IDQwcHg7CiAgICAgICAgICAgICAgICAgICAgYm94LXNpemluZzogYm9yZGVyLWJveDsKICAgICAgICAgICAgICAgICAgICB1c2VyLXNlbGVjdDogbm9uZTsKICAgICAgICAgICAgICAgICAgICB0ZXh0LWFsaWduOiBjZW50ZXI7CiAgICAgICAgICAgICAgICAgICAgd2lkdGg6IDc2cHg7CiAgICAgICAgICAgICAgICAgICAgZm9udC1zaXplOiAxZW07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAua2l0dHlfcGFuZWxIZWFkPmRpdjpub3QoLmtpdHR5X2hlYWREaXZBY3RpdmUpOmhvdmVyIHsKICAgICAgICAgICAgICAgICAgICBib3JkZXItYm90dG9tOiAzcHggc29saWQgI2NjYzsKICAgICAgICAgICAgICAgICAgICBjdXJzb3I6IHBvaW50ZXI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAua2l0dHlfaGVhZERpdkFjdGl2ZSB7CiAgICAgICAgICAgICAgICAgICAgYm9yZGVyLWJvdHRvbTogM3B4IHNvbGlkIHZhcigtLXNjcmlwdC1wYW5lbC1tYWluLWNvbG9yKTsKICAgICAgICAgICAgICAgICAgICBjb2xvcjogIzQ0NDsKICAgICAgICAgICAgICAgICAgICBmb250LXdlaWdodDogYm9sZDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC8qIHBhbmVsSGVhZC1lbmQgKi8KICAgICAgICAgICAgICAgIC8qIOeVjOmdouaYvuekuuaMiemSriAqLwogICAgICAgICAgICAgICAgLmtpdHR5X3Nob3dQYW5lbEJ0biwgLmtpdHR5X2ppZXhpQnRuIHsKICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7CiAgICAgICAgICAgICAgICAgICAgbGVmdDogMzIwcHg7CiAgICAgICAgICAgICAgICAgICAgdG9wOiAxNTBweDsKICAgICAgICAgICAgICAgICAgICB3aWR0aDogNTBweDsKICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IDUwcHg7CiAgICAgICAgICAgICAgICAgICAgbGluZS1oZWlnaHQ6IDUwcHg7CiAgICAgICAgICAgICAgICAgICAgY29sb3I6IHZhcigtLXNjcmlwdC1wYW5lbC1tYWluLWNvbG9yKTsKICAgICAgICAgICAgICAgICAgICB1c2VyLXNlbGVjdDogbm9uZTsKICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjRkZGRkZGOwogICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTsKICAgICAgICAgICAgICAgICAgICBib3R0b206IDIwcHg7CiAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogbm9uZTsKICAgICAgICAgICAgICAgICAgICBjdXJzb3I6IHBvaW50ZXI7CiAgICAgICAgICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogNTBweDsKICAgICAgICAgICAgICAgICAgICB0ZXh0LWFsaWduOiBjZW50ZXI7CiAgICAgICAgICAgICAgICAgICAgYm94LXNoYWRvdzowIDAgMCAxcHggcmdiKDAgMCAwIC8gNSUpLCAwIDJweCA0cHggMXB4IHJnYigwIDAgMCAvIDklKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC5raXR0eV9qaWV4aUJ0biB7CiAgICAgICAgICAgICAgICAgIHRvcDogODVweDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC8qIOi6q+S9kyAqLwogICAgICAgICAgICAgICAgLmtpdHR5X3BhbmVsQm9keSAgewogICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IDAgMTBweDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC5raXR0eV9wYW5lbEJvZHkgcCB7CiAgICAgICAgICAgICAgICAgICAgbWFyZ2luOiAxMHB4IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAvKiDovpPlhaXmoYYtc3RhcnQgKi8KICAgICAgICAgICAgICAgIC5raXR0eV9zZWFyY2hJbnB1dCB7CiAgICAgICAgICAgICAgICAgICAgd2lkdGg6IDk4JTsKICAgICAgICAgICAgICAgICAgICBib3JkZXItcmFkaXVzOiAyNHB4OwogICAgICAgICAgICAgICAgICAgIGJveC1zaGFkb3c6IDAgMCAwIDFweCByZ2IoMCAwIDAgLyA1JSksIDAgMnB4IDRweCAxcHggcmdiKDAgMCAwIC8gOSUpOwogICAgICAgICAgICAgICAgICAgIGhlaWdodDogNDBweDsKICAgICAgICAgICAgICAgICAgICBib3JkZXItbGVmdDogMXB4IHNvbGlkIHRyYW5zcGFyZW50OwogICAgICAgICAgICAgICAgICAgIGJvcmRlci1yaWdodDogbm9uZTsKICAgICAgICAgICAgICAgICAgICBib3JkZXItdG9wOiAxcHggc29saWQgdHJhbnNwYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkIHRyYW5zcGFyZW50OwogICAgICAgICAgICAgICAgICAgIG92ZXJmbG93OiBoaWRkZW47CiAgICAgICAgICAgICAgICAgICAgbWFyZ2luOiAwIGF1dG87CiAgICAgICAgICAgICAgICAgICAgbWFyZ2luLXRvcDogNDBweDsKICAgICAgICAgICAgICAgICAgICBtYXJnaW4tYm90dG9tOiA1MHB4OwogICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAua2l0dHlfc2VhcmNoSW5wdXQ6aG92ZXIgewogICAgICAgICAgICAgICAgICAgIGJvcmRlci10b3AtbGVmdC1yYWRpdXM6IDI0cHg7CiAgICAgICAgICAgICAgICAgICAgYm94LXNoYWRvdzogMCAwIDAgMXB4IHJnYigwIDAgMCAvIDEwJSksIDAgMnB4IDRweCAxcHggcmdiKDAgMCAwIC8gMTglKTsKICAgICAgICAgICAgICAgICAgICBib3JkZXItbGVmdDogMXB4IHNvbGlkIHRyYW5zcGFyZW50OwogICAgICAgICAgICAgICAgICAgIGJvcmRlci1yaWdodDogbm9uZTsKICAgICAgICAgICAgICAgICAgICBib3JkZXItdG9wOiAxcHggc29saWQgdHJhbnNwYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkIHRyYW5zcGFyZW50OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgLmtpdHR5X3NlYXJjaElucHV0IGlucHV0IHsKICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IDEwMCU7CiAgICAgICAgICAgICAgICAgICAgYm9yZGVyOiAwOwogICAgICAgICAgICAgICAgICAgIG91dGxpbmU6IDA7CiAgICAgICAgICAgICAgICAgICAgcGFkZGluZzogMCAxMHB4OwogICAgICAgICAgICAgICAgICAgIGNvbG9yOiBibGFjazsKICAgICAgICAgICAgICAgICAgICB3aWR0aDogMTAwJTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC8qIOi+k+WFpeahhi1lbmQgKi8KICAgICAgICAgICAgICAgIC8qIGdv5oyJ6ZKuLXN0YXJ0ICovCiAgICAgICAgICAgICAgICAua2l0dHlfZ29Ub1ZpcEJ0biB7CiAgICAgICAgICAgICAgICAgICAgY29sb3I6ICNGRkZGRkY7CiAgICAgICAgICAgICAgICAgICAgZm9udC13ZWlnaHQ6IGJvbGQ7CiAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogdmFyKC0tc2NyaXB0LXBhbmVsLW1haW4tY29sb3IpOwogICAgICAgICAgICAgICAgICAgIGhlaWdodDogMTAwcHg7CiAgICAgICAgICAgICAgICAgICAgd2lkdGg6IDEwMHB4OwogICAgICAgICAgICAgICAgICAgIGJvcmRlci1yYWRpdXM6IDUwcHg7CiAgICAgICAgICAgICAgICAgICAgdGV4dC1hbGlnbjogY2VudGVyOwogICAgICAgICAgICAgICAgICAgIGxpbmUtaGVpZ2h0OiAxMDBweDsKICAgICAgICAgICAgICAgICAgICBtYXJnaW46IDIwcHggYXV0bzsKICAgICAgICAgICAgICAgICAgICBib3gtc2hhZG93OiAwIDAgMCAxcHggcmdiKDAgMCAwIC8gNSUpLCAwIDJweCA0cHggMXB4IHJnYigwIDAgMCAvIDklKTsKICAgICAgICAgICAgICAgICAgICB1c2VyLXNlbGVjdDogbm9uZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC5raXR0eV9nb1RvVmlwQnRuOmhvdmVyIHsKICAgICAgICAgICAgICAgICAgICBjdXJzb3I6IHBvaW50ZXI7CiAgICAgICAgICAgICAgICAgICAgYm94LXNoYWRvdzogMCAwIDAgMCByZ2IoMCAwIDAgLyA1JSksIDAgMnB4IDRweCAxcHggcmdiKDAgMCAwIC8gMTglKTsKICAgICAgICAgICAgICAgICAgICAtd2Via2l0LWJveC1zaGFkb3c6IDAgMCAwIDAgcmdiKDAgMCAwIC8gNSUpLCAwIDJweCA0cHggMXB4IHJnYigwIDAgMCAvIDE4JSk7CiAgICAgICAgICAgICAgICAgICAgLW1vei1ib3gtc2hhZG93OiAwIDAgMCAwIHJnYmEoMCwwLDAsLjA1KSwwIDJweCA0cHggMXB4IHJnYmEoMCwwLDAsLjE4KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC8qIOWKqOeUuyAqLwogICAgICAgICAgICAgICAgQGtleWZyYW1lcyBraXR0eV9mbG9hdCB7CiAgICAgICAgICAgICAgICAgICAgMCUgewogICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoMHB4KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgNSUgewogICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoLTEwcHgpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAxMCUsMTAwJSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwcHgpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgIAogICAgICAgICAgICAgICAgLmtpdHR5X25hdnkgewogICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICAgICAgICAgIH0KICAgIAogICAgICAgICAgICAgICAgLmtpdHR5X25hdnkgc3BhbiB7CiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlOwogICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6IGlubGluZS1ibG9jazsKICAgICAgICAgICAgICAgICAgICBjb2xvcjogd2hpdGU7CiAgICAgICAgICAgICAgICAgICAgYW5pbWF0aW9uOiBraXR0eV9mbG9hdCA5cyBlYXNlLWluLW91dCBpbmZpbml0ZTsKICAgICAgICAgICAgICAgICAgICBhbmltYXRpb24tZGVsYXk6IDJzOwogICAgICAgICAgICAgICAgICAgIGZvbnQtc2l6ZTogMS41ZW07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAvKiBnb+aMiemSri1lbmQgKi8KICAgICAgICAgICAgICAgIC5raXR0eV9sb2dPdXRwdXQgewogICAgICAgICAgICAgICAgICAgIGNvbG9yOiAjNzE3NzdkOwogICAgICAgICAgICAgICAgICAgIGZvbnQtc2l6ZTogMC45ZW07CiAgICAgICAgICAgICAgICAgICAgbWFyZ2luLXRvcDogMTBweDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC5raXR0eV9sb2dPdXRwdXQgZGl2IHsKICAgICAgICAgICAgICAgICAgICBtYXJnaW46IDA7CiAgICAgICAgICAgICAgICAgICAgcGFkZGluZzogMDsKICAgICAgICAgICAgICAgICAgICBsaW5lLWhlaWdodDogMS41OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgLmtpdHR5X2Rvd25sb2FkVGV4dCB7CiAgICAgICAgICAgICAgICAgICAgZm9udC1zaXplOiAyMHB4OwogICAgICAgICAgICAgICAgICAgIGZvbnQtd2VpZ2h0OiBib2xkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgLmtpdHR5X2Rvd25sb2FkVGV4dCBhIHsKICAgICAgICAgICAgICAgICAgICBjdXJzb3I6cG9pbnRlcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgYDsKICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiaGVhZCIpLmFwcGVuZENoaWxkKHN0eWxlKTsKICAgIH0KICAgIGZ1bmN0aW9uIGtpdHR5X2NyZWF0ZVBhbmVsKCkgewogICAgICBsZXQgcGFuZWwgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJkaXYiKTsKICAgICAgcGFuZWwuc2V0QXR0cmlidXRlKCJpZCIsICJraXR0eV92aXBQYW5lbCIpOwogICAgICBwYW5lbC5pbm5lckhUTUwgPSBgCiAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJraXR0eV9zaG93UGFuZWxCdG4iPuaYvuekujwvZGl2PgogICAgICAgICAgICAgICAgPGRpdiBjbGFzcz0ia2l0dHlfamlleGlCdG4iPuino+aekDwvZGl2PgogICAgICAgICAgICAgICAgPGRpdiBjbGFzcz0ia2l0dHlfcGFuZWxNYWluIj4KICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJraXR0eV9wYW5lbEhlYWQiPgogICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJraXR0eV9oZWFkRGl2QWN0aXZlIj7ov5DooYzml6Xlv5c8L2Rpdj4KICAgICAgICAgICAgICAgICAgICAgICAgPGRpdj7ph43opoHor7TmmI48L2Rpdj4KICAgICAgICAgICAgICAgICAgICAgICAgPGRpdj7kvb/nlKjmjIfljZc8L2Rpdj4KICAgICAgICAgICAgICAgICAgICA8L2Rpdj4KICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJra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AgICAgICAgICAgICAgICAgICAgIDxwPisg5pys6ISa5pys5a6M5YWo5YWN6LS5PC9wPgogICAgICAgICAgICAgICAgICAgICAgPHA+KyDmnKzohJrmnKzml6DmgbbmhI/ku6PnoIHmlL7lv4Pkvb/nlKg8L3A+CiAgICAgICAgICAgICAgICAgICAgICA8cD4rIOabtOWkmuiEmuacrOWPr+eciyA8YSB0YXJnZXQ9Il9ibGFuayIgaHJlZj0iaHR0cHM6Ly9kb2NzLmtpdHR5bWFvLnh5eiI+d3d3LmtpdHR5bWFvLnh5ejwvYT48L3A+CiAgICAgICAgICAgICAgICAgICAgICA8cD4rIOiEmuacrOS7heaUr+aMgeato+eJiOa1t+inkjwvcD4KICAgICAgICAgICAgICAgICAgICAgIDxwPisg5aaC5p6c6ISa5pys5Zyo6Z2e5q2j54mI5rW36KeS572R56uZ6L+Q6KGMLCDor7flhbPpl63ljbPlj688L3A+CiAgICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9ImtpdHR5X3BhbmVsQm9keSBraXR0eV9wYW5lbEJvZHlfMiIgc3R5bGU9ImRpc3BsYXk6bm9uZTsiPgogICAgICAgICAgICAgICAgICAgICAgICA8cD4rIOS9v+eUqOaWueazlee6v+i3rzE6IDxhIHRhcmdldD0iX2JsYW5rIiBocmVmPSJodHRwczovL3d3dy5raXR0eW1hby54eXoiPnd3dy5raXR0eW1hby54eXo8L2E+PC9wPgogICAgICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAgPC9kaXY+CiAgICAgICAgICAgIGA7CiAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQocGFuZWwpOwogICAgICBsZXQgaXNoaWRkZW4gPSBsb2NhbFN0b3JhZ2UuZ2V0SXRlbSgia2l0dHlfaXNIaWRkZW5QYW5lbCIpOwogICAgICBpZiAoaXNoaWRkZW4pIHsKICAgICAgICBpc2hpZGRlbiA9IEpTT04ucGFyc2UoaXNoaWRkZW4pOwogICAgICAgIGlmIChpc2hpZGRlbikgewogICAgICAgICAga2l0dHlfaGlkZGVuUGFuZWwoKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAga2l0dHlfc2hvd1BhbmVsKCk7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgIAogICAgZnVuY3Rpb24ga2l0dHlfZXZlbnRCaW5kKCkgewogICAgICBsZXQgdGFicyA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoIi5raXR0eV9wYW5lbEhlYWQ+ZGl2Iik7CiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgdGFicy5sZW5ndGg7IGkrKykgewogICAgICAgIHRhYnNbaV0uYWRkRXZlbnRMaXN0ZW5lcigiY2xpY2siLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICBmb3IgKGxldCBpaSA9IDA7IGlpIDwgdGFicy5sZW5ndGg7IGlpKyspIHsKICAgICAgICAgICAgdGFic1tpaV0uY2xhc3NOYW1lID0gIiI7CiAgICAgICAgICB9CiAgICAgICAgICB0YWJzW2ldLmNsYXNzTmFtZSA9ICJraXR0eV9oZWFkRGl2QWN0aXZlIjsKICAgICAgICAgIGtpdHR5X2NoYW5nZVRhYihpKTsKICAgICAgICB9KTsKICAgICAgfQogICAgICBkb2N1bWVudAogICAgICAgIC5xdWVyeVNlbGVjdG9yKCIua2l0dHlfaGlkZGVuUGFuZWxCdG4iKQogICAgICAgIC5hZGRFdmVudExpc3RlbmVyKCJjbGljayIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgIGtpdHR5X2hpZGRlblBhbmVsKCk7CiAgICAgICAgfSk7CiAgICAgIGRvY3VtZW50CiAgICAgICAgLnF1ZXJ5U2VsZWN0b3IoIi5raXR0eV9zaG93UGFuZWxCdG4iKQogICAgICAgIC5hZGRFdmVudExpc3RlbmVyKCJjbGljayIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgIGtpdHR5X3Nob3dQYW5lbCgpOwogICAgICAgIH0pOwogICAgICBkb2N1bWVudAogICAgICAgIC5xdWVyeVNlbGVjdG9yKCIua2l0dHlfamlleGlCdG4iKQogICAgICAgIC5hZGRFdmVudExpc3RlbmVyKCJjbGljayIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgIGlmIChsb2NhdGlvbi5ocmVmLmluY2x1ZGVzKCJwb3N0L2RldGFpbHM/cGlkIikpIHsKICAgICAgICAgICAgaWYgKGtpdHR5X2lzTG9naW4oKSkgewogICAgICAgICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi5raXR0eV9qaWV4aUJ0biIpLmlubmVySFRNTCA9ICLnqI3nrYkiOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi5raXR0eV9qaWV4aUJ0biIpLmlubmVySFRNTCA9ICLmmoLml6AiOwogICAgICAgICAgICAgIGtpdHR5X2NoZWNrTG9naW4oKTsKICAgICAgICAgICAgICBraXR0eV9zaG93UGFuZWwoKTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLmtpdHR5X2ppZXhpQnRuIikuaW5uZXJIVE1MID0gIuaaguaXoCI7CiAgICAgICAgICB9CiAgICAgICAgfSk7CiAgICB9CiAgIAogICAgZnVuY3Rpb24ga2l0dHlfY2hhbmdlVGFiKGluZGV4KSB7CiAgICAgIGtpdHR5X3RhYkluZGV4ID0gaW5kZXg7CiAgICAgIGxldCBwYW5lbEJvZHlzID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgiLmtpdHR5X3BhbmVsQm9keSIpOwogICAgICBpZiAoIXBhbmVsQm9keXNba2l0dHlfdGFiSW5kZXhdKSB7CiAgICAgICAgcmV0dXJuOwogICAgICB9CiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgcGFuZWxCb2R5cy5sZW5ndGg7IGkrKykgewogICAgICA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W9uIGtpdHR5X2dldE5ld1ZlcnNpb24oaW5kZXgsIGNoYW5nZSkgewogICAgICBpZiAoa2l0dHlfaXNydW4uZ2V0TmV3VmVyc2lvbiAmJiAhY2hhbmdlKSB7CiAgICAgICAgcmV0dXJuOwogICAgICB9CiAgICAgIGxldCBob3N0ID0ga2l0dHlfZ2V0SG9zdChpbmRleCk7CiAgICAgIGlmICghY2hhbmdlKSB7CiAgICAgICAga2l0dHlfbG9nTGlzdFB1c2goIuajgOafpeeJiOacrOWPt+S4reivt+iAkOW/g+etieW+hS4uLiIsICJpbmZvIik7CiAgICAgIH0KICAgICAga2l0dHlfaXNydW4uZ2V0TmV3VmVyc2lvbiA9IHRydWU7CiAgICAgIGxldCB1cmwgPSBgJHtob3N0fS9nZXRWZXJzaW9uYDsKICAgICAgZmV0Y2godXJsLCB7CiAgICAgICAgbWV0aG9kOiAicG9zdCIsCiAgICAgICAgaGVhZGVyczogewogICAgICAgICAgIkNvbnRlbnQtVHlwZSI6ICJhcHBsaWNhdGlvbi9qc29uIiwKICAgICAgICB9LAogICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHsKICAgICAgICAgIG5pY2tuYW1lOiAiaGpmcmVlIiwKICAgICAgICB9KSwKICAgICAgfSkKICAgICAgICAudGhlbigocmVzKSA9PiByZXMuanNvbigpKQogICAgICAgIC50aGVuKChyZXMpID0+IHsKICAgICAgICAgIGxvY2FsU3RvcmFnZS5zZXRJdGVtKCJraXR0eV9yZXF1ZXN0U3VjY2Vzc0hvc3QiLCBob3N0KTsKICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgIGxldCBkYXRhID0gcmVzLmRhdGE7CiAgICAgICAgICAgIGlmIChkYXRhLnZlcnNpb24gPT09IGtpdHR5X2NvbmZpZy52ZXJzaW9uKSB7CiAgICAgICAgICAgICAga2l0dHlfY29uZmlnLnVwZGF0ZSA9IDE7CiAgICAgICAgICAgICAga2l0dHlfbG9nTGlzdFB1c2goIuW3suaYr+acgOaWsOeJiCIsICJzdWNjZXNzIik7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAga2l0dHlfY29uZmlnLnVwZGF0ZSA9IDI7CiAgICAgICAgICAgICAga2l0dHlfY29uZmlnLnVwZGF0ZVVybCA9IGRhdGEudXBkYXRlVXJsOwogICAgICAgICAgICAgIGtpdHR5X2xvZ0xpc3RQdXNoKCLkuI3mmK/mnIDmlrDniYgs5Y+v6IO95peg5rOV5L2/55SoIiwgIndhcm5pbmciKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBraXR0eV9zZXRDb25maWcoKTsKICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAga2l0dHlfbG9nTGlzdFB1c2goIuWksei0pSzov5Tlm57lgLzlpITnkIbmnInpl67popgiLCAiZGFuZ2VyIik7CiAgICAgICAgICAgIGNvbnNvbGUubG9nKGUpOwogICAgICAgICAgfQogICAgICAgICAga2l0dHlfaXNydW4uZ2V0TmV3VmVyc2lvbiA9IGZhbHNlOwogICAgICAgIH0pCiAgICAgICAgLmNhdGNoKChlKSA9PiB7CiAgICAgICAgICBpZiAoZS50b1N0cmluZygpLmluY2x1ZGVzKCJKU09OIikpIHsKICAgICAgICAgICAga2l0dHlfbG9nTGlzdFB1c2goIkpTT07op6PmnpDlpLHotKUs6K+36IGU57O75L2c6ICFIiwgImRhbmdlciIpOwogICAgICAgICAgICBraXR0eV9pc3J1bi5nZXROZXdWZXJzaW9uID0gZmFsc2U7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjb25zb2xlLmxvZyhlKTsKICAgICAgICAgICAgaW5kZXgrKzsKICAgICAgICAgICAgbGV0IGdldEhvc3QgPSBraXR0eV9nZXRIb3N0KGluZGV4KTsKICAgICAgICAgICAgaWYgKGdldEhvc3QpIHsKICAgICAgICAgICAgICBraXR0eV9sb2dMaXN0UHVzaCgi6K+35rGC5aSx6LSlLOWIh+aNoue6v+i3r+S4reivt+iAkOW/g+etieW+hS4uLiIs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AgICAgaWYgKHRyaW1tZWRDb29raWVOYW1lID09PSBuYW1lKSB7CiAgICAgICAgICAgIHJldHVybiBkZWNvZGVVUklDb21wb25lbnQoY29va2llVmFsdWUpOyAvLyDop6PnoIEgQ29va2llIOWAvAogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gbnVsbDsgLy8g5rKh5pyJ5om+5Yiw5Yy56YWN55qEIENvb2tpZQogICAgICB9LAogICAgICBoakFwaURlY29kZTogZnVuY3Rpb24gKGRhdGEpIHsKICAgICAgICBsZXQgcmVzOwogICAgICAgIHRyeSB7CiAgICAgICAgICByZXMgPSBKU09OLnBhcnNlKGF0b2IoYXRvYihhdG9iKGRhdGEpKSkpOwogICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgIGNvbnNvbGUubG9nKCJhYiBlcnJvciIpOwogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmVzOwogICAgICB9LAogICAgICBoakFwaUVlY29kZTogZnVuY3Rpb24gKGRhdGEpIHsKICAgICAgICByZXR1cm4gYnRvYShidG9hKGJ0b2EoSlNPTi5zdHJpbmdpZnkoZGF0YSkpKSk7CiAgICAgIH0sCiAgICAgIGdldEVsZW1lbnQ6IGZ1bmN0aW9uIChzZWxlY3RvcikgewogICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSgoc3VjY2VzcywgcmVqZWN0KSA9PiB7CiAgICAgICAgICBsZXQgZWxlOwogICAgICAgICAgZnVuY3Rpb24gcXVlcnlTZWxlY3RvckFsbF8oKSB7CiAgICAgICAgICAgIGVsZSA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoc2VsZWN0b3IpOwogICAgICAgICAgICBpZiAoZWxlLmxlbmd0aCAhPSAwKSB7CiAgICAgICAgICAgICAgc3VjY2VzcyhlbGUpOwogICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKCFxdWVyeVNlbGVjdG9yQWxsXygpKSB7CiAgICAgICAgICAgIGxldCBjb3VudCA9IDE7CiAgICAgICAgICAgIGxldCBpbnRlcnZhbCA9IHNldEludGVydmFsKCgpID0+IHsKICAgICAgICAgICAgICBpZiAoY291bnQgPiA3NSkgewogICAgICAgICAgICAgICAgcmVqZWN0KCLmnKrojrflj5blhYPntKA6ICIsIHNlbGVjdG9yKTsKICAgICAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwoaW50ZXJ2YWwpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAoIXF1ZXJ5U2VsZWN0b3JBbGxfKCkpIHsKICAgICAgICAgICAgICAgIGNvdW50Kys7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHN1Y2Nlc3MoZWxlKTsKICAgICAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwoaW50ZXJ2YWwpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwgNTApOwogICAgICAgICAgfQogICAgICAgIH0pOwogICAgICB9LAogICAgICBpc01vYmlsZURldmljZTogZnVuY3Rpb24gKCkgewogICAgICAgIHJldHVybiAvQW5kcm9pZHx3ZWJPU3xpUGhvbmV8aVBhZHxpUG9kfEJsYWNrQmVycnl8SUVNb2JpbGV8T3BlcmEgTWluaS9pLnRlc3QoCiAgICAgICAgICBuYXZpZ2F0b3IudXNlckFnZW50CiAgICAgICAgKTsKICAgICAgfSwKICAgIH07CiAgICBsZXQgaXNNb2JpbGVEZXZpY2UgPSBraXR0eV91dGlscy5pc01vYmlsZURldmljZSgpOwogICAgZnVuY3Rpb24ga2l0dHlfaGpQaWNFZGNvZGVyKCkgewogICAgICB2YXIgZSA9ICJBQkNEKkVGR0hJSktMTU5PUFFSU1RVVldYI1laYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwIiwKICAgICAgICB0ID0KICAgICAgICAgICgodGhpcy5lbmNvZGUgPSBmdW5jdGlvbiAoaSkgewogICAgICAgICAgICB2YXIgYSwKICAgICAgICAgICAgICBuLAogICAgICAgICAgICAgIG8sCiAgICAgICAgICAgICAgciwKICAgICAgICAgICAgICBzLAogICAgICAgICAgICAgIGMsCiAgICAgICAgICAgICAgbCA9ICIiLAogICAgICAgICAgICAgIGQgPSAwOwogICAgICAgICAgICBmb3IgKGkgPSB0KGkpOyBkIDwgaS5sZW5ndGg7ICkKICAgICAgICAgICAgICAobyA9IChhID0gaS5jaGFyQ29kZUF0KGQrKykpID4+IDIpLAogICAgICAgICAgICAgICAgKHIgPSAoKDMgJiBhKSA8PCA0KSB8ICgoYSA9IGkuY2hhckNvZGVBdChkKyspKSA+PiA0KSksCiAgICAgICAgICAgICAgICAocyA9ICgoMTUgJiBhKSA8PCAyKSB8ICgobiA9IGkuY2hhckNvZGVBdChkKyspKSA+PiA2KSksCiAgICAgICAgICAgICAgICAoYyA9IDYzICYgbiksCiAgICAgICAgICAgICAgICBpc05hTihhKSA/IChzID0gYyA9IDY0KSA6IGlzTmFOKG4pICYmIChjID0gNjQpLAogICAgICAgICAgICAgICAgKGwgPSBsICsgZS5jaGFyQXQobykgKyBlLmNoYXJBdChyKSArIGUuY2hhckF0KHMpICsgZS5jaGFyQXQoYykpOwogICAgICAgICAgICByZXR1cm4gbDsKICAgICAgICAgIH0pLAogICAgICAgICAgKHRoaXMuZGVjb2RlID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgdmFyIGEsCiAgICAgICAgICAgICAgbiwKICAgICAgICAgICAgICBvLAogICAgICAgICAgICAgIHIsCiAgICAgICAgICAgICAgcywKICAgICAgICAgICAgICBjLAogICAgICAgICAgICAgIGwgPSAiIiwKICAgICAgICAgICAgICBkID0gMDsKICAgICAgICAgICAgZm9yICh0ID0gdC5yZXBsYWNlKC9bXkEtWmEtejAtOVwqXCNdL2csICIiKTsgZCA8IHQubGVuZ3RoOyApCiAgICAgICAgICAgICAgKG8gPSBlLmluZGV4T2YodC5jaGFyQXQoZCsrKSkpLAogICAgICAgICAgICAgICAgKGEgPQogICAgICAgICAgICAgICAgICAoKDE1ICYgKHIgPSBlLmluZGV4T2YodC5jaGFyQXQoZCsrKSkpKSA8PCA0KSB8CiAgICAgICAgICAgICAgICAgICgocyA9IGUuaW5kZXhPZih0LmNoYXJBdChkKyspKSkgPj4gMikpLAogICAgICAgICAgICAgICAgKG4gPSAoKDMgJiBzKSA8PCA2KSB8IChjID0gZS5pbmRleE9mKHQuY2hhckF0KGQrKykpKSksCiAgICAgICAgICAgICAgICAobCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKChvIDw8IDIpIHwgKHIgPj4gNCkpKSwKICAgICAgICAgICAgICAgIDY0ICE9IHMgJiYgKGwgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShhKSksCiAgICAgICAgICAgICAgICA2NCAhPSBjICYmIChsICs9IFN0cmluZy5mcm9tQ2hhckNvZGUobikpOwogICAgICAgICAgICByZXR1cm4gaShsKTsKICAgICAgICAgIH0pLAogICAgICAgICAgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgZSA9IGUucmVwbGFjZSgvXHJcbi9nLCAiXG4iKTsKICAgICAgICAgICAgZm9yICh2YXIgdCA9ICIiLCBpID0gMDsgaSA8IGUubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgICB2YXIgYSA9IGUuY2hhckNvZGVBdChpKTsKICAgICAgICAgICAgICBhIDwgMTI4CiAgICAgICAgICAgICAgICA/ICh0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYSkpCiAgICAgICAgICAgICAgICA6ICh0ID0KICAgICAgICAgICAgICAgICAgICAxMjcgPCBhICYmIGEgPCAyMDQ4CiAgICAgICAgICAgICAgICAgICAgICA/ICh0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoKGEgPj4gNikgfCAxOTIpKSArCiAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZy5mcm9tQ2hhckNvZGUoKDYzICYgYSkgfCAxMjgpCiAgICAgICAgICAgICAgICAgICAgICA6ICh0ID0KICAgICAgICAgICAgICAgICAgICAgICAgICAodCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKChhID4+IDEyKSB8IDIyNCkpICsKICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcuZnJvbUNoYXJDb2RlKCgoYSA+PiA2KSAmIDYzKSB8IDEyOCkpICsKICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nLmZyb21DaGFyQ29kZSgoNjMgJiBhKSB8IDEyOCkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgfSksCiAgICAgICAgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICBmb3IgKHZhciB0LCBpLCBhID0gIiIsIG4gPSAwLCBvID0gMDsgbiA8IGUubGVuZ3RoOyApCiAgICAgICAgICAgICh0ID0gZS5jaGFyQ29kZUF0KG4pKSA8IDEyOAogICAgICAgICAgICAgID8gKChhICs9IFN0cmluZy5mcm9tQ2hhckNvZGUodCkpLCBuKyspCiAgICAgICAgICAgICAgOiAxOTEgPCB0ICYmIHQgPCAyMjQKICAgICAgICAgICAgICA/ICgobyA9IGUuY2hhckNvZGVBdChuICsgMSkpLAogICAgICAgICAgICAgICAgKGEgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgoKDMxICYgdCkgPDwgNikgfCAoNjMgJiBvKSkpLAogICAgICAgICAgICAgICAgKG4gKz0gMikpCiAgICAgICAgICAgICAgOiAoKG8gPSBlLmNoYXJDb2RlQXQobiArIDEpKSwKICAgICAgICAgICAgICAgIChpID0gZS5jaGFyQ29kZUF0KG4gKyAyKSksCiAgICAgICAgICAgICAgICAoYSArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKAogICAgICAgICAgICAgICAgICAoKDE1ICYgdCkgPDwgMTIpIHwgKCg2MyAmIG8pIDw8IDYpIHwgKDYzICYgaSkKICAgICAgICAgICAgICAgICkpLAogICAgICAgICAgICAgICAgKG4gKz0gMykpOwogICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgfTsKICAgIH0KICAgIAogICAgbGV0IGtpdHR5X3RvcGljRGF0YSA9IG51bGwKICAgCiAgICBmdW5jdGlvbiBraXR0eV9jb3ZlckFkZENvbnRlbnQoaW5uZXJodG1sKSB7CiAgICAgIGtpdHR5X3V0aWxzLmdldEVsZW1lbnQoIi5raXR0eV9jb3ZlcklubmVyQm94IikudGhlbigoZWxlKSA9PiB7CiAgICAgICAgbGV0IGVsZW1lbnQgPSBlbGVbMF07CiAgICAgICAgbGV0IHAgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJwIik7CiAgICAgICAgcC5pbm5lckhUTUwgPSBpbm5lcmh0bWw7CiAgICAgICAgZWxlbWVudC5hcHBlbmQocCk7CiAgICAgIH0pOwogICAgfQogICAgLy8g6K+35rGC5oum5oiqCiAgICBmdW5jdGlvbiBraXR0eV94aHJJbnRlcmNlcHQoKSB7CiAgICAgIGxldCB4aHJPcGVuID0gWE1MSHR0cFJlcXVlc3QucHJvdG90eXBlLm9wZW47CiAgICAgIFhNTEh0dHBSZXF1ZXN0LnByb3RvdHlwZS5vcGVuID0gZnVuY3Rpb24gKG1ldGhvZCwgdXJsLCBhc3luYykgewogICAgICAgIAogICAgICAgIGlmIChsb2NhdGlvbi5ocmVmLmluY2x1ZGVzKCJwb3N0L2RldGFpbHM/cGlkIikpIHsKICAgICAgICAgIGlmICh1cmwuaW5jbHVkZXMoImhqc3RvcmUvaW1hZ2VzIikpIHsKICAgICAgICAgICAga2l0dHlfY2FjaGVJbWdzKG1ldGhvZCwgdXJsLCB0aGlzKTsKICAgICAgICAgIH0KICAgICAgICAgIGNvbnN0IGxvY2F0aW9uUGFyYW1zID0gbmV3IFVSTFNlYXJjaFBhcmFtcyhsb2NhdGlvbi5zZWFyY2gpOwogICAgICAgICAgY29uc3QgcGlkID0gbG9jYXRpb25QYXJhbXMuZ2V0KCJwaWQiKTsKICAgICAgICAgIGlmICh1cmwuaW5jbHVkZXMoImFwaS90b3BpYy8iICsgcGlkKSkgewogICAgICAgICAgICBsZXQga2l0dHlfdG9waWNEYXRhVGFyZ2V0ID0gewogICAgICAgICAgICAgIGhhc1ZpZGVvOiBmYWxzZSwKICAgICAgICAgICAgICBoYXNBdWRpbzogZmFsc2UsCiAgICAgICAgICAgICAgaGFzUGljOiBmYWxzZSwKICAgICAgICAgICAgICBzYWxlVHlwZTogMCwgLy8gMDrkuI3lh7rllK4gMTrph5HluIEgMjrpkrvnn7MKICAgICAgICAgICAgICB2aXBMaW1pdDogMCwgLy8gMDrkuI3pnIDopoF2aXAgMTrpnIDopoF2aXAx57qnIDI66ZyA6KaBdmlwMue6pyAzOi4uLgogICAgICAgICAgICAgIHBpY3NMaXN0OiBbXSwKICAgICAgICAgICAgICBhdWRzTGlzdDogW10sCiAgICAgICAgICAgICAgdmlkZW9EYXRhOiBudWxsLAogICAgICAgICAgICAgIGlzRnJlZTogZmFsc2UsCiAgICAgICAgICAgICAgdG9waWNJZDogMCwKICAgICAgICAgICAgICBpbWFnZUluc2VydGVkOiBbXSwKICAgICAgICAgICAgICBjYXRjaGVkSW1nczogbnVsbCwKICAgICAgICAgICAgICB3aG9sZU0zdThVcmw6IG51bGwsCiAgICAgICAgICAgICAgd2hvbGVNM3U4VXJsVHlwZTogIiIsCiAgICAgICAgICAgICAgcGljRG9tTGlzdDogW10sCiAgICAgICAgICAgICAgdG9waWNEYXRhU2V0T3ZlcjogZmFsc2UsCiAgICAgICAgICAgICAgY3JlYXRlVGltZTogIiIsCiAgICAgICAgICAgICAgaXNINTogaXNNb2JpbGVEZXZpY2UsCiAgICAgICAgICAgICAgcnVuSHJlZjogIiIsCiAgICAgICAgICAgICAgY29kZUxpc3Q6IG51bGwsCiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGtpdHR5X3RvcGljRGF0YSA9IG5ldyBQcm94eShraXR0eV90b3BpY0RhdGFUYXJnZXQsIHsKICAgICAgICAgICAgICBnZXQ6ICh0YXJnZXQsIGtleSwgcHJveHkpID0+IHsKICAgICAgICAgICAgICAgIHJldHVybiB0YXJnZXRba2V5XTsKICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgIHNldDogKHRhcmdldCwga2V5LCB2YWx1ZSwgcHJveHkpID0+IHsKICAgICAgICAgICAgICAgIGlmICh0YXJnZXRba2V5XSAhPT0gdmFsdWUpIHsKICAgICAgICAgICAgICAgICAgdGFyZ2V0W2tleV0gPSB2YWx1ZTsKICAgICAgICAgICAgICAgICAgaWYgKGtleSA9PSAidG9waWNEYXRhU2V0T3ZlciIpIHsKICAgICAgICAgICAgICAgICAgICBraXR0eV90b3BpY0RhdGFTZXRPdmVyKCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGtleSA9PSAid2hvbGVNM3U4VXJsIikgewogICAgICAgICAgICAgICAgICAgIGtpdHR5X2luc2VydFZpZGVvRG9tKCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICAgIH0sCiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgICAgbGV0IG9ucmVhZHlzdGF0ZWNoYW5nZV8gPSB0aGlzLm9ucmVhZHlzdGF0ZWNoYW5nZTsKICAgICAgICAgIHRoaXMub25yZWFkeXN0YXRlY2hhbmdlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICBpZiAodGhpcy5yZWFkeVN0YXRlID09IDQgJiYgdGhpcy5zdGF0dXMgPT0gMjAwKSB7CiAgICAgICAgICAgICAga2l0dHlfeGhyUmVzcG9uc2VQcm9jZXNzKG1ldGhvZCwgdXJsLCB0aGlzKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAob25yZWFkeXN0YXRlY2hhbmdlXykgewogICAgICAgICAgICAgIG9ucmVhZHlzdGF0ZWNoYW5nZV8oKTsKICAgICAgICAgICAgfQogICAgICAgICAgfTsKICAgICAgICAgIGlmIChpc01vYmlsZURldmljZSkgewogICAgICAgICAgICAvLyDmiYvmnLrnq68KICAgICAgICAgICAgbGV0IG9ubG9hZF8gPSB0aGlzLm9ubG9hZDsKICAgICAgICAgICAgdGhpcy5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAga2l0dHlfeGhyUmVzcG9uc2VQcm9jZXNzKG1ldGhvZCwgdXJsLCB0aGlzKTsKICAgICAgICAgICAgICBpZiAob25sb2FkXykgewogICAgICAgICAgICAgICAgb25sb2FkXygpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIHhock9wZW4uY2FsbCh0aGlzLCBtZXRob2QsIHVybCwgYXN5bmMpOwogICAgICB9OwogICAgfQogICAgLy8g6K+35rGC5YmN5aSE55CGCiAgICBmdW5jdGlvbiBraXR0eV9jYWNoZUltZ3MobWV0aG9kLCB1cmwsIHhocikgewogICAgICBpZiAodXJsLmluY2x1ZGVzKCJoanN0b3JlL2ltYWdlcyIpKSB7CiAgICAgICAgaWYgKGtpdHR5X3RvcGljRGF0YS5oYXNQaWMpIHsKICAgICAgICAgIGlmICgha2l0dHlfdG9waWNEYXRhLmNhdGNoZWRJbWdzKSB7CiAgICAgICAgICAgIGtpdHR5X3RvcGljRGF0YS5jYXRjaGVkSW1ncyA9IFtdOwogICAgICAgICAgfQogICAgICAgICAgbGV0IGZpbmQgPSBraXR0eV90b3BpY0RhdGEuY2F0Y2hlZEltZ3MuZmluZCgoaXRlbSkgPT4gewogICAgICAgICAgICByZXR1cm4gaXRlbS51cmwgPT0gdXJsOwogICAgICAgICAgfSk7CiAgICAgICAgICBpZiAoIWZpbmQpIHsKICAgICAgICAgICAga2l0dHlfdG9waWNEYXRhLmNhdGNoZWRJbWdzLnB1c2goewogICAgICAgICAgICAgIHVybDogdXJsLAogICAgICAgICAgICAgIGRhdGE6IG51bGwsCiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgfQogICAgLy8g6K+35rGC5ZCO6L+U5Zue5YC85aSE55CGCiAgICBmdW5jdGlvbiBraXR0eV94aHJSZXNwb25zZVByb2Nlc3MobWV0aG9kLCB1cmwsIHhocikgewogICAgICBjb25zdCBsb2NhdGlvblBhcmFtcyA9IG5ldyBVUkxTZWFyY2hQYXJhbXMobG9jYXRpb24uc2VhcmNoKTsKICAgICAgY29uc3QgcGlkID0gbG9jYXRpb25QYXJhbXMuZ2V0KCJwaWQiKTsKICAgICAgaWYgKHVybC5pbmNsdWRlcygiYXBpL3RvcGljLyIgKyBwaWQpKSB7CiAgICAgICAgbGV0IHJlc3BvbnNlVGV4dCA9IEpTT04ucGFyc2UoeGhyLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgbGV0IGRlY29kZURhdGEgPSBraXR0eV91dGlscy5oakFwaURlY29kZShyZXNwb25zZVRleHQuZGF0YSk7CiAgICAgICAgbGV0IG5ld0RhdGEgPSBraXR0eV91dGlscy5oakFwaUVlY29kZShraXR0eV9zZXRUb3BpY0RhdGEoZGVjb2RlRGF0YSkpOwogICAgICAgIHJlc3BvbnNlVGV4dC5kYXRhID0gbmV3RGF0YTsKICAgICAgICBsZXQganNvblJlcyA9IEpTT04uc3RyaW5naWZ5KHJlc3BvbnNlVGV4dCk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHhociwgInJlc3BvbnNlVGV4dCIsIHsKICAgICAgICAgIGdldDogKCkgPT4gewogICAgICAgICAgICByZXR1cm4ganNvblJlczsKICAgICAgICAgIH0sCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHhociwgInJlc3BvbnNlIiwgewogICAgICAgICAgZ2V0OiAoKSA9PiB7CiAgICAgICAgICAgIHJldHVybiBqc29uUmVzOwogICAgICAgICAgfSwKICAgICAgICB9KTsKICAgICAgfQogICAgICBpZiAodXJsLmluY2x1ZGVzKCJoanN0b3JlL2ltYWdlcyIpKSB7CiAgICAgICAgbGV0IGZpbmRDYXRjaGVkSW1nID0ga2l0dHlfdG9waWNEYXRhLmNhdGNoZWRJbWdzLmZpbmQoKGl0ZW0pID0+IHsKICAgICAgICAgIHJldHVybiBpdGVtLnVybCA9PSB1cmw7CiAgICAgICAgfSk7CiAgICAgICAgaWYgKGZpbmRDYXRjaGVkSW1nKSB7CiAgICAgICAgICBpZiAoIWZpbmRDYXRjaGVkSW1nLmRhdGEpIHsKICAgICAgICAgICAgZmluZENhdGNoZWRJbWcuZGF0YSA9IG5ldyBraXR0eV9oalBpY0VkY29kZXIoKS5kZWNvZGUoCiAgICAgICAgICAgICAgeGhyLnJlc3BvbnNlVGV4dAogICAgICAgICAgICApOwogICAgICAgICAgICBsZXQgZmluZEltZ0RvbSA9IGtpdHR5X3RvcGljRGF0YS5waWNEb21MaXN0LmZpbmQoKGl0ZW0pID0+IHsKICAgICAgICAgICAgICByZXR1cm4gaXRlbS5kYXRhc2V0LmltZ1VybCA9PSB1cmw7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBpZiAoZmluZEltZ0RvbSkgewogICAgICAgICAgICAgIGZpbmRJbWdEb20uc3JjID0gZmluZENhdGNoZWRJbWcuZGF0YTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgfQogICAgLy8gL2FwaS90b3BpYy9pZCDmjqXlj6Pov5Tlm57lgLzlpITnkIYKICAgIGZ1bmN0aW9uIGtpdHR5X3NldFRvcGljRGF0YShkYXRhKSB7CiAgICAgIGNvbnN0IGxvY2F0aW9uUGFyYW1zID0gbmV3IFVSTFNlYXJjaFBhcmFtcyhsb2NhdGlvbi5zZWFyY2gpOwogICAgICBjb25zdCBwaWQgPSBsb2NhdGlvblBhcmFtcy5nZXQoInBpZCIpOwogICAgICBraXR0eV90b3BpY0RhdGEudG9waWNJZCA9IHBpZDsKICAgICAgaWYgKGRhdGEuc2FsZSkgewogICAgICAgIC8vIOS7mOi0ueexu+WeiwogICAgICAgIGtpdHR5X3RvcGljRGF0YS5zYWxlVHlwZSA9IGRhdGEuc2FsZS5tb25leV90eXBlOwogICAgICB9CiAgIAogICAgICBsZXQgaGFzQXVkaW8gPSBmYWxzZTsKICAgICAgbGV0IGhhc1ZpZGVvID0gZmFsc2U7CiAgICAgIGxldCBoYXNQaWMgPSBmYWxzZTsKICAgICAgLy8g6ZmE5Lu25aSE55CGCiAgICAgIGRhdGEuYXR0YWNobWVudHMuZm9yRWFjaCgoaXRlbSkgPT4gewogICAgICAgIGlmIChpdGVtLmNhdGVnb3J5ID09ICJpbWFnZXMiKSB7CiAgICAgICAgICBoYXNQaWMgPSB0cnVlOwogICAgICAgICAga2l0dHlfdG9waWNEYXRhLnBpY3NMaXN0LnB1c2goaXRlbS5yZW1vdGVVcmwpOwogICAgICAgIH0gZWxzZSBpZiAoaXRlbS5jYXRlZ29yeSA9PSAidmlkZW8iKSB7CiAgICAgICAgICBoYXNWaWRlbyA9IHRydWU7CiAgICAgICAgICBraXR0eV90b3BpY0RhdGEudmlkZW9EYXRhID0gaXRlbTsKICAgICAgICB9IGVsc2UgaWYgKGl0ZW0uY2F0ZWdvcnkgPT0gImF1ZGlvIikgewogICAgICAgICAgaGFzQXVkaW8gPSB0cnVlOwogICAgICAgICAga2l0dHlfdG9waWNEYXRhLmF1ZHNMaXN0LnB1c2goaXRlbS5yZW1vdGVVcmwpOwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIGlmIChoYXNQaWMpIHsKICAgICAgICBraXR0eV90b3BpY0RhdGEuaGFzUGljID0gdHJ1ZTsKICAgICAgfQogICAgICBpZiAoaGFzVmlkZW8pIHsKICAgICAgICBraXR0eV90b3BpY0RhdGEuaGFzVmlkZW8gPSB0cnVlOwogICAgICB9CiAgICAgIGlmIChoYXNBdWRpbykgewogICAgICAgIGtpdHR5X3RvcGljRGF0YS5oYXNBdWRpbyA9IHRydWU7CiAgICAgIH0KICAgCiAgICAgIGlmIChkYXRhLm5vZGUpIHsKICAgICAgICBraXR0eV90b3BpY0RhdGEudmlwTGltaXQgPSBkYXRhLm5vZGUudmlwTGltaXQ7CiAgICAgICAgLy8g5Y676ZmkdmlwbGltaXTlvLnmoYYKICAgICAgICBkYXRhLm5vZGUudmlwTGltaXQgPSAwOwogICAgICB9CiAgICAgIC8vIOaYr+WQpuaYr+WFjei0uQogICAgICBpZiAoIWRhdGEuc2FsZSAmJiBraXR0eV90b3BpY0RhdGEudmlwTGltaXQgPT0gMCkgewogICAgICAgIGtpdHR5X3RvcGljRGF0YS5pc0ZyZWUgPSB0cnVlOwogICAgICB9CiAgICAgIGtpdHR5X3RvcGljRGF0YS5jcmVhdGVUaW1lID0gZGF0YS5jcmVhdGVUaW1lOwogICAgICBraXR0eV90b3BpY0RhdGEudG9waWNEYXRhU2V0T3ZlciA9IHRydWU7CiAgICAgIC8vZGVsZXRlIGRhdGEuY29udGVudAogICAgICByZXR1cm4gZGF0YTsKICAgIH0KICAgIC8vIOWmguaenOaYr3ZpcOWGheWuuQogICAgZnVuY3Rpb24ga2l0dHlfdG9waWNWaXBsaW1pdCgpIHsKICAgICAgaWYgKGtpdHR5X3RvcGljRGF0YS52aXBMaW1pdCA+IDApIHsKICAgICAgICBpZiAoa2l0dHlfdG9waWNEYXRhLmhhc1BpYykgewogICAgICAgICAgbGV0IGNvdW50ID0gMDsKICAgICAgICAgIGxldCBpbnRlcnZhbCA9IHNldEludGVydmFsKCgpID0+IHsKICAgICAgICAgICAgaWYgKGNvdW50ID49IGtpdHR5X3RvcGljRGF0YS5waWNzTGlzdC5sZW5ndGgpIHsKICAgICAgICAgICAgICByZXR1cm4gY2xlYXJJbnRlcnZhbChpbnRlcnZhbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbGV0IGl0ZW0gPSBraXR0eV90b3BpY0RhdGEucGljc0xpc3RbY291bnRdOwogICAgICAgICAgICBsZXQgeCA9IG5ldyBYTUxIdHRwUmVxdWVzdCgpOwogICAgICAgICAgICB4Lm9wZW4oImdldCIsIGl0ZW0pOwogICAgICAgICAgICB4LnNlbmQoKTsKICAgICAgICAgICAgY291bnQrKzsKICAgICAgICAgIH0sIDUwMCk7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICAvLyDmj5LlhaXlm77niYcKICAgIGZ1bmN0aW9uIGtpdHR5X2luc2VydFBheUltZ3NEb20odXJsKSB7CiAgICAgIGtpdHR5X3V0aWxzLmdldEVsZW1lbnQoIi5raXR0eV9jb3ZlcklubmVyQm94IikudGhlbigoZWxlKSA9PiB7CiAgICAgICAgbGV0IGVsZW1lbnQgPSBlbGVbMF07CiAgICAgICAga2l0dHlfdG9waWNEYXRhLnBpY3NMaXN0LmZvckVhY2goKHVybCwgaW5kZXgpID0+IHsKICAgICAgICAgIGlmICgha2l0dHlfdG9waWNEYXRhLmltYWdlSW5zZXJ0ZWQuaW5jbHVkZXModXJsKSkgewogICAgICAgICAgICBsZXQgcCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoInAiKTsKICAgICAgICAgICAgbGV0IGltZyA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImltZyIpOwogICAgICAgICAgICBpbWcuY2xhc3NOYW1lID0gImtpdHR5X3RvcGljSW1nIjsKICAgICAgICAgICAgaW1nLnNyYyA9ICIvaW1hZ2VzL2NvbW1vbi9wcm9qZWN0L2xvYWRpbmcuZ2lmIjsKICAgICAgICAgICAgaW1nLnRpdGxlID0gIueCueWHu+afpeeci+Wkp+WbviI7CiAgICAgICAgICAgIGltZy5kYXRhc2V0LmltZ1VybCA9IHVybDsKICAgICAgICAgICAgaW1nLmFkZEV2ZW50TGlzdGVuZXIoImNsaWNrIiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgIGltZy5jbGFzc0xpc3QudG9nZ2xlKCJpbWd3aWR0aDEwMCIpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgcC5hcHBlbmRDaGlsZChpbWcpOwogICAgICAgICAgICBlbGVtZW50LmFwcGVuZENoaWxkKHApOwogICAgICAgICAgICBraXR0eV90b3BpY0RhdGEuaW1hZ2VJbnNlcnRlZC5wdXNoKHVybCk7CiAgICAgICAgICAgIGtpdHR5X3RvcGljRGF0YS5waWNEb21MaXN0LnB1c2goaW1nKTsKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgfSk7CiAgICB9CiAgICBmdW5jdGlvbiBraXR0eV9nZXRWaWRlb1VybCgpIHsKICAgICAgaWYgKGtpdHR5X3RvcGljRGF0YS5pc0ZyZWUpIHsKICAgICAgICByZXR1cm47CiAgICAgIH0KICAgICAgaWYgKGtpdHR5X3RvcGljRGF0YS5oYXNWaWRlbykgewogICAgICAgIGtpdHR5X2NvdmVyQWRkQ29udGVudCgi5q2j5Zyo6I635Y+W6KeG6aKR5L+h5oGv77yM6K+356iN5ZCOLi4uIik7CiAgICAgICAgZmV0Y2goImh0dHBzOi8vYmFpeGlhb2R1LnVrL2FwaS9oai9maW5kdTgiLCB7CiAgICAgICAgICBtZXRob2Q6ICJwb3N0IiwKICAgICAgICAgIGhlYWRlcnM6IHsKICAgICAgICAgICAgIkNvbnRlbnQtVHlwZSI6ICJhcHBsaWNhdGlvbi9qc29uIiwKICAgICAgICAgIH0sCiAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7CiAgICAgICAgICAgIHBpZDogcGFyc2VJbnQoa2l0dHlfdG9waWNEYXRhLnRvcGljSWQpLAogICAgICAgICAgfSksCiAgICAgICAgfSkKICAgICAgICAgIC50aGVuKChyZXMpID0+IHJlcy5qc29uKCkpCiAgICAgICAgICAudGhlbigocmVzKSA9PiB7CiAgICAgICAgICAgIGlmIChyZXMuc3VjY2VzcykgewogICAgICAgICAgICAgIGtpdHR5X3RvcGljRGF0YS53aG9sZU0zdThVcmxUeXBlID0gcmVzLmRhdGEudHlwZTsKICAgICAgICAgICAgICBraXR0eV90b3BpY0RhdGEud2hvbGVNM3U4VXJsID0gcmVzLmRhdGEudXJsOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGtpdHR5X2xvZ0xpc3RQdXNoKHJlcy5tZXNzYWdlLCAid2FybmluZyIpOwogICAgICAgICAgICAgIGtpdHR5X2NvdmVyQWRkQ29udGVudChyZXMubWVzc2FnZSk7CiAgICAgICAgICAgICAga2l0dHlfc2hvd1BhbmVsKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0pOwogICAgICB9CiAgICB9CiAgICAvLyDmj5LlhaXop4bpopEKICAgIGZ1bmN0aW9uIGtpdHR5X2luc2VydFZpZGVvRG9tKCkgewogICAgICBpZiAoa2l0dHlfdG9waWNEYXRhLndob2xlTTN1OFVybFR5cGUgPT0gInBhZ2UiKSB7CiAgICAgICAga2l0dHlfY292ZXJBZGRDb250ZW50KAogICAgICAgICAgYOinhumikemcgOiHs2hhaWppYW8uYWnop4LnnIs6IDxhIHRhcmdldD0nX2JsYW5rJyBocmVmPSIke2tpdHR5X3RvcGljRGF0YS53aG9sZU0zdThVcmx9Ij7ngrnmraTop4LnnIs8L2E+YAogICAgICAgICk7CiAgICAgICAgcmV0dXJuOwogICAgICB9CiAgIAogICAgICBraXR0eV9jb3ZlckFkZENvbnRlbnQoCiAgICAgICAgYOivt+eCueWHu+ingueci+inhumikTogPGEgdGFyZ2V0PSdfYmxhbmsnIGhyZWY9Imh0dHBzOi8vZmlsZS5raXR0eW1hby54eXovZmlsZS9vdGhlci9tM3U4UGxheWVyLmh0bWw/dXJsPSR7a2l0dHlfdG9waWNEYXRhLndob2xlTTN1OFVybH0iPueCueatpOaSreaUvjwvYT5gCiAgICAgICk7CiAgICB9CiAgICAvLyDmj5LlhaXpn7PpopEKICAgIGZ1bmN0aW9uIGtpdHR5X2luc2VydEF1ZGlvRG9tKCkgewogICAgICBraXR0eV90b3BpY0RhdGEuYXVkc0xpc3QuZm9yRWFjaCgoaXRlbSkgPT4gewogICAgICAgIGxldCBh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3gga2l0dHlfY292ZXJCb3hIaWRkZW4iOwogICAgICAgIGNvdmVyLmlubmVySFRNTCA9IGA8ZGl2IGNsYXNzPSJraXR0eV9jb3ZlcklubmVyQm94Ij4KICAgICAgICAgICAgPGRpdiBjbGFzcz0ia2l0dHlfb3BlcmF0ZUNvdmVyIj4KICAgICAgICAgICAgICAgIDxpbWcgY2xhc3M9ImtpdHR5X2Nsb3NlQ292ZXIiIHNyYz0iJHtraXR0eV9pY29ucy5jbG9zZX0iPjwvaW1nPgogICAgICAgICAgICAgICAgPGltZyBjbGFzcz0ia2l0dHlfdG9Ub3AiIHNyYz0iJHtraXR0eV9pY29ucy50b1RvcH0iPjwvaW1nPgogICAgICAgICAgICAgICAgPGltZyBjbGFzcz0ia2l0dHlfdG9Cb3R0b20iIHNyYz0iJHtraXR0eV9pY29ucy50b1RvcH0iPjwvaW1nPgogICAgICAgICAgICA8L2Rpdj4KICAgICAgICAgICAgPGgyPua1t+inkuekvuWMuuiEmuacrDwvaDI+CiAgICAgICAgICAgIDxwPui/meS4quW4luaYryR7dG9waWNUeXBlfeW4lu+8jOiEmuacrOW3sue7j+iOt+WPliR7dG9waWNUeXBlfeWGheWuue+8jOWMheWQqyR7CiAgICAgICAgICBraXR0eV90b3BpY0RhdGEuaGFzQXVkaW8gPyAi6Z+z6aKRICIgOiAiIgogICAgICAgIH0ke2tpdHR5X3RvcGljRGF0YS5oYXNQaWMgPyAi5Zu+54mHICIgOiAiIn0kewogICAgICAgICAga2l0dHlfdG9waWNEYXRhLmhhc1ZpZGVvID8gIuinhumikSAiIDogIiIKICAgICAgICB9PC9wPgogICAgICAgICAgICA8cD7ngrnlh7vlm77niYflj6/mlL7lpKcsIOWGjeasoeeCueWHu+WPr+e8qeWwjzwvcD4KICAgICAgICA8L2Rpdj5gOwogICAgICAgIGlmICghY292ZXJEaXYpIHsKICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kKGNvdmVyKTsKICAgICAgICB9CiAgICAgICAga2l0dHlfdXRpbHMuZ2V0RWxlbWVudCgiLmtpdHR5X2Nsb3NlQ292ZXIiKS50aGVuKChyZXMpID0+IHsKICAgICAgICAgIHJlc1swXS5hZGRFdmVudExpc3RlbmVyKCJjbGljayIsIHRoaXMuaGlkZGVuQ292ZXIpOwogICAgICAgIH0pOwogICAgICAgIGtpdHR5X3V0aWxzLmdldEVsZW1lbnQoIi5raXR0eV90b1RvcCIpLnRoZW4oKHJlcykgPT4gewogICAgICAgICAgcmVzWzBdLmFkZEV2ZW50TGlzdGVuZXIoImNsaWNrIiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICBraXR0eV91dGlscy5nZXRFbGVtZW50KCIua2l0dHlfY292ZXJJbm5lckJveCIpLnRoZW4oKGJveCkgPT4gewogICAgICAgICAgICAgIGJveFswXS5zY3JvbGxUb3AgPSAwOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0pOwogICAgICAgIH0pOwogICAgICAgIGtpdHR5X3V0aWxzLmdldEVsZW1lbnQoIi5raXR0eV90b0JvdHRvbSIpLnRoZW4oKHJlcykgPT4gewogICAgICAgICAgcmVzWzBdLmFkZEV2ZW50TGlzdGVuZXIoImNsaWNrIiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICBraXR0eV91dGlscy5nZXRFbGVtZW50KCIua2l0dHlfY292ZXJJbm5lckJveCIpLnRoZW4oKGJveCkgPT4gewogICAgICAgICAgICAgIGJveFswXS5zY3JvbGxUb3AgPSBib3hbMF0uc2Nyb2xsSGVpZ2h0OwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0pOwogICAgICAgIH0pOwogICAgICAgIGtpdHR5X3V0aWxzLmdldEVsZW1lbnQoImhlYWQiKS50aGVuKChyZXMpID0+IHsKICAgICAgICAgIGxldCBzdHlsZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoInN0eWxlIik7CiAgICAgICAgICBzdHlsZS5pbm5lckhUTUwgPSBgCiAgICAgICAgICAua2l0dHlfY292ZXJJbm5lckJveCBpbWcuaW1nd2lkdGgxMDAgewogICAgICAgICAgICB3aWR0aDogMTAwJTsKICAgICAgICAgIH0KICAgICAgICAgICAgICAua2l0dHlfY292ZXJCb3hIaWRkZW4gewogICAgICAgICAgICAgICAgZGlzcGxheTpub25lOwogICAgICAgICAgICAgIH0ua2l0dHlfY292ZXJCb3hTaG93IHsKICAgICAgICAgICAgICAgIGRpc3BsYXk6YmxvY2s7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIC5raXR0eV9jb3ZlckJveCB7CiAgICAgICAgICAgICAgICB3aWR0aDogMTAwdnc7CiAgICAgICAgICAgICAgICBoZWlnaHQ6IDEwMHZoOwogICAgICAgICAgICAgICAgcG9zaXRpb246IGZpeGVkOwogICAgICAgICAgICAgICAgbGVmdDogMDsKICAgICAgICAgICAgICAgIHRvcDogMDsKICAgICAgICAgICAgICAgIGJhY2tncm91bmQ6IHJnYmEoMCwwLDAsIDAuNSk7CiAgICAgICAgICAgICAgICB6LWluZGV4OiA5OTk5OTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgLmtpdHR5X2NvdmVySW5uZXJCb3ggewogICAgICAgICAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlOwogICAgICAgICAgICAgICAgbWFyZ2luOiAwIGF1dG87CiAgICAgICAgICAgICAgICB3aWR0aDogJHtpc01vYmlsZURldmljZSA/ICIxMDAlIiA6ICI1MCUifTsKICAgICAgICAgICAgICAgIG1pbi13aWR0aDogMzAwcHg7CiAgICAgICAgICAgICAgICBoZWlnaHQ6IDEwMHZoOwogICAgICAgICAgICAgICAgb3ZlcmZsb3cteTogc2Nyb2xsOwogICAgICAgICAgICAgICAgdGV4dC1hbGlnbjpjZW50ZXI7CiAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiB3aGl0ZTsKICAgICAgICAgICAgICAgIHBhZGRpbmctYm90dG9tOiAxMDBweDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgLmtpdHR5X2NvdmVySW5uZXJCb3ggcCB7CiAgICAgICAgICAgICAgICBwYWRkaW5nOiAxMHB4OwogICAgICAgICAgICAgICAgbWFyZ2luOiAxMHB4OwogICAgICAgICAgICAgICAgZm9udC1zaXplOiAxNnB4OwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAua2l0dHlfY2xvc2VDb3ZlciB7CiAgICAgICAgICAgICAgICBtYXJnaW4tYm90dG9tOiAxMDBweDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgLmtpdHR5X29wZXJhdGVDb3ZlciB7CiAgICAgICAgICAgICAgICBwb3NpdGlvbjogc3RpY2t5OwogICAgICAgICAgICAgICAgbGVmdDogMTAwJTsKICAgICAgICAgICAgICAgIHdpZHRoOiA1MHB4OwogICAgICAgICAgICAgICAgdG9wOiAyMHB4OwogICAgICAgICAgICAgICAgaGVpZ2h0OiAzMHB4OwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAua2l0dHlfY292ZXJJbm5lckJveCBpbWcgewogICAgICAgICAgICAgICAgY3Vyc29yOiBwb2ludGVyOwogICAgICAgICAgICAgICAgd2lkdGg6IDI1MHB4OwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAua2l0dHlfY292ZXJJbm5lckJveCAua2l0dHlfb3BlcmF0ZUNvdmVyIGltZyB7CiAgICAgICAgICAgICAgICB3aWR0aDogMzBweDsKICAgICAgICAgICAgICAgIGRpc3BsYXk6IGJsb2NrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAua2l0dHlfdG9Cb3R0b20gewogICAgICAgICAgICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMTgwZGVnKTsKICAgICAgICAgICAgICAgIG1hcmdpbi10b3A6IDIwcHg7CiAgICAgICAgICAgICAgfQogICAgICAgICAgYDsKICAgICAgICAgIHJlc1swXS5hcHBlbmQoc3R5bGUpOwogICAgICAgIH0pOwogICAgICB9OwogICAgICB0aGlzLmhpZGRlbkNvdmVyID0gZnVuY3Rpb24gKCkgewogICA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AgICAgICAgICA/ICI8c3BhbiBjbGFzcz0na2l0dHlfY29udGVudEdldE92ZXInPui/meS4quW4luWtkOaYr+WFjei0ueeahDwvc3Bhbj4iCiAgICAgICAgICAgIDogIjxzcGFuIGNsYXNzPSdraXR0eV9jb250ZW50R2V0T3Zlcicgc3R5bGU9J2N1cnNvcjpwb2ludGVyOyc+5biW5a2Q5YaF5a656I635Y+W5a6M5q+VLCDor7fngrnmraTmn6XnnIs8L3NwYW4+IgogICAgICAgIH1gLAogICAgICAgICJzdWNjZXNzIiwKICAgICAgICB0cnVlCiAgICAgICk7CiAgICAgIGlmIChraXR0eV90b3BpY0RhdGEuaXNGcmVlKSB7CiAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLmtpdHR5X2ppZXhpQnRuIikuaW5uZXJIVE1MID0gIuWFjei0uSI7CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLmtpdHR5X2ppZXhpQnRuIikuaW5uZXJIVE1MID0gIuino+aekCI7CiAgICAgIH0KICAgICAgZG9jdW1lbnQKICAgICAgICAucXVlcnlTZWxlY3RvcigiLmtpdHR5X2ppZXhpQnRuIikKICAgICAgICAuYWRkRXZlbnRMaXN0ZW5lcigiY2xpY2siLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICBpZiAoIWxvY2F0aW9uLmhyZWYuaW5jbHVkZXMoInBvc3QvZGV0YWlscz9waWQiKSkgewogICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIua2l0dHlfamlleGlCdG4iKS5pbm5lckhUTUwgPSAi5pqC5pegIjsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGtpdHR5X3RvcGljRGF0YS5pc0ZyZWUpIHsKICAgICAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLmtpdHR5X2ppZXhpQnRuIikuaW5uZXJIVE1MID0gIuWFjei0uSI7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIua2l0dHlfamlleGlCdG4iKS5pbm5lckhUTUwgPSAi6Kej5p6QIjsKICAgICAgICAgICAgY292ZXIuc2hvd0NvdmVyKCk7CiAgICAgICAgICB9CiAgICAgICAgfSk7CiAgIAogICAgICBraXR0eV91dGlscy5nZXRFbGVtZW50KCIua2l0dHlfY29udGVudEdldE92ZXIiKS50aGVuKChlbGUpID0+IHsKICAgICAgICBlbGVbMF0uYWRkRXZlbnRMaXN0ZW5lcigiY2xpY2siLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICBpZiAoIWxvY2F0aW9uLmhyZWYuaW5jbHVkZXMoInBvc3QvZGV0YWlscz9waWQiKSkgewogICAgICAgICAgICBraXR0eV9sb2dMaXN0UHVzaCgi5rKh5pyJ5biW5a2QLi4uIiwgIndhcm5pbmciKTsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgfQogICAgICAgICAgY292ZXIuc2hvd0NvdmVyKCk7CiAgICAgICAgICBraXR0eV9oaWRkZW5QYW5lbCgpOwogICAgICAgIH0pOwogICAgICB9KTsKICAgCiAgICAgIGlmIChraXR0eV90b3BpY0RhdGEudmlwTGltaXQpIHsKICAgICAgICBraXR0eV90b3BpY1ZpcGxpbWl0KCk7CiAgICAgIH0KICAgCiAgICAgIGlmIChraXR0eV90b3BpY0RhdGEuaGFzUGljKSB7CiAgICAgICAga2l0dHlfaW5zZXJ0UGF5SW1nc0RvbSgpOwogICAgICB9CiAgICAgIGlmIChraXR0eV90b3BpY0RhdGEuaGFzQXVkaW8pIHsKICAgICAgICBraXR0eV9pbnNlcnRBdWRpb0RvbSgpOwogICAgICB9CiAgICAgIGlmIChraXR0eV90b3BpY0RhdGEuaGFzVmlkZW8pIHsKICAgICAgICAvLyDlj5HpgIHor7fmsYLliLBraXR0eW1hbwogICAgICAgIGtpdHR5X2dldFZpZGVvVXJsKCk7CiAgICAgIH0gZWxzZSB7CiAgICAgICAga2l0dHlfY292ZXJBZGRDb250ZW50KGA8c3BhbiBzdHlsZT0nY29sb3I6cmVkOyc+6L+Z5Liq5biW5a2Q5rKh5pyJ6KeG6aKRPC9zcGFuPmApOwogICAgICB9CiAgICAgIC8vY292ZXIuc2hvd0NvdmVyKCk7CiAgICB9CiAgICBmdW5jdGlvbiBraXR0eV9tYWluKCkgewogICAgICAKICAgICAga2l0dHlfeGhySW50ZXJjZXB0KCk7CiAgICB9CiAgICBmdW5jdGlvbiBraXR0eV9jaGVja0xvZ2luKCkgewogICAgICBpZiAoIWtpdHR5X2lzTG9naW4oKSkgewogICAgICAgIGxldCBpbnRlcnZhbCA9IHNldEludGVydmFsKCgpID0+IHsKICAgICAgICAgIGtpdHR5X2xvZ0xpc3RQdXNoKCLmsqHmnInnmbvlvZXmtbfop5LotKblj7cs5Y+v6IO95peg5rOV6Kej5p6QIiwgIndhcm5pbmciKTsKICAgICAgICAgIGlmIChraXR0eV9pc0xvZ2luKCkpIHsKICAgICAgICAgICAgY2xlYXJJbnRlcnZhbChpbnRlcnZhbCk7CiAgICAgICAgICAgIGxvY2F0aW9uLnJlbG9hZCgpOwogICAgICAgICAgfQogICAgICAgIH0sIDEwMDApOwogICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgfSBlbHNlIHsKICAgICAgICBraXR0eV9sb2dMaXN0UHVzaCgi6ISa5pys6L+Q6KGM5oiQ5Yqf77yM6K+35bCd6K+V6KeC55yL5biW5a2QIiwgInN1Y2Nlc3MiKTsKICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfQogICAgfQogICAgZnVuY3Rpb24ga2l0dHlfaXNMb2dpbigpIHsKICAgICAgaWYgKGtpdHR5X3V0aWxzLmdldENvb2tpZSgidWlkIikgJiYga2l0dHlfdXRpbHMuZ2V0Q29va2llKCJ0b2tlbiIpKSB7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgIH0gZWxzZSB7CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICB9CiAgICB9CiAgICBmdW5jdGlvbiBraXR0eV9jb3B5VGV4dFRvQ2xpcGJvYXJkKHRleHQpIHsKICAgICAgY29uc3QgdGV4dEFyZWEgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJ0ZXh0YXJlYSIpOwogICAgICB0ZXh0QXJlYS52YWx1ZSA9IHRleHQ7CiAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQodGV4dEFyZWEpOwogICAgICB0ZXh0QXJlYS5zZWxlY3QoKTsKICAgICAgZG9jdW1lbnQuZXhlY0NvbW1hbmQoImNvcHkiKTsKICAgICAgZG9jdW1lbnQuYm9keS5yZW1vdmVDaGlsZCh0ZXh0QXJlYSk7CiAgICAgIGNvbnNvbGUubG9nKCLmlofmnKzlt7LlpI3liLbliLDliarotLTmnb8iKTsKICAgIH0KICAgIGZ1bmN0aW9uIGtpdHR5X2lzUnVuKCkgewogICAgICBsZXQgcnVuID0gZmFsc2U7CiAgICAgIGlmICgKICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIja2l0dHlfdmlwUGFuZWwiKSB8fAogICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIiN2aXBQYW5lbCIpCiAgICAgICkgewogICAgICAgIHJ1biA9IHRydWU7CiAgICAgIH0KICAgICAgaWYgKCFydW4pIHsKICAgICAgICBjb25zb2xlLmxvZygicGFuZWxJbml0Iik7CiAgICAgICAga2l0dHlfdmlwUGFuZWxJbml0KCk7CiAgICAgICAgaWYgKGtpdHR5X2NoZWNrTG9naW4oKSkgewogICAgICAgICAgY29uc29sZS5sb2coImxvZ2luIik7CiAgICAgICAgICBraXR0eV9tYWluKCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGtpdHR5X3Nob3dQYW5lbCgpOwogICAgICAgIH0KICAgICAgfQogICAgfQogICAga2l0dHlfaXNSdW4oKTsKICB9KSgpOw==
Add Comment
Please, Sign In to add comment