package com.ss.android.ugc.aweme.ecommerce.messagecenter;

import X.4HR;
import X.4r1;
import X.9HM;
import X.APN;
import X.BDC;
import X.C6657CeD;
import X.C6664CeK;
import X.C6665CeL;
import X.DWM;
import X.DaP;
import X.Lea;
import X.M12;
import com.bytedance.covode.number.Covode;
import com.bytedance.ext_power_list.AssemListViewModel;
import java.util.ArrayList;
import java.util.List;

public final class SellerMessageListViewModel extends AssemListViewModel<BDC, DaP, Integer> {
    static {
        Covode.recordClassIndex(70846);
    }

    public final /* synthetic */ 4HR defaultState() {
        return new BDC();
    }

    public final void newState(DWM<DaP> dwm) {
        M12.LIZ(dwm);
        setState(new C6657CeD(dwm));
    }

    private final List<APN> LIZ(List<C6664CeK> list) {
        C6665CeL ceL;
        String str;
        long j;
        List<C6664CeK> list2 = list;
        ArrayList arrayList = new ArrayList(9HM.LIZ(list2, 10));
        for (C6664CeK ceK : list2) {
            List<C6665CeL> list3 = ceK.LJI;
            Long l = null;
            if (list3 != null) {
                ceL = (C6665CeL) Lea.LJIIJ(list3);
            } else {
                ceL = null;
            }
            Long l2 = ceK.LJFF;
            String str2 = ceK.LJIIJJI;
            String str3 = ceK.LJIIIZ;
            if (ceL != null) {
                str = ceL.LJFF;
                Long l3 = ceL.LJIIIIZZ;
                if (l3 != null) {
                    j = l3.longValue();
                }
                j = 0;
            } else {
                str = null;
                j = 0;
            }
            Long valueOf = Long.valueOf(j);
            Integer num = ceK.LJII;
            String str4 = ceK.LJIIJ;
            if (ceL != null) {
                l = ceL.LJIIIIZZ;
            }
            arrayList.add(new APN(l2, str3, str2, str, valueOf, num, str4, l));
        }
        return arrayList;
    }

    /* JADX WARNING: Removed duplicated region for block: B:12:0x0033  */
    /* JADX WARNING: Removed duplicated region for block: B:22:0x0050  */
    /* JADX WARNING: Removed duplicated region for block: B:7:0x001e  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final java.lang.Object onRefresh(X.4r1<? super X.C0479A4l<java.lang.Integer>> r16) {
        /*
            r15 = this;
            r3 = r16
            boolean r0 = r3 instanceof X.C6667CeN
            if (r0 == 0) goto L_0x0025
            r2 = r3
            X.CeN r2 = (X.C6667CeN) r2
            int r0 = r2.label
            r1 = -2147483648(0xffffffff80000000, float:-0.0)
            r0 = r0 & r1
            if (r0 == 0) goto L_0x0025
            int r0 = r2.label
            int r0 = r0 - r1
            r2.label = r0
        L_0x0015:
            java.lang.Object r5 = r2.result
            X.Cof r1 = X.Cof.COROUTINE_SUSPENDED
            int r0 = r2.label
            r4 = 1
            if (r0 == 0) goto L_0x0033
            if (r0 != r4) goto L_0x002b
            java.lang.Object r6 = r2.L$0
            com.ss.android.ugc.aweme.ecommerce.messagecenter.SellerMessageListViewModel r6 = (com.ss.android.ugc.aweme.ecommerce.messagecenter.SellerMessageListViewModel) r6
            goto L_0x0044
        L_0x0025:
            X.CeN r2 = new X.CeN
            r2.<init>(r15, r3)
            goto L_0x0015
        L_0x002b:
            java.lang.IllegalStateException r1 = new java.lang.IllegalStateException
            java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
            r1.<init>(r0)
            throw r1
        L_0x0033:
            X.2th.LIZ(r5)
            r0 = 0
            r2.L$0 = r15     // Catch:{ Exception -> 0x00f2 }
            r2.label = r4     // Catch:{ Exception -> 0x00f2 }
            java.lang.Object r5 = r15.LIZIZ(r0, r2)     // Catch:{ Exception -> 0x00f2 }
            if (r5 != r1) goto L_0x0042
            return r1
        L_0x0042:
            r6 = r15
            goto L_0x0047
        L_0x0044:
            X.2th.LIZ(r5)     // Catch:{ Exception -> 0x00f2 }
        L_0x0047:
            X.7Y3 r5 = (X.7Y3) r5     // Catch:{ Exception -> 0x00f2 }
            java.util.ArrayList r3 = new java.util.ArrayList
            r3.<init>()
            if (r5 == 0) goto L_0x00dd
            java.util.List r2 = r5.LIZ
            if (r2 == 0) goto L_0x00d9
            boolean r0 = r2.isEmpty()
            r0 = r0 ^ r4
            if (r0 == 0) goto L_0x00d9
            X.AU8 r8 = new X.AU8
            r7 = 1056964608(0x3f000000, float:0.5)
            android.content.res.Resources r0 = android.content.res.Resources.getSystem()
            java.lang.String r1 = ""
            kotlin.h.b.n.LIZIZ(r0, r1)
            android.util.DisplayMetrics r0 = r0.getDisplayMetrics()
            float r0 = android.util.TypedValue.applyDimension(r4, r7, r0)
            int r9 = X.LnI.LIZ(r0)
            r10 = 2131099719(0x7f060047, float:1.78118E38)
            android.content.res.Resources r0 = android.content.res.Resources.getSystem()
            kotlin.h.b.n.LIZIZ(r0, r1)
            android.util.DisplayMetrics r0 = r0.getDisplayMetrics()
            r7 = 1098907648(0x41800000, float:16.0)
            float r0 = android.util.TypedValue.applyDimension(r4, r7, r0)
            int r11 = X.LnI.LIZ(r0)
            android.content.res.Resources r0 = android.content.res.Resources.getSystem()
            kotlin.h.b.n.LIZIZ(r0, r1)
            android.util.DisplayMetrics r0 = r0.getDisplayMetrics()
            float r0 = android.util.TypedValue.applyDimension(r4, r7, r0)
            int r12 = X.LnI.LIZ(r0)
            android.content.res.Resources r0 = android.content.res.Resources.getSystem()
            kotlin.h.b.n.LIZIZ(r0, r1)
            android.util.DisplayMetrics r0 = r0.getDisplayMetrics()
            float r0 = android.util.TypedValue.applyDimension(r4, r7, r0)
            int r13 = X.LnI.LIZ(r0)
            r0 = 32
            r14 = 32
            r8.<init>(r9, r10, r11, r12, r13, r14)
            r3.add(r8)
            X.2yQ r8 = new X.2yQ
            android.app.Application r7 = X.FLI.LIZ()
            r0 = 2131824346(0x7f110eda, float:1.9281517E38)
            java.lang.String r0 = r7.getString(r0)
            kotlin.h.b.n.LIZIZ(r0, r1)
            r8.<init>(r0)
            r3.add(r8)
            java.util.List r0 = r6.LIZ(r2)
            r3.addAll(r0)
        L_0x00d9:
            boolean r0 = r5.LIZIZ
            if (r0 == 0) goto L_0x00eb
        L_0x00dd:
            X.A4n r2 = X.C0479A4l.LIZ
            r1 = 0
            r0 = 10
            java.lang.Integer r0 = X.ILJ.LIZ(r0)
            X.A4p r0 = X.C0481A4n.LIZ(r2, r1, r0, r3, r4)
            return r0
        L_0x00eb:
            X.A4n r0 = X.C0479A4l.LIZ
            X.A4o r0 = r0.LIZ((java.util.List<? extends X.DaP>) r3)
            return r0
        L_0x00f2:
            r1 = move-exception
            X.A4n r0 = X.C0479A4l.LIZ
            X.A4m r0 = r0.LIZ((java.lang.Exception) r1)
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ecommerce.messagecenter.SellerMessageListViewModel.onRefresh(X.4r1):java.lang.Object");
    }

    public final /* synthetic */ Object onLoadMore(Object obj, 4r1 r3) {
        return LIZ(((Number) obj).intValue(), r3);
    }

    /* JADX WARNING: Removed duplicated region for block: B:11:0x002a  */
    /* JADX WARNING: Removed duplicated region for block: B:7:0x001c  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final java.lang.Object LIZIZ(int r10, X.4r1<? super X.7Y3> r11) {
        /*
            r9 = this;
            boolean r0 = r11 instanceof X.C6670CeQ
            if (r0 == 0) goto L_0x004f
            r8 = r11
            X.CeQ r8 = (X.C6670CeQ) r8
            int r0 = r8.label
            r1 = -2147483648(0xffffffff80000000, float:-0.0)
            r0 = r0 & r1
            if (r0 == 0) goto L_0x004f
            int r0 = r8.label
            int r0 = r0 - r1
            r8.label = r0
        L_0x0013:
            java.lang.Object r3 = r8.result
            X.Cof r2 = X.Cof.COROUTINE_SUSPENDED
            int r0 = r8.label
            r1 = 1
            if (r0 == 0) goto L_0x002a
            if (r0 != r1) goto L_0x0055
            X.2th.LIZ(r3)
        L_0x0021:
            X.9ef r3 = (X.9ef) r3
            java.lang.Object r0 = r3.LIZIZ
            X.C5E r0 = (X.C5E) r0
            T r0 = r0.data
            return r0
        L_0x002a:
            X.2th.LIZ(r3)
            r8.label = r1
            X.Crj r0 = X.C6669CeP.LIZ
            java.lang.Object r3 = r0.getValue()
            com.ss.android.ugc.aweme.ecommerce.messagecenter.SellerMessageAPI r3 = (com.ss.android.ugc.aweme.ecommerce.messagecenter.SellerMessageAPI) r3
            java.lang.Integer r4 = X.ILJ.LIZ(r1)
            java.lang.Integer r7 = X.ILJ.LIZ(r10)
            r0 = 0
            java.lang.Boolean r5 = java.lang.Boolean.valueOf(r0)
            java.lang.Integer r6 = X.ILJ.LIZ(r0)
            java.lang.Object r3 = r3.fetchUserConversations(r4, r5, r6, r7, r8)
            if (r3 != r2) goto L_0x0021
            return r2
        L_0x004f:
            X.CeQ r8 = new X.CeQ
            r8.<init>(r9, r11)
            goto L_0x0013
        L_0x0055:
            java.lang.IllegalStateException r1 = new java.lang.IllegalStateException
            java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
            r1.<init>(r0)
            throw r1
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ecommerce.messagecenter.SellerMessageListViewModel.LIZIZ(int, X.4r1):java.lang.Object");
    }

    /* JADX WARNING: Removed duplicated region for block: B:18:0x003b  */
    /* JADX WARNING: Removed duplicated region for block: B:20:0x0049  */
    /* JADX WARNING: Removed duplicated region for block: B:25:0x0061  */
    /* JADX WARNING: Removed duplicated region for block: B:7:0x001c  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final java.lang.Object LIZ(int r6, X.4r1<? super X.C0479A4l<java.lang.Integer>> r7) {
        /*
            r5 = this;
            boolean r0 = r7 instanceof X.C6668CeO
            if (r0 == 0) goto L_0x005b
            r3 = r7
            X.CeO r3 = (X.C6668CeO) r3
            int r0 = r3.label
            r1 = -2147483648(0xffffffff80000000, float:-0.0)
            r0 = r0 & r1
            if (r0 == 0) goto L_0x005b
            int r0 = r3.label
            int r0 = r0 - r1
            r3.label = r0
        L_0x0013:
            java.lang.Object r2 = r3.result
            X.Cof r1 = X.Cof.COROUTINE_SUSPENDED
            int r0 = r3.label
            r4 = 1
            if (r0 == 0) goto L_0x0049
            if (r0 != r4) goto L_0x0068
            int r6 = r3.I$0
            java.lang.Object r1 = r3.L$0
            com.ss.android.ugc.aweme.ecommerce.messagecenter.SellerMessageListViewModel r1 = (com.ss.android.ugc.aweme.ecommerce.messagecenter.SellerMessageListViewModel) r1
            X.2th.LIZ(r2)
        L_0x0027:
            X.7Y3 r2 = (X.7Y3) r2
            if (r2 == 0) goto L_0x002f
            java.util.List r0 = r2.LIZ
            if (r0 != 0) goto L_0x0031
        L_0x002f:
            X.Lel r0 = X.Lel.INSTANCE
        L_0x0031:
            java.util.List r3 = r1.LIZ(r0)
            if (r2 == 0) goto L_0x0061
            boolean r0 = r2.LIZIZ
            if (r0 == 0) goto L_0x0061
            X.A4n r2 = X.C0479A4l.LIZ
            r1 = 0
            int r0 = r6 + 10
            java.lang.Integer r0 = X.ILJ.LIZ(r0)
            X.A4p r0 = X.C0481A4n.LIZ(r2, r1, r0, r3, r4)
            return r0
        L_0x0049:
            X.2th.LIZ(r2)
            r3.L$0 = r5
            r3.I$0 = r6
            r3.label = r4
            java.lang.Object r2 = r5.LIZIZ(r6, r3)
            if (r2 != r1) goto L_0x0059
            return r1
        L_0x0059:
            r1 = r5
            goto L_0x0027
        L_0x005b:
            X.CeO r3 = new X.CeO
            r3.<init>(r5, r7)
            goto L_0x0013
        L_0x0061:
            X.A4n r0 = X.C0479A4l.LIZ
            X.A4o r0 = r0.LIZ((java.util.List<? extends X.DaP>) r3)
            return r0
        L_0x0068:
            java.lang.IllegalStateException r1 = new java.lang.IllegalStateException
            java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
            r1.<init>(r0)
            throw r1
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ecommerce.messagecenter.SellerMessageListViewModel.LIZ(int, X.4r1):java.lang.Object");
    }
}
