package com.applovin.impl; import android.net.Uri; import android.text.TextUtils; import com.applovin.impl.f1; import com.applovin.impl.sdk.utils.StringUtils; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.concurrent.ExecutorService; /* loaded from: classes.dex */ public class e1 extends d1 { private final String f; private final com.applovin.impl.sdk.ad.b g; private final List h; private final u2 i; private final c j; private StringBuffer k; private final Object l; private final ExecutorService m; private List n; public interface c { void a(String str, boolean z); } public e1(String str, com.applovin.impl.sdk.ad.b bVar, List list, u2 u2Var, ExecutorService executorService, com.applovin.impl.sdk.j jVar, c cVar) { super("AsyncTaskCacheHTMLResources", jVar); this.f = str; this.g = bVar; this.h = list; this.i = u2Var; this.m = executorService; this.j = cVar; this.k = new StringBuffer(str); this.l = new Object(); } @Override // java.util.concurrent.Callable /* renamed from: b, reason: merged with bridge method [inline-methods] */ public Boolean call() { HashSet d; if (this.e.get()) { return Boolean.FALSE; } if (TextUtils.isEmpty(this.f)) { a(this.f); return Boolean.FALSE; } if (!((Boolean) this.a.a(sj.Y0)).booleanValue()) { if (com.applovin.impl.sdk.n.a()) { this.c.a(this.b, "Resource caching is disabled, skipping cache..."); } a(this.f); return Boolean.FALSE; } HashSet hashSet = new HashSet(); HashSet c2 = c(); if (c2 != null) { hashSet.addAll(c2); } if (((Boolean) this.a.a(sj.k5)).booleanValue() && (d = d()) != null) { hashSet.addAll(d); } this.n = new ArrayList(hashSet); if (this.e.get()) { return Boolean.FALSE; } List list = this.n; if (list != null && !list.isEmpty()) { if (com.applovin.impl.sdk.n.a()) { this.c.a(this.b, "Executing " + this.n.size() + " caching operations..."); } this.m.invokeAll(this.n); if (((Boolean) this.a.a(sj.p1)).booleanValue()) { synchronized (this.l) { a(this.k.toString()); } } else { a(this.k.toString()); } return Boolean.TRUE; } a(this.f); return Boolean.FALSE; } private void a(String str) { c cVar; if (this.e.get() || (cVar = this.j) == null) { return; } cVar.a(str, false); } public class a implements f1.a { final /* synthetic */ String a; public a(String str) { this.a = str; } @Override // com.applovin.impl.f1.a public void a(Uri uri) { if (uri != null) { if (((Boolean) e1.this.a.a(sj.p1)).booleanValue()) { synchronized (e1.this.l) { StringUtils.replaceAll(e1.this.k, this.a, uri.toString()); } } else { StringUtils.replaceAll(e1.this.k, this.a, uri.toString()); } e1.this.g.a(uri); e1.this.i.d(); return; } com.applovin.impl.sdk.n nVar = e1.this.c; if (com.applovin.impl.sdk.n.a()) { e1 e1Var = e1.this; e1Var.c.a(e1Var.b, "Failed to cache JavaScript resource " + this.a); } if (e1.this.j != null) { e1.this.j.a(e1.this.f, true); } e1.this.i.c(); } } private HashSet d() { HashSet hashSet = new HashSet(); for (String str : StringUtils.getRegexMatches(StringUtils.match(this.f, (String) this.a.a(sj.m5)), 1)) { if (this.e.get()) { return null; } if (!StringUtils.isValidString(str)) { if (com.applovin.impl.sdk.n.a()) { this.c.a(this.b, "Skip caching of non-resource " + str); } } else { hashSet.add(new f1(str, this.g, Collections.emptyList(), false, this.i, this.a, new a(str))); } } return hashSet; } /* JADX WARN: Code restructure failed: missing block: B:46:0x0011, code lost: continue; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private java.util.HashSet c() { /* Method dump skipped, instructions count: 277 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.e1.c():java.util.HashSet"); } public class b implements f1.a { final /* synthetic */ String a; final /* synthetic */ String b; final /* synthetic */ String c; public b(String str, String str2, String str3) { this.a = str; this.b = str2; this.c = str3; } @Override // com.applovin.impl.f1.a public void a(Uri uri) { if (uri == null) { if (e1.this.g.W().contains(this.b + this.c) && e1.this.j != null) { e1.this.j.a(e1.this.f, true); } e1.this.i.c(); return; } if (((Boolean) e1.this.a.a(sj.p1)).booleanValue()) { synchronized (e1.this.l) { StringUtils.replaceAll(e1.this.k, this.a, uri.toString()); } } else { StringUtils.replaceAll(e1.this.k, this.a, uri.toString()); } e1.this.g.a(uri); e1.this.i.d(); } } private Collection e() { HashSet hashSet = new HashSet(); for (char c2 : ((String) this.a.a(sj.X0)).toCharArray()) { hashSet.add(Character.valueOf(c2)); } hashSet.add('\"'); return hashSet; } }