package ῲ.ʬ.K.ῲ;

import java.util.Iterator;
import java.util.Map;
import java.util.WeakHashMap;
import ඓ.K.K.K.C1293;

/* renamed from: ῲ.ʬ.K.ῲ.ῲ  reason: contains not printable characters */
/* compiled from: SafeIterableMap */
public class C1499<K, V> implements Iterable<Map.Entry<K, V>> {

    /* renamed from: ʬ  reason: contains not printable characters */
    public C1500<K, V> f5540;

    /* renamed from: ඓ  reason: contains not printable characters */
    public int f5541 = 0;

    /* renamed from: ῲ  reason: contains not printable characters */
    public C1500<K, V> f5542;

    /* renamed from: 㸾  reason: contains not printable characters */
    public WeakHashMap<AbstractC1504<K, V>, Boolean> f5543 = new WeakHashMap<>();

    /* renamed from: ῲ.ʬ.K.ῲ.ῲ$ʬ  reason: contains not printable characters */
    /* compiled from: SafeIterableMap */
    public static class C1500<K, V> implements Map.Entry<K, V> {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final V f5544;

        /* renamed from: ඓ  reason: contains not printable characters */
        public C1500<K, V> f5545;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final K f5546;

        /* renamed from: 㸾  reason: contains not printable characters */
        public C1500<K, V> f5547;

        public C1500(K k, V v) {
            this.f5546 = k;
            this.f5544 = v;
        }

        public boolean equals(Object obj) {
            if (obj == this) {
                return true;
            }
            if (!(obj instanceof C1500)) {
                return false;
            }
            C1500 r5 = (C1500) obj;
            if (!this.f5546.equals(r5.f5546) || !this.f5544.equals(r5.f5544)) {
                return false;
            }
            return true;
        }

        @Override // java.util.Map.Entry
        public K getKey() {
            return this.f5546;
        }

        @Override // java.util.Map.Entry
        public V getValue() {
            return this.f5544;
        }

        public int hashCode() {
            return this.f5546.hashCode() ^ this.f5544.hashCode();
        }

        @Override // java.util.Map.Entry
        public V setValue(V v) {
            throw new UnsupportedOperationException("An entry modification is not supported");
        }

        public String toString() {
            return ((Object) this.f5546) + "=" + ((Object) this.f5544);
        }
    }

    /* renamed from: ῲ.ʬ.K.ῲ.ῲ$ῲ  reason: contains not printable characters */
    /* compiled from: SafeIterableMap */
    public static class C1502<K, V> extends AbstractC1501<K, V> {
        public C1502(C1500<K, V> r1, C1500<K, V> r2) {
            super(r1, r2);
        }

        @Override // ῲ.ʬ.K.ῲ.C1499.AbstractC1501
        /* renamed from: ʬ  reason: contains not printable characters */
        public C1500<K, V> m3837(C1500<K, V> r1) {
            return r1.f5545;
        }

        @Override // ῲ.ʬ.K.ῲ.C1499.AbstractC1501
        /* renamed from: ῲ  reason: contains not printable characters */
        public C1500<K, V> m3838(C1500<K, V> r1) {
            return r1.f5547;
        }
    }

    /* renamed from: ῲ.ʬ.K.ῲ.ῲ$K  reason: contains not printable characters */
    /* compiled from: SafeIterableMap */
    public static class C1503<K, V> extends AbstractC1501<K, V> {
        public C1503(C1500<K, V> r1, C1500<K, V> r2) {
            super(r1, r2);
        }

        @Override // ῲ.ʬ.K.ῲ.C1499.AbstractC1501
        /* renamed from: ʬ  reason: contains not printable characters */
        public C1500<K, V> m3839(C1500<K, V> r1) {
            return r1.f5547;
        }

        @Override // ῲ.ʬ.K.ῲ.C1499.AbstractC1501
        /* renamed from: ῲ  reason: contains not printable characters */
        public C1500<K, V> m3840(C1500<K, V> r1) {
            return r1.f5545;
        }
    }

    /* renamed from: ῲ.ʬ.K.ῲ.ῲ$㴹  reason: contains not printable characters */
    /* compiled from: SafeIterableMap */
    public interface AbstractC1504<K, V> {
        /* renamed from: K  reason: contains not printable characters */
        void m3841(C1500<K, V> v);
    }

    /* renamed from: ῲ.ʬ.K.ῲ.ῲ$㸾  reason: contains not printable characters */
    /* compiled from: SafeIterableMap */
    public class C1505 implements Iterator<Map.Entry<K, V>>, AbstractC1504<K, V> {

        /* renamed from: ʬ  reason: contains not printable characters */
        public boolean f5550 = true;

        /* renamed from: ῲ  reason: contains not printable characters */
        public C1500<K, V> f5551;

        public C1505() {
        }

        public boolean hasNext() {
            if (!this.f5550) {
                C1500<K, V> r0 = this.f5551;
                if (r0 == null || r0.f5547 == null) {
                    return false;
                }
                return true;
            } else if (C1499.this.f5542 != null) {
                return true;
            } else {
                return false;
            }
        }

        @Override // java.util.Iterator
        public Object next() {
            if (this.f5550) {
                this.f5550 = false;
                this.f5551 = C1499.this.f5542;
            } else {
                C1500<K, V> r0 = this.f5551;
                this.f5551 = r0 != null ? r0.f5547 : null;
            }
            return this.f5551;
        }

        @Override // ῲ.ʬ.K.ῲ.C1499.AbstractC1504
        /* renamed from: K  reason: contains not printable characters */
        public void m3842(C1500<K, V> r2) {
            C1500<K, V> r0 = this.f5551;
            if (r2 == r0) {
                this.f5551 = r0.f5545;
                this.f5550 = this.f5551 == null;
            }
        }
    }

    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof C1499)) {
            return false;
        }
        C1499 r6 = (C1499) obj;
        if (this.f5541 != r6.f5541) {
            return false;
        }
        Iterator<Map.Entry<K, V>> it2 = iterator();
        Iterator<Map.Entry<K, V>> it3 = r6.iterator();
        while (it2.hasNext() && it3.hasNext()) {
            Map.Entry<K, V> next = it2.next();
            Map.Entry<K, V> next2 = it3.next();
            if ((next == null && next2 != null) || (next != null && !next.equals(next2))) {
                return false;
            }
        }
        if (it2.hasNext() || it3.hasNext()) {
            return false;
        }
        return true;
    }

    public int hashCode() {
        Iterator<Map.Entry<K, V>> it2 = iterator();
        int i = 0;
        while (it2.hasNext()) {
            i += it2.next().hashCode();
        }
        return i;
    }

    @Override // java.lang.Iterable
    public Iterator<Map.Entry<K, V>> iterator() {
        C1503 k = new C1503(this.f5542, this.f5540);
        this.f5543.put(k, false);
        return k;
    }

    public V remove(K k) {
        C1500<K, V> r4 = m3830(k);
        if (r4 == null) {
            return null;
        }
        this.f5541--;
        if (!this.f5543.isEmpty()) {
            for (AbstractC1504<K, V> r2 : this.f5543.keySet()) {
                r2.m3841(r4);
            }
        }
        C1500<K, V> r1 = r4.f5545;
        if (r1 != null) {
            r1.f5547 = r4.f5547;
        } else {
            this.f5542 = r4.f5547;
        }
        C1500<K, V> r12 = r4.f5547;
        if (r12 != null) {
            r12.f5545 = r4.f5545;
        } else {
            this.f5540 = r4.f5545;
        }
        r4.f5547 = null;
        r4.f5545 = null;
        return r4.f5544;
    }

    public String toString() {
        StringBuilder r0 = C1293.m3416("[");
        Iterator<Map.Entry<K, V>> it2 = iterator();
        while (it2.hasNext()) {
            r0.append(it2.next().toString());
            if (it2.hasNext()) {
                r0.append(", ");
            }
        }
        r0.append("]");
        return r0.toString();
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public V m3829(K k, V v) {
        C1500<K, V> r0 = m3830(k);
        if (r0 != null) {
            return r0.f5544;
        }
        m3831(k, v);
        return null;
    }

    /* renamed from: K  reason: contains not printable characters */
    public C1500<K, V> m3830(K k) {
        C1500<K, V> r0 = this.f5542;
        while (r0 != null && !r0.f5546.equals(k)) {
            r0 = r0.f5547;
        }
        return r0;
    }

    /* renamed from: K  reason: contains not printable characters */
    public C1500<K, V> m3831(K k, V v) {
        C1500<K, V> r0 = new C1500<>(k, v);
        this.f5541++;
        C1500<K, V> r2 = this.f5540;
        if (r2 == null) {
            this.f5542 = r0;
            this.f5540 = this.f5542;
            return r0;
        }
        r2.f5547 = r0;
        r0.f5545 = r2;
        this.f5540 = r0;
        return r0;
    }

    /* renamed from: ῲ.ʬ.K.ῲ.ῲ$ඓ  reason: contains not printable characters */
    /* compiled from: SafeIterableMap */
    public static abstract class AbstractC1501<K, V> implements Iterator<Map.Entry<K, V>>, AbstractC1504<K, V> {

        /* renamed from: ʬ  reason: contains not printable characters */
        public C1500<K, V> f5548;

        /* renamed from: ῲ  reason: contains not printable characters */
        public C1500<K, V> f5549;

        public AbstractC1501(C1500<K, V> r1, C1500<K, V> r2) {
            this.f5549 = r2;
            this.f5548 = r1;
        }

        public boolean hasNext() {
            return this.f5548 != null;
        }

        @Override // java.util.Iterator
        public Object next() {
            C1500<K, V> r0 = this.f5548;
            this.f5548 = m3835();
            return r0;
        }

        /* renamed from: ʬ  reason: contains not printable characters */
        public abstract C1500<K, V> m3833(C1500<K, V> v);

        /* renamed from: ῲ  reason: contains not printable characters */
        public abstract C1500<K, V> m3834(C1500<K, V> v);

        @Override // ῲ.ʬ.K.ῲ.C1499.AbstractC1504
        /* renamed from: K  reason: contains not printable characters */
        public void m3836(C1500<K, V> r3) {
            C1500<K, V> r1 = null;
            if (this.f5549 == r3 && r3 == this.f5548) {
                this.f5548 = null;
                this.f5549 = null;
            }
            C1500<K, V> r0 = this.f5549;
            if (r0 == r3) {
                this.f5549 = m3834(r0);
            }
            C1500<K, V> r02 = this.f5548;
            if (r02 == r3) {
                C1500<K, V> r32 = this.f5549;
                if (!(r02 == r32 || r32 == null)) {
                    r1 = m3833(r02);
                }
                this.f5548 = r1;
            }
        }

        /* renamed from: K  reason: contains not printable characters */
        public final C1500<K, V> m3835() {
            C1500<K, V> r0 = this.f5548;
            C1500<K, V> r1 = this.f5549;
            if (r0 == r1 || r1 == null) {
                return null;
            }
            return m3833(r0);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public C1499<K, V>.C1505 m3832() {
        C1499<K, V>.C1505 r0 = new C1505();
        this.f5543.put(r0, false);
        return r0;
    }
}
