package com.google.android.recaptcha.internal;

import P4.f;
import P4.g;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Objects;
import x4.AbstractC3226C;
import x4.AbstractC3251q;
import x4.AbstractC3253s;

/* JADX INFO: loaded from: classes3.dex */
public final class zzht implements zzgx {
    public static final zzht zza = new zzht();

    private zzht() {
    }

    @Override // com.google.android.recaptcha.internal.zzgx
    public final void zza(int i6, zzgd zzgdVar, zzue... zzueVarArr) throws zzce {
        if (zzueVarArr.length != 2) {
            throw new zzce(4, 3, null);
        }
        Object objZza = zzgdVar.zzc().zza(zzueVarArr[0]);
        if (true != Objects.nonNull(objZza)) {
            objZza = null;
        }
        if (objZza == null) {
            throw new zzce(4, 5, null);
        }
        Object objZza2 = zzgdVar.zzc().zza(zzueVarArr[1]);
        if (true != Objects.nonNull(objZza2)) {
            objZza2 = null;
        }
        if (objZza2 == null) {
            throw new zzce(4, 5, null);
        }
        zzgdVar.zzc().zze(i6, zzb(objZza, objZza2));
    }

    public final Object zzb(Object obj, Object obj2) throws zzce {
        boolean z6 = obj instanceof Byte;
        if (z6 && (obj2 instanceof Byte)) {
            return Byte.valueOf((byte) (((Number) obj).byteValue() ^ ((Number) obj2).byteValue()));
        }
        boolean z7 = obj instanceof Short;
        if (z7 && (obj2 instanceof Short)) {
            return Short.valueOf((short) (((Number) obj).shortValue() ^ ((Number) obj2).shortValue()));
        }
        boolean z8 = obj instanceof Integer;
        if (z8 && (obj2 instanceof Integer)) {
            return Integer.valueOf(((Number) obj).intValue() ^ ((Number) obj2).intValue());
        }
        boolean z9 = obj instanceof Long;
        if (z9 && (obj2 instanceof Long)) {
            return Long.valueOf(((Number) obj2).longValue() ^ ((Number) obj).longValue());
        }
        int i6 = 0;
        if (obj instanceof String) {
            if (obj2 instanceof Byte) {
                byte[] bytes = ((String) obj).getBytes(S4.a.f6257a);
                int length = bytes.length;
                ArrayList arrayList = new ArrayList(length);
                while (i6 < length) {
                    arrayList.add(Byte.valueOf((byte) (bytes[i6] ^ ((Number) obj2).byteValue())));
                    i6++;
                }
                return AbstractC3251q.z0(arrayList);
            }
            if (obj2 instanceof Integer) {
                char[] charArray = ((String) obj).toCharArray();
                int length2 = charArray.length;
                ArrayList arrayList2 = new ArrayList(length2);
                while (i6 < length2) {
                    arrayList2.add(Integer.valueOf(charArray[i6] ^ ((Number) obj2).intValue()));
                    i6++;
                }
                return AbstractC3251q.B0(arrayList2);
            }
        }
        if (z6 && (obj2 instanceof byte[])) {
            byte[] bArr = (byte[]) obj2;
            ArrayList arrayList3 = new ArrayList(bArr.length);
            for (byte b5 : bArr) {
                arrayList3.add(Byte.valueOf((byte) (b5 ^ ((Number) obj).byteValue())));
            }
            return arrayList3.toArray(new Byte[0]);
        }
        if (z7 && (obj2 instanceof short[])) {
            short[] sArr = (short[]) obj2;
            ArrayList arrayList4 = new ArrayList(sArr.length);
            for (short s6 : sArr) {
                arrayList4.add(Short.valueOf((short) (s6 ^ ((Number) obj).shortValue())));
            }
            return arrayList4.toArray(new Short[0]);
        }
        if (z8 && (obj2 instanceof int[])) {
            int[] iArr = (int[]) obj2;
            ArrayList arrayList5 = new ArrayList(iArr.length);
            for (int i7 : iArr) {
                arrayList5.add(Integer.valueOf(i7 ^ ((Number) obj).intValue()));
            }
            return arrayList5.toArray(new Integer[0]);
        }
        if (z9 && (obj2 instanceof long[])) {
            long[] jArr = (long[]) obj2;
            ArrayList arrayList6 = new ArrayList(jArr.length);
            for (long j4 : jArr) {
                arrayList6.add(Long.valueOf(j4 ^ ((Number) obj).longValue()));
            }
            return arrayList6.toArray(new Long[0]);
        }
        boolean z10 = obj instanceof byte[];
        if (z10 && (obj2 instanceof Byte)) {
            byte[] bArr2 = (byte[]) obj;
            ArrayList arrayList7 = new ArrayList(bArr2.length);
            for (byte b6 : bArr2) {
                arrayList7.add(Byte.valueOf((byte) (b6 ^ ((Number) obj2).byteValue())));
            }
            return arrayList7.toArray(new Byte[0]);
        }
        boolean z11 = obj instanceof short[];
        if (z11 && (obj2 instanceof Short)) {
            short[] sArr2 = (short[]) obj;
            ArrayList arrayList8 = new ArrayList(sArr2.length);
            for (short s7 : sArr2) {
                arrayList8.add(Short.valueOf((short) (s7 ^ ((Number) obj2).shortValue())));
            }
            return arrayList8.toArray(new Short[0]);
        }
        boolean z12 = obj instanceof int[];
        if (z12 && (obj2 instanceof Integer)) {
            int[] iArr2 = (int[]) obj;
            ArrayList arrayList9 = new ArrayList(iArr2.length);
            for (int i8 : iArr2) {
                arrayList9.add(Integer.valueOf(i8 ^ ((Number) obj2).intValue()));
            }
            return arrayList9.toArray(new Integer[0]);
        }
        boolean z13 = obj instanceof long[];
        if (z13 && (obj2 instanceof Long)) {
            long[] jArr2 = (long[]) obj;
            ArrayList arrayList10 = new ArrayList(jArr2.length);
            for (long j6 : jArr2) {
                arrayList10.add(Long.valueOf(j6 ^ ((Number) obj2).longValue()));
            }
            return arrayList10.toArray(new Long[0]);
        }
        if (z10 && (obj2 instanceof byte[])) {
            byte[] bArr3 = (byte[]) obj;
            int length3 = bArr3.length;
            byte[] bArr4 = (byte[]) obj2;
            zzgw.zza(this, length3, bArr4.length);
            g gVarL0 = L4.a.l0(0, length3);
            ArrayList arrayList11 = new ArrayList(AbstractC3253s.G(gVarL0, 10));
            Iterator it = gVarL0.iterator();
            while (((f) it).f5681c) {
                int iA = ((AbstractC3226C) it).a();
                arrayList11.add(Byte.valueOf((byte) (bArr4[iA] ^ bArr3[iA])));
            }
            return arrayList11.toArray(new Byte[0]);
        }
        if (z11 && (obj2 instanceof short[])) {
            short[] sArr3 = (short[]) obj;
            int length4 = sArr3.length;
            short[] sArr4 = (short[]) obj2;
            zzgw.zza(this, length4, sArr4.length);
            g gVarL02 = L4.a.l0(0, length4);
            ArrayList arrayList12 = new ArrayList(AbstractC3253s.G(gVarL02, 10));
            Iterator it2 = gVarL02.iterator();
            while (((f) it2).f5681c) {
                int iA2 = ((AbstractC3226C) it2).a();
                arrayList12.add(Short.valueOf((short) (sArr4[iA2] ^ sArr3[iA2])));
            }
            return arrayList12.toArray(new Short[0]);
        }
        if (z12 && (obj2 instanceof int[])) {
            int[] iArr3 = (int[]) obj;
            int length5 = iArr3.length;
            int[] iArr4 = (int[]) obj2;
            zzgw.zza(this, length5, iArr4.length);
            g gVarL03 = L4.a.l0(0, length5);
            ArrayList arrayList13 = new ArrayList(AbstractC3253s.G(gVarL03, 10));
            Iterator it3 = gVarL03.iterator();
            while (((f) it3).f5681c) {
                int iA3 = ((AbstractC3226C) it3).a();
                arrayList13.add(Integer.valueOf(iArr4[iA3] ^ iArr3[iA3]));
            }
            return arrayList13.toArray(new Integer[0]);
        }
        if (!z13 || !(obj2 instanceof long[])) {
            throw new zzce(4, 5, null);
        }
        long[] jArr3 = (long[]) obj;
        int length6 = jArr3.length;
        long[] jArr4 = (long[]) obj2;
        zzgw.zza(this, length6, jArr4.length);
        g gVarL04 = L4.a.l0(0, length6);
        ArrayList arrayList14 = new ArrayList(AbstractC3253s.G(gVarL04, 10));
        Iterator it4 = gVarL04.iterator();
        while (((f) it4).f5681c) {
            int iA4 = ((AbstractC3226C) it4).a();
            arrayList14.add(Long.valueOf(jArr3[iA4] ^ jArr4[iA4]));
        }
        return arrayList14.toArray(new Long[0]);
    }
}
