package o5;

import androidx.sqlite.db.SupportSQLiteQuery;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;

/* loaded from: classes.dex */
public final class a implements SupportSQLiteQuery {

    /* renamed from: r, reason: collision with root package name */
    public static final C0709a f30658r = new C0709a(null);

    /* renamed from: p, reason: collision with root package name */
    private final String f30659p;

    /* renamed from: q, reason: collision with root package name */
    private final Object[] f30660q;

    /* renamed from: o5.a$a, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static final class C0709a {
        private C0709a() {
        }

        public /* synthetic */ C0709a(k kVar) {
            this();
        }

        private final void a(g gVar, int i10, Object obj) {
            if (obj == null) {
                gVar.bindNull(i10);
                return;
            }
            if (obj instanceof byte[]) {
                gVar.bindBlob(i10, (byte[]) obj);
                return;
            }
            if (obj instanceof Float) {
                gVar.bindDouble(i10, ((Number) obj).floatValue());
                return;
            }
            if (obj instanceof Double) {
                gVar.bindDouble(i10, ((Number) obj).doubleValue());
                return;
            }
            if (obj instanceof Long) {
                gVar.bindLong(i10, ((Number) obj).longValue());
                return;
            }
            if (obj instanceof Integer) {
                gVar.bindLong(i10, ((Number) obj).intValue());
                return;
            }
            if (obj instanceof Short) {
                gVar.bindLong(i10, ((Number) obj).shortValue());
                return;
            }
            if (obj instanceof Byte) {
                gVar.bindLong(i10, ((Number) obj).byteValue());
                return;
            }
            if (obj instanceof String) {
                gVar.bindString(i10, (String) obj);
                return;
            }
            if (obj instanceof Boolean) {
                gVar.bindLong(i10, ((Boolean) obj).booleanValue() ? 1L : 0L);
                return;
            }
            throw new IllegalArgumentException("Cannot bind " + obj + " at index " + i10 + " Supported types: Null, ByteArray, Float, Double, Long, Int, Short, Byte, String");
        }

        public final void b(g statement, Object[] objArr) {
            t.g(statement, "statement");
            if (objArr == null) {
                return;
            }
            int length = objArr.length;
            int i10 = 0;
            while (i10 < length) {
                Object obj = objArr[i10];
                i10++;
                a(statement, i10, obj);
            }
        }
    }

    public a(String query, Object[] objArr) {
        t.g(query, "query");
        this.f30659p = query;
        this.f30660q = objArr;
    }

    @Override // androidx.sqlite.db.SupportSQLiteQuery
    public void a(g statement) {
        t.g(statement, "statement");
        f30658r.b(statement, this.f30660q);
    }

    @Override // androidx.sqlite.db.SupportSQLiteQuery
    public int b() {
        Object[] objArr = this.f30660q;
        if (objArr != null) {
            return objArr.length;
        }
        return 0;
    }

    @Override // androidx.sqlite.db.SupportSQLiteQuery
    public String c() {
        return this.f30659p;
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public a(String query) {
        this(query, null);
        t.g(query, "query");
    }
}
