Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

base64_decode('PD9waHANCg0KDQoNCnJlcXVpcmVfb25jZSgnaW5jbHVkZS9ldmVudHMvU3FsUmVzdWx0SXRlcmF..

Decoded Output download

<?  base64_decode('PD9waHANCg0KDQoNCnJlcXVpcmVfb25jZSgnaW5jbHVkZS9ldmVudHMvU3FsUmVzdWx0SXRlcmF0b3IuaW5jJyk7DQpyZXF1aXJlX29uY2UoJ21vZHVsZXMvY29tX3Z0aWdlcl93b3JrZmxvdy9WVEVudGl0eUNhY2hlLmluYycpOw0KDQpyZXF1aXJlX29uY2UgJ2luY2x1ZGUvV2Vic2VydmljZXMvVXRpbHMucGhwJzsNCnJlcXVpcmVfb25jZSgibW9kdWxlcy9Vc2Vycy9Vc2Vycy5waHAiKTsNCnJlcXVpcmVfb25jZSgiaW5jbHVkZS9XZWJzZXJ2aWNlcy9WdGlnZXJDUk1PYmplY3QucGhwIik7DQpyZXF1aXJlX29uY2UoImluY2x1ZGUvV2Vic2VydmljZXMvVnRpZ2VyQ1JNT2JqZWN0TWV0YS5waHAiKTsNCnJlcXVpcmVfb25jZSgiaW5jbHVkZS9XZWJzZXJ2aWNlcy9EYXRhVHJhbnNmb3JtLnBocCIpOw0KcmVxdWlyZV9vbmNlKCJpbmNsdWRlL1dlYnNlcnZpY2VzL1dlYlNlcnZpY2VFcnJvci5waHAiKTsNCnJlcXVpcmVfb25jZSAnaW5jbHVkZS91dGlscy91dGlscy5waHAnOw0KcmVxdWlyZV9vbmNlICdpbmNsdWRlL1dlYnNlcnZpY2VzL01vZHVsZVR5cGVzLnBocCc7DQpyZXF1aXJlX29uY2UoJ2luY2x1ZGUvV2Vic2VydmljZXMvUmV0cmlldmUucGhwJyk7DQpyZXF1aXJlX29uY2UoJ2luY2x1ZGUvV2Vic2VydmljZXMvVXBkYXRlLnBocCcpOw0KcmVxdWlyZV9vbmNlICdpbmNsdWRlL1dlYnNlcnZpY2VzL1d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A9ICR0aGlzLT5pc1JURkFjdGl2YXRlZCgpOw0KICAgICAgICAgICAgaWYgKCEkUlRGX0FjdGl2YXRlZCkgew0KICAgICAgICAgICAgICAgIHJldHVybiAkcmVzdWx0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQoNCiAgICAgICAgaWYgKGlzc2V0KCR0aGlzLT5wcm9maWxlc0FjdGlvbnNbJGFjdGlvbktleV0pKSB7DQogICAgICAgICAgICAkYWN0aW9uaWQgPSBnZXRBY3Rpb25pZCgkdGhpcy0+cHJvZmlsZXNBY3Rpb25zWyRhY3Rpb25LZXldKTsNCiAgICAgICAgICAgICR0aGlzLT5HZXRQcm9maWxlc1Blcm1pc3Npb25zKCk7DQoNCiAgICAgICAgICAgICRwZXJtaXNzaW9ucyA9ICR0aGlzLT5wcm9maWxlc1Blcm1pc3Npb25zOw0KDQogICAgICAgICAgICBpZiAoaXNzZXQoJHBlcm1pc3Npb25zWyRwcm9maWxlaWRbMF1dWyRhY3Rpb25pZF0pICYmICRwZXJtaXNzaW9uc1skcHJvZmlsZWlkWzBdXVskYWN0aW9uaWRdID09ICIwIikgew0KICAgICAgICAgICAgICAgICRyZXN1bHQgPSB0cnVlOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQoNCiAgICAgICAgcmV0dXJuICRyZXN1bHQ7DQogICAgfQ0KDQogICAgcHVibGljIGZ1bmN0aW9uIGlzUlRGQWN0aXZhdGVkKCkNCiAgICB7DQogICAgICAgIHJldHVybiBmYWxzZTsNCiAgICB9DQoNCiAgICBwdWJsaWMgZnVuY3Rpb24gR2V0UHJvZmlsZXNQZXJtaXNzaW9ucygpDQogICAgew0KICAgICAgICBpZiAoY291bnQoJHRoaXMtPnByb2ZpbGVzUGVybWlzc2lvbnMpID09IDApIHsNCg0KICAgICAgICAgICAgJGFkYiA9IFBlYXJEYXRhYmFzZTo6Z2V0SW5zdGFuY2UoKTsNCiAgICAgICAgICAgICRwcm9maWxlcyA9IFNldHRpbmdzX1Byb2ZpbGVzX1JlY29yZF9Nb2RlbDo6Z2V0QWxsKCk7DQoNCiAgICAgICAgICAgICRzcWwgPSAiU0VMRUNUICogRlJPTSB2dGlnZXJfcGRmbWFrZXJfcHJvZmlsZXNwZXJtaXNzaW9ucyI7DQogICAgICAgICAgICAkcmVzID0gJGFkYi0+cHF1ZXJ5KCRzcWwsIGFycmF5KCkpOw0KICAgICAgICAgICAgJHBlcm1pc3Npb25zID0gYXJyYXkoKTsNCiAgICAgICAgICAgIHdoaWxlICgkcm93ID0gJGFkYi0+ZmV0Y2hCeUFzc29jKCRyZXMpKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc3NldCgkcHJvZmlsZXNbJHJvd1sicHJvZmlsZWlkIl1dKSkgew0KICAgICAgICAgICAgICAgICAgICAkcGVybWlzc2lvbnNbJHJvd1sicHJvZmlsZWlkIl1dWyRyb3dbIm9wZXJhdGlvbiJdXSA9ICRyb3dbInBlcm1pc3Npb25zIl07DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICBmb3JlYWNoICgkcHJvZmlsZXMgYXMgJHByb2ZpbGVpZCA9PiAkcHJvZmlsZW5hbWUpIHsNCiAgICAgICAgICAgICAgICBmb3JlYWNoICgkdGhpcy0+cHJvZmlsZXNBY3Rpb25zIGFzICRhY3Rpb25OYW1lKSB7DQogICAgICAgICAgICAgICAgICAgICRhY3Rpb25JZCA9IGdldEFjdGlvbmlkKCRhY3Rpb25OYW1lKTsNCiAgICAgICAgICAgICAgICAgICAgaWYgKCFpc3NldCgkcGVybWlzc2lvbnNbJHByb2ZpbGVpZF1bJGFjdGlvbklkXSkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICRwZXJtaXNzaW9uc1skcHJvZmlsZWlkXVskYWN0aW9uSWRdID0gIjAiOw0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgIC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AgICAgICAgJGFkYiA9IFBlYXJEYXRhYmFzZTo6Z2V0SW5zdGFuY2UoKTsNCg0KICAgICAgICAkc3FsID0gIlNFTEVDVCBvd25lciwgc2hhcmluZ3R5cGUgRlJPTSB2dGlnZXJfcGRmbWFrZXJfc2V0dGluZ3MgV0hFUkUgdGVtcGxhdGVpZCA9ID8iOw0KICAgICAgICAkcmVzdWx0ID0gJGFkYi0+cHF1ZXJ5KCRzcWwsIGFycmF5KCR0ZW1wbGF0ZWlkKSk7DQogICAgICAgICRyb3cgPSAkYWRiLT5mZXRjaEJ5QXNzb2MoJHJlc3VsdCk7DQoNCiAgICAgICAgJG93bmVyID0gJHJvd1sib3duZXIiXTsNCiAgICAgICAgJHNoYXJpbmd0eXBlID0gJHJvd1sic2hhcmluZ3R5cGUiXTsNCg0KICAgICAgICAkcmVzdWx0ID0gZmFsc2U7DQogICAgICAgIGlmICgkb3duZXIgPT0gJGN1cnJlbnRfdXNlci0+aWQpIHsNCiAgICAgICAgICAgICRyZXN1bHQgPSB0cnVlOw0KICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgc3dpdGNoICgkc2hhcmluZ3R5cGUpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAiIjoNCiAgICAgICAgICAgICAgICBjYXNlICJwdWJsaWMiOg0KICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gdHJ1ZTsNCiAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICJwcml2YXRlIjoNCiAgICAgICAgICAgICAgICAgICAgJHN1Ym9yZGluYXRlVXNlcnMgPSAkdGhpcy0+Z2V0U3ViUm9sZVVzZXJJZHMoJGN1cnJlbnRfdXNlci0+cm9sZWlkKTsNCiAgICAgICAgICAgICAgICAgICAgaWYgKCFlbXB0eSgkc3Vib3JkaW5hdGVVc2VycykgJiYgY291bnQoJHN1Ym9yZGluYXRlVXNlcnMpID4gMCkgew0KICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IGluX2FycmF5KCRvd25lciwgJHN1Ym9yZGluYXRlVXNlcnMpOw0KICAgICAgICAgICAgICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IGZhbHNlOw0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICJzaGFyZSI6DQogICAgICAgICAgICAgICAgICAgICRzdWJvcmRpbmF0ZVVzZXJzID0gJHRoaXMtPmdldFN1YlJvbGVVc2VySWRzKCRjdXJyZW50X3VzZXItPnJvbGVpZCk7DQogICAgICAgICAgICAgICAgICAgIGlmICghZW1wdHkoJHN1Ym9yZGluYXRlVXNlcnMpICYmIGNvdW50KCRzdWJvcmRpbmF0ZVVzZXJzKSA+IDAgJiYgaW5fYXJyYXkoJG93bmVyLCAkc3Vib3JkaW5hdGVVc2VycykpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgICAgICAgICAgICAgJG1lbWJlcl9hcnJheSA9ICR0aGlzLT5HZXRTaGFyaW5nTWVtYmVyQXJyYXkoJHRlbXBsYXRlaWQpOw0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzc2V0KCRtZW1iZXJfYXJyYXlbInVzZXJzIl0pICYmIGluX2FycmF5KCRjdXJyZW50X3VzZXItPmlkLCAkbWVtYmVyX2FycmF5WyJ1c2VycyJdKSkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlaWYgKGlzc2V0KCRtZW1iZXJfYXJyYXlbInJvbGVzIl0pICYmIGluX2FycmF5KCRjdXJyZW50X3VzZXItPnJvbGVpZCwgJG1lbWJlcl9hcnJheVsicm9sZXMiXSkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gdHJ1ZTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzc2V0KCRtZW1iZXJfYXJyYXlbInJzIl0pKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2ggKCRtZW1iZXJfYXJyYXlbInJzIl0gYXMgJHJvbGVpZCkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJvbGVBbmRzdWJvcmRpbmF0ZVJvbGVzID0gZ2V0Um9sZUFuZFN1Ym9yZGluYXRlc1JvbGVJZHMoJHJvbGVpZCk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5fYXJyYXkoJGN1cnJlbnRfdXNlci0+cm9sZWlkLCAkcm9sZUFuZHN1Ym9yZGluYXRlUm9sZXMpKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IHRydWU7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJHJlc3VsdCA9PSBmYWxzZSAmJiBpc3NldCgkbWVtYmVyX2FycmF5WyJncm91cHMiXSkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJGN1cnJlbnRfdXNlcl9ncm91cHMgPSBleHBsb2RlKCIsIiwgZmV0Y2hVc2VyR3JvdXBpZHMoJGN1cnJlbnRfdXNlci0+aWQpKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlc19hcnJheSA9IGFycmF5X2ludGVyc2VjdCgkbWVtYmVyX2FycmF5WyJncm91cHMiXSwgJGN1cnJlbnRfdXNlcl9ncm91cHMpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVtcHR5KCRyZXNfYXJyYXkpICYmIGNvdW50KCRyZXNfYXJyYXkpID4gMCkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IHRydWU7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gZmFsc2U7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNzZXQoJG1lbWJlcl9hcnJheVsiY29tcGFuaWVzIl0pKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2ggKCRtZW1iZXJfYXJyYXlbImNvbXBhbmllcyJdIGFzICRjb21wYW55SWQpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChJVFM0WW91TXVsdGlDb21wYW55X1JlY29yZF9Nb2RlbDo6aXNSb2xlSW5Db21wYW55KCRjb21wYW55SWQsICRjdXJyZW50X3VzZXItPnJvbGVpZCkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gdHJ1ZTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgICAgICAgIC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SJdID09ICIwIikgew0KICAgICAgICAgICAgICAgICAgICAkcGRmdGVtcGxhdGVhcnJheVsnc3RhdHVzJ10gPSAwOw0KICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICRwZGZ0ZW1wbGF0ZWFycmF5WydzdGF0dXMnXSA9IDE7DQogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoJHN0YXR1c19hcnJbJHRlbXBsYXRlaWRdWyJpc19kZWZhdWx0Il0pIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgIjEiOg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzdWZmaXggPSAiICgiIC4gdnRyYW5zbGF0ZSgiTEJMX0RFRkFVTFRfTk9QQVIiLCAiUERGTWFrZXIiKSAuICIgIiAuIHZ0cmFuc2xhdGUoIkxCTF9GT1JfRFYiLCAiUERGTWFrZXIiKSAuICIpIjsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCg0KICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAiMiI6DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgJHN1ZmZpeCA9ICIgKCIgLiB2dHJhbnNsYXRlKCJMQkxfREVGQVVMVF9OT1BBUiIsICJQREZNYWtlciIpIC4gIiAiIC4gdnRyYW5zbGF0ZSgiTEJMX0ZPUl9MViIsICJQREZNYWtlciIpIC4gIikiOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KDQogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICIzIjoNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc3VmZml4ID0gIiAoIiAuIHZ0cmFuc2xhdGUoIkxCTF9ERUZBVUxUX05PUEFSIiwgIlBERk1ha2VyIikgLiAiKSI7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQogICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICAk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XRhIGFzICRrZXkgPT4gJHRlbXBsYXRlQXJyKSB7DQogICAgICAgICAgICAgICAgJG1vZHVsZXNbJHRlbXBsYXRlQXJyWyJtb2R1bGUiXV1bJGtleV0gPSAkdGVtcGxhdGVBcnJbIm9yZGVyIl07DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICR0bXBBcnIgPSBhcnJheSgpOw0KICAgICAgICAgICAgZm9yZWFjaCAoJG1vZHVsZXMgYXMgJG9yZGVyQXJyKSB7DQogICAgICAgICAgICAgICAgaWYgKCRvcmlnaW5EaXIgPT0gImFzYyIpIHsNCiAgICAgICAgICAgICAgICAgICAgYXNvcnQoJG9yZGVyQXJyLCBTT1JUX05VTUVSSUMpOw0KICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgIGFyc29ydCgkb3JkZXJBcnIsIFNPUlRfTlVNRVJJQyk7DQogICAgICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICAgICAgZm9yZWFjaCAoJG9yZGVyQXJyIGFzICRyZElkeCA9PiAkb3JkZXIpIHsNCiAgICAgICAgICAgICAgICAgICAgJHRtcEFycltdID0gJHJldHVybl9kYXRhWyRyZElkeF07DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgJHJldHVybl9kYXRhID0gJHRtcEFycjsNCiAgICAgICAgfQ0KDQogICAgICAgIHJldHVybiAkcmV0dXJuX2RhdGE7DQogICAgfQ0KDQogICAgcHVibGljIGZ1bmN0aW9uIEdldExpc3R2aWV3UmVzdWx0KCRvcmRlcmJ5ID0gInRlbXBsYXRlaWQiLCAkZGlyID0gIkFTQyIsICRyZXF1ZXN0LCAkYWxsX2RhdGEgPSB0cnVlKQ0KICAgIHsNCiAgICAgICAgJGFkYiA9IFBlYXJEYXRhYmFzZTo6Z2V0SW5zdGFuY2UoKTsNCg0KICAgICAgICAkc3FsID0gIlNFTEVDVCB2dGlnZXJfcGRmbWFrZXJfZGlzcGxheWVk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VUxMIE9SIHZ0aWdlcl9wZGZtYWtlci50eXBlID0gJycpICI7DQogICAgICAgIGlmICgkcmVxdWVzdCkgew0KDQogICAgICAgICAgICBpZiAoJHJlcXVlc3QtPmhhcygnYmxvY2t0eXBlJykgJiYgISRyZXF1ZXN0LT5pc0VtcHR5KCdibG9ja3R5cGUnKSkgew0KICAgICAgICAgICAgICAgICRSX0F0cltdID0gJHJlcXVlc3QtPmdldCgnYmxvY2t0eXBlJyk7DQogICAgICAgICAgICAgICAgJFNlYXJjaFtdID0gIiB2dGlnZXJfcGRmbWFrZXIudHlwZSA9ID8gIjsNCiAgICAgICAgICAgICAgICAkc2IgPSAiIjsNCg0KICAgICAgICAgICAgICAgICRzcSA9ICJ2dGlnZXJfcGRmbWFrZXIubW9kdWxlIElTIE5VTEwgT1IgdnRpZ2VyX3BkZm1ha2VyLm1vZHVsZSA9ICcnIjsNCiAgICAgICAgICAgICAgICBpZiAoJHJlcXVlc3QtPmhhcygnc2VsZWN0X21vZHVsZScpICYmICEkcmVxdWVzdC0+aXNFbXB0eSgnc2VsZWN0X21vZHVsZScpKSB7DQogICAgICAgICAgICAgICAgICAgICRSX0F0cltdID0gJHJlcXVlc3QtPmdldCgnc2VsZWN0X21vZHVsZScpOw0KICAgICAgICAgICAgICAgICAgICAkU2VhcmNoW10gPSAiKCIgLiAkc3EgLiAiIE9SIHZ0aWdlcl9wZGZtYWtlci5tb2R1bGUgPSA/KSI7DQogICAgICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICAgICAgJFNlYXJjaFtdID0gIigiIC4gJHNxIC4gIikiOw0KICAgICAgICAgICAgICAgIH0NCg0KDQogICAgICAgICAgICB9IGVsc2VpZiAoJHJlcXVlc3QtPmhhcygnbW9kZScpICYmICEkcmVxdWVzdC0+aXNFbXB0eSgnbW9kZScpKSB7DQogICAgICAgICAgICAgICAgJG1vZGUgPSAkcmVxdWVzdC0+Z2V0KCdtb2RlJyk7DQoNCiAgICAgICAgICAgICAgICBpZiAoJG1vZGUgPT0gIkJsb2NrcyIpIHsNCiAgICAgICAgICAgICAgICAgICAgJHNiID0gInZ0aWdlcl9wZGZtYWtlci50eXBlIElTIE5PVCBOVUxMIEFORCB2dGlnZXJfcGRmbWFrZXIudHlwZSAhPSAnJyAiOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH0NCg0KDQogICAgICAgICAgICBpZiAoJHJlcXVlc3QtPmhhcygnc2VhcmNoX3BhcmFtcycpICYmICEkcmVxdWVzdC0+aXNFbXB0eSgnc2VhcmNoX3BhcmFtcycpKSB7DQoNCiAgICAgICAgICAgICAgICAkbGlzdFNlYXJjaFBhcmFtcyA9ICRyZXF1ZXN0LT5nZXQoJ3NlYXJjaF9wYXJhbXMnKTsNCg0KICAgICAgICAgICAgICAgIGZvcmVhY2ggKCRsaXN0U2VhcmNoUGFyYW1zIGFzICRncm91cEluZm8pIHsNCiAgICAgICAgICAgICAgICAgICAgaWYgKGVtcHR5KCRncm91cEluZm8pKSB7DQogICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsNCiAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICBmb3JlYWNoICgkZ3JvdXBJbmZvIGFzICRmaWVsZFNlYXJjaEluZm8pIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICRzdCA9ICRmaWVsZFNlYXJjaEluZm9bMF07DQogICAgICAgICAgICAgICAgICAgICAgICAkb3BlcmF0b3IgPSAkZmllbGRTZWFyY2hJbmZvWzFdOw0KICAgICAgICAgICAgICAgICAgICAgICAgJHNlYXJjaF92YWwgPSAkZmllbGRTZWFyY2hJbmZvWzJdOw0KDQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5fYXJyYXkoJHN0LCAkU2VhcmNoX1R5cGVzKSkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkc3QgPT0gImZpbGVuYW1lIiB8fCAkc3QgPT0gImRlc2NyaXB0aW9uIikgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2VhcmNoX3ZhbCA9ICIlIiAuICRzZWFyY2hfdmFsIC4gIiUiOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkU2VhcmNoW10gPSAidnRpZ2VyX3BkZm1ha2VyLiIgLiAkc3QgLiAiIExJS0UgPyI7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlaWYgKCRzdCA9PSAib3duZXIiIHx8ICRzdCA9PSAic2hhcmluZ3R5cGUiKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRTZWFyY2hbXSA9ICJ2dGlnZXJfcGRmbWFrZXJfc2V0dGluZ3MuIiAuICRzdCAuICIgPSA/IjsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2VpZiAoJHN0ID09ICJmb3Jtb2R1bGUiKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRTZWFyY2hbXSA9ICJ2dGlnZXJfcGRmbWFrZXIubW9kdWxlID0gPyI7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJFNlYXJjaFtdID0gInZ0aWdlcl9wZGZtYWtlci4iIC4gJHN0IC4gIiA9ID8iOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkUl9BdHJbXSA9ICRzZWFyY2hfdmFsOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRzdCA9PSAic3RhdHVzIikgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzZWFyY2hfc3RhdHVzID0gJHNlYXJjaF92YWw7DQogICAgICAgICAgICAgICAgICAgICAgICB9DQoNCg0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQ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yZWFrOw0KDQogICAgICAgICAgICAgICAgY2FzZSAiMSI6DQogICAgICAgICAgICAgICAgICAgICRpc19kZWZhdWx0ID0gdnRyYW5zbGF0ZSgiTEJMX0ZPUl9EViIsICJQREZNYWtlciIpIC4gJHllc19pbWcgLiAnJm5ic3A7Jm5ic3A7JzsNCiAgICAgICAgICAgICAgICAgICAgJGlzX2RlZmF1bHQgLj0gdnRyYW5zbGF0ZSgiTEJMX0ZPUl9MViIsICJQREZNYWtlciIpIC4gJG5vX2ltZzsNCiAgICAgICAgICAgICAgICAgICAgJGRlZmF1bHRCdXR0b24gPSB2dHJhbnNsYXRlKCJMQkxfVU5TRVRBU0RFRkFVTFQiLCAiUERGTWFrZXIiKTsNCiAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQoNCiAgICAgICAgICAgICAgICBjYXNlICIyIjoNCiAgICAgICAgICAgICAgICAgICAgJGlzX2RlZmF1bHQgPSB2dHJhbnNsYXRlKCJMQkxfRk9SX0RWIiwgIlBERk1ha2VyIikgLiAkbm9faW1nIC4gJyZuYnNwOyZuYnNwOyc7DQogICAgICAgICAgICAgICAgICAgICRpc19kZWZhdWx0IC49IHZ0cmFuc2xhdGUoIkxCTF9GT1JfTFYiLCAiUERGTWFrZXIiKSAuICR5ZXNfaW1nOw0KICAgICAgICAgICAgICAgICAgICAkZGVmYXVsdEJ1dHRvbiA9IHZ0cmFuc2xhdGUoIkxCTF9VTlNFVEFTREVGQVVMVCIsICJQREZNYWtlciIpOw0KICAgICAgICAgICAgICAgICAgICBicmVhazsNCg0KICAgICAgICAgICAgICAgIGNhc2UgIjMiOg0KICAgICAgICAgICAgICAgICAgICAkaXNfZGVmYXVsdCA9IHZ0cmFuc2xhdGUoIkxCTF9GT1JfRFYiLCAiUERGTWFrZXIiKSAuICR5ZXNfaW1nIC4gJyZuYnNwOyZuYnNwOyc7DQogICAgICAgICAgICAgICAgICAgICRpc19kZWZhdWx0IC49IHZ0cmFuc2xhdGUoIkxCTF9GT1JfTFY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mF5KA0KICAgICAgICAgICAgJ2N1cnJlbmN5X3BvaW50JyA9PiAnLCcsDQogICAgICAgICAgICAnY3VycmVuY3knID0+ICcyJywNCiAgICAgICAgICAgICdjdXJyZW5jeV90aG91c2FuZHMnID0+ICcuJywNCiAgICAgICAgKTsNCiAgICB9DQoNCiAgICBwdWJsaWMgZnVuY3Rpb24gZ2V0TGlzdFZpZXdMaW5rcygkbGlua1BhcmFtcykNCiAgICB7DQogICAgICAgICRjdXJyZW50VXNlck1vZGVsID0gVXNlcnNfUmVjb3JkX01vZGVsOjpnZXRDdXJyZW50VXNlck1vZGVsKCk7DQoNCiAgICAgICAgJGxpbmtUeXBlcyA9IGFycmF5KCdMSVNUVklFV01BU1NBQ1RJT04nLCAnTElTVFZJRVdTRVRUSU5HJyk7DQogICAgICAgICRsaW5rcyA9IFZ0aWdlcl9MaW5rX01vZGVsOjpnZXRBbGxCeVR5cGUoJHRoaXMtPmdldElkKCksICRsaW5rVHlwZXMsICRsaW5rUGFyYW1zKTsNCg0KICAgICAgICBpZiAoJHRoaXMtPkNoZWNrUGVybWlzc2lvbnMoIkRFTEVURSIpICYmICR0aGlzLT5nZXRWZXJzaW9uVHlwZSgpICE9ICJkZWFjdGl2YXRlIikgew0KICAgICAgICAgICAgJG1hc3NBY3Rpb25MaW5rID0gYXJyYXkoDQogICAgICAgICAgICAgICAgJ2xpbmt0eXBlJyA9PiAnTElTVFZJRVdNQVNTQUNUSU9OJywNCiAgICAgICAgICAgICAgICAnbGlua2xhYmVsJyA9PiAnTEJMX0RFTEVURScsDQogICAgICAgICAgICAgICAgJ2xpbmt1cmwnID0+ICdqYXZhc2NyaXB0OlZ0aWdlcl9MaXN0X0pzLm1hc3NEZWxldGVSZWNvcmRzKCJpbmRleC5waHA/bW9kdWxlPVBERk1ha2VyJmFjdGlvbj1NYXNzRGVsZXRlIiknLA0KICAgICAgICAgICAgICAgICdsaW5raWNvbicgPT4gJycNCiAgICAgICAgICAgICk7DQoNCiAgICAgICAgICAgICRsaW5rc1snTElTVFZJRVdNQVNTQUNUSU9OJ11bXSA9IFZ0aWdlcl9MaW5rX01vZGVsOjpnZXRJbnN0YW5jZUZyb21WYWx1ZXMoJG1hc3NBY3Rpb25MaW5rKTsNCiAgICAgICAgfQ0KDQogICAgICAgICRxdWlja0xpbmtzID0gYXJyYXkoKTsNCiAgICAgICAgaWYgKCR0aGlzLT5DaGVja1Blcm1pc3Npb25zKCJFRElUIikgJiYgJHRoaXMtPmdldFZlcnNpb25UeXBlKCkgIT0gImRlYWN0aXZhdGUiKSB7DQogICAgICAgICAgICAkcXVpY2tMaW5rcyBbXSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICdsaW5rdHlwZScgPT4gJ0xJU1RWSUVXJywNCiAgICAgICAgICAgICAgICAnbGlua2xhYmVsJyA9PiAnTEJMX0lNUE9SVCcsDQogICAgICAgICAgICAgICAgJ2xpbmt1cmwnID0+ICdqYXZhc2NyaXB0OlZ0aWdlcl9JbXBvcnRfSnMudHJpZ2dlckltcG9ydEFjdGlvbigiaW5kZXgucGhwP21vZHVsZT1QREZNYWtlciZ2aWV3PUltcG9ydCIpJywNCiAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnDQogICAgICAgICAgICApOw0KICAgICAgICB9DQoNCiAgICAgICAgaWYgKCR0aGlzLT5DaGVja1Blcm1pc3Npb25zKCJFRElUIikpIHsNCiAgICAgICAgICAgICRxdWlja0xpbmtzIFtdID0gYXJyYXkoDQogICAgICAgICAgICAgICAgJ2xpbmt0eXBlJyA9PiAnTElTVFZJRVcnLA0KICAgICAgICAgICAgICAgICdsaW5rbGFiZWwnID0+ICdMQkxfRVhQT1JUJywNCiAgICAgICAgICAgICAgICAnbGlua3VybCcgPT4gJ2phdmFzY3JpcHQ6VnRpZ2VyX0xpc3RfSnMudHJpZ2dlckV4cG9ydEFjdGlvbigiaW5kZXgucGhwP21vZHVsZT1QREZNYWtlciZ2aWV3PUV4cG9ydCIpJywNCiAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnDQogICAgICAgICAgICApOw0KICAgICAgICB9DQoNCiAgICAgICAgZm9yZWFjaCAoJHF1aWNrTGlua3MgYXMgJHF1aWNrTGluaykgew0KICAgICAgICAgICAgJGxpbmtzWydMSVNUVklFVyddW10gPSBWdGlnZXJfTGlua19Nb2RlbDo6Z2V0SW5zdGFuY2VGcm9tVmFsdWVzKCRxdWlja0xpbmspOw0KICAgICAgICB9DQoNCiAgICAgICAgaWYgKCRjdXJyZW50VXNlck1vZGVsLT5pc0FkbWluVXNlcigpKSB7DQoNCiAgICAgICAgICAgICRzZXR0aW5nc0xpbmtzID0gJHRoaXMtPmdldFNldHRpbmdMaW5rcygpOw0KICAgICAgICAgICAgZm9yZWFjaCAoJHNldHRpbmdzTGlua3MgYXMgJHNldHRpbmdzTGluaykgew0KICAgICAgICAgICAgICAgICRsaW5rc1snTElTVFZJRVdTRVRUSU5HJ11bXSA9IFZ0aWdlcl9MaW5rX01vZGVsOjpnZXRJbnN0YW5jZUZyb21WYWx1ZXMoJHNldHRpbmdzTGluayk7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICRTZXR0aW5nc0xpbmtzID0gJHRoaXMtPkdldEF2YWlsYWJsZVNldHRpbmdzKCk7DQoNCiAgICAgICAgICAgIGZvcmVhY2ggKCRTZXR0aW5nc0xpbmtzIGFzICRzdHlwZSA9PiAkc2RhdGEpIHsNCiAgICAgICAgICAgICAgICAkc19wYXJyID0gYXJyYXkoDQogICAgICAgICAgICAgICAgICAgICdsaW5rdHlwZScgPT4gJ0xJU1RWSUVXU0VUVElORycsDQogICAgICAgICAgICAgICAgICAgICdsaW5rbGFiZWwnID0+ICRzZGF0YVsibGFiZWwiXSwNCiAgICAgICAgICAgICAgICAgICAgJ2xpbmt1cmwnID0+ICRzZGF0YVsibG9jYXRpb24iXSwNCiAgICAgICAgICAgICAgICAgICAgJ2xpbmtpY29uJyA9PiAnJw0KICAgICAgICAgICAgICAgICk7DQoNCiAgICAgICAgICAgICAgICAkbGlua3NbJ0xJU1RWSUVXU0VUVElORyddW10gPSBWdGlnZXJfTGlua19Nb2RlbDo6Z2V0SW5zdGFuY2VGcm9tVmFsdWVzKCRzX3BhcnIpOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgICAgIHJldHVybiAkbGlua3M7DQogICAgfQ0KDQogICAgDQogICAgcHVibGljIGZ1bmN0aW9uIGdldFNldHRpbmdMaW5rcygpDQogICAgew0KDQogICAgICAgIA0KICAgICAgICAkc2V0dGluZ3NMaW5rcyA9IGFycmF5KCk7DQoNCiAgICAgICAgJGN1cnJlbnRVc2VyTW9kZWwgPSBVc2Vyc19SZWNvcmRfTW9kZWw6OmdldEN1cnJlbnRVc2VyTW9kZWwoKTsNCiAgICAgICAgaWYgKCRjdXJyZW50VXNlck1vZGVsLT5pc0FkbWluVXNlcigpKSB7DQoNCiAgICAgICAgICAgICRzZXR0aW5nc0xpbmtzW10gPSBhcnJheSgNCiAgICAgICAgICAgICAgICAnbGlua3R5cGUnID0+ICdMSVNUVklFV1NFVFRJTkcnLA0KICAgICAgICAgICAgICAgICdsaW5rbGFiZWwnID0+IHZ0cmFuc2xhdGUoJ0xCTF9FWFRFTlNJT05TJywgJHRoaXMtPmdldE5hbWUoKSksDQogICAgICAgICAgICAgICAgJ2xpbmt1cmwnID0+ICdpbmRleC5waHA/bW9kdWxlPScgLiAkdGhpcy0+Z2V0TmFtZSgpIC4gJyZ2aWV3PUV4dGVuc2lvbnMnLA0KICAgICAgICAgICAgICAgICdsaW5raWNvbicgPT4gJycNCiAgICAgICAgICAgICk7DQoNCiAgICAgICAgICAgICRzZXR0aW5nc0xpbmtzW10gPSBhcnJheSgNCiAgICAgICAgICAgICAgICAnbGlua3R5cGUnID0+ICdMSVNUVklFV1NFVFRJTkcnLA0KICAgICAgICAgICAgICAgICdsaW5rbGFiZWwnID0+IHZ0cmFuc2xhdGUoJ0xCTF9QUk9GSUxFUycsICR0aGlzLT5nZXROYW1lKCkpLA0KICAgICAgICAgICAgICAgICdsaW5rdXJsJyA9PiAnaW5kZXgucGhwP21vZHVsZT0nIC4gJHRoaXMtPmdldE5hbWUoKSAuICcmdmlldz1Qcm9maWxlc1ByaXZpbGVnaWVzJywNCiAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnDQogICAgICAgICAgICApOw0KICAgICAgICAgICAgaWYgKCR0aGlzLT5nZXRWZXJzaW9uVHlwZSgpID09ICJwcm9mZXNzaW9uYWwiKSB7DQogICAgICAgICAgICAgICAgJHNldHRpbmdzTGlua3NbXSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICAgICAnbGlua3R5cGUnID0+ICdMSVNUVklFV1NFVFRJTkcnLA0KICAgICAgICAgICAgICAgICAgICAnbGlua2xhYmVsJyA9PiB2dHJhbnNsYXRlKCdMQkxfQ1VTVE9NX0xBQkVMUycsICR0aGlzLT5nZXROYW1lKCkpLA0KICAgICAgICAgICAgICAgICAgICAnbGlua3VybCcgPT4gJ2luZGV4LnBocD9tb2R1bGU9UERGTWFrZXImdmlldz1DdXN0b21MYWJlbHMnLA0KICAgICAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnDQogICAgICAgICAgICAgICAgKTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgICAgICRzZXR0aW5nc0xpbmtzW10gPSBhcnJheSgNCiAgICAgICAgICAgICAgICAnbGlua3R5cGUnID0+ICdMSVNUVklFV1NFVFRJTkcnLA0KICAgICAgICAgICAgICAgICdsaW5rbGFiZWwnID0+IHZ0cmFuc2xhdGUoJ0xCTF9QUk9EVUNUQkxPQ0tUUEwnLCAkdGhpcy0+Z2V0TmFtZSgpKSwNCiAgICAgICAgICAgICAgICAnbGlua3VybCcgPT4gJ2luZGV4LnBocD9tb2R1bGU9UERGTWFrZXImdmlldz1Qcm9kdWN0QmxvY2tzJywNCiAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnDQogICAgICAgICAgICApOw0KDQogICAgICAgICAgICAkc2V0dGluZ3NMaW5rc1tdID0gYXJyYXkoDQogICAgICAgICAgICAgICAgJ2xpbmt0eXBlJyA9PiAnTElTVFZJRVdTRVRUSU5HJywNCiAgICAgICAgICAgICAgICAnbGlua2xhYmVsJyA9PiAnTEJMX0xJQ0VOU0UnLA0KICAgICAgICAgICAgICAgICdsaW5rdXJsJyA9PiAnaW5kZXgucGhwP21vZHVsZT1QREZNYWtlciZ2aWV3PUxpY2Vuc2UmcGFyZW50PVNldHRpbmdzJywNCiAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnLA0KICAgICAgICAgICAgKTsNCg0KICAgICAgICAgICAgJHNldHRpbmdzTGlua3NbXSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICdsaW5rdHlwZScgPT4gJ0xJU1RWSUVXU0VUVElORycsDQogICAgICAgICAgICAgICAgJ2xpbmtsYWJlbCcgPT4gJ0xCTF9VUEdSQURFJywNCiAgICAgICAgICAgICAgICAnbGlua3VybCcgPT4gJ2luZGV4LnBocD9tb2R1bGU9TW9kdWxlTWFuYWdlciZwYXJlbnQ9U2V0dGluZ3Mmdmlldz1Nb2R1bGVJbXBvcnQmbW9kZT1pbXBvcnRVc2VyTW9kdWxlU3RlcDEnLA0KICAgICAgICAgICAgICAgICdsaW5raWNvbicgPT4gJycsDQogICAgICAgICAgICApOw0KDQogICAgICAgICAgICAkc2V0dGluZ3NMaW5rc1tdID0gYXJyYXkoDQogICAgICAgICAgICAgICAgJ2xpbmt0eXBlJyA9PiAnTElTVFZJRVdTRVRUSU5HJywNCiAgICAgICAgICAgICAgICAnbGlua2xhYmVsJyA9PiAnTEJMX1VOSU5TVEFMTCcsDQogICAgICAgICAgICAgICAgJ2xpbmt1cmwnID0+ICdpbmRleC5waHA/bW9kdWxlPVBERk1ha2VyJnZpZXc9VW5pbnN0YWxsJnBhcmVudD1TZXR0aW5ncycsDQogICAgICAgICAgICAgICAgJ2xpbmtpY29uJyA9PiAnJywNCiAgICAgICAgICAgICk7DQogICAgICAgI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iAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgJHBkZlRlbXBsYXRlQXJyYXlbJ3N0YXR1cyddID0gJzEnOw0KICAgICAgICAgICAgICAgICRwZGZUZW1wbGF0ZUFycmF5Wydpc19kZWZhdWx0J10gPSAnMCc7DQogICAgICAgICAgICAgICAgJHBkZlRlbXBsYXRlQXJyYXlbJ29yZGVyJ10gPSAnMSc7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgIGlmICghaW50dmFsKCRwZGZUZW1wbGF0ZUFycmF5WydzdGF0dXMnXSkpIHsNCiAgICAgICAgICAgICAgICBjb250aW51ZTsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgJHJldHVybl9hcnJheVskdGVtcGxhdGVJZF1bJ3RlbXBsYXRlbmFtZSddID0gJHJvd1snZmlsZW5hbWUnXTsNCiAgICAgICAgICAgICRyZXR1cm5fYXJyYXlbJHRlbXBsYXRlSWRdWyd0aXRsZSddID0gJHJvd1snZGVzY3JpcHRpb24nXTsNCiAgICAgICAgICAgICRyZXR1cm5fYXJyYXlbJHRlbXBsYXRlSWRdWydpc19kZWZhdWx0J10gPSAkcGRmVGVtcGxhdGVBcnJheVsnaXNfZGVmYXVsdCddOw0KICAgICAgICAgICAgJHJldHVybl9hcnJheVskdGVtcGxhdGVJZF1bJ29yZGVyJ10gPSAkcGRmVGVtcGxhdGVBcnJheVsnb3JkZXInXTsNCiAgICAgICAgICAgICRyZXR1cm5fYXJyYXlbJHRlbXBsYXRlSWRdWydkaXNhYmxlX2V4cG9ydF9lZGl0J10gPSAkcm93WydkaXNhYmxlX2V4cG9ydF9lZGl0J107DQogICAgICAgIH0NCg0KICAgICAgICBpZiAoMSA9PT0gY291bnQoJHJldHVybl9hcnJheSkpIHsNCiAgICAgICAgICAgICR0bXBfYXJyID0gJHJldHVybl9hcnJheTsNCg0KICAgICAgICAgICAgcmVzZXQoJHRtcF9hcnIpOw0KDQogICAgICAgICAgICAka2V5ID0ga2V5KCR0bXBfYXJyKTsNCiAgICAgICAgICAgICRyZXR1cm5fYXJyYXlbJGtleV1bJ3RlbXBsYXRlbmFtZSddID0gJHRtcF9hcnJbJGtleV1bJ3RlbXBsYXRlbmFtZSddOw0KICAgICAgICAgICAgJHJldHVybl9hcnJheVska2V5XVsnaXNfZGVmYXVsdCddID0gJzMnOw0KICAgICAgICB9DQoNCiAgICAgICAgcmV0dXJuICRyZXR1cm5fYXJyYXk7DQogICAgfQ0KDQogICAgcHVibGljIGZ1bmN0aW9uIENoZWNrVGVtcGxhdGVQZXJtaXNzaW9ucygkc2VsZWN0ZWRfbW9kdWxlLCAkdGVtcGxhdGVpZCwgJGRpZSA9IHRydWUpDQogICAgew0KICAgICAgICAkY3VycmVudF91c2VyID0gVXNlcnNfUmVjb3JkX01vZGVsOjpnZXRDdXJyZW50VXNlck1vZGVsKCk7DQogICAgICAgICRyZXN1bHQgPSB0cnVlOw0KICAgICAgICBpZiAoIWlzX2FkbWluKCRjdXJyZW50X3VzZXIpKSB7DQogICAgICAgICAgICBpZiAoJHNlbGVjdGVkX21vZHVsZSAhPSAiIiAmJiBpc1Blcm1pdHRlZCgkc2VsZWN0ZWRfbW9kdWxlLCAnJykgIT0gInllcyIpIHsNCiAgICAgICAgICAgICAgICAkcmVzdWx0ID0gZmFsc2U7DQogICAgICAgICAgICB9IGVsc2VpZiAoJHRlbXBsYXRlaWQgIT0gIiIgJiYgJHRoaXMtPkNoZWNrU2hhcmluZygkdGVtcGxhdGVpZCkgPT09IGZhbHNlKSB7DQogICAgICAgICAgICAgICAgJHJlc3VsdCA9IGZhbHNlOw0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICBpZiAoJHJlc3VsdCA9PT0gZmFsc2UpIHsNCiAgICAgICAgICAgICAgICByZXF1aXJlKCd1c2VyX3ByaXZpbGVnZXMvdXNlcl9wcml2aWxlZ2VzXycgLiAkY3VycmVudF91c2VyLT5pZCAuICcucGhwJyk7DQogICAgICAgICAgICAgICAgcmVx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gICAgICRhdHRyX3ZhbCA9IGpzb25fZW5jb2RlKCRhdHRyX3ZhbCk7DQogICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgJEFbXSA9ICRhdHRyX3R5cGUgLiAnPScgLiB1cmxlbmNvZGUoJGF0dHJfdmFsKTsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQogICAgICAgIH0NCg0KICAgICAgICBpZiAoY291bnQoJEFkZF9BdHRyKSA+IDApIHsNCiAgICAgICAgICAgIGZvcmVhY2ggKCRBZGRfQXR0ciBhcyAkYXR0cl90eXBlID0+ICRyZXFfbmFtZSkgew0KICAgICAgICAgICAgICAgIGlmICgkcmVxdWVzdC0+aGFzKCRyZXFfbmFtZSkgJiYgISRyZXF1ZXN0LT5pc0VtcHR5KCRyZXFfbmFtZSkpIHsNCiAgICAgICAgICAgICAgICAgICAgJGF0dHJfdmFsID0gJHJlcXVlc3QtPmdldCgkcmVxX25hbWUpOw0KICAgICAgICAgICAgICAgICAgICBpZiAoaXNfYXJyYXkoJGF0dHJfdmFsKSkgew0KICAgICAgICAgICAgICAgICAgICAgICAgJGF0dHJfdmFsID0ganNvbl9lbmNvZGUoJGF0dHJfdmFsKTsNCiAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAkQVtdID0gJGF0dHJfdHlwZSAuICc9JyAuIHVybGVuY29kZSgkYXR0cl92YWwpOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH0NCiAgICAgICAgfQ0KDQogICAgICAgIHJldHVybiBpbXBsb2RlKCcmJywgJEEpOw0KICAgIH0NCg0KICAgIHB1YmxpYyBmdW5jdGlvbiBhZGRBd2Vzb21lU3R5bGUoJiRjb250ZW50LCAkY29udmVydCA9IHRydWUpDQogICAgew0KDQogICAgICAgICRmb250YXdlc29tZWNsYXNzID0gZmlsZV9nZXRfY29udGVudHMoJ2xheW91dHMvdjcvbW9kdWxlcy9QREZNYWtlci9yZXNvdXJjZXMvRm9udEF3ZXNvbWUuY3NzJyk7DQogICAgICAgIGlmICgkY29udmVydCkgew0KICAgICAgICAgICAgJGZvbnRhd2Vzb21lY2xhc3MgPSBzdHJfcmVwbGFjZSgiRm9udEF3ZXNvbWUiLCAiZm9udGF3ZXNvbWUiLCAkZm9udGF3ZXNvbWVjbGFzcyk7DQogICAgICAgIH0NCg0KICAgICAgICAkc3R5bGVfY29udGVudCA9ICc8c3R5bGU+JyAuICRmb250YXdlc29tZWNsYXNzIC4gJzwvc3R5bGU+JzsNCiAgICAgICAgaWYgKCRjb252ZXJ0KSB7DQogICAgICAgICAgICAkc3R5bGVfY29udGVudCAuPSAnPHN0eWxlPi5mYSB7IGZvbnQtZmFtaWx5OiBmb250YXdlc29tZTt9PC9zdHlsZT4nOw0KICAgICAgICB9DQogICAgICAgIGlmIChlbXB0eSgkY29udGVudCkpIHsNCiAgICAgICAgICAgICRjb250ZW50ID0gJzwhRE9DVFlQRSBodG1sPg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxodG1sPg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxoZWFkPicgLiAkc3R5bGVfY29udGVudCAuICc8L2hlYWQ+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJvZHk+PC9ib2R5Pg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvaHRtbD4nOw0KICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgUERGTWFrZXJfUERGTWFrZXJfTW9kZWw6OmdldFNpbXBsZUh0bWxEb21GaWxlKCk7DQoNCiAgICAgICAgICAgICRodG1sID0gc3RyX2dldF9odG1sKCRjb250ZW50KTsNCg0KICAgICAgICAgICAgaWYgKGlzX2FycmF5KCRodG1sLT5maW5kKCJoZWFkIikpICYmIGNvdW50KCRodG1sLT5maW5kKCJoZWFkIikpID4gMCkgew0KDQogICAgICAgICAgICAgICAgZm9yZWFjaCAoJGh0bWwtPmZpbmQoImhlYWQiKSBhcyAkaGVhZCkgew0KICAgICAgICAgICAgICAgICAgICAkaGVhZF9jb250ZW50ID0gJGhlYWQtPmlubmVydGV4dDsNCiAgICAgICAgICAgICAgICAgICAgJGhlYWQtPmlubmVydGV4dCA9ICRzdHlsZV9jb250ZW50IC4gJGhlYWRfY29udGVudDsNCiAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICBmb3JlYWNoICgkaHRtbC0+ZmluZCgiYm9keSIpIGFzICRib2R5KSB7DQogICAgICAgICAgICAgICAgICAgICRib2R5X2NvbnRlbnQgPSAkYm9keS0+aW5uZXJ0ZXh0Ow0KICAgICAgICAgICAgICAgICAgICAkYm9keS0+aW5uZXJ0ZXh0ID0gJGJvZHlfY29udGVudDsNCiAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICAkY29udGVudCA9ICRodG1sLT5zYXZlKCk7DQoNCiAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgJGNvbnRlbnQgPSAnPCFET0NUWVBFIGh0bWw+DQogICAgICAgICAgICAgICAgICAgICAgICA8aHRtbD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDxoZWFkPicgLiAkc3R5bGVfY29udGVudCAuICc8L2hlYWQ+DQogICAgICAgICAgICAgICAgICAgICAgICA8Ym9keT4NCiAgICAgICAgICAgICAgICAgICAgICAgICcgLiAkY29udGVudCAuICcNCiAgICAgICAgICAgICAgICAgICAgICAgIDwvYm9keT4NCiAgICAgICAgICAgICAgICAgICAgICAgIDwvaHRtbD4nOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgfQ0KDQogICAgDQogICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBmaXhTdG9yZWROYW1lKCR2YWx1ZXMpDQogICAgew0KICAgICAgICBpZiAoIWlzc2V0KCR2YWx1ZXNbInN0b3JlZG5hbWUiXSkgfHwgZW1wdHkoJHZhbHVlc1sic3RvcmVkbmFtZSJdKSkgew0KICAgICAgICAgICAgJHZhbHVlc1sic3Rvc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AgICAgICd2dGlnZXJfcGRmbWFrZXJfdmVyc2lvbicsDQogICAgICAgICk7DQogICAgfQ0KDQogICAgDQogICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBjb252ZXJ0VG9GbG9hdE51bWJlcigkdmFsdWUpDQogICAgew0KICAgICAgICBwcmVnX21hdGNoX2FsbCgnL1teMC05XS8nLCAkdmFsdWUsICRtYXRjaGVzKTsNCg0KICAgICAgICBpZiAoY291bnQoJG1hdGNoZXNbMF0pID4gMSkgew0KICAgICAgICAgICAgJHZhbHVlID0gc3RyX3JlcGxhY2UoJG1hdGNoZXNbMF1bMF0sICcnLCAkdmFsdWUpOw0KICAgICAgICB9DQoNCiAgICAgICAgcmV0dXJuIHByZWdfcmVwbGFjZSgnL1teMC05XS8nLCAnLicsICR2YWx1ZSk7DQogICAgfQ0KfSA/Pg=='); ?>

Did this file decode correctly?

Original Code

base64_decode('PD9waHANCg0KDQoNCnJlcXVpcmVfb25jZSgnaW5jbHVkZS9ldmVudHMvU3FsUmVzdWx0SXRlcmF0b3IuaW5jJyk7DQpyZXF1aXJlX29uY2UoJ21vZHVsZXMvY29tX3Z0aWdlcl93b3JrZmxvdy9WVEVudGl0eUNhY2hlLmluYycpOw0KDQpyZXF1aXJlX29uY2UgJ2luY2x1ZGUvV2Vic2VydmljZXMvVXRpbHMucGhwJzsNCnJlcXVpcmVfb25jZSgibW9kdWxlcy9Vc2Vycy9Vc2Vycy5waHAiKTsNCnJlcXVpcmVfb25jZSgiaW5jbHVkZS9XZWJzZXJ2aWNlcy9WdGlnZXJDUk1PYmplY3QucGhwIik7DQpyZXF1aXJlX29uY2UoImluY2x1ZGUvV2Vic2VydmljZXMvVnRpZ2VyQ1JNT2JqZWN0TWV0YS5waHAiKTsNCnJlcXVpcmVfb25jZSgiaW5jbHVkZS9XZWJzZXJ2aWNlcy9EYXRhVHJhbnNmb3JtLnBocCIpOw0KcmVxdWlyZV9vbmNlKCJpbmNsdWRlL1dlYnNlcnZpY2VzL1d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KSB7DQogICAgICAgICAgICAgICAgICAgICRhY3Rpb25JZCA9IGdldEFjdGlvbmlkKCRhY3Rpb25OYW1lKTsNCiAgICAgICAgICAgICAgICAgICAgaWYgKCFpc3NldCgkcGVybWlzc2lvbnNbJHByb2ZpbGVpZF1bJGFjdGlvbklkXSkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICRwZXJtaXNzaW9uc1skcHJvZmlsZWlkXVskYWN0aW9uSWRdID0gIjAiOw0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICBrc29ydCgkcGVybWlzc2lvbnMpOw0KICAgICAgICAgICAgJHRoaXMtPnByb2ZpbGVzUGVybWlzc2lvbnMgPSAkcGVybWlzc2lvbnM7DQogICAgICAgIH0NCiAgICB9DQoNCiAgICBwdWJsaWMgZnVuY3Rpb24gZ2V0VmVyc2lvblR5cGUoKQ0KICAgIHsNCiAgICAgICAgaWYgKGVtcHR5KCR0aGlzLT5saWNlbnNlUGVybWlzc2lvbnMpKSB7DQogICAgICAgICAgICAkdGhpcy0+Z2V0TGljZW5zZVBlcm1pc3Npb25zKCdFZGl0Jyk7DQogICAgICAgIH0NCg0KICAgICAgICByZXR1cm4gaXNzZXQoJHRoaXMtPmxpY2Vuc2VQZXJtaXNzaW9uc1sndmVyc2lvbl90eXBlJ10pID8gJHRoaXMtPmxpY2Vuc2VQZXJtaXNzaW9uc1sndmVyc2lvbl90eXBlJ10gOiAnZGVhY3RpdmF0ZSc7DQogICAgfQ0KDQogICAgcHVibGljIGZ1bmN0aW9uIGdldExpY2Vuc2VQZXJtaXNzaW9ucygkdHlwZSA9ICdMaXN0JykNCiAgICB7DQogICAgICAgIGlmIChlbXB0eSgkdGhpcy0+bmFtZSkpIHsNCiAgICAgICAgICAgICR0aGlzLT5uYW1lID0gZXhwbG9kZSgnXycsIGdldF9jbGFzcygkdGhpcykpWzBdOw0KICAgICAgICB9DQogICAgICAgICRp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GFbIm93bmVycyJdWyRvd25lcmlkXSA9IGdldFVzZXJGdWxsTmFtZSgkb3duZXJpZCk7DQogICAgICAgICAgICB9DQogICAgICAgIH0NCg0KICAgICAgICByZXR1cm4gJFNlYXJjaF9TZWxlY3Rib3hfRGF0YTsNCiAgICB9DQoNCiAgICBwdWJsaWMgZnVuY3Rpb24gcmV0dXJuVGVtcGxhdGVQZXJtaXNzaW9uc0RhdGEoJHNlbGVjdGVkX21vZHVsZSwgJHRlbXBsYXRlaWQpDQogICAgew0KICAgICAgICAkY3VycmVudF91c2VyID0gVXNlcnNfUmVjb3JkX01vZGVsOjpnZXRDdXJyZW50VXNlck1vZGVsKCk7DQoNCiAgICAgICAgJHJlc3VsdCA9IHRydWU7DQoNCiAgICAgICAgaWYgKCFpc19hZG1pbigkY3VycmVudF91c2VyKSkgew0KICAgICAgICAgICAgaWYgKCRzZWxlY3RlZF9tb2R1bGUgIT0gIiIgJiYgaXNQZXJtaXR0ZWQoJHNlbGVjdGVkX21vZHVsZSwgJycpICE9ICJ5ZXMiKSB7DQogICAgICAgICAgICAgICAgJHJlc3VsdCA9IGZhbHNlOw0KICAgICAgICAgICAgfSBlbHNlaWYgKCR0ZW1wbGF0ZWlkICE9ICIiICYmICR0aGlzLT5DaGVja1NoYXJpbmcoJHRlbXBsYXRlaWQpID09PSBmYWxzZSkgew0KICAgICAgICAgICAgICAgICRyZXN1bHQgPSBmYWxzZTsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgJGRldGFpbF9yZXN1bHQgPSAkcmVzdWx0Ow0KDQogICAgICAgICAgICBpZiAoISR0aGlzLT5DaGVja1Blcm1pc3Npb25zKCJFRElUIikpIHsNCiAgICAgICAgICAgICAgICAkZWRpdF9yZXN1bHQgPSBmYWxzZTsNCiAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgJGVkaXRfcmVzdWx0ID0gJHJlc3VsdDsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgaWYg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mVzdWx0ID0gdHJ1ZTsNCiAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICJwcml2YXRlIjoNCiAgICAgICAgICAgICAgICAgICAgJHN1Ym9yZGluYXRlVXNlcnMgPSAkdGhpcy0+Z2V0U3ViUm9sZVVzZXJJZHMoJGN1cnJlbnRfdXNlci0+cm9sZWlkKTsNCiAgICAgICAgICAgICAgICAgICAgaWYgKCFlbXB0eSgkc3Vib3JkaW5hdGVVc2VycykgJiYgY291bnQoJHN1Ym9yZGluYXRlVXNlcnMpID4gMCkgew0KICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IGluX2FycmF5KCRvd25lciwgJHN1Ym9yZGluYXRlVXNlcnMpOw0KICAgICAgICAgICAgICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IGZhbHNlOw0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICJzaGFyZSI6DQogICAgICAgICAgICAgICAgICAgICRzdWJvcmRpbmF0ZVVzZXJzID0gJHRoaXMtPmdldFN1YlJvbGVVc2VySWRzKCRjdXJyZW50X3VzZXItPnJvbGVpZCk7DQogICAgICAgICAgICAgICAgICAgIGlmICghZW1wdHkoJHN1Ym9yZGluYXRlVXNlcnMpICYmIGNvdW50KCRzdWJvcmRpbmF0ZVVzZXJzKSA+IDAgJiYgaW5fYXJyYXkoJG93bmVyLCAkc3Vib3JkaW5hdGVVc2VycykpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgICAgICAgICAgICAgJG1lbWJlcl9hcnJheSA9ICR0aGlzLT5HZXRTaGFyaW5nTWVtYmVyQXJyYXkoJHRlbXBsYXRlaWQpOw0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzc2V0KCRtZW1iZXJfYXJyYXlbInVzZXJzIl0pICYmIGluX2FycmF5KCRjdXJyZW50X3VzZXItPmlkLCAkbWVtYmVyX2FycmF5WyJ1c2VycyJdKSkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlaWYgKGlzc2V0KCRtZW1iZXJfYXJyYXlbInJvbGVzIl0pICYmIGluX2FycmF5KCRjdXJyZW50X3VzZXItPnJvbGVpZCwgJG1lbWJlcl9hcnJheVsicm9sZXMiXSkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gdHJ1ZTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzc2V0KCRtZW1iZXJfYXJyYXlbInJzIl0pKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2ggKCRtZW1iZXJfYXJyYXlbInJzIl0gYXMgJHJvbGVpZCkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJvbGVBbmRzdWJvcmRpbmF0ZVJvbGVzID0gZ2V0Um9sZUFuZFN1Ym9yZGluYXRlc1JvbGVJZHMoJHJvbGVpZCk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5fYXJyYXkoJGN1cnJlbnRfdXNlci0+cm9sZWlkLCAkcm9sZUFuZHN1Ym9yZGluYXRlUm9sZXMpKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IHRydWU7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJHJlc3VsdCA9PSBmYWxzZSAmJiBpc3NldCgkbWVtYmVyX2FycmF5WyJncm91cHMiXSkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJGN1cnJlbnRfdXNlcl9ncm91cHMgPSBleHBsb2RlKCIsIiwgZmV0Y2hVc2VyR3JvdXBpZHMoJGN1cnJlbnRfdXNlci0+aWQpKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlc19hcnJheSA9IGFycmF5X2ludGVyc2VjdCgkbWVtYmVyX2FycmF5WyJncm91cHMiXSwgJGN1cnJlbnRfdXNlcl9ncm91cHMpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVtcHR5KCRyZXNfYXJyYXkpICYmIGNvdW50KCRyZXNfYXJyYXkpID4gMCkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IHRydWU7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gZmFsc2U7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNzZXQoJG1lbWJlcl9hcnJheVsiY29tcGFuaWVzIl0pKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2ggKCRtZW1iZXJfYXJyYXlbImNvbXBhbmllcyJdIGFzICRjb21wYW55SWQpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChJVFM0WW91TXVsdGlDb21wYW55X1JlY29yZF9Nb2RlbDo6aXNSb2xlSW5Db21wYW55KCRjb21wYW55SWQsICRjdXJyZW50X3VzZXItPnJvbGVpZCkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gdHJ1ZTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQoNCiAgICAgICAgcmV0dXJuICRyZXN1bHQ7DQogICAgfQ0KDQogICAgcHJpdmF0ZSBmdW5jdGlvbiBnZXRTdWJSb2xlVXNlcklkcygkcm9sZWlkKQ0KICAgIHsNCiAgICAgICAgJHN1YlJvbGVVc2VySWRzID0gYXJyYXkoKTsNCiAgICAgICAgJHN1Ym9yZGluYXRlVXNlcnMgPSBnZXRSb2xlQW5kU3Vib3JkaW5hdGVVc2Vycygkcm9sZWlkKTsNCiAgICAgICAgaWYgKCFlbXB0eSgkc3Vib3JkaW5hdGVVc2VycykgJiYgY291bnQoJHN1Ym9yZGluYXRlVXNlcnMpID4gMCkgew0KICAgICAgICAgICAgJGN1cnJSb2xlVXNlcklkcyA9IGdldFJvbGVVc2VySWRzKCRyb2xlaWQpOw0KICAgICAgICAgICAgJHN1YlJvbGVVc2VySWRzID0gYXJyYXlfZGlmZigkc3Vib3JkaW5hdGVVc2VycywgJGN1cnJSb2xlVXNlcklkcyk7DQogICAgICAgIH0NCg0KICAgICAgICByZXR1cm4gJHN1YlJvbGVVc2VySWRzOw0KICAgIH0NCg0KICAgIHB1YmxpYyBmdW5jdGlvbiBHZXRTaGFyaW5nTWVtYmVyQ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9QZXJtaXNzaW9uc19EYXRhWyJkZXRhaWwiXSA9PT0gZmFsc2UpIHsNCiAgICAgICAgICAgICAgICBjb250aW51ZTsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgJHBkZnRlbXBsYXRlYXJyYXkgPSBhcnJheSgpOw0KICAgICAgICAgICAgJHN1ZmZpeCA9ICIiOw0KDQogICAgICAgICAgICBpZiAoaXNzZXQoJHN0YXR1c19hcnJbJHRlbXBsYXRlaWRdKSkgew0KICAgICAgICAgICAgICAgIGlmICgkc3RhdHVzX2FyclskdGVtcGxhdGVpZF1bImlzX2FjdGl2ZSJdID09ICIwIikgew0KICAgICAgICAgICAgICAgICAgICAkcGRmdGVtcGxhdGVhcnJheVsnc3RhdHVzJ10gPSAwOw0KICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICRwZGZ0ZW1wbGF0ZWFycmF5WydzdGF0dXMnXSA9IDE7DQogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoJHN0YXR1c19hcnJbJHRlbXBsYXRlaWRdWyJpc19kZWZhdWx0Il0pIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgIjEiOg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzdWZmaXggPSAiICgiIC4gdnRyYW5zbGF0ZSgiTEJMX0RFRkFVTFRfTk9QQVIiLCAiUERGTWFrZXIiKSAuICIgIiAuIHZ0cmFuc2xhdGUoIkxCTF9GT1JfRFYiLCAiUERGTWFrZXIiKSAuICIpIjsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCg0KICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAiMiI6DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgJHN1ZmZpeCA9ICIgKCIgLiB2dHJhbnNsYXRlKCJMQkxfREVGQVVMVF9OT1BBUiIsICJQREZNYWtlciIpIC4gIiAiIC4gdnRyYW5zbGF0ZSgiTEJMX0ZPUl9MViIsICJQREZNYWtlciIpIC4gIikiOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KDQogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICIzIjoNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc3VmZml4ID0gIiAoIiAuIHZ0cmFuc2xhdGUoIkxCTF9ERUZBVUxUX05PUEFSIiwgIlBERk1ha2VyIikgLiAiKSI7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQogICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICAkcGRmdGVtcGxhdGVhcnJheVsnb3JkZXInXSA9ICRzdGF0dXNfYXJyWyR0ZW1wbGF0ZWlkXVsic2VxdWVuY2UiXTsNCiAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgJHBkZnRlbXBsYXRlYXJyYXlbJ3N0YXR1cyddID0gMTsNCiAgICAgICAgICAgICAgICAkcGRmdGVtcGxhdGVhcnJheVsnb3JkZXInXSA9IDE7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgIGlmICghZW1wdHkoJHNlYXJjaF9zdGF0dXMpKSB7DQogICAgICAgICAgICAgICAgaWYgKCRzZWFyY2hfc3RhdHVzICE9ICJzdGF0dXNfIiAuICRwZGZ0ZW1wbGF0ZWFycmF5WydzdGF0dXMnXSkgew0KICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQogICAgICAgICAgICAkcGRmdGVtcGxhdGVhcnJheVsnc3RhdHVzX2xibCddID0gKCRwZGZ0ZW1wbGF0ZWFycmF5WydzdGF0dXMnXSA9PSAxID8gdnRyYW5zbGF0ZSgiQWN0aXZlIikgOiB2dHJhbnNsYXRlKCJJbmFjdGl2ZSIsICJQREZNYWtlciIpKTsNCg0KICAgICAgICAgICAgJHBkZnRlbXBsYXRlYXJyYXlbJ3RlbXBsYXRlaWQn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gICAgICAgICAkcGRmdGVtcGxhdGVhcnJheVsndHlwZSddID0gdnRyYW5zbGF0ZSh1Y2ZpcnN0KCRibG9ja3R5cGUpLCAnUERGTWFrZXInKTsNCiAgICAgICAgICAgICRyZXR1cm5fZGF0YSBbXSA9ICRwZGZ0ZW1wbGF0ZWFycmF5Ow0KICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICBpZiAoJG9yaWdpbk9yZGVyYnkgPT0gIm9yZGVyIikgew0KICAgICAgICAgICAgJG1vZHVsZXMgPSBhcnJheSgpOw0KICAgICAgICAgICAgZm9yZWFjaCAoJHJldHVybl9kYXRhIGFzICRrZXkgPT4gJHRlbXBsYXRlQXJyKSB7DQogICAgICAgICAgICAgICAgJG1vZHVsZXNbJHRlbXBsYXRlQXJyWyJtb2R1bGUiXV1bJGtleV0gPSAkdGVtcGxhdGVBcnJbIm9yZGVyIl07DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICR0bXBBcnIgPSBhcnJheSgpOw0KICAgICAgICAgICAgZm9yZWFjaCAoJG1vZHVsZXMgYXMgJG9yZGVyQXJyKSB7DQogICAgICAgICAgICAgICAgaWYgKCRvcmlnaW5EaXIgPT0gImFzYyIpIHsNCiAgICAgICAgICAgICAgICAgICAgYXNvcnQoJG9yZGVyQXJyLCBTT1JUX05VTUVSSUMpOw0KICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgIGFyc29ydCgkb3JkZXJBcnIsIFNPUlRfTlVNRVJJQyk7DQogICAgICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICAgICAgZm9yZWFjaCAoJG9yZGVyQXJyIGFzICRyZElkeCA9PiAkb3JkZXIpIHsNCiAgICAgICAgICAgICAgICAgICAgJHRtcEFycltdID0gJHJldHVybl9kYXRhWyRyZElkeF07DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgJHJldHVybl9kYXRhID0gJHRtcEFycjsNCiAgICAgICAgfQ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Wdlcl9wZGZtYWtlci5tb2R1bGUgPSA/KSI7DQogICAgICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICAgICAgJFNlYXJjaFtdID0gIigiIC4gJHNxIC4gIikiOw0KICAgICAgICAgICAgICAgIH0NCg0KDQogICAgICAgICAgICB9IGVsc2VpZiAoJHJlcXVlc3QtPmhhcygnbW9kZScpICYmICEkcmVxdWVzdC0+aXNFbXB0eSgnbW9kZScpKSB7DQogICAgICAgICAgICAgICAgJG1vZGUgPSAkcmVxdWVzdC0+Z2V0KCdtb2RlJyk7DQoNCiAgICAgICAgICAgICAgICBpZiAoJG1vZGUgPT0gIkJsb2NrcyIpIHsNCiAgICAgICAgICAgICAgICAgICAgJHNiID0gInZ0aWdlcl9wZGZtYWtlci50eXBlIElTIE5PVCBOVUxMIEFORCB2dGlnZXJfcGRmbWFrZXIudHlwZSAhPSAnJyAiOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH0NCg0KDQogICAgICAgICAgICBpZiAoJHJlcXVlc3QtPmhhcygnc2VhcmNoX3BhcmFtcycpICYmICEkcmVxdWVzdC0+aXNFbXB0eSgnc2VhcmNoX3BhcmFtcycpKSB7DQoNCiAgICAgICAgICAgICAgICAkbGlzdFNlYXJjaFBhcmFtcyA9ICRyZXF1ZXN0LT5nZXQoJ3NlYXJjaF9wYXJhbXMnKTsNCg0KICAgICAgICAgICAgICAgIGZvcmVhY2ggKCRsaXN0U2VhcmNoUGFyYW1zIGFzICRncm91cEluZm8pIHsNCiAgICAgICAgICAgICAgICAgICAgaWYgKGVtcHR5KCRncm91cEluZm8pKSB7DQogICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsNCiAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICBmb3JlYWNoICgkZ3JvdXBJbmZvIGFzICRmaWVsZFNlYXJjaEluZm8pIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICRzdCA9ICRmaWVsZFNlYXJjaEluZm9bMF07DQogICAgICAgICAgICAgICAgICAgICAgICAkb3BlcmF0b3IgPSAkZmllbGRTZWFyY2hJbmZvWzFdOw0KICAgICAgICAgICAgICAgICAgICAgICAgJHNlYXJjaF92YWwgPSAkZmllbGRTZWFyY2hJbmZvWzJdOw0KDQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5fYXJyYXkoJHN0LCAkU2VhcmNoX1R5cGVzKSkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkc3QgPT0gImZpbGVuYW1lIiB8fCAkc3QgPT0gImRlc2NyaXB0aW9uIikgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2VhcmNoX3ZhbCA9ICIlIiAuICRzZWFyY2hfdmFsIC4gIiUiOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkU2VhcmNoW10gPSAidnRpZ2VyX3BkZm1ha2VyLiIgLiAkc3QgLiAiIExJS0UgPyI7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlaWYgKCRzdCA9PSAib3duZXIiIHx8ICRzdCA9PSAic2hhcmluZ3R5cGUiKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRTZWFyY2hbXSA9ICJ2dGlnZXJfcGRmbWFrZXJfc2V0dGluZ3MuIiAuICRzdCAuICIgPSA/IjsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2VpZiAoJHN0ID09ICJmb3Jtb2R1bGUiKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRTZWFyY2hbXSA9ICJ2dGlnZXJfcGRmbWFrZXIubW9kdWxlID0gPyI7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJFNlYXJjaFtdID0gInZ0aWdlcl9wZGZtYWtlci4iIC4gJHN0IC4gIiA9ID8iOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkUl9BdHJbXSA9ICRzZWFyY2hfdmFsOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRzdCA9PSAic3RhdHVzIikgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzZWFyY2hfc3RhdHVzID0gJHNlYXJjaF92YWw7DQogICAgICAgICAgICAgICAgICAgICAgICB9DQoNCg0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgICAgIGlmICghZW1wdHkoJHNiKSkgew0KICAgICAgICAgICAgJFNlYXJjaFtdID0gJHNiOw0KICAgICAgICB9DQoNCiAgICAgICAgJHNxbCAuPSBpbXBsb2RlKCIgQU5EICIsICRTZWFyY2gpOw0KDQogICAgICAgIGlmICghZW1wdHkoJG9yZGVyYnkpKSB7DQogICAgICAgICAgICAkc3FsIC49ICIgT1JERVIgQlkgIjsNCiAgICAgICAgICAgIGlmICgkb3JkZXJieSA9PSAib3duZXIiIHx8ICRvcmRlcmJ5ID09ICJzaGFyaW5ndHlwZSIpIHsNCiAgICAgICAgICAgICAgICAkc3FsIC49ICJ2dGlnZXJfcGRmbWFrZXJfc2V0dGluZ3MiOw0KICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICAkc3FsIC49ICJ2dGlnZXJfcGRmbWFrZXIiOw0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgJHNxbCAuPSAiLiIgLiAkb3JkZXJieSAuICIgIiAuICRkaXI7DQogICAgICAgIH0NCg0KICAgICAgICAkcmVzdWx0ID0gJGFkYi0+cHF1ZXJ5KCRzcWwsICRSX0F0cik7DQogICAgICAgIHJldHVybiAkcmVzdWx0Ow0KICAgIH0NCg0KICAgIHB1YmxpYyBmdW5jdGlvbiBHZXREZXRhaWxWaWV3RGF0YSgkdGVtcGxhdGVpZCkNCiA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mt0eXBlJyA9PiAnTElTVFZJRVdNQVNTQUNUSU9OJywNCiAgICAgICAgICAgICAgICAnbGlua2xhYmVsJyA9PiAnTEJMX0RFTEVURScsDQogICAgICAgICAgICAgICAgJ2xpbmt1cmwnID0+ICdqYXZhc2NyaXB0OlZ0aWdlcl9MaXN0X0pzLm1hc3NEZWxldGVSZWNvcmRzKCJpbmRleC5waHA/bW9kdWxlPVBERk1ha2VyJmFjdGlvbj1NYXNzRGVsZXRlIiknLA0KICAgICAgICAgICAgICAgICdsaW5raWNvbicgPT4gJycNCiAgICAgICAgICAgICk7DQoNCiAgICAgICAgICAgICRsaW5rc1snTElTVFZJRVdNQVNTQUNUSU9OJ11bXSA9IFZ0aWdlcl9MaW5rX01vZGVsOjpnZXRJbnN0YW5jZUZyb21WYWx1ZXMoJG1hc3NBY3Rpb25MaW5rKTsNCiAgICAgICAgfQ0KDQogICAgICAgICRxdWlja0xpbmtzID0gYXJyYXkoKTsNCiAgICAgICAgaWYgKCR0aGlzLT5DaGVja1Blcm1pc3Npb25zKCJFRElUIikgJiYgJHRoaXMtPmdldFZlcnNpb25UeXBlKCkgIT0gImRlYWN0aXZhdGUiKSB7DQogICAgICAgICAgICAkcXVpY2tMaW5rcyBbXSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICdsaW5rdHlwZScgPT4gJ0xJU1RWSUVXJywNCiAgICAgICAgICAgICAgICAnbGlua2xhYmVsJyA9PiAnTEJMX0lNUE9SVCcsDQogICAgICAgICAgICAgICAgJ2xpbmt1cmwnID0+ICdqYXZhc2NyaXB0OlZ0aWdlcl9JbXBvcnRfSnMudHJpZ2dlckltcG9ydEFjdGlvbigiaW5kZXgucGhwP21vZHVsZT1QREZNYWtlciZ2aWV3PUltcG9ydCIpJywNCiAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnDQogICAgICAgICAgICApOw0KICAgICAgICB9DQoNCiAgICAgICAgaWYgKCR0aGlzLT5DaGVja1Blcm1pc3Npb25zKCJFRElUIikpIHsNCiAgICAgICAgICAgICRxdWlja0xpbmtzIFtdID0gYXJyYXkoDQogICAgICAgICAgICAgICAgJ2xpbmt0eXBlJyA9PiAnTElTVFZJRVcnLA0KICAgICAgICAgICAgICAgICdsaW5rbGFiZWwnID0+ICdMQkxfRVhQT1JUJywNCiAgICAgICAgICAgICAgICAnbGlua3VybCcgPT4gJ2phdmFzY3JpcHQ6VnRpZ2VyX0xpc3RfSnMudHJpZ2dlckV4cG9ydEFjdGlvbigiaW5kZXgucGhwP21vZHVsZT1QREZNYWtlciZ2aWV3PUV4cG9ydCIpJywNCiAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnDQogICAgICAgICAgICApOw0KICAgICAgICB9DQoNCiAgICAgICAgZm9yZWFjaCAoJHF1aWNrTGlua3MgYXMgJHF1aWNrTGluaykgew0KICAgICAgICAgICAgJGxpbmtzWydMSVNUVklFVyddW10gPSBWdGlnZXJfTGlua19Nb2RlbDo6Z2V0SW5zdGFuY2VGcm9tVmFsdWVzKCRxdWlja0xpbmspOw0KICAgICAgICB9DQoNCiAgICAgICAgaWYgKCRjdXJyZW50VXNlck1vZGVsLT5pc0FkbWluVXNlcigpKSB7DQoNCiAgICAgICAgICAgICRzZXR0aW5nc0xpbmtzID0gJHRoaXMtPmdldFNldHRpbmdMaW5rcygpOw0KICAgICAgICAgICAgZm9yZWFjaCAoJHNldHRpbmdzTGlua3MgYXMgJHNldHRpbmdzTGluaykgew0KICAgICAgICAgICAgICAgICRsaW5rc1snTElTVFZJRVdTRVRUSU5HJ11bXSA9IFZ0aWdlcl9MaW5rX01vZGVsOjpnZXRJbnN0YW5jZUZyb21WYWx1ZXMoJHNldHRpbmdzTGluayk7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICRTZXR0aW5nc0xpbmtzID0gJHRoaXMtPkdldEF2YWlsYWJsZVNldHRpbmdzKCk7DQoNCiAgICAgICAgICAgIGZvcmVhY2ggKCRTZXR0aW5nc0xpbmtzIGFzICRzdHlwZSA9PiAkc2RhdGEpIHsNCiAgICAgICAgICAgICAgICAkc19wYXJyID0gYXJyYXkoDQogICAgICAgICAgICAgICAgICAgICdsaW5rdHlwZScgPT4gJ0xJU1RWSUVXU0VUVElORycsDQogICAgICAgICAgICAgICAgICAgICdsaW5rbGFiZWwnID0+ICRzZGF0YVsibGFiZWwiXSwNCiAgICAgICAgICAgICAgICAgICAgJ2xpbmt1cmwnID0+ICRzZGF0YVsibG9jYXRpb24iXSwNCiAgICAgICAgICAgICAgICAgICAgJ2xpbmtpY29uJyA9PiAnJw0KICAgICAgICAgICAgICAgICk7DQoNCiAgICAgICAgICAgICAgICAkbGlua3NbJ0xJU1RWSUVXU0VUVElORyddW10gPSBWdGlnZXJfTGlua19Nb2RlbDo6Z2V0SW5zdGFuY2VGcm9tVmFsdWVzKCRzX3BhcnIpOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgICAgIHJldHVybiAkbGlua3M7DQogICAgfQ0KDQogICAgDQogICAgcHVibGljIGZ1bmN0aW9uIGdldFNldHRpbmdMaW5rcygpDQogICAgew0KDQogICAgICAgIA0KICAgICAgICAkc2V0dGluZ3NMaW5rcyA9IGFycmF5KCk7DQoNCiAgICAgICAgJGN1cnJlbnRVc2VyTW9kZWwgPSBVc2Vyc19SZWNvcmRfTW9kZWw6OmdldEN1cnJlbnRVc2VyTW9kZWwoKTsNCiAgICAgICAgaWYgKCRjdXJyZW50VXNlck1vZGVsLT5pc0FkbWluVXNlcigpKSB7DQoNCiAgICAgICAgICAgICRzZXR0aW5nc0xpbmtzW10gPSBhcnJheSgNCiAgICAgICAgICAgICAgICAnbGlua3R5cGUnID0+ICdMSVNUVklFV1NFVFRJTkcnLA0KICAgICAgICAgICAgICAgICdsaW5rbGFiZWwnID0+IHZ0cmFuc2xhdGUoJ0xCTF9FWFRFTlNJT05TJywgJHRoaXMtPmdldE5hbWUoKSksDQogICAgICAgICAgICAgICAgJ2xpbmt1cmwnID0+ICdpbmRleC5waHA/bW9kdWxlPScgLiAkdGhpcy0+Z2V0TmFtZSgpIC4gJyZ2aWV3PUV4dGVuc2lvbnMnLA0KICAgICAgICAgICAgICAgICdsaW5raWNvbicgPT4gJycNCiAgICAgICAgICAgICk7DQoNCiAgICAgICAgICAgICRzZXR0aW5nc0xpbmtzW10gPSBhcnJheSgNCiAgICAgICAgICAgICAgICAnbGlua3R5cGUnID0+ICdMSVNUVklFV1NFVFRJTkcnLA0KICAgICAgICAgICAgICAgICdsaW5rbGFiZWwnID0+IHZ0cmFuc2xhdGUoJ0xCTF9QUk9GSUxFUycsICR0aGlzLT5nZXROYW1lKCkpLA0KICAgICAgICAgICAgICAgICdsaW5rdXJsJyA9PiAnaW5kZXgucGhwP21vZHVsZT0nIC4gJHRoaXMtPmdldE5hbWUoKSAuICcmdmlldz1Qcm9maWxlc1ByaXZpbGVnaWVzJywNCiAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnDQogICAgICAgICAgICApOw0KICAgICAgICAgICAgaWYgKCR0aGlzLT5nZXRWZXJzaW9uVHlwZSgpID09ICJwcm9mZXNzaW9uYWwiKSB7DQogICAgICAgICAgICAgICAgJHNldHRpbmdzTGlua3NbXSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICAgICAnbGlua3R5cGUnID0+ICdMSVNUVklFV1NFVFRJTkcnLA0KICAgICAgICAgICAgICAgICAgICAnbGlua2xhYmVsJyA9PiB2dHJhbnNsYXRlKCdMQkxfQ1VTVE9NX0xBQkVMUycsICR0aGlzLT5nZXROYW1lKCkpLA0KICAgICAgICAgICAgICAgICAgICAnbGlua3VybCcgPT4gJ2luZGV4LnBocD9tb2R1bGU9UERGTWFrZXImdmlldz1DdXN0b21MYWJlbHMnLA0KICAgICAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnDQogICAgICAgICAgICAgICAgKTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgICAgICRzZXR0aW5nc0xpbmtzW10gPSBhcnJheSgNCiAgICAgICAgICAgICAgICAnbGlua3R5cGUnID0+ICdMSVNUVklFV1NFVFRJTkcnLA0KICAgICAgICAgICAgICAgICdsaW5rbGFiZWwnID0+IHZ0cmFuc2xhdGUoJ0xCTF9QUk9EVUNUQkxPQ0tUUEwnLCAkdGhpcy0+Z2V0TmFtZSgpKSwNCiAgICAgICAgICAgICAgICAnbGlua3VybCcgPT4gJ2luZGV4LnBocD9tb2R1bGU9UERGTWFrZXImdmlldz1Qcm9kdWN0QmxvY2tzJywNCiAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnDQogICAgICAgICAgICApOw0KDQogICAgICAgICAgICAkc2V0dGluZ3NMaW5rc1tdID0gYXJyYXkoDQogICAgICAgICAgICAgICAgJ2xpbmt0eXBlJyA9PiAnTElTVFZJRVdTRVRUSU5HJywNCiAgICAgICAgICAgICAgICAnbGlua2xhYmVsJyA9PiAnTEJMX0xJQ0VOU0UnLA0KICAgICAgICAgICAgICAgICdsaW5rdXJsJyA9PiAnaW5kZXgucGhwP21vZHVsZT1QREZNYWtlciZ2aWV3PUxpY2Vuc2UmcGFyZW50PVNldHRpbmdzJywNCiAgICAgICAgICAgICAgICAnbGlua2ljb24nID0+ICcnLA0KICAgICAgICAgICAgKTsNCg0KICAgICAgICAgICAgJHNldHRpbmdzTGlua3NbXSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICdsaW5rdHlwZScgPT4gJ0xJU1RWSUVXU0VUVElORycsDQogICAgICAgICAgICAgICAgJ2xpbmtsYWJlbCcgPT4gJ0xCTF9VUEdSQURFJywNCiAgICAgICAgICAgICAgICAnbGlua3VybCcgPT4gJ2luZGV4LnBocD9tb2R1bGU9TW9kdWxlTWFuYWdlciZwYXJlbnQ9U2V0dGluZ3Mmdmlldz1Nb2R1bGVJbXBvcnQmbW9kZT1pbXBvcnRVc2VyTW9kdWxlU3RlcDEnLA0KICAgICAgICAgICAgICAgICdsaW5raWNvbicgPT4gJycsDQogICAgICAgICAgICApOw0KDQogICAgICAgICAgICAkc2V0dGluZ3NMaW5rc1tdID0gYXJyYXkoDQogICAgICAgICAgICAgICAgJ2xpbmt0eXBlJyA9PiAnTElTVFZJRVdTRVRUSU5HJywNCiAgICAgICAgICAgICAgICAnbGlua2xhYmVsJyA9PiAnTEJMX1VOSU5TVEFMTCcsDQogICAgICAgICAgICAgICAgJ2xpbmt1cmwnID0+ICdpbmRleC5waHA/bW9kdWxlPVBERk1ha2VyJnZpZXc9VW5pbnN0YWxsJnBhcmVudD1TZXR0aW5ncycsDQogICAgICAgICAgICAgICAgJ2xpbmtpY29uJyA9PiAnJywNCiAgICAgICAgICAgICk7DQogICAgICAgIH0NCiAgICAgICAgcmV0dXJuICRzZXR0aW5nc0xpbmtzOw0KICAgIH0NCg0KICAgIHB1YmxpYyBmdW5jdGlvbiBHZXRBdmFpbGFibGVTZXR0aW5ncygpDQogICAgew0KICAgICAgICAkbWVudV9hcnJheSA9IGFycmF5KCk7DQogICAgICAgIHJldHVybiAkbWVudV9hcnJheTsNCiAgICB9DQoNCiAgICBwdWJsaWMgZnVuY3Rpb24gaXNTZW5kRW1haWxBY3RpdmUoKQ0KICAgIHsNCg0KICAgICAgICAkc2VuZEVtYWlsUERGID0gIjEiOw0KICAgICAgICBpZiAoIXZ0bGliX2lzTW9kdWxlQWN0aXZlKCdFbWFpbHMnKSkgew0KICAgICAgICAgICAgJHNlbmRFbWFpbFBERiA9ICIwIjsNCiAgICAgICAgfQ0KICAgICAgICBpZiAoaXNfZGlyKCJtb2R1bGVzL0VNQUlMTWFrZXIiKSAmJiB2dGxpYl9pc01vZHVsZUFjdGl2ZSgnRU1BSUxNYWtlcicpKSB7DQogICAgICAgICAgICBpZiAoaXNQZXJtaXR0ZWQoIkVNQUlMTWFrZXIiLCAiIikgPT0gIm5vIiAmJiAkc2VuZEVtYWlsUERGID0gIjAiKSB7DQogICAgICAgICAgICAgICAgJHNlbmRFbWFpbFBERiA9ICIwIjsNCiAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgJHNl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GVtcGxhdGVBcnJheVsnb3JkZXInXTsNCiAgICAgICAgICAgICRyZXR1cm5fYXJyYXlbJHRlbXBsYXRlSWRdWydkaXNhYmxlX2V4cG9ydF9lZGl0J10gPSAkcm93WydkaXNhYmxlX2V4cG9ydF9lZGl0J107DQogICAgICAgIH0NCg0KICAgICAgICBpZiAoMSA9PT0gY291bnQoJHJldHVybl9hcnJheSkpIHsNCiAgICAgICAgICAgICR0bXBfYXJyID0gJHJldHVybl9hcnJheTsNCg0KICAgICAgICAgICAgcmVzZXQoJHRtcF9hcnIpOw0KDQogICAgICAgICAgICAka2V5ID0ga2V5KCR0bXBfYXJyKTsNCiAgICAgICAgICAgICRyZXR1cm5fYXJyYXlbJGtleV1bJ3RlbXBsYXRlbmFtZSddID0gJHRtcF9hcnJbJGtleV1bJ3RlbXBsYXRlbmFtZSddOw0KICAgICAgICAgICAgJHJldHVybl9hcnJheVska2V5XVsnaXNfZGVmYXVsdCddID0gJzMnOw0KICAgICAgICB9DQoNCiAgICAgICAgcmV0dXJuICRyZXR1cm5fYXJyYXk7DQogICAgfQ0KDQogICAgcHVibGljIGZ1bmN0aW9uIENoZWNrVGVtcGxhdGVQZXJtaXNzaW9ucygkc2VsZWN0ZWRfbW9kdWxlLCAkdGVtcGxhdGVpZCwgJGRpZSA9IHRydWUpDQogICAgew0KICAgICAgICAkY3VycmVudF91c2VyID0gVXNlcnNfUmVjb3JkX01vZGVsOjpnZXRDdXJyZW50VXNlck1vZGVsKCk7DQogICAgICAgICRyZXN1bHQgPSB0cnVlOw0KICAgICAgICBpZiAoIWlzX2FkbWluKCRjdXJyZW50X3VzZXIpKSB7DQogICAgICAgICAgICBpZiAoJHNlbGVjdGVkX21vZHVsZSAhPSAiIiAmJiBpc1Blcm1pdHRlZCgkc2VsZWN0ZWRfbW9kdWxlLCAnJykgIT0gInllcyIpIHsNCiAgICAgICAgICAgICAgICAkcmVzdWx0ID0gZmFsc2U7DQogICAgICAgICAgICB9IGVsc2VpZiAoJHRl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B7DQogICAgICAgICAgICBpZiAoIWlzc2V0KCRBZGRfQXR0clskYXR0cl90eXBlXSkpIHsNCiAgICAgICAgICAgICAgICBpZiAoJHJlcXVlc3QtPmhhcygkYXR0cl90eXBlKSAmJiAhJHJlcXVlc3QtPmlzRW1wdHkoJGF0dHJfdHlwZSkpIHsNCiAgICAgICAgICAgICAgICAgICAgJGF0dHJfdmFsID0gJHJlcXVlc3QtPmdldCgkYXR0cl90eXBlKTsNCiAgICAgICAgICAgICAgICAgICAgaWYgKGlzX2FycmF5KCRhdHRyX3ZhbCkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICRhdHRyX3ZhbCA9IGpzb25fZW5jb2RlKCRhdHRyX3ZhbCk7DQogICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgJEFbXSA9ICRhdHRyX3R5cGUgLiAnPScgLiB1cmxlbmNvZGUoJGF0dHJfdmFsKTsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQogICAgICAgIH0NCg0KICAgICAgICBpZiAoY291bnQoJEFkZF9BdHRyKSA+IDApIHsNCiAgICAgICAgICAgIGZvcmVhY2ggKCRBZGRfQXR0ciBhcyAkYXR0cl90eXBlID0+ICRyZXFfbmFtZSkgew0KICAgICAgICAgICAgICAgIGlmICgkcmVxdWVzdC0+aGFzKCRyZXFfbmFtZSkgJiYgISRyZXF1ZXN0LT5pc0VtcHR5KCRyZXFfbmFtZSkpIHsNCiAgICAgICAgICAgICAgICAgICAgJGF0dHJfdmFsID0gJHJlcXVlc3QtPmdldCgkcmVxX25hbWUpOw0KICAgICAgICAgICAgICAgICAgICBpZiAoaXNfYXJyYXkoJGF0dHJfdmFsKSkgew0KICAgICAgICAgICAgICAgICAgICAgICAgJGF0dHJfdmFsID0ganNvbl9lbmNvZGUoJGF0dHJfdmFsKTsNCiAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAkQVtdID0gJGF0dHJfdHlwZSAuICc9JyAuIHVybGVuY29kZSgkYXR0cl92YWwpOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH0NCiAgICAgICAgfQ0KDQogICAgICAgIHJldHVybiBpbXBsb2RlKCcmJywgJEEpOw0KICAgIH0NCg0KICAgIHB1YmxpYyBmdW5jdGlvbiBhZGRBd2Vzb21lU3R5bGUoJiRjb250ZW50LCAkY29udmVydCA9IHRydWUpDQogICAgew0KDQogICAgICAgICRmb250YXdlc29tZWNsYXNzID0gZmlsZV9nZXRfY29udGVudHMoJ2xheW91dHMvdjcvbW9kdWxlcy9QREZNYWtlci9yZXNvdXJjZXMvRm9udEF3ZXNvbWUuY3NzJyk7DQogICAgICAgIGlmICgkY29udmVydCkgew0KICAgICAgICAgICAgJGZvbnRhd2Vzb21lY2xhc3MgPSBzdHJfcmVwbGFjZSgiRm9udEF3ZXNvbWUiLCAiZm9udGF3ZXNvbWUiLCAkZm9udGF3ZXNvbWVjbGFzcyk7DQogICAgICAgIH0NCg0KICAgICAgICAkc3R5bGVfY29udGVudCA9ICc8c3R5bGU+JyAuICRmb250YXdlc29tZWNsYXNzIC4gJzwvc3R5bGU+JzsNCiAgICAgICAgaWYgKCRjb252ZXJ0KSB7DQogICAgICAgICAgICAkc3R5bGVfY29udGVudCAuPSAnPHN0eWxlPi5mYSB7IGZvbnQtZmFtaWx5OiBmb250YXdlc29tZTt9PC9zdHlsZT4nOw0KICAgICAgICB9DQogICAgICAgIGlmIChlbXB0eSgkY29udGVudCkpIHsNCiAgICAgICAgICAgICRjb250ZW50ID0gJzwhRE9DVFlQRSBodG1sPg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxodG1sPg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxoZWFkPicgLiAkc3R5bGVfY29udGVudCAuICc8L2hlYWQ+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJvZHk+PC9ib2R5Pg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvaHRtbD4nOw0KICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgUERGTWFrZXJfUERGTWFrZXJfTW9kZWw6OmdldFNpbXBsZUh0bWxEb21GaWxlKCk7DQoNCiAgICAgICAgICAgICRodG1sID0gc3RyX2dldF9odG1sKCRjb250ZW50KTsNCg0KICAgICAgICAgICAgaWYgKGlzX2FycmF5KCRodG1sLT5maW5kKCJoZWFkIikpICYmIGNvdW50KCRodG1sLT5maW5kKCJoZWFkIikpID4gMCkgew0KDQogICAgICAgICAgICAgICAgZm9yZWFjaCAoJGh0bWwtPmZpbmQoImhlYWQiKSBhcyAkaGVhZCkgew0KICAgICAgICAgICAgICAgICAgICAkaGVhZF9jb250ZW50ID0gJGhlYWQtPmlubmVydGV4dDsNCiAgICAgICAgICAgICAgICAgICAgJGhlYWQtPmlubmVydGV4dCA9ICRzdHlsZV9jb250ZW50IC4gJGhlYWRfY29udGVudDsNCiAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICBmb3JlYWNoICgkaHRtbC0+ZmluZCgiYm9keSIpIGFzICRib2R5KSB7DQogICAgICAgICAgICAgICAgICAgICRib2R5X2NvbnRlbnQgPSAkYm9keS0+aW5uZXJ0ZXh0Ow0KICAgICAgICAgICAgICAgICAgICAkYm9keS0+aW5uZXJ0ZXh0ID0gJGJvZHlfY29udGVudDsNCiAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICAkY29udGVudCA9ICRodG1sLT5zYXZlKCk7DQoNCiAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgJGNvbnRlbnQgPSAnPCFET0NUWVBFIGh0bWw+DQogICAgICAgICAgICAgICAgICAgICAgICA8aHRtbD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDxoZWFkPicgLiAkc3R5bGVfY29udGVudCAuICc8L2hlYWQ+DQogICAgICAgICAgICAgICAgICAgICAgICA8Ym9keT4NCiAgICAgICAgICAgICAgICAgICAgICAgICcgLiAkY29udGVudCAuICcNCiA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CiAgICAgICAgICAgICd2dGlnZXJfcGRmbWFrZXJfcmVsZWFzZXMnLA0KICAgICAgICAgICAgJ3Z0aWdlcl9wZGZtYWtlcl9zZXEnLA0KICAgICAgICAgICAgJ3Z0aWdlcl9wZGZtYWtlcl9zZXR0aW5ncycsDQogICAgICAgICAgICAndnRpZ2VyX3BkZm1ha2VyX3NoYXJpbmcnLA0KICAgICAgICAgICAgJ3Z0aWdlcl9wZGZtYWtlcl91c2Vyc2V0dGluZ3MnLA0KICAgICAgICAgICAgJ3Z0aWdlcl9wZGZtYWtlcl91c2Vyc3RhdHVzJywNCiAgICAgICAgICAgICd2dGlnZXJfcGRmbWFrZXJfdmVyc2lvbicsDQogICAgICAgICk7DQogICAgfQ0KDQogICAgDQogICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBjb252ZXJ0VG9GbG9hdE51bWJlcigkdmFsdWUpDQogICAgew0KICAgICAgICBwcmVnX21hdGNoX2FsbCgnL1teMC05XS8nLCAkdmFsdWUsICRtYXRjaGVzKTsNCg0KICAgICAgICBpZiAoY291bnQoJG1hdGNoZXNbMF0pID4gMSkgew0KICAgICAgICAgICAgJHZhbHVlID0gc3RyX3JlcGxhY2UoJG1hdGNoZXNbMF1bMF0sICcnLCAkdmFsdWUpOw0KICAgICAgICB9DQoNCiAgICAgICAgcmV0dXJuIHByZWdfcmVwbGFjZSgnL1teMC05XS8nLCAnLicsICR2YWx1ZSk7DQogICAgfQ0KfSA/Pg==');

Function Calls

base64_decode 1

Variables

None

Stats

MD5 aae83880eaf7e59bc586a7859ef5872c
Eval Count 0
Decode Time 2950 ms