package o; import com.google.zxing.NotFoundException; import com.google.zxing.ReaderException; import java.util.ArrayList; import java.util.Collection; import java.util.Map; /* loaded from: classes2.dex */ public final class tnl extends xue { private static final rua[] b = new rua[0]; private final rua[] e; public tnl(Map map) { Collection collection = map == null ? null : (Collection) map.get(CGg.POSSIBLE_FORMATS); ArrayList arrayList = new ArrayList(); if (collection != null) { if (collection.contains(PTS.EAN_13)) { arrayList.add(new pNh()); } else if (collection.contains(PTS.UPC_A)) { arrayList.add(new aFX()); } if (collection.contains(PTS.EAN_8)) { arrayList.add(new CRq()); } if (collection.contains(PTS.UPC_E)) { arrayList.add(new eAT()); } } if (arrayList.isEmpty()) { arrayList.add(new pNh()); arrayList.add(new CRq()); arrayList.add(new eAT()); } this.e = (rua[]) arrayList.toArray(b); } @Override // o.xue public final WFF d(int i, C17416wdP c17416wdP, Map map) throws NotFoundException { boolean z; int[] a = rua.a(c17416wdP); for (rua ruaVar : this.e) { try { WFF a2 = ruaVar.a(i, c17416wdP, a, map); boolean z2 = a2.d == PTS.EAN_13 && a2.b.charAt(0) == '0'; Collection collection = map == null ? null : (Collection) map.get(CGg.POSSIBLE_FORMATS); if (collection != null && !collection.contains(PTS.UPC_A)) { z = false; if (z2 || !z) { return a2; } WFF wff = new WFF(a2.b.substring(1), a2.a, a2.c, PTS.UPC_A); Map map2 = a2.e; if (map2 != null) { Map map3 = wff.e; if (map3 == null) { wff.e = map2; } else { map3.putAll(map2); } } return wff; } z = true; if (z2) { } return a2; } catch (ReaderException unused) { } } throw NotFoundException.b(); } @Override // o.xue, o.zIz public final void c() { for (rua ruaVar : this.e) { ruaVar.c(); } } }