Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@6V新版α@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6ImpzOlxudmFyIGNocCA9IFtdO1xudHJ5IHtcbiAgICB2YXIgaHRtbCA9IGdldFJlc0NvZGUoKTtcbiAgICB2YXIgY29udHMgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICdib2R5JiYuc3R1aS1jb250ZW50X19wbGF5bGlzdCcpO1xuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY29udHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgdmFyIGxpc3QgPSBwZGZhKGNvbnRzW2ldLCAnYm9keSYmbGknKTtcbiAgICAgICAgY2hwLnB1c2gobGlzdC5sZW5ndGgpO1xuICAgIH0gICAgIFxufSBjYXRjaCAoZSkge31cbnNldFJlc3VsdCgn5pu05paw6IezOicgKyAoTWF0aC5tYXguYXBwbHkobnVsbCwgY2hwKSkpOyIsInRpdGxlIjoiNlbmlrDniYjOsSIsImF1dGhvciI6IlIiLCJ1cmwiOiJodHRwOi8vd3d3LnhiNnYuY29tL2Z5QWxsL2luZGV4X2Z5cGFnZS5odG1sW2ZpcnN0UGFnZT1odHRwOi8vd3d3LnhiNnYuY29tL2Z5QWxsXSIsInZlcnNpb24iOjIwMjMwNjI3LCJjb2xfdHlwZSI6Im1vdmllXzMiLCJjbGFzc19uYW1lIjoi5o6o6I2QJuWWnOWJp+eJhybliqjkvZzniYcm54ix5oOF54mHJuenkeW5u+eJhybmgZDmgJbniYcm5Ymn5oOF54mHJuaImOS6ieeJhyIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiZ4aWp1cGlhbiZkb25nenVvcGlhbiZhaXFpbmdwaWFuJmtlaHVhbnBpYW4ma29uZ2J1cGlhbiZqdXFpbmdwaWFuJnpoYW56aGVuZ3BpYW4iLCJhcmVhX25hbWUiOiLnlLXop4bliacm5Zu95YmnJuaXp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IDtcXG4gICAgfSlcXG59XFxuIFxcbmxldCBFcmppID0ge1xcbiAgICDpgJrlhY06ICQoJycpLmxhenlSdWxlKCgpID0+IHtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgdmFyIGh0bWwgPSBKU09OLnBhcnNlKHJlcXVlc3QoaW5wdXQpLm1hdGNoKC9yIHBsYXllcl8uKj89KC4qPyk8LylbMV0pXFxuICAgICAgICAgICAgdmFyIHVybCA9IGh0bWwudXJsXFxuICAgICAgICAgICAgaWYgKGh0bWwuZW5jcnlwdCA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gdW5lc2NhcGUodXJsKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGh0bWwuZW5jcnlwdCA9PSAnMicpIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gdW5lc2NhcGUoYmFzZTY0RGVjb2RlKHVybCkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoL20zdTh8bXA0Ly50ZXN0KHVybCkpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHVybFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidmlkZW86Ly9cXFwiICsgaW5wdXRcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ2aWRlbzovL1xcXCIgKyBpbnB1dFxcbiAgICAgICAgfVxcbiAgICB9KSxcXG4gICAgdXBkYXRhOiBmdW5jdGlvbihydWxlKSB7XFxuICAgICAgICBzZXRMYXN0Q2hhcHRlclJ1bGUoJ2pzOicgKyAkLnRvU3RyaW5nKCh1cmwscnVsZSkgPT4ge1xcbiAgICAgICAgICAgIHZhciBodG1sPWZldGNoKHVybCk7XFxuICAgICAgICAgICAgc2V0UmVzdWx0KGV2YWwocnVsZSkpXFxuICAgICAgICB9LE1ZX1VSTCwgcnVsZSkpXFxuICAgIH0sXFxuICAgIGNsb3NlOiBmdW5jdGlvbihsaXN0LCBzb3J0cykge1xcbiAgICAgICAgYWRkTGlzdGVuZXIoJ29uQ2xvc2UnLCAkLnRvU3RyaW5nKChsaXN0LCBzb3J0cykgPT4ge1xcbiAgICAgICAgICAgIGxpc3QubWFwKHggPT4ge1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdlcl8nICsgeCArICdmb2xkJyk7XFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2VyXycreCk7XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHNvcnRzOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcigncGxheWxpc3RfJyArIGkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBjbGVhck15VmFyKCdlcl9wbGF5bGlzdHMnKTtcXG4gICAgICAgIH0sIGxpc3QsIHNvcnRzKSlcXG4gICAgfSxcXG4gICAgZGF0YUNvbnZlcnQ6IGZ1bmN0aW9uKGRhdGEpIHtcXG4gICAgICAgIHZhciBuZXdjbHNsaXN0ID0gZGF0YS5tYXAoZnVuY3Rpb24ob2JqKSB7XFxuICAgICAgICAgICAgdmFyIG5ld09iaiA9IE9iamVjdC5hc3NpZ24oe30sIG9iaik7XFxuICAgICAgICAgICAgaWYgKG5ld09iai5oYXNPd25Qcm9wZXJ0eSgndHlwZScpKSB7XFxuICAgICAgICAgICAgICAgIG5ld09iai5jb2xfdHlwZSA9IG5ld09iai50eXBlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gbmV3T2JqO1xcbiAgICAgICAgfSk7XFxuICAgICAgICByZXR1cm4gbmV3Y2xzbGlzdDtcXG4gICAgfSxcXG4gICAgcHJlTG9hZDogZnVuY3Rpb24oZnVuYykge1xcbiAgICAgICAgbGV0IG15ZnVuYz1udWxsXFxuICAgICAgICBpZihmdW5jIT11bmRlZmluZWQmJm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sZW4gKz0gMjtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGxlbisrO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChsZW4gPiBtYXhMZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzdHIuc2xpY2UoMCwgaSkgKyAnLi4uJztcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gc3RyO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IHNkZXNjID0gc3Vic3RyKGRlc2MsIG51bSk7XFxuICAgICAgICB2YXIgbGF6eSA9ICQoYCNub0xvYWRpbmcjYCkubGF6eVJ1bGUoKGRjLCBzZGMsIG0pID0+IHtcXG4gICAgICAgICAgICB2YXIgc2hvdyA9IHN0b3JhZ2UwLmdldEl0ZW0obSwgJzAnKTtcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSBmaW5kSXRlbSgnZGVzYycpLnRpdGxlO1xcbiAgICAgICAgICAgIHZhciByZSA9IC8oPFxcXFwvc21hbGw+PGJyPi4qPz4pLisvZztcXG4gICAgICAgICAgICB2YXIgZXhwID0gJ+WxleW8gDonO1xcbiAgICAgICAgICAgIHZhciByZXQgPSAn5pS26LW3Oic7XFxuICAgICAgICAgICAgaWYgKHNob3cgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oJ2Rlc2MnLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGVcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZXQsIGV4cClcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZSwgJyQxJyArIHNkYyArICc8L3NtYWxsPicpXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoLyg8XFxcXC9zbWFsbD48YnI+PGZvbnQgY29sb3I9XFxcIikuKj8oXFxcIj4pLywgJyQxIzhBMkJFMiQyJykvL+aUtui1t+minOiJslxcblxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKG0sICcwJyk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbSgnZGVzYycsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKGV4cCwgcmV0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKHJlLCAnJDEnICsgZGMgKyAnPC9zbWFsbD4nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8oPFxcXFwvc21hbGw+PGJyPjxmb250IGNvbG9yPVxcXCIpLio/KFxcXCI+KS8sICckMSMwMDgwMDAkMicpLy/lsZXlvIDpopzoibJcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShtLCAnMScpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gYGhpa2VyOi8vZW1wdHlgXFxuICAgICAgICB9LCBkZXNjLCBzZGVzYywgbWFyaylcXG4gICAgICAgIHZhciBzYyA9IHN0b3JhZ2UwLmdldEl0ZW0obWFyaywgJzAnKSA9PSAnMCcgPyAn5bGV5byAOicgOiAn5pS26LW3Oic7XFxuICAgICAgICB2YXIgZGMgPSBzdG9yYWdlMC5nZXRJdGVtKG1hcmssICcwJykgPT0gJzAnID8gc2Rlc2MgOiBkZXNjO1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiAnJyArICc8Yj48Zm9udCBjb2xvcj1cXFwiIzA5OEFDMVxcXCI+4oi3ICDliafmg4XnroDku4tcXHQ8L2ZvbnQ+PC9iPicgKyBcXFwiPHNtYWxsPjxhIHN0eWxlPSd0ZXh0LWRlY29yYXRpb246IG5vbmU7JyBocmVmPSdcXFwiICsgbGF6eSArIFxcXCInPlxcXCIgKyBzYyArICc8L2E+PC9zbWFsbD48YnI+PGZvbnQgY29sb3I9XFxcIiM4QTJCRTJcXFwiPicgKyBgJHtkY31gICsgJzwvc21hbGw+JywvL+m7mOiupOminOiJslxcbiAgICAgICAgICAgIGNvbF90eXBlOiAncmljaF90ZXh0JyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogJ2Rlc2MnLFxcbiAgICAgICAgICAgICAgICBsaW5lU3BhY2luZzogNixcXG4gICAgICAgICAgICAgICAgdGV4dFNpemU6IDE1LFxcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogdHJ1ZSxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9LFxcblxcbi8v5rW35oqlXFxuICAgIHN0ckNvbnZlcnQ6IGZ1bmN0aW9uKGFycikge1xcbiAgICAgICAgcmV0dXJuIGFyci5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgc3RyID0geDtcXG4gICAgICAgICAgICBpZiAoLyjlr7zmvJR85Li75ryUfOexu+WeiynvvJovLnRlc3Qoc3RyKSkge1xcbiAgICAgICAgICAgICAgICBzdHIgPSBzdHIuc3BsaXQoJy8nKS5tYXAoKHZhbCwgaW5kZXgpID0+IChpbmRleCA9PT0gMCA/ICcnIDogJycpICsgdmFsKS5zbGljZSgwLCA1KS5qb2luKCcgJykucmVwbGFjZSgvICQvLCAnJyk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBzdHJcXG4gICAgICAgIH0pXFxuICAgIH0sXFxuICAgIHNldENvbnRlbnQ6IGZ1bmN0aW9uKG9iaikge1xcbiAgICAgICAgdmFyIGNvbnRlbnRzID0gb2JqLm1haW47XFxuICAgICAgICB2YXIgc29ydE9yZGVyID0gb2JqLnNvcnQ7XFxuICAgICAgICB2YXIgaW1nID0gb2JqLmltZztcXG4gICAgICAgIHZhciB0ZXh0cyA9IGNvbnRlbnRzLm1hcCh4ID0+IHBkZmgoeCwgJ1RleHQnKSk7XFxuICAgICAgICB2YXIgYXJyYXkgPSB0ZXh0cy5zb3J0KChhLCBiKSA9PiB7XFxuICAgICAgICAgICAgY29uc3QgaW5kZXhBID0gc29ydE9yZGVyLmluZGV4T2YoYS5zdWJzdHIoMCwgMikpO1xcbiAgICAgICAgICAgIGNvbnN0IGluZGV4QiA9IHNvcnRPcmRlci5pbmRleE9mKGIuc3Vic3RyKDAsIDIpKTtcXG4gICAgICAgICAgICByZXR1cm4gaW5kZXhBIC0gaW5kZXhCO1xcbiAgICAgICAgfSlcXG4gICAgICAgIHZhciByZWdleCA9IG5ldyBSZWdFeHAoJygnICsgc29ydE9yZGVyLmpvaW4oJ3wnKSArICcpJyk7XFxuICAgICAgICBhcnJheSA9IGFycmF5LmZpbHRlcihmdW5jdGlvbihpdGVtKSB7XFxuICAgICAgICAgICAgcmV0dXJuIHJlZ2V4LnRlc3QoaXRlbSk7XFxuICAgICAgICB9KTtcXG4gICAgICAgIGFycmF5ID0gdGhpcy5zdHJDb252ZXJ0KGFycmF5KVxcbiAgICAgICAgdmFyIHRpdGxlcyA9IFtdO1xcbiAgICAgICAgdmFyIGRlc2NzID0gW107XFxuICAgICAgICBzd2l0Y2ggKGFycmF5Lmxlbmd0aCkge1xcbiAgICAgICAgICAgIGNhc2UgNDpcXG4gICAgICAgICAgICBjYXNlIDU6XFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDIpO1xcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDIpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlIDY6XFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDMpO1xcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDMpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgIH1cXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdlcl9pbmZvJyx7XFxuICAgICAgICAgIGRlc2M6ZGVzY3Muam9pbignXFxcXG4nKSxcXG4gICAgICAgICAgaW1nOmltZyxcXG4gICAgICAgIH0pXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIC8vdGl0bGU6IHRpdGxlc1swXSArICdcXFxcbicgKyB0aGlzLnNtYWxsKHRpdGxlcy5zbGljZSgxLCAzKS5qb2luKCdcXFxcbicpKSxcXG4gICAgIHRpdGxlOiAgdGhpcy5zbWFsbChwZGZoKGh0bWwsICcjcG9zdF9jb250ZW50JiZUZXh0JykucmVwbGFjZSgvXFxcXHMvZywnJyksJ3JlZCcpLFxcbiAgICAgICAgICAgLy8gZGVzYzogdGhpcy5zbWFsbChkZXNjcy5qb2luKCdcXFxcbicpKSxcXG4gICAgIGRlc2M6IHRoaXMuc21hbGwocGRmaChodG1sLCAnLmNvbnRleHQmJi53aWRnZXQmJlRleHQnKSwnI0ZGN0YwMCcpLFxcbiAgICAgICAgICAgIHBpY191cmw6IGltZyArICdAUmVmZXJlcj0nLFxcbiAgICAgICAgICAgIHVybDogTVlfVVJMLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMV92ZXJ0aWNhbF9waWNfYmx1cicsXFxuICAgICAgICB9KVxcbiAgICAgICAgaWYgKG9iai5kZXNjICE9IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgIHRoaXMuc2V0RGVzYyhvYmouZGVzYyk7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHNldEN1c3RvbTogZnVuY3Rpb24ob2JqLCBpbWcpIHtcXG4gICAgICAgIHZhciBhcnJheSA9IFtdO1xcbiAgICAgICAgaWYgKG9iai5jb25zdHJ1Y3RvciA9PSBBcnJheSkge1xcbiAgICAgICAgICAgIGFycmF5ID0gb2JqO1xcbiAgICAgICAgfVxcbiAgICAgICAgYXJyYXkgPSB0aGlzLnN0ckNvbnZlcnQoYXJyYXkpO1xcbiAgICAgICAgdmFyIHRpdGxlcyA9IFtdO1xcbiAgICAgICAgdmFyIGRlc2NzID0gW107XFxuICAgICAgICBzd2l0Y2ggKGFycmF5Lmxlbmd0aCkge1xcbiAgICAgICAgICAgIGNhc2UgNDpcXG4gICAgICAgICAgICBjYXNlIDU6XFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDIpO1xcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDIpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlIDY6XFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDMpO1xcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDMpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgIH1cXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdlcl9pbmZvJyx7XFxuICAgICAgICAgIGRlc2M6ZGVzY3Muam9pbignXFxcXG4nKSxcXG4gICAgICAgICAgaW1nOmltZyxcXG4gICAgICAgIH0pXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiB0aXRsZXNbMF0gKyAnXFxcXG4nICsgdGhpcy5zbWFsbCh0aXRsZXMuc2xpY2UoMSwgMykuam9pbignXFxcXG4nKSksXFxuICAgICAgICAgICAgZGVzYzogdGhpcy5zbWFsbChkZXNjcy5qb2luKCdcXFxcbicpKSxcXG4gICAgICAgICAgICBwaWNfdXJsOiBpbWcgKyAnQFJlZmVyZXI9JyxcXG4gICAgICAgICAgICB1cmw6IE1ZX1VSTCxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzFfdmVydGljYWxfcGljX2JsdXInLFxcbiAgICAgICAgfSlcXG4gICAg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iAgICAgIHZhcmk9XFxcImVyX1xcXCIrdmFyaTtcXG4gICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHRhYnMubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICB2YXIgdXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgodmFyaSwgc2hzb3J0LCBpLGxpbmVjKSA9PiB7XFxuICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgIHZhciBsaXN0cyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfbGlzdCcsICdbXScpO1xcbiAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgIGlmKGdldE15VmFyKHZhcmkrJ2ZvbGQnLCcxJyk9PScwJyl7XFxuICAgICAgICAgICAgICAgIHZhciBidG49ZmluZEl0ZW0oc2hzb3J0KydfYnV0dG9uJyk7XFxuICAgICAgICAgICAgICAgIHZhciBmb2xkcz1bJzxmb250IGNvbG9yPVxcXCIjRDNEM0QzXFxcIj7imLcnLCc8Zm9udCBjb2xvcj1cXFwiI0ZGQTUwMFxcXCI+4piwJ107XFxuICAgICAgICAgICAgICAgICAgdmFyIHBsaXN0ID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpO1xcbiAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICAgIHZhciBjb2wgPSBwbGlzdFtzaHNvcnRdLmNvbF90eXBlO1xcbiAgICAgICAgICAgICAgICAgIHZhciBjbHMgPSBwbGlzdFtzaHNvcnRdLmNscztcXG4gICAgICAgICAgICAgICAgICB2YXIgcGljPXBsaXN0W3Noc29ydF0ucGljO1xcbiAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oYnRuLmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogYnRuLnRpdGxlLnJlcGxhY2UoZm9sZHNbMF0sIGZvbGRzWzFdKSxcXG4gICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHZhcmkrJ2ZvbGQnLCcxJyk7XFxuICAgICAgICAgICAgICAvL3JldHVybiAndG9hc3Q6Ly/lsZXlvIDmiY3og73mk43kvZwnO1xcbiAgICAgICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGxpc3QgPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfcGxheWxpc3RzJywgJ3t9Jyk7XFxuICAgICAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjb2wgPSBwbGlzdFtzaHNvcnRdLmNvbF90eXBlO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNscyA9IHBsaXN0W3Noc29ydF0uY2xzO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBpYz1wbGlzdFtzaHNvcnRdLnBpYztcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcih2YXJpLCBpKTtcXG5cXG4gICAgICAgICAgICAgICAgdmFyIHhsaXN0PWxpc3RzW2ldO1xcbiAgICAgICAgICAgICAgICBpZigkLmZ1bmMhPXVuZGVmaW5lZCYmJC5mdW5jLmNvbnN0cnVjdG9yPT1GdW5jdGlvbil7XFxuICAgICAgICAgICAgICAgICAgICB4bGlzdD0kLmZ1bmMoaSk7XFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfbGlzdCcsIHhsaXN0KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB2YXIgcGxheXMgPSB4bGlzdC5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogeC51cmwsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IGNvbCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwaWM6cGljLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiB4LnVybC5yZXBsYWNlKC9AbGF6eVJ1bGVbXFxcXHNcXFxcU10rL2csICcnKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBjbHMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JykgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgICAgICBwbGF5cy5yZXZlcnNlKCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIHBjZmc9c3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0KydfcHVzaGNmZycsJ3t9Jyk7XFxuICAgICAgICAgICAgICAgIGlmKHBjZmdbJ+WNleaOqCddKXtcXG4gICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCsnX3B1c2gnLHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOnBjZmdbJ29iaiddWyfljZXmjqgnXVswXVxcbiAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgcGNmZ1sn5Y2V5o6oJ109ZmFsc2U7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYocGNmZ1sn6YCJ5o6oJ10pe1xcbiAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0KydfcHVzaHMnLHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOnBjZmdbJ29iaiddWyfpgInmjqgnXVswXVxcbiAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgcGNmZ1sn6YCJ5o6oJ109ZmFsc2U7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0KydfcHVzaGNmZycscGNmZyk7XFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoc2hzb3J0ICsgJ19saW5lJywgcGxheXMpO1xcblxcbiAgICAgICAgICAgICAgICB2YXIgdGFieCA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCArICdfdGFiJyk7XFxuICAgICAgICAgICAgICAgIHRhYnguZm9yRWFjaCgoeCwgaWkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciB0aXRsZSA9IHgudGl0bGU7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoaSA9PSBpaSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUucmVwbGFjZSgvIyhcXFxcdyspPy9nLCBsaW5lYyksXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZS5yZXBsYWNlKC8jKFxcXFx3Kyk/L2csICcjJyksXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaIkOWKn++8gSc7XFxuICAgICAgICAgICAgfSwgdmFyaSwgc2hzb3J0LCBpLGN1c3RvbS7nur/ot6/pgInkuK0pXFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgKGdldE15VmFyKHZhcmksICcwJykgPT0gaSA/IHRhYnNbaV0uZm9udGNvbG9yKGN1c3RvbS7nur/ot6/pgInkuK0pIDogdGFic1tpXS5mb250Y29sb3IoJyMnKSksXFxuICAgICAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQgKyAnX3RhYicsXFxuICAgICAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ190YWJfJyArIGksXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTonYmxhbmtfYmxvY2snLCAvLydibGFua19ibG9jaycsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfbGluZScsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgfSxcXG4gICAgcHVzaFRhYjpmdW5jdGlvbih2YXJpLHNoc29ydCl7XFxuICAgICAgYWRkTGlzdGVuZXIoJ29uUmVmcmVzaCcsICQudG9TdHJpbmcoKHNoc29ydCkgPT4ge1xcbiAgICAgICAgY2xlYXJNeVZhcihzaHNvcnQrJ19wdXNoY2ZnJyk7XFxuICAgICAgICBjbGVhck15VmFyKHNoc29ydCsnX2R1b3NlbGVjdCcpO1xcbiAgICAgICAgfSwgc2hzb3J0KSlcXG4gICAgICAgdmFyIHBvYmo9e1xcbiAgICAgICAn5Y2V5o6oJzpbJ+Kmv+WNleaOqCcsJzxiPuKmv+WNleaOqDwvYj4nLmZvbnRjb2xvcignIzAwRkE5QScpXSxcXG4gICAgICAgJ+mAieaOqCc6WyfimJHpgInmjqgnLCc8Yj7imJHpgInmjqg8L2I+Jy5mb250Y29sb3IoJyM0NjgyQjQnKV0sXFxuICAgICAgfVxcbiAgICAgIFxcbiAgICAgIGQucHVzaCh7XFxuICAgICAgICAgIHRpdGxlOifijJgnLFxcbiAgICAgICAgICBjb2xfdHlwZTonc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgIHVybDonaGlrZXI6Ly9lbXB0eScsXFxuICAgICAgICAgIGV4dHJhOntcXG4gICAgICAgICAgICBjbHM6c2hzb3J0KydfcHVzaHRhYicsXFxuICAgICAgICAgIH1cXG4gICAgICAgIH0se1xcbiAgICAgICAgICB0aXRsZTpwb2JqWyfljZXmjqgnXVswXSxcXG4gICAgICAgICAgY29sX3R5cGU6J3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICB1cmw6JCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2hzb3J0LHBvYmosdmFyaSk9PntcXG4gICAgICAgICAgaWYoZ2V0TXlWYXIodmFyaSsnZm9sZCcsJzEnKT09JzAnKXtcXG4gICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bGV5byA5omN6IO95pON5L2cJztcXG4gICAgICAgICAgfVxcbiAgICAgICAgICAgIFxcbiAgICAgICAgICB2YXIgdGl0bGVzPXBvYmpbJ+WNleaOqCddO1xcbiAgICAgICAgICB2YXIgcGNmZz1zdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQrJ19wdXNoY2ZnJywne30nKTtcXG4gICAgICAgICAgcGNmZ1snb2JqJ109cG9iajtcXG4gICAgICAgICAgdmFyIOWNleaOqD1wY2ZnWyfljZXmjqgnXT9wY2ZnWyfljZXmjqgnXTpmYWxzZTtcXG4gICAgICAgICAgXFxuICAgICAgICAgIGlmKOWNleaOqCl7XFxuICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQrJ19wdXNoJyx7XFxuICAgICAgICAgICAgICB0aXRsZTp0aXRsZXNbMF0sXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBwY2ZnWyfljZXmjqgnXT1mYWxzZTtcXG4gICAgICAgICAgICBwY2ZnWydwbGF5bGlzdCddLm1hcCgoeCk9PntcXG4gICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQse1xcbiAgICAgICAgICAgICAgICAgdXJsOngudXJsLFxcbiAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQrJ19wdXNoJyx7XFxuICAgICAgICAgICAgICB0aXRsZTon4oCc4oCc4oCd4oCdJyt0aXRsZXNbMV0sXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCsnX3B1c2hzJyx7XFxuICAgICAgICAgICAgICB0aXRsZTpwb2JqWyfpgInmjqgnXVswXSxcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIHBjZmdbJ+WNleaOqCddPXRydWU7XFxuICAgICAgICAgICAgcGNmZ1sn6YCJ5o6oJ109ZmFsc2U7XFxuICAgICAgICAgICAgdmFyIHBsYXlsaXN0PWZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgcGNmZ1sncGxheWxpc3QnXT1wbGF5bGlzdDtcXG4gICAgICAgICAgICBmaW5kSXRlbXNCeUNscyhzaHNvcnQpLm1hcCh4PT57XFxuICAgICAgICAgICAgICB2YXIgZHB1c2g9e1xcbiAgICAgICAgICAgICAgICBuYW1lOmdldFBhZ2VUaXRsZSgpLFxcbiAgICAgICAgICAgICAgICB1cmw6eC50aXRsZSsnJCcreC5leHRyYS5pZFxcbiAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LmV4dHJhLmlkLHtcXG4gICAgICAgICAgICAgICAgdXJsOiQoJycpLmxhenlSdWxlKChkcHVzaCk9PntcXG4gICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9wYWdlL3B1c2g/cnVsZT1YWVHmjqjpgIEmcHVzaHVybD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KEpTT04uc3RyaW5naWZ5KGRwdXNoKSk7XFxuICAgICAgICAgICAgICAgIH0sZHB1c2gpXFxuICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgIH1cXG4gICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0KydfcHVzaGNmZycscGNmZyk7XFxuICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly8nKyjljZXmjqg/J+WNleaOqOW8gOWQryc6J+WNleaOqOWFs+mXrScpO1xcbiAgICAgICAgICB9LHNoc29ydCxwb2JqLHZhcmkpLFxcbiAgICAgICAgICBleHRyYTp7XFxuICAgICAgICAgICAgaWQ6c2hzb3J0KydfcHVzaCcsXFxuICAgICAgICAgICAgY2xzOnNoc29ydCsnX3B1c2h0YWInLFxcbiAgICAgICAgICB9XFxuICAgICAgICB9LHtcXG4gICAgICAgICAgdGl0bGU6cG9ialsn6YCJ5o6oJ11bMF0sXFxuICAgICAgICAgIGNvbF90eXBlOidzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgdXJsOiQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHNoc29ydCxwb2JqLHZhcmkpPT57XFxuICAgICAgICAgIGlmKGdldE15VmFyKHZhcmkrJ2ZvbGQnLCcxJyk9PScwJyl7XFxuICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WxleW8gOaJjeiDveaTjeS9nCc7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgdmFyIHRpdGxlcz1wb2JqWyfpgInmjqgnXTtcXG4gICAgICAgICAgdmFyIHBjZmc9c3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0KydfcHVzaGNmZycsJ3t9Jyk7XFxuICAgICAgICAgIHBjZmdbJ29iaiddPXBvYmo7XFxuICAgICAgICAgIHZhciDpgInmjqg9cGNmZ1sn6YCJ5o6oJ10/cGNmZ1sn6YCJ5o6oJ106ZmFsc2U7XFxuICAgICAgICAgIGlmKOmAieaOqCl7XFxuICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQrJ19wdXNocycse1xcbiAgICAgICAgICAgICAgdGl0bGU6dGl0bGVzWzBdLFxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgcGNmZ1sn6YCJ5o6oJ109ZmFsc2U7XFxuICAgICAgICAgICAgcGNmZ1sncGxheWxpc3QnXS5tYXAoKHgpPT57XFxuICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LmV4dHJhLmlkLHtcXG4gICAgICAgICAgICAgICAgIHRpdGxlOngudGl0bGUsXFxuICAgICAgICAgICAgICAgICB1cmw6eC51cmwsXFxuICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0KydfcHVzaHRvJywge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmjqjpgIHmnKzpobU9PlRWQm94JyxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBjbGVhck15VmFyKHNoc29ydCsnX2R1b3NlbGVjdCcpO1xcbiAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQrJ19wdXNocycse1xcbiAgICAgICAgICAgICAgdGl0bGU6J+KAnOKAnOKAneKAnScrdGl0bGVzWzFdLFxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgcGNmZ1sn6YCJ5o6oJ109dHJ1ZTtcXG4gICAgICAgICAgICBwY2ZnWyfljZXmjqgnXT1mYWxzZTtcXG4gICAgICAgICAgICB2YXIgcGxheWxpc3Q9ZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICBwY2ZnWydwbGF5bGlzdCddPXBsYXlsaXN0O1xcbiAgICAgICAgICAgIGxldCBJZHM9cGxheWxpc3QubWFwKGl0ID0+IGl0LmV4dHJhLmlkKTtcXG4gICAgICAgICAgICAgICAgSWRzLmZvckVhY2goeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSBmaW5kSXRlbSh4KS50aXRsZTtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJC5tc20odGl0bGUsIHgsc2hzb3J0KSxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCsnX3B1c2gnLHtcXG4gICAgICAgICAgICAgIHRpdGxlOnBvYmpbJ+WNleaOqCddWzBdLFxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQrJ19wdXNodG8nLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aOqOmAgemAieS4rT0+VFZCb3gnLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCsnX3B1c2hjZmcnLHBjZmcpO1xcbiAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8vJyso6YCJ5o6oPyfpgInmjqjlvIDlkK8nOifpgInmjqjlhbPpl60nKTtcXG4gICAgICAgICAgfSxzaHNvcnQscG9iaix2YXJpKSxcXG4gICAgICAgICAgZXh0cmE6e1xcbiAgICAgICAgICAgIGlkOnNoc29ydCsnX3B1c2hzJyxcXG4gICAgICAgICAgICBjbHM6c2hzb3J0KydfcHVzaHRhYidcXG4gICAgICAgICAgfVxcbiAgICAgICAgfSx7XFxuICAgICAgICAgIHRpdGxlOiBcXFwi5o6o6YCB5pys6aG1PT5UVkJveFxcXCIsXFxuICAgICAgICAgIGNvbF90eXBlOidzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgdXJsOiQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHNoc29ydCx2YXJpKT0+e1xcbiAgICAgICAgICB2YXIgcGNmZz1zdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQrJ19wdXNoY2ZnJywne30nKTtcXG4gICAgICAgICAgdmFyIOWNleaOqD1wY2ZnWyfljZXmjqgnXT9wY2ZnWyfljZXmjqgnXTpmYWxzZTtcXG4gICAgICAgICAgdmFyIOmAieaOqD1wY2ZnWyfpgInmjqgnXT9wY2ZnWyfpgInmjqgnXTpmYWxzZTtcXG4gICAgICAgICAgaWYoIeWNleaOqCYmIemAieaOqCl7XFxuICAgICAgICAgIHZhciB0YWJzPXN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCsnX3RhYnMnLCdbXScpO1xcbiAgICAgICAgICB0cnl7XFxuICAgICAgICAgIHZhciBwbHM9c3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0KydfbGlzdCcsJ1tdJykubWFwKGxpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGkubWFwKGl0ZW0gPT4gaXRlbS50aXRsZSArICckJyArIGl0ZW0udXJsKS5qb2luKCcjJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignJCQkJyk7XFxuICAgICAgICAgIH1jYXRjaHtcXG4gICAgICAgICAgdmFyIHBscz1zdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQrXFxcIl9saXN0XFxcIiwnW10nKS5tYXAoeCA9PiB4LnRpdGxlICsgXFxcIiRcXFwiICsgeC51cmwpLmpvaW4oXFxcIiNcXFwiKTtcXG4gICAgICAgICAgdmFyIHRhYnM9W3RhYnNbZ2V0TXlWYXIodmFyaSwnMCcpXV07XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgLypsb2cocGxzKVxcbiAgICAgICAgICBsb2codGFicykqL1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIGlmKOmAieaOqCl7XFxuICAgICAgICAgIHZhciBwbHM9c3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0K1xcXCJfZHVvc2VsZWN0XFxcIiwnW10nKS5tYXAoeCA9PiB4LnRpdGxlICsgXFxcIiRcXFwiICsgeC51cmwpLmpvaW4oXFxcIiNcXFwiKTtcXG4gICAgICAgICAgaWYocGxzLmxlbmd0aD09MCl7XFxuICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+mAieaLqeS4uuepuic7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgdmFyIHRhYnM9Wyfmkq3mlL7liJfooagnXTtcXG4gICAgICAgICAgfVxcbiAgICAgICAgICBcXG4gICAgICAgICAgdmFyIGluZm89c3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX2luZm8nLCd7fScpO1xcbiAgICAgICAgICB2YXIgZGVzYyA9aW5mb1snZGVzYyddO1xcbiAgICAgICAgICB2YXIg5o6o6YCBID0ge1xcbiAgICAgICAgICAgICAgICAgXFxcIm5hbWVcXFwiOiBnZXRQYWdlVGl0bGUoKSxcXG4gICAgICAgICAgICAgICAgIFxcXCJjb250ZW50XFxcIjogZGVzY3x8JycsXFxuICAgICAgICAgICAgICAgICBcXFwicGljXFxcIjogaW5mb1snaW1nJ10gfHwgJycsXFxuICAgICAgICAgICAgICAgICBcXFwiZnJvbVxcXCI6IHRhYnMuam9pbignJCQkJyksXFxuICAgICAgICAgICAgICAgICBcXFwidXJsXFxcIjogcGxzLFxcbiAgICAgICAgICAgfVxcbiAgICAgICAgICAvL2xvZyjmjqjpgIEpXFxuICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9wdXNoP3J1bGU9WFlR5o6o6YCBJnB1c2h1cmw9XFxcIiArIGVuY29kZVVSSUNvbXBvbmVudChKU09OLnN0cmluZ2lmeSjmjqjpgIEpKVxcbiAgICAgICAgICB9LHNoc29ydCx2YXJpKSxcXG4gICAgICAgICAgZXh0cmE6e1xcbiAgICAgICAgICAgIGlkOnNoc29ydCsnX3B1c2h0bycsXFxuICAgICAgICAgICAgY2xzOnNoc29ydCsnX3B1c2h0YWInXFxuICAgICAgICAgIH1cXG4gICAgICAgIH0se1xcbiAgICAgICAgICBjb2xfdHlwZTonYmxhbmtfYmxvY2snLFxcbiAgICAgICAgICBleHRyYTp7XFxuICAgICAgICAgICAgY2xzOnNoc29ydCsnX3B1c2h0YWInLFxcbiAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9LFxcbiAgICBzZXRMb25nY2xpY2s6ZnVuY3Rpb24oc2hzb3J0LGN1c3RvbSl7XFxuICAgICAgcmV0dXJuIFt7dGl0bGU6J+agt+W8j/CfjqgnLGpzOiAkLnRvU3RyaW5nKChzaHNvcnQpPT57XFxuICAgICAgICAgICAgICAgICAgICBsZXQgYWxsX2NvbHMgPSBbJyddLmNvbmNhdChnZXRDb2xUeXBlcygpKTtcXG4gICAgICAgICAgICAgICAgICAgIGFsbF9jb2xzPWFsbF9jb2xzLmZpbHRlcih4PT5cXG4gICAgICAgICAgICAgICAgICAgICAgLyh0ZXh0X3xmbGV4KS4qLy50ZXN0KHgpJiZ4IT0ndGV4dF9pY29uJyk7XFxuICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKGFsbF9jb2xzKVxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNscyA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCd7fScpXFxuICAgICAgICAgICAgICAgICAgICB8fCAnJztcXG4gICAgICAgICAgICAgICAgICAgIGlmKGNsc1tzaHNvcnRdIT0nJyl7XFxuICAgICAgICAgICAgICAgICAgICAgIGNvbD1jbHNbc2hzb3J0XS5jb2xfdHlwZTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGxldCDmjInpkq7moLflvI8gPSBhbGxfY29scy5tYXAoKGl0KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGl0ID09PSBjb2wgPyAn8J+RiScgKyBpdDogaXQ7XFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCB0aXBzID0gJ+ivt+mAieaLqemAiembhuaMiemSruagt+W8jyc7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJCjmjInpkq7moLflvI8sIDIsIHRpcHMpLnNlbGVjdCgoc2hzb3J0LGNscykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICBpbnB1dCA9IGlucHV0LnJlcGxhY2UoL/CfkYkvZywgJycpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8qc3RvcmFnZTAuc2V0SXRlbSgn5oyJ6ZKu5qC35byPJywgaW5wdXQpOyovXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG9sZElkcyA9IChmaW5kSXRlbXNCeUNscyhzaHNvcnQpIHx8IFtdKS5tYXAoaXQ9Pml0LmV4dHJhLmlkKTsgLy/ogIHlhYPntKBpZHNcXG4gICAgICAgICAgICAgICAgICAgICAgICBvbGRJZHMuZm9yRWFjaCh4PT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHgsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBpbnB1dFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bey5YiH5o2i6YCJ6ZuG5oyJ6ZKu5qC35byP5Li6OicgKyBpbnB1dDtcXG4gICAgICAgICAgICAgICAgICAgIH0sc2hzb3J0LGNscyk7XFxuICAgICAgICAgICAgICAgIH0sc2hzb3J0LGN1c3RvbSl9XVxcbiAgICB9LFxcbiAgICBzZXRUYWJzOiBmdW5jdGlvbih0YWJzLCB2YXJpLCBza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IgbmV3Y2xzbGlzdCA9ICQuZGF0YUNvbnZlcnQoY2xzbGlzdHMpO1xcbiAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgIHZhciB0aXRsZXM9W2Ake2N1c3RvbS7mraPluo/popzoibJ9XFxcIj7mraPluo9gLGAke2N1c3RvbS7pgIbluo/popzoibJ9XFxcIj7pgIbluo9gXTtcXG4gICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgICAgIG5ld2Nsc2xpc3QucmV2ZXJzZSgpO1xcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoc2hzb3J0ICsgJ19saW5lJywgbmV3Y2xzbGlzdCk7XFxuXFxuICAgICAgICAgICAgICAgIHZhciBvYmogPSBmaW5kSXRlbShzaHNvcnQgKyAnX2F2YXRhcicpXFxuXFxuICAgICAgICAgICAgICAgIGlmIChjb25mID09ICcxJykge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX2F2YXRhcicsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogb2JqLnRpdGxlLnJlcGxhY2UodGl0bGVzWzFdLCB0aXRsZXNbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJyk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMF0sIHRpdGxlc1sxXSksXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzEnKTt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ycpLmxhenlSdWxlKChmb2xkbmFtZSxzaHNvcnQpID0+IHtcXG4gICAgICAgICAgICAgICAgdmFyICBmb2xkID0gZ2V0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxuICAgICAgICAgICAgICAgIHZhciBvYmogPSBmaW5kSXRlbShzaHNvcnQrJ19saW5lJyk7XFxuICAgICAgICAgICAgICAgIHZhciBidG49ZmluZEl0ZW0oc2hzb3J0KydfYnV0dG9uJyk7XFxuICAgICAgICAgICAgICAgIHZhciBmb2xkcz1bJzxmb250IGNvbG9yPVxcXCIjRDNEM0QzXFxcIj7imLcnLCc8Zm9udCBjb2xvcj1cXFwiI0ZGQTUwMFxcXCI+4piwJ107XFxuICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICBpZihmb2xkPT0nMCcpe1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgICcxJyk7XFxuICAgICAgICAgICAgICAgIHZhciBjcyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfY2xzJyk7XFxuICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihvYmouZXh0cmEuaWQsIGNzKTtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBidG4udGl0bGUucmVwbGFjZShmb2xkc1swXSwgZm9sZHNbMV0pLFxcbiAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYoZm9sZD09JzEnKXtcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgICcwJyk7XFxuICAgICAgICAgICAgICAgIHZhciBwY2xzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgdmFyIGN4ID0gJC5kYXRhQ29udmVydChwY2xzKTtcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19jbHMnLCBjeCk7XFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGJ0bi5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGJ0bi50aXRsZS5yZXBsYWNlKGZvbGRzWzFdLCBmb2xkc1swXSksXFxuICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly8nICsgKGZvbGQgPT09ICcxJyA/ICfmlLbotbcnIDogJ+WxleW8gCcpO1xcbiAgICAgICAgICAgIH0sIGZvbGRuYW1lLHNoc29ydCksXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfYnV0dG9uJyxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgdGhpcy5jcmVhdGVQTGlzdCh0YWJzLHZhcmksc2hzb3J0LGN1c3RvbSk7XFxuICAgIH0sXFxuICAgIHNldFRhYnMyOiBmdW5jdGlvbih0YWJzLCB2YXJpLCBzaHNvcnQscGFyc2UpIHtcXG4gICAgICAgIGxldCBjdXN0b209cGFyc2Uu6Ieq5a6a5LmJO1xcbiAgICAgICAgY3VzdG9tID10aGlzLmdldFByZXNldChjdXN0b20pO1xcbiAgICAgICAgXFxuICAgICAgICBzaHNvcnQgPSBzaHNvcnQgPyBzaHNvcnQgOiAnc2hzb3J0JztcXG4gICAgICAgIHZhciB0aXRsZSA9IChnZXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMCcpID09ICcxJykgPyAnPGI+PHNwYW4gc3R5bGU9XFxcImNvbG9yOicrY3VzdG9tLumAhuW6j+minOiJsisnXFxcIj7pgIbluo88L3NwYW4+PC9iPicgOiAnPGI+PHNwYW4gc3R5bGU9XFxcImNvbG9yOicrY3VzdG9tLuato+W6j+minOiJsisnXFxcIj7mraPluo88L3NwYW4+PC9iPidcXG4gICAgICBcXG4gICAgICAgIHZhciDmipjlj6AgPSAnPGI+5oqY5Y+gJyArICfimLcnLmZvbnRjb2xvcihcXFwiI0QzRDNEM1xcXCIpO1xcbiAgICAgICAgdmFyIOWxleW8gCA9ICc8Yj7lsZXlvIAnICsgJ+KYsCcuZm9udGNvbG9yKFxcXCIjRkZBNTAwXFxcIik7XFxuICAgICAgICB2YXIgZm9sZG5hbWUgPSAnZXJfJyArIHZhcmkgKyAnZm9sZCc7XFxuICAgICAgICB2YXIgZm9sZCA9IGdldE15VmFyKGZvbGRuYW1lLCAnMScpO1xcblxcbiAgICAgICAgdmFyIHVybCA9ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGZvbGRuYW1lLCBzaHNvcnQscHVzaCkgPT4ge1xcbiAgICAgICAgICAgIHZhciBwbCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXG4gICAgICAgICAgICBpZiAoT2JqZWN0LmtleXMocGwpLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgdmFyIGZvbGQgPSBnZXRNeVZhcihmb2xkbmFtZSwgJzEnKTtcXG4gICAgICAgICAgICB2YXIgb2JqID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInKVxcbiAgICAgICAgICAgIGlmIChmb2xkID09ICcxJykge1xcbiAgICAgICAgICAgICAgICB2YXIgYmNscyA9IGZpbmRJdGVtKHNoc29ydCArICdfYnV0dG9uJyk7XFxuICAgICAgICAgICAgICAgIHZhciB0Y2xzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXG4gICAgICAgICAgICAgICAgdmFyIGxjbHMgPSBmaW5kSXRlbShzaHNvcnQgKyAnX2xpbmUnKTtcXG4gICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgIHZhciBwY2xzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgdmFyIGNzID0gW2JjbHNdLmNvbmNhdCh0Y2xzLCBbbGNsc10sIHBjbHMpO1xcbiAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgaWYocHVzaCl7XFxuICAgICAgICAgICAgICAgICAgdmFyIHBjbHM9ZmluZEl0ZW1zQnlDbHMoc2hzb3J0KydfcHVzaHRhYicpO1xcbiAgICAgICAgICAgICAgICAgIGNzPXBjbHMuY29uY2F0KGNzKTtcXG4gICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICB2YXIgY3ggPSAkLmRhdGFDb252ZXJ0KGNzKTtcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19jbHMnLCBjeCk7XFxuICAgICAgICAgICAgICAgIGlmKHB1c2gpe1xcbiAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQrJ19wdXNodGFiJyk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbShiY2xzLmV4dHJhLmlkKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCArICdfdGFiJyk7XFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0oc2hzb3J0ICsgJ19saW5lJyk7XFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcblxcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKG9iai5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogb2JqLmRlc2MucmVwbGFjZSgn5bGV5byAPGZvbnQgY29sb3I9XFxcIiNG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68nLFxcbiAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdhdmF0YXInLFxcbiAgICAgICAgICAgIGltZzogY3VzdG9tLuWbvuaghyxcXG4gICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ19hdmF0YXInLFxcbiAgICAgICAgICAgICAgICBsb25nQ2xpY2s6dGhpcy5zZXRMb25nY2xpY2soc2hzb3J0KSxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgaWYodHlwZW9mKHBhcnNlWyfmjqjpgIEnXSkhPSd1bmRlZmluZWQnJiZwYXJzZVsn5o6o6YCBJ10pXFxuICAgICAgICB0aGlzLnB1c2hUYWIoJ2VyXycrdmFyaSxzaHNvcnQpO1xcbiAgICAgICAgXFxuICAgICAgICBpZiAoZm9sZCA9PSAnMCcpIHtcXG4gICAgICAgICAgICByZXR1cm5cXG4gICAgICAgIH1cXG5cXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgdGl0bGUsXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKCh2YXJpLCBzaHNvcnQsY3VzdG9tKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBjb25mID0gZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXG4gICAgICAgICAgICAgICAgdmFyIGNsc2xpc3RzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgdmFyIG5ld2Nsc2xpc3QgPSAkLmRhdGFDb252ZXJ0KGNsc2xpc3RzKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgICAgIG5ld2Nsc2xpc3QucmV2ZXJzZSgpO1xcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoc2hzb3J0ICsgJ19saW5lJywgbmV3Y2xzbGlzdCk7XFxuXFxuICAgICAgICAgICAgICAgIHZhciBvYmogPSBmaW5kSXRlbShzaHNvcnQgKyAnX2J1dHRvbicpXFxuICAgICAgICAgICAgICAgIHZhciB0aXRsZXM9W2Ake2N1c3RvbS7mraPluo/popzoibJ9XFxcIj7mraPluo9gLGAke2N1c3RvbS7pgIbluo/popzoibJ9XFxcIj7pgIbluo9gXTtcXG4gICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgIGlmIChjb25mID09ICcxJykge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX2J1dHRvbicsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogb2JqLnRpdGxlLnJlcGxhY2UodGl0bGVzWzFdLCB0aXRsZXNbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJyk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYnV0dG9uJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMF0sIHRpdGxlc1sxXSksXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzEnKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAvL3JlZnJlc2hQYWdlKClcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaOkuW6j+aIkOWKnydcXG4gICAgICAgICAgICB9LCB2YXJpLCBzaHNvcnQsY3VzdG9tKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX2J1dHRvbicsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIHRoaXMuY3JlYXRlUExpc3QodGFicyx2YXJpLHNoc29ydCxjdXN0b20pO1xcbiAgICB9LFxcbiAgICBzZXRMaXN0czogZnVuY3Rpb24obGlzdHMsIGluZGV4LCBzaHNvcnQscGFyc2UpIHtcXG5cXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfbGlzdCcsIGxpc3RzKTtcXG4gICAgICAgIFxcbiAgICAgICAgcGFyc2U9cGFyc2U/cGFyc2U6e307XFxuICAgICAgICB2YXIg5qC35byPPXBhcnNlLuagt+W8jz9wYXJzZS7moLflvI86Jyc7XFxuICAgICAgICB2YXIg5Zu+5qCHPXBhcnNlLuWbvuaghz9wYXJzZS7lm77moIc6J2h0dHBzOi8vaGlrZXJmYW5zLmNvbS90dWJpYW8vbW92aWUvMTMuc3ZnJztcXG4gICAgICAgIHZhciBhamF4PXBhcnNlLkFqYXg/cGFyc2UuQWpheDpmYWxzZTtcXG5cXG4gICAgICAgIHNoc29ydCA9IHNoc29ydCA/IHNoc29ydCA6ICdzaHNvcnQnO1xcblxcbiAgICAgICAgaWYoYWpheCl7XFxuICAgICAgICAgICAgdmFyIGxpc3QgPSBsaXN0cztcXG4gICAgICAgICAgICBpZiAoZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JykgPT0gJzEnICYmIGxpc3RzLmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICAgICAgbGlzdCA9IGxpc3RzLnJldmVyc2UoKTtcXG4gICAgICAgICAgIH1cXG4gICAgICAgIH1lbHNle1xcbiAgICAgICAgICAgIHZhciBsaXN0ID0gbGlzdHNbaW5kZXhdO1xcbiAgICAgICAgICAgIGlmIChnZXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnKSA9PSAnMScgJiYgbGlzdHMubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICBsaXN0ID0gbGlzdHNbaW5kZXhdLnJldmVyc2UoKTtcXG4gICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIFxcbiAgICAgICAgaWYo5qC35byPPT0nJyl7XFxuICAgICAgICAgIOagt+W8jz1saXN0Lmxlbmd0aCA+IDMgPyAndGV4dF80JyA6ICd0ZXh0XzInXFxuICAgICAgICB9XFxuICAgICAgICBcXG4gICAgICAgIGlmKGxpc3QubGVuZ3RoID4gMCl7XFxuICAgICAgICB2YXIgcGxpc3QgPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfcGxheWxpc3RzJywgJ3t9Jyk7XFxuICAgICAgICBpZighcGxpc3QuaGFzT3duUHJvcGVydHkoc2hzb3J0KSl7XFxuICAgICAgICAgICAgIHBsaXN0W3Noc29ydF09e307XFxuICAgICAgICB9XFxuICAgICAgICBwbGlzdFtzaHNvcnRdWydjbHMnXT1zaHNvcnQ7XFxuICAgICAgICBwbGlzdFtzaHNvcnRdWydjb2xfdHlwZSddPeagt+W8jztcXG4gICAgICAgIHBsaXN0W3Noc29ydF1bJ3BpYyddPeWbvuaghztcXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdlcl9wbGF5bGlzdHMnLCBwbGlzdCk7XFxuICAgICAgICB9ICAgXFxuICAgICAgICBcXG4gICAgICAgIFxcbiAgICAgICAgZm9yICh2YXIgaiBpbiBsaXN0KSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGxpc3Rbal0udGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogbGlzdFtqXS51cmwsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiDmoLflvI8sXFxuICAgICAgICAgICAgICAgIHBpYzrlm77moIcsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogbGlzdFtqXS51cmwucmVwbGFjZSgvQGxhenlSdWxlW1xcXFxzXFxcXFNdKy9nLCAnJyksXFxuICAgICAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCxcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICBnZXRUYWJzOiBmdW5jdGlvbihwYXJzZSkge1xcbiAgICAgICAgdmFyIHRhYnMgPSBbXTtcXG4gICAgICAgIHZhciBhcnRzID0gcGRmYShodG1sLCBwYXJzZS7nur/ot68pO1xcbiAgICAgICAgdmFyIOe6v+i3r+WQjSA9IHBhcnNlLue6v+i3r+WQjeensDtcXG4gICAgICAgIHZhciDmm7/mjaLlh73mlbAgPSAnJztcXG4gICAgICAgIGlmIChwYXJzZS7nur/ot6/lkI3np7AuaW5jbHVkZXMoJ0BAJykpIHtcXG4gICAgICAgICAgICDnur/ot6/lkI0gPSBwYXJzZS7nur/ot6/lkI3np7Auc3BsaXQoJ0BAJylbMF07XFxuICAgICAgICAgICAg5pu/5o2i5Ye95pWwID0gcGFyc2Uu57q/6Lev5ZCN56ewLnNwbGl0KCdAQCcpWzFdO1xcbiAgICAgICAgfVxcbiAgICAgICAgZm9yICh2YXIgaSBpbiBhcnRzKSB7XFxuICAgICAgICAgICAgdmFyIGxpbmVuYW1lID0gcGRmaChhcnRzW2ldLCDnur/ot6/lkI0pO1xcbiAgICAgICAgICAgIGlmICjmm7/mjaLlh73mlbAgIT0gJycpIHtcXG4gICAgICAgICAgICAgICAgbGluZW5hbWUgPSBldmFsKCdsaW5lbmFtZScgKyDmm7/mjaLlh73mlbApO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0YWJzLnB1c2gobGluZW5hbWUpO1xcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIHRhYnM7XFxuICAgIH0sXFxuICAgIGdldExpc3RzOiBmdW5jdGlvbihwYXJzZSxzaHNvcnQpIHtcXG4gICAgICAgIHNoc29ydCA9IHNoc29ydCA/IHNoc29ydCA6ICdzaHNvcnQnO1xcbiAgICAgICAgdmFyIGxpc3RzID0gW107XFxuICAgICAgICB2YXIgY29udHMgPSBwZGZhKGh0bWwsIHBhcnNlLumAiembhik7XFxuICAgICAgICB2YXIg6YCJ6ZuG5ZCN56ewID0gcGFyc2Uu6YCJ6ZuG5ZCN56ewID8gcGFyc2Uu6YCJ6ZuG5ZCN56ewIDogJ2EmJlRleHQnO1xcbiAgICAgICAgdmFyIOmAiembhumTvuaOpSA9IHBhcnNlLumAiembhumTvuaOpSA/IHBhcnNlLumAiembhumTvuaOpSA6ICdhJiZocmVmJztcXG4gICAgICAgIHZhciDop6PmnpAgPSBwYXJzZS7op6PmnpAgPyBwYXJzZS7op6PmnpAgOiAnJztcXG4gICAgICAgIHZhciB0ZW1wID0gW107XFxuICAgICAgICBmb3IgKHZhciBpIGluIGNvbnRzKSB7XFxuICAgICAgICAgICAgaWYgKHBhcnNlLumAiembhuWIl+ihqCAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICAgICAgbGlzdHMucHVzaChwZGZhKGNvbnRzW2ldLCBwYXJzZS7pgInpm4bliJfooagpLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBkZmgoeCwg6YCJ6ZuG5ZCN56ewKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHBkKHgsIOmAiembhumTvuaOpSkgKyDop6PmnpAsXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pKVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHZhciB1cmwgPSBwZChjb250c1tpXSwg6YCJ6ZuG6ZO+5o6lKTtcXG4gICAgICAgICAgICAgICAgaWYgKCHpgInpm4bpk77mjqUuaW5jbHVkZXMoJ2hyZWYnKSkge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsID0gcGRmaChjb250c1tpXSwg6YCJ6ZuG6ZO+5o6lKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB0ZW1wLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBkZmgoY29udHNbaV0sIOmAiembhuWQjeensCksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCArIOino+aekCxcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBsZXQg5YCS5bqPID0gcGFyc2Uu5YCS5bqPID8gcGFyc2Uu5YCS5bqPIDogZmFsc2U7XFxuICAgICAgICB2YXIgcmVzdWx0cyA9IGxpc3RzLmxlbmd0aCA/IGxpc3RzIDogW3RlbXBdO1xcbiAgICAgICAgaWYgKOWAkuW6jykge1xcbiAgICAgICAgICAgIHJlc3VsdHMgPSByZXN1bHRzLm1hcCh4ID0+IHgucmV2ZXJzZSgpKTtcXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBwbGlzdCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXG4gICAgICAgIGlmIChyZXN1bHRzLnNvbWUoeCA9PiB4Lmxlbmd0aCA+IDApKSB7XFxuICAgICAgICAgICBpZighcGxpc3QuaGFzT3duUHJvcGVydHkoc2hzb3J0KSl7XFxuICAgICAgICAgICAgIHBsaXN0W3Noc29ydF09e307XFxuICAgICAgICAgICB9XFxuICAgICAgICAgICBwbGlzdFtzaHNvcnRdWydsZW5ndGgnXT1yZXN1bHRzLmxlbmd0aDtcXG4gICAgICAgIH07XFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfcGxheWxpc3RzJywgcGxpc3QpO1xcbiAgICAgICAgcmV0dXJuIHJlc3VsdHM7XFxuICAgIH0sXFxuICAgIGdldFBsYXllcnM6IGZ1bmN0aW9uKHBhcnNlLCBtb2RlLGZ1bmMpIHtcXG4gICAgICAgIC8vbG9nKG1vZGUpXFxuICAgICAgICB2YXIgcGxheSA9ICdlcl9wbGF5bGlzdF8nO1xcbiAgICAgICAgdGhpcy5wcmVMb2FkKGZ1bmMpO1xcbiAgICAgICAgdGhpcy5jbG9zZShwYXJzZS5tYXAoeCA9PiB4Luexu+WeiyksIHBhcnNlLmxlbmd0aCk7XFxuICAgICAgICBtb2RlID0gbW9kZSA/IG1vZGUgOiAxO1xcbiAgICAgICAgcGFyc2UuZm9yRWFjaCgoaXRlbSwgaSkgPT4ge1xcbiAgICAgICAgICAgIHZhciB0YWJzID0gWyfkuLvnur8nXTtcXG4gICAgICAgICAgICBpZiAoaXRlbS7nur/ot68gIT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgIHRhYnMgPSB0aGlzLmdldFRhYnMoaXRlbSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHB1dE15VmFyKHBsYXkraSsnX3RhYnMnLHRhYnMpO1xcbiAgICAgICAgICAgIGlmKGl0ZW0uQWpheCl7XFxuICAgICAgICAgICAgICAgIGlmIChtb2RlID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFicyh0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksaXRlbSk7XFxuICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYWJzMih0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksaXRlbSk7XFxuICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICBwdXRNeVZhcignZXJfaHRtbCcsaHRtbCk7XFxuICAgICAgICAgICAgICAgICBwdXRNeVZhcignZXJfdXJsJyxNWV9VUkwpO1xcblxcbiAgICAgICAgICAgICAgICB2YXIgbGlzdHM9ZnVuYyhnZXRNeVZhcignZXJfJytpdGVtLuexu+WeiywnMCcpLE1ZX1VSTCk7XFxuICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgdmFyIGxpc3RzID0gdGhpcy5nZXRMaXN0cyhpdGVtLCBwbGF5K2kpO1xcbiAgICAgICAgICAgIC8vbG9nKGxpc3RzKVxcbiAgICAgICAgICAgIGlmIChsaXN0cy5zb21lKHggPT4geC5sZW5ndGggPiAwKSkge1xcbiAgICAgICAgICAgICAgICBpZiAobW9kZSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnNldFRhYnModGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFiczIodGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChnZXRNeVZhcignZXJfJyArIGl0ZW0u57G75Z6LICsgJ2ZvbGQnLCAnMScpID09ICcxJykge1xcbiAgICAgICAgICAgICAgICB0aGlzLnNldExpc3RzKGxpc3RzLCBnZXRNeVZhcignZXJfJytpdGVtLuexu+WeiywgJzAnKSwgcGxheSArIGksaXRlbSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH0pXFxuICAgIH1cXG59XFxuXFxuXFxubGV0IE1ldGhvZHM9e1xcbiAgICAvL+WkmumAieaooeWdl1xcbiAgICBNdWx0aVNlbGVjdE1vZGU6ZnVuY3Rpb24obmFtZSxpZCxzaHNvcnQpe1xcbiAgICAgICAgcmV0dXJuICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGRhdGF0aXRsZSwgZGF0YXVybCxzaHNvcnQpID0+IHtcXG4gICAgICAgICAgICBmdW5jdGlvbiB1bmlxdWUoYXJyKSB7XFxuICAgICAgICAgICAgY29uc3QgcmVzID0gbmV3IE1hcCgpXFxuICAgICAgICAgICAgcmV0dXJuIGFyci5maWx0ZXIoKGEpID0+ICFyZXMuaGFzKGEudXJsKSAmJiByZXMuc2V0KGEudXJsLCAxKSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGR1b3NlbGVjdCA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCtcXFwiX2R1b3NlbGVjdFxcXCIpID8gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0K1xcXCJfZHVvc2VsZWN0XFxcIikgOiBbXTtcXG4gICAgICAgICAgICBpZiAoZHVvc2VsZWN0LmZpbmRJbmRleCh4ID0+IHgudXJsID09PSBkYXRhdXJsKSA9PSAtMSkge1xcbiAgICAgICAgICAgICAgICBkdW9zZWxlY3QucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogZGF0YXRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBkYXRhdXJsXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIGR1b3NlbGVjdCA9IHVuaXF1ZShkdW9zZWxlY3QpXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oZGF0YXVybCwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGDigJzigJzigJ3igJ08c3BhbiBzdHlsZT1cXFwiY29sb3I6I0ZGNTczM1xcXCI+YCArIGRhdGF0aXRsZSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgZnVuY3Rpb24gcmVtb3ZlQnlWYWx1ZShhcnIsIHZhbCkge1xcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYXJyW2ldWyd1cmwnXSA9PSB2YWwpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyLnNwbGljZShpLCAxKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlbW92ZUJ5VmFsdWUoZHVvc2VsZWN0LCBkYXRhdXJsKVxcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGRhdGF1cmwsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBkYXRhdGl0bGVcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCtcXFwiX2R1b3NlbGVjdFxcXCIsIGR1b3NlbGVjdCk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgfSwgbmFtZSwgaWQsIHNoc29ydClcXG4gICAgfSxcXG59XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLop6PmnpBcIixcInBhdGhcIjpcImxhenlcIixcInJ1bGVcIjpcInZhciBsYXp5ID0gJCgnJykubGF6eVJ1bGUoKCkgPT4ge1xcbiAgICB0cnkge1xcbiAgICAgICAgaWYoaW5wdXQuc3RhcnRzV2l0aChcXFwiaHR0cHM6Ly9wYW4ucXVhcmsuY24vc1xcXCIpKXtcXG4gICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vc2VhcmNoP3M9XFxcIitpbnB1dCtcXFwiJnJ1bGU9dWNra+S6kVxcXCJcXG4gICAgICAgIH1cXG4gICAgICAgIHZhciB1cmwgPSBwZGZoKHJlcXVlc3QoaW5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