/**
 * State transition map defining valid state transitions.
 */
export const EXPERIENCE_STATE_TRANSITIONS = {
  pending: ['started'],
  started: ['aborted', 'failed', 'succeeded'],
  aborted: ['started'],
  failed: ['started'],
  succeeded: ['started']
};

/**
 * Validates whether a state transition is allowed.
 *
 * @param fromState - The current state
 * @param toState - The target state to transition to
 * @returns true if the transition is valid, false otherwise
 */
export const canTransition = (fromState, toState) => {
  var _EXPERIENCE_STATE_TRA, _EXPERIENCE_STATE_TRA2;
  return (_EXPERIENCE_STATE_TRA = (_EXPERIENCE_STATE_TRA2 = EXPERIENCE_STATE_TRANSITIONS[fromState]) === null || _EXPERIENCE_STATE_TRA2 === void 0 ? void 0 : _EXPERIENCE_STATE_TRA2.includes(toState)) !== null && _EXPERIENCE_STATE_TRA !== void 0 ? _EXPERIENCE_STATE_TRA : false;
};