what-the-bank/sources/o/pmJ.java

344 lines
13 KiB
Java

package o;
import com.adobe.internal.xmp.XMPException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import okhttp3.HttpUrl;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
/* loaded from: classes.dex */
public final class pmJ {
/* JADX INFO: Access modifiers changed from: package-private */
public static sfI b(sfI sfi, String str, boolean z) throws XMPException {
if (sfi.g == null) {
sfi.g = new C14373frw();
}
if ((sfi.g.a & PKIFailureInfo.systemUnavail) == 0) {
if (sfi.g == null) {
sfi.g = new C14373frw();
}
if ((sfi.g.a & 256) == 0) {
if (!sfi.a) {
throw new XMPException("Named children only allowed for schemas and structs", 102);
}
if (sfi.g == null) {
sfi.g = new C14373frw();
}
if ((sfi.g.a & 512) != 0) {
throw new XMPException("Named children not allowed for arrays", 102);
}
if (z) {
if (sfi.g == null) {
sfi.g = new C14373frw();
}
sfi.g.a |= 256;
}
}
}
if (sfi.e == null) {
sfi.e = new ArrayList(0);
}
sfI b = sfI.b(sfi.e, str);
if (b != null || !z) {
return b;
}
sfI sfi2 = new sfI(str, new C14373frw());
sfi2.a = true;
sfi.c(sfi2);
return sfi2;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r14v5, types: [o.sfI] */
/* JADX WARN: Type inference failed for: r15v4 */
/* JADX WARN: Type inference failed for: r15v5, types: [int] */
/* JADX WARN: Type inference failed for: r15v8 */
public static sfI c(sfI sfi, AVp aVp, boolean z, C14373frw c14373frw) throws XMPException {
sfI sfi2;
int i;
boolean z2;
if (aVp == null || aVp.c.size() == 0) {
throw new XMPException("Empty XMPPath", 102);
}
C14373frw c14373frw2 = null;
boolean z3 = true;
sfI e = e(sfi, ((mrG) aVp.c.get(0)).b, null, true);
if (e == null) {
return null;
}
if (e.a) {
e.a = false;
sfi2 = e;
} else {
sfi2 = null;
}
int i2 = 1;
while (i2 < aVp.c.size()) {
try {
mrG mrg = (mrG) aVp.c.get(i2);
int i3 = mrg.e;
if (i3 == z3) {
e = b(e, mrg.b, z3);
} else if (i3 == 2) {
String substring = mrg.b.substring(z3 ? 1 : 0);
sfI b = sfI.b(e.h, substring);
if (b == null) {
b = new sfI(substring, c14373frw2);
b.a = z3;
e.d(b);
}
e = b;
} else {
if (e.g == null) {
e.g = new C14373frw();
}
if ((e.g.a & 512) == 0) {
throw new XMPException("Indexing applied to non-array", 102);
}
if (i3 == 3) {
i = c(e, mrg.b, z3);
} else if (i3 == 4) {
List list = e.e;
i = list != null ? list.size() : 0;
} else {
int i4 = -1;
if (i3 == 6) {
String[] a = C15974jzn.a(mrg.b);
String str = a[0];
String str2 = a[z3 ? 1 : 0];
int i5 = z3 ? 1 : 0;
while (true) {
List list2 = e.e;
if (i5 > (list2 != null ? list2.size() : 0) || i4 >= 0) {
break;
}
?? b2 = e.b(i5);
if (b2.g == null) {
b2.g = new C14373frw();
}
if ((b2.g.a & 256) == 0) {
throw new XMPException("Field selector must be used on array of struct", 102);
}
?? r15 = z3;
while (true) {
List list3 = b2.e;
if (r15 <= (list3 != null ? list3.size() : 0)) {
sfI b3 = b2.b(r15);
if (str.equals(b3.f) && str2.equals(b3.i)) {
i4 = i5;
break;
}
r15++;
}
}
i5++;
z3 = true;
}
} else if (i3 == 5) {
String[] a2 = C15974jzn.a(mrg.b);
String str3 = a2[0];
String str4 = a2[1];
int i6 = mrg.a;
if (!"xml:lang".equals(str3)) {
i = 1;
while (true) {
List list4 = e.e;
if (i >= (list4 != null ? list4.size() : 0)) {
break;
}
Iterator e2 = e.b(i).e();
while (e2.hasNext()) {
sfI sfi3 = (sfI) e2.next();
if (str3.equals(sfi3.f) && str4.equals(sfi3.i)) {
break;
}
}
i++;
}
} else {
int d = d(e, C15974jzn.d(str4));
if (d >= 0 || (i6 & 4096) <= 0) {
i = d;
} else {
sfI sfi4 = new sfI(HttpUrl.PATH_SEGMENT_ENCODE_SET_URI, null);
sfi4.d(new sfI("xml:lang", "x-default", null));
e.a(sfi4);
i = 1;
}
}
} else {
throw new XMPException("Unknown array indexing step in FollowXPathStep", 9);
}
i = i4;
}
if (i > 0) {
List list5 = e.e;
if (i <= (list5 != null ? list5.size() : 0)) {
e = e.b(i);
}
}
e = null;
}
if (e == null) {
b(sfi2);
return null;
}
c14373frw2 = null;
if (e.a) {
e.a = false;
if (i2 == 1 && ((mrG) aVp.c.get(i2)).c && ((mrG) aVp.c.get(i2)).a != 0) {
if (e.g == null) {
e.g = new C14373frw();
}
C14373frw c14373frw3 = e.g;
c14373frw3.a = ((mrG) aVp.c.get(i2)).a | c14373frw3.a;
z2 = true;
} else {
z2 = true;
if (i2 < aVp.c.size() - 1 && ((mrG) aVp.c.get(i2)).e == 1) {
if (e.g == null) {
e.g = new C14373frw();
}
if ((e.g.a & 768) <= 0) {
if (e.g == null) {
e.g = new C14373frw();
}
e.g.a |= 256;
}
}
}
if (sfi2 == null) {
sfi2 = e;
}
} else {
z2 = true;
}
i2++;
z3 = z2;
} catch (XMPException e3) {
if (sfi2 != null) {
b(sfi2);
}
throw e3;
}
}
if (sfi2 != null) {
if (e.g == null) {
e.g = new C14373frw();
}
C14373frw c14373frw4 = e.g;
if (c14373frw != null) {
c14373frw4.a(c14373frw.a | c14373frw4.a);
}
if (e.g == null) {
e.g = new C14373frw();
}
e.g = e.g;
}
return e;
}
private static int c(sfI sfi, String str, boolean z) throws XMPException {
try {
int parseInt = Integer.parseInt(str.substring(1, str.length() - 1));
if (parseInt <= 0) {
throw new XMPException("Array index must be larger than zero", 102);
}
if (z) {
List list = sfi.e;
if (parseInt == (list != null ? list.size() : 0) + 1) {
sfI sfi2 = new sfI(HttpUrl.PATH_SEGMENT_ENCODE_SET_URI, null);
sfi2.a = true;
sfi.c(sfi2);
}
}
return parseInt;
} catch (NumberFormatException unused) {
throw new XMPException("Array index not digits.", 102);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void a(sfI sfi, String str, String str2) throws XMPException {
sfI sfi2 = new sfI(HttpUrl.PATH_SEGMENT_ENCODE_SET_URI, str2, null);
sfI sfi3 = new sfI("xml:lang", str, null);
sfi2.d(sfi3);
if (!"x-default".equals(sfi3.i)) {
sfi.c(sfi2);
} else {
sfi.a(sfi2);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static int d(sfI sfi, String str) throws XMPException {
if (sfi.g == null) {
sfi.g = new C14373frw();
}
if ((sfi.g.a & 512) == 0) {
throw new XMPException("Language item must be used on array", 102);
}
int i = 1;
while (true) {
List list = sfi.e;
if (i > (list != null ? list.size() : 0)) {
return -1;
}
sfI b = sfi.b(i);
List list2 = b.h;
if (list2 != null && list2.size() > 0 && "xml:lang".equals(b.d(1).f) && str.equals(b.d(1).i)) {
return i;
}
i++;
}
}
private static void b(sfI sfi) {
sfI sfi2 = sfi.j;
if (sfi.g == null) {
sfi.g = new C14373frw();
}
if ((sfi.g.a & 32) != 0) {
sfi2.b(sfi);
} else {
sfi2.e(sfi);
}
List list = sfi2.e;
if (list == null || list.size() <= 0) {
if (sfi2.g == null) {
sfi2.g = new C14373frw();
}
if ((sfi2.g.a & PKIFailureInfo.systemUnavail) != 0) {
sfi2.j.e(sfi2);
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static sfI e(sfI sfi, String str, String str2, boolean z) throws XMPException {
if (sfi.e == null) {
sfi.e = new ArrayList(0);
}
sfI b = sfI.b(sfi.e, str);
if (b == null && z) {
C14373frw c14373frw = new C14373frw();
c14373frw.a = Integer.MIN_VALUE | c14373frw.a;
b = new sfI(str, c14373frw);
b.a = true;
String c = C1235Yps.c().c(str);
if (c == null) {
if (str2 != null && str2.length() != 0) {
c = C1235Yps.c().c(str, str2);
} else {
throw new XMPException("Unregistered schema namespace URI", 101);
}
}
b.i = c;
sfi.c(b);
}
return b;
}
}