Liferay.Loader.define("commerce-product-options-web@4.0.27/js/add_cp_option_value",["module","exports","require","commerce-frontend-js/ServiceProvider/index","commerce-frontend-js/utilities/modals/index","commerce-frontend-js/utilities/slugify","frontend-js-web"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({cpOptionId:e,defaultLanguageId:t,editOptionURL:r,namespace:u,windowState:c}){const d=document.getElementById(u+"fm"),l=d.querySelector("#"+u+"key"),f=d.querySelector("#"+u+"name"),s=d.querySelector("#"+u+"priority");f.addEventListener("input",(0,a.debounce)((()=>{l.value=(0,i.default)(f.value)}),200));const p=n.default.AdminCatalogAPI("v1");Liferay.provide(window,u+"apiSubmit",(()=>{o.isSubmitting();const n={id:"",key:"",name:{},priority:0};n.key=l.value,n.name[t]=f.value,n.id=e,n.priority=s.value,p.createOptionValue(e,n).then((()=>{const t=new Liferay.PortletURL.createURL(r);t.setParameter("p_p_state",c),t.setParameter("cpOptionId",e),o.closeAndRedirect(t)})).catch(o.onSubmitFail)}),["liferay-portlet-url"])};var n=c(r("commerce-frontend-js/ServiceProvider/index")),o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r("commerce-frontend-js/utilities/modals/index")),i=c(r("commerce-frontend-js/utilities/slugify")),a=r("frontend-js-web");function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function c(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=add_cp_option_value.js.map