!function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}function n(n){return function(t){if(Array.isArray(t))return e(t)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||t(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}(e,n)||t(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var i=window.ctFrontend;(0,i.registerDynamicChunk)("blocksy_mega_menu",{mount:function(e){var t=e.filter((function(e){return e.closest("ul")})).map((function(e){return parseFloat(n(e.parentNode.classList).find((function(e){return e.match(/^menu-item-\d{1,}/)})).replace("menu-item-",""))}));(function(e,t){return new Promise((function(n){var i=localStorage.getItem(blocksyMegaMenu.persistence_key+":"+e);if(i){var o=JSON.parse(i);if(o&&t.every((function(e){return o.find((function(t){return t.id===e}))})))return void n(JSON.parse(i))}var a=new FormData;a.append("ids",t.join(",")),a.append("menu_id",e),fetch("".concat(ct_localizations.ajax_url,"?action=blc_retrieve_mega_menu_content"),{method:"POST",body:a}).then((function(e){return e.json()})).then((function(t){var i=t.success,o=t.data;if(i&&o){for(var a=r(blocksyMegaMenu.persistence_key.split(":"),3),l=a[0],c=a[1],u=(a[2],[]),s=0;s<localStorage.length;s++){var f=localStorage.key(s);if(0===f.indexOf([l,c].join(":"))){var m=r(f.split(":"),4),d=m[0],y=m[1],h=(m[2],m[3]);l===d&&c===y&&h===e&&u.push(f)}}u.map((function(e){localStorage.removeItem(e)})),localStorage.setItem(blocksyMegaMenu.persistence_key+":"+e,JSON.stringify(o.content)),n(o.content)}}))}))})(e[0].closest('ul[id^="menu-"]').id.replace("menu-",""),t).then((function(t){e.filter((function(e){return e.closest("ul")})).map((function(e){var r=parseFloat(n(e.parentNode.classList).find((function(e){return e.match(/^menu-item-\d{1,}/)})).replace("menu-item-","")),i=t.find((function(e){return e.id===r}));if(i){var o=document.createElement("div");o.innerHTML=e.innerHTML;var a=document.createElement("div");a.innerHTML=i.content,e.innerHTML=a.firstElementChild.innerHTML,e.className=a.firstElementChild.className,n(e.querySelectorAll(".menu-item")).map((function(e){var t=o.querySelector("#".concat(e.id));t&&(e.firstElementChild&&t.firstElementChild&&t.matches(".ct-menu-link")&&(e.firstElementChild.innerHTML=t.firstElementChild.innerHTML),e.firstElementChild&&t.firstElementChild&&t.firstElementChild.matches(".ct-menu-link")&&(e.firstElementChild.outerHTML=t.firstElementChild.outerHTML),e.className=t.className)}))}})),ctEvents.trigger("blocksy:frontend:init")}))}})}();