package com.igaworks.ssp.part.video.a; import com.google.android.gms.ads.RequestConfiguration; import com.igaworks.ssp.common.o.k; import com.igaworks.ssp.part.video.a.d.b; import com.igaworks.ssp.part.video.a.d.d; import java.io.StringReader; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; /* loaded from: classes2.dex */ public class a { /* renamed from: a, reason: collision with root package name */ private Document f7331a; /* renamed from: b, reason: collision with root package name */ private Node f7332b; /* renamed from: c, reason: collision with root package name */ private Node f7333c; /* renamed from: d, reason: collision with root package name */ private Node f7334d; /* renamed from: e, reason: collision with root package name */ private b f7335e; /* renamed from: f, reason: collision with root package name */ private d f7336f; /* renamed from: g, reason: collision with root package name */ private DocumentBuilderFactory f7337g; public String a() { try { String a10 = com.igaworks.ssp.part.video.a.c.b.a(this.f7331a, "Error"); if (k.b(a10)) { return null; } return a10; } catch (Exception unused) { return null; } } public b b() { return this.f7335e; } public d c() { return this.f7336f; } public boolean d() { NodeList elementsByTagName; try { Document document = this.f7331a; if (document == null || (elementsByTagName = document.getElementsByTagName("Ad")) == null || elementsByTagName.getLength() <= 0) { return false; } this.f7332b = elementsByTagName.item(0); return true; } catch (Exception unused) { return false; } } public void e() { try { Node node = this.f7332b; if (node != null) { Node c10 = com.igaworks.ssp.part.video.a.c.b.c(node, "InLine"); this.f7333c = c10; if (c10 != null) { this.f7335e = new b(c10); } else { Node c11 = com.igaworks.ssp.part.video.a.c.b.c(this.f7332b, "Wrapper"); this.f7334d = c11; if (c11 != null) { this.f7336f = new d(c11); } } } } catch (Exception e10) { e10.printStackTrace(); } } public void a(String str) { if (str == null) { return; } try { String replaceFirst = str.replaceFirst("<\\?.*\\?>", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED); if (this.f7337g == null) { DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance(); this.f7337g = newInstance; newInstance.setCoalescing(true); } this.f7331a = this.f7337g.newDocumentBuilder().parse(new InputSource(new StringReader(replaceFirst))); } catch (Exception e10) { e10.printStackTrace(); this.f7331a = null; } } }