package com.facetec.sdk; import java.text.DateFormat; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; /* loaded from: classes.dex */ public final class ld { private static final ThreadLocal d = new ThreadLocal() { // from class: com.facetec.sdk.ld.4 @Override // java.lang.ThreadLocal protected final /* synthetic */ DateFormat initialValue() { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US); simpleDateFormat.setLenient(false); simpleDateFormat.setTimeZone(km.e); return simpleDateFormat; } }; private static final String[] c = {"EEE, dd MMM yyyy HH:mm:ss zzz", "EEEE, dd-MMM-yy HH:mm:ss zzz", "EEE MMM d HH:mm:ss yyyy", "EEE, dd-MMM-yyyy HH:mm:ss z", "EEE, dd-MMM-yyyy HH-mm-ss z", "EEE, dd MMM yy HH:mm:ss z", "EEE dd-MMM-yyyy HH:mm:ss z", "EEE dd MMM yyyy HH:mm:ss z", "EEE dd-MMM-yyyy HH-mm-ss z", "EEE dd-MMM-yy HH:mm:ss z", "EEE dd MMM yy HH:mm:ss z", "EEE,dd-MMM-yy HH:mm:ss z", "EEE,dd-MMM-yyyy HH:mm:ss z", "EEE, dd-MM-yyyy HH:mm:ss z", "EEE MMM d yyyy HH:mm:ss z"}; private static final DateFormat[] b = new DateFormat[15]; public static Date b(String str) { if (str.length() == 0) { return null; } ParsePosition parsePosition = new ParsePosition(0); Date parse = d.get().parse(str, parsePosition); if (parsePosition.getIndex() == str.length()) { return parse; } String[] strArr = c; synchronized (strArr) { int length = strArr.length; for (int i = 0; i < length; i++) { DateFormat[] dateFormatArr = b; DateFormat dateFormat = dateFormatArr[i]; if (dateFormat == null) { dateFormat = new SimpleDateFormat(c[i], Locale.US); dateFormat.setTimeZone(km.e); dateFormatArr[i] = dateFormat; } parsePosition.setIndex(0); Date parse2 = dateFormat.parse(str, parsePosition); if (parsePosition.getIndex() != 0) { return parse2; } } return null; } } public static String d(Date date) { return d.get().format(date); } }