package o; import com.google.gson.Gson; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Map; /* loaded from: classes.dex */ public final class OS extends TypeAdapter implements HJa { private PYE a; private Gson c; private InterfaceC15734iCu d; public OS(Gson gson, InterfaceC15734iCu interfaceC15734iCu, PYE pye) { this.c = gson; this.d = interfaceC15734iCu; this.a = pye; } @Override // com.google.gson.TypeAdapter public final void write(JsonWriter jsonWriter, Object obj) throws IOException { if (obj == null) { jsonWriter.nullValue(); return; } OC oc = (OC) obj; Gson gson = this.c; PYE pye = this.a; jsonWriter.beginObject(); String str = oc.a; pye.c(jsonWriter, 616); String str2 = oc.a; DTh.b(gson, String.class, str2).write(jsonWriter, str2); if (oc != oc.d) { pye.c(jsonWriter, 642); OG og = new OG(); Map map = oc.d; DTh.a(gson, og, map).write(jsonWriter, map); } jsonWriter.endObject(); } @Override // com.google.gson.TypeAdapter /* renamed from: read */ public final Object read2(JsonReader jsonReader) throws IOException { if (jsonReader.peek() == JsonToken.NULL) { jsonReader.skipValue(); return null; } OC oc = new OC(); Gson gson = this.c; InterfaceC15734iCu interfaceC15734iCu = this.d; jsonReader.beginObject(); while (jsonReader.hasNext()) { int e = interfaceC15734iCu.e(jsonReader); boolean z = jsonReader.peek() != JsonToken.NULL; if (e != 176) { if (e != 192) { jsonReader.skipValue(); } else if (z) { oc.a = (String) gson.getAdapter(String.class).read2(jsonReader); } else { oc.a = null; jsonReader.nextNull(); } } else if (z) { oc.d = (Map) gson.getAdapter(new OG()).read2(jsonReader); } else { oc.d = null; jsonReader.nextNull(); } } jsonReader.endObject(); return oc; } }