package j5; import i5.b; import i5.d; import java.util.ArrayList; import java.util.Iterator; import okhttp3.HttpUrl; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class e { public static n a(l lVar, n nVar, Node node, String str, boolean z14) throws b { i5.e eVar = d.f85123a; String namespaceURI = node.getNamespaceURI(); if (namespaceURI != null) { if ("http://purl.org/dc/1.1/".equals(namespaceURI)) { namespaceURI = "http://purl.org/dc/elements/1.1/"; } q qVar = (q) eVar; String b14 = qVar.b(namespaceURI); if (b14 == null) { b14 = qVar.e(namespaceURI, node.getPrefix() != null ? node.getPrefix() : "_dflt"); } StringBuilder a14 = b.d.a(b14); a14.append(node.getLocalName()); String sb4 = a14.toString(); l5.e eVar2 = new l5.e(); boolean z15 = false; if (z14) { nVar = o.e(lVar.f90522b, namespaceURI, "_dflt", true); nVar.f90531h = false; if (qVar.a(sb4) != null) { lVar.f90522b.f90532i = true; nVar.f90532i = true; z15 = true; } } boolean equals = "rdf:li".equals(sb4); boolean equals2 = "rdf:value".equals(sb4); n nVar2 = new n(sb4, str, eVar2); nVar2.f90533j = z15; if (!equals2) { nVar.c(nVar2); } else { nVar.a(1, nVar2); } if (equals2) { if (z14 || !nVar.n().l()) { throw new b("Misplaced rdf:value element", 202); } nVar.f90534k = true; } if (equals) { if (nVar.n().g()) { nVar2.f90525b = HttpUrl.PATH_SEGMENT_ENCODE_SET_URI; } else { throw new b("Misplaced rdf:li element", 202); } } return nVar2; } throw new b("XML namespace required for all elements and attributes", 202); } public static n b(n nVar, String str, String str2) throws b { if ("xml:lang".equals(str)) { str2 = h.e(str2); } n nVar2 = new n(str, str2, null); nVar.d(nVar2); return nVar2; } public static void c(n nVar) throws b { n j14 = nVar.j(1); if (j14.n().f()) { if (!nVar.n().f()) { n p14 = j14.p(1); j14.G(p14); nVar.d(p14); } else { throw new b("Redundant xml:lang for rdf:value element", 203); } } for (int i14 = 1; i14 <= j14.x(); i14++) { nVar.d(j14.p(i14)); } for (int i15 = 2; i15 <= nVar.m(); i15++) { nVar.d(nVar.j(i15)); } nVar.f90534k = false; nVar.n().e(256, false); nVar.n().m(j14.n()); nVar.f90526c = j14.f90526c; nVar.f90528e = null; Iterator B = j14.B(); while (B.hasNext()) { nVar.c((n) B.next()); } } public static int d(Node node) { String localName = node.getLocalName(); String namespaceURI = node.getNamespaceURI(); if (namespaceURI == null && (("about".equals(localName) || "ID".equals(localName)) && (node instanceof Attr) && "http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(((Attr) node).getOwnerElement().getNamespaceURI()))) { namespaceURI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; } if (!"http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(namespaceURI)) { return 0; } if ("li".equals(localName)) { return 9; } if ("parseType".equals(localName)) { return 4; } if ("Description".equals(localName)) { return 8; } if ("about".equals(localName)) { return 3; } if ("resource".equals(localName)) { return 5; } if ("RDF".equals(localName)) { return 1; } if ("ID".equals(localName)) { return 2; } if ("nodeID".equals(localName)) { return 6; } if ("datatype".equals(localName)) { return 7; } if ("aboutEach".equals(localName)) { return 10; } if ("aboutEachPrefix".equals(localName)) { return 11; } return "bagID".equals(localName) ? 12 : 0; } public static boolean e(Node node) { if (node.getNodeType() != 3) { return false; } String nodeValue = node.getNodeValue(); for (int i14 = 0; i14 < nodeValue.length(); i14++) { if (!Character.isWhitespace(nodeValue.charAt(i14))) { return false; } } return true; } /* JADX WARNING: Removed duplicated region for block: B:59:0x00f0 */ public static void f(l lVar, n nVar, Node node, boolean z14) throws b { boolean z15; int i14; String str; String str2; if (!node.hasChildNodes()) { Node node2 = null; boolean z16 = false; boolean z17 = false; boolean z18 = false; boolean z19 = false; for (int i15 = 0; i15 < node.getAttributes().getLength(); i15++) { Node item = node.getAttributes().item(i15); if (!"xmlns".equals(item.getPrefix()) && (item.getPrefix() != null || !"xmlns".equals(item.getNodeName()))) { int d14 = d(item); if (d14 != 0) { if (d14 == 2) { continue; } else if (d14 != 5) { if (d14 != 6) { throw new b("Unrecognized attribute of empty property element", 202); } else if (!z17) { z19 = true; } else { throw new b("Empty property element can't have both rdf:resource and rdf:nodeID", 202); } } else if (z19) { throw new b("Empty property element can't have both rdf:resource and rdf:nodeID", 202); } else if (!z16) { if (!z16) { node2 = item; } z17 = true; } else { throw new b("Empty property element can't have both rdf:value and rdf:resource", 203); } } else if (!"value".equals(item.getLocalName()) || !"http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(item.getNamespaceURI())) { if (!"xml:lang".equals(item.getNodeName())) { z18 = true; } } else if (!z17) { node2 = item; z16 = true; } else { throw new b("Empty property element can't have both rdf:value and rdf:resource", 203); } } } String str3 = ""; n a14 = a(lVar, nVar, node, str3, z14); if (z16 || z17) { if (node2 != null) { str3 = node2.getNodeValue(); } a14.f90526c = str3; if (!z16) { a14.n().e(2, true); } } else if (z18) { z15 = true; a14.n().e(256, true); for (i14 = 0; i14 < node.getAttributes().getLength(); i14++) { Node item2 = node.getAttributes().item(i14); if (item2 != node2 && !"xmlns".equals(item2.getPrefix()) && (item2.getPrefix() != null || !"xmlns".equals(item2.getNodeName()))) { int d15 = d(item2); if (d15 == 0) { str = item2.getNodeName(); if (!z15) { str2 = item2.getNodeValue(); } else if ("xml:lang".equals(str)) { b(a14, "xml:lang", item2.getNodeValue()); } else { a(lVar, a14, item2, item2.getNodeValue(), false); } } else if (d15 != 2) { if (d15 == 5) { str2 = item2.getNodeValue(); str = "rdf:resource"; } else if (d15 != 6) { throw new b("Unrecognized attribute of empty property element", 202); } } b(a14, str, str2); } } return; } z15 = false; while (i14 < node.getAttributes().getLength()) { } return; } throw new b("Nested content not allowed with rdf:resource or property attributes", 202); } public static void g(l lVar, n nVar, Node node, boolean z14) throws b { n a14 = a(lVar, nVar, node, null, z14); for (int i14 = 0; i14 < node.getAttributes().getLength(); i14++) { Node item = node.getAttributes().item(i14); if (!"xmlns".equals(item.getPrefix()) && (item.getPrefix() != null || !"xmlns".equals(item.getNodeName()))) { String namespaceURI = item.getNamespaceURI(); String localName = item.getLocalName(); if ("xml:lang".equals(item.getNodeName())) { b(a14, "xml:lang", item.getNodeValue()); } else if (!"http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(namespaceURI) || (!"ID".equals(localName) && !"datatype".equals(localName))) { throw new b("Invalid attribute for literal property element", 202); } } } String str = ""; for (int i15 = 0; i15 < node.getChildNodes().getLength(); i15++) { Node item2 = node.getChildNodes().item(i15); if (item2.getNodeType() == 3) { StringBuilder a15 = b.d.a(str); a15.append(item2.getNodeValue()); str = a15.toString(); } else { throw new b("Invalid child of literal property element", 202); } } a14.f90526c = str; } public static void h(l lVar, n nVar, Node node, boolean z14) throws b { int d14 = d(node); if (d14 != 8 && d14 != 0) { throw new b("Node element must be rdf:Description or typed node", 202); } else if (!z14 || d14 != 0) { int i14 = 0; for (int i15 = 0; i15 < node.getAttributes().getLength(); i15++) { Node item = node.getAttributes().item(i15); if (!"xmlns".equals(item.getPrefix()) && (item.getPrefix() != null || !"xmlns".equals(item.getNodeName()))) { int d15 = d(item); if (d15 == 0) { a(lVar, nVar, item, item.getNodeValue(), z14); } else if (d15 != 6 && d15 != 2 && d15 != 3) { throw new b("Invalid nodeElement attribute", 202); } else if (i14 <= 0) { i14++; if (z14 && d15 == 3) { String str = nVar.f90525b; if (str == null || str.length() <= 0) { nVar.f90525b = item.getNodeValue(); } else if (!nVar.f90525b.equals(item.getNodeValue())) { throw new b("Mismatched top level rdf:about values", 203); } } } else { throw new b("Mutally exclusive about, ID, nodeID attributes", 202); } } } i(lVar, nVar, node, z14); } else { throw new b("Top level typed node not allowed", 203); } } /* JADX WARNING: Removed duplicated region for block: B:166:0x0319 */ /* JADX WARNING: Removed duplicated region for block: B:167:0x031d */ /* JADX WARNING: Removed duplicated region for block: B:210:0x03ad A[SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:24:0x004b */ public static void i(l lVar, n nVar, Node node, boolean z14) throws b { boolean z15; b bVar; boolean z16; boolean z17; boolean z18; String localName; String namespaceURI; String nodeValue; for (int i14 = 0; i14 < node.getChildNodes().getLength(); i14++) { Node item = node.getChildNodes().item(i14); if (!e(item)) { if (item.getNodeType() == 1) { int d14 = d(item); if (d14 != 8) { if (!(10 <= d14 && d14 <= 12)) { z15 = !(1 <= d14 && d14 <= 7); if (!z15) { NamedNodeMap attributes = item.getAttributes(); ArrayList<String> arrayList = null; for (int i15 = 0; i15 < attributes.getLength(); i15++) { Node item2 = attributes.item(i15); if ("xmlns".equals(item2.getPrefix()) || (item2.getPrefix() == null && "xmlns".equals(item2.getNodeName()))) { if (arrayList == null) { arrayList = new ArrayList(); } arrayList.add(item2.getNodeName()); } } if (arrayList != null) { for (String str : arrayList) { attributes.removeNamedItem(str); } } if (attributes.getLength() <= 3) { int i16 = 0; while (true) { if (i16 < attributes.getLength()) { Node item3 = attributes.item(i16); localName = item3.getLocalName(); namespaceURI = item3.getNamespaceURI(); nodeValue = item3.getNodeValue(); if ("xml:lang".equals(item3.getNodeName()) && !("ID".equals(localName) && "http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(namespaceURI))) { i16++; } } else if (item.hasChildNodes()) { int i17 = 0; while (true) { if (i17 >= item.getChildNodes().getLength()) { g(lVar, nVar, item, z14); break; } else if (item.getChildNodes().item(i17).getNodeType() == 3) { i17++; } else if (!z14 || !"iX:changes".equals(item.getNodeName())) { n a14 = a(lVar, nVar, item, "", z14); for (int i18 = 0; i18 < item.getAttributes().getLength(); i18++) { Node item4 = item.getAttributes().item(i18); if (!"xmlns".equals(item4.getPrefix()) && (item4.getPrefix() != null || !"xmlns".equals(item4.getNodeName()))) { String localName2 = item4.getLocalName(); String namespaceURI2 = item4.getNamespaceURI(); if ("xml:lang".equals(item4.getNodeName())) { b(a14, "xml:lang", item4.getNodeValue()); } else if (!"ID".equals(localName2) || !"http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(namespaceURI2)) { throw new b("Invalid attribute for resource property element", 202); } } } boolean z19 = false; for (int i19 = 0; i19 < item.getChildNodes().getLength(); i19++) { Node item5 = item.getChildNodes().item(i19); if (!e(item5)) { if (item5.getNodeType() == 1 && !z19) { boolean equals = "http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(item5.getNamespaceURI()); String localName3 = item5.getLocalName(); if (equals && "Bag".equals(localName3)) { a14.n().e(512, true); } else if (equals && "Seq".equals(localName3)) { l5.e n14 = a14.n(); n14.e(512, true); n14.e(1024, true); } else if (!equals || !"Alt".equals(localName3)) { a14.n().e(256, true); if (!equals && !"Description".equals(localName3)) { String namespaceURI3 = item5.getNamespaceURI(); if (namespaceURI3 != null) { b(a14, "rdf:type", namespaceURI3 + ':' + localName3); } else { throw new b("All XML elements must be in a namespace", 203); } } z16 = false; h(lVar, a14, item5, z16); if (!a14.f90534k) { c(a14); } else if (a14.n().i() && a14.n().i() && a14.y()) { Iterator B = a14.B(); while (true) { if (B.hasNext()) { if (((n) B.next()).n().f()) { z18 = true; break; } } else { z18 = z16; break; } } if (z18) { z17 = true; a14.n().e(4096, true); o.i(a14); z19 = z17; } } z17 = true; z19 = z17; } else { l5.e n15 = a14.n(); n15.e(512, true); n15.e(1024, true); n15.e(2048, true); } z16 = false; h(lVar, a14, item5, z16); if (!a14.f90534k) { } z17 = true; z19 = z17; } else if (z19) { throw bVar; } else { bVar = new b("Children of resource property element must be XML elements", 202); throw bVar; } } } if (!z19) { throw new b("Missing child of resource property element", 202); } } } } } if ("datatype".equals(localName) && "http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(namespaceURI)) { g(lVar, nVar, item, z14); } else if (!"parseType".equals(localName) || !"http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(namespaceURI)) { f(lVar, nVar, item, z14); } else if ("Literal".equals(nodeValue)) { throw new b("ParseTypeLiteral property element not allowed", 203); } else if ("Resource".equals(nodeValue)) { n a15 = a(lVar, nVar, item, "", z14); a15.n().e(256, true); for (int i24 = 0; i24 < item.getAttributes().getLength(); i24++) { Node item6 = item.getAttributes().item(i24); if (!"xmlns".equals(item6.getPrefix()) && (item6.getPrefix() != null || !"xmlns".equals(item6.getNodeName()))) { String localName4 = item6.getLocalName(); String namespaceURI4 = item6.getNamespaceURI(); if ("xml:lang".equals(item6.getNodeName())) { b(a15, "xml:lang", item6.getNodeValue()); } else if (!"http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(namespaceURI4) || (!"ID".equals(localName4) && !"parseType".equals(localName4))) { throw new b("Invalid attribute for ParseTypeResource property element", 202); } } } i(lVar, a15, item, false); if (a15.f90534k) { c(a15); } } else if ("Collection".equals(nodeValue)) { throw new b("ParseTypeCollection property element not allowed", 203); } else { throw new b("ParseTypeOther property element not allowed", 203); } } f(lVar, nVar, item, z14); } else { throw new b("Invalid property element name", 202); } } } z15 = false; if (!z15) { } } else { throw new b("Expected property element node not found", 202); } } } } }