package o; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicReference; /* renamed from: o.fUU, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C13221fUU implements Iterable { private InterfaceC13169fSq e; public C13221fUU(InterfaceC13169fSq interfaceC13169fSq) { this.e = interfaceC13169fSq; } @Override // java.lang.Iterable public final Iterator iterator() { Sts sts = new Sts(); AbstractC13163fSk.wrap(this.e).materialize().subscribe(sts); return sts; } /* renamed from: o.fUU$Sts */ /* loaded from: classes6.dex */ static final class Sts extends AbstractC13403fZf> implements Iterator { private C13166fSn d; private Semaphore a = new Semaphore(0); private AtomicReference> e = new AtomicReference<>(); @Override // o.InterfaceC13174fSv public final void onComplete() { } Sts() { } @Override // o.InterfaceC13174fSv public final /* synthetic */ void onNext(Object obj) { if (this.e.getAndSet((C13166fSn) obj) == null) { this.a.release(); } } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { C13418fZu.c(th); } @Override // java.util.Iterator public final boolean hasNext() { C13166fSn c13166fSn = this.d; if (c13166fSn != null && fYX.b(c13166fSn.a)) { Object obj = this.d.a; throw fYR.c(fYX.b(obj) ? fYX.a(obj) : null); } if (this.d == null) { try { this.a.acquire(); C13166fSn andSet = this.e.getAndSet(null); this.d = andSet; if (fYX.b(andSet.a)) { Object obj2 = andSet.a; throw fYR.c(fYX.b(obj2) ? fYX.a(obj2) : null); } } catch (InterruptedException e) { dispose(); this.d = C13166fSn.a((Throwable) e); throw fYR.c(e); } } Object obj3 = this.d.a; return (obj3 == null || fYX.b(obj3)) ? false : true; } @Override // java.util.Iterator public final T next() { if (hasNext()) { C13166fSn c13166fSn = this.d; Object obj = c13166fSn.a; T t = (obj == null || fYX.b(obj)) ? null : (T) c13166fSn.a; this.d = null; return t; } throw new NoSuchElementException(); } @Override // java.util.Iterator public final void remove() { throw new UnsupportedOperationException("Read-only iterator."); } } }