Liferay.Loader.define("@liferay/commerce-product-definitions-web@7.0.115/js/utils",["module","exports","require","frontend-js-web/index"],(function(e,t,i){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.isRequired=t.initialSkuOptionsAtomState=t.getSkuOptionsErrors=t.getProductOptionName=t.getName=t.getInitialProductOptionValue=void 0;var r=i("frontend-js-web/index");const getInitialProductOptionValue=e=>{if(!e.productOptionValues)return;const t=e.productOptionValues.find((e=>!0===e.preselected));return t||(e.skuContributor?e.productOptionValues[0]:void 0)};t.getInitialProductOptionValue=getInitialProductOptionValue;const getName=(e,t,i,o,n)=>((0,r.isObject)(t)&&((t=t[Liferay.ThemeDisplay.getLanguageId()])||(t=t[Liferay.ThemeDisplay.getDefaultLanguageId()])),i!==e&&o&&n?t+n:t);t.getName=getName;const getProductOptionName=e=>((0,r.isObject)(e)&&((e=e[Liferay.ThemeDisplay.getLanguageId()])||(e=e[Liferay.ThemeDisplay.getDefaultLanguageId()])),e);t.getProductOptionName=getProductOptionName;const getSkuOptionsErrors=(e,t,i)=>e?[...i.errors,{hasErrors:!0,id:t.id}]:i.errors.filter((e=>e.id!==t.id));t.getSkuOptionsErrors=getSkuOptionsErrors;const e={errors:[],namespace:"",skuOptions:[],updating:!1};t.initialSkuOptionsAtomState=e;const isRequired=(e,t,i)=>t?e:e||i.required||i.skuContributor;t.isRequired=isRequired}}));
//# sourceMappingURL=utils.js.map