Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥搜索:易看影视@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcImFwaVwiLFwicGF0aFwiOlwiYXBpXCIsXCJydWxlXCI6XCJqczpcXG5sZXQgYXBpID0ge1xcbiAgaG9zdDogXFxcImh0dHBzOi8vd3d3LjlidDAuY29tXFxcIixcXG4gIGNvb2tpZToge1xcbiAgICBnZXQoKSB7XFxuICAgICAgcmV0dXJuIGdldE15VmFyKFxcXCJjb29raWVcXFwiLCBcXFwiXFxcIilcXG4gICAgfSxcXG4gICAgc2V0KHZhbHVlKSB7XFxuICAgICAgcHV0TXlWYXIoXFxcImNvb2tpZVxcXCIsIHZhbHVlKTtcXG4gICAgfSxcXG4gICAgbWF0Y2godmFsdWUpIHtcXG4gICAgICBsZXQgcmVzdWx0ID0gdmFsdWUubWF0Y2goL2RvY3VtZW50LmNvb2tpZSA9IFxcXCIoLio/KTsvZylbMF0ucmVwbGFjZSgvKGRvY3VtZW50LmNvb2tpZSA9IFxcXCJ8OykvZywgJycpO1xcbiAgICAgIC8vbG9nKHJlc3VsdCk7XFxuICAgICAgcmV0dXJuIHJlc3VsdDtcXG4gICAgfVxcbiAgfSxcXG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ZXRJdGVtKE1ZX1JVTEUuZ3JvdXAsIGZvbGQgPT09IFxcXCIxXFxcIiA/IFxcXCIwXFxcIiA6IFxcXCIxXFxcIik7XFxuICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgfSksXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLph43nva5cXFwiLFxcbiAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJrZXl3b3JkXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJjYXRlb2JqXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1dXFxuICAgICAgICB9XFxuICAgIH0pXFxuICAgIGhlYWQuZm9yRWFjaCgoeCwgaSkgPT4ge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyAoaGkgPT0gaSA/IG1lLmJhY2tDb2xvcih4LnRpdGxlLCB7IGJjOiBcXFwiI0ZGNjY5OVxcXCIgfSkgOiB4LnRpdGxlKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaSkgPT4ge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaGlcXFwiLCBpKTtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwia2V5d29yZFxcXCIpO1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGF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cXFwiXFxcIiA6IFxcXCIwXFxcIixcXG4gICAgICAgIH1cXG4gICAgfSlcXG59XFxuXFxuaWYgKGZvbGQgPT0gXFxcIjBcXFwiICYmIHBhZ2UgPT0gMSAmJiBuYXYgJiYgIS9ob21lfG5ldy8udGVzdChzYSkpIHtcXG4gICAgdGtleXMuZm9yRWFjaCgodGFnLCBpbmRleCkgPT4ge1xcbiAgICAgICAgaWYgKHRhZyAhPSBcXFwic2dcXFwiKSB7XFxuICAgICAgICAgICAgdGFnc1t0YWddLnVuc2hpZnQoe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuS4jemZkFxcXCIsXFxuICAgICAgICAgICAgICAgIGlkOiBcXFwiXFxcIlxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgdGFnc1t0YWddLmZvckVhY2goZnVuY3Rpb24gKGl0ZW0sIGkpIHtcXG4gICAgICAgICAgICAvL2xvZyhpdGVtKVxcbiAgICAgICAgICAgIGlmICh0YWcgIT0gXFxcInNnXFxcIikge1xcbiAgICAgICAgICAgICAgICBpdGVtLmlkID0gaXRlbS50aXRsZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGl0ZW0udGl0bGUgPT0gXFxcIuS4jemZkFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgaXRlbS5pZCA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgY29sb3IgPSAnI0ZGNjY5OSc7XFxuICAgICAgICAgICAgaWYgKHRhZyBpbiBjb2xvcnMpIHtcXG4gICAgICAgICAgICAgICAgY29sb3IgPSBjb2xvcnNbdGFnXTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgKGNhdGVvYmpbdGFnXS5pID09IGkgPyBtZS5iYWNrQ29sb3IoaXRlbS50aXRsZSwgeyBiYzogY29sb3IgfSkgOiBpdGVtLnRpdGxlKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGl0ZW0uaWQgKyAnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoY2F0ZW9iaiwgdGFnLCBpbmRleCwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgY2F0ZW9ialt0YWddID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGk6IGksXFxuICAgICAgICAgICAgICAgICAgICAgICAgdjogaW5wdXRcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKFxcXCJjYXRlb2JqXFxcIiwgY2F0ZW9iaik7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxuICAgICAgICAgICAgICAgIH0sIGNhdGVvYmosIHRhZywgaW5kZXgsIGkpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSk7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snXFxuICAgICAgICB9KTtcXG4gICAgfSlcXG59XFxubGV0IHRpdGxlcyA9IFtcXFwi55S15b2xOjFcXFwiLCBcXFwi55S16KeG5YmnOjJcXFwiLCBcXFwi6L+R5pyf54Ot6ZeoOjNcXFwiLCBcXFwi5pys5ZGo54Ot6ZeoOjRcXFwiLCBcXFwi5pys5pyI54Ot6ZeoOjVcXFwiXVxcblxcbmxldCBzYyA9IGdldE15VmFyKFxcXCJob21lQHNjXFxcIiwgXFxcIjFcXFwiKTtcXG5pZiAoL2hvbWV8bmV3Ly50ZXN0KHNhKSAmJiBuYXYgJiYgcGFnZSA9PSAxKSB7XFxuICAgIHR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XCIgPyBcXFwibW92aWVfM19tYXJxdWVlXFxcIiA6IFxcXCJtb3ZpZV8xX3ZlcnRpY2FsX3BpY1xcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgcGFnZVRpdGxlOiBpdGVtLnRpdGxlLFxcbiAgICAgICAgICAgICAgICBpZDogaWQsXFxuICAgICAgICAgICAgICAgIGltZzogaW1nXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIGlmIChzYSA9PSBcXFwibmV3XFxcIikge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBtZS5mb250c3R5bGUobWUuYmFja0NvbG9yKFxcXCLno4Hlipvpk77mjqVcXFwiLCB7IGJjOiBcXFwiI0M0OWY0N1xcXCIgfSksIHsgdGFnczogXFxcInNtYWxsXFxcIiB9KSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzNcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6IGl0ZW0uemxpbmssXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLlpI3liLbno4Hpk75cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcHkoaXRlbS56bGluaylcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtKSxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuWFtuWug+W6lOeUqOaJk+W8gFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6IEpTT04uc3RyaW5naWZ5KFxcXCJtYWduZXQ6Ly9cXFwiICsgaXRlbS56bGluayksXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBdLFxcbiAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBtZS5mb250c3R5bGUobWUuYmFja0NvbG9yKGl0ZW0uenNpemUsIHsgYmM6IFxcXCIjOEU0NEFEXFxcIiB9KSwgeyB0YWdzOiBcXFwic21hbGxcXFwiIH0pLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfM1xcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IG1lLmZvbnRzdHlsZShtZS5iYWNrQ29sb3IoXFxcIuS4i+i9veenjeWtkFxcXCIsIHsgYmM6IFxcXCIjMzU5OERDXFxcIiB9KSwgeyB0YWdzOiBcXFwic21hbGxcXFwiIH0pLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfM1xcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFwaS5ob3N0ICsgaXRlbS5kb3duXFxuICAgICAgICAgICAgICAgIH0sIGl0ZW0pXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgfSlcXG59XFxuXFxuXFxuc2V0UmVzdWx0KGQpXCJ9XSxcInBhcmFtc1wiOlwie1xcXCJuYXZcXFwiOmZhbHNlLFxcXCJwYWdlVGl0bGVcXFwiOlxcXCLmkJzntKI65piT55yL5b2x6KeGX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ICAgICAgY2xlYXJNeVZhcihcXFwia2V5d29yZFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwiY2F0ZW9ialxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XVxcbiAgICAgICAgfVxcbiAgICB9KVxcbiAgICBoZWFkLmZvckVhY2goKHgsIGkpID0+IHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgKGhpID09IGkgPyBtZS5iYWNrQ29sb3IoeC50aXRsZSwgeyBiYzogXFxcIiNGRjY2OTlcXFwiIH0pIDogeC50aXRsZSksXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKGkpID0+IHtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImhpXFxcIiwgaSk7XFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcImtleXdvcmRcXFwiKTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICB9LCBpKVxcbiAgICAgICAgfSlcXG4gICAgfSlcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snXFxuICAgIH0pXFxuICAgIFxcbn1cXG5cXG5cXG5cXG5sZXQgc2EgPSBoZWFkW2hpXS5pZDtcXG5cXG52YXIgdGFncyA9IHt9O1xcblsnc2N0OnQxJywgJ3NkOnQyJywgJ3NlOnQzJywgJ3NmOnQ0JywgJ3NoOnQ1J10ubWFwKHggPT4ge1xcbiA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ZDogXFxcIlxcXCJcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIHRhZ3NbdGFnXS5mb3JFYWNoKGZ1bmN0aW9uIChpdGVtLCBpKSB7XFxuICAgICAgICAgICAgLy9sb2coaXRlbSlcXG4gICAgICAgICAgICBpZiAodGFnICE9IFxcXCJzZ1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgaXRlbS5pZCA9IGl0ZW0udGl0bGU7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChpdGVtLnRpdGxlID09IFxcXCLkuI3pmZBcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGl0ZW0uaWQgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGNvbG9yID0gJyNGRjY2OTknO1xcbiAgICAgICAgICAgIGlmICh0YWcgaW4gY29sb3JzKSB7XFxuICAgICAgICAgICAgICAgIGNvbG9yID0gY29sb3JzW3RhZ107XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIChjYXRlb2JqW3RhZ10uaSA9PSBpID8gbWUuYmFja0NvbG9yKGl0ZW0udGl0bGUsIHsgYmM6IGNvbG9yIH0pIDogaXRlbS50aXRsZSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgIHVybDogJChpdGVtLmlkICsgJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGNhdGVvYmosIHRhZywgaW5kZXgsIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGNhdGVvYmpbdGFnXSA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpOiBpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHY6IGlucHV0XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAg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lLmJhY2tDb2xvcihcXFwi56OB5Yqb6ZO+5o6lXFxcIiwgeyBiYzogXFxcIiNDNDlmNDdcXFwiIH0pLCB7IHRhZ3M6IFxcXCJzbWFsbFxcXCIgfSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8zXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBpdGVtLnpsaW5rLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5aSN5Yi256OB6ZO+XFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3B5KGl0ZW0uemxpbmspXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSksXFxuICAgICAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLlhbblroPlupTnlKjmiZPlvIBcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiBKU09OLnN0cmluZ2lmeShcXFwibWFnbmV0Oi8vXFxcIiArIGl0ZW0uemxpbmspLFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgXSxcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogbWUuZm9udHN0eWxlKG1lLmJhY2tDb2xvcihpdGVtLnpzaXplLCB7IGJjOiBcXFwiIzhFNDRBRFxcXCIgfSksIHsgdGFnczogXFxcInNtYWxsXFxcIiB9KSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IF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xvZyhpdGVtKVxcXFxuICAgICAgICAgICAgaWYgKHRhZyAhPSBcXFxcXFxcInNnXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICBpdGVtLmlkID0gaXRlbS50aXRsZTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChpdGVtLnRpdGxlID09IFxcXFxcXFwi5LiN6ZmQXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICBpdGVtLmlkID0gXFxcXFxcXCJcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGxldCBjb2xvciA9ICcjRkY2Njk5JztcXFxcbiAgICAgICAgICAgIGlmICh0YWcgaW4gY29sb3JzKSB7XFxcXG4gICAgICAgICAgICAgICAgY29sb3IgPSBjb2xvcnNbdGFnXTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi4oCc4oCc4oCd4oCdXFxcXFxcXCIgKyAoY2F0ZW9ialt0YWddLmkgPT0gaSA/IG1lLmJhY2tDb2xvcihpdGVtLnRpdGxlLCB7IGJjOiBjb2xvciB9KSA6IGl0ZW0udGl0bGUpLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGl0ZW0uaWQgKyAnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoY2F0ZW9iaiwgdGFnLCBpbmRleCwgaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBjYXRlb2JqW3RhZ10gPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpOiBpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdjogaW5wdXRcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5w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xcXFxuICAgICAgICAgICAgdXJsOiB1cmwsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogc2EgIT0gXFxcXFxcXCJuZXdcXFxcXFxcIiA/IFxcXFxcXFwibW92aWVfM19tYXJxdWVlXFxcXFxcXCIgOiBcXFxcXFxcIm1vdmllXzFfdmVydGljYWxfcGljXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogaXRlbS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICBpZDogaWQsXFxcXG4gICAgICAgICAgICAgICAgaW1nOiBpbWdcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSlcXFxcbiAgICAgICAgaWYgKHNhID09IFxcXFxcXFwibmV3XFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IG1lLmZvbnRzdHlsZShtZS5iYWNrQ29sb3IoXFxcXFxcXCLno4Hlipvpk77mjqVcXFxcXFxcIiwgeyBiYzogXFxcXFxcXCIjQzQ5ZjQ3XFxcXFxcXCIgfSksIHsgdGFnczogXFxcXFxcXCJzbWFsbFxcXFxcXFwiIH0pLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfM1xcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIHVybDogaXRlbS56bGluayxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLlpI3liLbno4Hpk75cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29weShpdGVtLnpsaW5rKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSksXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuWFtuWug+W6lOeUqOaJk+W8gFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6IEpTT04uc3RyaW5naWZ5KFxcXFxcXFwibWFnbmV0Oi8vXFxcXFxcXCIgKyBpdGVtLnpsaW5rKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICBdLFxcXFxuICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogbWUuZm9udHN0eWxlKG1lLmJhY2tDb2xvcihpdGVtLnpzaXplLCB7IGJjOiBcXFxcXFxcIiM4RTQ0QURcXFxcXFxcIiB9KSwgeyB0YWdzOiBcXFxcXFxcInNtYWxsXFxcXFxcXCIgfSksXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF8zXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFxcXFxcImhpa2VyOi8vZW1wdHlcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBtZS5mb250c3R5bGUobWUuYmFja0NvbG9yKFxcXFxcXFwi5LiL6L2956eN5a2QXFxcXFxcXCIsIHsgYmM6IFxcXFxcXFwiIzM1OThEQ1xcXFxcXFwiIH0pLCB7IHRhZ3M6IFxcXFxcXFwic21hbGxcXFxcXFxcIiB9KSxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJ0ZXh0XzNcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoXFxcXFxcXCIjbm9Mb2FkaW5nI1xcXFxcXFwiKS5sYXp5UnVsZSgoaXRlbSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXBpLmhvc3QgKyBpdGVtLmRvd25cXFxcbiAgICAgICAgICAgICAgICB9LCBpdGVtKVxcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgfVxcXFxuICAgIH0pXFxcXG59XFxcXG5cXFxcblxcXFxuc2V0UmVzdWx0KGQpXFxcIn1dXCJ9IiwidGl0bGUiOiLmkJzntKI65piT55yL5b2x6KeGIn0=
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement