导航菜单

页面标题

页面副标题

moonshot.企业版 v5.53.33 - C1596.java 源代码

正在查看: moonshot.企业版 v5.53.33 应用的 C1596.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package TCUcMtElLJnqSvqb7YcU.J8XGgBmc5IbfScQDY6EG.TCUcMtElLJnqSvqb7YcU;

import MeHcvHJFg1sI1SlloYsz.UBVL9U3WwxbAPwDW6rA5.UBVL9U3WwxbAPwDW6rA5.C0033;
import ShxcOQUYV4NCnoYZ6rEG.rKwtQoMTg9U9BbR7dg96.jb4dWzI2R7xQpOgeBEx2.UBVL9U3WwxbAPwDW6rA5.C0781;
import TCUcMtElLJnqSvqb7YcU.J8XGgBmc5IbfScQDY6EG.TCUcMtElLJnqSvqb7YcU.C1593;
import TCUcMtElLJnqSvqb7YcU.TCUcMtElLJnqSvqb7YcU.InterfaceC1758;
import TCUcMtElLJnqSvqb7YcU.TCUcMtElLJnqSvqb7YcU.InterfaceC1762;
import TCUcMtElLJnqSvqb7YcU.TCUcMtElLJnqSvqb7YcU.InterfaceC1793;
import TCUcMtElLJnqSvqb7YcU.cr3JSOpoZIqsmhvmO4JX.t53cCoLViFIKJxicLKwJ.C2712;
import android.annotation.SuppressLint;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.location.Location;
import android.media.MediaDataSource;
import android.media.MediaMetadataRetriever;
import android.os.Build;
import android.system.OsConstants;
import android.util.Log;
import android.util.Pair;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import com.google.android.material.badge.BadgeDrawable;
import com.google.android.material.datepicker.UtcDates;
import com.google.android.material.shadow.ShadowDrawableWrapper;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.netease.nimlib.sdk.avchat.constant.AVChatControlCommand;
import com.tencent.smtt.sdk.TbsListener;
import com.xiaomi.mipush.sdk.Constants;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.CRC32;
import jnksI9k6J1HFuFo5YzBf.P1qFuCkms7jkO5aFlyzU.UBVL9U3WwxbAPwDW6rA5.UBVL9U3WwxbAPwDW6rA5.C6258;
import jnksI9k6J1HFuFo5YzBf.SJLrLvLW83R6jZomEMlx.UBVL9U3WwxbAPwDW6rA5.E2fGKlJbayGsv9rEKPZ5.C6305;
import jnksI9k6J1HFuFo5YzBf.XiuvXGti2l5Gpvotr28R.UBVL9U3WwxbAPwDW6rA5.jb4dWzI2R7xQpOgeBEx2.C6566;

public class C1596 {

    private static final int f6663 = 12;

    public static final String f6664 = "Flash";

    public static final short f6665 = 1;

    public static final short f6666 = 4;

    public static final String f6667 = "Saturation";

    private static final int f6668 = 19;

    public static final String f6669 = "NewSubfileType";

    private static final int f6670 = 6;

    public static final int f6671 = 7;

    public static final String f6672 = "E";

    public static final short f6673 = 2;

    private static final C1598[] f6674;

    public static final int f6675 = 1;

    private static final byte f6676 = 47;

    public static final short f6677 = 24;

    public static final short f6678 = 1;

    public static final short f6681 = 23;

    public static final short f6682 = 2;

    public static final String f6683 = "ImageDescription";

    private static final int f6684 = 2;

    private static final int f6685 = 3;

    private static final int f6686 = 4;

    public static final String f6688 = "K";

    public static final short f6689 = 7;

    private static final byte f6690 = -38;

    public static final short f6691 = 1;

    public static final short f6692 = 1;

    public static final short f6693 = 0;

    public static final String f6694 = "GPSImgDirectionRef";

    private static final int f6695 = 4;

    public static final short f6696 = 7;

    public static final String f6697 = "2";

    public static final short f6698 = 0;

    public static final String f6699 = "GPSDestBearingRef";

    @InterfaceC1762({InterfaceC1762.EnumC1763.LIBRARY})
    public static final String f6700 = "ThumbnailOrientation";

    public static final String f6701 = "GPSTrack";

    public static final String f6702 = "GPSTimeStamp";

    public static final String f6703 = "ExposureMode";

    public static final String f6704 = "ThumbnailImageLength";

    public static final String f6705 = "InteroperabilityIndex";

    private static final byte[] f6706;

    public static final String f6707 = "A";

    public static final short f6708 = 6;

    public static final short f6709 = 1;

    public static final String f6710 = "GPSProcessingMethod";

    public static final String f6711 = "GainControl";

    private static final byte f6712 = -58;

    private static final int f6713 = 2;

    public static final short f6714 = 2;

    public static final short f6715 = 20;

    public static final short f6716 = 0;

    public static final String f6717 = "FileSource";

    private static final C1598[] f6718;

    public static final int f6719 = 7;

    public static final String f6720 = "W";

    public static final String f6721 = "GPSAltitude";

    private static final short f6722 = 85;

    public static final String f6723 = "FNumber";

    private static final C1598[] f6724;

    public static final short f6725 = 3;

    public static final String f6726 = "SubjectDistanceRange";

    private static final Pattern f6727;

    public static final String f6728 = "FocalPlaneXResolution";

    public static final short f6729 = 1;

    public static final String f6730 = "S";

    public static final int f6731 = 9;

    private static final int f6732 = 9;

    public static final String f6733 = "Contrast";

    public static final short f6734 = 6;

    private static final int f6735 = 5;

    public static final String f6736 = "V";

    public static final int f6737 = 0;

    private static final byte f6738 = -49;

    private static final int f6739 = 8;

    private static final byte f6740 = -63;

    private static final int f6742 = 12;

    private static final C1598[] f6743;

    public static final String f6744 = "GPSMeasureMode";

    public static final int f6745 = 1;

    public static final String f6746 = "GPSDestLatitude";

    public static final int f6747 = 2;

    public static final int f6748 = 2;

    public static final short f6749 = 1;

    public static final String f6750 = "LensSpecification";

    public static final short f6752 = 8;

    public static final int f6753 = 5;

    public static final short f6755 = 19789;

    public static final String f6756 = "BodySerialNumber";

    private static final byte f6757 = -61;

    public static final short f6758 = 15;

    public static final String f6759 = "GPSSpeed";

    private static final C1598[] f6760;

    public static final int f6761 = 0;

    public static final int f6762 = 3;

    public static final short f6763 = 3;

    public static final short f6764 = 255;

    public static final int f6765 = 1;

    private static final int f6766 = 4;

    public static final String f6768 = "GPSImgDirection";

    private static final int f6769 = 8;

    public static final int f6770 = 2;

    public static final String f6772 = "TransferFunction";

    private static final byte f6773 = -55;

    public static final short f6774 = 3;

    public static final String f6775 = "ISO";

    public static final String f6776 = "GPSDestDistance";

    public static final String f6777 = "DigitalZoomRatio";

    public static final short f6778 = 0;

    private static final String f6779 = "ImageProcessingIFDPointer";

    public static final short f6780 = 1;

    public static final String f6781 = "GPSSpeedRef";

    private static final int f6782 = 6;

    private static final String f6783 = "PENTAX";

    public static final short f6784 = 18761;

    public static final short f6786 = 0;

    public static final byte f6787 = -39;

    public static final String f6788 = "GPSDestLatitudeRef";

    public static final String f6789 = "YCbCrCoefficients";

    public static final String f6790 = "GPSSatellites";

    public static final String f6791 = "MakerNote";

    public static final int f6792 = 0;

    public static final String f6793 = "GPSLatitude";

    public static final String f6794 = "PlanarConfiguration";

    public static final short f6795 = 1;

    public static final short f6796 = 2;

    public static final short f6797 = 1;

    private static final int f6798 = 7;

    private static final int f6799 = 10;

    public static final short f6800 = 0;

    public static final short f6801 = 0;

    public static final short f6802 = 2;

    public static final String f6804 = "RecommendedExposureIndex";

    public static final int f6805 = 8;

    public static final int f6806 = 0;

    public static final String f6807 = "JPEGInterchangeFormatLength";

    public static final String f6808 = "Gamma";

    @Deprecated
    public static final String f6809 = "ISOSpeedRatings";

    private static final HashMap<Integer, C1598>[] f6810;

    public static final String f6811 = "ISOSpeedLatitudeyyy";

    public static final int f6812 = 14;

    public static final String f6813 = "DNGVersion";

    public static final String f6814 = "DateTimeOriginal";

    public static final String f6816 = "SensingMethod";

    private static final Pattern f6820;

    public static final String f6821 = "ISOSpeed";

    public static final short f6822 = 3;

    public static final String f6823 = "GPSDestLongitudeRef";

    public static final String f6824 = "Software";

    public static final String f6825 = "SpatialFrequencyResponse";

    public static final String f6826 = "SceneCaptureType";

    public static final String f6827 = "CompressedBitsPerPixel";

    public static final short f6828 = 13;

    public static final String f6829 = "GPSAreaInformation";

    public static final String f6831 = "GPSAltitudeRef";

    public static final int f6832 = 4;

    public static final String f6833 = "YResolution";

    private static final byte f6834 = -57;

    public static final String f6835 = "Model";

    public static final String f6836 = "GPSDestLongitude";

    public static final String f6837 = "MaxApertureValue";

    public static final short f6838 = 4;

    public static final String f6839 = "SubjectLocation";

    public static final String f6840 = "RelatedSoundFile";

    private static final int f6841 = 6;

    public static final String f6842 = "PhotometricInterpretation";

    private static final int f6843 = 8;

    private static final int f6844 = 1;

    private static SimpleDateFormat f6845 = null;

    public static final short f6846 = 1;

    public static final int f6847 = 6;

    public static final String f6848 = "GPSStatus";

    public static final String f6849 = "ShutterSpeedValue";

    public static final String f6850 = "GPSDateStamp";

    public static final short f6851 = 0;

    public static final short f6852 = 5;

    private static final HashSet<String> f6853;

    public static final String f6854 = "StripOffsets";

    public static final String f6855 = "ImageLength";

    public static final short f6856 = 5;

    public static final String f6857 = "SubSecTimeDigitized";

    @Deprecated
    public static final String f6858 = "CameraOwnerName";

    private static final String f6859 = "CameraSettingsIFDPointer";

    public static final String f6860 = "Xmp";

    public static final short f6861 = 1;

    public static final String f6862 = "GPSHPositioningError";

    public static final String f6863 = "FlashEnergy";

    public static final int f6864 = 0;

    public static final short f6865 = 1;

    public static final short f6866 = 0;

    private static final C1598[] f6867;

    public static final short f6868 = 1;

    public static final short f6869 = 1;

    public static final short f6871 = 9;

    private static SimpleDateFormat f6872 = null;

    public static final String f6873 = "GPSDifferential";

    public static final String f6874 = "PrimaryChromaticities";

    public static final short f6875 = 0;

    public static final short f6876 = 1;

    public static final int f6877 = 1;

    public static final int f6878 = 3;

    public static final short f6879 = 18;

    public static final String f6880 = "PreviewImageLength";

    public static final String f6881 = "Artist";

    public static final String f6884 = "ExposureTime";

    public static final String f6886 = "PreviewImageStart";

    public static final short f6887 = 0;

    private static final C1598[] f6888;

    public static final short f6889 = 6;

    public static final short f6890 = 17;

    public static final short f6891 = 3;

    public static final String f6892 = "M";

    public static final short f6893 = 0;

    public static final int f6895 = 4;

    public static final int f6896 = 8;

    private static final HashMap<String, C1598>[] f6897;

    public static final String f6899 = "BrightnessValue";

    public static final short f6900 = 8;

    public static final String f6901 = "GPSMapDatum";

    public static final short f6902 = 0;

    public static final String f6903 = "SensorRightBorder";

    private static final C1598[] f6904;

    public static final String f6905 = "T";

    public static final short f6908 = 2;

    public static final short f6909 = 0;

    public static final short f6910 = 4;

    public static final String f6911 = "GPSDestDistanceRef";

    public static final String f6912 = "DefaultCropSize";

    private static final C1598 f6913;

    public static final String f6914 = "OffsetTime";

    private static final short f6915 = 20306;

    public static final int f6916 = 2;

    public static final String f6917 = "K";

    private static final Pattern f6919;

    public static final String f6920 = "WhitePoint";

    public static final String f6921 = "ThumbnailImageWidth";

    public static final String f6922 = "UserComment";

    public static final short f6923 = 7;

    public static final String f6924 = "N";

    public static final String f6925 = "ComponentsConfiguration";

    public static final byte[] f6926;

    public static final short f6927 = 5;

    public static final String f6928 = "MeteringMode";

    private static final C1598[] f6929;

    public static final String f6930 = "PixelYDimension";

    public static final String f6931 = "Copyright";

    public static final String f6932 = "RowsPerStrip";

    public static final short f6933 = 255;

    private static final int f6934 = 13;

    private static final byte f6935 = -2;

    public static final String f6936 = "WhiteBalance";

    private static final int f6937 = 84;

    public static final short f6938 = 2;

    public static final String f6939 = "Compression";

    public static final short f6940 = 2;

    public static final String f6941 = "ApertureValue";

    public static final String f6942 = "FocalPlaneYResolution";

    public static final int f6943 = 1;

    public static final String f6944 = "StandardOutputSensitivity";

    private static final Pattern f6945;

    public static final short f6946 = 8;

    private static final HashMap<Integer, Integer> f6947;

    public static final int f6948 = 6;

    private static final byte f6950 = -64;

    public static final String f6951 = "3";

    public static final short f6952 = 19;

    private static final int f6953 = 512;

    private static final int f6954 = 11;

    public static final short f6955 = 1;

    private static final String f6956 = "InteroperabilityIFDPointer";

    private static final byte f6957 = -59;

    private static final C1598[] f6958;

    public static final byte f6959 = -1;

    private static final byte f6960 = -54;

    public static final int f6961 = 12;

    private static final int f6962 = 8192;

    public static final String f6963 = "Orientation";

    private static final String f6964 = "FUJIFILMCCD-RAW";

    public static final short f6966 = 0;

    public static final short f6967 = 22;

    public static final String f6968 = "ThumbnailImage";

    private static final String f6969 = "ExifIFDPointer";

    public static final String f6970 = "XResolution";

    public static final String f6971 = "JPEGInterchangeFormat";

    public static final String f6972 = "LensMake";

    public static final String f6973 = "GPSLongitude";

    private static final int f6974 = 5000;

    public static final int f6975 = 1;

    public static final String f6976 = "AspectFrame";

    public static final short f6977 = 2;

    public static final String f6978 = "CFAPattern";

    public static final int f6979 = 1;

    public static final int f6980 = 4;

    public static final String f6981 = "SensorTopBorder";

    private static final String f6982 = "SubIFDPointer";

    public static final String f6983 = "SubSecTime";

    public static final short f6984 = 1;

    public static final short f6985 = 24;

    public static final String f6986 = "FlashpixVersion";

    public static final String f6987 = "SubjectDistance";

    private static final short f6988 = 21330;

    public static final int f6989 = 6;

    public static final int f6990 = 11;

    public static final String f6991 = "M";

    public static final short f6992 = 16;

    public static final short f6993 = 2;

    public static final String f6994 = "SceneType";

    public static final String f6995 = "OffsetTimeOriginal";

    public static final String f6996 = "SubfileType";

    public static final int f6997 = 10;

    public static final short f6998 = 4;

    public static final Charset f6999;

    public static final String f7000 = "GPSTrackRef";

    public static final short f7001 = 64;

    public static final String f7002 = "GPSDestBearing";

    public static final String f7003 = "SubjectArea";

    public static final String f7004 = "GPSLatitudeRef";

    public static final String f7005 = "GPSDOP";

    private static final String f7006 = "GPSInfoIFDPointer";

    public static final String f7007 = "SpectralSensitivity";

    public static final int f7009 = 65535;

    public static final String f7010 = "PhotographicSensitivity";

    public static final short f7011 = 16;

    public static final String f7012 = "Make";

    private static final int f7013 = 1;

    public static final String f7014 = "ExposureBiasValue";

    public static final String f7015 = "LightSource";

    public static final short f7016 = 0;

    public static final String f7017 = "SamplesPerPixel";

    public static final short f7018 = 0;

    public static final short f7019 = 12;

    public static final String f7020 = "N";

    public static final short f7021 = 11;

    public static final String f7022 = "SubSecTimeOriginal";

    private static final int f7023 = 4;

    public static final String f7024 = "LensSerialNumber";

    public static final String f7025 = "N";

    private static final byte f7026 = -50;

    public static final int f7027 = 6;

    public static final short f7028 = 3;

    public static final short f7029 = 2;

    private static final byte f7030 = -62;

    public static final String f7031 = "Sharpness";

    public static final C1598[][] f7032;

    public static final short f7033 = 2;

    public static final short f7034 = 32;

    public static final String f7035 = "ReferenceBlackWhite";

    public static final String f7036 = "BitsPerSample";

    private static final int f7037 = 4;

    public static final int f7038 = 5;

    public static final String f7039 = "ImageUniqueID";

    public static final short f7040 = 1;

    public static final String f7042 = "ResolutionUnit";

    public static final short f7043 = 2;

    @Deprecated
    public static final int f7044 = 0;

    public static final String f7045 = "ExifVersion";

    public static final String f7046 = "ISOSpeedLatitudezzz";

    public static final String f7047 = "FocalLengthIn35mmFilm";

    public static final String f7049 = "SensorBottomBorder";

    private static final int f7050 = 8;

    public static final int f7052 = 34892;

    public static final String f7053 = "M";

    public static final String f7054 = "JpgFromRaw";

    public static final String f7055 = "ExposureProgram";

    public static final String f7056 = "DateTime";

    private static final int f7057 = 3;

    private static final int f7058 = 7;

    public static final String f7059 = "ColorSpace";

    public static final String f7060 = "GPSVersionID";

    public static final int f7061 = 7;

    public static final short f7063 = 3;

    public static final short f7064 = 10;

    public static final String f7065 = "OECF";

    public static final short f7066 = 14;

    public static final String f7067 = "YCbCrSubSampling";

    public static final short f7068 = 5;

    public static final int f7069 = 8;

    public static final String f7070 = "GPSLongitudeRef";

    private static final byte f7071 = -53;

    public static final int f7072 = 5;

    public static final String f7073 = "ExposureIndex";

    public static final String f7074 = "CameraOwnerName";

    public static final String f7075 = "StripByteCounts";

    public static final String f7076 = "LensModel";

    public static final String f7077 = "FocalPlaneResolutionUnit";

    public static final String f7078 = "YCbCrPositioning";

    public static final String f7079 = "SensorLeftBorder";

    public static final String f7080 = "OffsetTimeDigitized";

    private static final int f7081 = 10;

    public static final short f7082 = 4;

    public static final short f7083 = 2;

    public static final int f7084 = 0;

    public static final String f7085 = "FocalLength";

    public static final short f7086 = 4;

    public static final String f7087 = "DeviceSettingDescription";

    public static final short f7088 = 3;

    public static final short f7089 = 3;

    public static final int f7090 = 32773;

    public static final String f7091 = "CustomRendered";

    public static final byte f7092 = -31;

    public static final short f7093 = 4;

    public static final String f7094 = "DateTimeDigitized";

    public static final short f7095 = 1;

    public static final short f7096 = 21;

    public static final String f7097 = "PixelXDimension";

    private static final byte f7098 = -51;

    public static final String f7099 = "ImageWidth";

    @Deprecated
    public static final int f7100 = 1;

    public static final short f7101 = 2;

    public static final int f7102 = 13;

    private static final int f7103 = 4;

    public static final short f7104 = 0;

    public static final short f7105 = 6;

    public static final String f7106 = "SensitivityType";

    public static final short f7107 = 3;

    private static final int f7108 = 9;

    private int f7109;

    private FileDescriptor f7110;

    private final HashMap<String, C1600>[] f7111;

    private boolean f7112;

    private boolean f7113;

    private boolean f7114;

    private Set<Integer> f7115;

    private int f7116;

    private int f7117;

    private ByteOrder f7118;

    private boolean f7119;

    private int f7120;

    private int f7121;

    private AssetManager.AssetInputStream f7122;

    private int f7123;

    private String f7124;

    private int f7125;

    private int f7126;

    private byte[] f7127;

    private boolean f7128;

    private boolean f7129;

    private static final String f6885 = "ExifInterface";

    private static final boolean f6894 = Log.isLoggable(f6885, 3);

    private static final List<Integer> f7008 = Arrays.asList(1, 6, 3, 8);

    private static final List<Integer> f6815 = Arrays.asList(2, 7, 4, 5);

    public static final int[] f6898 = {8, 8, 8};

    public static final int[] f6767 = {4};

    public static final int[] f6882 = {8};

    private static final byte f7041 = -40;

    public static final byte[] f6819 = {-1, f7041, -1};

    private static final byte[] f6883 = {102, 116, 121, 112};

    private static final byte[] f6817 = {109, 105, 102, 49};

    private static final byte[] f6741 = {104, 101, 105, 99};

    private static final byte[] f6679 = {79, 76, 89, 77, 80, 0};

    private static final byte[] f7048 = {79, 76, 89, 77, 80, 85, 83, 0, 73, 73};

    private static final byte[] f6830 = {-119, 80, 78, 71, AVChatControlCommand.NOTIFY_RECORD_START, 10, 26, 10};

    private static final byte[] f7062 = {101, 88, 73, 102};

    private static final byte[] f6754 = {73, 72, 68, 82};

    private static final byte[] f6949 = {73, 69, 78, 68};

    private static final byte[] f6751 = {82, 73, 70, 70};

    private static final byte[] f6680 = {87, 69, 66, 80};

    private static final byte[] f6803 = {69, 88, 73, 70};

    public static final byte f6818 = 42;

    private static final byte[] f6771 = {-99, 1, f6818};

    private static final byte[] f7051 = "VP8X".getBytes(Charset.defaultCharset());

    private static final byte[] f6687 = "VP8L".getBytes(Charset.defaultCharset());

    private static final byte[] f6906 = "VP8 ".getBytes(Charset.defaultCharset());

    private static final byte[] f6918 = "ANIM".getBytes(Charset.defaultCharset());

    private static final byte[] f6785 = "ANMF".getBytes(Charset.defaultCharset());

    public static final String[] f6907 = {"", "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"};

    public static final int[] f6870 = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};

    public static final byte[] f6965 = {65, 83, 67, 73, 73, 0, 0, 0};

    public static class C1597 extends InputStream implements DataInput {

        private static final ByteOrder f7130 = ByteOrder.LITTLE_ENDIAN;

        private static final ByteOrder f7131 = ByteOrder.BIG_ENDIAN;

        public final DataInputStream f7132;

        private byte[] f7133;

        public int f7134;

        private ByteOrder f7135;

        public C1597(byte[] bArr) throws IOException {
            this(new ByteArrayInputStream(bArr), ByteOrder.BIG_ENDIAN);
        }

        @Override
        public int available() throws IOException {
            return this.f7132.available();
        }

        @Override
        public void mark(int i) {
            throw new UnsupportedOperationException("Mark is currently unsupported");
        }

        @Override
        public int read() throws IOException {
            this.f7134++;
            return this.f7132.read();
        }

        @Override
        public boolean readBoolean() throws IOException {
            this.f7134++;
            return this.f7132.readBoolean();
        }

        @Override
        public byte readByte() throws IOException {
            this.f7134++;
            int read = this.f7132.read();
            if (read >= 0) {
                return (byte) read;
            }
            throw new EOFException();
        }

        @Override
        public char readChar() throws IOException {
            this.f7134 += 2;
            return this.f7132.readChar();
        }

        @Override
        public double readDouble() throws IOException {
            return Double.longBitsToDouble(readLong());
        }

        @Override
        public float readFloat() throws IOException {
            return Float.intBitsToFloat(readInt());
        }

        @Override
        public void readFully(byte[] bArr, int i, int i2) throws IOException {
            this.f7134 += i2;
            this.f7132.readFully(bArr, i, i2);
        }

        @Override
        public int readInt() throws IOException {
            this.f7134 += 4;
            int read = this.f7132.read();
            int read2 = this.f7132.read();
            int read3 = this.f7132.read();
            int read4 = this.f7132.read();
            if ((read | read2 | read3 | read4) < 0) {
                throw new EOFException();
            }
            ByteOrder byteOrder = this.f7135;
            if (byteOrder == f7130) {
                return (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
            }
            if (byteOrder == f7131) {
                return (read << 24) + (read2 << 16) + (read3 << 8) + read4;
            }
            throw new IOException("Invalid byte order: " + this.f7135);
        }

        @Override
        public String readLine() throws IOException {
            return null;
        }

        @Override
        public long readLong() throws IOException {
            this.f7134 += 8;
            int read = this.f7132.read();
            int read2 = this.f7132.read();
            int read3 = this.f7132.read();
            int read4 = this.f7132.read();
            int read5 = this.f7132.read();
            int read6 = this.f7132.read();
            int read7 = this.f7132.read();
            int read8 = this.f7132.read();
            if ((read | read2 | read3 | read4 | read5 | read6 | read7 | read8) < 0) {
                throw new EOFException();
            }
            ByteOrder byteOrder = this.f7135;
            if (byteOrder == f7130) {
                return (read8 << 56) + (read7 << 48) + (read6 << 40) + (read5 << 32) + (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
            }
            if (byteOrder == f7131) {
                return (read << 56) + (read2 << 48) + (read3 << 40) + (read4 << 32) + (read5 << 24) + (read6 << 16) + (read7 << 8) + read8;
            }
            throw new IOException("Invalid byte order: " + this.f7135);
        }

        @Override
        public short readShort() throws IOException {
            this.f7134 += 2;
            int read = this.f7132.read();
            int read2 = this.f7132.read();
            if ((read | read2) < 0) {
                throw new EOFException();
            }
            ByteOrder byteOrder = this.f7135;
            if (byteOrder == f7130) {
                return (short) ((read2 << 8) + read);
            }
            if (byteOrder == f7131) {
                return (short) ((read << 8) + read2);
            }
            throw new IOException("Invalid byte order: " + this.f7135);
        }

        @Override
        public String readUTF() throws IOException {
            this.f7134 += 2;
            return this.f7132.readUTF();
        }

        @Override
        public int readUnsignedByte() throws IOException {
            this.f7134++;
            return this.f7132.readUnsignedByte();
        }

        @Override
        public int readUnsignedShort() throws IOException {
            this.f7134 += 2;
            int read = this.f7132.read();
            int read2 = this.f7132.read();
            if ((read | read2) < 0) {
                throw new EOFException();
            }
            ByteOrder byteOrder = this.f7135;
            if (byteOrder == f7130) {
                return (read2 << 8) + read;
            }
            if (byteOrder == f7131) {
                return (read << 8) + read2;
            }
            throw new IOException("Invalid byte order: " + this.f7135);
        }

        @Override
        public void reset() {
            throw new UnsupportedOperationException("Reset is currently unsupported");
        }

        @Override
        public int skipBytes(int i) throws IOException {
            throw new UnsupportedOperationException("skipBytes is currently unsupported");
        }

        public long m5805() throws IOException {
            return readInt() & 4294967295L;
        }

        public void m5806(int i) throws IOException {
            int i2 = 0;
            while (i2 < i) {
                int i3 = i - i2;
                int skip = (int) this.f7132.skip(i3);
                if (skip <= 0) {
                    if (this.f7133 == null) {
                        this.f7133 = new byte[8192];
                    }
                    skip = this.f7132.read(this.f7133, 0, Math.min(8192, i3));
                    if (skip == -1) {
                        throw new EOFException("Reached EOF while skipping " + i + " bytes.");
                    }
                }
                i2 += skip;
            }
            this.f7134 += i2;
        }

        public void m5807(ByteOrder byteOrder) {
            this.f7135 = byteOrder;
        }

        public int m5808() {
            return this.f7134;
        }

        public C1597(InputStream inputStream) throws IOException {
            this(inputStream, ByteOrder.BIG_ENDIAN);
        }

        public C1597(InputStream inputStream, ByteOrder byteOrder) throws IOException {
            this.f7135 = ByteOrder.BIG_ENDIAN;
            DataInputStream dataInputStream = new DataInputStream(inputStream);
            this.f7132 = dataInputStream;
            dataInputStream.mark(0);
            this.f7134 = 0;
            this.f7135 = byteOrder;
        }

        @Override
        public int read(byte[] bArr, int i, int i2) throws IOException {
            int read = this.f7132.read(bArr, i, i2);
            this.f7134 += read;
            return read;
        }

        @Override
        public void readFully(byte[] bArr) throws IOException {
            this.f7134 += bArr.length;
            this.f7132.readFully(bArr);
        }
    }

    @Retention(RetentionPolicy.SOURCE)
    @InterfaceC1762({InterfaceC1762.EnumC1763.LIBRARY})
    public @interface InterfaceC1599 {
    }

    public static class C1600 {

        public static final long f7140 = -1;

        public final int f7141;

        public final byte[] f7142;

        public final long f7143;

        public final int f7144;

        public C1600(int i, int i2, byte[] bArr) {
            this(i, i2, -1L, bArr);
        }

        public static C1600 m5810(double d, ByteOrder byteOrder) {
            return m5819(new double[]{d}, byteOrder);
        }

        public static C1600 m5811(C1601 c1601, ByteOrder byteOrder) {
            return m5813(new C1601[]{c1601}, byteOrder);
        }

        public static C1600 m5812(long[] jArr, ByteOrder byteOrder) {
            ByteBuffer wrap = ByteBuffer.wrap(new byte[C1596.f6870[4] * jArr.length]);
            wrap.order(byteOrder);
            for (long j : jArr) {
                wrap.putInt((int) j);
            }
            return new C1600(4, jArr.length, wrap.array());
        }

        public static C1600 m5813(C1601[] c1601Arr, ByteOrder byteOrder) {
            ByteBuffer wrap = ByteBuffer.wrap(new byte[C1596.f6870[10] * c1601Arr.length]);
            wrap.order(byteOrder);
            for (C1601 c1601 : c1601Arr) {
                wrap.putInt((int) c1601.f7146);
                wrap.putInt((int) c1601.f7145);
            }
            return new C1600(10, c1601Arr.length, wrap.array());
        }

        public static C1600 m5814(int i, ByteOrder byteOrder) {
            return m5823(new int[]{i}, byteOrder);
        }

        public static C1600 m5815(int i, ByteOrder byteOrder) {
            return m5821(new int[]{i}, byteOrder);
        }

        public static C1600 m5816(String str) {
            byte[] bytes = (str + (char) 0).getBytes(C1596.f6999);
            return new C1600(2, bytes.length, bytes);
        }

        public static C1600 m5817(C1601 c1601, ByteOrder byteOrder) {
            return m5818(new C1601[]{c1601}, byteOrder);
        }

        public static C1600 m5818(C1601[] c1601Arr, ByteOrder byteOrder) {
            ByteBuffer wrap = ByteBuffer.wrap(new byte[C1596.f6870[5] * c1601Arr.length]);
            wrap.order(byteOrder);
            for (C1601 c1601 : c1601Arr) {
                wrap.putInt((int) c1601.f7146);
                wrap.putInt((int) c1601.f7145);
            }
            return new C1600(5, c1601Arr.length, wrap.array());
        }

        public static C1600 m5819(double[] dArr, ByteOrder byteOrder) {
            ByteBuffer wrap = ByteBuffer.wrap(new byte[C1596.f6870[12] * dArr.length]);
            wrap.order(byteOrder);
            for (double d : dArr) {
                wrap.putDouble(d);
            }
            return new C1600(12, dArr.length, wrap.array());
        }

        public static C1600 m5820(String str) {
            if (str.length() == 1 && str.charAt(0) >= '0' && str.charAt(0) <= '1') {
                return new C1600(1, 1, new byte[]{(byte) (str.charAt(0) - '0')});
            }
            byte[] bytes = str.getBytes(C1596.f6999);
            return new C1600(1, bytes.length, bytes);
        }

        public static C1600 m5821(int[] iArr, ByteOrder byteOrder) {
            ByteBuffer wrap = ByteBuffer.wrap(new byte[C1596.f6870[3] * iArr.length]);
            wrap.order(byteOrder);
            for (int i : iArr) {
                wrap.putShort((short) i);
            }
            return new C1600(3, iArr.length, wrap.array());
        }

        public static C1600 m5822(long j, ByteOrder byteOrder) {
            return m5812(new long[]{j}, byteOrder);
        }

        public static C1600 m5823(int[] iArr, ByteOrder byteOrder) {
            ByteBuffer wrap = ByteBuffer.wrap(new byte[C1596.f6870[9] * iArr.length]);
            wrap.order(byteOrder);
            for (int i : iArr) {
                wrap.putInt(i);
            }
            return new C1600(9, iArr.length, wrap.array());
        }

        public String toString() {
            return C0033.C0034.f90 + C1596.f6907[this.f7144] + ", data length:" + this.f7142.length + C0033.C0034.f92;
        }

        public int m5824(ByteOrder byteOrder) {
            Object m5827 = m5827(byteOrder);
            if (m5827 == null) {
                throw new NumberFormatException("NULL can't be converted to a integer value");
            }
            if (m5827 instanceof String) {
                return Integer.parseInt((String) m5827);
            }
            if (m5827 instanceof long[]) {
                long[] jArr = (long[]) m5827;
                if (jArr.length == 1) {
                    return (int) jArr[0];
                }
                throw new NumberFormatException("There are more than one component");
            }
            if (!(m5827 instanceof int[])) {
                throw new NumberFormatException("Couldn't find a integer value");
            }
            int[] iArr = (int[]) m5827;
            if (iArr.length == 1) {
                return iArr[0];
            }
            throw new NumberFormatException("There are more than one component");
        }

        public int m5825() {
            return C1596.f6870[this.f7144] * this.f7141;
        }

        public String m5826(ByteOrder byteOrder) {
            Object m5827 = m5827(byteOrder);
            if (m5827 == null) {
                return null;
            }
            if (m5827 instanceof String) {
                return (String) m5827;
            }
            StringBuilder sb = new StringBuilder();
            int i = 0;
            if (m5827 instanceof long[]) {
                long[] jArr = (long[]) m5827;
                while (i < jArr.length) {
                    sb.append(jArr[i]);
                    i++;
                    if (i != jArr.length) {
                        sb.append(",");
                    }
                }
                return sb.toString();
            }
            if (m5827 instanceof int[]) {
                int[] iArr = (int[]) m5827;
                while (i < iArr.length) {
                    sb.append(iArr[i]);
                    i++;
                    if (i != iArr.length) {
                        sb.append(",");
                    }
                }
                return sb.toString();
            }
            if (m5827 instanceof double[]) {
                double[] dArr = (double[]) m5827;
                while (i < dArr.length) {
                    sb.append(dArr[i]);
                    i++;
                    if (i != dArr.length) {
                        sb.append(",");
                    }
                }
                return sb.toString();
            }
            if (!(m5827 instanceof C1601[])) {
                return null;
            }
            C1601[] c1601Arr = (C1601[]) m5827;
            while (i < c1601Arr.length) {
                sb.append(c1601Arr[i].f7146);
                sb.append('/');
                sb.append(c1601Arr[i].f7145);
                i++;
                if (i != c1601Arr.length) {
                    sb.append(",");
                }
            }
            return sb.toString();
        }

        public Object m5827(ByteOrder byteOrder) {
            C1597 c1597;
            byte b;
            byte[] bArr;
            C1597 c15972 = null;
            try {
                c1597 = new C1597(this.f7142);
            } catch (IOException unused) {
                c1597 = null;
            } catch (Throwable th) {
                th = th;
            }
            try {
                c1597.m5807(byteOrder);
                boolean z = true;
                int i = 0;
                switch (this.f7144) {
                    case 1:
                    case 6:
                        byte[] bArr2 = this.f7142;
                        if (bArr2.length != 1 || bArr2[0] < 0 || bArr2[0] > 1) {
                            String str = new String(this.f7142, C1596.f6999);
                            try {
                                c1597.close();
                            } catch (IOException unused2) {
                            }
                            return str;
                        }
                        String str2 = new String(new char[]{(char) (this.f7142[0] + 48)});
                        try {
                            c1597.close();
                        } catch (IOException unused3) {
                        }
                        return str2;
                    case 2:
                    case 7:
                        if (this.f7141 >= C1596.f6965.length) {
                            int i2 = 0;
                            while (true) {
                                bArr = C1596.f6965;
                                if (i2 < bArr.length) {
                                    if (this.f7142[i2] != bArr[i2]) {
                                        z = false;
                                    } else {
                                        i2++;
                                    }
                                }
                            }
                            if (z) {
                                i = bArr.length;
                            }
                        }
                        StringBuilder sb = new StringBuilder();
                        while (i < this.f7141 && (b = this.f7142[i]) != 0) {
                            if (b >= 32) {
                                sb.append((char) b);
                            } else {
                                sb.append('?');
                            }
                            i++;
                        }
                        String sb2 = sb.toString();
                        try {
                            c1597.close();
                        } catch (IOException unused4) {
                        }
                        return sb2;
                    case 3:
                        int[] iArr = new int[this.f7141];
                        while (i < this.f7141) {
                            iArr[i] = c1597.readUnsignedShort();
                            i++;
                        }
                        try {
                            c1597.close();
                        } catch (IOException unused5) {
                        }
                        return iArr;
                    case 4:
                        long[] jArr = new long[this.f7141];
                        while (i < this.f7141) {
                            jArr[i] = c1597.m5805();
                            i++;
                        }
                        try {
                            c1597.close();
                        } catch (IOException unused6) {
                        }
                        return jArr;
                    case 5:
                        C1601[] c1601Arr = new C1601[this.f7141];
                        while (i < this.f7141) {
                            c1601Arr[i] = new C1601(c1597.m5805(), c1597.m5805());
                            i++;
                        }
                        try {
                            c1597.close();
                        } catch (IOException unused7) {
                        }
                        return c1601Arr;
                    case 8:
                        int[] iArr2 = new int[this.f7141];
                        while (i < this.f7141) {
                            iArr2[i] = c1597.readShort();
                            i++;
                        }
                        try {
                            c1597.close();
                        } catch (IOException unused8) {
                        }
                        return iArr2;
                    case 9:
                        int[] iArr3 = new int[this.f7141];
                        while (i < this.f7141) {
                            iArr3[i] = c1597.readInt();
                            i++;
                        }
                        try {
                            c1597.close();
                        } catch (IOException unused9) {
                        }
                        return iArr3;
                    case 10:
                        C1601[] c1601Arr2 = new C1601[this.f7141];
                        while (i < this.f7141) {
                            c1601Arr2[i] = new C1601(c1597.readInt(), c1597.readInt());
                            i++;
                        }
                        try {
                            c1597.close();
                        } catch (IOException unused10) {
                        }
                        return c1601Arr2;
                    case 11:
                        double[] dArr = new double[this.f7141];
                        while (i < this.f7141) {
                            dArr[i] = c1597.readFloat();
                            i++;
                        }
                        try {
                            c1597.close();
                        } catch (IOException unused11) {
                        }
                        return dArr;
                    case 12:
                        double[] dArr2 = new double[this.f7141];
                        while (i < this.f7141) {
                            dArr2[i] = c1597.readDouble();
                            i++;
                        }
                        try {
                            c1597.close();
                        } catch (IOException unused12) {
                        }
                        return dArr2;
                    default:
                        try {
                            c1597.close();
                        } catch (IOException unused13) {
                        }
                        return null;
                }
            } catch (IOException unused14) {
                if (c1597 != null) {
                    try {
                        c1597.close();
                    } catch (IOException unused15) {
                    }
                }
                return null;
            } catch (Throwable th2) {
                th = th2;
                c15972 = c1597;
                if (c15972 != null) {
                    try {
                        c15972.close();
                    } catch (IOException unused16) {
                    }
                }
                throw th;
            }
        }

        public double m5828(ByteOrder byteOrder) {
            Object m5827 = m5827(byteOrder);
            if (m5827 == null) {
                throw new NumberFormatException("NULL can't be converted to a double value");
            }
            if (m5827 instanceof String) {
                return Double.parseDouble((String) m5827);
            }
            if (m5827 instanceof long[]) {
                if (((long[]) m5827).length == 1) {
                    return r5[0];
                }
                throw new NumberFormatException("There are more than one component");
            }
            if (m5827 instanceof int[]) {
                if (((int[]) m5827).length == 1) {
                    return r5[0];
                }
                throw new NumberFormatException("There are more than one component");
            }
            if (m5827 instanceof double[]) {
                double[] dArr = (double[]) m5827;
                if (dArr.length == 1) {
                    return dArr[0];
                }
                throw new NumberFormatException("There are more than one component");
            }
            if (!(m5827 instanceof C1601[])) {
                throw new NumberFormatException("Couldn't find a double value");
            }
            C1601[] c1601Arr = (C1601[]) m5827;
            if (c1601Arr.length == 1) {
                return c1601Arr[0].m5829();
            }
            throw new NumberFormatException("There are more than one component");
        }

        public C1600(int i, int i2, long j, byte[] bArr) {
            this.f7144 = i;
            this.f7141 = i2;
            this.f7143 = j;
            this.f7142 = bArr;
        }
    }

    public static class C1601 {

        public final long f7145;

        public final long f7146;

        public C1601(double d) {
            this((long) (d * 10000.0d), C6258.f24110);
        }

        public String toString() {
            return this.f7146 + "/" + this.f7145;
        }

        public double m5829() {
            double d = this.f7146;
            double d2 = this.f7145;
            Double.isNaN(d);
            Double.isNaN(d2);
            return d / d2;
        }

        public C1601(long j, long j2) {
            if (j2 == 0) {
                this.f7146 = 0L;
                this.f7145 = 1L;
            } else {
                this.f7146 = j;
                this.f7145 = j2;
            }
        }
    }

    public static class C1602 extends FilterOutputStream {

        public final OutputStream f7147;

        private ByteOrder f7148;

        public C1602(OutputStream outputStream, ByteOrder byteOrder) {
            super(outputStream);
            this.f7147 = outputStream;
            this.f7148 = byteOrder;
        }

        @Override
        public void write(byte[] bArr) throws IOException {
            this.f7147.write(bArr);
        }

        public void m5830(int i) throws IOException {
            this.f7147.write(i);
        }

        public void m5831(int i) throws IOException {
            m5832((short) i);
        }

        public void m5832(short s) throws IOException {
            ByteOrder byteOrder = this.f7148;
            if (byteOrder == ByteOrder.LITTLE_ENDIAN) {
                this.f7147.write((s >>> 0) & 255);
                this.f7147.write((s >>> 8) & 255);
            } else if (byteOrder == ByteOrder.BIG_ENDIAN) {
                this.f7147.write((s >>> 8) & 255);
                this.f7147.write((s >>> 0) & 255);
            }
        }

        public void m5833(int i) throws IOException {
            ByteOrder byteOrder = this.f7148;
            if (byteOrder == ByteOrder.LITTLE_ENDIAN) {
                this.f7147.write((i >>> 0) & 255);
                this.f7147.write((i >>> 8) & 255);
                this.f7147.write((i >>> 16) & 255);
                this.f7147.write((i >>> 24) & 255);
                return;
            }
            if (byteOrder == ByteOrder.BIG_ENDIAN) {
                this.f7147.write((i >>> 24) & 255);
                this.f7147.write((i >>> 16) & 255);
                this.f7147.write((i >>> 8) & 255);
                this.f7147.write((i >>> 0) & 255);
            }
        }

        public void m5834(ByteOrder byteOrder) {
            this.f7148 = byteOrder;
        }

        public void m5835(long j) throws IOException {
            m5833((int) j);
        }

        @Override
        public void write(byte[] bArr, int i, int i2) throws IOException {
            this.f7147.write(bArr, i, i2);
        }
    }

    public class C1603 extends MediaDataSource {

        public long f7149;

        public final C1604 f7151;

        public C1603(C1604 c1604) {
            this.f7151 = c1604;
        }

        @Override
        public void close() throws IOException {
        }

        @Override
        public long getSize() throws IOException {
            return -1L;
        }

        @Override
        public int readAt(long j, byte[] bArr, int i, int i2) throws IOException {
            if (i2 == 0) {
                return 0;
            }
            if (j < 0) {
                return -1;
            }
            try {
                long j2 = this.f7149;
                if (j2 != j) {
                    if (j2 >= 0 && j >= j2 + this.f7151.available()) {
                        return -1;
                    }
                    this.f7151.m5836(j);
                    this.f7149 = j;
                }
                if (i2 > this.f7151.available()) {
                    i2 = this.f7151.available();
                }
                int read = this.f7151.read(bArr, i, i2);
                if (read >= 0) {
                    this.f7149 += read;
                    return read;
                }
            } catch (IOException unused) {
            }
            this.f7149 = -1L;
            return -1;
        }
    }

    @Retention(RetentionPolicy.SOURCE)
    @InterfaceC1762({InterfaceC1762.EnumC1763.LIBRARY})
    public @interface InterfaceC1605 {
    }

    static {
        C1598[] c1598Arr = {new C1598(f6669, 254, 4), new C1598(f6996, 255, 4), new C1598(f7099, 256, 3, 4), new C1598(f6855, 257, 3, 4), new C1598(f7036, 258, 3), new C1598(f6939, 259, 3), new C1598(f6842, 262, 3), new C1598(f6683, SubsamplingScaleImageView.ORIENTATION_270, 2), new C1598(f7012, 271, 2), new C1598(f6835, 272, 2), new C1598(f6854, 273, 3, 4), new C1598(f6963, 274, 3), new C1598(f7017, 277, 3), new C1598(f6932, 278, 3, 4), new C1598(f7075, 279, 3, 4), new C1598(f6970, 282, 5), new C1598(f6833, 283, 5), new C1598(f6794, 284, 3), new C1598(f7042, 296, 3), new C1598(f6772, 301, 3), new C1598(f6824, 305, 2), new C1598(f7056, 306, 2), new C1598(f6881, 315, 2), new C1598(f6920, 318, 5), new C1598(f6874, TbsListener.ErrorCode.ERROR_QBSDK_INIT_CANLOADX5, 5), new C1598(f6982, TbsListener.ErrorCode.ERROR_QBSDK_INIT_ERROR_RET_TYPE_NOT_BUNDLE, 4), new C1598(f6971, C2712.f12425, 4), new C1598(f6807, 514, 4), new C1598(f6789, 529, 5), new C1598(f7067, 530, 3), new C1598(f7078, 531, 3), new C1598(f7035, 532, 5), new C1598(f6931, 33432, 2), new C1598(f6969, 34665, 4), new C1598(f7006, 34853, 4), new C1598(f6981, 4, 4), new C1598(f7079, 5, 4), new C1598(f7049, 6, 4), new C1598(f6903, 7, 4), new C1598(f6775, 23, 3), new C1598(f7054, 46, 7), new C1598(f6860, 700, 1)};
        f6743 = c1598Arr;
        C1598[] c1598Arr2 = {new C1598(f6884, 33434, 5), new C1598(f6723, 33437, 5), new C1598(f7055, 34850, 3), new C1598(f7007, 34852, 2), new C1598(f7010, 34855, 3), new C1598(f7065, 34856, 7), new C1598(f7106, 34864, 3), new C1598(f6944, 34865, 4), new C1598(f6804, 34866, 4), new C1598(f6821, 34867, 4), new C1598(f6811, 34868, 4), new C1598(f7046, 34869, 4), new C1598(f7045, 36864, 2), new C1598(f6814, 36867, 2), new C1598(f7094, 36868, 2), new C1598(f6914, 36880, 2), new C1598(f6995, 36881, 2), new C1598(f7080, 36882, 2), new C1598(f6925, 37121, 7), new C1598(f6827, 37122, 5), new C1598(f6849, 37377, 10), new C1598(f6941, 37378, 5), new C1598(f6899, 37379, 10), new C1598(f7014, 37380, 10), new C1598(f6837, 37381, 5), new C1598(f6987, 37382, 5), new C1598(f6928, 37383, 3), new C1598(f7015, 37384, 3), new C1598(f6664, 37385, 3), new C1598(f7085, 37386, 5), new C1598(f7003, 37396, 3), new C1598(f6791, 37500, 7), new C1598(f6922, 37510, 7), new C1598(f6983, 37520, 2), new C1598(f7022, 37521, 2), new C1598(f6857, 37522, 2), new C1598(f6986, 40960, 7), new C1598(f7059, 40961, 3), new C1598(f7097, 40962, 3, 4), new C1598(f6930, 40963, 3, 4), new C1598(f6840, 40964, 2), new C1598(f6956, 40965, 4), new C1598(f6863, 41483, 5), new C1598(f6825, 41484, 7), new C1598(f6728, 41486, 5), new C1598(f6942, 41487, 5), new C1598(f7077, 41488, 3), new C1598(f6839, 41492, 3), new C1598(f7073, 41493, 5), new C1598(f6816, 41495, 3), new C1598(f6717, 41728, 7), new C1598(f6994, 41729, 7), new C1598(f6978, 41730, 7), new C1598(f7091, 41985, 3), new C1598(f6703, 41986, 3), new C1598(f6936, 41987, 3), new C1598(f6777, 41988, 5), new C1598(f7047, 41989, 3), new C1598(f6826, 41990, 3), new C1598(f6711, 41991, 3), new C1598(f6733, 41992, 3), new C1598(f6667, 41993, 3), new C1598(f7031, 41994, 3), new C1598(f7087, 41995, 7), new C1598(f6726, 41996, 3), new C1598(f7039, 42016, 2), new C1598("CameraOwnerName", 42032, 2), new C1598(f6756, 42033, 2), new C1598(f6750, 42034, 5), new C1598(f6972, 42035, 2), new C1598(f7076, 42036, 2), new C1598(f6808, 42240, 5), new C1598(f6813, 50706, 1), new C1598(f6912, 50720, 3, 4)};
        f6929 = c1598Arr2;
        C1598[] c1598Arr3 = {new C1598(f7060, 0, 1), new C1598(f7004, 1, 2), new C1598(f6793, 2, 5, 10), new C1598(f7070, 3, 2), new C1598(f6973, 4, 5, 10), new C1598(f6831, 5, 1), new C1598(f6721, 6, 5), new C1598(f6702, 7, 5), new C1598(f6790, 8, 2), new C1598(f6848, 9, 2), new C1598(f6744, 10, 2), new C1598(f7005, 11, 5), new C1598(f6781, 12, 2), new C1598(f6759, 13, 5), new C1598(f7000, 14, 2), new C1598(f6701, 15, 5), new C1598(f6694, 16, 2), new C1598(f6768, 17, 5), new C1598(f6901, 18, 2), new C1598(f6788, 19, 2), new C1598(f6746, 20, 5), new C1598(f6823, 21, 2), new C1598(f6836, 22, 5), new C1598(f6699, 23, 2), new C1598(f7002, 24, 5), new C1598(f6911, 25, 2), new C1598(f6776, 26, 5), new C1598(f6710, 27, 7), new C1598(f6829, 28, 7), new C1598(f6850, 29, 2), new C1598(f6873, 30, 3), new C1598(f6862, 31, 5)};
        f6867 = c1598Arr3;
        C1598[] c1598Arr4 = {new C1598(f6705, 1, 2)};
        f6718 = c1598Arr4;
        C1598[] c1598Arr5 = {new C1598(f6669, 254, 4), new C1598(f6996, 255, 4), new C1598(f6921, 256, 3, 4), new C1598(f6704, 257, 3, 4), new C1598(f7036, 258, 3), new C1598(f6939, 259, 3), new C1598(f6842, 262, 3), new C1598(f6683, SubsamplingScaleImageView.ORIENTATION_270, 2), new C1598(f7012, 271, 2), new C1598(f6835, 272, 2), new C1598(f6854, 273, 3, 4), new C1598(f6700, 274, 3), new C1598(f7017, 277, 3), new C1598(f6932, 278, 3, 4), new C1598(f7075, 279, 3, 4), new C1598(f6970, 282, 5), new C1598(f6833, 283, 5), new C1598(f6794, 284, 3), new C1598(f7042, 296, 3), new C1598(f6772, 301, 3), new C1598(f6824, 305, 2), new C1598(f7056, 306, 2), new C1598(f6881, 315, 2), new C1598(f6920, 318, 5), new C1598(f6874, TbsListener.ErrorCode.ERROR_QBSDK_INIT_CANLOADX5, 5), new C1598(f6982, TbsListener.ErrorCode.ERROR_QBSDK_INIT_ERROR_RET_TYPE_NOT_BUNDLE, 4), new C1598(f6971, C2712.f12425, 4), new C1598(f6807, 514, 4), new C1598(f6789, 529, 5), new C1598(f7067, 530, 3), new C1598(f7078, 531, 3), new C1598(f7035, 532, 5), new C1598(f6860, 700, 1), new C1598(f6931, 33432, 2), new C1598(f6969, 34665, 4), new C1598(f7006, 34853, 4), new C1598(f6813, 50706, 1), new C1598(f6912, 50720, 3, 4)};
        f6958 = c1598Arr5;
        f6913 = new C1598(f6854, 273, 3);
        C1598[] c1598Arr6 = {new C1598(f6968, 256, 7), new C1598(f6859, 8224, 4), new C1598(f6779, 8256, 4)};
        f6904 = c1598Arr6;
        C1598[] c1598Arr7 = {new C1598(f6886, 257, 4), new C1598(f6880, 258, 4)};
        f6888 = c1598Arr7;
        C1598[] c1598Arr8 = {new C1598(f6976, 4371, 3)};
        f6760 = c1598Arr8;
        C1598[] c1598Arr9 = {new C1598(f7059, 55, 3)};
        f6724 = c1598Arr9;
        C1598[][] c1598Arr10 = {c1598Arr, c1598Arr2, c1598Arr3, c1598Arr4, c1598Arr5, c1598Arr, c1598Arr6, c1598Arr7, c1598Arr8, c1598Arr9};
        f7032 = c1598Arr10;
        f6674 = new C1598[]{new C1598(f6982, TbsListener.ErrorCode.ERROR_QBSDK_INIT_ERROR_RET_TYPE_NOT_BUNDLE, 4), new C1598(f6969, 34665, 4), new C1598(f7006, 34853, 4), new C1598(f6956, 40965, 4), new C1598(f6859, 8224, 1), new C1598(f6779, 8256, 1)};
        f6810 = new HashMap[c1598Arr10.length];
        f6897 = new HashMap[c1598Arr10.length];
        f6853 = new HashSet<>(Arrays.asList(f6723, f6777, f6884, f6987, f6702));
        f6947 = new HashMap<>();
        Charset forName = Charset.forName("US-ASCII");
        f6999 = forName;
        f6926 = "Exif\u0000\u0000".getBytes(forName);
        f6706 = "http://ns.adobe.com/xap/1.0/\u0000".getBytes(forName);
        Locale locale = Locale.US;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", locale);
        f6845 = simpleDateFormat;
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
        SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat(C6305.f24250, locale);
        f6872 = simpleDateFormat2;
        simpleDateFormat2.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
        int i = 0;
        while (true) {
            C1598[][] c1598Arr11 = f7032;
            if (i >= c1598Arr11.length) {
                HashMap<Integer, Integer> hashMap = f6947;
                C1598[] c1598Arr12 = f6674;
                hashMap.put(Integer.valueOf(c1598Arr12[0].f7139), 5);
                hashMap.put(Integer.valueOf(c1598Arr12[1].f7139), 1);
                hashMap.put(Integer.valueOf(c1598Arr12[2].f7139), 2);
                hashMap.put(Integer.valueOf(c1598Arr12[3].f7139), 3);
                hashMap.put(Integer.valueOf(c1598Arr12[4].f7139), 7);
                hashMap.put(Integer.valueOf(c1598Arr12[5].f7139), 8);
                f6945 = Pattern.compile(".*[1-9].*");
                f6727 = Pattern.compile("^(\\d{2}):(\\d{2}):(\\d{2})$");
                f6919 = Pattern.compile("^(\\d{4}):(\\d{2}):(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$");
                f6820 = Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$");
                return;
            }
            f6810[i] = new HashMap<>();
            f6897[i] = new HashMap<>();
            for (C1598 c1598 : c1598Arr11[i]) {
                f6810[i].put(Integer.valueOf(c1598.f7139), c1598);
                f6897[i].put(c1598.f7136, c1598);
            }
            i++;
        }
    }

    public C1596(@InterfaceC1793 File file) throws IOException {
        C1598[][] c1598Arr = f7032;
        this.f7111 = new HashMap[c1598Arr.length];
        this.f7115 = new HashSet(c1598Arr.length);
        this.f7118 = ByteOrder.BIG_ENDIAN;
        Objects.requireNonNull(file, "file cannot be null");
        m5729(file.getAbsolutePath());
    }

    private boolean m5722(byte[] bArr) throws IOException {
        byte[] bytes = f6964.getBytes(Charset.defaultCharset());
        for (int i = 0; i < bytes.length; i++) {
            if (bArr[i] != bytes[i]) {
                return false;
            }
        }
        return true;
    }

    private String m5723(double d) {
        long j = (long) d;
        double d2 = j;
        Double.isNaN(d2);
        double d3 = d - d2;
        long j2 = (long) (d3 * 60.0d);
        double d4 = j2;
        Double.isNaN(d4);
        return j + "/1," + j2 + "/1," + Math.round((d3 - (d4 / 60.0d)) * 3600.0d * 1.0E7d) + "/10000000";
    }

    private void m5724(C1597 c1597, int i, int i2) throws IOException {
        if (f6894) {
            String str = "getJpegAttributes starting with: " + c1597;
        }
        c1597.m5807(ByteOrder.BIG_ENDIAN);
        byte readByte = c1597.readByte();
        byte b = -1;
        if (readByte != -1) {
            throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255));
        }
        if (c1597.readByte() != -40) {
            throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255));
        }
        int i3 = 2;
        int i4 = 2;
        while (true) {
            byte readByte2 = c1597.readByte();
            if (readByte2 != b) {
                throw new IOException("Invalid marker:" + Integer.toHexString(readByte2 & 255));
            }
            int i5 = i4 + 1;
            byte readByte3 = c1597.readByte();
            boolean z = f6894;
            if (z) {
                String str2 = "Found JPEG segment indicator: " + Integer.toHexString(readByte3 & 255);
            }
            int i6 = i5 + 1;
            if (readByte3 != -39 && readByte3 != -38) {
                int readUnsignedShort = c1597.readUnsignedShort() - i3;
                int i7 = i6 + i3;
                if (z) {
                    String str3 = "JPEG segment: " + Integer.toHexString(readByte3 & 255) + " (length: " + (readUnsignedShort + 2) + C0033.C0034.f92;
                }
                if (readUnsignedShort < 0) {
                    throw new IOException("Invalid length");
                }
                if (readByte3 == -31) {
                    byte[] bArr = new byte[readUnsignedShort];
                    c1597.readFully(bArr);
                    int i8 = i7 + readUnsignedShort;
                    byte[] bArr2 = f6926;
                    if (C1593.m5714(bArr, bArr2)) {
                        byte[] copyOfRange = Arrays.copyOfRange(bArr, bArr2.length, readUnsignedShort);
                        this.f7109 = i + i7 + bArr2.length;
                        m5727(copyOfRange, i2);
                        m5759(new C1597(copyOfRange));
                    } else {
                        byte[] bArr3 = f6706;
                        if (C1593.m5714(bArr, bArr3)) {
                            int length = i7 + bArr3.length;
                            byte[] copyOfRange2 = Arrays.copyOfRange(bArr, bArr3.length, readUnsignedShort);
                            if (m5799(f6860) == null) {
                                this.f7111[0].put(f6860, new C1600(1, copyOfRange2.length, length, copyOfRange2));
                                this.f7114 = true;
                            }
                        }
                    }
                    i7 = i8;
                } else if (readByte3 != -2) {
                    switch (readByte3) {
                        default:
                            switch (readByte3) {
                                default:
                                    switch (readByte3) {
                                        default:
                                            switch (readByte3) {
                                            }
                                        case -55:
                                        case -54:
                                        case -53:
                                            c1597.m5806(1);
                                            this.f7111[i2].put(i2 != 4 ? f6855 : f6704, C1600.m5822(c1597.readUnsignedShort(), this.f7118));
                                            this.f7111[i2].put(i2 != 4 ? f7099 : f6921, C1600.m5822(c1597.readUnsignedShort(), this.f7118));
                                            readUnsignedShort -= 5;
                                            break;
                                    }
                                case -59:
                                case -58:
                                case -57:
                                    break;
                            }
                        case -64:
                        case -63:
                        case -62:
                        case -61:
                            break;
                    }
                    if (readUnsignedShort >= 0) {
                        throw new IOException("Invalid length");
                    }
                    c1597.m5806(readUnsignedShort);
                    i4 = i7 + readUnsignedShort;
                    i3 = 2;
                    b = -1;
                } else {
                    byte[] bArr4 = new byte[readUnsignedShort];
                    if (c1597.read(bArr4) != readUnsignedShort) {
                        throw new IOException("Invalid exif");
                    }
                    if (m5799(f6922) == null) {
                        this.f7111[1].put(f6922, C1600.m5816(new String(bArr4, f6999)));
                    }
                }
                readUnsignedShort = 0;
                if (readUnsignedShort >= 0) {
                }
            }
        }
    }

    private static boolean m5725(BufferedInputStream bufferedInputStream) throws IOException {
        byte[] bArr = f6926;
        bufferedInputStream.mark(bArr.length);
        byte[] bArr2 = new byte[bArr.length];
        bufferedInputStream.read(bArr2);
        bufferedInputStream.reset();
        int i = 0;
        while (true) {
            byte[] bArr3 = f6926;
            if (i >= bArr3.length) {
                return true;
            }
            if (bArr2[i] != bArr3[i]) {
                return false;
            }
            i++;
        }
    }

    private static boolean m5726(byte[] bArr) throws IOException {
        int i = 0;
        while (true) {
            byte[] bArr2 = f6819;
            if (i >= bArr2.length) {
                return true;
            }
            if (bArr[i] != bArr2[i]) {
                return false;
            }
            i++;
        }
    }

    private void m5727(byte[] bArr, int i) throws IOException {
        C1604 c1604 = new C1604(bArr);
        m5751(c1604);
        m5749(c1604, i);
    }

    private void m5728() throws IOException {
        m5773(0, 5);
        m5773(0, 4);
        m5773(5, 4);
        C1600 c1600 = this.f7111[1].get(f7097);
        C1600 c16002 = this.f7111[1].get(f6930);
        if (c1600 != null && c16002 != null) {
            this.f7111[0].put(f7099, c1600);
            this.f7111[0].put(f6855, c16002);
        }
        if (this.f7111[4].isEmpty() && m5766(this.f7111[5])) {
            HashMap<String, C1600>[] hashMapArr = this.f7111;
            hashMapArr[4] = hashMapArr[5];
            hashMapArr[5] = new HashMap<>();
        }
        m5766(this.f7111[4]);
        m5731(0, f6700, f6963);
        m5731(0, f6704, f6855);
        m5731(0, f6921, f7099);
        m5731(5, f6700, f6963);
        m5731(5, f6704, f6855);
        m5731(5, f6921, f7099);
        m5731(4, f6963, f6700);
        m5731(4, f6855, f6704);
        m5731(4, f7099, f6921);
    }

    private void m5729(String str) throws IOException {
        Objects.requireNonNull(str, "filename cannot be null");
        FileInputStream fileInputStream = null;
        this.f7122 = null;
        this.f7124 = str;
        try {
            FileInputStream fileInputStream2 = new FileInputStream(str);
            try {
                if (m5736(fileInputStream2.getFD())) {
                    this.f7110 = fileInputStream2.getFD();
                } else {
                    this.f7110 = null;
                }
                m5730(fileInputStream2);
                C1593.m5715(fileInputStream2);
            } catch (Throwable th) {
                th = th;
                fileInputStream = fileInputStream2;
                C1593.m5715(fileInputStream);
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    private void m5730(@InterfaceC1793 InputStream inputStream) {
        Objects.requireNonNull(inputStream, "inputstream shouldn't be null");
        for (int i = 0; i < f7032.length; i++) {
            try {
                try {
                    this.f7111[i] = new HashMap<>();
                } catch (IOException | UnsupportedOperationException unused) {
                    boolean z = f6894;
                    m5758();
                    if (!z) {
                        return;
                    }
                }
            } finally {
                m5758();
                if (f6894) {
                    m5750();
                }
            }
        }
        if (!this.f7129) {
            BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
            this.f7116 = m5744(bufferedInputStream);
            inputStream = bufferedInputStream;
        }
        if (m5769(this.f7116)) {
            C1604 c1604 = new C1604(inputStream);
            if (this.f7129) {
                m5761(c1604);
            } else {
                int i2 = this.f7116;
                if (i2 == 12) {
                    m5745(c1604);
                } else if (i2 == 7) {
                    m5771(c1604);
                } else if (i2 == 10) {
                    m5756(c1604);
                } else {
                    m5754(c1604);
                }
            }
            c1604.m5836(this.f7109);
            m5759(c1604);
        } else {
            C1597 c1597 = new C1597(inputStream);
            int i3 = this.f7116;
            if (i3 == 4) {
                m5724(c1597, 0, 0);
            } else if (i3 == 13) {
                m5739(c1597);
            } else if (i3 == 9) {
                m5764(c1597);
            } else if (i3 == 14) {
                m5735(c1597);
            }
        }
    }

    private void m5731(int i, String str, String str2) {
        if (this.f7111[i].isEmpty() || this.f7111[i].get(str) == null) {
            return;
        }
        HashMap[] hashMapArr = this.f7111;
        hashMapArr[i].put(str2, hashMapArr[i].get(str));
        this.f7111[i].remove(str);
    }

    private int m5732(C1602 c1602) throws IOException {
        C1598[][] c1598Arr = f7032;
        int[] iArr = new int[c1598Arr.length];
        int[] iArr2 = new int[c1598Arr.length];
        for (C1598 c1598 : f6674) {
            m5737(c1598.f7136);
        }
        if (this.f7128) {
            if (this.f7112) {
                m5737(f6854);
                m5737(f7075);
            } else {
                m5737(f6971);
                m5737(f6807);
            }
        }
        for (int i = 0; i < f7032.length; i++) {
            for (Object obj : this.f7111[i].entrySet().toArray()) {
                Map.Entry entry = (Map.Entry) obj;
                if (entry.getValue() == null) {
                    this.f7111[i].remove(entry.getKey());
                }
            }
        }
        if (!this.f7111[1].isEmpty()) {
            this.f7111[0].put(f6674[1].f7136, C1600.m5822(0L, this.f7118));
        }
        if (!this.f7111[2].isEmpty()) {
            this.f7111[0].put(f6674[2].f7136, C1600.m5822(0L, this.f7118));
        }
        if (!this.f7111[3].isEmpty()) {
            this.f7111[1].put(f6674[3].f7136, C1600.m5822(0L, this.f7118));
        }
        if (this.f7128) {
            if (this.f7112) {
                this.f7111[4].put(f6854, C1600.m5815(0, this.f7118));
                this.f7111[4].put(f7075, C1600.m5815(this.f7117, this.f7118));
            } else {
                this.f7111[4].put(f6971, C1600.m5822(0L, this.f7118));
                this.f7111[4].put(f6807, C1600.m5822(this.f7117, this.f7118));
            }
        }
        for (int i2 = 0; i2 < f7032.length; i2++) {
            Iterator<Map.Entry<String, C1600>> it = this.f7111[i2].entrySet().iterator();
            int i3 = 0;
            while (it.hasNext()) {
                int m5825 = it.next().getValue().m5825();
                if (m5825 > 4) {
                    i3 += m5825;
                }
            }
            iArr2[i2] = iArr2[i2] + i3;
        }
        int i4 = 8;
        for (int i5 = 0; i5 < f7032.length; i5++) {
            if (!this.f7111[i5].isEmpty()) {
                iArr[i5] = i4;
                i4 += (this.f7111[i5].size() * 12) + 2 + 4 + iArr2[i5];
            }
        }
        if (this.f7128) {
            if (this.f7112) {
                this.f7111[4].put(f6854, C1600.m5815(i4, this.f7118));
            } else {
                this.f7111[4].put(f6971, C1600.m5822(i4, this.f7118));
            }
            this.f7120 = i4;
            i4 += this.f7117;
        }
        if (this.f7116 == 4) {
            i4 += 8;
        }
        if (f6894) {
            for (int i6 = 0; i6 < f7032.length; i6++) {
                String.format("index: %d, offsets: %d, tag count: %d, data sizes: %d, total size: %d", Integer.valueOf(i6), Integer.valueOf(iArr[i6]), Integer.valueOf(this.f7111[i6].size()), Integer.valueOf(iArr2[i6]), Integer.valueOf(i4));
            }
        }
        if (!this.f7111[1].isEmpty()) {
            this.f7111[0].put(f6674[1].f7136, C1600.m5822(iArr[1], this.f7118));
        }
        if (!this.f7111[2].isEmpty()) {
            this.f7111[0].put(f6674[2].f7136, C1600.m5822(iArr[2], this.f7118));
        }
        if (!this.f7111[3].isEmpty()) {
            this.f7111[1].put(f6674[3].f7136, C1600.m5822(iArr[3], this.f7118));
        }
        int i7 = this.f7116;
        if (i7 == 4) {
            c1602.m5831(i4);
            c1602.write(f6926);
        } else if (i7 == 13) {
            c1602.m5833(i4);
            c1602.write(f7062);
        } else if (i7 == 14) {
            c1602.write(f6803);
            c1602.m5833(i4);
        }
        c1602.m5832(this.f7118 == ByteOrder.BIG_ENDIAN ? f6755 : f6784);
        c1602.m5834(this.f7118);
        c1602.m5831(42);
        c1602.m5835(8L);
        for (int i8 = 0; i8 < f7032.length; i8++) {
            if (!this.f7111[i8].isEmpty()) {
                c1602.m5831(this.f7111[i8].size());
                int size = iArr[i8] + 2 + (this.f7111[i8].size() * 12) + 4;
                for (Map.Entry<String, C1600> entry2 : this.f7111[i8].entrySet()) {
                    int i9 = f6897[i8].get(entry2.getKey()).f7139;
                    C1600 value = entry2.getValue();
                    int m58252 = value.m5825();
                    c1602.m5831(i9);
                    c1602.m5831(value.f7144);
                    c1602.m5833(value.f7141);
                    if (m58252 > 4) {
                        c1602.m5835(size);
                        size += m58252;
                    } else {
                        c1602.write(value.f7142);
                        if (m58252 < 4) {
                            while (m58252 < 4) {
                                c1602.m5830(0);
                                m58252++;
                            }
                        }
                    }
                }
                if (i8 != 0 || this.f7111[4].isEmpty()) {
                    c1602.m5835(0L);
                } else {
                    c1602.m5835(iArr[4]);
                }
                Iterator<Map.Entry<String, C1600>> it2 = this.f7111[i8].entrySet().iterator();
                while (it2.hasNext()) {
                    byte[] bArr = it2.next().getValue().f7142;
                    if (bArr.length > 4) {
                        c1602.write(bArr, 0, bArr.length);
                    }
                }
            }
        }
        if (this.f7128) {
            c1602.write(m5802());
        }
        if (this.f7116 == 14 && i4 % 2 == 1) {
            c1602.m5830(0);
        }
        c1602.m5834(ByteOrder.BIG_ENDIAN);
        return i4;
    }

    private boolean m5733(HashMap hashMap) throws IOException {
        C1600 c1600;
        C1600 c16002 = (C1600) hashMap.get(f7036);
        if (c16002 == null) {
            return false;
        }
        int[] iArr = (int[]) c16002.m5827(this.f7118);
        int[] iArr2 = f6898;
        if (Arrays.equals(iArr2, iArr)) {
            return true;
        }
        if (this.f7116 != 3 || (c1600 = (C1600) hashMap.get(f6842)) == null) {
            return false;
        }
        int m5824 = c1600.m5824(this.f7118);
        return (m5824 == 1 && Arrays.equals(iArr, f6882)) || (m5824 == 6 && Arrays.equals(iArr, iArr2));
    }

    private ByteOrder m5734(C1597 c1597) throws IOException {
        short readShort = c1597.readShort();
        if (readShort == 18761) {
            boolean z = f6894;
            return ByteOrder.LITTLE_ENDIAN;
        }
        if (readShort == 19789) {
            boolean z2 = f6894;
            return ByteOrder.BIG_ENDIAN;
        }
        throw new IOException("Invalid byte order: " + Integer.toHexString(readShort));
    }

    private void m5735(C1597 c1597) throws IOException {
        if (f6894) {
            String str = "getWebpAttributes starting with: " + c1597;
        }
        c1597.m5807(ByteOrder.LITTLE_ENDIAN);
        c1597.m5806(f6751.length);
        int readInt = c1597.readInt() + 8;
        byte[] bArr = f6680;
        c1597.m5806(bArr.length);
        int length = bArr.length + 8;
        while (true) {
            try {
                byte[] bArr2 = new byte[4];
                if (c1597.read(bArr2) != 4) {
                    throw new IOException("Encountered invalid length while parsing WebP chunktype");
                }
                int readInt2 = c1597.readInt();
                int i = length + 4 + 4;
                if (Arrays.equals(f6803, bArr2)) {
                    byte[] bArr3 = new byte[readInt2];
                    if (c1597.read(bArr3) == readInt2) {
                        this.f7109 = i;
                        m5727(bArr3, 0);
                        m5759(new C1597(bArr3));
                        return;
                    } else {
                        throw new IOException("Failed to read given length for given PNG chunk type: " + C1593.m5716(bArr2));
                    }
                }
                if (readInt2 % 2 == 1) {
                    readInt2++;
                }
                length = i + readInt2;
                if (length == readInt) {
                    return;
                }
                if (length > readInt) {
                    throw new IOException("Encountered WebP file with invalid chunk size");
                }
                c1597.m5806(readInt2);
            } catch (EOFException unused) {
                throw new IOException("Encountered corrupt WebP file.");
            }
        }
    }

    private static boolean m5736(FileDescriptor fileDescriptor) {
        if (Build.VERSION.SDK_INT >= 21) {
            try {
                C1593.C1595.m5720(fileDescriptor, 0L, OsConstants.SEEK_CUR);
                return true;
            } catch (Exception unused) {
                boolean z = f6894;
            }
        }
        return false;
    }

    private void m5737(String str) {
        for (int i = 0; i < f7032.length; i++) {
            this.f7111[i].remove(str);
        }
    }

    private void m5738(C1597 c1597, HashMap hashMap) throws IOException {
        C1600 c1600 = (C1600) hashMap.get(f6971);
        C1600 c16002 = (C1600) hashMap.get(f6807);
        if (c1600 == null || c16002 == null) {
            return;
        }
        int m5824 = c1600.m5824(this.f7118);
        int m58242 = c16002.m5824(this.f7118);
        if (this.f7116 == 7) {
            m5824 += this.f7123;
        }
        if (m5824 > 0 && m58242 > 0) {
            this.f7128 = true;
            if (this.f7124 == null && this.f7122 == null && this.f7110 == null) {
                byte[] bArr = new byte[m58242];
                c1597.skip(m5824);
                c1597.read(bArr);
                this.f7127 = bArr;
            }
            this.f7120 = m5824;
            this.f7117 = m58242;
        }
        if (f6894) {
            String str = "Setting thumbnail attributes with offset: " + m5824 + ", length: " + m58242;
        }
    }

    private void m5739(C1597 c1597) throws IOException {
        if (f6894) {
            String str = "getPngAttributes starting with: " + c1597;
        }
        c1597.m5807(ByteOrder.BIG_ENDIAN);
        byte[] bArr = f6830;
        c1597.m5806(bArr.length);
        int length = bArr.length + 0;
        while (true) {
            try {
                int readInt = c1597.readInt();
                int i = length + 4;
                byte[] bArr2 = new byte[4];
                if (c1597.read(bArr2) != 4) {
                    throw new IOException("Encountered invalid length while parsing PNG chunktype");
                }
                int i2 = i + 4;
                if (i2 == 16 && !Arrays.equals(bArr2, f6754)) {
                    throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk");
                }
                if (Arrays.equals(bArr2, f6949)) {
                    return;
                }
                if (Arrays.equals(bArr2, f7062)) {
                    byte[] bArr3 = new byte[readInt];
                    if (c1597.read(bArr3) != readInt) {
                        throw new IOException("Failed to read given length for given PNG chunk type: " + C1593.m5716(bArr2));
                    }
                    int readInt2 = c1597.readInt();
                    CRC32 crc32 = new CRC32();
                    crc32.update(bArr2);
                    crc32.update(bArr3);
                    if (((int) crc32.getValue()) == readInt2) {
                        this.f7109 = i2;
                        m5727(bArr3, 0);
                        m5728();
                        m5759(new C1597(bArr3));
                        return;
                    }
                    throw new IOException("Encountered invalid CRC value for PNG-EXIF chunk.\n recorded CRC value: " + readInt2 + ", calculated CRC value: " + crc32.getValue());
                }
                int i3 = readInt + 4;
                c1597.m5806(i3);
                length = i2 + i3;
            } catch (EOFException unused) {
                throw new IOException("Encountered corrupt PNG file.");
            }
        }
    }

    private void m5740(InputStream inputStream, OutputStream outputStream) throws IOException {
        ByteArrayOutputStream byteArrayOutputStream;
        int i;
        int i2;
        int i3;
        int i4;
        if (f6894) {
            String str = "saveWebpAttributes starting with (inputStream: " + inputStream + ", outputStream: " + outputStream + C0033.C0034.f92;
        }
        ByteOrder byteOrder = ByteOrder.LITTLE_ENDIAN;
        C1597 c1597 = new C1597(inputStream, byteOrder);
        C1602 c1602 = new C1602(outputStream, byteOrder);
        byte[] bArr = f6751;
        C1593.m5711(c1597, c1602, bArr.length);
        byte[] bArr2 = f6680;
        c1597.m5806(bArr2.length + 4);
        ByteArrayOutputStream byteArrayOutputStream2 = null;
        try {
            try {
                byteArrayOutputStream = new ByteArrayOutputStream();
            } catch (Exception e) {
                e = e;
            }
        } catch (Throwable th) {
            th = th;
        }
        try {
            C1602 c16022 = new C1602(byteArrayOutputStream, byteOrder);
            int i5 = this.f7109;
            if (i5 != 0) {
                C1593.m5711(c1597, c16022, ((i5 - ((bArr.length + 4) + bArr2.length)) - 4) - 4);
                c1597.m5806(4);
                c1597.m5806(c1597.readInt());
                m5732(c16022);
            } else {
                byte[] bArr3 = new byte[4];
                if (c1597.read(bArr3) != 4) {
                    throw new IOException("Encountered invalid length while parsing WebP chunk type");
                }
                byte[] bArr4 = f7051;
                boolean z = true;
                if (Arrays.equals(bArr3, bArr4)) {
                    int readInt = c1597.readInt();
                    byte[] bArr5 = new byte[readInt % 2 == 1 ? readInt + 1 : readInt];
                    c1597.read(bArr5);
                    bArr5[0] = (byte) (8 | bArr5[0]);
                    if (((bArr5[0] >> 1) & 1) != 1) {
                        z = false;
                    }
                    c16022.write(bArr4);
                    c16022.m5833(readInt);
                    c16022.write(bArr5);
                    if (z) {
                        m5741(c1597, c16022, f6918, null);
                        while (true) {
                            byte[] bArr6 = new byte[4];
                            inputStream.read(bArr6);
                            if (!Arrays.equals(bArr6, f6785)) {
                                break;
                            } else {
                                m5772(c1597, c16022, bArr6);
                            }
                        }
                        m5732(c16022);
                    } else {
                        m5741(c1597, c16022, f6906, f6687);
                        m5732(c16022);
                    }
                } else {
                    byte[] bArr7 = f6906;
                    if (Arrays.equals(bArr3, bArr7) || Arrays.equals(bArr3, f6687)) {
                        int readInt2 = c1597.readInt();
                        int i6 = readInt2 % 2 == 1 ? readInt2 + 1 : readInt2;
                        byte[] bArr8 = new byte[3];
                        if (Arrays.equals(bArr3, bArr7)) {
                            c1597.read(bArr8);
                            byte[] bArr9 = new byte[3];
                            if (c1597.read(bArr9) != 3 || !Arrays.equals(f6771, bArr9)) {
                                throw new IOException("Encountered error while checking VP8 signature");
                            }
                            i = c1597.readInt();
                            i2 = (i << 18) >> 18;
                            i3 = (i << 2) >> 18;
                            i6 -= 10;
                        } else if (!Arrays.equals(bArr3, f6687)) {
                            i = 0;
                            i2 = 0;
                            i3 = 0;
                        } else {
                            if (c1597.readByte() != 47) {
                                throw new IOException("Encountered error while checking VP8L signature");
                            }
                            i = c1597.readInt();
                            i4 = i & 8;
                            i6 -= 5;
                            i3 = ((i << 4) >> 18) + 1;
                            i2 = ((i << 18) >> 18) + 1;
                            c16022.write(bArr4);
                            c16022.m5833(10);
                            byte[] bArr10 = new byte[10];
                            bArr10[0] = (byte) (bArr10[0] | 8);
                            bArr10[0] = (byte) (bArr10[0] | (i4 << 4));
                            int i7 = i2 - 1;
                            int i8 = i3 - 1;
                            bArr10[4] = (byte) i7;
                            bArr10[5] = (byte) (i7 >> 8);
                            bArr10[6] = (byte) (i7 >> 16);
                            bArr10[7] = (byte) i8;
                            bArr10[8] = (byte) (i8 >> 8);
                            bArr10[9] = (byte) (i8 >> 16);
                            c16022.write(bArr10);
                            c16022.write(bArr3);
                            c16022.m5833(readInt2);
                            if (!Arrays.equals(bArr3, bArr7)) {
                                c16022.write(bArr8);
                                c16022.write(f6771);
                                c16022.m5833(i);
                            } else if (Arrays.equals(bArr3, f6687)) {
                                c16022.write(47);
                                c16022.m5833(i);
                            }
                            C1593.m5711(c1597, c16022, i6);
                            m5732(c16022);
                        }
                        i4 = 0;
                        c16022.write(bArr4);
                        c16022.m5833(10);
                        byte[] bArr102 = new byte[10];
                        bArr102[0] = (byte) (bArr102[0] | 8);
                        bArr102[0] = (byte) (bArr102[0] | (i4 << 4));
                        int i72 = i2 - 1;
                        int i82 = i3 - 1;
                        bArr102[4] = (byte) i72;
                        bArr102[5] = (byte) (i72 >> 8);
                        bArr102[6] = (byte) (i72 >> 16);
                        bArr102[7] = (byte) i82;
                        bArr102[8] = (byte) (i82 >> 8);
                        bArr102[9] = (byte) (i82 >> 16);
                        c16022.write(bArr102);
                        c16022.write(bArr3);
                        c16022.m5833(readInt2);
                        if (!Arrays.equals(bArr3, bArr7)) {
                        }
                        C1593.m5711(c1597, c16022, i6);
                        m5732(c16022);
                    }
                }
            }
            C1593.m5717(c1597, c16022);
            int size = byteArrayOutputStream.size();
            byte[] bArr11 = f6680;
            c1602.m5833(size + bArr11.length);
            c1602.write(bArr11);
            byteArrayOutputStream.writeTo(c1602);
            C1593.m5715(byteArrayOutputStream);
        } catch (Exception e2) {
            e = e2;
            byteArrayOutputStream2 = byteArrayOutputStream;
            throw new IOException("Failed to save WebP file", e);
        } catch (Throwable th2) {
            th = th2;
            byteArrayOutputStream2 = byteArrayOutputStream;
            C1593.m5715(byteArrayOutputStream2);
            throw th;
        }
    }

    private void m5741(C1597 c1597, C1602 c1602, byte[] bArr, byte[] bArr2) throws IOException {
        String str;
        while (true) {
            byte[] bArr3 = new byte[4];
            if (c1597.read(bArr3) != 4) {
                StringBuilder sb = new StringBuilder();
                sb.append("Encountered invalid length while copying WebP chunks up tochunk type ");
                Charset charset = f6999;
                sb.append(new String(bArr, charset));
                if (bArr2 == null) {
                    str = "";
                } else {
                    str = " or " + new String(bArr2, charset);
                }
                sb.append(str);
                throw new IOException(sb.toString());
            }
            m5772(c1597, c1602, bArr3);
            if (Arrays.equals(bArr3, bArr)) {
                return;
            }
            if (bArr2 != null && Arrays.equals(bArr3, bArr2)) {
                return;
            }
        }
    }

    private boolean m5742(byte[] bArr) throws IOException {
        C1597 c1597;
        long readInt;
        byte[] bArr2;
        C1597 c15972 = null;
        try {
            try {
                c1597 = new C1597(bArr);
            } catch (Exception unused) {
            }
        } catch (Throwable th) {
            th = th;
        }
        try {
            readInt = c1597.readInt();
            bArr2 = new byte[4];
            c1597.read(bArr2);
        } catch (Exception unused2) {
            c15972 = c1597;
            boolean z = f6894;
            if (c15972 != null) {
                c15972.close();
            }
            return false;
        } catch (Throwable th2) {
            th = th2;
            c15972 = c1597;
            if (c15972 != null) {
                c15972.close();
            }
            throw th;
        }
        if (!Arrays.equals(bArr2, f6883)) {
            c1597.close();
            return false;
        }
        long j = 16;
        if (readInt == 1) {
            readInt = c1597.readLong();
            if (readInt < 16) {
                c1597.close();
                return false;
            }
        } else {
            j = 8;
        }
        if (readInt > bArr.length) {
            readInt = bArr.length;
        }
        long j2 = readInt - j;
        if (j2 < 8) {
            c1597.close();
            return false;
        }
        byte[] bArr3 = new byte[4];
        boolean z2 = false;
        boolean z3 = false;
        for (long j3 = 0; j3 < j2 / 4; j3++) {
            if (c1597.read(bArr3) != 4) {
                c1597.close();
                return false;
            }
            if (j3 != 1) {
                if (Arrays.equals(bArr3, f6817)) {
                    z2 = true;
                } else if (Arrays.equals(bArr3, f6741)) {
                    z3 = true;
                }
                if (z2 && z3) {
                    c1597.close();
                    return true;
                }
            }
        }
        c1597.close();
        return false;
    }

    private static boolean m5743(int i) {
        return i == 4 || i == 13 || i == 14 || i == 3 || i == 0;
    }

    private int m5744(BufferedInputStream bufferedInputStream) throws IOException {
        bufferedInputStream.mark(5000);
        byte[] bArr = new byte[5000];
        bufferedInputStream.read(bArr);
        bufferedInputStream.reset();
        if (m5726(bArr)) {
            return 4;
        }
        if (m5722(bArr)) {
            return 9;
        }
        if (m5742(bArr)) {
            return 12;
        }
        if (m5763(bArr)) {
            return 7;
        }
        if (m5760(bArr)) {
            return 10;
        }
        if (m5767(bArr)) {
            return 13;
        }
        return m5768(bArr) ? 14 : 0;
    }

    private void m5745(C1604 c1604) throws IOException {
        String str;
        String str2;
        if (Build.VERSION.SDK_INT < 28) {
            throw new UnsupportedOperationException("Reading EXIF from HEIF files is supported from SDK 28 and above");
        }
        MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
        try {
            try {
                C1593.C1594.m5718(mediaMetadataRetriever, new C1603(c1604));
                String extractMetadata = mediaMetadataRetriever.extractMetadata(33);
                String extractMetadata2 = mediaMetadataRetriever.extractMetadata(34);
                String extractMetadata3 = mediaMetadataRetriever.extractMetadata(26);
                String extractMetadata4 = mediaMetadataRetriever.extractMetadata(17);
                String str3 = null;
                if ("yes".equals(extractMetadata3)) {
                    str3 = mediaMetadataRetriever.extractMetadata(29);
                    str = mediaMetadataRetriever.extractMetadata(30);
                    str2 = mediaMetadataRetriever.extractMetadata(31);
                } else if ("yes".equals(extractMetadata4)) {
                    str3 = mediaMetadataRetriever.extractMetadata(18);
                    str = mediaMetadataRetriever.extractMetadata(19);
                    str2 = mediaMetadataRetriever.extractMetadata(24);
                } else {
                    str = null;
                    str2 = null;
                }
                if (str3 != null) {
                    this.f7111[0].put(f7099, C1600.m5815(Integer.parseInt(str3), this.f7118));
                }
                if (str != null) {
                    this.f7111[0].put(f6855, C1600.m5815(Integer.parseInt(str), this.f7118));
                }
                if (str2 != null) {
                    int i = 1;
                    int parseInt = Integer.parseInt(str2);
                    if (parseInt == 90) {
                        i = 6;
                    } else if (parseInt == 180) {
                        i = 3;
                    } else if (parseInt == 270) {
                        i = 8;
                    }
                    this.f7111[0].put(f6963, C1600.m5815(i, this.f7118));
                }
                if (extractMetadata != null && extractMetadata2 != null) {
                    int parseInt2 = Integer.parseInt(extractMetadata);
                    int parseInt3 = Integer.parseInt(extractMetadata2);
                    if (parseInt3 <= 6) {
                        throw new IOException("Invalid exif length");
                    }
                    c1604.m5836(parseInt2);
                    byte[] bArr = new byte[6];
                    if (c1604.read(bArr) != 6) {
                        throw new IOException("Can't read identifier");
                    }
                    int i2 = parseInt2 + 6;
                    int i3 = parseInt3 - 6;
                    if (!Arrays.equals(bArr, f6926)) {
                        throw new IOException("Invalid identifier");
                    }
                    byte[] bArr2 = new byte[i3];
                    if (c1604.read(bArr2) != i3) {
                        throw new IOException("Can't read exif");
                    }
                    this.f7109 = i2;
                    m5727(bArr2, 0);
                }
                if (f6894) {
                    String str4 = "Heif meta: " + str3 + "x" + str + ", rotation " + str2;
                }
            } catch (RuntimeException unused) {
                throw new UnsupportedOperationException("Failed to read EXIF from HEIF file. Given stream is either malformed or unsupported.");
            }
        } finally {
            mediaMetadataRetriever.release();
        }
    }

    private static double m5746(String str, String str2) {
        try {
            String[] split = str.split(",", -1);
            String[] split2 = split[0].split("/", -1);
            double parseDouble = Double.parseDouble(split2[0].trim()) / Double.parseDouble(split2[1].trim());
            String[] split3 = split[1].split("/", -1);
            double parseDouble2 = Double.parseDouble(split3[0].trim()) / Double.parseDouble(split3[1].trim());
            String[] split4 = split[2].split("/", -1);
            double parseDouble3 = parseDouble + (parseDouble2 / 60.0d) + ((Double.parseDouble(split4[0].trim()) / Double.parseDouble(split4[1].trim())) / 3600.0d);
            if (!str2.equals(f6730) && !str2.equals(f6720)) {
                if (!str2.equals("N") && !str2.equals(f6672)) {
                    throw new IllegalArgumentException();
                }
                return parseDouble3;
            }
            return -parseDouble3;
        } catch (ArrayIndexOutOfBoundsException | NumberFormatException unused) {
            throw new IllegalArgumentException();
        }
    }

    private void m5747(C1604 c1604, int i) throws IOException {
        C1600 c1600 = this.f7111[i].get(f6855);
        C1600 c16002 = this.f7111[i].get(f7099);
        if (c1600 == null || c16002 == null) {
            C1600 c16003 = this.f7111[i].get(f6971);
            C1600 c16004 = this.f7111[i].get(f6807);
            if (c16003 == null || c16004 == null) {
                return;
            }
            int m5824 = c16003.m5824(this.f7118);
            int m58242 = c16003.m5824(this.f7118);
            c1604.m5836(m5824);
            byte[] bArr = new byte[m58242];
            c1604.read(bArr);
            m5724(new C1597(bArr), m5824, i);
        }
    }

    @InterfaceC1758
    private C1600 m5748(@InterfaceC1793 String str) {
        Objects.requireNonNull(str, "tag shouldn't be null");
        if (f6809.equals(str)) {
            boolean z = f6894;
            str = f7010;
        }
        for (int i = 0; i < f7032.length; i++) {
            C1600 c1600 = this.f7111[i].get(str);
            if (c1600 != null) {
                return c1600;
            }
        }
        return null;
    }

    private void m5749(C1604 c1604, int i) throws IOException {
        C1598 c1598;
        int i2;
        long j;
        boolean z;
        short s;
        long j2;
        C1598 c15982;
        short s2;
        int readUnsignedShort;
        int i3 = i;
        this.f7115.add(Integer.valueOf(c1604.f7134));
        short readShort = c1604.readShort();
        if (f6894) {
            String str = "numberOfDirectoryEntry: " + ((int) readShort);
        }
        if (readShort <= 0) {
            return;
        }
        char c = 0;
        short s3 = 0;
        while (s3 < readShort) {
            int readUnsignedShort2 = c1604.readUnsignedShort();
            int readUnsignedShort3 = c1604.readUnsignedShort();
            int readInt = c1604.readInt();
            long m5808 = c1604.m5808() + 4;
            C1598 c15983 = f6810[i3].get(Integer.valueOf(readUnsignedShort2));
            boolean z2 = f6894;
            if (z2) {
                Object[] objArr = new Object[5];
                objArr[c] = Integer.valueOf(i);
                objArr[1] = Integer.valueOf(readUnsignedShort2);
                objArr[2] = c15983 != null ? c15983.f7136 : null;
                objArr[3] = Integer.valueOf(readUnsignedShort3);
                objArr[4] = Integer.valueOf(readInt);
                String.format("ifdType: %d, tagNumber: %d, tagName: %s, dataFormat: %d, numberOfComponents: %d", objArr);
            }
            if (c15983 != null) {
                if (readUnsignedShort3 > 0) {
                    if (readUnsignedShort3 < f6870.length) {
                        if (c15983.m5809(readUnsignedShort3)) {
                            if (readUnsignedShort3 == 7) {
                                readUnsignedShort3 = c15983.f7138;
                            }
                            i2 = readUnsignedShort2;
                            c1598 = c15983;
                            j = r4[readUnsignedShort3] * readInt;
                            if (j < 0 || j > 2147483647L) {
                                if (z2) {
                                    String str2 = "Skip the tag entry since the number of components is invalid: " + readInt;
                                }
                                z = false;
                            } else {
                                z = true;
                            }
                            if (z) {
                                if (j > 4) {
                                    int readInt2 = c1604.readInt();
                                    if (z2) {
                                        StringBuilder sb = new StringBuilder();
                                        s = readShort;
                                        sb.append("seek to data offset: ");
                                        sb.append(readInt2);
                                        sb.toString();
                                    } else {
                                        s = readShort;
                                    }
                                    if (this.f7116 == 7) {
                                        c15982 = c1598;
                                        s2 = s3;
                                        if (f6791.equals(c15982.f7136)) {
                                            this.f7123 = readInt2;
                                        } else if (i3 == 6 && f6968.equals(c15982.f7136)) {
                                            this.f7125 = readInt2;
                                            this.f7121 = readInt;
                                            C1600 m5815 = C1600.m5815(6, this.f7118);
                                            j2 = m5808;
                                            C1600 m5822 = C1600.m5822(this.f7125, this.f7118);
                                            C1600 m58222 = C1600.m5822(this.f7121, this.f7118);
                                            this.f7111[4].put(f6939, m5815);
                                            this.f7111[4].put(f6971, m5822);
                                            this.f7111[4].put(f6807, m58222);
                                        }
                                        j2 = m5808;
                                    } else {
                                        j2 = m5808;
                                        c15982 = c1598;
                                        s2 = s3;
                                    }
                                    c1604.m5836(readInt2);
                                } else {
                                    s = readShort;
                                    j2 = m5808;
                                    c15982 = c1598;
                                    s2 = s3;
                                }
                                Integer num = f6947.get(Integer.valueOf(i2));
                                if (z2) {
                                    String str3 = "nextIfdType: " + num + " byteCount: " + j;
                                }
                                if (num != null) {
                                    long j3 = -1;
                                    if (readUnsignedShort3 != 3) {
                                        if (readUnsignedShort3 == 4) {
                                            j3 = c1604.m5805();
                                        } else if (readUnsignedShort3 == 8) {
                                            readUnsignedShort = c1604.readShort();
                                        } else if (readUnsignedShort3 == 9 || readUnsignedShort3 == 13) {
                                            readUnsignedShort = c1604.readInt();
                                        }
                                        if (z2) {
                                            String.format("Offset: %d, tagName: %s", Long.valueOf(j3), c15982.f7136);
                                        }
                                        if (j3 <= 0) {
                                            if (!this.f7115.contains(Integer.valueOf((int) j3))) {
                                                c1604.m5836(j3);
                                                m5749(c1604, num.intValue());
                                            } else if (z2) {
                                                String str4 = "Skip jump into the IFD since it has already been read: IfdType " + num + " (at " + j3 + C0033.C0034.f92;
                                            }
                                        } else if (z2) {
                                            String str5 = "Skip jump into the IFD since its offset is invalid: " + j3;
                                        }
                                        c1604.m5836(j2);
                                    } else {
                                        readUnsignedShort = c1604.readUnsignedShort();
                                    }
                                    j3 = readUnsignedShort;
                                    if (z2) {
                                    }
                                    if (j3 <= 0) {
                                    }
                                    c1604.m5836(j2);
                                } else {
                                    long j4 = j2;
                                    int m58082 = c1604.m5808() + this.f7109;
                                    byte[] bArr = new byte[(int) j];
                                    c1604.readFully(bArr);
                                    C1600 c1600 = new C1600(readUnsignedShort3, readInt, m58082, bArr);
                                    this.f7111[i].put(c15982.f7136, c1600);
                                    if (f6813.equals(c15982.f7136)) {
                                        this.f7116 = 3;
                                    }
                                    if (((f7012.equals(c15982.f7136) || f6835.equals(c15982.f7136)) && c1600.m5826(this.f7118).contains(f6783)) || (f6939.equals(c15982.f7136) && c1600.m5824(this.f7118) == 65535)) {
                                        this.f7116 = 8;
                                    }
                                    if (c1604.m5808() != j4) {
                                        c1604.m5836(j4);
                                    }
                                }
                            } else {
                                c1604.m5836(m5808);
                                s = readShort;
                                s2 = s3;
                            }
                            s3 = (short) (s2 + 1);
                            i3 = i;
                            readShort = s;
                            c = 0;
                        } else if (z2) {
                            String str6 = "Skip the tag entry since data format (" + f6907[readUnsignedShort3] + ") is unexpected for tag: " + c15983.f7136;
                        }
                    }
                }
                c1598 = c15983;
                i2 = readUnsignedShort2;
                if (z2) {
                    String str7 = "Skip the tag entry since data format is invalid: " + readUnsignedShort3;
                }
                z = false;
                j = 0;
                if (z) {
                }
                s3 = (short) (s2 + 1);
                i3 = i;
                readShort = s;
                c = 0;
            } else if (z2) {
                String str8 = "Skip the tag entry since tag number is not defined: " + readUnsignedShort2;
            }
            c1598 = c15983;
            i2 = readUnsignedShort2;
            z = false;
            j = 0;
            if (z) {
            }
            s3 = (short) (s2 + 1);
            i3 = i;
            readShort = s;
            c = 0;
        }
        int readInt3 = c1604.readInt();
        boolean z3 = f6894;
        if (z3) {
            String.format("nextIfdOffset: %d", Integer.valueOf(readInt3));
        }
        long j5 = readInt3;
        if (j5 <= 0) {
            if (z3) {
                String str9 = "Stop reading file since a wrong offset may cause an infinite loop: " + readInt3;
                return;
            }
            return;
        }
        if (this.f7115.contains(Integer.valueOf(readInt3))) {
            if (z3) {
                String str10 = "Stop reading file since re-reading an IFD may cause an infinite loop: " + readInt3;
                return;
            }
            return;
        }
        c1604.m5836(j5);
        if (this.f7111[4].isEmpty()) {
            m5749(c1604, 4);
        } else if (this.f7111[5].isEmpty()) {
            m5749(c1604, 5);
        }
    }

    private void m5750() {
        for (int i = 0; i < this.f7111.length; i++) {
            String str = "The size of tag group[" + i + "]: " + this.f7111[i].size();
            for (Map.Entry<String, C1600> entry : this.f7111[i].entrySet()) {
                C1600 value = entry.getValue();
                String str2 = "tagName: " + entry.getKey() + ", tagType: " + value.toString() + ", tagValue: '" + value.m5826(this.f7118) + "'";
            }
        }
    }

    private void m5751(C1597 c1597) throws IOException {
        ByteOrder m5734 = m5734(c1597);
        this.f7118 = m5734;
        c1597.m5807(m5734);
        int readUnsignedShort = c1597.readUnsignedShort();
        int i = this.f7116;
        if (i != 7 && i != 10 && readUnsignedShort != 42) {
            throw new IOException("Invalid start code: " + Integer.toHexString(readUnsignedShort));
        }
        int readInt = c1597.readInt();
        if (readInt < 8) {
            throw new IOException("Invalid first Ifd offset: " + readInt);
        }
        int i2 = readInt - 8;
        if (i2 > 0) {
            c1597.m5806(i2);
        }
    }

    public static boolean m5752(@InterfaceC1793 String str) {
        Objects.requireNonNull(str, "mimeType shouldn't be null");
        String lowerCase = str.toLowerCase(Locale.ROOT);
        lowerCase.hashCode();
        switch (lowerCase) {
            case "image/x-fuji-raf":
            case "image/x-samsung-srw":
            case "image/x-sony-arw":
            case "image/heic":
            case "image/heif":
            case "image/jpeg":
            case "image/webp":
            case "image/x-adobe-dng":
            case "image/x-panasonic-rw2":
            case "image/png":
            case "image/x-pentax-pef":
            case "image/x-olympus-orf":
            case "image/x-nikon-nef":
            case "image/x-nikon-nrw":
            case "image/x-canon-cr2":
                return true;
            default:
                return false;
        }
    }

    private void m5753(C1597 c1597, HashMap hashMap) throws IOException {
        C1600 c1600 = (C1600) hashMap.get(f6854);
        C1600 c16002 = (C1600) hashMap.get(f7075);
        if (c1600 == null || c16002 == null) {
            return;
        }
        long[] m5713 = C1593.m5713(c1600.m5827(this.f7118));
        long[] m57132 = C1593.m5713(c16002.m5827(this.f7118));
        if (m5713 == null || m5713.length == 0 || m57132 == null || m57132.length == 0 || m5713.length != m57132.length) {
            return;
        }
        long j = 0;
        for (long j2 : m57132) {
            j += j2;
        }
        int i = (int) j;
        byte[] bArr = new byte[i];
        int i2 = 1;
        this.f7119 = true;
        this.f7112 = true;
        this.f7128 = true;
        int i3 = 0;
        int i4 = 0;
        int i5 = 0;
        while (i3 < m5713.length) {
            int i6 = (int) m5713[i3];
            int i7 = (int) m57132[i3];
            if (i3 < m5713.length - i2 && i6 + i7 != m5713[i3 + 1]) {
                this.f7119 = false;
            }
            int i8 = i6 - i4;
            if (i8 < 0) {
                return;
            }
            long j3 = i8;
            if (c1597.skip(j3) != j3) {
                String str = "Failed to skip " + i8 + " bytes.";
                return;
            }
            int i9 = i4 + i8;
            byte[] bArr2 = new byte[i7];
            if (c1597.read(bArr2) != i7) {
                String str2 = "Failed to read " + i7 + " bytes.";
                return;
            }
            i4 = i9 + i7;
            System.arraycopy(bArr2, 0, bArr, i5, i7);
            i5 += i7;
            i3++;
            i2 = 1;
        }
        this.f7127 = bArr;
        if (this.f7119) {
            this.f7120 = (int) m5713[0];
            this.f7117 = i;
        }
    }

    private void m5754(C1604 c1604) throws IOException {
        C1600 c1600;
        m5751(c1604);
        m5749(c1604, 0);
        m5755(c1604, 0);
        m5755(c1604, 5);
        m5755(c1604, 4);
        m5728();
        if (this.f7116 != 8 || (c1600 = this.f7111[1].get(f6791)) == null) {
            return;
        }
        C1604 c16042 = new C1604(c1600.f7142);
        c16042.m5807(this.f7118);
        c16042.m5806(6);
        m5749(c16042, 9);
        C1600 c16002 = this.f7111[9].get(f7059);
        if (c16002 != null) {
            this.f7111[1].put(f7059, c16002);
        }
    }

    private void m5755(C1604 c1604, int i) throws IOException {
        C1600 m5815;
        C1600 m58152;
        C1600 c1600 = this.f7111[i].get(f6912);
        C1600 c16002 = this.f7111[i].get(f6981);
        C1600 c16003 = this.f7111[i].get(f7079);
        C1600 c16004 = this.f7111[i].get(f7049);
        C1600 c16005 = this.f7111[i].get(f6903);
        if (c1600 == null) {
            if (c16002 == null || c16003 == null || c16004 == null || c16005 == null) {
                m5747(c1604, i);
                return;
            }
            int m5824 = c16002.m5824(this.f7118);
            int m58242 = c16004.m5824(this.f7118);
            int m58243 = c16005.m5824(this.f7118);
            int m58244 = c16003.m5824(this.f7118);
            if (m58242 <= m5824 || m58243 <= m58244) {
                return;
            }
            C1600 m58153 = C1600.m5815(m58242 - m5824, this.f7118);
            C1600 m58154 = C1600.m5815(m58243 - m58244, this.f7118);
            this.f7111[i].put(f6855, m58153);
            this.f7111[i].put(f7099, m58154);
            return;
        }
        if (c1600.f7144 == 5) {
            C1601[] c1601Arr = (C1601[]) c1600.m5827(this.f7118);
            if (c1601Arr == null || c1601Arr.length != 2) {
                String str = "Invalid crop size values. cropSize=" + Arrays.toString(c1601Arr);
                return;
            }
            m5815 = C1600.m5817(c1601Arr[0], this.f7118);
            m58152 = C1600.m5817(c1601Arr[1], this.f7118);
        } else {
            int[] iArr = (int[]) c1600.m5827(this.f7118);
            if (iArr == null || iArr.length != 2) {
                String str2 = "Invalid crop size values. cropSize=" + Arrays.toString(iArr);
                return;
            }
            m5815 = C1600.m5815(iArr[0], this.f7118);
            m58152 = C1600.m5815(iArr[1], this.f7118);
        }
        this.f7111[i].put(f7099, m5815);
        this.f7111[i].put(f6855, m58152);
    }

    private void m5756(C1604 c1604) throws IOException {
        if (f6894) {
            String str = "getRw2Attributes starting with: " + c1604;
        }
        m5754(c1604);
        C1600 c1600 = this.f7111[0].get(f7054);
        if (c1600 != null) {
            m5724(new C1597(c1600.f7142), (int) c1600.f7143, 5);
        }
        C1600 c16002 = this.f7111[0].get(f6775);
        C1600 c16003 = this.f7111[1].get(f7010);
        if (c16002 == null || c16003 != null) {
            return;
        }
        this.f7111[1].put(f7010, c16002);
    }

    private void m5757(InputStream inputStream, OutputStream outputStream) throws IOException {
        if (f6894) {
            String str = "saveJpegAttributes starting with (inputStream: " + inputStream + ", outputStream: " + outputStream + C0033.C0034.f92;
        }
        C1597 c1597 = new C1597(inputStream);
        C1602 c1602 = new C1602(outputStream, ByteOrder.BIG_ENDIAN);
        if (c1597.readByte() != -1) {
            throw new IOException("Invalid marker");
        }
        c1602.m5830(-1);
        if (c1597.readByte() != -40) {
            throw new IOException("Invalid marker");
        }
        c1602.m5830(-40);
        C1600 c1600 = null;
        if (m5799(f6860) != null && this.f7114) {
            c1600 = this.f7111[0].remove(f6860);
        }
        c1602.m5830(-1);
        c1602.m5830(-31);
        m5732(c1602);
        if (c1600 != null) {
            this.f7111[0].put(f6860, c1600);
        }
        byte[] bArr = new byte[4096];
        while (c1597.readByte() == -1) {
            byte readByte = c1597.readByte();
            if (readByte == -39 || readByte == -38) {
                c1602.m5830(-1);
                c1602.m5830(readByte);
                C1593.m5717(c1597, c1602);
                return;
            }
            if (readByte != -31) {
                c1602.m5830(-1);
                c1602.m5830(readByte);
                int readUnsignedShort = c1597.readUnsignedShort();
                c1602.m5831(readUnsignedShort);
                int i = readUnsignedShort - 2;
                if (i < 0) {
                    throw new IOException("Invalid length");
                }
                while (i > 0) {
                    int read = c1597.read(bArr, 0, Math.min(i, 4096));
                    if (read >= 0) {
                        c1602.write(bArr, 0, read);
                        i -= read;
                    }
                }
            } else {
                int readUnsignedShort2 = c1597.readUnsignedShort() - 2;
                if (readUnsignedShort2 < 0) {
                    throw new IOException("Invalid length");
                }
                byte[] bArr2 = new byte[6];
                if (readUnsignedShort2 >= 6) {
                    if (c1597.read(bArr2) != 6) {
                        throw new IOException("Invalid exif");
                    }
                    if (Arrays.equals(bArr2, f6926)) {
                        c1597.m5806(readUnsignedShort2 - 6);
                    }
                }
                c1602.m5830(-1);
                c1602.m5830(readByte);
                c1602.m5831(readUnsignedShort2 + 2);
                if (readUnsignedShort2 >= 6) {
                    readUnsignedShort2 -= 6;
                    c1602.write(bArr2);
                }
                while (readUnsignedShort2 > 0) {
                    int read2 = c1597.read(bArr, 0, Math.min(readUnsignedShort2, 4096));
                    if (read2 >= 0) {
                        c1602.write(bArr, 0, read2);
                        readUnsignedShort2 -= read2;
                    }
                }
            }
        }
        throw new IOException("Invalid marker");
    }

    private void m5758() {
        String m5799 = m5799(f6814);
        if (m5799 != null && m5799(f7056) == null) {
            this.f7111[0].put(f7056, C1600.m5816(m5799));
        }
        if (m5799(f7099) == null) {
            this.f7111[0].put(f7099, C1600.m5822(0L, this.f7118));
        }
        if (m5799(f6855) == null) {
            this.f7111[0].put(f6855, C1600.m5822(0L, this.f7118));
        }
        if (m5799(f6963) == null) {
            this.f7111[0].put(f6963, C1600.m5822(0L, this.f7118));
        }
        if (m5799(f7015) == null) {
            this.f7111[1].put(f7015, C1600.m5822(0L, this.f7118));
        }
    }

    private void m5759(C1597 c1597) throws IOException {
        HashMap<String, C1600> hashMap = this.f7111[4];
        C1600 c1600 = hashMap.get(f6939);
        if (c1600 == null) {
            this.f7126 = 6;
            m5738(c1597, hashMap);
            return;
        }
        int m5824 = c1600.m5824(this.f7118);
        this.f7126 = m5824;
        if (m5824 != 1) {
            if (m5824 == 6) {
                m5738(c1597, hashMap);
                return;
            } else if (m5824 != 7) {
                return;
            }
        }
        if (m5733(hashMap)) {
            m5753(c1597, hashMap);
        }
    }

    private boolean m5760(byte[] bArr) throws IOException {
        C1597 c1597 = null;
        try {
            C1597 c15972 = new C1597(bArr);
            try {
                ByteOrder m5734 = m5734(c15972);
                this.f7118 = m5734;
                c15972.m5807(m5734);
                boolean z = c15972.readShort() == 85;
                c15972.close();
                return z;
            } catch (Exception unused) {
                c1597 = c15972;
                if (c1597 != null) {
                    c1597.close();
                }
                return false;
            } catch (Throwable th) {
                th = th;
                c1597 = c15972;
                if (c1597 != null) {
                    c1597.close();
                }
                throw th;
            }
        } catch (Exception unused2) {
        } catch (Throwable th2) {
            th = th2;
        }
    }

    private void m5761(C1604 c1604) throws IOException {
        byte[] bArr = f6926;
        c1604.m5806(bArr.length);
        byte[] bArr2 = new byte[c1604.available()];
        c1604.readFully(bArr2);
        this.f7109 = bArr.length;
        m5727(bArr2, 0);
    }

    private void m5762(InputStream inputStream, OutputStream outputStream) throws IOException {
        if (f6894) {
            String str = "savePngAttributes starting with (inputStream: " + inputStream + ", outputStream: " + outputStream + C0033.C0034.f92;
        }
        C1597 c1597 = new C1597(inputStream);
        ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
        C1602 c1602 = new C1602(outputStream, byteOrder);
        byte[] bArr = f6830;
        C1593.m5711(c1597, c1602, bArr.length);
        int i = this.f7109;
        if (i == 0) {
            int readInt = c1597.readInt();
            c1602.m5833(readInt);
            C1593.m5711(c1597, c1602, readInt + 4 + 4);
        } else {
            C1593.m5711(c1597, c1602, ((i - bArr.length) - 4) - 4);
            c1597.m5806(c1597.readInt() + 4 + 4);
        }
        ByteArrayOutputStream byteArrayOutputStream = null;
        try {
            ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
            try {
                C1602 c16022 = new C1602(byteArrayOutputStream2, byteOrder);
                m5732(c16022);
                byte[] byteArray = ((ByteArrayOutputStream) c16022.f7147).toByteArray();
                c1602.write(byteArray);
                CRC32 crc32 = new CRC32();
                crc32.update(byteArray, 4, byteArray.length - 4);
                c1602.m5833((int) crc32.getValue());
                C1593.m5715(byteArrayOutputStream2);
                C1593.m5717(c1597, c1602);
            } catch (Throwable th) {
                th = th;
                byteArrayOutputStream = byteArrayOutputStream2;
                C1593.m5715(byteArrayOutputStream);
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    private boolean m5763(byte[] bArr) throws IOException {
        C1597 c1597 = null;
        try {
            C1597 c15972 = new C1597(bArr);
            try {
                ByteOrder m5734 = m5734(c15972);
                this.f7118 = m5734;
                c15972.m5807(m5734);
                short readShort = c15972.readShort();
                boolean z = readShort == 20306 || readShort == 21330;
                c15972.close();
                return z;
            } catch (Exception unused) {
                c1597 = c15972;
                if (c1597 != null) {
                    c1597.close();
                }
                return false;
            } catch (Throwable th) {
                th = th;
                c1597 = c15972;
                if (c1597 != null) {
                    c1597.close();
                }
                throw th;
            }
        } catch (Exception unused2) {
        } catch (Throwable th2) {
            th = th2;
        }
    }

    private void m5764(C1597 c1597) throws IOException {
        boolean z = f6894;
        if (z) {
            String str = "getRafAttributes starting with: " + c1597;
        }
        c1597.m5806(84);
        byte[] bArr = new byte[4];
        byte[] bArr2 = new byte[4];
        byte[] bArr3 = new byte[4];
        c1597.read(bArr);
        c1597.read(bArr2);
        c1597.read(bArr3);
        int i = ByteBuffer.wrap(bArr).getInt();
        int i2 = ByteBuffer.wrap(bArr2).getInt();
        int i3 = ByteBuffer.wrap(bArr3).getInt();
        byte[] bArr4 = new byte[i2];
        c1597.m5806(i - c1597.m5808());
        c1597.read(bArr4);
        m5724(new C1597(bArr4), i, 5);
        c1597.m5806(i3 - c1597.m5808());
        c1597.m5807(ByteOrder.BIG_ENDIAN);
        int readInt = c1597.readInt();
        if (z) {
            String str2 = "numberOfDirectoryEntry: " + readInt;
        }
        for (int i4 = 0; i4 < readInt; i4++) {
            int readUnsignedShort = c1597.readUnsignedShort();
            int readUnsignedShort2 = c1597.readUnsignedShort();
            if (readUnsignedShort == f6913.f7139) {
                short readShort = c1597.readShort();
                short readShort2 = c1597.readShort();
                C1600 m5815 = C1600.m5815(readShort, this.f7118);
                C1600 m58152 = C1600.m5815(readShort2, this.f7118);
                this.f7111[0].put(f6855, m5815);
                this.f7111[0].put(f7099, m58152);
                if (f6894) {
                    String str3 = "Updated to length: " + ((int) readShort) + ", width: " + ((int) readShort2);
                    return;
                }
                return;
            }
            c1597.m5806(readUnsignedShort2);
        }
    }

    private static Pair<Integer, Integer> m5765(String str) {
        if (str.contains(",")) {
            String[] split = str.split(",", -1);
            Pair<Integer, Integer> m5765 = m5765(split[0]);
            if (((Integer) m5765.first).intValue() == 2) {
                return m5765;
            }
            for (int i = 1; i < split.length; i++) {
                Pair<Integer, Integer> m57652 = m5765(split[i]);
                int intValue = (((Integer) m57652.first).equals(m5765.first) || ((Integer) m57652.second).equals(m5765.first)) ? ((Integer) m5765.first).intValue() : -1;
                int intValue2 = (((Integer) m5765.second).intValue() == -1 || !(((Integer) m57652.first).equals(m5765.second) || ((Integer) m57652.second).equals(m5765.second))) ? -1 : ((Integer) m5765.second).intValue();
                if (intValue == -1 && intValue2 == -1) {
                    return new Pair<>(2, -1);
                }
                if (intValue == -1) {
                    m5765 = new Pair<>(Integer.valueOf(intValue2), -1);
                } else if (intValue2 == -1) {
                    m5765 = new Pair<>(Integer.valueOf(intValue), -1);
                }
            }
            return m5765;
        }
        if (!str.contains("/")) {
            try {
                try {
                    Long valueOf = Long.valueOf(Long.parseLong(str));
                    return (valueOf.longValue() < 0 || valueOf.longValue() > 65535) ? valueOf.longValue() < 0 ? new Pair<>(9, -1) : new Pair<>(4, -1) : new Pair<>(3, 4);
                } catch (NumberFormatException unused) {
                    return new Pair<>(2, -1);
                }
            } catch (NumberFormatException unused2) {
                Double.parseDouble(str);
                return new Pair<>(12, -1);
            }
        }
        String[] split2 = str.split("/", -1);
        if (split2.length == 2) {
            try {
                long parseDouble = (long) Double.parseDouble(split2[0]);
                long parseDouble2 = (long) Double.parseDouble(split2[1]);
                if (parseDouble >= 0 && parseDouble2 >= 0) {
                    if (parseDouble <= 2147483647L && parseDouble2 <= 2147483647L) {
                        return new Pair<>(10, 5);
                    }
                    return new Pair<>(5, -1);
                }
                return new Pair<>(10, -1);
            } catch (NumberFormatException unused3) {
            }
        }
        return new Pair<>(2, -1);
    }

    private boolean m5766(HashMap hashMap) throws IOException {
        C1600 c1600 = (C1600) hashMap.get(f6855);
        C1600 c16002 = (C1600) hashMap.get(f7099);
        if (c1600 == null || c16002 == null) {
            return false;
        }
        return c1600.m5824(this.f7118) <= 512 && c16002.m5824(this.f7118) <= 512;
    }

    private boolean m5767(byte[] bArr) throws IOException {
        int i = 0;
        while (true) {
            byte[] bArr2 = f6830;
            if (i >= bArr2.length) {
                return true;
            }
            if (bArr[i] != bArr2[i]) {
                return false;
            }
            i++;
        }
    }

    private boolean m5768(byte[] bArr) throws IOException {
        int i = 0;
        while (true) {
            byte[] bArr2 = f6751;
            if (i >= bArr2.length) {
                int i2 = 0;
                while (true) {
                    byte[] bArr3 = f6680;
                    if (i2 >= bArr3.length) {
                        return true;
                    }
                    if (bArr[f6751.length + i2 + 4] != bArr3[i2]) {
                        return false;
                    }
                    i2++;
                }
            } else {
                if (bArr[i] != bArr2[i]) {
                    return false;
                }
                i++;
            }
        }
    }

    private static boolean m5769(int i) {
        return (i == 4 || i == 9 || i == 13 || i == 14) ? false : true;
    }

    private static Long m5770(@InterfaceC1758 String str, @InterfaceC1758 String str2, @InterfaceC1758 String str3) {
        if (str != null && f6945.matcher(str).matches()) {
            ParsePosition parsePosition = new ParsePosition(0);
            try {
                Date parse = f6845.parse(str, parsePosition);
                if (parse == null && (parse = f6872.parse(str, parsePosition)) == null) {
                    return null;
                }
                long time = parse.getTime();
                if (str3 != null) {
                    int i = 1;
                    String substring = str3.substring(0, 1);
                    int parseInt = Integer.parseInt(str3.substring(1, 3));
                    int parseInt2 = Integer.parseInt(str3.substring(4, 6));
                    if ((BadgeDrawable.DEFAULT_EXCEED_MAX_BADGE_NUMBER_SUFFIX.equals(substring) || Constants.ACCEPT_TIME_SEPARATOR_SERVER.equals(substring)) && ":".equals(str3.substring(3, 4)) && parseInt <= 14) {
                        int i2 = ((parseInt * 60) + parseInt2) * 60 * 1000;
                        if (!Constants.ACCEPT_TIME_SEPARATOR_SERVER.equals(substring)) {
                            i = -1;
                        }
                        time += i2 * i;
                    }
                }
                if (str2 != null) {
                    time += C1593.m5712(str2);
                }
                return Long.valueOf(time);
            } catch (IllegalArgumentException unused) {
            }
        }
        return null;
    }

    private void m5771(C1604 c1604) throws IOException {
        m5754(c1604);
        C1600 c1600 = this.f7111[1].get(f6791);
        if (c1600 != null) {
            C1604 c16042 = new C1604(c1600.f7142);
            c16042.m5807(this.f7118);
            byte[] bArr = f6679;
            byte[] bArr2 = new byte[bArr.length];
            c16042.readFully(bArr2);
            c16042.m5836(0L);
            byte[] bArr3 = f7048;
            byte[] bArr4 = new byte[bArr3.length];
            c16042.readFully(bArr4);
            if (Arrays.equals(bArr2, bArr)) {
                c16042.m5836(8L);
            } else if (Arrays.equals(bArr4, bArr3)) {
                c16042.m5836(12L);
            }
            m5749(c16042, 6);
            C1600 c16002 = this.f7111[7].get(f6886);
            C1600 c16003 = this.f7111[7].get(f6880);
            if (c16002 != null && c16003 != null) {
                this.f7111[5].put(f6971, c16002);
                this.f7111[5].put(f6807, c16003);
            }
            C1600 c16004 = this.f7111[8].get(f6976);
            if (c16004 != null) {
                int[] iArr = (int[]) c16004.m5827(this.f7118);
                if (iArr == null || iArr.length != 4) {
                    String str = "Invalid aspect frame values. frame=" + Arrays.toString(iArr);
                    return;
                }
                if (iArr[2] <= iArr[0] || iArr[3] <= iArr[1]) {
                    return;
                }
                int i = (iArr[2] - iArr[0]) + 1;
                int i2 = (iArr[3] - iArr[1]) + 1;
                if (i < i2) {
                    int i3 = i + i2;
                    i2 = i3 - i2;
                    i = i3 - i2;
                }
                C1600 m5815 = C1600.m5815(i, this.f7118);
                C1600 m58152 = C1600.m5815(i2, this.f7118);
                this.f7111[0].put(f7099, m5815);
                this.f7111[0].put(f6855, m58152);
            }
        }
    }

    private void m5772(C1597 c1597, C1602 c1602, byte[] bArr) throws IOException {
        int readInt = c1597.readInt();
        c1602.write(bArr);
        c1602.m5833(readInt);
        if (readInt % 2 == 1) {
            readInt++;
        }
        C1593.m5711(c1597, c1602, readInt);
    }

    private void m5773(int i, int i2) throws IOException {
        if (this.f7111[i].isEmpty() || this.f7111[i2].isEmpty()) {
            boolean z = f6894;
            return;
        }
        C1600 c1600 = this.f7111[i].get(f6855);
        C1600 c16002 = this.f7111[i].get(f7099);
        C1600 c16003 = this.f7111[i2].get(f6855);
        C1600 c16004 = this.f7111[i2].get(f7099);
        if (c1600 == null || c16002 == null) {
            boolean z2 = f6894;
            return;
        }
        if (c16003 == null || c16004 == null) {
            boolean z3 = f6894;
            return;
        }
        int m5824 = c1600.m5824(this.f7118);
        int m58242 = c16002.m5824(this.f7118);
        int m58243 = c16003.m5824(this.f7118);
        int m58244 = c16004.m5824(this.f7118);
        if (m5824 >= m58243 || m58242 >= m58244) {
            return;
        }
        HashMap<String, C1600>[] hashMapArr = this.f7111;
        HashMap<String, C1600> hashMap = hashMapArr[i];
        hashMapArr[i] = hashMapArr[i2];
        hashMapArr[i2] = hashMap;
    }

    @InterfaceC1758
    @InterfaceC1762({InterfaceC1762.EnumC1763.LIBRARY})
    public Long m5774() {
        return m5770(m5799(f6814), m5799(f7022), m5799(f6995));
    }

    public void m5775(@InterfaceC1793 String str, @InterfaceC1758 String str2) {
        C1598 c1598;
        int i;
        String str3 = str;
        String str4 = str2;
        Objects.requireNonNull(str3, "tag shouldn't be null");
        if ((f7056.equals(str3) || f6814.equals(str3) || f7094.equals(str3)) && str4 != null) {
            boolean find = f6919.matcher(str4).find();
            boolean find2 = f6820.matcher(str4).find();
            if (str2.length() != 19 || (!find && !find2)) {
                String str5 = "Invalid value for " + str3 + " : " + str4;
                return;
            }
            if (find2) {
                str4 = str4.replaceAll(Constants.ACCEPT_TIME_SEPARATOR_SERVER, ":");
            }
        }
        if (f6809.equals(str3)) {
            str3 = f7010;
        }
        int i2 = 2;
        int i3 = 1;
        if (str4 != null && f6853.contains(str3)) {
            if (str3.equals(f6702)) {
                Matcher matcher = f6727.matcher(str4);
                if (!matcher.find()) {
                    String str6 = "Invalid value for " + str3 + " : " + str4;
                    return;
                }
                str4 = Integer.parseInt(matcher.group(1)) + "/1," + Integer.parseInt(matcher.group(2)) + "/1," + Integer.parseInt(matcher.group(3)) + "/1";
            } else {
                try {
                    str4 = new C1601(Double.parseDouble(str4)).toString();
                } catch (NumberFormatException unused) {
                    String str7 = "Invalid value for " + str3 + " : " + str4;
                    return;
                }
            }
        }
        char c = 0;
        int i4 = 0;
        while (i4 < f7032.length) {
            if ((i4 != 4 || this.f7128) && (c1598 = f6897[i4].get(str3)) != null) {
                if (str4 != null) {
                    Pair<Integer, Integer> m5765 = m5765(str4);
                    if (c1598.f7138 == ((Integer) m5765.first).intValue() || c1598.f7138 == ((Integer) m5765.second).intValue()) {
                        i = c1598.f7138;
                    } else {
                        int i5 = c1598.f7137;
                        if (i5 == -1 || !(i5 == ((Integer) m5765.first).intValue() || c1598.f7137 == ((Integer) m5765.second).intValue())) {
                            int i6 = c1598.f7138;
                            if (i6 == i3 || i6 == 7 || i6 == i2) {
                                i = i6;
                            } else if (f6894) {
                                StringBuilder sb = new StringBuilder();
                                sb.append("Given tag (");
                                sb.append(str3);
                                sb.append(") value didn't match with one of expected formats: ");
                                String[] strArr = f6907;
                                sb.append(strArr[c1598.f7138]);
                                sb.append(c1598.f7137 == -1 ? "" : ", " + strArr[c1598.f7137]);
                                sb.append(" (guess: ");
                                sb.append(strArr[((Integer) m5765.first).intValue()]);
                                sb.append(((Integer) m5765.second).intValue() != -1 ? ", " + strArr[((Integer) m5765.second).intValue()] : "");
                                sb.append(C0033.C0034.f92);
                                sb.toString();
                            }
                        } else {
                            i = c1598.f7137;
                        }
                    }
                    switch (i) {
                        case 1:
                            this.f7111[i4].put(str3, C1600.m5820(str4));
                            continue;
                        case 2:
                        case 7:
                            this.f7111[i4].put(str3, C1600.m5816(str4));
                            continue;
                        case 3:
                            String[] split = str4.split(",", -1);
                            int[] iArr = new int[split.length];
                            for (int i7 = 0; i7 < split.length; i7++) {
                                iArr[i7] = Integer.parseInt(split[i7]);
                            }
                            this.f7111[i4].put(str3, C1600.m5821(iArr, this.f7118));
                            continue;
                        case 4:
                            String[] split2 = str4.split(",", -1);
                            long[] jArr = new long[split2.length];
                            for (int i8 = 0; i8 < split2.length; i8++) {
                                jArr[i8] = Long.parseLong(split2[i8]);
                            }
                            this.f7111[i4].put(str3, C1600.m5812(jArr, this.f7118));
                            continue;
                        case 5:
                            String[] split3 = str4.split(",", -1);
                            C1601[] c1601Arr = new C1601[split3.length];
                            int i9 = 0;
                            while (i9 < split3.length) {
                                String[] split4 = split3[i9].split("/", -1);
                                c1601Arr[i9] = new C1601((long) Double.parseDouble(split4[c]), (long) Double.parseDouble(split4[1]));
                                i9++;
                                c = 0;
                            }
                            this.f7111[i4].put(str3, C1600.m5818(c1601Arr, this.f7118));
                            continue;
                        case 6:
                        case 8:
                        case 11:
                        default:
                            if (f6894) {
                                String str8 = "Data format isn't one of expected formats: " + i;
                                break;
                            } else {
                                continue;
                            }
                        case 9:
                            String[] split5 = str4.split(",", -1);
                            int[] iArr2 = new int[split5.length];
                            for (int i10 = 0; i10 < split5.length; i10++) {
                                iArr2[i10] = Integer.parseInt(split5[i10]);
                            }
                            this.f7111[i4].put(str3, C1600.m5823(iArr2, this.f7118));
                            break;
                        case 10:
                            String[] split6 = str4.split(",", -1);
                            C1601[] c1601Arr2 = new C1601[split6.length];
                            int i11 = 0;
                            while (i11 < split6.length) {
                                String[] split7 = split6[i11].split("/", -1);
                                c1601Arr2[i11] = new C1601((long) Double.parseDouble(split7[c]), (long) Double.parseDouble(split7[i3]));
                                i11++;
                                split6 = split6;
                                i3 = 1;
                            }
                            this.f7111[i4].put(str3, C1600.m5813(c1601Arr2, this.f7118));
                            break;
                        case 12:
                            String[] split8 = str4.split(",", -1);
                            double[] dArr = new double[split8.length];
                            for (int i12 = 0; i12 < split8.length; i12++) {
                                dArr[i12] = Double.parseDouble(split8[i12]);
                            }
                            this.f7111[i4].put(str3, C1600.m5819(dArr, this.f7118));
                            break;
                    }
                } else {
                    this.f7111[i4].remove(str3);
                }
            }
            i4++;
            i2 = 2;
            c = 0;
            i3 = 1;
        }
    }

    public void m5776() {
        int i = 1;
        switch (m5788(f6963, 1)) {
            case 1:
                i = 2;
                break;
            case 2:
                break;
            case 3:
                i = 4;
                break;
            case 4:
                i = 3;
                break;
            case 5:
                i = 6;
                break;
            case 6:
                i = 5;
                break;
            case 7:
                i = 8;
                break;
            case 8:
                i = 7;
                break;
            default:
                i = 0;
                break;
        }
        m5775(f6963, Integer.toString(i));
    }

    @InterfaceC1758
    public byte[] m5777(@InterfaceC1793 String str) {
        Objects.requireNonNull(str, "tag shouldn't be null");
        C1600 m5748 = m5748(str);
        if (m5748 != null) {
            return m5748.f7142;
        }
        return null;
    }

    @InterfaceC1758
    public byte[] m5778() {
        int i = this.f7126;
        if (i == 6 || i == 7) {
            return m5802();
        }
        return null;
    }

    @Deprecated
    public boolean m5779(float[] fArr) {
        double[] m5787 = m5787();
        if (m5787 == null) {
            return false;
        }
        fArr[0] = (float) m5787[0];
        fArr[1] = (float) m5787[1];
        return true;
    }

    public void m5780(double d, double d2) {
        if (d < -90.0d || d > 90.0d || Double.isNaN(d)) {
            throw new IllegalArgumentException("Latitude value " + d + " is not valid.");
        }
        if (d2 < -180.0d || d2 > 180.0d || Double.isNaN(d2)) {
            throw new IllegalArgumentException("Longitude value " + d2 + " is not valid.");
        }
        m5775(f7004, d >= ShadowDrawableWrapper.COS_45 ? "N" : f6730);
        m5775(f6793, m5723(Math.abs(d)));
        m5775(f7070, d2 >= ShadowDrawableWrapper.COS_45 ? f6672 : f6720);
        m5775(f6973, m5723(Math.abs(d2)));
    }

    public int m5781() {
        switch (m5788(f6963, 1)) {
            case 3:
            case 4:
                return 180;
            case 5:
            case 8:
                return SubsamplingScaleImageView.ORIENTATION_270;
            case 6:
            case 7:
                return 90;
            default:
                return 0;
        }
    }

    public void m5782() {
        int i = 1;
        switch (m5788(f6963, 1)) {
            case 1:
                i = 4;
                break;
            case 2:
                i = 3;
                break;
            case 3:
                i = 2;
                break;
            case 4:
                break;
            case 5:
                i = 8;
                break;
            case 6:
                i = 7;
                break;
            case 7:
                i = 6;
                break;
            case 8:
                i = 5;
                break;
            default:
                i = 0;
                break;
        }
        m5775(f6963, Integer.toString(i));
    }

    @InterfaceC1758
    public long[] m5783(@InterfaceC1793 String str) {
        Objects.requireNonNull(str, "tag shouldn't be null");
        if (this.f7113) {
            throw new IllegalStateException("The underlying file has been modified since being parsed");
        }
        C1600 m5748 = m5748(str);
        if (m5748 != null) {
            return new long[]{m5748.f7143, m5748.f7142.length};
        }
        return null;
    }

    public double m5784(double d) {
        double m5785 = m5785(f6721, -1.0d);
        int m5788 = m5788(f6831, -1);
        if (m5785 < ShadowDrawableWrapper.COS_45 || m5788 < 0) {
            return d;
        }
        double d2 = m5788 != 1 ? 1 : -1;
        Double.isNaN(d2);
        return m5785 * d2;
    }

    public double m5785(@InterfaceC1793 String str, double d) {
        Objects.requireNonNull(str, "tag shouldn't be null");
        C1600 m5748 = m5748(str);
        if (m5748 == null) {
            return d;
        }
        try {
            return m5748.m5828(this.f7118);
        } catch (NumberFormatException unused) {
            return d;
        }
    }

    public void m5786(double d) {
        String str = d >= ShadowDrawableWrapper.COS_45 ? PushConstants.PUSH_TYPE_NOTIFY : "1";
        m5775(f6721, new C1601(Math.abs(d)).toString());
        m5775(f6831, str);
    }

    @InterfaceC1758
    public double[] m5787() {
        String m5799 = m5799(f6793);
        String m57992 = m5799(f7004);
        String m57993 = m5799(f6973);
        String m57994 = m5799(f7070);
        if (m5799 == null || m57992 == null || m57993 == null || m57994 == null) {
            return null;
        }
        try {
            return new double[]{m5746(m5799, m57992), m5746(m57993, m57994)};
        } catch (IllegalArgumentException unused) {
            String str = "Latitude/longitude values are not parsable. " + String.format("latValue=%s, latRef=%s, lngValue=%s, lngRef=%s", m5799, m57992, m57993, m57994);
            return null;
        }
    }

    public int m5788(@InterfaceC1793 String str, int i) {
        Objects.requireNonNull(str, "tag shouldn't be null");
        C1600 m5748 = m5748(str);
        if (m5748 == null) {
            return i;
        }
        try {
            return m5748.m5824(this.f7118);
        } catch (NumberFormatException unused) {
            return i;
        }
    }

    public boolean m5789() {
        int m5788 = m5788(f6963, 1);
        return m5788 == 2 || m5788 == 7 || m5788 == 4 || m5788 == 5;
    }

    @InterfaceC1758
    public long[] m5790() {
        if (this.f7113) {
            throw new IllegalStateException("The underlying file has been modified since being parsed");
        }
        if (!this.f7128) {
            return null;
        }
        if (!this.f7112 || this.f7119) {
            return new long[]{this.f7120 + this.f7109, this.f7117};
        }
        return null;
    }

    public boolean m5791() {
        return this.f7128;
    }

    public boolean m5792() {
        if (!this.f7128) {
            return false;
        }
        int i = this.f7126;
        return i == 6 || i == 7;
    }

    @InterfaceC1758
    @SuppressLint({"AutoBoxing"})
    public Long m5793() {
        String m5799 = m5799(f6850);
        String m57992 = m5799(f6702);
        if (m5799 != null && m57992 != null) {
            Pattern pattern = f6945;
            if (pattern.matcher(m5799).matches() || pattern.matcher(m57992).matches()) {
                String str = m5799 + ' ' + m57992;
                ParsePosition parsePosition = new ParsePosition(0);
                try {
                    Date parse = f6845.parse(str, parsePosition);
                    if (parse == null && (parse = f6872.parse(str, parsePosition)) == null) {
                        return null;
                    }
                    return Long.valueOf(parse.getTime());
                } catch (IllegalArgumentException unused) {
                }
            }
        }
        return null;
    }

    @InterfaceC1758
    @InterfaceC1762({InterfaceC1762.EnumC1763.LIBRARY})
    public Long m5794() {
        return m5770(m5799(f7094), m5799(f6857), m5799(f7080));
    }

    public void m5795(int i) {
        if (i % 90 != 0) {
            throw new IllegalArgumentException("degree should be a multiple of 90");
        }
        int m5788 = m5788(f6963, 1);
        List<Integer> list = f7008;
        if (list.contains(Integer.valueOf(m5788))) {
            int indexOf = (list.indexOf(Integer.valueOf(m5788)) + (i / 90)) % 4;
            r4 = list.get(indexOf + (indexOf < 0 ? 4 : 0)).intValue();
        } else {
            List<Integer> list2 = f6815;
            if (list2.contains(Integer.valueOf(m5788))) {
                int indexOf2 = (list2.indexOf(Integer.valueOf(m5788)) + (i / 90)) % 4;
                r4 = list2.get(indexOf2 + (indexOf2 < 0 ? 4 : 0)).intValue();
            }
        }
        m5775(f6963, Integer.toString(r4));
    }

    public void m5796(Location location) {
        if (location == null) {
            return;
        }
        m5775(f6710, location.getProvider());
        m5780(location.getLatitude(), location.getLongitude());
        m5786(location.getAltitude());
        m5775(f6781, "K");
        m5775(f6759, new C1601((location.getSpeed() * TimeUnit.HOURS.toSeconds(1L)) / 1000.0f).toString());
        String[] split = f6845.format(new Date(location.getTime())).split(C6566.f25308, -1);
        m5775(f6850, split[0]);
        m5775(f6702, split[1]);
    }

    @InterfaceC1758
    @InterfaceC1762({InterfaceC1762.EnumC1763.LIBRARY})
    public Long m5797() {
        return m5770(m5799(f7056), m5799(f6983), m5799(f6914));
    }

    @InterfaceC1762({InterfaceC1762.EnumC1763.LIBRARY})
    public void m5798(@InterfaceC1793 Long l) {
        Objects.requireNonNull(l, "Timestamp should not be null.");
        if (l.longValue() < 0) {
            throw new IllegalArgumentException("Timestamp should a positive value.");
        }
        String l2 = Long.toString(l.longValue() % 1000);
        for (int length = l2.length(); length < 3; length++) {
            l2 = PushConstants.PUSH_TYPE_NOTIFY + l2;
        }
        m5775(f7056, f6845.format(new Date(l.longValue())));
        m5775(f6983, l2);
    }

    @InterfaceC1758
    public String m5799(@InterfaceC1793 String str) {
        Objects.requireNonNull(str, "tag shouldn't be null");
        C1600 m5748 = m5748(str);
        if (m5748 != null) {
            if (!f6853.contains(str)) {
                return m5748.m5826(this.f7118);
            }
            if (str.equals(f6702)) {
                int i = m5748.f7144;
                if (i != 5 && i != 10) {
                    String str2 = "GPS Timestamp format is not rational. format=" + m5748.f7144;
                    return null;
                }
                C1601[] c1601Arr = (C1601[]) m5748.m5827(this.f7118);
                if (c1601Arr != null && c1601Arr.length == 3) {
                    return String.format("%02d:%02d:%02d", Integer.valueOf((int) (c1601Arr[0].f7146 / c1601Arr[0].f7145)), Integer.valueOf((int) (c1601Arr[1].f7146 / c1601Arr[1].f7145)), Integer.valueOf((int) (c1601Arr[2].f7146 / c1601Arr[2].f7145)));
                }
                String str3 = "Invalid GPS Timestamp array. array=" + Arrays.toString(c1601Arr);
                return null;
            }
            try {
                return Double.toString(m5748.m5828(this.f7118));
            } catch (NumberFormatException unused) {
            }
        }
        return null;
    }

    @InterfaceC1758
    public Bitmap m5800() {
        if (!this.f7128) {
            return null;
        }
        if (this.f7127 == null) {
            this.f7127 = m5802();
        }
        int i = this.f7126;
        if (i == 6 || i == 7) {
            return BitmapFactory.decodeByteArray(this.f7127, 0, this.f7117);
        }
        if (i == 1) {
            int length = this.f7127.length / 3;
            int[] iArr = new int[length];
            for (int i2 = 0; i2 < length; i2++) {
                byte[] bArr = this.f7127;
                int i3 = i2 * 3;
                iArr[i2] = (bArr[i3] << C0781.f3105) + 0 + (bArr[i3 + 1] << 8) + bArr[i3 + 2];
            }
            C1600 c1600 = this.f7111[4].get(f6704);
            C1600 c16002 = this.f7111[4].get(f6921);
            if (c1600 != null && c16002 != null) {
                return Bitmap.createBitmap(iArr, c16002.m5824(this.f7118), c1600.m5824(this.f7118), Bitmap.Config.ARGB_8888);
            }
        }
        return null;
    }

    public boolean m5801(@InterfaceC1793 String str) {
        return m5748(str) != null;
    }

    @InterfaceC1758
    public byte[] m5802() {
        Throwable th;
        FileDescriptor fileDescriptor;
        InputStream inputStream;
        Throwable th2;
        InputStream inputStream2 = null;
        if (!this.f7128) {
            return null;
        }
        byte[] bArr = this.f7127;
        if (bArr != null) {
            return bArr;
        }
        try {
            inputStream = this.f7122;
            try {
                if (inputStream != null) {
                    try {
                        if (!inputStream.markSupported()) {
                            C1593.m5715(inputStream);
                            return null;
                        }
                        inputStream.reset();
                    } catch (Exception unused) {
                        fileDescriptor = null;
                        C1593.m5715(inputStream);
                        if (fileDescriptor != null) {
                        }
                        return null;
                    } catch (Throwable th3) {
                        inputStream2 = inputStream;
                        th = th3;
                        fileDescriptor = null;
                        C1593.m5715(inputStream2);
                        if (fileDescriptor == null) {
                        }
                    }
                } else {
                    if (this.f7124 == null) {
                        if (Build.VERSION.SDK_INT >= 21) {
                            FileDescriptor m5719 = C1593.C1595.m5719(this.f7110);
                            try {
                                C1593.C1595.m5720(m5719, 0L, OsConstants.SEEK_SET);
                                fileDescriptor = m5719;
                                inputStream = new FileInputStream(m5719);
                            } catch (Exception unused2) {
                                fileDescriptor = m5719;
                                inputStream = null;
                                C1593.m5715(inputStream);
                                if (fileDescriptor != null) {
                                    C1593.m5710(fileDescriptor);
                                }
                                return null;
                            } catch (Throwable th4) {
                                th2 = th4;
                                fileDescriptor = m5719;
                                th = th2;
                                C1593.m5715(inputStream2);
                                if (fileDescriptor == null) {
                                    throw th;
                                }
                                C1593.m5710(fileDescriptor);
                                throw th;
                            }
                        } else {
                            inputStream = null;
                            fileDescriptor = null;
                        }
                        if (inputStream != null) {
                            throw new FileNotFoundException();
                        }
                        if (inputStream.skip(this.f7120 + this.f7109) != this.f7120 + this.f7109) {
                            throw new IOException("Corrupted image");
                        }
                        byte[] bArr2 = new byte[this.f7117];
                        if (inputStream.read(bArr2) != this.f7117) {
                            throw new IOException("Corrupted image");
                        }
                        this.f7127 = bArr2;
                        C1593.m5715(inputStream);
                        if (fileDescriptor != null) {
                            C1593.m5710(fileDescriptor);
                        }
                        return bArr2;
                    }
                    inputStream = new FileInputStream(this.f7124);
                }
                if (inputStream != null) {
                }
            } catch (Exception unused3) {
                C1593.m5715(inputStream);
                if (fileDescriptor != null) {
                }
                return null;
            } catch (Throwable th5) {
                th2 = th5;
                inputStream2 = inputStream;
                th = th2;
                C1593.m5715(inputStream2);
                if (fileDescriptor == null) {
                }
            }
            fileDescriptor = null;
        } catch (Exception unused4) {
            inputStream = null;
            fileDescriptor = null;
        } catch (Throwable th6) {
            th = th6;
            fileDescriptor = null;
        }
    }

    public void m5803() throws IOException {
        FileOutputStream fileOutputStream;
        FileInputStream fileInputStream;
        Closeable closeable;
        FileOutputStream fileOutputStream2;
        Exception exc;
        FileOutputStream fileOutputStream3;
        InputStream inputStream;
        Exception e;
        FileOutputStream fileOutputStream4;
        FileInputStream fileInputStream2;
        BufferedInputStream bufferedInputStream;
        if (!m5743(this.f7116)) {
            throw new IOException("ExifInterface only supports saving attributes for JPEG, PNG, WebP, and DNG formats.");
        }
        if (this.f7110 == null && this.f7124 == null) {
            throw new IOException("ExifInterface does not support saving attributes for the current input.");
        }
        if (this.f7128 && this.f7112 && !this.f7119) {
            throw new IOException("ExifInterface does not support saving attributes when the image file has non-consecutive thumbnail strips");
        }
        this.f7113 = true;
        this.f7127 = m5778();
        InputStream inputStream2 = null;
        try {
            File createTempFile = File.createTempFile("temp", "tmp");
            if (this.f7124 != null) {
                fileInputStream = new FileInputStream(this.f7124);
            } else if (Build.VERSION.SDK_INT >= 21) {
                C1593.C1595.m5720(this.f7110, 0L, OsConstants.SEEK_SET);
                fileInputStream = new FileInputStream(this.f7110);
            } else {
                fileInputStream = null;
            }
            try {
                fileOutputStream = new FileOutputStream(createTempFile);
                try {
                    C1593.m5717(fileInputStream, fileOutputStream);
                    C1593.m5715(fileInputStream);
                    C1593.m5715(fileOutputStream);
                    try {
                        try {
                            try {
                                fileInputStream2 = new FileInputStream(createTempFile);
                                try {
                                    if (this.f7124 != null) {
                                        fileOutputStream3 = new FileOutputStream(this.f7124);
                                    } else if (Build.VERSION.SDK_INT >= 21) {
                                        C1593.C1595.m5720(this.f7110, 0L, OsConstants.SEEK_SET);
                                        fileOutputStream3 = new FileOutputStream(this.f7110);
                                    } else {
                                        fileOutputStream3 = null;
                                    }
                                    try {
                                        bufferedInputStream = new BufferedInputStream(fileInputStream2);
                                    } catch (Exception e2) {
                                        inputStream2 = fileInputStream2;
                                        exc = e2;
                                    }
                                } catch (Exception e3) {
                                    e = e3;
                                    fileOutputStream2 = null;
                                    inputStream2 = fileInputStream2;
                                    exc = e;
                                    fileOutputStream3 = fileOutputStream2;
                                    try {
                                        inputStream = new FileInputStream(createTempFile);
                                    } catch (Exception e4) {
                                        inputStream = inputStream2;
                                        e = e4;
                                    } catch (Throwable th) {
                                        th = th;
                                    }
                                    try {
                                        if (this.f7124 != null) {
                                            if (Build.VERSION.SDK_INT >= 21) {
                                                C1593.C1595.m5720(this.f7110, 0L, OsConstants.SEEK_SET);
                                                fileOutputStream4 = new FileOutputStream(this.f7110);
                                            }
                                            C1593.m5717(inputStream, fileOutputStream3);
                                            C1593.m5715(inputStream);
                                            C1593.m5715(fileOutputStream3);
                                            throw new IOException("Failed to save new file", exc);
                                        }
                                        fileOutputStream4 = new FileOutputStream(this.f7124);
                                        fileOutputStream3 = fileOutputStream4;
                                        C1593.m5717(inputStream, fileOutputStream3);
                                        C1593.m5715(inputStream);
                                        C1593.m5715(fileOutputStream3);
                                        throw new IOException("Failed to save new file", exc);
                                    } catch (Exception e5) {
                                        e = e5;
                                        try {
                                            throw new IOException("Failed to save new file. Original file is stored in " + createTempFile.getAbsolutePath(), e);
                                        } catch (Throwable th2) {
                                            th = th2;
                                            inputStream2 = inputStream;
                                            C1593.m5715(inputStream2);
                                            C1593.m5715(fileOutputStream3);
                                            throw th;
                                        }
                                    } catch (Throwable th3) {
                                        th = th3;
                                        inputStream2 = inputStream;
                                        C1593.m5715(inputStream2);
                                        C1593.m5715(fileOutputStream3);
                                        throw th;
                                    }
                                }
                            } catch (Exception e6) {
                                e = e6;
                                fileOutputStream2 = null;
                            }
                        } catch (Throwable th4) {
                            th = th4;
                            closeable = null;
                            C1593.m5715(inputStream2);
                            C1593.m5715(closeable);
                            if (0 == 0) {
                                createTempFile.delete();
                            }
                            throw th;
                        }
                    } catch (Throwable th5) {
                        th = th5;
                    }
                    try {
                        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream3);
                        try {
                            int i = this.f7116;
                            if (i == 4) {
                                m5757(bufferedInputStream, bufferedOutputStream);
                            } else if (i == 13) {
                                m5762(bufferedInputStream, bufferedOutputStream);
                            } else if (i == 14) {
                                m5740(bufferedInputStream, bufferedOutputStream);
                            } else if (i == 3 || i == 0) {
                                m5732(new C1602(bufferedOutputStream, ByteOrder.BIG_ENDIAN));
                            }
                            C1593.m5715(bufferedInputStream);
                            C1593.m5715(bufferedOutputStream);
                            createTempFile.delete();
                            this.f7127 = null;
                        } catch (Exception e7) {
                            exc = e7;
                            inputStream2 = fileInputStream2;
                            inputStream = new FileInputStream(createTempFile);
                            if (this.f7124 != null) {
                            }
                            fileOutputStream3 = fileOutputStream4;
                            C1593.m5717(inputStream, fileOutputStream3);
                            C1593.m5715(inputStream);
                            C1593.m5715(fileOutputStream3);
                            throw new IOException("Failed to save new file", exc);
                        }
                    } catch (Exception e8) {
                        inputStream2 = fileInputStream2;
                        exc = e8;
                    } catch (Throwable th6) {
                        th = th6;
                        closeable = null;
                        inputStream2 = bufferedInputStream;
                        C1593.m5715(inputStream2);
                        C1593.m5715(closeable);
                        if (0 == 0) {
                        }
                        throw th;
                    }
                } catch (Exception e9) {
                    e = e9;
                    inputStream2 = fileInputStream;
                    try {
                        throw new IOException("Failed to copy original file to temp file", e);
                    } catch (Throwable th7) {
                        th = th7;
                        C1593.m5715(inputStream2);
                        C1593.m5715(fileOutputStream);
                        throw th;
                    }
                } catch (Throwable th8) {
                    th = th8;
                    inputStream2 = fileInputStream;
                    C1593.m5715(inputStream2);
                    C1593.m5715(fileOutputStream);
                    throw th;
                }
            } catch (Exception e10) {
                e = e10;
                fileOutputStream = null;
            } catch (Throwable th9) {
                th = th9;
                fileOutputStream = null;
            }
        } catch (Exception e11) {
            e = e11;
            fileOutputStream = null;
        } catch (Throwable th10) {
            th = th10;
            fileOutputStream = null;
        }
    }

    public void m5804() {
        m5775(f6963, Integer.toString(1));
    }

    public static class C1604 extends C1597 {
        public C1604(byte[] bArr) throws IOException {
            super(bArr);
            this.f7132.mark(Integer.MAX_VALUE);
        }

        public void m5836(long j) throws IOException {
            int i = this.f7134;
            if (i > j) {
                this.f7134 = 0;
                this.f7132.reset();
            } else {
                j -= i;
            }
            m5806((int) j);
        }

        public C1604(InputStream inputStream) throws IOException {
            super(inputStream);
            if (inputStream.markSupported()) {
                this.f7132.mark(Integer.MAX_VALUE);
                return;
            }
            throw new IllegalArgumentException("Cannot create SeekableByteOrderedDataInputStream with stream that does not support mark/reset");
        }
    }

    public static class C1598 {

        public final String f7136;

        public final int f7137;

        public final int f7138;

        public final int f7139;

        public C1598(String str, int i, int i2) {
            this.f7136 = str;
            this.f7139 = i;
            this.f7138 = i2;
            this.f7137 = -1;
        }

        public boolean m5809(int i) {
            int i2;
            int i3 = this.f7138;
            if (i3 == 7 || i == 7 || i3 == i || (i2 = this.f7137) == i) {
                return true;
            }
            if ((i3 == 4 || i2 == 4) && i == 3) {
                return true;
            }
            if ((i3 == 9 || i2 == 9) && i == 8) {
                return true;
            }
            return (i3 == 12 || i2 == 12) && i == 11;
        }

        public C1598(String str, int i, int i2, int i3) {
            this.f7136 = str;
            this.f7139 = i;
            this.f7138 = i2;
            this.f7137 = i3;
        }
    }

    public C1596(@InterfaceC1793 String str) throws IOException {
        C1598[][] c1598Arr = f7032;
        this.f7111 = new HashMap[c1598Arr.length];
        this.f7115 = new HashSet(c1598Arr.length);
        this.f7118 = ByteOrder.BIG_ENDIAN;
        Objects.requireNonNull(str, "filename cannot be null");
        m5729(str);
    }

    public C1596(@InterfaceC1793 FileDescriptor fileDescriptor) throws IOException {
        FileInputStream fileInputStream;
        Throwable th;
        C1598[][] c1598Arr = f7032;
        this.f7111 = new HashMap[c1598Arr.length];
        this.f7115 = new HashSet(c1598Arr.length);
        this.f7118 = ByteOrder.BIG_ENDIAN;
        Objects.requireNonNull(fileDescriptor, "fileDescriptor cannot be null");
        this.f7122 = null;
        this.f7124 = null;
        boolean z = false;
        if (Build.VERSION.SDK_INT >= 21 && m5736(fileDescriptor)) {
            this.f7110 = fileDescriptor;
            try {
                fileDescriptor = C1593.C1595.m5719(fileDescriptor);
                z = true;
            } catch (Exception e) {
                throw new IOException("Failed to duplicate file descriptor", e);
            }
        } else {
            this.f7110 = null;
        }
        try {
            fileInputStream = new FileInputStream(fileDescriptor);
            try {
                m5730(fileInputStream);
                C1593.m5715(fileInputStream);
                if (z) {
                    C1593.m5710(fileDescriptor);
                }
            } catch (Throwable th2) {
                th = th2;
                C1593.m5715(fileInputStream);
                if (z) {
                    C1593.m5710(fileDescriptor);
                }
                throw th;
            }
        } catch (Throwable th3) {
            fileInputStream = null;
            th = th3;
        }
    }

    public C1596(@InterfaceC1793 InputStream inputStream) throws IOException {
        this(inputStream, 0);
    }

    public C1596(@InterfaceC1793 InputStream inputStream, int i) throws IOException {
        C1598[][] c1598Arr = f7032;
        this.f7111 = new HashMap[c1598Arr.length];
        this.f7115 = new HashSet(c1598Arr.length);
        this.f7118 = ByteOrder.BIG_ENDIAN;
        Objects.requireNonNull(inputStream, "inputStream cannot be null");
        this.f7124 = null;
        if (i == 1) {
            BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, f6926.length);
            if (!m5725(bufferedInputStream)) {
                return;
            }
            this.f7129 = true;
            this.f7122 = null;
            this.f7110 = null;
            inputStream = bufferedInputStream;
        } else if (inputStream instanceof AssetManager.AssetInputStream) {
            this.f7122 = (AssetManager.AssetInputStream) inputStream;
            this.f7110 = null;
        } else {
            if (inputStream instanceof FileInputStream) {
                FileInputStream fileInputStream = (FileInputStream) inputStream;
                if (m5736(fileInputStream.getFD())) {
                    this.f7122 = null;
                    this.f7110 = fileInputStream.getFD();
                }
            }
            this.f7122 = null;
            this.f7110 = null;
        }
        m5730(inputStream);
    }
}