package I2;

import android.text.TextUtils;
import com.google.android.gms.internal.play_billing.zzbt;
import java.util.ArrayList;
import java.util.Iterator;

/* JADX INFO: renamed from: I2.g, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0323g {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public String f2617a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public ArrayList f2618b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f2619c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public C0325i f2620d;

    public final C0326j a() {
        ArrayList arrayList = this.f2618b;
        boolean z6 = (arrayList == null || arrayList.isEmpty()) ? false : true;
        if (!z6) {
            throw new IllegalArgumentException("Details of the products must be provided.");
        }
        ArrayList arrayList2 = this.f2618b;
        if (arrayList2 != null) {
            Iterator it = arrayList2.iterator();
            while (it.hasNext()) {
                if (((C0324h) it.next()) == null) {
                    throw new IllegalArgumentException("ProductDetailsParams cannot be null.");
                }
            }
        }
        C0326j c0326j = new C0326j();
        c0326j.f2627a = z6 && !((C0324h) this.f2618b.get(0)).f2621a.f2666b.optString("packageName").isEmpty();
        c0326j.f2628b = this.f2617a;
        C0325i c0325i = this.f2620d;
        boolean z7 = true;
        if (TextUtils.isEmpty((String) c0325i.f2626d) && TextUtils.isEmpty(null)) {
            z7 = false;
        }
        boolean zIsEmpty = TextUtils.isEmpty(null);
        if (z7 && !zIsEmpty) {
            throw new IllegalArgumentException("Please provide Old SKU purchase information(token/id) or original external transaction id, not both.");
        }
        if (!c0325i.f2625c && !z7 && zIsEmpty) {
            throw new IllegalArgumentException("Old SKU purchase information(token/id) or original external transaction id must be provided.");
        }
        C1.k kVar = new C1.k(3, false);
        kVar.f691c = (String) c0325i.f2626d;
        kVar.f690b = c0325i.f2624b;
        c0326j.f2629c = kVar;
        c0326j.f2631e = new ArrayList();
        c0326j.f2632f = this.f2619c;
        ArrayList arrayList3 = this.f2618b;
        c0326j.f2630d = arrayList3 != null ? zzbt.zzj(arrayList3) : zzbt.zzk();
        return c0326j;
    }
}
