import { convertSavedDashboardPanelToPanelState , convertPanelStateToSavedDashboardPanel , } from '../../../common/embeddable/embeddable_saved_object_converters' ; import type { SavedDashboardPanel , DashboardPanelMap } from '../../types' ; export const convertSavedPanelsToPanelMap = ( panels ? ) : DashboardPanelMap => { const panelsMap = { } ; panels ?. forEach ( ( panel , idx ) => { panelsMap ! [ panel . panelIndex ?? String ( idx ) ] = convertSavedDashboardPanelToPanelState ( panel ) ; } ) ; return panelsMap ; } ; export const convertPanelMapToSavedPanels = ( panels , version ) => { return Object . values ( panels ) . map ( ( panel ) => convertPanelStateToSavedDashboardPanel ( panel , version ) ) ; } ;