function removeLikelySubtags(tag) {
        var maxLocale = addLikelySubtags(tag);
        if (!maxLocale) {
            return tag;
        }
        maxLocale = intlGetcanonicallocales.emitUnicodeLanguageId(__assign(__assign({}, intlGetcanonicallocales.parseUnicodeLanguageId(maxLocale)), { variants: [] }));
        var ast = intlGetcanonicallocales.parseUnicodeLocaleId(tag);
        var _a = ast.lang, lang = _a.lang, script = _a.script, region = _a.region, variants = _a.variants;
        var trial = addLikelySubtags(intlGetcanonicallocales.emitUnicodeLanguageId({ lang: lang, variants: [] }));
        if (trial === maxLocale) {
            return intlGetcanonicallocales.emitUnicodeLocaleId(__assign(__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, undefined, variants) }));
        }
        if (region) {
            var trial_1 = addLikelySubtags(intlGetcanonicallocales.emitUnicodeLanguageId({ lang: lang, region: region, variants: [] }));
            if (trial_1 === maxLocale) {
                return intlGetcanonicallocales.emitUnicodeLocaleId(__assign(__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, region, variants) }));
            }
        }
        if (script) {
            var trial_2 = addLikelySubtags(intlGetcanonicallocales.emitUnicodeLanguageId({ lang: lang, script: script, variants: [] }));
            if (trial_2 === maxLocale) {
                return intlGetcanonicallocales.emitUnicodeLocaleId(__assign(__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, script, undefined, variants) }));
            }
        }
        return tag;
    }
From: https://github.com/unicode-org/icu/blob/4231ca5be053a22a1be24eb891817458c97db709/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java#L2395
@param tag