package com.strmr.ps.background;

import android.content.Context;
import android.util.Log;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import androidx.work.CoroutineWorker;
import androidx.work.WorkerParameters;
import androidx.work.f;
import com.strmr.ps.data.repository.ContentRepository;
import dagger.hilt.EntryPoint;
import dagger.hilt.InstallIn;
import dagger.hilt.android.EntryPointAccessors;
import dagger.hilt.components.SingletonComponent;
import defpackage.bk1;
import defpackage.ck1;
import defpackage.cr4;
import defpackage.kp6;
import defpackage.q07;
import defpackage.s38;
import defpackage.vx8;
import defpackage.y41;
import kotlin.Metadata;
import kotlin.coroutines.jvm.internal.ContinuationImpl;

/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\u00020\u0001:\u0002\b\tB\u0017\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\u0006\u0010\u0005\u001a\u00020\u0004¢\u0006\u0004\b\u0006\u0010\u0007¨\u0006\n"}, d2 = {"Lcom/strmr/ps/background/CatalogRefreshWorker;", "Landroidx/work/CoroutineWorker;", "Landroid/content/Context;", "appContext", "Landroidx/work/WorkerParameters;", "params", "<init>", "(Landroid/content/Context;Landroidx/work/WorkerParameters;)V", "b", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class CatalogRefreshWorker extends CoroutineWorker {

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\bg\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lcom/strmr/ps/background/CatalogRefreshWorker$a;", "", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    @InstallIn({SingletonComponent.class})
    @EntryPoint
    public interface a {
        ContentRepository contentRepository();
    }

    @Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0010\t\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001R\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004R\u0014\u0010\u0005\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0005\u0010\u0004R\u0014\u0010\u0006\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0006\u0010\u0004R\u0014\u0010\b\u001a\u00020\u00078\u0002X\u0082T¢\u0006\u0006\n\u0004\b\b\u0010\t¨\u0006\n"}, d2 = {"Lcom/strmr/ps/background/CatalogRefreshWorker$b;", "", "", "TAG", "Ljava/lang/String;", "PERIODIC_WORK_NAME", "ONE_TIME_WORK_NAME", "", "BACKOFF_DELAY_SECONDS", "J", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    @vx8
    public static final class b {
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public CatalogRefreshWorker(@kp6 Context context, @kp6 WorkerParameters workerParameters) {
        super(context, workerParameters);
        cr4.g(context, "appContext");
        cr4.g(workerParameters, "params");
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    @Override // androidx.work.CoroutineWorker
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object f(ContinuationImpl continuationImpl) {
        com.strmr.ps.background.a aVar;
        if (continuationImpl instanceof com.strmr.ps.background.a) {
            aVar = (com.strmr.ps.background.a) continuationImpl;
            int i = aVar.c;
            if ((i & Integer.MIN_VALUE) != 0) {
                aVar.c = i - Integer.MIN_VALUE;
            } else {
                aVar = new com.strmr.ps.background.a(this, continuationImpl);
            }
        }
        Object objC = aVar.a;
        ck1 ck1Var = ck1.a;
        int i2 = aVar.c;
        if (i2 == 0) {
            s38.b(objC);
            Context context = this.a;
            cr4.f(context, "getApplicationContext(...)");
            ContentRepository contentRepository = ((a) EntryPointAccessors.fromApplication(context, a.class)).contentRepository();
            g gVar = new g(y41.an(new q07("Trending Movies", new com.strmr.ps.background.b(2, contentRepository, ContentRepository.class, "getTrendingMovies", "getTrendingMovies-gIAlu-s(ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;", 0)), new q07("Popular Movies", new c(2, contentRepository, ContentRepository.class, "getPopularMovies", "getPopularMovies-gIAlu-s(ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;", 0)), new q07("Trending Shows", new d(2, contentRepository, ContentRepository.class, "getTrendingShows", "getTrendingShows-gIAlu-s(ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;", 0)), new q07("Popular Shows", new e(2, contentRepository, ContentRepository.class, "getPopularShows", "getPopularShows-gIAlu-s(ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;", 0))), this, null);
            aVar.c = 1;
            objC = bk1.c(gVar, aVar);
            if (objC == ck1Var) {
                return ck1Var;
            }
        } else {
            if (i2 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            s38.b(objC);
        }
        int iIntValue = ((Number) objC).intValue();
        if (iIntValue == 0) {
            return f.a.b();
        }
        Log.w("CatalogRefreshWorker", "Catalog refresh completed with " + iIntValue + " failures");
        return new f.a.b();
    }
}
