Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥完美世界@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuKTuOmAmueUqOino+aekFwiLFwicGF0aFwiOlwibGF6eVwiLFwicnVsZVwiOlwiXFxudmFyIGxhenkgPSAkKCcnKS5sYXp5UnVsZSgoKSA9PiB7XFxuaWYgKGlucHV0LmluZGV4T2YoJ21hZ25ldDo/eHQnKSA9PSAtMSkge1xcbiAgICB0cnl7XFxuICAgICAgdmFyIGh0bWwgPSBKU09OLnBhcnNlKHJlcXVlc3QoaW5wdXQpLm1hdGNoKC9yIHBsYXllcl8uKj89KC4qPyk8LylbMV0pXFxuICAgIHZhciB1cmwgPSBodG1sLnVybFxcbiAgICBpZiAoaHRtbC5lbmNyeXB0ID09ICcxJykge1xcbiAgICAgICAgdXJsID0gdW5lc2NhcGUodXJsKTtcXG4gICAgfSBlbHNlIGlmIChodG1sLmVuY3J5cHQgPT0gJzInKSB7XFxuICAgICAgICB1cmwgPSB1bmVzY2FwZShiYXNlNjREZWNvZGUodXJsKSk7XFxuICAgIH1cXG4gICAgaWYgKC9tM3U4fG1wNHxmbHYvLnRlc3QodXJsKSkge1xcbiAgICAgICBpZiAoL3Z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sXFxuICAgICAgICBpbWc6IGl0ZW0uaW1nLFxcbiAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLFxcbiAgICAgICAgdXJsOiBpdGVtLnVybCxcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgaWQ6IGlkKydiYXInLFxcbiAgICAgICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLFxcbiAgICAgICAgICAgIGltZzogaXRlbS5pbWcsXFxuICAgICAgICB9XFxuICAgIH0pXFxuXFxuICAgIGlmIChzdGFydCA9PSBmYWxzZSB8fCBnZXRNeVZhcignYmVuc3RhcnQnLCAndHJ1ZScpID09ICdmYWxzZScpIHtcXG4gICAgICAgIHVuUmVnaXN0ZXJUYXNrKGlkKVxcbiAgICAgICAgcmV0dXJuXFxuICAgIH1cXG4gICAgXFxuICAgIC8vbG9nKGRhdGEpXFxuXFxuICAgIGxldCBvYmogPSB7XFxuICAgICAgICBkYXRhOiBkYXRhLFxcbiAgICB9O1xcblxcbiAgICByZWdpc3RlclRhc2soaWQsIHRpbWUsICQudG9TdHJpbmcoKG9iaixpZCkgPT4ge1xcbiAgICAgICAgdmFyIGRhdGEgPSBvYmouZGF0YTtcXG4gICAgICAgIHZhciBydW0gPSBnZXRNeVZhcigncm51bScpO1xcblxcbiAgICAgICAgdmFyIGkgPSBOdW1iZXIoZ2V0TXlWYXIoJ2Jhbm5lcmknLCAnMCcpKTtcXG4gICAgICAgIGlmIChydW0gIT0gJycpIHtcXG4gICAgICAgICAgICBpID0gTnVtYmVyKHJ1bSkgKyAxXFxuICAgICAgICAgICAgY2xlYXJNeVZhcigncm51bScpXFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGkgPSBpICsgMTtcXG4gICAgICAgIH1cXG4gICAgICAgIC8vbG9nKGkpXFxuICAgICAgICAvL2xvZyhkYXRhLmxlbmd0aClcXG5cXG4gICAgICAgIGlmIChpID4gZGF0YS5sZW5ndGggLSAxKSB7XFxuICAgICAgICAgICAgaSA9IDBcXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBpdGVtID0gZGF0YVtpXTtcXG4gICAgICAgIC8vbG9nKGl0ZW0pXFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oaWQrJ2JhcicsIHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0udGl0bGUsXFxuICAgICAgICAgICAgICAgIGltZzogaXRlbS5pbWcsXFxuICAgICAgICAgICAgICAgIHVybDogaXRlbS51cmwsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGltZzogaXRlbS5pbWcsXFxuICAgICAgICAgICAgICAgICAgICAvL25hbWU6IGl0ZW0udGl0bGUucmVwbGFjZSgvPFtePl0rPi9nLCAnJyksXFxuICAgICAgICAgICAgICAgICAgICAvL3NuYW1lOiBpdGVtLmV4dHJhLnNuYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgLy9zdHlwZTogaXRlbS5leHRyYS5zdHlwZSxcXG4gICAgICAgICAgICAgICAgICAgIC8vc3VybDogaXRlbS51cmwsXFxuICAgICAgICAgICAgICAgICAgICAvL2ltZzppdGVtLmltZyxcXG4gICAgICAgICAgICAgICAgICAgIC8vcGFnZVRpdGxlOiBpdGVtLnRpdGxlLnJlcGxhY2UoLzxbXj5dKz4vZywgJycpLFxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBsb2coZS5tZXNzYWdlKVxcbiAgICAgICAgICAgIHVuUmVnaXN0ZXJUYXNrKGlkKVxcbiAgICAgICAgfVxcbiAgICAgICAgcHV0TXlWYXIoJ2Jhbm5lcmknLCBpKTtcXG5cXG4gICAgfSwgb2JqLGlkKSlcXG59XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLikaDkuIDnuqfpobXpnaJcIixcInBhdGhcIjpcInlpXCIsXCJydWxlXCI6XCJ2YXIgSWNvbl9wcmVmaXggPSAnaHR0cHM6Ly9oaWtlcmZhbnMuY29tL3R1Ymlhby9tb3JlLyc7XFxuXFxuLy/liLfmlrAgICAgICAgXFxuICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfliLfmlrAnLFxcbiAgICAgICAgICAgIHVybDogJCgpLmxhenlSdWxlKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIt+aWsOaIkOWKnycgIFxcbiAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgIHBpY191cmw6IEljb25fcHJlZml4ICsgJzE0LnBuZycrIFxcXCJAUmVmZXJlcj1cXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaWNvbl81XFxcIlxcbiAgICAgICAgfSk7XFxuXFxuLy/nrZvpgIlcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfnrZvpgIknLFxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9zaGFpP3BhZ2U9ZnlwYWdlI25vSGlzdG9yeSMnLFxcbiAgICAgICAgICAgIHBpY191cmw6IEljb25fcHJlZml4ICsgJzMxLnBuZycgKyBcXFwiQFJlZmVyZXI9XFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImljb25fNVxcXCJcXG4gICAgICAgIH0pO1xcblxcbi8v5pCc57SiXFxuICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfmkJzntKInLFxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9zcycsXFxuICAgICAgICAgICAgcGljX3VybDogSWNvbl9wcmVmaXggKyAnNy5wbmcnICsgXFxcIkBSZWZlcmVyPVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJpY29uXzVcXFwiXFxuICAgICAgICB9KTtcXG5cXG4vL+abtOaWsFxcbiAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+abtOaWsCcsXFxuICAgICAgICAgICAgdXJsOiAnaGlrZXI6Ly9wYWdlL2d4eCcsXFxuICAgICAgICAgICAgcGljX3VybDogSWNvbl9wcmVmaXggKyAnMjc3LnBuZycgKyBcXFwiQFJlZmVyZXI9XFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImljb25fNVxcXCJcXG4gICAgICAgIH0pO1xcblxcbi8v5YiH5o2iXFxuY29uc3QgZm9sZCA9IGdldE15VmFyKCdsaWUuZ3JvdXAnLCBcXFwiMVxcXCIpXFxuZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+WIh+aNoicsXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChmb2xkKSA9PiB7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCdsaWUuZ3JvdXAnLCBmb2xkID09PSAnMScgPyAnMCcgOiAnMScpO1xcblxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgIH0sIGZvbGQpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnaWNvbl81JyxcXG4gICAgICAgICAgICBwaWNfdXJsOiBJY29uX3ByZWZpeCArICcyMDAucG5nJyArIFxcXCJAUmVmZXJlcj1cXFwiLFxcbiAgICAgICAgfSk7XFxuLypcXG5kLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCJcXG4gICAgICAgIH0pOyovXFxuZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2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rJywgbm93X1dlZWspO1xcbnZhciB3a1RvbnVtID0gZnVuY3Rpb24od2spIHtcXG4gICAgICAgIGlmICgv5ZGofOaYn+acny8udGVzdCh3aykpIHtcXG4gICAgICAgICAgICB3ayA9IHdrLnJlcGxhY2UoL+WRqHzmmJ/mnJ8vLCBcXFwiXFxcIilcXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBtYXAgPSB7XFxuICAgICAgICAgICAgXFxcIuaXpVxcXCI6IDYsXFxuICAgICAgICAgICAgXFxcIuS4gFxcXCI6IDAsXFxuICAgICAgICAgICAgXFxcIuS6jFxcXCI6IDEsXFxuICAgICAgICAgICAgXFxcIuS4iVxcXCI6IDIsXFxuICAgICAgICAgICAgXFxcIuWbm1xcXCI6IDMsXFxuICAgICAgICAgICAgXFxcIuS6lFxcXCI6IDQsXFxuICAgICAgICAgICAgXFxcIuWFrVxcXCI6IDVcXG4gICAgICAgIH07XFxuICAgICAgICByZXR1cm4gbWFwW3drXVxcbiAgICB9XFxuICAgIGxldCB3a19udW0gPSB3a1RvbnVtKGNob3NlX3dlZWspO1xcbi8vbG9nKHdrX251bSlcXG5mb3IgKHZhciBrID0gMDsgayA8PSA2OyBrKyspIHtcXG4gICAgZXZhbCgndmFyIHdrJyArIGsgKyAnPXBkZmEoaHRtbCwgXFxcImJvZHkmJi50YWItbGlzdCwnICsgKGs9PTA/MDprKSArICcmJi5tb2R1bGUtaXRlbSwwOjEyXFxcIik7Jyk7Ly/mmJ/mnJ/liJfooahcXG4gICAgaWYgKHdrX251bSA9PSBrKSB7XFxuICAgICAgICBldmFsKCd3aycraykuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgICAgICB2YXIgdXJsbCA9IE1ZX0hPTUUgKyBwZGZoKGl0ZW0sICdhJiZocmVmJykgKyAnI2ltbWVyc2l2ZVRoZW1lIyc7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHBkZmgoaXRlbSwg5qCH6aKYK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B1cmwgPSBodG1sLnVybFxcbiAgICAgICAgICAgIGlmIChodG1sLmVuY3J5cHQgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgIHVybCA9IHVuZXNjYXBlKHVybCk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChodG1sLmVuY3J5cHQgPT0gJzInKSB7XFxuICAgICAgICAgICAgICAgIHVybCA9IHVuZXNjYXBlKGJhc2U2NERlY29kZSh1cmwpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKC9tM3U4fG1wNC8udGVzdCh1cmwpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB1cmxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInZpZGVvOi8vXFxcIiArIGlucHV0XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidmlkZW86Ly9cXFwiICsgaW5wdXRcXG4gICAgICAgIH1cXG4gICAgfSksXFxuICAgIHVwZGF0YTogZnVuY3Rpb24ocnVsZSwgaGVhZGVycykge1xcbiAgICAgICAgaGVhZGVycyA9IGhlYWRlcnMgIT0gdW5kZWZpbmVkID8gaGVhZGVycyA6IHt9O1xcbiAgICAgICAgc2V0TGFzdENoYXB0ZXJSdWxlKCdqczonICsgJC50b1N0cmluZygodXJsLCBydWxlLCBoZWFkZXJzKSA9PiB7XFxuICAgICAgICAgICAgdmFyIGh0bWwgPSBmZXRjaCh1cmwsIGhlYWRlcnMpO1xcbiAgICAgICAgICAgIHNldFJlc3VsdChldmFsKHJ1bGUpKVxcbiAgICAgICAgfSwgTVlfVVJMLCBydWxlLCBoZWFkZXJzKSlcXG4gICAgfSxcXG4gICAgY2xvc2U6IGZ1bmN0aW9uKGxpc3QsIHNvcnRzKSB7XFxuICAgICAgICBhZGRMaXN0ZW5lcignb25DbG9zZScsICQudG9TdHJpbmcoKGxpc3QsIHNvcnR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ZXNjLmNvbnN0cnVjdG9yID09IEFycmF5ID8gZGVzYy5qb2luKCc8YnI+JykgOiBkZXNjO1xcbiAgICAgICAgaWYgKGRlc2MucmVwbGFjZSgvKDxicj58XFxcXHMrKS9nLCAnJykubGVuZ3RoID09IDApIHtcXG4gICAgICAgICAgICByZXR1cm5cXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBpbmZvID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX2luZm8nLCAne30nKVxcbiAgICAgICAgaWYgKGluZm9bJ2Rlc2MnXSAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICBpbmZvWydkZXNjJ10gPSBpbmZvWydkZXNjJ10gKyAnIOeugOS7izonICsgZGVzYztcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfaW5mbycsIGluZm8pO1xcbiAgICAgICAgfVxcblxcbiAgICAgICAgY29uc3QgbWFyayA9ICdkZXNjJztcXG4gICAgICAgIG51bSA9IHR5cGVvZihudW0pID09ICd1bmRlZmluZWQnID8gOTAgOiBudW1cXG4gICAgICAgIGRlc2MgPSBkZXNjLnN0YXJ0c1dpdGgoJ+OAgOOAgCcpID8gZGVzYyA6ICfjgIDjgIAnICsgZGVzYztcXG4gICAgICAgIGRlc2MgPSBkZXNjLnJlcGxhY2UoLycvZywgXFxcIiYjMzk7XFxcIik7XFxuICAgICAgICBkZXNjID0gZGVzYy5yZXBsYWNlKC9cXFxcclxcXFxuL2csIFxcXCI8YnI+XFxcIik7XFxuXFxuICAgICAgICBmdW5jdGlvbiBzdWJzdHIoc3RyLCBtYXhMZW5ndGgpIHtcXG4gICAgICAgICAgICBsZXQgbGVuID0gMDtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBpZiAoc3RyLmNoYXJDb2RlQXQoaSkgPiAyNTUpIHtcXG4gICAgICAgICAgICAgICAgICAgIGxlbiArPSAyO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgbGVuKys7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKGxlbiA+IG1heExlbmd0aCkge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0ci5zbGljZSgwLCBpKSArICcuLi4nO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBzdHI7XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgc2Rlc2MgPSBzdWJzdHIoZGVzYywgbnVtKTtcXG4gICAgICAgIHZhciBsYXp5ID0gJChgI25vTG9hZGluZyNgKS5sYXp5UnVsZSgoZGMsIHNkYywgbSkgPT4ge1xcbiAgICAgICAgICAgIHZhciBzaG93ID0gc3RvcmFnZTAuZ2V0SXRlbShtLCAnMCcpO1xcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IGZpbmRJdGVtKCdkZXNjJykudGl0bGU7XFxuICAgICAgICAgICAgdmFyIHJlID0gLyg8XFxcXC9zbWFsbD48YnI+Lio/PikuKy9nO1xcbiAgICAgICAgICAgIHZhciBleHAgPSAn5bGV5byAOic7XFxuICAgICAgICAgICAgdmFyIHJldCA9ICfmlLbotbc6JztcXG4gICAgICAgICAgICBpZiAoc2hvdyA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbSgnZGVzYycsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKHJldCwgZXhwKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKHJlLCAnJDEnICsgc2RjICsgJzwvc21hbGw+JylcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvKDxcXFxcL3NtYWxsPjxicj48Zm9udCBjb2xvcj1cXFwiKS4qPyhcXFwiPikvLCAnJDEjOEEyQkUyJDInKS8v5pS26LW36aKc6ImyXFxuXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0obSwgJzAnKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKCdkZXNjJywge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoZXhwLCByZXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UocmUsICckMScgKyBkYyArICc8L3NtYWxsPicpXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoLyg8XFxcXC9zbWFsbD48YnI+PGZvbnQgY29sb3I9XFxcIikuKj8oXFxcIj4pLywgJyQxIzAwODAwMCQyJykvL+WxleW8gOminOiJslxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKG0sICcxJyk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBgaGlrZXI6Ly9lbXB0eWBcXG4gICAgICAgIH0sIGRlc2MsIHNkZXNjLCBtYXJrKVxcbiAgICAgICAgdmFyIHNjID0gc3RvcmFnZTAuZ2V0SXRlbShtYXJrLCAnMCcpID09ICcwJyA/ICflsZXlvIA6JyA6ICfmlLbotbc6JztcXG4gICAgICAgIHZhciBkYyA9IHN0b3JhZ2UwLmdldEl0ZW0obWFyaywgJzAnKSA9PSAnMCcgPyBzZGVzYyA6IGRlc2M7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAnJyArICc8Yj48Zm9udCBjb2xvcj1cXFwiIzA5OEFDMVxcXCI+4oi3ICAgICAgICAgICAgICAgICAgICAgIOWJp+aDheeugOS7i1xcdDwvZm9udD48L2I+JyArIFxcXCI8c21hbGw+PGEgc3R5bGU9J3RleHQtZGVjb3JhdGlvbjogbm9uZTsnIGhyZWY9J1xcXCIgKyBsYXp5ICsgXFxcIic+XFxcIiArIHNjICsgJzwvYT48L3NtYWxsPjxicj48Zm9udCBjb2xvcj1cXFwiIzhBMkJFMlxcXCI+JyArIGAke2RjfWAgKyAnPC9zbWFsbD4nLC8v6buY6K6k6aKc6ImyXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdyaWNoX3RleHQnLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiAnZGVzYycsXFxuICAgICAgICAgICAgICAgIGxpbmVTcGFjaW5nOiA2LFxcbiAgICAgICAgICAgICAgICB0ZXh0U2l6ZTogMTUsXFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiB0cnVlLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgIH0sXFxuXFxuXFxuLy/mtbfmiqVcXG4gICAgc3RyQ29udmVydDogZnVuY3Rpb24oYXJyKSB7XFxuICAgICAgICByZXR1cm4gYXJyLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICBzdHIgPSB4O1xcbiAgICAgICAgICAgIGlmICgvKOWvvOa8lHzkuLvmvJR857G75Z6LKe+8mi8udGVzdChzdHIpKSB7XFxuICAgICAgICAgICAgICAgIHN0ciA9IHN0ci5zcGxpdCgnLycpLm1hcCgodmFsLCBpbmRleCkgPT4gKGluZGV4ID09PSAwID8gJycgOiAnJykgKyB2YWwpLnNsaWNlKDAsIDUpLmpvaW4oJyAnKS5yZXBsYWNlKC8gJC8sICcnKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHN0clxcbiAgICAgICAgfSlcXG4gICAgfSxcXG4gICAgc2V0Q29udGVudDogZnVuY3Rpb24ob2JqKSB7XFxuICAgICAgICAvL2xvZyhvYmopXFxuICAgICAgICB2YXIgY29udGVudHMgPSBvYmoubWFpbjtcXG4gICAgICAgIHZhciBzb3J0T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G4gICAgICAgICAgICBjYXNlIDU6XFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDIpO1xcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDIpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlIDY6XFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDMpO1xcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDMpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgIH1cXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdlcl9pbmZvJywge1xcbiAgICAgICAgICAgIGRlc2M6IGRlc2NzLmpvaW4oJ1xcXFxuJyksXFxuICAgICAgICAgICAgaW1nOiBpbWcsXFxuICAgICAgICB9KVxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgIC8vdGl0bGU6ICB0aGlzLnNtYWxsKCB0aXRsZXNbMF0gKyAnXFxcXG4nICt0aXRsZXMuc2xpY2UoMSwgMykuam9pbignXFxcXG4nKSwncmVkJyksXFxuICAgICAgICAgICAgLy9kZXNjOiB0aGlzLnNtYWxsKGRlc2NzLmpvaW4oJ1xcXFxuJyksJyNGRjdGMDAnKSxcXG4gICAgICAgICAgICB0aXRsZTogIHRoaXMuc21hbGwocGRmaChodG1sLCAnLm1vZHVsZS1pbmZvLWl0ZW06bWF0Y2hlcyjlpIfms6jvvJp86L+e6L2977yafOmbhuaVsO+8mnzniYfplb/vvJopJiZUZXh0JykgKyAnXFxcXG4nICsgcGRmaChodG1sLCAnLm1vZHVsZS1pbmZvLXRhZyYmVGV4dCcpLCdyZWQnKSxcXG4gICAgICAgICAgZGVzYzogdGhpcy5zbWFsbChwZGZoKGh0bWwsICcubW9kdWxlLWluZm8taXRlbTpjb250YWlucyjmm7TmlrDvvJopJiZUZXh0JykgKyAnXFxcXG4nICsgcGRmaChodG1sLCAnLm1vZHVsZS1pbmZvLWl0ZW06Y29udGFpbnMo5a+85ryU77yaKSYmVGV4dCcpICsgJ1xcXFxuJyArIHBkZmgoaHRtbCwgJy5tb2R1bGUtaW5mby1pdGVtOmNvbnRhaW5zKOS4u+a8lO+8mikmJlRleHQnKSwnI0ZGN0YwMCcpLFxcbiAgICAgICAgICAgIHBpY191cmw6IGltZyArICdAUmVmZXJlcj0nLFxcbiAgICAgICAgICAgIHVybDogTVlfVVJMLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMV92ZXJ0aWNhbF9waWNfYmx1cicsXFxuICAgICAgICB9KVxcbiAgICAgICAgaWYgKG9iai5kZXNjICE9IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgIHRoaXMuc2V0RGVzYyhvYmouZGVzYyk7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHNldEN1c3RvbTogZnVuY3Rpb24ob2JqLCBpbWcpIHtcXG4gICAgICAgIHZhciBhcnJheSA9IFtdO1xcbiAgICAgICAgaWYgKG9iai5jb25zdHJ1Y3RvciA9PSBBcnJheSkge1xcbiAgICAgICAgICAgIGFycmF5ID0gb2JqO1xcbiAgICAgICAgfVxcbiAgICAgICAgYXJyYXkgPSB0aGlzLnN0ckNvbnZlcnQoYXJyYXkpO1xcbiAgICAgICAgdmFyIHRpdGxlcyA9IFtdO1xcbiAgICAgICAgdmFyIGRlc2NzID0gW107XFxuICAgICAgICBzd2l0Y2ggKGFycmF5Lmxlbmd0aCkge1xcbiAgICAgICAgICAgIGNhc2UgNDpcXG4gICAgICAgICAgICBjYXNlIDU6XFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDIpO1xcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDIpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlIDY6XFxuICAgICAgICAgICAgICAgIH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Gg7IGkrKykge1xcbiAgICAgICAgICAgIHZhciB1cmwgPSAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKCh2YXJpLCBzaHNvcnQsIGksIGxpbmVjKSA9PiB7XFxuXFxuICAgICAgICAgICAgICAgIHZhciBsaXN0cyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfbGlzdCcsICdbXScpO1xcblxcbiAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIodmFyaSArICdmb2xkJywgJzEnKSA9PSAnMCcpIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBidG4gPSBmaW5kSXRlbShzaHNvcnQgKyAnX2J1dHRvbicpO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZvbGRzID0gWyc8Zm9udCBjb2xvcj1cXFwiI0QzRDNEM1xcXCI+4pi3JywgJzxmb250IGNvbG9yPVxcXCIjRkZBNTAwXFxcIj7imLAnXTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwbGlzdCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXG4gICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNvbCA9IHBsaXN0W3Noc29ydF0uY29sX3R5cGU7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgY2xzID0gcGxpc3Rbc2hzb3J0XS5jbHM7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGljID0gcGxpc3Rbc2hzb3J0XS5waWM7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgZXh0cmEgPSBwbGlzdFtzaHNvcnRdLmV4dHJhO1xcbiAgICAgICAgICAgICAgICAgICAgLy9sb2coZXh0cmEpXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGJ0bi5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBidG4udGl0bGUucmVwbGFjZShmb2xkc1swXSwgZm9sZHNbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG5cXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHZhcmkgKyAnZm9sZCcsICcxJyk7XFxuICAgICAgICAgICAgICAgICAgICAvL3JldHVybiAndG9hc3Q6Ly/lsZXlvIDmiY3og73mk43kvZwnO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBsaXN0ID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpO1xcbiAgICAgICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgICAgICB2YXIgY29sID0gcGxpc3Rbc2hzb3J0XS5jb2xfdHlwZTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjbHMgPSBwbGlzdFtzaHNvcnRdLmNscztcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwaWMgPSBwbGlzdFtzaHNvcnRdLnBpYztcXG4gICAgICAgICAgICAgICAgICAgIHZhciBleHRyYSA9IHBsaXN0W3Noc29ydF0uZXh0cmE7XFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhleHRyYSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcih2YXJpLCBpKTtcXG5cXG4gICAgICAgICAgICAgICAgdmFyIHhsaXN0ID0gbGlzdHNbaV07XFxuICAgICAgICAgICAgICAgIGlmICgkLmZ1bmMgIT0gdW5kZWZpbmVkICYmICQuZnVuYy5jb25zdHJ1Y3RvciA9PSBGdW5jdGlvbikge1xcbiAgICAgICAgICAgICAgICAgICAgeGxpc3QgPSAkLmZ1bmMoaSk7XFxuICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2xpc3QnLCB4bGlzdCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIHBsYXlzID0geGxpc3QubWFwKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogeC50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHgudXJsLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBjb2wsXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGljOiBwaWMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IE9iamVjdC5hc3NpZ24oe30sZXh0cmEse1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogeC51cmwucmVwbGFjZSgvQGxhenlSdWxlW1xcXFxzXFxcXFNdKy9nLCAnJyksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogY2xzLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnKSA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlzLnJldmVyc2UoKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB2YXIgcGNmZyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsICd7fScpO1xcbiAgICAgICAgICAgICAgICBpZiAocGNmZ1sn5Y2V5o6oJ10pIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNoJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwY2ZnWydvYmonXVsn5Y2V5o6oJ11bMF1cXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfljZXmjqgnXSA9IGZhbHNlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChwY2ZnWyfpgInmjqgnXSkge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2hzJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwY2ZnWydvYmonXVsn6YCJ5o6oJ11bMF1cXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfpgInmjqgnXSA9IGZhbHNlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsIHBjZmcpO1xcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIHBsYXlzKTtcXG5cXG4gICAgICAgICAgICAgICAgdmFyIHRhYnggPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQgKyAnX3RhYicpO1xcbiAgICAgICAgICAgICAgICB0YWJ4LmZvckVhY2goKHgsIGlpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSB4LnRpdGxlO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT0gaWkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoLyMoXFxcXHcrKT8vZywgbGluZWMpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUucmVwbGFjZSgvIyhcXFxcdyspPy9nLCAnIycpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/liIfmjaLmiJDlip/vvIEnO1xcbiAgICAgICAgICAgIH0sIHZhcmksIHNoc29ydCwgaSwgY3VzdG9tLue6v+i3r+mAieS4rSlcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyAoZ2V0TXlWYXIodmFyaSwgJzAnKSA9PSBpID8gdGFic1tpXS5mb250Y29sb3IoY3VzdG9tLue6v+i3r+mAieS4rSkgOiB0YWJzW2ldLmZvbnRjb2xvcignIycpKSxcXG4gICAgICAgICAgICAgICAgdXJsOiB1cmwsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBjdXN0b20u57q/6Lev5qC35byPLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQgKyAnX3RhYicsXFxuICAgICAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ190YWJfJyArIGksXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogY3VzdG9tLuWIhuWJsuagt+W8jyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ19saW5lJyxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9LFxcbiAgICBwdXNoVGFiOiBmdW5jdGlvbih2YXJpLCBzaHNvcnQpIHtcXG4gICAgICAgIGFkZExpc3RlbmVyKCdvblJlZnJlc2gnLCAkLnRvU3RyaW5nKChzaHNvcnQpID0+IHtcXG4gICAgICAgICAgICBjbGVhck15VmFyKHNoc29ydCArICdfcHVzaGNmZycpO1xcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoc2hzb3J0ICsgJ19kdW9zZWxlY3QnKTtcXG4gICAgICAgIH0sIHNoc29ydCkpXFxuICAgICAgICB2YXIgcG9iaiA9IHtcXG4gICAgICAgICAgICAn5Y2V5o6oJzogWyfipr/ljZXmjqgnLCAnPGI+4qa/5Y2V5o6oPC9iPicuZm9udGNvbG9yKCcjMDBGQTlBJyldLFxcbiAgICAgICAgICAgICfpgInmjqgnOiBbJ+KYkemAieaOqCcsICc8Yj7imJHpgInmjqg8L2I+Jy5mb250Y29sb3IoJyM0NjgyQjQnKV0sXFxuICAgICAgICB9XFxuXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAn4oyYJyxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vZW1wdHknLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGNsczogc2hzb3J0ICsgJ19wdXNodGFiJyxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgdGl0bGU6IHBvYmpbJ+WNleaOqCddWzBdLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChzaHNvcnQsIHBvYmosIHZhcmkpID0+IHtcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKHZhcmkgKyAnZm9sZCcsICcxJykgPT0gJzAnKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bGV5byA5omN6IO95pON5L2cJztcXG4gICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICB2YXIgdGl0bGVzID0gcG9ialsn5Y2V5o6oJ107XFxuICAgICAgICAgICAgICAgIHZhciBwY2ZnID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ19wdXNoY2ZnJywgJ3t9Jyk7XFxuICAgICAgICAgICAgICAgIHBjZmdbJ29iaiddID0gcG9iajtcXG4gICAgICAgICAgICAgICAgdmFyIOWNleaOqCA9IHBjZmdbJ+WNleaOqCddID8gcGNmZ1sn5Y2V5o6oJ10gOiBmYWxzZTtcXG5cXG4gICAgICAgICAgICAgICAgaWYgKOWNleaOqCkge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2gnLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlc1swXSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfljZXmjqgnXSA9IGZhbHNlO1xcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sncGxheWxpc3QnXS5tYXAoKHgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnVybCxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNoJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIHRpdGxlc1sxXSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHMnLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBvYmpbJ+mAieaOqCddWzBdLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ+WNleaOqCddID0gdHJ1ZTtcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ+mAieaOqCddID0gZmFsc2U7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGxheWxpc3QgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sncGxheWxpc3QnXSA9IHBsYXlsaXN0O1xcbiAgICAgICAgICAgICAgICAgICAgZmluZEl0ZW1zQnlDbHMoc2hzb3J0KS5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGRwdXNoID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBnZXRQYWdlVGl0bGUoKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnRpdGxlICsgJyQnICsgeC5leHRyYS5pZFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKCcnKS5sYXp5UnVsZSgoZHB1c2gpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9wYWdlL3B1c2g/cnVsZT1YWVHmjqjpgIEmcHVzaHVybD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KEpTT04uc3RyaW5naWZ5KGRwdXNoKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGRwdXNoKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsIHBjZmcpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8vJyArICjljZXmjqggPyAn5Y2V5o6o5byA5ZCvJyA6ICfljZXmjqjlhbPpl60nKTtcXG4gICAgICAgICAgICB9LCBzaHNvcnQsIHBvYmosIHZhcmkpLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX3B1c2gnLFxcbiAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCArICdfcHVzaHRhYicsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgIHRpdGxlOiBwb2JqWyfpgInmjqgnXVswXSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2hzb3J0LCBwb2JqLCB2YXJpKSA9PiB7XFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcih2YXJpICsgJ2ZvbGQnLCAnMScpID09ICcwJykge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WxleW8gOaJjeiDveaTjeS9nCc7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIHRpdGxlcyA9IHBvYmpbJ+mAieaOqCddO1xcbiAgICAgICAgICAgICAgICB2YXIgcGNmZyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsICd7fScpO1xcbiAgICAgICAgICAgICAgICBwY2ZnWydvYmonXSA9IHBvYmo7XFxuICAgICAgICAgICAgICAgIHZhciDpgInmjqggPSBwY2ZnWyfpgInmjqgnXSA/IHBjZmdbJ+mAieaOqCddIDogZmFsc2U7XFxuICAgICAgICAgICAgICAgIGlmICjpgInmjqgpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNocycsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGVzWzBdLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ+mAieaOqCddID0gZmFsc2U7XFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWydwbGF5bGlzdCddLm1hcCgoeCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogeC50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnVybCxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNodG8nLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmjqjpgIHmnKzpobU9PlRWQm94JyxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihzaHNvcnQgKyAnX2R1b3NlbGVjdCcpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2hzJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIHRpdGxlc1sxXSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfpgInmjqgnXSA9IHRydWU7XFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfljZXmjqgnXSA9IGZhbHNlO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBsYXlsaXN0ID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ3BsYXlsaXN0J10gPSBwbGF5bGlzdDtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBJZHMgPSBwbGF5bGlzdC5tYXAoaXQgPT4gaXQuZXh0cmEuaWQpO1xcbiAgICAgICAgICAgICAgICAgICAgSWRzLmZvckVhY2goeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gZmluZEl0ZW0oeCkudGl0bGU7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJC5tc20odGl0bGUsIHgsIHNoc29ydCksXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNoJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwb2JqWyfljZXmjqgnXVswXSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHRvJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5o6o6YCB6YCJ5LitPT5UVkJveCcsXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCBwY2ZnKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovLycgKyAo6YCJ5o6oID8gJ+mAieaOqOW8gOWQrycgOiAn6YCJ5o6o5YWz6ZetJyk7XFxuICAgICAgICAgICAgfSwgc2hzb3J0LCBwb2JqLCB2YXJpKSxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ19wdXNocycsXFxuICAgICAgICAgICAgICAgIGNsczogc2hzb3J0ICsgJ19wdXNodGFiJ1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuaOqOmAgeacrOmhtT0+VFZCb3hcXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChzaHNvcnQsIHZhcmkpID0+IHtcXG4gICAgICAgICAgICAgICAgdmFyIHBjZmcgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCAne30nKTtcXG4gICAgICAgICAgICAgICAgdmFyIOWNleaOqCA9IHBjZmdbJ+WNleaOqCddID8gcGNmZ1sn5Y2V5o6oJ10gOiBmYWxzZTtcXG4gICAgICAgICAgICAgICAgdmFyIOmAieaOqCA9IHBjZmdbJ+mAieaOqCddID8gcGNmZ1sn6YCJ5o6oJ10gOiBmYWxzZTtcXG4gICAgICAgICAgICAgICAgaWYgKCHljZXmjqggJiYgIemAieaOqCkge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRhYnMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX3RhYnMnLCAnW10nKTtcXG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHBscyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfbGlzdCcsICdbXScpLm1hcChsaSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsaS5tYXAoaXRlbSA9PiBpdGVtLnRpdGxlICsgJyQnICsgaXRlbS51cmwucmVwbGFjZSgvQGxhenlSdWxlW1xcXFxzXFxcXFNdKy9nLCAnJykpLmpvaW4oJyMnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJyQkJCcpO1xcbiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHBscyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArIFxcXCJfbGlzdFxcXCIsICdbXScpLm1hcCh4ID0+IHgudGl0bGUgKyBcXFwiJFxcXCIgKyB4LnVybCkuam9pbihcXFwiI1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0YWJzID0gW3RhYnNbZ2V0TXlWYXIodmFyaSwgJzAnKV1dO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgLypsb2cocGxzKVxcbiAgICAgICAgICAgICAgICAgICAgbG9nKHRhYnMpKi9cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZiAo6YCJ5o6oKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGxzID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgXFxcIl9kdW9zZWxlY3RcXFwiLCAnW10nKS5tYXAoeCA9PiB4LnRpdGxlICsgXFxcIiRcXFwiICsgeC51cmwpLmpvaW4oXFxcIiNcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChwbHMubGVuZ3RoID09IDApIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6YCJ5oup5Li656m6JztcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHZhciB0YWJzID0gWyfmkq3mlL7liJfooagnXTtcXG4gICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICB2YXIgaW5mbyA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9pbmZvJywgJ3t9Jyk7XFxuICAgICAgICAgICAgICAgIHZhciBkZXNjID0gaW5mb1snZGVzYyddO1xcbiAgICAgICAgICAgICAgICB2YXIg5o6o6YCBID0ge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIm5hbWVcXFwiOiBnZXRQYWdlVGl0bGUoKSxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJjb250ZW50XFxcIjogZGVzYyB8fCAnJyxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJwaWNcXFwiOiBpbmZvWydpbWcnXSB8fCAnJyxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJmcm9tXFxcIjogdGFicy5qb2luKCckJCQnKSxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJ1cmxcXFwiOiBwbHMsXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgLy9sb2co5o6o6YCBKVxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9wdXNoP3J1bGU9WFlR5o6o6YCBJnB1c2h1cmw9XFxcIiArIGVuY29kZVVSSUNvbXBvbmVudChKU09OLnN0cmluZ2lmeSjmjqjpgIEpKVxcbiAgICAgICAgICAgIH0sIHNoc29ydCwgdmFyaSksXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfcHVzaHRvJyxcXG4gICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQgKyAnX3B1c2h0YWInXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGNsczogc2hzb3J0ICsgJ19wdXNodGFiJyxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9LFxcbiAgICBzZXRMb25nY2xpY2s6IGZ1bmN0aW9uKHNoc29ydCwgY3VzdG9tKSB7XFxuICAgICAgICByZXR1cm4gW3tcXG4gICAgICAgICAgICB0aXRsZTogJ+agt+W8j/CfjqgnLFxcbiAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChzaHNvcnQpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGFsbF9jb2xzID0gWycnXS5jb25jYXQoZ2V0Q29sVHlwZXMoKSk7XFxuICAgICAgICAgICAgICAgIGFsbF9jb2xzID0gYWxsX2NvbHMuZmlsdGVyKHggPT5cXG4gICAgICAgICAgICAgICAgICAgIC8odGV4dF98ZmxleCkuKi8udGVzdCh4KSAmJiB4ICE9ICd0ZXh0X2ljb24nKTtcXG4gICAgICAgICAgICAgICAgLy9sb2coYWxsX2NvbHMpXFxuICAgICAgICAgICAgICAgIGxldCBjbHMgPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfcGxheWxpc3RzJywgJ3t9JykgfHxcXG4gICAgICAgICAgICAgICAgICAgICcnO1xcbiAgICAgICAgICAgICAgICBpZiAoY2xzW3Noc29ydF0gIT0gJycpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbCA9IGNsc1tzaHNvcnRdLmNvbF90eXBlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGxldCDmjInpkq7moLflvI8gPSBhbGxfY29scy5tYXAoKGl0KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXQgPT09IGNvbCA/ICfwn5GJJyArIGl0IDogaXQ7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBsZXQgdGlwcyA9ICfor7fpgInmi6npgInpm4bmjInpkq7moLflvI8nO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJCjmjInpkq7moLflvI8sIDIsIHRpcHMpLnNlbGVjdCgoc2hzb3J0LCBjbHMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGlucHV0ID0gaW5wdXQucmVwbGFjZSgv8J+RiS9nLCAnJyk7XFxuICAgICAgICAgICAgICAgICAg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BhbiBzdHlsZT1cXFwiY29sb3I6ICcgKyBjdXN0b20u5q2j5bqP6aKc6ImyICsgJ1xcXCI+5q2j5bqPPC9zcGFuPjwvYj4nXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiB2YXJpICsgJzonICsgdGl0bGUsXFxuICAgICAgICAgICAgZGVzYzogJ+WFsScgKyBTdHJpbmcodGFicy5sZW5ndGgpLmZvbnRjb2xvcignIzQ2ODJCNCcpICsgJ+adoee6v+i3rycsXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChzaHNvcnQsIHZhcmksIGN1c3RvbSkgPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgY29uZiA9IGdldE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJyk7XFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcignZXJfJyArIHZhcmkgKyAnZm9sZCcsICcxJykgPT0gJzAnKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bGV5byA5omN6IO95pON5L2cJztcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB2YXIgY2xzbGlzdHMgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICB2YXIgbmV3Y2xzbGlzdCA9ICQuZGF0YUNvbnZlcnQoY2xzbGlzdHMpO1xcblxcbiAgICAgICAgICAgICAgICB2YXIgdGl0bGVzID0gW2Ake2N1c3RvbS7mraPluo/popzoibJ9XFxcIj7mraPluo9gLCBgJHtjdXN0b20u6YCG5bqP6aKc6ImyfVxcXCI+6YCG5bqPYF07XFxuXFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICBuZXdjbHNsaXN0LnJldmVyc2UoKTtcXG4gICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIG5ld2Nsc2xpc3QpO1xcblxcbiAgICAgICAgICAgICAgICB2YXIgb2JqID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInKVxcblxcbiAgICAgICAgICAgICAgICBpZiAoY29uZiA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1sxXSwgdGl0bGVzWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMCcpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX2F2YXRhcicsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogb2JqLnRpdGxlLnJlcGxhY2UodGl0bGVzWzBdLCB0aXRsZXNbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcxJyk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaOkuW6j+aIkOWKnyc7XFxuICAgICAgICAgICAgfSwgc2hzb3J0LCB2YXJpLCBjdXN0b20pLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnYXZhdGFyJyxcXG4gICAgICAgICAgICBpbWc6IGN1c3RvbS7lm77moIcsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfYXZhdGFyJyxcXG4gICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiB0aGlzLnNldExvbmdjbGljayhzaHNvcnQpL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bG9yPVxcXCIjRkZBNTAwXFxcIj7imLAnXTtcXG5cXG4gICAgICAgICAgICAgICAgaWYgKGZvbGQgPT0gJzAnKSB7XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgJzEnKTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjcyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfY2xzJyk7XFxuICAgICAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIob2JqLmV4dHJhLmlkLCBjcyk7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGJ0bi5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBidG4udGl0bGUucmVwbGFjZShmb2xkc1swXSwgZm9sZHNbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZiAoZm9sZCA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKGZvbGRuYW1lLCAnMCcpO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBjbHMgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGN4ID0gJC5kYXRhQ29udmVydChwY2xzKTtcXG4gICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfY2xzJywgY3gpO1xcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGJ0bi5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBidG4udGl0bGUucmVwbGFjZShmb2xkc1sxXSwgZm9sZHNbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxc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ICAgIHZhciBmb2xkbmFtZSA9ICdlcl8nICsgdmFyaSArICdmb2xkJztcXG4gICAgICAgIHZhciBmb2xkID0gZ2V0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxuXFxuICAgICAgICB2YXIgdXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZm9sZG5hbWUsIHNoc29ydCwgcHVzaCkgPT4ge1xcbiAgICAgICAgICAgIHZhciBwbCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXG4gICAgICAgICAgICBpZiAoT2JqZWN0LmtleXMocGwpLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgdmFyIGZvbGQgPSBnZXRNeVZhcihmb2xkbmFtZSwgJzEnKTtcXG4gICAgICAgICAgICB2YXIgb2JqID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInKVxcbiAgICAgICAgICAgIGlmIChmb2xkID09ICcxJykge1xcbiAgICAgICAgICAgICAgICB2YXIgYmNscyA9IGZpbmRJdGVtKHNoc29ydCArICdfYnV0dG9uJyk7XFxuICAgICAgICAgICAgICAgIHZhciB0Y2xzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXG4gICAgICAgICAgICAgICAgdmFyIGxjbHMgPSBmaW5kSXRlbShzaHNvcnQgKyAnX2xpbmUnKTtcXG5cXG4gICAgICAgICAgICAgICAgdmFyIHBjbHMgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICB2YXIgY3MgPSBbYmNsc10uY29uY2F0KHRjbHMsIFtsY2xzXSwgcGNscyk7XFxuXFxuICAgICAgICAgICAgICAgIGlmIChwdXNoKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGNscyA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCArICdfcHVzaHRhYicpO1xcbiAgICAgICAgICAgICAgICAgICAgY3MgPSBwY2xzLmNvbmNhdChjcyk7XFxuICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgdmFyIGN4ID0gJC5kYXRhQ29udmVydChjcyk7XFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfY2xzJywgY3gpO1xcbiAgICAgICAgICAgICAgICBpZiAocHVzaCkge1xcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCArICdfcHVzaHRhYicpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0oYmNscy5leHRyYS5pZCk7XFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQgKyAnX3RhYicpO1xcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtKHNoc29ydCArICdfbGluZScpO1xcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXG5cXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShvYmouZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IG9iai5kZXNjLnJlcGxhY2UoJ+WxleW8gDxmb250IGNvbG9yPVxcXCIjRkZBNTAwXFxcIj7imLAnLCAn5oqY5Y+gPGZvbnQgY29sb3I9XFxcIiNEM0QzRDNcXFwiPuKYtycpLFxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoZm9sZCA9PSAnMCcpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGNzID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ19jbHMnKTtcXG4gICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfYXZhdGFyJywgY3MpO1xcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKG9iai5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogb2JqLmRlc2MucmVwbGFjZSgn5oqY5Y+gPGZvbnQgY29sb3I9XFxcIiNEM0QzRDNcXFwiPuKYtycsICflsZXlvIA8Zm9udCBjb2xvcj1cXFwiI0ZGQTUwMFxcXCI+4piwJyksXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHB1dE15VmFyKGZvbGRuYW1lLCBmb2xkID09PSAnMScgPyAnMCcgOiAnMScpO1xcbiAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly8nICsgKGZvbGQgPT09ICcxJyA/ICfmlLbotbcnIDogJ+WxleW8gCcpO1xcbiAgICAgICAgfSwgZm9sZG5hbWUsIHNoc29ydCwgKHBhcnNlWyfmjqjpgIEnXSA/IHRydWUgOiBmYWxzZSkpO1xcbiAgICAgICAgdmFyIGRlc2MgPSAoZm9sZCA9PT0gJzAnID8g5oqY5Y+gIDog5bGV5byAKSArICdcXFxcdCc7XFxuXFxuICAgICAgICBpZiAoZXhwLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgICAgdXJsID0gJ2hpa2VyOi8vZW1wdHknO1xcbiAgICAgICAgICAgIGRlc2MgPSAnJztcXG4gICAgICAgIH1cXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IHZhcmkgKyAnOlxcXFx0XFxcXHQnICsgJ+WFsScgKyBTdHJpbmcodGFicy5sZW5ndGgpLmZvbnRjb2xvcignIzQ2ODJCNCcpICsgJ+adoee6v+i3rycsXFxuICAgICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2F2YXRhcicsXFxuICAgICAgICAgICAgaW1nOiBjdXN0b20u5Zu+5qCHLFxcbiAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgIGV4dHJhOi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gICAgICAgICAgICAgICAgdmFyIHRpdGxlcyA9IFtgJHtjdXN0b20u5q2j5bqP6aKc6ImyfVxcXCI+5q2j5bqPYCwgYCR7Y3VzdG9tLumAhuW6j+minOiJsn1cXFwiPumAhuW6j2BdO1xcblxcbiAgICAgICAgICAgICAgICBpZiAoY29uZiA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19idXR0b24nLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1sxXSwgdGl0bGVzWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMCcpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX2J1dHRvbicsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogb2JqLnRpdGxlLnJlcGxhY2UodGl0bGVzWzBdLCB0aXRsZXNbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcxJyk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgLy9yZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/liIfmjaLmjpLluo/miJDlip8nXFxuICAgICAgICAgICAgfSwgdmFyaSwgc2hzb3J0LCBjdXN0b20pLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBjdXN0b20u57q/6Lev5qC35byPLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX2J1dHRvbicsXFxuICAgICAgICAgICAgfVxcbiAgIC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ZGV4XS5yZXZlcnNlKCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcblxcbiAgICAgICAgaWYgKOagt+W8jyA9PSAnJykge1xcbiAgICAgICAgICAgIOagt+W8jyA9IGxpc3QubGVuZ3RoID4gMyA/ICd0ZXh0XzQnIDogJ3RleHRfMidcXG4gICAgICAgIH1cXG4gICAgICAgIFxcbiAgICAgICAgdmFyIGV4dHJhID0gJyc7XFxuXFxuICAgICAgICBpZiAocGFyc2UuZXh0cmEgIT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgZXh0cmEgPSBwYXJzZS5leHRyYVxcbiAgICAgICAgfVxcblxcbiAgICAgICAgaWYgKGxpc3QubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgIHZhciBwbGlzdCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXG4gICAgICAgICAgICBpZiAoIXBsaXN0Lmhhc093blByb3BlcnR5KHNoc29ydCkpIHtcXG4gICAgICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XSA9IHt9O1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBwbGlzdFtzaHNvcnRdWydjbHMnXSA9IHNoc29ydDtcXG4gICAgICAgICAgICBwbGlzdFtzaHNvcnRdWydjb2xfdHlwZSddID0g5qC35byPO1xcbiAgICAgICAgICAgIHBsaXN0W3Noc29ydF1bJ3BpYyddID0g5Zu+5qCHOyBcXG4gICAgICAgICAgICBwbGlzdFtzaHNvcnRdWydleHRyYSddPWV4dHJhOyAgICAgICAgICAgXFxuICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2VyX3BsYXlsaXN0cycsIHBsaXN0KTtcXG4gICAgICAgIH1cXG4gICAgICAgIFxcblxcbiAgICAgICAgZm9yICh2YXIgaiBpbiBsaXN0KSB7XFxuICAgICAgICAgICAgbGV0IGx0ID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogbGlzdFtqXS50aXRsZSxcXG4gICAgICAgICAgICAgICAgdXJsOiBsaXN0W2pdLnVybCxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IOagt+W8jyxcXG4gICAgICAgICAgICAgICAgcGljOiDlm77moIcsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogbGlzdFtqXS51cmwucmVwbGFjZSgvQGxhenlSdWxlW1xcXFxzXFxcXFNdKy9nLCAnJyksXFxuICAgICAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCwgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIGx0WydleHRyYSddID0gT2JqZWN0LmFzc2lnbih7fSwgbHRbJ2V4dHJhJ10sIGV4dHJhKTtcXG4gICAgICAgICAgICBkLnB1c2gobHQpO1xcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICBldmFsUmU6IGZ1bmN0aW9uKGlucHV0LCDlh73mlbApIHtcXG4gICAgICAgIGxldCByZXN1bHQgPSBpbnB1dDtcXG4gICAgICAgIHJlc3VsdCA9IGV2YWwoJ2lucHV0JyArIOWHveaVsCk7XFxuICAgICAgICByZXR1cm4gcmVzdWx0O1xcbiAgICB9LFxcbiAgICBnZXRUYWJzOiBmdW5jdGlvbihwYXJzZSkge1xcbiAgICAgICAgdmFyIHRhYnMgPSBbXTtcXG4gICAgICAgIHZhciBhcnRzID0gW107XFxuICAgICAgICBpZiAodHlwZW9mIHBhcnNlLue6v+i3ryA9PSAnb2JqZWN0Jykge1xcbiAgICAgICAgICAgIGFydHMgPSBwYXJzZS7nur/ot687XFxuICAgICAgICB9XFxuICAgICAgICBpZiAoYXJ0cy5sZW5ndGggPT0gMCkge1xcbiAgICAgICAgICAgIGFydHMgPSBwZGZhKGh0bWwsIHBhcnNlLue6v+i3ryk7XFxuICAgICAgICB9XFxuICAgICAgICB2YXIg57q/6Lev5ZCNID0gcGFyc2Uu57q/6Lev5ZCN56ewO1xcbiAgICAgICAgdmFyIOabv+aNouWHveaVsCA9ICcnO1xcbiAgICAgICAgaWYgKHBhcnNlLue6v+i3r+WQjeensC5pbmNsdWRlcygnQEAnKSkge1xcbiAgICAgICAgICAgIOe6v+i3r+WQjSA9IHBhcnNlLue6v+i3r+WQjeensC5zcGxpdCgnQEAnKVswXTtcXG4gICAgICAgICAgICDmm7/mjaLlh73mlbAgPSBwYXJzZS7nur/ot6/lkI3np7Auc3BsaXQoJ0BAJylbMV07XFxuICAgICAgICB9XFxuICAgICAgICBmb3IgKHZhciBpIGluIGFydHMpIHtcXG4gICAgICAgICAgICBsZXQgbGluZW5hbWUgPSAnJztcXG4gICAgICAgICAgICBpZiAo57q/6Lev5ZCNID09ICcnKSB7XFxuICAgICAgICAgICAgICAgIGxpbmVuYW1lID0gYXJ0c1tpXTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBsaW5lbmFtZSA9IHBkZmgoYXJ0c1tpXSwg57q/6Lev5ZCNKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKOabv+aNouWHveaVsCAhPSAnJykge1xcbiAgICAgICAgICAgICAgICBsaW5lbmFtZSA9IHRoaXMuZXZhbFJlKGxpbmVuYW1lLCDmm7/mjaLlh73mlbApO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0YWJzLnB1c2gobGluZW5hbWUpO1xcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIHRhYnM7XFxuICAgIH0sXFxuICAgIGdldExpc3RzOiBmdW5jdGlvbihwYXJzZSwgc2hzb3J0KSB7XFxuICAgICAgICBzaHNvcnQgPSBzaHNvcnQgPyBzaHNvcnQgOiAnc2hzb3J0JztcXG4gICAgICAgIHZhciBsaXN0cyA9IFtdO1xcbiAgICAgICAgdmFyIGNvbnRzID0gW107XFxuICAgICAgICBpZiAodHlwZW9mIHBhcnNlLumAiembhiA9PSAnb2JqZWN0Jykge1xcbiAgICAgICAgICAgIGNvbnRzID0gcGFyc2Uu6YCJ6ZuGO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGNvbnRzLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgY29udHMgPSBwZGZhKGh0bWwsIHBhcnNlLumAiembhik7XFxuICAgICAgICAgICAgfSBjYXRjaCB7XFxuICAgICAgICAgICAgICAgIHRvYXN0KCfpgInpm4blrprkvY3mnInor68nKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG5cXG4gICAgICAgIGxldCDmm7/mjaLlh73mlbAgPSAnJztcXG4gICAgICAgIHZhciDpgInpm4blkI3np7AgPSBwYXJzZS7pgInpm4blkI3np7AgPyBwYXJzZS7pgInpm4blkI3np7AgOiAnYSYmVGV4dCc7XFxuICAgICAgICBpZiAo6YCJ6ZuG5ZCN56ewLmluY2x1ZGVzKCdAQCcpKSB7XFxuICAgICAgICAgICAg6YCJ6ZuG5ZCN56ewID0gcGFyc2Uu6YCJ6ZuG5ZCN56ewLnNwbGl0KCdAQCcpWzBdO1xcbiAgICAgICAgICAgIOabv+aNouWHveaVsCA9IHBhcnNlLumAiembhuWQjeensC5zcGxpdCgnQEAnKVsxXTtcXG4gICAgICAgIH1cXG5cXG4gICAgICAgIHZhciDpgInpm4bpk77mjqUgPSBwYXJzZS7pgInpm4bpk77mjqUgPyBwYXJzZS7pgInpm4bpk77mjqUgOiAnYSYmaHJlZic7XFxuICAgICAgICB2YXIg6Kej5p6QID0gcGFyc2Uu6Kej5p6QID8gcGFyc2Uu6Kej5p6QIDogJyc7XFxuICAgICAgICB2YXIgdGVtcCA9IFtdO1xcblxcbiAgICAgICAgZm9yICh2YXIgaSBpbiBjb250cykge1xcbiAgICAgICAgICAgIGlmIChwYXJzZS7pgInpm4bliJfooaggIT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgIGlmIChwYXJzZS7pgInpm4bliJfooaggPT0gJ29iamVjdCcpIHtcXG4gICAgICAgICAgICAgICAgICAgIGxpc3RzLnB1c2goY29udHNbaV0ubWFwKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHgudXJsICsg6Kej5p6QLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pKVxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgbGlzdHMucHVzaChwZGZhKGNvbnRzW2ldLCBwYXJzZS7pgInpm4bliJfooagpLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGRmaCh4LCDpgInpm4blkI3np7ApLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHBkKHgsIOmAiembhumTvuaOpSkgKyDop6PmnpAsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSkpXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICB2YXIgdXJsID0gcGQoY29udHNbaV0sIOmAiembhumTvuaOpSk7XFxuICAgICAgICAgICAgICAgIGlmICgh6YCJ6ZuG6ZO+5o6lLmluY2x1ZGVzKCdocmVmJykpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVybCA9IHBkZmgoY29udHNbaV0sIOmAiembhumTvuaOpSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gcGRmaChjb250c1tpXSwg6YCJ6ZuG5ZCN56ewKTtcXG4gICAgICAgICAgICAgICAgdGl0bGUgPSDmm7/mjaLlh73mlbAgIT0gJycgPyB0aGlzLmV2YWxSZSh0aXRsZSwg5pu/5o2i5Ye95pWwKSA6IHRpdGxlO1xcbiAgICAgICAgICAgICAgICB0ZW1wLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1cmwgKyDop6PmnpAsXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IOWAkuW6jyA9IHBhcnNlLuWAkuW6jyA/IHBhcnNlLuWAkuW6jyA6IGZhbHNlO1xcbiAgICAgICAgdmFyIHJlc3VsdHMgPSBsaXN0cy5sZW5ndGggPyBsaXN0cyA6IFt0ZW1wXTtcXG4gICAgICAgIGlmICjlgJLluo8pIHtcXG4gICAgICAgICAgICByZXN1bHRzID0gcmVzdWx0cy5tYXAoeCA9PiB4LnJldmVyc2UoKSk7XFxuICAgICAgICB9XFxuICAgICAgICB2YXIgcGxpc3QgPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfcGxheWxpc3RzJywgJ3t9Jyk7XFxuICAgICAgICBpZiAocmVzdWx0cy5zb21lKHggPT4geC5sZW5ndGggPiAwKSkge1xcbiAgICAgICAgICAgIGlmICghcGxpc3QuaGFzT3duUHJvcGVydHkoc2hzb3J0KSkge1xcbiAgICAgICAgICAgICAgICBwbGlzdFtzaHNvcnRdID0ge307XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHBsaXN0W3Noc29ydF1bJ2xlbmd0aCddID0gcmVzdWx0cy5sZW5ndGg7XFxuICAgICAgICB9O1xcbiAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2VyX3BsYXlsaXN0cycsIHBsaXN0KTtcXG4gICAgICAgIHJldHVybiByZXN1bHRzO1xcbiAgICB9LFxcbiAgICBnZXRQbGF5ZXJzOiBmdW5jdGlvbihwYXJzZSwgbW9kZSwgZnVuYykge1xcbiAgICAgICAgLy9sb2cobW9kZSlcXG4gICAgICAgIHZhciBwbGF5ID0gJ2VyX3BsYXlsaXN0Xyc7XFxuICAgICAgICB0aGlzLnByZUxvYWQoZnVuYyk7XFxuICAgICAgICB0aGlzLmNsb3NlKHBhcnNlLm1hcCh4ID0+IHgu57G75Z6LKSwgcGFyc2UubGVuZ3RoKTtcXG4gICAgICAgIG1vZGUgPSBtb2RlID8gbW9kZSA6IDE7XFxuXFxuICAgICAgICBsZXQgcGUgPSBbMV07XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIHBlID0gcGFyc2UubWFwKHggPT4gcGRmYShodG1sLCB4Lue6v+i3rykubGVuZ3RoKS5maWx0ZXIoeSA9PiB5ID4gMCk7XFxuICAgICAgICB9IGNhdGNoIHt9XFxuXFxuXFxuICAgICAgICBwYXJzZS5mb3JFYWNoKChpdGVtLCBpKSA9PiB7XFxuICAgICAgICAgICAgdmFyIHRhYnMgPSBbJ+S4u+e6vyddO1xcbiAgICAgICAgICAgIGlmIChpdGVtLue6v+i3ryAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICAgICAgdGFicyA9IHRoaXMuZ2V0VGFicyhpdGVtKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcHV0TXlWYXIocGxheSArIGkgKyAnX3RhYnMnLCB0YWJzKTtcXG4gICAgICAgICAgICBpZiAoaXRlbS5BamF4KSB7XFxuICAgICAgICAgICAgICAgIGlmIChtb2RlID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFicyh0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksIGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYWJzMih0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksIGl0ZW0sIHBlKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcignZXJfaHRtbCcsIGh0bWwpO1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcignZXJfdXJsJywgTVlfVVJMKTtcXG5cXG4gICAgICAgICAgICAgICAgdmFyIGxpc3RzID0gZnVuYyhnZXRNeVZhcignZXJfJyArIGl0ZW0u57G75Z6LLCAnMCcpLCBNWV9VUkwpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHZhciBsaXN0cyA9IHRoaXMuZ2V0TGlzdHMoaXRlbSwgcGxheSArIGkpO1xcblxcblxcbiAgICAgICAgICAgICAgICBpZiAobGlzdHMuc29tZSh4ID0+IHgubGVuZ3RoID4gMCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChtb2RlID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNldFRhYnModGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLCBpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYWJzMih0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksIGl0ZW0sIHBlKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoZ2V0TXlWYXIoJ2VyXycgKyBpdGVtLuexu+WeiyArICdmb2xkJywgJzEnKSA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgdGhpcy5zZXRMaXN0cyhsaXN0cywgZ2V0TXlWYXIoJ2VyXycgKyBpdGVtLuexu+WeiywgJzAnKSwgcGxheSArIGksIGl0ZW0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2JsYW5rX2Jsb2NrJ1xcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9KVxcbiAgICB9XFxufVxcblxcblxc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F0YXRpdGxlLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBmdW5jdGlvbiByZW1vdmVCeVZhbHVlKGFyciwgdmFsKSB7XFxuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhcnJbaV1bJ3VybCddID09IHZhbCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcnIuc3BsaWNlKGksIDEpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmVtb3ZlQnlWYWx1ZShkdW9zZWxlY3QsIGRhdGF1cmwpXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oZGF0YXVybCwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGRhdGF0aXRsZVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgXFxcIl9kdW9zZWxlY3RcXFwiLCBkdW9zZWxlY3QpO1xcbiAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgIH0sIG5hbWUsIGlkLCBzaHNvcnQpXFxuICAgIH0sXFxufVwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi4pO35LqM57qn5pCc57SiXCIsXCJwYXRoXCI6XCJ0b29sXCIsXCJydWxlXCI6XCIvL3ZhciB0aXRsZSA9IHBhcnNlRG9tRm9ySHRtbChodG1sLCDmkJzntKLmoIfnrb4pO1xcbnZhciB0aXRsZSA9IE1ZX1B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oaW5wdXQpIHtcXG4gICAgICBpZiAoaW5wdXQgPT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICBpbnB1dCA9IHRydWU7XFxuICAgICAgfVxcbiAgICAgIHRoaXMuaXNCb29sZWFuKGlucHV0KTtcXG4gICAgICB0aGlzLm9wZW4gPSBpbnB1dDtcXG4gICAgICByZXR1cm4gdGhpcztcXG4gICAgfSxcXG4gICAgc2V0VGl0bGUoaywgaSwgdCkge1xcbiAgICAgIHJldHVybiBrID09IGkgPyBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIHQuZm9udGNvbG9yKHRoaXMu5YiG57G76aKc6ImyKSA6IHQ7XFxuICAgIH0sXFxuICAgIGFjdGlvbihvYmopIHtcXG4gICAgICByZXR1cm4gW1xcbiAgICAgICAge1xcbiAgICAgICAgICB0aXRsZTogXFxcIua4hemZpOeKtuaAgVxcXCIsXFxuICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChvYmopID0+IHtcXG4gICAgICAgICAgICBsb2cob2JqKTtcXG4gICAgICAgICAgICBjbGVhck15VmFyKG9iai5zdGF0ZSk7XFxuICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwiaGVhZC5jYXRlXFxcIik7XFxuICAgICAgICAgICAgb2JqLmFsbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIG9iai5jbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgIH0sIG9iaiksXFxuICAgICAgICB9LFxcbiAgICAgIF07XFxuICAgIH0sXFxuICAgIGNoZWNrUGFyYW0oKSB7XFxuICAgICAgdmFyIG9iaiA9IHt9O1xcbiAgICAgIGlmICh0aGlzLnBhZ2Ug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W0sIHgu5qCH6aKYKTtcXG4gICAgICAgICAgICB2YXIgdXJsID0gdGhpcy5nZXRVcmwoaXRlbSwgeCk7XFxuICAgICAgICAgICAgdmFyIG9iaiA9IHsgdGl0bGU6IHRpdGxlLCB1cmw6IHVybCB9O1xcbiAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShvYmopO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgcmV0dXJuIOWumuS9jTtcXG4gICAgICAgIH0pO1xcbiAgICAgICAgLy9sb2co5LiA57qnKVxcbiAgICAgICAgLy9sb2co5LiA57qnLmxlbmd0aClcXG4gICAgICAgIGlmICjkuIDnuqcubGVuZ3RoID09IDEpIHtcXG4gICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKOS4gOe6py5qb2luKFxcXCJcXFxcblxcXCIpKTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgIOS4gOe6py5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKGl0ZW0uam9pbihcXFwiLFxcXCIpKTtcXG4gICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgICAvL2xvZyhjYXRlZ29yaWVzKVxcbiAgICAgIH0pO1xcbiAgICAgIGlmICjmipjlj6DnirbmgIEpIHtcXG4gICAgICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogZm9sZCA9PT0gXFxcIjFcXFwiID8g5oqY5Y+gIDog5bGV5byALFxcbiAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZShcXG4gICAgICAgICAgICAgIChmb2xkLCB1LCBhbGwpID0+IHtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoTVlfUlVMRS5ncm91cCwgZm9sZCA9PT0gXFxcIjFcXFwiID8gXFxcIjBcXFwiIDogXFxcIjFcXFwiKTtcXG4gICAgICAgICAgICAgICAgLyphbGwuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgIH0pOyovXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICBmb2xkLFxcbiAgICAgICAgICAgICAg54q25oCBLFxcbiAgICAgICAgICAgICAg5YWo5riFXFxuICAgICAgICAgICAgKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICBsb25nQ2xpY2s6IHRoaXMuYWN0aW9uKHtcXG4gICAgICAgICAgICAgICAgc3RhdGU6IOeKtuaAgSxcXG4gICAgICAgICAgICAgICAgYWxsOiDlhajmuIUsXFxuICAgICAgICAgICAgICAgIGNsOiDmuIXpmaQsXFxuICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICB9XFxuICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgIGNhdGVnb3JpZXMuZm9yRWFjaCgoY2F0ZWdvcnksIGluZGV4KSA9PiB7XFxuICAgICAgICAvL2xvZyhjYXRlZ29yaWVzKVxcbiAgICAgICAgbGV0IHN1Yl9jYXRlZ29yaWVzID0gW107XFxuICAgICAgICAvKmlmICjlsI/nsbvlrprkvY0uaW5jbHVkZXMoXFxcIjtcXFwiKSkge1xcbiAgICAgICAgICBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jS5zcGxpdChcXFwiO1xcXCIpWzBdKTtcXG4gICAgICAgICAgaWYgKHN1Yl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gICAgICAgICAgIGNsZWFyczog5riF6ZmkLFxcbiAgICAgICAgICAgICAganNvbjoganNvbixcXG4gICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXG4gICAgICAgICAgICB9O1xcblxcbiAgICAgICAgICAgIC8vbGV0IHVybCA9IHBkKGl0ZW0sIF/lpKfnsbvpk77mjqUpO1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBpdGVtLnVybDtcXG4gICAgICAgICAgICAvKmlmICjlpKfnsbvlpITnkIYpIHtcXG4gICAgICAgICAgICAgIHVybCA9IOS4gOe6p+WIhuexu+WkhOeQhih1cmwpO1xcbiAgICAgICAgICAgIH0qL1xcbiAgICAgICAgICAgIC8vbG9nKHVybClcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgdGl0bGU6IHRoaXMuc2V0VGl0bGUoa2V5LnRvU3RyaW5nKCksIGNhdGVfdGVtcFtpbmRleF0sIHRpdGxlKSxcXG4gICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICB1cmw6ICQoXFxcImhpa2VyOi8vZW1wdHkjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IG5ld19jYXRlID0gW107XFxuICAgICAgICAgICAgICAgIHBhcmFtcy5jbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBwYXJhbXMuYWxsY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICAgICAgcGFyYW1zLmNhdGVfdGVtcC5mb3JFYWNoKChjYXRlLCBpbmRleCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIG5ld19jYXRlLnB1c2goaW5kZXggPT09IDAgPyBwYXJhbXMua2V5LnRvU3RyaW5nKCkgOiBcXFwiMFxcXCIpO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIsIEpTT04uc3RyaW5naWZ5KG5ld19jYXRlKSk7XFxuICAgICAgICAgICAgICAgIGlmIChwYXJhbXMuanNvbi5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0KSB7XFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImR0X1xcXCIgKyBwYXJhbXMuanNvbi50eXBlLCBwYXJhbXMuanNvbi52YWx1ZSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLnN0YXRlLCBwYXJhbXMuanNvbik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UodHJ1ZSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICAgICAgICB9LCBwYXJhbXMpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIixcXG4gICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2UgaWYgKGZvbGQgPT09IFxcXCIxXFxcIiB8fCDmipjlj6DnirbmgIEgPT0gZmFsc2UpIHtcXG4gICAgICAgICAgc3ViX2NhdGVnb3JpZXMuZm9yRWFjaCgoaXRlbSwga2V5KSA9PiB7XFxuICAgICAgICAgICAgdmFyIGV4dHJhcG9zID0gZmFsc2U7XFxuICAgICAgICAgICAgLyppZiAoaXRlbS5pbmNsdWRlcygndHlwZT1cXFwiQGV4dHJhXFxcIicpKSB7XFxuICAgICAgICAgICAgICBleHRyYXBvcyA9IHRydWU7XFxuICAgICAgICAgICAgICAvL2xvZygn6ZmE5Yqg5a6a5L2NJylcXG4gICAgICAgICAgICB9Ki9cXG5cXG4gICAgICAgICAgICBpZiAoZXh0cmFwb3MpIHtcXG4gICAgICAgICAgICAgIHZhciB0aXRsZSA9IHBkZmgoaXRlbSwgXFxcImEmJlRleHRcXFwiKTtcXG4gICAgICAgICAgICAgIGlmICh0eXBlb2Yg5o6S6ZmkICE9IFxcXCJ1bmRlZmluZWRcXFwiICYmIOaOkumZpCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgIHZhciBqc29uID0ge1xcbiAgICAgICAgICAgICAgICB0eXBlOiBwZGZoKGl0ZW0sIFxcXCJhJiZzdGF0ZVxcXCIpLFxcbiAgICAgICAgICAgICAgICB2YWx1ZTogcGRmaChpdGVtLCBcXFwiYSYmdmFsdWVcXFwiKSxcXG4gICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgIC8vdmFyIHRpdGxlID0gcGRmaChpdGVtLCDliIbnsbvmoIfpopgpO1xcbiAgICAgICAgICAgICAgdmFyIHRpdGxlID0gaXRlbS50aXRsZTtcXG4gICAgICAgICAgICAgIGlmICh0eXBlb2Yg5o6S6ZmkICE9IFxcXCJ1bmRlZmluZWRcXFwiICYmIOaOkumZpCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgIHZhciBqc29uID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgICAvKnN3aXRjaCAodHJ1ZSkge1xcbiAgICAgICAgICAgICAgICBjYXNlIOWIhuexu+mTvuaOpS5pbmNsdWRlcyhcXFwiQEBAXFxcIik6XFxuICAgICAgICAgICAgICAgICAganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXCJAQEBcXFwiKVswXSksXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAQFxcXCIpWzFdKSxcXG4gICAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICBjYXNlIOWIhuexu+mTvuaOpS5pbmNsdWRlcyhcXFwiQEBcXFwiKTpcXG4gICAgICAgICAgICAgICAgICBqc29uID0ge1xcbiAgICAgICAgICAgICAgICAgICAgdHlwZTog5YiG57G76ZO+5o6lLnNwbGl0KFxcXCJAQFxcXCIpWzBdLFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXCJAQFxcXCIpWzFdKSxcXG4gICAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXG4gICAgICAgICAgICAgICAgICAvLyBqc29uID0gcGQoaXRlbSwg5YiG57G76ZO+5o6lKTtcXG4gICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgIH0qL1xcbiAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgICAgLyp2YXIganNvbj3liIbnsbvpk77mjqUuaW5jbHVkZXMoJ0BAQCcpP3tcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEBAJylbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEBAJylbMV0pLFxcbiAgICAgICAgICAgICAgICB9OnBkKGl0ZW0s5YiG57G76ZO+5o6lKTtcXG4gICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQCcpP3tcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU65YiG57G76ZO+5o6lLnNwbGl0KCdAQCcpWzBdLFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgIH06cGQoaXRlbSzliIbnsbvpk77mjqUpOyovXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGxldCBwYXJhbXMgPSB7XFxuICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXG4gICAgICAgICAgICAgIGluZGV4OiBpbmRleCxcXG4gICAgICAgICAgICAgIGtleToga2V5LFxcbiAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgIGpzb246IGpzb24sXFxuICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcbiAgICAgICAgICAgICAgYWxsY2xlYXJzOiDlhajmuIUsXFxuICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgdGl0bGU6IHRoaXMuc2V0VGl0bGUoa2V5LnRvU3RyaW5nKCksIGNhdGVfdGVtcFtpbmRleF0sIHRpdGxlKSxcXG4gICAgICAgICAgICAgIHVybDogJChcXFwiaGlrZXI6Ly9lbXB0eVxcXCIgKyBcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wW3BhcmFtcy5pbmRleF0gPSBwYXJhbXMua2V5LnRvU3RyaW5nKCk7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJoZWFkLmNhdGVcXFwiLCBKU09OLnN0cmluZ2lmeShwYXJhbXMuY2F0ZV90ZW1wKSk7XFxuICAgICAgICAgICAgICAgIGlmIChwYXJhbXMuanNvbi5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0KSB7XFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImR0X1xcXCIgKyBwYXJhbXMuanNvbi50eXBlLCBwYXJhbXMuanNvbi52YWx1ZSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLnN0YXRlLCBwYXJhbXMuanNvbik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgIH0sIHBhcmFtcyksXFxuICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrX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cnVsZSk7XFxuICAgICAgICB2YXIgdXJsID0gdGhpcy51cmxIYW5kbGUoaXRlbSwgcnVsZSk7XFxuICAgICAgICB2YXIgY29udGVudCA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmNvbnRlbnQpO1xcbiAgICAgICAgaWYgKGkgPT0gbGlzdC5sZW5ndGggLSAxKSB7XFxuICAgICAgICAgIGlkID0gXFxcImxhc3RpZF9cXFwiICsgcGFnZTtcXG4gICAgICAgICAgY2xzID0gXFxcImxhc3RtYXJrXFxcIjtcXG4gICAgICAgIH1cXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgcGljX3VybDogaW1nLFxcbiAgICAgICAgICB1cmw6ICdoaWtlcjovL3BhZ2UvZWo/dXJsPScrdXJsKycjbm9IaXN0b3J5IycsXFxuICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXFxuICAgICAgICAgIGNvbF90eXBlOiBydWxlLmNvbF90eXBlLFxcbiAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICBpZDogaWQsXFxuICAgICAgICAgICAgY2xzOiBjbHMsXFxuICAgICAgICAgIH0sXFxuICAgICAgICB9KTtcXG4gICAgICAgIGlmIChpID09IGxpc3QubGVuZ3RoIC0gMSAmJiBzaG93KSB7XFxuICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgaWQ6IFxcXCJwYWdlbGluZVxcXCIsXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ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mFyIHJ1bSA9IGdldE15VmFyKCdybnVtJyk7XFxcXG5cXFxcbiAgICAgICAgdmFyIGkgPSBOdW1iZXIoZ2V0TXlWYXIoJ2Jhbm5lcmknLCAnMCcpKTtcXFxcbiAgICAgICAgaWYgKHJ1bSAhPSAnJykge1xcXFxuICAgICAgICAgICAgaSA9IE51bWJlcihydW0pICsgMVxcXFxuICAgICAgICAgICAgY2xlYXJNeVZhcigncm51bScpXFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBpID0gaSArIDE7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgLy9sb2coaSlcXFxcbiAgICAgICAgLy9sb2coZGF0YS5sZW5ndGgpXFxcXG5cXFxcbiAgICAgICAgaWYgKGkgPiBkYXRhLmxlbmd0aCAtIDEpIHtcXFxcbiAgICAgICAgICAgIGkgPSAwXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgdmFyIGl0ZW0gPSBkYXRhW2ldO1xcXFxuICAgICAgICAvL2xvZyhpdGVtKVxcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgdXBkYXRlSXRlbShpZCsnYmFyJywge1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgIGltZzogaXRlbS5pbWcsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiBpdGVtLnVybCxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW1nOiBpdGVtLmltZyxcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9uYW1lOiBpdGVtLnRpdGxlLnJlcGxhY2UoLzxbXj5dKz4vZywgJycpLFxcXFxuICAgICAgICAgICAgICAgICAgICAvL3NuYW1lOiBpdGVtLmV4dHJhLnNuYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICAvL3N0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cXG4gICAgaWYgKHdrX251bSA9PSBrKSB7XFxcXG4gICAgICAgIGV2YWwoJ3drJytrKS5mb3JFYWNoKGl0ZW0gPT4ge1xcXFxuICAgICAgICAgICAgdmFyIHVybGwgPSBNWV9IT01FICsgcGRmaChpdGVtLCAnYSYmaHJlZicpICsgJyNpbW1lcnNpdmVUaGVtZSMnO1xcXFxuICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogcGRmaChpdGVtLCDmoIfpopgpLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6IHBkZmgoaXRlbSwg5o+P6L+wKSxcXFxcbiAgICAgICAgICAgICAgICBpbWc6IHBkZmgoaXRlbSwg5Zu+54mHKSArIFxcXFxcXFwiQFJlZmVyZXI9XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAnaGlrZXI6Ly9wYWdlL2VqI25vSGlzdG9yeSMjaW1tZXJzaXZlVGhlbWUjJyxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHVybGwsXFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwZGZoKGl0ZW0sIOagh+mimCksXFxcXG4gICAgICAgICAgICAgICAgICAgIGltZzogcGRmaChpdGVtLCDlm77niYcpICsgXFxcXFxcXCJAUmVmZXJlcj1cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMycsXFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfSlcXFxcbiAgICB9ICAgIFxcXFxufVxcXFxuZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJibGFua19ibG9ja1xcXFxcXFwiXFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfVxcXFxuXFxcIn0se1xcXCJjb2xfdHlwZVxcXCI6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2tdO1xcXFxuICAgIH0pXFxcXG59XFxcXG5cXFxcbmxldCBFcmppID0ge1xcXFxuICAgIOmAmuWFjTogJCgnJykubGF6eVJ1bGUoKCkgPT4ge1xcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgdmFyIGh0bWwgPSBKU09OLnBhcnNlKHJlcXVlc3QoaW5wdXQpLm1hdGNoKC9yIHBsYXllcl8uKj89KC4qPyk8LylbMV0pXFxcXG4gICAgICAgICAgICB2YXIgdXJsID0gaHRtbC51cmxcXFxcbiAgICAgICAgICAgIGlmIChodG1sLmVuY3J5cHQgPT0gJzEnKSB7XFxcXG4gICAgICAgICAgICAgICAgdXJsID0gdW5lc2NhcGUodXJsKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaHRtbC5lbmNyeXB0ID09ICcyJykge1xcXFxuICAgICAgICAgICAgICAgIHVybCA9IHVuZXNjYXBlKGJhc2U2NERlY29kZSh1cmwpKTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmICgvbTN1OHxtcDQvLnRlc3QodXJsKSkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiB1cmxcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidmlkZW86Ly9cXFxcXFxcIiArIGlucHV0XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInZpZGVvOi8vXFxcXFxcXCIgKyBpbnB1dFxcXFxuICAgICAgICB9XFxcXG4gICAgfSksXFxcXG4gICAgdXBkYXRhOiBmdW5jdGlvbihydWxlLCBoZWFkZXJzKSB7XFxcXG4gICAgICAgIGhlYWRlcnMgPSBoZWFkZXJzICE9IHVuZGVmaW5lZCA/IGhlYWRlcnMgOiB7fTtcXFxcbiAgICAgICAgc2V0TGFzdENoYXB0ZXJSdWxlKCdqczonICsgJC50b1N0cmluZygodXJsLCBydWxlLCBoZWFkZXJzKSA9PiB7XFxcXG4gICAgICAgICAgICB2YXIgaHRtbCA9IGZldGNoKHVybCwgaGVhZGVycyk7XFxcXG4gICAgICAgICAgICBzZXRSZXN1bHQoZXZhbChydWxlKSlcXFxcbiAgICAgICAgfSwgTVlfVVJMLCBydWxlLCBoZWFkZXJzKSlcXFxcbiAgICB9LFxcXFxuICAgIGNsb3NlOiBmdW5jdGlvbihsaXN0LCBzb3J0cykge1xcXFxuICAgICAgICBhZGRMaXN0ZW5lcignb25DbG9zZScsICQudG9TdHJpbmcoKGxpc3QsIHNvcnRzKSA9PiB7XFxcXG4gICAgICAgICAgICBsaXN0Lm1hcCh4ID0+IHtcXFxcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdlcl8nICsgeCArICdmb2xkJyk7XFxcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcignZXJfJyArIHgpO1xcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc29ydHM7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ3BsYXlsaXN0XycgKyBpKTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2VyX3BsYXlsaXN0cycpO1xcXFxuICAgICAgICB9LCBsaXN0LCBzb3J0cykpXFxcXG4gICAgfSxcXFxcbiAgICBkYXRhQ29udmVydDogZnVuY3Rpb24oZGF0YSkge1xcXFxuICAgICAgICB2YXIgbmV3Y2xzbGlzdCA9IGRhdGEubWFwKGZ1bmN0aW9uKG9iaikge1xcXFxuICAgICAgICAgICAgdmFyIG5ld09iaiA9IE9iamVjdC5hc3NpZ24oe30sIG9iaik7XFxcXG4gICAgICAgICAgICBpZiAobmV3T2JqLmhhc093blByb3BlcnR5KCd0eXBlJykpIHtcXFxcbiAgICAgICAgICAgICAgICBuZXdPYm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VmaW5lZCcgPyA5MCA6IG51bVxcXFxuICAgICAgICBkZXNjID0gZGVzYy5zdGFydHNXaXRoKCfjgIDjgIAnKSA/IGRlc2MgOiAn44CA44CAJyArIGRlc2M7XFxcXG4gICAgICAgIGRlc2MgPSBkZXNjLnJlcGxhY2UoLycvZywgXFxcXFxcXCImIzM5O1xcXFxcXFwiKTtcXFxcbiAgICAgICAgZGVzYyA9IGRlc2MucmVwbGFjZSgvXFxcXFxcXFxyXFxcXFxcXFxuL2csIFxcXFxcXFwiPGJyPlxcXFxcXFwiKTtcXFxcblxcXFxuICAgICAgICBmdW5jdGlvbiBzdWJzdHIoc3RyLCBtYXhMZW5ndGgpIHtcXFxcbiAgICAgICAgICAgIGxldCBsZW4gPSAwO1xcXFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICBpZiAoc3RyLmNoYXJDb2RlQXQoaSkgPiAyNTUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGVuICs9IDI7XFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGVuKys7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGlmIChsZW4gPiBtYXhMZW5ndGgpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0ci5zbGljZSgwLCBpKSArICcuLi4nO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBzdHI7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgbGV0IHNkZXNjID0gc3Vic3RyKGRlc2MsIG51bSk7XFxcXG4gICAgICAgIHZhciBsYXp5ID0gJChgI25vTG9hZGluZyNgKS5sYXp5UnVsZSgoZGMsIHNkYywgbSkgPT4ge1xcXFxuICAgICAgICAgICAgdmFyIHNob3cgPSBzdG9yYWdlMC5nZXRJdGVtKG0sICcwJyk7XFxcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSBmaW5kSXRlbSgnZGVzYycpLnRpdGxlO1xcXFxuICAgICAgICAgICAgdmFyIHJlID0gLyg8XFxcXFxcXFwvc21hbGw+PGJyPi4qPz4pLisvZztcXFxcbiAgICAgICAgICAgIHZhciBleHAgPSAn5bGV5byAOic7XFxcXG4gICAgICAgICAgICB2YXIgcmV0ID0gJ+aUtui1tzonO1xcXFxuICAgICAgICAgICAgaWYgKHNob3cgPT0gJzEnKSB7XFxcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbSgnZGVzYycsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZXQsIGV4cClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKHJlLCAnJDEnICsgc2RjICsgJzwvc21hbGw+JylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8oPFxcXFxcXFxcL3NtYWxsPjxicj48Zm9udCBjb2xvcj1cXFxcXFxcIikuKj8oXFxcXFxcXCI+KS8sICckMSM4QTJCRTIkMicpLy/mlLbotbfpopzoibJcXFxcblxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShtLCAnMCcpO1xcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKCdkZXNjJywge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGVcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKGV4cCwgcmV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UocmUsICckMScgKyBkYyArICc8L3NtYWxsPicpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvKDxcXFxcXFxcXC9zbWFsbD48YnI+PGZvbnQgY29sb3I9XFxcXFxcXCIpLio/KFxcXFxcXFwiPikvLCAnJDEjMDA4MDAwJDInKS8v5bGV5byA6aKc6ImyXFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKG0sICcxJyk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gYGhpa2VyOi8vZW1wdHlgXFxcXG4gICAgICAgIH0sIGRlc2MsIHNkZXNjLCBtYXJrKVxcXFxuICAgICAgICB2YXIgc2MgPSBzdG9yYWdlMC5nZXRJdGVtKG1hcmssICcwJykgPT0gJzAnID8gJ+WxleW8gDonIDogJ+aUtui1tzonO1xcXFxuICAgICAgICB2YXIgZGMgPSBzdG9yYWdlMC5nZXRJdGVtKG1hcmssICcwJykgPT0gJzAnID8gc2Rlc2MgOiBkZXNjO1xcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6ICcnICsgJzxiPjxmb250IGNvbG9yPVxcXFxcXFwiIzA5OEFDMVxcXFxcXFwiPuKItyAgICAgICAgICAgICAgICAgICAgICDliafmg4XnroDku4tcXFxcdDwvZm9udD48L2I+JyArIFxcXFxcXFwiPHNtYWxsPjxhIHN0eWxlPSd0ZXh0LWRlY29yYXRpb246IG5vbmU7JyBocmVmPSdcXFxcXFxcIiArIGxhenkgKyBcXFxcXFxcIic+XFxcXFxcXCIgKyBzYyArICc8L2E+PC9zbWFsbD48YnI+PGZvbnQgY29sb3I9XFxcXFxcXCIjOEEyQkUyXFxcXFxcXCI+JyArIGAke2RjfWAgKyAnPC9zbWFsbD4nLC8v6buY6K6k6aKc6ImyXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3JpY2hfdGV4dCcsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGlkOiAnZGVzYycsXFxcXG4gICAgICAgICAgICAgICAgbGluZVNwYWNpbmc6IDYsXFxcXG4gICAgICAgICAgICAgICAgdGV4dFNpemU6IDE1LFxcXFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiB0cnVlLFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KVxcXFxuICAgIH0sXFxcXG5cXFxcblxcXFxuLy/mtbfmiqVcXFxcbiAgICBzdHJDb252ZXJ0OiBmdW5jdGlvbihhcnIpIHtcXFxcbiAgICAgICAgcmV0dXJuIGFyci5tYXAoeCA9PiB7XFxcXG4gICAgICAgICAgICBzdHIgPSB4O1xcXFxuICAgICAgICAgICAgaWYgKC8o5a+85ryUfOS4u+a8lHznsbvlnosp77yaLy50ZXN0KHN0cikpIHtcXFxcbiAgICAgICAgICAgICAgICBzdHIgPSBzdHIuc3BsaXQoJy8nKS5tYXAoKHZhbCwgaW5kZXgpID0+IChpbmRleCA9PT0gMCA/ICcnIDogJycpICsgdmFsKS5zbGljZSgwLCA1KS5qb2luKCcgJykucmVwbGFjZSgvICQvLCAnJyk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gc3RyXFxcXG4gICAgICAgIH0pXFxcXG4gICAgfSxcXFxcbiAgICBzZXRDb250ZW50OiBmdW5jdGlvbihvYmopIHtcXFxcbiAgICAgICAgLy9sb2cob2JqKVxcXFxuICAgICAgICB2YXIgY29udGVudHMgPSBvYmoubWFpbjtcXFxcbiAgICAgICAgdmFyIHNvcnRPcmRlciA9IG9iai5zb3J0O1xcXFxuICAgICAgICB2YXIgaW1nID0gb2JqLmltZztcXFxcbiAgICAgICAgdmFyIHRleHRzID0gY29udGVudHMubWFwKHggPT4gcGRmaCh4LCAnVGV4dCcpKTtcXFxcblxcXFxuICAgICAgICB2YXIgYXJyYXkgPSB0ZXh0cy5zb3J0KChhLCBiKSA9PiB7XFxcXG4gICAgICAgICAgICBjb25zdCBpbmRleEEgPSBzb3J0T3JkZXIuaW5kZXhPZihhLnN1YnN0cigwLCAyKSk7XFxcXG4gICAgICAgICAgICBjb25zdCBpbmRleEIgPSBzb3J0T3JkZXIuaW5kZXhPZihiLnN1YnN0cigwLCAyKSk7XFxcXG4gICAgICAgICAgICByZXR1cm4gaW5kZXhBIC0gaW5kZXhCO1xcXFxuICAgICAgICB9KVxcXFxuICAgICAgICB2YXIgcmVnZXggPSBuZXcgUmVnRXhwKCcoJyArIHNvcnRPcmRlci5qb2luKCd8JykgKyAnKScpO1xcXFxuICAgICAgICBhcnJheSA9IGFycmF5LmZpbHRlcihmdW5jdGlvbihpdGVtKSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gcmVnZXgudGVzdChpdGVtKTtcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgICAgIC8vbG9nKGFycmF5KVxcXFxuXFxcXG4gICAgICAgIC8vYXJyYXkgPSBzb3J0T3JkZXIubGVuZ3RoPT0wP2FycmF5OnRoaXMuc3RyQ29udmVydChhcnJheSk7XFxcXG4gICAgICAgIGFycmF5ID0gdGhpcy5zdHJDb252ZXJ0KGFycmF5KTtcXFxcblxcXFxuICAgICAgICBpZiAoYXJyYXkubGVuZ3RoID4gNikge1xcXFxuICAgICAgICAgICAgYXJyYXkgPSBhcnJheS5zbGljZSgwLCA2KTtcXFxcbiAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgIHZhciB0aXRsZXMgPSBbXTtcXFxcbiAgICAgICAgdmFyIGRlc2NzID0gW107XFxcXG5cXFxcbiAgICAgICAgc3dpdGNoIChhcnJheS5sZW5ndGgpIHtcXFxcbiAgICAgICAgICAgIGNhc2UgNDpcXFxcbiAgICAgICAgICAgIGNhc2UgNTpcXFxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAyKTtcXFxcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDIpO1xcXFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgIC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wZGZoKGh0bWwsICcubW9kdWxlLWluZm8taXRlbTpjb250YWlucyjkuLvmvJTvvJopJiZUZXh0JyksJyNGRjdGMDAnKSxcXFxcbiAgICAgICAgICAgIHBpY191cmw6IGltZyArICdAUmVmZXJlcj0nLFxcXFxuICAgICAgICAgICAgdXJsOiBNWV9VUkwsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzFfdmVydGljYWxfcGljX2JsdXInLFxcXFxuICAgICAgICB9KVxcXFxuICAgICAgICBpZiAob2JqLmRlc2MgIT0gdW5kZWZpbmVkKSB7XFxcXG4gICAgICAgICAgICB0aGlzLnNldERlc2Mob2JqLmRlc2MpO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSxcXFxcbiAgICBzZXRDdXN0b206IGZ1bmN0aW9uKG9iaiwgaW1nKSB7XFxcXG4gICAgICAgIHZhciBhcnJheSA9IFtdO1xcXFxuICAgICAgICBpZiAob2JqLmNvbnN0cnVjdG9yID09IEFycmF5KSB7XFxcXG4gICAgICAgICAgICBhcnJheSA9IG9iajtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBhcnJheSA9IHRoaXMuc3RyQ29udmVydChhcnJheSk7XFxcXG4gICAgICAgIHZhciB0aXRsZXMgPSBbXTtcXFxcbiAgICAgICAgdmFyIGRlc2NzID0gW107XFxcXG4gICAgICAgIHN3aXRjaCAoYXJyYXkubGVuZ3RoKSB7XFxcXG4gICAgICAgICAgICBjYXNlIDQ6XFxcXG4gICAgICAgICAgICBjYXNlIDU6XFxcXG4gICAgICAgICAgICAgICAgdGl0bGVzID0gYXJyYXkuc2xpY2UoMCwgMik7XFxcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgyKTtcXFxcbiAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgIGNhc2UgNjpcXFxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAzKTtcXFxcbiAgICAgICAgICA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GVsc2Uge1xcXFxuICAgICAgICAgICAgY3VzdG9tID0gY3VzdG9tID8gY3VzdG9tIDoge31cXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBjdXN0b20u5q2j5bqP6aKc6ImyID0gKGN1c3RvbS7mraPluo/popzoibIgJiYgdGhpcy5pc0NvbG9yKGN1c3RvbS7mraPluo/popzoibIpKSA/IGN1c3RvbS7mraPluo/popzoibIgOiAnIzFBQUQxOSc7XFxcXG4gICAgICAgIGN1c3RvbS7pgIbluo/popzoibIgPSAoY3VzdG9tLumAhuW6j+minOiJsiAmJiB0aGlzLmlzQ29sb3IoY3VzdG9tLumAhuW6j+minOiJsikpID8gY3VzdG9tLumAhuW6j+minOiJsiA6ICcjRkYwMDAwJztcXFxcbiAgICAgICAgY3VzdG9tLuWbvuaghyA9IGN1c3RvbS7lm77moIcgPyBjdXN0b20u5Zu+5qCHIDogJ2h0dHBzOi8vaTIuMTAwMDI0Lnh5ei8yMDIzLzA2LzEwL2g0ejYyNy53ZWJwJztcXFxcbiAgICAgICAgY3VzdG9tLue6v+i3r+mAieS4rSA9IGN1c3RvbS7nur/ot6/pgInkuK0gPyBjdXN0b20u57q/6Lev6YCJ5LitIDogJyMwMDhCOEInO1xcXFxuICAgICAgICBjdXN0b20u57q/6Lev5qC35byPID0gY3VzdG9tLue6v+i3r+agt+W8jyA/IGN1c3RvbS7nur/ot6/moLflvI8gOiAnc2Nyb2xsX2J1dHRvbic7XFxcXG4gICAgICAgIGN1c3RvbS7liIblibLmoLflvI8gPSBjdXN0b20u5YiG5Ymy5qC35byPID8gY3VzdG9tLuWIhuWJsuagt+W8jyA6ICdibGFua19ibG9jayc7XFxcXG4gICAgICAgIHJldHVybiBjdXN0b207XFxcXG4gICAgfSxcXFxcbiAgICBjcmVhdGVQTGlzdDogZnVuY3Rpb24odGFicywgdmFyaSwgc2hzb3J0LCBjdXN0b20pIHtcXFxcbiAgICAgICAgdmFyaSA9IFxcXFxcXFwiZXJfXFxcXFxcXCIgKyB2YXJpO1xcXFxuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHRhYnMubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgIHZhciB1cmwgPSAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKCh2YXJpLCBzaHNvcnQsIGksIGxpbmVjKSA9PiB7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICB2YXIgbGlzdHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX2xpc3QnLCAnW10nKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcih2YXJpICsgJ2ZvbGQnLCAnMScpID09ICcwJykge1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgYnRuID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19idXR0b24nKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZvbGRzID0gWyc8Zm9udCBjb2xvcj1cXFxcXFxcIiNEM0QzRDNcXFxcXFxcIj7imLcnLCAnPGZvbnQgY29sb3I9XFxcXFxcXCIjRkZBNTAwXFxcXFxcXCI+4piwJ107XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwbGlzdCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjb2wgPSBwbGlzdFtzaHNvcnRdLmNvbF90eXBlO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgY2xzID0gcGxpc3Rbc2hzb3J0XS5jbHM7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwaWMgPSBwbGlzdFtzaHNvcnRdLnBpYztcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGV4dHJhID0gcGxpc3Rbc2hzb3J0XS5leHRyYTtcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9sb2coZXh0cmEpXFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oYnRuLmV4dHJhLmlkLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYnRuLnRpdGxlLnJlcGxhY2UoZm9sZHNbMF0sIGZvbGRzWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcih2YXJpICsgJ2ZvbGQnLCAnMScpO1xcXFxuICAgICAgICAgICAgICAgICAgICAvL3JldHVybiAndG9hc3Q6Ly/lsZXlvIDmiY3og73mk43kvZwnO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwbGlzdCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjb2wgPSBwbGlzdFtzaHNvcnRdLmNvbF90eXBlO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgY2xzID0gcGxpc3Rbc2hzb3J0XS5jbHM7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwaWMgPSBwbGlzdFtzaHNvcnRdLnBpYztcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGV4dHJhID0gcGxpc3Rbc2hzb3J0XS5leHRyYTtcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9sb2coZXh0cmEpXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKHZhcmksIGkpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgdmFyIHhsaXN0ID0gbGlzdHNbaV07XFxcXG4gICAgICAgICAgICAgICAgaWYgKCQuZnVuYyAhPSB1bmRlZmluZWQgJiYgJC5mdW5jLmNvbnN0cnVjdG9yID09IEZ1bmN0aW9uKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHhsaXN0ID0gJC5mdW5jKGkpO1xcXFxuICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2xpc3QnLCB4bGlzdCk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHZhciBwbGF5cyA9IHhsaXN0Lm1hcCh4ID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnVybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBjb2wsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwaWM6IHBpYyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiBPYmplY3QuYXNzaWduKHt9LGV4dHJhLHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogeC51cmwucmVwbGFjZSgvQGxhenlSdWxlW1xcXFxcXFxcc1xcXFxcXFxcU10rL2csICcnKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGNscyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnKSA9PSAnMScpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcGxheXMucmV2ZXJzZSgpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB2YXIgcGNmZyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsICd7fScpO1xcXFxuICAgICAgICAgICAgICAgIGlmIChwY2ZnWyfljZXmjqgnXSkge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaCcsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwY2ZnWydvYmonXVsn5Y2V5o6oJ11bMF1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sn5Y2V5o6oJ10gPSBmYWxzZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYgKHBjZmdbJ+mAieaOqCddKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNocycsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwY2ZnWydvYmonXVsn6YCJ5o6oJ11bMF1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sn6YCJ5o6oJ10gPSBmYWxzZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19wdXNoY2ZnJywgcGNmZyk7XFxcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxcXG4gICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIHBsYXlzKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIHZhciB0YWJ4ID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXFxcbiAgICAgICAgICAgICAgICB0YWJ4LmZvckVhY2goKHgsIGlpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciB0aXRsZSA9IHgudGl0bGU7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpID09IGlpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUucmVwbGFjZSgvIyhcXFxcXFxcXHcrKT8vZywgbGluZWMpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZS5yZXBsYWNlKC8jKFxcXFxcXFxcdyspPy9nLCAnIycpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaIkOWKn++8gSc7XFxcXG4gICAgICAgICAgICB9LCB2YXJpLCBzaHNvcnQsIGksIGN1c3RvbS7nur/ot6/pgInkuK0pXFxcXG4gICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIChnZXRNeVZhcih2YXJpLCAnMCcpID09IGkgPyB0YWJzW2ldLmZvbnRjb2xvcihjdXN0b20u57q/6Lev6YCJ5LitKSA6IHRhYnNbaV0uZm9udGNvbG9yKCcjJykpLFxcXFxuICAgICAgICAgICAgICAgIHVybDogdXJsLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBjdXN0b20u57q/6Lev5qC35byPLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogc2hzb3J0ICsgJ190YWInLFxcXFxuICAgICAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ190YWJfJyArIGksXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgY29sX3R5cGU6IGN1c3RvbS7liIblibLmoLflvI8sXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX2xpbmUnLFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KVxcXFxuICAgIH0sXFxcXG4gICAgcHVzaFRhYjogZnVuY3Rpb24odmFyaSwgc2hzb3J0KSB7XFxcXG4gICAgICAgIGFkZExpc3RlbmVyKCdvblJlZnJlc2gnLCAkLnRvU3RyaW5nKChzaHNvcnQpID0+IHtcXFxcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoc2hzb3J0ICsgJ19wdXNoY2ZnJyk7XFxcXG4gICAgICAgICAgICBjbGVhck15VmFyKHNoc29ydCArICdfZHVvc2VsZWN0Jyk7XFxcXG4gICAgICAgIH0sIHNoc29ydCkpXFxcXG4gICAgICAgIHZhciBwb2JqID0ge1xcXFxuICAgICAgICAgICAgJ+WNleaOqCc6IFsn4qa/5Y2V5o6oJywgJzxiPuKmv+WNleaOqDwvYj4nLmZvbnRjb2xvcignIzAwRkE5QScpXSxcXFxcbiAgICAgICAgICAgICfpgInmjqgnOiBbJ+KYkemAieaOqCcsICc8Yj7imJHpgInmjqg8L2I+Jy5mb250Y29sb3IoJyM0NjgyQjQnKV0sXFxcXG4gICAgICAgIH1cXFxcblxcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6ICfijJgnLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXFxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vZW1wdHknLFxcXFxuICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCArICdfcHVzaHRhYicsXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiBwb2JqWyfljZXmjqgnXVswXSxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxcXG4gICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHNoc29ydCwgcG9iaiwgdmFyaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcih2YXJpICsgJ2ZvbGQnLCAnMScpID09ICcwJykge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bGV5byA5omN6IO95pON5L2cJztcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgICAgICB2YXIgdGl0bGVzID0gcG9ialsn5Y2V5o6oJ107XFxcXG4gICAgICAgICAgICAgICAgdmFyIHBjZmcgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCAne30nKTtcXFxcbiAgICAgICAgICAgICAgICBwY2ZnWydvYmonXSA9IHBvYmo7XFxcXG4gICAgICAgICAgICAgICAgdmFyIOWNleaOqCA9IHBjZmdbJ+WNleaOqCddID8gcGNmZ1sn5Y2V5o6oJ10gOiBmYWxzZTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIGlmICjljZXmjqgpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2gnLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGVzWzBdLFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfljZXmjqgnXSA9IGZhbHNlO1xcXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWydwbGF5bGlzdCddLm1hcCgoeCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LmV4dHJhLmlkLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnVybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2gnLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyB0aXRsZXNbMV0sXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNocycsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwb2JqWyfpgInmjqgnXVswXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sn5Y2V5o6oJ10gPSB0cnVlO1xcXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfpgInmjqgnXSA9IGZhbHNlO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGxheWxpc3QgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQpO1xcXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWydwbGF5bGlzdCddID0gcGxheWxpc3Q7XFxcXG4gICAgICAgICAgICAgICAgICAgIGZpbmRJdGVtc0J5Q2xzKHNoc29ydCkubWFwKHggPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGRwdXNoID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGdldFBhZ2VUaXRsZSgpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogeC50aXRsZSArICckJyArIHguZXh0cmEuaWRcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJCgnJykubGF6eVJ1bGUoKGRwdXNoKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9wYWdlL3B1c2g/cnVsZT1YWVHmjqjpgIEmcHVzaHVybD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KEpTT04uc3RyaW5naWZ5KGRwdXNoKSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZHB1c2gpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCBwY2ZnKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8vJyArICjljZXmjqggPyAn5Y2V5o6o5byA5ZCvJyA6ICfljZXmjqjlhbPpl60nKTtcXFxcbiAgICAgICAgICAgIH0sIHNoc29ydCwgcG9iaiwgdmFyaSksXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX3B1c2gnLFxcXFxuICAgICAgICAgICAgICAgIGNsczogc2hzb3J0ICsgJ19wdXNodGFiJyxcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgdGl0bGU6IHBvYmpbJ+mAieaOqCddWzBdLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2hzb3J0LCBwb2JqLCB2YXJpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKHZhcmkgKyAnZm9sZCcsICcxJykgPT0gJzAnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/lsZXlvIDmiY3og73mk43kvZwnO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB2YXIgdGl0bGVzID0gcG9ialsn6YCJ5o6oJ107XFxcXG4gICAgICAgICAgICAgICAgdmFyIHBjZmcgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCAne30nKTtcXFxcbiAgICAgICAgICAgICAgICBwY2ZnWydvYmonXSA9IHBvYmo7XFxcXG4gICAgICAgICAgICAgICAgdmFyIOmAieaOqCA9IHBjZmdbJ+mAieaOqCddID8gcGNmZ1sn6YCJ5o6oJ10gOiBmYWxzZTtcXFxcbiAgICAgICAgICAgICAgICBpZiAo6YCJ5o6oKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNocycsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZXNbMF0sXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ+mAieaOqCddID0gZmFsc2U7XFxcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ3BsYXlsaXN0J10ubWFwKCh4KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogeC50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHgudXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2h0bycsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5o6o6YCB5pys6aG1PT5UVkJveCcsXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKHNoc29ydCArICdfZHVvc2VsZWN0Jyk7XFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2hzJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgdGl0bGVzWzFdLFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfpgInmjqgnXSA9IHRydWU7XFxcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ+WNleaOqCddID0gZmFsc2U7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwbGF5bGlzdCA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ3BsYXlsaXN0J10gPSBwbGF5bGlzdDtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IElkcyA9IHBsYXlsaXN0Lm1hcChpdCA9PiBpdC5leHRyYS5pZCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIElkcy5mb3JFYWNoKHggPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gZmluZEl0ZW0oeCkudGl0bGU7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHgsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQubXNtKHRpdGxlLCB4LCBzaHNvcnQpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaCcsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwb2JqWyfljZXmjqgnXVswXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2h0bycsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5o6o6YCB6YCJ5LitPT5UVkJveCcsXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCBwY2ZnKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8vJyArICjpgInmjqggPyAn6YCJ5o6o5byA5ZCvJyA6ICfpgInmjqjlhbPpl60nKTtcXFxcbiAgICAgICAgICAgIH0sIHNoc29ydCwgcG9iaiwgdmFyaSksXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX3B1c2hzJyxcXFxcbiAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCArICdfcHVzaHRhYidcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5o6o6YCB5pys6aG1PT5UVkJveFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2hzb3J0LCB2YXJpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgdmFyIHBjZmcgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCAne30nKTtcXFxcbiAgICAgICAgICAgICAgICB2YXIg5Y2V5o6oID0gcGNmZ1sn5Y2V5o6oJ10gPyBwY2ZnWyfljZXmjqgnXSA6IGZhbHNlO1xcXFxuICAgICAgICAgICAgICAgIHZhciDpgInmjqggPSBwY2ZnWyfpgInmjqgnXSA/IHBjZmdbJ+mAieaOqCddIDogZmFsc2U7XFxcXG4gICAgICAgICAgICAgICAgaWYgKCHljZXmjqggJiYgIemAieaOqCkge1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgdGFicyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfdGFicycsICdbXScpO1xcXFxuICAgICAgICAgICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHBscyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfbGlzdCcsICdbXScpLm1hcChsaSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxpLm1hcChpdGVtID0+IGl0ZW0udGl0bGUgKyAnJCcgKyBpdGVtLnVybC5yZXBsYWNlKC9AbGF6eVJ1bGVbXFxcXFxcXFxzXFxcXFxcXFxTXSsvZywgJycpKS5qb2luKCcjJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJyQkJCcpO1xcXFxuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwbHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyBcXFxcXFxcIl9saXN0XFxcXFxcXCIsICdbXScpLm1hcCh4ID0+IHgudGl0bGUgKyBcXFxcXFxcIiRcXFxcXFxcIiArIHgudXJsKS5qb2luKFxcXFxcXFwiI1xcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0YWJzID0gW3RhYnNbZ2V0TXlWYXIodmFyaSwgJzAnKV1dO1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIC8qbG9nKHBscylcXFxcbiAgICAgICAgICAgICAgICAgICAgbG9nKHRhYnMpKi9cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYgKOmAieaOqCkge1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGxzID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgXFxcXFxcXCJfZHVvc2VsZWN0XFxcXFxcXCIsICdbXScpLm1hcCh4ID0+IHgudGl0bGUgKyBcXFxcXFxcIiRcXFxcXFxcIiArIHgudXJsKS5qb2luKFxcXFxcXFwiI1xcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBscy5sZW5ndGggPT0gMCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+mAieaLqeS4uuepuic7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRhYnMgPSBbJ+aSreaUvuWIl+ihqCddO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgICAgIHZhciBpbmZvID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX2luZm8nLCAne30nKTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgZGVzYyA9IGluZm9bJ2Rlc2MnXTtcXFxcbiAgICAgICAgICAgICAgICB2YXIg5o6o6YCBID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIm5hbWVcXFxcXFxcIjogZ2V0UGFnZVRpdGxlKCksXFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiY29udGVudFxcXFxcXFwiOiBkZXNjIHx8ICcnLFxcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInBpY1xcXFxcXFwiOiBpbmZvWydpbWcnXSB8fCAnJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJmcm9tXFxcXFxcXCI6IHRhYnMuam9pbignJCQkJyksXFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwidXJsXFxcXFxcXCI6IHBscyxcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgLy9sb2co5o6o6YCBKVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vcGFnZS9wdXNoP3J1bGU9WFlR5o6o6YCBJnB1c2h1cmw9XFxcXFxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQoSlNPTi5zdHJpbmdpZnko5o6o6YCBKSlcXFxcbiAgICAgICAgICAgIH0sIHNoc29ydCwgdmFyaSksXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX3B1c2h0bycsXFxcXG4gICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQgKyAnX3B1c2h0YWInXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snLFxcXFxuICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCArICdfcHVzaHRhYicsXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0pXFxcXG4gICAgfSxcXFxcbiAgICBzZXRMb25nY2xpY2s6IGZ1bmN0aW9uKHNoc29ydCwgY3VzdG9tKSB7XFxcXG4gICAgICAgIHJldHVybiBbe1xcXFxuICAgICAgICAgICAgdGl0bGU6ICfmoLflvI/wn46oJyxcXFxcbiAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChzaHNvcnQpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgYWxsX2NvbHMgPSBbJyddLmNvbmNhdChnZXRDb2xUeXBlcygpKTtcXFxcbiAgICAgICAgICAgICAgICBhbGxfY29scyA9IGFsbF9jb2xzLmZpbHRlcih4ID0+XFxcXG4gICAgICAgICAgICAgICAgICAgIC8odGV4dF98ZmxleCkuKi8udGVzdCh4KSAmJiB4ICE9ICd0ZXh0X2ljb24nKTtcXFxcbiAgICAgICAgICAgICAgICAvL2xvZyhhbGxfY29scylcXFxcbiAgICAgICAgICAgICAgICBsZXQgY2xzID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpIHx8XFxcXG4gICAgICAgICAgICAgICAgICAgICcnO1xcXFxuICAgICAgICAgICAgICAgIGlmIChjbHNbc2hzb3J0XSAhPSAnJykge1xcXFxuICAgICAgICAgICAgICAgICAgICBjb2wgPSBjbHNbc2hzb3J0XS5jb2xfdHlwZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgbGV0IOaMiemSruagt+W8jyA9IGFsbF9jb2xzLm1hcCgoaXQpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGl0ID09PSBjb2wgPyAn8J+RiScgKyBpdCA6IGl0O1xcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIGxldCB0aXBzID0gJ+ivt+mAieaLqemAiembhuaMiemSruagt+W8jyc7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQo5oyJ6ZKu5qC35byPLCAyLCB0aXBzKS5zZWxlY3QoKHNoc29ydCwgY2xzKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlucHV0ID0gaW5wdXQucmVwbGFjZSgv8J+RiS9nLCAnJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgIC8qc3RvcmFnZTAuc2V0SXRlbSgn5oyJ6ZKu5qC35byPJywgaW5wdXQpOyovXFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBvbGRJZHMgPSAoZmluZEl0ZW1zQnlDbHMoc2hzb3J0KSB8fCBbXSkubWFwKGl0ID0+IGl0LmV4dHJhLmlkKTsgLy/ogIHlhYPntKBpZHNcXFxcbiAgICAgICAgICAgICAgICAgICAgb2xkSWRzLmZvckVhY2goeCA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHgsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogaW5wdXRcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3suWIh+aNoumAiembhuaMiemSruagt+W8j+S4ujonICsgaW5wdXQ7XFxcXG4gICAgICAgICAgICAgICAgfSwgc2hzb3J0LCBjbHMpO1xcXFxuICAgICAgICAgICAgfSwgc2hzb3J0LCBjdXN0b20pXFxcXG4gICAgICAgIH1dXFxcXG4gICAgfSxcXFxcbiAgICBzZXRUYWJzOiBmdW5jdGlvbih0YWJzLCB2YXJpLCBzaHNvcnQsIHBhcnNlKSB7XFxcXG4gICAgICAgIGxldCBjdXN0b20gPSBwYXJzZS7oh6rlrprkuYk7XFxcXG4gICAgICAgIGN1c3RvbSA9IHRoaXMuZ2V0UHJlc2V0KGN1c3RvbSk7XFxcXG4gICAgICAgIHNoc29ydCA9IHNoc29ydCA/IHNoc29ydCA6ICdzaHNvcnQnO1xcXFxuICAgICAgICB2YXIgdGl0bGUgPSAoZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKSA9PSAnMScpID8gJzxiPjxzcGFuIHN0eWxlPVxcXFxcXFwiY29sb3I6ICcgKyBjdXN0b20u6YCG5bqP6aKc6ImyICsgJ1xcXFxcXFwiPumAhuW6jzwvc3Bhbj48L2I+JyA6ICc8Yj48c3BhbiBzdHlsZT1cXFxcXFxcImNvbG9yOiAnICsgY3VzdG9tLuato+W6j+minOiJsiArICdcXFxcXFxcIj7mraPluo88L3NwYW4+PC9iPidcXFxcbiAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiB2YXJpICsgJzonICsgdGl0bGUsXFxcXG4gICAgICAgICAgICBkZXNjOiAn5YWxJyArIFN0cmluZyh0YWJzLmxlbmd0aCkuZm9udGNvbG9yKCcjNDY4MkI0JykgKyAn5p2h57q/6LevJyxcXFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2hzb3J0LCB2YXJpLCBjdXN0b20pID0+IHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgY29uZiA9IGdldE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJyk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKCdlcl8nICsgdmFyaSArICdmb2xkJywgJzEnKSA9PSAnMCcpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WxleW8gOaJjeiDveaTjeS9nCc7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHZhciBjbHNsaXN0cyA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIG5ld2Nsc2xpc3QgPSAkLmRhdGFDb252ZXJ0KGNsc2xpc3RzKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIHZhciB0aXRsZXMgPSBbYCR7Y3VzdG9tLuato+W6j+minOiJsn1cXFxcXFxcIj7mraPluo9gLCBgJHtjdXN0b20u6YCG5bqP6aKc6ImyfVxcXFxcXFwiPumAhuW6j2BdO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxcXG4gICAgICAgICAgICAgICAgbmV3Y2xzbGlzdC5yZXZlcnNlKCk7XFxcXG4gICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIG5ld2Nsc2xpc3QpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgdmFyIG9iaiA9IGZpbmRJdGVtKHNoc29ydCArICdfYXZhdGFyJylcXFxcblxcXFxuICAgICAgICAgICAgICAgIGlmIChjb25mID09ICcxJykge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1sxXSwgdGl0bGVzWzBdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1swXSwgdGl0bGVzWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzEnKTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaOkuW6j+aIkOWKnyc7XFxcXG4gICAgICAgICAgICB9LCBzaHNvcnQsIHZhcmksIGN1c3RvbSksXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2F2YXRhcicsXFxcXG4gICAgICAgICAg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ICAgICAgICAgICAgICAgIHZhciBvYmogPSBmaW5kSXRlbShzaHNvcnQgKyAnX2xpbmUnKTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgYnRuID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19idXR0b24nKTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgZm9sZHMgPSBbJzxmb250IGNvbG9yPVxcXFxcXFwiI0QzRDNEM1xcXFxcXFwiPuKYtycsICc8Zm9udCBjb2xvcj1cXFxcXFxcIiNGRkE1MDBcXFxcXFxcIj7imLAnXTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIGlmIChmb2xkID09ICcwJykge1xcXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgJzEnKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNzID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ19jbHMnKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKG9iai5leHRyYS5pZCwgY3MpO1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGJ0bi5leHRyYS5pZCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGJ0bi50aXRsZS5yZXBsYWNlKGZvbGRzWzBdLCBmb2xkc1sxXSksXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGlmIChmb2xkID09ICcxJykge1xcXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgJzAnKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBjbHMgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQpO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgY3ggPSAkLmRhdGFDb252ZXJ0KHBjbHMpO1xcXFxuICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdX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ICB2YXIgYmNscyA9IGZpbmRJdGVtKHNoc29ydCArICdfYnV0dG9uJyk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIHRjbHMgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQgKyAnX3RhYicpO1xcXFxuICAgICAgICAgICAgICAgIHZhciBsY2xzID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19saW5lJyk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICB2YXIgcGNscyA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGNzID0gW2JjbHNdLmNvbmNhdCh0Y2xzLCBbbGNsc10sIHBjbHMpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgaWYgKHB1c2gpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBjbHMgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQgKyAnX3B1c2h0YWInKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgY3MgPSBwY2xzLmNvbmNhdChjcyk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICAgICAgdmFyIGN4ID0gJC5kYXRhQ29udmVydChjcyk7XFxcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19jbHMnLCBjeCk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHB1c2gpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCArICdfcHVzaHRhYicpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtKGJjbHMuZXh0cmEuaWQpO1xcXFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQgKyAnX3RhYicpO1xcXFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0oc2hzb3J0ICsgJ19saW5lJyk7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ydCwgKHBhcnNlWyfmjqjpgIEnXSA/IHRydWUgOiBmYWxzZSkpO1xcXFxuICAgICAgICB2YXIgZGVzYyA9IChmb2xkID09PSAnMCcgPyDmipjlj6AgOiDlsZXlvIApICsgJ1xcXFxcXFxcdCc7XFxcXG5cXFxcbiAgICAgICAgaWYgKGV4cC5sZW5ndGggPT0gMSkge1xcXFxuICAgICAgICAgICAgdXJsID0gJ2hpa2VyOi8vZW1wdHknO1xcXFxuICAgICAgICAgICAgZGVzYyA9ICcnO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICB0aXRsZTogdmFyaSArICc6XFxcXFxcXFx0XFxcXFxcXFx0JyArICflhbEnICsgU3RyaW5nKHRhYnMubGVuZ3RoKS5mb250Y29sb3IoJyM0NjgyQjQnKSArICfmnaHnur/ot68nLFxcXFxuICAgICAgICAgICAgZGVzYzogZGVzYyxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnYXZhdGFyJyxcXFxcbiAgICAgICAgICAgIGltZzogY3VzdG9tLuWbvuaghyxcXFxcbiAgICAgICAgICAgIHVybDogdXJsLFxcXFxuICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ19hdmF0YXInLFxcXFxuICAgICAgICAgICAgICAgIGxvbmdDbGljazogdGhpcy5zZXRMb25nY2xpY2soc2hzb3J0KSxcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSlcXFxcbiAgICAgICAgaWYgKHR5cGVvZihwYXJzZVsn5o6o6YCBJ10pICE9ICd1bmRlZmluZWQnICYmIHBhcnNlWyfmjqjpgIEnXSlcXFxcbiAgICAgICAgICAgIHRoaXMucHVzaFRhYignZXJfJyArIHZhcmksIHNoc29ydCk7XFxcXG5cXFxcbiAgICAgICAgaWYgKGZvbGQgPT0gJzAnKSB7XFxcXG4gICAgICAgICAgICByZXR1cm5cXFxcbiAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyB0aXRsZSxcXFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgodmFyaSwgc2hzb3J0LCBjdXN0b20pID0+IHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgY29uZiA9IGdldE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJyk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGNsc2xpc3RzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgbmV3Y2xzbGlzdCA9ICQuZGF0YUNvbnZlcnQoY2xzbGlzdHMpO1xcXFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcXFxuICAgICAgICAgICAgICAgIG5ld2Nsc2xpc3QucmV2ZXJzZSgpO1xcXFxuICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihzaHNvcnQgKyAnX2xpbmUnLCBuZXdjbHNsaXN0KTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIHZhciBvYmogPSBmaW5kSXRlbShzaHNvcnQgKyAnX2J1dHRvbicpXFxcXG4gICAgICAgICAgICAgICAgdmFyIHRpdGxlcyA9IFtgJHtjdXN0b20u5q2j5bqP6aKc6ImyfVxcXFxcXFwiPuato+W6j2AsIGAke2N1c3RvbS7pgIbluo/popzoibJ9XFxcXFxcXCI+6YCG5bqPYF07XFxcXG5cXFxcbiAgICAgICAgICAgICAgICBpZiAoY29uZiA9PSAnMScpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX2J1dHRvbicsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMV0sIHRpdGxlc1swXSksXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJyk7XFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX2J1dHRvbicsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMF0sIHRpdGxlc1sxXSksXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcxJyk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIC8vcmVmcmVzaFBhZ2UoKVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/liIfmjaLmjpLluo/miJDlip8nXFxcXG4gICAgICAgICAgICB9LCB2YXJpLCBzaHNvcnQsIGN1c3RvbSksXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogY3VzdG9tLue6v+i3r+agt+W8jyxcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfYnV0dG9uJyxcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSlcXFxcbiAgICAgICAgdGhpcy5jcmVhdGVQTGlzdCh0YWJzLCB2YXJpLCBzaHNvcnQsIGN1c3RvbSk7XFxcXG4gICAgfSxcXFxcbiAgICBzZXRMaXN0czogZnVuY3Rpb24obGlzdHMsIGluZGV4LCBzaHNvcnQsIHBhcnNlKSB7XFxcXG5cXFxcbiAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19saXN0JywgbGlzdHMpO1xcXFxuXFxcXG4gICAgICAgIHBhcnNlID0gcGFyc2UgPyBwYXJzZSA6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mFyIGV4dHJhID0gJyc7XFxcXG5cXFxcbiAgICAgICAgaWYgKHBhcnNlLmV4dHJhICE9IHVuZGVmaW5lZCkge1xcXFxuICAgICAgICAgICAgZXh0cmEgPSBwYXJzZS5leHRyYVxcXFxuICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgaWYgKGxpc3QubGVuZ3RoID4gMCkge1xcXFxuICAgICAgICAgICAgdmFyIHBsaXN0ID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpO1xcXFxuICAgICAgICAgICAgaWYgKCFwbGlzdC5oYXNPd25Qcm9wZXJ0eShzaHNvcnQpKSB7XFxcXG4gICAgICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XSA9IHt9O1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XVsnY2xzJ10gPSBzaHNvcnQ7XFxcXG4gICAgICAgICAgICBwbGlzdFtzaHNvcnRdWydjb2xfdHlwZSddID0g5qC35byPO1xcXFxuICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XVsncGljJ10gPSDlm77moIc7IFxcXFxuICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XVsnZXh0cmEnXT1leHRyYTsgICAgICAgICAgIFxcXFxuICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2VyX3BsYXlsaXN0cycsIHBsaXN0KTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBcXFxcblxcXFxuICAgICAgICBmb3IgKHZhciBqIGluIGxpc3QpIHtcXFxcbiAgICAgICAgICAgIGxldCBsdCA9IHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogbGlzdFtqXS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICB1cmw6IGxpc3Rbal0udXJsLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiDmoLflvI8sXFxcXG4gICAgICAgICAgICAgICAgcGljOiDlm77moIcsXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGxpc3Rbal0udXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcXFxcXHNcXFxcXFxcXFNdKy9nLCAnJyksXFxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogc2hzb3J0LCAgICAgICAgICAgICBcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9O1xcXFxuICAgICAgICAgICAgbHRbJ2V4dHJhJ10gPSBPYmplY3QuYXNzaWduKHt9LCBsdFsnZXh0cmEnXSwgZXh0cmEpO1xcXFxuICAgICAgICAgICAgZC5wdXNoKGx0KTtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0sXFxcXG4gICAgZXZhbFJlOiBmdW5jdGlvbihpbnB1dCwg5Ye95pWwKSB7XFxcXG4gICAgICAgIGxldCByZXN1bHQgPSBpbnB1dDtcXFxcbiAgICAgICAgcmVzdWx0ID0gZXZhbCgnaW5wdXQnICsg5Ye95pWwKTtcXFxcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcXFxcbiAgICB9LFxcXFxuICAgIGdldFRhYnM6IGZ1bmN0aW9uKHBhcnNlKSB7XFxcXG4gICAgICAgIHZhciB0YWJzID0gW107XFxcXG4gICAgICAgIHZhciBhcnRzID0gW107XFxcXG4gICAgICAgIGlmICh0eXBlb2YgcGFyc2Uu57q/6LevID09ICdvYmplY3QnKSB7XFxcXG4gICAgICAgICAgICBhcnRzID0gcGFyc2Uu57q/6LevO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGlmIChhcnRzLmxlbmd0aCA9PSAwKSB7XFxcXG4gICAgICAgICAgICBhcnRzID0gcGRmYShodG1sLCBwYXJzZS7nur/ot68pO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHZhciDnur/ot6/lkI0gPSBwYXJzZS7nur/ot6/lkI3np7A7XFxcXG4gICAgICAgIHZhciDmm7/mjaLlh73mlbAgPSAnJztc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09ICdvYmplY3QnKSB7XFxcXG4gICAgICAgICAgICBjb250cyA9IHBhcnNlLumAiembhjtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBpZiAoY29udHMubGVuZ3RoID09IDApIHtcXFxcbiAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgY29udHMgPSBwZGZhKGh0bWwsIHBhcnNlLumAiembhik7XFxcXG4gICAgICAgICAgICB9IGNhdGNoIHtcXFxcbiAgICAgICAgICAgICAgICB0b2FzdCgn6YCJ6ZuG5a6a5L2N5pyJ6K+vJylcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgIGxldCDmm7/mjaLlh73mlbAgPSAnJztcXFxcbiAgICAgICAgdmFyIOmAiembhuWQjeensCA9IHBhcnNlLumAiembhuWQjeensCA/IHBhcnNlLumAiembhuWQjeensCA6ICdhJiZUZXh0JztcXFxcbiAgICAgICAgaWYgKOmAiembhuWQjeensC5pbmNsdWRlcygnQEAnKSkge1xcXFxuICAgICAgICAgICAg6YCJ6ZuG5ZCN56ewID0gcGFyc2Uu6YCJ6ZuG5ZCN56ewLnNwbGl0KCdAQCcpWzBdO1xcXFxuICAgICAgICAgICAg5pu/5o2i5Ye95pWwID0gcGFyc2Uu6YCJ6ZuG5ZCN56ewLnNwbGl0KCdAQCcpWzFdO1xcXFxuICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgdmFyIOmAiembhumTvuaOpSA9IHBhcnNlLumAiembhumTvuaOpSA/IHBhcnNlLumAiembhumTvuaOpSA6ICdhJiZocmVmJztcXFxcbiAgICAgICAgdmFyIOino+aekCA9IHBhcnNlLuino+aekCA/IHBhcnNlLuino+aekCA6ICcnO1xcXFxuICAgICAgICB2YXIgdGVtcCA9IFtdO1xcXFxuXFxcXG4gICAgICAgIGZvciAodmFyIGkgaW4gY29udHMpIHtcXFxcbiAgICAgICAgICAgIGlmIChwYXJzZS7pgInpm4bliJfooaggIT0gdW5kZWZpbmVkKSB7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHBhcnNlLumAiembhuWIl+ihqCA9PSAnb2JqZWN0Jykge1xcXFxuICAgICAgICAgICAgICAgICAgICBsaXN0cy5wdXNoKGNvbnRzW2ldLm1hcCh4ID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHgudGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnVybCArIOino+aekCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSkpXFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGlzdHMucHVzaChwZGZhKGNvbnRzW2ldLCBwYXJzZS7pgInpm4bliJfooagpLm1hcCh4ID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBkZmgoeCwg6YCJ6ZuG5ZCN56ewKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHBkKHgsIOmAiembhumTvuaOpSkgKyDop6PmnpAsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pKVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgdmFyIHVybCA9IHBkKGNvbnRzW2ldLCDpgInpm4bpk77mjqUpO1xcXFxuICAgICAgICAgICAgICAgIGlmICgh6YCJ6ZuG6ZO+5o6lLmluY2x1ZGVzKCdocmVmJykpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsID0gcGRmaChjb250c1tpXSwg6YCJ6ZuG6ZO+5o6lKTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gcGRmaChjb250c1tpXSwg6YCJ6ZuG5ZCN56ewKTtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZSA9IOabv+aNouWHveaVsCAhPSAnJyA/IHRoaXMuZXZhbFJlKHRpdGxlLCDmm7/mjaLlh73mlbApIDogdGl0bGU7XFxcXG4gICAgICAgICAgICAgICAgdGVtcC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCArIOino+aekCxcXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGxldCDlgJLluo8gPSBwYXJzZS7lgJLluo8gPyBwYXJzZS7lgJLluo8gOiBmYWxzZTtcXFxcbiAgICAgICAgdmFyIHJlc3VsdHMgPSBsaXN0cy5sZW5ndGggPyBsaXN0cyA6IFt0ZW1wXTtcXFxcbiAgICAgICAgaWYgKOWAkuW6jykge1xcXFxuICAgICAgICAgICAgcmVzdWx0cyA9IHJlc3VsdHMubWFwKHggPT4geC5yZXZlcnNlKCkpO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHZhciBwbGlzdCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXFxcbiAgICAgICAgaWYgKHJlc3VsdHMuc29tZSh4ID0+IHgubGVuZ3RoID4gMCkpIHtcXFxcbiAgICAgICAgICAgIGlmICghcGxpc3QuaGFzT3duUHJvcGVydHkoc2hzb3J0KSkge1xcXFxuICAgICAgICAgICAgICAgIHBsaXN0W3Noc29ydF0gPSB7fTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHBsaXN0W3Noc29ydF1bJ2xlbmd0aCddID0gcmVzdWx0cy5sZW5ndGg7XFxcXG4gICAgICAgIH07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ICAgICB0aGlzLnNldFRhYnModGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLCBpdGVtKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnNldFRhYnMyKHRhYnMsIGl0ZW0u57G75Z6LLCBwbGF5ICsgaSwgaXRlbSwgcGUpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcignZXJfaHRtbCcsIGh0bWwpO1xcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCdlcl91cmwnLCBNWV9VUkwpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgdmFyIGxpc3RzID0gZnVuYyhnZXRNeVZhcignZXJfJyArIGl0ZW0u57G75Z6LLCAnMCcpLCBNWV9VUkwpO1xcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICB2YXIgbGlzdHMgPSB0aGlzLmdldExpc3RzKGl0ZW0sIHBsYXkgKyBpKTtcXFxcblxcXFxuXFxcXG4gICAgICAgICAgICAgICAgaWYgKGxpc3RzLnNvbWUoeCA9PiB4Lmxlbmd0aCA+IDApKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChtb2RlID09IDEpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFicyh0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksIGl0ZW0pO1xcXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYWJzMih0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksIGl0ZW0sIHBlKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChnZXRNeVZhcignZXJfJyArIGl0ZW0u57G75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sKSA9PSAtMSkge1xcXFxuICAgICAgICAgICAgICAgIGR1b3NlbGVjdC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGRhdGF0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBkYXRhdXJsXFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICBkdW9zZWxlY3QgPSB1bmlxdWUoZHVvc2VsZWN0KVxcXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oZGF0YXVybCwge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogYOKAnOKAnOKAneKAnTxzcGFuIHN0eWxlPVxcXFxcXFwiY29sb3I6I0ZGNTczM1xcXFxcXFwiPmAgKyBkYXRhdGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJlbW92ZUJ5VmFsdWUoYXJyLCB2YWwpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhcnJbaV1bJ3VybCddID09IHZhbCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyci5zcGxpY2UoaSwgMSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmVtb3ZlQnlWYWx1ZShkdW9zZWxlY3QsIGRhdGF1cmwpXFxcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShkYXRhdXJsLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBkYXRh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ID09PSAwKSB7XFxcXG4gICAgICAgICAgc3ViX2NhdGVnb3JpZXMuZm9yRWFjaCgoaXRlbSwga2V5KSA9PiB7XFxcXG5cXFxcbiAgICAgICAgICAgIC8vbGV0IHRpdGxlID0gcGRmaChpdGVtLCBf5aSn57G75qCH6aKYKTtcXFxcbiAgICAgICAgICAgIGxldCB0aXRsZSA9IGl0ZW0udGl0bGU7XFxcXG4gICAgICAgICAgICBpZiAodHlwZW9mIOaOkumZpCAhPSBcXFxcXFxcInVuZGVmaW5lZFxcXFxcXFwiICYmIOaOkumZpCAhPSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgIHRpdGxlID0gdGl0bGUucmVwbGFjZShuZXdSZWdFeHAo5o6S6ZmkLCBcXFxcXFxcImdcXFxcXFxcIiksIFxcXFxcXFwiXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgbGV0IGpzb249JydcXFxcbiAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXFxcbiAgICAgICAgICAgIFxcXFxuICAgICAgICAgICAgbGV0IHBhcmFtcyA9IHtcXFxcbiAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxcXG4gICAgICAgICAgICAgIGtleToga2V5LFxcXFxuICAgICAgICAgICAgICBwYWdlOiBwYWdlLFxcXFxuICAgICAgICAgICAgICBjbGVhcnM6IOa4hemZpCxcXFxcbiAgICAgICAgICAgICAganNvbjoganNvbixcXFxcbiAgICAgICAgICAgICAgc3RhdGU6IOeKtuaAgSxcXFxcbiAgICAgICAgICAgICAgYWxsY2xlYXJzOiDlhajmuIUsXFxcXG4gICAgICAgICAgICB9O1xcXFxuXFxcXG4gICAgICAgICAgICAvL2xldCB1cmwgPSBwZChpdGVtLCBf5aSn57G76ZO+5o6lKTtcXFxcbiAgICAgICAgICAgIGxldCB1cmwgPSBpdGVtLnVybDtcXFxcbiAgICAgICAgICAgIC8qaWYgKOWkp+exu+WkhOeQhikge1xcXFxuICAgICAgICAgICAgICB1cmwgPSDkuIDnuqfliIbnsbvlpITnkIYodXJsKTtcXFxcbiAgICAgICAgICAgIH0qL1xcXFxuICAgICAgICAgICAgLy9sb2codXJsKVxcXFxuICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgdGl0bGU6IHRoaXMuc2V0VGl0bGUoa2V5LnRvU3RyaW5nKCksIGNhdGVfdGVtcFtpbmRleF0sIHRpdGxlKSxcXFxcbiAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwic2Nyb2xsX2J1dHRvblxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICB1cmw6ICQoXFxcXFxcXCJoaWtlcjovL2VtcHR5I25vTG9hZGluZyNcXFxcXFxcIikubGF6eVJ1bGUoKHBhcmFtcykgPT4ge1xcXFxuICAgICAgICAgICAgICAgIGxldCBuZXdfY2F0ZSA9IFtdO1xcXFxuICAgICAgICAgICAgICAgIHBhcmFtcy5jbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICBwYXJhbXMuYWxsY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wLmZvckVhY2goKGNhdGUsIGluZGV4KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICBuZXdfY2F0ZS5wdXNoKGluZGV4ID09PSAwID8gcGFyYW1zLmtleS50b1N0cmluZygpIDogXFxcXFxcXCIwXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXFxcXFwiaGVhZC5jYXRlXFxcXFxcXCIsIEpTT04uc3RyaW5naWZ5KG5ld19jYXRlKSk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtcy5qc29uLmNvbnN0cnVjdG9yID09PSBPYmplY3QpIHtcXFxcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXFxcXFwiZHRfXFxcXFxcXCIgKyBwYXJhbXMuanNvbi50eXBlLCBwYXJhbXMuanNvbi52YWx1ZSk7XFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHBhcmFtcy5zdGF0ZSwgcGFyYW1zLmpzb24pO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgIH0sIHBhcmFtcyksXFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwiYmxhbmtfYmxvY2tcXFxcXFxcIixcXFxcbiAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfSBlbHNlIGlmIChmb2xkID09PSBcXFxcXFxcIjFcXFxcXFxcIiB8fCDmipjlj6DnirbmgIEgPT0gZmFsc2UpIHtcXFxcbiAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXFxcbiAgICAgICAgICAgIHZhciBleHRyYXBvcyA9IGZhbHNlO1xcXFxuICAgICAgICAgICAgLyppZiAoaXRlbS5pbmNsdWRlcygndHlwZT1cXFxcXFxcIkBleHRyYVxcXFxcXFwiJykpIHtcXFxcbiAgICAgICAgICAgICAgZXh0cmF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wbGFjZShuZXcgUmVnRXhwKOaOkumZpCwgXFxcXFxcXCJnXFxcXFxcXCIpLCBcXFxcXFxcIlxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICAgIHZhciBqc29uID0gXFxcXFxcXCJcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgLypzd2l0Y2ggKHRydWUpIHtcXFxcbiAgICAgICAgICAgICAgICBjYXNlIOWIhuexu+mTvuaOpS5pbmNsdWRlcyhcXFxcXFxcIkBAQFxcXFxcXFwiKTpcXFxcbiAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXFxcXFwiQEBAXFxcXFxcXCIpWzBdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXFxcXFwiQEBAXFxcXFxcXCIpWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICBjYXNlIOWIhuexu+mTvuaOpS5pbmNsdWRlcyhcXFxcXFxcIkBAXFxcXFxcXCIpOlxcXFxuICAgICAgICAgICAgICAgICAganNvbiA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdHlwZTog5YiG57G76ZO+5o6lLnNwbGl0KFxcXFxcXFwiQEBcXFxcXFxcIilbMF0sXFxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFxcXFxcIkBAXFxcXFxcXCIpWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxcXFxuICAgICAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcXFxuICAgICAgICAgICAgICAgICAgLy8ganNvbiA9IHBkKGl0ZW0sIOWIhuexu+mTvuaOpSk7XFxcXG4gICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgfSovXFxcXG4gICAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXFxcbiAgICAgICAgICAgICAgLyp2YXIganNvbj3liIbnsbvpk77mjqUuaW5jbHVkZXMoJ0BAQCcpP3tcXFxcbiAgICAgICAgICAgICAgICAgICAgdHlwZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVswXSksXFxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzFdKSxcXFxcbiAgICAgICAgICAgICAgICB9OnBkKGl0ZW0s5YiG57G76ZO+5o6lKTtcXFxcbiAgICAgICAgICAgICAgICBcXFxcbiAgICAgICAgICAgICAgICBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEAnKT97XFxcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU65YiG57G76ZO+5o6lLnNwbGl0KCdAQCcpWzBdLFxcXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQCcpWzFdKSxcXFxcbiAgICAgICAgICAgICAgICB9OnBkKGl0ZW0s5YiG57G76ZO+5o6lKTsqL1xcXFxuICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICBsZXQgcGFyYW1zID0ge1xcXFxuICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXFxcbiAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxcXFxuICAgICAgICAgICAgICBrZXk6IGtleSxcXFxcbiAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXFxcbiAgICA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FxuICAgIGFkZExpc3RlbmVyKFxcXFxuICAgICAgXFxcXFxcXCJvblJlZnJlc2hcXFxcXFxcIixcXFxcbiAgICAgICQudG9TdHJpbmcoKHUpID0+IHtcXFxcbiAgICAgICAgY2xlYXJNeVZhcihcXFxcXFxcInlpbGlzdFxcXFxcXFwiKTtcXFxcbiAgICAgICAgLy92YXIgcCA9IHN0b3JhZ2UwLmdldE15VmFyKCdzcGFnZScsICcnKTtcXFxcbiAgICAgICAgLy9wdXRNeVZhcih1LCBwKTtcXFxcbiAgICAgIH0sIOeKtuaAgSlcXFxcbiAgICApO1xcXFxuICB9LFxcXFxuICBqc29uTGlzdDogZnVuY3Rpb24gKGFyciwganNvbiwgcnVsZSkge1xcXFxuICAgIGlmIChqc29uLmNvbnN0cnVjdG9yICE9IE9iamVjdCkge1xcXFxuICAgICAgdHJ5IHtcXFxcbiAgICAgICAganNvbiA9IEpTT04ucGFyc2UoanNvbik7XFxcXG4gICAgICB9IGNhdGNoIHt9XFxcXG4gICAgfVxcXFxuICAgIGpzb25bcnVsZS5saXN0XS5mb3JFYWNoKChpdGVtKSA9PiB7XFxcXG4gICAgICB2YXIgaW1nID0gZXZhbChydWxlLmltZykgKyBydWxlLnJlZjtcXFxcbiAgICAgIHZhciBocmVmID0gZXZhbChydWxlLnVybCk7XFxcXG4gICAgICBocmVmID0gcnVsZS5pbXQgPyBocmVmICsgXFxcXFxcXCIjaW1tZXJzaXZlVGhlbWUjXFxcXFxcXCIgOiBocmVmO1xcXFxuICAgICAgdmFyIGxhenkgPSBydWxlLmxhenkgPyBydWxlLmxhenkgOiBcXFxcXFxcIlxcXFxcXFwiO1xcXFxuICAgICAgdmFyIGRkID0ge1xcXFxuICAgICAgICB0aXRsZTogZXZhbChydWxlLnRpdGxlKSxcXFxcbiAgICAgICAgZGVzYzogZXZhbChydWxlLmRlc2MpLFxcXFxuICAgICAgICBjb250ZW50OiBldmFsKHJ1bGUuY29udGVudCksXFxcXG4gICAgICAgIHBpY191cmw6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GNvbnRlbnQsXFxcXG4gICAgICAgICAgY29sX3R5cGU6IHJ1bGUuY29sX3R5cGUsXFxcXG4gICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXFxcbiAgICAgICAgICAgIGltZzogaW1nLFxcXFxuICAgICAgICAgICAgaWQ6IGlkLFxcXFxuICAgICAgICAgICAgY2xzOiBjbHMsXFxcXG4gICAgICAgICAgfSxcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgICAgIGlmIChpID09IGxpc3QubGVuZ3RoIC0gMSAmJiBzaG93KSB7XFxcXG4gICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcImxpbmVcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgIGlkOiBcXFxcXFxcInBhZ2VsaW5lXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICB9LFxcXFxuICAgICAgICAgIH0pO1xcXFxuXFxcXG4gICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuKAnOKAnOKAneKAnTxzbWFsbD7liqDovb3kuK0uLi48L3NtYWxsPlxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgdXJsOiBcXFxcXFxcImhpa2VyOi8vZW1wdHlcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgIGlkOiBcXFxcXFxcInBhZ2VudW1cXFxcXFxcIixcXFxcbiAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgfSk7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgIH0pO1xcXFxuICAgIH0gZWxzZSB7XFxcXG4gICAgICB1cGRhdGVJdGVtKFxcXFxcXFwicGFnZW51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xcXCJuZXh0XFxcXFxcXCIpO1xcXFxuICAgICAgLy9sb2coJ25leHQ6JytuZXh0KTtcXFxcbiAgICB9IGNhdGNoIHtcXFxcbiAgICAgIGxvZyhcXFxcXFxcIuWPr+iDveS4jeWtmOWcqOS4i+S4gOmhteaIluiAheS4i+S4gOmhteWumuS9jeaciemXrumimFxcXFxcXFwiKTtcXFxcbiAgICAgIG5leHQgPSBcXFxcXFxcIlxcXFxcXFwiO1xcXFxuICAgIH1cXFxcbiAgICBpZiAobmV4dCAhPSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICBwdXRNeVZhcijnirbmgIEsIG5leHQpO1xcXFxuICAgIH1cXFxcbn1cXFwifV1cIixcInByb3h5XCI6XCJcIn0iLCJwaWNVcmwiOiJodHRwczovL3B1dWkucXBpYy5jbi92Y292ZXJfdnRfcGljLzAvbWN2OGhrYzh6azhsbm92MTY1OTg4ODcxODM5Ny8wQFJlZmVyZXI9IiwidGl0bGUiOiLlroznvo7kuJbnlYwifQ==
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement