package o; import com.adobe.internal.xmp.XMPException; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; /* loaded from: classes.dex */ public final class RKF implements yYF { private static final khW e; static { khW khw = new khW(); khw.c.putAll(Collections.singletonMap("photoshop:DocumentAncestors", 1000)); e = khw; } @Override // o.yYF public final Iterable c() { return Collections.singletonList(EnumC2874amo.APP1); } @Override // o.yYF public final void d(Iterable iterable, C16613piz c16613piz, EnumC2874amo enumC2874amo) { byte[] bArr = null; String str = null; for (byte[] bArr2 : iterable) { if (bArr2.length >= 29 && ("http://ns.adobe.com/xap/1.0/\u0000".equalsIgnoreCase(new String(bArr2, 0, 29)) || "XMP".equalsIgnoreCase(new String(bArr2, 0, 3)))) { int length = bArr2.length - 29; byte[] bArr3 = new byte[length]; System.arraycopy(bArr2, 29, bArr3, 0, length); a(bArr3, 0, length, c16613piz); str = e(c16613piz); } else if (str != null && bArr2.length >= 35 && "http://ns.adobe.com/xmp/extension/\u0000".equalsIgnoreCase(new String(bArr2, 0, 35))) { bArr = d(c16613piz, bArr2, str, bArr); } } if (bArr != null) { a(bArr, 0, bArr.length, c16613piz); } } public static void e(byte[] bArr, C16613piz c16613piz) { a(bArr, 0, bArr.length, c16613piz); } /* JADX WARN: Removed duplicated region for block: B:10:? A[RETURN, SYNTHETIC] */ /* JADX WARN: Removed duplicated region for block: B:7:0x0054 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static void a(byte[] r2, int r3, int r4, o.C16613piz r5) { /* o.KQW r0 = new o.KQW r0.() if (r3 != 0) goto L11 int r1 = r2.length // Catch: com.adobe.internal.xmp.XMPException -> L2a if (r4 != r1) goto L11 o.khW r3 = o.RKF.e // Catch: com.adobe.internal.xmp.XMPException -> L2a o.OPB r2 = o.C1235Yps.e(r2, r3) // Catch: com.adobe.internal.xmp.XMPException -> L2a goto L26 L11: o.mVl r1 = new o.mVl // Catch: com.adobe.internal.xmp.XMPException -> L2a r1.(r2, r3, r4) // Catch: com.adobe.internal.xmp.XMPException -> L2a java.io.ByteArrayInputStream r2 = new java.io.ByteArrayInputStream // Catch: com.adobe.internal.xmp.XMPException -> L2a byte[] r3 = r1.e // Catch: com.adobe.internal.xmp.XMPException -> L2a int r4 = r1.c // Catch: com.adobe.internal.xmp.XMPException -> L2a r1 = 0 r2.(r3, r1, r4) // Catch: com.adobe.internal.xmp.XMPException -> L2a o.khW r3 = o.RKF.e // Catch: com.adobe.internal.xmp.XMPException -> L2a o.OPB r2 = o.C1235Yps.e(r2, r3) // Catch: com.adobe.internal.xmp.XMPException -> L2a L26: r0.d(r2) // Catch: com.adobe.internal.xmp.XMPException -> L2a goto L4e L2a: r2 = move-exception java.lang.StringBuilder r3 = new java.lang.StringBuilder java.lang.String r4 = "Error processing XMP data: " r3.(r4) java.lang.String r2 = r2.getMessage() r3.append(r2) java.lang.String r2 = r3.toString() java.lang.Object[] r2 = new java.lang.Object[]{r0, r2} int r3 = java.lang.System.identityHashCode(r0) r4 = -1786863991(0xffffffff957e9e89, float:-5.1419954E-26) r1 = 1786863992(0x6a816178, float:7.820586E25) o.BrP.b(r2, r4, r1, r3) L4e: boolean r2 = r0.i() if (r2 != 0) goto L59 java.util.List r2 = r5.c r2.add(r0) L59: return */ throw new UnsupportedOperationException("Method not decompiled: o.RKF.a(byte[], int, int, o.piz):void"); } public static void c(String str, C16613piz c16613piz) { KQW kqw = new KQW(); try { kqw.d(C1235Yps.d(str, e)); } catch (XMPException e2) { StringBuilder sb = new StringBuilder("Error processing XMP data: "); sb.append(e2.getMessage()); BrP.b(new Object[]{kqw, sb.toString()}, -1786863991, 1786863992, System.identityHashCode(kqw)); } if (kqw.i()) { return; } c16613piz.c.add(kqw); } private static String e(C16613piz c16613piz) { ArrayList arrayList = new ArrayList(); for (BrP brP : c16613piz.c) { if (KQW.class.isAssignableFrom(brP.getClass())) { arrayList.add(brP); } } Iterator it = arrayList.iterator(); while (it.hasNext()) { KQW kqw = (KQW) it.next(); if (kqw.b == null) { kqw.b = new C16814rTK(); } try { KfL e2 = kqw.b.e("http://ns.adobe.com/xmp/note/"); while (e2.hasNext()) { VYk vYk = (VYk) e2.next(); if ("xmpNote:HasExtendedXMP".equals(vYk.a())) { return vYk.c(); } } } catch (XMPException unused) { } } return null; } private static byte[] d(C16613piz c16613piz, byte[] bArr, String str, byte[] bArr2) { int length = bArr.length; if (length >= 75) { try { C0629LEh c0629LEh = new C0629LEh(bArr); c0629LEh.b(35L); if (str.equals(new String(c0629LEh.a(32)))) { int f = (int) c0629LEh.f(); int f2 = (int) c0629LEh.f(); if (bArr2 == null) { bArr2 = new byte[f]; } if (bArr2.length == f) { System.arraycopy(bArr, 75, bArr2, f2, length - 75); } else { KQW kqw = new KQW(); BrP.b(new Object[]{kqw, String.format("Inconsistent length for the Extended XMP buffer: %d instead of %d", Integer.valueOf(f), Integer.valueOf(bArr2.length))}, -1786863991, 1786863992, System.identityHashCode(kqw)); c16613piz.c.add(kqw); } } } catch (IOException e2) { KQW kqw2 = new KQW(); BrP.b(new Object[]{kqw2, e2.getMessage()}, -1786863991, 1786863992, System.identityHashCode(kqw2)); c16613piz.c.add(kqw2); } } return bArr2; } }