package ඓ.ⁱ.K.ῲ;

import com.facebook.internal.security.CertificateUtil;
import java.net.URI;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONObject;
import ඓ.ⁱ.K.ʬ.C1243;
import ඓ.ⁱ.K.ඓ.C1252;
import ඓ.ⁱ.K.ῲ.AbstractC1258;
import ඓ.ⁱ.K.㸾.C1276;
import ඓ.ⁱ.K.㸾.C1288;

/* renamed from: ඓ.ⁱ.K.ῲ.ῲ  reason: contains not printable characters */
/* compiled from: AutoZone */
public final class C1255 extends AbstractC1258 {

    /* renamed from: 㸾  reason: contains not printable characters */
    public static final C1255 f4941 = new C1255();

    /* renamed from: ʬ  reason: contains not printable characters */
    public C1243 f4942 = new C1243(10, 30);

    /* renamed from: ῲ  reason: contains not printable characters */
    public Map<C1256, C1254> f4943 = new ConcurrentHashMap();

    /* renamed from: K  reason: contains not printable characters */
    public final String f4944 = "https://uc.qbox.me";

    /* renamed from: ඓ.ⁱ.K.ῲ.ῲ$K  reason: contains not printable characters */
    /* compiled from: AutoZone */
    public static class C1256 {

        /* renamed from: ῲ  reason: contains not printable characters */
        public final String f4945;

        /* renamed from: K  reason: contains not printable characters */
        public final String f4946;

        public C1256(String str, String str2) {
            this.f4946 = str;
            this.f4945 = str2;
        }

        public boolean equals(Object obj) {
            if (obj != this) {
                if (obj != null && (obj instanceof C1256)) {
                    C1256 k = (C1256) obj;
                    if (!k.f4946.equals(this.f4946) || !k.f4945.equals(this.f4945)) {
                        return false;
                    }
                }
                return false;
            }
            return true;
        }

        public int hashCode() {
            return this.f4945.hashCode() + (this.f4946.hashCode() * 37);
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public C1254 m3359(String str) {
        try {
            String[] split = str.split(CertificateUtil.DELIMITER);
            return this.f4943.get(new C1256(split[0], new JSONObject(new String(C1252.m3352(split[2]), "utf-8")).getString("scope").split(CertificateUtil.DELIMITER)[0]));
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    @Override // ඓ.ⁱ.K.ῲ.AbstractC1258
    /* renamed from: K  reason: contains not printable characters */
    public synchronized String m3360(String str, boolean z, String str2) {
        C1254 r1 = m3359(str);
        if (r1 == null) {
            return null;
        }
        return super.m3365(r1, z, str2);
    }

    @Override // ඓ.ⁱ.K.ῲ.AbstractC1258
    /* renamed from: K  reason: contains not printable characters */
    public synchronized void m3361(String str) {
        if (str != null) {
            String host = URI.create(str).getHost();
            C1254 r0 = null;
            Iterator<Map.Entry<C1256, C1254>> it2 = this.f4943.entrySet().iterator();
            while (true) {
                if (!it2.hasNext()) {
                    break;
                }
                C1254 value = it2.next().getValue();
                if (value.f4940.contains(host)) {
                    r0 = value;
                    break;
                }
            }
            if (r0 != null) {
                r0.m3358(host);
            }
        }
    }

    @Override // ඓ.ⁱ.K.ῲ.AbstractC1258
    /* renamed from: K  reason: contains not printable characters */
    public void m3362(String str, AbstractC1258.AbstractC1259 k) {
        C1256 k2;
        String[] split = str.split(CertificateUtil.DELIMITER);
        try {
            k2 = new C1256(split[0], new JSONObject(new String(C1252.m3352(split[2]), "utf-8")).getString("scope").split(CertificateUtil.DELIMITER)[0]);
        } catch (Exception e) {
            e.printStackTrace();
            k2 = null;
        }
        if (k2 == null) {
            ((C1288.C1292) k).m3400(-5);
        } else if (this.f4943.get(k2) != null) {
            ((C1288.C1292) k).m3399();
        } else {
            this.f4942.m3314(this.f4944 + "/v2/query?ak=" + k2.f4946 + "&bucket=" + k2.f4945, null, C1276.f4987, new C1257(this, k2, k));
        }
    }
}
