import { BaseTagSystem } from './base' ; export class LegacyTagSystem extends BaseTagSystem { normalize ( locale ? , fallback = 'en' , strict = false ) { if ( ! locale ) return fallback ; try { locale = locale . replace ( /_/g , '-' ) ; if ( locale . split ( '-' ) [ 0 ] . length !== 2 ) return fallback ; const canonical = Intl . getCanonicalLocales ( locale ) [ 0 ] ; if ( strict ) return Intl . Collator . supportedLocalesOf ( canonical , { localeMatcher : 'lookup' } ) [ 0 ] ; return canonical ; } catch ( e ) { return fallback ; } } toFlagname ( locale ) { return locale . includes ( '-' ) ? locale . toLocaleLowerCase ( ) . split ( '-' , 2 ) . slice ( - 1 ) [ 0 ] ?. toLowerCase ( ) : locale . toLowerCase ( ) ; } }