Liferay.Loader.define("layout-seo-web@2.0.66/js/seo/openGraph.es",["module","exports","require","frontend-js-web","./PreviewSeoEvents.es"],(function(e,t,n){window;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function _default({namespace:e,uploadOpenGraphImageURL:t}){const n=document.getElementById("".concat(e,"openGraphImageButton")),c=document.getElementById("".concat(e,"openGraphClearImageButton")),l=document.getElementById("".concat(e,"openGraphImageInput")),r=document.getElementById("".concat(e,"openGraphImageFileEntryId")),d=document.getElementById("".concat(e,"openGraphImageAlt")),p=document.getElementById("".concat(e,"openGraphImageAlt_").concat(Liferay.ThemeDisplay.getDefaultLanguageId())),i=document.querySelector('[for="'.concat(e,'openGraphImageAlt"')),openImageSelector=()=>{(0,a.openSelectionModal)({onSelect:t=>{if(t){const n=JSON.parse(t.value);r.value=n.fileEntryId,l.value=n.title,(0,o.previewSeoFireChange)(e,{type:"imgUrl",value:n.url}),(0,a.toggleDisabled)([c,d,p,i],!1)}},selectEventName:"".concat(e,"openGraphImageSelectedItem"),title:Liferay.Language.get("open-graph-image"),url:t})};n.addEventListener("click",openImageSelector),l.addEventListener("click",openImageSelector),c.addEventListener("click",(()=>{r.value="",l.value="",(0,a.toggleDisabled)([c,d,p,i],!0),(0,o.previewSeoFireChange)(e,{type:"imgUrl",value:""})}));const g=document.getElementById("".concat(e,"openGraphTitleEnabled")),u=document.getElementById("".concat(e,"openGraphTitle")),m=document.getElementById("".concat(e,"openGraphTitle_").concat(Liferay.ThemeDisplay.getLanguageId())),s=document.getElementById("".concat(e,"openGraphTitleWrapper"));g.addEventListener("click",(t=>{const n=!t.target.checked,c=s.querySelector("label");(0,a.toggleDisabled)([u,m,c],n),(0,o.previewSeoFireChange)(e,{disabled:n,type:"title",value:u.value})}));const y=document.getElementById("".concat(e,"openGraphDescriptionEnabled")),I=document.getElementById("".concat(e,"openGraphDescription")),h=document.getElementById("".concat(e,"openGraphDescription_").concat(Liferay.ThemeDisplay.getLanguageId())),v=document.getElementById("".concat(e,"openGraphDescriptionWrapper"));y.addEventListener("click",(t=>{const n=!t.target.checked,c=v.querySelector("label");(0,a.toggleDisabled)([I,h,c],n),(0,o.previewSeoFireChange)(e,{disabled:n,type:"description",value:I.value})}))};var a=n("frontend-js-web"),o=n("./PreviewSeoEvents.es")}));
//# sourceMappingURL=openGraph.es.js.map