package o; import android.animation.TimeInterpolator; import android.content.Context; import android.util.TypedValue; import android.view.animation.AnimationUtils; import com.google.android.gms.maps.model.BitmapDescriptorFactory; /* loaded from: classes2.dex */ public final class DAZ { public static TimeInterpolator Kh_(Context context, int i, TimeInterpolator timeInterpolator) { TypedValue typedValue = new TypedValue(); if (!context.getTheme().resolveAttribute(i, typedValue, true)) { return timeInterpolator; } if (typedValue.type != 3) { throw new IllegalArgumentException("Motion easing theme attribute must be an @interpolator resource for ?attr/motionEasing*Interpolator attributes or a string for ?attr/motionEasing* attributes."); } String valueOf = String.valueOf(typedValue.string); if (d(valueOf, "cubic-bezier") || d(valueOf, "path")) { return Kg_(valueOf); } return AnimationUtils.loadInterpolator(context, typedValue.resourceId); } private static TimeInterpolator Kg_(String str) { if (d(str, "cubic-bezier")) { String[] split = str.substring(13, str.length() - 1).split(","); if (split.length != 4) { StringBuilder sb = new StringBuilder("Motion easing theme attribute must have 4 control points if using bezier curve format; instead got: "); sb.append(split.length); throw new IllegalArgumentException(sb.toString()); } return C17534xZR.uu_(c(split, 0), c(split, 1), c(split, 2), c(split, 3)); } if (d(str, "path")) { return C17534xZR.uv_(C0661Lpn.oG_(str.substring(5, str.length() - 1))); } throw new IllegalArgumentException("Invalid motion easing type: ".concat(String.valueOf(str))); } private static boolean d(String str, String str2) { StringBuilder sb = new StringBuilder(); sb.append(str2); sb.append("("); return str.startsWith(sb.toString()) && str.endsWith(")"); } private static float c(String[] strArr, int i) { float parseFloat = Float.parseFloat(strArr[i]); if (parseFloat < BitmapDescriptorFactory.HUE_RED || parseFloat > 1.0f) { throw new IllegalArgumentException("Motion easing control point value must be between 0 and 1; instead got: ".concat(String.valueOf(parseFloat))); } return parseFloat; } public static int a(Context context, int i, int i2) { TypedValue typedValue = new TypedValue(); if (!context.getTheme().resolveAttribute(i, typedValue, true)) { typedValue = null; } return (typedValue == null || typedValue.type != 16) ? i2 : typedValue.data; } }