package okio;

import java.io.Closeable;
import kotlin.Metadata;
import kotlin.a;
import kotlin.jvm.JvmName;
import nb.g;
import org.jetbrains.annotations.NotNull;
import sd.l;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u001a\n\u0010\u0002\u001a\u00020\u0001*\u00020\u0000\u001a\n\u0010\u0002\u001a\u00020\u0004*\u00020\u0003\u001a\u000f\u0010\u0007\u001a\u00020\u0003H\u0007¢\u0006\u0004\b\u0005\u0010\u0006\u001aC\u0010\u000e\u001a\u00028\u0001\"\u0010\b\u0000\u0010\n*\n\u0018\u00010\bj\u0004\u0018\u0001`\t\"\u0004\b\u0001\u0010\u000b*\u00028\u00002\u0012\u0010\r\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00028\u00010\fH\u0086\bø\u0001\u0000¢\u0006\u0004\b\u000e\u0010\u000f\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u0010"}, d2 = {"Lokio/Source;", "Lokio/BufferedSource;", "buffer", "Lokio/Sink;", "Lokio/BufferedSink;", "blackhole", "()Lokio/Sink;", "blackholeSink", "Ljava/io/Closeable;", "Lokio/Closeable;", "T", "R", "Lkotlin/Function1;", "block", "use", "(Ljava/io/Closeable;Lsd/l;)Ljava/lang/Object;", "okio"}, k = 5, mv = {1, 9, 0}, xs = "okio/Okio")
final /* synthetic */ class Okio__OkioKt {
    @JvmName(name = "blackhole")
    @NotNull
    public static final Sink blackhole() {
        return new BlackholeSink();
    }

    @NotNull
    public static final BufferedSource buffer(@NotNull Source source) {
        g.i(source, "<this>");
        return new RealBufferedSource(source);
    }

    public static final <T extends Closeable, R> R use(T t10, @NotNull l lVar) throws Throwable {
        R r10;
        g.i(lVar, "block");
        Throwable th = null;
        try {
            r10 = (R) lVar.invoke(t10);
            if (t10 != null) {
                try {
                    t10.close();
                } catch (Throwable th2) {
                    th = th2;
                }
            }
        } catch (Throwable th3) {
            if (t10 != null) {
                try {
                    t10.close();
                } catch (Throwable th4) {
                    a.a(th3, th4);
                }
            }
            th = th3;
            r10 = null;
        }
        if (th != null) {
            throw th;
        }
        g.f(r10);
        return r10;
    }

    @NotNull
    public static final BufferedSink buffer(@NotNull Sink sink) {
        g.i(sink, "<this>");
        return new RealBufferedSink(sink);
    }
}
