LINE.apk(点击下载) / f.java


package zy0;

import android.net.Uri;
import com.google.gson.Gson;
import com.google.gson.m;
import com.linecorp.line.search.impl.model.GetCollectionMenuItemsResponse;
import com.linecorp.line.search.impl.model.SearchRequestData;
import com.linecorp.line.search.impl.model.SearchResultResponse;
import em3.q;
import hq3.i;
import hq3.z;
import iy0.e;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CancellationException;
import kotlin.ResultKt;
import kotlin.TuplesKt;
import ql3.f0;
import ql3.g0;
import ql3.u;
import ul3.d;

public final class f {

    /* renamed from: a  reason: collision with root package name */
    public final e f202031a;

    /* renamed from: b  reason: collision with root package name */
    public final b f202032b;

    /* renamed from: c  reason: collision with root package name */
    public final d f202033c;

    @wl3.e(c = "com.linecorp.line.search.impl.service.SearchService", f = "SearchService.kt", l = {28}, m = "getCollectionMenu")
    public static final class a extends wl3.c {

        /* renamed from: b  reason: collision with root package name */
        public /* synthetic */ Object f202034b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ f f202035c;

        /* renamed from: d  reason: collision with root package name */
        public int f202036d;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public a(f fVar, d<? super a> dVar) {
            super(dVar);
            this.f202035c = fVar;
        }

        @Override // wl3.a
        public final Object invokeSuspend(Object obj) {
            this.f202034b = obj;
            this.f202036d |= Integer.MIN_VALUE;
            return this.f202035c.a(null, this);
        }
    }

    @wl3.e(c = "com.linecorp.line.search.impl.service.SearchService", f = "SearchService.kt", l = {74}, m = "getMoreSearchResults")
    public static final class b extends wl3.c {

        /* renamed from: b  reason: collision with root package name */
        public Object f202037b;

        /* renamed from: c  reason: collision with root package name */
        public /* synthetic */ Object f202038c;

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ f f202039d;

        /* renamed from: e  reason: collision with root package name */
        public int f202040e;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public b(f fVar, d<? super b> dVar) {
            super(dVar);
            this.f202039d = fVar;
        }

        @Override // wl3.a
        public final Object invokeSuspend(Object obj) {
            this.f202038c = obj;
            this.f202040e |= Integer.MIN_VALUE;
            return this.f202039d.b(null, null, this);
        }
    }

    @wl3.e(c = "com.linecorp.line.search.impl.service.SearchService", f = "SearchService.kt", l = {46}, m = "getSearchResults")
    public static final class c extends wl3.c {

        /* renamed from: b  reason: collision with root package name */
        public Object f202041b;

        /* renamed from: c  reason: collision with root package name */
        public /* synthetic */ Object f202042c;

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ f f202043d;

        /* renamed from: e  reason: collision with root package name */
        public int f202044e;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public c(f fVar, d<? super c> dVar) {
            super(dVar);
            this.f202043d = fVar;
        }

        @Override // wl3.a
        public final Object invokeSuspend(Object obj) {
            this.f202042c = obj;
            this.f202044e |= Integer.MIN_VALUE;
            return this.f202043d.d(null, null, null, null, this);
        }
    }

    public f(e eVar, mr.a aVar, b bVar, d dVar, int i14) {
        d dVar2 = null;
        b bVar2 = (i14 & 4) != 0 ? new b(eVar, aVar, null, 4) : null;
        dVar2 = (i14 & 8) != 0 ? new d(new e(eVar)) : dVar2;
        q.f(eVar, "searchApiDataProvider");
        q.f(aVar, "legyHttp2Module");
        q.f(bVar2, "collectionMenuService");
        q.f(dVar2, "searchResultServiceManager");
        this.f202031a = eVar;
        this.f202032b = bVar2;
        this.f202033c = dVar2;
    }

    /* JADX WARNING: Removed duplicated region for block: B:14:0x0032  */
    /* JADX WARNING: Removed duplicated region for block: B:8:0x0022  */
    public final Object a(String str, d<? super GetCollectionMenuItemsResponse> dVar) {
        a aVar;
        int i14;
        if (dVar instanceof a) {
            aVar = (a) dVar;
            int i15 = aVar.f202036d;
            if ((i15 & Integer.MIN_VALUE) != 0) {
                aVar.f202036d = i15 - Integer.MIN_VALUE;
                Object obj = aVar.f202034b;
                vl3.a aVar2 = vl3.a.COROUTINE_SUSPENDED;
                i14 = aVar.f202036d;
                if (i14 != 0) {
                    ResultKt.throwOnFailure(obj);
                    b bVar = this.f202032b;
                    aVar.f202036d = 1;
                    obj = bVar.a(str, aVar);
                    if (obj == aVar2) {
                        return aVar2;
                    }
                } else if (i14 == 1) {
                    try {
                        ResultKt.throwOnFailure(obj);
                    } catch (m unused) {
                        return null;
                    } catch (Throwable th4) {
                        if (!(th4 instanceof CancellationException)) {
                            return null;
                        }
                        throw th4;
                    }
                } else {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                return (GetCollectionMenuItemsResponse) obj;
            }
        }
        aVar = new a(this, dVar);
        Object obj2 = aVar.f202034b;
        vl3.a aVar22 = vl3.a.COROUTINE_SUSPENDED;
        i14 = aVar.f202036d;
        if (i14 != 0) {
        }
        return (GetCollectionMenuItemsResponse) obj2;
    }

    /* JADX WARNING: Removed duplicated region for block: B:15:0x0039  */
    /* JADX WARNING: Removed duplicated region for block: B:25:0x0084  */
    /* JADX WARNING: Removed duplicated region for block: B:8:0x0024  */
    public final Object b(String str, SearchRequestData searchRequestData, d<? super SearchResultResponse> dVar) {
        b bVar;
        int i14;
        Throwable th4;
        f fVar;
        z zVar;
        SearchResultResponse copy$default;
        if (dVar instanceof b) {
            bVar = (b) dVar;
            int i15 = bVar.f202040e;
            if ((i15 & Integer.MIN_VALUE) != 0) {
                bVar.f202040e = i15 - Integer.MIN_VALUE;
                Object obj = bVar.f202038c;
                vl3.a aVar = vl3.a.COROUTINE_SUSPENDED;
                i14 = bVar.f202040e;
                boolean z14 = false;
                if (i14 != 0) {
                    ResultKt.throwOnFailure(obj);
                    try {
                        c b14 = this.f202033c.b();
                        if (b14 == null) {
                            return new SearchResultResponse(null, null, 2, null);
                        }
                        String c14 = c(this.f202031a.b());
                        Map<String, String> e14 = e(str);
                        Map<String, String> j14 = g0.j(TuplesKt.to("user-agent", "LINE"), TuplesKt.to("x-line-info", new Gson().o(searchRequestData)));
                        bVar.f202037b = this;
                        bVar.f202040e = 1;
                        obj = b14.a(c14, e14, j14, bVar);
                        if (obj == aVar) {
                            return aVar;
                        }
                    } catch (Throwable th5) {
                        th4 = th5;
                        fVar = this;
                        Objects.requireNonNull(fVar);
                        if ((th4 instanceof IOException) || (th4 instanceof i)) {
                            z14 = true;
                        }
                        if (z14) {
                            return new SearchResultResponse(null, null, 2, null);
                        }
                        throw th4;
                    }
                } else if (i14 == 1) {
                    fVar = (f) bVar.f202037b;
                    try {
                        ResultKt.throwOnFailure(obj);
                    } catch (Throwable th6) {
                        th4 = th6;
                    }
                } else {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                zVar = (z) obj;
                if (zVar != null) {
                    String str2 = zVar.b().get("x-nx-page-id");
                    if (str2 == null) {
                        str2 = "";
                    }
                    T t14 = zVar.f83850b;
                    return (t14 == null || (copy$default = SearchResultResponse.copy$default(t14, null, str2, 1, null)) == null) ? new SearchResultResponse(null, null, 2, null) : copy$default;
                }
                return new SearchResultResponse(null, null, 2, null);
            }
        }
        bVar = new b(this, dVar);
        Object obj2 = bVar.f202038c;
        vl3.a aVar2 = vl3.a.COROUTINE_SUSPENDED;
        i14 = bVar.f202040e;
        boolean z142 = false;
        if (i14 != 0) {
        }
        zVar = (z) obj2;
        if (zVar != null) {
        }
        return new SearchResultResponse(null, null, 2, null);
    }

    public final String c(String str) {
        List<String> pathSegments = Uri.parse(str).getPathSegments();
        q.e(pathSegments, "parse(this).pathSegments");
        return u.Z(pathSegments, "/", null, null, 0, null, null, 62);
    }

    /* JADX WARNING: Removed duplicated region for block: B:15:0x003d  */
    /* JADX WARNING: Removed duplicated region for block: B:25:0x008b  */
    /* JADX WARNING: Removed duplicated region for block: B:8:0x0028  */
    public final Object d(String str, String str2, String str3, SearchRequestData searchRequestData, d<? super SearchResultResponse> dVar) {
        c cVar;
        int i14;
        f fVar;
        Throwable th4;
        z zVar;
        SearchResultResponse copy$default;
        if (dVar instanceof c) {
            cVar = (c) dVar;
            int i15 = cVar.f202044e;
            if ((i15 & Integer.MIN_VALUE) != 0) {
                cVar.f202044e = i15 - Integer.MIN_VALUE;
                Object obj = cVar.f202042c;
                vl3.a aVar = vl3.a.COROUTINE_SUSPENDED;
                i14 = cVar.f202044e;
                boolean z14 = false;
                if (i14 != 0) {
                    ResultKt.throwOnFailure(obj);
                    try {
                        c b14 = this.f202033c.b();
                        if (b14 == null) {
                            return new SearchResultResponse(null, null, 2, null);
                        }
                        String c14 = c(this.f202031a.b());
                        Map<String, String> j14 = g0.j(TuplesKt.to("user-agent", "LINE"), TuplesKt.to("x-line-info", new Gson().o(searchRequestData)));
                        cVar.f202041b = this;
                        cVar.f202044e = 1;
                        obj = b14.b(c14, str, str2, str3, j14, cVar);
                        if (obj == aVar) {
                            return aVar;
                        }
                    } catch (Throwable th5) {
                        th4 = th5;
                        fVar = this;
                        Objects.requireNonNull(fVar);
                        if ((th4 instanceof IOException) || (th4 instanceof i)) {
                            z14 = true;
                        }
                        if (z14) {
                            return new SearchResultResponse(null, null, 2, null);
                        }
                        throw th4;
                    }
                } else if (i14 == 1) {
                    fVar = (f) cVar.f202041b;
                    try {
                        ResultKt.throwOnFailure(obj);
                    } catch (Throwable th6) {
                        th4 = th6;
                    }
                } else {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                zVar = (z) obj;
                if (zVar != null) {
                    String str4 = zVar.b().get("x-nx-page-id");
                    if (str4 == null) {
                        str4 = "";
                    }
                    T t14 = zVar.f83850b;
                    return (t14 == null || (copy$default = SearchResultResponse.copy$default(t14, null, str4, 1, null)) == null) ? new SearchResultResponse(null, null, 2, null) : copy$default;
                }
                return new SearchResultResponse(null, null, 2, null);
            }
        }
        cVar = new c(this, dVar);
        Object obj2 = cVar.f202042c;
        vl3.a aVar2 = vl3.a.COROUTINE_SUSPENDED;
        i14 = cVar.f202044e;
        boolean z142 = false;
        if (i14 != 0) {
        }
        zVar = (z) obj2;
        if (zVar != null) {
        }
        return new SearchResultResponse(null, null, 2, null);
    }

    public final Map<String, String> e(String str) {
        Uri parse = Uri.parse("https://line.me" + str);
        Set<String> queryParameterNames = parse.getQueryParameterNames();
        q.e(queryParameterNames, "uri.queryParameterNames");
        int a14 = f0.a(ql3.q.p(queryParameterNames, 10));
        if (a14 < 16) {
            a14 = 16;
        }
        LinkedHashMap linkedHashMap = new LinkedHashMap(a14);
        for (T t14 : queryParameterNames) {
            q.e(t14, "it");
            String queryParameter = parse.getQueryParameter(t14);
            if (queryParameter == null) {
                queryParameter = "";
            }
            linkedHashMap.put(t14, queryParameter);
        }
        return linkedHashMap;
    }
}