package com.strmr.ps.data.local.dao;

import android.database.Cursor;
import android.os.CancellationSignal;
import androidx.media3.extractor.text.ttml.TtmlNode;
import androidx.room.RoomDatabase;
import com.strmr.ps.data.local.dao.UserCollectionDao;
import com.strmr.ps.data.local.entity.UserCollectionEntity;
import defpackage.e6a;
import defpackage.mk1;
import defpackage.n58;
import defpackage.oq8;
import defpackage.p58;
import defpackage.pe9;
import defpackage.q2;
import defpackage.rq6;
import defpackage.sp1;
import defpackage.vo6;
import defpackage.vw2;
import defpackage.xm2;
import defpackage.yn1;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import kotlin.coroutines.Continuation;

/* JADX INFO: loaded from: classes3.dex */
public final class UserCollectionDao_Impl implements UserCollectionDao {
    private final RoomDatabase __db;
    private final xm2<UserCollectionEntity> __insertionAdapterOfUserCollectionEntity;
    private final oq8 __preparedStmtOfDeleteAll;

    public UserCollectionDao_Impl(@vo6 RoomDatabase roomDatabase) {
        this.__db = roomDatabase;
        this.__insertionAdapterOfUserCollectionEntity = new xm2<UserCollectionEntity>(roomDatabase) { // from class: com.strmr.ps.data.local.dao.UserCollectionDao_Impl.1
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "INSERT OR REPLACE INTO `user_collections` (`id`,`json`) VALUES (?,?)";
            }

            @Override // defpackage.xm2
            public void bind(@vo6 pe9 pe9Var, @vo6 UserCollectionEntity userCollectionEntity) {
                pe9Var.bindString(1, userCollectionEntity.getId());
                pe9Var.bindString(2, userCollectionEntity.getJson());
            }
        };
        this.__preparedStmtOfDeleteAll = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.UserCollectionDao_Impl.2
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM user_collections";
            }
        };
    }

    @vo6
    public static List<Class<?>> getRequiredConverters() {
        return Collections.EMPTY_LIST;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ Object lambda$replaceAll$0(List list, Continuation continuation) {
        return UserCollectionDao.DefaultImpls.replaceAll(this, list, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.UserCollectionDao
    public Object deleteAll(Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.UserCollectionDao_Impl.4
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                pe9 pe9VarAcquire = UserCollectionDao_Impl.this.__preparedStmtOfDeleteAll.acquire();
                try {
                    UserCollectionDao_Impl.this.__db.beginTransaction();
                    try {
                        pe9VarAcquire.executeUpdateDelete();
                        UserCollectionDao_Impl.this.__db.setTransactionSuccessful();
                        return e6a.a;
                    } finally {
                        UserCollectionDao_Impl.this.__db.endTransaction();
                    }
                } finally {
                    UserCollectionDao_Impl.this.__preparedStmtOfDeleteAll.release(pe9VarAcquire);
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.UserCollectionDao
    public Object getAll(Continuation<? super List<UserCollectionEntity>> continuation) {
        final p58 p58VarD = p58.d(0, "SELECT * FROM user_collections");
        return mk1.c(this.__db, false, new CancellationSignal(), new Callable<List<UserCollectionEntity>>() { // from class: com.strmr.ps.data.local.dao.UserCollectionDao_Impl.6
            @Override // java.util.concurrent.Callable
            @vo6
            public List<UserCollectionEntity> call() throws Exception {
                Cursor cursorB = sp1.b(UserCollectionDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, TtmlNode.ATTR_ID);
                    int iB2 = yn1.b(cursorB, "json");
                    ArrayList arrayList = new ArrayList(cursorB.getCount());
                    while (cursorB.moveToNext()) {
                        arrayList.add(new UserCollectionEntity(cursorB.getString(iB), cursorB.getString(iB2)));
                    }
                    return arrayList;
                } finally {
                    cursorB.close();
                    p58VarD.release();
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.UserCollectionDao
    public Object getById(String str, Continuation<? super UserCollectionEntity> continuation) {
        final p58 p58VarD = p58.d(1, "SELECT * FROM user_collections WHERE id = ?");
        return mk1.c(this.__db, false, vw2.f(p58VarD, 1, str), new Callable<UserCollectionEntity>() { // from class: com.strmr.ps.data.local.dao.UserCollectionDao_Impl.5
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public UserCollectionEntity call() throws Exception {
                Cursor cursorB = sp1.b(UserCollectionDao_Impl.this.__db, p58VarD, false);
                try {
                    return cursorB.moveToFirst() ? new UserCollectionEntity(cursorB.getString(yn1.b(cursorB, TtmlNode.ATTR_ID)), cursorB.getString(yn1.b(cursorB, "json"))) : null;
                } finally {
                    cursorB.close();
                    p58VarD.release();
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.UserCollectionDao
    public Object insertAll(final List<UserCollectionEntity> list, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.UserCollectionDao_Impl.3
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                UserCollectionDao_Impl.this.__db.beginTransaction();
                try {
                    UserCollectionDao_Impl.this.__insertionAdapterOfUserCollectionEntity.insert((Iterable) list);
                    UserCollectionDao_Impl.this.__db.setTransactionSuccessful();
                    return e6a.a;
                } finally {
                    UserCollectionDao_Impl.this.__db.endTransaction();
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.UserCollectionDao
    public Object replaceAll(List<UserCollectionEntity> list, Continuation<? super e6a> continuation) {
        return n58.a(this.__db, new q2(this, list, 23), continuation);
    }
}
