xiaomianao666

插件名:global_oo.movie

Sep 26th, 2024
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:网页插件¥js_url¥global_oo.movie@base64://Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgICAgICBvby5tb3ZpZe+8iCBWSVDop4bpopHop6PmnpAgKyDnsr7pgInlnKjnur/op4LnnIvmupAg77yJCi8vIEBuYW1lOmVuICAgICAgb28ubW92aWUKLy8gQHZlcnNpb24gICAgICAyMC4zLjE0Ci8vIEBkZXNjcmlwdGlvbiAg57K+6YCJVklQ6KeG6aKR6Kej5p6Q5ZKM5Zyo57q/6KeC55yL5rqQ77yM6KeG6aKR5bm/5ZGK5bCR77yM5Y6f572R6aG16Kej5p6Q77yM5Lqr5Y+XVklQ55qE5Y6f55S76KeC5b2x5L2T6aqM44CC5pSv5oyB6IW+6K6v6KeG6aKR44CB54ix5aWH6Im644CB5LyY6YW344CB6IqS5p6cVFbjgIHmkJzni5Dop4bpopHjgIFQUFRW44CBMTkwNeOAgeS5kOinhuetiee9keermeOAglZJUOino+aekOivhOWIhuaOkuW6j++8jOS4jeWQjOe9keermeS4jeWQjOaOkuW6j++8jOi2iuWlveeUqOeahOino+aekOi2iumdoOWJjeOAggovLyBAZGVzY3JpcHRpb246ZW4gIE5PIFZJUCBOTyBWSURFTy4gRm9yIHYucXEsIGlxaXlpLCB5b3VrdSwgbWd0diwgdHYuc29odSwgcHB0diwgMTkwNSwgbGV0di4KLy8gQGF1dGhvciAgICAgICAob8uY4pehy5hvKQovLyBAbmFtZXNwYWNlICAgIGh0dHBzOi8vZ2l0ZWUuY29tL2VjcnVvcy9vbwovLyBAdXBkYXRlVVJMICAgIGh0dHBzOi8vZ2l0ZWUuY29tL2VjcnVvcy9vby9yYXcvbWFzdGVyL3NjcmlwdHMvb28ubW92aWUuanMKLy8gQHN1cHBvcnRVUkwgICBodHRwczovL2dpdGVlLmNvbS9lY3J1b3Mvb28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ewogICAgICBuYW1lOiAi5a6M576O55yL55yLwrfmkJzntKIiLAogICAgICBtYXRjaDogL3dhbm1laWtrXC5tZVwvc2VhcmNoLywKICAgICAganVtcDogIi5zdHVpLXBhZ2UsIC5zdHVpLXBhbm5lbCIKICAgIH0sIHsKICAgICAgbmFtZTogIuWujOe+jueci+eciyIsCiAgICAgIG1hdGNoOiAvd2FubWVpa2tcLm1lLywKICAgICAgaGlkZTogIi5jb250YWluZXIgfiAqW2lkXSIKICAgIH0sIHsKICAgICAgbmFtZTogIumjnuaegemAn8K35pCc57SiIiwKICAgICAgbWF0Y2g6ICJmZWlqaXN1OC5jb20vc2VhcmNoIiwKICAgICAganVtcDogIiNyZXN1bHQiCiAgICB9LCB7CiAgICAgIG5hbWU6ICLpo57mnoHpgJ8iLAogICAgICBtYXRjaDogL2ZlaWppc3U4XC5jb20vLAogICAgICBoaWRlOiAiLmluZGV4LXRvcCB+IGRpdiwgLnYtdG9wIH4gZGl2LCAuZm9vdGVyIH4gZGl2LCAuZm9vdGVyIH4gYnJkZSwgYm9keSA+IGRpdjpub3QoW2NsYXNzXSkiCiAgICB9LCB7CiAgICAgIG5hbWU6ICIxMDkw5b2x6KeGwrfmkJzntKIiLAogICAgICBtYXRjaDogLzEwOTB5cy5jb21cLy4rYz1zZWFyY2gvLAogICAgICBqdW1wOiAiLnN0dWktcGFnZSwgLnN0dWktcGFubmVsIgogICAgfSwgewogICAgICBuYW1lOiAiMTA5MOW9seinhiIsCiAgICAgIG1hdGNoOiAvMTA5MHlzXC5jb20vLAogICAgICBoaWRlOiAiLmNvbnRhaW5lciB+ICpbaWRdIiwKICAgICAgY3NzOiAiXG5ib2R5IHtcbiAgcGFkZGluZy1ib3R0b206IDAgIWltcG9ydGFudDtcbn0iCiAgICB9LCB7CiAgICAgIG5hbWU6ICLlk5Tmu7TCt+aQnOe0oiIsCiAgICAgIG1hdGNoOiAvYmRlNC5jb21cL3NlYXJjaFwvLywKICAgICAganVtcDogIi5zZWFyY2gtb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FNuaWZmVXJsUmVnZXggPSAvYnRyYWNlXC52aWRlb1wucXFcLmNvbS8sCiAgICAgICAgaXNWaWRlb1VybFJlZ2V4ID0gL1wuKG1wNHxtM3U4fDNncHx3bXZ8Zmx2fGF2aXxybXZifG00dnx0cykvLAogICAgICAgIGlzQmFkVmlkZW9VcmxSZWdleCA9IC8oNzFlZGdlfGNvbS1sLXlvdWt1KVwuY29tLywKICAgICAgICBaZXB0byA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgdmFyIG4sIGUsIHQsIGksIG8sIHIgPSBbXSwKICAgICAgICAgICAgYSA9IHIuY29uY2F0LAogICAgICAgICAgICBsID0gci5maWx0ZXIsCiAgICAgICAgICAgIHMgPSByLnNsaWNlLAogICAgICAgICAgICBjID0gd2luZG93LmRvY3VtZW50LAogICAgICAgICAgICBwID0ge30sCiAgICAgICAgICAgIHUgPSB7fSwKICAgICAgICAgICAgZCA9IHsKICAgICAgICAgICAgICAiY29sdW1uLWNvdW50IjogMSwKICAgICAgICAgICAgICBjb2x1bW5zOiAxLAogICAgICAgICAgICAgICJmb250LXdlaWdodCI6IDEsCiAgICAgICAgICAgICAgImxpbmUtaGVpZ2h0IjogMSwKICAgICAgICAgICAgICBvcGFjaXR5OiAxLAogICAgICAgICAgICAgICJ6LWluZGV4IjogMSwKICAgICAgICAgICAgICB6b29tOiAxCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGYgPSAvXlxzKjwoXHcrfCEpW14+XSo+LywKICAgICAgICAgICAgbSA9IC9ePChcdyspXHMqXC8/Pig/OjxcL1wxPnwpJC8sCiAgICAgICAgICAgIGggPSAvPCg/IWFyZWF8YnJ8Y29sfGVtYmVkfGhyfGltZ3xpbnB1dHxsaW5rfG1ldGF8cGFyYW0pKChbXHc6XSspW14+XSopXC8+L2dpLAogICAgICAgICAgICB2ID0gL14oPzpib2R5fGh0bWwpJC9pLAogICAgICAgICAgICBnID0gLyhbQS1aXSkvZywKICAgICAgICAgICAgeSA9IFsidmFsIiwgImNzcyIsICJodG1sIiwgInRleHQiLCAiZGF0YSIsICJ3aWR0aCIsICJoZWlnaHQiLCAib2Zmc2V0Il0sCiAgICAgICAgICAgIGIgPSBjLmNyZWF0ZUVsZW1lbnQoInRhYmxlIiksCiAgICAgICAgICAgIE0gPSBjLmNyZWF0ZUVsZW1lbnQoInRyIiksCiAgICAgICAgICAgIHcgPSB7CiAgICAgICAgICAgICAgdHI6IGMuY3JlYXRlRWxlbWVudCgidGJvZHkiKSwKICAgICAgICAgICAgICB0Ym9keTogYiwKICAgICAgICAgICAgICB0aGVhZDogYiwKICAgICAgICAgICAgICB0Zm9vdDogYiwKICAgICAgICAgICAgICB0ZDogTSwKICAgICAgICAgICAgICB0aDogTSwKICAgICAgICAgICAgICAiKiI6IGMuY3JlYXRlRWxlbWVudCgiZGl2IikKICAgICAgICAgICAgfSwKICAgICAgICAgICAgVCA9IC9jb21wbGV0ZXxsb2FkZWR8aW50ZXJhY3RpdmUvLAogICAgICAgICAgICBVID0gL15bXHctXSokLywKICAgICAgICAgICAgeCA9IHt9LAogICAgICAgICAgICBEID0geC50b1N0cmluZywKICAgICAgICAgICAgSiA9IHt9LAogICAgICAgICAgICBOID0gYy5jcmVhdGVFbGVtZW50KCJkaXYiKSwKICAgICAgICAgICAgayA9IHsKICAgICAgICAgICAgICB0YWJpbmRleDogInRhYkluZGV4IiwKICAgICAgICAgICAgICByZWFkb25seTogInJlYWRPbmx5IiwKICAgICAgICAgICAgICBmb3I6ICJodG1sRm9yIiwKICAgICAgICAgICAgICBjbGFzczogImNsYXNzTmFtZSIsCiAgICAgICAgICAgICAgbWF4bGVuZ3RoOiAibWF4TGVuZ3RoIiwKICAgICAgICAgICAgICBjZWxsc3BhY2luZzogImNlbGxTcGFjaW5nIiwKICAgICAgICAgICAgICBjZWxscGFkZGluZzogImNlbGxQYWRkaW5nIiwKICAgICAgICAgICAgICByb3dzcGFuOiAicm93U3BhbiIsCiAgICAgICAgICAgICAgY29sc3BhbjogImNvbFNwYW4iLAogICAgICAgICAgICAgIHVzZW1hcDogInVzZU1hcCIsCiAgICAgICAgICAgICAgZnJhbWVib3JkZXI6ICJmcmFtZUJvcmRlciIsCiAgICAgICAgICAgICAgY29udGVudGVkaXRhYmxlOiAiY29udGVudEVkaXRhYmxlIgogICAgICAgICAgICB9LAogICAgICAgICAgICBJID0gQXJyYXkuaXNBcnJheSB8fCBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgcmV0dXJuIG4gaW5zdGFuY2VvZiBBcnJheQogICAgICAgICAgICB9OwoKICAgICAgICAgIGZ1bmN0aW9uIF8obikgewogICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBuID8gU3RyaW5nKG4pIDogeFtELmNhbGwobildIHx8ICJvYmplY3QiCiAgICAgICAgICB9CgogICAgICAgICAgZnVuY3Rpb24gUyhuKSB7CiAgICAgICAgICAgIHJldHVybiAiZnVuY3Rpb24iID09IF8obikKICAgICAgICAgIH0KCiAgICAgICAgICBmdW5jdGlvbiBRKG4pIHsKICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gbiAmJiBuID09IG4ud2luZG93CiAgICAgICAgICB9CgogICAgICAgICAgZnVuY3Rpb24gVihuKSB7CiAgICAgICAgICAgIHJldHVybiBudWxsICE9IG4gJiYgbi5ub2RlVHlwZSA9PSBuLkRPQ1VNRU5UX05PREUKICAgICAgICAgIH0KCiAgICAgICAgICBmdW5jdGlvbiBqKG4pIHsKICAgICAgICAgICAgcmV0dXJuICJvYmplY3QiID09IF8obikKICAgICAgICAgIH0KCiAgICAgICAgICBmdW5jdGlvbiBFKG4pIHsKICAgICAgICAgICAgcmV0dXJuIGoobikgJiYgIVEobikgJiYgT2JqZWN0LmdldFByb3RvdHlwZU9mKG4pID09IE9iamVjdC5wcm90b3R5cGUKICAgICAgICAgIH0KCiAgICAgICAgICBmdW5jdGlvbiBSKG4pIHsKICAgICAgICAgICAgdmFyIHQgPSAhIW4gJiYgImxlbmd0aCIgaW4gbiAmJiBuLmxlbmd0aCwKICAgICAgICAgICAgICBpID0gZS50eXBlKG4pOwogICAgICAgICAgICByZXR1cm4gImZ1bmN0aW9uIiAhPSBpICYmICFRKG4pICYmICgiYXJyYXkiID09IGkgfHwgMCA9PT0gdCB8fCAibnVtYmVyIiA9PSB0eXBlb2YgdCAmJiB0ID4gMCAmJiB0IC0gMSBpbiBuKQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIEEobikgewogICAgICAgICAgICByZXR1cm4gbi5yZXBsYWNlKC86Oi9nLCAiLyIpLnJlcGxhY2UoLyhbQS1aXSspKFtBLVpdW2Etel0pL2csICIkMV8kMiIpLnJlcGxhY2UoLyhbYS16XGRdKShbQS1aXSkvZywgIiQxXyQyIikucmVwbGFjZSgvXy9nLCAiLSIpLnRvTG93ZXJDYXNlKCkKICAgICAgICAgIH0KCiAgICAgICAgICBmdW5jdGlvbiBPKG4pIHsKICAgICAgICAgICAgcmV0dXJuIG4gaW4gdSA/IHVbbl0gOiB1W25dID0gbmV3IFJlZ0V4cCgiKF58XFxzKSIgKyBuICsgIihcXHN8JCkiKQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIEMobiwgZSkgewogICAgICAgICAgICByZXR1cm4gIm51bWJlciIgIT0gdHlwZW9mIGUgfHwgZFtBKG4pXSA/IGUgOiBlICsgInB4IgogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uICQobikgewogICAgICAgICAgICByZXR1cm4gImNoaWxkcmVuIiBpbiBuID8gcy5jYWxsKG4uY2hpbGRyZW4pIDogZS5tYXAobi5jaGlsZE5vZGVzLCAoZnVuY3Rpb24obikgewogICAgICAgICAgICAgIGlmICgxID09IG4ubm9kZVR5cGUpIHJldHVybiBuCiAgICAgICAgICAgIH0pKQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIHoobiwgZSkgewogICAgICAgICAgICB2YXIgdCwgaSA9IG4gPyBuLmxlbmd0aCA6IDA7CiAgICAgICAgICAgIGZvciAodCA9IDA7IHQgPCBpOyB0KyspIHRoaXNbdF0gPSBuW3RdOwogICAgICAgICAgICB0aGlzLmxlbmd0aCA9IGksIHRoaXMuc2VsZWN0b3IgPSBlIHx8ICIiCiAgICAgICAgICB9CgogICAgICAgICAgZnVuY3Rpb24gSChlLCB0LCBpKSB7CiAgICAgICAgICAgIGZvciAobiBpbiB0KSBpICYmIChFKHRbbl0pIHx8IEkodFtuXSkpID8gKEUodFtuXSkgJiYgIUUoZVtuXSkgJiYgKGVbbl0gPSB7fSksIEkodFtuXSkgJiYgIUkoZVtuXSkgJiYgKGVbbl0gPSBbXSksIEgoZVtuXSwgdFtuXSwgaSkpIDogdm9pZCAwICE9PSB0W25dICYmIChlW25dID0gdFtuXSkKICAgICAgICAgIH0KCiAgICAgICAgICBmdW5jdGlvbiBCKG4sIHQpIHsKICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gdCA/IGUobikgOiBlKG4pLmZpbHRlcih0KQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIFAobiwgZSwgdCwgaSkgewogICAgICAgICAgICByZXR1cm4gUyhlKSA/IGUuY2FsbChuLCB0LCBpKSA6IGUKICAgICAgICAgIH0KCiAgICAgICAgICBmdW5jdGlvbiBGKG4sIGUsIHQpIHsKICAgICAgICAgICAgbnVsbCA9PSB0ID8gbi5yZW1vdmVBdHRyaWJ1dGUoZSkgOiBuLnNldEF0dHJpYnV0ZShlLCB0KQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIEwobiwgZSkgewogICAgICAgICAgICB2YXIgdCA9IG4uY2xhc3NOYW1lIHx8ICIiLAogICAgICAgICAgICAgIGkgPSB0ICYmIHZvaWQgMCAhPT0gdC5iYXNlVmFsOwogICAgICAgICAgICBpZiAodm9pZCAwID09PSBlKSByZXR1cm4gaSA/IHQuYmFzZVZhbCA6IHQ7CiAgICAgICAgICAgIGkgPyB0LmJhc2VWYWwgPSBlIDogbi5jbGFzc05hbWUgPSBlCiAgICAgICAgICB9CgogICAgICAgICAgZnVuY3Rpb24gcShuKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgcmV0dXJuIG4gPyAidHJ1ZSIgPT0gbiB8fCAiZmFsc2UiICE9IG4gJiYgKCJudWxsIiA9PSBuID8gbnVsbCA6ICtuICsgIiIgPT0gbiA/ICtuIDogL15bXFtce10vLnRlc3QobikgPyBlLnBhcnNlSlNPTihuKSA6IG4pIDogbgogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgcmV0dXJuIG4KICAgICAgICAgICAgfQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIFgobiwgZSkgewogICAgICAgICAgICBlKG4pOwogICAgICAgICAgICBmb3IgKHZhciB0ID0gMCwgaSA9IG4uY2hpbGROb2Rlcy5sZW5ndGg7IHQgPCBpOyB0KyspIFgobi5jaGlsZE5vZGVzW3RdLCBlKQogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEoubWF0Y2hlcyA9IGZ1bmN0aW9uKG4sIGUpIHsKICAgICAgICAgICAgaWYgKCFlIHx8ICFuIHx8IDEgIT09IG4ubm9kZVR5cGUpIHJldHVybiAhMTsKICAgICAgICAgICAgdmFyIHQgPSBuLm1hdGNoZXMgfHwgbi53ZWJraXRNYXRjaGVzU2VsZWN0b3IgfHwgbi5tb3pNYXRjaGVzU2VsZWN0b3IgfHwgbi5vTWF0Y2hlc1NlbGVjdG9yIHx8IG4ubWF0Y2hlc1NlbGVjdG9yOwogICAgICAgICAgICBpZiAodCkgcmV0dXJuIHQuY2FsbChuLCBlKTsKICAgICAgICAgICAgdmFyIGksIG8gPSBuLnBhcmVudE5vZGUsCiAgICAgICAgICAgICAgciA9ICFvOwogICAgICAgICAgICByZXR1cm4gciAmJiAobyA9IE4pLmFwcGVuZENoaWxkKG4pLCBpID0gfkoucXNhKG8sIGUpLmluZGV4T2YobiksIHIgJiYgTi5yZW1vdmVDaGlsZChuKSwgaQogICAgICAgICAgfSwgaSA9IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgcmV0dXJuIG4ucmVwbGFjZSgvLSsoLik/L2csIChmdW5jdGlvbihuLCBlKSB7CiAgICAgICAgICAgICAgcmV0dXJuIGUgPyBlLnRvVXBwZXJDYXNlKCkgOiAiIgogICAgICAgICAgICB9KSkKICAgICAgICAgIH0sIG8gPSBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgIHJldHVybiBsLmNhbGwobiwgKGZ1bmN0aW9uKGUsIHQpIHsKICAgICAgICAgICAgICByZXR1cm4gbi5pbmRleE9mKGUpID09IHQKICAgICAgICAgICAgfSkpCiAgICAgICAgICB9LCBKLmZyYWdtZW50ID0gZnVuY3Rpb24obiwgdCwgaSkgewogICAgICAgICAgICB2YXIgbywgciwgYTsKICAgICAgICAgICAgcmV0dXJuIG0udGVzdChuKSAmJiAobyA9IGUoYy5jcmVhdGVFbGVtZW50KFJlZ0V4cC4kMSkpKSwgbyB8fCAobi5yZXBsYWNlICYmIChuID0gbi5yZXBsYWNlKGgsICI8JDE+PC8kMj4iKSksIHZvaWQgMCA9PT0gdCAmJiAodCA9IGYudGVzdChuKSAmJiBSZWdFeHAuJDEpLCB0IGluIHcgfHwgKHQgPSAiKiIpLCAoYSA9IHdbdF0pLmlubmVySFRNTCA9ICIiICsgbiwgbyA9IGUuZWFjaChzLmNhbGwoYS5jaGlsZE5vZGVzKSwgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgIGEucmVtb3ZlQ2hpbGQodGhpcykKICAgICAgICAgICAgfSkpKSwgRShpKSAmJiAociA9IGUobyksIGUuZWFjaChpLCAoZnVuY3Rpb24obiwgZSkgewogICAgICAgICAgICAgIHkuaW5kZXhPZihuKSA+IC0xID8gcltuXShlKSA6IHIuYXR0cihuLCBlKQogICAgICAgICAgICB9KSkpLCBvCiAgICAgICAgICB9LCBKLlogPSBmdW5jdGlvbihuLCBlKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgeihuLCBlKQogICAgICAgICAgfSwgSi5pc1ogPSBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgIHJldHVybiBuIGluc3RhbmNlb2YgSi5aCiAgICAgICAgICB9LCBKLmluaXQgPSBmdW5jdGlvbihuLCB0KSB7CiAgICAgICAgICAgIHZhciBpLCBvOwogICAgICAgICAgICBpZiAoIW4pIHJldHVybiBKLlooKTsKICAgICAgICAgICAgaWYgKCJzdHJpbmciID09IHR5cGVvZiBuKQogICAgICAgICAgICAgIGlmICgiPCIgPT0gKG4gPSBuLnRyaW0oKSlbMF0gJiYgZi50ZXN0KG4pKSBpID0gSi5mcmFnbWVudChuLCBSZWdFeHAuJDEsIHQpLCBuID0gbnVsbDsKICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHQpIHJldHVybiBlKHQpLmZpbmQobik7CiAgICAgICAgICAgICAgICBpID0gSi5xc2EoYywgbikKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgIGlmIChTKG4pKSByZXR1cm4gZShjKS5yZWFkeShuKTsKICAgICAgICAgICAgICBpZiAoSi5pc1oobikpIHJldHVybiBuOwogICAgICAgICAgICAgIGlmIChJKG4pKSBvID0gbiwgaSA9IGwuY2FsbChvLCAoZnVuY3Rpb24obikgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gbgogICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICBlbHNlIGlmIChqKG4pKSBpID0gW25dLCBuID0gbnVsbDsKICAgICAgICAgICAgICBlbHNlIGlmIChmLnRlc3QobikpIGkgPSBKLmZyYWdtZW50KG4udHJpbSgpLCBSZWdFeHAuJDEsIHQpLCBuID0gbnVsbDsKICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHQpIHJldHVybiBlKHQpLmZpbmQobik7CiAgICAgICAgICAgICAgICBpID0gSi5xc2EoYywgbikKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIEouWihpLCBuKQogICAgICAgICAgfSwgKGUgPSBmdW5jdGlvbihuLCBlKSB7CiAgICAgICAgICAgIHJldHVybiBKLmluaXQobiwgZSkKICAgICAgICAgIH0pLmV4dGVuZCA9IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgdmFyIGUsIHQgPSBzLmNhbGwoYXJndW1lbnRzLCAxKTsKICAgICAgICAgICAgcmV0dXJuICJib29sZWFuIiA9PSB0eXBlb2YgbiAmJiAoZSA9IG4sIG4gPSB0LnNoaWZ0KCkpLCB0LmZvckVhY2goKGZ1bmN0aW9uKHQpIHsKICAgICAgICAgICAgICBIKG4sIHQsIGUpCiAgICAgICAgICAgIH0pKSwgbgogICAgICAgICAgfSwgSi5xc2EgPSBmdW5jdGlvbihuLCBlKSB7CiAgICAgICAgICAgIHZhciB0LCBpID0gIiMiID09IGVbMF0sCiAgICAgICAgICAgICAgbyA9ICFpICYmICIuIiA9PSBlWzBdLAogICAgICAgICAgICAgIHIgPSBpIHx8IG8gPyBlLnNsaWNlKDEpIDogZSwKICAgICAgICAgICAgICBhID0gVS50ZXN0KHIpOwogICAgICAgICAgICByZXR1cm4gbi5nZXRFbGVtZW50QnlJZCAmJiBhICYmIGkgPyAodCA9IG4uZ2V0RWxlbWVudEJ5SWQocikpID8gW3RdIDogW10gOiAxICE9PSBuLm5vZGVUeXBlICYmIDkgIT09IG4ubm9kZVR5cGUgJiYgMTEgIT09IG4ubm9kZVR5cGUgPyBbXSA6IHMuY2FsbChhICYmICFpICYmIG4uZ2V0RWxlbWVudHNCeUNsYXNzTmFtZSA/IG8gPyBuLmdldEVsZW1lbnRzQnlDbGFzc05hbWUocikgOiBuLmdldEVsZW1lbnRzQnlUYWdOYW1lKGUpIDogbi5xdWVyeVNlbGVjdG9yQWxsKGUpKQogICAgICAgICAgfSwgZS5jb250YWlucyA9IGMuZG9jdW1lbnRFbGVtZW50LmNvbnRhaW5zID8gZnVuY3Rpb24obiwgZSkgewogICAgICAgICAgICByZXR1cm4gbiAhPT0gZSAmJiBuLmNvbnRhaW5zKGUpCiAgICAgICAgICB9IDogZnVuY3Rpb24obiwgZSkgewogICAgICAgICAgICBmb3IgKDsgZSAmJiAoZSA9IGUucGFyZW50Tm9kZSk7KQogICAgICAgICAgICAgIGlmIChlID09PSBuKSByZXR1cm4gITA7CiAgICAgICAgICAgIHJldHVybiAhMQogICAgICAgICAgfSwgZS50eXBlID0gXywgZS5pc0Z1bmN0aW9uID0gUywgZS5pc1dpbmRvdyA9IFEsIGUuaXNBcnJheSA9IEksIGUuaXNQbGFpbk9iamVjdCA9IEUsIGUuaXNFbXB0eU9iamVjdCA9IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgIGZvciAoZSBpbiBuKSByZXR1cm4gITE7CiAgICAgICAgICAgIHJldHVybiAhMAogICAgICAgICAgfSwgZS5pc051bWVyaWMgPSBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgIHZhciBlID0gTnVtYmVyKG4pLAogICAgICAgICAgICAgIHQgPSB0eXBlb2YgbjsKICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gbiAmJiAiYm9vbGVhbiIgIT0gdCAmJiAoInN0cmluZyIgIT0gdCB8fCBuLmxlbmd0aCkgJiYgIWlzTmFOKGUpICYmIGlzRmluaXRlKGUpIHx8ICExCiAgICAgICAgICB9LCBlLmluQXJyYXkgPSBmdW5jdGlvbihuLCBlLCB0KSB7CiAgICAgICAgICAgIHJldHVybiByLmluZGV4T2YuY2FsbChlLCBuLCB0KQogICAgICAgICAgfSwgZS5jYW1lbENhc2UgPSBpLCBlLnRyaW0gPSBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgIHJldHVybiBudWxsID09IG4gPyAiIiA6IFN0cmluZy5wcm90b3R5cGUudHJpbS5jYWxsKG4pCiAgICAgICAgICB9LCBlLnV1aWQgPSAwLCBlLnN1cHBvcnQgPSB7fSwgZS5leHByID0ge30sIGUubm9vcCA9IGZ1bmN0aW9uKCkge30sIGUubWFwID0gZnVuY3Rpb24obiwgdCkgewogICAgICAgICAgICB2YXIgaSwgbywgciwgYSwgbCA9IFtdOwogICAgICAgICAgICBpZiAoUihuKSkKICAgICAgICAgICAgICBmb3IgKG8gPSAwOyBvIDwgbi5sZW5ndGg7IG8rKykgbnVsbCAhPSAoaSA9IHQobltvXSwgbykpICYmIGwucHVzaChpKTsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgIGZvciAociBpbiBuKSBudWxsICE9IChpID0gdChuW3JdLCByKSkgJiYgbC5wdXNoKGkpOwogICAgICAgICAgICByZXR1cm4gKGEgPSBsKS5sZW5ndGggPiAwID8gZS5mbi5jb25jYXQuYXBwbHkoW10sIGEpIDogYQogICAgICAgICAgfSwgZS5lYWNoID0gZnVuY3Rpb24obiwgZSkgewogICAgICAgICAgICB2YXIgdCwgaTsKICAgICAgICAgICAgaWYgKFIobikpIHsKICAgICAgICAgICAgICBmb3IgKHQgPSAwOyB0IDwgbi5sZW5ndGg7IHQrKykKICAgICAgICAgICAgICAgIGlmICghMSA9PT0gZS5jYWxsKG5bdF0sIHQsIG5bdF0pKSByZXR1cm4gbgogICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICBmb3IgKGkgaW4gbikKICAgICAgICAgICAgICAgIGlmICghMSA9PT0gZS5jYWxsKG5baV0sIGksIG5baV0pKSByZXR1cm4gbjsKICAgICAgICAgICAgcmV0dXJuIG4KICAgICAgICAgIH0sIGUuZ3JlcCA9IGZ1bmN0aW9uKG4sIGUpIHsKICAgICAgICAgICAgcmV0dXJuIGwuY2FsbChuLCBlKQogICAgICAgICAgfSwgd2luZG93LkpTT04gJiYgKGUucGFyc2VKU09OID0gSlNPTi5wYXJzZSksIGUuZWFjaCgiQm9vbGVhbiBOdW1iZXIgU3RyaW5nIEZ1bmN0aW9uIEFycmF5IERhdGUgUmVnRXhwIE9iamVjdCBFcnJvciIuc3BsaXQoIiAiKSwgKGZ1bmN0aW9uKG4sIGUpIHsKICAgICAgICAgICAgeFsiW29iamVjdCAiICsgZSArICJdIl0gPSBlLnRvTG93ZXJDYXNlKCkKICAgICAgICAgIH0pKSwgZS5mbiA9IHsKICAgICAgICAgICAgY29uc3RydWN0b3I6IEouWiwKICAgICAgICAgICAgbGVuZ3RoOiAwLAogICAgICAgICAgICBmb3JFYWNoOiByLmZvckVhY2gsCiAgICAgICAgICAgIHJlZHVjZTogci5yZWR1Y2UsCiAgICAgICAgICAgIHB1c2g6IHIucHVzaCwKICAgICAgICAgICAgc29ydDogci5zb3J0LAogICAgICAgICAgICBzcGxpY2U6IHIuc3BsaWNlLAogICAgICAgICAgICBpbmRleE9mOiByLmluZGV4T2YsCiAgICAgICAgICAgIGNvbmNhdDogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgdmFyIG4sIGUsIHQgPSBbXTsKICAgICAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgYXJndW1lbnRzLmxlbmd0aDsgbisrKSBlID0gYXJndW1lbnRzW25dLCB0W25dID0gSi5pc1ooZSkgPyBlLnRvQXJyYXkoKSA6IGU7CiAgICAgICAgICAgICAgcmV0dXJuIGEuYXBwbHkoSi5pc1oodGhpcykgPyB0aGlzLnRvQXJyYXkoKSA6IHRoaXMsIHQpCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIG1hcDogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiBlKGUubWFwKHRoaXMsIChmdW5jdGlvbihlLCB0KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbi5jYWxsKGUsIHQsIGUpCiAgICAgICAgICAgICAgfSkpKQogICAgICAgICAgICB9LAogICAgICAgICAgICBzbGljZTogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgcmV0dXJuIGUocy5hcHBseSh0aGlzLCBhcmd1bWVudHMpKQogICAgICAgICAgICB9LAogICAgICAgICAgICByZWFkeTogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiBULnRlc3QoYy5yZWFkeVN0YXRlKSAmJiBjLmJvZHkgPyBuKGUpIDogYy5hZGRFdmVudExpc3RlbmVyKCJET01Db250ZW50TG9hZGVkIiwgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgbihlKQogICAgICAgICAgICAgIH0pLCAhMSksIHRoaXMKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gbiA/IHMuY2FsbCh0aGlzKSA6IHRoaXNbbiA+PSAwID8gbiA6IG4gKyB0aGlzLmxlbmd0aF0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgdG9BcnJheTogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0KCkKICAgICAgICAgICAgfSwKICAgICAgICAgICAgc2l6ZTogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubGVuZ3RoCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHJlbW92ZTogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZWFjaCgoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICBudWxsICE9IHRoaXMucGFyZW50Tm9kZSAmJiB0aGlzLnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQodGhpcykKICAgICAgICAgICAgICB9KSkKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZWFjaDogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiByLmV2ZXJ5LmNhbGwodGhpcywgKGZ1bmN0aW9uKGUsIHQpIHsKICAgICAgICAgICAgICAgIHJldHVybiAhMSAhPT0gbi5jYWxsKGUsIHQsIGUpCiAgICAgICAgICAgICAgfSkpLCB0aGlzCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZpbHRlcjogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiBTKG4pID8gdGhpcy5ub3QodGhpcy5ub3QobikpIDogZShsLmNhbGwodGhpcywgKGZ1bmN0aW9uKGUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBKLm1hdGNoZXMoZSwgbikKICAgICAgICAgICAgICB9KSkpCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGFkZDogZnVuY3Rpb24obiwgdCkgewogICAgICAgICAgICAgIHJldHVybiBlKG8odGhpcy5jb25jYXQoZShuLCB0KSkpKQogICAgICAgICAgICB9LAogICAgICAgICAgICBpczogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiB0aGlzLmxlbmd0aCA+IDAgJiYgSi5tYXRjaGVzKHRoaXNbMF0sIG4pCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIG5vdDogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgaWYgKFMobikgJiYgdm9pZCAwICE9PSBuLmNhbGwpIHRoaXMuZWFjaCgoZnVuY3Rpb24oZSkgewogICAgICAgICAgICAgICAgbi5jYWxsKHRoaXMsIGUpIHx8IHQucHVzaCh0aGlzKQogICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgIHZhciBpID0gInN0cmluZyIgPT0gdHlwZW9mIG4gPyB0aGlzLmZpbHRlcihuKSA6IFIobikgJiYgUyhuLml0ZW0pID8gcy5jYWxsKG4pIDogZShuKTsKICAgICAgICAgICAgICAgIHRoaXMuZm9yRWFjaCgoZnVuY3Rpb24obikgewogICAgICAgICAgICAgICAgICBpLmluZGV4T2YobikgPCAwICYmIHQucHVzaChuKQogICAgICAgICAgICAgICAgfSkpCiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHJldHVybiBlKHQpCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGhhczogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlcigoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gaihuKSA/IGUuY29udGFpbnModGhpcywgbikgOiBlKHRoaXMpLmZpbmQobikuc2l6ZSgpCiAgICAgICAgICAgICAgfSkpCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGVxOiBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgcmV0dXJuIC0xID09PSBuID8gdGhpcy5zbGljZShuKSA6IHRoaXMuc2xpY2UobiwgK24gKyAxKQogICAgICAgICAgICB9LAogICAgICAgICAgICBmaXJzdDogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzWzBdOwogICAgICAgICAgICAgIHJldHVybiBuICYmICFqKG4pID8gbiA6IGUobikKICAgICAgICAgICAgfSwKICAgICAgICAgICAgbGFzdDogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzW3RoaXMubGVuZ3RoIC0gMV07CiAgICAgICAgICAgICAgcmV0dXJuIG4gJiYgIWoobikgPyBuIDogZShuKQogICAgICAgICAgICB9LAogICAgICAgICAgICBmaW5kOiBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgIHJldHVybiBuID8gIm9iamVjdCIgPT0gdHlwZW9mIG4gPyBlKG4pLmZpbHRlcigoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXM7CiAgICAgICAgICAgICAgICByZXR1cm4gci5zb21lLmNhbGwodCwgKGZ1bmN0aW9uKHQpIHsKICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY29udGFpbnModCwgbikKICAgICAgICAgICAgICAgIH0pKQogICAgICAgICAgICAgIH0pKSA6IDEgPT0gdGhpcy5sZW5ndGggPyBlKEoucXNhKHRoaXNbMF0sIG4pKSA6IHRoaXMubWFwKChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHJldHVybiBKLnFzYSh0aGlzLCBuKQogICAgICAgICAgICAgIH0pKSA6IGUoKQogICAgICAgICAgICB9LAogICAgICAgICAgICBjbG9zZXN0OiBmdW5jdGlvbihuLCB0KSB7CiAgICAgICAgICAgICAgdmFyIGkgPSBbXSwKICAgICAgICAgICAgICAgIG8gPSAib2JqZWN0IiA9PSB0eXBlb2YgbiAmJiBlKG4pOwogICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goKGZ1bmN0aW9uKGUsIHIpIHsKICAgICAgICAgICAgICAgIGZvciAoOyByICYmICEobyA/IG8uaW5kZXhPZihyKSA+PSAwIDogSi5tYXRjaGVzKHIsIG4pKTspIHIgPSByICE9PSB0ICYmICFWKHIpICYmIHIucGFyZW50Tm9kZTsKICAgICAgICAgICAgICAgIHIgJiYgaS5pbmRleE9mKHIpIDwgMCAmJiBpLnB1c2gocikKICAgICAgICAgICAgICB9KSksIGUoaSkKICAgICAgICAgICAgfSwKICAgICAgICAgICAgcGFyZW50czogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIGZvciAodmFyIHQgPSBbXSwgaSA9IHRoaXM7IGkubGVuZ3RoID4gMDspIGkgPSBlLm1hcChpLCAoZnVuY3Rpb24obikgewogICAgICAgICAgICAgICAgaWYgKChuID0gbi5wYXJlbnROb2RlKSAmJiAhVihuKSAmJiB0LmluZGV4T2YobikgPCAwKSByZXR1cm4gdC5wdXNoKG4pLCBuCiAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgIHJldHVybiBCKHQsIG4pCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHBhcmVudDogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiBCKG8odGhpcy5wbHVjaygicGFyZW50Tm9kZSIpKSwgbikKICAgICAgICAgICAgfSwKICAgICAgICAgICAgY2hpbGRyZW46IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICByZXR1cm4gQih0aGlzLm1hcCgoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJCh0aGlzKQogICAgICAgICAgICAgIH0pKSwgbikKICAgICAgICAgICAgfSwKICAgICAgICAgICAgY29udGVudHM6IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgIHJldHVybiB0aGlzLm1hcCgoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb250ZW50RG9jdW1lbnQgfHwgcy5jYWxsKHRoaXMuY2hpbGROb2RlcykKICAgICAgICAgICAgICB9KSkKICAgICAgICAgICAgfSwKICAgICAgICAgICAgc2libGluZ3M6IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICByZXR1cm4gQih0aGlzLm1hcCgoZnVuY3Rpb24obiwgZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGwuY2FsbCgkKGUucGFyZW50Tm9kZSksIChmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgICAgIHJldHVybiBuICE9PSBlCiAgICAgICAgICAgICAgICB9KSkKICAgICAgICAgICAgICB9KSksIG4pCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGVtcHR5OiBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHRoaXMuaW5uZXJIVE1MID0gIiIKICAgICAgICAgICAgICB9KSkKICAgICAgICAgICAgfSwKICAgICAgICAgICAgcGx1Y2s6IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICByZXR1cm4gZS5tYXAodGhpcywgKGZ1bmN0aW9uKGUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBlW25dCiAgICAgICAgICAgICAgfSkpCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHNob3c6IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgdmFyIG4sIGUsIHQ7CiAgICAgICAgICAgICAgICAibm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lvbihuKSB7CiAgICAgICAgICAgICAgaWYgKHRoaXNbMF0pIHsKICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgZm9yIChlKHRoaXNbMF0pLmJlZm9yZShuID0gZShuKSk7CiAgICAgICAgICAgICAgICAgICh0ID0gbi5jaGlsZHJlbigpKS5sZW5ndGg7KSBuID0gdC5maXJzdCgpOwogICAgICAgICAgICAgICAgZShuKS5hcHBlbmQodGhpcykKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMKICAgICAgICAgICAgfSwKICAgICAgICAgICAgd3JhcElubmVyOiBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgdmFyIHQgPSBTKG4pOwogICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goKGZ1bmN0aW9uKGkpIHsKICAgICAgICAgICAgICAgIHZhciBvID0gZSh0aGlzKSwKICAgICAgICAgICAgICAgICAgciA9IG8uY29udGVudHMoKSwKICAgICAgICAgICAgICAgICAgYSA9IHQgPyBuLmNhbGwodGhpcywgaSkgOiBuOwogICAgICAgICAgICAgICAgci5sZW5ndGggPyByLndyYXBBbGwoYSkgOiBvLmFwcGVuZChhKQogICAgICAgICAgICAgIH0pKQogICAgICAgICAgICB9LAogICAgICAgICAgICB1bndyYXA6IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgIHJldHVybiB0aGlzLnBhcmVudCgpLmVhY2goKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgZSh0aGlzKS5yZXBsYWNlV2l0aChlKHRoaXMpLmNoaWxkcmVuKCkpCiAgICAgICAgICAgICAgfSkpLCB0aGlzCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGNsb25lOiBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICByZXR1cm4gdGhpcy5tYXAoKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY2xvbmVOb2RlKCEwKQogICAgICAgICAgICAgIH0pKQogICAgICAgICAgICB9LAogICAgICAgICAgICBoaWRlOiBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jc3MoImRpc3BsYXkiLCAibm9uZSIpCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHRvZ2dsZTogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgdmFyIHQgPSBlKHRoaXMpOwogICAgICAgICAgICAgICAgKHZvaWQgMCA9PT0gbiA/ICJub25lIiA9PSB0LmNzcygiZGlzcGxheSIpIDogbikgPyB0LnNob3coKTogdC5oaWRlKCkKICAgICAgICAgICAgICB9KSkKICAgICAgICAgICAgfSwKICAgICAgICAgICAgcHJldjogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiBlKHRoaXMucGx1Y2soInByZXZpb3VzRWxlbWVudFNpYmxpbmciKSkuZmlsdGVyKG4gfHwgIioiKQogICAgICAgICAgICB9LAogICAgICAgICAgICBuZXh0OiBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgcmV0dXJuIGUodGhpcy5wbHVjaygibmV4dEVsZW1lbnRTaWJsaW5nIikpLmZpbHRlcihuIHx8ICIqIikKICAgICAgICAgICAgfSwKICAgICAgICAgICAgaHRtbDogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiAwIGluIGFyZ3VtZW50cyA/IHRoaXMuZWFjaCgoZnVuY3Rpb24odCkgewogICAgICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmlubmVySFRNTDsKICAgICAgICAgICAgICAgIGUodGhpcykuZW1wdHkoKS5hcHBlbmQoUCh0aGlzLCBuLCB0LCBpKSkKICAgICAgICAgICAgICB9KSkgOiAwIGluIHRoaXMgPyB0aGlzWzBdLmlubmVySFRNTCA6IG51bGwKICAgICAgICAgICAgfSwKICAgICAgICAgICAgdGV4dDogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiAwIGluIGFyZ3VtZW50cyA/IHRoaXMuZWFjaCgoZnVuY3Rpb24oZSkgewogICAgICAgICAgICAgICAgdmFyIHQgPSBQKHRoaXMsIG4sIGUsIHRoaXMudGV4dENvbnRlbnQpOwogICAgICAgICAgICAgICAgdGhpcy50ZXh0Q29udGVudCA9IG51bGwgPT0gdCA/ICIiIDogIiIgKyB0CiAgICAgICAgICAgICAgfSkpIDogMCBpbiB0aGlzID8gdGhpcy5wbHVjaygidGV4dENvbnRlbnQiKS5qb2luKCIiKSA6IG51bGwKICAgICAgICAgICAgfSwKICAgICAgICAgICAgYXR0cjogZnVuY3Rpb24oZSwgdCkgewogICAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgICAgIHJldHVybiAic3RyaW5nIiAhPSB0eXBlb2YgZSB8fCAxIGluIGFyZ3VtZW50cyA/IHRoaXMuZWFjaCgoZnVuY3Rpb24oaSkgewogICAgICAgICAgICAgICAgaWYgKDEgPT09IHRoaXMubm9kZVR5cGUpCiAgICAgICAgICAgICAgICAgIGlmIChqKGUpKQogICAgICAgICAgICAgICAgICAgIGZvciAobiBpbiBlKSBGKHRoaXMsIG4sIGVbbl0pOwogICAgICAgICAgICAgICAgICBlbHNlIEYodGhpcywgZSwgUCh0aGlzLCB0LCBpLCB0aGlzLmdldEF0dHJpYnV0ZShlKSkpCiAgICAgICAgICAgICAgfSkpIDogMCBpbiB0aGlzICYmIDEgPT0gdGhpc1swXS5ub2RlVHlwZSAmJiBudWxsICE9IChpID0gdGhpc1swXS5nZXRBdHRyaWJ1dGUoZSkpID8gaSA6IHZvaWQgMAogICAgICAgICAgICB9LAogICAgICAgICAgICByZW1vdmVBdHRyOiBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZWFjaCgoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICAxID09PSB0aGlzLm5vZGVUeXBlICYmIG4uc3BsaXQoIiAiKS5mb3JFYWNoKChmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgICAgIEYodGhpcywgbikKICAgICAgICAgICAgICAgIH0pLCB0aGlzKQogICAgICAgICAgICAgIH0pKQogICAgICAgICAgICB9LAogICAgICAgICAgICBwcm9wOiBmdW5jdGlvbihuLCBlKSB7CiAgICAgICAgICAgICAgcmV0dXJuIG4gPSBrW25dIHx8IG4sIDEgaW4gYXJndW1lbnRzID8gdGhpcy5lYWNoKChmdW5jdGlvbih0KSB7CiAgICAgICAgICAgICAgICB0aGlzW25dID0gUCh0aGlzLCBlLCB0LCB0aGlzW25dKQogICAgICAgICAgICAgIH0pKSA6IHRoaXNbMF0gJiYgdGhpc1swXVtuXQogICAgICAgICAgICB9LAogICAgICAgICAgICByZW1vdmVQcm9wOiBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgcmV0dXJuIG4gPSBrW25dIHx8IG4sIHRoaXMuZWFjaCgoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1tuXQogICAgICAgICAgICAgIH0pKQogICAgICAgICAgICB9LAogICAgICAgICAgICBkYXRhOiBmdW5jdGlvbihuLCBlKSB7CiAgICAgICAgICAgICAgdmFyIHQgPSAiZGF0YS0iICsgbi5yZXBsYWNlKGcsICItJDEiKS50b0xvd2VyQ2FzZSgpLAogICAgICAgICAgICAgICAgaSA9IDEgaW4gYXJndW1lbnRzID8gdGhpcy5hdHRyKHQsIGUpIDogdGhpcy5hdHRyKHQpOwogICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBpID8gcShpKSA6IHZvaWQgMAogICAgICAgICAgICB9LAogICAgICAgICAgICB2YWw6IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICByZXR1cm4gMCBpbiBhcmd1bWVudHMgPyAobnVsbCA9PSBuICYmIChuID0gIiIpLCB0aGlzLmVhY2goKGZ1bmN0aW9uKGUpIHsKICAgICAgICAgICAgICAgIHRoaXMudmFsdWUgPSBQKHRoaXMsIG4sIGUsIHRoaXMudmFsdWUpCiAgICAgICAgICAgICAgfSkpKSA6IHRoaXNbMF0gJiYgKHRoaXNbMF0ubXVsdGlwbGUgPyBlKHRoaXNbMF0pLmZpbmQoIm9wdGlvbiIpLmZpbHRlcigoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zZWxlY3RlZAogICAgICAgICAgICAgIH0pKS5wbHVjaygidmFsdWUiKSA6IHRoaXNbMF0udmFsdWUpCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIG9mZnNldDogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIGlmIChuKSByZXR1cm4gdGhpcy5lYWNoKChmdW5jdGlvbih0KSB7CiAgICAgICAgICAgICAgICB2YXIgaSA9IGUodGhpcyksCiAgICAgICAgICAgICAgICAgIG8gPSBQKHRoaXMsIG4sIHQsIGkub2Zmc2V0KCkpLAogICAgICAgICAgICAgICAgICByID0gaS5vZmZzZXRQYXJlbnQoKS5vZmZzZXQoKSwKICAgICAgICAgICAgICAgICAgYSA9IHsKICAgICAgICAgICAgICAgICAgICB0b3A6IG8udG9wIC0gci50b3AsCiAgICAgICAgICAgICAgICAgICAgbGVmdDogby5sZWZ0IC0gci5sZWZ0CiAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAic3RhdGljIiA9PSBpLmNzcygicG9zaXRpb24iKSAmJiAoYS5wb3NpdGlvbiA9ICJyZWxhdGl2ZSIpLCBpLmNzcyhhKQogICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICBpZiAoIXRoaXMubGVuZ3RoKSByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICBpZiAoYy5kb2N1bWVudEVsZW1lbnQgIT09IHRoaXNbMF0gJiYgIWUuY29udGFpbnMoYy5kb2N1bWVudEVsZW1lbnQsIHRoaXNbMF0pKSByZXR1cm4gewogICAgICAgICAgICAgICAgdG9wOiAwLAogICAgICAgICAgICAgICAgbGVmdDogMAogICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzWzBdLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpOwogICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICBsZWZ0OiB0LmxlZnQgKyB3aW5kb3cucGFnZVhPZmZzZXQsCiAgICAgICAgICAgICAgICB0b3A6IHQudG9wICsgd2luZG93LnBhZ2VZT2Zmc2V0LAogICAgICAgICAgICAgICAgd2lkdGg6IE1hdGgucm91bmQodC53aWR0aCksCiAgICAgICAgICAgICAgICBoZWlnaHQ6IE1hdGgucm91bmQodC5oZWlnaHQpCiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICBjc3M6IGZ1bmN0aW9uKHQsIG8pIHsKICAgICAgICAgICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA8IDIpIHsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpc1swXTsKICAgICAgICAgICAgICAgIGlmICgic3RyaW5nIiA9PSB0eXBlb2YgdCkgewogICAgICAgICAgICAgICAgICBpZiAoIXIpIHJldHVybjsKICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuc3R5bGVbaSh0KV0gfHwgZ2V0Q29tcHV0ZWRTdHlsZShyLCAiIikuZ2V0UHJvcGVydHlWYWx1ZSh0KQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKEkodCkpIHsKICAgICAgICAgICAgICAgICAgaWYgKCFyKSByZXR1cm47CiAgICAgICAgICAgICAgICAgIHZhciBhID0ge30sCiAgICAgICAgICAgICAgICAgICAgbCA9IGdldENvbXB1dGVkU3R5bGUociwgIiIpOwogICAgICAgICAgICAgICAgICByZXR1cm4gZS5lYWNoKHQsIChmdW5jdGlvbihuLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgYVtlXSA9IHIuc3R5bGVbaShlKV0gfHwgbC5nZXRQcm9wZXJ0eVZhbHVlKGUpCiAgICAgICAgICAgICAgICAgIH0pKSwgYQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB2YXIgcyA9ICIiOwogICAgICAgICAgICAgIGlmICgic3RyaW5nIiA9PSBfKHQpKSBvIHx8IDAgPT09IG8gPyBzID0gQSh0KSArICI6IiArIEModCwgbykgOiB0aGlzLmVhY2goKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgdGhpcy5zdHlsZS5yZW1vdmVQcm9wZXJ0eShBKHQpKQogICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICBmb3IgKG4gaW4gdCkgdFtuXSB8fCAwID09PSB0W25dID8gcyArPSBBKG4pICsgIjoiICsgQyhuLCB0W25dKSArICI7IiA6IHRoaXMuZWFjaCgoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICAgIHRoaXMuc3R5bGUucmVtb3ZlUHJvcGVydHkoQShuKSkKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHRoaXMuc3R5bGUuY3NzVGV4dCArPSAiOyIgKyBzCiAgICAgICAgICAgICAgfSkpCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGluZGV4OiBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgcmV0dXJuIG4gPyB0aGlzLmluZGV4T2YoZShuKVswXSkgOiB0aGlzLnBhcmVudCgpLmNoaWxkcmVuKCkuaW5kZXhPZih0aGlzWzBdKQogICAgICAgICAgICB9LAogICAgICAgICAgICBoYXNDbGFzczogZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiAhIW4gJiYgci5zb21lLmNhbGwodGhpcywgKGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRlc3QoTChuKSkKICAgICAgICAgICAgICB9KSwgTyhuKSkKICAgICAgICAgICAgfSwKICAgICAgICAgICAgYWRkQ2xhc3M6IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICByZXR1cm4gbiA/IHRoaXMuZWFjaCgoZnVuY3Rpb24oaSkgewogICAgICAgICAgICAgICAgaWYgKCJjbGFzc05hbWUiIGluIHRoaXMpIHsKICAgICAgICAgICAgICAgICAgdCA9IFtdOwogICAgICAgICAgICAgICAgICB2YXIgbyA9IEwodGhpcyk7CiAgICAgICAgICAgICAgICAgIFAodGhpcywgbiwgaSwgbykuc3BsaXQoL1xzKy9nKS5mb3JFYWNoKChmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgICAgICAgZSh0aGlzKS5oYXNDbGFzcyhuKSB8fCB0LnB1c2gobikKICAgICAgICAgICAgICAgICAgfSksIHRoaXMpLCB0Lmxlbmd0aCAmJiBMKHRoaXMsIG8gKyAobyA/ICIgIiA6ICIiKSArIHQuam9pbigiICIpKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0pKSA6IHRoaXMKICAgICAgICAgICAgfSwKICAgICAgICAgICAgcmVtb3ZlQ2xhc3M6IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKChmdW5jdGlvbihlKSB7CiAgICAgICAgICAgICAgICBpZiAoImNsYXNzTmFtZSIgaW4gdGhpcykgewogICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBuKSByZXR1cm4gTCh0aGlzLCAiIik7CiAgICAgICAgICAgICAgICAgIHQgPSBMKHRoaXMpLCBQKHRoaXMsIG4sIGUsIHQpLnNwbGl0KC9ccysvZykuZm9yRWFjaCgoZnVuY3Rpb24obikgewogICAgICAgICAgICAgICAgICAgIHQgPSB0LnJlcGxhY2UoTyhuKSwgIiAiKQogICAgICAgICAgICAgICAgICB9KSksIEwodGhpcywgdC50cmltKCkpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSkpCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHRvZ2dsZUNsYXNzOiBmdW5jdGlvbihuLCB0KSB7CiAgICAgICAgICAgICAgcmV0dXJuIG4gPyB0aGlzLmVhY2goKGZ1bmN0aW9uKGkpIHsKICAgICAgICAgICAgICAgIHZhciBvID0gZSh0aGlzKTsKICAgICAgICAgICAgICAgIFAodGhpcywgbiwgaSwgTCh0aGlzKSkuc3BsaXQoL1xzKy9nKS5mb3JFYWNoKChmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgICAgICh2b2lkIDAgPT09IHQgPyAhby5oYXNDbGFzcyhuKSA6IHQpID8gby5hZGRDbGFzcyhuKTogby5yZW1vdmVDbGFzcyhuKQogICAgICAgICAgICAgICAgfSkpCiAgICAgICAgICAgICAgfSkpIDogdGhpcwogICAgICAgICAgICB9LAogICAgICAgICAgICBzY3JvbGxUb3A6IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICBpZiAodGhpcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gInNjcm9sbFRvcCIgaW4gdGhpc1swXTsKICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IG4gPyBlID8gdGhpc1swXS5zY3JvbGxUb3AgOiB0aGlzWzBdLnBhZ2VZT2Zmc2V0IDogdGhpcy5lYWNoKGUgPyBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgdGhpcy5zY3JvbGxUb3AgPSBuCiAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsVG8odGhpcy5zY3JvbGxYLCBuKQogICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHNjcm9sbExlZnQ6IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICBpZiAodGhpcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gInNjcm9sbExlZnQiIGluIHRoaXNbMF07CiAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSBuID8gZSA/IHRoaXNbMF0uc2Nyb2xsTGVmdCA6IHRoaXNbMF0ucGFnZVhPZmZzZXQgOiB0aGlzLmVhY2goZSA/IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbExlZnQgPSBuCiAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsVG8obiwgdGhpcy5zY3JvbGxZKQogICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHBvc2l0aW9uOiBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICBpZiAodGhpcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHZhciBuID0gdGhpc1swXSwKICAgICAgICAgICAgICAgICAgdCA9IHRoaXMub2Zmc2V0UGFyZW50KCksCiAgICAgICAgICAgICAgICAgIGkgPSB0aGlzLm9mZnNldCgpLAogICAgICAgICAgICAgICAgICBvID0gdi50ZXN0KHRbMF0ubm9kZU5hbWUpID8gewogICAgICAgICAgICAgICAgICAgIHRvcDogMCwKICAgICAgICAgICAgICAgICAgICBsZWZ0OiAwCiAgICAgICAgICAgICAgICAgIH0gOiB0Lm9mZnNldCgpOwogICAgICAgICAgICAgICAgcmV0dXJuIGkudG9wIC09IHBhcnNlRmxvYXQoZShuKS5jc3MoIm1hcmdpbi10b3AiKSkgfHwgMCwgaS5sZWZ0IC09IHBhcnNlRmxvYXQoZShuKS5jc3MoIm1hcmdpbi1sZWZ0IikpIHx8IDAsIG8udG9wICs9IHBhcnNlRmxvYXQoZSh0WzBdKS5jc3MoImJvcmRlci10b3Atd2lkdGgiKSkgfHwgMCwgby5sZWZ0ICs9IHBhcnNlRmxvYXQoZSh0WzBdKS5jc3MoImJvcmRlci1sZWZ0LXdpZHRoIikpIHx8IDAsIHsKICAgICAgICAgICAgICAgICAgdG9wOiBpLnRvcCAtIG8udG9wLAogICAgICAgICAgICAgICAgICBsZWZ0OiBpLmxlZnQgLSBvLmxlZnQKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIG9mZnNldFBhcmVudDogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwKChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSB0aGlzLm9mZnNldFBhcmVudCB8fCBjLmJvZHk7IG4gJiYgIXYudGVzdChuLm5vZGVOYW1lKSAmJiAic3RhdGljIiA9PSBlKG4pLmNzcygicG9zaXRpb24iKTspIG4gPSBuLm9mZnNldFBhcmVudDsKICAgICAgICAgICAgICAgIHJldHVybiBuCiAgICAgICAgICAgICAgfSkpCiAgICAgICAgICAgIH0KICAgICAgICAgIH0sIGUuZm4uZGV0YWNoID0gZS5mbi5yZW1vdmUsIFsid2lkdGgiLCAiaGVpZ2h0Il0uZm9yRWFjaCgoZnVuY3Rpb24obikgewogICAgICAgICAgICB2YXIgdCA9IG4ucmVwbGFjZSgvLi8sIChmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgcmV0dXJuIG5bMF0udG9VcHBlckNhc2UoKQogICAgICAgICAgICB9KSk7CiAgICAgICAgICAgIGUuZm5bbl0gPSBmdW5jdGlvbihpKSB7CiAgICAgICAgICAgICAgdmFyIG8sIHIgPSB0aGlzWzBdOwogICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGkgPyBRKHIpID8gclsiaW5uZXIiICsgdF0gOiBWKHIpID8gci5kb2N1bWVudEVsZW1lbnRbInNjcm9sbCIgKyB0XSA6IChvID0gdGhpcy5vZmZzZXQoKSkgJiYgb1tuXSA6IHRoaXMuZWFjaCgoZnVuY3Rpb24odCkgewogICAgICAgICAgICAgICAgKHIgPSBlKHRoaXMpKS5jc3MobiwgUCh0aGlzLCBpLCB0LCByW25dKCkpKQogICAgICAgICAgICAgIH0pKQogICAgICAgICAgICB9CiAgICAgICAgICB9KSksIFsiYWZ0ZXIiLCAicHJlcGVuZCIsICJiZWZvcmUiLCAiYXBwZW5kIl0uZm9yRWFjaCgoZnVuY3Rpb24obiwgdCkgewogICAgICAgICAgICB2YXIgaSA9IHQgJSAyOwogICAgICAgICAgICBlLmZuW25dID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgdmFyIG4sIG8sIHIgPSBlLm1hcChhcmd1bWVudHMsIChmdW5jdGlvbih0KSB7CiAgICAgICAgICAgICAgICAgIHZhciBpID0gW107CiAgICAgICAgICAgICAgICAgIHJldHVybiAiYXJyYXkiID09IChuID0gXyh0KSkgPyAodC5mb3JFYWNoKChmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gbi5ub2RlVHlwZSA/IGkucHVzaChuKSA6IGUuemVwdG8uaXNaKG4pID8gaSA9IGkuY29uY2F0KG4uZ2V0KCkpIDogdm9pZChpID0gaS5jb25jYXQoSi5mcmFnbWVudChuKSkpCiAgICAgICAgICAgICAgICAgIH0pKSwgaSkgOiAib2JqZWN0IiA9PSBuIHx8IG51bGwgPT0gdCA/IHQgOiBKLmZyYWdtZW50KHQpCiAgICAgICAgICAgICAgICB9KSksCiAgICAgICAgICAgICAgICBhID0gdGhpcy5sZW5ndGggPiAxOwogICAgICAgICAgICAgIHJldHVybiByLmxlbmd0aCA8IDEgPyB0aGlzIDogdGhpcy5lYWNoKChmdW5jdGlvbihuLCBsKSB7CiAgICAgICAgICAgICAgICBvID0gaSA/IGwgOiBsLnBhcmVudE5vZGUsIGwgPSAwID09IHQgPyBsLm5leHRTaWJsaW5nIDogMSA9PSB0ID8gbC5maXJzdENoaWxkIDogMiA9PSB0ID8gbCA6IG51bGw7CiAgICAgICAgICAgICAgICB2YXIgcyA9IGUuY29udGFpbnMoYy5kb2N1bWVudEVsZW1lbnQsIG8pOwogICAgICAgICAgICAgICAgci5mb3JFYWNoKChmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgICAgIGlmIChhKSBuID0gbi5jbG9uZU5vZGUoITApOwogICAgICAgICAgICAgICAgICBlbHNlIGlmICghbykgcmV0dXJuIGUobikucmVtb3ZlKCk7CiAgICAgICAgICAgICAgICAgIG8uaW5zZXJ0QmVmb3JlKG4sIGwpLCBzICYmIFgobiwgKGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIShudWxsID09IG4ubm9kZU5hbWUgfHwgIlNDUklQVCIgIT09IG4ubm9kZU5hbWUudG9VcHBlckNhc2UoKSB8fCBuLnR5cGUgJiYgInRleHQvamF2YXNjcmlwdCIgIT09IG4udHlwZSB8fCBuLnNyYykpIHsKICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbi5vd25lckRvY3VtZW50ID8gbi5vd25lckRvY3VtZW50LmRlZmF1bHRWaWV3IDogd2luZG93OwogICAgICAgICAgICAgICAgICAgICAgZS5ldmFsLmNhbGwoZSwgbi5pbm5lckhUTUwpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9KSkKICAgICAgICAgICAgICAgIH0pKQogICAgICAgICAgICAgIH0pKQogICAgICAgICAgICB9LCBlLmZuW2kgPyBuICsgIlRvIiA6ICJpbnNlcnQiICsgKHQgPyAiQmVmb3JlIiA6ICJBZnRlciIpXSA9IGZ1bmN0aW9uKHQpIHsKICAgICAgICAgICAgICByZXR1cm4gZSh0KVtuXSh0aGlzKSwgdGhpcwogICAgICAgICAgICB9CiAgICAgICAgICB9KSksIEouWi5wcm90b3R5cGUgPSB6LnByb3RvdHlwZSA9IGUuZm4sIEoudW5pcSA9IG8sIEouZGVzZXJpYWxpemVWYWx1ZSA9IHEsIGUuemVwdG8gPSBKLCBlCiAgICAgICAgfSgpOwogICAgICB3aW5kb3cuWmVwdG8gPSBaZXB0bywgdm9pZCAwID09PSB3aW5kb3cuJCAmJiAod2luZG93LiQgPSBaZXB0byksCiAgICAgICAgZnVuY3Rpb24obikgewogICAgICAgICAgdmFyIGUgPSAxLAogICAgICAgICAgICB0ID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLAogICAgICAgICAgICBpID0gbi5pc0Z1bmN0aW9uLAogICAgICAgICAgICBvID0gZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiAic3RyaW5nIiA9PSB0eXBlb2YgbgogICAgICAgICAgICB9LAogICAgICAgICAgICByID0ge30sCiAgICAgICAgICAgIGEgPSB7fSwKICAgICAgICAgICAgbCA9ICJvbmZvY3VzaW4iIGluIHdpbmRvdywKICAgICAgICAgICAgcyA9IHsKICAgICAgICAgICAgICBmb2N1czogImZvY3VzaW4iLAogICAgICAgICAgICAgIGJsdXI6ICJmb2N1c291dCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgYyA9IHsKICAgICAgICAgICAgICBtb3VzZWVudGVyOiAibW91c2VvdmVyIiwKICAgICAgICAgICAgICBtb3VzZWxlYXZlOiAibW91c2VvdXQiCiAgICAgICAgICAgIH07CgogICAgICAgICAgZnVuY3Rpb24gcChuKSB7CiAgICAgICAgICAgIHJldHVybiBuLl96aWQgfHwgKG4uX3ppZCA9IGUrKykKICAgICAgICAgIH0KCiAgICAgICAgICBmdW5jdGlvbiB1KG4sIGUsIHQsIGkpIHsKICAgICAgICAgICAgaWYgKChlID0gZChlKSkubnMpIHZhciBvID0gKGEgPSBlLm5zLCBuZXcgUmVnRXhwKCIoPzpefCApIiArIGEucmVwbGFjZSgiICIsICIgLiogPyIpICsgIig/OiB8JCkiKSk7CiAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICByZXR1cm4gKHJbcChuKV0gfHwgW10pLmZpbHRlcigoZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHJldHVybiBuICYmICghZS5lIHx8IG4uZSA9PSBlLmUpICYmICghZS5ucyB8fCBvLnRlc3Qobi5ucykpICYmICghdCB8fCBwKG4uZm4pID09PSBwKHQpKSAmJiAoIWkgfHwgbi5zZWwgPT0gaSkKICAgICAgICAgICAgfSkpCiAgICAgICAgICB9CgogICAgICAgICAgZnVuY3Rpb24gZChuKSB7CiAgICAgICAgICAgIHZhciBlID0gKCIiICsgbikuc3BsaXQoIi4iKTsKICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICBlOiBlWzBdLAogICAgICAgICAgICAgIG5zOiBlLnNsaWNlKDEpLnNvcnQoKS5qb2luKCIgIikKICAgICAgICAgICAgfQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIGYobiwgZSkgewogICAgICAgICAgICByZXR1cm4gbi5kZWwgJiYgIWwgJiYgbi5lIGluIHMgfHwgISFlCiAgICAgICAgICB9CgogICAgICAgICAgZnVuY3Rpb24gbShuKSB7CiAgICAgICAgICAgIHJldHVybiBjW25dIHx8IGwgJiYgc1tuXSB8fCBuCiAgICAgICAgICB9CgogICAgICAgICAgZnVuY3Rpb24gaChlLCB0LCBpLCBvLCBhLCBsLCBzKSB7CiAgICAgICAgICAgIHZhciB1ID0gcChlKSwKICAgICAgICAgICAgICBoID0gclt1XSB8fCAoclt1XSA9IFtdKTsKICAgICAgICAgICAgdC5zcGxpdCgvXHMvKS5mb3JFYWNoKChmdW5jdGlvbih0KSB7CiAgICAgICAgICAgICAgaWYgKCJyZWFkeSIgPT0gdCkgcmV0dXJuIG4oZG9jdW1lbnQpLnJlYWR5KGkpOwogICAgICAgICAgICAgIHZhciByID0gZCh0KTsKICAgICAgICAgICAgICByLmZuID0gaSwgci5zZWwgPSBhLCByLmUgaW4gYyAmJiAoaSA9IGZ1bmN0aW9uKGUpIHsKICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZWxhdGVkVGFyZ2V0OwogICAgICAgICAgICAgICAgaWYgKCF0IHx8IHQgIT09IHRoaXMgJiYgIW4uY29udGFpbnModGhpcywgdCkpIHJldHVybiByLmZuLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykKICAgICAgICAgICAgICB9KSwgci5kZWwgPSBsOwogICAgICAgICAgICAgIHZhciBwID0gbCB8fCBpOwogICAgICAgICAgICAgIHIucHJveHkgPSBmdW5jdGlvbihuKSB7CiAgICAgICAgICAgICAgICBpZiAoIShuID0gdyhuKSkuaXNJbW1lZGlhdGVQcm9wYWdhdGlvblN0b3BwZWQoKSkgewogICAgICAgICAgICAgICAgICBuLmRhdGEgPSBvOwogICAgICAgICAgICAgICAgICB2YXIgdCA9IHAuYXBwbHkoZSwgbnVsbCA9PSBuLl9hcmdzID8gW25dIDogW25dLmNvbmNhdChuLl9hcmdzKSk7CiAgICAgICAgICAgICAgICAgIHJldHVybiAhMSA9PT0gdCAmJiAobi5wcmV2ZW50RGVmYXVsdCgpLCBuLnN0b3BQcm9wYWdhdGlvbigpKSwgdAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0sIHIuaSA9IGgubGVuZ3RoLCBoLnB1c2gociksICJhZGRFdmVudExpc3RlbmVyIiBpbiBlICYmIGUuYWRkRXZlbnRMaXN0ZW5lcihtKHIuZSksIHIucHJveHksIGYociwgcykpCiAgICAgICAgICAgIH0pKQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIHYobiwgZSwgdCwgaSwgbykgewogICAgICAgICAgICB2YXIgYSA9IHAobik7CiAgICAgICAgICAgIChlIHx8ICIiKS5zcGxpdCgvXHMvKS5mb3JFYWNoKChmdW5jdGlvbihlKSB7CiAgICAgICAgICAgICAgdShuLCBlLCB0LCBpKS5mb3JFYWNoKChmdW5jdGlvbihlKSB7CiAgICAgICAgICAgICAgICBkZWxldGUgclthXVtlLmldLCAicmVtb3ZlRXZlbnRMaXN0ZW5lciIgaW4gbiAmJiBuLnJlbW92ZUV2ZW50TGlzdGVuZXIobShlLmUpLCBlLnByb3h5LCBmKGUsIG8pKQogICAgICAgICAgICAgIH0pKQogICAgICAgICAgICB9KSkKICAgICAgICAgIH0KICAgICAgICAgIGEuY2xpY2sgPSBhLm1vdXNlZG93biA9IGEubW91c2V1cCA9IGEubW91c2Vtb3ZlID0gIk1vdXNlRXZlbnRzIiwgbi5ldmVudCA9IHsKICAgICAgICAgICAgYWRkOiBoLAogICAgICAgICAgICByZW1vdmU6IHYKICAgICAgICAgIH0sIG4ucHJveHkgPSBmdW5jdGlvbihlLCByKSB7CiAgICAgICAgICAgIHZhciBhID0gMiBpbiBhcmd1bWVudHMgJiYgdC5jYWxsKGFyZ3VtZW50cywgMik7CiAgICAgICAgICAgIGlmIChpKGUpKSB7CiAgICAgICAgICAgICAgdmFyIGwgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHIsIGEgPyBhLmNvbmNhdCh0LmNhbGwoYXJndW1lbnRzKSkgOiBhcmd1bWVudHMpCiAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICByZXR1cm4gbC5femlkID0gcChlKSwgbAogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChvKHIpKSByZXR1cm4gYSA/IChhLnVuc2hpZnQoZVtyXSwgZSksIG4ucHJveHkuYXBwbHkobnVsbCwgYSkpIDogbi5wcm94eShlW3JdLCBlKTsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiZXhwZWN0ZWQgZnVuY3Rpb24iKQogICAgICAgICAgfSwgbi5mbi5iaW5kID0gZnVuY3Rpb24obiwgZSwgdCkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5vbihuLCBlLCB0KQogICAgICAgICAgfSwgbi5mbi51bmJpbmQgPSBmdW5jdGlvbihuLCBlKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLm9mZihuLCBlKQogICAgICAgICAgfSwgbi5mbi5vbmUgPSBmdW5jdGlvbihuLCBlLCB0LCBpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLm9uKG4sIGUsIHQsIGksIDEpCiAgICAgICAgICB9OwogICAgICAgICAgdmFyIGcgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICByZXR1cm4gITAKICAgICAgICAgICAgfSwKICAgICAgICAgICAgeSA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgIHJldHVybiAhMQogICAgICAgICAgICB9LAogICAgICAgICAgICBiID0gL14oW0EtWl18cmV0dXJuVmFsdWUkfGxheWVyW1hZXSR8d2Via2l0TW92ZW1lbnRbWFldJCkvLAogICAgICAgICAgICBNID0gewogICAgICAgICAgICAgIHByZXZlbnREZWZhdWx0OiAiaXNEZWZhdWx0UHJldmVudGVkIiwKICAgICAgICAgICAgICBzdG9wSW1tZWRpYXRlUHJvcGFnYXRpb246ICJpc0ltbWVkaWF0ZVByb3BhZ2F0aW9uU3RvcHBlZCIsCiAgICAgICAgICAgICAgc3RvcFByb3BhZ2F0aW9uOiAiaXNQcm9wYWdhdGlvblN0b3BwZWQiCiAgICAgICAgICAgIH07CgogICAgICAgICAgZnVuY3Rpb24gdyhlLCB0KSB7CiAgICAgICAgICAgIHJldHVybiAhdCAmJiBlLmlzRGVmYXVsdFByZXZlbnRlZCB8fCAodCB8fCAodCA9IGUpLCBuLmVhY2goTSwgKGZ1bmN0aW9uKG4sIGkpIHsKICAgICAgICAgICAgICB2YXIgbyA9IHRbbl07CiAgICAgICAgICAgICAgZVtuXSA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbaV0gPSBnLCBvICYmIG8uYXBwbHkodCwgYXJndW1lbnRzKQogICAgICAgICAgICAgIH0sIGVbaV0gPSB5CiAgICAgICAgICAgIH0pKSwgZS50aW1lU3RhbXAgfHwgKGUudGltZVN0YW1wID0gRGF0ZS5ub3coKSksICh2b2lkIDAgIT09IHQuZGVmYXVsdFByZXZlbnRlZCA/IHQuZGVmYXVsdFByZXZlbnRlZCA6ICJyZXR1cm5WYWx1ZSIgaW4gdCA/ICExID09PSB0LnJldHVyblZhbHVlIDogdC5nZXRQcmV2ZW50RGVmYXVsdCAmJiB0LmdldFByZXZlbnREZWZhdWx0KCkpICYmIChlLmlzRGVmYXVsdFByZXZlbnRlZCA9IGcpKSwgZQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIFQobikgewogICAgICAgICAgICB2YXIgZSwgdCA9IHsKICAgICAgICAgICAgICBvcmlnaW5hbEV2ZW50OiBuCiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGZvciAoZSBpbiBuKSBiLnRlc3QoZSkgfHwgdm9pZCAwID09PSBuW2VdIHx8ICh0W2VdID0gbltlXSk7CiAgICAgICAgICAgIHJldHVybiB3KHQsIG4pCiAgICAgICAgICB9CiAgICAgICAgICBuLmZuLmRlbGVnYXRlID0gZnVuY3Rpb24obiwgZSwgdCkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5vbihlLCBuLCB0KQogICAgICAgICAgfSwgbi5mbi51bmRlbGVnYXRlID0gZnVuY3Rpb24obiwgZSwgdCkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5vZmYoZSwgbiwgdCkKICAgICAgICAgIH0sIG4uZm4ubGl2ZSA9IGZ1bmN0aW9uKGUsIHQpIHsKICAgICAgICAgICAgcmV0dXJuIG4oZG9jdW1lbnQuYm9keSkuZGVsZWdhdGUodGhpcy5zZWxlY3RvciwgZSwgdCksIHRoaXMKICAgICAgICAgIH0sIG4uZm4uZGllID0gZnVuY3Rpb24oZSwgdCkgewogICAgICAgICAgICByZXR1cm4gbihkb2N1bWVudC5ib2R5KS51bmRlbGVnYXRlKHRoaXMuc2VsZWN0b3IsIGUsIHQpLCB0aGlzCiAgICAgICAgICB9LCBuLmZuLm9uID0gZnVuY3Rpb24oZSwgciwgYSwgbCwgcykgewogICAgICAgICAgICB2YXIgYywgcCwgdSA9IHRoaXM7CiAgICAgICAgICAgIHJldHVybiBlICYmICFvKGUpID8gKG4uZWFjaChlLCAoZnVuY3Rpb24obiwgZSkgewogICAgICAgICAgICAgIHUub24obiwgciwgYSwgZSwgcykKICAgICAgICAgICAgfSkpLCB1KSA6IChvKHIpIHx8IGkobCkgfHwgITEgPT09IGwgfHwgKGwgPSBhLCBhID0gciwgciA9IHZvaWQgMCksIHZvaWQgMCAhPT0gbCAmJiAhMSAhPT0gYSB8fCAobCA9IGEsIGEgPSB2b2lkIDApLCAhMSA9PT0gbCAmJiAobCA9IHkpLCB1LmVhY2goKGZ1bmN0aW9uKGksIG8pIHsKICAgICAgICAgICAgICBzICYmIChjID0gZnVuY3Rpb24obikgewogICAgICAgICAgICAgICAgcmV0dXJuIHYobywgbi50eXBlLCBsKSwgbC5hcHBseSh0aGlzLCBhcmd1bWVudHMpCiAgICAgICAgICAgICAgfSksIHIgJiYgKHAgPSBmdW5jdGlvbihlKSB7CiAgICAgICAgICAgICAgICB2YXIgaSwgYSA9IG4oZS50YXJnZXQpLmNsb3Nlc3QociwgbykuZ2V0KDApOwogICAgICAgICAgICAgICAgaWYgKGEgJiYgYSAhPT0gbykgcmV0dXJuIGkgPSBuLmV4dGVuZChUKGUpLCB7CiAgICAgICAgICAgICAgICAgIGN1cnJlbnRUYXJnZXQ6IGEsCiAgICAgICAgICAgICAgICAgIGxpdmVGaXJlZDogbwogICAgICAgICAgICAgICAgfSksIChjIHx8IGwpLmFwcGx5KGEsIFtpXS5jb25jYXQodC5jYWxsKGFyZ3VtZW50cywgMSkpKQogICAgICAgICAgICAgIH0pLCBoKG8sIGUsIGwsIGEsIHIsIHAgfHwgYykKICAgICAgICAgICAgfSkpKQogICAgICAgICAgfSwgbi5mbi5vZmYgPSBmdW5jdGlvbihlLCB0LCByKSB7CiAgICAgICAgICAgIHZhciBhID0gdGhpczsKICAgICAgICAgICAgcmV0dXJuIGUgJiYgIW8oZSkgPyAobi5lYWNoKGUsIChmdW5jdGlvbihuLCBlKSB7CiAgICAgICAgICAgICAgYS5vZmYobiwgdCwgZSkKICAgICAgICAgICAgfSkpLCBhKSA6IChvKHQpIHx8IGkocikgfHwgITEgPT09IHIgfHwgKHIgPSB0LCB0ID0gdm9pZCAwKSwgITEgPT09IHIgJiYgKHIgPSB5KSwgYS5lYWNoKChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICB2KHRoaXMsIGUsIHIsIHQpCiAgICAgICAgICAgIH0p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1vdXNlbGVhdmUgY2hhbmdlIHNlbGVjdCBrZXlkb3duIGtleXByZXNzIGtleXVwIGVycm9yIi5zcGxpdCgiICIpLmZvckVhY2goKGZ1bmN0aW9uKGUpIHsKICAgICAgICAgICAgbi5mbltlXSA9IGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICByZXR1cm4gMCBpbiBhcmd1bWVudHMgPyB0aGlzLmJpbmQoZSwgbikgOiB0aGlzLnRyaWdnZXIoZSkKICAgICAgICAgICAgfQogICAgICAgICAgfSkpLCBuLkV2ZW50ID0gZnVuY3Rpb24obiwgZSkgewogICAgICAgICAgICBvKG4pIHx8IChuID0gKGUgPSBuKS50eXBlKTsKICAgICAgICAgICAgdmFyIHQgPSBkb2N1bWVudC5jcmVhdGVFdmVudChhW25dIHx8ICJFdmVudHMiKSwKICAgICAgICAgICAgICBpID0gITA7CiAgICAgICAgICAgIGlmIChlKQogICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gZSkgImJ1YmJsZXMiID09IHIgPyBpID0gISFlW3JdIDogdFtyXSA9IGVbcl07CiAgICAgICAgICAgIHJldHVybiB0LmluaXRFdmVudChuLCBpLCAhMCksIHcodCkKICAgICAgICAgIH0KICAgICAgICB9KFplcHRvKSwKICAgICAgICBmdW5jdGlvbihuKSB7CiAgICAgICAgICB2YXIgZSwgdCwgaSA9ICtuZXcgRGF0ZSwKICAgICAgICAgICAgbyA9IHdpbmRvdy5kb2N1bWVudCwKICAgICAgICAgICAgciA9IC88c2NyaXB0XGJbXjxdKig/Oig/ITxcL3NjcmlwdD4pPFtePF0qKSo8XC9zY3JpcHQ+L2dpLAogICAgICAgICAgICBhID0gL14oPzp0ZXh0fGFwcGxpY2F0aW9uKVwvamF2YXNjcmlwdC9pLAogICAgICAgICAgICBsID0gL14oPzp0ZXh0fGFwcGxpY2F0aW9uKVwveG1sL2ksCiAgICAgICAgICAgIHMgPSAvXlxzKiQvLAogICAgICAgICAgICBjID0gby5jcmVhdGVFbGVtZW50KCJhIik7CgogICAgICAgICAgZnVuY3Rpb24gcChlLCB0LCBpLCByKSB7CiAgICAgICAgICAgIGlmIChlLmdsb2JhbCkgcmV0dXJuIGZ1bmN0aW9uKGUsIHQsIGkpIHsKICAgICAgICAgICAgICB2YXIgbyA9IG4uRXZlbnQodCk7CiAgICAgICAgICAgICAgcmV0dXJuIG4oZSkudHJpZ2dlcihvLCBpKSwgIW8uaXNEZWZhdWx0UHJldmVudGVkKCkKICAgICAgICAgICAgfSh0IHx8IG8sIGksIHIpCiAgICAgICAgICB9CgogICAgICAgICAgZnVuY3Rpb24gdShuLCBlKSB7CiAgICAgICAgICAgIHZhciB0ID0gZS5jb250ZXh0OwogICAgICAgICAgICBpZiAoITEgPT09IGUuYmVmb3JlU2VuZC5jYWxsKHQsIG4sIGUpIHx8ICExID09PSBwKGUsIHQsICJhamF4QmVmb3JlU2VuZCIsIFtuLCBlXSkpIHJldHVybiAhMTsKICAgICAgICAgICAgcChlLCB0LCAiYWpheFNlbmQiLCBbbiwgZV0pCiAgICAgICAgICB9CgogICAgICAgICAgZnVuY3Rpb24gZChuLCBlLCB0LCBpKSB7CiAgICAgICAgICAgIHZhciBvID0gdC5jb250ZXh0OwogICAgICAgICAgICB0LnN1Y2Nlc3MuY2FsbChvLCBuLCAic3VjY2VzcyIsIGUpLCBpICYmIGkucmVzb2x2ZVdpdGgobywgW24sICJzdWNjZXNzIiwgZV0pLCBwKHQsIG8sICJhamF4U3VjY2VzcyIsIFtlLCB0LCBuXSksIG0oInN1Y2Nlc3MiLCBlLCB0KQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIGYobiwgZSwgdCwgaSwgbykgewogICAgICAgICAgICB2YXIgciA9IGkuY29udGV4dDsKICAgICAgICAgICAgaS5lcnJvci5jYWxsKHIsIHQsIGUsIG4pLCBvICYmIG8ucmVqZWN0V2l0aChyLCBbdCwgZSwgbl0pLCBwKGksIHIsICJhamF4RXJyb3IiLCBbdCwgaSwgbiB8fCBlXSksIG0oZSwgdCwgaSkKICAgICAgICAgIH0KCiAgICAgICAgICBmdW5jdGlvbiBtKGUsIHQsIGkpIHsKICAgICAgICAgICAgdmFyIG8gPSBpLmNvbnRleHQ7CiAgICAgICAgICAgIGkuY29tcGxldGUuY2FsbChvLCB0LCBlKSwgcChpLCBvLCAiYWpheENvbXBsZXRlIiwgW3QsIGldKSwKICAgICAgICAgICAgICBmdW5jdGlvbihlKSB7CiAgICAgICAgICAgICAgICBlLmdsb2JhbCAmJiAhLS1uLmFjdGl2ZSAmJiBwKGUsIG51bGwsICJhamF4U3RvcCIpCiAgICAgICAgICAgICAgfShpKQogICAgICAgICAgfQoKICAgICAgICAgIGZ1bmN0aW9uIGgoKSB7fQoKICAgICAgICAgIGZ1bmN0aW9uIHYobiwgZSkgewogICAgICAgICAgICByZXR1cm4gIiIgPT0gZSA/IG4gOiAobiArICImIiArIGUpLnJlcGxhY2UoL1smP117MSwyfS8sICI/IikKICAgICAgICAgIH0KCiAgICAgICAgICBmdW5jdGlvbiBnKGUsIHQsIGksIG8pIHsKICAgICAgICAgICAgcmV0dXJuIG4uaXNGdW5jdGlvbih0KSAmJiAobyA9IGksIGkgPSB0LCB0ID0gdm9pZCAwKSwgbi5pc0Z1bmN0aW9uKGkpIHx8IChvID0gaSwgaSA9IHZvaWQgMCksIHsKICAgICAgICAgICAgICB1cmw6IGUsCiAgICAgICAgICAgICAgZGF0YTogdCwKICAgICAgICAgICAgICBzdWNjZXNzOiBpLAogICAgICAgICAgICAgIGRhdGFUeXBlOiBvCiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGMuaHJlZiA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLCBuLmFjdGl2ZSA9IDAsIG4uYWpheEpTT05QID0gZnVuY3Rpb24oZSwgdCkgewogICAgICAgICAgICBpZiAoISgidHlwZSIgaW4gZSkpIHJldHVybiBuLmFqYXgoZSk7CiAgICAgICAgICAgIHZhciByLCBhLCBsID0gZS5qc29ucENhbGxiYWNrLAogICAgICAgICAgICAgIHMgPSAobi5pc0Z1bmN0aW9uKGwpID8gbCgpIDogbCkgfHwgIlplcHRvIiArIGkrKywKICAgICAgICAgICAgICBjID0gby5jcmVhdGVFbGVtZW50KCJzY3JpcHQiKSwKICAgICAgICAgICAgICBwID0gd2luZG93W3NdLAogICAgICAgICAgICAgIG0gPSBmdW5jdGlvbihlKSB7CiAgICAgICAgICAgICAgICBuKGMpLnRyaWdnZXJIYW5kbGVyKCJlcnJvciIsIGUgfHwgImFib3J0IikKICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgIGggPSB7CiAgICAgICAgICAgICAgICBhYm9ydDogbQogICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHJldHVybiB0ICYmIHQucHJvbWlzZShoKSwgbihjKS5vbigibG9hZCBlcnJvciIsIChmdW5jdGlvbihpLCBvKSB7CiAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KGEpLCBuKGMpLm9mZigpLnJlbW92ZSgpLCAiZXJyb3IiICE9IGkudHlwZSAmJiByID8gZChyWzBdLCBoLCBlLCB0KSA6IGYobnVsbCwgbyB8fCAiZXJyb3IiLCBoLCBlLCB0KSwgd2luZG93W3NdID0gcCwgciAmJiBuLmlzRnVuY3Rpb24ocCkgJiYgcChyWzBdKSwgcCA9IHIgPSB2b2lkIDAKICAgICAgICAgICAgfSkpLCAhMSA9PT0gdShoLCBlKSA/IChtKCJhYm9ydCIpLCBoKSA6ICh3aW5kb3dbc10gPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICByID0gYXJndW1lbnRzCiAgICAgICAgICAgIH0sIGMuc3JjID0gZS51cmwucmVwbGFjZSgvXD8oLispPVw/LywgIj8kMT0iICsgcyksIG8uaGVhZC5hcHBlbmRDaGlsZChjKSwgZS50aW1lb3V0ID4gMCAmJiAoYSA9IHNldFRpbWVvdXQoKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgIG0oInRpbWVvdXQiKQogICAgICAgICAgICB9KSwgZS50aW1lb3V0KSksIGgpCiAgICAgICAgICB9LCBuLmFqYXhTZXR0aW5ncyA9IHsKICAgICAgICAgICAgdHlwZTogIkdFVCIsCiAgICAgICAgICAgIGJlZm9yZVNlbmQ6IGgsCiAgICAgICAgICAgIHN1Y2Nlc3M6IGgsCiAgICAgICAgICAgIGVycm9yOiBoLAogICAgICAgICAgICBjb21wbGV0ZTogaCwKICAgICAgICAgICAgY29udGV4dDogbnVsbCwKICAgICAgICAgICAgZ2xvYmFsOiAhMCwKICAgICAgICAgICAgeGhyOiBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICByZXR1cm4gbmV3IHdpbmRvdy5YTUxIdHRwUmVxdWVzdAogICAgICAgICAgICB9LAogICAgICAgICAgICBhY2NlcHRzOiB7CiAgICAgICAgICAgICAgc2NyaXB0OiAidGV4dC9qYXZhc2NyaXB0LCBhcHBsaWNhdGlvbi9qYXZhc2NyaXB0LCBhcHBsaWNhdGlvbi94LWphdmFzY3JpcHQiLAogICAgICAgICAgICAgIGpzb246ICJhcHBsaWNhdGlvbi9qc29uIiwKICAgICAgICAgICAgICB4bWw6ICJhcHBsaWNhdGlvbi94bWwsIHRleHQveG1sIiwKICAgICAgICAgICAgICBodG1sOiAidGV4dC9odG1sIiwKICAgICAgICAgICAgICB0ZXh0OiAidGV4dC9wbGFpbiIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgY3Jvc3NEb21haW46ICExLAogICAgICAgICAgICB0aW1lb3V0OiAwLAogICAgICAgICAgICBwcm9jZXNzRGF0YTogITAsCiAgICAgICAgICAgIGNhY2hlOiAhMCwKICAgICAgICAgICAgZGF0YUZpbHRlcjogaAogICAgICAgICAgfSwgbi5hamF4ID0gZnVuY3Rpb24oaSkgewogICAgICAgICAgICB2YXIgciwgbSwgZyA9IG4uZXh0ZW5kKHt9LCBpIHx8IHt9KSwKICAgICAgICAgICAgICB5ID0gbi5EZWZlcnJlZCAmJiBuLkRlZmVycmVkKCk7CiAgICAgICAgICAgIGZvciAoZSBpbiBuLmFqYXhTZXR0aW5ncykgdm9pZCAwID09PSBnW2VdICYmIChnW2VdID0gbi5hamF4U2V0dGluZ3NbZV0pOwogICAgICAgICAgICAhIGZ1bmN0aW9uKGUpIHsKICAgICAgICAgICAgICBlLmdsb2JhbCAmJiAwID09IG4uYWN0aXZlKysgJiYgcChlLCBudWxsLCAiYWpheFN0YXJ0IikKICAgICAgICAgICAgfShnKSwgZy5jcm9zc0RvbWFpbiB8fCAoKHIgPSBvLmNyZWF0ZUVsZW1lbnQoImEiKSkuaHJlZiA9IGcudXJsLCByLmhyZWYgPSByLmhyZWYsIGcuY3Jvc3NEb21haW4gPSBjLnByb3RvY29sICsgIi8vIiArIGMuaG9zdCAhPSByLnByb3RvY29sICsgIi8vIiArIHIuaG9zdCksIGcudXJsIHx8IChnLnVybCA9IHdpbmRvdy5sb2NhdGlvbi50b1N0cmluZygpKSwgKG0gPSBnLnVybC5pbmRleE9mKCIjIikpID4gLTEgJiYgKGcudXJsID0gZy51cmwuc2xpY2UoMCwgbSkpLAogICAgICAgICAgICAgIGZ1bmN0aW9uKGUpIHsKICAgICAgICAgICAgICAgIGUucHJvY2Vzc0RhdGEgJiYgZS5kYXRhICYmICJzdHJpbmciICE9IG4udHlwZShlLmRhdGEpICYmIChlLmRhdGEgPSBuLnBhcmFtKGUuZGF0YSwgZS50cmFkaXRpb25hbCkpLCAhZS5kYXRhIHx8IGUudHlwZSAmJiAiR0VUIiAhPSBlLnR5cGUudG9VcHBlckNhc2UoKSAmJiAianNvbnAiICE9IGUuZGF0YVR5cGUgfHwgKGUudXJsID0gdihlLnVybCwgZS5kYXRhKSwgZS5kYXRhID0gdm9pZCAwKQogICAgICAgICAgICAgIH0oZyk7CiAgICAgICAgICAgIHZhciBiID0gZy5kYXRhVHlwZSwKICAgICAgICAgICAgICBNID0gL1w/Lis9XD8vLnRlc3QoZy51cmwpOwogICAgICAgICAgICBpZiAoTSAmJiAoYiA9ICJqc29ucCIpLCAhMSAhPT0gZy5jYWN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XBlLnRvVXBwZXJDYXNlKCkpICYmIHgoIkNvbnRlbnQtVHlwZSIsIGcuY29udGVudFR5cGUgfHwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCIpLCBnLmhlYWRlcnMpCiAgICAgICAgICAgICAgZm9yICh0IGluIGcuaGVhZGVycykgeCh0LCBnLmhlYWRlcnNbdF0pOwogICAgICAgICAgICBpZiAoSi5zZXRSZXF1ZXN0SGVhZGVyID0geCwgSi5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIGlmICg0ID09IEoucmVhZHlTdGF0ZSkgewogICAgICAgICAgICAgICAgICBKLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGgsIGNsZWFyVGltZW91dCh3KTsKICAgICAgICAgICAgICAgICAgdmFyIGUsIHQgPSAhMTsKICAgICAgICAgICAgICAgICAgaWYgKEouc3RhdHVzID49IDIwMCAmJiBKLnN0YXR1cyA8IDMwMCB8fCAzMDQgPT0gSi5zdGF0dXMgfHwgMCA9PSBKLnN0YXR1cyAmJiAiZmlsZToiID09IEQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IGIgfHwgZnVuY3Rpb24obikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiAobiA9IG4uc3BsaXQoIjsiLCAyKVswXSksIG4gJiYgKCJ0ZXh0L2h0bWwiID09IG4gPyAiaHRtbCIgOiAiYXBwbGljYXRpb24vanNvbiIgPT0gbiA/ICJqc29uIiA6IGEudGVzdChuKSA/ICJzY3JpcHQiIDogbC50ZXN0KG4pICYmICJ4bWwiKSB8fCAidGV4dCIKICAgICAgICAgICAgICAgICAgICAgIH0oZy5taW1lVHlwZSB8fCBKLmdldFJlc3BvbnNlSGVhZGVyKCJjb250ZW50LXR5cGUiKSksICJhcnJheWJ1ZmZlciIgPT0gSi5yZXNwb25zZVR5cGUgfHwgImJsb2IiID09IEoucmVzcG9uc2VUeXBlKSBlID0gSi5yZXNwb25zZTsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgIGUgPSBKLnJlc3BvbnNlVGV4dDsKICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBmdW5jdGlvbihuLCBlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuZGF0YUZpbHRlciA9PSBoKSByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHQuY29udGV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5kYXRhRmlsdGVyLmNhbGwoaSwgbiwgZSkKICAgICAgICAgICAgICAgICAgICAgICAgfShlLCBiLCBnKSwgInNjcmlwdCIgPT0gYiA/ICgwLCBldmFsKShlKSA6ICJ4bWwiID09IGIgPyBlID0gSi5yZXNwb25zZVhNTCA6ICJqc29uIiA9PSBiICYmIChlID0gcy50ZXN0KGUpID8gbnVsbCA6IG4ucGFyc2VKU09OKGUpKQogICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICB0ID0gbgogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgaWYgKHQpIHJldHVybiBmKHQsICJwYXJzZXJlcnJvciIsIEosIGcsIHkpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGQoZSwgSiwgZywgeSkKICAgICAgICAgICAgICAgICAgfSBlbHNlIGYoSi5zdGF0dXNUZXh0IHx8IG51bGwsIEouc3RhdHVzID8gImVycm9yIiA6ICJhYm9ydCIsIEosIGcsIHkpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSwgITEgPT09IHUoSiwgZykpIHJldHVybiBKLmFib3J0KCksIGYobnVsbCwgImFib3J0IiwgSiwgZywgeSksIEo7CiAgICAgICAgICAgIHZhciBrID0gISgiYXN5bmMiIGluIGcpIHx8IGcuYXN5bmM7CiAgICAgICAgICAgIGlmIChKLm9wZW4oZy50eXBlLCBnLnVybCwgaywgZy51c2VybmFtZSwgZy5wYXNzd29yZCksIGcueGhyRmllbGRzKQogICAgICAgICAgICAgIGZvciAodCBpbiBnLnhockZpZWxkcykgSlt0XSA9IGcueGhyRmllbGRzW3RdOwogICAgICAgICAgICBmb3IgKHQgaW4gVSkgTi5hcHBseShKLCBVW3RdKTsKICAgICAgICAgICAgcmV0dXJuIGcudGltZW91dCA+IDAgJiYgKHcgPSBzZXRUaW1lb3V0KChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICBKLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGgsIEouYWJvcnQoKSwgZihudWxsLCAidGltZW91dCIsIEosIGcsIHkpCiAgICAgICAgICAgIH0pLCBnLnRpbWVvdXQpKSwgSi5zZW5kKGcuZGF0YSA/IGcuZGF0YSA6IG51bGwpLCBKCiAgICAgICAgICB9LCBuLmdldCA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICByZXR1cm4gbi5hamF4KGcuYXBwbHkobnVsbCwgYXJndW1lbnRzKSkKICAgICAgICAgIH0sIG4ucG9zdCA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICB2YXIgZSA9IGcuYXBwbHkobnVsbCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgcmV0dXJuIGUudHlwZSA9ICJQT1NUIiwgbi5hamF4KGUpCiAgICAgICAgICB9LCBuLmdldEpTT04gPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgdmFyIGUgPSBnLmFwcGx5KG51bGwsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIHJldHVybiBlLmRhdGFUeXBlID0gImpzb24iLCBuLmFqYXgoZSkKICAgICAgICAgIH0sIG4uZm4ubG9hZCA9IGZ1bmN0aW9uKGUsIHQsIGkpIHsKICAgICAgICAgICAgaWYgKCF0aGlzLmxlbmd0aCkgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgIHZhciBvLCBhID0gdGhpcywKICAgICAgICAgICAgICBsID0gZS5zcGxpdCgvXHMvKSwKICAgICAgICAgICAgICBzID0gZyhlLCB0LCBpKSwKICAgICAgICAgICAgICBjID0gcy5zdWNjZXNzOwogICAgICAgICAgICByZXR1cm4gbC5sZW5ndGggPiAxICYmIChzLnVybCA9IGxbMF0sIG8gPSBsWzFdKSwgcy5zdWNjZXNzID0gZnVuY3Rpb24oZSkgewogICAgICAgICAgICAgIGEuaHRtbChvID8gbigiPGRpdj4iKS5odG1sKGUucmVwbGFjZShyLCAiIikpLmZpbmQobykgOiBlKSwgYyAmJiBjLmFwcGx5KGEsIGFyZ3VtZW50cykKICAgICAgICAgICAgfSwgbi5hamF4KHMpLCB0aGlzCiAgICAgICAgICB9OwogICAgICAgICAgdmFyIHkgPSBlbmNvZGVVUklDb21wb25lbnQ7CiAgICAgICAgICBuLnBhcmFtID0gZnVuY3Rpb24oZSwgdCkgewogICAgICAgICAgICB2YXIgaSA9IFtdOwogICAgICAgICAgICByZXR1cm4gaS5hZGQgPSBmdW5jdGlvbihlLCB0KSB7CiAgICAgICAgICAgICAgICBuLmlzRnVuY3Rpb24odCkgJiYgKHQgPSB0KCkpLCBudWxsID09IHQgJiYgKHQgPSAiIiksIHRoaXMucHVzaCh5KGUpICsgIj0iICsgeSh0KSkKICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCwgaSwgbywgcikgewogICAgICAgICAgICAgICAgdmFyIGEsIGwgPSBuLmlzQXJyYXkoaSksCiAgICAgICAgICAgICAgICAgIHMgPSBuLmlzUGxhaW5PYmplY3QoaSk7CiAgICAgICAgICAgICAgICBuLmVhY2goaSwgKGZ1bmN0aW9uKGksIGMpIHsKICAgICAgICAgICAgICAgICAgYSA9IG4udHlwZShjKSwgciAmJiAoaSA9IG8gPyByIDogciArICJbIiArIChzIHx8ICJvYmplY3QiID09IGEgfHwgImFycmF5IiA9PSBhID8gaSA6ICIiKSArICJdIiksICFyICYmIGwgPyB0LmFkZChjLm5hbWUsIGMudmFsdWUpIDogImFycmF5IiA9PSBhIHx8ICFvICYmICJvYmplY3QiID09IGEgPyBlKHQsIGMsIG8sIGkpIDogdC5hZGQoaSwgYykKICAgICAgICAgICAgICAgIH0pKQogICAgICAgICAgICAgIH0oaSwgZSwgdCksIGkuam9pbigiJiIpLnJlcGxhY2UoLyUyMC9nLCAiKyIpCiAgICAgICAgICB9CiAgICAgICAgfShaZXB0byksCiAgICAgICAgZnVuY3Rpb24obikgewogICAgICAgICAgbi5mbi5zZXJpYWxpemVBcnJheSA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICB2YXIgZSwgdCwgaSA9IFtdOwogICAgICAgICAgICByZXR1cm4gdGhpc1swXSAmJiBuLmVhY2godGhpc1swXS5lbGVtZW50cywgKGZ1bmN0aW9uKG8sIHIpIHsKICAgICAgICAgICAgICB0ID0gci50eXBlLCAoZSA9IHIubmFtZSkgJiYgImZpZWxkc2V0IiAhPSByLm5vZGVOYW1lLnRvTG93ZXJDYXNlKCkgJiYgIXIuZGlzYWJsZWQgJiYgInN1Ym1pdCIgIT0gdCAmJiAicmVzZXQiICE9IHQgJiYgImJ1dHRvbiIgIT0gdCAmJiAiZmlsZSIgIT0gdCAmJiAoInJhZGlvIiAhPSB0ICYmICJjaGVja2JveCIgIT0gdCB8fCByLmNoZWNrZWQpICYmIGZ1bmN0aW9uIG4odCkgewogICAgICAgICAgICAgICAgaWYgKHQuZm9yRWFjaCkgcmV0dXJuIHQuZm9yRWFjaChuKTsKICAgICAgICAgICAgICAgIGkucHVzaCh7CiAgICAgICAgICAgICAgICAgIG5hbWU6IGUsCiAgICAgICAgICAgICAgICAgIHZhbHVlOiB0CiAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgIH0obihyKS52YWwoKSkKICAgICAgICAgICAgfSkpLCBpCiAgICAgICAgICB9LCBuLmZuLnNlcmlhbGl6ZSA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICB2YXIgbiA9IFtdOwogICAgICAgICAgICByZXR1cm4gdGhpcy5zZXJpYWxpemVBcnJheSgpLmZvckVhY2goKGZ1bmN0aW9uKGUpIHsKICAgICAgICAgICAgICBuLnB1c2goZW5jb2RlVVJJQ29tcG9uZW50KGUubmFtZSkgKyAiPSIgKyBlbmNvZGVVUklDb21wb25lbnQoZS52YWx1ZSkpCiAgICAgICAgICAgIH0pKSwgbi5qb2luKCImIikKICAgICAgICAgIH0sIG4uZm4uc3VibWl0ID0gZnVuY3Rpb24oZSkgewogICAgICAgICAgICBpZiAoMCBpbiBhcmd1bWVudHMpIHRoaXMuYmluZCgic3VibWl0IiwgZSk7CiAgICAgICAgICAgIGVsc2UgaWYgKHRoaXMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgdmFyIHQgPSBuLkV2ZW50KCJzdWJtaXQiKTsKICAgICAgICAgICAgICB0aGlzLmVxKDApLnRyaWdnZXIodCksIHQuaXNEZWZhdWx0UHJldmVudGVkKCkgfHwgdGhpcy5nZXQoMCkuc3VibWl0KCkKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gdGhpcwogICAgICAgICAgfQogICAgICAgIH0oWmVwdG8pLAogICAgICAgIGZ1bmN0aW9uKCkgewogICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgZ2V0Q29tcHV0ZWRTdHlsZSh2b2lkIDApCiAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgIHZhciBuID0gZ2V0Q29tcHV0ZWRTdHlsZTsKICAgICAgICAgICAgd2luZG93LmdldENvbXB1dGVkU3R5bGUgPSBmdW5jdGlvbihlLCB0KSB7CiAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIHJldHVybiBuKGUsIHQpCiAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAg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2ZmZjRlNjtcbn1cblxuLm9vLWZhaWwgPiBkaXYgPiBkaXYgKyBkaXYge1xuICBtYXJnaW4tdG9wOiAxZW07XG59XG4iKTsKICAgICAgICAgICAgdCA9IDAsIGkgPSBzZXRJbnRlcnZhbCgoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgdmFyIG4gPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJ2aWRlbyIpOwogICAgICAgICAgICAgIGlmIChuLmR1cmF0aW9uIDwgMzkwKSB7CiAgICAgICAgICAgICAgICBuLnBhdXNlKCk7CiAgICAgICAgICAgICAgICB2YXIgZSA9ICQoIiNUZXh0Qm94MiIpLmF0dHIoInZhbHVlIikgfHwgIiI7CiAgICAgICAgICAgICAgICAkKCIudmlkZW8tanMiKS5hZGRDbGFzcygib28tZmFpbCIpLmh0bWwoIjxkaXY+XG4gIDxkaXY+6Kej5p6Q5aSx6LSlPC9kaXY+Ii5jb25jYXQoZSA/ICI8ZGl2PiIgKyBlICsgIjwvZGl2PiIgOiAiIiwgIlxuPC9kaXY+IikpLCBjbGVhckludGVydmFsKGkpCiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHQrKyA+IDEwMCAmJiBjbGVhckludGVydmFsKGkpCiAgICAgICAgICAgIH0pLCAxMDApCiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB2YXIgbiA9IEhyZWYuc3BsaXQoInVybD0iKVsxXTsKICAgICAgICAgICAgaWYgKG4pIHsKICAgICAgICAgICAgICAkKCIjVGV4dEJveDEiKS52YWwoZGVjb2RlVVJJKG4pKTsKICAgICAgICAgICAgICB2YXIgZSA9ICQoIiNCdXR0b24xIik7CiAgICAgICAgICAgICAgZS5sZW5ndGggPiAwICYmICgkKCIudmlkZW8tanMiKS5jc3MoImRpc3BsYXkiLCAibm9uZSAhaW1wb3J0YW50IiksIGUuY2xpY2soKSkKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgdCA9IDAsCiAgICAgICAgICAgICAgaSA9IHNldEludGVydmFsKChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHZhciBuID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigidmlkZW8iKTsKICAgICAgICAgICAgICAgIG4gJiYgbi5wYXVzZSgpLCB0KysgPiAxMDAgJiYgY2xlYXJJbnRlcnZhbChpKQogICAgICAgICAgICAgIH0pLCAxMDApCiAgICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAoSXMoL20xOTA3XC5jbi8pKSB7CiAgICAgICAgICBhZGRTdHlsZSgiXG4jcy1wbGF5ZXIgKyAuc2hvdyA+IGRpdlt0aXRsZV0sXG4jcy1jb250cm9scyArIGRpdiA+IGRpdjpudGgtY2hpbGQobis1KTpub3QoOmxhc3QtY2hpbGQpXG57Ii5jb25jYXQoUHVyaWZ5U3R5bGUsICJ9XG4iKSk7CiAgICAgICAgICB0ID0gMCwgaSA9IHNldEludGVydmFsKChmdW5jdGlvbigpIHsKICAgICAgICAgICAgKCQoIiNzLXBsYXllciArIC5zaG93IikubGVuZ3RoID4gMCB8fCB0KysgPiAxNSkgJiYgKGNsZWFySW50ZXJ2YWwoaSksICQoIiNzLWNvbnRyb2xzID4gZGl2IGltZyArIHNwYW4iKS5jbGljaygpKQogICAgICAgICAgfSksIDIwMCk7CiAgICAgICAgICB3aW5kb3cuYWxlcnQgPSBmdW5jdGlvbigpIHt9CiAgICAgICAgfQogICAgICB9KSkpLCAoSXMoLz1odHRwLykgJiYgKElzKGlzVmlwQWRkb25VcmxSZWdleCkgfHwgd2luZG93LnRvcCAhPT0gd2luZG93LnNlbGYgJiYgSXNOb3QoL20xOTA3XC5jbi8pKSB8fCBJcygvb29cLm1vdmllJi8pKSAmJiB2aXBBZGRvbkdvKCk7CiAgICAgIGVsc2UgaWYgKElzKC9zZWFyY2hcLmRvdWJhblwuY29tXC9tb3ZpZVwvLykpIGxvZygi6LGG55OjwrfnlLXlvbHCt+aQnOe0oiAtIHBjIiksIGFkZFN0eWxlKCJcbiNk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1xuICBib3R0b206IDA7XG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgbGVmdDogMDtcbiAgcmlnaHQ6IDA7XG4gIHRvcDogMDtcbiAgd2lkdGg6IDEwMnB4O1xuICBoZWlnaHQ6IDE0MnB4O1xuICBib3JkZXItcmFkaXVzOiA0cHg7XG59XG4nKSkKICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoInN5bmNDb3ZlckNvbG9yOiIsIG4pCiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBzZXRUaW1lb3V0KChmdW5jdGlvbigpIHsKICAgICAgICAgICAgbigpCiAgICAgICAgICB9KSwgMTAwKQogICAgICAgIH0oKQogICAgICB9KSk7CiAgICAgIGVsc2UgewogICAgICAgIGlmIChJcygvbVwudHZcLnNvaHVcLmNvbVwvcGhvbmVfcGxheV9maWxtLit2aWQ9LykpIHJldHVybiBsb2NhdGlvbi5ocmVmID0gSHJlZi5yZXBsYWNlKCJwaG9uZV9wbGF5X2ZpbG0iLCAidiIuY29uY2F0KEhyZWYubWF0Y2goL3ZpZD0oXGQrKS8pWzFdLCAiLnNodG1sIikpOwogICAgICAgIGlmIChpc01vYmlsZSAmJiBJcygvbW92aWVcLmRvdWJhblwuY29tXC90YWdcLyMvKSkgewogICAgICAgICAgbG9nKCLosYbnk6PCt+mAieW9seinhiIpOwogICAgICAgICAgdmFyIG51bSA9IDM7CiAgICAgICAgICBhZGRTdHlsZShwcmVmaXhDc3MoIlxuLmNhdGVnb3J5IHtcbiAgd2lkdGg6IDEwMCU7XG4gIHdoaXRlLXNwYWNlOiBub3dyYXA7XG4gIG92ZXJmbG93LXg6IGF1dG87XG59XG5cbi50YWdzIHtcbiAgbWFyZ2luLWJvdHRvbTogMWVtO1xufVxuXG4uY2hlY2tib3hfX2lucHV0IHtcbiAgdmVydGljYWwtYWxpZ246IHRleHQtdG9wO1xufVxuXG4udGFnLW5hdiB7XG4gIG1h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QoZSkuYXR0cigiaHJlZiIsICQoZSkuYXR0cigiaHJlZiIpLnJlcGxhY2UoIm1vdmllLmRvdWJhbi5jb20iLCAibS5kb3ViYW4uY29tL21vdmllIikpLnJlbW92ZUF0dHIoInRhcmdldCIpCiAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgdmFyIG4gPSAhMTsKCiAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgIW4gJiYgJCh3aW5kb3cpLnNjcm9sbFRvcCgpICsgJCh3aW5kb3cpLmhlaWdodCgpID4gJChkb2N1bWVudCkuaGVpZ2h0KCkgLSA0MCAmJiAobiA9ICEwLCBzZXRUaW1lb3V0KChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICQod2luZG93KS5zY3JvbGxUb3AoKSArICQod2luZG93KS5oZWlnaHQoKSA+ICQoZG9jdW1lbnQpLmhlaWdodCgpIC0gNDAgJiYgKCQod2luZG93KS51bmJpbmQoInNjcm9sbCIpLCAkKCIubW9yZSIpLmNsaWNrKCkpLCBuID0gITEKICAgICAgICAgICAgICB9KSwgMTIwMCkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHQgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIubGlzdC13cCIpOwogICAgICAgICAgICBuZXcgTXV0YXRpb25PYnNlcnZlcigoZnVuY3Rpb24obikgewogICAgICAgICAgICAgIHZhciB0ID0gITEsCiAgICAgICAgICAgICAgICBpID0gITAsCiAgICAgICAgICAgICAgICBvID0gITEsCiAgICAgICAgICAgICAgICByID0gdm9pZCAwOwogICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBhLCBsID0gbltTeW1ib2wuaXRlcmF0b3JdKCk7ICEoaSA9IChhID0gbC5uZXh0KCkpLmRvbmUpOyBpID0gITApIHsKICAgICAgICAgICAgICAgICAgdmFyIHMgPSBhLnZhbHVlOwogICAgICAgICAgICAgICAgICAiY2hpbGRMaXN0IiA9PSBzLnR5cGUgJiYgKHQgPSAhMCwgcy5hZGRlZE5vZGVzLmZvckVhY2goKGZ1bmN0aW9uKG4pIHsKICAgICAgICAgICAgICAgICAgICBuLmNsYXNzTGlzdC5jb250YWlucygiaXRlbSIpICYmIChuLnNldEF0dHJpYnV0ZSgiaHJlZiIsIG4uZ2V0QXR0cmlidXRlKCJocmVmIikucmVwbGFjZSgibW92aWUuZG91YmFuLmNvbSIsICJtLmRvdWJhbi5jb20vbW92aWUiKSksIG4ucmVtb3ZlQXR0cmlidXRlKCJ0YXJnZXQiKSkKICAgICAgICAgICAgICAgICAgfSkpKSwgdCAmJiBzZXRUaW1lb3V0KChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgICAkKHdpbmRvdykuc2Nyb2xsKGUpCiAgICAgICAgICAgICAgICAgIH0pLCAxNTAwKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgIG8gPSAhMCwgciA9IG4KICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgaSB8fCBudWxsID09IGwucmV0dXJuIHx8IGwucmV0dXJuKCkKICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgIGlmIChvKSB0aHJvdyByCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSkub2JzZXJ2ZSh0LCB7CiAgICAgICAgICAgICAgYXR0cmlidXRlczogITAsCiAgICAgICAgICAgICAgY2hpbGRMaXN0OiAhMAogICAgICAgICAgICB9KQogICAgICAgICAgfSkpCiAgICAgICAgfSBlbHNlIElzKC9cdys6MTIzNHxlY3J1b3NcLmdpdGVlXC5pb1wvb25lLykgPyAobG9nKCJPbmXCt+S4u+mhtSIpLCBfJCgoZnVuY3Rpb24oKSB7CiAgICAgICAgICBsb2NhbFN0b3JhZ2Uuc2V0SXRlbSgiT25lLnBsdWdpbi52ZXJzaW9uIiwgVkVSU0lPTikKICAgICAgICB9KSkpIDogSXMoL1wuYmlsaWJpbGlcLmNvbVwvYmFuZ3VtaVwvcGxheVwvLykgJiYgKGxvZygi5ZOU5ZOp5ZOU5ZOpwrflvbHop4bmkq3mlL7pobUiKSwgXyQoKGZ1bmN0aW9uKCkgewogICAgICAgICAgdmFyIG4gPSAwLAogICAgICAgICAgICBlID0gc2V0SW50ZXJ2YWwoKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgIGlmICgkKCIuZXAtaW5mby1pbWFnZSBpbWcsIC5tZWRpYS1jb3ZlciBpbWciKS5sZW5ndGggPiAwKSB7CiAgICAgICAgICAgICAgICB2YXIgdCA9ICQoIi5tZWRpYS10aXRsZSwgLmVwLWluZm8tdGl0bGUiKS5lcSgwKS50ZXh0KCk7CiAgICAgICAgICAgICAgICB0ICYmIChjbGVhckludGVydmFsKGUpLCBpbnNlcnRTZWFyY2hBZGRvbih0LCAiLm1lZGlhLXdyYXBwZXIsIC5lcC1saXN0LXByZS13cmFwcGVyIikpCiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIG4rKyA+IDUwICYmIGNsZWFySW50ZXJ2YWwoZSkKICAgICAgICAgICAgfSksIDIwMCkKICAgICAgICB9KSkpCiAgICAgIH0KICAgICAgbWFrZUJldHRlckFkZG9ucygpLCBjYWxsYmFja1doZW5Eb25lKCksIElzKC9tXC52XC5xcVwuY29tLykgJiYgdXJsRGV0ZWN0b3IoKGZ1bmN0aW9uKCkgewogICAgICAgIGlmIChJcygvdlwucXFcLmNvbVwvKGNvdmVyfHBsYXl8eFwvY292ZXJ8eFwvcGFnZXx4XC9wbGF5fHhcL21cL2NvdmVyfHhcL21cL3BhZ2V8eFwvbVwvcGxheSkvKSkgdmFyIG4gPSAwLAogICAgICAgICAgZSA9ICExLAogICAgICAgICAgdCA9IHNldEludGVydmFsKChmdW5jdGlvbigpIHsKICAgICAgICAgICAgZSB8fCAoZS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ZmYoc25pZmZUaWNrSWQpIHsKICAgIGlmIChzbmlmZlRpY2tJZCA9PT0gc25pZmZUaWNrKSB7CiAgICAgIGxvZygiaGlrZXJTbmlmZiIpOwogICAgICB2YXIgcmVzb3VyY2UgPSBldmFsKHdpbmRvdy5meV9icmlkZ2VfYXBwLmdldE5ldHdvcmtSZWNvcmRzKCkpOwogICAgICBpZiAocmVzb3VyY2UgPSByZXNvdXJjZS5maWx0ZXIoKGZ1bmN0aW9uKG4pIHsKICAgICAgICAgIHJldHVybiBuLnRpbWVzdGFtcCA+IHNuaWZmVGltZXN0YW1wICYmIC92aWRlby9pLnRlc3Qobi5tZWRpYVR5cGUubmFtZSkgJiYgaXNWYWxpZFZpZGVvVXJsKG4udXJsKQogICAgICAgIH0pKSwgREVCVUcpIHsKICAgICAgICB2YXIgbG9nSW5mbyA9ICJDb3VudDogIi5jb25jYXQocmVzb3VyY2UubGVuZ3RoLCAiICgiKS5jb25jYXQoKG5ldyBEYXRlKS50b0lTT1N0cmluZygpLCAiKTxicj4iKSArIHJlc291cmNlLm1hcCgoZnVuY3Rpb24obiwgZSkgewogICAgICAgICAgcmV0dXJuICIiLmNvbmNhdChlICsgMSwgIiAtICIpLmNvbmNhdChuLm1lZGlhVHlwZS5uYW1lLCAiKCIpLmNvbmNhdChuLm1lZGlhVHlwZS50eXBlLCAiKSAtICIpLmNvbmNhdChuLnVybCkKICAgICAgICB9KSkuam9pbigiPGJyPiIpOwogICAgICAgICQoIi5vby1zb3VyY2VzIikuaHRtbChsb2dJbmZvKQogICAgICB9CiAgICAgIGlmICgwICE9PSByZXNvdXJjZS5sZW5ndGgpIHsKICAgICAgICBpZiAoaXNTbmlmZmluZykgewogICAgICAgICAgdmFyIHJlc291cmNlVXJsID0gcmVzb3VyY2VbMF0udXJsOwogICAgICAgICAgc25pZmZTdWNjZXNzKHJlc291cmNlVXJsKSwgd2luZG93LmZ5X2JyaWRnZV9hcHAucGxheVZpZGVvKHJlc291cmNlVXJsKQogICAgICAgIH0KICAgICAgfSBlbHNlIGlzU25pZmZpbmcgJiYgc2V0VGltZW91dCgoZnVuY3Rpb24oKSB7CiAgICAgICAgaGlrZXJTbmlmZihzbmlmZlRpY2tJZCkKICAgICAgfSksIDEwMCkKICAgIH0KICB9CgogIGZ1bmN0aW9uIG1peGlhU25pZmYobikgewogICAgaWYgKG4gPT09IHNuaWZmVGljaykgewogICAgICBsb2coIm1peGlhU25pZmYiKTsKICAgICAgdmFyIGUgPSBbXSwKICAgICAgICB0ID0gd2luZG93Lm14X2Jyb3dzZXJfb2JqLmdldHdlYmxvZ3MoImh0dHAiKTsKICAgICAgaWYgKCJlcnJvciIgIT09IHQgJiYgKGUgPSAoZSA9IHQudHJpbSgpLnNwbGl0KC9ccypcbltcblxzXSovKSkuZmlsdGVyKChmdW5jdGlvbihuKSB7CiAgICAgICAgICByZXR1cm4gaXNWYWxpZFZpZGVvVXJsKG4pCiAgICAgICAgfSkpKSwgREVCVUcpIHsKICAgICAgICB2YXIgaSA9ICJDb3VudDogIi5jb25jYXQoZS5sZW5ndGgsICIgKCIpLmNvbmNhdCgobmV3IERhdGUpLnRvSVNPU3RyaW5nKCksICIpPGJyPiIpICsgZS5tYXAoKGZ1bmN0aW9uKG4sIGUpIHsKICAgICAgICAgIHJldHVybiAiIi5jb25jYXQoZSArIDEsICIgLSAiKS5jb25jYXQobikKICAgICAgICB9KSkuam9pbigiPGJyPiIpOwogICAgICAgICQoIi5vby1zb3VyY2VzIikuaHRtbChpKQogICAgICB9CiAgICAgIGlmICgwICE9PSBlLmxlbmd0aCkgewogICAgICAgIGlmIChpc1NuaWZmaW5nKSB7CiAgICAgICAgICB2YXIgbyA9IGVbMF07CiAgICAgICAgICBzbmlmZlN1Y2Nlc3MobyksIHdpbmRvdy5teF9icm93c2VyX29iai5wbGF5dmlkZW8obywgbykKICAgICAgICB9CiAgICAgIH0gZWxzZSBpc1NuaWZmaW5nICYmIHNldFRpbWVvdXQoKGZ1bmN0aW9uKCkgewogICAgICA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24taXRlbXM6IGNlbnRlcjtcbiAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gIGJhY2tncm91bmQtY29sb3I6ICMwMDA7XG59XG5cbi5vby5pcy1mYWlsIC50aXAge1xuICB0ZXh0LWFsaWduOiBjZW50ZXI7XG4gIHBhZGRpbmc6IDFlbTtcbiAgY29sb3I6IHdoaXRlO1xufVxuICAgICIpKSwgXyQoKGZ1bmN0aW9uKCkgewogICAgICB2YXIgdCwgaSA9ICEwLAogICAgICAgIG8gPSAhMSwKICAgICAgICByID0gITEsCiAgICAgICAgYSA9IHNldEludGVydmFsKChmdW5jdGlvbigpIHsKICAgICAgICAgIGlmICghcikKICAgICAgICAgICAgaWYgKHIgPSAhMCwgJChuKS5oYXNDbGFzcygib28iKSkgY2xlYXJJbnRlcnZhbChhKTsKICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgKHQgPSAkKCJ2aWRlbyIpLmdldCgwKSkgJiYgZSh0KTsKICAgICAgICAgICAgICB2YXIgbCA9ICQoImlmcmFtZSIpOwogICAgICAgICAgICAgIGlmICgwICE9PSBsLmxlbmd0aCkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgczsgMCA9PT0gKHQgPSBsLmNvbnRlbnRzKCkuZmluZCgidmlkZW8iKSkubGVuZ3RoICYmIChzID0gbC5jb250ZW50cygpLmZpbmQoImlmcmFtZSIpKS5sZW5ndGggPiAwOykgbCA9IHM7CiAgICAgICAgICAgICAgICB0Lmxlbmd0aCA+IDAgJiYgdC5hdHRyKCJzcmMiKSA/IChjbGVhckludGVydmFsKGEpLCBpICYmIChpID0gITAsIGUodCkpKSA6IG8gJiYgY2xlYXJJbnRlcnZhbChhKSwgciA9ICExLCAkKCJ0aXRsZSIpLmh0bWwoKSAhPT0gUExVR0lOX0lEICYmICQoInRpdGxlIikuaHRtbChQTFVHSU5fSUQpCiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfSksIDI1MCk7CiAgICAgIHNldFR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