package c.i.e.q; import c.i.e.a; import c.i.e.d; import com.google.zxing.NotFoundException; import com.google.zxing.ReaderException; import com.google.zxing.Result; import java.util.ArrayList; import java.util.Collection; import java.util.Map; import java.util.Objects; /* compiled from: MultiFormatUPCEANReader */ public final class j extends k { public final p[] a; public j(Map map) { Collection collection = map == null ? null : (Collection) map.get(d.POSSIBLE_FORMATS); ArrayList arrayList = new ArrayList(); if (collection != null) { if (collection.contains(a.EAN_13)) { arrayList.add(new e()); } else if (collection.contains(a.UPC_A)) { arrayList.add(new l()); } if (collection.contains(a.EAN_8)) { arrayList.add(new f()); } if (collection.contains(a.UPC_E)) { arrayList.add(new q()); } } if (arrayList.isEmpty()) { arrayList.add(new e()); arrayList.add(new f()); arrayList.add(new q()); } this.a = (p[]) arrayList.toArray(new p[arrayList.size()]); } @Override // c.i.e.q.k public Result b(int i, c.i.e.n.a aVar, Map map) throws NotFoundException { p[] pVarArr; boolean z2; a aVar2 = a.UPC_A; int[] m = p.m(aVar); for (p pVar : this.a) { try { Result k = pVar.k(i, aVar, m, map); boolean z3 = k.d == a.EAN_13 && k.a.charAt(0) == '0'; Collection collection = map == null ? null : (Collection) map.get(d.POSSIBLE_FORMATS); if (collection != null) { if (!collection.contains(aVar2)) { z2 = false; if (z3 || !z2) { return k; } Result result = new Result(k.a.substring(1), k.b, k.f2477c, aVar2); result.a(k.e); return result; } } z2 = true; if (z3) { } return k; } catch (ReaderException unused) { } } throw NotFoundException.k; } @Override // c.i.e.q.k, c.i.e.i public void reset() { for (p pVar : this.a) { Objects.requireNonNull(pVar); } } }