package com.applovin.impl; import androidx.core.app.NotificationCompat; import com.applovin.impl.sdk.utils.CollectionUtils; import com.applovin.impl.sdk.utils.StringUtils; import com.facebook.internal.security.CertificateUtil; import com.mbridge.msdk.foundation.entity.CampaignEx; import java.util.List; import java.util.concurrent.TimeUnit; /* loaded from: classes.dex */ public class kq { private String a; private String b; private String c; private long d = -1; private int e = -1; public String a() { return this.b; } public boolean a(long j, int i) { long j2 = this.d; boolean z = j2 >= 0; boolean z2 = j >= j2; int i2 = this.e; return (z && z2) || ((i2 >= 0) && (i >= i2)); } public String b() { return this.c; } public String toString() { return "VastTracker{identifier='" + this.a + "', event='" + this.b + "', uriString='" + this.c + "', offsetSeconds=" + this.d + ", offsetPercent=" + this.e + '}'; } private kq() { } public static kq a(es esVar, eq eqVar, com.applovin.impl.sdk.j jVar) { List explode; int size; long seconds; if (esVar == null) { throw new IllegalArgumentException("No node specified."); } if (jVar != null) { try { String d = esVar.d(); if (StringUtils.isValidString(d)) { kq kqVar = new kq(); kqVar.c = d; kqVar.a = (String) esVar.a().get("id"); kqVar.b = (String) esVar.a().get(NotificationCompat.CATEGORY_EVENT); kqVar.e = a(kqVar.a(), eqVar); String str = (String) esVar.a().get("offset"); if (StringUtils.isValidString(str)) { String trim = str.trim(); if (trim.contains("%")) { kqVar.e = StringUtils.parseInt(trim.substring(0, trim.length() - 1)); } else if (trim.contains(CertificateUtil.DELIMITER) && (size = (explode = CollectionUtils.explode(trim, CertificateUtil.DELIMITER)).size()) > 0) { int i = size - 1; long j = 0; for (int i2 = i; i2 >= 0; i2--) { String str2 = explode.get(i2); if (StringUtils.isNumeric(str2)) { int parseInt = Integer.parseInt(str2); if (i2 == i) { seconds = parseInt; } else if (i2 == size - 2) { seconds = TimeUnit.MINUTES.toSeconds(parseInt); } else if (i2 == size - 3) { seconds = TimeUnit.HOURS.toSeconds(parseInt); } j += seconds; } } kqVar.d = j; kqVar.e = -1; } } return kqVar; } jVar.J(); if (!com.applovin.impl.sdk.n.a()) { return null; } jVar.J().b("VastTracker", "Unable to create tracker. Could not find URL."); return null; } catch (Throwable th) { jVar.J(); if (com.applovin.impl.sdk.n.a()) { jVar.J().a("VastTracker", "Error occurred while initializing", th); } jVar.E().a("VastTracker", th); return null; } } throw new IllegalArgumentException("No sdk specified."); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof kq)) { return false; } kq kqVar = (kq) obj; if (this.d != kqVar.d || this.e != kqVar.e) { return false; } String str = this.a; if (str == null ? kqVar.a != null : !str.equals(kqVar.a)) { return false; } String str2 = this.b; if (str2 == null ? kqVar.b == null : str2.equals(kqVar.b)) { return this.c.equals(kqVar.c); } return false; } public int hashCode() { String str = this.a; int hashCode = (str != null ? str.hashCode() : 0) * 31; String str2 = this.b; int hashCode2 = (((hashCode + (str2 != null ? str2.hashCode() : 0)) * 31) + this.c.hashCode()) * 31; long j = this.d; return ((hashCode2 + ((int) (j ^ (j >>> 32)))) * 31) + this.e; } private static int a(String str, eq eqVar) { if ("start".equalsIgnoreCase(str)) { return 0; } if ("firstQuartile".equalsIgnoreCase(str)) { return 25; } if (CampaignEx.JSON_NATIVE_VIDEO_MIDPOINT.equalsIgnoreCase(str)) { return 50; } if ("thirdQuartile".equalsIgnoreCase(str)) { return 75; } if (!CampaignEx.JSON_NATIVE_VIDEO_COMPLETE.equalsIgnoreCase(str)) { return -1; } if (eqVar != null) { return eqVar.g(); } return 95; } }