package com.facetec.sdk; import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Locale; /* loaded from: classes.dex */ public final class fh extends ek { public static final en a = new en() { // from class: com.facetec.sdk.fh.2 @Override // com.facetec.sdk.en public final ek e(dx dxVar, fv fvVar) { if (fvVar.a() == Date.class) { return new fh(); } return null; } }; private final List e; public fh() { ArrayList arrayList = new ArrayList(); this.e = arrayList; arrayList.add(DateFormat.getDateTimeInstance(2, 2, Locale.US)); if (!Locale.getDefault().equals(Locale.US)) { arrayList.add(DateFormat.getDateTimeInstance(2, 2)); } if (ew.b()) { arrayList.add(fa.e(2, 2)); } } private Date d(String str) { synchronized (this) { Iterator it = this.e.iterator(); while (it.hasNext()) { try { return it.next().parse(str); } catch (ParseException unused) { } } try { return fp.a(str, new ParsePosition(0)); } catch (ParseException e) { throw new ei(str, e); } } } /* JADX INFO: Access modifiers changed from: private */ @Override // com.facetec.sdk.ek public void b(ga gaVar, Date date) throws IOException { synchronized (this) { if (date == null) { gaVar.h(); } else { gaVar.b(this.e.get(0).format(date)); } } } @Override // com.facetec.sdk.ek public final /* synthetic */ Date a(fu fuVar) throws IOException { if (fuVar.i() == gc.NULL) { fuVar.l(); return null; } return d(fuVar.h()); } }