1 line
9.3 KiB
JavaScript
1 line
9.3 KiB
JavaScript
Ly8g5rOo5YWl5YWo5bGA5pa55rOVICjku4XmlK/mjIF0dmJveOeahGpzMeS7peWPimMj54mIZHJweeeahGpzMO+8jOaaguS4jeaUr+aMgWRycHnlrpjmlrlweeeJiOeahGpzMCkKLy8g5rOo5YWl5YWo5bGA5pa55rOVICjku4XmlK/mjIF0dmJveOeahGpzMeS7peWPimMj54mIZHJweeeahGpzMO+8jOaaguS4jeaUr+aMgWRycHnlrpjmlrlweeeJiOeahGpzMCkKLy8g5rOo5YWl5YWo5bGA5pa55rOVICjku4XmlK/mjIF0dmJveOeahGpzMeS7peWPimMj54mIZHJweeeahGpzMO+8jOaaguS4jeaUr+aMgWRycHnlrpjmlrlweeeJiOeahGpzMCkKZ2xvYmFsVGhpcy5nZXRIZWFkZXJzID0gZnVuY3Rpb24gKGlucHV0KSB7CiAgICBsZXQgdCA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpLnRvU3RyaW5nKCk7CiAgICBsZXQgaGVhZGVycyA9IHsKICAgICAgICAndmVyc2lvbl9uYW1lJzogJzEuMC42JywKICAgICAgICAndmVyc2lvbl9jb2RlJzogJzYnLAogICAgICAgICdwYWNrYWdlX25hbWUnOiAnY29tLmFwcC5uYW5ndWF0dicsCiAgICAgICAgJ3NpZ24nOiBtZDUoJ2M0MzFlYTU0MmNlZTk2NzkjdUJGc3pkRU0wb0wwSlJuQCcgKyB0KS50b1VwcGVyQ2FzZSgpLAogICAgICAgICdpbWVpJzogJ2M0MzFlYTU0MmNlZTk2NzknLAogICAgICAgICd0aW1lTWlsbGlzJzogdCwKICAgICAgICAnVXNlci1BZ2VudCc6ICdva2h0dHAvNC42LjAnCiAgICB9OwogICAgcmV0dXJuIGhlYWRlcnMKfQoKdmFyIHJ1bGUgPSB7CiAgICB0aXRsZTogJ+eVheaipuW9seinhlvkvJhdJywKICAgIGhvc3Q6ICdodHRwOi8veXMuY2hhbmdtZW5neXVuLmNvbScsCiAg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AgICAgIlVzZXItQWdlbnQiOiAib2todHRwLzQuNi4wIgogICAgfSwKICAgIHRpbWVvdXQ6IDUwMDAsCiAgICBjbGFzc19uYW1lOiAn55S16KeG5YmnJueUteW9sSbliqjmvKsm57u86Im6Jua1t+WklueyvumAiScsIC8vIC9hcGkucGhwL3Byb3ZpZGUvaG9tZV9uYXYKICAgIGNsYXNzX3VybDogJzImMSY0JjMmNDYnLAogICAgbGltaXQ6IDIwLAogICAgcGxheV9wYXJzZTogdHJ1ZSwKICAgIGxhenk6IGBqczoKICAgICAgICB0cnkgewogICAgICAgICAgICBmdW5jdGlvbiBnZXR2aWRlbyh1cmwpIHsKICAgICAgICAgICAgICAgIGxldCBqRGF0YSA9IEpTT04ucGFyc2UocmVxdWVzdCh1cmwsIHsKICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBnZXRIZWFkZXJzKHVybCkKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIGlmIChqRGF0YS5jb2RlID09IDEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gakRhdGEuZGF0YS51cmwKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdodHRwOi8vNDMuMTU0LjEwNC4xNTI6MTIzNC9qaGFwaS9jcy5waHA/dXJsPScgKyB1cmwuc3BsaXQoJz0nKVsxXQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICgvLC8udGVzdChpbnB1dCkpIHsKICAgICAgICAgICAgICAgIGxldCBtanVybCA9IGlucHV0LnNwbGl0KCcsJylbMV0KICAgICAgICAgICAgICAgIGxldCB2aWRlb1VybCA9IGdldHZpZGVvKG1qdXJsKTsKICAgICAgICAgICAgICAgIGlucHV0ID0gewogICAgICAgICAgICAgICAgICAgIGp4OiAwLAogICAgICAgICAgICAgICAgICAgIHVybDogdmlkZW9VcmwsCiAgICAgICAgICAgICAgICAgICAgcGFyc2U6IDAsCiAgICAgICAgICAgICAgICAgICAgaGVhZGVyOiBKU09OLnN0cmluZ2lmeSh7CiAgICAgICAgICAgICAgICAgICAgICAgICd1c2VyLWFnZW50JzogJ0xhdmYvNTguMTIuMTAwJwogICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBsZXQgdmlkZW9VcmwgPSBnZXR2aWRlbyhpbnB1dCk7CiAgICAgICAgICAgICAgICBpZiAoL2poYXBpLy50ZXN0KHZpZGVvVXJsKSkgewogICAgICAgICAgICAgICAgICAgIHZpZGVvVXJsID0gZ2V0dmlkZW8odmlkZW9VcmwpOwogICAgICAgICAgICAgICAgICAgIGlucHV0ID0gewogICAgICAgICAgICAgICAgICAgICAgICBqeDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB2aWRlb1VybCwKICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2U6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcjogSlNPTi5zdHJpbmdpZnkoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZXItYWdlbnQnOiAnTGF2Zi81OC4xMi4xMDAnCiAgICAgICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBpbnB1dCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgang6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogdmlkZW9VcmwsCiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlOiAwCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICBsb2coZS50b1N0cmluZygpKQogICAgICAgIH0KCWAsCiAgICDmjqjojZA6IGBqczoKICAgICAgICB2YXIgZCA9IFtdOwogICAgICAgIGxldCBodG1sID0gcmVxdWVzdChpbnB1dCwgewogICAgICAgICAgICBoZWFkZXJzOiBnZXRIZWFkZXJzKGlucHV0KQogICAgICAgIH0pOwogICAgICAgIGh0bWwgPSBKU09OLnBhcnNlKGh0bWwpOwogICAgICAgIGh0bWwuZm9yRWFjaChmdW5jdGlvbihpdCkgewogICAgICAgICAgICBkLnB1c2goewogICAgICAgICAgICAgICAgdGl0bGU6IGl0Lm5hbWUsCiAgICAgICAgICAgICAgICBpbWc6IGl0LmltZywKICAgICAgICAgICAgICAgIGRlc2M6IGl0LnJlbWFya3MsCiAgICAgICAgICAgICAgICB1cmw6IGl0LmlkCiAgICAgICAgICAgIH0pCiAgICAgICAgfSk7CiAgICAgICAgc2V0UmVzdWx0KGQpOwogICAgYCwKICAgIOS4gOe6pzogYGpzOgoJCXZhciBkID0gW107CgkJbGV0IGh0bWwgPSByZXF1ZXN0KGlucHV0LCB7CgkJCWhlYWRlcnM6IGdldEhlYWRlcnMoaW5wdXQpCgkJfSk7CgkJaHRtbCA9IEpTT04ucGFyc2UoaHRtbCk7CgkJaHRtbC5saXN0LmZvckVhY2goZnVuY3Rpb24oaXQpIHsKCQkJZC5wdXNoKHsKCQkJCXRpdGxlOiBpdC5uYW1lLAoJCQkJaW1nOiBpdC5pbWcsCgkJCQlkZXNjOiBpdC5tc2csCgkJCQl1cmw6IGl0LmlkCgkJCX0pCgkJfSk7CgkJc2V0UmVzdWx0KGQpOwoJYCwKICAgIOS6jOe6pzogYGpzOgogICAgICAgIHZhciBkID0gW107CiAgICAgICAgVk9EID0gewogICAgICAgICAgICB2b2RfaWQ6IGlucHV0LnNwbGl0KCdpZD0nKVsxXQogICAgICAgIH07CiAgICAgICAgdHJ5IHsKICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KGlucHV0LCB7CiAgICAgICAgICAgICAgICBoZWFkZXJzOiBnZXRIZWFkZXJzKGlucHV0KQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgaHRtbCA9IEpTT04ucGFyc2UoaHRtbCk7CiAgICAgICAgICAgIGxldCBub2RlID0gaHRtbC5kYXRhOwogICAgICAgICAgICBWT0QgPSB7CiAgICAgICAgICAgICAgICB2b2RfbmFtZTogbm9kZVsnbmFtZSddLAogICAgICAgICAgICAgICAgdm9kX3BpYzogbm9kZVsnaW1nJ10sCiAgICAgICAgICAgICAgICB0eXBlX25hbWU6IG5vZGVbJ3R5cGUnXSwKICAgICAgICAgICAgICAgIHZvZF95ZWFyOiBub2RlWyd5ZWFyJ10sCiAgICAgICAgICAgICAgICB2b2RfcmVtYXJrczogJ+abtOaWsOiHszogJyArIG5vZGVbJ21zZyddICsgJyAvIOivhOWIhjogJyArIG5vZGVbJ3Njb3JlJ10sCiAgICAgICAgICAgICAgICB2b2RfY29udGVudDogbm9kZVsnaW5mbyddLnN0cmlwKCkKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbGV0IGVwaXNvZGVzID0gbm9kZS5wbGF5ZXJfaW5mbzsKICAgICAgICAgICAgbGV0IHBsYXlNYXAgPSB7fTsKICAgICAgICAgICAgaWYgKHR5cGVvZiBwbGF5X3VybCA9PT0gJ3VuZGVmaW5lZCcpIHsKICAgICAgICAgICAgICAgIHZhciBwbGF5X3VybCA9ICcnCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXBpc29kZXMuZm9yRWFjaChmdW5jdGlvbihlcCkgewogICAgICAgICAgICAgICAgbGV0IHBsYXl1cmxzID0gZXBbJ3ZpZGVvX2luZm8nXTsKICAgICAgICAgICAgICAgIHBsYXl1cmxzLmZvckVhY2goZnVuY3Rpb24ocGxheXVybCkgewogICAgICAgICAgICAgICAgICAgIGxldCBzb3VyY2UgPSBlcFsnc2hvdyddOwogICAgICAgICAgICAgICAgICAgIGlmICghcGxheU1hcC5oYXNPd25Qcm9wZXJ0eShzb3VyY2UpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBsYXlNYXBbc291cmNlXSA9IFtdCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHBsYXlNYXBbc291cmNlXS5hcHBlbmQocGxheXVybFsnbmFtZSddLnN0cmlwKCkgKyAnJCcgKyBwbGF5X3VybCArIHVybGVuY29kZShwbGF5dXJsWyd1cmwnXSkpCiAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgbGV0IHBsYXlGcm9tID0gW107CiAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IFtdOwogICAgICAgICAgICBPYmplY3Qua2V5cyhwbGF5TWFwKQogICAgICAgICAgICAgICAgLmZvckVhY2goZnVuY3Rpb24oa2V5KSB7CiAgICAgICAgICAgICAgICAgICAgcGxheUZyb20uYXBwZW5kKGtleSk7CiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QuYXBwZW5kKHBsYXlNYXBba2V5XS5qb2luKCcjJykpCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgbGV0IHZvZF9wbGF5X2Zyb20gPSBwbGF5RnJvbS5qb2luKCckJCQnKTsKICAgICAgICAgICAgbGV0IHZvZF9wbGF5X3VybCA9IHBsYXlMaXN0LmpvaW4oJyQkJCcpOwogICAgICAgICAgICBWT0RbJ3ZvZF9wbGF5X2Zyb20nXSA9IHZvZF9wbGF5X2Zyb207CiAgICAgICAgICAgIFZPRFsndm9kX3BsYXlfdXJsJ10gPSB2b2RfcGxheV91cmwKICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgIGxvZygn6I635Y+W5LqM57qn6K+m5oOF6aG15Y+R55Sf6ZSZ6K+vOicgKyBlLm1lc3NhZ2UpCiAgICAgICAgfQoJYCwKICAgIOaQnOe0ojogYGpzOgogICAgICAgIHZhciBkID0gW107CiAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KGlucHV0LCB7CiAgICAgICAgICAgIGhlYWRlcnM6IGdldEhlYWRlcnMoaW5wdXQpCiAgICAgICAgfSk7CiAgICAgICAgaHRtbCA9IEpTT04ucGFyc2UoaHRtbCk7CiAgICAgICAgaHRtbC5kYXRhLmZvckVhY2goZnVuY3Rpb24oaXQpIHsKICAgICAgICAgICAgZC5wdXNoKHsKICAgICAgICAgICAgICAgIHRpdGxlOiBpdC52aWRlb19uYW1lLAogICAgICAgICAgICAgICAgaW1nOiBpdC5pbWcsCiAgICAgICAgICAgICAgICBkZXNjOiBpdC5xaW5neGlkdSArICcvJyArIGl0LmNhdGVnb3J5LAogICAgICAgICAgICAgICAgdXJsOiBpdC5pZCwKICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGl0LmJsdXJiCiAgICAgICAgICAgIH0pCiAgICAgICAgfSk7CiAgICAgICAgc2V0UmVzdWx0KGQpOwogICAgYCwKfQ== |