WeChat.apk(点击下载) / o.java


package qr0;

import android.net.Uri;
import android.os.StatFs;
import android.text.TextUtils;
import android.webkit.URLUtil;
import com.tencent.mm.sdk.platformtools.LocaleUtil;
import com.tencent.mm.vfs.h0;
import com.tencent.mm.vfs.n2;
import com.tencent.mm.vfs.o2;
import com.tencent.mm.vfs.q1;
import com.tencent.mm.vfs.u1;
import com.tencent.tmassistantsdk.downloadservice.DownloadInfo;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.NoRouteToHostException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.AbstractExecutorService;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import lr0.k;
import or0.h;
import or0.i;
import pr0.e;
import pr0.f;
import pr0.k;
import pr0.l;
import pr0.m;
import sr0.g;
import sr0.l;
import sr0.m;

public class o {

    /* renamed from: m  reason: collision with root package name */
    public static AtomicInteger f290932m = new AtomicInteger(10000);

    /* renamed from: n  reason: collision with root package name */
    public static AtomicInteger f290933n = new AtomicInteger(10000);

    /* renamed from: a  reason: collision with root package name */
    public int f290934a = 0;

    /* renamed from: b  reason: collision with root package name */
    public boolean f290935b = true;

    /* renamed from: c  reason: collision with root package name */
    public or0.a f290936c;

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

    /* renamed from: e  reason: collision with root package name */
    public ServerSocket f290938e;

    /* renamed from: f  reason: collision with root package name */
    public final ExecutorService f290939f;

    /* renamed from: g  reason: collision with root package name */
    public final r f290940g;

    /* renamed from: h  reason: collision with root package name */
    public Map<String, c> f290941h = new HashMap();

    /* renamed from: i  reason: collision with root package name */
    public ConcurrentHashMap<String, d> f290942i = new ConcurrentHashMap<>(8, 0.75f, 2);

    /* renamed from: j  reason: collision with root package name */
    public Map<String, g> f290943j = new ConcurrentHashMap();

    /* renamed from: k  reason: collision with root package name */
    public Map<String, g> f290944k = new ConcurrentHashMap();

    /* renamed from: l  reason: collision with root package name */
    public Map<String, g> f290945l = new ConcurrentHashMap();

    public class a extends k {
        public a(o oVar) {
        }

        @Override // pr0.k, pr0.e
        public b getFileType() {
            return b.a("application/vnd.apple.mpegurl");
        }
    }

    public final class b {

        /* renamed from: a  reason: collision with root package name */
        public long f290946a = -1;

        /* renamed from: b  reason: collision with root package name */
        public boolean f290947b = false;

        /* renamed from: c  reason: collision with root package name */
        public e f290948c = null;

        /* renamed from: d  reason: collision with root package name */
        public q1 f290949d = null;

        public b(o oVar, n nVar) {
        }
    }

    public final class c implements Runnable {

        /* renamed from: d  reason: collision with root package name */
        public Socket f290950d;

        /* renamed from: e  reason: collision with root package name */
        public Future<?> f290951e;

        /* renamed from: f  reason: collision with root package name */
        public CountDownLatch f290952f;

        public c(Socket socket, CountDownLatch countDownLatch) {
            this.f290950d = socket;
            this.f290952f = countDownLatch;
        }

        public void run() {
            String str;
            Throwable th5;
            try {
                this.f290952f.await();
            } catch (InterruptedException e15) {
                g.q(6, "VideoProxy", "SocketHandler run exception, reason " + g.h(e15, false), null);
            }
            p pVar = new p();
            pVar.f290957a = this.f290951e;
            o oVar = o.this;
            Socket socket = this.f290950d;
            oVar.getClass();
            String str2 = "VideoProxy/" + pVar.f290962f;
            String str3 = str2 + "/";
            g.q(3, str2, "process socket start", null);
            try {
                InputStream inputStream = socket.getInputStream();
                if (inputStream == null) {
                    g.q(6, str2, "socket inputstream is null", null);
                    return;
                }
                sr0.e eVar = new sr0.e(inputStream, str3);
                String str4 = eVar.f304610f;
                String b15 = eVar.b("url");
                String b16 = eVar.b(DownloadInfo.PRIORITY);
                String b17 = eVar.b("id");
                String b18 = eVar.b("secret");
                String b19 = eVar.b("enableCache");
                String b25 = eVar.b(DownloadInfo.CONTENTTYPE);
                if (b15 == null) {
                    g.q(6, str2, "invalid request detected, sourceUrl is null", null);
                    return;
                }
                if (oVar.f290935b) {
                    if (b18 == null) {
                        g.q(6, str2, "invalid request detected, token is null", null);
                        return;
                    }
                    try {
                        String a15 = l.a("des", l.c(), b18);
                        String v15 = g.v(b15);
                        if (a15 == null || !a15.equals(v15)) {
                            th5 = null;
                            try {
                                g.q(6, str2, "invalid request detected, key is illegal", null);
                                return;
                            } catch (Throwable unused) {
                            }
                        }
                    } catch (Throwable unused2) {
                        th5 = null;
                        g.q(5, str2, "decode token error", th5);
                        return;
                    }
                }
                StringBuilder sb5 = new StringBuilder();
                Iterator<String> it = eVar.f304609e.iterator();
                while (it.hasNext()) {
                    sb5.append(it.next());
                    sb5.append("\n");
                }
                String sb6 = sb5.toString();
                g.q(4, str2, g.w("requestHeader:" + sb6, null), null);
                OutputStream outputStream = socket.getOutputStream();
                if (outputStream == null) {
                    g.q(6, str2, "socket outputstream is null", null);
                    return;
                }
                long[] c15 = sr0.e.c(sb6);
                pVar.f290973q = str4;
                pVar.f290971o = b15;
                pVar.f290970n = g.v(b15);
                pVar.f290965i = c15[0];
                pVar.f290966j = c15[1];
                pVar.f290969m = b17;
                pVar.f290972p = b25;
                pVar.f290974r = str3;
                if (TextUtils.isEmpty(b19) || !b19.equals("1")) {
                    pVar.f290968l = false;
                } else {
                    pVar.f290968l = true;
                }
                if (TextUtils.isEmpty(b16)) {
                    pVar.f290964h = -1;
                } else if (b16.equals(String.valueOf(90))) {
                    pVar.f290964h = 90;
                } else if (b16.equals(String.valueOf(10))) {
                    pVar.f290964h = 10;
                } else {
                    pVar.f290964h = -1;
                }
                if (pVar.f290964h == -1) {
                    g.q(5, str2, "videoRequest priority is not specified", null);
                }
                g.q(4, str2, "processSocket, videoRequest=" + pVar, null);
                if (pVar.f290964h == 90) {
                    oVar.f290940g.b(pVar.f290970n, pVar);
                }
                oVar.f290940g.a(b15, pVar);
                oVar.e(socket, b15, outputStream, pVar, inputStream);
            } catch (Exception e16) {
                oVar.f290934a++;
                g.q(5, str2, "processSocket, proxyExceptionCount=" + oVar.f290934a, null);
                long j15 = -99999;
                if (e16 instanceof m) {
                    j15 = -99799;
                    str = "IllegalDataSpecException";
                } else if (e16 instanceof ArrayIndexOutOfBoundsException) {
                    j15 = -99699;
                    str = "ArrayIndexOutOfBoundsException";
                } else {
                    str = "";
                }
                long f15 = g.f(4, j15);
                long e17 = g.e(f15, j15);
                int currentTimeMillis = (int) (System.currentTimeMillis() - pVar.f290977u);
                rr0.a aVar = nr0.a.a().f272510n;
                String str5 = pVar.f290969m;
                String str6 = pVar.f290971o;
                int i15 = pVar.f290964h;
                long j16 = pVar.f290965i;
                long j17 = pVar.f290966j;
                synchronized (pVar) {
                    ((jz0.c) aVar).a(str5, str6, i15, j16, j17, pVar.f290967k, pVar.f290963g, pVar.f290973q, (long) (((float) (((long) pVar.f290976t) * 1000)) / ((float) (1024 * (System.currentTimeMillis() - pVar.f290977u)))), f15, j15, e17, str, currentTimeMillis);
                    g.q(6, str2, "processSocket, unexpected proxy error " + e16.getMessage() + g.h(e16, false), e16);
                }
            }
        }
    }

    public final class d implements Runnable {

        /* renamed from: d  reason: collision with root package name */
        public CountDownLatch f290954d;

        public d(CountDownLatch countDownLatch) {
            this.f290954d = countDownLatch;
        }

        public void run() {
            this.f290954d.countDown();
            o oVar = o.this;
            oVar.getClass();
            g.q(3, "VideoProxy", "proxy server wait for request", null);
            while (!Thread.currentThread().isInterrupted()) {
                try {
                    Socket accept = oVar.f290938e.accept();
                    CountDownLatch countDownLatch = new CountDownLatch(1);
                    c cVar = new c(accept, countDownLatch);
                    Future<?> submit = ((AbstractExecutorService) oVar.f290939f).submit(cVar);
                    m.b bVar = (m.b) oVar.f290939f;
                    ((ThreadPoolExecutor) oVar.f290939f).setCorePoolSize(bVar.getActiveCount() + bVar.getQueue().size() + 2);
                    cVar.f290951e = submit;
                    countDownLatch.countDown();
                } catch (SocketException e15) {
                    if (oVar.f290938e.isClosed()) {
                        g.q(3, "VideoProxy", "proxy server is closed", null);
                    } else {
                        g.q(6, "VideoProxy", "proxy server is quit, reason SOCKET:" + g.h(e15, false), null);
                    }
                } catch (IOException e16) {
                    g.q(6, "VideoProxy", "proxy server is quit, reason IO:" + g.h(e16, false), null);
                } catch (OutOfMemoryError e17) {
                    g.q(6, "VideoProxy", "proxy server is quit, reason OOM:" + g.h(e17, false), null);
                } catch (Throwable th5) {
                    g.q(3, "VideoProxy", "shutdown thread pool", null);
                    ((ThreadPoolExecutor) oVar.f290939f).shutdownNow();
                    g.q(3, "VideoProxy", "proxy server stopped", null);
                    throw th5;
                }
            }
            g.q(3, "VideoProxy", "shutdown thread pool", null);
            ((ThreadPoolExecutor) oVar.f290939f).shutdownNow();
            g.q(3, "VideoProxy", "proxy server stopped", null);
        }
    }

    public o() {
        String b15 = nr0.a.a().b();
        g.q(4, "VideoProxy", "initCache, cache dir:" + nr0.a.a().b(), null);
        if (TextUtils.isEmpty(b15)) {
            this.f290936c = null;
            ((jz0.c) nr0.a.a().f272510n).g(-1);
            lr0.k.this.f254494e = false;
        } else {
            long j15 = -1;
            if (!TextUtils.isEmpty(b15)) {
                try {
                    StatFs statFs = new StatFs(b15);
                    j15 = ((long) statFs.getAvailableBlocks()) * ((long) statFs.getBlockSize());
                } catch (Exception unused) {
                }
            }
            long min = Math.min(j15, nr0.a.a().f272506j);
            g.q(4, "VideoProxy", "initCache, cache availableSpace=" + min, null);
            h hVar = new h(min);
            sr0.m.b(new n(this, b15, min, hVar), "VideoProxy");
            this.f290936c = new i(new q1(b15), hVar);
        }
        StringBuilder sb5 = new StringBuilder();
        sb5.append("initCache, cache:");
        String str = this.f290936c;
        sb5.append(str == null ? "null" : str);
        g.q(4, "VideoProxy", sb5.toString(), null);
        this.f290940g = new r();
        this.f290939f = new m.b(10, 10, 0, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
        try {
            ServerSocket serverSocket = new ServerSocket(g.b(5), 10, InetAddress.getByName("0.0.0.0"));
            this.f290938e = serverSocket;
            this.f290937d = serverSocket.getLocalPort();
            CountDownLatch countDownLatch = new CountDownLatch(1);
            new Thread(new d(countDownLatch), "video_proxy_wait_for_connection_thread").start();
            countDownLatch.await();
            g.q(4, "VideoProxy", "proxy server start success, port:" + this.f290937d, null);
            ((jz0.c) nr0.a.a().f272510n).g(0);
            ((k.a) nr0.a.a().f272511o).getClass();
        } catch (IOException | IllegalStateException | InterruptedException e15) {
            ((ThreadPoolExecutor) this.f290939f).shutdown();
            g.q(6, "VideoProxy", "proxy server start failed " + g.h(e15, false), null);
            ((jz0.c) nr0.a.a().f272510n).g(-2);
            lr0.k.this.f254494e = false;
        }
    }

    /* JADX DEBUG: Failed to insert an additional move for type inference into block B:96:0x0276 */
    /* JADX DEBUG: Failed to insert an additional move for type inference into block B:48:0x0171 */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r16v19 */
    /* JADX WARN: Type inference failed for: r16v35 */
    /* JADX WARN: Type inference failed for: r16v36 */
    /* JADX WARN: Type inference failed for: r16v41 */
    /* JADX WARN: Type inference failed for: r16v42 */
    /* JADX WARN: Type inference failed for: r16v43 */
    /* JADX WARN: Type inference failed for: r16v52 */
    /* JADX WARN: Type inference failed for: r16v55 */
    /* JADX WARN: Type inference failed for: r16v56 */
    /* JADX WARN: Type inference failed for: r16v57 */
    /* JADX WARN: Type inference failed for: r16v58 */
    /* JADX WARN: Type inference failed for: r16v59 */
    /* JADX WARN: Type inference failed for: r16v65 */
    /* JADX WARN: Type inference failed for: r16v70 */
    /* JADX WARN: Type inference failed for: r16v71 */
    /* JADX WARN: Type inference failed for: r16v74 */
    /* JADX WARN: Type inference failed for: r16v75 */
    /* JADX WARN: Type inference failed for: r16v78 */
    /* JADX WARN: Type inference failed for: r16v79 */
    /* JADX WARN: Type inference failed for: r16v81 */
    /* JADX WARNING: Code restructure failed: missing block: B:110:0x030d, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:111:0x030e, code lost:
        r39 = r2;
        r17 = r13;
        r16 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:113:0x0318, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:114:0x0319, code lost:
        r39 = r2;
        r17 = r13;
        r16 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:126:0x035b, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:127:0x035c, code lost:
        r39 = r2;
        r17 = r13;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:164:0x0474, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:166:0x0477, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:168:0x047a, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:225:0x05d4, code lost:
        r7 = r47;
        r45 = r1;
        r39 = r2;
        r48 = r6;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:367:0x0900, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:368:0x0901, code lost:
        r33 = r11;
        r6 = r12;
        r5 = r13;
        r7 = r14;
        r4 = 6;
        r16 = null;
        r36 = false;
        r1 = r0;
        r39 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:370:0x0913, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:371:0x0914, code lost:
        r33 = r11;
        r6 = r12;
        r5 = r13;
        r7 = r14;
        r4 = 6;
        r16 = null;
        r22 = true;
        r36 = false;
        r1 = r0;
        r3 = null;
        r39 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:375:0x092c, code lost:
        r50.b();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:376:0x092f, code lost:
        if (r39 != null) goto L_0x0931;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:378:?, code lost:
        r39.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:379:0x0935, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:380:0x0936, code lost:
        sr0.g.p(r4, r15, r5 + sr0.g.g(r0));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:381:0x094d, code lost:
        if (r3 != null) goto L_0x094f;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:383:?, code lost:
        r3.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:384:0x0953, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:385:0x0954, code lost:
        sr0.g.p(r4, r15, r6 + sr0.g.g(r0));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:390:0x0977, code lost:
        sr0.g.p(4, r15, r25 + r33.toString() + r7 + r33.l());
     */
    /* JADX WARNING: Code restructure failed: missing block: B:391:0x099a, code lost:
        return r16;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:392:0x099b, code lost:
        r8 = r25;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:394:?, code lost:
        sr0.g.p(r4, r15, "generateLocalPlaylistFile Exception:" + sr0.g.g(r1));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:395:0x09ba, code lost:
        throw new qr0.f(r1);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:399:0x09c1, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:400:0x09c2, code lost:
        r33 = r11;
        r6 = r12;
        r5 = r13;
        r7 = r14;
        r8 = r25;
        r4 = 6;
        r16 = null;
        r36 = false;
        r1 = r0;
        r3 = null;
        r39 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:404:0x09dc, code lost:
        r50.b();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:405:0x09df, code lost:
        if (r39 != null) goto L_0x09e1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:407:?, code lost:
        r39.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:408:0x09e5, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:409:0x09e6, code lost:
        sr0.g.p(r4, r15, r5 + sr0.g.g(r0));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:410:0x09fd, code lost:
        if (r3 != null) goto L_0x09ff;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:412:?, code lost:
        r3.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:413:0x0a03, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:414:0x0a04, code lost:
        sr0.g.p(r4, r15, r6 + sr0.g.g(r0));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:419:0x0a27, code lost:
        sr0.g.p(4, r15, r8 + r33.toString() + r7 + r33.l());
     */
    /* JADX WARNING: Code restructure failed: missing block: B:420:0x0a48, code lost:
        return r16;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:421:0x0a49, code lost:
        sr0.g.p(r4, r15, "generateLocalPlaylistFile LivePlayListException:" + sr0.g.g(r1));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:422:0x0a61, code lost:
        throw r1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:423:0x0a62, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:424:0x0a63, code lost:
        r1 = r0;
        r16 = r3;
        r36 = r22;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:429:?, code lost:
        r39.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:430:0x0a74, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:431:0x0a75, code lost:
        sr0.g.p(r4, r15, r5 + sr0.g.g(r0));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:434:?, code lost:
        r16.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:435:0x0a92, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:436:0x0a93, code lost:
        sr0.g.p(r4, r15, r6 + sr0.g.g(r0));
     */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Removed duplicated region for block: B:126:0x035b A[ExcHandler: all (th java.lang.Throwable), Splitter:B:96:0x0276] */
    /* JADX WARNING: Removed duplicated region for block: B:12:0x0078  */
    /* JADX WARNING: Removed duplicated region for block: B:131:0x0394  */
    /* JADX WARNING: Removed duplicated region for block: B:13:0x007a  */
    /* JADX WARNING: Removed duplicated region for block: B:15:0x0084  */
    /* JADX WARNING: Removed duplicated region for block: B:164:0x0474 A[Catch:{ f -> 0x0618, Exception -> 0x0613, all -> 0x060e }, ExcHandler: all (th java.lang.Throwable), Splitter:B:132:0x03a4] */
    /* JADX WARNING: Removed duplicated region for block: B:20:0x00dd  */
    /* JADX WARNING: Removed duplicated region for block: B:21:0x00df  */
    /* JADX WARNING: Removed duplicated region for block: B:230:0x05f0  */
    /* JADX WARNING: Removed duplicated region for block: B:24:0x00ea  */
    /* JADX WARNING: Removed duplicated region for block: B:25:0x00ec  */
    /* JADX WARNING: Removed duplicated region for block: B:338:0x084e  */
    /* JADX WARNING: Removed duplicated region for block: B:367:0x0900 A[ExcHandler: all (r0v12 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:27:0x0112] */
    /* JADX WARNING: Removed duplicated region for block: B:370:0x0913 A[ExcHandler: Exception (r0v11 'e' java.lang.Exception A[CUSTOM_DECLARE]), Splitter:B:27:0x0112] */
    /* JADX WARNING: Removed duplicated region for block: B:375:0x092c A[Catch:{ all -> 0x09bb }] */
    /* JADX WARNING: Removed duplicated region for block: B:38:0x014d A[SYNTHETIC, Splitter:B:38:0x014d] */
    /* JADX WARNING: Removed duplicated region for block: B:392:0x099b  */
    /* JADX WARNING: Removed duplicated region for block: B:404:0x09dc A[Catch:{ all -> 0x0a69 }] */
    /* JADX WARNING: Removed duplicated region for block: B:421:0x0a49  */
    /* JADX WARNING: Removed duplicated region for block: B:428:0x0a70 A[SYNTHETIC, Splitter:B:428:0x0a70] */
    /* JADX WARNING: Removed duplicated region for block: B:433:0x0a8e A[SYNTHETIC, Splitter:B:433:0x0a8e] */
    /* JADX WARNING: Removed duplicated region for block: B:444:0x05d4 A[EDGE_INSN: B:444:0x05d4->B:225:0x05d4 ?: BREAK  , SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:72:0x01c6  */
    /* JADX WARNING: Removed duplicated region for block: B:76:0x01ed  */
    /* JADX WARNING: Removed duplicated region for block: B:79:0x01fa  */
    /* JADX WARNING: Removed duplicated region for block: B:82:0x0213  */
    /* JADX WARNING: Removed duplicated region for block: B:85:0x0223  */
    /* JADX WARNING: Removed duplicated region for block: B:96:0x0276 A[SYNTHETIC, Splitter:B:96:0x0276] */
    /* JADX WARNING: Unknown variable types count: 4 */
    public final q1 a(e eVar, pr0.g gVar, String str, p pVar) {
        String str2;
        h0.h l15;
        boolean z15;
        q1 q1Var;
        String m15;
        Pattern compile;
        BufferedReader bufferedReader;
        boolean z16;
        q1 q1Var2;
        OutputStream outputStream;
        String str3;
        String str4;
        String str5;
        String str6;
        int i15;
        Throwable th5;
        q1 q1Var3;
        OutputStream outputStream2;
        f fVar;
        boolean z17;
        q1 q1Var4;
        Exception exc;
        q1 q1Var5;
        BufferedReader bufferedReader2;
        int i16;
        OutputStream F;
        q1 q1Var6;
        q1 q1Var7;
        StringBuilder sb5;
        ArrayList<h> arrayList;
        boolean z18;
        int i17;
        int i18;
        String str7;
        boolean z19;
        OutputStream outputStream3;
        String str8;
        String str9;
        q1 q1Var8;
        q1 q1Var9;
        q1 q1Var10;
        f e15;
        q1 q1Var11;
        Exception e16;
        Throwable th6;
        ArrayList<h> arrayList2;
        StringBuilder sb6;
        StringBuilder sb7;
        int i19;
        boolean z25;
        q1 q1Var12;
        f e17;
        q1 q1Var13;
        q1 q1Var14;
        q1 q1Var15;
        Exception e18;
        q1 q1Var16;
        q1 q1Var17;
        Throwable th7;
        int i25;
        Pattern pattern;
        String str10;
        String str11;
        String str12;
        ArrayList<h> arrayList3;
        StringBuilder sb8;
        int i26;
        ArrayList<h> arrayList4;
        String str13;
        q1 q1Var18;
        q1 q1Var19;
        ArrayList<h> arrayList5;
        String str14;
        q1 q1Var20;
        q1 q1Var21;
        Pattern pattern2;
        StringBuilder sb9;
        o oVar = this;
        p pVar2 = pVar;
        String str15 = "generateLocalPlaylistFile, error close PlayListFile: ";
        String str16 = "generateLocalPlaylistFile, error close reader: ";
        String str17 = ", deleteSuccess:";
        String str18 = "VideoProxy/" + pVar.k();
        String d15 = nr0.a.a().d();
        if (d15 == null) {
            g.p(6, str18, "generateLocalPlaylistFile error: dirPath is null");
            return null;
        }
        n2 a15 = n2.a(d15);
        String str19 = a15.f189021f;
        if (str19 != null) {
            String k15 = o2.k(str19, false, false);
            if (!a15.f189021f.equals(k15)) {
                str2 = "generateLocalPlaylistFile, finally deletePlayListFile ";
                str7 = a15.f189019d;
                a15 = new n2(str7, a15.f189020e, k15, a15.f189022g, a15.f189023h);
                h0 h0Var = h0.i.f188954a;
                l15 = h0Var.l(a15, null);
                if (l15.a()) {
                    z15 = false;
                } else {
                    z15 = l15.f188951a.D(l15.f188952b);
                }
                if (!z15) {
                    h0.h l16 = h0Var.l(a15, l15);
                    if (l16.a()) {
                        l16.f188951a.i(l16.f188952b);
                    }
                }
                q1Var = new q1(d15 + "/" + (System.currentTimeMillis() + ((long) f290933n.incrementAndGet())) + ".m3u8");
                StringBuilder sb10 = new StringBuilder();
                sb10.append("generateLocalPlaylistFile:");
                sb10.append(q1Var);
                g.p(4, str18, sb10.toString());
                boolean z26 = pVar.g() != 10;
                m15 = pVar.m();
                int i27 = pVar.g() != 10 ? 1 : 3;
                g.p(4, str18, "generateLocalPlaylistFile, preloadTsMaxCount=" + i27);
                pVar2.q(pVar.d() | 5);
                compile = Pattern.compile("URI=\"(.+?)\"", 34);
                eVar.b(gVar);
                boolean z27 = z26;
                i16 = i27;
                bufferedReader2 = new BufferedReader(new f(eVar, "UTF-8"));
                try {
                    F = u1.F(q1Var);
                    try {
                        sb5 = new StringBuilder();
                        g.p(4, str18, "====================== start original m3u8 content ======================");
                        arrayList = null;
                        z18 = true;
                        i17 = -1;
                        i18 = -1;
                        boolean z28 = false;
                        int i28 = 0;
                        while (true) {
                            ?? r16 = 1;
                            r16 = 1;
                            r16 = 1;
                            ?? r162 = 1;
                            ?? r163 = 1;
                            ?? r164 = 1;
                            z19 = !Thread.interrupted();
                            if (z19) {
                                break;
                            }
                            try {
                                if (pVar.t()) {
                                    break;
                                }
                                outputStream3 = F;
                                try {
                                    String readLine = bufferedReader2.readLine();
                                    if (readLine == null) {
                                        sb6 = sb5;
                                        arrayList2 = arrayList;
                                        bufferedReader = bufferedReader2;
                                        break;
                                    }
                                    g.p(4, str18, readLine);
                                    str9 = str17;
                                    q1Var2 = q1Var;
                                    str8 = str15;
                                    if (readLine.startsWith("#")) {
                                        try {
                                            if (readLine.toUpperCase().equals("#EXTM3U")) {
                                                try {
                                                    if (!((ConcurrentHashMap) oVar.f290943j).containsKey(m15)) {
                                                        arrayList5 = new ArrayList<>();
                                                        try {
                                                            ((ConcurrentHashMap) oVar.f290943j).put(m15, new g());
                                                            if (!readLine.toUpperCase().startsWith("#EXT-X-STREAM-INF")) {
                                                                if (!z28) {
                                                                    g.p(4, str18, "find master play list");
                                                                    ((jz0.c) nr0.a.a().e()).c();
                                                                }
                                                                pVar2.q(pVar.d() & -5);
                                                                z27 = true;
                                                                z18 = false;
                                                                z28 = true;
                                                            }
                                                            if (readLine.toUpperCase().startsWith("#EXT-X-ENDLIST")) {
                                                                pVar2.q(pVar.d() & -5);
                                                                z27 = true;
                                                                z18 = false;
                                                            }
                                                            if (readLine.toUpperCase().startsWith("#EXT-X-MEDIA-SEQUENCE")) {
                                                                i17 = g.t(readLine);
                                                            }
                                                            if (readLine.toUpperCase().startsWith("#EXT-X-TARGETDURATION")) {
                                                                i18 = g.t(readLine);
                                                            }
                                                            if (readLine.toUpperCase().startsWith("#EXT-X-PLAYLIST-TYPE") && g.u(readLine).toUpperCase().equals("VOD")) {
                                                                pVar2.q(pVar.d() & -5);
                                                                z27 = true;
                                                                z18 = false;
                                                            }
                                                            if (!readLine.toUpperCase().startsWith("#EXT-X-KEY")) {
                                                                try {
                                                                    Matcher matcher = compile.matcher(readLine);
                                                                    if (!matcher.matches() || matcher.groupCount() <= 0) {
                                                                        bufferedReader = bufferedReader2;
                                                                        pattern2 = compile;
                                                                        str7 = str16;
                                                                        i25 = i16;
                                                                        str14 = null;
                                                                        str10 = m15;
                                                                        str11 = readLine;
                                                                        sb9 = sb5;
                                                                        sb9.append(str11);
                                                                        sb9.append("\n");
                                                                    } else {
                                                                        int start = matcher.start(1);
                                                                        int end = matcher.end(1);
                                                                        String substring = readLine.substring(0, start);
                                                                        String substring2 = readLine.substring(start, end);
                                                                        String substring3 = readLine.substring(end);
                                                                        bufferedReader = bufferedReader2;
                                                                        i25 = i16;
                                                                        str10 = m15;
                                                                        pattern2 = compile;
                                                                        r163 = 0;
                                                                        str14 = null;
                                                                        r162 = 0;
                                                                        str7 = str16;
                                                                        str11 = readLine;
                                                                        try {
                                                                            String c15 = c(g.c(str, substring2), false, false, "application/octet-stream;charset=utf-8", 90);
                                                                            if (pVar.m() != null) {
                                                                                c15 = (c15 + "&id=" + pVar.m()) + "&enableCache=0";
                                                                            }
                                                                            sb9 = sb5;
                                                                            sb9.append(substring);
                                                                            sb9.append(c15);
                                                                            sb9.append(substring3);
                                                                            sb9.append("\n");
                                                                        } catch (f e19) {
                                                                            e = e19;
                                                                            q1Var20 = r163;
                                                                            fVar = e;
                                                                            q1Var18 = q1Var20;
                                                                            outputStream2 = outputStream3;
                                                                            str6 = str7;
                                                                            str3 = str2;
                                                                            str4 = str9;
                                                                            str5 = str8;
                                                                            i15 = 6;
                                                                            z16 = false;
                                                                            q1Var3 = q1Var18;
                                                                            try {
                                                                                if (!pVar.t()) {
                                                                                }
                                                                            } catch (Throwable th8) {
                                                                                th = th8;
                                                                                th5 = th;
                                                                                outputStream = outputStream2;
                                                                                if (bufferedReader != null) {
                                                                                }
                                                                                if (outputStream != null) {
                                                                                }
                                                                                g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                                                                throw th5;
                                                                            }
                                                                        } catch (Exception e25) {
                                                                            e = e25;
                                                                            q1Var21 = r162;
                                                                            exc = e;
                                                                            q1Var19 = q1Var21;
                                                                            outputStream2 = outputStream3;
                                                                            str6 = str7;
                                                                            str4 = str9;
                                                                            str5 = str8;
                                                                            i15 = 6;
                                                                            z17 = true;
                                                                            z16 = false;
                                                                            q1Var4 = q1Var19;
                                                                            try {
                                                                                if (!pVar.t()) {
                                                                                }
                                                                            } catch (Throwable th9) {
                                                                                th = th9;
                                                                                str3 = str2;
                                                                                th5 = th;
                                                                                outputStream = outputStream2;
                                                                                if (bufferedReader != null) {
                                                                                }
                                                                                if (outputStream != null) {
                                                                                }
                                                                                g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                                                                throw th5;
                                                                            }
                                                                        } catch (Throwable th10) {
                                                                            th = th10;
                                                                            th5 = th;
                                                                            outputStream = outputStream3;
                                                                            str6 = str7;
                                                                            str3 = str2;
                                                                            str4 = str9;
                                                                            str5 = str8;
                                                                            i15 = 6;
                                                                            z16 = false;
                                                                            if (bufferedReader != null) {
                                                                            }
                                                                            if (outputStream != null) {
                                                                            }
                                                                            g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                                                            throw th5;
                                                                        }
                                                                    }
                                                                    sb8 = sb9;
                                                                    pattern = pattern2;
                                                                    z17 = true;
                                                                    z16 = false;
                                                                } catch (f e26) {
                                                                    e = e26;
                                                                    bufferedReader = bufferedReader2;
                                                                    str7 = str16;
                                                                    q1Var20 = null;
                                                                    fVar = e;
                                                                    q1Var18 = q1Var20;
                                                                    outputStream2 = outputStream3;
                                                                    str6 = str7;
                                                                    str3 = str2;
                                                                    str4 = str9;
                                                                    str5 = str8;
                                                                    i15 = 6;
                                                                    z16 = false;
                                                                    q1Var3 = q1Var18;
                                                                    if (!pVar.t()) {
                                                                    }
                                                                } catch (Exception e27) {
                                                                    e = e27;
                                                                    bufferedReader = bufferedReader2;
                                                                    str7 = str16;
                                                                    q1Var21 = null;
                                                                    exc = e;
                                                                    q1Var19 = q1Var21;
                                                                    outputStream2 = outputStream3;
                                                                    str6 = str7;
                                                                    str4 = str9;
                                                                    str5 = str8;
                                                                    i15 = 6;
                                                                    z17 = true;
                                                                    z16 = false;
                                                                    q1Var4 = q1Var19;
                                                                    if (!pVar.t()) {
                                                                    }
                                                                } catch (Throwable th11) {
                                                                }
                                                            } else {
                                                                bufferedReader = bufferedReader2;
                                                                str7 = str16;
                                                                i25 = i16;
                                                                r16 = 0;
                                                                str14 = null;
                                                                r164 = 0;
                                                                r16 = 0;
                                                                q1Var15 = null;
                                                                q1Var12 = null;
                                                                r164 = 0;
                                                                r16 = 0;
                                                                q1Var16 = null;
                                                                q1Var13 = null;
                                                                r164 = 0;
                                                                r16 = 0;
                                                                str14 = null;
                                                                str14 = null;
                                                                q1Var17 = null;
                                                                q1Var14 = null;
                                                                r164 = 0;
                                                                str10 = m15;
                                                                str11 = readLine;
                                                                try {
                                                                    if (str11.toUpperCase().startsWith("#EXT-X-MAP")) {
                                                                        Matcher matcher2 = compile.matcher(str11);
                                                                        if (!matcher2.matches() || matcher2.groupCount() <= 0) {
                                                                            pattern = compile;
                                                                            sb8 = sb5;
                                                                            z17 = true;
                                                                            z16 = false;
                                                                            sb8.append(str11);
                                                                            sb8.append("\n");
                                                                        } else {
                                                                            int start2 = matcher2.start(1);
                                                                            int end2 = matcher2.end(1);
                                                                            try {
                                                                                String substring4 = str11.substring(0, start2);
                                                                                String substring5 = str11.substring(start2, end2);
                                                                                String substring6 = str11.substring(end2);
                                                                                z16 = false;
                                                                                z17 = true;
                                                                                pattern = compile;
                                                                                sb8 = sb5;
                                                                                try {
                                                                                    String c16 = c(g.c(str, substring5), false, false, "video/MP2T", 90);
                                                                                    if (pVar.m() != null) {
                                                                                        c16 = (c16 + "&id=" + pVar.m()) + "&enableCache=[VALUE_CACHE_PLACEHOLDER]";
                                                                                    }
                                                                                    sb8.append(substring4);
                                                                                    sb8.append(c16);
                                                                                    sb8.append(substring6);
                                                                                    sb8.append("\n");
                                                                                } catch (f e28) {
                                                                                    e15 = e28;
                                                                                    q1Var10 = r16;
                                                                                    fVar = e15;
                                                                                    q1Var8 = q1Var10;
                                                                                    outputStream2 = outputStream3;
                                                                                    str6 = str7;
                                                                                    str3 = str2;
                                                                                    str4 = str9;
                                                                                    str5 = str8;
                                                                                    i15 = 6;
                                                                                    q1Var3 = q1Var8;
                                                                                    if (!pVar.t()) {
                                                                                    }
                                                                                } catch (Exception e29) {
                                                                                    e16 = e29;
                                                                                    q1Var11 = r164;
                                                                                    exc = e16;
                                                                                    q1Var9 = q1Var11;
                                                                                    outputStream2 = outputStream3;
                                                                                    str6 = str7;
                                                                                    str4 = str9;
                                                                                    str5 = str8;
                                                                                    i15 = 6;
                                                                                    q1Var4 = q1Var9;
                                                                                    if (!pVar.t()) {
                                                                                    }
                                                                                } catch (Throwable th12) {
                                                                                    th6 = th12;
                                                                                    th5 = th6;
                                                                                    outputStream = outputStream3;
                                                                                    str6 = str7;
                                                                                    str3 = str2;
                                                                                    str4 = str9;
                                                                                    str5 = str8;
                                                                                    i15 = 6;
                                                                                    if (bufferedReader != null) {
                                                                                    }
                                                                                    if (outputStream != null) {
                                                                                    }
                                                                                    g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                                                                    throw th5;
                                                                                }
                                                                            } catch (f e35) {
                                                                                e17 = e35;
                                                                                z16 = false;
                                                                                fVar = e17;
                                                                                q1Var8 = q1Var12;
                                                                                outputStream2 = outputStream3;
                                                                                str6 = str7;
                                                                                str3 = str2;
                                                                                str4 = str9;
                                                                                str5 = str8;
                                                                                i15 = 6;
                                                                                q1Var3 = q1Var8;
                                                                                if (!pVar.t()) {
                                                                                }
                                                                            } catch (Exception e36) {
                                                                                e18 = e36;
                                                                                z16 = false;
                                                                                z17 = true;
                                                                                exc = e18;
                                                                                q1Var9 = q1Var15;
                                                                                outputStream2 = outputStream3;
                                                                                str6 = str7;
                                                                                str4 = str9;
                                                                                str5 = str8;
                                                                                i15 = 6;
                                                                                q1Var4 = q1Var9;
                                                                                if (!pVar.t()) {
                                                                                }
                                                                            } catch (Throwable th13) {
                                                                                th7 = th13;
                                                                                z16 = false;
                                                                                th5 = th7;
                                                                                outputStream = outputStream3;
                                                                                str6 = str7;
                                                                                str3 = str2;
                                                                                str4 = str9;
                                                                                str5 = str8;
                                                                                i15 = 6;
                                                                                if (bufferedReader != null) {
                                                                                }
                                                                                if (outputStream != null) {
                                                                                }
                                                                                g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                                                                throw th5;
                                                                            }
                                                                        }
                                                                    } else {
                                                                        sb8 = sb5;
                                                                        pattern = compile;
                                                                        z17 = true;
                                                                        z16 = false;
                                                                        sb8.append(str11);
                                                                        sb8.append("\n");
                                                                    }
                                                                } catch (f e37) {
                                                                    e17 = e37;
                                                                    z16 = false;
                                                                    q1Var12 = q1Var13;
                                                                    fVar = e17;
                                                                    q1Var8 = q1Var12;
                                                                    outputStream2 = outputStream3;
                                                                    str6 = str7;
                                                                    str3 = str2;
                                                                    str4 = str9;
                                                                    str5 = str8;
                                                                    i15 = 6;
                                                                    q1Var3 = q1Var8;
                                                                    if (!pVar.t()) {
                                                                    }
                                                                } catch (Exception e38) {
                                                                    e18 = e38;
                                                                    z17 = true;
                                                                    z16 = false;
                                                                    q1Var15 = q1Var16;
                                                                    exc = e18;
                                                                    q1Var9 = q1Var15;
                                                                    outputStream2 = outputStream3;
                                                                    str6 = str7;
                                                                    str4 = str9;
                                                                    str5 = str8;
                                                                    i15 = 6;
                                                                    q1Var4 = q1Var9;
                                                                    if (!pVar.t()) {
                                                                    }
                                                                } catch (Throwable th14) {
                                                                }
                                                            }
                                                            str12 = str14;
                                                            arrayList3 = arrayList5;
                                                        } catch (f e39) {
                                                            fVar = e39;
                                                        } catch (Exception e45) {
                                                            exc = e45;
                                                            bufferedReader = bufferedReader2;
                                                            str7 = str16;
                                                            q1Var19 = null;
                                                            outputStream2 = outputStream3;
                                                            str6 = str7;
                                                            str4 = str9;
                                                            str5 = str8;
                                                            i15 = 6;
                                                            z17 = true;
                                                            z16 = false;
                                                            q1Var4 = q1Var19;
                                                            if (!pVar.t()) {
                                                            }
                                                        } catch (Throwable th15) {
                                                            th5 = th15;
                                                            bufferedReader = bufferedReader2;
                                                            str7 = str16;
                                                            outputStream = outputStream3;
                                                            str6 = str7;
                                                            str3 = str2;
                                                            str4 = str9;
                                                            str5 = str8;
                                                            i15 = 6;
                                                            z16 = false;
                                                            if (bufferedReader != null) {
                                                            }
                                                            if (outputStream != null) {
                                                            }
                                                            g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                                            throw th5;
                                                        }
                                                    }
                                                } catch (f e46) {
                                                    fVar = e46;
                                                    bufferedReader = bufferedReader2;
                                                    str7 = str16;
                                                    q1Var18 = null;
                                                    outputStream2 = outputStream3;
                                                    str6 = str7;
                                                    str3 = str2;
                                                    str4 = str9;
                                                    str5 = str8;
                                                    i15 = 6;
                                                    z16 = false;
                                                    q1Var3 = q1Var18;
                                                    if (!pVar.t()) {
                                                    }
                                                } catch (Exception e47) {
                                                    exc = e47;
                                                    bufferedReader = bufferedReader2;
                                                    str7 = str16;
                                                    q1Var19 = null;
                                                    outputStream2 = outputStream3;
                                                    str6 = str7;
                                                    str4 = str9;
                                                    str5 = str8;
                                                    i15 = 6;
                                                    z17 = true;
                                                    z16 = false;
                                                    q1Var4 = q1Var19;
                                                    if (!pVar.t()) {
                                                    }
                                                } catch (Throwable th16) {
                                                    th5 = th16;
                                                    bufferedReader = bufferedReader2;
                                                    str7 = str16;
                                                    outputStream = outputStream3;
                                                    str6 = str7;
                                                    str3 = str2;
                                                    str4 = str9;
                                                    str5 = str8;
                                                    i15 = 6;
                                                    z16 = false;
                                                    if (bufferedReader != null) {
                                                    }
                                                    if (outputStream != null) {
                                                    }
                                                    g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                                    throw th5;
                                                }
                                            }
                                            arrayList5 = arrayList;
                                            if (!readLine.toUpperCase().startsWith("#EXT-X-STREAM-INF")) {
                                            }
                                            if (readLine.toUpperCase().startsWith("#EXT-X-ENDLIST")) {
                                            }
                                            if (readLine.toUpperCase().startsWith("#EXT-X-MEDIA-SEQUENCE")) {
                                            }
                                            if (readLine.toUpperCase().startsWith("#EXT-X-TARGETDURATION")) {
                                            }
                                            pVar2.q(pVar.d() & -5);
                                            z27 = true;
                                            z18 = false;
                                            if (!readLine.toUpperCase().startsWith("#EXT-X-KEY")) {
                                            }
                                            str12 = str14;
                                            arrayList3 = arrayList5;
                                        } catch (f e48) {
                                            e17 = e48;
                                            bufferedReader = bufferedReader2;
                                            str7 = str16;
                                            q1Var14 = null;
                                            q1Var13 = q1Var14;
                                            z16 = false;
                                            q1Var12 = q1Var13;
                                            fVar = e17;
                                            q1Var8 = q1Var12;
                                            outputStream2 = outputStream3;
                                            str6 = str7;
                                            str3 = str2;
                                            str4 = str9;
                                            str5 = str8;
                                            i15 = 6;
                                            q1Var3 = q1Var8;
                                            if (!pVar.t()) {
                                            }
                                        } catch (Exception e49) {
                                            e18 = e49;
                                            bufferedReader = bufferedReader2;
                                            str7 = str16;
                                            q1Var17 = null;
                                            z17 = true;
                                            q1Var16 = q1Var17;
                                            z16 = false;
                                            q1Var15 = q1Var16;
                                            exc = e18;
                                            q1Var9 = q1Var15;
                                            outputStream2 = outputStream3;
                                            str6 = str7;
                                            str4 = str9;
                                            str5 = str8;
                                            i15 = 6;
                                            q1Var4 = q1Var9;
                                            if (!pVar.t()) {
                                            }
                                        } catch (Throwable th17) {
                                            th7 = th17;
                                            bufferedReader = bufferedReader2;
                                            str7 = str16;
                                            z16 = false;
                                            th5 = th7;
                                            outputStream = outputStream3;
                                            str6 = str7;
                                            str3 = str2;
                                            str4 = str9;
                                            str5 = str8;
                                            i15 = 6;
                                            if (bufferedReader != null) {
                                            }
                                            if (outputStream != null) {
                                            }
                                            g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                            throw th5;
                                        }
                                    } else {
                                        sb8 = sb5;
                                        bufferedReader = bufferedReader2;
                                        pattern = compile;
                                        str7 = str16;
                                        i25 = i16;
                                        z17 = true;
                                        z16 = false;
                                        str10 = m15;
                                        str11 = readLine;
                                        if (!"".equalsIgnoreCase(str11)) {
                                            String c17 = g.c(str, str11);
                                            arrayList4 = arrayList;
                                            String c18 = c(c17, false, false, "video/MP2T", 90);
                                            if (pVar.m() != null) {
                                                c18 = (c18 + "&id=" + pVar.m()) + "&enableCache=[VALUE_CACHE_PLACEHOLDER]";
                                            }
                                            sb8.append(c18);
                                            sb8.append("\n");
                                            str13 = c17;
                                        } else {
                                            arrayList4 = arrayList;
                                            sb8.append(str11);
                                            sb8.append("\n");
                                            str13 = null;
                                        }
                                        str12 = str13;
                                        arrayList3 = arrayList4;
                                    }
                                    if (str11.startsWith("#") || (!str11.contains(".ts") && !str11.contains(".aac"))) {
                                        i26 = i25;
                                        i28 = i28;
                                    } else {
                                        i26 = i25;
                                        if (arrayList3 != null && i28 < i26 && !TextUtils.isEmpty(str12)) {
                                            String c19 = c(str12, true, true, "video/MP2T", 10);
                                            g.p(4, str18, "generateLocalPlaylistFile, preloadTs:" + c19);
                                            h hVar = new h();
                                            hVar.f290914b = c19;
                                            hVar.f290913a = str12;
                                            arrayList3.add(hVar);
                                        }
                                        i28++;
                                    }
                                    F = outputStream3;
                                    sb5 = sb8;
                                    arrayList = arrayList3;
                                    str16 = str7;
                                    m15 = str10;
                                    compile = pattern;
                                    str17 = str9;
                                    q1Var = q1Var2;
                                    bufferedReader2 = bufferedReader;
                                    oVar = this;
                                    pVar2 = pVar;
                                    i16 = i26;
                                    str15 = str8;
                                } catch (f e55) {
                                    e17 = e55;
                                    bufferedReader = bufferedReader2;
                                    q1Var2 = q1Var;
                                    str8 = str15;
                                    str7 = str16;
                                    str9 = str17;
                                    q1Var14 = null;
                                    q1Var13 = q1Var14;
                                    z16 = false;
                                    q1Var12 = q1Var13;
                                    fVar = e17;
                                    q1Var8 = q1Var12;
                                    outputStream2 = outputStream3;
                                    str6 = str7;
                                    str3 = str2;
                                    str4 = str9;
                                    str5 = str8;
                                    i15 = 6;
                                    q1Var3 = q1Var8;
                                    if (!pVar.t()) {
                                    }
                                } catch (Exception e56) {
                                    e18 = e56;
                                    bufferedReader = bufferedReader2;
                                    q1Var2 = q1Var;
                                    str8 = str15;
                                    str7 = str16;
                                    str9 = str17;
                                    q1Var17 = null;
                                    z17 = true;
                                    q1Var16 = q1Var17;
                                    z16 = false;
                                    q1Var15 = q1Var16;
                                    exc = e18;
                                    q1Var9 = q1Var15;
                                    outputStream2 = outputStream3;
                                    str6 = str7;
                                    str4 = str9;
                                    str5 = str8;
                                    i15 = 6;
                                    q1Var4 = q1Var9;
                                    if (!pVar.t()) {
                                    }
                                } catch (Throwable th18) {
                                    th7 = th18;
                                    bufferedReader = bufferedReader2;
                                    q1Var2 = q1Var;
                                    str8 = str15;
                                    str7 = str16;
                                    str9 = str17;
                                    z16 = false;
                                    th5 = th7;
                                    outputStream = outputStream3;
                                    str6 = str7;
                                    str3 = str2;
                                    str4 = str9;
                                    str5 = str8;
                                    i15 = 6;
                                    if (bufferedReader != null) {
                                    }
                                    if (outputStream != null) {
                                    }
                                    g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                    throw th5;
                                }
                            } catch (f e57) {
                                e17 = e57;
                                bufferedReader = bufferedReader2;
                                outputStream3 = F;
                                q1Var2 = q1Var;
                                str8 = str15;
                                str7 = str16;
                                str9 = str17;
                                q1Var14 = null;
                                q1Var13 = q1Var14;
                                z16 = false;
                                q1Var12 = q1Var13;
                                fVar = e17;
                                q1Var8 = q1Var12;
                                outputStream2 = outputStream3;
                                str6 = str7;
                                str3 = str2;
                                str4 = str9;
                                str5 = str8;
                                i15 = 6;
                                q1Var3 = q1Var8;
                                if (!pVar.t()) {
                                }
                            } catch (Exception e58) {
                                e18 = e58;
                                bufferedReader = bufferedReader2;
                                outputStream3 = F;
                                q1Var2 = q1Var;
                                str8 = str15;
                                str7 = str16;
                                str9 = str17;
                                q1Var17 = null;
                                z17 = true;
                                q1Var16 = q1Var17;
                                z16 = false;
                                q1Var15 = q1Var16;
                                exc = e18;
                                q1Var9 = q1Var15;
                                outputStream2 = outputStream3;
                                str6 = str7;
                                str4 = str9;
                                str5 = str8;
                                i15 = 6;
                                q1Var4 = q1Var9;
                                if (!pVar.t()) {
                                }
                            } catch (Throwable th19) {
                                th7 = th19;
                                bufferedReader = bufferedReader2;
                                outputStream3 = F;
                                q1Var2 = q1Var;
                                str8 = str15;
                                str7 = str16;
                                str9 = str17;
                                z16 = false;
                                th5 = th7;
                                outputStream = outputStream3;
                                str6 = str7;
                                str3 = str2;
                                str4 = str9;
                                str5 = str8;
                                i15 = 6;
                                if (bufferedReader != null) {
                                }
                                if (outputStream != null) {
                                }
                                g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                throw th5;
                            }
                        }
                        q1Var2 = q1Var;
                        str8 = str15;
                        str7 = str16;
                        str9 = str17;
                        q1Var6 = null;
                        q1Var11 = null;
                        q1Var10 = null;
                        q1Var7 = null;
                        q1Var6 = null;
                        q1Var7 = null;
                        z17 = true;
                        z16 = false;
                    } catch (f e59) {
                        e = e59;
                        bufferedReader = bufferedReader2;
                        outputStream2 = F;
                        q1Var2 = q1Var;
                        str5 = str15;
                        str6 = str16;
                        str4 = str17;
                        i15 = 6;
                        q1Var6 = null;
                        z16 = false;
                        fVar = e;
                        q1Var5 = q1Var6;
                        str3 = str2;
                        q1Var3 = q1Var5;
                        if (!pVar.t()) {
                        }
                    } catch (Exception e65) {
                        e = e65;
                        bufferedReader = bufferedReader2;
                        outputStream2 = F;
                        q1Var2 = q1Var;
                        str5 = str15;
                        str6 = str16;
                        str4 = str17;
                        i15 = 6;
                        q1Var7 = null;
                        z17 = true;
                        z16 = false;
                        exc = e;
                        q1Var4 = q1Var7;
                        if (!pVar.t()) {
                        }
                    } catch (Throwable th20) {
                        th = th20;
                        bufferedReader = bufferedReader2;
                        outputStream2 = F;
                        q1Var2 = q1Var;
                        str5 = str15;
                        str6 = str16;
                        str4 = str17;
                        i15 = 6;
                        z16 = false;
                        th5 = th;
                        outputStream = outputStream2;
                        str3 = str2;
                        if (bufferedReader != null) {
                        }
                        if (outputStream != null) {
                        }
                        g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                        throw th5;
                    }
                    try {
                        if (pVar.t()) {
                            if (arrayList2 != null && nr0.a.a().g() && !pVar.t()) {
                                m.b().e(arrayList2, "preloadTs");
                            }
                            if (z18) {
                                String m16 = pVar.m();
                                sb7 = sb6;
                                try {
                                    if (!((ConcurrentHashMap) this.f290944k).containsKey(m16)) {
                                        ((ConcurrentHashMap) this.f290944k).put(m16, new g());
                                    }
                                    g gVar2 = (g) ((ConcurrentHashMap) this.f290944k).get(m16);
                                    if (i17 == -1) {
                                        throw new f("error parse media sequence");
                                    } else if (i18 != -1) {
                                        int i29 = gVar2.f290911a;
                                        if (i29 == -1) {
                                            if (((ConcurrentHashMap) this.f290945l).get(str) != null) {
                                                g gVar3 = (g) ((ConcurrentHashMap) this.f290945l).get(str);
                                            }
                                            g.p(3, str18, "set MaxMediaSequence " + i17);
                                            gVar2.f290911a = i17;
                                            gVar2.f290912b = System.currentTimeMillis();
                                        } else if (i17 < i29) {
                                            throw new f("mediaSequence can not be less than " + gVar2.f290911a + ", current is " + i17 + ", url=" + str);
                                        } else if (i17 == i29) {
                                            long currentTimeMillis = System.currentTimeMillis() - gVar2.f290912b;
                                            if (currentTimeMillis > ((long) (i18 * 1000))) {
                                                ((ConcurrentHashMap) this.f290945l).put(str, gVar2);
                                                throw new f("MaxMediaSequence not updated in " + currentTimeMillis + "ms, targetDuration=" + i18);
                                            }
                                        } else {
                                            gVar2.f290911a = i17;
                                            gVar2.f290912b = System.currentTimeMillis();
                                        }
                                    } else {
                                        throw new f("error parse target duration");
                                    }
                                } catch (f e66) {
                                    e15 = e66;
                                    fVar = e15;
                                    q1Var8 = q1Var10;
                                    outputStream2 = outputStream3;
                                    str6 = str7;
                                    str3 = str2;
                                    str4 = str9;
                                    str5 = str8;
                                    i15 = 6;
                                    q1Var3 = q1Var8;
                                    if (!pVar.t()) {
                                    }
                                } catch (Exception e67) {
                                    e16 = e67;
                                    exc = e16;
                                    q1Var9 = q1Var11;
                                    outputStream2 = outputStream3;
                                    str6 = str7;
                                    str4 = str9;
                                    str5 = str8;
                                    i15 = 6;
                                    q1Var4 = q1Var9;
                                    if (!pVar.t()) {
                                    }
                                } catch (Throwable th21) {
                                    th6 = th21;
                                    th5 = th6;
                                    outputStream = outputStream3;
                                    str6 = str7;
                                    str3 = str2;
                                    str4 = str9;
                                    str5 = str8;
                                    i15 = 6;
                                    if (bufferedReader != null) {
                                    }
                                    if (outputStream != null) {
                                    }
                                    g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                    throw th5;
                                }
                            } else {
                                sb7 = sb6;
                            }
                            try {
                                g.p(4, str18, "====================== end original m3u8 content ======================");
                                String replaceAll = sb7.toString().replaceAll("\\[VALUE_CACHE_PLACEHOLDER\\]", (!z27 || !nr0.a.a().f()) ? "0" : "1");
                                g.p(4, str18, "====================== start local m3u8 content ======================");
                                g.p(4, str18, replaceAll);
                                g.p(4, str18, "====================== end local m3u8 content ======================");
                                outputStream2 = outputStream3;
                                try {
                                    outputStream2.write(replaceAll.getBytes());
                                    try {
                                        bufferedReader.close();
                                        i19 = 6;
                                    } catch (IOException e68) {
                                        i19 = 6;
                                        g.p(6, str18, str7 + g.g(e68));
                                        z16 = true;
                                    }
                                    try {
                                        outputStream2.close();
                                        z25 = z16;
                                    } catch (IOException e69) {
                                        g.p(i19, str18, str8 + g.g(e69));
                                        z25 = true;
                                    }
                                    if (!z19) {
                                        if (pVar.t()) {
                                            pVar.b();
                                        }
                                        if (q1Var2.m() && q1Var2.v()) {
                                            g.p(4, str18, "generateLocalPlaylistFile, interrupt deletePlayListFile " + q1Var2.toString() + str9 + q1Var2.l());
                                        }
                                        return null;
                                    } else if (!z25) {
                                        return q1Var2;
                                    } else {
                                        if (q1Var2.m() && q1Var2.v()) {
                                            g.p(4, str18, "generateLocalPlaylistFile, hasError deletePlayListFile " + q1Var2.toString() + str9 + q1Var2.l());
                                        }
                                        return null;
                                    }
                                } catch (f e75) {
                                    e = e75;
                                    str6 = str7;
                                    str4 = str9;
                                    str5 = str8;
                                    i15 = 6;
                                    fVar = e;
                                    q1Var5 = q1Var6;
                                    str3 = str2;
                                    q1Var3 = q1Var5;
                                    if (!pVar.t()) {
                                    }
                                } catch (Exception e76) {
                                    e = e76;
                                    str6 = str7;
                                    str4 = str9;
                                    str5 = str8;
                                    i15 = 6;
                                    exc = e;
                                    q1Var4 = q1Var7;
                                    if (!pVar.t()) {
                                    }
                                } catch (Throwable th22) {
                                    th = th22;
                                    str6 = str7;
                                    str4 = str9;
                                    str5 = str8;
                                    i15 = 6;
                                    th5 = th;
                                    outputStream = outputStream2;
                                    str3 = str2;
                                    if (bufferedReader != null) {
                                    }
                                    if (outputStream != null) {
                                    }
                                    g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                    throw th5;
                                }
                            } catch (f e77) {
                                e = e77;
                                outputStream2 = outputStream3;
                                str6 = str7;
                                str4 = str9;
                                str5 = str8;
                                i15 = 6;
                                fVar = e;
                                q1Var5 = q1Var6;
                                str3 = str2;
                                q1Var3 = q1Var5;
                                if (!pVar.t()) {
                                }
                            } catch (Exception e78) {
                                e = e78;
                                outputStream2 = outputStream3;
                                str6 = str7;
                                str4 = str9;
                                str5 = str8;
                                i15 = 6;
                                exc = e;
                                q1Var4 = q1Var7;
                                if (!pVar.t()) {
                                }
                            } catch (Throwable th23) {
                                th = th23;
                                outputStream2 = outputStream3;
                                str6 = str7;
                                str4 = str9;
                                str5 = str8;
                                i15 = 6;
                                th5 = th;
                                outputStream = outputStream2;
                                str3 = str2;
                                if (bufferedReader != null) {
                                }
                                if (outputStream != null) {
                                }
                                g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                throw th5;
                            }
                        } else {
                            outputStream2 = outputStream3;
                            str6 = str7;
                            str4 = str9;
                            str5 = str8;
                            i15 = 6;
                            try {
                                throw new f("request cancelled");
                            } catch (f e79) {
                                e = e79;
                                fVar = e;
                                q1Var5 = q1Var6;
                                str3 = str2;
                                q1Var3 = q1Var5;
                                if (!pVar.t()) {
                                }
                            } catch (Exception e85) {
                                e = e85;
                                exc = e;
                                q1Var4 = q1Var7;
                                if (!pVar.t()) {
                                }
                            } catch (Throwable th24) {
                                th = th24;
                                th5 = th;
                                outputStream = outputStream2;
                                str3 = str2;
                                if (bufferedReader != null) {
                                }
                                if (outputStream != null) {
                                }
                                g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                                throw th5;
                            }
                        }
                    } catch (f e86) {
                        e = e86;
                        outputStream2 = outputStream3;
                        str6 = str7;
                        str4 = str9;
                        str5 = str8;
                        i15 = 6;
                        fVar = e;
                        q1Var5 = q1Var6;
                        str3 = str2;
                        q1Var3 = q1Var5;
                        if (!pVar.t()) {
                        }
                    } catch (Exception e87) {
                        e = e87;
                        outputStream2 = outputStream3;
                        str6 = str7;
                        str4 = str9;
                        str5 = str8;
                        i15 = 6;
                        exc = e;
                        q1Var4 = q1Var7;
                        if (!pVar.t()) {
                        }
                    } catch (Throwable th25) {
                        th = th25;
                        outputStream2 = outputStream3;
                        str6 = str7;
                        str4 = str9;
                        str5 = str8;
                        i15 = 6;
                        th5 = th;
                        outputStream = outputStream2;
                        str3 = str2;
                        if (bufferedReader != null) {
                        }
                        if (outputStream != null) {
                        }
                        g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                        throw th5;
                    }
                } catch (f e88) {
                    bufferedReader = bufferedReader2;
                    q1Var2 = q1Var;
                    str5 = str15;
                    str6 = str16;
                    str4 = str17;
                    i15 = 6;
                    q1Var5 = null;
                    z16 = false;
                    fVar = e88;
                    outputStream2 = null;
                    str3 = str2;
                    q1Var3 = q1Var5;
                    if (!pVar.t()) {
                    }
                } catch (Exception e89) {
                    bufferedReader = bufferedReader2;
                    q1Var2 = q1Var;
                    str5 = str15;
                    str6 = str16;
                    str4 = str17;
                    i15 = 6;
                    q1Var4 = null;
                    z17 = true;
                    z16 = false;
                    exc = e89;
                    outputStream2 = null;
                    if (!pVar.t()) {
                    }
                } catch (Throwable th26) {
                    bufferedReader = bufferedReader2;
                    q1Var2 = q1Var;
                    str5 = str15;
                    str6 = str16;
                    str4 = str17;
                    i15 = 6;
                    outputStream = null;
                    z16 = false;
                    th5 = th26;
                    str3 = str2;
                    if (bufferedReader != null) {
                    }
                    if (outputStream != null) {
                    }
                    g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
                    throw th5;
                }
            }
        }
        str2 = "generateLocalPlaylistFile, finally deletePlayListFile ";
        h0 h0Var2 = h0.i.f188954a;
        l15 = h0Var2.l(a15, null);
        if (l15.a()) {
        }
        if (!z15) {
        }
        q1Var = new q1(d15 + "/" + (System.currentTimeMillis() + ((long) f290933n.incrementAndGet())) + ".m3u8");
        StringBuilder sb102 = new StringBuilder();
        sb102.append("generateLocalPlaylistFile:");
        sb102.append(q1Var);
        g.p(4, str18, sb102.toString());
        if (pVar.g() != 10) {
        }
        m15 = pVar.m();
        if (pVar.g() != 10) {
        }
        g.p(4, str18, "generateLocalPlaylistFile, preloadTsMaxCount=" + i27);
        pVar2.q(pVar.d() | 5);
        compile = Pattern.compile("URI=\"(.+?)\"", 34);
        try {
            eVar.b(gVar);
            boolean z272 = z26;
            i16 = i27;
            bufferedReader2 = new BufferedReader(new f(eVar, "UTF-8"));
            F = u1.F(q1Var);
            sb5 = new StringBuilder();
            g.p(4, str18, "====================== start original m3u8 content ======================");
            arrayList = null;
            z18 = true;
            i17 = -1;
            i18 = -1;
            boolean z282 = false;
            int i282 = 0;
            while (true) {
                ?? r165 = 1;
                r162 = 1;
                r163 = 1;
                ?? r1622 = 1;
                ?? r1632 = 1;
                ?? r1642 = 1;
                z19 = !Thread.interrupted();
                if (z19) {
                }
                F = outputStream3;
                sb5 = sb8;
                arrayList = arrayList3;
                str16 = str7;
                m15 = str10;
                compile = pattern;
                str17 = str9;
                q1Var = q1Var2;
                bufferedReader2 = bufferedReader;
                oVar = this;
                pVar2 = pVar;
                i16 = i26;
                str15 = str8;
            }
            q1Var2 = q1Var;
            str8 = str15;
            str7 = str16;
            str9 = str17;
            q1Var6 = null;
            q1Var11 = null;
            q1Var10 = null;
            q1Var7 = null;
            q1Var6 = null;
            q1Var7 = null;
            z17 = true;
            z16 = false;
            if (pVar.t()) {
            }
        } catch (f e95) {
            q1Var2 = q1Var;
            str5 = str15;
            str6 = str16;
            str4 = str17;
            i15 = 6;
            q1Var5 = null;
            z16 = false;
            fVar = e95;
            outputStream2 = null;
            bufferedReader = null;
            str3 = str2;
            q1Var3 = q1Var5;
            if (!pVar.t()) {
            }
        } catch (Exception e96) {
        } catch (Throwable th27) {
        }
        g.p(4, str18, str3 + q1Var2.toString() + str4 + q1Var2.l());
        throw th5;
    }

    public final int b(Throwable th5) {
        if (th5.toString().toLowerCase().contains("unexpected end of stream")) {
            return 6;
        }
        if (th5.getCause() == null || !(th5.getCause() instanceof SocketTimeoutException)) {
            return 7;
        }
        return 14;
    }

    public String c(String str, boolean z15, boolean z16, String str2, int i15) {
        String str3;
        boolean z17;
        boolean z18;
        String str4;
        String str5;
        String str6;
        String str7;
        boolean z19;
        if (!nr0.a.a().f272499c || this.f290934a > 3 || ((ThreadPoolExecutor) this.f290939f).isShutdown() || ((ThreadPoolExecutor) this.f290939f).isTerminated()) {
            g.q(4, "VideoProxy", "getUrl, proxy disabled or server shutdown", null);
            lr0.k.this.f254494e = false;
            return g.x(str);
        }
        if (URLUtil.isHttpUrl(str) || URLUtil.isHttpsUrl(str)) {
            str3 = str;
            z17 = z16;
        } else {
            String x15 = g.x(str);
            boolean z25 = true;
            if (TextUtils.isEmpty(x15) || !x15.startsWith("file:///android_asset")) {
                z19 = false;
            } else {
                z19 = true;
            }
            if (!z19) {
                if (TextUtils.isEmpty(x15) || !x15.startsWith("android.resource://")) {
                    z25 = false;
                }
                if (!z25) {
                    return x15;
                }
                x15 = str;
            }
            str3 = x15;
            z17 = false;
        }
        if (!g.m(str3)) {
            str4 = str2;
            z18 = z17;
        } else if (!nr0.a.a().f272502f) {
            g.q(4, "VideoProxy", "getUrl, hls proxy disabled", null);
            return str3;
        } else {
            str4 = "application/vnd.apple.mpegurl";
            z18 = false;
        }
        try {
            str5 = URLEncoder.encode(str3, "UTF-8");
        } catch (UnsupportedEncodingException e15) {
            g.q(6, "VideoProxy", "invalid url " + g.h(e15, false), null);
            str5 = "";
        }
        if (TextUtils.isEmpty(str5)) {
            g.q(6, "VideoProxy", "url is empty " + str5, null);
            return str3;
        }
        String lastPathSegment = Uri.parse(str3).getLastPathSegment();
        StringBuilder sb5 = new StringBuilder();
        sb5.append("http://127.0.0.1:" + this.f290937d);
        sb5.append("/");
        sb5.append(lastPathSegment);
        sb5.append("?");
        sb5.append("url");
        sb5.append("=");
        sb5.append(str5);
        String sb6 = sb5.toString();
        if (z18) {
            sb6 = sb6 + "&enableCache=1";
        }
        if (i15 == 90 || i15 == 10 || i15 == -1) {
            sb6 = sb6 + "&priority=" + i15;
        }
        if (!TextUtils.isEmpty(str4)) {
            try {
                str7 = URLEncoder.encode(str4, "UTF-8");
            } catch (UnsupportedEncodingException unused) {
                g.q(6, "VideoProxy", "unable to encode contentType " + str4, null);
                str7 = null;
            }
            if (!TextUtils.isEmpty(str7)) {
                sb6 = sb6 + "&contentType=" + str7;
            }
        }
        if (z15) {
            str6 = System.currentTimeMillis() + "" + f290932m.getAndIncrement();
        } else {
            str6 = null;
        }
        if (str6 != null) {
            sb6 = sb6 + "&id=" + str6;
        }
        String str8 = sb6;
        if (this.f290935b) {
            try {
                str8 = str8 + "&secret=" + l.b("des", l.c(), g.v(str3));
            } catch (Exception e16) {
                g.q(6, "VideoProxy", "encode failed:" + g.h(e16, false), null);
                this.f290935b = false;
            }
        }
        g.q(4, "VideoProxy", "getUrl, url:" + str3 + ", proxyUrl:" + str8, null);
        return str8;
    }

    /* JADX WARNING: Removed duplicated region for block: B:33:0x013d  */
    /* JADX WARNING: Removed duplicated region for block: B:34:0x015a  */
    /* JADX WARNING: Removed duplicated region for block: B:43:0x01a5  */
    /* JADX WARNING: Removed duplicated region for block: B:49:0x01bb  */
    /* JADX WARNING: Removed duplicated region for block: B:53:0x01c4 A[ADDED_TO_REGION] */
    /* JADX WARNING: Removed duplicated region for block: B:66:0x0228  */
    /* JADX WARNING: Removed duplicated region for block: B:67:0x0247  */
    public final b d(e eVar, pr0.g gVar, String str, String str2, p pVar, Socket socket, String str3, long j15, long j16, long j17) {
        b bVar;
        String str4;
        String str5;
        f e15;
        int i15;
        b bVar2;
        String str6;
        int i16;
        String str7;
        int i17;
        String str8;
        String str9;
        b bVar3;
        b bVar4 = new b(this, null);
        bVar4.f290946a = j15;
        g.q(4, str2, "openDataSource, dataSpec=" + gVar.toString(), null);
        if (!g.m(str)) {
            eVar.b(gVar);
        } else {
            try {
                try {
                    q1 a15 = nr0.a.a().f272513q != null ? ((rd.a) nr0.a.a().f272513q).a(str) : null;
                    if (a15 == null || !a15.m()) {
                        bVar4.f290949d = a(eVar, gVar, str, pVar);
                    } else {
                        bVar4.f290949d = a15;
                    }
                    if (bVar4.f290949d != null) {
                        g.q(4, str2, "openDataSource, localPlaylist generate success:" + bVar4.f290949d.toString(), null);
                        a aVar = new a(this);
                        aVar.b(new pr0.g(Uri.fromFile(new File(u1.i(bVar4.f290949d.t(), false))), gVar.f285070b, gVar.f285071c, gVar.f285072d, gVar.f285073e, gVar.f285074f, gVar.f285075g, gVar.f285076h));
                        bVar4.f290948c = aVar;
                    } else {
                        if (pVar.f290964h == 90) {
                            bVar4.f290946a = g.f((long) 18, j16);
                            c cVar = (c) ((HashMap) this.f290941h).get(str3);
                            if (cVar != null) {
                                bVar3 = bVar4;
                                str8 = "openDataSource, videoRequest is interrupted:";
                                str9 = "openDataSource, socket close exception";
                                cVar.a(pVar.f290969m, str, 18, pVar.f290964h, "LivePlayListException", new HashMap(), (int) (System.currentTimeMillis() - j17), bVar4.f290946a, j16);
                                g.q(4, str2, "openDataSource, localPlaylist generate fail, see previous logs", null);
                                socket.close();
                                this.f290940g.d(pVar);
                                if (!pVar.a(2)) {
                                    pVar.s(256);
                                    g.q(4, str2, str8 + pVar, null);
                                    pVar.c();
                                } else {
                                    pVar.s(257);
                                }
                                bVar3.f290947b = true;
                                return bVar3;
                            }
                        }
                        bVar3 = bVar4;
                        str8 = "openDataSource, videoRequest is interrupted:";
                        str9 = "openDataSource, socket close exception";
                        g.q(4, str2, "openDataSource, localPlaylist generate fail, see previous logs", null);
                        try {
                            socket.close();
                        } catch (IOException e16) {
                            g.q(6, str2, str9, e16);
                        }
                        this.f290940g.d(pVar);
                        if (!pVar.a(2)) {
                        }
                        bVar3.f290947b = true;
                        return bVar3;
                    }
                } catch (f e17) {
                    e15 = e17;
                    bVar = bVar4;
                    str5 = "openDataSource, videoRequest is interrupted:";
                    str4 = "openDataSource, socket close exception";
                    g.q(6, "VideoProxy/" + pVar.f290962f, "openDataSource, localPlaylist generate livePlayListException " + e15, null);
                    if (e15.getCause() != null) {
                    }
                    i15 = i17;
                    if (pVar.f290964h == 90) {
                    }
                    str6 = str5;
                    i16 = 6;
                    str7 = str4;
                    bVar2 = bVar;
                    try {
                        socket.close();
                    } catch (IOException e18) {
                        g.q(i16, str2, str7, e18);
                    }
                    this.f290940g.d(pVar);
                    if (pVar.a(2)) {
                    }
                    bVar2.f290947b = true;
                    return bVar2;
                }
            } catch (f e19) {
                e15 = e19;
                bVar = bVar4;
                str5 = "openDataSource, videoRequest is interrupted:";
                str4 = "openDataSource, socket close exception";
                g.q(6, "VideoProxy/" + pVar.f290962f, "openDataSource, localPlaylist generate livePlayListException " + e15, null);
                if (e15.getCause() != null) {
                    i17 = 16;
                } else if ((e15.getCause() instanceof l.b) || (e15.getCause() instanceof l.c)) {
                    i15 = 0;
                    if (pVar.f290964h == 90 || i15 == 0) {
                        str6 = str5;
                        i16 = 6;
                        str7 = str4;
                        bVar2 = bVar;
                    } else {
                        bVar.f290946a = g.f((long) i15, j16);
                        c cVar2 = (c) ((HashMap) this.f290941h).get(str3);
                        if (cVar2 != null) {
                            str6 = str5;
                            bVar2 = bVar;
                            i16 = 6;
                            str7 = str4;
                            cVar2.a(pVar.f290969m, str, i15, pVar.f290964h, "LivePlayListException", new HashMap(), (int) (System.currentTimeMillis() - j17), bVar.f290946a, j16);
                        } else {
                            str6 = str5;
                            bVar2 = bVar;
                            str7 = str4;
                            i16 = 6;
                        }
                    }
                    socket.close();
                    this.f290940g.d(pVar);
                    if (pVar.a(2)) {
                        pVar.s(256);
                        g.q(4, str2, str6 + pVar, null);
                        pVar.c();
                    } else {
                        pVar.s(257);
                    }
                    bVar2.f290947b = true;
                    return bVar2;
                } else {
                    i17 = 17;
                }
                i15 = i17;
                if (pVar.f290964h == 90) {
                }
                str6 = str5;
                i16 = 6;
                str7 = str4;
                bVar2 = bVar;
                socket.close();
                this.f290940g.d(pVar);
                if (pVar.a(2)) {
                }
                bVar2.f290947b = true;
                return bVar2;
            }
        }
        return bVar4;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:114:0x02fa, code lost:
        r12 = r8;
        r4 = r31;
        r9 = r53;
        r1 = r54;
        r10 = r61;
        r8 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:115:0x0309, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:116:0x030a, code lost:
        r13 = r1;
        r12 = r8;
        r62 = r38;
        r4 = r31;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:117:0x0310, code lost:
        r9 = r53;
        r1 = r54;
        r10 = r61;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:119:0x0319, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:121:0x0332, code lost:
        r12 = r8;
        r13 = r38;
        r8 = "write response, dataSource close failed";
        r9 = r54;
        r10 = r61;
        r52 = 0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:122:0x0341, code lost:
        r11 = r0;
        r73 = r4;
        r32 = r8;
        r56 = r38;
        r18 = r12;
        r4 = true;
        r8 = r12;
        r12 = 0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:166:0x0417, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:167:0x0418, code lost:
        r32 = r8;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:170:0x042a, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:171:0x042b, code lost:
        r32 = r8;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:207:0x04b4, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:208:0x04b6, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:209:0x04b7, code lost:
        r8 = r10;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:210:0x04ba, code lost:
        r12 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:211:0x04bc, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:212:0x04bd, code lost:
        r32 = r8;
        r8 = r10;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:218:0x04ce, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:219:0x04cf, code lost:
        r32 = r8;
        r8 = r0;
        r47 = r3;
        r12 = r4;
        r48 = r5;
        r14 = null;
        r3 = r1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:220:0x04dd, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:221:0x04de, code lost:
        r32 = r8;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:222:0x04e0, code lost:
        r4 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:223:0x04e4, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:224:0x04e5, code lost:
        r32 = r8;
        r8 = r10;
        r18 = r12;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:227:0x0503, code lost:
        r32 = r8;
        r8 = r10;
        r18 = r12;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:232:0x0518, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:233:0x0519, code lost:
        r15 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:234:0x051c, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:235:0x051e, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:236:0x051f, code lost:
        r12 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:242:0x052d, code lost:
        r27 = r11;
        r52 = r4;
        r8 = r31;
        r12 = r32;
        r9 = r54;
        r13 = r56;
        r10 = r61;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:274:0x0638, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:275:0x0639, code lost:
        r15 = r1;
        r11 = r5;
        r60 = null;
        r5 = r54;
        r8 = r3;
        r3 = r61;
        r10 = r4;
        r16 = r0;
        r14 = r31;
        r4 = r53;
        r9 = r32;
        r12 = r56;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:276:0x0661, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:277:0x0662, code lost:
        r75 = r1;
        r16 = r4;
        r17 = r11;
        r4 = r31;
        r12 = r32;
        r9 = r53;
        r1 = r54;
        r13 = r56;
        r10 = r61;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:278:0x0675, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:279:0x0676, code lost:
        r75 = r1;
        r16 = r4;
        r17 = r11;
        r4 = r31;
        r12 = r32;
        r9 = r53;
        r1 = r54;
        r13 = r56;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:291:0x0703, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:292:0x0704, code lost:
        r75 = r1;
        r12 = r8;
        r4 = r31;
        r9 = r53;
        r1 = r54;
        r13 = r56;
        r10 = r61;
        r8 = r0;
        r44 = 0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:294:0x0729, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:295:0x072a, code lost:
        r75 = r1;
        r12 = r8;
        r4 = r31;
        r9 = r53;
        r1 = r54;
        r13 = r56;
        r10 = r61;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:297:0x073e, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:298:0x073f, code lost:
        r75 = r1;
        r18 = r12;
        r4 = r31;
        r9 = r53;
        r1 = r54;
        r13 = r56;
        r10 = r61;
        r12 = r8;
        r8 = r12;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:299:0x0753, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:300:0x0754, code lost:
        r75 = r1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:304:0x076a, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:305:0x076d, code lost:
        r62 = r38;
        r14 = r30;
        r13 = r1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:306:0x0775, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:307:0x0776, code lost:
        r75 = r1;
        r12 = r8;
        r13 = r38;
        r4 = r31;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:319:0x07a9, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:321:0x07b6, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:322:0x07b7, code lost:
        r75 = r1;
        r73 = r4;
        r4 = "write response, dataSource close failed";
        r18 = r12;
        r30 = r14;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:324:0x07c9, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:325:0x07ca, code lost:
        r75 = r1;
        r12 = r8;
        r4 = "write response, dataSource close failed";
        r30 = r14;
        r1 = r54;
        r13 = r38;
        r9 = r53;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:340:0x083e, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:341:0x083f, code lost:
        r15 = r74;
        r13 = r1;
        r12 = r8;
        r62 = r38;
        r4 = "write response, dataSource close failed";
        r30 = r14;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:342:0x084a, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:343:0x084b, code lost:
        r15 = r74;
        r13 = r1;
        r12 = r8;
        r62 = r38;
        r4 = "write response, dataSource close failed";
        r30 = r14;
        r14 = r11;
        r9 = r53;
        r1 = r54;
        r8 = r12;
        r10 = r61;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:344:0x0861, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:345:0x0862, code lost:
        r13 = r1;
        r12 = r8;
        r62 = r38;
        r4 = "write response, dataSource close failed";
        r30 = r14;
        r9 = r53;
        r1 = r54;
        r10 = r61;
        r11 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:360:0x08e9, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:361:0x08ea, code lost:
        r15 = r74;
        r62 = r38;
        r4 = "write response, dataSource close failed";
        r13 = r3;
        r9 = r53;
        r1 = r54;
        r10 = r61;
        r12 = r8;
        r8 = r0;
        r17 = r12;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:362:0x08ff, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:363:0x0900, code lost:
        r15 = r74;
        r62 = r38;
        r4 = "write response, dataSource close failed";
        r28 = r12;
        r13 = r3;
        r14 = r11;
        r9 = r53;
        r1 = r54;
        r10 = r61;
        r12 = r8;
        r8 = r12;
        r16 = r0;
        r18 = -1;
        r30 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:365:0x0930, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:366:0x0931, code lost:
        r12 = r8;
        r62 = r38;
        r4 = "write response, dataSource close failed";
        r13 = r3;
        r9 = r53;
        r1 = r54;
        r10 = r61;
        r11 = r0;
        r14 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:376:0x099b, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:377:0x099c, code lost:
        r13 = r3;
        r4 = "write response, dataSource close failed";
        r12 = r32;
        r2 = r6;
        r3 = "write response, total send ";
        r5 = " bytes, rangeStart=";
        r6 = r9;
        r9 = r53;
        r1 = r54;
        r62 = r38;
        r10 = r61;
        r8 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:380:0x09c6, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:381:0x09c7, code lost:
        r15 = r74;
        r13 = r3;
        r4 = "write response, dataSource close failed";
        r12 = r32;
        r2 = r6;
        r3 = "write response, total send ";
        r5 = " bytes, rangeStart=";
        r6 = r9;
        r9 = r53;
        r1 = r54;
        r62 = r38;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:391:?, code lost:
        r74.b();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:392:0x0a09, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:393:0x0a0a, code lost:
        r1 = r0;
        r32 = r12;
        r11 = r62;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:415:0x0abb, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:416:0x0abc, code lost:
        r15 = r74;
        r13 = r3;
        r4 = "write response, dataSource close failed";
        r2 = r6;
        r3 = "write response, total send ";
        r5 = " bytes, rangeStart=";
        r6 = r9;
        r14 = r11;
        r9 = r53;
        r11 = r38;
        r8 = r12;
        r10 = r61;
        r16 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:424:?, code lost:
        r4 = (pr0.l.f) r1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:425:0x0af8, code lost:
        r53 = r9;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:426:0x0afc, code lost:
        if (r74.g() == 90) goto L_0x0afe;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:430:0x0b02, code lost:
        if (r4.f285120d == 416) goto L_0x0b04;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:431:0x0b04, code lost:
        r9 = r70;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:434:0x0b08, code lost:
        r47 = r3;
        r48 = r5;
        r5 = r5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:436:?, code lost:
        r3 = r9.f290940g.c(r5, -1).iterator();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:438:0x0b1b, code lost:
        if (r3.hasNext() != false) goto L_0x0b1d;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:440:?, code lost:
        r10 = r3.next();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:441:0x0b27, code lost:
        if (r10.equals(r15) == false) goto L_0x0b29;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:443:?, code lost:
        monitor-enter(r10);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:444:0x0b2a, code lost:
        r75 = r4;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:446:?, code lost:
        r3 = r10.f290967k;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:449:0x0b33, code lost:
        if (r3 != -1) goto L_0x0b35;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:451:?, code lost:
        monitor-enter(r10);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:453:?, code lost:
        r3 = r10.f290967k;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:454:0x0b38, code lost:
        monitor-exit(r10);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:455:0x0b39, code lost:
        r10 = r10.e();
        r20 = r3;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:460:0x0b44, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:461:0x0b46, code lost:
        r4 = r75;
        r3 = r3;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:466:0x0b4f, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:467:0x0b51, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:468:0x0b52, code lost:
        r3 = r0;
        r56 = r11;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:469:0x0b57, code lost:
        r75 = r4;
        r10 = r14;
        r20 = -1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:471:0x0b5f, code lost:
        if (r20 == -1) goto L_0x0bcf;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:476:0x0b69, code lost:
        r22 = r10.toString();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:477:0x0b71, code lost:
        if (sr0.g.m(r72) == false) goto L_0x0b73;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:478:0x0b73, code lost:
        r23 = true;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:479:0x0b76, code lost:
        r23 = false;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:480:0x0b78, code lost:
        r3 = sr0.e.d(r6, r11, r20, r22, r23);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:481:0x0b86, code lost:
        if (r10.equals(qr0.b.f290904c) != false) goto L_0x0b88;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:482:0x0b88, code lost:
        sr0.g.p(6, r2, "file type should not be unknown");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:483:0x0b8e, code lost:
        r4 = new java.lang.StringBuilder();
        r4.append("write response, responseCode 416, totalLength=");
        r56 = r11;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:485:?, code lost:
        r4.append(r65);
        r4.append(", send response headers: ");
        r10 = null;
        r4.append(sr0.g.w(r3, null));
        sr0.g.p(4, r2, r4.toString());
     */
    /* JADX WARNING: Code restructure failed: missing block: B:488:?, code lost:
        r8.write(r3.getBytes("UTF-8"));
        r8.flush();
        r8.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:489:0x0bc5, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:490:0x0bc6, code lost:
        sr0.g.q(4, r2, "write response, workaround 416 error ", r0);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:491:0x0bcf, code lost:
        r56 = r11;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:492:0x0bd2, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:493:0x0bd4, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:494:0x0bd6, code lost:
        r9 = r70;
        r47 = r3;
        r75 = r4;
        r48 = r5;
        r56 = r11;
        r5 = r5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:495:0x0be2, code lost:
        r10 = r1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:496:0x0be3, code lost:
        if (r10 == null) goto L_0x0c20;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:498:?, code lost:
        sr0.g.p(4, r2, "uri:" + r74.l() + ", InvalidResponseCode: \r\n" + sr0.e.a(r75.f285121e));
        r11 = sr0.g.i(r75.f285121e);
        r39 = sr0.g.f((long) r75.f285120d, r11);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:499:0x0c19, code lost:
        r1 = r10;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:500:0x0c1c, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:501:0x0c1d, code lost:
        r1 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:502:0x0c20, code lost:
        r1 = r10;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:503:0x0c23, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:505:0x0c26, code lost:
        r47 = r3;
        r48 = r5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:506:0x0c2a, code lost:
        r56 = r11;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:507:0x0c2c, code lost:
        r3 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:508:0x0c2f, code lost:
        r9 = r70;
        r47 = r3;
        r48 = r5;
        r56 = r11;
        r5 = r5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:509:0x0c3a, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:510:0x0c3b, code lost:
        r47 = r3;
        r48 = r5;
        r53 = r9;
        r56 = r11;
        r3 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:511:0x0c46, code lost:
        r8 = r3;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:512:0x0c49, code lost:
        r47 = r3;
        r48 = r5;
        r53 = r9;
        r56 = r11;
        r5 = r5;
        r9 = r70;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:515:0x0c58, code lost:
        if ((r1 instanceof pr0.l.e) != false) goto L_0x0c5a;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:516:0x0c5a, code lost:
        r3 = (pr0.l.e) r1;
        sr0.g.p(4, r2, "uri:" + r74.l() + ", InvalidContentType: \r\n" + sr0.e.a(r3.f285119d));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:517:0x0c88, code lost:
        if (r74.g() == 90) goto L_0x0c8a;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:518:0x0c8a, code lost:
        r3 = sr0.g.i(r3.f285119d);
        r39 = sr0.g.f(3, r3);
        r11 = r3;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:521:0x0ca1, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:523:0x0ca5, code lost:
        if ((r1 instanceof pr0.l.d) != false) goto L_0x0ca7;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:524:0x0ca7, code lost:
        sr0.g.p(4, r2, "uri:" + r74.l() + ", InvalidContent");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:525:0x0cc9, code lost:
        if (r74.g() == 90) goto L_0x0ccb;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:526:0x0ccb, code lost:
        r11 = -99999;
        r39 = sr0.g.f(10, -99999);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:527:0x0cd5, code lost:
        r11 = -99999;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:528:0x0cda, code lost:
        if ((r1 instanceof pr0.l.g) != false) goto L_0x0cdc;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:529:0x0cdc, code lost:
        sr0.g.p(4, r2, "uri:" + r74.l() + ", MalformedResponse");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:530:0x0cfe, code lost:
        if (r74.g() == 90) goto L_0x0d00;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:531:0x0d00, code lost:
        r39 = sr0.g.f(12, -99999);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:533:0x0d09, code lost:
        if ((r1 instanceof pr0.l.b) != false) goto L_0x0d0b;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:534:0x0d0b, code lost:
        r15.s(256);
        sr0.g.p(5, r2, "uri:" + r74.l() + " connect to server interrupted");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:536:0x0d30, code lost:
        if ((r1 instanceof pr0.l.c) != false) goto L_0x0d32;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:537:0x0d32, code lost:
        r15.s(256);
        sr0.g.p(5, r2, "uri:" + r74.l() + " read interrupted");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:538:0x0d55, code lost:
        r10 = r1;
        r1 = r3;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:539:0x0d57, code lost:
        r8 = r1;
        r1 = r10;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:540:0x0d59, code lost:
        r14 = r1;
        r3 = r13;
        r12 = r64;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:542:0x0d61, code lost:
        if ((r1 instanceof pr0.l.h) != false) goto L_0x0d63;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:544:?, code lost:
        sr0.g.p(5, r2, "uri:" + r74.l() + ", unable to connect server: " + sr0.g.g(r1));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:545:0x0d8c, code lost:
        if (r74.g() == 90) goto L_0x0d8e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:547:0x0d90, code lost:
        if ((r13 instanceof or0.c) != false) goto L_0x0d92;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:548:0x0d92, code lost:
        r3 = ((or0.c) r13).h();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:549:0x0d9b, code lost:
        if ((r3 instanceof pr0.j) != false) goto L_0x0d9d;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:550:0x0d9d, code lost:
        r14 = ((pr0.j) r3).h();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:551:0x0da4, code lost:
        sr0.g.p(4, r2, "write response, cacheDataSource error:" + r13);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:553:0x0dbd, code lost:
        if ((r13 instanceof pr0.j) != false) goto L_0x0dbf;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:554:0x0dbf, code lost:
        r14 = ((pr0.j) r13).h();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:555:0x0dc7, code lost:
        r14 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:556:0x0dc8, code lost:
        if (r14 != null) goto L_0x0dca;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:564:0x0de1, code lost:
        r27 = false;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:565:0x0de3, code lost:
        if (r27 != false) goto L_0x0de5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:566:0x0de5, code lost:
        r3 = 13;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:568:0x0dec, code lost:
        if (sr0.g.n() != false) goto L_0x0dee;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:569:0x0dee, code lost:
        r3 = 5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:570:0x0df0, code lost:
        r3 = 9;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:571:0x0df2, code lost:
        r39 = sr0.g.f((long) r3, -99999);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:573:0x0dfb, code lost:
        if ((r1 instanceof pr0.l.a) != false) goto L_0x0dfd;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:574:0x0dfd, code lost:
        sr0.g.p(5, r2, "uri:" + r74.l() + ", read upstream error1: " + sr0.g.g(r1));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:575:0x0e26, code lost:
        if (r74.g() == 90) goto L_0x0e28;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:576:0x0e28, code lost:
        r39 = sr0.g.f((long) r9.b(r1), -99999);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:578:0x0e35, code lost:
        if ((r13 instanceof pr0.k) == false) goto L_0x0e72;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:581:0x0e3b, code lost:
        sr0.g.p(5, r2, "uri:" + r74.l() + ", read upstream error2: " + sr0.g.g(r1));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:582:0x0e64, code lost:
        if (r74.g() == 90) goto L_0x0e66;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:583:0x0e66, code lost:
        r39 = sr0.g.f(1404, -99999);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:584:0x0e6e, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:585:0x0e6f, code lost:
        r3 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:587:0x0e74, code lost:
        if ((r1 instanceof java.net.NoRouteToHostException) != false) goto L_0x0e76;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:588:0x0e76, code lost:
        sr0.g.p(5, r2, "uri:" + r74.l() + ", read upstream error3: " + sr0.g.g(r1));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:589:0x0e9f, code lost:
        if (r74.g() == 90) goto L_0x0ea1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:590:0x0ea1, code lost:
        r39 = sr0.g.f(1, -99999);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:592:0x0eab, code lost:
        if ((r1 instanceof java.io.InterruptedIOException) != false) goto L_0x0ead;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:593:0x0ead, code lost:
        r15.s(256);
        sr0.g.p(4, r2, "uri:" + r74.l() + " is interrupted by system");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:594:0x0ece, code lost:
        r14 = r1;
        r3 = -99999;
        r12 = false;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:596:0x0edc, code lost:
        if (r1.getMessage().matches("(?i)^.*((ECONNRESET)|(EPIPE)|(reset)).*$") != false) goto L_0x0ede;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:597:0x0ede, code lost:
        sr0.g.p(5, r2, "response interrupted, client closed connection");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:599:0x0ef1, code lost:
        if (r1.toString().contains("write byteCount err") != false) goto L_0x0ef3;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:600:0x0ef3, code lost:
        sr0.g.p(5, r2, "response interrupted, socket write byteCount err");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:601:0x0efb, code lost:
        sr0.g.p(5, r2, "uri:" + r15 + ", error occurred while sending data " + sr0.g.g(r1));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:606:?, code lost:
        r74.b();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:607:0x0f26, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:608:0x0f27, code lost:
        r3 = r0;
        r1 = r14;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:618:?, code lost:
        r71.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:619:0x0f7d, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:620:0x0f7e, code lost:
        sr0.g.q(r6, r2, r54, r0);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:719:0x11f2, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:720:0x11f3, code lost:
        r15 = r13;
        r14 = r31;
        r9 = r32;
        r8 = r47;
        r11 = r48;
        r4 = r53;
        r5 = r54;
        r12 = r56;
        r3 = r61;
        r10 = r64;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:733:?, code lost:
        r71.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:734:0x1248, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:735:0x1249, code lost:
        sr0.g.q(r1, r2, r5, r0);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:73:0x0256, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:74:0x0257, code lost:
        r4 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:75:0x025a, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:76:0x025b, code lost:
        r28 = r12;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:83:0x0278, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:84:0x027a, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:85:0x027b, code lost:
        r4 = r0;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:89:0x0281, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:90:0x0282, code lost:
        r12 = r8;
        r62 = r38;
        r30 = r14;
        r9 = r53;
        r10 = r61;
        r8 = r1;
        r1 = r54;
        r11 = r0;
        r4 = "write response, dataSource close failed";
     */
    /* JADX WARNING: Code restructure failed: missing block: B:91:0x0296, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:92:0x0297, code lost:
        r28 = r12;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:93:0x029a, code lost:
        r15 = r74;
        r30 = r14;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:94:0x02a2, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:95:0x02a3, code lost:
        r28 = r12;
     */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Removed duplicated region for block: B:218:0x04ce A[ExcHandler: all (r0v92 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:144:0x03cd] */
    /* JADX WARNING: Removed duplicated region for block: B:220:0x04dd A[ExcHandler: Exception (e java.lang.Exception), Splitter:B:144:0x03cd] */
    /* JADX WARNING: Removed duplicated region for block: B:229:0x050b  */
    /* JADX WARNING: Removed duplicated region for block: B:232:0x0518 A[ExcHandler: all (r0v80 'th' java.lang.Throwable A[CUSTOM_DECLARE]), PHI: r4 r32 
      PHI: (r4v161 int) = (r4v152 int), (r4v152 int), (r4v152 int), (r4v152 int), (r4v152 int), (r4v183 int), (r4v152 int), (r4v152 int) binds: [B:230:0x050d, B:231:?, B:173:0x0430, B:174:?, B:204:0x049e, B:205:?, B:162:0x03ff, B:163:?] A[DONT_GENERATE, DONT_INLINE]
      PHI: (r32v15 java.lang.String) = (r32v18 java.lang.String), (r32v18 java.lang.String), (r32v31 java.lang.String), (r32v31 java.lang.String), (r32v31 java.lang.String), (r32v31 java.lang.String), (r32v36 java.lang.String), (r32v36 java.lang.String) binds: [B:230:0x050d, B:231:?, B:173:0x0430, B:174:?, B:204:0x049e, B:205:?, B:162:0x03ff, B:163:?] A[DONT_GENERATE, DONT_INLINE], Splitter:B:162:0x03ff] */
    /* JADX WARNING: Removed duplicated region for block: B:234:0x051c A[ExcHandler: Exception (e java.lang.Exception), PHI: r4 r32 
      PHI: (r4v160 int) = (r4v152 int), (r4v152 int), (r4v152 int), (r4v152 int), (r4v152 int), (r4v183 int), (r4v152 int), (r4v152 int) binds: [B:230:0x050d, B:231:?, B:173:0x0430, B:174:?, B:204:0x049e, B:205:?, B:162:0x03ff, B:163:?] A[DONT_GENERATE, DONT_INLINE]
      PHI: (r32v14 java.lang.String) = (r32v18 java.lang.String), (r32v18 java.lang.String), (r32v31 java.lang.String), (r32v31 java.lang.String), (r32v31 java.lang.String), (r32v31 java.lang.String), (r32v36 java.lang.String), (r32v36 java.lang.String) binds: [B:230:0x050d, B:231:?, B:173:0x0430, B:174:?, B:204:0x049e, B:205:?, B:162:0x03ff, B:163:?] A[DONT_GENERATE, DONT_INLINE], Splitter:B:162:0x03ff] */
    /* JADX WARNING: Removed duplicated region for block: B:237:0x0521  */
    /* JADX WARNING: Removed duplicated region for block: B:241:0x0529  */
    /* JADX WARNING: Removed duplicated region for block: B:278:0x0675 A[ExcHandler: IOException (e java.io.IOException), Splitter:B:238:0x0523] */
    /* JADX WARNING: Removed duplicated region for block: B:291:0x0703 A[ExcHandler: all (r0v72 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:134:0x0382] */
    /* JADX WARNING: Removed duplicated region for block: B:294:0x0729 A[ExcHandler: Exception (e java.lang.Exception), Splitter:B:134:0x0382] */
    /* JADX WARNING: Removed duplicated region for block: B:304:0x076a A[ExcHandler: all (r0v65 'th' java.lang.Throwable A[CUSTOM_DECLARE]), PHI: r31 
      PHI: (r31v5 java.lang.String) = (r31v7 java.lang.String), (r31v7 java.lang.String), (r31v7 java.lang.String), (r31v11 java.lang.String), (r31v11 java.lang.String) binds: [B:124:0x0354, B:131:0x0377, B:132:?, B:112:0x02f5, B:113:?] A[DONT_GENERATE, DONT_INLINE], Splitter:B:112:0x02f5] */
    /* JADX WARNING: Removed duplicated region for block: B:306:0x0775 A[ExcHandler: Exception (e java.lang.Exception), Splitter:B:124:0x0354] */
    /* JADX WARNING: Removed duplicated region for block: B:324:0x07c9 A[ExcHandler: all (th java.lang.Throwable), Splitter:B:102:0x02dc] */
    /* JADX WARNING: Removed duplicated region for block: B:344:0x0861 A[ExcHandler: all (r0v111 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:56:0x020a] */
    /* JADX WARNING: Removed duplicated region for block: B:365:0x0930 A[ExcHandler: all (r0v37 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:47:0x01fc] */
    /* JADX WARNING: Removed duplicated region for block: B:376:0x099b A[ExcHandler: all (r0v32 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:18:0x010e] */
    /* JADX WARNING: Removed duplicated region for block: B:380:0x09c6 A[ExcHandler: Exception (e java.lang.Exception), Splitter:B:18:0x010e] */
    /* JADX WARNING: Removed duplicated region for block: B:390:0x0a05 A[SYNTHETIC, Splitter:B:390:0x0a05] */
    /* JADX WARNING: Removed duplicated region for block: B:422:0x0af1  */
    /* JADX WARNING: Removed duplicated region for block: B:497:0x0be5 A[SYNTHETIC, Splitter:B:497:0x0be5] */
    /* JADX WARNING: Removed duplicated region for block: B:502:0x0c20  */
    /* JADX WARNING: Removed duplicated region for block: B:512:0x0c49  */
    /* JADX WARNING: Removed duplicated region for block: B:557:0x0dca A[Catch:{ all -> 0x0e6e }] */
    /* JADX WARNING: Removed duplicated region for block: B:566:0x0de5 A[Catch:{ all -> 0x0e6e }] */
    /* JADX WARNING: Removed duplicated region for block: B:567:0x0de8 A[Catch:{ all -> 0x0e6e }] */
    /* JADX WARNING: Removed duplicated region for block: B:605:0x0f22 A[SYNTHETIC, Splitter:B:605:0x0f22] */
    /* JADX WARNING: Removed duplicated region for block: B:617:0x0f79 A[SYNTHETIC, Splitter:B:617:0x0f79] */
    /* JADX WARNING: Removed duplicated region for block: B:634:0x0fec  */
    /* JADX WARNING: Removed duplicated region for block: B:635:0x0ff0  */
    /* JADX WARNING: Removed duplicated region for block: B:639:0x1016  */
    /* JADX WARNING: Removed duplicated region for block: B:643:0x1037  */
    /* JADX WARNING: Removed duplicated region for block: B:705:0x1181  */
    /* JADX WARNING: Removed duplicated region for block: B:732:0x1244 A[SYNTHETIC, Splitter:B:732:0x1244] */
    /* JADX WARNING: Removed duplicated region for block: B:84:0x027a A[ExcHandler: Exception (e java.lang.Exception), PHI: r28 
      PHI: (r28v30 long) = (r28v31 long), (r28v31 long), (r28v31 long), (r28v31 long), (r28v36 long) binds: [B:78:0x0260, B:79:?, B:81:0x0273, B:82:?, B:69:0x022c] A[DONT_GENERATE, DONT_INLINE], Splitter:B:69:0x022c] */
    /* JADX WARNING: Removed duplicated region for block: B:89:0x0281 A[ExcHandler: all (r0v116 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:60:0x020f] */
    /* JADX WARNING: Removed duplicated region for block: B:91:0x0296 A[ExcHandler: Exception (e java.lang.Exception), Splitter:B:60:0x020f] */
    public final void e(Socket socket, String str, OutputStream outputStream, p pVar, InputStream inputStream) {
        long j15;
        long j16;
        long currentTimeMillis;
        long j17;
        boolean z15;
        IOException iOException;
        q1 q1Var;
        Throwable th5;
        e eVar;
        String str2;
        long j18;
        String str3;
        int i15;
        String str4;
        String str5;
        long j19;
        String str6;
        String str7;
        String str8;
        String str9;
        int i16;
        p pVar2;
        Exception exc;
        boolean z16;
        o oVar;
        long j25;
        String str10;
        long j26;
        e eVar2;
        String str11;
        long j27;
        long j28;
        String str12;
        String str13;
        String str14;
        long j29;
        int i17;
        long j35;
        boolean z17;
        b bVar;
        e eVar3;
        long j36;
        String str15;
        String str16;
        BufferedOutputStream bufferedOutputStream;
        String str17;
        String str18;
        IOException iOException2;
        int i18;
        String str19;
        long j37;
        e eVar4;
        String str20;
        String str21;
        String str22;
        int i19;
        String str23;
        String str24;
        String str25;
        Throwable th6;
        long j38;
        String str26;
        String str27;
        IOException e15;
        long j39;
        e eVar5;
        String str28;
        String str29;
        String str30;
        String str31;
        String str32;
        Throwable th7;
        long j45;
        long j46;
        long j47;
        long j48;
        IOException iOException3;
        String str33;
        String str34;
        String str35;
        q1 q1Var2;
        Exception exc2;
        e eVar6;
        Throwable th8;
        long a15;
        e eVar7;
        long j49;
        e eVar8;
        b bVar2;
        long j55;
        long j56;
        String d15;
        StringBuilder sb5;
        BufferedOutputStream bufferedOutputStream2;
        Throwable th9;
        long j57;
        String str36;
        String str37;
        String str38;
        String str39;
        String str40;
        IOException iOException4;
        char c15;
        int i25;
        pr0.g gVar;
        e eVar9;
        int i26;
        String str41 = "VideoProxy/" + pVar.k();
        String n15 = pVar.n();
        e a16 = new pr0.i(this.f290936c, this.f290942i.get(n15), pVar).a(str, str41 + "/");
        if (a16 == null) {
            g.p(6, str41, "write response, dataSource is null, return");
            return;
        }
        byte[] bArr = new byte[65536];
        b bVar3 = b.f290904c;
        long h15 = pVar.h();
        String str42 = ", rangeEnd=";
        long i27 = pVar.i();
        if (h15 == -1 || h15 == -2) {
            j15 = h15;
            j16 = -1;
        } else {
            j15 = h15;
            j16 = (h15 - i27) + 1;
        }
        int i28 = (i27 > -1 ? 1 : (i27 == -1 ? 0 : -1));
        pr0.g gVar2 = new pr0.g(Uri.parse(str), i28 == 0 ? 0 : i27, i28 == 0 ? 0 : i27, j16, n15, 0, pVar.m(), pVar.g());
        BufferedOutputStream bufferedOutputStream3 = new BufferedOutputStream(outputStream);
        currentTimeMillis = System.currentTimeMillis();
        j17 = 0;
        z15 = true;
        String str43 = "write response, delete PlayListFile:";
        pr0.g gVar3 = gVar2;
        byte[] bArr2 = bArr;
        String str44 = "write response, socket close failed";
        String str45 = "write response, delete PlayListFile failed:";
        try {
            b d16 = d(a16, gVar2, str, str41, pVar, socket, n15, 0, -99999, currentTimeMillis);
            if (d16.f290947b) {
                str9 = str41;
                try {
                    g.p(4, str9, "write response, isHandled");
                    g.p(4, str9, "write response, total send " + 0 + " bytes, rangeStart=" + i27 + str42 + j15);
                    try {
                        a16.close();
                        i26 = 5;
                    } catch (IOException unused) {
                        i26 = 5;
                        g.p(5, str9, "write response, dataSource close failed");
                    }
                    try {
                        socket.close();
                        return;
                    } catch (IOException e16) {
                        g.q(i26, str9, str44, e16);
                        return;
                    }
                } catch (IOException e17) {
                    str18 = "write response, total send ";
                    str17 = " bytes, rangeStart=";
                    j19 = i27;
                    iOException2 = e17;
                    pVar2 = pVar;
                    i17 = 0;
                    str42 = str42;
                    str14 = "write response, dataSource close failed";
                    str44 = str44;
                    eVar3 = a16;
                    j35 = 0;
                    z17 = true;
                    j29 = -1;
                    bVar = bVar3;
                    bufferedOutputStream = bufferedOutputStream3;
                    q1Var = null;
                    j36 = j15;
                    str16 = str43;
                    str15 = str45;
                    try {
                        str45 = str15;
                        if (iOException2 instanceof l.f) {
                        }
                        long j58 = -99999;
                        exc = iOException2;
                        long j59 = j58;
                        boolean z18 = z17;
                    } catch (Throwable th10) {
                        Throwable th11 = th10;
                        str5 = str18;
                        str7 = str16;
                        str8 = str15;
                        eVar = eVar3;
                        str2 = str14;
                        str4 = str42;
                        i15 = i17;
                        j18 = j36;
                        str3 = str17;
                        str6 = str44;
                        th5 = th11;
                        iOException = iOException2;
                        g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                        try {
                            eVar.close();
                            i16 = 5;
                        } catch (IOException unused2) {
                            i16 = 5;
                            g.p(5, str9, str2);
                        }
                        if (iOException == null) {
                        }
                        g.p(4, str9, str7 + q1Var.toString());
                        g.p(5, str9, str8 + q1Var.toString());
                        throw th5;
                    }
                    try {
                        if (pVar.t()) {
                        }
                        g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                        try {
                            eVar3.close();
                            i18 = 5;
                        } catch (IOException unused3) {
                            i18 = 5;
                            g.p(5, str9, str14);
                        }
                        if (exc == null) {
                        }
                        g.p(4, str9, str43 + q1Var.toString());
                        g.p(5, str9, str45 + q1Var.toString());
                        j25 = j59;
                        z16 = z18;
                        eVar2 = eVar3;
                        j26 = j35;
                        oVar.f290940g.d(pVar2);
                        if (!pVar.o()) {
                        }
                        String m15 = pVar.m();
                        int g15 = pVar.g();
                        int currentTimeMillis2 = (int) (System.currentTimeMillis() - currentTimeMillis);
                        c cVar = (c) ((HashMap) oVar.f290941h).get(str10);
                        if (!(exc instanceof l.f)) {
                        }
                        if (nr0.a.a().e() != null) {
                        }
                        g.p(4, str9, "write response finish");
                    } catch (Throwable th12) {
                        eVar = eVar3;
                        str4 = str42;
                        str5 = str13;
                        str3 = str12;
                        str7 = str43;
                        str6 = str44;
                        j18 = j28;
                        str8 = str45;
                        i15 = i17;
                        th5 = th12;
                        iOException2 = exc;
                        str2 = str14;
                        iOException = iOException2;
                        g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                        eVar.close();
                        i16 = 5;
                        if (iOException == null) {
                        }
                        g.p(4, str9, str7 + q1Var.toString());
                        g.p(5, str9, str8 + q1Var.toString());
                        throw th5;
                    }
                } catch (Exception e18) {
                    str18 = "write response, total send ";
                    str17 = " bytes, rangeStart=";
                    j19 = i27;
                    pVar2 = pVar;
                    exc = e18;
                    str20 = str42;
                    j37 = j15;
                    str24 = str44;
                    eVar4 = a16;
                    str22 = str43;
                    str21 = str45;
                    q1Var = null;
                    i19 = 0;
                    str23 = "write response, dataSource close failed";
                    try {
                        StringBuilder sb6 = new StringBuilder();
                        str25 = str24;
                        try {
                            sb6.append("other exception ");
                            sb6.append(g.g(exc));
                            g.p(4, str9, sb6.toString());
                            if (pVar.t()) {
                            }
                            g.p(4, str9, str18 + i19 + str17 + j19 + str20 + j37);
                            try {
                                eVar4.close();
                            } catch (IOException unused4) {
                                g.p(5, str9, str23);
                            }
                            g.p(4, str9, str22 + q1Var.toString());
                            g.p(5, str9, str21 + q1Var.toString());
                            oVar = this;
                            eVar2 = eVar4;
                            j26 = j17;
                            z16 = z15;
                            str10 = n15;
                            j25 = -99999;
                            oVar.f290940g.d(pVar2);
                            if (!pVar.o()) {
                            }
                            String m152 = pVar.m();
                            int g152 = pVar.g();
                            int currentTimeMillis22 = (int) (System.currentTimeMillis() - currentTimeMillis);
                            c cVar2 = (c) ((HashMap) oVar.f290941h).get(str10);
                            if (!(exc instanceof l.f)) {
                            }
                            if (nr0.a.a().e() != null) {
                            }
                            g.p(4, str9, "write response finish");
                        } catch (Throwable th13) {
                            th6 = th13;
                            String str46 = str20;
                            long j65 = j37;
                            Throwable th14 = th6;
                            th5 = th14;
                            eVar = eVar4;
                            iOException = exc;
                            str2 = str23;
                            str7 = str22;
                            j18 = j65;
                            str4 = str46;
                            str3 = str17;
                            str6 = str25;
                            str5 = str18;
                            str8 = str21;
                            i15 = i19;
                            g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                            eVar.close();
                            i16 = 5;
                            if (iOException == null) {
                            }
                            g.p(4, str9, str7 + q1Var.toString());
                            g.p(5, str9, str8 + q1Var.toString());
                            throw th5;
                        }
                    } catch (Throwable th15) {
                        th6 = th15;
                        str25 = str24;
                        String str462 = str20;
                        long j652 = j37;
                        Throwable th142 = th6;
                        th5 = th142;
                        eVar = eVar4;
                        iOException = exc;
                        str2 = str23;
                        str7 = str22;
                        j18 = j652;
                        str4 = str462;
                        str3 = str17;
                        str6 = str25;
                        str5 = str18;
                        str8 = str21;
                        i15 = i19;
                        g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                        eVar.close();
                        i16 = 5;
                        if (iOException == null) {
                        }
                        g.p(4, str9, str7 + q1Var.toString());
                        g.p(5, str9, str8 + q1Var.toString());
                        throw th5;
                    }
                } catch (Throwable th16) {
                    String str47 = "write response, total send ";
                    String str48 = " bytes, rangeStart=";
                    j19 = i27;
                    String str49 = str42;
                    long j66 = j15;
                    String str50 = "write response, dataSource close failed";
                    String str51 = str43;
                    String str52 = str45;
                    Throwable th17 = th16;
                    String str53 = str44;
                    e eVar10 = a16;
                    str2 = str50;
                    str3 = str48;
                    th5 = th17;
                    str7 = str51;
                    str4 = str49;
                    eVar = eVar10;
                    j18 = j66;
                    q1Var = null;
                    iOException = null;
                    str6 = str53;
                    str5 = str47;
                    str8 = str52;
                    i15 = 0;
                    g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                    eVar.close();
                    i16 = 5;
                    if (iOException == null) {
                    }
                    g.p(4, str9, str7 + q1Var.toString());
                    g.p(5, str9, str8 + q1Var.toString());
                    throw th5;
                }
            } else {
                String str54 = str42;
                str9 = str41;
                str18 = "write response, total send ";
                str17 = " bytes, rangeStart=";
                j19 = i27;
                try {
                    j45 = d16.f290946a;
                    q1Var2 = d16.f290949d;
                } catch (IOException e19) {
                    e15 = e19;
                    pVar2 = pVar;
                    str26 = str54;
                    j38 = j15;
                    str19 = "write response, dataSource close failed";
                    eVar3 = a16;
                    bVar = bVar3;
                    str16 = str43;
                    str27 = str44;
                    bufferedOutputStream = bufferedOutputStream3;
                    str15 = str45;
                    IOException iOException5 = e15;
                    str44 = str27;
                    str42 = str26;
                    j36 = j38;
                    str14 = str19;
                    iOException2 = iOException5;
                    j35 = 0;
                    z17 = true;
                    j29 = -1;
                    q1Var = null;
                    i17 = 0;
                    str45 = str15;
                    if (iOException2 instanceof l.f) {
                    }
                    long j582 = -99999;
                    exc = iOException2;
                    long j592 = j582;
                    boolean z182 = z17;
                    if (pVar.t()) {
                    }
                    g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                    eVar3.close();
                    i18 = 5;
                    if (exc == null) {
                    }
                    g.p(4, str9, str43 + q1Var.toString());
                    g.p(5, str9, str45 + q1Var.toString());
                    j25 = j592;
                    z16 = z182;
                    eVar2 = eVar3;
                    j26 = j35;
                    oVar.f290940g.d(pVar2);
                    if (!pVar.o()) {
                    }
                    String m1522 = pVar.m();
                    int g1522 = pVar.g();
                    int currentTimeMillis222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                    c cVar22 = (c) ((HashMap) oVar.f290941h).get(str10);
                    if (!(exc instanceof l.f)) {
                    }
                    if (nr0.a.a().e() != null) {
                    }
                    g.p(4, str9, "write response finish");
                } catch (Exception e25) {
                    Exception e26 = e25;
                    pVar2 = pVar;
                    str20 = str54;
                    j37 = j15;
                    str23 = "write response, dataSource close failed";
                    eVar4 = a16;
                    str22 = str43;
                    str24 = str44;
                    str21 = str45;
                    Exception exc3 = e26;
                    exc = exc3;
                    i19 = 0;
                    q1Var = null;
                    StringBuilder sb62 = new StringBuilder();
                    str25 = str24;
                    sb62.append("other exception ");
                    sb62.append(g.g(exc));
                    g.p(4, str9, sb62.toString());
                    if (pVar.t()) {
                    }
                    g.p(4, str9, str18 + i19 + str17 + j19 + str20 + j37);
                    eVar4.close();
                    g.p(4, str9, str22 + q1Var.toString());
                    g.p(5, str9, str21 + q1Var.toString());
                    oVar = this;
                    eVar2 = eVar4;
                    j26 = j17;
                    z16 = z15;
                    str10 = n15;
                    j25 = -99999;
                    oVar.f290940g.d(pVar2);
                    if (!pVar.o()) {
                    }
                    String m15222 = pVar.m();
                    int g15222 = pVar.g();
                    int currentTimeMillis2222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                    c cVar222 = (c) ((HashMap) oVar.f290941h).get(str10);
                    if (!(exc instanceof l.f)) {
                    }
                    if (nr0.a.a().e() != null) {
                    }
                    g.p(4, str9, "write response finish");
                } catch (Throwable th18) {
                }
                try {
                    eVar2 = d16.f290948c;
                    if (eVar2 != null) {
                        j47 = j45;
                    } else {
                        eVar2 = a16;
                        try {
                            if (eVar2 instanceof or0.c) {
                                try {
                                    e h16 = ((or0.c) eVar2).h();
                                    if (h16 instanceof pr0.l) {
                                        String uri = ((pr0.l) h16).getUri();
                                        if (uri != null) {
                                            StringBuilder sb7 = new StringBuilder();
                                            j47 = j45;
                                            sb7.append("write response, firstTimeOpenFinish:");
                                            sb7.append(uri);
                                            g.p(4, str9, sb7.toString());
                                        } else {
                                            j47 = j45;
                                            g.p(4, str9, "write response, upstreamDataSource:" + h16);
                                        }
                                    } else {
                                        j47 = j45;
                                        g.p(6, str9, "write response, abnormal upstreamDataSource " + h16);
                                    }
                                } catch (IOException e27) {
                                    e = e27;
                                    IOException iOException6 = e;
                                    pVar2 = pVar;
                                    eVar3 = eVar2;
                                    iOException2 = iOException6;
                                    str42 = str54;
                                    str14 = "write response, dataSource close failed";
                                    q1Var = q1Var2;
                                    j35 = j47;
                                    j29 = -1;
                                    bVar = bVar3;
                                    bufferedOutputStream = bufferedOutputStream3;
                                    i17 = 0;
                                    j36 = j15;
                                    z17 = true;
                                    str16 = str43;
                                    str15 = str45;
                                    str45 = str15;
                                    if (iOException2 instanceof l.f) {
                                    }
                                    long j5822 = -99999;
                                    exc = iOException2;
                                    long j5922 = j5822;
                                    boolean z1822 = z17;
                                    if (pVar.t()) {
                                    }
                                    g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                                    eVar3.close();
                                    i18 = 5;
                                    if (exc == null) {
                                    }
                                    g.p(4, str9, str43 + q1Var.toString());
                                    g.p(5, str9, str45 + q1Var.toString());
                                    j25 = j5922;
                                    z16 = z1822;
                                    eVar2 = eVar3;
                                    j26 = j35;
                                    oVar.f290940g.d(pVar2);
                                    if (!pVar.o()) {
                                    }
                                    String m152222 = pVar.m();
                                    int g152222 = pVar.g();
                                    int currentTimeMillis22222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                                    c cVar2222 = (c) ((HashMap) oVar.f290941h).get(str10);
                                    if (!(exc instanceof l.f)) {
                                    }
                                    if (nr0.a.a().e() != null) {
                                    }
                                    g.p(4, str9, "write response finish");
                                } catch (Exception e28) {
                                } catch (Throwable th19) {
                                }
                            } else {
                                j47 = j45;
                                g.p(4, str9, "write response, dataSource:" + eVar2);
                            }
                        } catch (IOException e29) {
                            e = e29;
                            pVar2 = pVar;
                            j46 = j15;
                            str34 = "write response, dataSource close failed";
                            j47 = j45;
                            q1Var = q1Var2;
                            bVar = bVar3;
                            str16 = str43;
                            str15 = str45;
                            eVar3 = eVar2;
                            str33 = str54;
                            str35 = str44;
                            bufferedOutputStream = bufferedOutputStream3;
                            iOException3 = e;
                            j48 = -1;
                            str44 = str35;
                            str14 = str34;
                            str42 = str33;
                            iOException2 = iOException3;
                            j29 = j48;
                            j35 = j47;
                            j36 = j46;
                            i17 = 0;
                            z17 = true;
                            str45 = str15;
                            if (iOException2 instanceof l.f) {
                            }
                            long j58222 = -99999;
                            exc = iOException2;
                            long j59222 = j58222;
                            boolean z18222 = z17;
                            if (pVar.t()) {
                            }
                            g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                            eVar3.close();
                            i18 = 5;
                            if (exc == null) {
                            }
                            g.p(4, str9, str43 + q1Var.toString());
                            g.p(5, str9, str45 + q1Var.toString());
                            j25 = j59222;
                            z16 = z18222;
                            eVar2 = eVar3;
                            j26 = j35;
                            oVar.f290940g.d(pVar2);
                            if (!pVar.o()) {
                            }
                            String m1522222 = pVar.m();
                            int g1522222 = pVar.g();
                            int currentTimeMillis222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                            c cVar22222 = (c) ((HashMap) oVar.f290941h).get(str10);
                            if (!(exc instanceof l.f)) {
                            }
                            if (nr0.a.a().e() != null) {
                            }
                            g.p(4, str9, "write response finish");
                        } catch (Exception e35) {
                            e = e35;
                            pVar2 = pVar;
                            j37 = j15;
                            str23 = "write response, dataSource close failed";
                            j47 = j45;
                            q1Var = q1Var2;
                            str22 = str43;
                            str21 = str45;
                            eVar4 = eVar2;
                            str20 = str54;
                            str24 = str44;
                            exc2 = e;
                            exc = exc2;
                            j17 = j47;
                            i19 = 0;
                            StringBuilder sb622 = new StringBuilder();
                            str25 = str24;
                            sb622.append("other exception ");
                            sb622.append(g.g(exc));
                            g.p(4, str9, sb622.toString());
                            if (pVar.t()) {
                            }
                            g.p(4, str9, str18 + i19 + str17 + j19 + str20 + j37);
                            eVar4.close();
                            g.p(4, str9, str22 + q1Var.toString());
                            g.p(5, str9, str21 + q1Var.toString());
                            oVar = this;
                            eVar2 = eVar4;
                            j26 = j17;
                            z16 = z15;
                            str10 = n15;
                            j25 = -99999;
                            oVar.f290940g.d(pVar2);
                            if (!pVar.o()) {
                            }
                            String m15222222 = pVar.m();
                            int g15222222 = pVar.g();
                            int currentTimeMillis2222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                            c cVar222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                            if (!(exc instanceof l.f)) {
                            }
                            if (nr0.a.a().e() != null) {
                            }
                            g.p(4, str9, "write response finish");
                        } catch (Throwable th20) {
                        }
                    }
                    try {
                        a15 = eVar2.a();
                        try {
                            b fileType = eVar2.getFileType();
                            pVar2 = pVar;
                            pVar2.v(a15, fileType);
                            q1Var = q1Var2;
                            try {
                                if (fileType.equals(bVar3)) {
                                    str14 = "write response, dataSource close failed";
                                    try {
                                        g.p(6, str9, "write response, file type should not be unknown");
                                    } catch (IOException e36) {
                                        e = e36;
                                        eVar8 = eVar2;
                                        bVar2 = fileType;
                                        j48 = a15;
                                        str34 = str14;
                                        str35 = str44;
                                        str33 = str54;
                                        j55 = j15;
                                        str16 = str43;
                                        bufferedOutputStream = bufferedOutputStream3;
                                        str15 = str45;
                                        iOException3 = e;
                                        j46 = j55;
                                        bVar = bVar2;
                                        eVar3 = eVar8;
                                        str44 = str35;
                                        str14 = str34;
                                        str42 = str33;
                                        iOException2 = iOException3;
                                        j29 = j48;
                                        j35 = j47;
                                        j36 = j46;
                                        i17 = 0;
                                        z17 = true;
                                        str45 = str15;
                                        if (iOException2 instanceof l.f) {
                                        }
                                        long j582222 = -99999;
                                        exc = iOException2;
                                        long j592222 = j582222;
                                        boolean z182222 = z17;
                                        if (pVar.t()) {
                                        }
                                        g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                                        eVar3.close();
                                        i18 = 5;
                                        if (exc == null) {
                                        }
                                        g.p(4, str9, str43 + q1Var.toString());
                                        g.p(5, str9, str45 + q1Var.toString());
                                        j25 = j592222;
                                        z16 = z182222;
                                        eVar2 = eVar3;
                                        j26 = j35;
                                        oVar.f290940g.d(pVar2);
                                        if (!pVar.o()) {
                                        }
                                        String m152222222 = pVar.m();
                                        int g152222222 = pVar.g();
                                        int currentTimeMillis22222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                                        c cVar2222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                                        if (!(exc instanceof l.f)) {
                                        }
                                        if (nr0.a.a().e() != null) {
                                        }
                                        g.p(4, str9, "write response finish");
                                    } catch (Exception e37) {
                                    } catch (Throwable th21) {
                                    }
                                } else {
                                    str14 = "write response, dataSource close failed";
                                }
                                d15 = sr0.e.d(j19, j15, a15, fileType.toString(), !g.m(str));
                                sb5 = new StringBuilder();
                                bVar2 = fileType;
                                sb5.append("write response, dataSource open costTimeMs:");
                                j28 = j15;
                            } catch (IOException e38) {
                                e = e38;
                                eVar8 = eVar2;
                                bVar2 = fileType;
                                str34 = "write response, dataSource close failed";
                                j48 = a15;
                                str35 = str44;
                                str33 = str54;
                                j55 = j15;
                                str16 = str43;
                                bufferedOutputStream = bufferedOutputStream3;
                                str15 = str45;
                                iOException3 = e;
                                j46 = j55;
                                bVar = bVar2;
                                eVar3 = eVar8;
                                str44 = str35;
                                str14 = str34;
                                str42 = str33;
                                iOException2 = iOException3;
                                j29 = j48;
                                j35 = j47;
                                j36 = j46;
                                i17 = 0;
                                z17 = true;
                                str45 = str15;
                                if (iOException2 instanceof l.f) {
                                }
                                long j5822222 = -99999;
                                exc = iOException2;
                                long j5922222 = j5822222;
                                boolean z1822222 = z17;
                                if (pVar.t()) {
                                }
                                g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                                eVar3.close();
                                i18 = 5;
                                if (exc == null) {
                                }
                                g.p(4, str9, str43 + q1Var.toString());
                                g.p(5, str9, str45 + q1Var.toString());
                                j25 = j5922222;
                                z16 = z1822222;
                                eVar2 = eVar3;
                                j26 = j35;
                                oVar.f290940g.d(pVar2);
                                if (!pVar.o()) {
                                }
                                String m1522222222 = pVar.m();
                                int g1522222222 = pVar.g();
                                int currentTimeMillis222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                                c cVar22222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                                if (!(exc instanceof l.f)) {
                                }
                                if (nr0.a.a().e() != null) {
                                }
                                g.p(4, str9, "write response finish");
                            } catch (Exception e39) {
                                e = e39;
                                eVar7 = eVar2;
                                str20 = str54;
                                j49 = j15;
                                str23 = "write response, dataSource close failed";
                                str22 = str43;
                                str24 = str44;
                                str21 = str45;
                                exc2 = e;
                                j37 = j49;
                                eVar4 = eVar7;
                                exc = exc2;
                                j17 = j47;
                                i19 = 0;
                                StringBuilder sb6222 = new StringBuilder();
                                str25 = str24;
                                sb6222.append("other exception ");
                                sb6222.append(g.g(exc));
                                g.p(4, str9, sb6222.toString());
                                if (pVar.t()) {
                                }
                                g.p(4, str9, str18 + i19 + str17 + j19 + str20 + j37);
                                eVar4.close();
                                g.p(4, str9, str22 + q1Var.toString());
                                g.p(5, str9, str21 + q1Var.toString());
                                oVar = this;
                                eVar2 = eVar4;
                                j26 = j17;
                                z16 = z15;
                                str10 = n15;
                                j25 = -99999;
                                oVar.f290940g.d(pVar2);
                                if (!pVar.o()) {
                                }
                                String m15222222222 = pVar.m();
                                int g15222222222 = pVar.g();
                                int currentTimeMillis2222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                                c cVar222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                                if (!(exc instanceof l.f)) {
                                }
                                if (nr0.a.a().e() != null) {
                                }
                                g.p(4, str9, "write response finish");
                            } catch (Throwable th22) {
                                Throwable th23 = th22;
                                eVar6 = eVar2;
                                str28 = str54;
                                long j67 = j15;
                                str31 = "write response, dataSource close failed";
                                str30 = str43;
                                str32 = str44;
                                str29 = str45;
                                th8 = th23;
                                j39 = j67;
                                th7 = th8;
                                e eVar11 = eVar6;
                                eVar5 = eVar11;
                                q1 q1Var3 = q1Var;
                                Throwable th24 = th7;
                                str3 = str17;
                                th5 = th24;
                                eVar = eVar5;
                                q1Var = q1Var3;
                                iOException = null;
                                str6 = str32;
                                str5 = str18;
                                str2 = str31;
                                str7 = str30;
                                str8 = str29;
                                str4 = str28;
                                j18 = j39;
                                i15 = 0;
                                g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                                eVar.close();
                                i16 = 5;
                                if (iOException == null) {
                                }
                                g.p(4, str9, str7 + q1Var.toString());
                                g.p(5, str9, str8 + q1Var.toString());
                                throw th5;
                            }
                        } catch (IOException e45) {
                            pVar2 = pVar;
                            j46 = j15;
                            str34 = "write response, dataSource close failed";
                            j48 = a15;
                            q1Var = q1Var2;
                            bVar = bVar3;
                            str16 = str43;
                            str35 = str44;
                            str15 = str45;
                            str33 = str54;
                            bufferedOutputStream = bufferedOutputStream3;
                            eVar3 = eVar2;
                            iOException3 = e45;
                            str44 = str35;
                            str14 = str34;
                            str42 = str33;
                            iOException2 = iOException3;
                            j29 = j48;
                            j35 = j47;
                            j36 = j46;
                            i17 = 0;
                            z17 = true;
                            str45 = str15;
                            if (iOException2 instanceof l.f) {
                            }
                            long j58222222 = -99999;
                            exc = iOException2;
                            long j59222222 = j58222222;
                            boolean z18222222 = z17;
                            if (pVar.t()) {
                            }
                            g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                            eVar3.close();
                            i18 = 5;
                            if (exc == null) {
                            }
                            g.p(4, str9, str43 + q1Var.toString());
                            g.p(5, str9, str45 + q1Var.toString());
                            j25 = j59222222;
                            z16 = z18222222;
                            eVar2 = eVar3;
                            j26 = j35;
                            oVar.f290940g.d(pVar2);
                            if (!pVar.o()) {
                            }
                            String m152222222222 = pVar.m();
                            int g152222222222 = pVar.g();
                            int currentTimeMillis22222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                            c cVar2222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                            if (!(exc instanceof l.f)) {
                            }
                            if (nr0.a.a().e() != null) {
                            }
                            g.p(4, str9, "write response finish");
                        } catch (Exception e46) {
                            e = e46;
                            pVar2 = pVar;
                            eVar7 = eVar2;
                            str20 = str54;
                            str23 = "write response, dataSource close failed";
                            q1Var = q1Var2;
                            str24 = str44;
                            j49 = j15;
                            str22 = str43;
                            str21 = str45;
                            exc2 = e;
                            j37 = j49;
                            eVar4 = eVar7;
                            exc = exc2;
                            j17 = j47;
                            i19 = 0;
                            StringBuilder sb62222 = new StringBuilder();
                            str25 = str24;
                            sb62222.append("other exception ");
                            sb62222.append(g.g(exc));
                            g.p(4, str9, sb62222.toString());
                            if (pVar.t()) {
                            }
                            g.p(4, str9, str18 + i19 + str17 + j19 + str20 + j37);
                            eVar4.close();
                            g.p(4, str9, str22 + q1Var.toString());
                            g.p(5, str9, str21 + q1Var.toString());
                            oVar = this;
                            eVar2 = eVar4;
                            j26 = j17;
                            z16 = z15;
                            str10 = n15;
                            j25 = -99999;
                            oVar.f290940g.d(pVar2);
                            if (!pVar.o()) {
                            }
                            String m1522222222222 = pVar.m();
                            int g1522222222222 = pVar.g();
                            int currentTimeMillis222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                            c cVar22222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                            if (!(exc instanceof l.f)) {
                            }
                            if (nr0.a.a().e() != null) {
                            }
                            g.p(4, str9, "write response finish");
                        } catch (Throwable th25) {
                        }
                    } catch (IOException e47) {
                        e = e47;
                        pVar2 = pVar;
                        str33 = str54;
                        j46 = j15;
                        str34 = "write response, dataSource close failed";
                        q1Var = q1Var2;
                        bVar = bVar3;
                        str16 = str43;
                        str35 = str44;
                        bufferedOutputStream = bufferedOutputStream3;
                        str15 = str45;
                        eVar3 = eVar2;
                        iOException3 = e;
                        j48 = -1;
                        str44 = str35;
                        str14 = str34;
                        str42 = str33;
                        iOException2 = iOException3;
                        j29 = j48;
                        j35 = j47;
                        j36 = j46;
                        i17 = 0;
                        z17 = true;
                        str45 = str15;
                        if (iOException2 instanceof l.f) {
                        }
                        long j582222222 = -99999;
                        exc = iOException2;
                        long j592222222 = j582222222;
                        boolean z182222222 = z17;
                        if (pVar.t()) {
                        }
                        g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                        eVar3.close();
                        i18 = 5;
                        if (exc == null) {
                        }
                        g.p(4, str9, str43 + q1Var.toString());
                        g.p(5, str9, str45 + q1Var.toString());
                        j25 = j592222222;
                        z16 = z182222222;
                        eVar2 = eVar3;
                        j26 = j35;
                        oVar.f290940g.d(pVar2);
                        if (!pVar.o()) {
                        }
                        String m15222222222222 = pVar.m();
                        int g15222222222222 = pVar.g();
                        int currentTimeMillis2222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                        c cVar222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                        if (!(exc instanceof l.f)) {
                        }
                        if (nr0.a.a().e() != null) {
                        }
                        g.p(4, str9, "write response finish");
                    } catch (Exception e48) {
                        e = e48;
                        pVar2 = pVar;
                        str20 = str54;
                        j37 = j15;
                        str23 = "write response, dataSource close failed";
                        q1Var = q1Var2;
                        str22 = str43;
                        str24 = str44;
                        str21 = str45;
                        eVar4 = eVar2;
                        exc2 = e;
                        exc = exc2;
                        j17 = j47;
                        i19 = 0;
                        StringBuilder sb622222 = new StringBuilder();
                        str25 = str24;
                        sb622222.append("other exception ");
                        sb622222.append(g.g(exc));
                        g.p(4, str9, sb622222.toString());
                        if (pVar.t()) {
                        }
                        g.p(4, str9, str18 + i19 + str17 + j19 + str20 + j37);
                        eVar4.close();
                        g.p(4, str9, str22 + q1Var.toString());
                        g.p(5, str9, str21 + q1Var.toString());
                        oVar = this;
                        eVar2 = eVar4;
                        j26 = j17;
                        z16 = z15;
                        str10 = n15;
                        j25 = -99999;
                        oVar.f290940g.d(pVar2);
                        if (!pVar.o()) {
                        }
                        String m152222222222222 = pVar.m();
                        int g152222222222222 = pVar.g();
                        int currentTimeMillis22222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                        c cVar2222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                        if (!(exc instanceof l.f)) {
                        }
                        if (nr0.a.a().e() != null) {
                        }
                        g.p(4, str9, "write response finish");
                    } catch (Throwable th26) {
                        eVar6 = eVar2;
                        str28 = str54;
                        j39 = j15;
                        str31 = "write response, dataSource close failed";
                        q1Var = q1Var2;
                        str30 = str43;
                        str32 = str44;
                        str29 = str45;
                        th8 = th26;
                        th7 = th8;
                        e eVar112 = eVar6;
                        eVar5 = eVar112;
                        q1 q1Var32 = q1Var;
                        Throwable th242 = th7;
                        str3 = str17;
                        th5 = th242;
                        eVar = eVar5;
                        q1Var = q1Var32;
                        iOException = null;
                        str6 = str32;
                        str5 = str18;
                        str2 = str31;
                        str7 = str30;
                        str8 = str29;
                        str4 = str28;
                        j18 = j39;
                        i15 = 0;
                        g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                        eVar.close();
                        i16 = 5;
                        if (iOException == null) {
                        }
                        g.p(4, str9, str7 + q1Var.toString());
                        g.p(5, str9, str8 + q1Var.toString());
                        throw th5;
                    }
                    try {
                        sb5.append(System.currentTimeMillis() - currentTimeMillis);
                        g.p(4, str9, sb5.toString());
                        g.p(4, str9, "write response, totalLength=" + a15 + ", send response headers: " + g.w(d15, null));
                        bufferedOutputStream2 = bufferedOutputStream3;
                        bufferedOutputStream2.write(d15.getBytes("UTF-8"));
                        bufferedOutputStream2.flush();
                        long currentTimeMillis3 = System.currentTimeMillis();
                        z16 = true;
                        int i29 = 0;
                        while (true) {
                            try {
                                z16 = !Thread.interrupted();
                                if (!z16) {
                                    break;
                                }
                                try {
                                    if (pVar.t()) {
                                        break;
                                    }
                                    j56 = a15;
                                    int c16 = eVar2.c(bArr2, 0, 65536);
                                    if (c16 == -1) {
                                        break;
                                    } else if (pVar.p()) {
                                        break;
                                    } else {
                                        long currentTimeMillis4 = System.currentTimeMillis() - currentTimeMillis3;
                                        if (currentTimeMillis4 > 1000) {
                                            StringBuilder sb8 = new StringBuilder();
                                            str42 = str54;
                                            try {
                                                sb8.append("write response, not receive data over ");
                                                sb8.append(currentTimeMillis4);
                                                sb8.append(LocaleUtil.MALAY);
                                                g.p(5, str9, sb8.toString());
                                            } catch (IOException e49) {
                                                iOException4 = e49;
                                            } catch (Exception e55) {
                                            } catch (Throwable th27) {
                                            }
                                        } else {
                                            str42 = str54;
                                        }
                                        currentTimeMillis3 = System.currentTimeMillis();
                                        if (i29 == 0 && j19 == 0) {
                                            if (eVar2 instanceof or0.c) {
                                                eVar9 = ((or0.c) eVar2).h();
                                            } else {
                                                eVar9 = eVar2 instanceof pr0.l ? eVar2 : null;
                                            }
                                            if (eVar9 instanceof pr0.l) {
                                                sr0.h<String> e56 = ((pr0.l) eVar9).e();
                                                if (e56 != null) {
                                                    try {
                                                        if (!((sr0.f) e56).a(bArr2)) {
                                                            throw new l.d("invalid content", gVar3);
                                                        }
                                                    } catch (IOException e57) {
                                                        IOException e58 = e57;
                                                        iOException4 = e58;
                                                        bufferedOutputStream = bufferedOutputStream2;
                                                        bVar = bVar2;
                                                        eVar3 = eVar2;
                                                        i17 = i29;
                                                        iOException2 = iOException4;
                                                        j29 = j56;
                                                        j35 = j47;
                                                        str16 = str43;
                                                        str15 = str45;
                                                        z17 = z16;
                                                        j36 = j28;
                                                        str45 = str15;
                                                        if (iOException2 instanceof l.f) {
                                                        }
                                                        long j5822222222 = -99999;
                                                        exc = iOException2;
                                                        long j5922222222 = j5822222222;
                                                        boolean z1822222222 = z17;
                                                        if (pVar.t()) {
                                                        }
                                                        g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                                                        eVar3.close();
                                                        i18 = 5;
                                                        if (exc == null) {
                                                        }
                                                        g.p(4, str9, str43 + q1Var.toString());
                                                        g.p(5, str9, str45 + q1Var.toString());
                                                        j25 = j5922222222;
                                                        z16 = z1822222222;
                                                        eVar2 = eVar3;
                                                        j26 = j35;
                                                        oVar.f290940g.d(pVar2);
                                                        if (!pVar.o()) {
                                                        }
                                                        String m1522222222222222 = pVar.m();
                                                        int g1522222222222222 = pVar.g();
                                                        int currentTimeMillis222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                                                        c cVar22222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                                                        if (!(exc instanceof l.f)) {
                                                        }
                                                        if (nr0.a.a().e() != null) {
                                                        }
                                                        g.p(4, str9, "write response finish");
                                                    } catch (Exception e59) {
                                                        eVar4 = eVar2;
                                                        exc = e59;
                                                        z15 = z16;
                                                        j17 = j47;
                                                        str20 = str42;
                                                        str22 = str43;
                                                        str24 = str44;
                                                        j37 = j28;
                                                        str21 = str45;
                                                        i19 = i29;
                                                        str23 = str14;
                                                        StringBuilder sb6222222 = new StringBuilder();
                                                        str25 = str24;
                                                        sb6222222.append("other exception ");
                                                        sb6222222.append(g.g(exc));
                                                        g.p(4, str9, sb6222222.toString());
                                                        if (pVar.t()) {
                                                        }
                                                        g.p(4, str9, str18 + i19 + str17 + j19 + str20 + j37);
                                                        eVar4.close();
                                                        g.p(4, str9, str22 + q1Var.toString());
                                                        g.p(5, str9, str21 + q1Var.toString());
                                                        oVar = this;
                                                        eVar2 = eVar4;
                                                        j26 = j17;
                                                        z16 = z15;
                                                        str10 = n15;
                                                        j25 = -99999;
                                                        oVar.f290940g.d(pVar2);
                                                        if (!pVar.o()) {
                                                        }
                                                        String m15222222222222222 = pVar.m();
                                                        int g15222222222222222 = pVar.g();
                                                        int currentTimeMillis2222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                                                        c cVar222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                                                        if (!(exc instanceof l.f)) {
                                                        }
                                                        if (nr0.a.a().e() != null) {
                                                        }
                                                        g.p(4, str9, "write response finish");
                                                    } catch (Throwable th28) {
                                                        th = th28;
                                                        th9 = th;
                                                        str40 = str14;
                                                        str36 = str42;
                                                        str38 = str43;
                                                        str39 = str44;
                                                        j57 = j28;
                                                        str37 = str45;
                                                        str13 = str18;
                                                        str12 = str17;
                                                        str14 = str40;
                                                        str44 = str39;
                                                        str43 = str38;
                                                        str45 = str37;
                                                        str42 = str36;
                                                        j28 = j57;
                                                        Throwable th29 = th9;
                                                        IOException iOException7 = null;
                                                        e eVar12 = eVar2;
                                                        int i35 = i29;
                                                        eVar = eVar12;
                                                        th5 = th29;
                                                        i15 = i35;
                                                        iOException = iOException7;
                                                        str2 = str14;
                                                        str4 = str42;
                                                        str5 = str13;
                                                        str3 = str12;
                                                        str7 = str43;
                                                        str6 = str44;
                                                        j18 = j28;
                                                        str8 = str45;
                                                        g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                                                        eVar.close();
                                                        i16 = 5;
                                                        if (iOException == null) {
                                                        }
                                                        g.p(4, str9, str7 + q1Var.toString());
                                                        g.p(5, str9, str8 + q1Var.toString());
                                                        throw th5;
                                                    }
                                                } else {
                                                    gVar = gVar3;
                                                    g.p(6, str9, "write response, predicator is null");
                                                    bufferedOutputStream = bufferedOutputStream2;
                                                    bufferedOutputStream.write(bArr2, 0, c16);
                                                    i29 += c16;
                                                    pVar2.w(c16);
                                                    pVar2.r(i29);
                                                    gVar3 = gVar;
                                                    bArr2 = bArr2;
                                                    a15 = j56;
                                                    bufferedOutputStream2 = bufferedOutputStream;
                                                    str54 = str42;
                                                }
                                            }
                                        }
                                        gVar = gVar3;
                                        bufferedOutputStream = bufferedOutputStream2;
                                        bufferedOutputStream.write(bArr2, 0, c16);
                                        i29 += c16;
                                        pVar2.w(c16);
                                        pVar2.r(i29);
                                        gVar3 = gVar;
                                        bArr2 = bArr2;
                                        a15 = j56;
                                        bufferedOutputStream2 = bufferedOutputStream;
                                        str54 = str42;
                                    }
                                } catch (IOException e65) {
                                    IOException e66 = e65;
                                    str42 = str54;
                                    bufferedOutputStream = bufferedOutputStream2;
                                    int i36 = i29;
                                    boolean z19 = z16;
                                    IOException iOException8 = e66;
                                    bVar = bVar2;
                                    eVar3 = eVar2;
                                    iOException2 = iOException8;
                                    i17 = i36;
                                    j29 = j56;
                                    j35 = j47;
                                    str16 = str43;
                                    j36 = j28;
                                    str15 = str45;
                                    z17 = z19;
                                    str45 = str15;
                                    if (iOException2 instanceof l.f) {
                                    }
                                    long j58222222222 = -99999;
                                    exc = iOException2;
                                    long j59222222222 = j58222222222;
                                    boolean z18222222222 = z17;
                                    if (pVar.t()) {
                                    }
                                    g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                                    eVar3.close();
                                    i18 = 5;
                                    if (exc == null) {
                                    }
                                    g.p(4, str9, str43 + q1Var.toString());
                                    g.p(5, str9, str45 + q1Var.toString());
                                    j25 = j59222222222;
                                    z16 = z18222222222;
                                    eVar2 = eVar3;
                                    j26 = j35;
                                    oVar.f290940g.d(pVar2);
                                    if (!pVar.o()) {
                                    }
                                    String m152222222222222222 = pVar.m();
                                    int g152222222222222222 = pVar.g();
                                    int currentTimeMillis22222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                                    c cVar2222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                                    if (!(exc instanceof l.f)) {
                                    }
                                    if (nr0.a.a().e() != null) {
                                    }
                                    g.p(4, str9, "write response finish");
                                } catch (Exception e67) {
                                } catch (Throwable th30) {
                                }
                                if (z16) {
                                    c15 = 256;
                                    pVar2.s(256);
                                    g.p(4, str9, "write response, videoRequest is interrupted");
                                } else {
                                    c15 = 256;
                                }
                                if (pVar.t()) {
                                    pVar.b();
                                }
                                bufferedOutputStream.flush();
                                bufferedOutputStream.close();
                                g.p(4, str9, str18 + i29 + str17 + j19 + str42 + j28);
                                try {
                                    eVar2.close();
                                    i25 = 5;
                                } catch (IOException unused5) {
                                    i25 = 5;
                                    g.p(5, str9, str14);
                                }
                                socket.close();
                                if (q1Var != null && q1Var.v() && q1Var.m()) {
                                    g.p(4, str9, str43 + q1Var.toString());
                                    if (q1Var.o().startsWith(nr0.a.a().d()) && !q1Var.l()) {
                                        g.p(5, str9, str45 + q1Var.toString());
                                    }
                                }
                                j25 = -99999;
                                exc = null;
                                oVar = this;
                                j26 = j47;
                                str10 = n15;
                            } catch (IOException e68) {
                                e = e68;
                                e eVar13 = eVar2;
                                int i37 = i29;
                                boolean z25 = z16;
                                j56 = a15;
                                String str55 = str14;
                                str16 = str43;
                                String str56 = str44;
                                long j68 = j28;
                                String str57 = str54;
                                bufferedOutputStream = bufferedOutputStream2;
                                str15 = str45;
                                str44 = str56;
                                str14 = str55;
                                str42 = str57;
                                j36 = j68;
                                i17 = i37;
                                j29 = j56;
                                iOException2 = e;
                                j35 = j47;
                                bVar = bVar2;
                                eVar3 = eVar13;
                                z17 = z25;
                                str45 = str15;
                                if (iOException2 instanceof l.f) {
                                }
                                long j582222222222 = -99999;
                                exc = iOException2;
                                long j592222222222 = j582222222222;
                                boolean z182222222222 = z17;
                                if (pVar.t()) {
                                }
                                g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                                eVar3.close();
                                i18 = 5;
                                if (exc == null) {
                                }
                                g.p(4, str9, str43 + q1Var.toString());
                                g.p(5, str9, str45 + q1Var.toString());
                                j25 = j592222222222;
                                z16 = z182222222222;
                                eVar2 = eVar3;
                                j26 = j35;
                                oVar.f290940g.d(pVar2);
                                if (!pVar.o()) {
                                }
                                String m1522222222222222222 = pVar.m();
                                int g1522222222222222222 = pVar.g();
                                int currentTimeMillis222222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                                c cVar22222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                                if (!(exc instanceof l.f)) {
                                }
                                if (nr0.a.a().e() != null) {
                                }
                                g.p(4, str9, "write response finish");
                            } catch (Exception e69) {
                                Exception e75 = e69;
                                e eVar14 = eVar2;
                                int i38 = i29;
                                str20 = str54;
                                boolean z26 = z16;
                                str23 = str14;
                                str22 = str43;
                                str24 = str44;
                                long j69 = j28;
                                str21 = str45;
                                z15 = z26;
                                j37 = j69;
                                j17 = j47;
                                eVar4 = eVar14;
                                exc = e75;
                                i19 = i38;
                                StringBuilder sb62222222 = new StringBuilder();
                                str25 = str24;
                                sb62222222.append("other exception ");
                                sb62222222.append(g.g(exc));
                                g.p(4, str9, sb62222222.toString());
                                if (pVar.t()) {
                                }
                                g.p(4, str9, str18 + i19 + str17 + j19 + str20 + j37);
                                eVar4.close();
                                g.p(4, str9, str22 + q1Var.toString());
                                g.p(5, str9, str21 + q1Var.toString());
                                oVar = this;
                                eVar2 = eVar4;
                                j26 = j17;
                                z16 = z15;
                                str10 = n15;
                                j25 = -99999;
                                oVar.f290940g.d(pVar2);
                                if (!pVar.o()) {
                                }
                                String m15222222222222222222 = pVar.m();
                                int g15222222222222222222 = pVar.g();
                                int currentTimeMillis2222222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                                c cVar222222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                                if (!(exc instanceof l.f)) {
                                }
                                if (nr0.a.a().e() != null) {
                                }
                                g.p(4, str9, "write response finish");
                            } catch (Throwable th31) {
                                e eVar15 = eVar2;
                                String str58 = str54;
                                String str59 = str14;
                                String str60 = str43;
                                String str61 = str44;
                                long j75 = j28;
                                String str62 = str45;
                                Throwable th32 = th31;
                                int i39 = i29;
                                eVar = eVar15;
                                str3 = str17;
                                th5 = th32;
                                iOException = null;
                                str6 = str61;
                                str5 = str18;
                                str8 = str62;
                                i15 = i39;
                                str2 = str59;
                                str7 = str60;
                                str4 = str58;
                                j18 = j75;
                                g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                                eVar.close();
                                i16 = 5;
                                if (iOException == null) {
                                }
                                g.p(4, str9, str7 + q1Var.toString());
                                g.p(5, str9, str8 + q1Var.toString());
                                throw th5;
                            }
                            oVar.f290940g.d(pVar2);
                            if (!pVar.o()) {
                                pVar.c();
                            } else if (z16) {
                                pVar2.s(16);
                            }
                            String m152222222222222222222 = pVar.m();
                            int g152222222222222222222 = pVar.g();
                            int currentTimeMillis22222222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                            c cVar2222222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                            if (!(exc instanceof l.f)) {
                                str11 = "HttpDataSource.InvalidResponseCodeException";
                                l.f fVar = (l.f) exc;
                                if (cVar2222222222222222222 != null) {
                                    cVar2222222222222222222.a(m152222222222222222222, str, fVar.f285120d, g152222222222222222222, str11, fVar.f285121e, currentTimeMillis22222222222222222222, j26, j25);
                                }
                            } else if (exc instanceof l.e) {
                                str11 = "HttpDataSource.InvalidContentTypeException";
                                l.e eVar16 = (l.e) exc;
                                if (cVar2222222222222222222 != null) {
                                    cVar2222222222222222222.a(m152222222222222222222, str, 3, g152222222222222222222, str11, eVar16.f285119d, currentTimeMillis22222222222222222222, j26, j25);
                                }
                            } else if (exc instanceof l.d) {
                                str11 = "HttpDataSource.InvalidContentException";
                                if (cVar2222222222222222222 != null) {
                                    cVar2222222222222222222.a(m152222222222222222222, str, 10, g152222222222222222222, str11, new HashMap(), currentTimeMillis22222222222222222222, j26, j25);
                                }
                            } else if (exc instanceof l.g) {
                                str11 = "HttpDataSource.MalformedResponseException";
                                if (cVar2222222222222222222 != null) {
                                    cVar2222222222222222222.a(m152222222222222222222, str, 12, g152222222222222222222, str11, new HashMap(), currentTimeMillis22222222222222222222, j26, j25);
                                }
                            } else if (exc instanceof l.b) {
                                str11 = "HttpDataSource.InterruptConnectServerException";
                                if (cVar2222222222222222222 != null) {
                                    cVar2222222222222222222.a(m152222222222222222222, str, g.n() ? 5 : 9, g152222222222222222222, str11, new HashMap(), currentTimeMillis22222222222222222222, j26, j25);
                                }
                            } else if (exc instanceof l.c) {
                                str11 = "HttpDataSource.InterruptReadException";
                                if (cVar2222222222222222222 != null) {
                                    cVar2222222222222222222.a(m152222222222222222222, str, g.n() ? 5 : 9, g152222222222222222222, str11, new HashMap(), currentTimeMillis22222222222222222222, j26, j25);
                                }
                            } else if (exc instanceof l.h) {
                                str11 = "HttpDataSource.UnableConnectServerException";
                                if (cVar2222222222222222222 != null) {
                                    cVar2222222222222222222.a(m152222222222222222222, str, g.n() ? 5 : 9, g152222222222222222222, str11, new HashMap(), currentTimeMillis22222222222222222222, j26, j25);
                                }
                            } else if (exc instanceof l.a) {
                                str11 = "HttpDataSource.HttpDataSourceException";
                                if (cVar2222222222222222222 != null) {
                                    cVar2222222222222222222.a(m152222222222222222222, str, oVar.b(exc), g152222222222222222222, str11, new HashMap(), currentTimeMillis22222222222222222222, j26, j25);
                                }
                            } else if ((eVar2 instanceof pr0.k) && (exc instanceof k.a)) {
                                str11 = "FileDataSource.FileDataSourceException";
                                if (cVar2222222222222222222 != null) {
                                    cVar2222222222222222222.a(m152222222222222222222, str, 1404, g152222222222222222222, str11, null, currentTimeMillis22222222222222222222, j26, j25);
                                }
                            } else if (exc instanceof NoRouteToHostException) {
                                str11 = "NoRouteToHostException";
                                if (cVar2222222222222222222 != null) {
                                    cVar2222222222222222222.a(m152222222222222222222, str, 1, g152222222222222222222, str11, new HashMap(), currentTimeMillis22222222222222222222, j26, j25);
                                }
                            } else {
                                str11 = "";
                            }
                            if (nr0.a.a().e() != null) {
                                long e76 = g.e(j26, j25);
                                rr0.a e77 = nr0.a.a().e();
                                int g16 = pVar.g();
                                long i45 = pVar.i();
                                long h17 = pVar.h();
                                synchronized (pVar) {
                                    j27 = pVar2.f290967k;
                                }
                                ((jz0.c) e77).a(m152222222222222222222, str, g16, i45, h17, j27, pVar.d(), pVar.j(), (long) (((float) (((long) pVar2.f290976t) * 1000)) / ((float) ((System.currentTimeMillis() - pVar2.f290977u) * 1024))), j26, j25, e76, str11, currentTimeMillis22222222222222222222);
                            }
                            g.p(4, str9, "write response finish");
                        }
                        str42 = str54;
                        bufferedOutputStream = bufferedOutputStream2;
                        if (z16) {
                        }
                        try {
                            if (pVar.t()) {
                            }
                            bufferedOutputStream.flush();
                            bufferedOutputStream.close();
                            g.p(4, str9, str18 + i29 + str17 + j19 + str42 + j28);
                            eVar2.close();
                            i25 = 5;
                            try {
                                socket.close();
                            } catch (IOException e78) {
                                g.q(i25, str9, str44, e78);
                            }
                            g.p(4, str9, str43 + q1Var.toString());
                            g.p(5, str9, str45 + q1Var.toString());
                            j25 = -99999;
                            exc = null;
                            oVar = this;
                            j26 = j47;
                            str10 = n15;
                        } catch (IOException e79) {
                        } catch (Exception e85) {
                            String str63 = str14;
                            str20 = str42;
                            String str64 = str44;
                            long j76 = j28;
                            str21 = str45;
                            int i46 = i29;
                            z15 = z16;
                            Exception exc4 = e85;
                            j37 = j76;
                            j17 = j47;
                            eVar4 = eVar2;
                            exc = exc4;
                            str23 = str63;
                            str24 = str64;
                            i19 = i46;
                            str22 = str43;
                            StringBuilder sb622222222 = new StringBuilder();
                            str25 = str24;
                            sb622222222.append("other exception ");
                            sb622222222.append(g.g(exc));
                            g.p(4, str9, sb622222222.toString());
                            if (pVar.t()) {
                            }
                            g.p(4, str9, str18 + i19 + str17 + j19 + str20 + j37);
                            eVar4.close();
                            g.p(4, str9, str22 + q1Var.toString());
                            g.p(5, str9, str21 + q1Var.toString());
                            oVar = this;
                            eVar2 = eVar4;
                            j26 = j17;
                            z16 = z15;
                            str10 = n15;
                            j25 = -99999;
                            oVar.f290940g.d(pVar2);
                            if (!pVar.o()) {
                            }
                            String m1522222222222222222222 = pVar.m();
                            int g1522222222222222222222 = pVar.g();
                            int currentTimeMillis222222222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                            c cVar22222222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                            if (!(exc instanceof l.f)) {
                            }
                            if (nr0.a.a().e() != null) {
                            }
                            g.p(4, str9, "write response finish");
                        } catch (Throwable th33) {
                            str40 = str14;
                            str36 = str42;
                            str38 = str43;
                            str39 = str44;
                            j57 = j28;
                            str37 = str45;
                            th9 = th33;
                            str13 = str18;
                            str12 = str17;
                            str14 = str40;
                            str44 = str39;
                            str43 = str38;
                            str45 = str37;
                            str42 = str36;
                            j28 = j57;
                            Throwable th292 = th9;
                            IOException iOException72 = null;
                            e eVar122 = eVar2;
                            int i352 = i29;
                            eVar = eVar122;
                            th5 = th292;
                            i15 = i352;
                            iOException = iOException72;
                            str2 = str14;
                            str4 = str42;
                            str5 = str13;
                            str3 = str12;
                            str7 = str43;
                            str6 = str44;
                            j18 = j28;
                            str8 = str45;
                            g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                            eVar.close();
                            i16 = 5;
                            if (iOException == null) {
                            }
                            g.p(4, str9, str7 + q1Var.toString());
                            g.p(5, str9, str8 + q1Var.toString());
                            throw th5;
                        }
                    } catch (IOException e86) {
                        e = e86;
                        eVar8 = eVar2;
                        j48 = a15;
                        str34 = str14;
                        str16 = str43;
                        str35 = str44;
                        j55 = j28;
                        str33 = str54;
                        bufferedOutputStream = bufferedOutputStream2;
                        str15 = str45;
                        iOException3 = e;
                        j46 = j55;
                        bVar = bVar2;
                        eVar3 = eVar8;
                        str44 = str35;
                        str14 = str34;
                        str42 = str33;
                        iOException2 = iOException3;
                        j29 = j48;
                        j35 = j47;
                        j36 = j46;
                        i17 = 0;
                        z17 = true;
                        str45 = str15;
                        if (iOException2 instanceof l.f) {
                        }
                        long j5822222222222 = -99999;
                        exc = iOException2;
                        long j5922222222222 = j5822222222222;
                        boolean z1822222222222 = z17;
                        if (pVar.t()) {
                        }
                        g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                        eVar3.close();
                        i18 = 5;
                        if (exc == null) {
                        }
                        g.p(4, str9, str43 + q1Var.toString());
                        g.p(5, str9, str45 + q1Var.toString());
                        j25 = j5922222222222;
                        z16 = z1822222222222;
                        eVar2 = eVar3;
                        j26 = j35;
                        oVar.f290940g.d(pVar2);
                        if (!pVar.o()) {
                        }
                        String m15222222222222222222222 = pVar.m();
                        int g15222222222222222222222 = pVar.g();
                        int currentTimeMillis2222222222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                        c cVar222222222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                        if (!(exc instanceof l.f)) {
                        }
                        if (nr0.a.a().e() != null) {
                        }
                        g.p(4, str9, "write response finish");
                    } catch (Exception e87) {
                    } catch (Throwable th34) {
                    }
                } catch (IOException e88) {
                    e = e88;
                    pVar2 = pVar;
                    j46 = j15;
                    str34 = "write response, dataSource close failed";
                    j47 = j45;
                    q1Var = q1Var2;
                    eVar3 = a16;
                    bVar = bVar3;
                    str16 = str43;
                    str35 = str44;
                    str15 = str45;
                    str33 = str54;
                    bufferedOutputStream = bufferedOutputStream3;
                    iOException3 = e;
                    j48 = -1;
                    str44 = str35;
                    str14 = str34;
                    str42 = str33;
                    iOException2 = iOException3;
                    j29 = j48;
                    j35 = j47;
                    j36 = j46;
                    i17 = 0;
                    z17 = true;
                    str45 = str15;
                    if (iOException2 instanceof l.f) {
                    }
                    long j58222222222222 = -99999;
                    exc = iOException2;
                    long j59222222222222 = j58222222222222;
                    boolean z18222222222222 = z17;
                    if (pVar.t()) {
                    }
                    g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
                    eVar3.close();
                    i18 = 5;
                    if (exc == null) {
                    }
                    g.p(4, str9, str43 + q1Var.toString());
                    g.p(5, str9, str45 + q1Var.toString());
                    j25 = j59222222222222;
                    z16 = z18222222222222;
                    eVar2 = eVar3;
                    j26 = j35;
                    oVar.f290940g.d(pVar2);
                    if (!pVar.o()) {
                    }
                    String m152222222222222222222222 = pVar.m();
                    int g152222222222222222222222 = pVar.g();
                    int currentTimeMillis22222222222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                    c cVar2222222222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                    if (!(exc instanceof l.f)) {
                    }
                    if (nr0.a.a().e() != null) {
                    }
                    g.p(4, str9, "write response finish");
                } catch (Exception e89) {
                    e = e89;
                    pVar2 = pVar;
                    j37 = j15;
                    str23 = "write response, dataSource close failed";
                    j47 = j45;
                    q1Var = q1Var2;
                    eVar4 = a16;
                    str22 = str43;
                    str24 = str44;
                    str21 = str45;
                    str20 = str54;
                    exc2 = e;
                    exc = exc2;
                    j17 = j47;
                    i19 = 0;
                    StringBuilder sb6222222222 = new StringBuilder();
                    str25 = str24;
                    sb6222222222.append("other exception ");
                    sb6222222222.append(g.g(exc));
                    g.p(4, str9, sb6222222222.toString());
                    if (pVar.t()) {
                    }
                    g.p(4, str9, str18 + i19 + str17 + j19 + str20 + j37);
                    eVar4.close();
                    g.p(4, str9, str22 + q1Var.toString());
                    g.p(5, str9, str21 + q1Var.toString());
                    oVar = this;
                    eVar2 = eVar4;
                    j26 = j17;
                    z16 = z15;
                    str10 = n15;
                    j25 = -99999;
                    oVar.f290940g.d(pVar2);
                    if (!pVar.o()) {
                    }
                    String m1522222222222222222222222 = pVar.m();
                    int g1522222222222222222222222 = pVar.g();
                    int currentTimeMillis222222222222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                    c cVar22222222222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                    if (!(exc instanceof l.f)) {
                    }
                    if (nr0.a.a().e() != null) {
                    }
                    g.p(4, str9, "write response finish");
                } catch (Throwable th35) {
                    str28 = str54;
                    j39 = j15;
                    str31 = "write response, dataSource close failed";
                    q1Var = q1Var2;
                    eVar5 = a16;
                    str30 = str43;
                    str32 = str44;
                    str29 = str45;
                    th7 = th35;
                    q1 q1Var322 = q1Var;
                    Throwable th2422 = th7;
                    str3 = str17;
                    th5 = th2422;
                    eVar = eVar5;
                    q1Var = q1Var322;
                    iOException = null;
                    str6 = str32;
                    str5 = str18;
                    str2 = str31;
                    str7 = str30;
                    str8 = str29;
                    str4 = str28;
                    j18 = j39;
                    i15 = 0;
                    g.p(4, str9, str5 + i15 + str3 + j19 + str4 + j18);
                    eVar.close();
                    i16 = 5;
                    if (iOException == null) {
                    }
                    g.p(4, str9, str7 + q1Var.toString());
                    g.p(5, str9, str8 + q1Var.toString());
                    throw th5;
                }
                oVar.f290940g.d(pVar2);
                if (!pVar.o()) {
                }
                String m15222222222222222222222222 = pVar.m();
                int g15222222222222222222222222 = pVar.g();
                int currentTimeMillis2222222222222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
                c cVar222222222222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
                if (!(exc instanceof l.f)) {
                }
                if (nr0.a.a().e() != null) {
                }
                g.p(4, str9, "write response finish");
            }
        } catch (IOException e95) {
            e15 = e95;
            pVar2 = pVar;
            eVar3 = a16;
            str19 = "write response, dataSource close failed";
            str26 = str42;
            str9 = str41;
            str18 = "write response, total send ";
            str17 = " bytes, rangeStart=";
            j19 = i27;
            bVar = bVar3;
            str16 = str43;
            str27 = str44;
            j38 = j15;
            bufferedOutputStream = bufferedOutputStream3;
            str15 = str45;
            IOException iOException52 = e15;
            str44 = str27;
            str42 = str26;
            j36 = j38;
            str14 = str19;
            iOException2 = iOException52;
            j35 = 0;
            z17 = true;
            j29 = -1;
            q1Var = null;
            i17 = 0;
            str45 = str15;
            if (iOException2 instanceof l.f) {
            }
            long j582222222222222 = -99999;
            exc = iOException2;
            long j592222222222222 = j582222222222222;
            boolean z182222222222222 = z17;
            if (pVar.t()) {
            }
            g.p(4, str9, str13 + i17 + str12 + j19 + str42 + j28);
            eVar3.close();
            i18 = 5;
            if (exc == null) {
            }
            g.p(4, str9, str43 + q1Var.toString());
            g.p(5, str9, str45 + q1Var.toString());
            j25 = j592222222222222;
            z16 = z182222222222222;
            eVar2 = eVar3;
            j26 = j35;
            oVar.f290940g.d(pVar2);
            if (!pVar.o()) {
            }
            String m152222222222222222222222222 = pVar.m();
            int g152222222222222222222222222 = pVar.g();
            int currentTimeMillis22222222222222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
            c cVar2222222222222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
            if (!(exc instanceof l.f)) {
            }
            if (nr0.a.a().e() != null) {
            }
            g.p(4, str9, "write response finish");
        } catch (Exception e96) {
        } catch (Throwable th36) {
        }
        g.p(4, str9, str7 + q1Var.toString());
        g.p(5, str9, str8 + q1Var.toString());
        throw th5;
        g.p(4, str9, str22 + q1Var.toString());
        g.p(5, str9, str21 + q1Var.toString());
        oVar = this;
        eVar2 = eVar4;
        j26 = j17;
        z16 = z15;
        str10 = n15;
        j25 = -99999;
        oVar.f290940g.d(pVar2);
        if (!pVar.o()) {
        }
        String m1522222222222222222222222222 = pVar.m();
        int g1522222222222222222222222222 = pVar.g();
        int currentTimeMillis222222222222222222222222222 = (int) (System.currentTimeMillis() - currentTimeMillis);
        c cVar22222222222222222222222222 = (c) ((HashMap) oVar.f290941h).get(str10);
        if (!(exc instanceof l.f)) {
        }
        if (nr0.a.a().e() != null) {
        }
        g.p(4, str9, "write response finish");
    }
}