X-plore v4.37.09版本的 MD5 值为:1ac588cd7c13e9578c2d4266387e2f4f

以下内容为反编译后的 d.java 源代码,内容仅作参考


package K6;

import F2.ZMqY.WdjwpVRPRVA;
import F6.AbstractC1143l;
import F6.C;
import F6.C1141j;
import F6.C1145n;
import F6.C1148q;
import F7.C1160d;
import F7.t;
import F7.w;
import H7.AbstractC1204h;
import H7.AbstractC1208j;
import H7.AbstractC1211k0;
import H7.L;
import X6.m;
import Z2.gV.aVJUUIozox;
import android.net.Uri;
import b7.x;
import com.lonelycatgames.Xplore.Browser;
import com.lonelycatgames.Xplore.FileSystem.h;
import h7.AbstractC6732u;
import h7.AbstractC6736y;
import h7.C6709J;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Locale;
import java.util.Set;
import m7.InterfaceC7068d;
import o7.AbstractC7136l;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import t6.k;
import u6.AbstractC7556B;
import v7.l;
import v7.p;
import w0.VHo.EgGm;
import w7.AbstractC7771k;
import w7.AbstractC7777q;
import w7.AbstractC7780t;
import w7.AbstractC7781u;
import w7.C7759S;
import z6.AbstractC7990b;
import z6.AbstractC7992d;
import z6.C7989a;

public final class d extends K6.b {

    public static final C0198d f6725w0 = new C0198d(null);

    private static final AbstractC7990b.C0993b f6726x0 = new b(AbstractC7556B.f55596A0, c.f6737I);

    private static final SimpleDateFormat f6727y0 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);

    private final class a extends OutputStream implements h.l {

        private OutputStream f6728E;

        private int f6729F;

        private C1145n f6730G;

        final d f6731H;

        private final String f6732a;

        private final C1141j f6733b;

        private long f6734c;

        private String f6735d;

        public HttpURLConnection f6736e;

        public a(d dVar, String str, C1141j c1141j) {
            AbstractC7780t.f(str, "fullPath");
            this.f6731H = dVar;
            this.f6732a = str;
            this.f6733b = c1141j;
            d();
        }

        private final JSONObject h() {
            return k.c0(AbstractC6736y.a("cursor", k.c0(AbstractC6736y.a("session_id", this.f6735d), AbstractC6736y.a(EgGm.lYCEoBu, Long.valueOf(this.f6734c)))));
        }

        private final int l(byte[] bArr, int i9, int i10) {
            if (this.f6729F == 0) {
                f();
                d();
            }
            int min = Math.min(i10, this.f6729F);
            OutputStream outputStream = this.f6728E;
            AbstractC7780t.c(outputStream);
            outputStream.write(bArr, i9, min);
            this.f6729F -= min;
            this.f6734c += min;
            return min;
        }

        @Override
        public C1145n b() {
            close();
            C1145n c1145n = this.f6730G;
            if (c1145n == null) {
                throw new FileNotFoundException();
            }
            if (c1145n != null) {
                return c1145n;
            }
            AbstractC7780t.r("createdFile");
            return null;
        }

        @Override
        public void close() {
            Set E8;
            if (this.f6728E == null) {
                return;
            }
            f();
            try {
                JSONObject h9 = h();
                h9.put("commit", k.c0(AbstractC6736y.a("path", this.f6732a), AbstractC6736y.a("mode", "overwrite"), AbstractC6736y.a("mute", Boolean.TRUE)));
                HttpURLConnection F32 = this.f6731H.F3("upload_session/finish", h9);
                F32.setRequestProperty("Content-Type", "application/octet-stream");
                if (F32.getResponseCode() != 200) {
                    throw new IOException("Upload failed: " + this.f6731H.X1(F32));
                }
                JSONObject g9 = AbstractC7990b.f60542s0.g(F32);
                if (g9.optLong("size") != this.f6734c) {
                    throw new IOException("Upload size mismatch");
                }
                long h10 = d.f6725w0.h(g9);
                com.lonelycatgames.Xplore.FileSystem.h h02 = this.f6731H.h0();
                d dVar = this.f6731H;
                String string = g9.getString("id");
                AbstractC7780t.e(string, "getString(...)");
                this.f6730G = h02.P(new AbstractC7992d.k(dVar, string, null, 4, null), this.f6732a, h10, this.f6733b);
                C7989a.b bVar = (C7989a.b) this.f6733b;
                if (bVar != null && (E8 = bVar.E()) != null) {
                    E8.add(k.I(this.f6732a));
                }
                this.f6731H.o3(true);
            } catch (h.j e9) {
                throw new IOException(k.Q(e9));
            }
        }

        public final void d() {
            try {
                j(this.f6735d == null ? this.f6731H.F3("upload_session/start", null) : this.f6731H.F3(WdjwpVRPRVA.vbINFD, h()));
                i().setRequestProperty("Content-Type", "application/octet-stream");
                i().setChunkedStreamingMode(16384);
                this.f6728E = i().getOutputStream();
                this.f6729F = 134217728;
            } catch (h.j e9) {
                throw new IOException(k.Q(e9));
            }
        }

        public final void f() {
            OutputStream outputStream = this.f6728E;
            if (outputStream != null) {
                outputStream.close();
            }
            this.f6728E = null;
            if (i().getResponseCode() != 200) {
                throw new IOException("Upload error code: " + this.f6731H.X1(i()));
            }
            if (this.f6735d == null) {
                try {
                    this.f6735d = AbstractC7990b.f60542s0.g(i()).getString("session_id");
                } catch (JSONException unused) {
                    throw new IOException("Upload failed");
                }
            }
        }

        public final HttpURLConnection i() {
            HttpURLConnection httpURLConnection = this.f6736e;
            if (httpURLConnection != null) {
                return httpURLConnection;
            }
            AbstractC7780t.r("con");
            return null;
        }

        public final void j(HttpURLConnection httpURLConnection) {
            AbstractC7780t.f(httpURLConnection, "<set-?>");
            this.f6736e = httpURLConnection;
        }

        @Override
        public Void write(int i9) {
            throw new IOException();
        }

        @Override
        public void write(byte[] bArr, int i9, int i10) {
            AbstractC7780t.f(bArr, "b");
            while (i10 > 0) {
                int l9 = l(bArr, i9, i10);
                i9 += l9;
                i10 -= l9;
            }
        }
    }

    public static final class b extends AbstractC7990b.C0993b {
        b(int i9, c cVar) {
            super(i9, "Dropbox", cVar, true);
        }
    }

    class c extends AbstractC7777q implements p {

        public static final c f6737I = new c();

        c() {
            super(2, d.class, "<init>", "<init>(Lcom/lonelycatgames/Xplore/FileSystem/net/CloudFileSystem;Landroid/net/Uri;)V", 0);
        }

        @Override
        public final d r(C7989a c7989a, Uri uri) {
            AbstractC7780t.f(c7989a, "p0");
            AbstractC7780t.f(uri, "p1");
            return new d(c7989a, uri, null);
        }
    }

    public static final class C0198d {
        private C0198d() {
        }

        public C0198d(AbstractC7771k abstractC7771k) {
            this();
        }

        public final String d(String str, boolean z8, String str2) {
            boolean D8;
            StringBuilder sb = new StringBuilder("https://");
            sb.append(str);
            if (z8) {
                t.h(sb, '/', 2);
            }
            D8 = w.D(str2, "/", false, 2, null);
            if (!D8) {
                sb.append('/');
            }
            sb.append(str2);
            String sb2 = sb.toString();
            AbstractC7780t.e(sb2, aVJUUIozox.KkDN);
            return sb2;
        }

        public final String e(String str) {
            StringBuilder sb = new StringBuilder(str.length() * 2);
            int length = str.length();
            for (int i9 = 0; i9 < length; i9++) {
                char charAt = str.charAt(i9);
                if (charAt >= 128) {
                    C7759S c7759s = C7759S.f58210a;
                    String format = String.format("\\u%04x", Arrays.copyOf(new Object[]{Integer.valueOf(charAt)}, 1));
                    AbstractC7780t.e(format, "format(...)");
                    sb.append(format);
                } else {
                    sb.append(charAt);
                }
            }
            String sb2 = sb.toString();
            AbstractC7780t.e(sb2, "let(...)");
            return sb2;
        }

        public final long h(JSONObject jSONObject) {
            String optString = jSONObject.optString("client_modified");
            if (optString.length() <= 0) {
                optString = null;
            }
            if (optString != null) {
                return AbstractC7990b.f60542s0.e(optString, d.f6727y0, true);
            }
            return 0L;
        }

        public final JSONObject f(String str) {
            AbstractC7780t.f(str, "cmd");
            URLConnection openConnection = new URL(d("api.dropboxapi.com", false, "/oauth2/token")).openConnection();
            AbstractC7780t.d(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
            HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
            httpURLConnection.setRequestMethod("POST");
            httpURLConnection.setDoOutput(true);
            String str2 = "grant_type=authorization_code&client_id=d8a5mdmavbii0eq&client_secret=ouwwhwhlcgxy3hz&redirect_uri=" + Uri.encode("https://www.lonelycatgames.com/internal/xplore/authcode") + '&' + str;
            httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            OutputStream outputStream = httpURLConnection.getOutputStream();
            try {
                byte[] bytes = str2.getBytes(C1160d.f4033b);
                AbstractC7780t.e(bytes, "getBytes(...)");
                outputStream.write(bytes);
                C6709J c6709j = C6709J.f49946a;
                t7.c.a(outputStream, null);
                int responseCode = httpURLConnection.getResponseCode();
                if (responseCode != 200) {
                    throw new IOException("Invalid response: " + responseCode);
                }
                InputStream inputStream = httpURLConnection.getInputStream();
                try {
                    AbstractC7780t.c(inputStream);
                    String o02 = k.o0(inputStream);
                    t7.c.a(inputStream, null);
                    try {
                        return new JSONObject(o02);
                    } catch (JSONException e9) {
                        throw new IOException(k.Q(e9));
                    }
                } finally {
                }
            } finally {
            }
        }

        public final AbstractC7990b.C0993b g() {
            return d.f6726x0;
        }
    }

    public static final class e extends A6.a {

        public static final class a extends AbstractC7136l implements p {

            final String f6739F;

            int f6740e;

            public static final class C0199a extends AbstractC7136l implements p {

                final String f6741E;

                int f6742e;

                C0199a(String str, InterfaceC7068d interfaceC7068d) {
                    super(2, interfaceC7068d);
                    this.f6741E = str;
                }

                @Override
                public final Object r(L l9, InterfaceC7068d interfaceC7068d) {
                    return ((C0199a) u(l9, interfaceC7068d)).z(C6709J.f49946a);
                }

                @Override
                public final InterfaceC7068d u(Object obj, InterfaceC7068d interfaceC7068d) {
                    return new C0199a(this.f6741E, interfaceC7068d);
                }

                @Override
                public final Object z(Object obj) {
                    n7.d.f();
                    if (this.f6742e != 0) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    AbstractC6732u.b(obj);
                    return d.f6725w0.f("code=" + this.f6741E);
                }
            }

            a(String str, InterfaceC7068d interfaceC7068d) {
                super(2, interfaceC7068d);
                this.f6739F = str;
            }

            @Override
            public final Object r(L l9, InterfaceC7068d interfaceC7068d) {
                return ((a) u(l9, interfaceC7068d)).z(C6709J.f49946a);
            }

            @Override
            public final InterfaceC7068d u(Object obj, InterfaceC7068d interfaceC7068d) {
                return new a(this.f6739F, interfaceC7068d);
            }

            @Override
            public final Object z(Object obj) {
                Object f9;
                f9 = n7.d.f();
                int i9 = this.f6740e;
                try {
                    if (i9 == 0) {
                        AbstractC6732u.b(obj);
                        AbstractC1211k0 H8 = e.this.u().B1().H();
                        C0199a c0199a = new C0199a(this.f6739F, null);
                        this.f6740e = 1;
                        obj = AbstractC1204h.g(H8, c0199a, this);
                        if (obj == f9) {
                            return f9;
                        }
                    } else {
                        if (i9 != 1) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                        AbstractC6732u.b(obj);
                    }
                    JSONObject jSONObject = (JSONObject) obj;
                    String optString = jSONObject.optString("access_token");
                    AbstractC7780t.c(optString);
                    if (optString.length() > 0) {
                        K6.b.v3(e.J(e.this), optString, null, 2, null);
                        e.this.f();
                        C1141j.o1(e.J(e.this), e.this.u(), false, null, 6, null);
                    } else {
                        e eVar = e.this;
                        String optString2 = jSONObject.optString("error_description");
                        AbstractC7780t.c(optString2);
                        String str = optString2.length() > 0 ? optString2 : null;
                        if (str == null) {
                            str = jSONObject.optString("error", "Auth failed");
                        }
                        eVar.M(str);
                    }
                } catch (Exception e9) {
                    e.this.M(k.Q(e9));
                }
                return C6709J.f49946a;
            }
        }

        public e(m mVar, d dVar) {
            super(mVar, dVar, "https://www.lonelycatgames.com/internal/xplore/authcode", !dVar.T2());
            AbstractC7780t.f(mVar, "p");
            AbstractC7780t.f(dVar, "server");
        }

        public static final d J(e eVar) {
            return (d) eVar.v();
        }

        public final void M(String str) {
            Browser X02 = u().X0();
            if (str == null) {
                str = "Authorization failed";
            }
            Browser.I3(X02, str, false, 2, null);
        }

        @Override
        protected void A(String str) {
            AbstractC7780t.f(str, "url");
            Uri parse = Uri.parse(str);
            AbstractC7780t.e(parse, "parse(...)");
            L(parse);
        }

        @Override
        public void H() {
            w().loadUrl(((d) v()).G3().toString());
        }

        public final void L(Uri uri) {
            AbstractC7780t.f(uri, "uri");
            String queryParameter = uri.getQueryParameter("code");
            if (queryParameter != null) {
                AbstractC1208j.d(u().B1().G(), null, null, new a(queryParameter, null), 3, null);
                return;
            }
            String queryParameter2 = uri.getQueryParameter("error_description");
            if (queryParameter2 == null) {
                queryParameter2 = uri.getQueryParameter("error");
            }
            M(queryParameter2);
        }
    }

    public static final class f extends AbstractC7781u implements l {

        final JSONObject f6743b;

        f(JSONObject jSONObject) {
            super(1);
            this.f6743b = jSONObject;
        }

        public final void a(HttpURLConnection httpURLConnection) {
            String str;
            AbstractC7780t.f(httpURLConnection, "$this$createAndRunHttpConnection");
            JSONObject jSONObject = this.f6743b;
            if (jSONObject == null || (str = jSONObject.toString()) == null) {
                str = "null";
            }
            httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
            OutputStream outputStream = httpURLConnection.getOutputStream();
            byte[] bytes = str.getBytes(C1160d.f4033b);
            AbstractC7780t.e(bytes, "getBytes(...)");
            outputStream.write(bytes);
        }

        @Override
        public Object h(Object obj) {
            a((HttpURLConnection) obj);
            return C6709J.f49946a;
        }
    }

    private d(C7989a c7989a, Uri uri) {
        super(c7989a, uri, AbstractC7556B.f55596A0, null, 8, null);
        t2(uri);
    }

    public d(C7989a c7989a, Uri uri, AbstractC7771k abstractC7771k) {
        this(c7989a, uri);
    }

    private final void D3(String str) {
        K3("/files/delete", k.c0(AbstractC6736y.a("path", str)));
    }

    private final HttpURLConnection E3(String str) {
        return F3("download", k.c0(AbstractC6736y.a("path", str)));
    }

    public final HttpURLConnection F3(String str, JSONObject jSONObject) {
        C0198d c0198d = f6725w0;
        int i9 = 2 >> 1;
        HttpURLConnection Q22 = Q2("POST", c0198d.d("content.dropboxapi.com", true, "/files/" + str));
        Q22.setRequestProperty("Content-Type", "");
        if (jSONObject != null) {
            String jSONObject2 = jSONObject.toString();
            AbstractC7780t.e(jSONObject2, "toString(...)");
            Q22.setRequestProperty("Dropbox-API-Arg", c0198d.e(jSONObject2));
        }
        return Q22;
    }

    public final Uri.Builder G3() {
        return new Uri.Builder().scheme("https").authority("www.dropbox.com").path("oauth2/authorize").appendQueryParameter("response_type", "code").appendQueryParameter("disable_signup", "true").appendQueryParameter("client_id", "d8a5mdmavbii0eq").appendQueryParameter("redirect_uri", "https://www.lonelycatgames.com/internal/xplore/authcode");
    }

    private final String H3(C c9) {
        return c9 instanceof AbstractC7990b ? "/" : AbstractC7992d.f60582j0.d(c9.i0());
    }

    private final void I3(String str, String str2) {
        K3("/files/move", k.c0(AbstractC6736y.a("from_path", str), AbstractC6736y.a("to_path", str2)));
    }

    private final String J3(C1141j c1141j, String str) {
        return com.lonelycatgames.Xplore.FileSystem.h.f44583b.e(H3(c1141j), str);
    }

    private final JSONObject K3(String str, JSONObject jSONObject) {
        return AbstractC7990b.f60542s0.g(N2("POST", f6725w0.d("api.dropboxapi.com", true, str), new f(jSONObject)));
    }

    public final void C3(m mVar) {
        AbstractC7780t.f(mVar, "pane");
        if (!T2()) {
            G(new e(mVar, this), mVar);
            return;
        }
        Uri.Builder G32 = G3();
        AbstractC7780t.e(G32, "<get-loginUrl>(...)");
        AbstractC7990b.E2(this, mVar, G32, null, null, 12, null);
    }

    @Override
    public boolean H2(C c9) {
        AbstractC7780t.f(c9, "le");
        return !AbstractC7780t.a(c9, this);
    }

    @Override
    protected boolean M2(C1141j c1141j, String str) {
        AbstractC7780t.f(c1141j, "dir");
        AbstractC7780t.f(str, "name");
        try {
            if (K3("/files/get_metadata", k.c0(AbstractC6736y.a("path", c1141j.j0(str)))).has("name")) {
                return true;
            }
        } catch (Exception unused) {
        }
        return false;
    }

    @Override
    public C1141j P2(C1141j c1141j, String str) {
        AbstractC7780t.f(c1141j, "parent");
        AbstractC7780t.f(str, "name");
        try {
            K3("/files/create_folder", k.c0(AbstractC6736y.a("path", J3(c1141j, str))));
            return new AbstractC7992d.a(this, 0L, 2, null);
        } catch (x.c e9) {
            if (e9.b() != 409 || !(c1141j instanceof C7989a.b) || (!((C7989a.b) c1141j).E().contains(str) && c1141j.s1())) {
                throw new IOException("Can't create dir");
            }
            int i9 = 5 ^ 0;
            return new AbstractC7992d.a(this, 0L, 2, null);
        }
    }

    @Override
    public void R2(C c9) {
        AbstractC7780t.f(c9, "le");
        D3(H3(c9));
    }

    @Override
    public OutputStream S1(C c9, String str, long j9, Long l9) {
        AbstractC7780t.f(c9, "le");
        String H32 = H3(c9);
        if (str != null) {
            H32 = com.lonelycatgames.Xplore.FileSystem.h.f44583b.e(H32, str);
        }
        return new a(this, H32, str != null ? c9 instanceof C1141j ? (C1141j) c9 : null : c9.u0());
    }

    @Override
    public AbstractC7990b.C0993b U2() {
        return f6726x0;
    }

    @Override
    public String V1(String str, String str2) {
        AbstractC7780t.f(str, "content");
        if (AbstractC7780t.a(str2, "application/json")) {
            try {
                String optString = new JSONObject(str).optString("error_summary");
                AbstractC7780t.c(optString);
                if (optString.length() > 0) {
                    return optString;
                }
            } catch (JSONException e9) {
                e9.printStackTrace();
            }
        }
        return super.V1(str, str2);
    }

    @Override
    public int V2() {
        return 1;
    }

    @Override
    public Object clone() {
        return super.clone();
    }

    @Override
    public void d3(C c9, C1141j c1141j, String str) {
        AbstractC7780t.f(c9, "le");
        AbstractC7780t.f(c1141j, "newParent");
        String H32 = H3(c9);
        if (str == null) {
            str = c9.p0();
        }
        String J32 = J3(c1141j, str);
        try {
            I3(H32, J32);
        } catch (h.j unused) {
            D3(J32);
            I3(H32, J32);
        } catch (IOException unused2) {
            D3(J32);
            I3(H32, J32);
        }
    }

    @Override
    public void f3(Uri uri, m mVar) {
        AbstractC7780t.f(uri, "uri");
        AbstractC7780t.f(mVar, "pane");
        e eVar = new e(mVar, this);
        eVar.L(uri);
        G(eVar, mVar);
    }

    @Override
    public boolean i2() {
        return true;
    }

    @Override
    public void i3(C c9, String str) {
        AbstractC7780t.f(c9, "le");
        AbstractC7780t.f(str, "newName");
        if (AbstractC7780t.a(c9, this)) {
            j3(str);
            return;
        }
        String H32 = H3(c9);
        AbstractC7992d.C0994d c0994d = AbstractC7992d.f60582j0;
        h.b bVar = com.lonelycatgames.Xplore.FileSystem.h.f44583b;
        String R8 = k.R(H32);
        if (R8 == null) {
            R8 = "";
        }
        I3(H32, c0994d.d(bVar.e(R8, str)));
    }

    @Override
    public void j2(h.f fVar) {
        JSONObject K32;
        int i9;
        int i10;
        JSONArray jSONArray;
        String str;
        C R12;
        AbstractC7780t.f(fVar, "lister");
        String str2 = null;
        if (W2() == null) {
            throw new h.j(null, 1, null);
        }
        super.j2(fVar);
        while (true) {
            if (str2 == null) {
                try {
                    String H32 = H3(fVar.m());
                    if (AbstractC7780t.a(H32, "/")) {
                        H32 = "";
                    }
                    K32 = K3("/files/list_folder", k.c0(AbstractC6736y.a("path", H32)));
                } catch (JSONException e9) {
                    throw new IOException(k.Q(e9));
                }
            } else {
                K32 = K3("/files/list_folder/continue", k.c0(AbstractC6736y.a("cursor", str2)));
            }
            JSONObject jSONObject = K32;
            JSONArray jSONArray2 = jSONObject.getJSONArray("entries");
            AbstractC7780t.c(jSONArray2);
            int length = jSONArray2.length();
            int i11 = 0;
            while (i11 < length) {
                JSONObject jSONObject2 = (JSONObject) jSONArray2.get(i11);
                String string = jSONObject2.getString("name");
                String string2 = jSONObject2.getString(".tag");
                if (AbstractC7780t.a(string2, "folder")) {
                    R12 = new AbstractC7992d.a(this, 0L, 2, null);
                    str = string;
                    i9 = i11;
                    i10 = length;
                    jSONArray = jSONArray2;
                } else if (AbstractC7780t.a(string2, "file")) {
                    AbstractC7780t.c(string);
                    str = string;
                    i9 = i11;
                    i10 = length;
                    jSONArray = jSONArray2;
                    R12 = AbstractC7992d.R1(this, fVar, string, f6725w0.h(jSONObject2), jSONObject2.optLong("size", -1L), null, null, 48, null);
                } else {
                    i9 = i11;
                    i10 = length;
                    jSONArray = jSONArray2;
                    i11 = i9 + 1;
                    jSONArray2 = jSONArray;
                    length = i10;
                }
                AbstractC7780t.c(str);
                fVar.c(R12, str);
                i11 = i9 + 1;
                jSONArray2 = jSONArray;
                length = i10;
            }
            if (!jSONObject.optBoolean("has_more")) {
                return;
            } else {
                str2 = jSONObject.getString("cursor");
            }
        }
    }

    @Override
    public InputStream k2(C c9, int i9, long j9) {
        int i10;
        AbstractC7780t.f(c9, "le");
        String H32 = H3(c9);
        if (i9 == 1 && (c9 instanceof C1148q)) {
            try {
                JSONObject c02 = k.c0(AbstractC6736y.a("path", H32), AbstractC6736y.a("size", k.c0(AbstractC6736y.a(".tag", "w640h480"))));
                if (AbstractC7780t.a(((C1148q) c9).A(), "image/png")) {
                    c02.put("format", k.c0(AbstractC6736y.a(".tag", "PNG")));
                }
                InputStream inputStream = F3("get_thumbnail", c02).getInputStream();
                AbstractC7780t.e(inputStream, "getInputStream(...)");
                return inputStream;
            } catch (h.j e9) {
                throw new IOException(e9.getMessage());
            } catch (IOException e10) {
                e10.printStackTrace();
            }
        }
        try {
            HttpURLConnection E32 = E3(H32);
            if (j9 > 0) {
                AbstractC7992d.C0994d.b(AbstractC7992d.f60582j0, E32, j9, 0L, 2, null);
                i10 = 206;
            } else {
                i10 = 200;
            }
            if (E32.getResponseCode() == i10) {
                InputStream inputStream2 = E32.getInputStream();
                AbstractC7780t.e(inputStream2, "getInputStream(...)");
                return inputStream2;
            }
            throw new IOException("Can't open URI: " + X1(E32));
        } catch (h.j e11) {
            throw new IOException(k.Q(e11));
        }
    }

    @Override
    public void q3(C c9) {
        AbstractC7780t.f(c9, "le");
        if ((c9 instanceof C1141j) || !(c9 instanceof C1145n)) {
            return;
        }
        JSONObject K32 = K3("/files/get_metadata", k.c0(AbstractC6736y.a("path", c9.i0())));
        C1145n c1145n = (C1145n) c9;
        c1145n.m1(f6725w0.h(K32));
        c1145n.l1(K32.optLong("size", -1L));
    }

    @Override
    protected void r3() {
        String optString;
        JSONObject K32 = K3("/users/get_space_usage", null);
        long optLong = K32.optLong("used");
        JSONObject optJSONObject = K32.optJSONObject("allocation");
        m3(new AbstractC1143l.b(optLong, optJSONObject != null ? optJSONObject.optLong("allocated") : 0L));
        Uri a22 = a2();
        if ((a22 != null ? a22.getFragment() : null) == null) {
            JSONObject K33 = K3("/users/get_current_account", null);
            JSONObject optJSONObject2 = K33.optJSONObject("name");
            if (optJSONObject2 == null || (optString = optJSONObject2.optString("display_name")) == null) {
                optString = K33.optString("email");
            }
            AbstractC7780t.c(optString);
            if (optString.length() > 0) {
                i3(this, optString);
            }
        }
    }

    @Override
    public boolean z2() {
        return true;
    }
}