content: package okhttp3.internal.cache;
  
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.NoSuchElementException;
  import kotlin.Metadata;
  import kotlin.Unit;
  import kotlin.jvm.internal.Intrinsics;
  import kotlin.jvm.internal.markers.KMutableIterator;
  import okhttp3.internal.cache.DiskLruCache;
  
  @Metadata(bv = {1, 0, 3}, d1 = {"\u0000)\n\u0000\n\u0002\u0010)\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\f\u0012\b\u0012\u00060\u0002R\u00020\u00030\u0001J\t\u0010\t\u001a\u00020\nH\u0002J\r\u0010\u000b\u001a\u00060\u0002R\u00020\u0003H\u0002J\b\u0010\f\u001a\u00020\rH\u0016R$\u0010\u0004\u001a\u0018\u0012\u0014\u0012\u0012 \u0006*\b\u0018\u00010\u0005R\u00020\u00030\u0005R\u00020\u00030\u0001X\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0007\u001a\b\u0018\u00010\u0002R\u00020\u0003X\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\b\u001a\b\u0018\u00010\u0002R\u00020\u0003X\u000e¢\u0006\u0002\n\u0000¨\u0006\u000e"}, d2 = {"okhttp3/internal/cache/DiskLruCache$snapshots$1", "", "Lokhttp3/internal/cache/DiskLruCache$Snapshot;", "Lokhttp3/internal/cache/DiskLruCache;", "delegate", "Lokhttp3/internal/cache/DiskLruCache$Entry;", "kotlin.jvm.PlatformType", "nextSnapshot", "removeSnapshot", "hasNext", "", "next", "remove", "", "okhttp"}, k = 1, mv = {1, 4, 0})
  /* compiled from: DiskLruCache.kt */
  public final class DiskLruCache$snapshots$1 implements Iterator<DiskLruCache.Snapshot>, KMutableIterator {
      private final Iterator<DiskLruCache.Entry> delegate;
      private DiskLruCache.Snapshot nextSnapshot;
      private DiskLruCache.Snapshot removeSnapshot;
      final /* synthetic */ DiskLruCache this$0;
  
      DiskLruCache$snapshots$1(DiskLruCache this$02) {
          this.this$0 = this$02;
          Iterator<DiskLruCache.Entry> it = new ArrayList(this$02.getLruEntries$okhttp().values()).iterator();
          Intrinsics.checkNotNullExpressionValue(it, "ArrayList(lruEntries.values).iterator()");
          this.delegate = it;
      }
  
      public boolean hasNext() {
          DiskLruCache.Snapshot snapshot$okhttp;
          if (this.nextSnapshot != null) {
              return true;
          }
          synchronized (this.this$0) {
              if (this.this$0.getClosed$okhttp()) {
                  return false;
              }
              while (this.delegate.hasNext()) {
                  DiskLruCache.Entry next = this.delegate.next();
                  if (next != null && (snapshot$okhttp = next.snapshot$okhttp()) != null) {
                      this.nextSnapshot = snapshot$okhttp;
                      return true;
                  }
              }
              Unit unit = Unit.INSTANCE;
              return false;
          }
      }
  
      public DiskLruCache.Snapshot next() {
          if (hasNext()) {
              DiskLruCache.Snapshot snapshot = this.nextSnapshot;
              this.removeSnapshot = snapshot;
              DiskLruCache.Snapshot snapshot2 = null;
              this.nextSnapshot = null;
              Intrinsics.checkNotNull(snapshot);
              return snapshot;
          }
          throw new NoSuchElementException();
      }
  
      public void remove() {
          DiskLruCache.Snapshot snapshot = this.removeSnapshot;
          if (snapshot != null) {
              try {
                  this.this$0.remove(snapshot.key());
              } catch (IOException e) {
              } catch (Throwable th) {
                  DiskLruCache.Snapshot snapshot2 = null;
                  this.removeSnapshot = null;
                  throw th;
              }
              DiskLruCache.Snapshot snapshot3 = null;
              this.removeSnapshot = null;
              return;
          }
          throw new IllegalStateException("remove() before next()".toString());
      }
  }
  