hipy/drpy_js/直播转点播[合].js
2024-11-19 16:16:36 +08:00

1 line
No EOL
25 KiB
JavaScript

LyoqCiAqIOaUr+aMgeacrOWcsOWMheebtOaSremTvuaOpQogKiDkvKDlj4IgP3R5cGU9dXJsJnBhcmFtcz0uLi9qc29uL2xpdmUyY21zLmpzb24KIGxpdmUyY21zLmpzb24KIOaUr+aMgW0zdeexu+ebtOaSre+8jOaUr+aMgee6v+i3r+W9kuW5tuOAguaUr+aMgeetm+mAieWIh+aNouaYvuekuuaooeW8jwogWwogewogICAgIm5hbWUiOiAiR2l0SHViIiwKICAgICJ1cmwiOiAiaHR0cHM6Ly9naHByb3h5Lm5ldC9odHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vc3NpbGkxMjYvdHYvbWFpbi9pdHZsaXN0LnR4dCIKICB9LAogewogICAgIm5hbWUiOiAiQ05UViIsCiAgICAidXJsIjogIi4vbGl2ZV9jbnR2LnR4dCIKICB9CiBdCiAqLwoKLyoqCiAqIG0zdeebtOaSreagvOW8j+i9rOS4gOiIrOebtOaSreagvOW8jwogKiBAcGFyYW0gbTN1CiAqIEByZXR1cm5zIHtzdHJpbmd9CiAqLwpmdW5jdGlvbiBjb252ZXJ0TTN1VG9Ob3JtYWwobTN1KSB7CiAgICB0cnkgewogICAgICAgIGNvbnN0IGxpbmVzID0gbTN1LnNwbGl0KCdcbicpOwogICAgICAgIGxldCByZXN1bHQgPSAnJzsKICAgICAgICBsZXQgVFYgPSAnJzsKICAgICAgICAvLyBsZXQgZmxhZz0nI2dlbnJlIyc7CiAgICAgICAgbGV0IGZsYWcgPSAnI20zdSMnOwogICAgICAgIGxldCBjdXJyZW50R3JvdXBUaXRsZSA9ICcnOwogICAgICAgIGxpbmVzLmZvckVhY2goKGxpbmUpID0+IHsKICAgICAgICAgICAgaWYgKGxpbmUuc3RhcnRzV2l0aCgnI0VYVElORjonKSkgewogICAgICAgICAgICAgICAgbGluZSA9IGxpbmUucmVwbGFjZSgvJy9nLCAnIicpOwogICAgICAgICAgICAgICAgbGV0IGdyb3VwVGl0bGUgPSAn5pyq55+l6aKR6YGTJzsKICAgICAgICAgICAgICAgIGxldCB0dmdfbmFtZSA9ICcnOwogICAgICAgICAgICAgICAgbGV0IHR2Z19sb2dvID0gJyc7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGdyb3VwVGl0bGUgPSBsaW5lLm1hdGNoKC9ncm91cC10aXRsZT0iKC4qPykiLylbMV0udHJpbSgpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB0dmdfbmFtZSA9IGxpbmUubWF0Y2goL3R2Zy1uYW1lPSIoLio/KSIvKVsxXS50cmltKCk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHR2Z19sb2dvID0gbGluZS5tYXRjaCgvdHZnLWxvZ289IiguKj8pIi8pWzFdLnRyaW0oKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIFRWID0gbGluZS5zcGxpdCgnLCcpLnNsaWNlKC0xKVswXS50cmltKCk7CiAgICAgICAgICAgICAgICBpZiAoY3VycmVudEdyb3VwVGl0bGUgIT09IGdyb3VwVGl0bGUpIHsKICAgICAgICAgICAgICAgICAgICBjdXJyZW50R3JvdXBUaXRsZSA9IGdyb3VwVGl0bGU7CiAgICAgICAgICAgICAgICAgICAgbGV0IHJldF9saXN0ID0gW2N1cnJlbnRHcm91cFRpdGxlLCBmbGFnXTsKICAgICAgICAgICAgICAgICAgICAvLyBpZih0dmdfbmFtZSl7CiAgICAgICAgICAgICAgICAgICAgLy8gICAgIHJldF9saXN0LnB1c2godHZnX25hbWUpOwogICAgICAgICAgICAgICAgICAgIC8vIH0KICAgICAgICAgICAgICAgICAgICAvLyBpZih0dmdfbG9nbyl7CiAgICAgICAgICAgICAgICAgICAgLy8gICAgIHJldF9saXN0LnB1c2godHZnX2xvZ28pOwogICAgICAgICAgICAgICAgICAgIC8vIH0KICAgICAgICAgICAgICAgICAgICByZXN1bHQgKz0gYFxuJHtyZXRfbGlzdC5qb2luKCIsIil9XG5gOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgaWYgKGxpbmUuc3RhcnRzV2l0aCgnaHR0cCcpKSB7CiAgICAgICAgICAgICAgICBjb25zdCBzcGxpdExpbmUgPSBsaW5lLnNwbGl0KCcsJyk7CiAgICAgICAgICAgICAgICByZXN1bHQgKz0gYCR7VFZ9XCwke3NwbGl0TGluZVswXX1cbmA7CiAgICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICAvLyByZXN1bHQgPSByZXN1bHQudHJpbSgpOwogICAgICAgIHJlc3VsdCA9IG1lcmdlQ2hhbm5lbHMocmVzdWx0KTsKICAgICAgICAvLyBsb2cocmVzdWx0KTsKICAgICAgICByZXR1cm4gcmVzdWx0CiAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgbG9nKGBtM3Xnm7Tmkq3ovazmma7pgJrnm7Tmkq3lj5HnlJ/plJnor686JHtlLm1lc3NhZ2V9YCk7CiAgICAgICAgcmV0dXJuIG0zdQogICAgfQp9CgovKioKICog57q/6Lev5b2S57G7L+Wwj+ajieiihOeul+azlQogKiBAcGFyYW0gYXJyIOaVsOe7hAogKiBAcGFyYW0gcGFyc2Ug6Kej5p6Q5byPCiAqIEByZXR1cm5zIHtbWypdXX0KICovCmZ1bmN0aW9uIHNwbGl0QXJyYXkoYXJyLCBwYXJzZSkgewogICAgcGFyc2UgPSBwYXJzZSAmJiB0eXBlb2YgKHBhcnNlKSA9PSAnZnVuY3Rpb24nID8gcGFyc2UgOiAnJzsKICAgIGxldCByZXN1bHQgPSBbW2FyclswXV1dOwogICAgZm9yIChsZXQgaSA9IDE7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHsKICAgICAgICBsZXQgaW5kZXggPSAtMTsKICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IHJlc3VsdC5sZW5ndGg7IGorKykgewogICAgICAgICAgICBpZiAocGFyc2UgJiYgcmVzdWx0W2pdLm1hcChwYXJzZSkuaW5jbHVkZXMocGFyc2UoYXJyW2ldKSkpIHsKICAgICAgICAgICAgICAgIGluZGV4ID0gajsKICAgICAgICAgICAgfSBlbHNlIGlmICgoIXBhcnNlKSAmJiByZXN1bHRbal0uaW5jbHVkZXMoYXJyW2ldKSkgewogICAgICAgICAgICAgICAgaW5kZXggPSBqOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChpbmRleCA+PSByZXN1bHQubGVuZ3RoIC0gMSkgewogICAgICAgICAgICByZXN1bHQucHVzaChbXSk7CiAgICAgICAgICAgIHJlc3VsdFtyZXN1bHQubGVuZ3RoIC0gMV0ucHVzaChhcnJbaV0pOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJlc3VsdFtpbmRleCArIDFdLnB1c2goYXJyW2ldKTsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gcmVzdWx0Owp9CgovKioKICog5pCc57Si57uT5p6c55Sf5oiQ5YiG57uE5a2X5YW4CiAqIEBwYXJhbSBhcnIKICogQHBhcmFtIHBhcnNlIHg9Pnguc3BsaXQoJywnKVswXQogKiBAcmV0dXJucyB7e319CiAqLwpmdW5jdGlvbiBnZW5fZ3JvdXBfZGljdChhcnIsIHBhcnNlKSB7CiAgICBsZXQgZGljdCA9IHt9OwogICAgYXJyLmZvckVhY2goKGl0KSA9PiB7CiAgICAgICAgbGV0IGsgPSBpdC5zcGxpdCgnLCcpWzBdOwogICAgICAgIGlmIChwYXJzZSAmJiB0eXBlb2YgKHBhcnNlKSA9PT0gJ2Z1bmN0aW9uJykgewogICAgICAgICAgICBrID0gcGFyc2Uoayk7CiAgICAgICAgfQogICAgICAgIGlmICghZGljdFtrXSkgewogICAgICAgICAgICBkaWN0W2tdID0gW2l0XTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBkaWN0W2tdLnB1c2goaXQpOwogICAgICAgIH0KICAgIH0pOwogICAgcmV0dXJuIGRpY3QKfQoKLyoqCiAqIHR4dOagvOW8j+ebtOaSreiHquWKqOWQiOW5tumikemBk+mTvuaOpQogKiBAcGFyYW0gdGV4dAogKiBAcmV0dXJucyB7c3RyaW5nfQogKi8KZnVuY3Rpb24gbWVyZ2VDaGFubmVscyh0ZXh0KSB7CiAgICBjb25zdCBsaW5lcyA9IHRleHQuc3BsaXQoJ1xuJyk7CiAgICBjb25zdCBjaGFubmVsTWFwID0gbmV3IE1hcCgpOwogICAgbGV0IGN1cnJlbnRDaGFubmVsID0gJyc7IC8vIOW9k+WJjeWkhOeQhueahOmikemBkwoKICAgIGxpbmVzLmZvckVhY2gobGluZSA9PiB7CiAgICAgICAgLy8g5L2/55So5q2j5YiZ6KGo6L6+5byP5Yy56YWN6aKR6YGT6KGM77yM5YGH6K6+6aKR6YGT6KGM5YyF5ZCrIiwjIuWNs+WPr+ivhuWIq+S4uumikemBk+ihjAogICAgICAgIGlmICgvLCMvLnRlc3QobGluZSkpIHsKICAgICAgICAgICAgLy8g5aaC5p6c5piv6aKR6YGT5ZCN56ew77yM5L2c5Li66ZSu5YC85a2Y5YKo77yM5Yid5aeL5YyW5Li656m65pWw57uECiAgICAgICAgICAgIGN1cnJlbnRDaGFubmVsID0gbGluZTsKICAgICAgICAgICAgaWYgKCFjaGFubmVsTWFwLmhhcyhsaW5lKSkgewogICAgICAgICAgICAgICAgY2hhbm5lbE1hcC5zZXQobGluZSwgW10pOwogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIGlmIChsaW5lKSB7IC8vIOW/veeVpeepuuihjAogICAgICAgICAgICAvLyDlsIblvZPliY3ooYzvvIjpk77mjqXvvInmt7vliqDliLDlvZPliY3popHpgZPmlbDnu4Tk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ivt+axguebtOaOpeaUvumjnuiHquaIkeOAguaQnOe0oumZkOWItuacgOWkp+e6v+eoi+aVsOmHjzE2CiAgICAgICAgICAgIHJ1bGUuc2VhcmNoX2xpbWl0ID0gMTY7CiAgICAgICAgICAgIGxvZygn5b2T5YmN56iL5bqP5pSv5oyB5om56YeP6K+35rGCW2JhdGNoRmV0Y2hdLOaQnOe0oumZkOWItuW3suiuvue9ruS4ujE2Jyk7CiAgICAgICAgfQogICAgICAgIGxldCBfdXJsID0gcnVsZS5wYXJhbXM7CiAgICAgICAgaWYgKF91cmwgJiYgdHlwZW9mIChfdXJsKSA9PT0gJ3N0cmluZycgJiYgL14oaHR0cHxmaWxlKS8udGVzdChfdXJsKSkgewogICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoX3VybCk7CiAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShodG1sKTsKCiAgICAgICAgICAgIGxldCBfY2xhc3NlcyA9IFtdOwogICAgICAgICAgICBydWxlLmZpbHRlciA9IHt9OwogICAgICAgICAgICBydWxlLmZpbHRlcl9kZWYgPSB7fTsKICAgICAgICAgICAganNvbi5mb3JFYWNoKGl0ID0+IHsKICAgICAgICAgICAgICAgIGlmIChpdC51cmwgJiYgIS9eKGh0dHB8ZmlsZSkvLnRlc3QoaXQudXJsKSkgewogICAgICAgICAgICAgICAgICAgIGl0LnVybCA9IHVybGpvaW4oX3VybCwgaXQudXJsKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChpdC5pbWcgJiYgIS9eKGh0dHB8ZmlsZSkvLnRlc3QoaXQuaW1nKSkgewogICAgICAgICAgICAgICAgICAgIGl0LmltZyA9IHVybGpvaW4oX3VybCwgaXQuaW1nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGxldCBfb2JqID0gewogICAgICAgICAgICAgICAgICAgIHR5cGVfbmFtZTogaXQubmFtZSwKICAgICAgICAgICAgICAgICAgICB0eXBlX2lkOiBpdC51cmwsCiAgICAgICAgICAgICAgICAgICAgaW1nOiBpdC5pbWcsCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgX2NsYXNzZXMucHVzaChfb2JqKTsKICAgICAgICAgICAgICAgIGxldCBqc29uMSA9IFt7J24nOiAn5aSa57q/6Lev5YiG57uEJywgJ3YnOiAnZ3JvdXBzJ30sIHsnbic6ICfljZXnur/ot68nLCAndic6ICdhbGwnfV07CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHJ1bGUuZmlsdGVyW19vYmoudHlwZV9pZF0gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsna2V5JzogJ3Nob3cnLCAnbmFtZSc6ICfmkq3mlL7lsZXnpLonLCAndmFsdWUnOiBqc29uMX0KICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgIGlmIChqc29uMS5sZW5ndGggPiAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGUuZmlsdGVyX2RlZltpdC51cmxdID0geyJzaG93IjoganNvbjFbMF0udn07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIHJ1bGUuZmlsdGVyW2l0LnVybF0gPSBqc29uMQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgX19leHQuZGF0YSA9IGpzb247CiAgICAgICAgICAgIHJ1bGUuY2xhc3NlcyA9IF9jbGFzc2VzOwogICAgICAgIH0KICAgIH0pLAogICAgY2xhc3NfcGFyc2U6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgaW5wdXQgPSBydWxlLmNsYXNzZXM7CiAgICB9KSwKICAgIOaOqOiNkDogJGpzLnRvU3RyaW5nKCgpID0+IHsKICAgICAgICBsZXQgdXBkYXRlX2luZm8gPSBbewogICAgICAgICAgICB2b2RfbmFtZTogJ+abtOaWsOaXpeW/lycsCiAgICAgICAgICAgIHZvZF9pZDogJ3VwZGF0ZV9pbmZvJywKICAgICAgICAgICAgdm9kX3JlbWFya3M6IGDniYjmnKw6JHtydWxlLnZlcnNpb259YCwKICAgICAgICAgICAgdm9kX3BpYzogJ2h0dHBzOi8vZ2hwcm94eS5uZXQvaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL2hqZGhueC9oaXB5LXNlcnZlci9tYXN0ZXIvYXBwL3N0YXRpYy9pbWcvbG9nby5wbmcnCiAgICAgICAgfV07CiAgICAgICAgVk9EUyA9IFtdOwogICAgICAgIGlmIChydWxlLmNsYXNzZXMpIHsKICAgICAgICAgICAgbGV0IHJhbmRvbUNsYXNzID0gZ2V0UmFuZG9tSXRlbShydWxlLmNsYXNzZXMpOwogICAgICAgICAgICBsZXQgX2dldF91cmwgPSByYW5kb21DbGFzcy50eXBlX2lkOwogICAgICAgICAgICAvLyBsZXQgY3VycmVudF92b2QgPSBydWxlLmNsYXNzZXMuZmluZChpdGVtID0+IGl0ZW0udHlwZV9pZCA9PT0gX2dldF91cmwpOwogICAgICAgICAgICAvLyBsZXQgX3BpYyA9IGN1cnJlbnRfdm9kID8gY3VycmVudF92b2QuaW1nIDogJyc7CiAgICAgICAgICAgIGxldCBfcGljID0gcmFuZG9tQ2xhc3MuaW1nOwogICAgICAgICAgICBsZXQgaHRtbDsKICAgICAgICAgICAgaWYgKF9fZXh0LmRhdGFfZGljdFtfZ2V0X3VybF0pIHsKICAgICAgICAgICAgICAgIGh0bWwgPSBfX2V4dC5kYXRhX2RpY3RbX2dldF91cmxdOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgaHRtbCA9IHJlcXVlc3QoX2dldF91cmwpOwogICAgICAgICAgICAgICAgaWYgKC8jRVhUTTNVLy50ZXN0KGh0bWwpKSB7CiAgICAgICAgICAgICAgICAgICAgaHRtbCA9IGNvbnZlcnRNM3VUb05vcm1hbChodG1sKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgaHRtbCA9IG1lcmdlQ2hhbm5lbHMoaHRtbCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBfX2V4dC5kYXRhX2RpY3RbX2dldF91cmxdID0gaHRtbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZXQgYXJyID0gaHRtbC5tYXRjaCgvLio/WyzvvIxdI1tcc1xTXS4qPyMvZyk7IC8vIOWPr+iDveWtmOWcqOS4reaWh+mAl+WPtwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgYXJyLmZvckVhY2goaXQgPT4gewogICAgICAgICAgICAgICAgICAgIGxldCB2bmFtZSA9IGl0LnNwbGl0KC9bLO+8jF0vKVswXTsKICAgICAgICAgICAgICAgICAgICBsZXQgdnRhYiA9IGl0Lm1hdGNoKC8jKC4qPykjLylbMF07CiAgICAgICAgICAgICAgICAgICAgVk9EUy5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgdm9kX25hbWU6IHZuYW1lLAogICAgICAgICAgICAgICAgICAgICAgICB2b2RfaWQ6IF9nZXRfdXJsICsgJyQnICsgdm5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9waWM6IF9waWMgfHwgcnVsZS5kZWZfcGljLAogICAgICAgICAgICAgICAgICAgICAgICB2b2RfcmVtYXJrczogdnRhYiwKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBsb2coYOebtOaSrei9rOeCueaSreiOt+WPlummlumhteaOqOiNkOWPkemAgemUmeivrzoke2UubWVzc2FnZX1gKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBWT0RTID0gdXBkYXRlX2luZm8uY29uY2F0KFZPRFMpOwogICAgfSksCiAgICDkuIDnuqc6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgVk9EUyA9IFtdOwogICAgICAgIC8vIOS4gOe6p+mZkOWItumhteaVsOS4jeWFgeiuuOe/u+mhtQogICAgICAgIGlmIChydWxlLmNsYXNzZXMgJiYgTVlfUEFHRSA8PSAxKSB7CiAgICAgICAgICAgIGlmIChNWV9GTC5zaG93KSB7CiAgICAgICAgICAgICAgICBydWxlLnNob3dNb2RlID0gTVlfRkwuc2hvdzsKICAgICAgICAgICAgICAgIHNldEl0ZW0oJ3Nob3dNb2RlJywgcnVsZS5zaG93TW9kZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbGV0IF9nZXRfdXJsID0gaW5wdXQuc3BsaXQoJyMnKVswXTsKICAgICAgICAgICAgbGV0IGN1cnJlbnRfdm9kID0gcnVsZS5jbGFzc2VzLmZpbmQoaXRlbSA9PiBpdGVtLnR5cGVfaWQgPT09IE1ZX0NBVEUpOwogICAgICAgICAgICBsZXQgX3BpYyA9IGN1cnJlbnRfdm9kID8gY3VycmVudF92b2QuaW1nIDogJyc7CiAgICAgICAgICAgIGxldCBodG1sOwogICAgICAgICAgICBpZiAoX19leHQuZGF0YV9kaWN0W19nZXRfdXJsXSkgewogICAgICAgICAgICAgICAgaHRtbCA9IF9fZXh0LmRhdGFfZGljdFtfZ2V0X3VybF07CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBodG1sID0gcmVxdWVzdChfZ2V0X3VybCk7CiAgICAgICAgICAgICAgICBpZiAoLyNFWFRNM1UvLnRlc3QoaHRtbCkpIHsKICAgICAgICAgICAgICAgICAgICBodG1sID0gY29udmVydE0zdVRvTm9ybWFsKGh0bWwpOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBodG1sID0gbWVyZ2VDaGFubmVscyhodG1sKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIF9fZXh0LmRhdGFfZGljdFtfZ2V0X3VybF0gPSBodG1sOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCBhcnIgPSBodG1sLm1hdGNoKC8uKj9bLO+8jF0jW1xzXFNdLio/Iy9nKTsgLy8g5Y+v6IO95a2Y5Zyo5Lit5paH6YCX5Y+3CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBhcnIuZm9yRWFjaChpdCA9PiB7CiAgICAgICAgICAgICAgICAgICAgbGV0IHZuYW1lID0gaXQuc3BsaXQoL1ss77yMXS8pWzBdOwogICAgICAgICAgICAgICAgICAgIGxldCB2dGFiID0gaXQubWF0Y2goLyMoLio/KSMvKVswXTsKICAgICAgICAgICAgICAgICAgICBWT0RTLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAvLyB2b2RfbmFtZTppdC5zcGxpdCgnLCcpWzBdLAogICAgICAgICAgICAgICAgICAgICAgICB2b2RfbmFtZTogdm5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9pZDogX2dldF91cmwgKyAnJCcgKyB2bmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgdm9kX3BpYzogX3BpYyB8fCBydWxlLmRlZl9waWMsCiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9yZW1hcmtzOiB2dGFiLAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGxvZyhg55u05pKt6L2s54K55pKt6I635Y+W5LiA57qn5YiG57G76aG15Y+R55Sf6ZSZ6K+vOiR7ZS5tZXNzYWdlfWApOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfSksCiAgICDkuoznuqc6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgVk9EID0ge307CiAgICAgICAgaWYgKG9ySWQgPT09ICd1cGRhdGVfaW5mbycpIHsKICAgICAgICAgICAgVk9EID0gewogICAgICAgICAgICAgICAgdm9kX2NvbnRlbnQ6IHJ1bGUudXBkYXRlX2luZm8udHJpbSgpLAogICAgICAgICAgICAgICAgdm9kX25hbWU6ICfmm7TmlrDml6Xlv5cnLAogICAgICAgICAgICAgICAgdHlwZV9uYW1lOiAn5pu05paw5pel5b+XJywKICAgICAgICAgICAgICAgIHZvZF9waWM6ICdodHRwczovL3Jlc291cmNlLWNkbi50dXhpYW9iZWkuY29tL3ZpZGVvL0Z0V2hzMm1ld1hfN25FdUU1MV9rNnp2ZzZhd2wucG5nJywKICAgICAgICAgICAgICAgIHZvZF9yZW1hcmtzOiBg54mI5pysOiR7cnVsZS52ZXJzaW9ufWAsCiAgICAgICAgICAgICAgICB2b2RfcGxheV9mcm9tOiAn6YGT6ZW/5Zyo57q/JywKICAgICAgICAgICAgICAgIC8vIHZvZF9wbGF5X3VybDogJ+WXheaOouaSreaUviRodHRwczovL3Jlc291cmNlLWNkbi50dXhpYW9iZWkuY29tL3ZpZGVvLzEwLzhmLzEwOGZjOWQxYWMzZjY5ZDI5YTczOGNkYzA5N2M5MDE4Lm1wNCcsCiAgICAgICAgICAgICAgICB2b2RfcGxheV91cmw6ICfpmo/mnLrlsI/op4bpopEkaHR0cDovL2FwaS55dWpuLmNuL2FwaS96enhqai5waHAnLAogICAgICAgICAgICB9OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmIChydWxlLmNsYXNzZXMpIHsKICAgICAgICAgICAgICAgIGxldCBfZ2V0X3VybCA9IG9ySWQuc3BsaXQoJyQnKVswXTsKICAgICAgICAgICAgICAgIGxldCBfdGFiID0gb3JJZC5zcGxpdCgnJCcpWzFdOwogICAgICAgICAgICAgICAgaWYgKG9ySWQuaW5jbHVkZXMoJyNzZWFyY2gjJykpIHsKICAgICAgICAgICAgICAgICAgICBsZXQgdm9kX25hbWUgPSBfdGFiLnJlcGxhY2UoJyNzZWFyY2gjJywgJycpOwogICAgICAgICAgICAgICAgICAgIGxldCB2b2RfcGxheV9mcm9tID0gJ+adpeiHquaQnOe0oic7CiAgICAgICAgICAgICAgICAgICAgdm9kX3BsYXlfZnJvbSArPSBgOiR7X2dldF91cmx9YDsKICAgICAgICAgICAgICAgICAgICBsZXQgdm9kX3BsYXlfdXJsID0gcnVsZS5ncm91cERpY3RbX2dldF91cmxdLm1hcCh4ID0+IHgucmVwbGFjZSgnLCcsICckJykpLmpvaW4oJyMnKTsKICAgICAgICAgICAgICAgICAgICBsb2cob3JJZCk7CiAgICAgICAgICAgICAgICAgICAgVk9EID0gewogICAgICAgICAgICAgICAgICAgICAgICB2b2RfbmFtZTogJ+aQnOe0ojonICsgdm9kX25hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVfbmFtZTogIuebtOaSreWIl+ihqCIsCiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9waWM6IHJ1bGUuZGVmX3BpYywKICAgICAgICAgICAgICAgICAgICAgICAgLy8gdm9kX2NvbnRlbnQ6IG9ySWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9jb250ZW50OiBvcklkLnJlcGxhY2UoZ2V0SG9tZShvcklkKSwgJ2h0dHA6Ly8qKionKSwKICAgICAgICAgICAgICAgICAgICAgICAgdm9kX3BsYXlfZnJvbTogdm9kX3BsYXlfZnJvbSwKICAgICAgICAgICAgICAgICAgICAgICAgdm9kX3BsYXlfdXJsOiB2b2RfcGxheV91cmwsCiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9kaXJlY3RvcjogcnVsZS50aXBzLAogICAgICAgICAgICAgICAgICAgICAgICB2b2RfcmVtYXJrczogcnVsZS50aXBzLAogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgbGV0IGN1cnJlbnRfdm9kID0gcnVsZS5jbGFzc2VzLmZpbmQoaXRlbSA9PiBpdGVtLnR5cGVfaWQgPT09IF9nZXRfdXJsKTsKICAgICAgICAgICAgICAgICAgICBsZXQgX3BpYyA9IGN1cnJlbnRfdm9kID8gY3VycmVudF92b2QuaW1nIDogJyc7CiAgICAgICAgICAgICAgICAgICAgbGV0IGh0bWw7CiAgICAgICAgICAgICAgICAgICAgaWYgKF9fZXh0LmRhdGFfZGljdFtfZ2V0X3VybF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbCA9IF9fZXh0LmRhdGFfZGljdFtfZ2V0X3VybF07CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbCA9IHJlcXVlc3QoX2dldF91cmwpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoLyNFWFRNM1UvLnRlc3QoaHRtbCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh0bWwgPSBjb252ZXJ0TTN1VG9Ob3JtYWwoaHRtbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBodG1sID0gbWVyZ2VDaGFubmVscyhodG1sKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBfX2V4dC5kYXRhX2RpY3RbX2dldF91cmxdID0gaHRtbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbGV0IGEgPSBuZXcgUmVnRXhwKGAuKj8ke190YWIucmVwbGFjZSgnKCcsJ1xcKCcpLnJlcGxhY2UoJyknLCdcXCknKX1bLO+8jF0jW1xcc1xcU10uKj8jYCk7CiAgICAgICAgICAgICAgICAgICAgbGV0IGIgPSBodG1sLm1hdGNoKGEpWzBdOwogICAgICAgICAgICAgICAgICAgIGxldCBjID0gaHRtbC5zcGxpdChiKVsxXTsKICAgICAgICAgICAgICAgICAgICBpZiAoYy5tYXRjaCgvLio/WyzvvIxdI1tcc1xTXS4qPyMvKSkgewogICAgICAgICAgICAgICAgICAgICAgICBsZXQgZCA9IGMubWF0Y2goLy4qP1ss77yMXSNbXHNcU10uKj8jLylbMF07CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjLnNwbGl0KGQpWzBdOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBsZXQgYXJyID0gYy50cmltKCkuc3BsaXQoJ1xuJyk7CiAgICAgICAgICAgICAgICAgICAgbGV0IF9saXN0ID0gW107CiAgICAgICAgICAgICAgICAgICAgYXJyLmZvckVhY2goKGl0KSA9PiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdC50cmltKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB0ID0gaXQudHJpbSgpLnNwbGl0KCcsJylbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdSA9IGl0LnRyaW0oKS5zcGxpdCgnLCcpWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgX2xpc3QucHVzaCh0ICsgJyQnICsgdSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKCiAgICAgICAgICAgICAgICAgICAgbGV0IHZvZF9uYW1lID0gX19leHQuZGF0YS5maW5kKHggPT4geC51cmwgPT09IF9nZXRfdXJsKS5uYW1lOwogICAgICAgICAgICAgICAgICAgIGxldCB2b2RfcGxheV91cmw7CiAgICAgICAgICAgICAgICAgICAgbGV0IHZvZF9wbGF5X2Zyb207CgogICAgICAgICAgICAgICAgICAgIGlmIChydWxlLnNob3dNb2RlID09PSAnZ3JvdXBzJykgewogICAgICAgICAgICAgICAgICAgICAgICBsZXQgZ3JvdXBzID0gc3BsaXRBcnJheShfbGlzdCwgeCA9PiB4LnNwbGl0KCckJylbMF0pOwogICAgICAgICAgICAgICAgICAgICAgICBsZXQgdGFicyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGdyb3Vwcy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWJzLnB1c2godm9kX25hbWUgKyAnQDEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFicy5wdXNoKGBAJHtpICsgMX1gKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB2b2RfcGxheV91cmwgPSBncm91cHMubWFwKGl0ID0+IGl0LmpvaW4oJyMnKSkuam9pbignJCQkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9wbGF5X2Zyb20gPSB0YWJzLmpvaW4oJyQkJCcpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9wbGF5X3VybCA9IF9saXN0LmpvaW4oJyMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdm9kX3BsYXlfZnJvbSA9IHZvZF9uYW1lOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBsb2cob3JJZCk7CiAgICAgICAgICAgICAgICAgICAgVk9EID0gewogICAgICAgICAgICAgICAgICAgICAgICB2b2RfaWQ6IG9ySWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9uYW1lOiB2b2RfbmFtZSArICd8JyArIF90YWIsCiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVfbmFtZTogIuebtOaSreWIl+ihqCIsCiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9waWM6IF9waWMgfHwgcnVsZS5kZWZfcGljLAogICAgICAgICAgICAgICAgICAgICAgICAvLyB2b2RfY29udGVudDogb3JJZCwKICAgICAgICAgICAgICAgICAgICAgICAgdm9kX2NvbnRlbnQ6IG9ySWQucmVwbGFjZShnZXRIb21lKG9ySWQpLCAnaHR0cDovLyoqKicpLAogICAgICAgICAgICAgICAgICAgICAgICB2b2RfcGxheV9mcm9tOiB2b2RfcGxheV9mcm9tLAogICAgICAgICAgICAgICAgICAgICAgICB2b2RfcGxheV91cmw6IHZvZF9wbGF5X3VybCwKICAgICAgICAgICAgICAgICAgICAgICAgdm9kX2RpcmVjdG9yOiBydWxlLnRpcHMsCiAgICAgICAgICAgICAgICAgICAgICAgIHZvZF9yZW1hcmtzOiBydWxlLnRpcHMsCiAgICAgICAgICAgICAgICAgICAgfTsKCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9KSwKICAgIOaQnOe0ojogJGpzLnRvU3RyaW5nKCgpID0+IHsKICAgICAgICBWT0RTID0gW107CiAgICAgICAgaWYgKHJ1bGUuY2xhc3NlcyAmJiBNWV9QQUdFIDw9IDEpIHsKICAgICAgICAgICAgbGV0IF9nZXRfdXJsID0gX19leHQuZGF0YVswXS51cmw7CiAgICAgICAgICAgIGxldCBjdXJyZW50X3ZvZCA9IHJ1bGUuY2xhc3Nlcy5maW5kKGl0ZW0gPT4gaXRlbS50eXBlX2lkID09PSBfZ2V0X3VybCk7CiAgICAgICAgICAgIGxldCBfcGljID0gY3VycmVudF92b2QgPyBjdXJyZW50X3ZvZC5pbWcgOiAnJzsKICAgICAgICAgICAgbGV0IGh0bWw7CiAgICAgICAgICAgIGlmIChfX2V4dC5kYXRhX2RpY3RbX2dldF91cmxdKSB7CiAgICAgICAgICAgICAgICBodG1sID0gX19leHQuZGF0YV9kaWN0W19nZXRfdXJsXTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGh0bWwgPSByZXF1ZXN0KF9nZXRfdXJsKTsKICAgICAgICAgICAgICAgIGlmICgvI0VYVE0zVS8udGVzdChodG1sKSkgewogICAgICAgICAgICAgICAgICAgIGh0bWwgPSBjb252ZXJ0TTN1VG9Ob3JtYWwoaHRtbCk7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGh0bWwgPSBtZXJnZUNoYW5uZWxzKGh0bWwpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgX19leHQuZGF0YV9kaWN0W19nZXRfdXJsXSA9IGh0bWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbGV0IHN0ciA9ICcnOwogICAgICAgICAgICBPYmplY3Qua2V5cyhfX2V4dC5kYXRhX2RpY3QpLmZvckVhY2goKCkgPT4gewogICAgICAgICAgICAgICAgc3RyICs9IF9fZXh0LmRhdGFfZGljdFtfZ2V0X3VybF07CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBsZXQgbGlua3MgPSBzdHIuc3BsaXQoJ1xuJykuZmlsdGVyKGl0ID0+IGl0LnRyaW0oKSAmJiBpdC5pbmNsdWRlcygnLCcpICYmIGl0LnNwbGl0KCcsJylbMV0udHJpbSgpLnN0YXJ0c1dpdGgoJ2h0dHAnKSk7CiAgICAgICAgICAgIGxpbmtzID0gbGlua3MubWFwKGl0ID0+IGl0LnRyaW0oKSk7CiAgICAgICAgICAgIGxldCBwbGF5cyA9IEFycmF5LmZyb20obmV3IFNldChsaW5rcykpOwogICAgICAgICAgICBsb2coJ+aQnOe0ouWFs+mUruivjTonICsgS0VZKTsKICAgICAgICAgICAgbG9nKCfov4fmu6TliY06JyArIHBsYXlzLmxlbmd0aCk7CiAgICAgICAgICAgIC8vIHBsYXlzID0gcGxheXMuZmlsdGVyKGl0ID0+IGl0LmluY2x1ZGVzKEtFWSkpOwogICAgICAgICAgICBwbGF5cyA9IHBsYXlzLmZpbHRlcihpdCA9PiBuZXcgUmVnRXhwKEtFWSwgJ2knKS50ZXN0KGl0KSk7CiAgICAgICAgICAgIGxvZygn6L+H5ruk5ZCOOicgKyBwbGF5cy5sZW5ndGgpOwogICAgICAgICAgICBsb2cocGxheXMpOwogICAgICAgICAgICBsZXQgbmV3X2dyb3VwID0gZ2VuX2dyb3VwX2RpY3QocGxheXMpOwogICAgICAgICAgICBydWxlLmdyb3VwRGljdCA9IE9iamVjdC5hc3NpZ24ocnVsZS5ncm91cERpY3QsIG5ld19ncm91cCk7CiAgICAgICAgICAgIC8vIOaQnOe0ouWIhue7hOe7k+aenOWtmOiHs+acrOWcsOaWueS+v+S6jOe6p+iwg+eUqAogICAgICAgICAgICBzZXRJdGVtKCdncm91cERpY3QnLCBKU09OLnN0cmluZ2lmeShydWxlLmdyb3VwRGljdCkpOwogICAgICAgICAgICAvLyDov5Tlm57nmoTov5jmmK/mkJzntKLnmoRuZXdfZ3JvdXAKICAgICAgICAgICAgT2JqZWN0LmtleXMobmV3X2dyb3VwKS5mb3JFYWNoKChpdCkgPT4gewogICAgICAgICAgICAgICAgVk9EUy5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAndm9kX25hbWUnOiBpdCwKICAgICAgICAgICAgICAgICAgICAndm9kX2lkJzogaXQgKyAnJCcgKyBLRVkgKyAnI3NlYXJjaCMnLAogICAgICAgICAgICAgICAgICAgICd2b2RfcGljJzogX3BpYyB8fCBydWxlLmRlZl9waWMsCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSk7CiAgICAgICAgfQogICAgfSksCiAgICBsYXp5OiAkanMudG9TdHJpbmcoKCkgPT4gewogICAgICAgIGlmICgvXC4obTN1OHxtcDQpLy50ZXN0KGlucHV0KSkgewogICAgICAgICAgICBpZiAoaW5wdXQuaW5jbHVkZXMoJz8nKSAmJiB0eXBlb2YgKHBsYXlPYmopID09ICdvYmplY3QnICYmIHBsYXlPYmoudXJsKSB7CiAgICAgICAgICAgICAgICBpbnB1dCA9IHBsYXlPYmoudXJsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlucHV0ID0ge3BhcnNlOiAwLCB1cmw6IGlucHV0fQogICAgICAgIH0gZWxzZSBpZiAoL3lhbmdzaGlwaW58MTkwNVwuY29tLy50ZXN0KGlucHV0KSkgewogICAgICAgICAgICBpbnB1dCA9IHtwYXJzZTogMSwgang6IDAsIHVybDogaW5wdXQsIGpzOiAnJywgaGVhZGVyOiB7J1VzZXItQWdlbnQnOiBQQ19VQX0sIHBhcnNlX2V4dHJhOiAnJmlzX3BjPTEnfTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBpbnB1dAogICAgICAgIH0KICAgIH0pLAp9