package i1;

import com.seewo.sdk.model.SDKKeyboardCode;
import e1.AbstractC0453a;
import java.io.UnsupportedEncodingException;
import l1.AbstractC0621d;

/* JADX INFO: renamed from: i1.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C0548b {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private static final String f4404e = AbstractC0453a.g("jcifs.netbios.scope");

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    static final String f4405f = AbstractC0453a.h("jcifs.encoding", System.getProperty("file.encoding"));

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public String f4406a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public String f4407b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f4408c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    int f4409d;

    C0548b() {
    }

    int a(byte[] bArr, int i2) {
        StringBuffer stringBuffer;
        int i3;
        int i4 = i2 + 1;
        int i5 = bArr[i2] & 255;
        if (i5 == 0) {
            this.f4407b = null;
            return 1;
        }
        try {
            stringBuffer = new StringBuffer(new String(bArr, i4, i5, f4405f));
            i3 = i4 + i5;
        } catch (UnsupportedEncodingException unused) {
        }
        while (true) {
            int i6 = i3 + 1;
            try {
                int i7 = bArr[i3] & 255;
                if (i7 == 0) {
                    break;
                }
                stringBuffer.append('.');
                stringBuffer.append(new String(bArr, i6, i7, f4405f));
                i3 = i7 + i6;
            } catch (UnsupportedEncodingException unused2) {
                i4 = i6;
                i6 = i4;
            }
            return i6 - i2;
        }
        this.f4407b = stringBuffer.toString();
        return i6 - i2;
    }

    int b(byte[] bArr, int i2) {
        byte[] bArr2 = new byte[33];
        int i3 = 15;
        for (int i4 = 0; i4 < 15; i4++) {
            int i5 = i4 * 2;
            byte b2 = (byte) (((bArr[(i5 + 1) + i2] & 255) - 65) << 4);
            bArr2[i4] = b2;
            byte b3 = (byte) (((byte) (((bArr[(i5 + 2) + i2] & 255) - 65) & 15)) | b2);
            bArr2[i4] = b3;
            if (b3 != 32) {
                i3 = i4 + 1;
            }
        }
        try {
            this.f4406a = new String(bArr2, 0, i3, f4405f);
        } catch (UnsupportedEncodingException unused) {
        }
        int i6 = ((bArr[i2 + 31] & 255) - 65) << 4;
        this.f4408c = i6;
        this.f4408c = i6 | (15 & ((bArr[i2 + 32] & 255) - 65));
        return a(bArr, i2 + 33) + 33;
    }

    int c(byte[] bArr, int i2) {
        String str = this.f4407b;
        if (str == null) {
            bArr[i2] = 0;
            return 1;
        }
        int i3 = i2 + 1;
        bArr[i2] = SDKKeyboardCode.FUNCTION_KEY_BOARD_PLUS;
        try {
            System.arraycopy(str.getBytes(f4405f), 0, bArr, i3, this.f4407b.length());
        } catch (UnsupportedEncodingException unused) {
        }
        int length = i3 + this.f4407b.length();
        bArr[length] = 0;
        int i4 = length - 1;
        int length2 = i4 - this.f4407b.length();
        int i5 = 0;
        while (true) {
            if (bArr[i4] == 46) {
                bArr[i4] = (byte) i5;
                i5 = 0;
            } else {
                i5++;
            }
            int i6 = i4 - 1;
            if (i4 <= length2) {
                return this.f4407b.length() + 2;
            }
            i4 = i6;
        }
    }

    int d(byte[] bArr, int i2) {
        bArr[i2] = SDKKeyboardCode.FUNCTION_KEY_BOARD_3;
        try {
            byte[] bytes = this.f4406a.getBytes(f4405f);
            int i3 = 0;
            while (i3 < bytes.length) {
                int i4 = i3 * 2;
                bArr[i4 + 1 + i2] = (byte) (((bytes[i3] & 240) >> 4) + 65);
                bArr[i4 + 2 + i2] = (byte) ((15 & bytes[i3]) + 65);
                i3++;
            }
            while (i3 < 15) {
                int i5 = i3 * 2;
                bArr[i5 + 1 + i2] = SDKKeyboardCode.FUNCTION_KEY_BOARD_F10;
                bArr[i5 + 2 + i2] = SDKKeyboardCode.FUNCTION_KEY_BOARD_F8;
                i3++;
            }
            int i6 = this.f4408c;
            bArr[i2 + 31] = (byte) (((i6 & 240) >> 4) + 65);
            bArr[i2 + 32] = (byte) ((i6 & 15) + 65);
        } catch (UnsupportedEncodingException unused) {
        }
        return c(bArr, i2 + 33) + 33;
    }

    public boolean equals(Object obj) {
        if (!(obj instanceof C0548b)) {
            return false;
        }
        C0548b c0548b = (C0548b) obj;
        return (this.f4407b == null && c0548b.f4407b == null) ? this.f4406a.equals(c0548b.f4406a) && this.f4408c == c0548b.f4408c : this.f4406a.equals(c0548b.f4406a) && this.f4408c == c0548b.f4408c && this.f4407b.equals(c0548b.f4407b);
    }

    public int hashCode() {
        int iHashCode = this.f4406a.hashCode() + (this.f4408c * 65599) + (this.f4409d * 65599);
        String str = this.f4407b;
        return (str == null || str.length() == 0) ? iHashCode : iHashCode + this.f4407b.hashCode();
    }

    public String toString() {
        StringBuffer stringBuffer = new StringBuffer();
        String str = this.f4406a;
        if (str == null) {
            str = "null";
        } else if (str.charAt(0) == 1) {
            char[] charArray = str.toCharArray();
            charArray[0] = '.';
            charArray[1] = '.';
            charArray[14] = '.';
            str = new String(charArray);
        }
        stringBuffer.append(str);
        stringBuffer.append("<");
        stringBuffer.append(AbstractC0621d.c(this.f4408c, 2));
        stringBuffer.append(">");
        if (this.f4407b != null) {
            stringBuffer.append(".");
            stringBuffer.append(this.f4407b);
        }
        return stringBuffer.toString();
    }

    public C0548b(String str, int i2, String str2) {
        this.f4406a = (str.length() > 15 ? str.substring(0, 15) : str).toUpperCase();
        this.f4408c = i2;
        this.f4407b = (str2 == null || str2.length() <= 0) ? f4404e : str2;
        this.f4409d = 0;
    }
}
