package okhttp3.internal;

import h.b;
import h.c0.d;
import h.c0.f;
import h.c0.q;
import h.i;
import h.r;
import h.s.e0;
import h.s.h;
import h.s.m;
import h.s.u;
import h.s.z;
import h.x.c.a;
import h.x.c.l;
import h.x.d.j;
import h.x.d.k;
import h.x.d.x;
import h.x.d.y;
import h.z.n;
import i.b0;
import i.d0;
import i.g;
import i.t;
import java.io.Closeable;
import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketTimeoutException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import okhttp3.Call;
import okhttp3.EventListener;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.internal.http2.Header;
import okhttp3.internal.io.FileSystem;
import org.snmp4j.agent.mo.snmp.DisplayString;
import org.snmp4j.mp.MPv3;
import org.snmp4j.util.SnmpConfigurator;

/* JADX INFO: compiled from: Util.kt */
/* JADX INFO: loaded from: classes.dex */
@i(bv = {1, 0, 3}, d1 = {"\u0000Æ\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u0011\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010 \n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010!\n\u0002\b\u0003\n\u0002\u0010\u0005\n\u0002\b\u0004\n\u0002\u0010\n\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\f\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u000e\n\u0002\u0010$\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0012\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\u001a'\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0001\u001a\u00020\u00002\u0006\u0010\u0003\u001a\u00020\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004¢\u0006\u0004\b\u0007\u0010\b\u001a%\u0010\r\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\u00022\u0006\u0010\n\u001a\u00020\u00022\u0006\u0010\u000b\u001a\u00020\u0002¢\u0006\u0004\b\r\u0010\u000e\u001a)\u0010\u000f\u001a\u00020\u00002\u0006\u0010\u000f\u001a\u00020\u00002\u0012\u0010\u0012\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00110\u0010\"\u00020\u0011¢\u0006\u0004\b\u000f\u0010\u0013\u001a!\u0010\u0016\u001a\u00020\f2\f\u0010\u0015\u001a\b\u0012\u0004\u0012\u00020\f0\u0014H\u0086\bø\u0001\u0000¢\u0006\u0004\b\u0016\u0010\u0017\u001a/\u0010\u001b\u001a\b\u0012\u0004\u0012\u00028\u00000\u001a\"\u0004\b\u0000\u0010\u00182\u0012\u0010\u0019\u001a\n\u0012\u0006\b\u0001\u0012\u00028\u00000\u0010\"\u00028\u0000H\u0007¢\u0006\u0004\b\u001b\u0010\u001c\u001a3\u0010!\u001a\u0004\u0018\u00018\u0000\"\u0004\b\u0000\u0010\u00182\u0006\u0010\u001d\u001a\u00020\u00112\f\u0010\u001f\u001a\b\u0012\u0004\u0012\u00028\u00000\u001e2\u0006\u0010 \u001a\u00020\u0000¢\u0006\u0004\b!\u0010\"\u001a\u001d\u0010&\u001a\u00020%2\u0006\u0010\u0001\u001a\u00020\u00002\u0006\u0010$\u001a\u00020#¢\u0006\u0004\b&\u0010'\u001a)\u0010(\u001a\u00020\f2\u0006\u0010\u0001\u001a\u00020\u00002\f\u0010\u0015\u001a\b\u0012\u0004\u0012\u00020\f0\u0014H\u0086\bø\u0001\u0000¢\u0006\u0004\b(\u0010)\u001a'\u0010-\u001a\u00020\f\"\u0004\b\u0000\u0010**\b\u0012\u0004\u0012\u00028\u00000+2\u0006\u0010,\u001a\u00028\u0000H\u0000¢\u0006\u0004\b-\u0010.\u001a\u001c\u00101\u001a\u00020\u0006*\u00020/2\u0006\u00100\u001a\u00020\u0006H\u0086\u0004¢\u0006\u0004\b1\u00102\u001a\u001c\u00101\u001a\u00020\u0002*\u00020\u00062\u0006\u00100\u001a\u00020\u0002H\u0086\u0004¢\u0006\u0004\b1\u00103\u001a\u001c\u00101\u001a\u00020\u0006*\u0002042\u0006\u00100\u001a\u00020\u0006H\u0086\u0004¢\u0006\u0004\b1\u00105\u001a\u0011\u00108\u001a\u000207*\u000206¢\u0006\u0004\b8\u00109\u001a\u0014\u0010:\u001a\u00020\f*\u00020\u0011H\u0080\b¢\u0006\u0004\b:\u0010;\u001a\u0014\u0010<\u001a\u00020\f*\u00020\u0011H\u0080\b¢\u0006\u0004\b<\u0010;\u001a\u0011\u0010=\u001a\u00020#*\u00020\u0000¢\u0006\u0004\b=\u0010>\u001a\u0019\u0010A\u001a\u00020#*\u00020?2\u0006\u0010@\u001a\u00020?¢\u0006\u0004\bA\u0010B\u001a\u0011\u0010D\u001a\u00020\f*\u00020C¢\u0006\u0004\bD\u0010E\u001a\u0011\u0010D\u001a\u00020\f*\u00020F¢\u0006\u0004\bD\u0010G\u001a\u0011\u0010D\u001a\u00020\f*\u00020H¢\u0006\u0004\bD\u0010I\u001a%\u0010K\u001a\b\u0012\u0004\u0012\u00020\u00000\u0010*\b\u0012\u0004\u0012\u00020\u00000\u00102\u0006\u0010J\u001a\u00020\u0000¢\u0006\u0004\bK\u0010L\u001a-\u0010Q\u001a\u00020\u0006*\u00020\u00002\u0006\u0010N\u001a\u00020M2\b\b\u0002\u0010O\u001a\u00020\u00062\b\b\u0002\u0010P\u001a\u00020\u0006¢\u0006\u0004\bQ\u0010R\u001a-\u0010Q\u001a\u00020\u0006*\u00020\u00002\u0006\u0010S\u001a\u00020\u00002\b\b\u0002\u0010O\u001a\u00020\u00062\b\b\u0002\u0010P\u001a\u00020\u0006¢\u0006\u0004\bQ\u0010T\u001a!\u0010X\u001a\u00020#*\u00020U2\u0006\u0010V\u001a\u00020\u00062\u0006\u0010W\u001a\u00020\u0004¢\u0006\u0004\bX\u0010Y\u001aB\u0010^\u001a\b\u0012\u0004\u0012\u00028\u00000\u001a\"\u0004\b\u0000\u0010\u0018*\b\u0012\u0004\u0012\u00028\u00000Z2\u0017\u0010]\u001a\u0013\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00020#0[¢\u0006\u0002\b\\H\u0086\bø\u0001\u0000¢\u0006\u0004\b^\u0010_\u001a7\u0010b\u001a\u00020#*\b\u0012\u0004\u0012\u00020\u00000\u00102\u000e\u0010@\u001a\n\u0012\u0004\u0012\u00020\u0000\u0018\u00010\u00102\u000e\u0010a\u001a\n\u0012\u0006\b\u0000\u0012\u00020\u00000`¢\u0006\u0004\bb\u0010c\u001a\u0011\u0010e\u001a\u00020\u0002*\u00020d¢\u0006\u0004\be\u0010f\u001a-\u0010g\u001a\u00020\u0006*\b\u0012\u0004\u0012\u00020\u00000\u00102\u0006\u0010J\u001a\u00020\u00002\f\u0010a\u001a\b\u0012\u0004\u0012\u00020\u00000`¢\u0006\u0004\bg\u0010h\u001a\u0011\u0010i\u001a\u00020\u0006*\u00020\u0000¢\u0006\u0004\bi\u0010j\u001a%\u0010k\u001a\u00020\u0006*\u00020\u00002\b\b\u0002\u0010O\u001a\u00020\u00062\b\b\u0002\u0010P\u001a\u00020\u0006¢\u0006\u0004\bk\u0010l\u001a%\u0010m\u001a\u00020\u0006*\u00020\u00002\b\b\u0002\u0010O\u001a\u00020\u00062\b\b\u0002\u0010P\u001a\u00020\u0006¢\u0006\u0004\bm\u0010l\u001a\u001b\u0010n\u001a\u00020\u0006*\u00020\u00002\b\b\u0002\u0010O\u001a\u00020\u0006¢\u0006\u0004\bn\u0010o\u001a;\u0010p\u001a\b\u0012\u0004\u0012\u00020\u00000\u0010*\b\u0012\u0004\u0012\u00020\u00000\u00102\f\u0010@\u001a\b\u0012\u0004\u0012\u00020\u00000\u00102\u000e\u0010a\u001a\n\u0012\u0006\b\u0000\u0012\u00020\u00000`¢\u0006\u0004\bp\u0010q\u001a\u0019\u0010u\u001a\u00020#*\u00020r2\u0006\u0010t\u001a\u00020s¢\u0006\u0004\bu\u0010v\u001a\u0019\u0010y\u001a\u00020#*\u00020H2\u0006\u0010x\u001a\u00020w¢\u0006\u0004\by\u0010z\u001a\u0014\u0010{\u001a\u00020\f*\u00020\u0011H\u0086\b¢\u0006\u0004\b{\u0010;\u001a\u0014\u0010|\u001a\u00020\f*\u00020\u0011H\u0086\b¢\u0006\u0004\b|\u0010;\u001a\u0011\u0010}\u001a\u00020\u0006*\u00020M¢\u0006\u0004\b}\u0010~\u001a\u0012\u0010\u007f\u001a\u00020\u0000*\u00020H¢\u0006\u0005\b\u007f\u0010\u0080\u0001\u001a\u001f\u0010\u0083\u0001\u001a\u00030\u0081\u0001*\u00020w2\b\u0010\u0082\u0001\u001a\u00030\u0081\u0001¢\u0006\u0006\b\u0083\u0001\u0010\u0084\u0001\u001a\u0014\u0010\u0085\u0001\u001a\u00020\u0006*\u00020w¢\u0006\u0006\b\u0085\u0001\u0010\u0086\u0001\u001a\u001e\u0010\u0089\u0001\u001a\u00020\u0006*\u00030\u0087\u00012\u0007\u0010\u0088\u0001\u001a\u00020/¢\u0006\u0006\b\u0089\u0001\u0010\u008a\u0001\u001a#\u0010\u0089\u0001\u001a\u00020#*\u00020U2\u0006\u0010\u0003\u001a\u00020\u00062\u0006\u0010W\u001a\u00020\u0004¢\u0006\u0005\b\u0089\u0001\u0010Y\u001a\u001c\u0010\u008d\u0001\u001a\t\u0012\u0005\u0012\u00030\u008c\u00010\u001a*\u00030\u008b\u0001¢\u0006\u0006\b\u008d\u0001\u0010\u008e\u0001\u001a\u001c\u0010\u008f\u0001\u001a\u00030\u008b\u0001*\t\u0012\u0005\u0012\u00030\u008c\u00010\u001a¢\u0006\u0006\b\u008f\u0001\u0010\u0090\u0001\u001a\u0014\u0010\u0091\u0001\u001a\u00020\u0000*\u00020\u0006¢\u0006\u0006\b\u0091\u0001\u0010\u0092\u0001\u001a\u0014\u0010\u0091\u0001\u001a\u00020\u0000*\u00020\u0002¢\u0006\u0006\b\u0091\u0001\u0010\u0093\u0001\u001a\u001f\u0010\u0095\u0001\u001a\u00020\u0000*\u00020?2\t\b\u0002\u0010\u0094\u0001\u001a\u00020#¢\u0006\u0006\b\u0095\u0001\u0010\u0096\u0001\u001a&\u0010\u0097\u0001\u001a\b\u0012\u0004\u0012\u00028\u00000\u001a\"\u0004\b\u0000\u0010\u0018*\b\u0012\u0004\u0012\u00028\u00000\u001a¢\u0006\u0006\b\u0097\u0001\u0010\u0098\u0001\u001a<\u0010\u009c\u0001\u001a\u000f\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00028\u00010\u009b\u0001\"\u0005\b\u0000\u0010\u0099\u0001\"\u0005\b\u0001\u0010\u009a\u0001*\u000f\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00028\u00010\u009b\u0001¢\u0006\u0006\b\u009c\u0001\u0010\u009d\u0001\u001a\u001d\u0010\u009f\u0001\u001a\u00020\u0002*\u00020\u00002\u0007\u0010\u009e\u0001\u001a\u00020\u0002¢\u0006\u0006\b\u009f\u0001\u0010 \u0001\u001a\u001e\u0010¡\u0001\u001a\u00020\u0006*\u0004\u0018\u00010\u00002\u0007\u0010\u009e\u0001\u001a\u00020\u0006¢\u0006\u0005\b¡\u0001\u0010o\u001a(\u0010¢\u0001\u001a\u00020\u0000*\u00020\u00002\b\b\u0002\u0010O\u001a\u00020\u00062\b\b\u0002\u0010P\u001a\u00020\u0006¢\u0006\u0006\b¢\u0001\u0010£\u0001\u001a\u0016\u0010¤\u0001\u001a\u00020\f*\u00020\u0011H\u0086\b¢\u0006\u0005\b¤\u0001\u0010;\u001a0\u0010©\u0001\u001a\u00030¨\u0001*\b0¥\u0001j\u0003`¦\u00012\u0013\u0010§\u0001\u001a\u000e\u0012\n\u0012\b0¥\u0001j\u0003`¦\u00010\u001a¢\u0006\u0006\b©\u0001\u0010ª\u0001\u001a\u001e\u0010\u00ad\u0001\u001a\u00020\f*\u00030«\u00012\u0007\u0010¬\u0001\u001a\u00020\u0006¢\u0006\u0006\b\u00ad\u0001\u0010®\u0001\"\u001a\u0010°\u0001\u001a\u00030¯\u00018\u0006@\u0007X\u0087\u0004¢\u0006\b\n\u0006\b°\u0001\u0010±\u0001\"\u001a\u0010²\u0001\u001a\u00030\u008b\u00018\u0006@\u0007X\u0087\u0004¢\u0006\b\n\u0006\b²\u0001\u0010³\u0001\"\u001a\u0010µ\u0001\u001a\u00030´\u00018\u0006@\u0007X\u0087\u0004¢\u0006\b\n\u0006\bµ\u0001\u0010¶\u0001\"\u001a\u0010¸\u0001\u001a\u00030·\u00018\u0006@\u0007X\u0087\u0004¢\u0006\b\n\u0006\b¸\u0001\u0010¹\u0001\"\u001a\u0010»\u0001\u001a\u00030º\u00018\u0002@\u0002X\u0082\u0004¢\u0006\b\n\u0006\b»\u0001\u0010¼\u0001\"\u001a\u0010¾\u0001\u001a\u00030½\u00018\u0006@\u0007X\u0087\u0004¢\u0006\b\n\u0006\b¾\u0001\u0010¿\u0001\"\u001a\u0010Á\u0001\u001a\u00030À\u00018\u0002@\u0002X\u0082\u0004¢\u0006\b\n\u0006\bÁ\u0001\u0010Â\u0001\"\u0019\u0010Ã\u0001\u001a\u00020#8\u0000@\u0001X\u0081\u0004¢\u0006\b\n\u0006\bÃ\u0001\u0010Ä\u0001\"\u0019\u0010Å\u0001\u001a\u00020\u00008\u0000@\u0001X\u0081\u0004¢\u0006\b\n\u0006\bÅ\u0001\u0010Æ\u0001\"\u0019\u0010Ç\u0001\u001a\u00020\u00008\u0006@\u0006X\u0086T¢\u0006\b\n\u0006\bÇ\u0001\u0010Æ\u0001\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006È\u0001"}, d2 = {"", "name", "", "duration", "Ljava/util/concurrent/TimeUnit;", "unit", "", "checkDuration", "(Ljava/lang/String;JLjava/util/concurrent/TimeUnit;)I", "arrayLength", "offset", "count", "", "checkOffsetAndCount", "(JJJ)V", "format", "", "", "args", "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", "Lkotlin/Function0;", "block", "ignoreIoExceptions", "(Lkotlin/Function0;)V", "T", "elements", "", "immutableListOf", "([Ljava/lang/Object;)Ljava/util/List;", "instance", "Ljava/lang/Class;", "fieldType", "fieldName", "readFieldOrNull", "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;", "", "daemon", "Ljava/util/concurrent/ThreadFactory;", "threadFactory", "(Ljava/lang/String;Z)Ljava/util/concurrent/ThreadFactory;", "threadName", "(Ljava/lang/String;Lkotlin/Function0;)V", SnmpConfigurator.O_CONTEXT_ENGINE_ID, "", "element", "addIfAbsent", "(Ljava/util/List;Ljava/lang/Object;)V", "", "mask", "and", "(BI)I", "(IJ)J", "", "(SI)I", "Lokhttp3/EventListener;", "Lokhttp3/EventListener$Factory;", "asFactory", "(Lokhttp3/EventListener;)Lokhttp3/EventListener$Factory;", "assertThreadDoesntHoldLock", "(Ljava/lang/Object;)V", "assertThreadHoldsLock", "canParseAsIpAddress", "(Ljava/lang/String;)Z", "Lokhttp3/HttpUrl;", "other", "canReuseConnectionFor", "(Lokhttp3/HttpUrl;Lokhttp3/HttpUrl;)Z", "Ljava/io/Closeable;", "closeQuietly", "(Ljava/io/Closeable;)V", "Ljava/net/ServerSocket;", "(Ljava/net/ServerSocket;)V", "Ljava/net/Socket;", "(Ljava/net/Socket;)V", "value", "concat", "([Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;", "", "delimiter", "startIndex", "endIndex", "delimiterOffset", "(Ljava/lang/String;CII)I", "delimiters", "(Ljava/lang/String;Ljava/lang/String;II)I", "Lokio/Source;", "timeout", "timeUnit", "discard", "(Lokio/Source;ILjava/util/concurrent/TimeUnit;)Z", "", "Lkotlin/Function1;", "Lkotlin/ExtensionFunctionType;", "predicate", "filterList", "(Ljava/lang/Iterable;Lkotlin/Function1;)Ljava/util/List;", "Ljava/util/Comparator;", "comparator", "hasIntersection", "([Ljava/lang/String;[Ljava/lang/String;Ljava/util/Comparator;)Z", "Lokhttp3/Response;", "headersContentLength", "(Lokhttp3/Response;)J", "indexOf", "([Ljava/lang/String;Ljava/lang/String;Ljava/util/Comparator;)I", "indexOfControlOrNonAscii", "(Ljava/lang/String;)I", "indexOfFirstNonAsciiWhitespace", "(Ljava/lang/String;II)I", "indexOfLastNonAsciiWhitespace", "indexOfNonWhitespace", "(Ljava/lang/String;I)I", "intersect", "([Ljava/lang/String;[Ljava/lang/String;Ljava/util/Comparator;)[Ljava/lang/String;", "Lokhttp3/internal/io/FileSystem;", "Ljava/io/File;", "file", "isCivilized", "(Lokhttp3/internal/io/FileSystem;Ljava/io/File;)Z", "Lokio/BufferedSource;", "source", "isHealthy", "(Ljava/net/Socket;Lokio/BufferedSource;)Z", "notify", "notifyAll", "parseHexDigit", "(C)I", "peerName", "(Ljava/net/Socket;)Ljava/lang/String;", "Ljava/nio/charset/Charset;", "default", "readBomAsCharset", "(Lokio/BufferedSource;Ljava/nio/charset/Charset;)Ljava/nio/charset/Charset;", "readMedium", "(Lokio/BufferedSource;)I", "Lokio/Buffer;", "b", "skipAll", "(Lokio/Buffer;B)I", "Lokhttp3/Headers;", "Lokhttp3/internal/http2/Header;", "toHeaderList", "(Lokhttp3/Headers;)Ljava/util/List;", "toHeaders", "(Ljava/util/List;)Lokhttp3/Headers;", "toHexString", "(I)Ljava/lang/String;", "(J)Ljava/lang/String;", "includeDefaultPort", "toHostHeader", "(Lokhttp3/HttpUrl;Z)Ljava/lang/String;", "toImmutableList", "(Ljava/util/List;)Ljava/util/List;", "K", "V", "", "toImmutableMap", "(Ljava/util/Map;)Ljava/util/Map;", "defaultValue", "toLongOrDefault", "(Ljava/lang/String;J)J", "toNonNegativeInt", "trimSubstring", "(Ljava/lang/String;II)Ljava/lang/String;", "wait", "Ljava/lang/Exception;", "Lkotlin/Exception;", "suppressed", "", "withSuppressed", "(Ljava/lang/Exception;Ljava/util/List;)Ljava/lang/Throwable;", "Lokio/BufferedSink;", "medium", "writeMedium", "(Lokio/BufferedSink;I)V", "", "EMPTY_BYTE_ARRAY", "[B", "EMPTY_HEADERS", "Lokhttp3/Headers;", "Lokhttp3/RequestBody;", "EMPTY_REQUEST", "Lokhttp3/RequestBody;", "Lokhttp3/ResponseBody;", "EMPTY_RESPONSE", "Lokhttp3/ResponseBody;", "Lokio/Options;", "UNICODE_BOMS", "Lokio/Options;", "Ljava/util/TimeZone;", "UTC", "Ljava/util/TimeZone;", "Lkotlin/text/Regex;", "VERIFY_AS_IP_ADDRESS", "Lkotlin/text/Regex;", "assertionsEnabled", "Z", "okHttpName", "Ljava/lang/String;", "userAgent", "okhttp"}, k = 2, mv = {1, 1, 15}, pn = "", xi = 0, xs = "")
public final class Util {
    public static final TimeZone UTC;
    private static final f VERIFY_AS_IP_ADDRESS;
    public static final boolean assertionsEnabled;
    public static final String okHttpName;
    public static final String userAgent = "okhttp/4.9.1";
    public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
    public static final Headers EMPTY_HEADERS = Headers.Companion.of(new String[0]);
    public static final ResponseBody EMPTY_RESPONSE = ResponseBody.Companion.create$default(ResponseBody.Companion, EMPTY_BYTE_ARRAY, (MediaType) null, 1, (Object) null);
    public static final RequestBody EMPTY_REQUEST = RequestBody.Companion.create$default(RequestBody.Companion, EMPTY_BYTE_ARRAY, (MediaType) null, 0, 0, 7, (Object) null);
    private static final t UNICODE_BOMS = t.f1040g.d(i.i.f1027h.b("efbbbf"), i.i.f1027h.b("feff"), i.i.f1027h.b("fffe"), i.i.f1027h.b("0000ffff"), i.i.f1027h.b("ffff0000"));

    static {
        TimeZone timeZone = TimeZone.getTimeZone("GMT");
        k.b(timeZone);
        UTC = timeZone;
        VERIFY_AS_IP_ADDRESS = new f("([0-9a-fA-F]*:[0-9a-fA-F:.]*)|([\\d.]+)");
        assertionsEnabled = OkHttpClient.class.desiredAssertionStatus();
        String name = OkHttpClient.class.getName();
        k.c(name, "OkHttpClient::class.java.name");
        okHttpName = q.e0(q.d0(name, "okhttp3."), "Client");
    }

    public static final <E> void addIfAbsent(List<E> list, E e2) {
        k.d(list, "$this$addIfAbsent");
        if (list.contains(e2)) {
            return;
        }
        list.add(e2);
    }

    public static final int and(byte b, int i2) {
        return b & i2;
    }

    public static final int and(short s, int i2) {
        return s & i2;
    }

    public static final long and(int i2, long j2) {
        return j2 & ((long) i2);
    }

    public static final EventListener.Factory asFactory(final EventListener eventListener) {
        k.d(eventListener, "$this$asFactory");
        return new EventListener.Factory() { // from class: okhttp3.internal.Util.asFactory.1
            @Override // okhttp3.EventListener.Factory
            public final EventListener create(Call call) {
                k.d(call, "it");
                return eventListener;
            }
        };
    }

    public static final void assertThreadDoesntHoldLock(Object obj) {
        k.d(obj, "$this$assertThreadDoesntHoldLock");
        if (assertionsEnabled && Thread.holdsLock(obj)) {
            StringBuilder sb = new StringBuilder();
            sb.append("Thread ");
            Thread threadCurrentThread = Thread.currentThread();
            k.c(threadCurrentThread, "Thread.currentThread()");
            sb.append(threadCurrentThread.getName());
            sb.append(" MUST NOT hold lock on ");
            sb.append(obj);
            throw new AssertionError(sb.toString());
        }
    }

    public static final void assertThreadHoldsLock(Object obj) {
        k.d(obj, "$this$assertThreadHoldsLock");
        if (!assertionsEnabled || Thread.holdsLock(obj)) {
            return;
        }
        StringBuilder sb = new StringBuilder();
        sb.append("Thread ");
        Thread threadCurrentThread = Thread.currentThread();
        k.c(threadCurrentThread, "Thread.currentThread()");
        sb.append(threadCurrentThread.getName());
        sb.append(" MUST hold lock on ");
        sb.append(obj);
        throw new AssertionError(sb.toString());
    }

    public static final boolean canParseAsIpAddress(String str) {
        k.d(str, "$this$canParseAsIpAddress");
        return VERIFY_AS_IP_ADDRESS.a(str);
    }

    public static final boolean canReuseConnectionFor(HttpUrl httpUrl, HttpUrl httpUrl2) {
        k.d(httpUrl, "$this$canReuseConnectionFor");
        k.d(httpUrl2, "other");
        return k.a(httpUrl.host(), httpUrl2.host()) && httpUrl.port() == httpUrl2.port() && k.a(httpUrl.scheme(), httpUrl2.scheme());
    }

    public static final int checkDuration(String str, long j2, TimeUnit timeUnit) {
        k.d(str, "name");
        boolean z = true;
        if (!(j2 >= 0)) {
            throw new IllegalStateException((str + " < 0").toString());
        }
        if (!(timeUnit != null)) {
            throw new IllegalStateException("unit == null".toString());
        }
        long millis = timeUnit.toMillis(j2);
        if (!(millis <= ((long) MPv3.MAX_MESSAGE_ID))) {
            throw new IllegalArgumentException((str + " too large.").toString());
        }
        if (millis == 0 && j2 > 0) {
            z = false;
        }
        if (z) {
            return (int) millis;
        }
        throw new IllegalArgumentException((str + " too small.").toString());
    }

    public static final void checkOffsetAndCount(long j2, long j3, long j4) {
        if ((j3 | j4) < 0 || j3 > j2 || j2 - j3 < j4) {
            throw new ArrayIndexOutOfBoundsException();
        }
    }

    public static final void closeQuietly(Closeable closeable) {
        k.d(closeable, "$this$closeQuietly");
        try {
            closeable.close();
        } catch (RuntimeException e2) {
            throw e2;
        } catch (Exception unused) {
        }
    }

    public static final String[] concat(String[] strArr, String str) {
        k.d(strArr, "$this$concat");
        k.d(str, "value");
        Object[] objArrCopyOf = Arrays.copyOf(strArr, strArr.length + 1);
        k.c(objArrCopyOf, "java.util.Arrays.copyOf(this, newSize)");
        String[] strArr2 = (String[]) objArrCopyOf;
        strArr2[h.t(strArr2)] = str;
        if (strArr2 != null) {
            return strArr2;
        }
        throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<kotlin.String>");
    }

    public static final int delimiterOffset(String str, String str2, int i2, int i3) {
        k.d(str, "$this$delimiterOffset");
        k.d(str2, "delimiters");
        while (i2 < i3) {
            if (q.D(str2, str.charAt(i2), false, 2, null)) {
                return i2;
            }
            i2++;
        }
        return i3;
    }

    public static /* synthetic */ int delimiterOffset$default(String str, String str2, int i2, int i3, int i4, Object obj) {
        if ((i4 & 2) != 0) {
            i2 = 0;
        }
        if ((i4 & 4) != 0) {
            i3 = str.length();
        }
        return delimiterOffset(str, str2, i2, i3);
    }

    public static final boolean discard(d0 d0Var, int i2, TimeUnit timeUnit) {
        k.d(d0Var, "$this$discard");
        k.d(timeUnit, "timeUnit");
        try {
            return skipAll(d0Var, i2, timeUnit);
        } catch (IOException unused) {
            return false;
        }
    }

    public static final <T> List<T> filterList(Iterable<? extends T> iterable, l<? super T, Boolean> lVar) {
        k.d(iterable, "$this$filterList");
        k.d(lVar, "predicate");
        List<T> listF = m.f();
        for (T t : iterable) {
            if (lVar.invoke(t).booleanValue()) {
                if (listF.isEmpty()) {
                    listF = new ArrayList<>();
                }
                if (listF == null) {
                    throw new NullPointerException("null cannot be cast to non-null type kotlin.collections.MutableList<T>");
                }
                y.a(listF).add(t);
            }
        }
        return listF;
    }

    public static final String format(String str, Object... objArr) {
        k.d(str, "format");
        k.d(objArr, "args");
        x xVar = x.a;
        Locale locale = Locale.US;
        Object[] objArrCopyOf = Arrays.copyOf(objArr, objArr.length);
        String str2 = String.format(locale, str, Arrays.copyOf(objArrCopyOf, objArrCopyOf.length));
        k.c(str2, "java.lang.String.format(locale, format, *args)");
        return str2;
    }

    public static final boolean hasIntersection(String[] strArr, String[] strArr2, Comparator<? super String> comparator) {
        k.d(strArr, "$this$hasIntersection");
        k.d(comparator, "comparator");
        if (!(strArr.length == 0) && strArr2 != null) {
            if (!(strArr2.length == 0)) {
                for (String str : strArr) {
                    for (String str2 : strArr2) {
                        if (comparator.compare(str, str2) == 0) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }

    public static final long headersContentLength(Response response) {
        k.d(response, "$this$headersContentLength");
        String str = response.headers().get(com.ifpdos.sdk.httpd.binder.aidl.Headers.KEY_CONTENT_LENGTH);
        if (str != null) {
            return toLongOrDefault(str, -1L);
        }
        return -1L;
    }

    public static final void ignoreIoExceptions(a<r> aVar) {
        k.d(aVar, "block");
        try {
            aVar.invoke();
        } catch (IOException unused) {
        }
    }

    @SafeVarargs
    public static final <T> List<T> immutableListOf(T... tArr) {
        k.d(tArr, "elements");
        Object[] objArr = (Object[]) tArr.clone();
        List<T> listUnmodifiableList = Collections.unmodifiableList(m.h(Arrays.copyOf(objArr, objArr.length)));
        k.c(listUnmodifiableList, "Collections.unmodifiable…istOf(*elements.clone()))");
        return listUnmodifiableList;
    }

    public static final int indexOf(String[] strArr, String str, Comparator<String> comparator) {
        k.d(strArr, "$this$indexOf");
        k.d(str, "value");
        k.d(comparator, "comparator");
        int length = strArr.length;
        for (int i2 = 0; i2 < length; i2++) {
            if (comparator.compare(strArr[i2], str) == 0) {
                return i2;
            }
        }
        return -1;
    }

    public static final int indexOfControlOrNonAscii(String str) {
        k.d(str, "$this$indexOfControlOrNonAscii");
        int length = str.length();
        for (int i2 = 0; i2 < length; i2++) {
            char cCharAt = str.charAt(i2);
            if (k.e(cCharAt, 31) <= 0 || k.e(cCharAt, 127) >= 0) {
                return i2;
            }
        }
        return -1;
    }

    public static final int indexOfFirstNonAsciiWhitespace(String str, int i2, int i3) {
        k.d(str, "$this$indexOfFirstNonAsciiWhitespace");
        while (i2 < i3) {
            char cCharAt = str.charAt(i2);
            if (cCharAt != '\t' && cCharAt != '\n' && cCharAt != '\f' && cCharAt != '\r' && cCharAt != ' ') {
                return i2;
            }
            i2++;
        }
        return i3;
    }

    public static /* synthetic */ int indexOfFirstNonAsciiWhitespace$default(String str, int i2, int i3, int i4, Object obj) {
        if ((i4 & 1) != 0) {
            i2 = 0;
        }
        if ((i4 & 2) != 0) {
            i3 = str.length();
        }
        return indexOfFirstNonAsciiWhitespace(str, i2, i3);
    }

    public static final int indexOfLastNonAsciiWhitespace(String str, int i2, int i3) {
        k.d(str, "$this$indexOfLastNonAsciiWhitespace");
        int i4 = i3 - 1;
        if (i4 >= i2) {
            while (true) {
                char cCharAt = str.charAt(i4);
                if (cCharAt != '\t' && cCharAt != '\n' && cCharAt != '\f' && cCharAt != '\r' && cCharAt != ' ') {
                    return i4 + 1;
                }
                if (i4 == i2) {
                    break;
                }
                i4--;
            }
        }
        return i2;
    }

    public static /* synthetic */ int indexOfLastNonAsciiWhitespace$default(String str, int i2, int i3, int i4, Object obj) {
        if ((i4 & 1) != 0) {
            i2 = 0;
        }
        if ((i4 & 2) != 0) {
            i3 = str.length();
        }
        return indexOfLastNonAsciiWhitespace(str, i2, i3);
    }

    public static final int indexOfNonWhitespace(String str, int i2) {
        k.d(str, "$this$indexOfNonWhitespace");
        int length = str.length();
        while (i2 < length) {
            char cCharAt = str.charAt(i2);
            if (cCharAt != ' ' && cCharAt != '\t') {
                return i2;
            }
            i2++;
        }
        return str.length();
    }

    public static /* synthetic */ int indexOfNonWhitespace$default(String str, int i2, int i3, Object obj) {
        if ((i3 & 1) != 0) {
            i2 = 0;
        }
        return indexOfNonWhitespace(str, i2);
    }

    public static final String[] intersect(String[] strArr, String[] strArr2, Comparator<? super String> comparator) {
        k.d(strArr, "$this$intersect");
        k.d(strArr2, "other");
        k.d(comparator, "comparator");
        ArrayList arrayList = new ArrayList();
        for (String str : strArr) {
            int length = strArr2.length;
            int i2 = 0;
            while (true) {
                if (i2 >= length) {
                    break;
                }
                if (comparator.compare(str, strArr2[i2]) == 0) {
                    arrayList.add(str);
                    break;
                }
                i2++;
            }
        }
        Object[] array = arrayList.toArray(new String[0]);
        if (array != null) {
            return (String[]) array;
        }
        throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
    }

    public static final boolean isCivilized(FileSystem fileSystem, File file) throws IOException {
        k.d(fileSystem, "$this$isCivilized");
        k.d(file, "file");
        b0 b0VarSink = fileSystem.sink(file);
        try {
            try {
                fileSystem.delete(file);
                h.w.a.a(b0VarSink, null);
                return true;
            } catch (IOException unused) {
                r rVar = r.a;
                h.w.a.a(b0VarSink, null);
                fileSystem.delete(file);
                return false;
            }
        } finally {
        }
    }

    public static final boolean isHealthy(Socket socket, i.h hVar) {
        k.d(socket, "$this$isHealthy");
        k.d(hVar, "source");
        try {
            int soTimeout = socket.getSoTimeout();
            try {
                socket.setSoTimeout(1);
                boolean z = !hVar.B();
                socket.setSoTimeout(soTimeout);
                return z;
            } catch (Throwable th) {
                socket.setSoTimeout(soTimeout);
                throw th;
            }
        } catch (SocketTimeoutException unused) {
            return true;
        } catch (IOException unused2) {
            return false;
        }
    }

    public static final void notify(Object obj) {
        k.d(obj, "$this$notify");
        obj.notify();
    }

    public static final void notifyAll(Object obj) {
        k.d(obj, "$this$notifyAll");
        obj.notifyAll();
    }

    public static final int parseHexDigit(char c2) {
        if ('0' <= c2 && '9' >= c2) {
            return c2 - '0';
        }
        char c3 = 'a';
        if ('a' > c2 || 'f' < c2) {
            c3 = 'A';
            if ('A' > c2 || 'F' < c2) {
                return -1;
            }
        }
        return (c2 - c3) + 10;
    }

    public static final String peerName(Socket socket) {
        k.d(socket, "$this$peerName");
        SocketAddress remoteSocketAddress = socket.getRemoteSocketAddress();
        if (!(remoteSocketAddress instanceof InetSocketAddress)) {
            return remoteSocketAddress.toString();
        }
        String hostName = ((InetSocketAddress) remoteSocketAddress).getHostName();
        k.c(hostName, "address.hostName");
        return hostName;
    }

    public static final Charset readBomAsCharset(i.h hVar, Charset charset) throws IOException {
        k.d(hVar, "$this$readBomAsCharset");
        k.d(charset, "default");
        int iM0 = hVar.m0(UNICODE_BOMS);
        if (iM0 == -1) {
            return charset;
        }
        if (iM0 == 0) {
            Charset charset2 = StandardCharsets.UTF_8;
            k.c(charset2, "UTF_8");
            return charset2;
        }
        if (iM0 == 1) {
            Charset charset3 = StandardCharsets.UTF_16BE;
            k.c(charset3, "UTF_16BE");
            return charset3;
        }
        if (iM0 == 2) {
            Charset charset4 = StandardCharsets.UTF_16LE;
            k.c(charset4, "UTF_16LE");
            return charset4;
        }
        if (iM0 == 3) {
            return d.a.a();
        }
        if (iM0 == 4) {
            return d.a.b();
        }
        throw new AssertionError();
    }

    public static final <T> T readFieldOrNull(Object obj, Class<T> cls, String str) {
        T tCast;
        Object fieldOrNull;
        k.d(obj, "instance");
        k.d(cls, "fieldType");
        k.d(str, "fieldName");
        Class<?> superclass = obj.getClass();
        while (true) {
            tCast = null;
            if (!(!k.a(superclass, Object.class))) {
                if (!(!k.a(str, "delegate")) || (fieldOrNull = readFieldOrNull(obj, Object.class, "delegate")) == null) {
                    return null;
                }
                return (T) readFieldOrNull(fieldOrNull, cls, str);
            }
            try {
                Field declaredField = superclass.getDeclaredField(str);
                k.c(declaredField, "field");
                declaredField.setAccessible(true);
                Object obj2 = declaredField.get(obj);
                if (!cls.isInstance(obj2)) {
                    break;
                }
                tCast = cls.cast(obj2);
                break;
            } catch (NoSuchFieldException unused) {
                superclass = superclass.getSuperclass();
                k.c(superclass, "c.superclass");
            }
        }
        return tCast;
    }

    public static final int readMedium(i.h hVar) throws IOException {
        k.d(hVar, "$this$readMedium");
        return and(hVar.readByte(), DisplayString.MAX_SIZE) | (and(hVar.readByte(), DisplayString.MAX_SIZE) << 16) | (and(hVar.readByte(), DisplayString.MAX_SIZE) << 8);
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x005b A[PHI: r12
      0x005b: PHI (r12v6 boolean) = (r12v5 boolean), (r12v10 boolean) binds: [B:23:0x007e, B:13:0x0051] A[DONT_GENERATE, DONT_INLINE]] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final boolean skipAll(i.d0 r11, int r12, java.util.concurrent.TimeUnit r13) throws java.io.IOException {
        /*
            java.lang.String r0 = "$this$skipAll"
            h.x.d.k.d(r11, r0)
            java.lang.String r0 = "timeUnit"
            h.x.d.k.d(r13, r0)
            long r0 = java.lang.System.nanoTime()
            i.e0 r2 = r11.timeout()
            boolean r2 = r2.hasDeadline()
            r3 = 9223372036854775807(0x7fffffffffffffff, double:NaN)
            if (r2 == 0) goto L27
            i.e0 r2 = r11.timeout()
            long r5 = r2.deadlineNanoTime()
            long r5 = r5 - r0
            goto L28
        L27:
            r5 = r3
        L28:
            i.e0 r2 = r11.timeout()
            long r7 = (long) r12
            long r12 = r13.toNanos(r7)
            long r12 = java.lang.Math.min(r5, r12)
            long r12 = r12 + r0
            r2.deadlineNanoTime(r12)
            i.f r12 = new i.f     // Catch: java.lang.Throwable -> L64 java.io.InterruptedIOException -> L7a
            r12.<init>()     // Catch: java.lang.Throwable -> L64 java.io.InterruptedIOException -> L7a
        L3e:
            r7 = 8192(0x2000, double:4.0474E-320)
            long r7 = r11.read(r12, r7)     // Catch: java.lang.Throwable -> L64 java.io.InterruptedIOException -> L7a
            r9 = -1
            int r13 = (r7 > r9 ? 1 : (r7 == r9 ? 0 : -1))
            if (r13 == 0) goto L4e
            r12.a()     // Catch: java.lang.Throwable -> L64 java.io.InterruptedIOException -> L7a
            goto L3e
        L4e:
            r12 = 1
            int r13 = (r5 > r3 ? 1 : (r5 == r3 ? 0 : -1))
            if (r13 != 0) goto L5b
        L53:
            i.e0 r11 = r11.timeout()
            r11.clearDeadline()
            goto L81
        L5b:
            i.e0 r11 = r11.timeout()
            long r0 = r0 + r5
            r11.deadlineNanoTime(r0)
            goto L81
        L64:
            r12 = move-exception
            int r13 = (r5 > r3 ? 1 : (r5 == r3 ? 0 : -1))
            if (r13 != 0) goto L71
            i.e0 r11 = r11.timeout()
            r11.clearDeadline()
            goto L79
        L71:
            i.e0 r11 = r11.timeout()
            long r0 = r0 + r5
            r11.deadlineNanoTime(r0)
        L79:
            throw r12
        L7a:
            r12 = 0
            int r13 = (r5 > r3 ? 1 : (r5 == r3 ? 0 : -1))
            if (r13 != 0) goto L5b
            goto L53
        L81:
            return r12
        */
        throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.Util.skipAll(i.d0, int, java.util.concurrent.TimeUnit):boolean");
    }

    public static final ThreadFactory threadFactory(final String str, final boolean z) {
        k.d(str, "name");
        return new ThreadFactory() { // from class: okhttp3.internal.Util.threadFactory.1
            @Override // java.util.concurrent.ThreadFactory
            public final Thread newThread(Runnable runnable) {
                Thread thread = new Thread(runnable, str);
                thread.setDaemon(z);
                return thread;
            }
        };
    }

    public static final void threadName(String str, a<r> aVar) {
        k.d(str, "name");
        k.d(aVar, "block");
        Thread threadCurrentThread = Thread.currentThread();
        k.c(threadCurrentThread, "currentThread");
        String name = threadCurrentThread.getName();
        threadCurrentThread.setName(str);
        try {
            aVar.invoke();
        } finally {
            j.b(1);
            threadCurrentThread.setName(name);
            j.a(1);
        }
    }

    public static final List<Header> toHeaderList(Headers headers) {
        k.d(headers, "$this$toHeaderList");
        h.z.h hVarI = n.i(0, headers.size());
        ArrayList arrayList = new ArrayList(h.s.n.o(hVarI, 10));
        Iterator<Integer> it = hVarI.iterator();
        while (it.hasNext()) {
            int iA = ((z) it).a();
            arrayList.add(new Header(headers.name(iA), headers.value(iA)));
        }
        return arrayList;
    }

    public static final Headers toHeaders(List<Header> list) {
        k.d(list, "$this$toHeaders");
        Headers.Builder builder = new Headers.Builder();
        for (Header header : list) {
            builder.addLenient$okhttp(header.component1().w(), header.component2().w());
        }
        return builder.build();
    }

    public static final String toHexString(long j2) {
        String hexString = Long.toHexString(j2);
        k.c(hexString, "java.lang.Long.toHexString(this)");
        return hexString;
    }

    public static final String toHostHeader(HttpUrl httpUrl, boolean z) {
        String strHost;
        k.d(httpUrl, "$this$toHostHeader");
        if (q.E(httpUrl.host(), ":", false, 2, null)) {
            strHost = '[' + httpUrl.host() + ']';
        } else {
            strHost = httpUrl.host();
        }
        if (!z && httpUrl.port() == HttpUrl.Companion.defaultPort(httpUrl.scheme())) {
            return strHost;
        }
        return strHost + ':' + httpUrl.port();
    }

    public static /* synthetic */ String toHostHeader$default(HttpUrl httpUrl, boolean z, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            z = false;
        }
        return toHostHeader(httpUrl, z);
    }

    public static final <T> List<T> toImmutableList(List<? extends T> list) {
        k.d(list, "$this$toImmutableList");
        List<T> listUnmodifiableList = Collections.unmodifiableList(u.K(list));
        k.c(listUnmodifiableList, "Collections.unmodifiableList(toMutableList())");
        return listUnmodifiableList;
    }

    public static final <K, V> Map<K, V> toImmutableMap(Map<K, ? extends V> map) {
        k.d(map, "$this$toImmutableMap");
        if (map.isEmpty()) {
            return e0.d();
        }
        Map<K, V> mapUnmodifiableMap = Collections.unmodifiableMap(new LinkedHashMap(map));
        k.c(mapUnmodifiableMap, "Collections.unmodifiableMap(LinkedHashMap(this))");
        return mapUnmodifiableMap;
    }

    public static final long toLongOrDefault(String str, long j2) {
        k.d(str, "$this$toLongOrDefault");
        try {
            return Long.parseLong(str);
        } catch (NumberFormatException unused) {
            return j2;
        }
    }

    public static final int toNonNegativeInt(String str, int i2) {
        if (str != null) {
            try {
                long j2 = Long.parseLong(str);
                if (j2 > MPv3.MAX_MESSAGE_ID) {
                    return MPv3.MAX_MESSAGE_ID;
                }
                if (j2 < 0) {
                    return 0;
                }
                return (int) j2;
            } catch (NumberFormatException unused) {
            }
        }
        return i2;
    }

    public static final String trimSubstring(String str, int i2, int i3) {
        k.d(str, "$this$trimSubstring");
        int iIndexOfFirstNonAsciiWhitespace = indexOfFirstNonAsciiWhitespace(str, i2, i3);
        String strSubstring = str.substring(iIndexOfFirstNonAsciiWhitespace, indexOfLastNonAsciiWhitespace(str, iIndexOfFirstNonAsciiWhitespace, i3));
        k.c(strSubstring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
        return strSubstring;
    }

    public static /* synthetic */ String trimSubstring$default(String str, int i2, int i3, int i4, Object obj) {
        if ((i4 & 1) != 0) {
            i2 = 0;
        }
        if ((i4 & 2) != 0) {
            i3 = str.length();
        }
        return trimSubstring(str, i2, i3);
    }

    public static final void wait(Object obj) throws InterruptedException {
        k.d(obj, "$this$wait");
        obj.wait();
    }

    public static final Throwable withSuppressed(Exception exc, List<? extends Exception> list) {
        k.d(exc, "$this$withSuppressed");
        k.d(list, "suppressed");
        if (list.size() > 1) {
            System.out.println(list);
        }
        Iterator<? extends Exception> it = list.iterator();
        while (it.hasNext()) {
            b.a(exc, it.next());
        }
        return exc;
    }

    public static final void writeMedium(g gVar, int i2) throws IOException {
        k.d(gVar, "$this$writeMedium");
        gVar.writeByte((i2 >>> 16) & DisplayString.MAX_SIZE);
        gVar.writeByte((i2 >>> 8) & DisplayString.MAX_SIZE);
        gVar.writeByte(i2 & DisplayString.MAX_SIZE);
    }

    public static final int delimiterOffset(String str, char c2, int i2, int i3) {
        k.d(str, "$this$delimiterOffset");
        while (i2 < i3) {
            if (str.charAt(i2) == c2) {
                return i2;
            }
            i2++;
        }
        return i3;
    }

    public static /* synthetic */ int delimiterOffset$default(String str, char c2, int i2, int i3, int i4, Object obj) {
        if ((i4 & 2) != 0) {
            i2 = 0;
        }
        if ((i4 & 4) != 0) {
            i3 = str.length();
        }
        return delimiterOffset(str, c2, i2, i3);
    }

    public static final String toHexString(int i2) {
        String hexString = Integer.toHexString(i2);
        k.c(hexString, "Integer.toHexString(this)");
        return hexString;
    }

    public static final void closeQuietly(Socket socket) {
        k.d(socket, "$this$closeQuietly");
        try {
            socket.close();
        } catch (AssertionError e2) {
            throw e2;
        } catch (RuntimeException e3) {
            if (!k.a(e3.getMessage(), "bio == null")) {
                throw e3;
            }
        } catch (Exception unused) {
        }
    }

    public static final void closeQuietly(ServerSocket serverSocket) {
        k.d(serverSocket, "$this$closeQuietly");
        try {
            serverSocket.close();
        } catch (RuntimeException e2) {
            throw e2;
        } catch (Exception unused) {
        }
    }

    public static final int skipAll(i.f fVar, byte b) throws EOFException {
        k.d(fVar, "$this$skipAll");
        int i2 = 0;
        while (!fVar.B() && fVar.n(0L) == b) {
            i2++;
            fVar.readByte();
        }
        return i2;
    }
}
