diff --git a/js/script.js b/js/script.js index 78a8530897..68b8f9ee0f 100755 --- a/js/script.js +++ b/js/script.js @@ -1126,161 +1126,6 @@ var π, π1, πd; π.mods.push(init); })(); -/******************************************************************** - π-pushmenu.js - // TODO: USAGE AND API REFERENCE - ______________________________________________ - DEPENDENCIES: - - HAL.js - - ______________________________________________ - DATA ATTRIBUTES: - - side: ["left", "right"] - ______________________________________________ - MARKUP AND DEFAULTS: - -
- -elsewhere... - - - - ______________________________________________ - GENERATED HTML: - - - ______________________________________________ - API - - - ***************************************************************************************/ - -π.pushmenu = (function(){ - var allPushMenus = {}; - - function init(){ - π('[data-auto-burger]').forEach(function(container){ - var id = container.getAttribute('data-auto-burger'); - - var autoBurger = πd(id) || π.div('pi-pushmenu', id); - var ul = autoBurger.π1('ul') || π.ul(); - - container.π('a[href], button').forEach(function (obj) { - if (!booleanAttributeValue(obj, 'data-auto-burger-exclude', false)) { - var clone = obj.cloneNode(true); - clone.id = ''; - - if (clone.tagName == "BUTTON") { - var aTag = π.srcElement('a'); - aTag.href = ''; - aTag.innerHTML = clone.innerHTML; - aTag.onclick = clone.onclick; - clone = aTag; - } - ul.add(π.li(0, 0, clone)); - } - }); - - autoBurger.add(ul); - π1('body').add(autoBurger); - }); - - π(".pi-pushmenu").forEach(function(el){ - allPushMenus[el.id] = PushMenu(el); - }); - - π.setTriggers('pushmenu', π.pushmenu); - } - - function show(objId) { - allPushMenus[objId].expose(); - } - - // TODO: dismiss on click? - // this works: - - //π('.pi-pushmenu li a').forEach(function(a){ - // a.onclick = function(){ - // this.parent('.pi-pushmenu').π1('.pi-modal-close-button').click(); - // console.log("message"); - // }; - //}); - - - function PushMenu(el) { - var html = π1('html'); - var body = π1('body'); - - var overlay = π.div("overlay"); - var content = π.div('content', null, el.π1('*')); - - var side = el.getAttribute("data-side") || "right"; - - var sled = π.div("sled"); - sled.css(side, 0); - - var topBar = π.div("top-bar"); - - topBar.fill(π.modalCloseButton(closeMe)); - sled.fill([topBar, content]); - - overlay.fill(sled); - el.fill(overlay); - - sled.onclick = function(e){ - e.stopPropagation(); - }; - - overlay.onclick = closeMe; - - π.listen(closeMe, 'resize'); - - function closeMe(e) { - var t = e.target; - if (t == sled || t == topBar) return; - - el.killClass("on"); - setTimeout(function(){ - el.css({display: "none"}); - - body.killClass("overlay-on"); - }, 300); - } - - function exposeMe(){ - body.addClass("overlay-on"); // in the default config, kills body scrolling - - el.css({ - display: "block", - zIndex: π.highestZ() - }); - setTimeout(function(){ - el.addClass("on"); - }, 10); - } - - return { - expose: exposeMe - }; - } - - π.mods.push(init); - - return { - show: show - }; -})(); - /******************************************************************** π-accordion.JS USAGE AND API REFERENCE @@ -1507,6 +1352,161 @@ elsewhere... // π.mods are loaded after DOMContentLoaded π.mods.push(init); })(); +/******************************************************************** + π-pushmenu.js + // TODO: USAGE AND API REFERENCE + ______________________________________________ + DEPENDENCIES: + + HAL.js + + ______________________________________________ + DATA ATTRIBUTES: + + side: ["left", "right"] + ______________________________________________ + MARKUP AND DEFAULTS: + + + +elsewhere... + + + + ______________________________________________ + GENERATED HTML: + + + ______________________________________________ + API + + + ***************************************************************************************/ + +π.pushmenu = (function(){ + var allPushMenus = {}; + + function init(){ + π('[data-auto-burger]').forEach(function(container){ + var id = container.getAttribute('data-auto-burger'); + + var autoBurger = πd(id) || π.div('pi-pushmenu', id); + var ul = autoBurger.π1('ul') || π.ul(); + + container.π('a[href], button').forEach(function (obj) { + if (!booleanAttributeValue(obj, 'data-auto-burger-exclude', false)) { + var clone = obj.cloneNode(true); + clone.id = ''; + + if (clone.tagName == "BUTTON") { + var aTag = π.srcElement('a'); + aTag.href = ''; + aTag.innerHTML = clone.innerHTML; + aTag.onclick = clone.onclick; + clone = aTag; + } + ul.add(π.li(0, 0, clone)); + } + }); + + autoBurger.add(ul); + π1('body').add(autoBurger); + }); + + π(".pi-pushmenu").forEach(function(el){ + allPushMenus[el.id] = PushMenu(el); + }); + + π.setTriggers('pushmenu', π.pushmenu); + } + + function show(objId) { + allPushMenus[objId].expose(); + } + + // TODO: dismiss on click? + // this works: + + //π('.pi-pushmenu li a').forEach(function(a){ + // a.onclick = function(){ + // this.parent('.pi-pushmenu').π1('.pi-modal-close-button').click(); + // console.log("message"); + // }; + //}); + + + function PushMenu(el) { + var html = π1('html'); + var body = π1('body'); + + var overlay = π.div("overlay"); + var content = π.div('content', null, el.π1('*')); + + var side = el.getAttribute("data-side") || "right"; + + var sled = π.div("sled"); + sled.css(side, 0); + + var topBar = π.div("top-bar"); + + topBar.fill(π.modalCloseButton(closeMe)); + sled.fill([topBar, content]); + + overlay.fill(sled); + el.fill(overlay); + + sled.onclick = function(e){ + e.stopPropagation(); + }; + + overlay.onclick = closeMe; + + π.listen(closeMe, 'resize'); + + function closeMe(e) { + var t = e.target; + if (t == sled || t == topBar) return; + + el.killClass("on"); + setTimeout(function(){ + el.css({display: "none"}); + + body.killClass("overlay-on"); + }, 300); + } + + function exposeMe(){ + body.addClass("overlay-on"); // in the default config, kills body scrolling + + el.css({ + display: "block", + zIndex: π.highestZ() + }); + setTimeout(function(){ + el.addClass("on"); + }, 10); + } + + return { + expose: exposeMe + }; + } + + π.mods.push(init); + + return { + show: show + }; +})(); + var kub = (function () { π.listen(init); @@ -1615,9 +1615,8 @@ var kub = (function () { }); if (currentLink) { - console.log("yup"); currentLink.parents('div.item').forEach(function (parent) { - parent.addClass('on'); + parent.π1('.title').click(); }); } } @@ -1707,4 +1706,4 @@ var kub = (function () { })(); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFsZi5qcyIsIs+ALmpzIiwiSEFMLmpzIiwiz4Atc3RhdHVzLmpzIiwiz4AtYmFzZUNvbXBvbmVudHMuanMiLCLPgC1wdXNobWVudS/PgC1wdXNobWVudS5qcyIsIs+ALWFjY29yZGlvbi/PgC1hY2NvcmRpb24uanMiLCLPgC1kaWFsb2cvz4AtZGlhbG9nLmpzIiwic2NyaXB0LmpzIl0sIm5hbWVzIjpbXSwib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cikge1xuXHRcdHJldHVybiBkLmEoc2VsZWN0b3IpO1xuXHR9O1xuXG5cdM+AMSA9IGZ1bmN0aW9uIChzZWxlY3Rvcikge1xuXHRcdHJldHVybiBkLnEoc2VsZWN0b3IpO1xuXHR9O1xuXG5cdM+AZCA9IGZ1bmN0aW9uKGlkKSB7XG5cdFx0cmV0dXJuIGQuZyhpZCk7XG5cdH07XG5cblx0LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXG5cdCAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxuXHQgKioqKlxuXHQgKioqKiAgRE9NIEVMRU1FTlQgQ1JFQVRJT04vSU5JVElBTElaQVRJT05cblx0ICoqKipcblx0ICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXG5cdCAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi9cblxuXHRcdC8vIHRoaXMgaXMgdGhlIGJhc2UgY3JlYXRlL2luaXQgbWV0aG9kLCBlLmdcblx0XHQvLyBuZXdEb21FbGVtZW50KCdwJywgJ2FydGljbGUtY29udGVudCcsICd0aGVGaXJzdE9mTWFueScpXG5cdM+ALm5ld0RPTUVsZW1lbnQgPSBmdW5jdGlvbih0YWdOYW1lLCBjbGFzc05hbWUsIGlkKSB7XG5cdFx0dmFyIGVsID0gZC5jcmVhdGVFbGVtZW50KHRhZ05hbWUpO1xuXG5cdFx0aWYgKGNsYXNzTmFtZSlcblx0XHRcdGVsLmNsYXNzTmFtZSA9IGNsYXNzTmFtZTtcblxuXHRcdGlmIChpZClcblx0XHRcdGVsLmlkID0gaWQ7XG5cblx0XHRyZXR1cm4gZWw7XG5cdH07XG5cbi8vIGJhc2UgZWxlbWVudCB3aXRoIGNvbnRlbnQgcGFzc2VkIGluLCBlLmdcbi8vIM+ALmNvbnRlbnRFbGVtZW50KCdwJywgJ2FydGljbGUtY29udGVudCcs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YW1lLCBpZCwgY29udGVudCk7IH07XG5cdM+ALnNwYW4gPSBmdW5jdGlvbihjbGFzc05hbWUsIGlkLCBjb250ZW50KXsgcmV0dXJuIM+ALmNvbnRlbnRFbGVtZW50KFwic3BhblwiLCBjbGFzc05hbWUsIGlkLCBjb250ZW50KTsgfTtcblx0z4AudWwgPSBmdW5jdGlvbihjbGFzc05hbWUsIGlkLCBjb250ZW50KXsgcmV0dXJuIM+ALmNvbnRlbnRFbGVtZW50KFwidWxcIiwgY2xhc3NOYW1lLCBpZCwgY29udGVudCk7IH07XG5cdM+ALmxpID0gZnVuY3Rpb24oY2xhc3NOYW1lLCBpZCwgY29udGVudCl7IHJldHVybiDPgC5jb250ZW50RWxlbWVudChcImxpXCIsIGNsYXNzTmFtZSwgaWQsIGNvbnRlbnQpOyB9O1xuXG5cdC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxuXHQgKioqKlxuXHQgKioqKiAgSFRNTEVMRU1FTlQvTk9ERSBQUk9UT1RZUEUgTUVUSE9EUyAoanF1ZXJ5LWl6YXRpb25zKVxuXHQgKioqKlxuXHQgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovXG5cblx0SFRNTEVsZW1lbnQucHJvdG90eXBlLndyYXAgPSBOb2RlLnByb3RvdHlwZS53cmFwID0gZnVuY3Rpb24oY29udGVudCl7XG5cdFx0dmFyIHdyYXBwZXIgPSB0aGlzO1xuXHRcdGlmICghY29udGVudC5mb3JFYWNoKSBjb250ZW50ID0gW2NvbnRlbnRdO1xuXG5cdFx0dmFyIHBhcmVudCA9IGNvbnRlbnRbMF0ucGFyZW50Tm9kZTtcblx0XHRwYXJlbnQuaW5zZXJ0QmVmb3JlKHdyYXBwZXIsIGNvbnRlbnRbMF0pO1xuXG5cdFx0Y29udGVudC5mb3JFYWNoKGZ1bmN0aW9uKGVs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SkoKTtcbiIsIi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxuIM+ALXB1c2htZW51LmpzXG4gLy8gVE9ETzogIFVTQUdFIEFORCBBUEkgUkVGRVJFTkNFXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIERFUEVOREVOQ0lFUzpcblxuIEhBTC5qc1xuXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIERBVEEgQVRUUklCVVRFUzpcblxuIHNpZGU6IFtcImxlZnRcIiwgXCJyaWdodFwiXVxuIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19cbiBNQVJLVVAgQU5EIERFRkFVTFRTOlxuXG5cdDxkaXYgY2xhc3M9XCJwaS1wdXNobWVudVwiIGlkPVwibXlQdXNoTWVudVwiPlxuXHRcdCA8dWw+XG5cdFx0XHQgPGxpPjxhIGhyZWY9XCIjXCI+Zm9vPC9hPjwvbGk+XG5cdFx0XHQgPGxpPjxhIGhyZWY9XCIjXCI+YmFyPC9hPjwvbGk+XG5cdFx0XHQgPGxpPjxhIGhyZWY9XCIjXCI+Z3Jvbms8L2E+PC9saT5cblx0XHRcdCA8bGk+PGEgaHJlZj1cIiNcIj5mbGVlYmxlczwvYT48L2xpPlxuXHRcdFx0IDxsaT48YSBocmVmPVwiI1wiPnNlcHVsdmVkYTwvYT48L2xpPlxuXHRcdCA8L3VsPlxuXHQ8L2Rpdj5cblxuZWxzZXdoZXJlLi4uXG5cbiA8YnV0dG9uIG9uY2xpY2s9XCLPgC1wdXNobWVudS5zaG93KCdteVB1c2hNZW51JylcIj5zaG93IG1lbnU8L2J1dHRvbj5cblxuIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19cbiBHRU5FUkFURUQgSFRNTDpcblxuXHRcbiBfX19fX19fX19fX19fX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xuIM+ALWRpYWxvZy5qc1xuIFVTQUdFIEFORCBBUEkgUkVGRVJFTkNFXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIERFUEVOREVOQ0lFUzpcblxuIM+ALmpzXG5cbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gREFUQSBBVFRSSUJVVEVTOlxuXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIE1BUktVUCBBTkQgREVGQVVMVFM6XG5cbiA8ZGl2IGNsYXNzPVwibmV3X21vZHVsZVwiPlxuXG4gPC9kaXY+XG5cbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gR0VORVJBVEVEIEhUTUw6XG5cbiA8ZGl2IGNsYXNzPVwibmV3X21vZHVsZVwiPlxuXG4gPC9kaXY+XG5cbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gQVBJXG5cbiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovXG5cbihmdW5jdGlvbigpe1xuXHTPgC5kaWFsb2cgPSB7XG5cdFx0c2hvdzogz4AubW9kYWxPdmVybGF5LnNob3csXG5cdFx0c3Bhd246IHNwYXduLFxuXHRcdGFjdGlvbnM6IHt9XG5cdH07XG5cblx0ZnVuY3Rpb24gaW5pdCgpIHtcblx0XHTPgCgnLnBpLWRpYWxvZycpLmZvckVhY2goz4AuZGlhbG9nLnNwYXduKTtcblx0XHTPgC5zZXRUcmlnZ2VycygnZGlhbG9nJywgz4AubW9kYWxPdmVybGF5KTtcblx0fVxuXG5cdGZ1bmN0aW9uIHNwYXduKGVsKXtcblx0XHR2YXIgY29udGVudEJveCA9IM+ALmRpdignY29udGVudC1ib3gnLCAwLCBlbC5pbm5lckh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29uZHNGb3JUcmFuc2l0aW9uKGVsLCAndHJhbnNmb3JtJylcblxuXHR2YXIgc3R5bGVzID0gZ2V0Q29tcHV0ZWRTdHlsZShlbGVtZW50KTtcblx0dmFyIGlkeCA9IHN0eWxlcy50cmFuc2l0aW9uUHJvcGVydHkuc3BsaXQoJywgJykuaW5kZXhPZih0cmFuc2l0aW9uUHJvcGVydHkpO1xuXG5cdHJldHVybiAocGFyc2VGbG9hdChzdHlsZXMudHJhbnNpdGlvbkR1cmF0aW9uLnNwbGl0KCcsICcpW2lkeF0pICsgcGFyc2VGbG9hdChzdHlsZXMudHJhbnNpdGlvbkRlbGF5LnNwbGl0KCcsICcpW2lkeF0pKSAqIDEwMDA7XG59XG5cbmZ1bmN0aW9uIHBjdChuKSB7XG5cdHJldHVybiBuICsgJyUnO1xufVxuXG5mdW5jdGlvbiBweChuKXtcblx0cmV0dXJuIG4gKyAncHgnO1xufVxuIiwidmFyIM+ALCDPgDEsIM+AZDtcbihmdW5jdGlvbigpe1xuXHQvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipcblx0ICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXG5cdCAqKioqXG5cdCAqKioqICDPgCBDT1JFXG5cdCAqKioqXG5cdCAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxuXHQgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovXG5cdHZhciBkID0gZG9jdW1lbnQ7XG5cdGQuZyA9IGQuZ2V0RWxlbWVudEJ5SWQ7XG5cdGQucSA9IGQucXVlcnlTZWxlY3Rvcjtcblx0ZC5hID0gZC5xdWVyeVNlbGVjdG9yQWxsO1xuXHRkLnQgPSBkLmdldEVsZW1lbnRzQnlUYWdOYW1lO1xuXG5cdM+AID0gZnVuY3Rpb24oc2VsZWN0b3IpIHtcblx0XHRyZXR1cm4gZC5hKHNlbGVjdG9yKTtcblx0fTtcblxuXHTPgDEgPSBmdW5jdGlvbiAoc2VsZWN0b3IpIHtcblx0XHRyZXR1cm4gZC5xKHNlbGVjdG9yKTtcblx0fTtcblxuXHTPgGQgPSBmdW5jdGlvbihpZCkge1xuXHRcdHJldHVybiBkLmcoaWQpO1xuXHR9O1xuXG5cdC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxuXHQgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipcblx0ICoqKipcblx0ICoqKiogIERPTSBFTEVNRU5UIENSRUFUSU9OL0lOSVRJQUxJWkFUSU9OXG5cdCAqKioqXG5cdCAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxuXHQgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovXG5cblx0XHQvLyB0aGlzIGlzIHRoZSBiYXNlIGNyZWF0ZS9pbml0IG1ldGhvZCwgZS5nXG5cdFx0Ly8gbmV3RG9tRWxlbWVudCgncCcsICdhcnRpY2xlLWNvbnRlbnQnLCAndGhlRmlyc3RPZk1hbnknKVxuXHTPgC5uZXdET01FbGVtZW50ID0gZnVuY3Rpb24odGFnTmFtZSwgY2xhc3NOYW1lLCBpZCkge1xuXHRcdHZhciBlbCA9IGQuY3JlYXRlRWxlbWVudCh0YWdOYW1lKTtcblxuXHRcdGlmIChjbGFzc05hbWUpXG5cdFx0XHRlbC5jbGFzc05hbWUgPSBjbGFzc05hbWU7XG5cblx0XHRpZiAoaWQpXG5cdFx0XHRlbC5pZCA9IGlkO1xuXG5cdFx0cmV0dXJuIGVsO1xuXHR9O1xuXG4vLyBiYXNlIGVsZW1lbnQgd2l0aCBjb250ZW50IHBhc3NlZCBpbiwgZS5nXG4vLyDPgC5jb250ZW50RWxlbWVudCgncCcsICdhcnRpY2xlLWNvbnRlbnQnLCAndGhlRmlyc3RPZk1hbnknLCAnPHNw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tZSwgaWQsIGNvbnRlbnQpOyB9O1xuXHTPgC5zcGFuID0gZnVuY3Rpb24oY2xhc3NOYW1lLCBpZCwgY29udGVudCl7IHJldHVybiDPgC5jb250ZW50RWxlbWVudChcInNwYW5cIiwgY2xhc3NOYW1lLCBpZCwgY29udGVudCk7IH07XG5cdM+ALnVsID0gZnVuY3Rpb24oY2xhc3NOYW1lLCBpZCwgY29udGVudCl7IHJldHVybiDPgC5jb250ZW50RWxlbWVudChcInVsXCIsIGNsYXNzTmFtZSwgaWQsIGNvbnRlbnQpOyB9O1xuXHTPgC5saSA9IGZ1bmN0aW9uKGNsYXNzTmFtZSwgaWQsIGNvbnRlbnQpeyByZXR1cm4gz4AuY29udGVudEVsZW1lbnQoXCJsaVwiLCBjbGFzc05hbWUsIGlkLCBjb250ZW50KTsgfTtcblxuXHQvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipcblx0ICoqKipcblx0ICoqKiogIEhUTUxFTEVNRU5UL05PREUgUFJPVE9UWVBFIE1FVEhPRFMgKGpxdWVyeS1pemF0aW9ucylcblx0ICoqKipcblx0ICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqL1xuXG5cdEhUTUxFbGVtZW50LnByb3RvdHlwZS53cmFwID0gTm9kZS5wcm90b3R5cGUud3JhcCA9IGZ1bmN0aW9uKGNvbnRlbnQpe1xuXHRcdHZhciB3cmFwcGVyID0gdGhpcztcblx0XHRpZiAoIWNvbnRlbnQuZm9yRWFjaCkgY29udGVudCA9IFtjb250ZW50XTtcblxuXHRcdHZhciBwYXJlbnQgPSBjb250ZW50WzBdLnBhcmVudE5vZGU7XG5cdFx0cGFyZW50Lmluc2VydEJlZm9yZSh3cmFwcGVyLCBjb250ZW50WzBdKTtcblxuXHRcdGNvbnRlbnQuZm9yRWFjaChmdW5jdGlvbihlbCl7XG5cdFx0XHR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24oKXtcblx0XHRcdFx0XHRcdHRoaXNXcmFwcGVyLmNzcyh7aGVpZ2h0OiAnJ30pO1xuXHRcdFx0XHRcdFx0bW92aW5nID0gZmFsc2U7XG5cdFx0XHRcdFx0fSwgZHVyYXRpb24pO1xuXHRcdFx0XHR9XG5cdFx0XHR9XG5cblx0XHRcdHZhciBpbm5lckNvbnRhaW5lcnMgPSBjb250ZW50Ls+AKCc6c2NvcGUgPiAuY29udGFpbmVyJyk7XG5cdFx0XHRpZiAoaW5uZXJDb250YWluZXJzLmxlbmd0aCA+IDApIHtcblx0XHRcdFx0aW5uZXJDb250YWluZXJzLmZvckVhY2goUGlBY2NvcmRpb24pO1xuXHRcdFx0fVxuXHRcdH0pO1xuXHR9XG5cblx0z4AubW9kcy5wdXNoKGluaXQpO1xufSkoKTtcbiIsIi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxuIM+ALWRpYWxvZy5qc1xuIFVTQUdFIEFORCBBUEkgUkVGRVJFTkNFXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIERFUEVOREVOQ0lFUzpcblxuIM+ALmpzXG5cbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gREFUQSBBVFRSSUJVVEVTOlxuXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIE1BUktVUCBBTkQgREVGQVVMVFM6XG5cbiA8ZGl2IGNsYXNzPVwibmV3X21vZHVsZVwiPlxuXG4gPC9kaXY+XG5cbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gR0VORVJBVEVEIEhUTUw6XG5cbiA8ZGl2IGNsYXNzPVwibmV3X21vZHVsZVwiPlxuXG4gPC9kaXY+XG5cbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19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