Liferay.Loader.define("@liferay/search-experiences-web@3.0.30/sxp_blueprint_admin/js/utils/sxp_element/get_ui_configuration_values",["module","exports","require","liferay!search-experiences-web$moment","../functions/to_number","../types/inputTypes","./clean_ui_configuration","./get_sxp_element_json"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function getUIConfigurationValues(e={}){var t;const r=null===(t=e.elementDefinition)||void 0===t?void 0:t.uiConfiguration;if(r)return(0,o.default)(r).fieldSets.reduce(((e,t)=>{const r=t.fields.reduce(((e,t)=>_objectSpread(_objectSpread({},e),{},{["".concat(t.name)]:getDefaultValue(t)})),{});return _objectSpread(_objectSpread({},e),r)}),{});return{sxpElement:JSON.stringify((0,a.default)(e),null,"\t")}},t.getDefaultValue=getDefaultValue;var n=_interopRequireDefault(r("liferay!search-experiences-web$moment")),u=_interopRequireDefault(r("../functions/to_number")),i=r("../types/inputTypes"),o=_interopRequireDefault(r("./clean_ui_configuration")),a=_interopRequireDefault(r("./get_sxp_element_json"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function getDefaultValue(e){var t,r,o;const a=e.defaultValue;switch(e.type){case i.INPUT_TYPES.DATE:return"number"==typeof a?a:(0,n.default)(a,["MM-DD-YYYY","YYYY-MM-DD"]).isValid()?(0,n.default)(a,["MM-DD-YYYY","YYYY-MM-DD"]).unix():"";case i.INPUT_TYPES.FIELD_MAPPING:return"object"==typeof a&&a.field?a:{field:"",locale:""};case i.INPUT_TYPES.FIELD_MAPPING_LIST:return Array.isArray(a)?a.filter((({field:e})=>!!e)):[];case i.INPUT_TYPES.ITEM_SELECTOR:return Array.isArray(a)?a.filter((e=>e.label&&e.value)):[];case i.INPUT_TYPES.JSON:return"object"==typeof a?JSON.stringify(a,null,"\t"):"{}";case i.INPUT_TYPES.MULTISELECT:return Array.isArray(a)?a.filter((e=>e.label&&e.value)):[];case i.INPUT_TYPES.NUMBER:return"number"==typeof a?a:"number"==typeof(0,u.default)(a)?(0,u.default)(a):"";case i.INPUT_TYPES.SELECT:return"string"==typeof a?a:"string"==typeof(null===(t=e.typeOptions)||void 0===t||null===(r=t.options)||void 0===r||null===(o=r[0])||void 0===o?void 0:o.value)?e.typeOptions.options[0].value:"";case i.INPUT_TYPES.SLIDER:return"number"==typeof a?a:"number"==typeof(0,u.default)(a)?(0,u.default)(a):"";default:return"string"==typeof a?a:""}}}}));
//# sourceMappingURL=get_ui_configuration_values.js.map