package com.mbridge.msdk.mbbanner.common.d; import android.text.TextUtils; import com.mbridge.msdk.c.h; import com.mbridge.msdk.c.k; import com.mbridge.msdk.foundation.entity.CampaignEx; import com.mbridge.msdk.foundation.same.report.d.c; import com.mbridge.msdk.foundation.same.report.d.d; import com.mbridge.msdk.foundation.same.report.d.e; import com.mbridge.msdk.foundation.tools.SameMD5; import com.mbridge.msdk.foundation.tools.af; import com.mbridge.msdk.foundation.tools.ak; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /* loaded from: classes4.dex */ public final class a { public static String a(String str) { String md5 = SameMD5.getMD5(ak.d()); try { if (!TextUtils.isEmpty(str)) { String[] split = str.split("_"); if (split.length < 3) { return ""; } String str2 = split[2]; if (!TextUtils.isEmpty(str2)) { return str2; } } return md5; } catch (Exception e) { af.b("BannerReport", e.getMessage()); return ""; } } public static c a(String str, String str2) { c cVar = new c(); try { LinkedHashMap b = d.a().b(); if (b != null && !b.isEmpty()) { Iterator> it = b.entrySet().iterator(); while (it.hasNext()) { Map.Entry next = it.next(); if (next != null && next.getValue().s()) { it.remove(); } } } cVar = d.a().a(str2, ""); if (cVar == null) { c cVar2 = new c(); try { d.a().b().put(str2, cVar2); cVar2.d(true); cVar = cVar2; } catch (Exception e) { e = e; cVar = cVar2; af.b("BannerReport", e.getMessage()); return cVar; } } cVar.b(296); cVar.c(str2); cVar.d(str); } catch (Exception e2) { e = e2; } return cVar; } public static void a(String str, c cVar, e eVar) { List h; try { try { String i = cVar.i(); if (TextUtils.isEmpty(i) && (h = cVar.h()) != null && !h.isEmpty() && h.get(0) != null) { i = h.get(0).getCampaignUnitId(); cVar.b(h.get(0).getAdType()); cVar.d(i); } k c = h.a().c(com.mbridge.msdk.foundation.controller.c.m().k(), i); if (c != null) { e eVar2 = eVar == null ? new e() : eVar; eVar2.a("us_rid", c.s()); HashMap hashMap = com.mbridge.msdk.foundation.controller.a.b; if (hashMap != null) { String str2 = hashMap.get(i); if (!TextUtils.isEmpty(str2)) { eVar2.a("u_stid", str2); } } else { eVar2.a("u_stid", c.a()); } } } catch (Exception e) { af.b("BannerReport", e.getMessage()); } if (eVar != null) { cVar.a(str, eVar); } d.a().a(str, cVar, (com.mbridge.msdk.foundation.same.report.d.a.a) null); } catch (Exception e2) { af.b("BannerReport", e2.getMessage()); } } }