package com.google.android.gms.internal.measurement; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.concurrent.Callable; /* loaded from: classes.dex */ public final class zzc { final zzf zza; zzg zzb; final zzab zzc; private final zzz zzd; public zzc() { zzf zzfVar = new zzf(); this.zza = zzfVar; this.zzb = zzfVar.zzb.zza(); this.zzc = new zzab(); this.zzd = new zzz(); zzfVar.zzd.zza("internal.registerCallback", new Callable(this) { // from class: com.google.android.gms.internal.measurement.zza public final zzc zza; @Override // java.util.concurrent.Callable public final Object call() { return this.zza.zzb(); } { this.zza = this; } }); zzfVar.zzd.zza("internal.eventLogger", new Callable(this) { // from class: com.google.android.gms.internal.measurement.zzb public final zzc zza; @Override // java.util.concurrent.Callable public final Object call() { return new zzk(this.zza.zzc); } { this.zza = this; } }); } /* JADX INFO: Access modifiers changed from: package-private */ public final /* synthetic */ zzai zzb() throws Exception { return new zzv(this.zzd); } public final void zzc(zzgo zzgoVar) throws zzd { zzai zzaiVar; try { this.zzb = this.zza.zzb.zza(); if (this.zza.zza(this.zzb, (zzgt[]) zzgoVar.zzc().toArray(new zzgt[0])) instanceof zzag) { throw new IllegalStateException("Program loading failed"); } for (zzgm zzgmVar : zzgoVar.zza().zzd()) { List zzc = zzgmVar.zzc(); String zzb = zzgmVar.zzb(); Iterator it = zzc.iterator(); while (it.hasNext()) { zzap zza = this.zza.zza(this.zzb, it.next()); if (zza instanceof zzam) { zzg zzgVar = this.zzb; if (zzgVar.zzh(zzb)) { zzap zzd = zzgVar.zzd(zzb); if (zzd instanceof zzai) { zzaiVar = (zzai) zzd; } else { String valueOf = String.valueOf(zzb); throw new IllegalStateException(valueOf.length() != 0 ? "Invalid function name: ".concat(valueOf) : new String("Invalid function name: ")); } } else { zzaiVar = null; } if (zzaiVar != null) { zzaiVar.zza(this.zzb, Collections.singletonList(zza)); } else { String valueOf2 = String.valueOf(zzb); throw new IllegalStateException(valueOf2.length() != 0 ? "Rule function is undefined: ".concat(valueOf2) : new String("Rule function is undefined: ")); } } else { throw new IllegalArgumentException("Invalid rule definition"); } } } } catch (Throwable th) { throw new zzd(th); } } public final void zzd(String str, Callable callable) { this.zza.zzd.zza(str, callable); } public final boolean zze(zzaa zzaaVar) throws zzd { try { this.zzc.zzd(zzaaVar); this.zza.zzc.zzg("runtime.counter", new zzah(Double.valueOf(0.0d))); this.zzd.zzb(this.zzb.zza(), this.zzc); if (zzg()) { return true; } return zzf(); } catch (Throwable th) { throw new zzd(th); } } public final boolean zzf() { return !this.zzc.zzc().isEmpty(); } public final boolean zzg() { return !this.zzc.zzb().equals(this.zzc.zza()); } public final zzab zza() { return this.zzc; } }