package com.bytedance.sdk.component.YFl;

import android.webkit.WebView;
import com.bytedance.sdk.component.YFl.AlY;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes2.dex */
public class lG {
    static Ne YFl;
    private final nc AlY;
    private final YFl Sg;
    private final WebView tN;
    private volatile boolean vc;
    private final List<pDU> wN;

    public static nc YFl(WebView webView) {
        return new nc(webView);
    }

    public lG YFl(String str, wN<?, ?> wNVar) {
        return YFl(str, (String) null, wNVar);
    }

    public lG YFl(String str, String str2, wN<?, ?> wNVar) {
        Sg();
        this.Sg.DSW.YFl(str, wNVar);
        return this;
    }

    public lG YFl(String str, AlY.Sg sg) {
        return YFl(str, (String) null, sg);
    }

    public lG YFl(String str, String str2, AlY.Sg sg) {
        Sg();
        this.Sg.DSW.YFl(str, sg);
        return this;
    }

    public void YFl() {
        if (this.vc) {
            return;
        }
        this.Sg.Sg();
        this.vc = true;
        Iterator<pDU> it = this.wN.iterator();
        while (it.hasNext()) {
            it.next();
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public lG(nc ncVar) {
        ArrayList arrayList = new ArrayList();
        this.wN = arrayList;
        this.vc = false;
        this.AlY = ncVar;
        if (ncVar.qsH && YFl != null) {
            throw null;
        }
        if (ncVar.YFl != null) {
            if (ncVar.Sg == null) {
                this.Sg = new UZM();
            } else {
                this.Sg = ncVar.Sg;
            }
        } else {
            this.Sg = ncVar.Sg;
        }
        this.Sg.YFl(ncVar, (wXo) null);
        this.tN = ncVar.YFl;
        arrayList.add(ncVar.nc);
        bZ.YFl(ncVar.DSW);
    }

    private void Sg() {
        if (this.vc) {
            NjR.YFl(new IllegalStateException("JsBridge2 is already released!!!"));
        }
    }
}
