package com.bytedance.sdk.component.jnr.ro.lb;

import android.content.Context;
import android.graphics.Bitmap;
import android.widget.ImageView;
import com.bytedance.sdk.component.jnr.dsz;
import com.bytedance.sdk.component.jnr.gof;
import com.bytedance.sdk.component.jnr.qhl;
import com.bytedance.sdk.component.jnr.sds;
import com.bytedance.sdk.component.jnr.wey;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;

/* JADX INFO: loaded from: classes.dex */
public class ajl {
    private com.bytedance.sdk.component.jnr.yz ajl;

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    private Context f6629ef;
    private Map<String, List<lb>> fm = new ConcurrentHashMap();
    private Map<String, com.bytedance.sdk.component.jnr.lb> jnr = new ConcurrentHashMap();

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private volatile qhl f6630lb;
    private final dsz ro;
    private ExecutorService wsy;
    private ExecutorService wu;
    private volatile gof yz;

    public ajl(Context context, dsz dszVar) {
        this.ro = (dsz) wsy.fm(dszVar);
        this.f6629ef = context;
        com.bytedance.sdk.component.jnr.ro.lb.fm.ro.fm(context, dszVar.jnr());
    }

    private ExecutorService ku() {
        ExecutorService executorServiceFm = this.ro.fm();
        return executorServiceFm != null ? executorServiceFm : com.bytedance.sdk.component.jnr.ro.fm.ro.fm();
    }

    private com.bytedance.sdk.component.jnr.yz vt() {
        com.bytedance.sdk.component.jnr.yz yzVarLb = this.ro.lb();
        return yzVarLb == null ? new com.bytedance.sdk.component.jnr.fm.fm() : yzVarLb;
    }

    public ExecutorService ajl() {
        ExecutorService executorServiceFm;
        wey weyVarRo = this.ro.ro();
        if (weyVarRo != null && (executorServiceFm = weyVarRo.fm()) != null) {
            return executorServiceFm;
        }
        if (this.wsy == null) {
            this.wsy = ku();
        }
        return this.wsy;
    }

    public Map<String, List<lb>> ef() {
        return this.fm;
    }

    public Context fm() {
        return this.f6629ef;
    }

    public com.bytedance.sdk.component.jnr.yz jnr() {
        if (this.ajl == null) {
            this.ajl = vt();
        }
        return this.ajl;
    }

    public gof lb() {
        return this.yz;
    }

    public boolean ro() {
        return this.ro.wsy();
    }

    public sds wsy() {
        dsz dszVar = this.ro;
        if (dszVar != null) {
            return dszVar.ajl();
        }
        return null;
    }

    public ExecutorService wu() {
        ExecutorService executorServiceRo;
        wey weyVarRo = this.ro.ro();
        if (weyVarRo != null && (executorServiceRo = weyVarRo.ro()) != null) {
            return executorServiceRo;
        }
        if (this.wu == null) {
            this.wu = com.bytedance.sdk.component.jnr.ro.fm.ro.fm();
        }
        return this.wu;
    }

    public Collection<com.bytedance.sdk.component.jnr.lb> yz() {
        return this.jnr.values();
    }

    private com.bytedance.sdk.component.jnr.lb yz(com.bytedance.sdk.component.jnr.ro roVar) {
        com.bytedance.sdk.component.jnr.lb lbVarYz = this.ro.yz();
        return lbVarYz != null ? lbVarYz : new com.bytedance.sdk.component.jnr.ro.lb.fm.fm.ro(roVar.wu(), roVar.fm());
    }

    public qhl fm(com.bytedance.sdk.component.jnr.ro roVar) {
        if (roVar == null) {
            roVar = com.bytedance.sdk.component.jnr.ro.lb.fm.ro.ef();
        }
        if (this.f6630lb == null) {
            synchronized (com.bytedance.sdk.component.jnr.ro.lb.fm.ro.lb.class) {
                try {
                    if (this.f6630lb == null) {
                        this.f6630lb = new com.bytedance.sdk.component.jnr.ro.lb.fm.ro.lb(new com.bytedance.sdk.component.jnr.ro.lb.fm.ro.fm(roVar.ro(), roVar.lb()));
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        }
        return this.f6630lb;
    }

    public com.bytedance.sdk.component.jnr.lb lb(com.bytedance.sdk.component.jnr.ro roVar) {
        if (roVar == null) {
            roVar = com.bytedance.sdk.component.jnr.ro.lb.fm.ro.ef();
        }
        String string = roVar.wu().toString();
        com.bytedance.sdk.component.jnr.lb lbVar = this.jnr.get(string);
        if (lbVar != null) {
            return lbVar;
        }
        com.bytedance.sdk.component.jnr.lb lbVarYz = yz(roVar);
        this.jnr.put(string, lbVarYz);
        return lbVarYz;
    }

    public gof ro(com.bytedance.sdk.component.jnr.ro roVar) {
        if (roVar == null) {
            roVar = com.bytedance.sdk.component.jnr.ro.lb.fm.ro.ef();
        }
        if (this.yz == null) {
            synchronized (com.bytedance.sdk.component.jnr.ro.lb.fm.ro.ro.class) {
                try {
                    if (this.yz == null) {
                        this.yz = new com.bytedance.sdk.component.jnr.ro.lb.fm.ro.ro(roVar.ro(), roVar.yz());
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        }
        return this.yz;
    }

    public com.bytedance.sdk.component.jnr.lb fm(String str) {
        return lb(com.bytedance.sdk.component.jnr.ro.lb.fm.ro.fm(new File(str)));
    }

    public com.bytedance.sdk.component.jnr.ro.lb.ro.ro fm(lb lbVar) {
        ImageView.ScaleType scaleTypeEf = lbVar.ef();
        if (scaleTypeEf == null) {
            scaleTypeEf = com.bytedance.sdk.component.jnr.ro.lb.ro.ro.fm;
        }
        ImageView.ScaleType scaleType = scaleTypeEf;
        Bitmap.Config configVt = lbVar.vt();
        if (configVt == null) {
            configVt = com.bytedance.sdk.component.jnr.ro.lb.ro.ro.ro;
        }
        return new com.bytedance.sdk.component.jnr.ro.lb.ro.ro(lbVar.ro(), lbVar.lb(), scaleType, configVt, lbVar.yz(), lbVar.jnr());
    }
}
