package o;

import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Pair;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.ws0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final /* synthetic */ class RunnableC2853ws0 implements Runnable {
    public final /* synthetic */ int l;
    public final /* synthetic */ Xs0 m;

    public /* synthetic */ RunnableC2853ws0(Xs0 xs0, int i) {
        this.l = i;
        this.m = xs0;
    }

    @Override // java.lang.Runnable
    public final void run() {
        switch (this.l) {
            case 0:
                this.m.P();
                break;
            case 1:
                Ir0 ir0 = this.m.r;
                Kr0 kr0 = ir0.l;
                Fr0 fr0 = kr0.g;
                Xs0 xs0 = kr0.m;
                C1617jr0 c1617jr0 = kr0.e;
                Kr0.l(fr0);
                fr0.r();
                if (ir0.e()) {
                    if (ir0.d()) {
                        Kr0.j(c1617jr0);
                        c1617jr0.w.h(null);
                        Bundle bundle = new Bundle();
                        bundle.putString("source", "(not set)");
                        bundle.putString("medium", "(not set)");
                        bundle.putString("_cis", "intent");
                        bundle.putLong("_cc", 1L);
                        Kr0.k(xs0);
                        xs0.z("auto", "_cmpx", bundle);
                    } else {
                        Kr0.j(c1617jr0);
                        C0949cs c0949cs = c1617jr0.w;
                        String strG = c0949cs.g();
                        if (TextUtils.isEmpty(strG)) {
                            Nq0 nq0 = kr0.f;
                            Kr0.l(nq0);
                            nq0.g.b("Cache still valid but referrer not found");
                        } else {
                            long jA = c1617jr0.x.a() / 3600000;
                            Uri uri = Uri.parse(strG);
                            Bundle bundle2 = new Bundle();
                            Pair pair = new Pair(uri.getPath(), bundle2);
                            for (String str : uri.getQueryParameterNames()) {
                                bundle2.putString(str, uri.getQueryParameter(str));
                            }
                            ((Bundle) pair.second).putLong("_cc", (jA - 1) * 3600000);
                            Object obj = pair.first;
                            String str2 = obj == null ? "app" : (String) obj;
                            Kr0.k(xs0);
                            xs0.z(str2, "_cmp", (Bundle) pair.second);
                        }
                        c0949cs.h(null);
                    }
                    Kr0.j(c1617jr0);
                    c1617jr0.x.b(0L);
                    break;
                }
                break;
            case 2:
                Xs0 xs02 = this.m;
                xs02.r();
                Kr0 kr02 = (Kr0) xs02.a;
                C1617jr0 c1617jr02 = kr02.e;
                Nq0 nq02 = kr02.f;
                Kr0.j(c1617jr02);
                C0948cr0 c0948cr0 = c1617jr02.t;
                if (c0948cr0.a()) {
                    Kr0.l(nq02);
                    nq02.m.b("Deferred Deep Link already retrieved. Not fetching again.");
                    break;
                } else {
                    C1235fr0 c1235fr0 = c1617jr02.u;
                    long jA2 = c1235fr0.a();
                    c1235fr0.b(1 + jA2);
                    if (jA2 >= 5) {
                        Kr0.l(nq02);
                        nq02.i.b("Permanently failed to retrieve Deferred Deep Link. Reached maximum retries.");
                        c0948cr0.b(true);
                        break;
                    } else {
                        if (xs02.t == null) {
                            xs02.t = new C3043ys0(xs02, kr02, 3);
                        }
                        xs02.t.b(0L);
                        break;
                    }
                }
            default:
                this.m.P();
                break;
        }
    }
}
