package com.ss.android.ugc.aweme.ecommercelive.business.audience.flashsale;

import X.1Bn;
import X.7he;
import X.8pz;
import X.AnonymousClass3PF;
import X.AnonymousClass3PH;
import X.AnonymousClass3PI;
import X.AnonymousClass3PJ;
import X.C49244Dk;
import X.C65674r1;
import X.Crj;
import X.Cv9;
import X.D8s;
import X.DAe;
import X.DAg;
import X.DAj;
import X.HqM;
import X.M12;
import android.app.Application;
import androidx.lifecycle.AndroidViewModel;
import com.bytedance.covode.number.Covode;
import java.util.List;
import java.util.concurrent.CancellationException;
import kotlin.h.b.n;

public final class ProductSyncViewModel extends AndroidViewModel {
    public static final AnonymousClass3PJ LJFF = new AnonymousClass3PJ((byte) 0);
    public final Cv9 LIZ;
    public int LIZIZ;
    public final Crj LIZJ = 7he.LIZ(AnonymousClass3PI.LIZ);
    public AnonymousClass3PH LIZLLL;
    public final 1Bn<List<HqM>> LJ = new 1Bn<>();
    public final C49244Dk LJI;

    static {
        Covode.recordClassIndex(73198);
    }

    public final void onCleared() {
        this.LJI.LIZ((CancellationException) null);
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public ProductSyncViewModel(Application application) {
        super(application);
        M12.LIZ(application);
        C49244Dk LIZ2 = DAg.LIZ();
        this.LJI = LIZ2;
        this.LIZ = DAj.LIZ(8pz.LIZIZ.plus(LIZ2));
    }

    public final void LIZ(String str, List<String> list) {
        M12.LIZ(str, list);
        String str2 = null;
        if (this.LIZIZ == 1) {
            AnonymousClass3PH r3 = this.LIZLLL;
            if (r3 != null) {
                str2 = r3.LIZIZ;
            }
            if (!n.LIZ(str2, str)) {
                r3 = new AnonymousClass3PH(str);
            }
            M12.LIZ(list);
            if (r3.LIZ.isEmpty()) {
                r3.LIZ.addAll(list);
            } else {
                for (String next : list) {
                    if (!r3.LIZ.contains(next)) {
                        r3.LIZ.add(next);
                    }
                }
            }
            this.LIZLLL = r3;
            return;
        }
        this.LIZLLL = null;
        this.LIZIZ = 1;
        DAe.LIZ(this.LIZ, (D8s) null, new AnonymousClass3PF(this, str, list, (C65674r1) null), 3);
    }
}
