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

import android.util.Base64;
import java.util.concurrent.Callable;

/* JADX INFO: loaded from: classes2.dex */
public final /* synthetic */ class em1 implements Callable {

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

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

    public /* synthetic */ em1(fm1 fm1Var, int i10) {
        this.f10855a = i10;
        this.f10856b = fm1Var;
    }

    @Override // java.util.concurrent.Callable
    public final Object call() {
        int i10 = 1;
        int i11 = this.f10855a;
        fm1 fm1Var = this.f10856b;
        switch (i11) {
            case 0:
                fm1Var.getClass();
                em1 em1Var = new em1(fm1Var, i10);
                ip1 ip1VarA = fm1Var.f11287g.a(101);
                try {
                    ip1VarA.a();
                    Object objCall = em1Var.call();
                    ip1VarA.c();
                    return (String) objCall;
                } catch (Throwable th) {
                    try {
                        ip1VarA.b(th);
                        throw th;
                    } catch (Throwable th2) {
                        ip1VarA.c();
                        throw th2;
                    }
                }
            case 1:
                pf pfVar = (pf) fm1Var.f11285e.e();
                String str = fm1Var.f11284d;
                gm1 gm1Var = fm1Var.f11282b;
                try {
                    return Base64.encodeToString(((cg) gm1Var.d(str, pfVar.b()).e()).b(), 11);
                } catch (IllegalArgumentException unused) {
                    gm1Var.getClass();
                    we weVarD0 = pf.D0();
                    weVarD0.h(4096);
                    return Base64.encodeToString(gm1Var.b(((pf) weVarD0.e()).b(), str, true), 11);
                }
            default:
                gm1 gm1Var2 = fm1Var.f11282b;
                gm1Var2.getClass();
                we weVarD02 = pf.D0();
                weVarD02.h(16384);
                return Base64.encodeToString(gm1Var2.b(((pf) weVarD02.e()).b(), fm1Var.f11284d, true), 11);
        }
    }
}
