Liferay.Loader.define("layout-admin-web@5.0.105/js/LayoutCustomizationSettings",["module","exports","require","@liferay/frontend-icons-web","frontend-js-web"],(function(t,e,n){window;Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){let t;const e=()=>{t=Array.from(document.querySelectorAll(".portlet-column")).map((t=>{const e=function(t){const e=Boolean(t.querySelector(".portlet-column-content.customizable")),n=document.createElement("div");n.innerHTML='\n\t\t<div class="'.concat(e?"customizable":"",' h-100">\n\t\t\t<div class="layout-customizable-controls">\n\t\t\t\t<div\n\t\t\t\t\tclass="d-inline-block lfr-portal-tooltip"\n\t\t\t\t\ttitle="').concat(Liferay.Language.get("customizable-help"),'"\n\t\t\t\t>\n\t\t\t\t\t<label class="toggle-switch">\n\t\t\t\t\t\t<span class="toggle-switch-check-bar">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclass="toggle-switch-check"\n\t\t\t\t\t\t\t\tid="TypeSettingsProperties--').concat(t.id,'-customizable--"\n\t\t\t\t\t\t\t\tname="TypeSettingsProperties--').concat(t.id,'-customizable--"\n\t\t\t\t\t\t\t\ttype="checkbox"\n\t\t\t\t\t\t\t\t').concat(e?"checked":"",'\n\t\t\t\t\t\t\t/>\n\t\n\t\t\t\t\t\t\t<span aria-hidden="true" class="toggle-switch-bar">\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclass="toggle-switch-handle"\n\t\t\t\t\t\t\t\t\tdata-label-off="').concat(Liferay.Language.get("not-customizable"),'"\n\t\t\t\t\t\t\t\t\tdata-label-on="').concat(Liferay.Language.get("customizable"),'"\n\t\t\t\t\t\t\t\t></span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</label>\n\t\t\t\t\t<svg class="d-inline-block lexicon-icon lexicon-icon-question-circle-full small text-white" role="presentation">\n\t\t\t\t\t\t<use xlink:href="').concat((0,o.getSpritemap)(),'#question-circle-full" />\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclass="customizable-layout-column-content h-100"\n\t\t\t\tstyle="opacity: 0.5;"\n\t\t\t></div>\n\t\t</div>\n\t');const l=n.querySelector("input"),i=t.querySelector(".portlet-dropzone"),c=n.firstElementChild;return l.addEventListener("change",(()=>{i.classList.toggle("portlet-dropzone-disabled",!l.checked),i.classList.toggle("customizable",l.checked),c.classList.toggle("customizable",l.checked),(0,a.fetch)(themeDisplay.getPathMain()+"/portal/update_layout",{body:(0,a.objectToFormData)({cmd:"update_type_settings",doAsUserId:themeDisplay.getDoAsUserIdEncoded(),p_auth:Liferay.authToken,p_l_id:themeDisplay.getPlid(),p_v_l_s_g_id:themeDisplay.getSiteGroupId(),[l.name]:l.checked}),method:"POST"}).then((()=>{Liferay.publish("updatedLayout",{defaultFn(){}})}))})),n}(t);t.querySelector(".portlet-dropzone").appendChild(e);return{overlay:function(t,e,{matchHeight:n,matchWidth:o,updateInterval:a}={matchHeight:!1,matchWidth:!1,updateInterval:2e3}){const l=()=>{const{height:a,left:l,top:i,width:c}=t.getBoundingClientRect();e.style.left="".concat(l,"px"),e.style.top="".concat(i,"px"),n&&(e.style.height="".concat(a,"px")),o&&(e.style.width="".concat(c,"px"))};(o||n)&&(e.style.boxSizing="border-box");e.style.position="fixed",e.style.zIndex="1";const i=setInterval(l,a);return window.addEventListener("resize",l),requestAnimationFrame(l),{dispose:()=>{clearInterval(i),window.removeEventListener("resize",l)}}}(t.querySelector(".portlet-column-content"),e,{matchHeight:!0,matchWidth:!0}),overlayElement:e}}))},n=()=>{var e;null===(e=t)||void 0===e||e.forEach((({overlay:t,overlayElement:e})=>{t.dispose(),e.parentElement.removeChild(e)})),t=[]},l=document.querySelector('input[name="manageCustomization"]'),i=()=>{l.checked?e():n()};return null==l||l.addEventListener("change",i),{dispose(){n(),null==l||l.removeEventListener("change",i)}}};var o=n("@liferay/frontend-icons-web"),a=n("frontend-js-web")}));
//# sourceMappingURL=LayoutCustomizationSettings.js.map