import { MapSavedObjectAttributes } from '../map_saved_object_type' ; export function setDefaultAutoFitToBounds ( { attributes , } ) { if ( ! attributes || ! attributes . mapStateJSON ) { return attributes ; } let mapState = { } ; try { mapState = JSON . parse ( attributes . mapStateJSON ) ; } catch ( e ) { throw new Error ( 'Unable to parse attribute mapStateJSON' ) ; } if ( 'settings' in mapState ) { mapState . settings ! . autoFitToDataBounds = false ; } else { mapState . settings = { autoFitToDataBounds : false , } ; } return { ... attributes , mapStateJSON : JSON . stringify ( mapState ) , } ; }