import { FormSelectOption } from '@energyweb/origin-ui-core' ; export const prepareSubregionOptions = ( allRegions ) : ( ( selected : FormSelectOption [ ] ) => FormSelectOption [ ] ) => { return ( selectedRegion ) => { if ( ! selectedRegion ) { return [ ] ; } const selectedValue = selectedRegion [ 0 ] ?. value ; const availableSubregions = allRegions [ selectedValue ] ; const options = availableSubregions ?. map ( ( subregion ) => ( { value : subregion , label : subregion , } ) ) ; return options ; } ; } ;