/**
 * Handles getting the current value.
 *
 * @param {boolean} simpleValue - Whether `simpleValue` is set.
 * @param {string|{label: string, value: string, metadata: Object<string, any>[]}} value - Current value.
 * @param {{label: string, value: string}[]} options - Options passed to the component.
 *
 * @returns Appropriate output for the given input combination.
 *
 * @preserve
 */
const getValue = (simpleValue, value, options) => {
  if (Array.isArray(value)) {
    if (simpleValue) {
      return value.map((value2) => options?.find(({ value: itemValue }) => itemValue === value2));
    }
    return value;
  }
  if (simpleValue) {
    return options?.find(({ value: itemValue }) => itemValue === value);
  }
  return value;
};
export {
  getValue
};
