diff --git a/GitMerge-Roboto b/GitMerge-Roboto new file mode 100644 index 0000000..792db96 --- /dev/null +++ b/GitMerge-Roboto @@ -0,0 +1,34 @@ +# This Strategy helps you merge 2 branches in githup and resolve conflicts +STRATEGY GitMerge() + # Open the teminal, and use cd(change directory) command to move to the local git project directory + Run the terminal and navigate to your git project directory + IF you are not in Master branch + # Run the command git checkout master + checkout to master branch + IF you are in master branch + # To merge the second branch with master branch run the command "git merge secondBranch", which secondBranch is the name of your git second branch + Merge two branches + IF the merge has confilict + SET confilictedFile TO the files in project that have confilict + FOR EACH 'file' IN 'confilictedFile' + DO fixConfilict('file') + # Run GIT STATUS to see the latest changes + # Run GIT ADD + # Run GIT PUSH + Commit and push the changes + # If you made it to this line, then you must have missed something. Is it possible you made a mistake above? If so, go back and verify your work, because something caused the faulty output. + RETURN nothing + +STRATEGY fixConfilict(conflictedFile) + Open the conflictedFile with your favorite text editor + # To find a line with conflict in your file, search the file for the conflict marker <<<<<<< HEAD + SET 'line' TO a line number that has conflict + # until there is no line with <<<<<<< HEAD tag in the file + UNTIL the file has no lines of conflict + # You'll see the changes from the master branch after the line <<<<<<< HEAD + # Next youll see ======= which divides 2 merged lines followed by >>>>>>> SECOND branch name + # Decide if you want to keep only your branch's changes, keep only the other branch's changes, or make a brand new change, and edit the file by removing unwanted lines + # Also remove >>>>>>Head & ====== from the lines and make sure that the file has proper code syntax. + Edit the line + SET 'line' TO a line number that has conflict + Return nothing diff --git a/StrategyTracker/js/bundle.js b/StrategyTracker/js/bundle.js index 0d8d1e4..793a586 100755 --- a/StrategyTracker/js/bundle.js +++ b/StrategyTracker/js/bundle.js @@ -243,9 +243,9 @@ if (typeof window !== 'undefined' && window.angular) { if (scope.fadeIn !== undefined) { scope.$watch('fadeIn', function (value) { if (value) { - $(element).fadeIn(500); + $(element).fadeIn(1500); } else { - $(element).fadeOut(100); + $(element).fadeOut(1000); } }); } @@ -2841,4 +2841,4 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {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cIiNpbml0aWFsUGFyYW1zXCIpLm1vZGFsKHtcclxuICAgICAgICAgICAgICAgICAgICBiYWNrZHJvcDogXCJzdGF0aWNcIixcclxuICAgICAgICAgICAgICAgICAgICBrZXlib2FyZDogXCJmYWxzZVwiLFxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICB2bS5teVN0cmF0ZWd5ID0gdm0uc2VsZWN0ZWRTdHJhdGVneTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2bS5zdHJhdGVneUNoYW5nZWQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAkd2luZG93LmxvY2F0aW9uID0gJHdpbmRvdy5sb2NhdGlvbi5vcmlnaW4gKyAkd2luZG93LmxvY2F0aW9uLnBhdGhuYW1lICsgJz9zdHJhdGVneT0nICsgdm0ubXlTdHJhdGVneS5uYW1lO1xyXG4gICAgICAgICAgICB9O1xyXG5cclxuICAgICAgICAgICAgdm0ucHJvY2VlZFRvU3RyYXRlZ3kgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICBsZXQgZmxhZyA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBhbmd1bGFyLmZvckVhY2godm0ucGFyYW1ldGVycywgZnVuY3Rpb24gKHZhbCwga2V5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYodmFsLnZhbCA9PSBudWxsIHx8IHZhbC52YWwudHJpbSgpID09ICcnKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZsYWcgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuXHJcbiAgICAgICAgICAgICAgICBpZihmbGFnID09IHRydWUpIHtcclxuICAgICAgICAgICAgICAgICAgICBhbmd1bGFyLmZvckVhY2godm0ucGFyYW1ldGVycywgZnVuY3Rpb24gKHZhbCwga2V5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH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jT2JqLnZhcmlhYmxlcy5maWx0ZXIoZnVuY3Rpb24gKHZhbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmFsLnR5cGUgPT0gJ3BhcmFtZXRlcic7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy8gb3BlbiB0aGUgbW9kYWwgdG8gaW5wdXQgc3RyYXRlZ3kgcGFyYW1ldGVyc1xyXG4gICAgICAgICAgICAgICAgICAgICQoXCIjaW5pdGlhbFBhcmFtc1wiKS5tb2RhbCh7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tkcm9wOiBcInN0YXRpY1wiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBrZXlib2FyZDogXCJmYWxzZVwiLFxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBhbGVydChcInBsZWFzZSBjaG9vc2UgYSBzdHJhdGVneSBmaXJzdFwiKTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZ1bmN0aW9uIGNoZWNrVHlwZSgpIHtcclxuICAgICAgICAgICAgICAgIGlmICh2bS5leGVjT2JqLmN1cnJlbnRTdGF0ZW1lbnQudHlwZSA9PSAnc2V0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCBpZCA9IHZtLmV4ZWNPYmouY3VycmVudFN0YXRlbWVudC5pZGVudGlmaWVyLnJlcGxhY2UoLycvZywgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCB2YXJpYWJsZSA9IHZtLmV4ZWNPYmoudmFyaWFibGVzLmZpbmQoZnVuY3Rpb24gKHZhbCwgaW5kZXgsIGFycikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmFsLm5hbWUgPT0gaWQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHZhcmlhYmxlLnZhbCA9PSBudWxsIHx8IHZhcmlhYmxlLnZhbC5sZW5ndGggPT0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZS52aXNpYmxlID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdm0uZXhlY09iai5zZXROZWVkZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJGJyb2FkY2FzdChcIkVkaXRNZVwiLCBpZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdm0uZXhlY09iai5zZXROZWVkZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAodm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50LnR5cGUgPT0gJ2ZvcmVhY2gnIHx8IHZtLmV4ZWNPYmouY3VycmVudFN0YXRlbWVudC50eXBlID09ICdsb29wJykge1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCBsaXN0ID0gdm0uZXhlY09iai52YXJpYWJsZXMuZmluZChmdW5jdGlvbiAodmFsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWwubmFtZSA9PT0gdm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50Lmxpc3QucmVwbGFjZSgvJy9nLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGxldCBpZGVudGlmaWVyID0gdm0uZXhlY09iai52YXJpYWJsZXMuZmluZChmdW5jdGlvbiAodmFsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWwubmFtZSA9PT0gdm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50LmlkZW50aWZpZXIucmVwbGFjZSgvJy9nLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWRlbnRpZmllci52aXNpYmxlID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICBpZGVudGlmaWVyLnZhbCA9IGxpc3QudmFsW3ZtLmV4ZWNPYmouY3VycmVudFN0YXRlbWVudC5jb3VudGVyID8gdm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50LmNvdW50ZXIgOiAwXTtcclxuICAgICAgICAgICAgICAgICAgICBsaXN0LmRpcnR5QXJyYXkucHVzaChsaXN0LnZhbFt2bS5leGVjT2JqLmN1cnJlbnRTdGF0ZW1lbnQuY291bnRlciA/IHZtLmV4ZWNPYmouY3VycmVudFN0YXRlbWVudC5jb3VudGVyIDogMF0pO1xyXG4gICAgICAgICAgICAgICAgICAgIC8vJHNjb3BlLiRhcHBseSgpO1xyXG5cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgdm0ubmV4dFN0YXRlbWVudCA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZtLmV4ZWNPYmogPSBpbnRlcnByZXRlci5leGVjdXRlKCk7XHJcbiAgICAgICAgICAgICAgICAvLyB2bS5leGVjT2JqLnZhcmlhYmxlcy5mb3JFYWNoKGZ1bmN0aW9uICh2YXJpYWJsZSkge1xyXG4gICAgICAgICAgICAgICAgLy8gICAgIGNvbnNvbGUubG9nKFwiVmFyaWFibGVzOiAgIFwiICsgdmFyaWFibGUubmFtZSk7XHJcbiAgICAgICAgICAgICAgICAvLyB9KTtcclxuICAgICAgICAgICAgICAgIGlmICh2bS5leGVjT2JqID09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAkdGltZW91dChmdW5jdGlvbigpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYWxlcnQoXCJDb25ncmF0dWxhdGlvbiFZb3UgaGF2ZSByZWFjaGVkIGVuZCBvZiBzdHJhdGVneSEgSWYgeW91IHRoaW5rIHlvdSBkaWQgbm90IGZpbmlzaCB0aGUgdGFzaywgcmVzZXQgdGhlIHN0cmF0ZWd5IGFuZCBzdGFydCBvdmVyIGFnYWluLiBcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBjaGVja1R5cGUoKTtcclxuICAgICAgICAgICAgICAgIGlmKHZtLmV4ZWNPYmouc3RyYXRlZ3lDaGFuZ2VkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJHRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBhbmd1bGFyLmZvckVhY2godm0uZXhlY09iai52YXJpYWJsZXMsIGZ1bmN0aW9uICh2YWwsIGtleSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYodmFsLnR5cGUgPT0gJ3BhcmFtZXRlcicpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwudmlzaWJsZSA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAodm0uY3VycmVudFN0cmF0ZWd5Lm5hbWUgIT09IHZtLmV4ZWNPYmouY3VycmVudFN0cmF0ZWd5Lm5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkKCcjJyArIHZtLmV4ZWNPYmouY3VycmVudFN0cmF0ZWd5Lm5hbWUpLmNvbGxhcHNlKCdzaG93Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJCgnIycgKyB2bS5jdXJyZW50U3RyYXRlZ3kubmFtZSkuY29sbGFwc2UoJ2hpZGUnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAodm0uZXhlY09iai52YXJpYWJsZXMgIT09IG51bGwpe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2bS5wYXJhbWV0ZXJzID0gdm0uZXhlY09iai52YXJpYWJsZXMuZmlsdGVyKGZ1bmN0aW9uICh2YWwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWwudHlwZSA9PSAncGFyYW1ldGVyJztcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICB2bS5jdXJyZW50U3RyYXRlZ3kgPSB2bS5leGVjT2JqLmN1cnJlbnRTdHJhdGVneTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHZtLnByZXZTdGF0ZW1lbnQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2bS5leGVjT2JqID0gaW50ZXJwcmV0ZXIuZ29CYWNrKCk7XHJcbiAgICAgICAgICAgICAgICBpZiAodm0uZXhlY09iaiA9PT0gbnVsbCkgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgaWYodm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50LnR5cGUgPT09ICdzZXQnKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IGlkID0gdm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50LmlkZW50aWZpZXIucmVwbGFjZSgvJy9nLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IHZhcmlhYmxlID0gdm0uZXhlY09iai52YXJpYWJsZXMuZmluZChmdW5jdGlvbiAodmFsLCBpbmRleCwgYXJyKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWwubmFtZSA9PSBpZDtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyh2YXJpYWJsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYodmFyaWFibGUuZGlydHlBcnJheSAhPT0gdW5kZWZpbmVkKSB2YXJpYWJsZS5kaXJ0eUFycmF5ID0gW107XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBjaGVja1R5cGUoKTtcclxuICAgICAgICAgICAgICAgIGlmICh2bS5jdXJyZW50U3RyYXRlZ3kubmFtZSAhPT0gdm0uZXhlY09iai5jdXJyZW50U3RyYXRlZ3kubmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICQoJyMnICsgdm0uZXhlY09iai5jdXJyZW50U3RyYXRlZ3kubmFtZSkuY29sbGFwc2UoJ3Nob3cnKTtcclxuICAgICAgICAgICAgICAgICAgICAkKCcjJyArIHZtLmN1cnJlbnRTdHJhdGVneS5uYW1lKS5jb2xsYXBzZSgnaGlkZScpO1xyXG4gICAgICAgICAgICAgICAgICAgIHZtLmN1cnJlbnRTdHJhdGVneSA9IHZtLmV4ZWNPYmouY3VycmVudFN0cmF0ZWd5O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG5cclxuICAgICAgICAgICAgdm0ub3V0ZXJTdGF0ZW1lbnQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2bS5leGVjT2JqID0gaW50ZXJwcmV0ZXIuZXhlY3V0ZShmYWxzZSk7XHJcblxyXG4gICAgICAgICAgICAgICAgY2hlY2tUeXBlKCk7XHJcblxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICB2bS5pbm5lclN0YXRlbWVudCA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZtLmV4ZWNPYmogPSBpbnRlcnByZXRlci5leGVjdXRlKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgY2hlY2tUeXBlKCk7XHJcbiAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAkc2NvcGUuJG9uKFwic2V0TmVlZGVkRmFsc2VcIiwgZnVuY3Rpb24gKGFyZ3MpIHtcclxuICAgICAgICAgICAgICAgIGlmKCFhcmdzLnRhcmdldFNjb3BlLm1vZGVsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdm0uZXhlY09iai5zZXROZWVkZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICB2bS5leGVjT2JqLnNldE5lZWRlZCA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuXHJcbiAgICAgICAgICAgICRzY29wZS4kb24oXCJibG9ja0FkZFwiLCBmdW5jdGlvbiAoYXJncywgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgaW50ZXJwcmV0ZXIuYWRkTG9vcEJsb2NrcyhkYXRhLmlkLCBkYXRhLmRhdGEpO1xyXG5cclxuICAgICAgICAgICAgfSlcclxuICAgICAgICB9KTtcclxuICAgIH0pO1xyXG5cclxuICAgIG15YXBwLmRpcmVjdGl2ZSgndmFyaWFibGVWYWx1ZScsIGZ1bmN0aW9uICgkcGFyc2UsICR0aW1lb3V0KSB7XHJcbiAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgdGVtcGxhdGU6XHJcbiAgICAgICAgICAgICc8c3BhbiBuZy1zaG93PVwiZWRpdFwiPicgK1xyXG4gICAgICAgICAgICAnPHRleHRhcmVhIG5nLXNob3c9XCJpc0FycmF5IFwiIG5nLWJsdXI9XCJ1cGRhdGVNb2RlbCgpXCIgbmctbW9kZWw9XCJ2YXJcIj48L3RleHRhcmVhPicgK1xyXG4gICAgICAgICAgICAnPGlucHV0IHR5cGU9XCJ0ZXh0XCIgbmctc2hvdz1cIiFpc0FycmF5IFwiIG5nLWJsdXI9XCJ1cGRhdGVNb2RlbCgpXCIgbmctbW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GU9XCIgQWRkIG1vcmUgaXRlbXNcIiBocmVmPVwiI1wiIG5nLWNsaWNrPVwiY2hhbmdlRWRpdCgpXCI+PGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXBsdXNcIj48L2k+PC9idXR0b24+JyArXHJcbiAgICAgICAgICAgICc8L2Rpdj4nLFxyXG4gICAgICAgICAgICByZXN0cmljdDogJ0UnLFxyXG4gICAgICAgICAgICBzY29wZToge1xyXG4gICAgICAgICAgICAgICAgbW9kZWw6ICc9JyxcclxuICAgICAgICAgICAgICAgIGlzQXJyYXk6ICc9JyxcclxuICAgICAgICAgICAgICAgIG1vZGVsSWQ6ICc9JyxcclxuICAgICAgICAgICAgICAgIHBhcmVudElkOiAnPScsXHJcbiAgICAgICAgICAgICAgICBkaXJ0eUFycmF5OiAnPScsXHJcbiAgICAgICAgICAgICAgICBwcmV2VmFyOiAnPScsXHJcbiAgICAgICAgICAgICAgICBmYWRlSW46ICc9J1xyXG4gICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICBsaW5rOiBmdW5jdGlvbiAoc2NvcGUsIGVsZW1lbnQsIGF0dHJzLCBjb250cm9sbGVyKSB7XHJcbiAgICAgICAgICAgICAgICBzY29wZS5lZGl0ID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBzY29wZS52YXIgPSAnJztcclxuICAgICAgICAgICAgICAgIHNjb3BlLmlkID0gbnVsbDtcclxuICAgICAgICAgICAgICAgIHZhciBsaXN0ZW5lciA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICBzY29wZS4kb24oJ0VkaXRNZScsIGZ1bmN0aW9uIChldmVudCwgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzY29wZS5tb2RlbElkID09IGRhdGEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuaWQgPSBkYXRhO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzY29wZS5jaGFuZ2VFZGl0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICBpZihzY29wZS5mYWRlSW4gIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNjb3BlLiR3YXRjaCgnZmFkZUluJywgZnVuY3Rpb24odmFsdWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYodmFsdWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoZWxlbWVudCkuZmFkZUluKDUwMClcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoZWxlbWVudCkuZmFkZU91dCgxMDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgaWYgKHNjb3BlLmlzQXJyYXkpIHtcclxuICAgICAgICAgICAgICAgICAgICBzY29wZS5hbGx2YXIgPSBzY29wZS5tb2RlbDtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcblxyXG4gICAgICAgICAgICAgICAgc2NvcGUuY2hhbmdlRWRpdCA9IGZ1bmN0aW9uICgpIHtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgbGlzdGVuZXIgPSBzY29wZS4kd2F0Y2goJ21vZGVsJywgZnVuY3Rpb24gKG5ld3ZhbCwgb2xkdmFsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLiRlbWl0KFwic2V0TmVlZGVkRmFsc2VcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2NvcGUuZWRpdCA9ICFzY29wZS5lZGl0O1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzY29wZS5pc0FycmF5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLnZhciA9IHNjb3BlLmFsbHZhci5qb2luKCcsJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRbMF0uZmlyc3RDaGlsZC5maXJzdENoaWxkLmZvY3VzKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIDEwKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRbMF0uZmlyc3RDaGlsZC5sYXN0Q2hpbGQuZm9jdXMoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTApO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBzY29wZS51cGRhdGVNb2RlbCA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lcigpO1xyXG4gICAgICAgICAgICAgICAgICAgIHNjb3BlLmVkaXQgPSAhc2NvcGUuZWRpdDtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2NvcGUuaXNBcnJheSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgYXJyID0gbmV3IFNldChzY29wZS52YXIuc3BsaXQoJywnKSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICBzY29wZS5hbGx2YXIgPSBbXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYW5ndWxhci5mb3JFYWNoKGFyciwgZnVuY3Rpb24gKHZhbCwga2V5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwudHJpbSgpLmxlbmd0aCA/IHNjb3BlLmFsbHZhci5wdXNoKHZhbC50cmltKCkpIDogbnVsbDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZihzY29wZS5kaXJ0eUFycmF5Lmxlbmd0aCA+IDApIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcihsZXQgaSA9IDA7IGk8IHNjb3BlLmRpcnR5QXJyYXkubGVuZ3RoOyBpKyspXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoc2NvcGUuZGlydHlBcnJheVtpXSAhPT0gc2NvcGUuYWxsdmFyW2ldKXtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuYWxsdmFyID0gc2NvcGUucHJldlZhcjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxlcnQoXCIgWW91IGFyZSBjdXJyZW50bHkgZXhlY3V0aW5nIGEgbG9vcC4gQWRkaW5nIGVsZW1lbnRzIGFyZSBqdXN0IGFsbG93ZWQgdG8gdGhlIGVuZCBvZiBjb2xsZWN0aW9uLiAgXCIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICAgICAgICAkcGFyc2UoYXR0cnMubW9kZWwpLmFzc2lnbihzY29wZS4kcGFyZW50LCBzY29wZS5hbGx2YXIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZihzY29wZS5wcmV2VmFyLmxlbmd0aCAhPT0gMCAmJiBzY29wZS5wcmV2VmFyLmxlbmd0aCA8IHNjb3BlLmFsbHZhci5sZW5ndGgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLiRlbWl0KFwiYmxvY2tBZGRcIiwge1wiZGF0YVwiOiBzY29wZS5hbGx2YXIuc2xpY2Uoc2NvcGUucHJldlZhci5sZW5ndGgsIHNjb3BlLmFsbHZhci5sZW5ndGgpLCBcImlkXCI6IHNjb3BlLnBhcmVudElkfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgLy9jb25zb2xlLmxvZyhzY29wZS5hbGx2YXIubGVuZ3RoKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLnByZXZWYXIgPSBzY29wZS5hbGx2YXI7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzY29wZS5pZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzY29wZS4kZW1pdChcInNldE5lZWRlZEZhbHNlXCIpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfSk7XHJcblxyXG59IiwiJ3VzZSBzdHJpY3QnO1xyXG5cclxudmFyIGNsb25lID0gcmVxdWlyZSgnY2xvbmUnKTtcclxuXHJcbi8vIGh0dHBzOi8vc3RhY2tvdmVyZmxvdy5jb20vcXVlc3Rpb25zLzU4NjE4Mi9ob3ctdG8taW5zZXJ0LWFuLWl0ZW0taW50by1hbi1hcnJheS1hdC1hLXNwZWNpZmljLWluZGV4XHJcbkFycmF5LnByb3RvdHlwZS5pbnNlcnQgPSBmdW5jdGlvbiAoaW5kZXgpIHtcclxuICAgIGluZGV4ID0gTWF0aC5taW4oaW5kZXgsIHRoaXMubGVuZ3RoKTtcclxuICAgIGFyZ3VtZW50cy5sZW5ndGggPiAxXHJcbiAgICAmJiB0aGlzLnNwbGljZS5hcHBseSh0aGlzLCBbaW5kZXgsIDBdLmNvbmNhdChbXS5wb3AuY2Fs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ICAgICAgICAgICAgbGV0IGxpc3RWYXJpYWJsZSA9IGxvb3BTdGF0ZW1lbnQubGlzdC5yZXBsYWNlKC8nL2csICcnKTtcclxuICAgICAgICAgICAgbGV0IGNvdW50ZXIgPSAwO1xyXG4gICAgICAgICAgICBjdXJyZW50RXhlY3V0aW9uQ29udGV4dC52YXJpYWJsZXMuZm9yRWFjaChmdW5jdGlvbiAodmFsLCBpbmRleCwgYXJyKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAodmFsLm5hbWUgPT09IGxpc3RWYXJpYWJsZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvdW50ZXIgPSB2YWwudmFsLmxlbmd0aCAtIDE7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBmb3IgKGxldCBudW0gPSAwOyBudW0gPCBhcnIubGVuZ3RoOyBudW0rKykge1xyXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IGxvb3BTdGF0ZW1lbnQuc3RhdGVtZW50cy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRlbXBCbG9jay51bnNoaWZ0KGNsb25lKGxvb3BTdGF0ZW1lbnQuc3RhdGVtZW50c1tpXSkpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgLy8gcHV0IHRoZSBmb3JlYWNoIHN0YXRlbWVudCBsZW5ndGggbWludXMgMSB0aW1lc1xyXG4gICAgICAgICAgICAgICAgaWYgKG51bSA8PSBhcnIubGVuZ3RoIC0gMSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCB0ZW1wU3RhdGVtZW50ID0gY2xvbmUobG9vcFN0YXRlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgdGVtcFN0YXRlbWVudC50eXBlID0gXCJsb29wXCI7XHJcbiAgICAgICAgICAgICAgICAgICAgdGVtcFN0YXRlbWVudC5jb3VudGVyID0gY291bnRlci0tO1xyXG4gICAgICAgICAgICAgICAgICAgIHRlbXBCbG9jay51bnNoaWZ0KGNsb25lKHRlbXBTdGF0ZW1lbnQpKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBsZXQgYWxsTG9vcFN0YXRlbWVudHMgPSBjdXJyZW50RXhlY3V0aW9uQ29udGV4dC5ibG9ja3MuZmlsdGVyKGZ1bmN0aW9uICh2YWwpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB2YWwuaWQuaW5jbHVkZXMoaWQpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgbGV0IG9iaklkID0gYWxsTG9vcFN0YXRlbWVudHMubGVuZ3RoID8gYWxsTG9vcFN0YXRlbWVudHMucG9wKCkuaWQgOiBpZDtcclxuICAgICAgICAgICAgLy8gcmV2ZXJzZSB0byBmaW5kIHRoZSBsYXN0IGluZGV4IG9mIHN0YXRlbWVudFxyXG4gICAgICAgICAgICBsZXQgaW5kZXggPSBjdXJyZW50RXhlY3V0aW9uQ29udGV4dC5ibG9ja3Muc2xpY2UoKS5yZXZlcnNlKCkuZmluZEluZGV4KGZ1bmN0aW9uICh2YWx1ZSwgaW5kZXgsIGFycmF5KSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWUuaWQgPT09IG9iaklkO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgaW5kZXggPSBpbmRleCA+PSAwID8gY3VycmVudEV4ZWN1dGlvbkNvbnRleHQuYmxvY2tzLmxlbmd0aCAtIGluZGV4IDogMDtcclxuICAgICAgICAgICAgY3VycmVudEV4ZWN1dGlvbkNvbnRleHQuYmxvY2tzLmluc2VydChpbmRleCwgdGVtcEJsb2NrKTtcclxuICAgICAgICB9XHJcbiAgICB9XHJcblxyXG4gICAgZmluZFN0YXRlbWVudEJ5SWQoaWQpIHtcclxuICAgICAgICBsZXQgY3VycmVudEV4ZWN1dGlvbkNvb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uZXhlY3V0ZShicmFuY2hUYWtlbik7XHJcbiAgICAgICAgZWxzZSBpZiAobmV4dFR5cGUgPT09IG51bGwpIHJldHVybiBudWxsO1xyXG4gICAgICAgIGVsc2UgaWYgKG5leHRUeXBlID09PSAnbmV3Jykge1xyXG4gICAgICAgICAgICB0aGlzLmV4ZWN1dGlvblN0YWNrLnB1c2goY3VycmVudEV4ZWN1dGlvbkNvbnRleHQpO1xyXG4gICAgICAgICAgICBsZXQgbXlBcmdzID0gbnVsbDtcclxuICAgICAgICAgICAgaWYgKGN1cnJlbnRFeGVjdXRpb25Db250ZXh0LnBjLnR5cGUgPT09ICdkbycpIHtcclxuICAgICAgICAgICAgICAgIG15QXJncyA9IGN1cnJlbnRFeGVjdXRpb25Db250ZXh0LnBjLmNhbGwuYXJndW1lbnRzLm1hcChmdW5jdGlvbiAodmFsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZhbC5yZXBsYWNlKC8nL2csICcnKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgbXlBcmdzID0gY3VycmVudEV4ZWN1dGlvbkNvbnRleHQucGMucXVlcnkuYXJndW1lbnRzLm1hcChmdW5jdGlvbiAodmFsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZhbC5yZXBsYWNlKC8nL2csICcnKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGxldCBhcmdzID0gW107XHJcbiAgICAgICAgICAgIG15QXJncy5mb3JFYWNoKGZ1bmN0aW9uICh2YWx1ZSwgaW5kZXgsIGFycmF5KSB7XHJcbiAgICAgICAgICAgICAgICAvL2NvbnNvbGUubG9nKHZhbHVlKTtcclxuICAgICAgICAgICAgICAgIGxldCBteXZhciA9IGN1cnJlbnRFeGVjdXRpb25Db250ZXh0LnZhcmlhYmxlcy5maW5kKGZ1bmN0aW9uICh2YWwpIHtcclxuICAgICAgICAgICAgICAgICAgICAvL2NvbnNvbGUubG9nKHZhbCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZhbC5uYW1lID09PSB2YWx1ZTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgYXJncy5wdXNoKG15dmFyKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiQVJHU1wiLCBhcmdzKTtcclxuXHJcbiAgICAgICAgICAgIGxldCBzdHJhdGVneSA9IHRoaXMuZmluZFN0cmF0ZWd5KGN1cnJlbnRFeGVjdXRpb25Db250ZXh0LnBjLnR5cGUgPT09ICdkbycgPyBjdXJyZW50RXhlY3V0aW9uQ29udGV4dC5wYy5jYWxsLm5hbWUgOiBjdXJyZW50RXhlY3V0aW9uQ29udGV4dC5wYy5xdWVyeS5uYW1lKTtcclxuICAgICAgICAgICAgY3VycmVudEV4ZWN1dGlvbkNvbnRleHQgPSBuZXcgRnVuY3Rpb25FeGVjQ29udGV4dChzdHJhdGVneSk7XHJcbiAgICAgICAgICAgIGN1cnJlbnRFeGVjdXRpb25Db250ZXh0LnZhcmlhYmxlcy5mb3JFYWNoKGZ1bmN0aW9uICh2YWx1ZSwgaW5kZXgsIGFycmF5KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAodmFsdWUudHlwZSA9PT0gJ3BhcmFtZXRlcicpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YWx1ZS52YWwgPSBhcmdzW2luZGV4XS52YWw7XHJcbiAgICAgICAgICAgICAgICAgICAgLy92YWx1ZS52aXNpYmxlID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgY3VycmVudEV4ZWN1dGlvbkNvbnRleHQgPSBuZXh0VHlwZTtcclxuICAgICAgICB9XHJcblxyXG4gICAg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W107XHJcbiAgICAgICAgdGhpcy5hY3RpdmVMaW5lcy5wdXNoKHRoaXMuc3RyYXRlZ3kuaWQpO1xyXG4gICAgICAgIHRoaXMuYmxvY2tzID0gW107XHJcbiAgICAgICAgdGhpcy5ibG9ja3MgPSBjbG9uZSh0aGlzLnN0cmF0ZWd5LnN0YXRlbWVudHMpO1xyXG4gICAgICAgIHRoaXMudmFyaWFibGVzID0gW107XHJcbiAgICAgICAgaWYgKHRoaXMuc3RyYXRlZ3kucGFyYW1ldGVycyAhPT0gdW5kZWZpbmVkKSB7XHJcbiAgICAgICAgICAgIHRoaXMuc3RyYXRlZ3kucGFyYW1ldGVycy5mb3JFYWNoKGZ1bmN0aW9uIChjdXJyZW50VmFsLCBpbmRleCwgYXJyKSB7XHJcbiAgICAgICAgICAgICAgICBjdXJyZW50VmFsID0gY3VycmVudFZhbC5yZXBsYWNlKC8nL2csICcnKTtcclxuICAgICAgICAgICAgICAgIHRoaXMudmFyaWFibGVzLnB1c2goe1xyXG4gICAgICAgICAgICAgICAgICAgIFwiaWRcIjogZ2xvYmFsQ291bnRlci5jb3VudCsrLFxyXG4gICAgICAgICAgICAgICAgICAgIFwibmFtZVwiOiBjdXJyZW50VmFsLFxyXG4gICAgICAgICAgICAgICAgICAgIFwidmFsXCI6IG51bGwsXHJcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwicGFyYW1ldGVyXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgXCJ2aXNpYmxlXCI6IGZhbHNlLFxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0sIHRoaXMpO1xyXG4gICAgICAgIH1cclxuICAgICAgICB0aGlzLmV4dHJhY3RWYXJpYWJsZXModGhpcy5zdHJhdGVneS5zdGF0ZW1lbnRzLCBnbG9iYWxDb3VudGVyLCB0aGlzKTtcclxuICAgICAgICB2YXIgdW5pcSA9IFsuLi5uZXcgU2V0KHRoaXMudmFyaWFibGVzKV07XHJcbiAgICAgICAgdW5pcS5mb3JFYWNoKGZ1bmN0aW9uICh2YXJpYWJsZSkge1xyXG4gICAgICAgICAgICBjb25zb2xlLmxvZyhcInZhcjogICBcIiArIHZhcmlhYmxlLm5hbWUpO1xyXG4gICAgICAgIH0pO1xyXG4gICAgICAgIHRoaXMuY2FsbFN0YWNrID0gW107XHJcbiAgICB9XHJcblxyXG5cclxuICAgIGV4dHJhY3RWYXJpYWJsZXMoc3RhdGVtZW50cywgY291bnRlciwgYXJnVGhpcykge1xyXG4gICAgICAgIHN0YXRlbWVudHMuZm9yRWFjaChmdW5jdGlvbiAoY3VycmVudFZhbCwgaW5kZXgsIGFycikge1xyXG4gICAgICAgICAgICBpZiAoY3VycmVudFZhbC5pZGVudGlmaWVyKSB7XHJcbiAgICAgICAgICAgICAgICBsZXQgaWRlbnRpZmllciA9IGN1cnJlbnRWYWwuaWRlbnRpZmllci5yZXBsYWNlKC8nL2csICcnKTtcclxuICAgICAgICAgICAgICAgIHZhciBmb3VuZCA9IGFyZ1RoaXMudmFyaWFibGVzLnNvbWUoZnVuY3Rpb24gKGVsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVsLm5hbWUgPT09IGlkZW50aWZpZXI7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIGlmICghZm91bmQpIHtcclxuICAgICAgICAgICAgICAgICAgICBhcmdUaGlzLnZhcmlhYmxlcy5wdXNoKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgXCJpZFwiOiBjb3VudGVyLmNvdW50KyssXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIFwibmFtZVwiOiBpZGVudGlmaWVyLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBcInZhbFwiOiBudWxsLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJpZGVudGlmaWVyXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidmlzaWJsZVwiOiBmYWxzZSxcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoY3VycmVudFZhbC50eXBlID09PSAnZG8nKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoY3VycmVudFZhbC5jYWxsLmFyZ3VtZW50cykge1xyXG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRWYWwuY2FsbC5hcmd1bWVudHMuZm9yRWFjaChmdW5jdGlvbiAodmFsLCBpbmQsIGFycmF5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCA9IHZhbC5yZXBsYWNlKC8nL2csICcnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGZvdW5kID0gYXJnVGhpcy52YXJpYWJsZXMuc29tZShmdW5jdGlvbiAoZWwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbC5uYW1lID09PSB2YWw7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWZvdW5kKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdUaGlzLnZhcmlhYmxlcy5wdXNoKHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImlkXCI6IGNvdW50ZXIuY291bnQrKyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm5hbWVcIjogdmFsLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwidmFsXCI6IG51bGwsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJndW1lbnRcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInZpc2libGVcIjogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH0sIGFyZ1RoaXMpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChjdXJyZW50VmFsLnR5cGUgPT09ICdyZXR1cm4nKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoY3VycmVudFZhbC5xdWVyeS5hcmd1bWVudHMpIHtcclxuICAgICAgICAgICAgICAgICAgICBjdXJyZW50VmFsLnF1ZXJ5LmFyZ3VtZW50cy5mb3JFYWNoKGZ1bmN0aW9uICh2YWwsIGluZCwgYXJyYXkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsID0gdmFsLnJlcGxhY2UoLycvZywgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgZm91bmQgPSBhcmdUaGlzLnZhcmlhYmxlcy5zb21lKGZ1bmN0aW9uIChlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVsLm5hbWUgPT09IHZhbDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZm91bmQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ1RoaXMudmFyaWFibGVzLnB1c2goe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiaWRcIjogY291bnRlci5jb3VudCsrLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwibmFtZVwiOiB2YWwsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ2YWxcIjogbnVsbCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcmd1bWVudFwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwidmlzaWJsZVwiOiBmYWxzZSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSwgYXJnVGhpcyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGN1cnJlbnRWYWwudHlwZSA9PT0gXCJmb3JlYWNoXCIpIHtcclxuICAgICAgICAgICAgICAgIGFyZ1RoaXMudmFyaWFibGVzLmZvckVhY2goZnVuY3Rpb24gKHZhbCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICh2YWwubmFtZSA9PT0gKGN1cnJlbnRWYWwubGlzdC5yZXBsYWNlKC8nL2csICcnKSkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsLnZhbCA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwucGFyZW50SWQgPSBjdXJyZW50VmFsLmlkO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwuZGlydHlBcnJheSA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwucHJldlZhciA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChjdXJyZW50VmFsLnN0YXRlbWVudHMpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMuZXh0cmFjdFZhcmlhYmxlcyhjdXJyZW50VmFsLnN0YXRlbWVudHMsIGNvdW50ZXIsIGFyZ1RoaXMpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSwgYXJnVGhpcyk7XHJcbiAgICB9XHJcblxyXG4gICAgZ2V0TmV4dFN0YXRlbWVudChjdXJyZW50U3RhdGVtZW50LCBicmFuY2hUYWtlbikge1xyXG4gICAgICAgIHRoaXMuYWN0aXZlTGluZXMgPSBbXTtcclxuICAgICAgICBpZiAodGhpcy5jYWxsU3RhY2subGVuZ3RoKSB7XHJcbiAgICAgICAgICAgIHRoaXMucGMgPSB0aGlzLmNhbGxTdGFjay5wb3AoKTtcclxuICAgICAgICAgICAgaWYgKHRoaXMucGMudHlwZSA9PT0gJ3JldHVybicpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMucGMudHlwZSA9ICdlbmQnO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgdGhpcy5wYyA9IHRoaXMuYmxvY2tzLnNoaWZ0KCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdGhpcy5hY3RpdmVMaW5lcy5wdXNoKHRoaXMucGMuaWQpO1xyXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICBpZiAoY3VycmVudFN0YXRlbWVudC50eXBlID09PSBcImlmXCIgJiYgYnJhbmNoVGFrZW4pIHtcclxuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHMgIT09IHVuZGVmaW5lZCAmJiBjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHMubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSBjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHMubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ibG9ja3MudW5zaGlmdChjbG9uZShjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHNbaV0pKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudFN0YXRlbWVudC50eXBlID09PSBcInVudGlsXCIgJiYgYnJhbmNoVGFrZW4pIHtcclxuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHMgIT09IHVuZGVmaW5lZCAmJiBjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHMubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYmxvY2tzLnVuc2hpZnQoY3VycmVudFN0YXRlbWVudCk7XHJcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IGN1cnJlbnRTdGF0ZW1lbnQuc3RhdGVtZW50cy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmJsb2Nrcy51bnNoaWZ0KGNsb25lKGN1cnJlbnRTdGF0ZW1lbnQuc3RhdGVtZW50c1tpXSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIGlmIChjdXJyZW50U3RhdGVtZW50LnR5cGUgPT09IFwicmV0dXJuXCIpIHtcclxuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50U3RhdGVtZW50LnF1ZXJ5LnR5cGUgPT09IFwiY2FsbFwiKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYWxsU3RhY2sucHVzaCh0aGlzLnBjKTtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLmFjdGl2ZUxpbmVzLnB1c2godGhpcy5wYy5pZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICduZXcnO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjdXJyZW50U3RhdGVtZW50LnF1ZXJ5LnR5cGUgPT09ICdub3RoaW5nJykge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYWN0aXZlTGluZXMucHVzaCh0aGlzLnBjLmlkKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ25vdGhpbmcnO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLmFjdGl2ZUxpbmVzLnB1c2godGhpcy5wYy5pZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdyZXR1cm4nO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGN1cnJlbnRTdGF0ZW1lbnQudHlwZSA9PT0gXCJkb1wiKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoY3VycmVudFN0YXRlbWVudC5jYWxsICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLmNhbGxTdGFjay5wdXNoKHRoaXMucGMpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnbmV3JztcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIGlmIChjdXJyZW50U3RhdGVtZW50LnR5cGUgPT09IFwiZm9yZWFjaFwiKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoY3VycmVudFN0YXRlbWVudC5zdGF0ZW1lbnRzICE9PSB1bmRlZmluZWQgJiYgY3VycmVudFN0YXRlbWVudC5zdGF0ZW1lbnRzLmxlbmd0aCA+IDApIHtcclxuICAgICAgICAgICAgICAgICAgICBsZXQgbG9vcENvdW50VmFyID0gdGhpcy52YXJpYWJsZXMuZmluZChmdW5jdGlvbiAodmFsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWwubmFtZSA9PT0gY3VycmVudFN0YXRlbWVudC5saXN0LnJlcGxhY2UoLycvZywgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIGZvciAobGV0IG51bSA9IDAsIGNvdW50ID0gbG9vcENvdW50VmFyLnZhbC5sZW5ndGg7IG51bSA8IGxvb3BDb3VudFZhci52YWwubGVuZ3RoOyBudW0rKywgY291bnQtLSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gY3VycmVudFN0YXRlbWVudC5zdGF0ZW1lbnRzLmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmJsb2Nrcy51bnNoaWZ0KGNsb25lKGN1cnJlbnRTdGF0ZW1lbnQuc3RhdGVtZW50c1tpXSkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHB1dCB0aGUgZm9yZWFjaCBzdGF0ZW1lbnQgbGVuZ3RoIG1pbnVzIDEgdGltZXNcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bSA8IGxvb3BDb3VudFZhci52YWwubGVuZ3RoIC0gMSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHRlbXBTdGF0ZW1lbnQgPSBjbG9uZShjdXJyZW50U3RhdGVtZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRlbXBTdGF0ZW1lbnQudHlwZSA9IFwibG9vcFwiO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVtcFN0YXRlbWVudC5jb3VudGVyID0gY291bnQgLSAxO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ibG9ja3MudW5zaGlmdCh0ZW1wU3RhdGVtZW50KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIC8vIGlmIChjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHMgIT09IHVuZGVmaW5lZCAmJiBjdXJyZW50U3RhdGVtZW50LnR5cGUgIT0gXCJsb29wXCIpXHJcbiAgICAgICAgICAgICAgICAvLyAgICAgdGhpcy5ibG9ja3MudW5zaGlmdChjbG9uZShjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHNbMF0pKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgaWYgKHRoaXMuYmxvY2tzLmxlb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O1xyXG4gICAgICAgICAgICAgICAgLy8gb3BlbiB0aGUgbW9kYWwgdG8gaW5wdXQgc3RyYXRlZ3kgcGFyYW1ldGVyc1xyXG4gICAgICAgICAgICAgICAgJChcIiNpbml0aWFsUGFyYW1zXCIpLm1vZGFsKHtcclxuICAgICAgICAgICAgICAgICAgICBiYWNrZHJvcDogXCJzdGF0aWNcIixcclxuICAgICAgICAgICAgICAgICAgICBrZXlib2FyZDogXCJmYWxzZVwiLFxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICB2bS5teVN0cmF0ZWd5ID0gdm0uc2VsZWN0ZWRTdHJhdGVneTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2bS5zdHJhdGVneUNoYW5nZWQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICAkd2luZG93LmxvY2F0aW9uID0gJHdpbmRvdy5sb2NhdGlvbi5vcmlnaW4gKyAkd2luZG93LmxvY2F0aW9uLnBhdGhuYW1lICsgJz9zdHJhdGVneT0nICsgdm0ubXlTdHJhdGVneS5uYW1lO1xyXG4gICAgICAgICAgICB9O1xyXG5cclxuICAgICAgICAgICAgdm0ucHJvY2VlZFRvU3RyYXRlZ3kgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICBsZXQgZmxhZyA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICBhbmd1bGFyLmZvckVhY2godm0ucGFyYW1ldGVycywgZnVuY3Rpb24gKHZhbCwga2V5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYodmFsLnZhbCA9PSBudWxsIHx8IHZhbC52YWwudHJpbSgpID09ICcnKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZsYWcgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuXHJcbiAgICAgICAgICAgICAgICBpZihmbGFnID09IHRydWUpIHtcclxuICAgICAgICAgICAgICAgICAgICBhbmd1bGFyLmZvckVhY2godm0ucGFyYW1ldGVycywgZnVuY3Rpb24gKHZhbCwga2V5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbC52aXNpYmxlPXRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgJChcIiNpbml0aWFsUGFyYW1zXCIpLm1vZGFsKCdoaWRlJyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICB2bS5yZXNldCA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIGlmICh2bS5zZWxlY3RlZFN0cmF0ZWd5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaW50ZXJwcmV0ZXIucmVzZXQoKTtcclxuICAgICAgICAgICAgICAgICAgICB2bS5leGVjT2JqID0gaW50ZXJwcmV0ZXIuaW5pdCh2bS5zZWxlY3RlZFN0cmF0ZWd5LnN0cmF0ZWdpZXNbMF0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHZtLmN1cnJlbnRTdHJhdGVneSA9IHZtLmV4ZWNPYmouY3VycmVudFN0cmF0ZWd5O1xyXG4gICAgICAgICAgICAgICAgICAgICQoJyMnICsgdm0uY3VycmVudFN0cmF0ZWd5Lm5hbWUpLmNvbGxhcHNlKCdzaG93Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgdm0uc2VsZWN0ZWRTdHJhdGVneS5zdHJhdGVnaWVzLmZvckVhY2goZnVuY3Rpb24gKHN0cmF0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHZtLmN1cnJlbnRTdHJhdGVneS5uYW1lICE9PSBzdHJhdC5uYW1lKSAkKCcjJyArIHN0cmF0Lm5hbWUpLmNvbGxhcHNlKCdoaWRlJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy8gb3BlbiB0aGUgbW9kYWwgdG8gaW5wdXQgc3RyYXRlZ3kgcGFyYW1ldGVyc1xyXG4gICAgICAgICAgICAgICAgICAgIHZtLnBhcmFtZXRlcnMgPSB2bS5leGVjT2JqLnZhcmlhYmxlcy5maWx0ZXIoZnVuY3Rpb24gKHZhbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmFsLnR5cGUgPT0gJ3BhcmFtZXRlcic7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgLy8gb3BlbiB0aGUgbW9kYWwgdG8gaW5wdXQgc3RyYXRlZ3kgcGFyYW1ldGVyc1xyXG4gICAgICAgICAgICAgICAgICAgICQoXCIjaW5pdGlhbFBhcmFtc1wiKS5tb2RhbCh7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tkcm9wOiBcInN0YXRpY1wiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBrZXlib2FyZDogXCJmYWxzZVwiLFxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBhbGVydChcInBsZWFzZSBjaG9vc2UgYSBzdHJhdGVneSBmaXJzdFwiKTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGZ1bmN0aW9uIGNoZWNrVHlwZSgpIHtcclxuICAgICAgICAgICAgICAgIGlmICh2bS5leGVjT2JqLmN1cnJlbnRTdGF0ZW1lbnQudHlwZSA9PSAnc2V0Jykge1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCBpZCA9IHZtLmV4ZWNPYmouY3VycmVudFN0YXRlbWVudC5pZGVudGlmaWVyLnJlcGxhY2UoLycvZywgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCB2YXJpYWJsZSA9IHZtLmV4ZWNPYmoudmFyaWFibGVzLmZpbmQoZnVuY3Rpb24gKHZhbCwgaW5kZXgsIGFycikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmFsLm5hbWUgPT0gaWQ7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHZhcmlhYmxlLnZhbCA9PSBudWxsIHx8IHZhcmlhYmxlLnZhbC5sZW5ndGggPT0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZS52aXNpYmxlID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdm0uZXhlY09iai5zZXROZWVkZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAkc2NvcGUuJGJyb2FkY2FzdChcIkVkaXRNZVwiLCBpZCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdm0uZXhlY09iai5zZXROZWVkZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAodm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50LnR5cGUgPT0gJ2ZvcmVhY2gnIHx8IHZtLmV4ZWNPYmouY3VycmVudFN0YXRlbWVudC50eXBlID09ICdsb29wJykge1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCBsaXN0ID0gdm0uZXhlY09iai52YXJpYWJsZXMuZmluZChmdW5jdGlvbiAodmFsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWwubmFtZSA9PT0gdm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50Lmxpc3QucmVwbGFjZSgvJy9nLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIGxldCBpZGVudGlmaWVyID0gdm0uZXhlY09iai52YXJpYWJsZXMuZmluZChmdW5jdGlvbiAodmFsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWwubmFtZSA9PT0gdm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50LmlkZW50aWZpZXIucmVwbGFjZSgvJy9nLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWRlbnRpZmllci52aXNpYmxlID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICBpZGVudGlmaWVyLnZhbCA9IGxpc3QudmFsW3ZtLmV4ZWNPYmouY3VycmVudFN0YXRlbWVudC5jb3VudGVyID8gdm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50LmNvdW50ZXIgOiAwXTtcclxuICAgICAgICAgICAgICAgICAgICBsaXN0LmRpcnR5QXJyYXkucHVzaChsaXN0LnZhbFt2bS5leGVjT2JqLmN1cnJlbnRTdGF0ZW1lbnQuY291bnRlciA/IHZtLmV4ZWNPYmouY3VycmVudFN0YXRlbWVudC5jb3VudGVyIDogMF0pO1xyXG4gICAgICAgICAgICAgICAgICAgIC8vJHNjb3BlLiRhcHBseSgpO1xyXG5cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgdm0ubmV4dFN0YXRlbWVudCA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZtLmV4ZWNPYmogPSBpbnRlcnByZXRlci5leGVjdXRlKCk7XHJcbiAgICAgICAgICAgICAgICAvLyB2bS5leGVjT2JqLnZhcmlhYmxlcy5mb3JFYWNoKGZ1bmN0aW9uICh2YXJpYWJsZSkge1xyXG4gICAgICAgICAgICAgICAgLy8gICAgIGNvbnNvbGUubG9nKFwiVmFyaWFibGVzOiAgIFwiICsgdmFyaWFibGUubmFtZSk7XHJcbiAgICAgICAgICAgICAgICAvLyB9KTtcclxuICAgICAgICAgICAgICAgIGlmICh2bS5leGVjT2JqID09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAkdGltZW91dChmdW5jdGlvbigpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYWxlcnQoXCJDb25ncmF0dWxhdGlvbiFZb3UgaGF2ZSByZWFjaGVkIGVuZCBvZiBzdHJhdGVneSEgSWYgeW91IHRoaW5rIHlvdSBkaWQgbm90IGZpbmlzaCB0aGUgdGFzaywgcmVzZXQgdGhlIHN0cmF0ZWd5IGFuZCBzdGFydCBvdmVyIGFnYWluLiBcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgfSwgMTAwKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBjaGVja1R5cGUoKTtcclxuICAgICAgICAgICAgICAgIGlmKHZtLmV4ZWNPYmouc3RyYXRlZ3lDaGFuZ2VkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgJHRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBhbmd1bGFyLmZvckVhY2godm0uZXhlY09iai52YXJpYWJsZXMsIGZ1bmN0aW9uICh2YWwsIGtleSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYodmFsLnR5cGUgPT0gJ3BhcmFtZXRlcicpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwudmlzaWJsZSA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sIDEwMCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpZiAodm0uY3VycmVudFN0cmF0ZWd5Lm5hbWUgIT09IHZtLmV4ZWNPYmouY3VycmVudFN0cmF0ZWd5Lm5hbWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAkKCcjJyArIHZtLmV4ZWNPYmouY3VycmVudFN0cmF0ZWd5Lm5hbWUpLmNvbGxhcHNlKCdzaG93Jyk7XHJcbiAgICAgICAgICAgICAgICAgICAgJCgnIycgKyB2bS5jdXJyZW50U3RyYXRlZ3kubmFtZSkuY29sbGFwc2UoJ2hpZGUnKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAodm0uZXhlY09iai52YXJpYWJsZXMgIT09IG51bGwpe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2bS5wYXJhbWV0ZXJzID0gdm0uZXhlY09iai52YXJpYWJsZXMuZmlsdGVyKGZ1bmN0aW9uICh2YWwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWwudHlwZSA9PSAncGFyYW1ldGVyJztcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgICAgICB2bS5jdXJyZW50U3RyYXRlZ3kgPSB2bS5leGVjT2JqLmN1cnJlbnRTdHJhdGVneTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHZtLnByZXZTdGF0ZW1lbnQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2bS5leGVjT2JqID0gaW50ZXJwcmV0ZXIuZ29CYWNrKCk7XHJcbiAgICAgICAgICAgICAgICBpZiAodm0uZXhlY09iaiA9PT0gbnVsbCkgcmV0dXJuO1xyXG4gICAgICAgICAgICAgICAgaWYodm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50LnR5cGUgPT09ICdzZXQnKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IGlkID0gdm0uZXhlY09iai5jdXJyZW50U3RhdGVtZW50LmlkZW50aWZpZXIucmVwbGFjZSgvJy9nLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IHZhcmlhYmxlID0gdm0uZXhlY09iai52YXJpYWJsZXMuZmluZChmdW5jdGlvbiAodmFsLCBpbmRleCwgYXJyKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWwubmFtZSA9PSBpZDtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyh2YXJpYWJsZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYodmFyaWFibGUuZGlydHlBcnJheSAhPT0gdW5kZWZpbmVkKSB2YXJpYWJsZS5kaXJ0eUFycmF5ID0gW107XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBjaGVja1R5cGUoKTtcclxuICAgICAgICAgICAgICAgIGlmICh2bS5jdXJyZW50U3RyYXRlZ3kubmFtZSAhPT0gdm0uZXhlY09iai5jdXJyZW50U3RyYXRlZ3kubmFtZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICQoJyMnICsgdm0uZXhlY09iai5jdXJyZW50U3RyYXRlZ3kubmFtZSkuY29sbGFwc2UoJ3Nob3cnKTtcclxuICAgICAgICAgICAgICAgICAgICAkKCcjJyArIHZtLmN1cnJlbnRTdHJhdGVneS5uYW1lKS5jb2xsYXBzZSgnaGlkZScpO1xyXG4gICAgICAgICAgICAgICAgICAgIHZtLmN1cnJlbnRTdHJhdGVneSA9IHZtLmV4ZWNPYmouY3VycmVudFN0cmF0ZWd5O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9O1xyXG5cclxuICAgICAgICAgICAgdm0ub3V0ZXJTdGF0ZW1lbnQgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgICAgICB2bS5leGVjT2JqID0gaW50ZXJwcmV0ZXIuZXhlY3V0ZShmYWxzZSk7XHJcblxyXG4gICAgICAgICAgICAgICAgY2hlY2tUeXBlKCk7XHJcblxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICB2bS5pbm5lclN0YXRlbWVudCA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHZtLmV4ZWNPYmogPSBpbnRlcnByZXRlci5leGVjdXRlKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgY2hlY2tUeXBlKCk7XHJcbiAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAkc2NvcGUuJG9uKFwic2V0TmVlZGVkRmFsc2VcIiwgZnVuY3Rpb24gKGFyZ3MpIHtcclxuICAgICAgICAgICAgICAgIGlmKCFhcmdzLnRhcmdldFNjb3BlLm1vZGVsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdm0uZXhlY09iai5zZXROZWVkZWQgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICB2bS5leGVjT2JqLnNldE5lZWRlZCA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuXHJcbiAgICAgICAgICAgICRzY29wZS4kb24oXCJibG9ja0FkZFwiLCBmdW5jdGlvbiAoYXJncywgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgaW50ZXJwcmV0ZXIuYWRkTG9vcEJsb2NrcyhkYXRhLmlkLCBkYXRhLmRhdGEpO1xyXG5cclxuICAgICAgICAgICAgfSlcclxuICAgICAgICB9KTtcclxuICAgIH0pO1xyXG5cclxuICAgIG15YXBwLmRpcmVjdGl2ZSgndmFyaWFibGVWYWx1ZScsIGZ1bmN0aW9uICgkcGFyc2UsICR0aW1lb3V0KSB7XHJcbiAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgdGVtcGxhdGU6XHJcbiAgICAgICAgICAgICc8c3BhbiBuZy1zaG93PVwiZWRpdFwiPicgK1xyXG4gICAgICAgICAgICAnPHRleHRhcmVhIG5nLXNob3c9XCJpc0FycmF5IFwiIG5nLWJsdXI9XCJ1cGRhdGVNb2RlbCgpXCIgbmctbW9kZWw9XCJ2YXJcIj48L3RleHRhcmVhPicgK1xyXG4g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ICAgICAgICAgICc8YnV0dG9uIHN0eWxlPVwibWFyZ2luLWxlZnQ6NXB4O1wiIG5nLXNob3c9XCJpc0FycmF5ICYmIGFsbHZhci5sZW5ndGggXCIgdGl0bGU9XCIgQWRkIG1vcmUgaXRlbXNcIiBocmVmPVwiI1wiIG5nLWNsaWNrPVwiY2hhbmdlRWRpdCgpXCI+PGkgY2xhc3M9XCJnbHlwaGljb24gZ2x5cGhpY29uLXBsdXNcIj48L2k+PC9idXR0b24+JyArXHJcbiAgICAgICAgICAgICc8L2Rpdj4nLFxyXG4gICAgICAgICAgICByZXN0cmljdDogJ0UnLFxyXG4gICAgICAgICAgICBzY29wZToge1xyXG4gICAgICAgICAgICAgICAgbW9kZWw6ICc9JyxcclxuICAgICAgICAgICAgICAgIGlzQXJyYXk6ICc9JyxcclxuICAgICAgICAgICAgICAgIG1vZGVsSWQ6ICc9JyxcclxuICAgICAgICAgICAgICAgIHBhcmVudElkOiAnPScsXHJcbiAgICAgICAgICAgICAgICBkaXJ0eUFycmF5OiAnPScsXHJcbiAgICAgICAgICAgICAgICBwcmV2VmFyOiAnPScsXHJcbiAgICAgICAgICAgICAgICBmYWRlSW46ICc9J1xyXG4gICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICBsaW5rOiBmdW5jdGlvbiAoc2NvcGUsIGVsZW1lbnQsIGF0dHJzLCBjb250cm9sbGVyKSB7XHJcbiAgICAgICAgICAgICAgICBzY29wZS5lZGl0ID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBzY29wZS52YXIgPSAnJztcclxuICAgICAgICAgICAgICAgIHNjb3BlLmlkID0gbnVsbDtcclxuICAgICAgICAgICAgICAgIHZhciBsaXN0ZW5lciA9IG51bGw7XHJcbiAgICAgICAgICAgICAgICBzY29wZS4kb24oJ0VkaXRNZScsIGZ1bmN0aW9uIChldmVudCwgZGF0YSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzY29wZS5tb2RlbElkID09IGRhdGEpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuaWQgPSBkYXRhO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzY29wZS5jaGFuZ2VFZGl0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICBpZihzY29wZS5mYWRlSW4gIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNjb3BlLiR3YXRjaCgnZmFkZUluJywgZnVuY3Rpb24odmFsdWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYodmFsdWUpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoZWxlbWVudCkuZmFkZUluKDE1MDApO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoZWxlbWVudCkuZmFkZU91dCgxMDAwKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICBpZiAoc2NvcGUuaXNBcnJheSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHNjb3BlLmFsbHZhciA9IHNjb3BlLm1vZGVsO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuXHJcbiAgICAgICAgICAgICAgICBzY29wZS5jaGFuZ2VFZGl0ID0gZnVuY3Rpb24gKCkge1xyXG5cclxuICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lciA9IHNjb3BlLiR3YXRjaCgnbW9kZWwnLCBmdW5jdGlvbiAobmV3dmFsLCBvbGR2YWwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuJGVtaXQoXCJzZXROZWVkZWRGYWxzZVwiKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICBzY29wZS5lZGl0ID0gIXNjb3BlLmVkaXQ7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNjb3BlLmlzQXJyYXkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUudmFyID0gc2NvcGUuYWxsdmFyLmpvaW4oJywnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJHRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFswXS5maXJzdENoaWxkLmZpcnN0Q2hpbGQuZm9jdXMoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTApO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgJHRpbWVvdXQoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFswXS5maXJzdENoaWxkLmxhc3RDaGlsZC5mb2N1cygpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAxMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgIHNjb3BlLnVwZGF0ZU1vZGVsID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGxpc3RlbmVyKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgc2NvcGUuZWRpdCA9ICFzY29wZS5lZGl0O1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChzY29wZS5pc0FycmF5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBhcnIgPSBuZXcgU2V0KHNjb3BlLnZhci5zcGxpdCgnLCcpKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLmFsbHZhciA9IFtdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBhbmd1bGFyLmZvckVhY2goYXJyLCBmdW5jdGlvbiAodmFsLCBrZXkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbC50cmltKCkubGVuZ3RoID8gc2NvcGUuYWxsdmFyLnB1c2godmFsLnRyaW0oKSkgOiBudWxsO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHNjb3BlLmRpcnR5QXJyYXkubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yKGxldCBpID0gMDsgaTwgc2NvcGUuZGlydHlBcnJheS5sZW5ndGg7IGkrKylcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihzY29wZS5kaXJ0eUFycmF5W2ldICE9PSBzY29wZS5hbGx2YXJbaV0pe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZS5hbGx2YXIgPSBzY29wZS5wcmV2VmFyO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGVydChcIiBZb3UgYXJlIGN1cnJlbnRseSBleGVjdXRpbmcgYSBsb29wLiBBZGRpbmcgZWxlbWVudHMgYXJlIGp1c3QgYWxsb3dlZCB0byB0aGUgZW5kIG9mIGNvbGxlY3Rpb24uICBcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICRwYXJzZShhdHRycy5tb2RlbCkuYXNzaWduKHNjb3BlLiRwYXJlbnQsIHNjb3BlLmFsbHZhcik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHNjb3BlLnByZXZWYXIubGVuZ3RoICE9PSAwICYmIHNjb3BlLnByZXZWYXIubGVuZ3RoIDwgc2NvcGUuYWxsdmFyLmxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUuJGVtaXQoXCJibG9ja0FkZFwiLCB7XCJkYXRhXCI6IHNjb3BlLmFsbHZhci5zbGljZShzY29wZS5wcmV2VmFyLmxlbmd0aCwgc2NvcGUuYWxsdmFyLmxlbmd0aCksIFwiaWRcIjogc2NvcGUucGFyZW50SWR9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2NvbnNvbGUubG9nKHNjb3BlLmFsbHZhci5sZW5ndGgpO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUucHJldlZhciA9IHNjb3BlLmFsbHZhcjtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNjb3BlLmlkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjb3BlLiRlbWl0KFwic2V0TmVlZGVkRmFsc2VcIik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcbiAgICB9KTtcclxuXHJcbn0iLCIndXNlIHN0cmljdCc7XHJcblxyXG52YXIgY2xvbmUgPSByZXF1aXJlKCdjbG9uZScpO1xyXG5cclxuLy8gaHR0cHM6Ly9zdGFja292ZXJmbG93LmNvbS9xdWVzdGlvbnMvNTg2MTgyL2hvdy10by1pbnNlcnQtYW4taXRlbS1pbnRvLWFuLWFycmF5LWF0LWEtc3BlY2lmaWMtaW5kZXhcclxuQXJyYXkucHJvdG90eXBlLmluc2VydCA9IGZ1bmN0aW9uIChpbmRleCkge1xyXG4gICAgaW5kZXggPSBNYXRoLm1pbihpbmRleCwgdGhpcy5sZW5ndGgpO1xyXG4gICAg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RhdGVtZW50QnlJZChpZCk7XHJcbiAgICAgICAgaWYgKGxvb3BTdGF0ZW1lbnQgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgbGV0IHRlbXBCbG9jayA9IFtdO1xyXG4gICAgICAgICAgICBsZXQgbGlzdFZhcmlhYmxlID0gbG9vcFN0YXRlbWVudC5saXN0LnJlcGxhY2UoLycvZywgJycpO1xyXG4gICAgICAgICAgICBsZXQgY291bnRlciA9IDA7XHJcbiAgICAgICAgICAgIGN1cnJlbnRFeGVjdXRpb25Db250ZXh0LnZhcmlhYmxlcy5mb3JFYWNoKGZ1bmN0aW9uICh2YWwsIGluZGV4LCBhcnIpIHtcclxuICAgICAgICAgICAgICAgIGlmICh2YWwubmFtZSA9PT0gbGlzdFZhcmlhYmxlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY291bnRlciA9IHZhbC52YWwubGVuZ3RoIC0gMTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIGZvciAobGV0IG51bSA9IDA7IG51bSA8IGFyci5sZW5ndGg7IG51bSsrKSB7XHJcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gbG9vcFN0YXRlbWVudC5zdGF0ZW1lbnRzLmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGVtcEJsb2NrLnVuc2hpZnQoY2xvbmUobG9vcFN0YXRlbWVudC5zdGF0ZW1lbnRzW2ldKSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAvLyBwdXQgdGhlIGZvcmVhY2ggc3RhdGVtZW50IGxlbmd0aCBtaW51cyAxIHRpbWVzXHJcbiAgICAgICAgICAgICAgICBpZiAobnVtIDw9IGFyci5sZW5ndGggLSAxKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRlbXBTdGF0ZW1lbnQgPSBjbG9uZShsb29wU3RhdGVtZW50KTtc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eGVjdXRpb25Db250ZXh0LnBjLCBicmFuY2hUYWtlbik7XHJcbiAgICAgICAgaWYgKG5leHRUeXBlID09PSAnbm90aGluZycgfHwgbmV4dFR5cGUgPT09ICdyZXR1cm4nKSByZXR1cm4gdGhpcy5leGVjdXRlKGJyYW5jaFRha2VuKTtcclxuICAgICAgICBlbHNlIGlmIChuZXh0VHlwZSA9PT0gbnVsbCkgcmV0dXJuIG51bGw7XHJcbiAgICAgICAgZWxzZSBpZiAobmV4dFR5cGUgPT09ICduZXcnKSB7XHJcbiAgICAgICAgICAgIHRoaXMuZXhlY3V0aW9uU3RhY2sucHVzaChjdXJyZW50RXhlY3V0aW9uQ29udGV4dCk7XHJcbiAgICAgICAgICAgIGxldCBteUFyZ3MgPSBudWxsO1xyXG4gICAgICAgICAgICBpZiAoY3VycmVudEV4ZWN1dGlvbkNvbnRleHQucGMudHlwZSA9PT0gJ2RvJykge1xyXG4gICAgICAgICAgICAgICAgbXlBcmdzID0gY3VycmVudEV4ZWN1dGlvbkNvbnRleHQucGMuY2FsbC5hcmd1bWVudHMubWFwKGZ1bmN0aW9uICh2YWwpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmFsLnJlcGxhY2UoLycvZywgJycpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBteUFyZ3MgPSBjdXJyZW50RXhlY3V0aW9uQ29udGV4dC5wYy5xdWVyeS5hcmd1bWVudHMubWFwKGZ1bmN0aW9uICh2YWwpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmFsLnJlcGxhY2UoLycvZywgJycpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgbGV0IGFyZ3MgPSBbXTtcclxuICAgICAgICAgICAgbXlBcmdzLmZvckVhY2goZnVuY3Rpb24gKHZhbHVlLCBpbmRleCwgYXJyYXkpIHtcclxuICAgICAgICAgICAgICAgIC8vY29uc29sZS5sb2codmFsdWUpO1xyXG4gICAgICAgICAgICAgICAgbGV0IG15dmFyID0gY3VycmVudEV4ZWN1dGlvbkNvbnRleHQudmFyaWFibGVzLmZpbmQoZnVuY3Rpb24gKHZhbCkge1xyXG4gICAgICAgICAgICAgICAgICAgIC8vY29uc29sZS5sb2codmFsKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmFsLm5hbWUgPT09IHZhbHVlO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICBhcmdzLnB1c2gobXl2YXIpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgY29uc29sZS5sb2coXCJBUkdTXCIsIGFyZ3MpO1xyXG5cclxuICAgICAgICAgICAgbGV0IHN0cmF0ZWd5ID0gdGhpcy5maW5kU3RyYXRlZ3koY3VycmVudEV4ZWN1dGlvbkNvbnRleHQucGMudHlwZSA9PT0gJ2RvJyA/IGN1cnJlbnRFeGVjdXRpb25Db250ZXh0LnBjLmNhbGwubmFtZSA6IGN1cnJlbnRFeGVjdXRpb25Db250ZXh0LnBjLnF1ZXJ5Lm5hbWUpO1xyXG4gICAgICAgICAgICBjdXJyZW50RXhlY3V0aW9uQ29udGV4dCA9IG5ldyBGdW5jdGlvbkV4ZWNDb250ZXh0KHN0cmF0ZWd5KTtcclxuICAgICAgICAgICAgY3VycmVudEV4ZWN1dGlvbkNvbnRleHQudmFyaWFibGVzLmZvckVhY2goZnVuY3Rpb24gKHZhbHVlLCBpbmRleCwgYXJyYXkpIHtcclxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZS50eXBlID09PSAncGFyYW1ldGVyJykge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlLnZhbCA9IGFyZ3NbaW5kZXhdLnZhbDtcclxuICAgICAgICAgICAgICAgICAgICAvL3ZhbHVlLnZpc2libGUgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICBjdXJyZW50RXhlY3V0aW9uQ29udGV4dCA9IG5leHRUeXBlO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdGhpcy5leGVjdXRpb25TdGFjay5wdXNoKGN1cnJlbnRFeGVjdXRpb25Db250ZXh0KTtcclxuICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICBjdXJyZW50U3RhdGVtZW50OiBjdXJyZW50RXhlY3V0aW9uQ29udGV4dC5wYyxcclxuICAgICAgICAgICAgY3VycmVudFN0cmF0ZWd5OiBjdXJyZW50RXhlY3V0aW9uQ29udGV4dC5zdHJhdGVneSxcclxuICAgICAgICAgICAgZXhlY3V0aW9uU3RhY2s6IHRoaXMuZXhlY3V0aW9uU3RhY2ssXHJcbiAgICAgICAgICAgIGFjdGl2ZUxpbmVzOiBjdXJyZW50RXhlY3V0aW9uQ29udGV4dC5hY3RpdmVMaW5lcyxcclxuICAgICAgICAgICAgc2VsZWN0aW9uTmVlZGVkOiAoY3VycmVudEV4ZWN1dGlvbkNvbnRleHQucGMudHlwZSA9PT0gXCJpZlwiIHx8IGN1cnJlbnRFeGVjdXRpb25Db250ZXh0LnBjLnR5cGUgPT09IFwidW50aWxcIiksXHJcbiAgICAgICAgICAgIHNldE5lZWRlZDogY3VycmVudEV4ZWN1dGlvbkNvbnRleHQucGMudHlwZSA9PT0gJ3NldCcsXHJcbiAgICAgICAgICAgIHZhcmlhYmxlczogY3VycmVudEV4ZWN1dGlvbkNvbnRleHQudmFyaWFibGVzLFxyXG4gICAgICAgICAgICBzdHJhdGVneUNoYW5nZWQ6IG5leHRUeXBlID09ICduZXcnXHJcbiAgICAgICAgfTtcclxuXHJcbiAgICB9XHJcblxyXG4gICAgZ29CYWNrKCkge1xyXG4gICAgICAgIGxldCBzdGFjayA9IHRoaXMuaGlzdG9yeUJhY2t3YXJkLnBvcCgpO1xyXG4gICAgICAgIGlm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gICAgICB0aGlzLnN0cmF0ZWd5ID0gY3VycmVudFN0cmF0ZWd5O1xyXG4gICAgICAgIHRoaXMucGMgPSB0aGlzLnN0cmF0ZWd5O1xyXG4gICAgICAgIHRoaXMuYWN0aXZlTGluZXMgPSBbXTtcclxuICAgICAgICB0aGlzLmFjdGl2ZUxpbmVzLnB1c2godGhpcy5zdHJhdGVneS5pZCk7XHJcbiAgICAgICAgdGhpcy5ibG9ja3MgPSBbXTtcclxuICAgICAgICB0aGlzLmJsb2NrcyA9IGNsb25lKHRoaXMuc3RyYXRlZ3kuc3RhdGVtZW50cyk7XHJcbiAgICAgICAgdGhpcy52YXJpYWJsZXMgPSBbXTtcclxuICAgICAgICBpZiAodGhpcy5zdHJhdGVneS5wYXJhbWV0ZXJzICE9PSB1bmRlZmluZWQpIHtcclxuICAgICAgICAgICAgdGhpcy5zdHJhdGVneS5wYXJhbWV0ZXJzLmZvckVhY2goZnVuY3Rpb24gKGN1cnJlbnRWYWwsIGluZGV4LCBhcnIpIHtcclxuICAgICAgICAgICAgICAgIGN1cnJlbnRWYWwgPSBjdXJyZW50VmFsLnJlcGxhY2UoLycvZywgJycpO1xyXG4gICAgICAgICAgICAgICAgdGhpcy52YXJpYWJsZXMucHVzaCh7XHJcbiAgICAgICAgICAgICAgICAgICAgXCJpZFwiOiBnbG9iYWxDb3VudGVyLmNvdW50KyssXHJcbiAgICAgICAgICAgICAgICAgICAgXCJuYW1lXCI6IGN1cnJlbnRWYWwsXHJcbiAgICAgICAgICAgICAgICAgICAgXCJ2YWxcIjogbnVsbCxcclxuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJwYXJhbWV0ZXJcIixcclxuICAgICAgICAgICAgICAgICAgICBcInZpc2libGVcIjogZmFsc2UsXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSwgdGhpcyk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHRoaXMuZXh0cmFjdFZhcmlhYmxlcyh0aGlzLnN0cmF0ZWd5LnN0YXRlbWVudHMsIGdsb2JhbENvdW50ZXIsIHRoaXMpO1xyXG4gICAgICAgIHZhciB1bmlxID0gWy4uLm5ldyBTZXQodGhpcy52YXJpYWJsZXMpXTtcclxuICAgICAgICB1bmlxLmZvckVhY2goZnVuY3Rpb24gKHZhcmlhYmxlKSB7XHJcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKFwidmFyOiAgIFwiICsgdmFyaWFibGUubmFtZSk7XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgdGhpcy5jYWxsU3RhY2sgPSBbXTtcclxuICAgIH1cclxuXHJcblxyXG4gICAgZXh0cmFjdFZhcmlhYmxlcyhzdGF0ZW1lbnRzLCBjb3VudGVyLCBhcmdUaGlzKSB7XHJcbiAgICAgICAgc3RhdGVtZW50cy5mb3JFYWNoKGZ1bmN0aW9uIChjdXJyZW50VmFsLCBpbmRleCwgYXJyKSB7XHJcbiAgICAgICAgICAgIGlmIChjdXJyZW50VmFsLmlkZW50aWZpZXIpIHtcclxuICAgICAgICAgICAgICAgIGxldCBpZGVudGlmaWVyID0gY3VycmVudFZhbC5pZGVudGlmaWVyLnJlcGxhY2UoLycvZywgJycpO1xyXG4gICAgICAgICAgICAgICAgdmFyIGZvdW5kID0gYXJnVGhpcy52YXJpYWJsZXMuc29tZShmdW5jdGlvbiAoZWwpIHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWwubmFtZSA9PT0gaWRlbnRpZmllcjtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgaWYgKCFmb3VuZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGFyZ1RoaXMudmFyaWFibGVzLnB1c2goe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBcImlkXCI6IGNvdW50ZXIuY291bnQrKyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgXCJuYW1lXCI6IGlkZW50aWZpZXIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidmFsXCI6IG51bGwsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImlkZW50aWZpZXJcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgXCJ2aXNpYmxlXCI6IGZhbHNlLFxyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChjdXJyZW50VmFsLnR5cGUgPT09ICdkbycpIHtcclxuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50VmFsLmNhbGwuYXJndW1lbnRzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY3VycmVudFZhbC5jYWxsLmFyZ3VtZW50cy5mb3JFYWNoKGZ1bmN0aW9uICh2YWwsIGluZCwgYXJyYXkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsID0gdmFsLnJlcGxhY2UoLycvZywgJycpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgZm91bmQgPSBhcmdUaGlzLnZhcmlhYmxlcy5zb21lKGZ1bmN0aW9uIChlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVsLm5hbWUgPT09IHZhbDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZm91bmQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ1RoaXMudmFyaWFibGVzLnB1c2goe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiaWRcIjogY291bnRlci5jb3VudCsrLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwibmFtZVwiOiB2YWwsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ2YWxcIjogbnVsbCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcmd1bWVudFwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwidmlzaWJsZVwiOiBmYWxzZSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfSwgYXJnVGhpcyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGN1cnJlbnRWYWwudHlwZSA9PT0gJ3JldHVybicpIHtcclxuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50VmFsLnF1ZXJ5LmFyZ3VtZW50cykge1xyXG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRWYWwucXVlcnkuYXJndW1lbnRzLmZvckVhY2goZnVuY3Rpb24gKHZhbCwgaW5kLCBhcnJheSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgPSB2YWwucmVwbGFjZSgvJy9nLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmb3VuZCA9IGFyZ1RoaXMudmFyaWFibGVzLnNvbWUoZnVuY3Rpb24gKGVsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWwubmFtZSA9PT0gdmFsO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmb3VuZCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJnVGhpcy52YXJpYWJsZXMucHVzaCh7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJpZFwiOiBjb3VudGVyLmNvdW50KyssXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJuYW1lXCI6IHZhbCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInZhbFwiOiBudWxsLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFyZ3VtZW50XCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ2aXNpYmxlXCI6IGZhbHNlLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9LCBhcmdUaGlzKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoY3VycmVudFZhbC50eXBlID09PSBcImZvcmVhY2hcIikge1xyXG4gICAgICAgICAgICAgICAgYXJnVGhpcy52YXJpYWJsZXMuZm9yRWFjaChmdW5jdGlvbiAodmFsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHZhbC5uYW1lID09PSAoY3VycmVudFZhbC5saXN0LnJlcGxhY2UoLycvZywgJycpKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwudmFsID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbC5wYXJlbnRJZCA9IGN1cnJlbnRWYWwuaWQ7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbC5kaXJ0eUFycmF5ID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbC5wcmV2VmFyID0gW107XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGN1cnJlbnRWYWwuc3RhdGVtZW50cykge1xyXG4gICAgICAgICAgICAgICAgdGhpcy5leHRyYWN0VmFyaWFibGVzKGN1cnJlbnRWYWwuc3RhdGVtZW50cywgY291bnRlciwgYXJnVGhpcyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LCBhcmdUaGlzKTtcclxuICAgIH1cclxuXHJcbiAgICBnZXROZXh0U3RhdGVtZW50KGN1cnJlbnRTdGF0ZW1lbnQsIGJyYW5jaFRha2VuKSB7XHJcbiAgICAgICAgdGhpcy5hY3RpdmVMaW5lcyA9IFtdO1xyXG4gICAgICAgIGlmICh0aGlzLmNhbGxTdGFjay5sZW5ndGgpIHtcclxuICAgICAgICAgICAgdGhpcy5wYyA9IHRoaXMuY2FsbFN0YWNrLnBvcCgpO1xyXG4gICAgICAgICAgICBpZiAodGhpcy5wYy50eXBlID09PSAncmV0dXJuJykge1xyXG4gICAgICAgICAgICAgICAgdGhpcy5wYy50eXBlID0gJ2VuZCc7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnBjID0gdGhpcy5ibG9ja3Muc2hpZnQoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB0aGlzLmFjdGl2ZUxpbmVzLnB1c2godGhpcy5wYy5pZCk7XHJcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgIGlmIChjdXJyZW50U3RhdGVtZW50LnR5cGUgPT09IFwiaWZcIiAmJiBicmFuY2hUYWtlbikge1xyXG4gICAgICAgICAgICAgICAgaWYgKGN1cnJlbnRTdGF0ZW1lbnQuc3RhdGVtZW50cyAhPT0gdW5kZWZpbmVkICYmIGN1cnJlbnRTdGF0ZW1lbnQuc3RhdGVtZW50cy5sZW5ndGggPiAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IGN1cnJlbnRTdGF0ZW1lbnQuc3RhdGVtZW50cy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmJsb2Nrcy51bnNoaWZ0KGNsb25lKGN1cnJlbnRTdGF0ZW1lbnQuc3RhdGVtZW50c1tpXSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIGlmIChjdXJyZW50U3RhdGVtZW50LnR5cGUgPT09IFwidW50aWxcIiAmJiBicmFuY2hUYWtlbikge1xyXG4gICAgICAgICAgICAgICAgaWYgKGN1cnJlbnRTdGF0ZW1lbnQuc3RhdGVtZW50cyAhPT0gdW5kZWZpbmVkICYmIGN1cnJlbnRTdGF0ZW1lbnQuc3RhdGVtZW50cy5sZW5ndGggPiAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5ibG9ja3MudW5zaGlmdChjdXJyZW50U3RhdGVtZW50KTtcclxuICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gY3VycmVudFN0YXRlbWVudC5zdGF0ZW1lbnRzLmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYmxvY2tzLnVuc2hpZnQoY2xvbmUoY3VycmVudFN0YXRlbWVudC5zdGF0ZW1lbnRzW2ldKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGN1cnJlbnRTdGF0ZW1lbnQudHlwZSA9PT0gXCJyZXR1cm5cIikge1xyXG4gICAgICAgICAgICAgICAgaWYgKGN1cnJlbnRTdGF0ZW1lbnQucXVlcnkudHlwZSA9PT0gXCJjYWxsXCIpIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLmNhbGxTdGFjay5wdXNoKHRoaXMucGMpO1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYWN0aXZlTGluZXMucHVzaCh0aGlzLnBjLmlkKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ25ldyc7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGN1cnJlbnRTdGF0ZW1lbnQucXVlcnkudHlwZSA9PT0gJ25vdGhpbmcnKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5hY3RpdmVMaW5lcy5wdXNoKHRoaXMucGMuaWQpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnbm90aGluZyc7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYWN0aXZlTGluZXMucHVzaCh0aGlzLnBjLmlkKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3JldHVybic7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudFN0YXRlbWVudC50eXBlID09PSBcImRvXCIpIHtcclxuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50U3RhdGVtZW50LmNhbGwgIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbFN0YWNrLnB1c2godGhpcy5wYyk7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICduZXcnO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGN1cnJlbnRTdGF0ZW1lbnQudHlwZSA9PT0gXCJmb3JlYWNoXCIpIHtcclxuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHMgIT09IHVuZGVmaW5lZCAmJiBjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHMubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCBsb29wQ291bnRWYXIgPSB0aGlzLnZhcmlhYmxlcy5maW5kKGZ1bmN0aW9uICh2YWwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZhbC5uYW1lID09PSBjdXJyZW50U3RhdGVtZW50Lmxpc3QucmVwbGFjZSgvJy9nLCAnJyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgbnVtID0gMCwgY291bnQgPSBsb29wQ291bnRWYXIudmFsLmxlbmd0aDsgbnVtIDwgbG9vcENvdW50VmFyLnZhbC5sZW5ndGg7IG51bSsrLCBjb3VudC0tKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSBjdXJyZW50U3RhdGVtZW50LnN0YXRlbWVudHMubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYmxvY2tzLnVuc2hpZnQoY2xvbmUoY3VycmVudFN0YXRlbWVudC5zdGF0ZW1lbnRzW2ldKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHV0IHRoZSBmb3JlYWNoIHN0YXRlbWVudCBsZW5ndGggbWludXMgMSB0aW1lc1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVtIDwgbG9vcENvdW50VmFyLnZhbC5sZW5ndGggLSAxKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdGVtcFN0YXRlbWVudCA9IGNsb25lKGN1cnJlbnRTdGF0ZW1lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVtcFN0YXRlbWVudC50eXBlID0gXCJsb29wXCI7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZW1wU3RhdGVtZW50LmNvdW50ZXIgPSBjb3VudCAtIDE7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmJsb2Nrcy51bnNoaWZ0KHRlbXBTdGF0ZW1lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgLy8gaWYgKGN1cnJlbnRTdGF0ZW1lbnQuc3RhdGVtZW50cyAhPT0gdW5kZWZpbmVkICYmIGN1cnJlbnRTdGF0ZW1lbnQudHl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AweGZmLCBpICs9IGQsIG0gLz0gMjU2LCBtTGVuIC09IDgpIHt9XG5cbiAgZSA9IChlIDw8IG1MZW4pIHwgbVxuICBlTGVuICs9IG1MZW5cbiAgZm9yICg7IGVMZW4gPiAwOyBidWZmZXJbb2Zmc2V0ICsgaV0gPSBlICYgMHhmZiwgaSArPSBkLCBlIC89IDI1NiwgZUxlbiAtPSA4KSB7fVxuXG4gIGJ1ZmZlcltvZmZzZXQgKyBpIC0gZF0gfD0gcyAqIDEyOFxufVxuIl19 diff --git a/StrategyTracker/js/index.js b/StrategyTracker/js/index.js index f5c6fa2..b6327be 100644 --- a/StrategyTracker/js/index.js +++ b/StrategyTracker/js/index.js @@ -256,9 +256,11 @@ if (typeof window !== 'undefined' && window.angular) { if(scope.fadeIn !== undefined) { scope.$watch('fadeIn', function(value) { if(value) { - $(element).fadeIn(500) + $(element).fadeIn(1500); + } else { - $(element).fadeOut(100); + $(element).fadeOut(1000); + } }); }