Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:网页插件¥js_url¥global_Javlibrary-首页一站式影片预览@base64://Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgICAgICAgICAgIEphdmxpYnJhcnkgLSDpppbpobXkuIDnq5nlvI/lvbHniYfpooTop4gKLy8gQHZlcnNpb24gICAgICAgICAgIDAuOC4zCi8vIEBkZXNjcmlwdGlvbiAgICAgICDkuI3pnIDopoHot7PovazvvIzlnKggSmF2bGlicmFyeSDpppbpobXlsLHog73nm7TmjqXpooTop4jlvbHniYfjgILkvJrnvJPlrZjlvbHniYfnm7jlhbPkv6Hmga/vvIzkuIvmrKHlj6/nm7TmjqXkvb/nlKjjgILlj6/mkJzntKLnlarlj7fmiJbliY3nvIDjgILmlK/mjIHovbvph4/nmoQgdG9ycmVudGtpdHR5IOejgeWKm+aQnOe0ouWxleekuuOAggovLyBAYXV0aG9yICAgICAgICAgICAgdGhpbmtlcgovLyBAbmFtZXNwYWNlICAgICAgICAgaHR0cHM6Ly9ncmVhc3lmb3JrLm9yZy91c2Vycy80NDA2MTYKLy8gQGluY2x1ZGUgICAgICAgICAgIGh0dHAqOi8vd3d3LmphdmxpYnJhcnkuY29tL2NuLwovLyBAaW5jbHVkZSAgICAgICAgICAgaHR0cCo6Ly93d3cuamF2bGlicmFyeS5jb20vY24vP19fY2ZfY2hsX2pzY2hsX3RrX18qCi8vIEByZXF1aXJlICAgICAgICAgICBodHRwczovL2Nkbi5ib290Y3NzLmNvbS92dWUvMi42LjEwL3Z1ZS5ydW50aW1lLm1pbi5qcwovLyBAcmVxdWlyZSAgICAgICAgICAgaHR0cHM6Ly91bnBrZy5jb20vcmVjdGFuZ2xlLXRyYW5zZm9ybUAwLjQuMC9saWIvcmVjdGFuZ2xlLXRyYW5zZm9ybS5taW4uanMKLy8gQGdyYW50ICAgICAgICAgICAgIEdNX3htbGh0dHBSZXF1ZXN0Ci8vIEBkb3dubG9h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9yIGV4cG9ydCBpbnRlcm9wLgogICAgICBjb25zdCBvcHRpb25zID0gdHlwZW9mIHNjcmlwdCA9PT0gJ2Z1bmN0aW9uJyA/IHNjcmlwdC5vcHRpb25zIDogc2NyaXB0OwogICAgICAvLyByZW5kZXIgZnVuY3Rpb25zCiAgICAgIGlmICh0ZW1wbGF0ZSAmJiB0ZW1wbGF0ZS5yZW5kZXIpIHsKICAgICAgICAgIG9wdGlvbnMucmVuZGVyID0gdGVtcGxhdGUucmVuZGVyOwogICAgICAgICAgb3B0aW9ucy5zdGF0aWNSZW5kZXJGbnMgPSB0ZW1wbGF0ZS5zdGF0aWNSZW5kZXJGbnM7CiAgICAgICAgICBvcHRpb25zLl9jb21waWxlZCA9IHRydWU7CiAgICAgICAgICAvLyBmdW5jdGlvbmFsIHRlbXBsYXRlCiAgICAgICAgICBpZiAoaXNGdW5jdGlvbmFsVGVtcGxhdGUpIHsKICAgICAgICAgICAgICBvcHRpb25zLmZ1bmN0aW9uYWwgPSB0cnVlOwogICAgICAgICAgfQogICAgICB9CiAgICAgIC8vIHNjb3BlZElkCiAgICAgIGlmIChzY29wZUlkKSB7CiAgICAgICAgICBvcHRpb25zLl9zY29wZUlkID0gc2NvcGVJZDsKICAgICAgfQogICAgICBsZXQgaG9vazsKICAgICAgaWYgKG1vZHVsZUlkZW50aWZpZXIpIHsKICAgICAgICAgIC8vIHNlcnZlciBidWlsZAogICAgICAgICAgaG9vayA9IGZ1bmN0aW9uIChjb250ZXh0KSB7CiAgICAgICAgICAgICAgLy8gMi4zIGluamVjdGlvbgogICAgICAgICAgICAgIGNvbnRleHQgPQogICAgICAgICAgICAgICAgICBjb250ZXh0IHx8IC8vIGNhY2hlZCBjYWxsCiAgICAgICAgICAgICAgICAgICAgICAodGhpcy4kdm5vZGUgJiYgdGhpcy4kdm5vZGUuc3NyQ29udGV4dCkgfHwgLy8gc3RhdGVmdWwKICAgICAgICAgICAgICAgICAgICAgICh0aGlzLnBhcmVudCAmJiB0aGlzLnBhcmVudC4kdm5vZGUgJiYgdGhpcy5wYXJlbnQuJHZub2RlLnNzckNvbnRleHQpOyAvLyBmdW5jdGlvbmFsCiAgICAgICAgICAgICAgLy8gMi4yIHdpdGggcnVuSW5OZXdDb250ZXh0OiB0cnVlCiAgICAgICAgICAgICAgaWYgKCFjb250ZXh0ICYmIHR5cGVvZiBfX1ZVRV9TU1JfQ09OVEVYVF9fICE9PSAndW5kZWZpbmVkJykgewogICAgICAgICAgICAgICAgICBjb250ZXh0ID0gX19WVUVfU1NSX0NPTlRFWFRfXzsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgLy8gaW5qZWN0IGNvbXBvbmVudCBzdHlsZXMKICAgICAgICAgICAgICBpZiAoc3R5bGUpIHsKICAgICAgICAgICAgICAgICAgc3R5bGUuY2FsbCh0aGlzLCBjcmVhdGVJbmplY3RvclNTUihjb250ZXh0KSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIC8vIHJlZ2lzdGVyIGNvbXBvbmVudCBtb2R1bGUgaWRlbnRpZmllciBmb3IgYXN5bmMgY2h1bmsgaW5mZXJlbmNlCiAgICAgICAgICAgICAgaWYgKGNvbnRleHQgJiYgY29udGV4dC5fcmVnaXN0ZXJlZENvbXBvbmVudHMpIHsKICAgICAgICAgICAgICAgICAgY29udGV4dC5fcmVnaXN0ZXJlZENvbXBvbmVudHMuYWRkKG1vZHVsZUlkZW50aWZpZXIpOwogICAgICAgICAgICAgIH0KICAgICAgICAgIH07CiAgICAgICAgICAvLyB1c2VkIGJ5IHNzciBpbiBjYXNlIGNvbXBvbmVudCBpcyBjYWNoZWQgYW5kIGJlZm9yZUNyZWF0ZQogICAgICAgICAgLy8gbmV2ZXIgZ2V0cyBjYWxsZWQKICAgICAgICAgIG9wdGlvbnMuX3NzclJlZ2lzdGVyID0gaG9vazsKICAgICAgfQogICAgICBlbHNlIGlmIChzdHlsZSkgewogICAgICAgICAgaG9vayA9IHNoYWRvd01vZGUKICAgICAgICAgICAgICA/IGZ1bmN0aW9uIChjb250ZXh0KSB7CiAgICAgICAgICAgICAgICAgIHN0eWxlLmNhbGwodGhpcywgY3JlYXRlSW5qZWN0b3JTaGFkb3coY29udGV4dCwgdGhpcy4kcm9vdC4kb3B0aW9ucy5zaGFkb3dSb290KSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIDogZnVuY3Rpb24gKGNvbnRleHQpIHsKICAgICAgICAgICAgICAgICAgc3R5bGUuY2FsbCh0aGlzLCBjcmVhdGVJbmplY3Rvcihjb250ZXh0KSk7CiAgICAgICAgICAgICAgfTsKICAgICAgfQogICAgICBpZiAoaG9vaykgewogICAgICAgICAgaWYgKG9wdGlvbnMuZnVuY3Rpb25hbCkgewogICAgICAgICAgICAgIC8vIHJlZ2lzdGVyIGZvciBmdW5jdGlvbmFsIGNvbXBvbmVudCBpbiB2dWUgZmlsZQogICAgICAgICAgICAgIGNvbnN0IG9yaWdpbmFsUmVuZGVyID0gb3B0aW9ucy5yZW5kZXI7CiAgICAgICAgICAgICAgb3B0aW9ucy5yZW5kZXIgPSBmdW5jdGlvbiByZW5kZXJXaXRoU3R5bGVJbmplY3Rpb24oaCwgY29udGV4dCkgewogICAgICAgICAgICAgICAgICBob29rLmNhbGwoY29udGV4dCk7CiAgICAgICAgICAgICAgICAgIHJldHVybiBvcmlnaW5hbFJlbmRlcihoLCBjb250ZXh0KTsKICAgICAgICAgICAgICB9OwogICAgICAgICAgfQogICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgLy8gaW5qZWN0IGNvbXBvbmVudCByZWdpc3RyYXRpb24gYXMgYmVmb3JlQ3JlYXRlIGhvb2sKICAgICAgICAgICAgICBjb25zdCBleGlzdGluZyA9IG9wdGlvbnMuYmVmb3JlQ3JlYXRlOwogICAgICAgICAgICAgIG9wdGlvbnMuYmVmb3JlQ3JlYXRlID0gZXhpc3RpbmcgPyBbXS5jb25jYXQoZXhpc3RpbmcsIGhvb2spIDogW2hvb2tdOwogICAgICAgICAgf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Ly9zdGFja292ZXJmbG93LmNvbS9hLzI2NjAzODc1CiAgICAgICAgICAgICAgY29kZSArPQogICAgICAgICAgICAgICAgICAnXG4vKiMgc291cmNlTWFwcGluZ1VSTD1kYXRhOmFwcGxpY2F0aW9uL2pzb247YmFzZTY0LCcgKwogICAgICAgICAgICAgICAgICAgICAgYnRvYSh1bmVzY2FwZShlbmNvZGVVUklDb21wb25lbnQoSlNPTi5zdHJpbmdpZnkoY3NzLm1hcCkpKSkgKwogICAgICAgICAgICAgICAgICAgICAgJyAqLyc7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoIXN0eWxlLmVsZW1lbnQpIHsKICAgICAgICAgICAgICBzdHlsZS5lbGVtZW50ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc3R5bGUnKTsKICAgICAgICAgICAgICBzdHlsZS5lbGVtZW50LnR5cGUgPSAndGV4dC9jc3MnOwogICAgICAgICAgICAgIGlmIChjc3MubWVkaWEpCiAgICAgICAgICAgICAgICAgIHN0eWxlLmVsZW1lbnQuc2V0QXR0cmlidXRlKCdtZWRpYScsIGNzcy5tZWRpYSk7CiAgICAgICAgICAgICAgaWYgKEhFQUQgPT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICAgICAgICBIRUFEID0gZG9jdW1lbnQuaGVhZCB8fCBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnaGVhZCcpWzBdOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBIRUFELmFwcGVuZENoaWxkKHN0eWxlLmVsZW1lbnQpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKCdzdHlsZVNoZWV0JyBpbiBzdHlsZS5lbGVtZW50KSB7CiAgICAgICAgICAgICAgc3R5bGUuc3R5bGVzLnB1c2goY29kZSk7CiAgICAgICAgICAgICAgc3R5bGUuZWxlbWVudC5zdHlsZVNoZWV0LmNzc1RleHQgPSBzdHlsZS5zdHlsZXMKICAgICAgICAgICAgICAgICAgLmZpbHRlcihCb29sZWFuKQogICAgICAgICAgICAgICAgICAuam9pbignXG4nKTsKICAgICAgICAgIH0KICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgIGNvbnN0IGluZGV4ID0gc3R5bGUuaWRzLnNpemUgLSAxOwogICAgICAgICAgICAgIGNvbnN0IHRleHROb2RlID0gZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUoY29kZSk7CiAgICAgICAgICAgICAgY29uc3Qgbm9kZXMgPSBzdHlsZS5lbGVtZW50LmNoaWxkTm9kZXM7CiAgICAgICAgICAgICAgaWYgKG5vZGVzW2luZGV4XSkKICAgICAgICAgICAgICAgICAgc3R5bGUuZWxlbWVudC5yZW1vdmVDaGlsZChub2Rlc1tpbmRleF0pOwogICAgICAgICAgICAgIGlmIChub2Rlcy5sZW5ndGgpCiAgICAgICAgICAgICAgICAgIHN0eWxlLmVsZW1lbnQuaW5zZXJ0QmVmb3JlKHRleHROb2RlLCBub2Rlc1tpbmRleF0pOwogICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgc3R5bGUuZWxlbWVudC5hcHBlbmRDaGlsZCh0ZXh0Tm9kZSk7CiAgICAgICAgICB9CiAgICAgIH0KICB9CgogIC8qIHNjcmlwdCAqLwogIGNvbnN0IF9fdnVlX3NjcmlwdF9fID0gc2NyaXB0OwoKICAvKiB0ZW1wbGF0ZSAqLwogIHZhciBfX3Z1ZV9yZW5kZXJfXyA9IGZ1bmN0aW9uKCkgewogICAgdmFyIF92bSA9IHRoaXM7CiAgICB2YXIgX2ggPSBfdm0uJGNyZWF0ZUVsZW1lbnQ7CiAgICB2YXIgX2MgPSBfdm0uX3NlbGYuX2MgfHwgX2g7CiAgICByZXR1cm4gX2MoCiAgICAgICJkaXYiLAogICAgICB7IHN0YXRpY0NsYXNzOiAidGktY29udGFpbmVyIiwgc3R5bGU6IHsgekluZGV4OiBfdm0uekluZGV4IH0gfSwKICAgICAgWwogICAgICAgIF9jKAogICAgICAgICAgImRpdiIsCiAgICAgICAgICB7CiAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG9nZ2xlIiwKICAgICAgICAgICAgY2xhc3M6IF92bS5zaG93ID8gInRvLWhpZGUiIDogInRvLXNob3ciLAogICAgICAgICAgICBvbjogewogICAgICAgICAgICAgIGNsaWNrOiBmdW5jdGlvbigkZXZlbnQpIHsKICAgICAgICAgICAgICAgIF92bS5zaG93ID0gIV92bS5zaG93OwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfSwKICAgICAgICAgIFtfYygiaSIsIHsgc3RhdGljQ2xhc3M6ICJ0aS10b2dnbGUiIH0pXQogICAgICAgICksCiAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgX3ZtLnNob3cKICAgICAgICAgID8gX2MoImRpdiIsIHsgc3RhdGljQ2xhc3M6ICJtYWluIiB9LCBbX3ZtLl90KCJkZWZhdWx0IildLCAyKQogICAgICAgICAgOiBfdm0uX2UoKQogICAgICBdCiAgICApCiAgfTsKICB2YXIgX192dWVfc3RhdGljUmVuZGVyRm5zX18gPSBbXTsKICBfX3Z1ZV9yZW5kZXJfXy5fd2l0aFN0cmlwcGVkID0gdHJ1ZTsKCiAgICAvKiBzdHlsZSAqLwogICAgY29uc3QgX192dWVfaW5qZWN0X3N0eWxlc19fID0gZnVuY3Rpb24gKGluamVjdCkgewogICAgICBpZiAoIWluamVjdCkgcmV0dXJuCiAgICAgIGluamVjdCgiZGF0YS12LTRhMjA2NDY4XzAiLCB7IHNvdXJjZTogIi50aS1jb250YWluZXJbZGF0YS12LTRhMjA2NDY4XSB7XG4gIHBvc2l0aW9uOiBmaXhlZDtcbiAgbGVmdDogMDtcbiAgdG9wOiAwO1xufVxuLnRpLWNvbnRhaW5lciAudG9nZ2xlW2RhdGEtdi00YTIwNjQ2OF0ge1xuICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gIGxlZnQ6IC0yMHB4O1xuICB0b3A6IC0yMHB4O1xuICB3aWR0aDogNDBweDtcbiAgaGVp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ogODM4LAogICAgICAgICAgaGVpZ2h0OiA1NTAsCiAgICAgICAgfQogICAgICB9CiAgICB9LAogICAgY29tcHV0ZWQ6IHsKICAgICAgc3R5bGVzICgpIHsKICAgICAgICByZXR1cm4gT2JqZWN0LmtleXModGhpcy5ib3VuZGluZykucmVkdWNlKChzLCBrKSA9PiB7CiAgICAgICAgICBzW2tdID0gdGhpcy5ib3VuZGluZ1trXSArICdweCc7CiAgICAgICAgICByZXR1cm4gcwogICAgICAgIH0sIHt9KQogICAgICB9CiAgICB9LAogICAgbWV0aG9kczogewogICAgICBvbmxvYWQgKGV2KSB7CiAgICAgICAgY29uc29sZS5sb2coJ2xvYWQnKTsKICAgICAgICBjb25zdCBkb2MgPSBldi50YXJnZXQuY29udGVudERvY3VtZW50OwogICAgICAgIGNvbnN0IGRldlN0eWxlID0gZG9jLmNyZWF0ZUVsZW1lbnQoJ3N0eWxlJyk7CiAgICAgICAgZGV2U3R5bGUuaW5uZXJIVE1MID0gYAogICAgICAgIC8qIyAudnVlICovIAogICAgICAgICN2aWRlb19qYWNrZXRfaW1nIHsKICAgICAgICAgIHdpZHRoOiAxMDAlOwogICAgICAgICAgaGVpZ2h0OiAxMDAlOwogICAgICAgIH0KICAgICAgICAjbGVmdG1lbnUsICN0b3Bsb2dvLCAjdG9wbWVudSB7CiAgICAgICAgICBkaXNwbGF5OiBub25lOwogICAgICAgIH0KICAgICAgICAjcmlnaHRjb2x1bW4gewogICAgICAgICAgbWFyZ2luOiAwcHggMTBweCAxMHB4IDBweDsKICAgICAgICB9CiAgICAgIGA7CiAgICAgICAgZG9jLmhlYWQuYXBwZW5kQ2hpbGQoZGV2U3R5bGUpOwogICAgICB9LAogICAgICB0cmFuc2Zvcm0gKGV2LCBjb250cm9sKSB7CiAgICAgICAgUlRMaXN0ZW5lcihldiwgewogICAgICAgICAgY29udHJvbCwKICAgICAgICAgIHRhcmdldDogdGhpcy5ib3VuZGluZywKICAgICAgICAgIGFuaW1hdGlvbkZyYW1lVXBkYXRlOiB0cnVlCiAgICAgICAgfSwgKHt0YXJnZXR9KSA9PiB7CiAgICAgICAgICB0aGlzLmJvdW5kaW5nID0gdGFyZ2V0OwogICAgICAgIH0pOwogICAgICB9LAogICAgfQogIH07CgogIC8qIHNjcmlwdCAqLwogIGNvbnN0IF9fdnVlX3NjcmlwdF9fJDEgPSBzY3JpcHQkMTsKCiAgLyogdGVtcGxhdGUgKi8KICB2YXIgX192dWVfcmVuZGVyX18kMSA9IGZ1bmN0aW9uKCkgewogICAgdmFyIF92bSA9IHRoaXM7CiAgICB2YXIgX2ggPSBfdm0uJGNyZWF0ZUVsZW1lbnQ7CiAgICB2YXIgX2MgPSBfdm0uX3NlbGYuX2MgfHwgX2g7CiAgICByZXR1cm4gX2MoCiAgICAgICJkaXYiLAogICAgICB7CiAgICAgICAgZGlyZWN0aXZlczogWwogICAgICAgICAgeyBuYW1lOiAic2hvdyIsIHJhd05hbWU6ICJ2LXNob3ciLCB2YWx1ZTogX3ZtLnNyYywgZXhwcmVzc2lvbjogInNyYyIgfQogICAgICAgIF0sCiAgICAgICAgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtd2luZG93IiwKICAgICAgICBzdHlsZTogX3ZtLnN0eWxlcwogICAgICB9LAogICAgICBbCiAgICAgICAgX2MoCiAgICAgICAgICAiZGl2IiwKICAgICAgICAgIHsKICAgICAgICAgICAgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtd2luZG93LS1oZWFkZXIiLAogICAgICAgICAgICBvbjogewogICAgICAgICAgICAgIG1vdXNlZG93bjogZnVuY3Rpb24oJGV2ZW50KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gX3ZtLnRyYW5zZm9ybSgkZXZlbnQsICJ4eSIpCiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgWwogICAgICAgICAgICBfYygic3BhbiIsIFtfdm0uX3YoIuWPr+aLluaLve+8jOWPs+S4i+WPr+e8qeaUviIpXSksCiAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICBfYygiaSIsIHsKICAgICAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi0tY2xvc2UiLAogICAgICAgICAgICAgIG9uOiB7CiAgICAgICAgICAgICAgICBjbGljazogZnVuY3Rpb24oJGV2ZW50KSB7CiAgICAgICAgICAgICAgICAgIHJldHVybiBfdm0uJGVtaXQoImNsb3NlIikKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pCiAgICAgICAgICBdCiAgICAgICAgKSwKICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICBfdm0uc3JjCiAgICAgICAgICA/IF9jKCJpZnJhbWUiLCB7CiAgICAgICAgICAgICAgcmVmOiAiaWZyYW1lIiwKICAgICAgICAgICAgICBhdHRyczogeyBzcmM6IF92bS5zcmMsIGZyYW1lYm9yZGVyOiAiMCIgfSwKICAgICAgICAgICAgICBvbjogeyBsb2FkOiBfdm0ub25sb2FkIH0KICAgICAgICAgICAgfSkKICAgICAgICAgIDogX3ZtLl9lKCksCiAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgX2MoImkiLCB7CiAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi13aW5kb3ctLXJlc2l6ZSIsCiAgICAgICAgICBvbjogewogICAgICAgICAgICBtb3VzZWRvd246IGZ1bmN0aW9uKCRldmVudCkgewogICAgICAgICAgICAgIHJldHVybiBfdm0udHJhbnNmb3JtKCRldmVudCwgInJiIikKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0pCiAgICAgIF0KICAgICkKICB9OwogIHZhciBfX3Z1ZV9zdGF0aWNSZW5kZXJGbnNfXyQxID0gW107CiAgX192dWVfcmVuZGVyX18kMS5fd2l0aFN0cmlwcGVkID0gdHJ1ZTsKCiAgICAvKiBzdHlsZSAqLwogICAgY29uc3QgX192dWVfaW5qZWN0X3N0eWxlc19fJDEgPSBmdW5jdGlvbiAoaW5qZWN0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AqLwogICAgY29uc3QgX192dWVfaXNfZnVuY3Rpb25hbF90ZW1wbGF0ZV9fJDEgPSBmYWxzZTsKICAgIC8qIHN0eWxlIGluamVjdCBTU1IgKi8KICAgIAogICAgLyogc3R5bGUgaW5qZWN0IHNoYWRvdyBkb20gKi8KICAgIAoKICAgIAogICAgY29uc3QgX192dWVfY29tcG9uZW50X18kMSA9IG5vcm1hbGl6ZUNvbXBvbmVudCgKICAgICAgeyByZW5kZXI6IF9fdnVlX3JlbmRlcl9fJDEsIHN0YXRpY1JlbmRlckZuczogX192dWVfc3RhdGljUmVuZGVyRm5zX18kMSB9LAogICAgICBfX3Z1ZV9pbmplY3Rfc3R5bGVzX18kMSwKICAgICAgX192dWVfc2NyaXB0X18kMSwKICAgICAgX192dWVfc2NvcGVfaWRfXyQxLAogICAgICBfX3Z1ZV9pc19mdW5jdGlvbmFsX3RlbXBsYXRlX18kMSwKICAgICAgX192dWVfbW9kdWxlX2lkZW50aWZpZXJfXyQxLAogICAgICBmYWxzZSwKICAgICAgY3JlYXRlSW5qZWN0b3IsCiAgICAgIHVuZGVmaW5lZCwKICAgICAgdW5kZWZpbmVkCiAgICApOwoKICAvLwogIC8vCiAgLy8KICAvLwogIC8vCiAgLy8KICAvLwogIC8vCiAgLy8KICAvLwogIC8vCiAgLy8KICAvLwoKICB2YXIgc2NyaXB0JDIgPSB7CiAgICBwcm9wczogewogICAgICB2aWRlbzogewogICAgICAgIHR5cGU6IE9iamVjdCwKICAgICAgICBkZWZhdWx0OiBudWxsCiAgICAgIH0KICAgIH0sCiAgICBtZXRob2RzOiB7CiAgICAgIHNob3dQcmV2aWV3ICgpIHsKICAgICAgICB0aGlzLiRlbWl0KCdzaG93LXByZXZpZXcnKTsKICAgICAgfQogICAgfQogIH07CgogIC8qIHNjcmlwdCAqLwogIGNvbnN0IF9fdnVlX3NjcmlwdF9fJDIgPSBzY3JpcHQkMjsKCiAgLyogdGVtcGxhdGUgKi8KICB2YXIgX192dWVfcmVuZGVyX18kMiA9IGZ1bmN0aW9uKCkgewogICAgdmFyIF92bSA9IHRoaXM7CiAgICB2YXIgX2ggPSBfdm0uJGNyZWF0ZUVsZW1lbnQ7CiAgICB2YXIgX2MgPSBfdm0uX3NlbGYuX2MgfHwgX2g7CiAgICByZXR1cm4gX2MoImRpdiIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtaXRlbSIgfSwgWwogICAgICBfYygiZGl2IiwgeyBzdGF0aWNDbGFzczogInRtLWphdi1pdGVtLS1pbm5lciIgfSwgWwogICAgICAgIF9jKCJpbWciLCB7CiAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi1pdGVtLS1jb3ZlciIsCiAgICAgICAgICBhdHRyczogeyBzcmM6IF92bS52aWRlby5pbWFnZSwgYWx0OiBfdm0udmlkZW8udGl0bGUsIHdpZHRoOiAiMTAwJSIgfQogICAgICAgIH0pLAogICAgICAgIF92bS5fdigiICIpLAogICAgICAgIF9jKCJkaXYiLCB7IHN0YXRpY0NsYXNzOiAicGxheS1idG4iLCBvbjogeyBjbGljazogX3ZtLnNob3dQcmV2aWV3IH0gfSksCiAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgX2MoImRpdiIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtaXRlbS0taW5mbyIgfSwgWwogICAgICAgICAgX2MoInNwYW4iLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LWl0ZW0tLWF2aWQiIH0sIFsKICAgICAgICAgICAgX3ZtLl92KF92bS5fcyhfdm0udmlkZW8uYXZpZCkpCiAgICAgICAgICBdKSwKICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgX2MoCiAgICAgICAgICAgICJhIiwKICAgICAgICAgICAgewogICAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LWl0ZW0tLXRpdGxlIiwKICAgICAgICAgICAgICBhdHRyczogewogICAgICAgICAgICAgICAgdGFyZ2V0OiAiX2JsYW5rIiwKICAgICAgICAgICAg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XHJcbiAgICAgIGJvcmRlci13aWR0aDogMnB4O1xyXG4gICAgICBib3JkZXItc3R5bGU6IHNvbGlkO1xyXG4gICAgICBib3JkZXItY29sb3I6IHdoaXRlO1xyXG4gICAgICBib3JkZXItaW1hZ2U6IGluaXRpYWw7XHJcbiAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XHJcbiAgICB9XHJcbiAgICAmOjphZnRlciB7XHJcbiAgICAgIGJvcmRlci13aWR0aDogLjNlbSAwIC4zZW0gLjRlbTtcclxuICAgICAgdG9wOiAuMmVtO1xyXG4gICAgICBsZWZ0OiAuMzVlbTtcclxuICAgICAgY29udGVudDogXCJcIjtcclxuICAgICAgcG9zaXRpb246IGFic29sdXRlO1xyXG4gICAgICBib3JkZXItc3R5bGU6IHNvbGlkO1xyXG4gICAgICBib3JkZXItY29sb3I6IHRyYW5zcGFyZW50IHdoaXRlO1xyXG4gICAgICBib3JkZXItaW1hZ2U6IGluaXRpYWw7XHJcbiAgICB9XHJcbiAgICAmOmhvdmVye1xyXG4gICAgICAmOjpiZWZvcmUge1xyXG4gICAgICAgIGJvcmRlci1jb2xvcjogI2ZmYTA0YztcclxuICAgICAgfVxyXG4gICAgICAmOjphZnRlciB7XHJcbiAgICAgICAgYm9yZGVyLWNvbG9yOiB0cmFuc3BhcmVudCAjZmZhMDRjO1xyXG4gICAgICB9XHJcbiAgICB9XHJcbiAgfVxyXG5cclxuICAmOmhvdmVyIC5wbGF5LWJ0biB7XHJcbiAgICBib3R0b206IDRweDtcclxuICB9XHJcblxyXG4gICY6aG92ZXIgJiB7XHJcbiAgICBib3gtc2hhZG93OiByZ2JhKDQ1LCA0NSwgNDUsIDAuMDUpIDBweCAycHggMnB4IDBweFxyXG4gICAgcmdiYSg0MiwgNDIsIDQyLCAwLjA1KSAwcHggOHB4IDhweCAwcHgsIFxyXG4gICAgcmdiYSgzMiwgMzIsIDMyLCAwLjA1KSAwcHggMTZweCAxNnB4IDBweCxcclxuICAgIHJnYmEoND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Xh0LCBhcmdzKTsKICAgICAgfQogICAgfQogIH0KCiAgZnVuY3Rpb24gcmVtb3ZlIChhcnIsIGl0ZW0pIHsKICAgIGlmIChhcnIubGVuZ3RoKSB7CiAgICAgIGNvbnN0IGluZGV4ID0gYXJyLmluZGV4T2YoaXRlbSk7CiAgICAgIGlmIChpbmRleCA+IC0xKSB7CiAgICAgICAgcmV0dXJuIGFyci5zcGxpY2UoaW5kZXgsIDEpCiAgICAgIH0KICAgIH0KICB9CgogIGZ1bmN0aW9uIGNyZWF0ZUxSVUNhY2hlIChMUlVTdG9yZSkgewogICAgcmV0dXJuIGZ1bmN0aW9uIExSVUNhY2hlIChrZXksIGNvbnRlbnQgPSBudWxsKSB7CiAgICAgIGNvbnN0IHtrZXlzLCBjYWNoZSwgbWF4fSA9IExSVVN0b3JlOwogICAgICBmdW5jdGlvbiBwdXNoS2V5ICgpIHsKICAgICAgICByZW1vdmUoa2V5cywga2V5KTsKICAgICAgICBrZXlzLnB1c2goa2V5KTsKICAgICAgfQogICAgICBpZiAoY29udGVudCkgewogICAgICAgIGNhY2hlW2tleV0gPSBjb250ZW50OwogICAgICAgIHB1c2hLZXkoKTsKICAgICAgICBpZiAobWF4ICYmIGtleXMubGVuZ3RoID4gcGFyc2VJbnQobWF4KSkgewogICAgICAgICAgY29uc3QgZmlyc3QgPSBrZXlzWzBdOwogICAgICAgICAgY2FjaGVbZmlyc3RdID0gbnVsbDsKICAgICAgICAgIHJlbW92ZShrZXlzLCBmaXJzdCk7CiAgICAgICAgfQogICAgICB9IGVsc2UgewogICAgICAgIHB1c2hLZXkoKTsKICAgICAgICByZXR1cm4gY2FjaGVba2V5XQogICAgICB9CiAgICB9CiAgfQoKICBmdW5jdGlvbiBzaW1pbGFyaXR5KHMxLCBzMiwgc3BsaXQgPSBmYWxzZSkgewogICAgZnVuY3Rpb24gZWRpdERpc3RhbmNlIChzMSwgczIpIHsKICAgICAgczEgPSBzMS50b0xvd2VyQ2FzZSgpOwogICAgICBzMiA9IHMyLnRvTG93ZXJDYXNlKCk7CgogICAgICBjb25zdCBjb3N0cyA9IG5ldyBBcnJheSgpOwogICAgICBmb3IgKGxldCBpID0gMDsgaSA8PSBzMS5sZW5ndGg7IGkrKykgewogICAgICAgIGxldCBsYXN0VmFsdWUgPSBpOwogICAgICAgIGZvciAobGV0IGogPSAwOyBqIDw9IHMyLmxlbmd0aDsgaisrKSB7CiAgICAgICAgICBpZiAoaSA9PT0gMCkgewogICAgICAgICAgICBjb3N0c1tqXSA9IGo7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBpZiAoaiA+IDApIHsKICAgICAgICAgICAgICB2YXIgbmV3VmFsdWUgPSBjb3N0c1tqIC0gMV07CiAgICAgICAgICAgICAgaWYgKHMxLmNoYXJBdChpIC0gMSkgIT0gczIuY2hhckF0KGogLSAxKSkgewogICAgICAgICAgICAgICAgbmV3VmFsdWUgPSBNYXRoLm1pbihNYXRoLm1pbihuZXdWYWx1ZSwgbGFzdFZhbHVlKSwgY29zdHNbal0pICsgMTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY29zdHNbaiAtIDFdID0gbGFzdFZhbHVlOwogICAgICAgICAgICAgIGxhc3RWYWx1ZSA9IG5ld1ZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChpID4gMCkgewogICAgICAgICAgY29zdHNbczIubGVuZ3RoXSA9IGxhc3RWYWx1ZTsKICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIGNvc3RzW3MyLmxlbmd0aF07CiAgICB9CgogICAgZnVuY3Rpb24gZG9TcGxpdE1vZGUgKHMxLCBzMil7IAogICAgICBsZXQgc3BsaXQxID0gczEuc3BsaXQoJyAnKTsKICAgICAgbGV0IHNwbGl0MiA9IHMyLnNwbGl0KCcgJyk7CiAgICAgIGxldCBzdW0gPSAwOyBsZXQgbWF4ID0gMDsgbGV0IHRlbXAgPSAwOyAKICAgICAgZm9yKGxldCBpPTA7IGkgPCBzcGxpdDEubGVuZ3RoO2krKykgeyAKICAgICAgICBtYXggPSAwOyAKICAgICAgICBmb3IobGV0IGo9MDsgaiA8IHNwbGl0Mi5sZW5ndGg7aisrKSB7IAogICAgICAgICAgdGVtcCA9IGdlblNpbWlsYXJpdHkoc3BsaXQxW2ldLCBzcGxpdDJbal0pOwogICAgICAgICAgaWYobWF4IDwgdGVtcCkgewogICAgICAgICAgICBtYXggPSB0ZW1wOwogICAgICAgICAgfSAgICAgfQogICAgICAgIHN1bSArPSBtYXggLyBzcGxpdDEubGVuZ3RoOyAKICAgICAgfQogICAgICByZXR1cm4gc3VtOwogICAgfQogICAgZnVuY3Rpb24gZ2VuU2ltaWxhcml0eSAoczEsIHMyKSB7CiAgICAgIGxldCBsb25nZXIgPSBzMTsKICAgICAgbGV0IHNob3J0ZXIgPSBzMjsKICAgICAgaWYgKHMxLmxlbmd0aCA8IHMyLmxlbmd0aCkgewogICAgICAgIGxvbmdlciA9IHMyOwogICAgICAgIHNob3J0ZXIgPSBzMTsKICAgICAgfQogICAgICBjb25zdCBsb25nZXJMZW5ndGggPSBsb25nZXIubGVuZ3RoOwogICAgICBpZiAobG9uZ2VyTGVuZ3RoID09IDApIHsKICAgICAgICByZXR1cm4gMS4wOwogICAgICB9CiAgICAgIHJldHVybiAobG9uZ2VyTGVuZ3RoIC0gZWRpdERpc3RhbmNlKGxvbmdlciwgc2hvcnRlcikpIC8gcGFyc2VGbG9hdChsb25nZXJMZW5ndGgpOwogICAgfQoKICAgIGlmIChzcGxpdCkgewogICAgICByZXR1cm4gZG9TcGxpdE1vZGUoczEsIHMyKQogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuIGdlblNpbWlsYXJpdHkoczEsIHMyKQogICAgfQogIH0KCiAgZnVuY3Rpb24gdG9NYXAgKGFyciwga2V5ID0gJ2lkJykgewogICAgcmV0dXJuIGFyci5yZWR1Y2UoKHIsIGMpID0+IHsKICAgICAgaWYgKGNba2V5XSkgewogICAgICA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ykpCiAgICAgICAgICApIHsKICAgICAgICAgICAgcmVtb3ZlKCk7CiAgICAgICAgICAgIGNvbnNvbGUubG9nKCdpZnJhbWU6bG9hZGVkJyk7CiAgICAgICAgICAgIHJlc29sdmUodHJ1ZSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXF1ZXN0QW5pbWF0aW9uRnJhbWUoY2hlY2spOwogICAgICAgICAgfQogICAgICAgIH0pOwogICAgICB9OwogICAgICBpZnJhbWUub25lcnJvciA9IChlKSA9PiB7CiAgICAgICAgcmVtb3ZlKCk7CiAgICAgICAgY29uc29sZS5sb2coJ2lmcmFtZTpvbmVycm9yJywgZSk7CiAgICAgICAgcmVqZWN0KGZhbHNlKTsKICAgICAgfTsKICAgICAgc2V0VGltZW91dChpZnJhbWUub25lcnJvciwgdGltZW91dCwgJ3RpbWVvdXQnKTsKICAgICAgaWZyYW1lLnN0eWxlPSJ3aWR0aDo2MDBweDtoZWlnaHQ6NDAwcHg7cG9zaXRpb246Zml4ZWQ7bGVmdDogLTk5OTk5OTk5OXB4O3RvcDogMDt6LWluZGV4OiAxMDAiOwogICAgICBkb2N1bWVudC5ib2R5Lmluc2VydEJlZm9yZShpZnJhbWUsIGRvY3VtZW50LmJvZHkuZmlyc3RDaGlsZCk7CiAgICAgIGlmcmFtZS5zcmMgPSBzcmM7CiAgICB9KQogIH0KCiAgZnVuY3Rpb24gZ2V0ICh1cmwsIG9wdGlvbnMgPSB7fSkgewogICAgcmV0dXJuIG5ldyBQcm9taXNlKGZ1bmN0aW9uIChyZXNvbHZlLCByZWplY3QpIHsKICAgICAgR01feG1saHR0cFJlcXVlc3QoewogICAgICAgIHVybCwKICAgICAgICBtZXRob2Q6ICdHRVQnLAogICAgICAgIC4uLm9wdGlvbnMsCiAgICAgICAgb25sb2FkOiAoZSkgPT4gewogICAgICAgICAgaWYgKGUuc3RhdHVzID09PSAyMDApIHsKICAgICAgICAgICAgcmVzb2x2ZShlKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGNvbnNvbGUubG9nKCdyZWplY3QnLCBlLnN0YXR1cyk7CiAgICAgICAgICAgIHJlamVjdChlKTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIG9uZXJyb3I6IChlKSA9PiB7CiAgICAgICAgICByZWplY3QoZSk7CiAgICAgICAgfQogICAgICB9KTsKICAgIH0pLmNhdGNoKChlKSA9PiB7CiAgICAgIGlmIChlLnN0YXR1cyA9PT0gNTAzKSB7CiAgICAgICAgcmV0dXJuIGZpeDUwMyh1cmwpLnRoZW4oKCkgPT4gZ2V0KHVybCwgb3B0aW9ucykpCiAgICAgIH0KICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KGUpCiAgICB9KQogIH0KCiAgZnVuY3Rpb24gZ2V0SFRNTCAodXJsLCBvcHRpb25zID0ge3BhcnNlOiB0cnVlfSkgewogICAgY29uc3Qge3BhcnNlfSA9IG9wdGlvbnM7CiAgICBsZXQgcmVxdWVzdCA9IGdldCh1cmwsIHtyZXNwb25zZVR5cGU6ICd0ZXh0J30pLnRoZW4oKHIpID0+IHIucmVzcG9uc2VUZXh0LCAoZSkgPT4gUHJvbWlzZS5yZWplY3QoZSkpOwoKICAgIGlmIChwYXJzZSkgewogICAgICByZXR1cm4gcmVxdWVzdC50aGVuKChodG1sKSA9PiB7CiAgICAgICAgcmV0dXJuIHBhcnNlSHRtbChodG1sKQogICAgICB9LCAoZSkgPT4gewogICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChlKQogICAgICB9KQogICAgfQoKICAgIHJldHVybiByZXF1ZXN0CiAgfQoKICBmdW5jdGlvbiBwb3N0ICh1cmwsIGRhdGEgPSB7fSwgb3B0aW9ucyA9IHt9KSB7CiAgICByZXR1cm4gbmV3IFByb21pc2UoZnVuY3Rpb24gKHJlc29sdmUsIHJlamVjdCkgewogICAgICBHTV94bWxodHRwUmVxdWVzdCh7CiAgICAgICAgdXJsLAogICAgICAgIG1ldGhvZDogJ1BPU1QnLAogICAgICAgIGRhdGEsCiAgICAgICAgcmVzcG9uc2VUeXBlOiAnanNvbicsCiAgICAgICAgLi4ub3B0aW9ucywKICAgICAgICBvbmxvYWQ6IChlKSA9PiB7CiAgICAgICAgICBpZiAoZS5zdGF0dXMgPT09IDIwMCkgewogICAgICAgICAgICByZXNvbHZlKGUpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmVqZWN0KGUpOwogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgb25lcnJvcjogKGUpID0+IHsKICAgICAgICAgIHJlamVjdChlKTsKICAgICAgICB9CiAgICAgIH0pOwogICAgfSkKICB9CgogIHZhciBIdHRwID0gewogICAgaW5zdGFsbCAoVnVlKSB7CiAgICAgIFZ1ZS5wcm90b3R5cGUuJGdldEhUTUwgPSBnZXRIVE1MOwogICAgICBWdWUucHJvdG90eXBlLiRnZXQgPSBnZXQ7CiAgICB9CiAgfTsKCiAgY29uc3QgbWFwID0gewogICAgc3RhcjogewogICAgICB1cmw6ICcvYWpheC9hamF4X2Zhdm9yaXRlYWRkX3N0YXIucGhwJywKICAgICAgdHlwZTogNAogICAgfQogIH07CgogIGZ1bmN0aW9uIGFkZEZhdiAoaWQsIF90eXBlKSB7CiAgICBjb25zdCB7dXJsLCB0eXBlfSA9IG1hcFtfdHlwZV07CiAgICByZXR1cm4gcG9zdCh1cmwsIHtpZCwgdHlwZX0pLnRoZW4oKHJlcykgPT4gewogICAgICBjb25zb2xlLmxvZyhyZXMucmVzcG9uc2UpOwogICAgICBpZiAocmVzLnJlc3BvbnNlLkVSUk9SID09PSAtMSkgewogICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdCgnYWxyZWFkeSBmYXYnKQogICAgICB9CiAgICAgIHJldHVybiByZXMucmVzcG9uc2UKICAgIH0pCiAgfQoKICBmdW5jdGlvbiBmaWxsTGlzdFVybCAoaWQsIHR5cGUpIHsKICAgIGNvbnN0IGZDaGFyID0gdHlwZVswXTsKICAgIGNvbnN0IHV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cmV2aWV3cycsIGtleTogJ2lkJywgY29sczogWydwcmV2aWV3SWQnLCAncHJldmlld0NvZGUnXX0gLy8gMDogbm9uZSBtYXRjaCwgMTogZ29vZ2xlIG1hdGNoLCAyOiBzbmFwc2hvdCBtYXRjaCwgNDogYWRkIHplcm8gbWF0Y2gsIDg6IHJlbW92ZSB6ZXJvIG1hdGNoCiAgICBdCiAgXTsKCiAgdmFyIGNvbmZpZyA9IHsKICAgIFZFUlNJT04sCiAgICBEQl9OQU1FLAogICAgVEFCTEVfREVGLAogIH07CgogIGZ1bmN0aW9uIERCICgpIHsKICAgIHRoaXMuZXJyb3JDb2RlID0gJyc7CiAgICB0aGlzLmRiID0gbnVsbDsKICB9CgogIGNvbnN0IHByb3RvID0gREIucHJvdG90eXBlOwoKICBwcm90by5zZXR1cCA9IGZ1bmN0aW9uIChkYk5hbWUsIHZlcnNpb24sIC4uLnRhYmxlRGVmcykgewogICAgdGhpcy5kYk5hbWUgPSBkYk5hbWU7CiAgICBjb25zdCByZXF1ZXN0ID0gd2luZG93LmluZGV4ZWREQi5vcGVuKGRiTmFtZSwgdmVyc2lvbik7CiAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4gewogICAgICByZXF1ZXN0Lm9uZXJyb3IgPSAoZXYpID0+IHsKICAgICAgICB0aGlzLmVycm9yQ29kZSA9IGV2LmVycm9yQ29kZTsKICAgICAgICByZWplY3QodGhpcyk7CiAgICAgIH07CgogICAgICByZXF1ZXN0Lm9uc3VjY2VzcyA9IChldikgPT4gewogICAgICAgIHRoaXMuZGIgPSBldi50YXJnZXQucmVzdWx0OwogICAgICAgIHJlc29sdmUodGhpcyk7CiAgICAgIH07CgogICAgICByZXF1ZXN0Lm9udXBncmFkZW5lZWRlZCA9IChldikgPT4gewogICAgICAgIHRoaXMuZGIgPSBldi50YXJnZXQucmVzdWx0OwogICAgICAgIHRoaXMuX2RlZlRhYmxlKHRhYmxlRGVmcykudGhlbigoKSA9PiB7CiAgICAgICAgICByZXNvbHZlKHRoaXMpOwogICAgICAgIH0sIChldikgPT4gewogICAgICAgICAgdGhpcy5lcnJvckNvZGUgPSBldi5lcnJvckNvZGU7CiAgICAgICAgICByZWplY3QodGhpcyk7CiAgICAgICAgfSk7CiAgICAgIH07CiAgICB9KQogIH07CgogIHByb3RvLnRyYW5zYWN0aW9uID0gZnVuY3Rpb24gKHRhYmxlcywgbW9kZSA9ICdyZWFkb25seScpIHsKICAgIGNvbnN0IHRyYW5zYWN0aW9uID0gdGhpcy5kYi50cmFuc2FjdGlvbih0YWJsZXMsIG1vZGUpOwogICAgY29uc3QgZ1RhYmxlID0gKHRhYmxlKSA9PiBuZXcgVGFibGUodGFibGUsIHRoaXMuZGIsIHRyYW5zYWN0aW9uKTsKCiAgICByZXR1cm4gZnVuY3Rpb24gcnVuVHJhbnNhY3Rpb24gKGhhbmRsZXIpIHsKICAgICAgcmV0dXJuIGhhbmRsZXIoZ1RhYmxlKQogICAgfQogIH07CgogIHByb3RvLl9kZWZUYWJsZSA9IGZ1bmN0aW9uICh0YWJsZXMpIHsKICAgIGNvbnN0IGV4aXN0VGFibGVzID0gWy4uLnRoaXMuZGIub2JqZWN0U3RvcmVOYW1lc10ucmVkdWNlKChyLCBjKSA9PiB7IHJbY10gPSB0cnVlOyByZXR1cm4gcjsgfSwge30pOwogICAgY29uc3QgYWxsVGFibGVUcmFuc2FjdGlvbiA9IFtdOwogICAgZm9yIChjb25zdCB0YWJsZSBvZiB0YWJsZXMpIHsKICAgICAgY29uc3Qge25hbWUsIGtleToga2V5UGF0aCwgaW5kZXhlc30gPSB0YWJsZTsKICAgICAgaWYgKGV4aXN0VGFibGVzW25hbWVdKSB7CiAgICAgICAgY29udGludWUKICAgICAgfQogICAgICBjb25zdCBvYmplY3RTdG9yZSA9IHRoaXMuZGIuY3JlYXRlT2JqZWN0U3RvcmUobmFtZSwgeyBrZXlQYXRoIH0pOwoKICAgICAgZm9yIChjb25zdCBpbmRleCBvZiA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FjdGlvbi5vYmplY3RTdG9yZSh0aGlzLm5hbWUpOwogICAgfSBlbHNlIHsKICAgICAgY29uc3QgbW9kZSA9IG1ldGhvZC5zdGFydHNXaXRoKCdnZXQnKSA/ICdyZWFkb25seScgOiAncmVhZHdyaXRlJzsKICAgICAgb2JqZWN0U3RvcmUgPSB0aGlzLmRiLnRyYW5zYWN0aW9uKHRoaXMubmFtZSwgbW9kZSkub2JqZWN0U3RvcmUodGhpcy5uYW1lKTsKICAgIH0KICAgIHJldHVybiBvYmplY3RTdG9yZVttZXRob2RdLmJpbmQob2JqZWN0U3RvcmUpCiAgfTsKCiAgVGFibGUucHJvdG90eXBlLl9hc3luY0V4ZWMgPSBmdW5jdGlvbiAobWV0aG9kLCAuLi5hcmdzKSB7CiAgICByZXR1cm4gbmV3IFByb21pc2UgKChyZXNvbHZlLCByZWplY3QpID0+IHsKICAgICAgY29uc3QgcmVxdWVzdEZuID0gdGhpcy5fdHJhbnNhY3Rpb25GbihtZXRob2QpOwoKICAgICAgaWYgKHR5cGVvZiByZXF1ZXN0Rm4gIT09ICdmdW5jdGlvbicpIHsKICAgICAgICByZWplY3QoYG1ldGhvZCAke21ldGhvZH0gaXMgSWxsZWdhbCBpbnZvY2F0aW9uYCk7CiAgICAgIH0gZWxzZSB7CiAgICAgICAgY29uc3QgcmVxdWVzdCA9IHJlcXVlc3RGbiguLi5hcmdzKTsKICAgICAgICByZXF1ZXN0Lm9uc3VjY2VzcyA9IGZ1bmN0aW9uIChldmVudCkgewogICAgICAgICAgcmVzb2x2ZShldmVudC50YXJnZXQucmVzdWx0KTsKICAgICAgICB9OwogICAgICAgIHJlcXVlc3Qub25lcnJvciA9IGZ1bmN0aW9uIChldmVudCkgewogICAgICAgICAgcmVqZWN0KGV2ZW50KTsKICAgICAgICB9OwogICAgICB9CiAgICB9KQogIH07CgogIGxldCBkYkluc3RhbmNlID0gbnVsbDsKICBhc3luYyBmdW5jdGlvbiBnZXREQkluc3RhbmNlICgpIHsKICAgIG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ID0gbnVsbDsKICAgIGZvciAoY29uc3QgZmlyc3RBTGluayBvZiBbLi4uZmlyc3RBTGlua3NdKSB7CiAgICAgIGNvbnN0IGxpbmsgPSBmaXJzdEFMaW5rLnBhdGhuYW1lOwogICAgICBjb25zdCB0aXRsZUVsID0gZmlyc3RBTGluay5xdWVyeVNlbGVjdG9yKCdoMycpOwogICAgICBjb25zdCByZXN1bHRUaXRsZSA9ICh0aXRsZUVsID8gdGl0bGVFbC5pbm5lclRleHQgOiAnJykucmVwbGFjZSgn44Ki44OA44Or44OIRFZE44O744OW44Or44O844Os44KkJywgJycpOwogICAgICBjb25zdCB0aXRsZVNpbWlsYXJpdHkgPSBnZXRTaW1pbGFyaXR5KGF2VGl0bGUsIHJlc3VsdFRpdGxlKTsKICAgICAgaWYgKHRpdGxlU2ltaWxhcml0eSA8IDAuNSkgewogICAgICAgIGxvZy5tc2coYOagh+mimOOAkOS4jeOAkeWMuemFjTogJyR7cmVzdWx0VGl0bGV9Jywg55u45Ly85bqmOiAke3RpdGxlU2ltaWxhcml0eX1gKTsKICAgICAgICBjb250aW51ZQogICAgICB9CiAgICAgIGxvZy5tc2coYOagh+mimOOAkOWMuemFjeOAkTogJyR7cmVzdWx0VGl0bGV9Jywg55u45Ly85bqmOiAke3RpdGxlU2ltaWxhcml0eX1gKTsKICAgICAgc25hcHNob3RMaW5rID0gZmlyc3RBTGluay5uZXh0RWxlbWVudFNpYmxpbmcucXVlcnlTZWxlY3RvcignLmFjdGlvbi1tZW51LWl0ZW0uYWJfZHJvcGRvd25pdGVtIGEnKTsKICAgICAgc25hcHNob3RMaW5rID0gc25hcHNob3RMaW5rICYmIHNuYXBzaG90TGluay5ocmVmOwogICAgICBwcmV2aWV3SWQgPSBnZXRDaWQobGluayk7CiAgICAgIGJyZWFrCiAgICB9CiAgICBpZiAocHJldmlld0lkKSB7CiAgICAgIHJldHVybiB7cHJldmlld0lkLCB2aWRlbywgc25hcHNob3RMaW5rfQogICAgfQogICAgcmV0dXJuIFByb21pc2UucmVqZWN0KG5ldyBFcnJvcihg6Kej5p6Q5aSx6LSlLCBVUkw6ICcke3NlYXJjaFVybH0nYCkpCiAgfQoKICBmdW5jdGlvbiBnZW5QcmVsb2FkVGVzdCAocHJldmlld0NvZGUsIHZpZGVvKSB7CiAgICBmdW5jdGlvbiBnZW5aZXJvSWQgKHByZXZJZCkgewogICAgICBsZXQgbmV4dElkID0gJyc7CiAgICAgIGNvbnN0IHJlZyA9IG5ldyBSZWdFeHAoYC4qJHt2aWRlby5wcmVmaXh9KDArPykke3ZpZGVvLm51bWJlcn1gLCAnaScpOwogICAgICBjb25zdCB6ZXJvID0gcHJldklkLnJlcGxhY2UocmVnLCAobSwgbTEpID0+IG0xKTsKICAgICAgaWYgKHplcm8gIT09IHByZXZJZCkgewogICAgICAgIG5leHRJZCA9IHByZXZJZC5yZXBsYWNlKHplcm8sICcnKTsKICAgICAgfSBlbHNlIHsKICAgICAgICBjb25zdCBhZGRaZXJvID0gYDAwMDAwJHt2aWRlby5udW1iZXJ9YC5zbGljZSgtNSk7CiAgICAgICAgbmV4dElkID0gcHJldklkLnJlcGxhY2UodmlkZW8ubnVtYmVyLCBhZGRaZXJvKTsKICAgICAgfQogICAgICByZXR1cm4gbmV4dElkCiAgICB9CiAgICByZXR1cm4gZnVuY3Rpb24gcHJlbG9hZFRlc3QgKHBheWxvYWQsIGxvZykgewogICAgICBsZXQge3ByZXZpZXdJZH0gPSBwYXlsb2FkIHx8IHt9OwogICAgICBpZiAoIXByZXZpZXdJZCkgewogICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdCh7Li4ucGF5bG9hZCwgZXJyb3I6IG5ldyBFcnJvcihgRU1QVFkgcHJldmlld0lkYCl9KQogICAgICB9CiAgICAgIGlmICgKICAgICAgICBbCiAgICAgICAgICBQUkVWSUVXX0NPREUuR09PR0xFX1pFUk8sIAogICAgICAgICAgUFJFVklFV19DT0RFLlNOQVBTSE9UX1pFUk8sCiAgICAgICAgICAvLyBmb3Iga3VtIHByZWZpeAogICAgICAgICAgUFJFVklFV19DT0RFLklORk9fSU1BR0UKICAgICAgICBdCiAgICAgICAgLmluY2x1ZGVzKHByZXZpZXdDb2RlKQogICAgICApIHsKICAgICAgICBwcmV2aWV3SWQgPSBnZW5aZXJvSWQocHJldmlld0lkKTsKICAgICAgfQogICAgICBjb25zdCBwYXRoID0gcHJldmlld0lkLnJlcGxhY2UoLygoKFx3KVx3XHcpLiopLywgJyQzLyQyLyQxLyQxJyk7CiAgICAgIGNvbnN0IHVybCA9IHVybFByZWZpeCArIHBhdGggKyAnX3NtX3cubXA0JzsKICAgICAgbG9nLm1zZyhg5bCd6K+V5Yqg6L29IHVybCAuLi4gOiAke3VybH1gKTsKICAgICAgcmV0dXJuIGdldCh1cmwpLnRoZW4oKCkgPT4gewogICAgICAgIHJldHVybiB7cHJldmlld0lkLCBwcmV2aWV3Q29kZX0KICAgICAgfSwgKGVycm9yKSA9PiB7CiAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KHsuLi5wYXlsb2FkLCBlcnJvcn0pCiAgICAgIH0pCiAgICB9CiAgfQoKICBmdW5jdGlvbiBwYXJzZUZyb21TbmFwc2hvdCAocGF5bG9hZCkgewogICAgY29uc3QgeyBzbmFwc2hvdExpbmsgfSA9IHBheWxvYWQ7CiAgICByZXR1cm4gZ2V0SFRNTChzbmFwc2hvdExpbmspLnRoZW4oKGRvbSkgPT4gewogICAgICBjb25zdCBsaW5rID0gZG9tLmJvZHkucXVlcnlTZWxlY3RvcignLmFyZWEtZWRpdGlvbiAuZWRpdGlvbjpub3QoLmxpbWl0ZWQpJyk7CiAgICAgIGNvbnN0IHByZXZpZXdJZCA9IGxpbmsgPyBnZXRDaWQobGluay5wYXRobmFtZSkgOiAnJzsKICAgICAgcmV0dXJuIHsuLi5wYXlsb2FkLCBwcmV2aWV3SWR9CiAgICB9KQogIH0KCiAgZnVuY3Rpb24gcHJlaXZld1Jlc29sdXRpb24gKHZpZGVvLCBpbmZvUH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GVsIGV4dGVuZHMgTW9kZWwgewogICAgY29uc3RydWN0b3IgKCkgewogICAgICBzdXBlcignZ2VucmVzJyk7CiAgICB9CiAgICAKICAgIGFzeW5jIGdldEZyb21SZW1vdGUgKCkgewogICAgICByZXR1cm4gZ2V0SFRNTChDb25maWcuVVJMKQogICAgICAudGhlbigoZG9tKSA9PiB7CiAgICAgICAgY29uc3QgZ2VucmVzID0gcGFyc2VHZW5yZXMoZG9tLmJvZHkpOwogICAgICAgIHJldHVybiBnZW5yZXMKICAgICAgfSkKICAgIH0KCiAgICBwcm9jZXNzRGF0YSAoZ2VucmVzKSB7CiAgICAgIGNvbnN0IHRyZWVPYmogPSBnZW5yZXMucmVkdWNlKCh0cmVlLCBnZW5yZSkgPT4gewogICAgICAgIGNvbnN0IHtpZCwgbmFtZSwgdHlwZSA9ICdUTS1KQVYtTkVXJ30gPSBnZW5yZTsKICAgICAgICBpZiAoIXRyZWVbdHlwZV0pIHsKICAgICAgICAgIHRyZWVbdHlwZV0gPSB7dHlwZSwgZ2VucmVzOiBbXX07CiAgICAgICAgfQogICAgICAgIHRyZWVbdHlwZV0uZ2VucmVzLnB1c2goe2lkLCBuYW1lfSk7CiAgICAgICAgcmV0dXJuIHRyZWUKICAgICAgfSwge30pOwogICAgCiAgICAgIHJldHVybiBPYmplY3Qua2V5cyh0cmVlT2JqKS5tYXAoayA9PiB0cmVlT2JqW2tdKQogICAgfQogIH0KCiAgdmFyIGdlbnJlc01vZGVsID0gbmV3IEdlbnJlc01vZGVsKCk7CgogIGNsYXNzIFRlbXBsYXRlc01vZGVsIGV4dGVuZHMgTW9kZWwgewogICAgY29uc3RydWN0b3IgKCkgewogICAgICBzdXBlcigndGVtcGxhdGVzJywgJ3ByZWZpeCcpOwogICAgfQogIH0KCiAgdmFyIHRlbXBsYXRlc01vZGVsID0gbmV3IFRlbXBsYXRlc01vZGVsKCk7CgogIGNvbnN0IERldGFpbHMgPSB7CiAgICBOQU1FOiAnZGV0YWlscycsCiAgfT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5nOiBmYWxzZSwKICAgICAgICBmaWxsRXJyb3I6IGZhbHNlLAogICAgICAgIGRkb3M6IHsKICAgICAgICAgIHN0YXR1czogZmFsc2UsCiAgICAgICAgICBjdXJyVGltZTogNSwKICAgICAgICAgIG1heFRpbWU6IDUsCiAgICAgICAgICB0aW1lcjogbnVsbAogICAgICAgIH0sCiAgICAgICAgcGFnZXM6IGdlbkRlZmF1bHRQYWdlcygpCiAgICAgIH0KICAgIH0sCiAgICBwcm9wczogewogICAgICB0YWI6IHsKICAgICAgICBkZWZhdWx0OiBudWxsCiAgICAgIH0sCiAgICB9LAogICAgY29tcHV0ZWQ6IHsKICAgICAgaGFzTmV4dCAoKSB7CiAgICAgICAgcmV0dXJuIHRoaXMudGFiICYmIHRoaXMudGFiLm5leHQgIT09IGZhbHNlICYmICF0aGlzLnBhZ2VzLnNob3cgJiYgdGhpcy5wYWdlcy5uZXh0CiAgICAgIH0KICAgIH0sCiAgICB3YXRjaDogewogICAgICB0YWI6IHsKICAgICAgICBpbW1lZGlhdGU6IHRydWUsCiAgICAgICAgaGFuZGxlciAodmFsLCBvbGQpIHsKICAgICAgICAgIGlmIChvbGQpIHsKICAgICAgICAgICAgdGhpcy5jYWNoZVRhYihvbGQpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHZhbCkgewogICAgICAgICAgICB0aGlzLm9uVGFiQ2hhbmdlKHZhbCwgb2xkKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgIH0sCiAgICBtZXRob2RzOiB7CiAgICAgIGluRERvUyAoKSB7CiAgICAgICAgaWYgKHRoaXMuZGRvcy50aW1lcikgewogICAgICAgICAgcmV0dXJuIHRydWUKICAgICAgICB9CiAgICAgICAgdGhpcy5kZG9zLnN0YXR1cyA9IGRvY3VtZW50LnRpdGxlID09PSAnSnVzdCBhIG1vbWVudC4uLic7CiAgICAgICAgaWYgKHRoaXMuZGRvcy5zdGF0dXMpIHsKICAgICAgICAgIHRoaXMuZGRvcy5jdXJyVGltZSA9IHRoaXMuZGRvcy5tYXhUaW1lOwoKICAgICAgICAgIHRoaXMuZGRvcy50aW1lciA9IHNldEludGVydmFsKCgpID0+IHsKICAgICAgICAgICAgdGhpcy5kZG9zLmN1cnJUaW1lLS07CiAgICAgICAgICAgIGlmICghdGhpcy5kZG9zLmN1cnJUaW1lKSB7CiAgICAgICAgICAgICAgY2xlYXJJbnRlcnZhbCh0aGlzLmRkb3MudGltZXIpOwogICAgICAgICAgICAgIHRoaXMuZGRvcy50aW1lciA9IG51bGw7CiAgICAgICAgICAgICAgbG9jYXRpb24ucmVsb2FkKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0sIDEwMDApOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpcy5kZG9zLnN0YXR1cyAvLyBjZl9jbGVhcmFuY2UKICAgICAgfSwKICAgICAgc3dpdGNoTG9hZE1vZGUgKCkgewogICAgICAgIGNvbnN0IHN0YXR1cyA9ICF0aGlzLnBhZ2VzLnNob3c7CiAgICAgICAgaWYgKHN0YXR1cykgewogICAgICAgICAgY29uc3QgdXJsID0gdGhpcy5nZW5QYWdlVXJsKHRoaXMucGFnZXMuY3Vycik7CiAgICAgICAgICB0aGlzLmdldENvbnRlbnQodXJsLCBzdGF0dXMpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB0aGlzLnBhZ2VzLmN1cnIgPSAxOwogICAgICAgICAgdGhpcy5nZXRDb250ZW50KHRoaXMudGFiLmhyZWYpOwogICAgICAgIH0KICAgICAgICAKICAgICAgICB0aGlzLnBhZ2VzLnNob3cgPSBzdGF0dXM7CiAgICAgIH0sCiAgICAgIG9uVGFiQ2hhbmdlICh0YWIsIG9sZCkgewogICAgICAgIGNvbnN0IGNhY2hlZCA9IExpc3RMUlVDYWNoZSh0YWIuaHJlZik7CiAgICAgICAgaWYgKGNhY2hlZCAmJiBjYWNoZWQubGlzdC5sZW5ndGgpIHsKICAgICAgICAgIHRoaXMubGlzdCA9IGNhY2hlZC5saXN0OwogICAgICAgICAgdGhpcy5wYWdlcyA9IGNhY2hlZC5wYWdlczsKICAgICAgICB9IGVsc2UgaWYgKCF0aGlzLmluRERvUygpKSB7CiAgICAgICAgICB0aGlzLmdldENvbnRlbnQodGFiLmhyZWYpOwogICAgICAgICAgdGhpcy5wYWdlcy5jdXJyID0gMTsKICAgICAgICB9CiAgICAgICAgCiAgICAgICAgaWYgKHRoaXMuJHJlZnNbJ3Njcm9sbC13cmFwcGVyJ10pIHsKICAgICAgICAgIHRoaXMuJHJlZnNbJ3Njcm9sbC13cmFwcGVyJ10uc2Nyb2xsVG9wID0gY2FjaGVkID8gY2FjaGVkLnNjcm9sbFRvcCA6IDA7CiAgICAgICAgfQogICAgICB9LAogICAgICBjYWNoZVRhYiAodGFiKSB7CiAgICAgICAgaWYgKCF0aGlzLmxpc3QubGVuZ3RoKSB7cmV0dXJufQogICAgICAgIGNvbnN0IHNjcm9sbCA9IHRoaXMuJHJlZnNbJ3Njcm9sbC13cmFwcGVyJ107CiAgICAgICAgTGlzdExSVUNhY2hlKHRhYi5ocmVmLCB7CiAgICAgICAgICBsaXN0OiB0aGlzLmxpc3QsCiAgICAgICAgICBwYWdlczogdGhpcy5wYWdlcywKICAgICAgICAgIHNjcm9sbFRvcDogc2Nyb2xsICYmIHNjcm9sbC5zY3JvbGxUb3AsCiAgICAgICAgfSk7CiAgICAgIH0sCiAgICAgIGdldENvbnRlbnQgKGhyZWYsIHBhZ2VTdGF0dXMgPSBmYWxzZSkgewogICAgICAgIHRoaXMubG9hZGluZyA9IHRydWU7CiAgICAgICAgdGhpcy5saXN0ID0gW107CiAgICAgICAgcXVlcnlWaWRlb0xpc3QoaHJlZikKICAgICAgICAudGhlbigoe2xpc3QsIHBhZ2VzfSkgPT4gewogICAgICAgICAgdGhpcy5saXN0ID0gbGlzdDsKICAgICAgICAgIHRoaXMucGFnZXMgPSBwYWdlczsKICAgICAgICAgIHRoaXMucGFnZXMuc2hvdyA9IHBhZ2VTdGF0dXM7CiAgICAgICAgICB0aGlzLmZpbGxMaXN0KCk7CiAgICAgICAgfSwgKCkgPT4gewogICAgICAgICAgdGhpcy5saXN0ID0gW107CiAgICAgICAgfSkuZmluYWxseSgoKSA9PiB7CiAgICAgICAgICB0aGlzLmxvYWRpbmcgPSBmYWxzZTsKICAgICAgICB9KTsKICAgICAgfSwKICAgICAgZ2VuUGFnZVVybCAocGFnZSA9IDApIHsKICAgICAgICBpZiAoIXBhZ2UpIHtwYWdlID0gKyt0aGlzLnBhZ2VzLmN1cnI7fQogICAgICAgIGNvbnN0IGhhc1EgPSAvXD8vLnRlc3QodGhpcy50YWIuaHJlZik7CiAgICAgICAgY29uc3QgdXJsID0gdGhpcy50YWIuaHJlZiArIGAke2hhc1EgPyAnJicgOiAnPyd9cGFnZT0ke3BhZ2V9YDsKICAgICAgICByZXR1cm4gdXJsCiAgICAgIH0sCiAgICAgIHRvUGFnZSAocCkgewogICAgICAgIGNvbnN0IHVybCA9IHRoaXMuZ2VuUGFnZVVybChwKTsKICAgICAgICB0aGlzLmdldENvbnRlbnQodXJsLCB0cnVlKTsKICAgICAgfSwKICAgICAgcXVlcnlOZXh0ICgpIHsKICAgICAgICBjb25zdCB1cmwgPSB0aGlzLmdlblBhZ2VVcmwoKTsKICAgICAgICByZXR1cm4gcXVlcnlWaWRlb0xpc3QodXJsKQogICAgICAgIC50aGVuKCh7bGlzdCwgcGFnZXN9KSA9PiB7CiAgICAgICAgICB0aGlzLnBhZ2VzID0gcGFnZXM7CiAgICAgICAgICB0aGlzLmxpc3QgPSB0aGlzLmxpc3QuY29uY2F0KGxpc3QpOwogICAgICAgICAgdGhpcy5maWxsTGlzdCgpOwogICAgICAgIH0pLmZpbmFsbHkoKCkgPT4gewogICAgICAgICAgdGhpcy5sb2FkaW5nID0gZmFsc2U7CiAgICAgICAgfSkKICAgICAgfSwKICAgICAgZmlsbExpc3QgKCkgewogICAgICAgIGlmICghdGhpcy5oYXNOZXh0KSB7CiAgICAgICAgICByZXR1cm4KICAgICAgICB9CiAgICAgICAgdGhpcy4kbmV4dFRpY2soKQogICAgICAgIC50aGVuKCgpID0+IHsKICAgICAgICAgIGlmICghdGhpcy5maWxsRXJyb3IgJiYgdGhpcy5pc1Njcm9sbEVuZCgpKSB7CiAgICAgICAgICAgIHRoaXMucXVlcnlOZXh0KCkuY2F0Y2goKCkgPT4gewogICAgICAgICAgICAgIHRoaXMuZmlsbEVycm9yID0gdHJ1ZTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICB9CiAgICAgICAgfSk7CiAgICAgIH0sCiAgICAgIHNob3dQcmV2aWV3ICh2aWRlbykgewogICAgICAgIGNvbnN0IGkgPSBnZXRWaWRlb0RldGFpbCh2aWRlbyk7CiAgICAgICAgaS50aGVuKCh7aW5mb3MsIGZhdm9yaXRlLCBpbWFnZXN9KSA9PiB7CiAgICAgICAgICB2aWRlby5pbmZvcyA9IGluZm9zOyAKICAgICAgICAgIHZpZGVvLmZhdm9yaXRlID0gZmF2b3JpdGU7CiAgICAgICAgICB2aWRlby5pbWFnZXMgPSBpbWFnZXM7CiAgICAgICAgICB2aWRlby5sb2FkZWQuZGV0YWlsID0gdHJ1ZTsKICAgICAgICAgIHRoaXMuJGVtaXQoJ3NlbGVjdCcsIHZpZGVvKTsKICAgICAgICAgIHJldHVybiB2aWRlbwogICAgICAgIH0pLmNhdGNoKChlKSA9PiB7CiAgICAgICAgICBjb25zb2xlLmxvZygn5Yqg6L295aSx6LSlOicsIGUpOwogICAgICAgICAgdmlkZW8ubG9hZGVkLmRldGFpbCA9IGZhbHNlOwogICAgICAgIH0pOwogICAgICAgIHZpZGVvLmVycm9yID0gJyc7CiAgICAgICAgY29uc3QgcyA9IGdldFZpZGVvUHJldmlldyh2aWRlbywgaSkudGhlbigocHJldmlld0lkKSA9PiB7CiAgICAgICAgICBpZiAocHJldmlld0lkKSB7CiAgICAgICAgICAgIHZpZGVvLnByZXZpZXdJZCA9IHByZXZpZXdJZDsKICAgICAgICAgICAgdmlkZW8ubG9hZGVkLnByZXZpZXcgPSB0cnVlOwogICAgICAgICAgICB0aGlzLiRlbWl0KCdzZWxlY3QnLCB2aWRlbyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB2aWRlby5lcnJvciA9ICfliqDovb3lpLHotKXvvIzor7fmn6XnnIvml6Xlv5cnOwogICAgICAgICAgfQogICAgICAgIH0pLmNhdGNoKChlKSA9PiB7CiAgICAgICAgICBjb25zb2xlLmxvZygn5Yqg6L295aSx6LSlOicsIGUpOwogICAgICAgICAgdmlkZW8uZXJyb3IgPSAn5Yqg6L295aSx6LSl77yM6K+35p+l55yL5pel5b+XJzsKICAgICAgICB9KTsKICAgICAgICAKICAgICAgICB0aGlzLiRlbWl0KCdzZWxlY3QnLCB2aWRlbyk7CiAgICAgICAgUHJvbWlzZS5hbGwoW3MsIGldKS50aGVuKCgpID0+IHsKICAgICAgICAgIGNvbnNvbGUubG9nKHZpZGVvKTsKICAgICAgICB9KTsKICAgICAgfSwKICAgICAgaXNTY3JvbGxFbmQgKCkgewogICAgICAgIGNvbnN0IHQgPSB0aGlzLiRyZWZzWydzY3JvbGwtd3JhcHBlciddOwogICAgICAgIGlmICghdCkge3JldHVybiBmYWxzZX0KICAgICAgICByZXR1cm4gdC5zY3JvbGxIZWlnaHQgLSB0LmNsaWVudEhlaWdodCAtIDIwIDwgdC5zY3JvbGxUb3AKICAgICAgfSwKICAgICAgb25TY3JvbGw6IHRocm90dGxlKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgaWYgKCF0aGlzLmhhc05leHQgfHwgZS5kZWx0YVkgPCAwKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2UKICAgICAgICB9CgogICAgICAgIGlmICh0aGlzLmlzU2Nyb2xsRW5kKCkgJiYgIXRoaXMubG9hZGluZykgewogICAgICAgICAgdGhpcy5sb2FkaW5nID0gdHJ1ZTsKICAgICAgICAgIHRoaXMucXVlcnlOZXh0KCk7CiAgICAgICAgfQogICAgICB9LCAxNikKICAgIH0KICB9OwoKICAvKiBzY3JpcHQgKi8KICBjb25zdCBfX3Z1ZV9zY3JpcHRfXyQzID0gc2NyaXB0JDM7CgogIC8qIHRlbXBsYXRlICovCiAgdmFyIF9fdnVlX3JlbmRlcl9fJDMgPSBmdW5jdGlvbigpIHsKICAgIHZhciBfdm0gPSB0aGlzOwogICAgdmFyIF9oID0gX3ZtLiRjcmVhdGVFbGVtZW50OwogICAgdmFyIF9jID0gX3ZtLl9zZWxmLl9jIHx8IF9oOwogICAgcmV0dXJuIF9jKCJkaXYiLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LWxpc3QiIH0sIFsKICAgICAgX3ZtLmRkb3Muc3RhdHVzCiAgICAgICAgPyBfYygiZGl2IiwgeyBzdGF0aWNDbGFzczogInRtLWphdi1saXN0LS1kZG9zIiB9LCBbCiAgICAgICAgICAgIF92bS5fbSgwKSwKICAgICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICAgIF9jKCJoMSIsIFtfdm0uX3YoX3ZtLl9zKF92bS5kZG9zLmN1cnJUaW1lKSArICLnp5IgLi4uICIpXSksCiAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICBfYygiaDEiLCBbX3ZtLl92KCJqYXZsaWJyYXJ5LmNvbSDmraPlnKjov5vooYwgRERvUyDpmLLmiqQiKV0pLAogICAgICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICAgICAgX2MoImg0IiwgWwogICAgICAgICAgICAgIF92bS5fdigKICAgICAgICAgICAgICAgICLmraTkuLroh6rov5DooYznqIvluo/vvIzmnIDplb/kuI3otoXov4c156eS77yM5L2g55qE5rWP6KeI5Zmo5Lya6Ieq5Yqo5Yqg6L29IGphdmxpYnJhcnkuY29tIOWGheWuuSIKICAgICAgICAgICAgICApCiAgICAgICAgICAgIF0pLAogICAgICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICAgICAgX2MoImg0IiwgW192bS5fdigi5aaC5p6c5rKh5pyJ6Lez6L2s77yM6K+36Ieq6KGM5Yi35pawIildKQogICAgICAgICAgXSkKICAgICAgICA6IF9jKAogICAgICAgICAgICAiZGl2IiwKICAgICAgICAgICAgewogICAgICAgICAgICAgIHJlZjogInNjcm9sbC13cmFwcGVyIiwKICAgICAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi1saXN0LS13cmFwcGVyIiwKICAgICAgICAgICAgICBvbjogewogICAgICAgICAgICAgICAgc2Nyb2xsOiBmdW5jdGlvbigkZXZlbnQpIHsKICAgICAgICAgICAgICAgICAgJGV2ZW50LnN0b3BQcm9wYWdhdGlvbigpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG1vdXNld2hlZWw6IF92bS5vblNjcm9sbAogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgWwogICAgICAgICAgICAgIF9jKAogICAgICAgICAgICAgICAgImRpdiIsCiAgICAgICAgICAgICAgICB7IHN0YXRpY0NsYXNzOiAidG0tamF2LWxpc3QtLXNjcm9sbCIgfSwKICAgICAgICAgICAgICAgIF92bS5fbChfdm0ubGlzdCwgZnVuY3Rpb24odmlkZW8pIHsKICAgICAgICAgICAgICAgICAgcmV0dXJuIF9jKCJ0bS1pdGVtIiwgewogICAgICAgICAgICAgICAgICAgIGtleTogdmlkZW8uaHJlZiwKICAgICAgICAgICAgICAgICAgICBhdHRyczogeyB2aWRlbzogdmlkZW8gfSwKICAgICAgICAgICAgICAgICAgICBvbjogewogICAgICAgICAgICAgICAgICAgICAgInNob3ctcHJldmlldyI6IGZ1bmN0aW9uKCRldmVudCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3ZtLnNob3dQcmV2aWV3KHZpZGVvKQogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICksCiAgICAgICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICAgICAgX2MoCiAgICAgICAgICAgICAgICAiZGl2IiwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgZGlyZWN0aXZlczogWwogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICJzaG93IiwKICAgICAgICAgICAgICAgICAgICAgIHJhd05hbWU6ICJ2LXNob3ciLAogICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IF92bS5sb2FkaW5nLAogICAgICAgICAgICAgICAgICAgICAgZXhwcmVzc2lvbjogImxvYWRpbmciCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi1saXN0LS1sb2FkaW5nIiwKICAgICAgICAgICAgICAgICAgY2xhc3M6IHsgInRtLWphdi1saXN0LS1sb2FkaW5nLXBhZ2VzIjogX3ZtLnBhZ2VzLnNob3cgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIFtfdm0uX20oMSldCiAgICAgICAgICAgICAgKQogICAgICAgICAgICBdCiAgICAgICAgICApLAogICAgICBfdm0uX3YoIiAiKSwKICAgICAgX2MoCiAgICAgICAgImRpdiIsCiAgICAgICAgewogICAgICAgICAgZGlyZWN0aXZlczogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgbmFtZTogInNob3ciLAogICAgICAgICAgICAgIHJhd05hbWU6ICJ2LXNob3ciLAogICAgICAgICAgICAgIHZhbHVlOiBfdm0ucGFnZXMubGVuZ3RoLAogICAgICAgICAgICAgIGV4cHJlc3Npb246ICJwYWdlcy5sZW5ndGgiCiAgICAgICAgICAgIH0KICAgICAgICAgIF0sCiAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi1saXN0LS1zd2l0Y2giCiAgICAgICAgfSwKICAgICAgICBbCiAgICAgICAgICBfYygic3BhbiIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtbGlzdC0tc3dpdGNoLWRlZmF1bHQiIH0sIFsKICAgICAgICAgICAgX3ZtLl92KCLlvZPliY3kuLoiICsgX3ZtLl9zKF92bS5wYWdlcy5zaG93ID8gIuWIh+mhtSIgOiAi5rua5YqoIikgKyAi5qih5byPIikKICAgICAgICAgIF0pLAogICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICBfYygKICAgICAgICAgICAgInNwYW4iLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtbGlzdC0tc3dpdGNoLWhvdmVyIiwKICAgICAgICAgICAgICBvbjogeyBjbGljazogX3ZtLnN3aXRjaExvYWRNb2RlIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgWwogICAgICAgICAgICAgIF92bS5fdigKICAgICAgICAgICAgICAgICLngrnlh7vliIfmjaLkuLoiICsgX3ZtLl9zKF92bS5wYWdlcy5zaG93ID8gIua7muWKqCIgOiAi5YiH6aG1IikgKyAi5qih5byPIgogICAgICAgICAgICAgICkKICAgICAgICAgICAgXQogICAgICAgICAgKQogICAgICAgIF0KICAgICAgKSwKICAgICAgX3ZtLl92KCIgIiksCiAgICAgIF92bS5wYWdlcy5sZW5ndGggJiYgX3ZtLnBhZ2VzLnNob3cKICAgICAgICA/IF9jKAogICAgICAgICAgICAiZGl2IiwKICAgICAgICAgICAgeyBzdGF0aWNDbGFzczogInRtLWphdi1saXN0LS1wYWdlcyIgfSwKICAgICAgICAgICAgWwogICAgICAgICAgICAgIF92bS5wYWdlcy5saXN0WzBdICE9IDEKICAgICAgICAgICAgICAgID8gX2MoCiAgICAgICAgICAgICAgICAgICAgImkiLAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LS10YWciLAogICAgICAgICAgICAgICAgICAgICAgb246IHsKICAgICAgICAgICAgICAgICAgICAgICAgY2xpY2s6IGZ1bmN0aW9uKCRldmVudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfdm0udG9QYWdlKDEpCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIFtfdm0uX3YoIuesrOS4gOmhtSIpXQogICAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICA6IF92bS5fZSgpLAogICAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICAgIF92bS5fbChfdm0ucGFnZXMubGlzdCwgZnVuY3Rpb24ocCkgewogICAgICAgICAgICAgICAgcmV0dXJuIF9jKAogICAgICAgICAgICAgICAgICAiaSIsCiAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi0tdGFnIiwKICAgICAgICAgICAgICAgICAgICBjbGFzczogeyAidG0tamF2LS1jdXJyZW50IjogcCA9PSBfdm0ucGFnZXMuY3VyciB9LAogICAgICAgICAgICAgICAgICAgIG9uOiB7CiAgICAgICAgICAgICAgICAgICAgICBjbGljazogZnVuY3Rpb24oJGV2ZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfdm0udG9QYWdlKHApCiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICBbX3ZtLl92KF92bS5fcyhwKSldCiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICAgICAgX3ZtLnBhZ2VzLmxhc3QKICAgICAgICAgICAgICAgID8gX2MoCiAgICAgICAgICAgICAgICAgICAgImkiLAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LS10YWciLAogICAgICAgICAgICAgICAgICAgICAgb246IHsKICAgICAgICAgICAgICAgICAgICAgICAgY2xpY2s6IGZ1bmN0aW9uKCRldmVudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfdm0udG9QYWdlKF92bS5wYWdlcy5sYXN0KQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBbX3ZtLl92KCLmnIDlkI7kuIDpobUiKV0KICAgICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgOiBfdm0uX2UoKQogICAgICAgICAgICBdLAogICAgICAgICAgICAyCiAgICAgICAgICApCiAgICAgICAgOiBfdm0uX2UoKQogICAgXSkKICB9OwogIHZhciBfX3Z1ZV9zdGF0aWNSZW5kZXJGbnNfXyQzID0gWwogICAgZnVuY3Rpb24oKSB7CiAgICAgIHZhciBfdm0gPSB0aGlzOwogICAgICB2YXIgX2ggPSBfdm0uJGNyZWF0ZUVsZW1lbnQ7CiAgICAgIHZhciBfYyA9IF92bS5fc2VsZi5fYyB8fCBfaDsKICAgICAgcmV0dXJuIF9jKCJkaXYiLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LS1sb2FkaW5nLXdyYXBwZXIiIH0sIFsKICAgICAgICBfYygiaSIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtLWxvYWRpbmciIH0pCiAgICAgIF0pCiAgICB9LAogICAgZnVuY3Rpb24oKSB7CiAgICAgIHZhciBfdm0gPSB0aGlzOwogICAgICB2YXIgX2ggPSBfdm0uJGNyZWF0ZUVsZW1lbnQ7CiAgICAgIHZhciBfYyA9IF92bS5fc2VsZi5fYyB8fCBfaDsKICAgICAgcmV0dXJuIF9jKCJkaXYiLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LS1sb2FkaW5nLXdyYXBwZXIiIH0sIFsKICAgICAgICBfYygiZGl2IiwgeyBzdGF0aWNDbGFzczogInRtLWphdi0tbG9hZGluZyIgfSkKIC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CkubWFwKHRkID0+IHsKICAgICAgICBjb25zdCBkZXRhaWwgPSB0ZC5jaGlsZHJlblswXTsKICAgICAgICBjb25zdCBvcGVuID0gdGQuY2hpbGRyZW5bMV07CiAgICAgICAgcmV0dXJuIHsKICAgICAgICAgIG1hZ25ldDogb3Blbi5ocmVmLAogICAgICAgICAgdGl0bGU6IG9wZW4udGl0bGUsCiAgICAgICAgICBkZXRhaWw6IG51bGwsCiAgICAgICAgICBkZXRhaWxVcmw6IGRldGFpbC5ocmVmLAogICAgICAgICAgZGV0YWlsUGFyc2VyOiB0b3JyZW50a2l0dHlEZXRhaWwKICAgICAgICB9CiAgICAgIH0pCiAgICB9LAogIH07CgogIGZ1bmN0aW9uIGdldFRvcnJlbnRMaXN0IChhdmlkLCBlbmdpbmUgPSAndG9ycmVudGtpdHR5JykgewogICAgY29uc3QgaHJlZiA9ICdodHRwczovL3d3dy50b3JyZW50a2l0dHkudHYvc2VhcmNoLycgKyBhdmlkOwogICAgY29uc3QgcGFyc2VyID0gcGFyc2VyRm5bZW5naW5lXTsKCiAgICByZXR1cm4gcnVuVGFzaygKICAgICAgJ+afpeivolRvcnJlbnTkv6Hmga8nLAogICAgICBbJ+WKoOi9vSBIVE1MJywgZ2V0SFRNTChocmVmKV0sCiAgICAgIFsn6Kej5p6QVG9ycmVudOS/oeaBrycsIHBhcnNlcl0sCiAgICApLmNhdGNoKChlKSA9PiB7CiAgICAgIHdpbmRvdy5vcGVuKGhyZWYpOwogICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZSkKICAgIH0pCiAgfQoKICAvLwogIGZ1bmN0aW9uIGcgKG8sIGspIHsKICAgIHJldHVybiBvICYmIG9ba10gfHwgJycKICB9CiAgdmFyIHNjcmlwdCQ0ID0gewogICAgcHJvcHM6IHsKICAgICAgdmlkZW86IHsKICAgICAgICB0eXBlOiBPYmplY3QsCiAgICAgICAgZGVmYXVsdDogbnVsbCwKICAgICAgICBsYXJnZUltYWdlOiB0cnVlCiAgICAgIH0KICAgIH0sCiAgICBkYXRhICgpIHsKICAgICAgcmV0dXJuIHsKICAgICAgICBzaG93SW1hZ2VzOiBmYWxzZSwKICAgICAgICB0b3JyZW50czogW10sCiAgICAgICAgc2hvd1RvcnJlbnQ6IGZhbHNlCiAgICAgIH0KICAgIH0sCiAgICBjb21wdXRlZDogewogICAgICBpbkREb3M6IHsKICAgICAgICBjYWNoZTogZmFsc2UsCiAgICAgICAgZ2V0ICgpIHsKICAgICAgICAgIHJldHVybiBkb2N1bWVudC50aXRsZSA9PT0gJ0p1c3QgYSBtb21lbnQuLi4nCiAgICAgICAgfQogICAgICB9LAogICAgICBhdXRvcGxheSAoKSB7CiAgICAgICAgcmV0dXJuICF0aGlzLmluRERvcyAmJiB0aGlzLiRyb290Lm9wdGlvbnMuYXV0b3BsYXkKICAgICAgfSwKICAgICAgbXV0ZWQgKCkgewogICAgICAgIHJldHVybiB0aGlzLiRyb290Lm9wdGlvbnMubXV0ZWQKICAgICAgfSwKICAgICAgaW1hZ2VzICgpIHsKICAgICAgICBjb25zdCBpbWdzID0gdGhpcy52aWRlbyAmJiB0aGlzLnZpZGVvLmltYWdlcyB8fCB7fTsKICAgICAgICBjb25zdCBjb3VudCA9IGltZ3MuY291bnQgfHwgMDsKICAgICAgICBjb25zdCBpZCA9IGltZ3MucHJldmlld0lkOwogICAgICAgIHJldHVybiBBcnJheShjb3VudCkuZmlsbCgxKS5tYXAoKHYsIGkpID0+IGAvL3BpY3MuZG1tLmNvLmpwL2RpZ2l0YWwvdmlkZW8vJHtpZH0vJHtpZH0tJHtpICsgMX0uanBnYCkKICAgICAgfSwKICAgICAgc291cmNlcyAoKSB7CiAgICAgICAgcmV0dXJuICF0aGlzLnZpZGVvIHx8ICF0aGlzLnZpZGVvLnByZXZpZXdJZCA/IFtdIDogZ2VuU291cmNlcyh0aGlzLnZpZGVvLnByZXZpZXdJZCkKICAgICAgfSwKICAgICAgbG9hZGluZyAoKSB7CiAgICAgICAgcmV0dXJuICF0aGl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b290LnB1c2hUYWIoewogICAgICAgICAgaHJlZjogZmlsbExpc3RVcmwodGFyZ2V0LmlkLCB0eXBlKSwKICAgICAgICAgIG5hbWU6IHRhcmdldC5uYW1lCiAgICAgICAgfSk7CiAgICAgIH0sCiAgICAgIHNlYXJjaFNhbWVQcmVmaXggKCkgewogICAgICAgIGNvbnN0IHtwcmVmaXh9ID0gdGhpcy52aWRlbzsKICAgICAgICB0aGlzLiRyb290LnB1c2hUYWIoewogICAgICAgICAgaHJlZjogYHZsX3NlYXJjaGJ5aWQucGhwP2tleXdvcmQ9JHtwcmVmaXh9YCwKICAgICAgICAgIG5hbWU6IHByZWZpeC50b1VwcGVyQ2FzZSgpCiAgICAgICAgfSk7CiAgICAgIH0sCiAgICAgIGxvYWRUb3JyZW50ICgpIHsKICAgICAgICB0aGlzLnNob3dUb3JyZW50ID0gIXRoaXMuc2hvd1RvcnJlbnQ7CiAgICAgICAgaWYgKCF0aGlzLnNob3dUb3JyZW50KSB7CiAgICAgICAgICByZXR1cm4KICAgICAgICB9CiAgICAgICAgZ2V0VG9ycmVudExpc3QodGhpcy5hdmlkKS50aGVuKChkKSA9PiB7CiAgICAgICAgICB0aGlzLnRvcnJlbnRzID0gZDsKICAgICAgICB9LCBlID0+IHsKICAgICAgICAgIGNvbnNvbGUuZXJyb3IoZSk7CiAgICAgICAgICB0aGlzLnNob3dUb3JyZW50ID0gZmFsc2U7CiAgICAgICAgfSk7CiAgICAgIH0sCiAgICAgIHJlbG9hZFZpZGVvICgpIHsKICAgICAgICBjb25zb2xlLmxvZyh0aGlzLnZpZGVvKTsKICAgICAgICBjb25zdCB2aWRlbyA9IEpTT04ucGFyc2UoSlNPTi5zdHJpbmdpZnkodGhpcy52aWRlbykpOwogICAgICAgIGlmICghdmlkZW8pIHsKICAgICAgICAgIHJldHVybgogICAgICAgIH0KICAgICAgICB2aWRlby5wcmV2aWV3SWQgPSB1bmRlZmluZWQ7CiAgICAgICAgdmlkZW8udGVtcGxhdGUgPSB1bmRlZmluZWQ7CiAgICAgICAgZ2V0VmlkZW9QcmV2aWV3KHZpZGVvLCBQcm9taXNlLnJlc29sdmUoe30pLCB0cnVlIC8qKiBmb3JjZSAqLykKICAgICAgICAudGhlbigocHJldmlld0lkKSA9PiB7CiAgICAgICAgICBpZiAocHJldmlld0lkKSB7CiAgICAgICAgICAgIHZpZGVvLnByZXZpZXdJZCA9IHByZXZpZXdJZDsKICAgICAgICAgICAgdmlkZW8ubG9hZGVkLnByZXZpZXcgPSB0cnVlOwogICAgICAgICAgICB0aGlzLiRlbWl0KCdzZWxlY3QnLCB2aWRlbyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB2aWRlby5lcnJvciA9ICfliqDovb3lpLHotKXvvIzor7fmn6XnnIvml6Xlv5cnOwogICAgICAgICAgfQogICAgICAgIH0pLmNhdGNoKChlKSA9PiB7CiAgICAgICAgICBjb25zb2xlLmxvZygn5Yqg6L295aSx6LSlOicsIGUpOwogICAgICAgICAgdmlkZW8uZXJyb3IgPSAn5Yqg6L295aSx6LSl77yM6K+35p+l55yL5pel5b+XJzsKICAgICAgICB9KTsKICAgICAgfQogICAgfQogIH07CgogIC8qIHNjcmlwdCAqLwogIGNvbnN0IF9fdnVlX3NjcmlwdF9fJDQgPSBzY3JpcHQkNDsKCiAgLyogdGVtcGxhdGUgKi8KICB2YXIgX192dWVfcmVuZGVyX18kNCA9IGZ1bmN0aW9uKCkgewogICAgdmFyIF92bSA9IHRoaXM7CiAgICB2YXIgX2ggPSBfdm0uJGNyZWF0ZUVsZW1lbnQ7CiAgICB2YXIgX2MgPSBfdm0uX3NlbGYuX2MgfHwgX2g7CiAgICByZXR1cm4gX2MoImRpdiIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtcHJldmlldyIgfSwgWwogICAgICBfdm0uaW1hZ2VzLmxlbmd0aAogICAgICAgID8gX2MoCiAgICAgICAgICAgICJzcGFuIiwKICAgICAgICAgICAgewogICAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LXByZXZpZXctLWltYWdlcy10cmlnZ2VyIiwKICAgICAgICAgICAgICBvbjogewogICAgICAgICAgICAgICAgY2xpY2s6IGZ1bmN0aW9uKCRldmVudCkgewogICAgICAgICAgICAgICAgICBfdm0uc2hvd0ltYWdlcyA9ICFfdm0uc2hvd0ltYWdlczsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIFtfdm0uX3YoIuWbviIpXQogICAgICAgICAgKQogICAgICAgIDogX3ZtLl9lKCksCiAgICAgIF92bS5fdigiICIpLAogICAgICBfdm0uc2hvd0ltYWdlcwogICAgICAgID8gX2MoCiAgICAgICAgICAgICJkaXYiLAogICAgICAgICAgICB7IHN0YXRpY0NsYXNzOiAidG0tamF2LXByZXZpZXctLWltYWdlcyIgfSwKICAgICAgICAgICAgX3ZtLl9sKF92bS5pbWFnZXMsIGZ1bmN0aW9uKHNyYykgewogICAgICAgICAgICAgIHJldHVybiBfYygiaW1nIiwgeyBrZXk6IHNyYywgYXR0cnM6IHsgc3JjOiBzcmMsIGFsdDogIiIgfSB9KQogICAgICAgICAgICB9KSwKICAgICAgICAgICAgMAogICAgICAgICAgKQogICAgICAgIDogX3ZtLl9lKCksCiAgICAgIF92bS5fdigiICIpLAogICAgICBfYygiZGl2IiwgeyBzdGF0aWNDbGFzczogInRtLWphdi1wbGF5ZXIiIH0sIFsKICAgICAgICBfYygKICAgICAgICAgICJ2aWRlbyIsCiAgICAgICAgICB7CiAgICAgICAgICAgIGtleTogX3ZtLmF2aWQsCiAgICAgICAgICAgIHJlZjogInZpZGVvIiwKICAgICAgICAgICAgYXR0cnM6IHsgY29udHJvbHM6ICIiLCBhdXRvcGxheTogX3ZtLmF1dG9wbGF5LCBwcmVsb2FkOiAidHJ1ZSIgfSwKICAgICAgICAgICAgZG9tUHJvcHM6IHsgbXV0ZWQ6IF92bS5tdXRlZCB9CiAgICAgICAgICB9LAogICAgICAgICAgX3ZtLl9sKF92bS5zb3VyY2VzLCBmdW5jdGlvbihzb3VyY2UsIGluZGV4KSB7CiAgICAgICAgICAgIHJldHVybiBfYygic291cmNlIiwgewogICAgICAgICAgICAgIGtleTogc291cmNlLAogICAgICAgICAgICAgIGF0dHJzOiB7IHNyYzogc291cmNlIH0sCiAgICAgICAgICAgICAgb246IHsKICAgICAgICAgICAgICAgIGVycm9yOiBmdW5jdGlvbigkZXZlbnQpIHsKICAgICAgICAgICAgICAgICAgcmV0dXJuIF92bS5vblZpZGVvRXJyb3IoJGV2ZW50LCBpbmRleCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pCiAgICAgICAgICB9KSwKICAgICAgICAgIDAKICAgICAgICApLAogICAgICAgIF92bS5fdigiICIpLAogICAgICAgIF92bS52aWRlbyAmJiBfdm0udmlkZW8uZXJyb3IKICAgICAgICAgID8gX2MoImRpdiIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtLWxvYWRpbmctd3JhcHBlciIgfSwgWwogICAgICAgICAgICAgIF92bS5fdigiXG4gICAgICAgICIgKyBfdm0uX3MoX3ZtLnZpZGVvLmVycm9yKSArICJcbiAgICAgICIpCiAgICAgICAgICAgIF0pCiAgICAgICAgICA6IF92bS5sb2FkaW5nCiAgICAgICAgICA/IF9jKCJkaXYiLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LS1sb2FkaW5nLXdyYXBwZXIiIH0sIFsKICAgICAgICAgICAgICBfYygiaSIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtLWxvYWRpbmciIH0pCiAgICAgICAgICAgIF0pCiAgICAgICAgICA6IF92bS5fZSgpCiAgICAgIF0pLAogICAgICBfdm0uX3YoIiAiKSwKICAgICAgX2MoImRpdiIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtaW5mb3JtYXRpb24iIH0sIFsKICAgICAgICBfYygKICAgICAgICAgICJkaXYiLAogICAgICAgICAgewogICAgICAgICAgICBkaXJlY3RpdmVzOiBbCiAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgbmFtZTogInNob3ciLAogICAgICAgICAgICAgICAgcmF3TmFtZTogInYtc2hvdyIsCiAgICAgICAgICAgICAgICB2YWx1ZTogX3ZtLmxvYWRpbmdEZXRhaWwsCiAgICAgICAgICAgICAgICBleHByZXNzaW9uOiAibG9hZGluZ0RldGFpbCIKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LS1sb2FkaW5nLXdyYXBwZXIiCiAgICAgICAgICB9LAogICAgICAgICAgW19jKCJpIiwgeyBzdGF0aWNDbGFzczogInRtLWphdi0tbG9hZGluZyIgfSldCiAgICAgICAgKSwKICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICBfYygiZGl2IiwgeyBzdGF0aWNDbGFzczogInRtLWphdi0tdG9ycmVudCIgfSwgWwogICAgICAgICAgX2MoCiAgICAgICAgICAgICJzcGFuIiwKICAgICAgICAgICAgewogICAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LS10b3JyZW50LWJ0biIsCiAgICAgICAgICAgICAgb246IHsgY2xpY2s6IF92bS5sb2FkVG9ycmVudCB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIFtfdm0uX3YoIuejgeWKm+aQnOe0oiIpXQogICAgICAgICAgKSwKICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgX2MoCiAgICAgICAgICAgICJkaXYiLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgZGlyZWN0aXZlczogWwogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICBuYW1lOiAic2hvdyIsCiAgICAgICAgICAgICAgICAgIHJhd05hbWU6ICJ2LXNob3ciLAogICAgICAgICAgICAgICAgICB2YWx1ZTogX3ZtLnNob3dUb3JyZW50LAogICAgICAgICAgICAgICAgICBleHByZXNzaW9uOiAic2hvd1RvcnJlbnQiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi0tdG9ycmVudC1saXN0IgogICAgICAgICAgICB9LAogICAgICAgICAgICBbCiAgICAgICAgICAgICAgX2MoCiAgICAgICAgICAgICAgICAic3BhbiIsCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgIGRpcmVjdGl2ZXM6IFsKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAic2hvdyIsCiAgICAgICAgICAgICAgICAgICAgICByYXdOYW1lOiAidi1zaG93IiwKICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAhX3ZtLnRvcnJlbnRzLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgIGV4cHJlc3Npb246ICIhdG9ycmVudHMubGVuZ3RoIgogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIFtfdm0uX3YoIuaQnOe0ouS4rS4uLiIpXQogICAgICAgICAgICAgICksCiAgICAgICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICAgICAgX3ZtLl9sKF92bS50b3JyZW50cywgZnVuY3Rpb24odCkgewogICAgICAgICAgICAgICAgcmV0dXJuIF9jKCJkaXYiLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LS10b3JyZW50LWl0ZW0iIH0sIFsKICAgICAgICAgICAgICAgICAgX2MoCiAgICAgICAgICAgICAgICAgICAgImEiLAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LS10b3JyZW50LWl0ZW0tdGl0bGUiLAogICAgICAgICAgICAgICAgICAgICAgYXR0cnM6IHsgaHJlZjogdC5tYWduZXQgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgW192bS5fdihfdm0uX3ModC50aXRsZSkpXQogICAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICBdKQogICAgICAgICAgICAgIH0pCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIDIKICAgICAgICAgICkKICAgICAgICBdKSwKICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICBfYygiaSIsIHsKICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LS1jbG9zZSIsCiAgICAgICAgICBvbjogewogICAgICAgICAgICBjbGljazogZnVuY3Rpb24oJGV2ZW50KSB7CiAgICAgICAgICAgICAgcmV0dXJuIF92bS4kZW1pdCgiY2xvc2UiKQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSksCiAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgX2MoImRpdiIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtaW5mb3JtYXRpb24tLWNvdmVyIiB9LCBbCiAgICAgICAgICBfdm0uaW1hZ2UKICAgICAgICAgICAgPyBfYygiaW1nIiwgeyBhdHRyczogeyBzcmM6IF92bS5pbWFnZSwgYWx0OiAiY292ZXIiIH0gfSkKICAgICAgICAgICAgOiBfdm0uX2UoKQogICAgICAgIF0pLAogICAgICAgIF92bS5fdigiICIpLAogICAgICAgIF92bS5pbmZvcwogICAgICAgICAgPyBfYygiZGl2IiwgeyBzdGF0aWNDbGFzczogInRtLWphdi1pbmZvcyIgfSwgWwogICAgICAgICAgICAgIF9jKCJkaXYiLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LWluZm9zLS1yb3ciIH0sIFsKICAgICAgICAgICAgICAgIF9jKAogICAgICAgICAgICAgICAgICAic3BhbiIsCiAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi0tdGFnIiwKICAgICAgICAgICAgICAgICAgICBvbjogeyBjbGljazogX3ZtLnNlYXJjaFNhbWVQcmVmaXggfQogICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICBbX3ZtLl92KF92bS5fcyhfdm0uYXZpZCkpXQogICAgICAgICAgICAgICAgKSwKICAgICAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICAgICAgX2MoCiAgICAgICAgICAgICAgICAgICJhIiwKICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LWluZm9zLS10aXRsZSIsCiAgICAgICAgICAgICAgICAgICAgYXR0cnM6IHsgdGFyZ2V0OiAiX2JsYW5rIiwgaHJlZjogX3ZtLnZpZGVvICYmIF92bS52aWRlby5ocmVmIH0KICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgW192bS5fdihfdm0uX3MoX3ZtLnRpdGxlKSldCiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgXSksCiAgICAgICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICAgICAgX2MoCiAgICAgICAgICAgICAgICAiZGl2IiwKICAgICAgICAgICAgICAgIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtaW5mb3MtLXJvdyIgfSwKICAgICAgICAgICAgICAgIF92bS5fbChfdm0uaW5mb3Muc3RhcnMsIGZ1bmN0aW9uKHN0YXIpIHsKICAgICAgICAgICAgICAgICAgcmV0dXJuIF9jKAogICAgICAgICAgICAgICAgICAgICJzcGFuIiwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi0tdGFnIiwKICAgICAgICAgICAgICAgICAgICAgIG9uOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWNrOiBmdW5jdGlvbigkZXZlbnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3ZtLnNob3dBdkxpc3Qoc3RhciwgInN0YXIiKQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBbX2MoInNwYW4iLCBbX3ZtLl92KF92bS5fcyhzdGFyLm5hbWUpKV0pXQogICAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgICApLAogICAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICAgIF9jKAogICAgICAgICAgICAgICAgImRpdiIsCiAgICAgICAgICAgICAgICB7IHN0YXRpY0NsYXNzOiAidG0tamF2LWluZm9zLS1yb3ciIH0sCiAgICAgICAgICAgICAgICBfdm0uX2woX3ZtLmluZm9zLmdlbnJlcywgZnVuY3Rpb24oZ2VucmUpIHsKICAgICAgICAgICAgICAgICAgcmV0dXJuIF9jKAogICAgICAgICAgICAgICAgICAgICJzcGFuIiwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi0tdGFnIiwKICAgICAgICAgICAgICAgICAgICAgIG9uOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWNrOiBmdW5jdGlvbigkZXZlbnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3ZtLnNob3dBdkxpc3QoZ2VucmUsICJnZW5yZSIpCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIFtfdm0uX3YoX3ZtLl9zKGdlbnJlLm5hbWUpKV0KICAgICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAwCiAgICAgICAgICAgICAgKSwKICAgICAgICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICAgICAgICBfYygiZGl2IiwgeyBzdGF0aWNDbGFzczogInRtLWphdi1pbmZvcy0tcm93IiB9LCBbCiAgICAgICAgICAgICAgICBfYygic3BhbiIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtLXRhZyIgfSwgWwogICAgICAgICAgICAgICAgICBfdm0uX3YoX3ZtLl9zKF92bS5pbmZvcy5kYXRlKSkKICAgICAgICAgICAgICAgIF0pLAogICAgICAgICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICAgICAgICBfYygKICAgICAgICAgICAgICAgICAgInNwYW4iLAogICAgICAgICAgICAgICAgICB7IHN0YXRpY0NsYXNzOiAidG0tamF2LS10YWciLCBhdHRyczogeyB0aXRsZTogIuivhOWIhiIgfSB9LAogICAgICAgICAgICAgICAgICBbX3ZtLl92KF92bS5fcyhfdm0uZmF2b3JpdGUuc2NvcmUgfHwgIi0tIikgKyAi5YiGIildCiAgICAgICAgICAgICAgICApLAogICAgICAgICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICAgICAgICBfYygKICAgICAgICAgICAgICAgICAgInNwYW4iLAogICAgICAgICAgICAgICAgICB7IHN0YXRpY0NsYXNzOiAidG0tamF2LS10YWciLCBhdHRyczogeyB0aXRsZTogIuaDs+eci+eahCIgfSB9LAogICAgICAgICAgICAgICAgICBbX3ZtLl92KF92bS5fcyhfdm0uZmF2b3JpdGUuc3Vic2NyaWJlZCkpXQogICAgICAgICAgICAgICAgKSwKICAgICAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICAgICAgX2MoCiAgICAgICAgICAgICAgICAgICJzcGFuIiwKICAgICAgICAgICAgICAgICAgeyBzdGF0aWNDbGFzczogInRtLWphdi0tdGFnIiwgYXR0cnM6IHsgdGl0bGU6ICLnnIvov4fnmoQiIH0gfSwKICAgICAgICAgICAgICAgICAgW192bS5fdihfdm0uX3MoX3ZtLmZhdm9yaXRlLndhdGNoZWQpKV0KICAgICAgICAgICAgICAgICksCiAgICAgICAgICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICAgICAgICAgIF9jKAogICAgICAgICAgICAgICAgICAic3BhbiIsCiAgICAgICAgICAgICAgICAgIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtLXRhZyIsIGF0dHJzOiB7IHRpdGxlOiAi5oul5pyJ55qEIiB9IH0sCiAgICAgICAgICAgICAgICAgIFtfdm0uX3YoX3ZtLl9zKF92bS5mYXZvcml0ZS5vd25lZCkpXQogICAgICAgICAgICAgICAgKSwKICAgICAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICAgICAgX2MoCiAgICAgICAgICAgICAgICAgICJzcGFuIiwKICAgICAgICAgICAgICAgICAgeyBzdGF0aWNDbGFzczogInRtLWphdi0tdGFnIiwgYXR0cnM6IHsgdGl0bGU6ICLlr7zmvJQiIH0gfSwKICAgICAgICAgICAgICAgICAgW192bS5fdihfdm0uX3MoX3ZtLmluZm9zLmRpcmVjdG9yLm5hbWUgfHwgIi0tIikpXQogICAgICAgICAgICAgICAgKSwKICAgICAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICAgICAgX2MoCiAgICAgICAgICAgICAgICAgICJzcGFuIiwKICAgICAgICAgICAgICAgICAgeyBzdGF0aWNDbGFzczogInRtLWphdi0tdGFnIiwgYXR0cnM6IHsgdGl0bGU6ICLliLbkvZzllYYiIH0gfSwKICAgICAgICAgICAgICAgICAgW192bS5fdihfdm0uX3MoX3ZtLmluZm9zLm1ha2VyLm5hbWUgfHwgIi0tIikpXQogICAgICAgICAgICAgICAgKSwKICAgICAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICAgICAgX2MoCiAgICAgICAgICAgICAgICAgICJzcGFuIiwKICAgICAgICAgICAgICAgICAgeyBzdGF0aWNDbGFzczogInRtLWphdi0tdGFnIiwgYXR0cnM6IHsgdGl0bGU6ICLlj5HooYzllYYiIH0gfSwKICAgICAgICAgICAgICAgICAgW192bS5fdihfdm0uX3MoX3ZtLmluZm9zLmxhYmVsLm5hbWUgfHwgIi0tIikpXQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgIF0pLAogICAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICAgIF9jKCJkaXYiLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LWluZm9zLS1yb3ciIH0sIFsKICAgICAgICAgICAgICAgIF9jKAogICAgICAgICAgICAgICAgICAic3BhbiIsCiAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi0tdG9ycmVudC1idG4iLAogICAgICAgICAgICAgICAgICAgIG9uOiB7IGNsaWNrOiBfdm0ucmVsb2FkVmlkZW8gfQogICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICBbX3ZtLl92KCLliLfmlrDkv6Hmga8iKV0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICBdKQogICAgICAgICAgICBdKQogICAgICAgICAgOiBfdm0uX2UoKQogICAgICBdKQogICAgXSkKICB9OwogIHZhciBfX3Z1ZV9zdGF0aWNSZW5kZXJGbnNfXyQ0ID0gW107CiAgX192dWVfcmVuZGVyX18kNC5fd2l0aFN0cmlwcGVkID0gdHJ1ZTsKCiAgICAvKiBzdHlsZSAqLwogICAgY29uc3QgX192dWVfaW5qZWN0X3N0eWxlc19fJDQgPSBmdW5jdGlvbiAoaW5qZWN0KSB7CiAgICAgIGlmICghaW5qZWN0KSByZXR1cm4KICAgICAgaW5qZWN0KCJkYXRhLXYtN2FjMTE3YWFfMCIsIHsgc291cmNlOiAiLnRtLWphdi1wcmV2aWV3W2RhdGEtdi03YWMxMTdhYV0ge1xuICBvdmVyZmxvdzogYXV0bztcbiAgZGlzcGxheTogZmxleDtcbiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcbiAgd2lkdGg6IDEwMCU7XG4gIG1hcmdpbi1yaWdodDogMTBweDtcbiAgcGFkZGluZy1yaWdodDogMTBweDtcbiAgcG9zaXRpb246IHJlbGF0aXZlO1xuICBwYWRkaW5nOiAwIDEwcHg7XG59XG4udG0tamF2LXByZXZpZXctLWltYWdlcy10cmlnZ2VyW2RhdGEt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ZUNvbXBvbmVudCgKICAgICAgeyByZW5kZXI6IF9fdnVlX3JlbmRlcl9fJDQsIHN0YXRpY1JlbmRlckZuczogX192dWVfc3RhdGljUmVuZGVyRm5zX18kNCB9LAogICAgICBfX3Z1ZV9pbmplY3Rfc3R5bGVzX18kNCwKICAgICAgX192dWVfc2NyaXB0X18kNCwKICAgICAgX192dWVfc2NvcGVfaWRfXyQ0LAogICAgICBfX3Z1ZV9pc19mdW5jdGlvbmFsX3RlbXBsYXRlX18kNCwKICAgICAgX192dWVfbW9kdWxlX2lkZW50aWZpZXJfXyQ0LAogICAgICBmYWxzZSwKICAgICAgY3JlYXRlSW5qZWN0b3IsCiAgICAgIHVuZGVmaW5lZCwKICAgICAgdW5kZWZpbmVkCiAgICApOwoKICAvLwogIHZhciBzY3JpcHQkNSA9IHsKICAgIGRhdGEgKCkgewogICAgICByZXR1cm4gewogICAgICAgIHZhbHVlOiAnJwogICAgICB9CiAgICB9LAogICAgbWV0aG9kczogewogICAgICBkb1NlYXJjaCAoKSB7CiAgICAgICAgaWYgKHRoaXMudmFsdWUpIHsKICAgICAgICAgIGNvbnN0IHVybCA9IGAke2xvY2F0aW9uLm9yaWdpbn0vY24vdmxfc2VhcmNoYnlpZC5waHA/a2V5d29yZD0ke3RoaXMudmFsdWV9YDsKICAgICAgICAgIHRoaXMuJGdldCh1cmwpLnRoZW4oKHJlcykgPT4gewogICAgICAgICAgICBjb25zdCBodG1sID0gcGFyc2VIdG1sKHJlcy5yZXNwb25zZVRleHQpOwogICAgICAgICAgICBpZiAocmVzLmZpbmFsVXJsID09PSB1cmwpIHsKICAgICAgICAgICAgICB0aGlzLnRvVGFiKGh0bWwsIHRoaXMudmFsdWUpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHRoaXMucGFyc2VEZXRhaWwoaHRtbCwgcmVzLmZpbmFsVXJsKTsKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgICAKICAgICAgICB9CiAgICAgIH0sCiAgICAgIHRvVGFiIChodG1sLCBuYW1lKSB7CiAgICAgICAgdGhpcy4kcm9vdC5wdXNoVGFiKHsKICAgICAgICAgIGhyZWY6IGB2bF9zZWFyY2hieWlkLnBocD9rZXl3b3JkPSR7bmFtZX1gLAogICAgICAgICAgbmFtZSwKICAgICAgICB9KTsKICAgICAgfSwKICAgICAgcGFyc2VEZXRhaWwgKGRvbSkgewogICAgICAgIGNvbnN0IHZpZGVvID0gcGFyc2VCYXNlSW5mbyhkb20pOwogICAgICAgIGNvbnN0IGkgPSBnZXRWaWRlb0RldGFpbCh2aWRlbywgZG9tKTsKICAgICAgICBpLnRoZW4oKHtpbmZvcywgZmF2b3JpdGUsIGltYWdlc30pID0+IHsKICAgICAgICAgIHZpZGVvLmluZm9zID0gaW5mb3M7IAogICAgICAgICAgdmlkZW8uZmF2b3JpdGUgPSBmYXZvcml0ZTsKICAgICAgICAgIHZpZGVvLmltYWdlcyA9IGltYWdlczsKICAgICAgICAgIHZpZGVvLmxvYWRlZC5kZXRhaWwgPSB0cnVlOwogICAgICAgICAgdGhpcy4kZW1pdCgnc2VsZWN0JywgdmlkZW8pOwogICAgICAgICAgcmV0dXJuIHZpZGVvCiAgICAgICAgfSkuY2F0Y2goKGUpID0+IHsKICAgICAgICAgIGNvbnNvbGUubG9nKCfliqDovb3lpLHotKU6JywgZSk7CiAgICAgICAgICB2aWRlby5sb2FkZWQuZGV0YWlsID0gZmFsc2U7CiAgICAgICAgfSk7CiAgICAgICAgdmlkZW8uZXJyb3IgPSAnJzsKICAgICAgICBjb25zdCBzID0gZ2V0VmlkZW9QcmV2aWV3KHZpZGVvLCBpKS50aGVuKChwcmV2aWV3SWQpID0+IHsKICAgICAgICAgIGlmIChwcmV2aWV3SWQpIHsKICAgICAgICAgICAgdmlkZW8ucHJldmlld0lkID0gcHJldmlld0lkOwogICAgICAgICAgICB2aWRlby5sb2FkZWQucHJldmlldyA9IHRydWU7CiAgICAgICAgICAgIHRoaXMuJGVtaXQoJ3NlbGVjdCcsIHZpZGVvKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHZpZGVvLmVycm9yID0gJ+WKoOi9veWksei0pe+8jOivt+afpeeci+aXpeW/lyc7CiAgICAgICAgICB9CiAgICAgICAgfSkuY2F0Y2goKGUpID0+IHsKICAgICAgICAgIGNvbnNvbGUubG9nKCfliqDovb3lpLHotKU6JywgZSk7CiAgICAgICAgICB2aWRlby5lcnJvciA9ICfliqDovb3lpLHotKXvvIzor7fmn6XnnIvml6Xlv5cnOwogICAgICAgIH0pOwogICAgICAgIAogICAgICAgIHRoaXMuJGVtaXQoJ3NlbGVjdCcsIHZpZGVvKTsKICAgICAgICBQcm9taXNlLmFsbChbcywgaV0pLnRoZW4oKCkgPT4gewogICAgICAgICAgY29uc29sZS5sb2codmlkZW8pOwogICAgICAgIH0pOwogICAgICB9LAogICAgfSwKICB9OwoKICAvKiBzY3JpcHQgKi8KICBjb25zdCBfX3Z1ZV9zY3JpcHRfXyQ1ID0gc2NyaXB0JDU7CgogIC8qIHRlbXBsYXRlICovCiAgdmFyIF9fdnVlX3JlbmRlcl9fJDUgPSBmdW5jdGlvbigpIHsKICAgIHZhciBfdm0gPSB0aGlzOwogICAgdmFyIF9oID0gX3ZtLiRjcmVhdGVFbGVtZW50OwogICAgdmFyIF9jID0gX3ZtLl9zZWxmLl9jIHx8IF9oOwogICAgcmV0dXJuIF9jKCJkaXYiLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LXNlYXJjaCIgfSwgWwogICAgICBfYygiaW5wdXQiLCB7CiAgICAgICAgZGlyZWN0aXZlczogWwogICAgICAgICAgewogICAgICAgICAgICBuYW1lOiAibW9kZWwiLAogICAgICAgICAgICByYXdOYW1lOiAidi1tb2RlbCIsCiAgICAgICAgICAgIHZhbHVlOiBfdm0udmFsdWUsCiAgICAgICAgICAgIGV4cHJlc3Npb246ICJ2YWx1ZSIKICAgICAgICAgIH0KICAgICAgICBdLAogICAgICAgIGF0dHJzOiB7IHR5cGU6ICJ0ZXh0IiB9LAogICAgICAgIGRvbVByb3BzOiB7IHZhbHVlOiBfdm0udmFsdWUgfSwKICAgICAgICBvbjogewogICAgICAgICAga2V5dXA6IGZ1bmN0aW9uKCRldmVudCkgewogICAgICAgICAgICBpZiAoCiAgICAgICAgICAgICAgISRldmVudC50eXBlLmluZGV4T2YoImtleSIpICYmCiAgICAgICAgICAgICAgX3ZtLl9rKCRldmVudC5rZXlDb2RlLCAiZW50ZXIiLCAxMywgJGV2ZW50LmtleSwgIkVudGVyIikKICAgICAgICAgICAgKSB7CiAgICAgICAgICAgICAgcmV0dXJuIG51bGwKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gX3ZtLmRvU2VhcmNoKCRldmVudCkKICAgICAgICAgIH0sCiAgICAgICAgICBpbnB1dDogZnVuY3Rpb24oJGV2ZW50KSB7CiAgICAgICAgICAgIGlmICgkZXZlbnQudGFyZ2V0LmNvbXBvc2luZykgewogICAgICAgICAgICAgIHJldHVybgogICAgICAgICAgICB9CiAgICAgICAgICAgIF92bS52YWx1ZSA9ICRldmVudC50YXJnZXQudmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9KSwKICAgICAgX3ZtLl92KCIgIiksCiAgICAgIF9jKCJidXR0b24iLCB7IG9uOiB7IGNsaWNrOiBfdm0uZG9TZWFyY2ggfSB9LCBbX3ZtLl92KCLmkJzntKIiKV0pCiAgICBdKQogIH07CiAgdmFyIF9fdnVlX3N0YXRpY1JlbmRlckZuc19fJDUgPSBbXTsKICBfX3Z1ZV9yZW5kZXJfXyQ1Ll93aXRoU3RyaXBwZWQgPSB0cnVlOwoKICAgIC8qIHN0eWxlICovCiAgICBjb25zdCBfX3Z1ZV9pbmplY3Rfc3R5bGVzX18kNSA9IGZ1bmN0aW9uIChpbmplY3QpIHsKICAgICAgaWYgKCFpbmplY3QpIHJldHVybgogICAgICBpbmplY3QoImRhdGEtdi0xYWUwMmRiY18wIiwgeyBzb3VyY2U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kZW8ubG9hZGVkLmRldGFpbCA9IHRydWVcclxuICAgICAgICB0aGlzLiRlbWl0KCdzZWxlY3QnLCB2aWRlbylcclxuICAgICAgICByZXR1cm4gdmlkZW9cclxuICAgICAgfSkuY2F0Y2goKGUpID0+IHtcclxuICAgICAgICBjb25zb2xlLmxvZygn5Yqg6L295aSx6LSlOicsIGUpXHJcbiAgICAgICAgdmlkZW8ubG9hZGVkLmRldGFpbCA9IGZhbHNlXHJcbiAgICAgIH0pXHJcbiAgICAgIHZpZGVvLmVycm9yID0gJydcclxuICAgICAgY29uc3QgcyA9IGdldFZpZGVvUHJldmlldyh2aWRlbywgaSkudGhlbigocHJldmlld0lkKSA9PiB7XHJcbiAgICAgICAgaWYgKHByZXZpZXdJZCkge1xyXG4gICAgICAgICAgdmlkZW8ucHJldmlld0lkID0gcHJldmlld0lkXHJcbiAgICAgICAgICB2aWRlby5sb2FkZWQucHJldmlldyA9IHRydWVcclxuICAgICAgICAgIHRoaXMuJGVtaXQoJ3NlbGVjdCcsIHZpZGVvKVxyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICB2aWRlby5lcnJvciA9ICfliqDovb3lpLHotKXvvIzor7fmn6XnnIvml6Xlv5cnXHJcbiAgICAgICAgfVxyXG4gICAgICB9KS5jYXRjaCgoZSkgPT4ge1xyXG4gICAgICAgIGNvbnNvbGUubG9nKCfliqDovb3lpLHotKU6JywgZSlcclxuICAgICAgICB2aWRlby5lcnJvciA9ICfliqDovb3lpLHotKXvvIzor7fmn6XnnIvml6Xlv5cnXHJcbiAgICAgIH0pXHJcbiAgICAgIFxyXG4gICAgICB0aGlzLiRlbWl0KCdzZWxlY3QnLCB2aWRlbylcclxuICAgICAgUHJvbWlzZS5hbGwoW3MsIGldKS50aGVuKCgpID0+IHtcclxuICAgICAgICBjb25zb2xlLmxvZyh2aWRlbylcclxuICAgICAgfSlcclxuICAgIH0sXHJcbiAgfSxcclxufVxyXG48L3NjcmlwdD5cclxuXHJcbjxzd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BkYXRhICgpIHsKICAgICAgcmV0dXJuIHsKICAgICAgICBzY3JvbGxMZWZ0OiAwCiAgICAgIH0KICAgIH0sCiAgICBwcm9wczogewogICAgICB0YWJzOiB7CiAgICAgICAgZGVmYXVsdCAoKSB7cmV0dXJuIFtdfQogICAgICB9LAogICAgICBjdXJySW5kZXg6IHsKICAgICAgICBkZWZhdWx0OiAwCiAgICAgIH0KICAgIH0sCiAgICBtZXRob2RzOiB7CiAgICAgIHNjcm9sbCAoZSkgewogICAgICAgIHRoaXMuc2Nyb2xsTGVmdCArPSBlLmRlbHRhWSAvIDEwOwogICAgICAgIHRoaXMuJGVsLnNjcm9sbExlZnQgPSB0aGlzLnNjcm9sbExlZnQ7CiAgICAgIH0KICAgIH0KICB9OwoKICAvKiBzY3JpcHQgKi8KICBjb25zdCBfX3Z1ZV9zY3JpcHRfXyQ2ID0gc2NyaXB0JDY7CgogIC8qIHRlbXBsYXRlICovCiAgdmFyIF9fdnVlX3JlbmRlcl9fJDYgPSBmdW5jdGlvbigpIHsKICAgIHZhciBfdm0gPSB0aGlzOwogICAgdmFyIF9oID0gX3ZtLiRjcmVhdGVFbGVtZW50OwogICAgdmFyIF9jID0gX3ZtLl9zZWxmLl9jIHx8IF9oOwogICAgcmV0dXJuIF9jKAogICAgICAiZGl2IiwKICAgICAgeyBzdGF0aWNDbGFzczogInRtLWphdi10YWJzIiwgb246IHsgbW91c2V3aGVlbDogX3ZtLnNjcm9sbCB9IH0sCiAgICAgIF92bS5fbChfdm0udGFicywgZnVuY3Rpb24odGFiLCBpbmRleCkgewogICAgICAgIHJldHVybiBfYygKICAgICAgICAgICJkaXYiLAogICAgICAgICAgewogICAgICAgICAgICBrZXk6IHRhYi5ocmVmLAogICAgICAgICAgICBzdGF0aWNDbGFzczogInRtLWphdi10YWJzLS1pdGVtIiwKICAgICAgICAgICAgY2xhc3M6IHsgY3VycjogX3ZtLmN1cnJJbmRleCA9PT0gaW5kZXggfQogICAgICAgICAgfSwKICAgICAgICAgIFsKICAgICAgICAgICAgX2MoCiAgICAgICAgICAgICAgInNwYW4iLAogICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LXRhYnMtLW5hbWUiLAogICAgICAgICAgICAgICAgb246IHsKICAgICAgICAgICAgICAgICAgY2xpY2s6IGZ1bmN0aW9uKCRldmVudCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBfdm0uJGVtaXQoImFjdGl2ZSIsIGluZGV4KQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICBbX3ZtLl92KF92bS5fcyh0YWIubmFtZSkpXQogICAgICAgICAgICApLAogICAgICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICAgICAgIXRhYi5maXhlZAogICAgICAgICAgICAgID8gX2MoInNwYW4iLCB7CiAgICAgICAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LS1jbG9zZSIsCiAgICAgICAgICAgICAgICAgIG9uOiB7CiAgICAgICAgICAgICAgICAgICAgY2xpY2s6IGZ1bmN0aW9uKCRldmVudCkgewogICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF92bS4kZW1pdCgicmVtb3ZlIiwgaW5kZXgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgIDogX3ZtLl9lKCkKICAgICAgICAgIF0KICAgICAgICApCiAgICAgIH0pLAogICAgICAwCiAgICApCiAgfTsKICB2YXIgX192dWVfc3RhdGljUmVuZGVyRm5zX18kNiA9IFtdOwogIF9fdnVlX3JlbmRlcl9fJDYuX3dpdGhTdHJpcHBlZCA9IHRydWU7CgogICAgLyogc3R5bGUgKi8KICAgIGNvbnN0IF9fdnVlX2luamVjdF9zdHlsZXNfXyQ2ID0gZnVuY3Rpb24gKGluamVjdCkgewogICAgICBpZiAoIWluamVjdCkgcmV0d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sKICAgIHZhciBfYyA9IF92bS5fc2VsZi5fYyB8fCBfaDsKICAgIHJldHVybiBfYygKICAgICAgImRpdiIsCiAgICAgIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtbG9nIiB9LAogICAgICBbCiAgICAgICAgX2MoImg0IiwgW192bS5fdigi6Kej5p6Q5pel5b+XIildKSwKICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICBfdm0uX2woX3ZtLmxvZ3MsIGZ1bmN0aW9uKHRhc2spIHsKICAgICAgICAgIHJldHVybiBfYygiZGl2IiwgeyBzdGF0aWNDbGFzczogInRtLWphdi1sb2ctLXRhc2siIH0sIFsKICAgICAgICAgICAgX2MoImg0IiwgW192bS5fdihfdm0uX3ModGFzay5uYW1lKSldKSwKICAgICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICAgIF9jKAogICAgICAgICAgICAgICJkaXYiLAogICAgICAgICAgICAgIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtbG9nLS1jb250ZW50IiB9LAogICAgICAgICAgICAgIF92bS5fbCh0YXNrLmxvZ3MsIGZ1bmN0aW9uKGxvZykgewogICAgICAgICAgICAgICAgcmV0dXJuIF9jKCJwIiwgeyBzdGF0aWNDbGFzczogInRtLWphdi1sb2ctLXJvdyIgfSwgWwogICAgICAgICAgICAgICAgICBfYygic3BhbiIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtbG9nLS10aW1lIiB9LCBbCiAgICAgICAgICAgICAgICAgICAgX3ZtLl92KF92bS5fcyhsb2cuYWZ0ZXIpICsgIm1zIikKICAgICAgICAgICAgICAgICAgXSksCiAgICAgICAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICAgICAgICBfYygKICAgICAgICAgICAgICAgICAgICAic3BhbiIsCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgY2xhc3M6IFsKICAgICAgICAgICAgICAgICAgICAgICAgInRtLWphdi0tc3RhdHVzIiwKICAgICAgICAgICAgICAgICAgICAgICAgInRtLWphdi0tc3RhdHVzLSIgKyBsb2cuc3RhdHVzLAogICAgICAgICAgICAgICAgICAgICAgICAidG0tamF2LS10YXNrLSIgKyB0YXNrLnN0YXR1cwogICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgW192bS5fdihfdm0uX3MobG9nLnN0YXR1cykpXQogICAgICAgICAgICAgICAgICApLAogICAgICAgICAgICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICAgICAgICAgICAgX2MoInNwYW4iLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LWxvZy0tbmFtZSIgfSwgWwogICAgICAgICAgICAgICAgICAgIF92bS5fdihfdm0uX3MobG9nLm5hbWUpKQogICAgICAgICAgICAgICAgICBdKSwKICAgICAgICAgICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICAgICAgICAgIF9jKCJzcGFuIiwgeyBzdGF0aWNDbGFzczogInRtLWphdi1sb2ctLW1zZyIgfSwgWwogICAgICAgICAgICAgICAgICAgIF92bS5fdihfdm0uX3MobG9nLm1zZykpCiAgICAgICAgICAgICAgICAgIF0pCiAgICAgICAgICAgICAgICBdKQogICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgIDAKICAgICAgICAgICAgKSwKICAgICAgICAgICAgX3ZtLl92KCIgIiksCiAgICAgICAgICAgICF0YXNrLmZpbmlzaGVkCiAgICAgICAgICAgICAgPyBfYygic3BhbiIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtLWxvYWRpbmciIH0pCiAgICAgICAgICAgICAgOiBfdm0uX2UoKQogICAgICAgICAgXSkKICAgICAgICB9KQogICAgICBdLAogICAgICAyCiAgICApCiAgfTsKICB2YXIgX192dWVfc3RhdGljUmVuZGVyRm5zX18kNyA9IFtdOwogIF9fdnVlX3JlbmRlcl9fJDcuX3dpdGhTdHJpcHBlZCA9IHRydWU7CgogICAgLyogc3R5bG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N0YXRpY1JlbmRlckZuczogX192dWVfc3RhdGljUmVuZGVyRm5zX18kNyB9LAogICAgICBfX3Z1ZV9pbmplY3Rfc3R5bGVzX18kNywKICAgICAgX192dWVfc2NyaXB0X18kNywKICAgICAgX192dWVfc2NvcGVfaWRfXyQ3LAogICAgICBfX3Z1ZV9pc19mdW5jdGlvbmFsX3RlbXBsYXRlX18kNywKICAgICAgX192dWVfbW9kdWxlX2lkZW50aWZpZXJfXyQ3LAogICAgICBmYWxzZSwKICAgICAgY3JlYXRlSW5qZWN0b3IsCiAgICAgIHVuZGVmaW5lZCwKICAgICAgdW5kZWZpbmVkCiAgICApOwoKICAvLwogIHZhciBzY3JpcHQkOCA9IHsKICAgIGRhdGEgKCkgewogICAgICByZXR1cm4gewogICAgICAgIGdlbnJlczogW10KICAgICAgfQogICAgfSwKICAgIG1vdW50ZWQgKCkgewogICAgICB0aGlzLmluaXQoKTsKICAgIH0sCiAgICBtZXRob2RzOiB7CiAgICAgIGluaXQgKCkgewogICAgICAgIGdlbnJlc01vZGVsLmdldEFsbCgpLnRoZW4oKHJlc3VsdCkgPT4gewogICAgICAgICAgdGhpcy5nZW5yZXMgPSByZXN1bHQ7CiAgICAgICAgfSk7CiAgICAgIH0sCiAgICAgIHNob3dHZW5yZSAoe2lkLCBuYW1lfSkgewogICAgICAgIHRoaXMuJHJvb3QucHVzaFRhYih7CiAgICAgICAgICBocmVmOiAndmxfZ2VucmUucGhwP2c9JyArIGlkLAogICAgICAgICAgbmFtZSwKICAgICAgICB9KTsKICAgICAgfQogICAgfQogIH07CgogIC8qIHNjcmlwdCAqLwogIGNvbnN0IF9fdnVlX3NjcmlwdF9fJDggPSBzY3JpcHQkODsKCiAgLyogdGVtcGxhdGUgKi8KICB2YXIgX192dWVfcmVuZGVyX18kOCA9IGZ1bmN0aW9uKCkgewogICAgdmFyIF92bSA9IHRoaXM7CiAgICB2YXIgX2ggPSBfdm0uJGNyZWF0ZUVsZW1lbnQ7CiAgICB2YXIgX2MgPSBfdm0uX3NlbGYuX2MgfHwgX2g7CiAgICByZXR1cm4gX2MoCiAgICAgICJkaXYiLAogICAgICB7IHN0YXRpY0NsYXNzOiAidG0tamF2LWdlbnJlcyIgfSwKICAgICAgX3ZtLl9sKF92bS5nZW5yZXMsIGZ1bmN0aW9uKGNhdGVnb3J5KSB7CiAgICAgICAgcmV0dXJuIF9jKCJkaXYiLCB7IHN0YXRpY0NsYXNzOiAidG0tamF2LWdlbnJlcy0tY2F0ZWdvcnkiIH0sIFsKICAgICAgICAgIF9jKCJoMyIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtZ2VucmVzLS1jYXRlZ29yeS1uYW1lIiB9LCBbCiAgICAgICAgICAgIF92bS5fdihfdm0uX3MoY2F0ZWdvcnkudHlwZSkpCiAgICAgICAgICBdKSwKICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgX2MoCiAgICAgICAgICAgICJkaXYiLAogICAgICAgICAgICB7IHN0YXRpY0NsYXNzOiAidG0tamF2LWdlbnJlcy0tbGlzdCIgfSwKICAgICAgICAgICAgX3ZtLl9sKGNhdGVnb3J5LmdlbnJlcywgZnVuY3Rpb24oZ2VucmUpIHsKICAgICAgICAgICAgICByZXR1cm4gX2MoCiAgICAgICAgICAgICAgICAiZGl2IiwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtZ2VucmVzLS1pdGVtIiwKICAgICAgICAgICAgICAgICAgb246IHsKICAgICAgICAgICAgICAgICAgICBjbGljazogZnVuY3Rpb24oJGV2ZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3ZtLnNob3dHZW5yZShnZW5yZSkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBbX3ZtLl92KCJcbiAgICAgICAgIiArIF92bS5fcyhnZW5yZS5uYW1lKSArICJcbiAg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PTi5zdHJpbmdpZnkodmFsdWUpOwogICAgICB9CiAgICAgIGxvY2FsU3RvcmFnZS5zZXRJdGVtKGtleSwgdmFsdWUpOwogICAgfSwKICAgIGdldCAoa2V5ID0gU1RPUkFHRV9LRVkpIHsKICAgICAgY29uc3QgdmFsdWUgPSBsb2NhbFN0b3JhZ2UuZ2V0SXRlbShrZXkpOwogICAgICByZXR1cm4gSlNPTi5wYXJzZSh2YWx1ZSkKICAgIH0KICB9OwoKICAvLwoKICB2YXIgc2NyaXB0JDkgPSB7CiAgICBuYW1lOiAndG0tYXBwJywKICAgIGNvbXBvbmVudHM6IHsKICAgICAgVG1Db250YWluZXI6IF9fdnVlX2NvbXBvbmVudF9fLAogICAgICBUbVdpbmRvdzogX192dWVfY29tcG9uZW50X18kMSwKICAgICAgVG1QcmV2aWV3OiBfX3Z1ZV9jb21wb25lbnRfXyQ0LAogICAgICBUbVNlYXJjaDogX192dWVfY29tcG9uZW50X18kNSwKICAgICAgVG1MaXN0OiBfX3Z1ZV9jb21wb25lbnRfXyQzLAogICAgICBUbVRhYnM6IF9fdnVlX2NvbXBvbmVudF9fJDYsCiAgICAgIFRtTG9nOiBfX3Z1ZV9jb21wb25lbnRfXyQ3LAogICAgICBUbUdlbnJlczogX192dWVfY29tcG9uZW50X18kOCwKICAgIH0sCiAgICBkYXRhICgpIHsKICAgICAgcmV0dXJuIHsKICAgICAgICBjdXJyVmlkZW86IG51bGwsCiAgICAgICAgY3VycldpbmRvd1NyYzogJycsCiAgICAgICAgdGFiSW5kZXg6IDAsCiAgICAgICAgdGFiczogWwogICAgICAgICAge25hbWU6ICfmnIDng63pl6gnLCBocmVmOiAnL2NuLycsIG5leHQ6IGZhbHNlLCBmaXhlZDogdHJ1ZX0sCiAgICAgICAgICB7bmFtZTogJ+aWsOWPkeihjCcsIGhyZWY6ICd2bF9uZXdyZWxlYXNlLnBocCcsIGZpeGVkOiB0cnVlfSwKICAgICAgICAgIHtuYW1lOiAn5paw5Yqg5YWlJywgaHJlZjogJ3ZsX25ld2VudHJpZXMucGhwJywgZml4ZWQ6IHRydWV9LAogICAgICAgICAge25hbWU6ICfmnIDmg7PopoEnLCBocmVmOiAndmxfbW9zdHdhbnRlZC5waHAnLCBmaXhlZDogdHJ1ZX0sCiAgICAgICAgICB7bmFtZTogJ+mrmOivhOS7tycsIGhyZWY6ICd2bF9iZXN0cmF0ZWQucGhwJywgZml4ZWQ6IHRydWV9LAogICAgICAgIF0sCiAgICAgICAgb3B0aW9uczogewogICAgICAgICAgYXV0b3BsYXk6IHRydWUsCiAgICAgICAgICBtdXRlZDogZmFsc2UsCiAgICAgICAgICBsb2FkUHJldlN0YXR1czogdHJ1ZSwKICAgICAgICAgIHVzZVdpbmRvdzogdHJ1ZSwKICAgICAgICAgIHNob3dBcHA6IHRydWUKICAgICAgICB9CiAgICAgIH0KICAgIH0sCiAgICBjcmVhdGVkICgpIHsKICAgICAgdGhpcy5pbml0KCk7CiAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdiZWZvcmV1bmxvYWQnLCB0aGlzLm9uQ2xvc2UpOwogICAgfSwKICAgIGJlZm9yZURlc3Ryb3kgKCkgewogICAgICB3aW5kb3cucmVtb3ZlRXZlbnRMaXN0ZW5lcignYmVmb3JldW5sb2FkJywgdGhpcy5vbkNsb3NlKTsKICAgIH0sCiAgICBjb21wdXRlZDogewogICAgICBjdXJyVGFiICgpIHsKICAgICAgICByZXR1cm4gdGhpcy50YWJzW3RoaXMudGFiSW5kZXhdIHx8IG51bGwKICAgICAgfQogICAgfSwKICAgIG1ldGhvZHM6IHsKICAgICAgcmVtb3ZlVGFiIChpbmRleCkgewogICAgICAgIGNvbnN0IHRhYiA9IHRoaXMudGFic1tpbmRleF07CiAgICAgICAgaWYgKHRhYi5maXhlZCkgeyByZXR1cm4gfQoKICAgICAgICB0aGlzLnRhYnMuc3BsaWNlKGluZGV4LCAxKTsKCiAgICAgICAgaWYgKGluZGV4ID09PSB0aGlzLnRhYkluZGV4KSB7CiAgICAgICAgICBjb25zdCBwcmV2SW5kZXggPSBMaXN0Q2FjaGVTdG9yZS5rZXlzLmxlbmd0aCAtIDI7CiAgICAgICAgICBpZiAocHJldkluZGV4ID4gLTEpIHsKICAgICAgICAgICAgaW5kZXggPSB0aGlzLnRhYnMuZmluZEluZGV4KHRhYiA9PiB0YWIuaHJlZiA9PT0gTGlzdENhY2hlU3RvcmUua2V5c1twcmV2SW5kZXhdKTsKICAgICAgICAgIH0KICAgICAgICAgIAogICAgICAgICAgdGhpcy50YWJJbmRleCA9IE1hdGgubWF4KGluZGV4LCAwKTsKICAgICAgICB9IGVsc2UgaWYgKHRoaXMudGFiSW5kZXggPj0gdGhpcy50YWJzLmxlbmd0aCkgewogICAgICAgICAgdGhpcy50YWJJbmRleCA9IHRoaXMudGFicy5sZW5ndGggLSAxOwogICAgICAgIH0KICAgICAgfSwKICAgICAgcHVzaFRhYiAodGFiKSB7CiAgICAgICAgdHJ5IHsKICAgICAgICAgIGNvbnN0IHtuYW1lLCBocmVmfSA9IHRhYjsKICAgICAgICAgIGNvbnN0IGluZGV4ID0gdGhpcy50YWJzLmZpbmRJbmRleCgodGFiKSA9PiB0YWIuaHJlZiA9PT0gaHJlZik7CiAgICAgICAgICBpZiAoaW5kZXggPiAtMSkgewogICAgICAgICAgICB0aGlzLnRhYkluZGV4ID0gaW5kZXg7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjb25zdCBsZW4gPSB0aGlzLnRhYnMucHVzaCh7bmFtZSwgaHJlZn0pOwogICAgICAgICAgICB0aGlzLnRhYkluZGV4ID0gbGVuIC0gMTsKICAgICAgICAgIH0KICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICBjb25zb2xlLmVycm9yKGUpOwogICAgICAgIH0KICAgICAgfSwKICAgICAgb25DbG9zZSAoKSB7CiAgICAgICAgcHJldlN0YXR1cy5zZXQodGhpcy5fZGF0YSk7CiAgICAgIH0sCiAgICAgIGluaXQgKCkgewogICAgICAgIGNvbnN0IHByZXYgPSBwcmV2U3RhdHVzLmdldCgpOwogICAgICAgIGlmICghcHJldikgewogICAgICAgICAgcmV0dXJuCiAgICAgICAgfQogICAgICAgIGNvbnN0IGxvYWRQcmV2U3RhdHVzID0gcHJldi5vcHRpb25zICYmIHByZXYub3B0aW9ucy5sb2FkUHJldlN0YXR1czsKICAgICAgICBwcmV2Lm9wdGlvbnMgJiYgKHRoaXMub3B0aW9ucyA9IHsuLi50aGlzLm9wdGlvbnMsIC4uLnByZXYub3B0aW9uc30pOwogICAgICAgIGlmIChwcmV2ICYmIGxvYWRQcmV2U3RhdHVzICE9PSBmYWxzZSkgewogICAgICAgICAgZm9yIChsZXQga2V5IGluIHByZXYpIHsKICAgICAgICAgICAgaWYgKGtleSAhPT0gJ29wdGlvbnMnKSB7CiAgICAgICAgICAgICAgdGhpc1trZXldID0gcHJldltrZXldOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9LAogICAgICBoYW5kbGVHbG9iYWxDbGljayAoZXYpIHsKICAgICAgICBpZiAoIXRoaXMub3B0aW9ucy51c2VXaW5kb3cpIHsKICAgICAgICAgIHJldHVybgogICAgICAgIH0KICAgICAgICAvLyBBIHRtLWphdi1pbmZvcy0tdGl0bGUgQSB0bS1qYXYtaXRlbS0tdGl0bGUKICAgICAgICBjb25zdCB0YXJnZXQgPSBldi50YXJnZXQ7CiAgICAgICAgaWYgKHRhcmdldC50YWdOYW1lID09PSAnQScgJiYgdGFyZ2V0LmNsYXNzTmFtZS5lbmRzV2l0aCgnLS10aXRsZScpKSB7CiAgICAgICAgICBldi5wcmV2ZW50RGVmYXVsdCgpOwogICAgICAgICAgZXYuc3RvcFByb3BhZ2F0aW9uKCk7CiAgICAgICAgICB0aGlzLmN1cnJXaW5kb3dTcmMgPSB0YXJnZXQuaHJlZjsKICAgICAgICB9CiAgICAgIH0KICAgIH0KICB9OwoKICAvKiBzY3JpcHQgKi8KICBjb25zdCBfX3Z1ZV9zY3JpcHRfXyQ5ID0gc2NyaXB0JDk7CgogIC8qIHRlbXBsYXRlICovCiAgdmFyIF9fdnVlX3JlbmRlcl9fJDkgPSBmdW5jdGlvbigpIHsKICAgIHZhciBfdm0gPSB0aGlzOwogICAgdmFyIF9oID0gX3ZtLiRjcmVhdGVFbGVtZW50OwogICAgdmFyIF9jID0gX3ZtLl9zZWxmLl9jIHx8IF9oOwogICAgcmV0dXJuIF9jKCJ0bS1jb250YWluZXIiLCBbCiAgICAgIF9jKAogICAgICAgICJkaXYiLAogICAgICAgIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYiLCBvbjogeyBjbGljazogX3ZtLmhhbmRsZUdsb2JhbENsaWNrIH0gfSwKICAgICAgICBbCiAgICAgICAgICBfYygKICAgICAgICAgICAgImhlYWRlciIsCiAgICAgICAgICAgIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtaGVhZGVyIiB9LAogICAgICAgICAgICBbCiAgICAgICAgICAgICAgX2MoImlucHV0IiwgewogICAgICAgICAgICAgICAgZGlyZWN0aXZlczogWwogICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgbmFtZTogIm1vZGVsIiwKICAgICAgICAgICAgICAgICAgICByYXdOYW1lOiAidi1tb2RlbCIsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IF92bS5vcHRpb25zLnNob3dBcHAsCiAgICAgICAgICAgICAgICAgICAgZXhwcmVzc2lvbjogIm9wdGlvbnMuc2hvd0FwcCIKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIGF0dHJzOiB7IHR5cGU6ICJjaGVja2JveCIgfSwKICAgICAgICAgICAgICAgIGRvbVByb3BzOiB7CiAgICAgICAgICAgICAgICAgIGNoZWNrZWQ6IEFycmF5LmlzQXJyYXkoX3ZtLm9wdGlvbnMuc2hvd0FwcCkKICAgICAgICAgICAgICAgICAgICA/IF92bS5faShfdm0ub3B0aW9ucy5zaG93QXBwLCBudWxsKSA+IC0xCiAgICAgICAgICAgICAgICAgICAgOiBfdm0ub3B0aW9ucy5zaG93QXBwCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgb246IHsKICAgICAgICAgICAgICAgICAgY2hhbmdlOiBmdW5jdGlvbigkZXZlbnQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgJCRhID0gX3ZtLm9wdGlvbnMuc2hvd0FwcCwKICAgICAgICAgICAgICAgICAgICAgICQkZWwgPSAkZXZlbnQudGFyZ2V0LAogICAgICAgICAgICAgICAgICAgICAgJCRjID0gJCRlbC5jaGVja2VkID8gdHJ1ZSA6IGZhbHNlOwogICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KCQkYSkpIHsKICAgICAgICAgICAgICAgICAgICAgIHZhciAkJHYgPSBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAkJGkgPSBfdm0uX2koJCRhLCAkJHYpOwogICAgICAgICAgICAgICAgICAgICAgaWYgKCQkZWwuY2hlY2tlZCkgewogICAgICAgICAgICAgICAgICAgICAgICAkJGkgPCAwICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgX3ZtLiRzZXQoX3ZtLm9wdGlvbnMsICJzaG93QXBwIiwgJCRhLmNvbmNhdChbJCR2XSkpOwogICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgJCRpID4gLTEgJiYKICAgICAgICAgICAgICAgICAgICAgICAgICBfdm0uJHNldCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF92bS5vcHRpb25zLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgInNob3dBcHAiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJCRhLnNsaWNlKDAsICQkaSkuY29uY2F0KCQkYS5zbGljZSgkJGkgKyAxKSkKICAgICAgICAgICAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICBfdm0uJHNldChfdm0ub3B0aW9ucywgInNob3dBcHAiLCAkJGMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgIF92bS5fdigiIOi/m+WFpee9keermeiHquWKqOWKoOi9veacrOiEmuacrFxyXG4gICAgICAiKSwKICAgICAgICAgICAgICBfYygiaW5wdXQiLCB7CiAgICAgICAgICAgICAgICBkaXJlY3RpdmVzOiBbCiAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBuYW1lOiAibW9kZWwiLAogICAgICAgICAgICAgICAgICAgIHJhd05hbWU6ICJ2LW1vZGVsIiwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogX3ZtLm9wdGlvbnMuYXV0b3BsYXksCiAgICAgICAgICAgICAgICAgICAgZXhwcmVzc2lvbjogIm9wdGlvbnMuYXV0b3BsYXkiCiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBhdHRyczogeyB0eXBlOiAiY2hlY2tib3giIH0sCiAgICAgICAgICAgICAgICBkb21Qcm9wczogewogICAgICAgICAgICAgICAgICBjaGVja2VkOiBBcnJheS5pc0FycmF5KF92bS5vcHRpb25zLmF1dG9wbGF5KQogICAgICAgICAgICAgICAgICAgID8gX3ZtLl9pKF92bS5vcHRpb25zLmF1dG9wbGF5LCBudWxsKSA+IC0xCiAgICAgICAgICAgICAgICAgICAgOiBfdm0ub3B0aW9ucy5hdXRvcGxheQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG9uOiB7CiAgICAgICAgICAgICAgICAgIGNoYW5nZTogZnVuY3Rpb24oJGV2ZW50KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyICQkYSA9IF92bS5vcHRpb25zLmF1dG9wbGF5LAogICAgICAgICAgICAgICAgICAgICAgJCRlbCA9ICRldmVudC50YXJnZXQsCiAgICAgICAgICAgICAgICAgICAgICAkJGMgPSAkJGVsLmNoZWNrZWQgPyB0cnVlIDogZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoJCRhKSkgewogICAgICAgICAgICAgICAgICAgICAgdmFyICQkdiA9IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICQkaSA9IF92bS5faSgkJGEsICQkdik7CiAgICAgICAgICAgICAgICAgICAgICBpZiAoJCRlbC5jaGVja2VkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICQkaSA8IDAgJiYKICAgICAgICAgICAgICAgICAgICAgICAgICBfdm0uJHNldChfdm0ub3B0aW9ucywgImF1dG9wbGF5IiwgJCRhLmNvbmNhdChbJCR2XSkpOwogICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgJCRpID4gLTEgJiYKICAgICAgICAgICAgICAgICAgICAgICAgICBfdm0uJHNldCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF92bS5vcHRpb25zLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgImF1dG9wbGF5IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICQkYS5zbGljZSgwLCAkJGkpLmNvbmNhdCgkJGEuc2xpY2UoJCRpICsgMSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgX3ZtLiRzZXQoX3ZtLm9wdGlvbnMsICJhdXRvcGxheSIsICQkYyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgX3ZtLl92KCIg6Ieq5Yqo5pKt5pS+XHJcbiAgICAgICIpLAogICAgICAgICAgICAgIF9jKCJpbnB1dCIsIHsKICAgICAgICAgICAgICAgIGRpcmVjdGl2ZXM6IFsKICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIG5hbWU6ICJtb2RlbCIsCiAgICAgICAgICAgICAgICAgICAgcmF3TmFtZTogInYtbW9kZWwiLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBfdm0ub3B0aW9ucy5tdXRlZCwKICAgICAgICAgICAgICAgICAgICBleHByZXNzaW9uOiAib3B0aW9ucy5tdXRlZCIKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIGF0dHJzOiB7IHR5cGU6ICJjaGVja2JveCIgfSwKICAgICAgICAgICAgICAgIGRvbVByb3BzOiB7CiAgICAgICAgICAgICAgICAgIGNoZWNrZWQ6IEFycmF5LmlzQXJyYXkoX3ZtLm9wdGlvbnMubXV0ZWQpCiAgICAgICAgICAgICAgICAgICAgPyBfdm0uX2koX3ZtLm9wdGlvbnMubXV0ZWQsIG51bGwpID4gLTEKICAgICAgICAgICAgICAgICAgICA6IF92bS5vcHRpb25zLm11dGVkCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgb246IHsKICAgICAgICAgICAgICAgICAgY2hhbmdlOiBmdW5jdGlvbigkZXZlbnQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgJCRhID0gX3ZtLm9wdGlvbnMubXV0ZWQsCiAgICAgICAgICAgICAgICAgICAgICAkJGVsID0gJGV2ZW50LnRhcmdldCwKICAgICAgICAgICAgICAgICAgICAgICQkYyA9ICQkZWwuY2hlY2tlZCA/IHRydWUgOiBmYWxzZTsKICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheSgkJGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICB2YXIgJCR2ID0gbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgJCRpID0gX3ZtLl9pKCQkYSwgJCR2KTsKICAgICAgICAgICAgICAgICAgICAgIGlmICgkJGVsLmNoZWNrZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgJCRpIDwgMCAmJgogICAgICAgICAgICAgICAgICAgICAgICAgIF92bS4kc2V0KF92bS5vcHRpb25zLCAibXV0ZWQiLCAkJGEuY29uY2F0KFskJHZdKSk7CiAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAkJGkgPiAtMSAmJgogICAgICAgICAgICAgICAgICAgICAgICAgIF92bS4kc2V0KAogICAgICAgICAgICAgICAgICAgICAgICAgICAgX3ZtLm9wdGlvbnMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAibXV0ZWQiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJCRhLnNsaWNlKDAsICQkaSkuY29uY2F0KCQkYS5zbGljZSgkJGkgKyAxKSkKICAgICAgICAgICAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICBfdm0uJHNldChfdm0ub3B0aW9ucywgIm11dGVkIiwgJCRjKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICBfdm0uX3YoIiDpnZnpn7Pmkq3mlL5cclxuICAgICAgIiksCiAgICAgICAgICAgICAgX2MoImlucHV0IiwgewogICAgICAgICAgICAgICAgZGlyZWN0aXZlczogWwogICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgbmFtZTogIm1vZGVsIiwKICAgICAgICAgICAgICAgICAgICByYXdOYW1lOiAidi1tb2RlbCIsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IF92bS5vcHRpb25zLmxvYWRQcmV2U3RhdHVzLAogICAgICAgICAgICAgICAgICAgIGV4cHJlc3Npb246ICJvcHRpb25zLmxvYWRQcmV2U3RhdHVzIgogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgYXR0cnM6IHsgdHlwZTogImNoZWNrYm94IiB9LAogICAgICAgICAgICAgICAgZG9tUHJvcHM6IHsKICAgICAgICAgICAgICAgICAgY2hlY2tlZDogQXJyYXkuaXNBcnJheShfdm0ub3B0aW9ucy5sb2FkUHJldlN0YXR1cykKICAgICAgICAgICAgICAgICAgICA/IF92bS5faShfdm0ub3B0aW9ucy5sb2FkUHJldlN0YXR1cywgbnVsbCkgPiAtMQogICAgICAgICAgICAgICAgICAgIDogX3ZtLm9wdGlvbnMubG9hZFByZXZTdGF0dXMKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBvbjogewogICAgICAgICAgICAgICAgICBjaGFuZ2U6IGZ1bmN0aW9uKCRldmVudCkgewogICAgICAgICAgICAgICAgICAgIHZhciAkJGEgPSBfdm0ub3B0aW9ucy5sb2FkUHJldlN0YXR1cywKICAgICAgICAgICAgICAgICAgICAgICQkZWwgPSAkZXZlbnQudGFyZ2V0LAogICAgICAgICAgICAgICAgICAgICAgJCRjID0gJCRlbC5jaGVja2VkID8gdHJ1ZSA6IGZhbHNlOwogICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KCQkYSkpIHsKICAgICAgICAgICAgICAgICAgICAgIHZhciAkJHYgPSBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAkJGkgPSBfdm0uX2koJCRhLCAkJHYpOwogICAgICAgICAgICAgICAgICAgICAgaWYgKCQkZWwuY2hlY2tlZCkgewogICAgICAgICAgICAgICAgICAgICAgICAkJGkgPCAwICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgX3ZtLiRzZXQoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdm0ub3B0aW9ucywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJsb2FkUHJldlN0YXR1cyIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkJGEuY29uY2F0KFskJHZdKQogICAgICAgICAgICAgICAgICAgICAgICAgICk7CiAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAkJGkgPiAtMSAmJgogICAgICAgICAgICAgICAgICAgICAgICAgIF92bS4kc2V0KAogICAgICAgICAgICAgICAgICAgICAgICAgICAgX3ZtLm9wdGlvbnMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAibG9hZFByZXZTdGF0dXMiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJCRhLnNsaWNlKDAsICQkaSkuY29uY2F0KCQkYS5zbGljZSgkJGkgKyAxKSkKICAgICAgICAgICAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICBfdm0uJHNldChfdm0ub3B0aW9ucywgImxvYWRQcmV2U3RhdHVzIiwgJCRjKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICBfdm0uX3YoIiDoh6rliqjliqDovb3kuIrkuIDmrKHmtY/op4jnirbmgIFcclxuICAgICAgIiksCiAgICAgICAgICAgICAgX2MoImlucHV0IiwgewogICAgICAgICAgICAgICAgZGlyZWN0aXZlczogWwogICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgbmFtZTogIm1vZGVsIiwKICAgICAgICAgICAgICAgICAgICByYXdOYW1lOiAidi1tb2RlbCIsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IF92bS5vcHRpb25zLnVzZVdpbmRvdywKICAgICAgICAgICAgICAgICAgICBleHByZXNzaW9uOiAib3B0aW9ucy51c2VXaW5kb3ciCiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBhdHRyczogeyB0eXBlOiAiY2hlY2tib3giIH0sCiAgICAgICAgICAgICAgICBkb21Qcm9wczogewogICAgICAgICAgICAgICAgICBjaGVja2VkOiBBcnJheS5pc0FycmF5KF92bS5vcHRpb25zLnVzZVdpbmRvdykKICAgICAgICAgICAgICAgICAgICA/IF92bS5faShfdm0ub3B0aW9ucy51c2VXaW5kb3csIG51bGwpID4gLTEKICAgICAgICAgICAgICAgICAgICA6IF92bS5vcHRpb25zLnVzZVdpbmRvdwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG9uOiB7CiAgICAgICAgICAgICAgICAgIGNoYW5nZTogZnVuY3Rpb24oJGV2ZW50KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyICQkYSA9IF92bS5vcHRpb25zLnVzZVdpbmRvdywKICAgICAgICAgICAgICAgICAgICAgICQkZWwgPSAkZXZlbnQudGFyZ2V0LAogICAgICAgICAgICAgICAgICAgICAgJCRjID0gJCRlbC5jaGVja2VkID8gdHJ1ZSA6IGZhbHNlOwogICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KCQkYSkpIHsKICAgICAgICAgICAgICAgICAgICAgIHZhciAkJHYgPSBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAkJGkgPSBfdm0uX2koJCRhLCAkJHYpOwogICAgICAgICAgICAgICAgICAgICAgaWYgKCQkZWwuY2hlY2tlZCkgewogICAgICAgICAgICAgICAgICAgICAgICAkJGkgPCAwICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgX3ZtLiRzZXQoX3ZtLm9wdGlvbnMsICJ1c2VXaW5kb3ciLCAkJGEuY29uY2F0KFskJHZdKSk7CiAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAkJGkgPiAtMSAmJgogICAgICAgICAgICAgICAgICAgICAgICAgIF92bS4kc2V0KAogICAgICAgICAgICAgICAgICAgICAgICAgICAgX3ZtLm9wdGlvbnMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAidXNlV2luZG93IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICQkYS5zbGljZSgwLCAkJGkpLmNvbmNhdCgkJGEuc2xpY2UoJCRpICsgMSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgX3ZtLiRzZXQoX3ZtLm9wdGlvbnMsICJ1c2VXaW5kb3ciLCAkJGMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgIF92bS5fdigiIOeCueWHu+agh+mimOWcqOWwj+eql+WPo+aJk+W8gFxyXG4gICAgICAiKSwKICAgICAgICAgICAgICBfYygidG0tc2VhcmNoIiwgewogICAgICAgICAgICAgICAgb246IHsKICAgICAgICAgICAgICAgICAgc2VsZWN0OiBmdW5jdGlvbih2KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChfdm0uY3VyclZpZGVvID0gdikKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0pCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIDEKICAgICAgICAgICksCiAgICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICAgIF9jKAogICAgICAgICAgICAiZGl2IiwKICAgICAgICAgICAgeyBzdGF0aWNDbGFzczogInRtLWphdi1ib2R5IiB9LAogICAgICAgICAgICBbCiAgICAgICAgICAgICAgX2MoInRtLXByZXZpZXciLCB7CiAgICAgICAgICAgICAgICBkaXJlY3RpdmVzOiBbCiAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBuYW1lOiAic2hvdyIsCiAgICAgICAgICAgICAgICAgICAgcmF3TmFtZTogInYtc2hvdyIsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IF92bS5jdXJyVmlkZW8sCiAgICAgICAgICAgICAgICAgICAgZXhwcmVzc2lvbjogImN1cnJWaWRlbyIKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIHN0YXRpY1N0eWxlOiB7IGZsZXg6ICIxIiB9LAogICAgICAgICAgICAgICAgYXR0cnM6IHsgdmlkZW86IF92bS5jdXJyVmlkZW8gfSwKICAgICAgICAgICAgICAgIG9uOiB7CiAgICAgICAgICAgICAgICAgIHNlbGVjdDogZnVuY3Rpb24odikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoX3ZtLmN1cnJWaWRlbyA9IHYpCiAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgIGNsb3NlOiBmdW5jdGlvbigkZXZlbnQpIHsKICAgICAgICAgICAgICAgICAgICBfdm0uY3VyclZpZGVvID0gbnVsbDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgICAgIF9jKAogICAgICAgICAgICAgICAgImRpdiIsCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgIHN0YXRpY0NsYXNzOiAidG0tamF2LW1haW4tbGlzdCIsCiAgICAgICAgICAgICAgICAgIHN0eWxlOiB7IHdpZHRoOiBfdm0uY3VyclZpZGVvID8gIjM1JSIgOiAiMTAwJSIgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgX2MoInRtLXRhYnMiLCB7CiAgICAgICAgICAgICAgICAgICAgYXR0cnM6IHsgY3VyckluZGV4OiBfdm0udGFiSW5kZXgsIHRhYnM6IF92bS50YWJzIH0sCiAgICAgICAgICAgICAgICAgICAgb246IHsKICAgICAgICAgICAgICAgICAgICAgIGFjdGl2ZTogZnVuY3Rpb24oaW5kZXgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChfdm0udGFiSW5kZXggPSBpbmRleCkKICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICByZW1vdmU6IF92bS5yZW1vdmVUYWIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICAgICAgICAgICAgX2MoInRtLWxpc3QiLCB7CiAgICAgICAgICAgICAgICAgICAgYXR0cnM6IHsgdGFiOiBfdm0uY3VyclRhYiB9LAogICAgICAgICAgICAgICAgICAgIG9uOiB7CiAgICAgICAgICAgICAgICAgICAgICBzZWxlY3Q6IGZ1bmN0aW9uKHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChfdm0uY3VyclZpZGVvID0gdikKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICkKICAgICAgICAgICAgXSwKICAgICAgICAgICAgMQogICAgICAgICAgKSwKICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgX2MoImZvb3RlciIsIHsgc3RhdGljQ2xhc3M6ICJ0bS1qYXYtZm9vdGVyIiB9LCBbX2MoInRtLWxvZyIpXSwgMSksCiAgICAgICAgICBfdm0uX3YoIiAiKSwKICAgICAgICAgIF9jKCJ0bS1nZW5yZXMiKSwKICAgICAgICAgIF92bS5fdigiICIpLAogICAgICAgICAgX2MoInRtLXdpbmRvdyIsIHsKICAgICAgICAgICAgYXR0cnM6IHsgc3JjOiBfdm0uY3VycldpbmRvd1NyYyB9LAogICAgICAgICAgICBvbjogewogICAgICAgICAgICAgIGNsb3NlOiBmdW5jdGlvbigkZXZlbnQpIHsKICAgICAgICAgICAgICAgIF92bS5jdXJyV2luZG93U3JjID0gIiI7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9KQogICAgICAg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odGFiKSB7XHJcbiAgICAgIHRyeSB7XHJcbiAgICAgICAgY29uc3Qge25hbWUsIGhyZWZ9ID0gdGFiXHJcbiAgICAgICAgY29uc3QgaW5kZXggPSB0aGlzLnRhYnMuZmluZEluZGV4KCh0YWIpID0+IHRhYi5ocmVmID09PSBocmVmKVxyXG4gICAgICAgIGlmIChpbmRleCA+IC0xKSB7XHJcbiAgICAgICAgICB0aGlzLnRhYkluZGV4ID0gaW5kZXhcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgY29uc3QgbGVuID0gdGhpcy50YWJzLnB1c2goe25hbWUsIGhyZWZ9KVxyXG4gICAgICAgICAgdGhpcy50YWJJbmRleCA9IGxlbiAtIDFcclxuICAgICAgICB9XHJcbiAgICAgIH0gY2F0Y2ggKGUpIHtcclxuICAgICAgICBjb25zb2xlLmVycm9yKGUpXHJcbiAgICAgIH1cclxuICAgIH0sXHJcbiAgICBvbkNsb3NlICgpIHtcclxuICAgICAgcHJldlN0YXR1cy5zZXQodGhpcy5fZGF0YSlcclxuICAgIH0sXHJcbiAgICBpbml0ICgpIHtcclxuICAgICAgY29uc3QgcHJldiA9IHByZXZTdGF0dXMuZ2V0KClcclxuICAgICAgaWYgKCFwcmV2KSB7XHJcbiAgICAgICAgcmV0dXJuXHJcbiAgICAgIH1cclxuICAgICAgY29uc3QgbG9hZFByZXZTdGF0dXMgPSBwcmV2Lm9wdGlvbnMgJiYgcHJldi5vcHRpb25zLmxvYWRQcmV2U3RhdHVzXHJcbiAgICAgIHByZXYub3B0aW9ucyAmJiAodGhpcy5vcHRpb25zID0gey4uLnRoaXMub3B0aW9ucywgLi4ucHJldi5vcHRpb25zfSlcclxuICAgICAgaWYgKHByZXYgJiYgbG9hZFByZXZTdGF0dXMgIT09IGZhbHNlKSB7XHJcbiAgICAgICAgZm9yIChsZXQga2V5IGluIHByZXYpIHtcclxuICAgICAgICAgIGlmIChrZXkgIT09ICdvcHRpb25zJykge1xyXG4gICAgICAgICAgICB0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