package com.tencent.bugly.proguard; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; /* compiled from: BUGLY */ /* loaded from: classes.dex */ public final class d extends c { private static HashMap f; private static HashMap> g; private f e = new f(); public d() { this.e.a = (short) 2; } @Override // com.tencent.bugly.proguard.c, com.tencent.bugly.proguard.a public final void a(String str, T t) { if (!str.startsWith(".")) { super.a(str, (String) t); } else { throw new IllegalArgumentException("put name can not startwith . , now is " + str); } } public final void b(String str) { this.e.c = str; } @Override // com.tencent.bugly.proguard.c public final void c() { super.c(); this.e.a = (short) 3; } public final void b(int i) { this.e.b = 1; } public final void c(String str) { this.e.d = str; } @Override // com.tencent.bugly.proguard.c, com.tencent.bugly.proguard.a public final byte[] a() { f fVar = this.e; if (fVar.a == 2) { if (!fVar.c.equals("")) { if (this.e.d.equals("")) { throw new IllegalArgumentException("funcName can not is null"); } } else { throw new IllegalArgumentException("servantName can not is null"); } } else { if (fVar.c == null) { fVar.c = ""; } f fVar2 = this.e; if (fVar2.d == null) { fVar2.d = ""; } } j jVar = new j(0); jVar.a(this.b); if (this.e.a == 2) { jVar.a((Map) this.a, 0); } else { jVar.a((Map) ((c) this).d, 0); } this.e.e = l.a(jVar.a()); j jVar2 = new j(0); jVar2.a(this.b); this.e.a(jVar2); byte[] a = l.a(jVar2.a()); int length = a.length + 4; ByteBuffer allocate = ByteBuffer.allocate(length); allocate.putInt(length).put(a).flip(); return allocate.array(); } @Override // com.tencent.bugly.proguard.c, com.tencent.bugly.proguard.a public final void a(byte[] bArr) { if (bArr.length >= 4) { try { i iVar = new i(bArr, 4); iVar.a(this.b); this.e.a(iVar); if (this.e.a == 3) { i iVar2 = new i(this.e.e); iVar2.a(this.b); if (f == null) { HashMap hashMap = new HashMap<>(); f = hashMap; hashMap.put("", new byte[0]); } ((c) this).d = iVar2.a((Map) f, 0, false); return; } i iVar3 = new i(this.e.e); iVar3.a(this.b); if (g == null) { g = new HashMap<>(); HashMap hashMap2 = new HashMap<>(); hashMap2.put("", new byte[0]); g.put("", hashMap2); } this.a = iVar3.a((Map) g, 0, false); new HashMap(); return; } catch (Exception e) { throw new RuntimeException(e); } } throw new IllegalArgumentException("decode package must include size head"); } }