package v0; import android.text.TextUtils; import androidx.work.m; import androidx.work.p; import androidx.work.u; import androidx.work.x; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; /* loaded from: classes.dex */ public class g extends u { /* renamed from: j, reason: collision with root package name */ private static final String f14801j = m.f("WorkContinuationImpl"); /* renamed from: a, reason: collision with root package name */ private final j f14802a; /* renamed from: b, reason: collision with root package name */ private final String f14803b; /* renamed from: c, reason: collision with root package name */ private final androidx.work.f f14804c; /* renamed from: d, reason: collision with root package name */ private final List f14805d; /* renamed from: e, reason: collision with root package name */ private final List f14806e; /* renamed from: f, reason: collision with root package name */ private final List f14807f; /* renamed from: g, reason: collision with root package name */ private final List f14808g; /* renamed from: h, reason: collision with root package name */ private boolean f14809h; /* renamed from: i, reason: collision with root package name */ private p f14810i; public g(j jVar, List list) { this(jVar, null, androidx.work.f.KEEP, list, null); } private static boolean i(g gVar, Set set) { set.addAll(gVar.c()); Set l10 = l(gVar); Iterator it = set.iterator(); while (it.hasNext()) { if (l10.contains((String) it.next())) { return true; } } List e10 = gVar.e(); if (e10 != null && !e10.isEmpty()) { Iterator it2 = e10.iterator(); while (it2.hasNext()) { if (i((g) it2.next(), set)) { return true; } } } set.removeAll(gVar.c()); return false; } public static Set l(g gVar) { HashSet hashSet = new HashSet(); List e10 = gVar.e(); if (e10 != null && !e10.isEmpty()) { Iterator it = e10.iterator(); while (it.hasNext()) { hashSet.addAll(((g) it.next()).c()); } } return hashSet; } public p a() { if (this.f14809h) { m.c().h(f14801j, String.format("Already enqueued work ids (%s)", TextUtils.join(", ", this.f14806e)), new Throwable[0]); } else { d1.b bVar = new d1.b(this); this.f14802a.p().c(bVar); this.f14810i = bVar.d(); } return this.f14810i; } public androidx.work.f b() { return this.f14804c; } public List c() { return this.f14806e; } public String d() { return this.f14803b; } public List e() { return this.f14808g; } public List f() { return this.f14805d; } public j g() { return this.f14802a; } public boolean h() { return i(this, new HashSet()); } public boolean j() { return this.f14809h; } public void k() { this.f14809h = true; } public g(j jVar, String str, androidx.work.f fVar, List list, List list2) { this.f14802a = jVar; this.f14803b = str; this.f14804c = fVar; this.f14805d = list; this.f14808g = list2; this.f14806e = new ArrayList(list.size()); this.f14807f = new ArrayList(); if (list2 != null) { Iterator it = list2.iterator(); while (it.hasNext()) { this.f14807f.addAll(((g) it.next()).f14807f); } } for (int i10 = 0; i10 < list.size(); i10++) { String a10 = ((x) list.get(i10)).a(); this.f14806e.add(a10); this.f14807f.add(a10); } } }