"use strict";(()=>{var o=Backbone.Model.extend({defaults:{isSticky:!1,colorScheme:!1,currentBgColor:null,dataAttrs:{sticky:"data-lqd-is-sticky",containerSticky:"data-lqd-container-is-sticky",widgetSticky:"data-lqd-widget-is-sticky",bodyScheme:"data-lqd-page-color-scheme"}}}),r=Backbone.View.extend({id:"lqd-switch-state",template:_.template(`<div class="lqd-switch-state-title"><h3>Simulator</h3></div>
	<button id="lqd-switch-state-sticky" class="lqd-switch-state-btn" title="Switch sticky header" aria-label="Switch sticky header"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-credit-card"><rect x="1" y="4" width="22" height="16" rx="2" ry="2"/><rect x="1" y="4" width="22" height="7" rx="2" ry="2" fill="currentColor" stroke="none"></rect></svg><span>Sticky</span></button>
	<button id="lqd-switch-state-dark-bg" class="lqd-switch-state-btn" data-scheme="dark" title="Switch dark scheme" aria-label="Switch dark scheme"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg><span>Dark</span></button>`),events:{"click #lqd-switch-state-sticky":"setSticky","click #lqd-switch-state-dark-bg":"setScheme"},currentScheme:null,liquidApp:null,initialize:function(){if(this.render(),this.liquidApp=elementorFrontend.elements.$window[0].liquid.app,elementorFrontend?.config?.experimentalFeatures?.editor_v2){let t=document.querySelector(".MuiGrid-container:nth-child(2) > div"),i=t?.querySelector(".MuiDivider-fullWidth, .eui-divider")?.cloneNode();this.el.classList.add("lqd-switch-state-inline"),t?.insertAdjacentElement("beforeend",this.el),t?.insertAdjacentElement("beforeend",i)}else this.el.classList.add("lqd-switch-state-floating"),document.body.insertAdjacentElement("beforeend",this.el);this.listenTo(this.model,"change:isSticky",this.onStickyChange),this.listenTo(this.model,"change:colorScheme",this.onSchemeChange)},render:function(){return this.el.innerHTML=this.template(),this},setSticky:function(t){this.model.set("isSticky",!this.model.get("isSticky")),t.currentTarget.classList.toggle("lqd-is-active",this.model.get("isSticky"))},setBgColor:function(t){let i=t.currentTarget.dataset.bgColor;this.model.set("currentBgColor",i)},setScheme:function(t){let i=t.currentTarget,e=i.dataset.scheme;switch(i.classList.toggle("lqd-is-active"),e===this.currentScheme&&(e=null),this.currentScheme=e,e){case"dark":this.model.set({colorScheme:"dark"});break;default:this.model.set({colorScheme:!1})}},onSchemeChange:function(t,i){let{bodyScheme:e}=this.model.get("dataAttrs");elementorFrontend.elements.$body[0].setAttribute(e,i)},onStickyChange:function(t,i){let{containerSticky:e,sticky:n}=this.model.get("dataAttrs"),l=this.liquidApp.layoutRegions.liquidPageHeader?.model?.get("childrenCollection")?.filter(s=>s.get("isTopLevelContainer")&&!s.view.el.hasAttribute("data-lqd-hide-on-sticky"));(this.liquidApp.layoutRegions.liquidPageHeader?.model?.get("childrenCollection")?.filter(s=>s.get("isTopLevelContainer")&&s.view.el.hasAttribute("data-lqd-hide-on-sticky"))).forEach(s=>{i?s.view.el.style.display="none":s.view.el.style.display=""}),l.forEach(s=>{i?(s.view.el.setAttribute(n,"true"),s.view.el.setAttribute(e,"true")):(s.view.el.removeAttribute(n),s.view.el.removeAttribute(e))})}});(()=>{"use strict";async function t(i){let e=document.querySelectorAll(".liquid-page-refresh");e.forEach(n=>n.setAttribute("disabled",!0)),elementor.saver.isEditorChanged()||_.defer(()=>{e.forEach(n=>n.removeAttribute("disabled"))}),await $e.run("document/save/update",{force:!0}),elementor.reloadPreview(),elementor.once("preview:loaded",()=>{_.defer(()=>{e.forEach(n=>n.removeAttribute("disabled")),$e.route("panel/page-settings/settings")})})}elementor.once("preview:loaded",()=>{if([...elementor.$previewContents[0].body.classList].find(e=>e.startsWith("single-liquid"))==="single-liquid-header"){let e=new o;new r({model:e})}}),elementor.channels.editor.on("liquid:page:refresh",t)})();})();
