(function(){$(`.gjs-editor`).append($(`#toggle-sidebar`)),$(`.gjs-pn-panels`).prepend($(`#sidebar-header`)),$(`.gjs-pn-panels`).append($(`#sidebar-bottom-buttons`)),$(`#toggle-sidebar`).click(function(){$(`#gjs`).toggleClass(`sidebar-collapsed`),t()}),e(),window.editor.on(`run:open-sm`,function(e){$(`.gjs-trt-traits`).parent().parent().css(`display`,`none`),$(`.gjs-sm-sectors`).parent().parent().css(`display`,`block`),$(`#gjs-sm-advanced .gjs-sm-properties`).append($(`.gjs-clm-tags`))}),window.editor.on(`run:open-tm`,function(e){$(`.gjs-sm-sectors`).parent().parent().css(`display`,`none`),$(`.gjs-trt-traits`).parent().parent().css(`display`,`block`)}),window.editor.on(`block:drag:start`,function(t){e()}),window.editor.on(`rteToolbarPosUpdate`,function(e){window.editor&&window.editor.getSelected()&&window.editor.getSelected().getEl()&&setTimeout(function(){let t=$(`.gjs-rte-toolbar`).first();if(t.offset().top0&&t.css(`top`,n+`px`)}},0)});function e(){$(window).width()<1e3&&($(`#gjs`).addClass(`sidebar-collapsed`),t())}function t(){window.editor.trigger(`change:canvasOffset canvasScroll`)}let n=!1;$(document).keydown(function(e){e.which===8&&(n=!0)}).keyup(function(e){e.which===8&&(n=!1)}),$(window).on(`beforeunload`,function(e){n&&e.preventDefault()});function r(){$(`.gjs-blocks-cs`).prepend($(`#block-search`))}window.addEventListener(`message`,i,!1);function i(e){e.data===`page-loaded`?($(`#phpb-loading`).addClass(`loaded`),r(),window.isLoaded=!0,$(window).trigger(`pagebuilder-page-loaded`)):e.data===`touch-start`&&window.touchStart()}$(document).on(`input`,`#block-search input`,function(){let e=$(this).val().toLowerCase();$(`.gjs-block-category`).each(function(){let t=!1;$(this).find(`.gjs-block`).each(function(){$(this).data(`original-html`)||$(this).data(`original-html`,$(this).html());let n=$(this).text();if(n.toLowerCase().includes(e)){$(this).removeClass(`d-none`),t=!0;let r=RegExp(`(`+e+`)`,`gi`),i=n.replace(r,`$1`);$(this).find(`.gjs-block-label`).html($(this).data(`original-html`).replace(n.trim(),i))}else $(this).addClass(`d-none`)}),$(this).removeClass(`d-none`),t||$(this).addClass(`d-none`)})}),window.customBuilderScripts={},window.editor.on(`component:create`,e=>{if(e.components().length){let t=e.components().models[e.components().length-1];if(t.attributes.type===`script`){let n=e.attributes.attributes[`block-id`];n===void 0&&(n=e.attributes.attributes.id);let r=t,i=!1;for(;r.parent();)if(r=r.parent(),r.attributes.attributes[`phpb-content-container`]){i=!0;break}i&&(window.customBuilderScripts[n]=t.toHTML(),t.remove())}}}),window.editor.on(`component:add`,function(e){if(e.attributes[`run-builder-script`]!==void 0){let t=customBuilderScripts;window.customBuilderScripts[e.attributes[`block-id`]]=customBuilderScripts[e.attributes[`run-builder-script`]],runScriptsOfComponentAndChildren(e),window.customBuilderScripts=t,delete e.attributes[`run-builder-script`]}}),window.editor.on(`sorter:drag:end`,function(e){let t=e.modelToDrop;t&&t.attributes&&(t.attributes[`block-id`]||t.attributes.id)&&window.runScriptsOfComponentAndChildren(t);for(let e in CKEDITOR.instances)CKEDITOR.instances[e].destroy(!0)}),window.runScriptsOfComponentAndChildren=function(e){a(e),e.components().each(function(e){runScriptsOfComponentAndChildren(e)})};function a(e){let t=e.attributes[`block-id`];if(t===void 0&&(t=e.attributes.attributes.id),t&&window.customBuilderScripts[t]!==void 0){let n=e.attributes[`style-identifier`],r=$(``).append(window.customBuilderScripts[t]);r.find(`script`).prepend(`let inPageBuilder = true;`),r.find(`script`).prepend(`let blockSelector = ".`+n+`";`),r.find(`script`).prepend(`let block = document.getElementsByClassName("`+n+`")[0];`),r.find(`script`).prepend(`(function(){`),r.find(`script`).append(`})();`);let i=document.createElement(`script`);i.type=`text/javascript`,i.innerHTML=r.find(`script`).html(),window.editor.Canvas.getDocument().body.appendChild(i)}}function o(){c();let e=document.createElement(`script`);e.type=`text/javascript`,e.src=window.injectionScriptUrl;let t=e.outerHTML+`