Liferay.Loader.define("asset-publisher-web@5.0.88/js/SelectStructureField",["module","exports","require","frontend-js-web"],(function(e,t,n){window;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function _default({assetClassName:e,eventName:t,getFieldItemURL:n,namespace:c}){const o=document.getElementById("".concat(c,"fieldName")),d=document.getElementById("".concat(c,"selectDDMStructureFieldForm")),l=[],s=(0,a.delegate)(d,"click","#".concat(c,"applyButton"),(function onClickApplyButton(){Liferay.component("".concat(c,"ddmForm")).updateDDMFormInputValue();const n=document.getElementById("".concat(c,"fieldForm"));document.getElementById("".concat(c,"name")).value=o.value,(0,a.fetch)(n.action,{body:new FormData(n),method:"POST"}).then((e=>e.json())).then((n=>{const d=document.getElementById("".concat(c,"message"));n.success?(d.classList.add("hide"),(0,a.getOpener)().Liferay.fire(t,{data:{className:e,displayValue:n.displayValue,label:o.options[o.selectedIndex].label,name:o.value,value:n.value}}),(0,a.getWindow)().destroy()):d.classList.remove("hide")}))}));l.push(s);const u=document.getElementById("".concat(c,"selectDDMStructureFieldContainer")),onChangeField=()=>{""!==o.value?(0,a.fetch)(n,{body:(0,a.objectToFormData)({["".concat(c,"name")]:o.value}),method:"POST"}).then((e=>e.text())).then((e=>{u.innerHTML=e,(0,a.runScriptsInElement)(u)})):u.innerHTML=""};onChangeField();const r=(0,a.delegate)(d,"change","select#".concat(c,"fieldName"),onChangeField);return l.push(r),{dispose(){l.forEach((e=>e.dispose()))}}};var a=n("frontend-js-web")}));
//# sourceMappingURL=SelectStructureField.js.map