package com.google.android.gms.internal.ads;

import android.app.Activity;
import android.content.Context;
import android.os.RemoteException;
import android.text.TextUtils;
import android.view.View;
import com.bytedance.sdk.component.pglcrypt.PglCryptUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/* JADX INFO: loaded from: classes2.dex */
public final class v40 implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f17506a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f17507b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Object f17508c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ Object f17509d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ Object f17510e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ Object f17511f;

    public /* synthetic */ v40(eb ebVar, Throwable th, re1 re1Var, String str, q7.n nVar) {
        this.f17506a = 1;
        this.f17508c = ebVar;
        this.f17509d = th;
        this.f17510e = re1Var;
        this.f17507b = str;
        this.f17511f = nVar;
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Removed duplicated region for block: B:72:0x01a4  */
    @Override // java.lang.Runnable
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void run() {
        String str;
        int i10 = this.f17506a;
        Object obj = this.f17511f;
        Object obj2 = this.f17510e;
        Object obj3 = this.f17509d;
        Object obj4 = this.f17508c;
        Object obj5 = this.f17507b;
        switch (i10) {
            case 0:
                HashMap mapO = com.google.android.gms.measurement.internal.u1.o("event", "precacheCanceled");
                mapO.put("src", (String) obj5);
                String str2 = (String) obj4;
                if (!TextUtils.isEmpty(str2)) {
                    mapO.put("cachedSrc", str2);
                }
                String str3 = (String) obj3;
                switch (str3) {
                    case "expireFailed":
                    case "noCacheDir":
                        str = "io";
                        break;
                    case "badUrl":
                    case "downloadTimeout":
                        str = "network";
                        break;
                    case "externalAbort":
                    case "sizeExceeded":
                        str = "policy";
                        break;
                    case "contentLengthMissing":
                    case "error":
                    case "inProgress":
                    case "interrupted":
                    case "noop":
                    case "playerFailed":
                    default:
                        str = "internal";
                        break;
                }
                mapO.put("type", str);
                mapO.put("reason", str3);
                String str4 = (String) obj2;
                if (!TextUtils.isEmpty(str4)) {
                    mapO.put(PglCryptUtils.KEY_MESSAGE, str4);
                }
                ((w40) obj).r(mapO);
                return;
            case 1:
                Throwable th = (Throwable) obj3;
                eb ebVar = (eb) obj4;
                if (((Boolean) n7.y.f31093e.f31096c.b(ao.Ab)).booleanValue()) {
                    dz.c(((y90) ebVar.f10744e).f18758a).d("AttributionReporting.registerSourceAndPingClickUrl", th);
                } else {
                    dz.a(((y90) ebVar.f10744e).f18758a).d("AttributionReportingSampled.registerSourceAndPingClickUrl", th);
                }
                re1 re1Var = (re1) obj2;
                re1Var.zzb((String) obj5, (q7.n) obj, null, null);
                return;
            case 2:
                gs0 gs0Var = (gs0) obj4;
                String str5 = (String) obj5;
                bu buVar = (bu) obj3;
                qb1 qb1Var = (qb1) obj2;
                List list = (List) obj;
                gs0Var.getClass();
                try {
                    try {
                        if (Objects.equals(str5, "com.google.ads.mediation.admob.AdMobAdapter")) {
                            buVar.zze();
                            return;
                        }
                        Context context = (Context) gs0Var.f11855g.get();
                        if (context == null) {
                            context = gs0Var.f11854f;
                        }
                        qb1Var.a(context, buVar, list);
                        return;
                    } catch (RemoteException unused) {
                        return;
                    }
                } catch (RemoteException e10) {
                    throw new zzgsa(e10);
                } catch (zzfjr unused2) {
                    StringBuilder sb = new StringBuilder(String.valueOf(str5).length() + 74);
                    sb.append("Failed to initialize adapter. ");
                    sb.append(str5);
                    sb.append(" does not implement the initialize() method.");
                    buVar.a(sb.toString());
                    return;
                }
            case 3:
                do1 do1Var = (do1) obj5;
                Map map = (Map) obj4;
                Context context2 = (Context) obj3;
                View view = (View) obj2;
                map.putAll(do1Var.f10462d.b(context2, view));
                do1Var.d(map);
                map.put("f", "v");
                map.put("ctx", context2);
                map.put("view", view);
                map.put("act", (Activity) obj);
                map.put("bds", null);
                return;
            default:
                do1 do1Var2 = (do1) obj4;
                Map map2 = (Map) obj3;
                map2.putAll(do1Var2.f10462d.c());
                do1Var2.d(map2);
                map2.put("f", "c");
                map2.put("ctx", (Context) obj2);
                map2.put("view", (View) obj);
                map2.put("act", null);
                map2.put("bds", (String) obj5);
                return;
        }
    }

    public /* synthetic */ v40(gs0 gs0Var, String str, ds0 ds0Var, qb1 qb1Var, ArrayList arrayList) {
        this.f17506a = 2;
        this.f17508c = gs0Var;
        this.f17507b = str;
        this.f17509d = ds0Var;
        this.f17510e = qb1Var;
        this.f17511f = arrayList;
    }

    public /* synthetic */ v40(do1 do1Var, HashMap map, Context context, View view, Activity activity, String str, int i10) {
        this.f17506a = i10;
        if (i10 != 4) {
            this.f17507b = do1Var;
            this.f17508c = map;
            this.f17509d = context;
            this.f17510e = view;
            this.f17511f = activity;
            return;
        }
        this.f17508c = do1Var;
        this.f17509d = map;
        this.f17510e = context;
        this.f17511f = view;
        this.f17507b = str;
    }

    public v40(w40 w40Var, String str, String str2, String str3, String str4) {
        this.f17506a = 0;
        this.f17507b = str;
        this.f17508c = str2;
        this.f17509d = str3;
        this.f17510e = str4;
        Objects.requireNonNull(w40Var);
        this.f17511f = w40Var;
    }
}
