package defpackage;

import android.net.Uri;
import androidx.core.content.FileProvider;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;

/* renamed from: ᵿʣ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C5474 {

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final String f20546;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final HashMap f20547 = new HashMap();

    public C5474(String str) {
        this.f20546 = str;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final File m11103(Uri uri) throws IOException {
        String encodedPath = uri.getEncodedPath();
        int iIndexOf = encodedPath.indexOf(47, 1);
        if (iIndexOf == -1) {
            ᵨᴵᵺ.ᵨᵳʝ(uri, "Unable to find path from root: ");
            return null;
        }
        String strDecode = Uri.decode(encodedPath.substring(1, iIndexOf));
        String strDecode2 = Uri.decode(encodedPath.substring(iIndexOf + 1));
        File file = (File) this.f20547.get(strDecode);
        if (file == null) {
            ᵨᴵᵺ.ᵨᵳʝ(uri, "Unable to find configured root for ");
            return null;
        }
        File file2 = new File(file, strDecode2);
        try {
            File canonicalFile = file2.getCanonicalFile();
            if (FileProvider.ᵥᵯˎ(canonicalFile.getPath()).startsWith(FileProvider.ᵥᵯˎ(file.getPath()).concat("/"))) {
                return canonicalFile;
            }
            throw new SecurityException("Resolved path jumped beyond configured root");
        } catch (IOException unused) {
            ᵨᴵᵺ.ᵨᵳʝ(file2, "Failed to resolve canonical path for ");
            return null;
        }
    }
}
