package o;

import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class VQ {
    public final LinkedHashMap a;
    public final OD b;

    public VQ(LinkedHashMap linkedHashMap, boolean z) {
        this.a = linkedHashMap;
        this.b = new OD(z);
    }

    public final Map a() {
        C3001yV c3001yV;
        Set<Map.Entry> setEntrySet = this.a.entrySet();
        int iZ = GN.Z(AbstractC0034Bi.W(setEntrySet, 10));
        if (iZ < 16) {
            iZ = 16;
        }
        LinkedHashMap linkedHashMap = new LinkedHashMap(iZ);
        for (Map.Entry entry : setEntrySet) {
            Object value = entry.getValue();
            if (value instanceof byte[]) {
                byte[] bArr = (byte[]) value;
                c3001yV = new C3001yV(entry.getKey(), Arrays.copyOf(bArr, bArr.length));
            } else {
                c3001yV = new C3001yV(entry.getKey(), entry.getValue());
            }
            linkedHashMap.put(c3001yV.l, c3001yV.m);
        }
        return Collections.unmodifiableMap(linkedHashMap);
    }

    public final void b() {
        if (((AtomicBoolean) this.b.m).get()) {
            throw new IllegalStateException("Do mutate preferences once returned to DataStore.");
        }
    }

    public final Object c(C1770lY c1770lY) {
        Object obj = this.a.get(c1770lY);
        if (!(obj instanceof byte[])) {
            return obj;
        }
        byte[] bArr = (byte[]) obj;
        return Arrays.copyOf(bArr, bArr.length);
    }

    public final void d(C1770lY c1770lY, Object obj) {
        b();
        LinkedHashMap linkedHashMap = this.a;
        if (obj == null) {
            b();
            linkedHashMap.remove(c1770lY);
        } else if (obj instanceof Set) {
            linkedHashMap.put(c1770lY, Collections.unmodifiableSet(AbstractC3117zi.w0((Set) obj)));
        } else if (!(obj instanceof byte[])) {
            linkedHashMap.put(c1770lY, obj);
        } else {
            byte[] bArr = (byte[]) obj;
            linkedHashMap.put(c1770lY, Arrays.copyOf(bArr, bArr.length));
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:27:0x005d  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean equals(java.lang.Object r7) {
        /*
            r6 = this;
            boolean r0 = r7 instanceof o.VQ
            r1 = 0
            if (r0 != 0) goto L6
            goto L60
        L6:
            o.VQ r7 = (o.VQ) r7
            java.util.LinkedHashMap r7 = r7.a
            java.util.LinkedHashMap r0 = r6.a
            r2 = 1
            if (r7 != r0) goto L10
            goto L61
        L10:
            int r3 = r7.size()
            int r4 = r0.size()
            if (r3 == r4) goto L1b
            goto L60
        L1b:
            boolean r3 = r7.isEmpty()
            if (r3 == 0) goto L22
            goto L61
        L22:
            java.util.Set r7 = r7.entrySet()
            java.util.Iterator r7 = r7.iterator()
        L2a:
            boolean r3 = r7.hasNext()
            if (r3 == 0) goto L61
            java.lang.Object r3 = r7.next()
            java.util.Map$Entry r3 = (java.util.Map.Entry) r3
            java.lang.Object r4 = r3.getKey()
            java.lang.Object r4 = r0.get(r4)
            if (r4 == 0) goto L5d
            java.lang.Object r3 = r3.getValue()
            boolean r5 = r3 instanceof byte[]
            if (r5 == 0) goto L58
            boolean r5 = r4 instanceof byte[]
            if (r5 == 0) goto L5d
            byte[] r3 = (byte[]) r3
            byte[] r4 = (byte[]) r4
            boolean r3 = java.util.Arrays.equals(r3, r4)
            if (r3 == 0) goto L5d
            r3 = r2
            goto L5e
        L58:
            boolean r3 = o.F3.c(r3, r4)
            goto L5e
        L5d:
            r3 = r1
        L5e:
            if (r3 != 0) goto L2a
        L60:
            return r1
        L61:
            return r2
        */
        throw new UnsupportedOperationException("Method not decompiled: o.VQ.equals(java.lang.Object):boolean");
    }

    public final int hashCode() {
        Iterator it = this.a.entrySet().iterator();
        int iHashCode = 0;
        while (it.hasNext()) {
            Object value = ((Map.Entry) it.next()).getValue();
            iHashCode += value instanceof byte[] ? Arrays.hashCode((byte[]) value) : value.hashCode();
        }
        return iHashCode;
    }

    public final String toString() {
        return AbstractC3117zi.i0(this.a.entrySet(), ",\n", "{\n", "\n}", C2291qw.w, 24);
    }

    public /* synthetic */ VQ(boolean z) {
        this(new LinkedHashMap(), z);
    }
}
