package com.bykv.vk.openvk.preload.geckox;

import android.content.Context;
import android.text.TextUtils;
import com.bykv.vk.openvk.preload.geckox.net.INetWork;
import com.bykv.vk.openvk.preload.geckox.statistic.IStatisticMonitor;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes.dex */
public class b {

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    private static IThreadPoolCallback f6009r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    private static ThreadPoolExecutor f6010s;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final Context f6011a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final com.bykv.vk.openvk.preload.geckox.a.a.c f6012b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final IStatisticMonitor f6013c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final INetWork f6014d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private final List<String> f6015e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private final List<String> f6016f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private final com.bykv.vk.openvk.preload.geckox.a.a.a f6017g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private final Long f6018h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    private final String f6019i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    private final String f6020j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    private final String f6021k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    private final String f6022l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    private final String f6023m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    private final File f6024n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    private final boolean f6025o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    private final long f6026p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    private JSONObject f6027q;

    public static class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        private INetWork f6028a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private List<String> f6029b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        private List<String> f6030c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        private Context f6031d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        private com.bykv.vk.openvk.preload.geckox.a.a.c f6032e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        private IStatisticMonitor f6033f;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        private boolean f6034g = true;

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        private com.bykv.vk.openvk.preload.geckox.a.a.a f6035h;

        /* JADX INFO: renamed from: i, reason: collision with root package name */
        private Long f6036i;

        /* JADX INFO: renamed from: j, reason: collision with root package name */
        private String f6037j;

        /* JADX INFO: renamed from: k, reason: collision with root package name */
        private String f6038k;

        /* JADX INFO: renamed from: l, reason: collision with root package name */
        private String f6039l;

        /* JADX INFO: renamed from: m, reason: collision with root package name */
        private File f6040m;

        /* JADX INFO: renamed from: n, reason: collision with root package name */
        private String f6041n;

        /* JADX INFO: renamed from: o, reason: collision with root package name */
        private String f6042o;

        /* JADX INFO: renamed from: p, reason: collision with root package name */
        private long f6043p;

        public a(Context context) {
            this.f6031d = context.getApplicationContext();
        }

        public final a a() {
            this.f6034g = false;
            return this;
        }

        public final a b(String str) {
            this.f6038k = str;
            return this;
        }

        public final a c(String str) {
            this.f6039l = str;
            return this;
        }

        public final a a(long j10) {
            this.f6043p = j10;
            return this;
        }

        public final a a(com.bykv.vk.openvk.preload.geckox.a.a.a aVar) {
            this.f6035h = aVar;
            return this;
        }

        public final a b(String... strArr) {
            this.f6029b = Arrays.asList(strArr);
            return this;
        }

        public final a a(INetWork iNetWork) {
            this.f6028a = iNetWork;
            return this;
        }

        public final a b() {
            this.f6036i = 38L;
            return this;
        }

        public final a a(IStatisticMonitor iStatisticMonitor) {
            this.f6033f = iStatisticMonitor;
            return this;
        }

        public final a a(File file) {
            this.f6040m = file;
            return this;
        }

        public final a a(String str) {
            this.f6037j = str;
            return this;
        }

        public final a a(String... strArr) {
            this.f6030c = Arrays.asList(strArr);
            return this;
        }
    }

    public /* synthetic */ b(a aVar, byte b10) {
        this(aVar);
    }

    public static Executor g() {
        return t();
    }

    public static Executor h() {
        return t();
    }

    public static ExecutorService t() {
        IThreadPoolCallback iThreadPoolCallback = f6009r;
        ExecutorService threadPool = iThreadPoolCallback != null ? iThreadPoolCallback.getThreadPool() : null;
        if (threadPool != null) {
            return threadPool;
        }
        if (f6010s == null) {
            synchronized (b.class) {
                try {
                    if (f6010s == null) {
                        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(2, 2, 20L, TimeUnit.SECONDS, new LinkedBlockingQueue());
                        f6010s = threadPoolExecutor;
                        threadPoolExecutor.allowCoreThreadTimeOut(true);
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        }
        return f6010s;
    }

    public final Context a() {
        return this.f6011a;
    }

    public final com.bykv.vk.openvk.preload.geckox.a.a.a b() {
        return this.f6017g;
    }

    public final boolean c() {
        return this.f6025o;
    }

    public final List<String> d() {
        return this.f6016f;
    }

    public final List<String> e() {
        return this.f6015e;
    }

    public final JSONObject f() {
        return this.f6027q;
    }

    public final INetWork i() {
        return this.f6014d;
    }

    public final String j() {
        return this.f6021k;
    }

    public final long k() {
        return this.f6018h.longValue();
    }

    public final String l() {
        return this.f6023m;
    }

    public final String m() {
        return this.f6022l;
    }

    public final File n() {
        return this.f6024n;
    }

    public final String o() {
        return this.f6019i;
    }

    public final com.bykv.vk.openvk.preload.geckox.a.a.c p() {
        return this.f6012b;
    }

    public final IStatisticMonitor q() {
        return this.f6013c;
    }

    public final String r() {
        return this.f6020j;
    }

    public final long s() {
        return this.f6026p;
    }

    private b(a aVar) {
        Context context = aVar.f6031d;
        this.f6011a = context;
        if (context == null) {
            throw new IllegalArgumentException("context == null");
        }
        List<String> list = aVar.f6029b;
        this.f6015e = list;
        this.f6016f = aVar.f6030c;
        this.f6012b = aVar.f6032e;
        this.f6017g = aVar.f6035h;
        Long l10 = aVar.f6036i;
        this.f6018h = l10;
        if (TextUtils.isEmpty(aVar.f6037j)) {
            this.f6019i = com.bykv.vk.openvk.preload.geckox.utils.a.a(context);
        } else {
            this.f6019i = aVar.f6037j;
        }
        String str = aVar.f6038k;
        this.f6020j = str;
        this.f6022l = aVar.f6041n;
        this.f6023m = aVar.f6042o;
        this.f6026p = aVar.f6043p;
        if (aVar.f6040m == null) {
            this.f6024n = new File(context.getFilesDir(), "gecko_offline_res_x");
        } else {
            this.f6024n = aVar.f6040m;
        }
        String str2 = aVar.f6039l;
        this.f6021k = str2;
        if (TextUtils.isEmpty(str2)) {
            throw new IllegalArgumentException("host == null");
        }
        if (list == null || list.isEmpty()) {
            throw new IllegalArgumentException("access key empty");
        }
        if (l10 == null) {
            throw new IllegalArgumentException("appId == null");
        }
        if (TextUtils.isEmpty(str)) {
            throw new IllegalArgumentException("deviceId key empty");
        }
        this.f6014d = aVar.f6028a;
        this.f6013c = aVar.f6033f;
        this.f6025o = aVar.f6034g;
    }

    public static void a(IThreadPoolCallback iThreadPoolCallback) {
        f6009r = iThreadPoolCallback;
    }

    public final void a(JSONObject jSONObject) {
        this.f6027q = jSONObject;
    }
}
