/**
  Replay handling. This codec is a combination of three other codecs
*/ 'use strict' ; import hex from './hex' ; import * as base65536 from './base65536' ; import * as base2048 from './base2048' ; /**
  Convert an array of moves into a replay
*/ const encode = ( moves ) : string => base2048 . encode ( moves ) ; /**
  Convert a string back into an array of moves
*/ const decode = ( string ) : string [ ] => { if ( /^[0123456789ABCDEF# ]*$/ . test ( string ) ) { return hex . decode ( string ) ; } try { return base65536 . decode ( string ) ; } catch ( e ) { } return base2048 . decode ( string ) ; } ; export default { encode , decode } ;