Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@DrpyHiker@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoiRHJweUhpa2VyIiwiYXV0aG9yIjoiQExveURnSWsmemV0YWxwaGEiLCJ1cmwiOiJoaWtlcjovL2VtcHR5IyNmeXBhZ2UiLCJ2ZXJzaW9uIjo0LCJjb2xfdHlwZSI6Im1vdmllXzMiLCJjbGFzc19uYW1lIjoiIiwidHlwZSI6InZpZGVvIiwiY2xhc3NfdXJsIjoiIiwiYXJlYV9uYW1lIjoiIiwiYXJlYV91cmwiOiIiLCJzb3J0X25hbWUiOiIiLCJ5ZWFyX25hbWUiOiIiLCJzb3J0X3VybCI6IiIsInllYXJfdXJsIjoiIiwiZmluZF9ydWxlIjoianM6XG5mdW5jdGlvbiBsb2FkKGQsIGRycHksIHNvdXJjZSkge1xuICBsZXQgcGFnZSA9IE1ZX1BBR0U7XG4gIGxldCBjYXRlZ29yeXMgPSAkLnJlcXVpcmUoXCJjYXRlZ29yeXNcIik7XG4gIGNhdGVnb3J5cy5nZXRjYXRlZ29yeXMoZCwgZHJweSwgcGFnZSk7XG4gIGxldCB7XG4gICAgY2F0ZSxcbiAgICBob21lbGlzdFxuICB9ID0gY2F0ZWdvcnlzLmdldGNhdGVsaXN0KCk7XG4gIGlmKGdldE15VmFyKFwibGlua3NcIixcIlwiKT09XCIxXCIpe1xuICAgIHNldFByZVJlc3VsdChkKTtcbiAgICBkLmxlbmd0aCA9IDA7XG4gIH1cbiAgbGV0IGZsID0gY2F0ZWdvcnlzLmdldGZsKCk7XG5cbiAgbGV0IGxpc3QgPSBbXTtcbiAgaWYgKGNhdGUgPT0gXCJob21lXCIpIHtcbiAgICBpZiAocGFnZSA9PSAxKSB7XG4gICAgICBsaXN0ID0gaG9tZWxpc3Q7XG4gICAgfVxuICB9IGVsc2Uge1xuICAgIGxpc3QgPSBKU09OLnBh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6IGl0LnZvZF9yZW1hcmtzK1wiwrdcIitzb3VyY2UubmFtZSxcbiAgICAgICAgY29udGVudDogaXQudm9kX2NvbnRlbnQsXG4gICAgICAgIHVybDogXCJoaWtlcjovL3BhZ2UvZGV0YWlsZWQjaW1tZXJzaXZlVGhlbWUjXCIsXG4gICAgICAgIHBpY191cmw6IGl0LnZvZF9waWMsXG4gICAgICAgIGNvbF90eXBlOiBcIm1vdmllXzNcIixcbiAgICAgICAgZXh0cmE6IHtcbiAgICAgICAgICB2b2RJZDogaXQudm9kX2lkLFxuICAgICAgICAgIGltZzogaXQudm9kX3BpYyxcbiAgICAgICAgICBzbmFtZTogc291cmNlLm5hbWUsXG4gICAgICAgICAgc2tleTogc291cmNlLmtleVxuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9XG4gICAgc2V0UmVzdWx0KGQpO1xuICB9IGVsc2Uge1xuICAgIHNldFJlc3VsdChbe1xuICAgICAgdGl0bGU6IFwi54K55oiR5byA5aeL6IGa5ZCI5pCc57SiXCIgKyBNWV9LRVlXT1JELFxuICAgICAgdXJsOiBcImhpa2VyOi8vc2VhcmNoP3M9XCIgKyBNWV9LRVlXT1JELFxuICAgICAgZXh0cmE6IHtcbiAgICAgICAgZGVsZWdhdGVPbmx5U2VhcmNoOiB0cnVlLFxuICAgICAgICBydWxlczogJC50b1N0cmluZygoKSA9PiB7XG4gICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGxldCBydW50aW1lQ29uZmlnID0gR00uZGVmaW5lTW9kdWxlKFwicnVudGltZUNvbmZpZ1wiLCBcInJ1bnRpbWVDb25maWdcIik7XG4gICAgICAgICAgICBsZXQgbGlzdCA9IHJ1bnRpbWVDb25maWcuZ2V0QWxsb3dTZWFyY2hTb3VyY2UoKTtcbiAgICAgICAgICAgIFxuICAgICAgICAgICAgbGV0IHNvdXJjZSA9IHJ1bnRpbWVDb25maWcuZ2V0Q3VycmVudFNvdXJjZSgpO1xuICBcbiAgICAgICAgICAgIGxldCBsaXN0aSA9IGxpc3QuZmluZEluZGV4KHggPT4geC5rZXkgPT0gc291cmNlLmtleSk7XG4gICAgICAgICAgICBcbiAgICAgICAgICAgIGlmIChzb3VyY2Uuc2VhcmNoYWJsZSAmJiBsaXN0aSAhPSAtMSkge1xuICAgICAgICAgICAgICBsaXN0LnNwbGljZShsaXN0LmluZGV4T2Yoc291cmNlKSwgMSk7XG4gICAgICAgICAgICAgIGxpc3QudW5zaGlmdChzb3VyY2UpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBsZXQgcnVsZXMgPSBbXTtcbiAgICAgICAgICAgIGZvciAobGV0IGl0IG9mIGxpc3QpIHtcbiAgICAgICAgICAgICAgcnVsZXMucHVzaCh7XG4gICAgICAgICAgICAgICAgdGl0bGU6IGl0Lm5hbWUsXG4gICAgICAgICAgICAgICAgc2VhcmNoX3VybDogXCJoaWtlcjovL2VtcHR5P3BhZ2U9ZnlwYWdlJnNlYXJjaFRlcm1zPSoqXCIsXG4gICAgICAgICAgICAgICAgc2VhcmNoRmluZDogXCJqczpcIiArICQudG9TdHJpbmcoKGl0ZW0pID0+IHtcbiAgICAgICAgICAgICAgICAgIGxldCBkcnB5ID0gR00uZGVmaW5lTW9kdWxlKFwiRHJweU1hbmFnZVwiKS5nZXQoaXRlbS5rZXkpO1xuXG4gICAgICAgICAgICAgICAgICBsZXQgaG9tZUxpc3QgPSBKU09OLnBhcnNlKGRycHkuc2VhcmNoKE1ZX0tFWVdPUkQsIGZhbHNlLCBNWV9QQUdFKSkubGlzdCB8fCBbXTtcbiAgICAgICAgICAgICAgICAgIGxldCBkID0gW107XG4gICAgICAgICAgICAgICAgICBmb3IgKGxldCBpdCBvZiBob21lTGlzdCkge1xuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdC52b2RfbmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBpdC52b2RfcmVtYXJrcyxcbiAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBpdC52b2RfY29udGVudCxcbiAgICAgICAgICAgICAgICAgICAgICB1cmw6IFwiaGlrZXI6Ly9wYWdlL2RldGFpbGVkI2ltbWVyc2l2ZVRoZW1lI1wiLFxuICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IGl0LnZvZF9waWMsXG4gICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFwibW92aWVfM1wiLFxuICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2b2RJZDogaXQudm9kX2lkLFxuICAgICAgICAgICAgICAgICAgICAgICAgaXNQb2x5bWVyaXplOiB0cnVlLFxuICAgICAgICAgICAgICAgICAgICAgICAgaW1nOiBpdC52b2RfcGljLFxuICAgICAgICAgICAgICAgICAgICAgICAgc25hbWU6IGl0ZW0ubmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNrZXk6IGl0ZW0ua2V5LFxuICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICBzZXRSZXN1bHQoZCk7XG4gICAgICAgICAgICAgICAgfSwgaXQpXG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHJ1bGVzKTtcbiAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICBsb2coZS50b1N0cmluZygpKTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pXG4gICAgICB9XG4gICAgfV0pO1xuICB9XG59KSgpIiwiZGV0YWlsX2NvbF90eXBlIjoibW92aWVfMSIsImRldGFpbF9maW5kX3J1bGUiOiIiLCJzZGV0YWlsX2NvbF90eXBlIjoibW92aWVfMSIsInNkZXRhaWxfZmluZF9ydWxlIjoiIiwidWEiOiJtb2JpbGUiLCJwcmVSdWxl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ZXkgKyBcXFwiQFxcXCIgKyBrKTtcXG4gICAgICAgIH1cXG4gICAgfTtcXG4gICAgZXZhbChnZXRDcnlwdG9KUygpKTtcXG4gICAgZ2xvYmFsVGhpcy5DcnlwdG9KUyA9IENyeXB0b0pTO1xcblxcbiAgICBsZXQgJHJlcXVlc3QgPSByZXF1ZXN0O1xcbiAgICBsZXQgJHBvc3QgPSBwb3N0O1xcbiAgICBnbG9iYWxUaGlzLnJlcSA9IGZ1bmN0aW9uICh1cmwsIGNvYmopIHtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgbGV0IHJlcyA9IHt9O1xcbiAgICAgICAgICAgIGxldCBvYmogPSBPYmplY3QuYXNzaWduKHt9LCBjb2JqKTtcXG4gICAgICAgICAgICBpZiAob2JqLmRhdGEpIHtcXG4gICAgICAgICAgICAgICAgb2JqLmJvZHkgPSBvYmouZGF0YTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlIG9iai5kYXRhO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBpZiAob2JqLmhhc093blByb3BlcnR5KFxcXCJyZWRpcmVjdFxcXCIpKSBvYmoucmVkaXJlY3QgPSAhIW9iai5yZWRpcmVjdDtcXG4gICAgICAgICAgICBpZiAob2JqLmJ1ZmZlciA9PT0gMikge1xcbiAgICAgICAgICAgICAgICBvYmoudG9IZXggPSB0cnVlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBvYmouaGVhZGVycyA9IE9iamVjdC5hc3NpZ24oe1xcbiAgICAgICAgICAgICAgICBDb29raWU6IFxcXCIjbm9Db29raWUjXFxcIlxcbiAgICAgICAgICAgIH0sIG9iai5oZWFkZXJzKTtcXG4gICAgICAgICAgICBpZiAodXJsID09PSBcXFwiaHR0cHM6Ly9hcGkubm4uY2kvb2NyL2I2NC90ZXh0XFxcIiAmJiBvYmouaGVhZGVycykge1xcbiAgICAgICAgICAgICAgICBvYmouaGVhZGVyc1tcXFwiQ29udGVudC1UeXBlXFxcIl0gPSBcXFwidGV4dC9wbGFpblxcXCI7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGlmICh1cmwuc3RhcnRzV2l0aChcXFwiZmlsZTovL1xcXCIpICYmICh1cmwuaW5jbHVkZXMoXFxcIj90eXBlPVxcXCIpIHx8IHVybC5pbmNsdWRlcyhcXFwiP3BhcmFtcz1cXFwiKSkpIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gdXJsLnNsaWNlKDAsIHVybC5sYXN0SW5kZXhPZihcXFwiP1xcXCIpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZm9yIChsZXQga2V5IGluIG9iai5oZWFkZXJzKSB7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2Ygb2JqLmhlYWRlcnNba2V5XSAhPT0gXFxcInN0cmluZ1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIG9iai5oZWFkZXJzW2tleV0gPSBTdHJpbmcob2JqLmhlYWRlcnNba2V5XSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IHIgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAvKiBpZiAoU3RyaW5nKG9iai5tZXRob2QpLnRvTG93ZXJDYXNlKCkgPT09IFxcXCJwb3N0XFxcIikge1xcbiAgICAgICAgICAgICAgICAgciA9ICRwb3N0KHVybCwgb2JqKTtcXG4gICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgIHIgPSAkcmVxdWVzdCh1cmwsIG9iaik7XFxuICAgICAgICAgICAgIH0qL1xcbiAgICAgICAgICAgIHIgPSAkcmVxdWVzdCh1cmwsIG9iaik7XFxuICAgICAgICAgICAgaWYgKG9iai53aXRoSGVhZGVycykge1xcbiAgICAgICAgICAgICAgICByID0gSlNPTi5wYXJzZShyKTtcXG4gICAgICAgICAgICAgICAgcmVzLmNvbnRlbnQgPSByLmJvZHk7XFxuICAgICAgICAgICAgICAgIHJlcy5oZWFkZXJzID0ge307XFxuICAgICAgICAgICAgICAgIGZvciAobGV0IFtrLCB2XSBvZiBPYmplY3QuZW50cmllcyhyLmhlYWRlcnMgfHwge30pKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXMuaGVhZGVyc1trXSA9IHZbMF07XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICByZXMuY29udGVudCA9IHI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChvYmouYnVmZmVyID09PSAyKSB7XFxuICAgICAgICAgICAgICAgIHJlcy5jb250ZW50ID0gQ3J5cHRvVXRpbC5EYXRhLnBhcnNlSGV4KHJlcy5jb250ZW50KS50b0Jhc2U2NChfYmFzZTY0Lk5PX1dSQVApO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gcmVzO1xcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGxvZyhcXFwiRXJyb3JcXFwiICsgZS50b1N0cmluZygpKTtcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICAvKlxcbiAgICBjb25zdCBKaW5KYSA9ICQucmVxdWlyZShcXFwiaHR0cHM6Ly9jZG4uYm9vdGNkbi5uZXQvYWpheC9saWJzL211c3RhY2hlLmpzLzQuMS4wL211c3RhY2hlLmpzXFxcIik7XFxuICBcXG4gICAgY29uc3QgSlAgPSAkLnJlcXVpcmUoXFxcImh0dHBzOi8vanNvbnBhdGgtcGx1cy5naXRodWIuaW8vSlNPTlBhdGgvZGlzdC9pbmRleC1icm93c2VyLXVtZC5janNcXFwiKTtcXG4gICAgZ2xvYmFsVGhpcy5jaGVlcmlvID0ge1xcbiAgICAgICAgamluamEyKHRlbXBsYXRlLCBvYmopIHtcXG4gICAgICAgICAgICBcXG4gICAgICAgICAgICByZXR1cm4gJC5sb2coSmluSmEucmVuZGVyKHRlbXBsYXRlLCBvYmopKTtcXG4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sYWNrXFxcIixcXG4gICAgICBoaWRlOiBcXFwiZ3JleVxcXCJcXG4gICAgfVxcblxcbiAgICB2YXIgbGF6eSA9ICQoYCNub0xvYWRpbmcjYCkubGF6eVJ1bGUoKGRjLCBzZGMsIG0sIGNzKSA9PiB7XFxuICAgICAgdmFyIHNob3cgPSBzdG9yYWdlMC5nZXRJdGVtKG0sICcwJyk7XFxuICAgICAgdmFyIHRpdGxlID0gZmluZEl0ZW0oJ2Rlc2MnKS50aXRsZTtcXG4gICAgICB2YXIgcmUgPSAvKDxcXFxcL3NtYWxsPjxicj4uKj8+KS4rL2c7XFxuICAgICAgdmFyIGV4cCA9ICflsZXlvIA6JztcXG4gICAgICB2YXIgcmV0ID0gJ+aUtui1tzonO1xcbiAgICAgIGlmIChzaG93ID09ICcxJykge1xcbiAgICAgICAgdXBkYXRlSXRlbSgnZGVzYycsIHtcXG4gICAgICAgICAgdGl0bGU6IHRpdGxlXFxuICAgICAgICAgICAgLnJlcGxhY2UocmV0LCBleHApXFxuICAgICAgICAgICAgLnJlcGxhY2UocmUsICckMScgKyBzZGMgKyAnPC9zbWFsbD4nKVxcbiAgICAgICAgICAgIC5yZXBsYWNlKC8oPFxcXFwvc21hbGw+PGJyPlxcXFw8Zm9udCBjb2xvcj1cXFwiKS4qPyhcXFwiPikvLCAnJDEnICsgY3MuaGlkZSArICckMicpXFxuXFxuICAgICAgICB9KVxcbiAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShtLCAnMCcpO1xcbiAgICAgIH0gZWxzZSB7XFxuICAgICAgICB1cGRhdGVJdGVtKCdkZXNjJywge1xcbiAgICAgICAgICB0aXRsZTogdGl0bGVcXG4gICAgICAgICAgICAucmVwbGFjZShleHAsIHJldClcXG4gICAgICAgICAgICAucmVwbGFjZShyZSwgJyQxJyArIGRjICsgJzwvc21hbGw+JylcXG4gICAgICAgICAgICAucmVwbGFjZSgvKDxcXFxcL3NtYWxsPjxicj5cXFxcPGZvbnQgY29sb3I9XFxcIikuKj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AgbGV0IHBsYXlvYmogPSB0LnNwbGl0KFxcXCIjXFxcIikubWFwKChqKSA9PiB7XFxuICAgICAgICBsZXQgayA9IGouc3BsaXQoXFxcIiRcXFwiKTtcXG4gICAgICAgIGxldCB0ID0ga1swXTtcXG4gICAgICAgIGxldCB1aWQgPSAoa1sxXXx8a1swXSk7XFxuICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICB0aXRsZTogZm9udHN0eWxlKHQsIHtcXG4gICAgICAgICAgICB0YWdzOiBcXFwic21hbGxcXFwiXFxuICAgICAgICAgIH0pLFxcbiAgICAgICAgICB1cmw6ICB1aWQrIFxcXCIjXFxcIiArIGZyb21baV0gKyBwbGF5TGF6eS5yZXBsYWNlKCdcXFwiaWRcXFwiJywgJ1xcXCInICt1aWQgKyAnXFxcIicpLFxcbiAgICAgICAgICBjb2xfdHlwZTogY29sLFxcbiAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgLypleHRyYTogT2JqZWN0LmFzc2lnbih7fSwgZXh0cmEsIHtcXG4gICAgICAgICAgICBcXFwiUmVmZXJlclxcXCI6IGRlY29kZVVSSUNvbXBvbmVudChrWzFdKSxcXG4gICAgICAgICAgICBpZDoga1sxXSxcXG4gICAgICAgICAgICAvL2xpbmVWaXNpYmxlOiBmYWxzZSxcXG4gICAgICAgICAgICB0ZXh0QWxpZ246IHRleHRhbGlnbixcXG4gICAgICAgICAgICBjbHM6IFxcXCJwbGF5bGlzdFxcXCIsXFxuICAgICAgICAgIH0pKi9cXG4gICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBpZDogdWlkLFxcbiAgICAgICAgICAgIGJsb2NrUnVsZXM6IFsnYmIuKi5wbmcnLCAnLmpwZycsIFxcXCJobVxcXFwuYmFpZHVcXFxcLmNvbVxcXFwvaG0uanNcXFwiXSxcXG4gICAgICAgICAgICB2aWRlb0V4Y2x1ZGVSdWxlczogWyc/dXJsPSddLFxcbiAgICAgICAgICAgIGxpbmVWaXNpYmxlOi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uICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKGxvY2F0aW9uLCBwY291bnQpID0+IHtcXG4gICAgICAgICAgbGV0IHBhZ2VudW0gPSBnZXRNeVZhcihcXFwicGFnZW51bVxcXCIsIFxcXCIwXFxcIik7XFxuICAgICAgICAgIGlmIChwYWdlbnVtID09IDApIHtcXG4gICAgICAgICAgICBwYWdlbnVtID0gcGNvdW50IC0gMTtcXG4gICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBwYWdlbnVtLS07XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgcHV0TXlWYXIoXFxcInBhZ2VudW1cXFwiLCBTdHJpbmcocGFnZW51bSkpO1xcbiAgICAgICAgICBHTS5nZXQoXFxcInJlbm92YXRlTGlzdFxcXCIsICgpID0+IHsgfSkobG9jYXRpb24pO1xcbiAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgfSwgbG9jYXRpb24sIHBjb3VudCksXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICBjbHM6IFxcXCJwbGF5cGFnZVxcXCJcXG4gICAgICAgIH1cXG4gICAgICB9LCB7XFxuICAgICAgICB0aXRsZTogcGxheXBbcGFnZW51bV0sXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMlxcXCIsXFxuICAgICAgICB1cmw6ICQocGFnZWFyciwgMykuc2VsZWN0KChsb2NhdGlvbikgPT4ge1xcbiAgICAgICAgICBwdXRNeVZhcihcXFwicGFnZW51bVxcXCIsIFN0cmluZyhNWV9JTkRFWCkpO1xcbiAgICAgICAgICBHTS5nZXQoXFxcInJlbm92YXRlTGlzdFxcXCIsICgpID0+IHsgfSkobG9jYXRpb24pO1xcbiAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICB9LCBsb2NhdGlvbiksXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICBjbHM6IFxcXCJwbGF5cGFnZVxcXCJcXG4gICAgICAgIH1cXG4gICAgICB9LCB7XFxuICAgICAgICB0aXRsZTogJ+S4i+S4gOmhtScsXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfNFxcXCIsXFxuICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKGxvY2F0aW9uLCBwY291bnQpID0+IHtcXG4gICAgICAgICAgbGV0IHBhZ2VudW0gPSBnZXRNeVZhcihcXFwicGFnZW51bVxcXCIsIFxcXCIwXFxcIik7XFxuICAgICAgICAgIGlmIChwYWdlbnVtID49IHBjb3VudCAtIDEpIHtcXG4gICAgICAgICAgICBwYWdlbnVtID0gMDtcXG4gICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBwYWdlbnVtKys7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgcHV0TXlWYXIoXFxcInBhZ2VudW1cXFwiLCBTdHJpbmcocGFnZW51bSkpO1xcbiAgICAgICAgICBHTS5nZXQoXFxcInJlbm92YXRlTGlzdFxcXCIsICgpID0+IHsgfSkobG9jYXRpb24pO1xcbiAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgfSwgbG9jYXRpb24sIHBjb3VudCksXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICBjbHM6IFxcXCJwbGF5cGFnZVxcXCJcXG4gICAgICAgIH1cXG4gICAgICB9XSlcXG4gICAgICAvKnBsYXlwID0gcGxheXAubWFwKCh4LCBpKSA9PiB7XFxuICAgICAgICAgbGV0IG9iaiA9IE9iamVjdC5hc3NpZ24oe30sIHRlbXAsIHtcXG4gICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIChwYWdlbnVtID09IGkgPyB4LmZvbnRjb2xvcihcXFwicmVkXFxcIikgOiB4KSxcXG4gICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5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IbkuqtcXFwiLFxcbiAgICB1cmw6ICQoXFxcIi0xXFxcIiwgXFxcIui+k+WFpeS9oOimgeWIhuS6q+ino+aekOeahOW6j+WPt1xcXFxuLTHlhajpg6jvvIwtMuW3suWQr+eUqOeahO+8jC0z5bey56aB55So55qEXFxcIikuaW5wdXQoKGxlbmd0aCkgPT4ge1xcbiAgICAgICAgbGV0IGluZGV4YyA9IGlucHV0LnNwbGl0KC8sfO+8jC8pO1xcbiAgICAgICAgbGV0IGluZGV4cyA9IFtdO1xcbiAgICAgICAgbGV0IG1vID0gcGFyc2VJbnQoaW5kZXhjWzBdKTtcXG4gICAgICAgIGlmICghKGluZGV4Yy5sZW5ndGggIT09IDAgJiYgbW8gPCAwICYmIG1vID4gLTUpKSB7XFxuICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgaW5kZXhjKSB7XFxuICAgICAgICAgICAgICAgIGxldCBudW0gPSBwYXJzZUludChpdCk7XFxuICAgICAgICAgICAgICAgIGlmIChOdW1iZXIuaXNOYU4obnVtKSB8fCBudW0gPj0gbGVuZ3RoIHx8IG51bSA8IDApIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mlbDlrZfkuI3lkIjms5VcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGluZGV4cy5wdXNoKG51bSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuICQoW1xcXCJISUtFUlxcXCIsIFxcXCJUWFRcXFwiXS5jb25jYXQoZ2V0UGFzdGVzKCkpLCAyLCBcXFwi5YiG5Lqr5pa55byPXFxcIikuc2VsZWN0KChtbywgaW5kZXhzLCBleHQpID0+IHtcXG4gICAgICAgICAgICBmdW5jdGlvbiB1cChydWxlcykge1xcbiAgICAgICAgICAgICAgICBsZXQgcnVsZWI2NCA9IGJhc2U2NEVuY29kZShKU09OLnN0cmluZ2lmeShydWxlcykpO1xcbiAgICAgICA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DtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgcnVsZXM7XFxuICAgICAgICAgICAgaWYgKG1vID09PSAtMSkge1xcbiAgICAgICAgICAgICAgICBydWxlcyA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1vID09PSAtMikge1xcbiAgICAgICAgICAgICAgICBydWxlcyA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldFVzZWZ1bEpzb24oKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1vID09PSAtMykge1xcbiAgICAgICAgICAgICAgICBydWxlcyA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEZvcmJpZGRlbkpzb24oKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBydWxlcyA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKS5maWx0ZXIoKHYsIGkpID0+IGluZGV4cy5pbmNsdWRlcyhpKSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJ1bGVzID0gcnVsZXMubWFwKCh2KSA9PiB7XFxuICAgICAgICAgICAgICAgIHYuZm9yYmlkZGVuID0gdW5kZWZpbmVkO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdjtcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICByZXR1cm4gdXAocnVsZXMpO1xcbiAgICAgICAgfSwgbW8sIGluZGV4cywgaW5kZXhjWzFdKTtcXG5cXG4gICAgfSwgbGVuZ3RoKSxcXG4gICAgY29sX3R5cGU6IFxcXCJpY29uX3NtYWxsXzRcXFwiLFxcbiAgICBwaWNfdXJsOiBcXFwiaGlrZXI6Ly9pbWFnZXMvaWNvbl9zaGFyZV9ncmVlblxcXCJcXG59KTtcXG5kLnB1c2goe1xcbiAgICB0aXRsZTogXFx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AgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdSA9IHNoYXJlUGFzdGUocnVsZWI2NCwgaW5wdXQpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBnZXRQYXNzKHJ1bGUubmFtZSwgdSwgXFxcImJcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgaW5kZXgpO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLnp7vliqhcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkKGluZGV4ICsgXFxcIlxcXCIsIFxcXCLovpPlhaXkvY3nva5cXFwiKS5pbnB1dCgoaW5kZXgsIGxlbmd0aCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IG5ld0luZGV4ID0gTnVtYmVyKGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChOdW1iZXIuaXNOYU4obmV3SW5kZXgpIHx8IG5ld0luZGV4ID49IGxlbmd0aCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/kuI3lkozop4TnmoTkvY3nva5cXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuZ2V0SnNvbigpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJ1bGUgPSBydWxlcy5zcGxpY2UoaW5kZXgsIDEpWzBdO1xcbiAgICAgICAgICAgICAgICAgICAgcnVsZXMuc3BsaWNlKG5ld0luZGV4LCAwLCBydWxlKTtcXG4gICAgICAgICAgICAgICAgICAgICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLnNhdmVKc29uKHJ1bGVzKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgfSwgaW5kZXgsIGxlbmd0aCk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIue9rumhtlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgbGV0IG5ld0luZGV4ID0gMDtcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuZ2V0SnNvbigpO1xcbiAgICAgICAgICAgICAgICBsZXQgcnVsZSA9IHJ1bGVzLnNwbGljZShpbmRleCwgMSlbMF07XFxuICAgICAgICAgICAgICAgIHJ1bGVzLnNwbGljZShuZXdJbmRleCwgMCwgcnVsZSk7XFxuICAgICAgICAgICAgICAgICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLnNhdmVKc29uKHJ1bGVzKTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLliKDpmaRcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXCLnoa7orqTliKDpmaTvvJ9cXFwiKS5jb25maXJtKChpbmRleCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJ1bGVzID0gJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuZ2V0SnNvbigpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJ1bGUgPSBydWxlcy5zcGxpY2UoaW5kZXgsIDEpWzBdO1xcbiAgICAgICAgICAgICAgICAgICAgJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuc2F2ZUpzb24ocnVsZXMpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3suWIoOmZpFxcXCIgKyBydWxlLm5hbWU7XFxuIC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09IHZvaWQoMCkgPyBcXFwi5pu05paw6Kej5p6QXFxcIiA6IFxcXCLlr7zlhaXop6PmnpBcXFwiO1xcbiAgICAgICAgc2V0UGFnZVRpdGxlKHRpcCArIFxcXCI6XFxcIiArIG9iai5uYW1lKTtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLigJjigJhcXFwiICsgdGlwICsgXFxcIuKAmeKAmVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG5cXG4gICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgb2JqID0ge307XFxuICAgICAgICBiYWNrKCk7XFxuICAgICAgICB0b2FzdChcXFwi5a+85YWl6ZSZ6K+vXFxcIik7XFxuICAgIH1cXG59IGVsc2UgaWYgKGluZGV4ICE9PSB2b2lkKDApKSB7XFxuICAgIG9iaiA9IGFycltpbmRleF07XFxuICAgIHNldFBhZ2VUaXRsZShcXFwi57yW6L6R6Kej5p6QOlxcXCIgKyBvYmoubmFtZSk7XFxufSBlbHNlIHtcXG4gICAgb2JqID0ge1xcbiAgICAgICAgcnVuVHlwZTogXFxcIldFQlxcXCIsXFxuICAgICAgICBtZXRob2Q6IFxcXCJHRVRcXFwiXFxuICAgIH07XFxuICAgIHNldFBhZ2VUaXRsZShcXFwi5paw5bu66Kej5p6QXFxcIik7XFxufVxcblxcbmQucHVzaCh7XFxuICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICBkZXNjOiBcXFwi5ZCN5a2XKOW/heWhqylcXFwiLFxcbiAgICBleHRyYToge1xcbiAgICAgICAgb25DaGFuZ2U6ICQudG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vU3RyaW5nKCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuICQucmVxdWlyZShcXFwidmlkZW9VcmxcXFwiKS5wcmVwYXJlUGFyc2VzKFt7XFxuICAgICAgICAgICAgICAgIG5hbWUsXFxuICAgICAgICAgICAgICAgIHVybCxcXG4gICAgICAgICAgICAgICAgZmxhZyxcXG4gICAgICAgICAgICAgICAgaGVhZGVycyxcXG4gICAgICAgICAgICAgICAgcnVuVHlwZSxcXG4gICAgICAgICAgICAgICAgbWV0aG9kLFxcbiAgICAgICAgICAgICAgICBqc29uUGF0aCxcXG4gICAgICAgICAgICAgICAganNcXG4gICAgICAgICAgICB9XSwgaW5wdXQsbnVsbCwgdHJ1ZSk7XFxuICAgICAgICB9KTtcXG4gICAgfSksXFxuICAgIGNvbF90eXBlOiBcXFwidGV4dF8zXFxcIixcXG59KTtcXG5cXG5kLnB1c2goe1xcbiAgICB0aXRsZTogXFxcIuS/neWtmFxcXCIsXFxuICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaW5kZXgsIGlzSW1wb3J0KSA9PiB7XFxuICAgICAgICBsZXQgbmFtZSA9IGdldE15VmFyKFxcXCJwc19uYW1lXFxcIiwgXFxcIlxcXCIpLnRyaW0oKTtcXG4gICAgICAgIGlmICghbmFtZSkge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lkI3lrZflvpfmnInkuIDkuKrlkKdcXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IHVybCA9IGdldE15VmFyKFxcXCJwc191cmxcXFwiLCBcXFwiXFxcIikudHJpbSgpO1xcbiAgICAgICAgaWYgKCF1cmwpIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6Kej5p6Q5Zyw5Z2A5LiN6IO95Li656m6XFxcIjtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBmbGFnID0g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AgICAgICB9IGVsc2UgaWYgKHJ1blR5cGUgPT09IFxcXCJKU1xcXCIgJiYgIWpzKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL0pT5qih5byP5LiL5b+F6aG75aGranNcXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IGFyciA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKTtcXG4gICAgICAgIGxldCBvYmoxID0ge1xcbiAgICAgICAgICAgIG5hbWUsXFxuICAgICAgICAgICAgdXJsLFxcbiAgICAgICAgICAgIGZsYWcsXFxuICAgICAgICAgICAgaGVhZGVycyxcXG4gICAgICAgICAgICBydW5UeXBlLFxcbiAgICAgICAgICAgIG1ldGhvZCxcXG4gICAgICAgICAgICBqc29uUGF0aCxcXG4gICAgICAgICAgICBqc1xcbiAgICAgICAgfTtcXG4gICAgICAgIGlmIChpbmRleCA9PT0gdm9pZCgwKSkge1xcbiAgICAgICAgICAgIGlmIChhcnIuc29tZSh2ID0+IHYubmFtZSA9PT0gbmFtZSkpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3sue7j+WtmOWcqOivpeino+aekFxcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChvYmoxLmdyb3VwKSB7XFxuICAgICAgICAgICAgICAgIGxldCBncm91cCA9IG9iajEuZ3JvdXA7XFxuICAgICAgICAgICAgICAgIGxldCBpbmRleCA9IGFyci5maW5kSW5kZXgodiA9PiB2Lmdyb3VwID09PSBncm91cCk7XFxuICAgICAgICAgICAgICAgIGlmIChpbmRleCA9PT0gLTEpIHtcXG4gICAgICAgICAgICAgICAgICAgIGFyci51bnNoaWZ0KG9iajEpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgYXJyLnNwbGljZShpbmRleCwgMCwgb2JqMSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBpZiAoaXNJbXBvcnQpIHtcXG4gICAgICAgICAgICAgICAgICAgIGFyci5wdXNoKG9iajEpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgYXJyLnVuc2hpZnQob2JqMSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGxldCBuYW1leSA9IGFycltpbmRleF0ubmFtZTtcXG4gICAgICAgICAgICBpZiAobmFtZSAhPT0gbmFtZXkpIHtcXG4gICAgICAgICAgICAgICAgaWYgKGFyci5zb21lKHYgPT4gdi5uYW1lID09PSBuYW1lKSkge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3sue7j+WtmOWcqOivpeino+aekFxcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgb2JqMSA9IE9iamVjdC5hc3NpZ24oYXJyW2luZGV4XSwgb2JqMSk7XFxuICAgICAgICAgICAgYXJyLnNwbGljZShpbmRleCwgMSwgb2JqMSk7XFxuICAgICAgICB9XFxuICAgICAgICAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5zYXZlSnNvbihhcnIpO1xcbiAgICAgICAgYmFjayh0cnVlKTtcXG4gICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/kv53lrZjmiJDlip9cXFwiO1xcbiAgICB9LCBpbmRleCwgaXNJbXBvcnQpLFxcbiAgICBjb2xfdHlwZTogXFxcInRleHRfM1xcXCIsXFxufSk7XFxuXFxuc2V0UmVzdWx0KGQpO1wifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi6Kej5p6Q5a+85YWlXCIsXCJwYXRoXCI6XCJpbXBvcnRcIixcInJ1bGVcIjpcImpzOlxcbmZ1bmN0aW9uIHNhdmVDYWNoZShqc29uKSB7XFxuICAgIHdyaXRlRmlsZShcXFwiaGlrZXI6Ly9maWxlcy9fY2FjaGUvamlleGlTaW1wbGVJbXBvcnQuanNvblxcXCIsIEpTT04uc3RyaW5naWZ5KGpzb24pKTtcXG59XFxuJC5leHBvcnRzID0gZnVuY3Rpb24ocGFzcykge1xcbiAgICB0cnkge1xcbiAgICAgICAgbGV0IFtfLCBydWxlLCB0eXBlXSA9IHBhc3Muc3BsaXQoXFxcIiRcXFwiKTtcXG4gICAgICAgIGlmICh0eXBlID09PSBcXFwiYlxcXCIpIHtcXG4gICAgICAgICAgICBydWxlID0gcGFyc2VQYXN0ZShydWxlKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBydWxlcyA9IEpTT04ucGFyc2UoYmFzZTY0RGVjb2RlKHJ1bGUpKTtcXG4gICAgICAgIGlmICghQXJyYXkuaXNBcnJheShydWxlcykpIHtcXG4gICAgICAgICAgICBydWxlcyA9IFtydWxlc107XFxuICAgICAgICB9XFxuICAgICAgICAvL3J1bGVzLnJldmVyc2UoKTtcXG4gICAgICAgIE1ZX1VSTCA9IG1vZHVsZS5pZDtcXG4gICAgICAgIGxldCBydWxlVGl0bGUgPSBnZXRQYXJhbShcXFwicnVsZVxcXCIpO1xcbiAgICAgICAgbGV0IGFyciA9ICQucmVxdWlyZShcXFwiY29uZmlncz9ydWxlPVxcXCIgKyBydWxlVGl0bGUpLmdldEpzb24oKTtcXG4gICAgICAgIGxldCBuZXdJID0gMDtcXG4gICAgICAgIGZvciAobGV0IHJ1bGUgb2YgcnVsZXMpIHtcXG4gICAgICAgICAgICBsZXQgaW5kZXggPSBhcnIuZmluZEluZGV4KHYgPT4gdi5uYW1lID09PSBydWxlLm5hbWUpO1xcbiAgICAgICAgICAgIGlmIChpbmRleCA+IC0xKSB7XFxuICAgICAgICAgICAgICAgIHJ1bGUgPSBPYmplY3QuYXNzaWduKGFycltpbmRleF0sIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICBhcnIuc3BsaWNlKGluZGV4LCAxLCBydWxlKTtcXG4gICAgICAgICAgICAgICAgaWYgKHJ1bGVzLmxlbmd0aCA9PT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgc2F2ZUNhY2hlKHJ1bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvcnVsZUVkaXQjbm9IaXN0b3J5IyNub1JlY29yZEhpc3RvcnkjP2lzSW1wb3J0PXRydWUmaW5kZXg9XFxcIiArIGluZGV4ICsgXFxcIiZydWxlPVxcXCIgKyBydWxlVGl0bGU7XFxuICAgICAgICAgICAgICAgICAgICAvL3RvYXN0KFxcXCLlt7Lmm7TmlrDop4TliJnvvJpcXFwiICsgcnVsZS5uYW1lKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi5bey5pu05paw6KeE5YiZ77yaXFxcIiArIHJ1bGUubmFtZSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIG5ld0krKztcXG4gICAgICAgICAgICAgICAgYXJyLnB1c2gocnVsZSk7XFxuICAgICAgICAgICAgICAgIGlmIChydWxlcy5sZW5ndGggPT09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVDYWNoZShydWxlKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL3J1bGVFZGl0I25vSGlzdG9yeSMjbm9SZWNvcmRIaXN0b3J5Iz9pc0ltcG9ydD10cnVlJnJ1bGU9XFxcIiArIHJ1bGVUaXRsZTtcXG4gICAgICAgICAgICAgICAgICAgIC8vdG9hc3QoXFxcIuW3suWvvOWFpeinhOWIme+8mlxcXCIgKyBydWxlLm5hbWUpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAg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pdGgoXFxcIi5qc1xcXCIpKSBjb250aW51ZTtcXG4gICAgICAgICAgICBuYW1lID0gbmFtZS5zbGljZSgwLCBuYW1lLmxhc3RJbmRleE9mKFxcXCIuXFxcIikpO1xcbiAgICAgICAgICAgIGxldCBydWxlID0gZmV0Y2goYGh0dHBzOi8vcmF3LmdpdG1pcnJvci5jb20vJHtyb3BlfS9tYXN0ZXIvJHtzcGF0aH1gKTtcXG4gICAgICAgICAgICBpZiAoISgoIXJ1bGUgfHwgIXJ1bGUuaW5jbHVkZXMoXFxcInJ1bGVcXFwiKSkgJiYgIWZpbGVFeGlzdChwYXRoICsgaXQubmFtZSkpKSB7XFxuICAgICAgICAgICAgICAgIHdyaXRlRmlsZShwYXRoICsgaXQubmFtZSwgcnVsZSk7XFxuICAgICAgICAgICAgICAgIHJ1bGVzLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgJ2tleSc6IGBoaXB5X2pzXyR7bmFtZX1gLFxcbiAgICAgICAgICAgICAgICAgICAgJ25hbWUnOiBgJHtuYW1lfWAsXFxuICAgICAgICAgICAgICAgICAgICAndHlwZSc6IDMsXFxuICAgICAgICAgICAgICAgICAgICAnYXBpJzonLi4vbGlicy9kcnB5Mi5qcycsXFxuICAgICAgICAgICAgICAgICAgICAnc2VhcmNoYWJsZSc6IDEsXFxuICAgICAgICAgICAgICAgICAgICAncXVpY2tTZWFyY2gnOiAxLFxcbiAgICAgICAgICAgICAgICAgICAgJ2ZpbHRlcmFibGUnOiAxLFxcbiAgICAgICAgICAgICAgICAgICAgJ2V4dCc6IFxcXCIuL1xcXCIgKyBpdC5uYW1lLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgY291bnQrKztcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgbG9nKGUudG9TdHJpbmcoKSk7XFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgd3JpdGVGaWxlKHBhdGggKyBcX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5leHQgPSBcXFwiLi9cXFwiICsgbmFtZTtcXG4gICAgICAgICAgICAgICAgaWYgKCFydWxlIHx8ICFydWxlLmluY2x1ZGVzKFxcXCJydWxlXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmICghZmlsZUV4aXN0KHBhdGggKyBuYW1lKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBhcnIuc3BsaWNlKGksIDEpO1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgIHdyaXRlRmlsZShwYXRoICsgbmFtZSwgcnVsZSk7XFxuICAgICAgICAgICAgICAgIGNvdW50Kys7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGxvZyhlLnRvU3RyaW5nKCkpO1xcbiAgICAgICAgfVxcbiAgICAgICAgaSsrO1xcbiAgICB9XFxuICAgIHdyaXRlRmlsZShwYXRoICsgXFxcImluZGV4Lmpzb25cXFwiLCBKU09OLnN0cmluZ2lmeShqc29uKSk7XFxuICAgIHJldHVybiBcXFwidG9hc3Q6Ly/miJDlip/mm7TmlrBcXFwiICsgY291bnQgKyBcXFwi5LiqXFxcIjtcXG59XFxuJC5leHBvcnRzLnBhcnNlVXJsID0gZnVuY3Rpb24odXJsLCBwYXRoKSB7XFxuICAgIHBhdGggPSBiYXNlNjREZWNvZGUocGF0aCk7XFxuICAgIHBhdGggPSBwYXRoLmVuZHNXaXRoKFxcXCIvXFxcIikgPyBwYXRoIDogcGF0aCArIFxcXCIvXFxcIjtcXG4gICAgdHJ5IHtcXG4gICAgICAgIGlmICh1cmwuc3RhcnRzV2l0aChcXFwiaHR0cHM6Ly9naXRodWIuY29tL2hqZGhueC9cXFwiKSkge1xcbiAgICAgICAgICAgIHJldHVybiBnZW5lcmF0ZUNvbmZpZ0J5R2l0aHViKHVybCwgcGF0aCk7XFxuICAgICAgICB9IGVsc2Uge1xcbiA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LnR5cGUgPSBcXFwibG9jYWxEaXJcXFwiO1xcbiAgICAgICAgfSBlbHNlIGlmIChjb25maWcucGF0aC5zdGFydHNXaXRoKFxcXCJodHRwczovL2dpdGh1Yi5jb21cXFwiKSkge1xcbiAgICAgICAgICAgIHNvdXJjZUxpc3QgPSBnZW5lcmF0ZUNvbmZpZ0J5R2l0aHViKGNvbmZpZy5wYXRoKTtcXG4gICAgICAgICAgICBjb25maWcudHlwZSA9IFxcXCJnaXRodWJEaXJcXFwiO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UodG9Db3JyZWN0SlNPTlN0cmluZyhmZXRjaChjb25maWcucGF0aCkpIHx8IFxcXCJ7fVxcXCIpO1xcbiAgICAgICAgICAgIGlmICghQXJyYXkuaXNBcnJheShqc29uLnNpdGVzKSB8fCAhanNvbi5zaXRlcy5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHNvdXJjZUxpc3QgPSBmaWx0ZXJPdGhlcihqc29uLnNpdGVzKTtcXG4gICAgICAgICAgICBjb25maWcudHlwZSA9IFxcXCJpbmRleFxcXCI7XFxuICAgICAgICB9XFxuICAgICAgICBmaWxlID0gdm9pZCAwO1xcbiAgICAgICAgbGV0IGN1cnJlbnRTb3VyY2UsIHNlYXJjaEFsbG93O1xcbiAgICAgICAgaWYgKGNvbmZpZy5jS2V5KSB7XFxuICAgICAgICAgICAgY3VycmVudFNvdXJjZSA9IHNvdXJjZUxpc3QuZmluZCh2ID0+IHYua2V5ID09PSBjb25maWcuY0tleSk7XFxuICAgICAgICAgICAgaWYgKCFjdXJyZW50U291cmNlKSB7XFxuICAgICAgICAgICAgICAgIGN1cnJlbnRTb3VyY2UgPSBzb3VyY2VMaXN0WzBdO1xcbiAgICAgICAgICAgICAgICAvL2N1cnJlbnRDb25maWcuY0tleSA9IHNvdXJjZUx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W5hbWUuZW5kc1dpdGgoXFxcIi5qc1xcXCIpKSBjb250aW51ZTtcXG4gICAgICAgIG5hbWUgPSBuYW1lLnNsaWNlKDAsIG5hbWUubGFzdEluZGV4T2YoXFxcIi5cXFwiKSk7XFxuICAgICAgICBydWxlcy5wdXNoKHtcXG4gICAgICAgICAgICAna2V5JzogYGhpcHlfanNfJHtuYW1lfWAsXFxuICAgICAgICAgICAgJ25hbWUnOiBgJHtuYW1lfWAsXFxuICAgICAgICAgICAgJ3R5cGUnOiAzLFxcbiAgICAgICAgICAgICdzZWFyY2hhYmxlJzogMSxcXG4gICAgICAgICAgICAncXVpY2tTZWFyY2gnOiAxLFxcbiAgICAgICAgICAgICdmaWx0ZXJhYmxlJzogMSxcXG4gICAgICAgICAgICAnZXh0JzogYGh0dHBzOi8vcmF3LmdpdG1pcnJvci5jb20vJHtyb3BlfS9tYXN0ZXIvJHtwYXRofWAsXFxuICAgICAgICB9KTtcXG4gICAgICAgIC8qXFxuICAgICAgICBodHRwczovL2dpdGh1Yi5jb20vaGpkaG54L2hpcHktc2VydmVyL3RyZWUvbWFzdGVyL2FwcC90NC9maWxlcy9kcnB5X2pzXFxuICAgICAgICBodHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vaGpkaG54L2hpcHktc2VydmVyL21hc3Rlci9hcHAvdDQvZmlsZXMvZHJweV9qcy8zNjAlRTUlQkQlQjElRTglQTclODYlNUIlRTUlQUUlOTglNUQuanMqL1xcbiAgICB9XFxuICAgIHJldHVybiBydWxlcztcXG59XFxuXFxuZnVuY3Rpb24gcHJlcGFyZShjb25maWcpIHtcXG4gICAgbGV0IGRhdGEgPSBpbml0KGNvbmZpZyk7XFxuICAgIGlmICghZGF0YSkgcmV0dXJuIGZhbHNlO1xcbiAgICBjdXJyZW50U291cmNlID0gZGF0YS5jdXJyZW50U291cmNlO1xcbiAgICBzZWFyY2hBbGxvdyA9IGRhdGEuc2VhcmNoQWxsb3c7XFxuICAgIHNvdXJjZUxp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ICAgICAgbGV0IGNvZGUgPSBcXFwibm9cXFwiO1xcbiAgICAgICAgICBsZXQgcGF0aCA9IG9iai51cmwucmVwbGFjZShcXFwiZmlsZTovL1xcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgbGV0IGRpciA9IG5ldyBqYXZhLmlvLkZpbGUocGF0aCk7XFxuICAgICAgICAgIGlmIChkaXIuaXNEaXJlY3RvcnkoKSkge1xcbiAgICAgICAgICAgIGxldCBmbGlzdCA9IGRpci5saXN0RmlsZXMoKTtcXG4gICAgICAgICAgICBmb3IgKHZhciBmIG9mIGZsaXN0KSB7XFxuICAgICAgICAgICAgICAvLyDmo4Dmn6Xmlofku7blkI3mmK/lkKbku6UuanPnu5PlsL5cXG4gICAgICAgICAgICAgIGlmIChmLmlzRmlsZSgpICYmIGYuZ2V0TmFtZSgpLnRvTG93ZXJDYXNlKCkuZW5kc1dpdGgoXFxcIi5qc1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgIGpzRmlsZXMucHVzaChmKTtcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgaWYgKGRpci5pc0ZpbGUoKSAmJiBmaWxlRXhpc3Qob2JqLnVybCkpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAganNvbiA9IEpTT04ucGFyc2UocmVhZEZpbGUob2JqLnVybCkpO1xcbiAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoanNvbi5zaXRlcykgfHwganNvbi5zaXRlcy5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgY291bnQgPSBmaWx0ZXJPdGhlcihqc29uLnNpdGVzKS5sZW5ndGg7XFxuICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge31cXG4gICAgICAgICAgICBjb2RlID0gXFxcIm9rXFxcIjtcXG4gICAgICAgICAgfVxcbiAgICAgICAgICBpZiAoanNGaWxlcy5sZW5ndGggPj0gNSkge1xcbiAgICAgICAgICAgIGNvdW50ID0ganNGaWxlcy5sZW5ndGg7XFxuICAgICAgICAgICAgY29kZSA9IFxcXCJva1xcXCI7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICB0aW1lOiAoRGF0ZS5ub3coKSAtIHMpLFxcbiAgICAgICAgICAgIHVybDogb2JqLnVybCxcXG4gICAgICAgICAgICBjb3VudDogY291bnQsXFxuICAgICAgICAgICAgY29kZTogY29kZSxcXG4gICAgICAgICAgICBpbmRleDogb2JqLmlcXG4gICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIGogPSBKU09OLnBhcnNlKGZldGNoKG9iai51cmwsIHtcXG4gICAgICAgICAgd2l0aEhlYWRlcnM6IHRydWUsXFxuICAgICAgICAgIHRpbWVvdXQ6IDUwMDAsXFxuICAgICAgICB9KSk7XFxuICAgICAgICBsZXQgZSA9IERhdGUubm93KCk7XFxuICAgICAgICBsZXQgYyA9IGUgLSBzO1xcbiAgICAgICAgaWYgKG9iai51cmwuaW5jbHVkZXMoXFxcImdpdGh1Yi5jb21cXFwiKSAmJiBqLnN0YXR1c0NvZGUgPT0gMjAwKSB7XFxuICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgdmFyIGh0bWwgPSBqLmJvZHk7XFxuICAgICAgICAgICAgdmFyIGpzb24gPSBKU09OLnBhcnNlKHBkZmgoaHRtbCwgXFxcIiNyZXBvLWNvbnRlbnQtcGpheC1jb250YWluZXImJnNjcmlwdCYmSHRtbFxcXCIpKTtcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IGpzb24ucGF5bG9hZC50cmVlLml0ZW1zO1xcbiAgICAgICAgICAgIGNvdW50ID0gbGlzdC5maWx0ZXIoeCA9PiB4Lm5hbWUuZW5kc1dpdGgoXFxcIi5qc1xcXCIpKS5sZW5ndGg7XFxuICAgICAgICAgIH0gY2F0Y2gge31cXG4gICAgICAgIH1cXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZSh0b0NvcnJlY3RKU09OU3RyaW5nKGouYm9keSkgfHwgXFxcInt9XFxcIik7XFxuICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGpzb24uc2l0ZXMpIHx8IGpzb24uc2l0ZXMubGVuZ3RoKSB7XFxuICAgICAgICAgICAgY291bnQgPSBmaWx0ZXJPdGhlcihqc29uLnNpdGVzKS5sZW5ndGg7XFxuICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGUpIHt9XFxuXFxuICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICB0aW1lOiBjLFxcbiAgICAgICAgICB1cmw6IGoudXJsLFxcbiAgICAgICAgICBjb3VudDogY291bnQsXFxuICAgICAgICAgIGNvZGU6IGouc3RhdHVzQ29kZSxcXG4gICAgICAgICAgaW5kZXg6IG9iai5pLFxcbiAgICAgICAgfVxcbiAgICAgIH07XFxuICAgICAgbGV0IHRhc2tzID0gbGlzdC5tYXAoKHgsIGkpID0+IHtcXG4gICAgICAgIGkgPSBpICsgMTtcXG4gICAgICAgIHJldHVybiB7XFxuICAgICAgICAgIGZ1bmM6IHRhc2ssXFxuICAgICAgICAgIHBhcmFtOiB7XFxuICAgICAgICAgICAgdXJsOiB4LFxcbiAgICAgICAgICAgIGk6IGkgLSAxLFxcbiAgICAgICAgICB9LFxcbiAgICAgICAgICBpZDogJ3Rhc2tpZCcgKyBpXFxuICAgICAgICB9XFxuICAgICAgfSk7XFxuICAgICAgdmFyIGNvdW50ID0gc3VjY2VzcyA9IHRhc2tzLmxlbmd0aDtcXG4gICAgICBiZSh0YXNrcywge1xcbiAgICAgICAgZnVuYzogZnVuY3Rpb24ob2JqLCBpZCwgZXJyb3IsIHRhc2tSZXN1bHQpIHtcXG4gICAgICAgICAgb2JqLnJlc3VsdHMucHVzaCh0YXNrUmVzdWx0KVxcbiAgICAgICAgICBjb3VudCA9IGNvdW50IC0g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biAgICAgIH1cXG4gICAgfVxcbiAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgXFxcIjxzbWFsbD5cXFwiICsgY3VycmVudCArIFxcXCLlkI3np7A6XFxcIiArIGl0ZW0ubmFtZSArIFxcXCJcXFxcbui3r+W+hDpcXFwiICsgaXRlbS5wYXRoICsgXFxcIjwvc21hbGw+XFxcIixcXG4gICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoaXRlbSA9PiB7XFxuICAgICAgICBjbGVhckl0ZW0oXFxcIm5vX2xvYWRpbmdcXFwiKTtcXG4gICAgICAgIGxldCBydW50aW1lQ29uZmlnID0gR00uZGVmaW5lTW9kdWxlKFxcXCJydW50aW1lQ29uZmlnXFxcIik7XFxuICAgICAgICBsZXQge1xcbiAgICAgICAgICBwYXRoLFxcbiAgICAgICAgICBuYW1lXFxuICAgICAgICB9ID0gaXRlbTtcXG4gICAgICAgIGlmIChwYXRoLnN0YXJ0c1dpdGgoXFxcImh0dHBcXFwiKSkge1xcbiAgICAgICAgICBzaG93TG9hZGluZyhcXFwi5q2j5Zyo5Yqg6L296YWN572uLi4uXFxcIik7XFxuICAgICAgICB9XFxuICAgICAgICBpZiAocnVudGltZUNvbmZpZy5zZXRDdXJyZW50Q29uZmlnKHtcXG4gICAgICAgICAgcGF0aCxcXG4gICAgICAgICAgbmFtZSxcXG4gICAgICAgIH0pKSB7XFxuICAgICAgICAgIGJhY2soZmFsc2UpO1xcbiAgICAgICAgICBsZXQgRHJweU1hbmFnZSA9IEdNLmRlZmluZU1vZHVsZShcXFwiRHJweU1hbmFnZVxcXCIpO1xcbiAgICAgICAgICBEcnB5TWFuYWdlLmNsZWFyKCk7XFxuICAgICAgICAgICQucmVxdWlyZShcXFwiQ2hhbmdlU291cmNlUG9wXFxcIikuc2hvdygxMDApO1xcbiAgICAgICAgICBoaWRlTG9hZGluZygpO1xcbiAgICAgICAgICByZ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XFxcIiArIChnZXRJdGVtKFxcXCJuYXR1cmFsXFxcIiwgXFxcIlxcXCIpID09IFxcXCJcXFwiID8gXFxcIuWFs+mXrVxcXCIgOiBcXFwi5ZCv55SoXFxcIiksIFxcXCLlgJLluo9cXFwiLCBcXFwi5Yi35paw6YWN572uXFxcIl0sXFxuICAgICAgICBjb2x1bW5zOiAyLFxcbiAgICAgICAgdGl0bGU6IFxcXCLor7fpgInmi6lcXFwiLFxcbiAgICAgICAgY2xpY2socywgaSkge1xcbiAgICAgICAgICBpZiAoaSA9PT0gMCkge1xcbiAgICAgICAgICAgIHNwZW4gPSBzcGVuID09IDMgPyAxIDogMztcXG4gICAgICAgICAgICBtYW5hZ2UuY2hhbmdlQ29sdW1ucyhzcGVuKTtcXG4gICAgICAgICAgfSBlbHNlIGlmIChpID09PSAxKSB7XFxuICAgICAgICAgICAgaGlrZXJQb3AuaW5wdXRDb25maXJtKHtcXG4gICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXCLovpPlhaXlhbPplK7lrZcg56m65pi+56S65YWo6YOoXFxcIixcXG4gICAgICAgICAgICAgIHRpdGxlOiBcXFwi562b6YCJ5rqQXFxcIixcXG4gICAgICAgICAgICAgIGhpbnQ6IFxcXCLmupDlhbPplK7lrZdcXFwiLFxcbiAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBzZWFyY2hLZXksXFxuICAgICAgICAgICAgICB0ZXh0YXJlYTogZmFsc2UsIC8v5aSa6KGM5qih5byPXFxuICAgICAgICAgICAgICBtYXhUZXh0YXJlYTogdHJ1ZSxcXG4gICAgICAgICAgICAgIG5vQXV0b1NvZnQ6IGZhbHNlLFxcbiAgICAgICAgICAgICAgLy9oaWRlQ2FuY2VsOiB0cnVlLFxcbiAgICAgICAgICAgICAgY29uZmlybSh0ZXh0KSB7XFxuICAgICAgICAgICAgICAgIGxldCBydW50aW1lQ29uZmlnID0gR00uZGVmaW5lTW9kdWxlKFxcXCJydW50aW1lQ29uZmlnXFxcIiwgXFxcInJ1bnRpbWVDb25maWdcXFwiKTtcXG4gICAgICAgICAgICAgICAgc2VhcmNoS2V5ID0gdGV4dDtcXG4gICAgICAgICAgICAgICAgbGV0IGxpc3QgPSBydW50aW1lQ29uZmlnLmdldEFsbFNvdXJjZSgpLm1hcCh4ID0+IHgubmFtZSk7XFxuICAgICAgICAgICAgICAgIGxldCBmbGlzdCA9IGxpc3QuZmlsdGVyKHggPT4geC5pbmNsdWRlcyh0ZXh0KSk7XFxuICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0Lmxlbmd0aCA9IDA7XFxuICAgICAgICAgICAgICAgIGZsaXN0LmZvckVhY2goeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgbWFuYWdlLmxpc3QucHVzaCh4KTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIG1hbmFnZS5jaGFuZ2UoKTtcXG4gICAgICAgICAgICAgICAgLy9yZXR1cm4gXFxcInRvYXN0Oi8v6L6T5YWl5LqGXFxcIiArIHRleHQ7XFxuICAgICAgICAgICAgICB9LFxcblxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICB9IGVsc2UgaWYgKGkgPT09IDIpIHtcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IE9iamVjdC5hc3NpZ24oW10sIG1hbmFnZS5saXN0KTtcXG4gICAgICAgICAgICBsZXQgbmF0dXJhbCA9IGdldEl0ZW0oXFxcIm5hdHVyYWxcXFwiLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgaWYgKG5hdHVyYWwgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgIG1hbmFnZS5saXN0Lmxlbmd0aCA9IDA7XFxuICAgICAgICAgICAgICBsaXN0LnNvcnQobmF0dXJhbFNvcnQpLmZvckVhY2goeCA9PiB7XFxuICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0LnB1c2goeCk7XFxuICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgbWFuYWdlLmxpc3QubGVuZ3RoID0gMDtcXG4gICAgICAgICAgICAgIHNuYW1lLmZvckVhY2goeCA9PiB7XFxuICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0LnB1c2goeCk7XFxuICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgICAgc2V0SXRlbShcXFwibmF0dXJhbFxcXCIsIG5hdHVyYWwgPyBcXFwiXFxcIiA6IFxcXCIxXFxcIik7XFxuICAgICAgICAgIH0gZWxzZSBpZiAoaSA9PSAzKSB7XFxuICAgICAgICAgICAgbWFuYWdlLmxpc3QucmV2ZXJzZSgpO1xcbiAgICAgICAgICAgIG5hbWVzLnJldmVyc2UoKTtcXG4gICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgZnVuY3Rpb24gYXJyYXlEaWZmZXJlbmNlKGFycjEsIGFycjIpIHtcXG4gICAgICAgICAgICAgIGNvbnN0IG1hcCA9IG5ldyBNYXAoYXJyMi5tYXAoaXRlbSA9PiBbaXRlbS5rZXksIGl0ZW1dKSk7XFxuICAgICAgICAgICAgICByZXR1cm4gYXJyMS5maWx0ZXIoaXRlbSA9PiAhbWFwLmhhcyhpdGVtLmtleSkpO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBsZXQgcnVudGltZUNvbmZpZyA9IEdNLmRlZmluZU1vZHVsZShcXFwicnVudGltZUNvbmZpZ1xcXCIsIFxcXCJydW50aW1lQ29uZmlnXFxcIik7XFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBydW50aW1lQ29uZmlnLmdldEFsbFNvdXJjZSgpO1xcbiAgICAgICAgICAgIGxldCBDa2V5ID0gcnVudGltZUNvbmZpZy5nZXRDdXJyZW50U291cmNlKCkua2V5O1xcbiAgICAgICAgICAgIC8vbG9nKENrZXkpXFxuICAgICAgICAgICAgbGV0IGNmZyA9IHJ1bnRpbWVDb25maWcuZ2V0Q3VycmVudENvbmZpZygpXFxuICAgICAgICAgICAgbGV0IHtcXG4gICAgICAgICAgICAgIHBhdGgsXFxuICAgICAgICAgICAgICBuYW1lXFxuICAgICAgICAgICAgfSA9IGNmZztcXG4gICAgICAgICAgICBydW50aW1lQ29uZmlnLnNldEN1cnJlbnRDb25maWcoe1xcbiAgICAgICAgICAgICAgcGF0aCxcXG4gICAgICAgICAgICAgIG5hbWUsXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgcnVudGltZUNvbmZpZy5zZXRDdXJyZW50U291cmNlKENrZXkpO1xcbiAgICAgICAgICAgIGxldCBuc291cmNlcyA9IHJ1bnRpbWVDb25maWcuZ2V0QWxsU291cmNlKCk7XFxuXFxuICAgICAgICAgICAgbGV0IGFsaXN0ID0gYXJyYXlEaWZmZXJlbmNlKG5zb3VyY2VzLCBsaXN0KTtcXG4gICAgICAgICAgICBsZXQgZGxpc3QgPSBhcnJheURpZmZlcmVuY2UobGlzdCwgbnNvdXJjZXMpO1xcblxcbiAgICAgICAgICAgIGlmIChhbGlzdC5sZW5ndGggPiAwIHx8IGRsaXN0Lmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICAgIGxldCBtc2cgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgIGlmIChhbGlzdC5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgIGFsaXN0LmZvckVhY2goeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgbWFuYWdlLmxpc3QucHVzaCh4Lm5hbWUpO1xcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBsb2coXFxcIuaWsOWinjpcXFwiICsgYWxpc3QubWFwKGsgPT4gay5uYW1lKS5qb2luKFxcXCIsXFxcIikpXFxuICAgICAgICAgICAgICAgIG1zZyArPSBcXFwi5paw5aKeXFxcIiArIGFsaXN0Lmxlbmd0aCArIFxcXCLkuKrmupBcXFwiO1xcbiAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgaWYgKGRsaXN0Lmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICAgICAgZGxpc3QuZm9yRWFjaCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5zcGxpY2UobWFuYWdlLmxpc3QuaW5kZXhPZih4Lm5hbWUpLCAxKTtcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgbG9nKFxcXCLnp7vpmaQ6XFxcIiArIGRsaXN0Lm1hcChrID0+IGsubmFtZSkuam9pbihcXFwiLFxcXCIpKVxcbiAgICAgICAgICAgICAgICBtc2cgKz0gXFxcIiDnp7vpmaRcXFwiICsgZGxpc3QubGVuZ3RoICsgXFxcIuS4qua6kFxcXCI7XFxuICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgICAgICB0b2FzdChtc2cgKyBcXFwiIOabtOWkmuivpuaDheeci2xvZ1xcXCIpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICB0b2FzdChcXFwi5bey5Yi35pawXFxcIik7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICB9XFxuICAgICAgICB9LFxcbiAgICAgIH0pO1xcbiAgICB9XFxuICB9KTtcXG59XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCJkcnB5566h55CGXCIsXCJwYXRoXCI6XCJEcnB5TWFuYWdlXCIsXCJydWxlXCI6XCJqczpcXG5jb25zdCBKU0VuZ2luZSA9IGNvbS5leGFtcGxlLmhpa2Vydmlldy5zZXJ2aWNlLnBhcnNlci5KU0VuZ2luZTtcXG5jb25zdCBydW50aW1lQ29uZmlnID0gR00uZGVmaW5lTW9kdWxlKFxcXCJydW50aW1lQ29uZmlnXFxcIik7XFxuY29uc3Qg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5YWz6ZSu5a2XIOWkmuS4queUqHzpmpTlvIBcXFwiLFxcbiAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBzZWFyY2hLZXksXFxuICAgICAgICAgICAgICB0ZXh0YXJlYTogZmFsc2UsIC8v5aSa6KGM5qih5byPXFxuICAgICAgICAgICAgICBtYXhUZXh0YXJlYTogdHJ1ZSxcXG4gICAgICAgICAgICAgIG5vQXV0b1NvZnQ6IGZhbHNlLFxcbiAgICAgICAgICAgICAgLy9oaWRlQ2FuY2VsOiB0cnVlLFxcbiAgICAgICAgICAgICAgY29uZmlybSh0ZXh0KSB7XFxuICAgICAgICAgICAgICAgIHNlYXJjaEtleSA9IHRleHQ7XFxuICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0Lmxlbmd0aCA9IDA7XFxuICAgICAgICAgICAgICAgIGR5bmFtaWNTb3VyY2UubGVuZ3RoID0gMDtcXG4gICAgICAgICAgICAgICAgaWYgKHRleHQpIHtcXG4gICAgICAgICAgICAgICAgICBjYW5TZWFyY2hTb3VyY2UuZm9yRWFjaCgodiwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRleHQuc3BsaXQoL1xcXFx8LykuZmlsdGVyKGYgPT4gZikuc29tZSh4ID0+IHYubmFtZS5pbmNsdWRlcyh4KSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgZHluYW1pY1NvdXJjZS5wdXNoKHYpO1xcbiAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5wdXNoKHNlYXJjaEFsbG93LmluY2x1ZGVzKHYua2V5KSA/IFxcXCLigJzigJzigJ3igJ1cXFwiICsgKHYubmFtZSArIFxcXCJcXFwiKS5mb250Y29sb3IoXFxcIiMwMDk5NjZcXFwiKSA6IHYubmFtZSlcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICBkeW5hbWljU291cmNlID0gY2FuU2VhcmNoU291cmNlLnNsaWNlKCk7XFxuICAgICAgICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihtYW5hZ2UubGlzdCwgZ2V0TmFtZXMoKSk7XFxuXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcbiAgICAgICAgICAgICAgICAvL3JldHVybiBcXFwidG9hc3Q6Ly/ovpPlhaXkuoZcXFwiICsgdGV4dDtcXG4gICAgICAgICAgICAgIH0sXFxuXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgIH0gZWxzZSBpZiAoaSA9PT0gMikge1xcbiAgICAgICAgICAgIGxldCBsaXN0ID0gT2JqZWN0LmFzc2lnbihbXSwgbWFuYWdlLmxpc3QpO1xcbiAgICAgICAgICAgIG1hbmFnZS5saXN0Lmxlbmd0aCA9IDA7XFxuXFxuXFxuICAgICAgICAgICAgZHluYW1pY1NvdXJjZS5zb3J0KChhLCBiKSA9PiB7XFxuICAgICAgICAgICAgICByZXR1cm4gU3RyaW5nKGEubmFtZSkubG9jYWxlQ29tcGFyZShTdHJpbmcoYi5uYW1lKSwgdW5kZWZpbmVkLCB7XFxuICAgICAgICAgICAgICAgIG51bWVyaWM6IHRydWUsXFxuICAgICAgICAgICAgICAgIHNlbnNpdGl2aXR5OiAnYmFzZSdcXG4gICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIE9iamVjdC5hc3NpZ24obWFuYWdlLmxpc3QsIGdldE5hbWVzKCkpO1xcbiAgICAgICAgICAgIG1hbmFnZS5jaGFuZ2UoKTtcXG4gICAgICAgICAgfSBlbHNlIGlmIChpID09IDMpIHtcXG4gICAgICAgICAgICBtYW5hZ2UubGlzdC5yZXZlcnNlKCk7XFxuICAgICAgICAgICAgZHluYW1pY1NvdXJjZS5yZXZlcnNlKCk7XFxuXFxuICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcbiAgICAgICAgICB9IGVsc2UgaWYgKGkgPT0gNCkge1xcbiAgICAgICAgICAgIGR5bmFtaWNTb3VyY2UuZm9yRWFjaCh2ID0+IHtcXG4gICAgICAgICAgICAgIGlmICghc2VhcmNoQWxsb3cuaW5jbHVkZXModikpIHtcXG4gICAgICAgICAgICAgICAgc2VhcmNoQWxsb3cucHVzaCh2LmtleSk7XFxuICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihtYW5hZ2UubGlzdCwgZ2V0TmFtZXMoKSk7XFxuICAgICAgICAgICAgcnVudGltZUNvbmZpZy5zZXRTZWFyY2hBbGxvdygpO1xcbiAgICAgICAgICAgIG1hbmFnZS5jaGFuZ2UoKTtcXG4gICAgICAgICAgfSBlbHNlIGlmIChpID09IDUpIHtcXG4gICAgICAgICAgICBsZXQgdGVtbGlzdCA9IHNlYXJjaEFsbG93LnNsaWNlKCk7XFxuICAgICAgICAgICAgc2VhcmNoQWxsb3cubGVuZ3RoID0gMDtcXG4gICAgICAgICAgICBkeW5hbWljU291cmNlLmZvckVhY2godiA9PiB7XFxuICAgICAgICAgICAgICBpZiAodGVtbGlzdC5pbmNsdWRlcyh2LmtleSkpIHJldHVybjtcXG4gICAgICAgICAgICAgIHNlYXJjaEFsbG93LnB1c2godi5rZXkpO1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIE9iamVjdC5hc3NpZ24obWFuYWdlLmxpc3QsIGdldE5hbWVzKCkpO1xcbiAgICAgICAgICAgIHJ1bnRpbWVDb25maWcuc2V0U2VhcmNoQWxsb3coKTtcXG4gICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgIH1cXG4gICAgICAgIH0sXFxuICAgICAgfSk7XFxuICAgIH1cXG4gIH0pO1xcbn1cIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuWIhuexu1wiLFwic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ICAgICAgbGV0IHQgPSBpdC5uO1xcbiAgICAgICAgICBpZiAoY2F0ZV90ZW1wW2luZGV4XSA9PSBpKSB7XFxuICAgICAgICAgICAgdCA9IFxcXCI8Yj48Zm9udCBjb2xvcj1cXFwiICsgY29sb3IgKyBcXFwiPlxcXCIgKyB0ICsgXFxcIjwvZm9udD48L2I+XFxcIjtcXG4gICAgICAgICAgICBmbFt4LmtleV0gPSBpdC52O1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIGlmIChjYXRlX3RlbXBbaW5kZXhdID09IFxcXCItMVxcXCIpIHtcXG4gICAgICAgICAgICBmbFt4LmtleV0gPSBcXFwidW5kZWZpbmVkXFxcIjtcXG4gICAgICAgICAgfVxcbiAgICAgICAgICBpZiAoZm9sZCA9PSAxKSB7XFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgdCxcXG4gICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgobykgPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgaSA9IG8uaTtcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoXFxcImlzX2RlZlxcXCIsIFxcXCIxXFxcIik7XFxuICAgICAgICAgICAgICAgIGxldCBjYXRlX29iaiA9IHN0b3JhZ2UwLmdldE15VmFyKFxcXCJjYXRlX29ialxcXCIsIHt9KTtcXG5cXG4gICAgICAgICAgICAgICAgbGV0IGNhdGVfdGVtcCA9IG8uY2F0ZV90ZW1wO1xcbiAgICAgICAgICAgICAgICBpZiAoY2F0ZV90ZW1wLmNvbnN0cnVjdG9yICE9IEFycmF5KSB7XFxuICAgICAgICAgICAgICAgICAgY2F0ZV90ZW1wID0gW107XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgbGV0IGluZGV4ID0gby5pbmRleDtcXG4gICAgICAgICAgICAgICAgbGV0IGMgPSBjYXRlX3RlbXBbaW5kZXhdIHx8IFxcXCItMVxcXCI7XFxuICAgICAgICAgICAgICAgIC8vbG9nKGMpXFxuICAgICAgICAgICAgICAgIGlmIChjID09IGkpIHtcXG4gICAgICAgICAgICAgICAgICBvLmNhdGVfdGVtcFtpbmRleF0gPSBcXFwiLTFcXFwiO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgIG8uY2F0ZV90ZW1wW2luZGV4XSA9IGkgKyBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBjYXRlX29ialtvLmNhdGVdID0gY2F0ZV90ZW1wO1xcbiAgICAgICAgICAgICAgICAvL2xvZyhjYXRlX3RlbXApXFxuICAgICAgICAgICAgICAgIC8vc3RvcmFnZTAucHV0TXlWYXIoXFxcImNhdGVfdGVtcFxcXCIsIGNhdGVfdGVtcCk7XFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKFxcXCJjYXRlX29ialxcXCIsIGNhdGVfb2JqKTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxcbiAgICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXG4gICAgICAgICAgICAgICAgaTogaSxcXG4gICAgICAgICAgICAgICAgY2F0ZTogY2F0ZVxcbiAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgICAgfSlcXG4gICAgfVxcbiAgfVxcbn1cXG5cXG5mdW5jdGlvbiBnZXRGbCgpIHtcXG4gIGZs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