导航菜单

页面标题

页面副标题

Perplexity v2.48.1 - J2.java 源代码

正在查看: Perplexity v2.48.1 应用的 J2.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package l0;

import android.util.Patterns;
import i.AbstractC2572e;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Iterator;
import java.util.List;
import kotlin.LazyKt;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import kotlin.text.Regex;
import kotlin.text.RegexOption;

public abstract class J2 {

    public static final Regex f34714a = new Regex("\\[\\d+\\]");

    public static final Regex f34715b = new Regex("^(http(s)?://)?((w){3}.)?youtu(be\\.com|\\.be)(/watch\\?v=|/)?([\\w\\-]{11})?$");

    public static final Regex f34716c = new Regex("(?:(?:\\.be/|embed/|v/|\\?v=|&v=|/videos/)|(?:[\\w+]+#\\w/\\w(?:/[\\w]+)?/\\w/))([\\w\\-_]+)");

    public static final al.d f34717d = LazyKt.a(new jk.N(12));

    public static final String a(List list) {
        Intrinsics.h(list, "<this>");
        ArrayList arrayList = new ArrayList();
        for (Object obj : list) {
            if (((String) obj).length() > 0) {
                arrayList.add(obj);
            }
        }
        return bl.f.M0(arrayList, " ", (String) null, (String) null, (Function1) null, 62);
    }

    public static final String b(String str) {
        Charset charset = Charsets.b;
        byte[] bytes = str.getBytes(charset);
        Intrinsics.g(bytes, "getBytes(...)");
        byte[] decode = Base64.getUrlDecoder().decode(bytes);
        Intrinsics.e(decode);
        return new String(decode, charset);
    }

    public static final String c(String str) {
        Intrinsics.h(str, "<this>");
        if (str.length() == 0) {
            return str;
        }
        try {
            String host = new URL(str).getHost();
            Intrinsics.e(host);
            if (gm.i.P(host, "www.", false)) {
                host = host.substring(4);
                Intrinsics.g(host, "substring(...)");
            }
            while (host.length() > 0 && gm.i.P(host, ".", false)) {
                host = host.substring(1);
                Intrinsics.g(host, "substring(...)");
            }
            List l02 = gm.j.l0(host, new char[]{'.'});
            return l02.size() > 2 ? (Intrinsics.c(l02.get(l02.size() - 2), "co") || Intrinsics.c(l02.get(l02.size() - 2), "com")) ? (String) l02.get(l02.size() - 3) : (String) l02.get(l02.size() - 2) : l02.size() == 2 ? (String) bl.f.F0(l02) : host;
        } catch (Throwable unused) {
            Jn.c.a.i(AbstractC2572e.k('\'', "Failed to parse url = '", str), new Object[0]);
            return "";
        }
    }

    public static final String d(String str) {
        String a4;
        try {
            int i10 = Result.x;
            ArrayList arrayList = new ArrayList();
            int i11 = 0;
            while (i11 < str.length()) {
                arrayList.add(Integer.valueOf(str.codePointAt(i11)));
                i11 = str.offsetByCodePoints(i11, 1);
            }
            a4 = bl.f.M0(arrayList, "-", (String) null, (String) null, new jk.o0(15), 30);
        } catch (Throwable th) {
            int i12 = Result.x;
            a4 = ResultKt.a(th);
        }
        return Result.a(a4) == null ? a4 : "";
    }

    public static final String e(String str) {
        Intrinsics.h(str, "<this>");
        byte[] bytes = str.getBytes(Charsets.b);
        Intrinsics.g(bytes, "getBytes(...)");
        String encodeToString = Base64.getUrlEncoder().encodeToString(bytes);
        Intrinsics.e(encodeToString);
        return encodeToString;
    }

    public static final String f(String str) {
        Intrinsics.h(str, "<this>");
        kotlin.text.b a4 = f34716c.a(str);
        return (a4 == null || a4.a().c() <= 1) ? "" : (String) a4.a().get(1);
    }

    public static final String g(String str) {
        int c02;
        Intrinsics.h(str, "<this>");
        String str2 = "";
        if (str.length() != 0) {
            try {
                str2 = new URL(str).getHost();
                Intrinsics.e(str2);
                int c03 = gm.j.c0(str2, '.', gm.j.U(str), 4);
                if (c03 != -1 && (c02 = gm.j.c0(str2, '.', c03 - 1, 4)) != -1) {
                    List e02 = bl.b.e0(new String[]{"co", "com"});
                    String substring = str2.substring(c02 + 1, c03);
                    Intrinsics.g(substring, "substring(...)");
                    if (e02.contains(substring)) {
                        c02 = gm.j.c0(str2, '.', c02 - 1, 4);
                    }
                    if (c02 != -1) {
                        str2 = str2.substring(c02 + 1);
                        Intrinsics.g(str2, "substring(...)");
                    }
                }
            } catch (Throwable unused) {
                Jn.c.a.i(AbstractC2572e.k('\'', "Failed to parse url = '", str), new Object[0]);
            }
        }
        return "https://www.google.com/s2/favicons?sz=128&domain=".concat(r(str2));
    }

    public static final String h(String str) {
        if (str.length() != 0) {
            try {
                String path = new URL(str).getPath();
                Path path2 = Paths.get(path, new String[0]);
                if (path2.getNameCount() != 0) {
                    path = path2.getName(path2.getNameCount() - 1).toString();
                }
                Intrinsics.e(path);
                return path;
            } catch (Throwable unused) {
                Jn.c.a.i(AbstractC2572e.k('\'', "Failed to parse url = '", str), new Object[0]);
            }
        }
        return str;
    }

    public static final String i(String str) {
        String a4;
        try {
            int i10 = Result.x;
            List<String> k02 = gm.j.k0(str, new String[]{"-"});
            ArrayList arrayList = new ArrayList(bl.b.a0(k02, 10));
            for (String str2 : k02) {
                kotlin.text.a.a(16);
                arrayList.add(Integer.valueOf(Integer.parseInt(str2, 16)));
            }
            StringBuilder sb2 = new StringBuilder();
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                sb2 = sb2.appendCodePoint(((Number) it.next()).intValue());
                Intrinsics.g(sb2, "appendCodePoint(...)");
            }
            a4 = sb2.toString();
        } catch (Throwable th) {
            int i11 = Result.x;
            a4 = ResultKt.a(th);
        }
        if (Result.a(a4) != null) {
            return "";
        }
        String str3 = a4;
        Intrinsics.e(str3);
        return str3;
    }

    public static String j(String str) {
        Intrinsics.h(str, "<this>");
        int c02 = gm.j.c0(str, '.', 0, 6);
        if (g3.l0.A(c02) || c02 == gm.j.U(str)) {
            return "image.png";
        }
        String substring = str.substring(c02 + 1);
        Intrinsics.g(substring, "substring(...)");
        return "image.".concat(substring);
    }

    public static final String k(String str, String str2) {
        Intrinsics.h(str, "<this>");
        int c02 = gm.j.c0(str, '.', 0, 6);
        if (!g3.l0.A(c02) && c02 != gm.j.U(str)) {
            String substring = str.substring(c02 + 1);
            Intrinsics.g(substring, "substring(...)");
            switch (substring.hashCode()) {
                case 105441:
                    if (substring.equals("jpg")) {
                        return "image/jpeg";
                    }
                    break;
                case 111145:
                    if (substring.equals("png")) {
                        return "image/png";
                    }
                    break;
                case 3268712:
                    if (substring.equals("jpeg")) {
                        return "image/jpeg";
                    }
                    break;
                case 3645340:
                    if (substring.equals("webp")) {
                        return "image/webp";
                    }
                    break;
            }
        }
        return str2;
    }

    public static final boolean l(String str) {
        Intrinsics.h(str, "<this>");
        return gm.i.I(str, ".jpg", false) || gm.i.I(str, ".jpeg", false);
    }

    public static final boolean m(String str) {
        Intrinsics.h(str, "<this>");
        return gm.i.P(str, "image/", false);
    }

    public static final boolean n(String str) {
        Intrinsics.h(str, "<this>");
        return !gm.j.b0(str) && Patterns.EMAIL_ADDRESS.matcher(str).matches();
    }

    public static final String o(String str) {
        Intrinsics.h(str, "<this>");
        return f34714a.e(str, "");
    }

    public static final String p(String str) {
        Intrinsics.h(str, "<this>");
        String e10 = new Regex("`(.+?)`").e(new Regex("~~(.+?)~~").e(new Regex("_(.+?)_").e(new Regex("\\*\\*(.+?)\\*\\*").e(str, "$1"), "$1"), "$1"), "$1");
        RegexOption regexOption = RegexOption.z;
        return new Regex("^\\s*\\d+\\.\\s+", regexOption).e(new Regex("^\\s*[*+-]\\s+", regexOption).e(new Regex("\\[(.+?)\\]\\(.+?\\)").e(new Regex("^#+\\s+(.+)$", regexOption).e(new Regex("``````", regexOption).e(e10, ""), "$1"), "$1"), ""), "");
    }

    public static final String q(String str) {
        String decode = URLDecoder.decode(str, Charsets.b.name());
        Intrinsics.g(decode, "decode(...)");
        return decode;
    }

    public static final String r(String str) {
        Intrinsics.h(str, "<this>");
        String encode = URLEncoder.encode(str, Charsets.b.name());
        Intrinsics.g(encode, "encode(...)");
        return encode;
    }
}