正在查看: moonshot.企业版 v8.14.46 应用的 C4428.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: moonshot.企业版 v8.14.46 应用的 C4428.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package c8sKPHc73aST6XPVbBtC.eu1n4Vdn1yKpcNjlf7lN.c8sKPHc73aST6XPVbBtC;
import JINLt5EavtBRnNuKNNEN.hX79Ew6mJdJrSjlkdwnl.k52vou7xlegBsU3qaLxq.zSFvmU2XOpXZrEfUxlHp.C1351;
import ZTD6r3EkaRUOi5CZamJi.zSFvmU2XOpXZrEfUxlHp.zSFvmU2XOpXZrEfUxlHp.C2486;
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 c8sKPHc73aST6XPVbBtC.PGqkJnXjeiwrwErSxdaQ.CClEfcQBIieeSntHv4xl.C3169;
import c8sKPHc73aST6XPVbBtC.c8sKPHc73aST6XPVbBtC.InterfaceC4379;
import c8sKPHc73aST6XPVbBtC.c8sKPHc73aST6XPVbBtC.InterfaceC4397;
import c8sKPHc73aST6XPVbBtC.c8sKPHc73aST6XPVbBtC.InterfaceC4399;
import c8sKPHc73aST6XPVbBtC.eu1n4Vdn1yKpcNjlf7lN.c8sKPHc73aST6XPVbBtC.C4438;
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 kp1AiJpjqJHu1Tcnj96z.Bu9YQKH1SoMrhmpeBGto.zSFvmU2XOpXZrEfUxlHp.k52vou7xlegBsU3qaLxq.C7366;
import kp1AiJpjqJHu1Tcnj96z.Yt7pKkvfomCuROgEX5My.zSFvmU2XOpXZrEfUxlHp.zSFvmU2XOpXZrEfUxlHp.C8511;
import kp1AiJpjqJHu1Tcnj96z.aKCBItyw9qyNc4XnXvii.zSFvmU2XOpXZrEfUxlHp.VDt5hM5rZJKFhafvD9gf.C8529;
public class C4428 {
public static final String f16552 = "SubjectDistanceRange";
public static final short f16553 = 2;
public static final String f16554 = "ColorSpace";
public static final short f16555 = 7;
private static final byte f16556 = -58;
public static final int f16558 = 2;
public static final short f16559 = 1;
public static final String f16560 = "JpgFromRaw";
public static final short f16561 = 1;
public static final String f16562 = "RecommendedExposureIndex";
public static final short f16563 = 0;
private static final short f16564 = 85;
private static final int f16565 = 7;
private static final int f16566 = 11;
public static final short f16567 = 5;
public static final int f16569 = 11;
public static final String f16570 = "ExifVersion";
public static final short f16571 = 2;
public static final String f16572 = "Xmp";
public static final short f16573 = 0;
public static final String f16574 = "SpectralSensitivity";
public static final short f16575 = 0;
private static final C4432 f16576;
public static final short f16577 = 3;
public static final String f16578 = "DateTime";
public static final int f16579 = 6;
private static final int f16580 = 1;
public static final short f16582 = 2;
private static final byte f16583 = -57;
public static final short f16585 = 22;
public static final String f16586 = "OECF";
public static final String f16587 = "A";
public static final short f16588 = 0;
public static final String f16589 = "K";
public static final short f16590 = 16;
public static final short f16592 = 1;
public static final String f16593 = "DefaultCropSize";
public static final String f16595 = "GPSImgDirectionRef";
public static final String f16596 = "RowsPerStrip";
public static final int f16597 = 6;
public static final int f16598 = 6;
public static final String f16599 = "OffsetTimeDigitized";
public static final short f16600 = 23;
public static final String f16601 = "PlanarConfiguration";
public static final short f16602 = 2;
private static final C4432[] f16603;
public static final String f16604 = "GPSDestLatitudeRef";
private static final C4432[] f16605;
public static final String f16606 = "ExposureTime";
public static final String f16607 = "DigitalZoomRatio";
private static final C4432[] f16608;
public static final short f16609 = 0;
public static final int f16610 = 0;
public static final int f16611 = 12;
public static final String f16612 = "SensitivityType";
public static final String f16613 = "LightSource";
public static final String f16615 = "GPSAreaInformation";
private static final byte f16616 = -55;
private static final HashSet<String> f16618;
public static final int f16619 = 8;
public static final String f16620 = "ImageUniqueID";
public static final String f16621 = "SceneType";
public static final String f16622 = "Model";
public static final int f16623 = 7;
public static final String f16624 = "CustomRendered";
private static final int f16625 = 5000;
public static final short f16626 = 0;
public static final String f16627 = "PrimaryChromaticities";
public static final int f16628 = 0;
public static final String f16629 = "ReferenceBlackWhite";
public static final short f16630 = 0;
public static final String f16631 = "FocalPlaneXResolution";
public static final String f16632 = "GPSSatellites";
private static final int f16633 = 5;
public static final String f16634 = "T";
public static final int f16636 = 5;
public static final int f16637 = 0;
public static final String f16638 = "SubfileType";
private static final String f16639 = "CameraSettingsIFDPointer";
public static final String f16641 = "GPSDestBearing";
public static final short f16643 = 2;
public static final String f16644 = "SpatialFrequencyResponse";
public static final short f16645 = 17;
public static final String f16646 = "FileSource";
private static final byte[] f16647;
public static final String f16648 = "InteroperabilityIndex";
private static final C4432[] f16649;
public static final String f16650 = "ISOSpeedLatitudeyyy";
public static final String f16651 = "ExposureProgram";
public static final String f16652 = "SubSecTimeOriginal";
public static final String f16653 = "SceneCaptureType";
public static final short f16655 = 1;
public static final String f16656 = "ImageLength";
private static final int f16657 = 2;
private static final byte f16658 = 47;
public static final String f16659 = "GPSLatitudeRef";
public static final String f16660 = "GainControl";
public static final short f16661 = 7;
public static final String f16662 = "3";
public static final short f16663 = 4;
public static final short f16665 = 64;
public static final String f16666 = "GPSDOP";
public static final Charset f16667;
public static final short f16668 = 0;
public static final int f16669 = 14;
public static final short f16670 = 1;
public static final String f16671 = "GPSTrack";
private static final int f16672 = 8;
public static final String f16673 = "GPSSpeedRef";
public static final int f16674 = 1;
public static final String f16675 = "GPSLatitude";
public static final String f16676 = "ThumbnailImage";
private static final int f16677 = 6;
public static final String f16678 = "Compression";
private static final int f16679 = 7;
public static final String f16680 = "GPSDestDistance";
public static final String f16681 = "GPSTrackRef";
private static final byte f16682 = -53;
public static final String f16683 = "SubjectArea";
public static final int f16684 = 5;
private static final byte f16685 = -63;
private static final int f16686 = 4;
public static final String f16687 = "ImageDescription";
public static final String f16688 = "ISO";
public static final String f16689 = "YCbCrCoefficients";
public static final int f16690 = 4;
public static final short f16691 = 6;
public static final int f16692 = 65535;
private static final byte f16693 = -59;
public static final String f16694 = "SensorBottomBorder";
private static final String f16695 = "PENTAX";
public static final String f16696 = "GPSDestDistanceRef";
public static final String f16697 = "ISOSpeed";
public static final short f16698 = 255;
public static final short f16699 = 2;
public static final String f16700 = "SensingMethod";
public static final int f16701 = 32773;
public static final String f16702 = "N";
private static final C4432[] f16703;
public static final String f16704 = "GPSProcessingMethod";
public static final int f16705 = 4;
public static final String f16706 = "Gamma";
public static final String f16707 = "Sharpness";
public static final byte f16708 = -31;
public static final String f16709 = "M";
public static final String f16710 = "GPSAltitude";
public static final short f16711 = 0;
public static final short f16712 = 3;
public static final int f16713 = 34892;
public static final short f16715 = 4;
private static final short f16716 = 21330;
public static final String f16717 = "PreviewImageStart";
private static final String f16718 = "FUJIFILMCCD-RAW";
public static final String f16719 = "StripByteCounts";
public static final short f16720 = 6;
public static final String f16721 = "ImageWidth";
private static final int f16722 = 8192;
public static final String f16723 = "FNumber";
public static final String f16724 = "SamplesPerPixel";
public static final int f16725 = 1;
public static final short f16726 = 3;
public static final String f16727 = "GPSVersionID";
@Deprecated
public static final int f16728 = 1;
public static final short f16729 = 3;
public static final String f16730 = "Orientation";
public static final String f16731 = "ThumbnailImageLength";
public static final short f16732 = 4;
public static final short f16733 = 2;
private static SimpleDateFormat f16734 = null;
public static final String f16735 = "ExposureMode";
@Deprecated
public static final int f16736 = 0;
public static final String f16737 = "N";
public static final short f16738 = 2;
public static final short f16739 = 24;
public static final short f16740 = 6;
private static final int f16741 = 3;
public static final short f16742 = 1;
public static final short f16743 = 1;
private static final int f16744 = 13;
public static final short f16745 = 21;
public static final short f16746 = 3;
public static final String f16749 = "YCbCrPositioning";
private static final short f16750 = 20306;
public static final short f16751 = 19789;
private static final int f16752 = 4;
public static final String f16753 = "SensorRightBorder";
public static final short f16754 = 1;
private static final int f16755 = 8;
public static final int f16756 = 4;
public static final String f16757 = "StripOffsets";
public static final short f16758 = 2;
private static final String f16759 = "GPSInfoIFDPointer";
public static final String f16760 = "ApertureValue";
public static final short f16761 = 5;
public static final String f16762 = "W";
public static final String f16763 = "E";
public static final String f16764 = "Saturation";
public static final String f16765 = "ResolutionUnit";
public static final String f16766 = "ShutterSpeedValue";
public static final String f16767 = "XResolution";
private static final String f16768 = "ImageProcessingIFDPointer";
public static final String f16769 = "GPSTimeStamp";
private static final int f16770 = 512;
public static final short f16773 = 0;
public static final String f16774 = "M";
public static final short f16775 = 8;
private static final int f16776 = 6;
private static final C4432[] f16777;
public static final String f16778 = "NewSubfileType";
public static final short f16779 = 16;
public static final String f16780 = "S";
public static final String f16781 = "Contrast";
public static final int f16782 = 7;
public static final String f16783 = "LensSerialNumber";
private static final byte f16784 = -2;
public static final short f16785 = 1;
public static final short f16786 = 3;
private static final C4432[] f16787;
private static final int f16788 = 9;
public static final String f16789 = "GPSDifferential";
public static final int f16790 = 10;
private static final byte f16791 = -62;
public static final short f16792 = 7;
public static final String f16793 = "SubSecTimeDigitized";
private static final int f16794 = 6;
public static final String f16795 = "ExposureBiasValue";
private static final HashMap<Integer, Integer> f16796;
public static final String f16797 = "SubjectLocation";
public static final int f16798 = 1;
private static final C4432[] f16799;
public static final short f16801 = 5;
public static final String f16803 = "CFAPattern";
public static final String f16804 = "OffsetTime";
public static final short f16805 = 2;
public static final String f16806 = "Software";
public static final int f16807 = 2;
public static final int f16808 = 3;
private static final int f16810 = 4;
public static final short f16811 = 11;
public static final String f16812 = "SubjectDistance";
public static final short f16813 = 3;
public static final String f16814 = "JPEGInterchangeFormat";
public static final int f16815 = 2;
public static final byte[] f16816;
public static final short f16817 = 4;
private static final HashMap<Integer, C4432>[] f16818;
public static final String f16819 = "BodySerialNumber";
public static final int f16820 = 0;
private static final int f16821 = 10;
public static final String f16822 = "PreviewImageLength";
public static final String f16823 = "GPSDestLatitude";
public static final short f16824 = 1;
public static final int f16826 = 13;
public static final String f16827 = "ComponentsConfiguration";
public static final String f16828 = "GPSDateStamp";
public static final short f16830 = 9;
public static final String f16831 = "GPSSpeed";
public static final String f16832 = "FocalPlaneYResolution";
public static final String f16833 = "WhiteBalance";
private static final byte f16834 = -51;
private static final byte f16835 = -54;
public static final short f16836 = 2;
public static final int f16837 = 8;
public static final String f16838 = "DateTimeOriginal";
public static final int f16839 = 9;
private static final String f16840 = "SubIFDPointer";
public static final short f16841 = 3;
private static final HashMap<String, C4432>[] f16842;
public static final short f16843 = 6;
public static final short f16844 = 4;
public static final byte f16845 = -39;
private static final int f16846 = 9;
public static final String f16847 = "AspectFrame";
public static final short f16848 = 20;
public static final String f16849 = "GPSAltitudeRef";
public static final int f16850 = 7;
private static final String f16851 = "InteroperabilityIFDPointer";
public static final short f16852 = 8;
public static final int f16853 = 0;
public static final String f16854 = "GPSHPositioningError";
@InterfaceC4379({InterfaceC4379.EnumC4380.LIBRARY})
public static final String f16855 = "ThumbnailOrientation";
private static final int f16856 = 4;
public static final String f16857 = "FlashEnergy";
public static final String f16858 = "DateTimeDigitized";
public static final short f16859 = 1;
public static final String f16860 = "Copyright";
public static final short f16861 = 14;
public static final String f16862 = "FocalPlaneResolutionUnit";
public static final short f16864 = 0;
public static final short f16865 = 8;
private static final byte f16866 = -49;
public static final String f16867 = "DNGVersion";
private static final int f16868 = 1;
public static final short f16869 = 0;
public static final int f16870 = 5;
public static final short f16871 = 0;
public static final String f16872 = "2";
public static final String f16873 = "CompressedBitsPerPixel";
private static final int f16874 = 10;
public static final String f16875 = "BrightnessValue";
private static final byte f16876 = -61;
public static final short f16877 = 18761;
public static final String f16878 = "GPSImgDirection";
private static final int f16880 = 8;
@Deprecated
public static final String f16881 = "ISOSpeedRatings";
public static final int f16882 = 0;
public static final String f16883 = "LensMake";
public static final int f16884 = 2;
public static final String f16885 = "PhotometricInterpretation";
public static final String f16886 = "GPSDestLongitude";
public static final String f16888 = "N";
public static final String f16889 = "ThumbnailImageWidth";
public static final short f16890 = 32;
private static final int f16891 = 3;
public static final String f16892 = "GPSDestLongitudeRef";
private static final int f16893 = 2;
private static final Pattern f16895;
public static final String f16896 = "GPSLongitudeRef";
public static final int f16897 = 6;
public static final short f16898 = 4;
private static final Pattern f16899;
public static final String f16900 = "TransferFunction";
public static final String f16901 = "OffsetTimeOriginal";
public static final short f16902 = 0;
public static final short f16903 = 0;
public static final short f16904 = 1;
private static final int f16905 = 84;
public static final String f16906 = "Artist";
public static final String f16907 = "Flash";
public static final String f16908 = "V";
public static final short f16909 = 3;
public static final short f16910 = 13;
private static final byte f16911 = -50;
public static final String f16912 = "MeteringMode";
public static final String f16913 = "CameraOwnerName";
public static final String f16914 = "PixelXDimension";
public static final String f16915 = "MakerNote";
public static final String f16916 = "ISOSpeedLatitudezzz";
public static final String f16917 = "Make";
public static final short f16918 = 2;
public static final short f16919 = 12;
public static final String f16920 = "YResolution";
public static final int f16921 = 8;
public static final String f16922 = "GPSMeasureMode";
public static final short f16923 = 1;
public static final String f16924 = "JPEGInterchangeFormatLength";
public static final String f16925 = "FlashpixVersion";
public static final int f16926 = 3;
public static final String f16927 = "YCbCrSubSampling";
public static final String f16928 = "K";
public static final byte f16929 = -1;
public static final short f16930 = 5;
private static final C4432[] f16931;
public static final short f16932 = 1;
public static final String f16933 = "UserComment";
public static final short f16934 = 0;
private static final Pattern f16935;
public static final int f16936 = 1;
public static final int f16937 = 1;
public static final String f16938 = "M";
public static final String f16939 = "LensSpecification";
public static final String f16940 = "MaxApertureValue";
public static final short f16941 = 2;
public static final short f16942 = 1;
public static final short f16943 = 0;
public static final String f16944 = "SensorTopBorder";
public static final String f16945 = "GPSLongitude";
private static final int f16947 = 12;
public static final short f16948 = 24;
@Deprecated
public static final String f16949 = "CameraOwnerName";
public static final short f16950 = 2;
public static final String f16952 = "ExposureIndex";
private static final byte f16953 = -64;
public static final short f16954 = 2;
private static final String f16955 = "ExifIFDPointer";
public static final String f16956 = "FocalLength";
private static final int f16957 = 12;
public static final int f16958 = 1;
public static final short f16959 = 1;
public static final String f16960 = "DeviceSettingDescription";
public static final String f16961 = "SensorLeftBorder";
private static final byte f16962 = -38;
public static final String f16963 = "BitsPerSample";
public static final String f16964 = "LensModel";
public static final short f16965 = 0;
public static final String f16966 = "GPSDestBearingRef";
private static SimpleDateFormat f16967 = null;
public static final short f16968 = 255;
public static final String f16969 = "GPSStatus";
public static final int f16971 = 1;
public static final String f16972 = "RelatedSoundFile";
public static final String f16973 = "PixelYDimension";
public static final short f16974 = 18;
public static final short f16975 = 4;
private static final int f16976 = 4;
public static final short f16977 = 19;
private static final int f16978 = 8;
public static final short f16979 = 1;
private static final int f16980 = 19;
public static final String f16981 = "PhotographicSensitivity";
public static final short f16982 = 1;
public static final short f16983 = 10;
public static final String f16984 = "SubSecTime";
public static final short f16985 = 15;
private static final int f16986 = 4;
public static final String f16987 = "StandardOutputSensitivity";
public static final short f16988 = 1;
public static final short f16989 = 1;
public static final String f16990 = "GPSMapDatum";
private static final C4432[] f16991;
public static final String f16992 = "FocalLengthIn35mmFilm";
public static final C4432[][] f16993;
public static final String f16994 = "WhitePoint";
private static final Pattern f16996;
public static final short f16997 = 3;
private boolean f16998;
private ByteOrder f16999;
private int f17000;
private AssetManager.AssetInputStream f17001;
private String f17002;
private final HashMap<String, C4433>[] f17003;
private byte[] f17004;
private boolean f17005;
private int f17006;
private int f17007;
private boolean f17008;
private boolean f17009;
private int f17010;
private int f17011;
private Set<Integer> f17012;
private FileDescriptor f17013;
private int f17014;
private boolean f17015;
private boolean f17016;
private int f17017;
private int f17018;
private static final String f16594 = "ExifInterface";
private static final boolean f16617 = Log.isLoggable(f16594, 3);
private static final List<Integer> f16863 = Arrays.asList(1, 6, 3, 8);
private static final List<Integer> f16772 = Arrays.asList(2, 7, 4, 5);
public static final int[] f16800 = {8, 8, 8};
public static final int[] f16614 = {4};
public static final int[] f16581 = {8};
private static final byte f16635 = -40;
public static final byte[] f16894 = {-1, f16635, -1};
private static final byte[] f16995 = {102, 116, 121, 112};
private static final byte[] f16809 = {109, 105, 102, 49};
private static final byte[] f16829 = {104, 101, 105, 99};
private static final byte[] f16825 = {79, 76, 89, 77, 80, 0};
private static final byte[] f16654 = {79, 76, 89, 77, 80, 85, 83, 0, 73, 73};
private static final byte[] f16802 = {-119, 80, 78, 71, AVChatControlCommand.NOTIFY_RECORD_START, 10, 26, 10};
private static final byte[] f16946 = {101, 88, 73, 102};
private static final byte[] f16714 = {73, 72, 68, 82};
private static final byte[] f16771 = {73, 69, 78, 68};
private static final byte[] f16879 = {82, 73, 70, 70};
private static final byte[] f16640 = {87, 69, 66, 80};
private static final byte[] f16584 = {69, 88, 73, 70};
public static final byte f16747 = 42;
private static final byte[] f16951 = {-99, 1, f16747};
private static final byte[] f16664 = "VP8X".getBytes(Charset.defaultCharset());
private static final byte[] f16557 = "VP8L".getBytes(Charset.defaultCharset());
private static final byte[] f16970 = "VP8 ".getBytes(Charset.defaultCharset());
private static final byte[] f16568 = "ANIM".getBytes(Charset.defaultCharset());
private static final byte[] f16642 = "ANMF".getBytes(Charset.defaultCharset());
public static final String[] f16887 = {"", "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"};
public static final int[] f16748 = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
public static final byte[] f16591 = {65, 83, 67, 73, 73, 0, 0, 0};
public static class C4429 {
public final long f17019;
public final long f17020;
public C4429(double d) {
this((long) (d * 10000.0d), C8511.f30508);
}
public String toString() {
return this.f17019 + "/" + this.f17020;
}
public double m21069() {
double d = this.f17019;
double d2 = this.f17020;
Double.isNaN(d);
Double.isNaN(d2);
return d / d2;
}
public C4429(long j, long j2) {
if (j2 == 0) {
this.f17019 = 0L;
this.f17020 = 1L;
} else {
this.f17019 = j;
this.f17020 = j2;
}
}
}
public static class C4430 extends FilterOutputStream {
public final OutputStream f17021;
private ByteOrder f17022;
public C4430(OutputStream outputStream, ByteOrder byteOrder) {
super(outputStream);
this.f17021 = outputStream;
this.f17022 = byteOrder;
}
@Override
public void write(byte[] bArr) throws IOException {
this.f17021.write(bArr);
}
public void m21070(int i) throws IOException {
ByteOrder byteOrder = this.f17022;
if (byteOrder == ByteOrder.LITTLE_ENDIAN) {
this.f17021.write((i >>> 0) & 255);
this.f17021.write((i >>> 8) & 255);
this.f17021.write((i >>> 16) & 255);
this.f17021.write((i >>> 24) & 255);
return;
}
if (byteOrder == ByteOrder.BIG_ENDIAN) {
this.f17021.write((i >>> 24) & 255);
this.f17021.write((i >>> 16) & 255);
this.f17021.write((i >>> 8) & 255);
this.f17021.write((i >>> 0) & 255);
}
}
public void m21071(ByteOrder byteOrder) {
this.f17022 = byteOrder;
}
public void m21072(int i) throws IOException {
m21073((short) i);
}
public void m21073(short s) throws IOException {
ByteOrder byteOrder = this.f17022;
if (byteOrder == ByteOrder.LITTLE_ENDIAN) {
this.f17021.write((s >>> 0) & 255);
this.f17021.write((s >>> 8) & 255);
} else if (byteOrder == ByteOrder.BIG_ENDIAN) {
this.f17021.write((s >>> 8) & 255);
this.f17021.write((s >>> 0) & 255);
}
}
public void m21074(int i) throws IOException {
this.f17021.write(i);
}
public void m21075(long j) throws IOException {
m21070((int) j);
}
@Override
public void write(byte[] bArr, int i, int i2) throws IOException {
this.f17021.write(bArr, i, i2);
}
}
public class C4431 extends MediaDataSource {
public long f17024;
public final C4437 f17025;
public C4431(C4437 c4437) {
this.f17025 = c4437;
}
@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.f17024;
if (j2 != j) {
if (j2 >= 0 && j >= j2 + this.f17025.available()) {
return -1;
}
this.f17025.m21100(j);
this.f17024 = j;
}
if (i2 > this.f17025.available()) {
i2 = this.f17025.available();
}
int read = this.f17025.read(bArr, i, i2);
if (read >= 0) {
this.f17024 += read;
return read;
}
} catch (IOException unused) {
}
this.f17024 = -1L;
return -1;
}
}
public static class C4433 {
public static final long f17030 = -1;
public final long f17031;
public final int f17032;
public final byte[] f17033;
public final int f17034;
public C4433(int i, int i2, byte[] bArr) {
this(i, i2, -1L, bArr);
}
public static C4433 m21077(long[] jArr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[C4428.f16748[4] * jArr.length]);
wrap.order(byteOrder);
for (long j : jArr) {
wrap.putInt((int) j);
}
return new C4433(4, jArr.length, wrap.array());
}
public static C4433 m21078(String str) {
byte[] bytes = (str + (char) 0).getBytes(C4428.f16667);
return new C4433(2, bytes.length, bytes);
}
public static C4433 m21079(double[] dArr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[C4428.f16748[12] * dArr.length]);
wrap.order(byteOrder);
for (double d : dArr) {
wrap.putDouble(d);
}
return new C4433(12, dArr.length, wrap.array());
}
public static C4433 m21080(String str) {
if (str.length() == 1 && str.charAt(0) >= '0' && str.charAt(0) <= '1') {
return new C4433(1, 1, new byte[]{(byte) (str.charAt(0) - '0')});
}
byte[] bytes = str.getBytes(C4428.f16667);
return new C4433(1, bytes.length, bytes);
}
public static C4433 m21081(C4429 c4429, ByteOrder byteOrder) {
return m21085(new C4429[]{c4429}, byteOrder);
}
public static C4433 m21082(int[] iArr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[C4428.f16748[3] * iArr.length]);
wrap.order(byteOrder);
for (int i : iArr) {
wrap.putShort((short) i);
}
return new C4433(3, iArr.length, wrap.array());
}
public static C4433 m21083(C4429 c4429, ByteOrder byteOrder) {
return m21087(new C4429[]{c4429}, byteOrder);
}
public static C4433 m21084(int i, ByteOrder byteOrder) {
return m21088(new int[]{i}, byteOrder);
}
public static C4433 m21085(C4429[] c4429Arr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[C4428.f16748[10] * c4429Arr.length]);
wrap.order(byteOrder);
for (C4429 c4429 : c4429Arr) {
wrap.putInt((int) c4429.f17019);
wrap.putInt((int) c4429.f17020);
}
return new C4433(10, c4429Arr.length, wrap.array());
}
public static C4433 m21086(double d, ByteOrder byteOrder) {
return m21079(new double[]{d}, byteOrder);
}
public static C4433 m21087(C4429[] c4429Arr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[C4428.f16748[5] * c4429Arr.length]);
wrap.order(byteOrder);
for (C4429 c4429 : c4429Arr) {
wrap.putInt((int) c4429.f17019);
wrap.putInt((int) c4429.f17020);
}
return new C4433(5, c4429Arr.length, wrap.array());
}
public static C4433 m21088(int[] iArr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[C4428.f16748[9] * iArr.length]);
wrap.order(byteOrder);
for (int i : iArr) {
wrap.putInt(i);
}
return new C4433(9, iArr.length, wrap.array());
}
public static C4433 m21089(long j, ByteOrder byteOrder) {
return m21077(new long[]{j}, byteOrder);
}
public static C4433 m21090(int i, ByteOrder byteOrder) {
return m21082(new int[]{i}, byteOrder);
}
public String toString() {
return C2486.C2488.f7759 + C4428.f16887[this.f17032] + ", data length:" + this.f17033.length + C2486.C2488.f7757;
}
public double m21091(ByteOrder byteOrder) {
Object m21093 = m21093(byteOrder);
if (m21093 == null) {
throw new NumberFormatException("NULL can't be converted to a double value");
}
if (m21093 instanceof String) {
return Double.parseDouble((String) m21093);
}
if (m21093 instanceof long[]) {
if (((long[]) m21093).length == 1) {
return r5[0];
}
throw new NumberFormatException("There are more than one component");
}
if (m21093 instanceof int[]) {
if (((int[]) m21093).length == 1) {
return r5[0];
}
throw new NumberFormatException("There are more than one component");
}
if (m21093 instanceof double[]) {
double[] dArr = (double[]) m21093;
if (dArr.length == 1) {
return dArr[0];
}
throw new NumberFormatException("There are more than one component");
}
if (!(m21093 instanceof C4429[])) {
throw new NumberFormatException("Couldn't find a double value");
}
C4429[] c4429Arr = (C4429[]) m21093;
if (c4429Arr.length == 1) {
return c4429Arr[0].m21069();
}
throw new NumberFormatException("There are more than one component");
}
public int m21092(ByteOrder byteOrder) {
Object m21093 = m21093(byteOrder);
if (m21093 == null) {
throw new NumberFormatException("NULL can't be converted to a integer value");
}
if (m21093 instanceof String) {
return Integer.parseInt((String) m21093);
}
if (m21093 instanceof long[]) {
long[] jArr = (long[]) m21093;
if (jArr.length == 1) {
return (int) jArr[0];
}
throw new NumberFormatException("There are more than one component");
}
if (!(m21093 instanceof int[])) {
throw new NumberFormatException("Couldn't find a integer value");
}
int[] iArr = (int[]) m21093;
if (iArr.length == 1) {
return iArr[0];
}
throw new NumberFormatException("There are more than one component");
}
public Object m21093(ByteOrder byteOrder) {
C4435 c4435;
byte b;
byte[] bArr;
C4435 c44352 = null;
try {
c4435 = new C4435(this.f17033);
} catch (IOException unused) {
c4435 = null;
} catch (Throwable th) {
th = th;
}
try {
c4435.m21096(byteOrder);
boolean z = true;
int i = 0;
switch (this.f17032) {
case 1:
case 6:
byte[] bArr2 = this.f17033;
if (bArr2.length != 1 || bArr2[0] < 0 || bArr2[0] > 1) {
String str = new String(this.f17033, C4428.f16667);
try {
c4435.close();
} catch (IOException unused2) {
}
return str;
}
String str2 = new String(new char[]{(char) (this.f17033[0] + 48)});
try {
c4435.close();
} catch (IOException unused3) {
}
return str2;
case 2:
case 7:
if (this.f17034 >= C4428.f16591.length) {
int i2 = 0;
while (true) {
bArr = C4428.f16591;
if (i2 < bArr.length) {
if (this.f17033[i2] != bArr[i2]) {
z = false;
} else {
i2++;
}
}
}
if (z) {
i = bArr.length;
}
}
StringBuilder sb = new StringBuilder();
while (i < this.f17034 && (b = this.f17033[i]) != 0) {
if (b >= 32) {
sb.append((char) b);
} else {
sb.append('?');
}
i++;
}
String sb2 = sb.toString();
try {
c4435.close();
} catch (IOException unused4) {
}
return sb2;
case 3:
int[] iArr = new int[this.f17034];
while (i < this.f17034) {
iArr[i] = c4435.readUnsignedShort();
i++;
}
try {
c4435.close();
} catch (IOException unused5) {
}
return iArr;
case 4:
long[] jArr = new long[this.f17034];
while (i < this.f17034) {
jArr[i] = c4435.m21099();
i++;
}
try {
c4435.close();
} catch (IOException unused6) {
}
return jArr;
case 5:
C4429[] c4429Arr = new C4429[this.f17034];
while (i < this.f17034) {
c4429Arr[i] = new C4429(c4435.m21099(), c4435.m21099());
i++;
}
try {
c4435.close();
} catch (IOException unused7) {
}
return c4429Arr;
case 8:
int[] iArr2 = new int[this.f17034];
while (i < this.f17034) {
iArr2[i] = c4435.readShort();
i++;
}
try {
c4435.close();
} catch (IOException unused8) {
}
return iArr2;
case 9:
int[] iArr3 = new int[this.f17034];
while (i < this.f17034) {
iArr3[i] = c4435.readInt();
i++;
}
try {
c4435.close();
} catch (IOException unused9) {
}
return iArr3;
case 10:
C4429[] c4429Arr2 = new C4429[this.f17034];
while (i < this.f17034) {
c4429Arr2[i] = new C4429(c4435.readInt(), c4435.readInt());
i++;
}
try {
c4435.close();
} catch (IOException unused10) {
}
return c4429Arr2;
case 11:
double[] dArr = new double[this.f17034];
while (i < this.f17034) {
dArr[i] = c4435.readFloat();
i++;
}
try {
c4435.close();
} catch (IOException unused11) {
}
return dArr;
case 12:
double[] dArr2 = new double[this.f17034];
while (i < this.f17034) {
dArr2[i] = c4435.readDouble();
i++;
}
try {
c4435.close();
} catch (IOException unused12) {
}
return dArr2;
default:
try {
c4435.close();
} catch (IOException unused13) {
}
return null;
}
} catch (IOException unused14) {
if (c4435 != null) {
try {
c4435.close();
} catch (IOException unused15) {
}
}
return null;
} catch (Throwable th2) {
th = th2;
c44352 = c4435;
if (c44352 != null) {
try {
c44352.close();
} catch (IOException unused16) {
}
}
throw th;
}
}
public int m21094() {
return C4428.f16748[this.f17032] * this.f17034;
}
public String m21095(ByteOrder byteOrder) {
Object m21093 = m21093(byteOrder);
if (m21093 == null) {
return null;
}
if (m21093 instanceof String) {
return (String) m21093;
}
StringBuilder sb = new StringBuilder();
int i = 0;
if (m21093 instanceof long[]) {
long[] jArr = (long[]) m21093;
while (i < jArr.length) {
sb.append(jArr[i]);
i++;
if (i != jArr.length) {
sb.append(",");
}
}
return sb.toString();
}
if (m21093 instanceof int[]) {
int[] iArr = (int[]) m21093;
while (i < iArr.length) {
sb.append(iArr[i]);
i++;
if (i != iArr.length) {
sb.append(",");
}
}
return sb.toString();
}
if (m21093 instanceof double[]) {
double[] dArr = (double[]) m21093;
while (i < dArr.length) {
sb.append(dArr[i]);
i++;
if (i != dArr.length) {
sb.append(",");
}
}
return sb.toString();
}
if (!(m21093 instanceof C4429[])) {
return null;
}
C4429[] c4429Arr = (C4429[]) m21093;
while (i < c4429Arr.length) {
sb.append(c4429Arr[i].f17019);
sb.append('/');
sb.append(c4429Arr[i].f17020);
i++;
if (i != c4429Arr.length) {
sb.append(",");
}
}
return sb.toString();
}
public C4433(int i, int i2, long j, byte[] bArr) {
this.f17032 = i;
this.f17034 = i2;
this.f17031 = j;
this.f17033 = bArr;
}
}
@Retention(RetentionPolicy.SOURCE)
@InterfaceC4379({InterfaceC4379.EnumC4380.LIBRARY})
public @interface InterfaceC4434 {
}
public static class C4435 extends InputStream implements DataInput {
public int f17037;
private byte[] f17038;
public final DataInputStream f17039;
private ByteOrder f17040;
private static final ByteOrder f17036 = ByteOrder.LITTLE_ENDIAN;
private static final ByteOrder f17035 = ByteOrder.BIG_ENDIAN;
public C4435(byte[] bArr) throws IOException {
this(new ByteArrayInputStream(bArr), ByteOrder.BIG_ENDIAN);
}
@Override
public int available() throws IOException {
return this.f17039.available();
}
@Override
public void mark(int i) {
throw new UnsupportedOperationException("Mark is currently unsupported");
}
@Override
public int read() throws IOException {
this.f17037++;
return this.f17039.read();
}
@Override
public boolean readBoolean() throws IOException {
this.f17037++;
return this.f17039.readBoolean();
}
@Override
public byte readByte() throws IOException {
this.f17037++;
int read = this.f17039.read();
if (read >= 0) {
return (byte) read;
}
throw new EOFException();
}
@Override
public char readChar() throws IOException {
this.f17037 += 2;
return this.f17039.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.f17037 += i2;
this.f17039.readFully(bArr, i, i2);
}
@Override
public int readInt() throws IOException {
this.f17037 += 4;
int read = this.f17039.read();
int read2 = this.f17039.read();
int read3 = this.f17039.read();
int read4 = this.f17039.read();
if ((read | read2 | read3 | read4) < 0) {
throw new EOFException();
}
ByteOrder byteOrder = this.f17040;
if (byteOrder == f17036) {
return (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
}
if (byteOrder == f17035) {
return (read << 24) + (read2 << 16) + (read3 << 8) + read4;
}
throw new IOException("Invalid byte order: " + this.f17040);
}
@Override
public String readLine() throws IOException {
return null;
}
@Override
public long readLong() throws IOException {
this.f17037 += 8;
int read = this.f17039.read();
int read2 = this.f17039.read();
int read3 = this.f17039.read();
int read4 = this.f17039.read();
int read5 = this.f17039.read();
int read6 = this.f17039.read();
int read7 = this.f17039.read();
int read8 = this.f17039.read();
if ((read | read2 | read3 | read4 | read5 | read6 | read7 | read8) < 0) {
throw new EOFException();
}
ByteOrder byteOrder = this.f17040;
if (byteOrder == f17036) {
return (read8 << 56) + (read7 << 48) + (read6 << 40) + (read5 << 32) + (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
}
if (byteOrder == f17035) {
return (read << 56) + (read2 << 48) + (read3 << 40) + (read4 << 32) + (read5 << 24) + (read6 << 16) + (read7 << 8) + read8;
}
throw new IOException("Invalid byte order: " + this.f17040);
}
@Override
public short readShort() throws IOException {
this.f17037 += 2;
int read = this.f17039.read();
int read2 = this.f17039.read();
if ((read | read2) < 0) {
throw new EOFException();
}
ByteOrder byteOrder = this.f17040;
if (byteOrder == f17036) {
return (short) ((read2 << 8) + read);
}
if (byteOrder == f17035) {
return (short) ((read << 8) + read2);
}
throw new IOException("Invalid byte order: " + this.f17040);
}
@Override
public String readUTF() throws IOException {
this.f17037 += 2;
return this.f17039.readUTF();
}
@Override
public int readUnsignedByte() throws IOException {
this.f17037++;
return this.f17039.readUnsignedByte();
}
@Override
public int readUnsignedShort() throws IOException {
this.f17037 += 2;
int read = this.f17039.read();
int read2 = this.f17039.read();
if ((read | read2) < 0) {
throw new EOFException();
}
ByteOrder byteOrder = this.f17040;
if (byteOrder == f17036) {
return (read2 << 8) + read;
}
if (byteOrder == f17035) {
return (read << 8) + read2;
}
throw new IOException("Invalid byte order: " + this.f17040);
}
@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 void m21096(ByteOrder byteOrder) {
this.f17040 = byteOrder;
}
public int m21097() {
return this.f17037;
}
public void m21098(int i) throws IOException {
int i2 = 0;
while (i2 < i) {
int i3 = i - i2;
int skip = (int) this.f17039.skip(i3);
if (skip <= 0) {
if (this.f17038 == null) {
this.f17038 = new byte[8192];
}
skip = this.f17039.read(this.f17038, 0, Math.min(8192, i3));
if (skip == -1) {
throw new EOFException("Reached EOF while skipping " + i + " bytes.");
}
}
i2 += skip;
}
this.f17037 += i2;
}
public long m21099() throws IOException {
return readInt() & 4294967295L;
}
public C4435(InputStream inputStream) throws IOException {
this(inputStream, ByteOrder.BIG_ENDIAN);
}
public C4435(InputStream inputStream, ByteOrder byteOrder) throws IOException {
this.f17040 = ByteOrder.BIG_ENDIAN;
DataInputStream dataInputStream = new DataInputStream(inputStream);
this.f17039 = dataInputStream;
dataInputStream.mark(0);
this.f17037 = 0;
this.f17040 = byteOrder;
}
@Override
public int read(byte[] bArr, int i, int i2) throws IOException {
int read = this.f17039.read(bArr, i, i2);
this.f17037 += read;
return read;
}
@Override
public void readFully(byte[] bArr) throws IOException {
this.f17037 += bArr.length;
this.f17039.readFully(bArr);
}
}
@Retention(RetentionPolicy.SOURCE)
@InterfaceC4379({InterfaceC4379.EnumC4380.LIBRARY})
public @interface InterfaceC4436 {
}
static {
C4432[] c4432Arr = {new C4432(f16778, 254, 4), new C4432(f16638, 255, 4), new C4432(f16721, 256, 3, 4), new C4432(f16656, 257, 3, 4), new C4432(f16963, 258, 3), new C4432(f16678, 259, 3), new C4432(f16885, 262, 3), new C4432(f16687, SubsamplingScaleImageView.ORIENTATION_270, 2), new C4432(f16917, 271, 2), new C4432(f16622, 272, 2), new C4432(f16757, 273, 3, 4), new C4432(f16730, 274, 3), new C4432(f16724, 277, 3), new C4432(f16596, 278, 3, 4), new C4432(f16719, 279, 3, 4), new C4432(f16767, 282, 5), new C4432(f16920, 283, 5), new C4432(f16601, 284, 3), new C4432(f16765, 296, 3), new C4432(f16900, 301, 3), new C4432(f16806, 305, 2), new C4432(f16578, 306, 2), new C4432(f16906, 315, 2), new C4432(f16994, 318, 5), new C4432(f16627, TbsListener.ErrorCode.ERROR_QBSDK_INIT_CANLOADX5, 5), new C4432(f16840, TbsListener.ErrorCode.ERROR_QBSDK_INIT_ERROR_RET_TYPE_NOT_BUNDLE, 4), new C4432(f16814, C3169.f10955, 4), new C4432(f16924, 514, 4), new C4432(f16689, 529, 5), new C4432(f16927, 530, 3), new C4432(f16749, 531, 3), new C4432(f16629, 532, 5), new C4432(f16860, 33432, 2), new C4432(f16955, 34665, 4), new C4432(f16759, 34853, 4), new C4432(f16944, 4, 4), new C4432(f16961, 5, 4), new C4432(f16694, 6, 4), new C4432(f16753, 7, 4), new C4432(f16688, 23, 3), new C4432(f16560, 46, 7), new C4432(f16572, 700, 1)};
f16991 = c4432Arr;
C4432[] c4432Arr2 = {new C4432(f16606, 33434, 5), new C4432(f16723, 33437, 5), new C4432(f16651, 34850, 3), new C4432(f16574, 34852, 2), new C4432(f16981, 34855, 3), new C4432(f16586, 34856, 7), new C4432(f16612, 34864, 3), new C4432(f16987, 34865, 4), new C4432(f16562, 34866, 4), new C4432(f16697, 34867, 4), new C4432(f16650, 34868, 4), new C4432(f16916, 34869, 4), new C4432(f16570, 36864, 2), new C4432(f16838, 36867, 2), new C4432(f16858, 36868, 2), new C4432(f16804, 36880, 2), new C4432(f16901, 36881, 2), new C4432(f16599, 36882, 2), new C4432(f16827, 37121, 7), new C4432(f16873, 37122, 5), new C4432(f16766, 37377, 10), new C4432(f16760, 37378, 5), new C4432(f16875, 37379, 10), new C4432(f16795, 37380, 10), new C4432(f16940, 37381, 5), new C4432(f16812, 37382, 5), new C4432(f16912, 37383, 3), new C4432(f16613, 37384, 3), new C4432(f16907, 37385, 3), new C4432(f16956, 37386, 5), new C4432(f16683, 37396, 3), new C4432(f16915, 37500, 7), new C4432(f16933, 37510, 7), new C4432(f16984, 37520, 2), new C4432(f16652, 37521, 2), new C4432(f16793, 37522, 2), new C4432(f16925, 40960, 7), new C4432(f16554, 40961, 3), new C4432(f16914, 40962, 3, 4), new C4432(f16973, 40963, 3, 4), new C4432(f16972, 40964, 2), new C4432(f16851, 40965, 4), new C4432(f16857, 41483, 5), new C4432(f16644, 41484, 7), new C4432(f16631, 41486, 5), new C4432(f16832, 41487, 5), new C4432(f16862, 41488, 3), new C4432(f16797, 41492, 3), new C4432(f16952, 41493, 5), new C4432(f16700, 41495, 3), new C4432(f16646, 41728, 7), new C4432(f16621, 41729, 7), new C4432(f16803, 41730, 7), new C4432(f16624, 41985, 3), new C4432(f16735, 41986, 3), new C4432(f16833, 41987, 3), new C4432(f16607, 41988, 5), new C4432(f16992, 41989, 3), new C4432(f16653, 41990, 3), new C4432(f16660, 41991, 3), new C4432(f16781, 41992, 3), new C4432(f16764, 41993, 3), new C4432(f16707, 41994, 3), new C4432(f16960, 41995, 7), new C4432(f16552, 41996, 3), new C4432(f16620, 42016, 2), new C4432("CameraOwnerName", 42032, 2), new C4432(f16819, 42033, 2), new C4432(f16939, 42034, 5), new C4432(f16883, 42035, 2), new C4432(f16964, 42036, 2), new C4432(f16706, 42240, 5), new C4432(f16867, 50706, 1), new C4432(f16593, 50720, 3, 4)};
f16787 = c4432Arr2;
C4432[] c4432Arr3 = {new C4432(f16727, 0, 1), new C4432(f16659, 1, 2), new C4432(f16675, 2, 5, 10), new C4432(f16896, 3, 2), new C4432(f16945, 4, 5, 10), new C4432(f16849, 5, 1), new C4432(f16710, 6, 5), new C4432(f16769, 7, 5), new C4432(f16632, 8, 2), new C4432(f16969, 9, 2), new C4432(f16922, 10, 2), new C4432(f16666, 11, 5), new C4432(f16673, 12, 2), new C4432(f16831, 13, 5), new C4432(f16681, 14, 2), new C4432(f16671, 15, 5), new C4432(f16595, 16, 2), new C4432(f16878, 17, 5), new C4432(f16990, 18, 2), new C4432(f16604, 19, 2), new C4432(f16823, 20, 5), new C4432(f16892, 21, 2), new C4432(f16886, 22, 5), new C4432(f16966, 23, 2), new C4432(f16641, 24, 5), new C4432(f16696, 25, 2), new C4432(f16680, 26, 5), new C4432(f16704, 27, 7), new C4432(f16615, 28, 7), new C4432(f16828, 29, 2), new C4432(f16789, 30, 3), new C4432(f16854, 31, 5)};
f16799 = c4432Arr3;
C4432[] c4432Arr4 = {new C4432(f16648, 1, 2)};
f16608 = c4432Arr4;
C4432[] c4432Arr5 = {new C4432(f16778, 254, 4), new C4432(f16638, 255, 4), new C4432(f16889, 256, 3, 4), new C4432(f16731, 257, 3, 4), new C4432(f16963, 258, 3), new C4432(f16678, 259, 3), new C4432(f16885, 262, 3), new C4432(f16687, SubsamplingScaleImageView.ORIENTATION_270, 2), new C4432(f16917, 271, 2), new C4432(f16622, 272, 2), new C4432(f16757, 273, 3, 4), new C4432(f16855, 274, 3), new C4432(f16724, 277, 3), new C4432(f16596, 278, 3, 4), new C4432(f16719, 279, 3, 4), new C4432(f16767, 282, 5), new C4432(f16920, 283, 5), new C4432(f16601, 284, 3), new C4432(f16765, 296, 3), new C4432(f16900, 301, 3), new C4432(f16806, 305, 2), new C4432(f16578, 306, 2), new C4432(f16906, 315, 2), new C4432(f16994, 318, 5), new C4432(f16627, TbsListener.ErrorCode.ERROR_QBSDK_INIT_CANLOADX5, 5), new C4432(f16840, TbsListener.ErrorCode.ERROR_QBSDK_INIT_ERROR_RET_TYPE_NOT_BUNDLE, 4), new C4432(f16814, C3169.f10955, 4), new C4432(f16924, 514, 4), new C4432(f16689, 529, 5), new C4432(f16927, 530, 3), new C4432(f16749, 531, 3), new C4432(f16629, 532, 5), new C4432(f16572, 700, 1), new C4432(f16860, 33432, 2), new C4432(f16955, 34665, 4), new C4432(f16759, 34853, 4), new C4432(f16867, 50706, 1), new C4432(f16593, 50720, 3, 4)};
f16703 = c4432Arr5;
f16576 = new C4432(f16757, 273, 3);
C4432[] c4432Arr6 = {new C4432(f16676, 256, 7), new C4432(f16639, 8224, 4), new C4432(f16768, 8256, 4)};
f16777 = c4432Arr6;
C4432[] c4432Arr7 = {new C4432(f16717, 257, 4), new C4432(f16822, 258, 4)};
f16931 = c4432Arr7;
C4432[] c4432Arr8 = {new C4432(f16847, 4371, 3)};
f16605 = c4432Arr8;
C4432[] c4432Arr9 = {new C4432(f16554, 55, 3)};
f16603 = c4432Arr9;
C4432[][] c4432Arr10 = {c4432Arr, c4432Arr2, c4432Arr3, c4432Arr4, c4432Arr5, c4432Arr, c4432Arr6, c4432Arr7, c4432Arr8, c4432Arr9};
f16993 = c4432Arr10;
f16649 = new C4432[]{new C4432(f16840, TbsListener.ErrorCode.ERROR_QBSDK_INIT_ERROR_RET_TYPE_NOT_BUNDLE, 4), new C4432(f16955, 34665, 4), new C4432(f16759, 34853, 4), new C4432(f16851, 40965, 4), new C4432(f16639, 8224, 1), new C4432(f16768, 8256, 1)};
f16818 = new HashMap[c4432Arr10.length];
f16842 = new HashMap[c4432Arr10.length];
f16618 = new HashSet<>(Arrays.asList(f16723, f16607, f16606, f16812, f16769));
f16796 = new HashMap<>();
Charset forName = Charset.forName("US-ASCII");
f16667 = forName;
f16816 = "Exif\u0000\u0000".getBytes(forName);
f16647 = "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);
f16734 = simpleDateFormat;
simpleDateFormat.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat(C8529.f30583, locale);
f16967 = simpleDateFormat2;
simpleDateFormat2.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
int i = 0;
while (true) {
C4432[][] c4432Arr11 = f16993;
if (i >= c4432Arr11.length) {
HashMap<Integer, Integer> hashMap = f16796;
C4432[] c4432Arr12 = f16649;
hashMap.put(Integer.valueOf(c4432Arr12[0].f17027), 5);
hashMap.put(Integer.valueOf(c4432Arr12[1].f17027), 1);
hashMap.put(Integer.valueOf(c4432Arr12[2].f17027), 2);
hashMap.put(Integer.valueOf(c4432Arr12[3].f17027), 3);
hashMap.put(Integer.valueOf(c4432Arr12[4].f17027), 7);
hashMap.put(Integer.valueOf(c4432Arr12[5].f17027), 8);
f16996 = Pattern.compile(".*[1-9].*");
f16899 = Pattern.compile("^(\\d{2}):(\\d{2}):(\\d{2})$");
f16895 = Pattern.compile("^(\\d{4}):(\\d{2}):(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$");
f16935 = Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$");
return;
}
f16818[i] = new HashMap<>();
f16842[i] = new HashMap<>();
for (C4432 c4432 : c4432Arr11[i]) {
f16818[i].put(Integer.valueOf(c4432.f17027), c4432);
f16842[i].put(c4432.f17029, c4432);
}
i++;
}
}
public C4428(@InterfaceC4399 File file) throws IOException {
C4432[][] c4432Arr = f16993;
this.f17003 = new HashMap[c4432Arr.length];
this.f17012 = new HashSet(c4432Arr.length);
this.f16999 = ByteOrder.BIG_ENDIAN;
Objects.requireNonNull(file, "file cannot be null");
m21030(file.getAbsolutePath());
}
private boolean m20986(byte[] bArr) throws IOException {
int i = 0;
while (true) {
byte[] bArr2 = f16879;
if (i >= bArr2.length) {
int i2 = 0;
while (true) {
byte[] bArr3 = f16640;
if (i2 >= bArr3.length) {
return true;
}
if (bArr[f16879.length + i2 + 4] != bArr3[i2]) {
return false;
}
i2++;
}
} else {
if (bArr[i] != bArr2[i]) {
return false;
}
i++;
}
}
}
private void m20987() throws IOException {
m20992(0, 5);
m20992(0, 4);
m20992(5, 4);
C4433 c4433 = this.f17003[1].get(f16914);
C4433 c44332 = this.f17003[1].get(f16973);
if (c4433 != null && c44332 != null) {
this.f17003[0].put(f16721, c4433);
this.f17003[0].put(f16656, c44332);
}
if (this.f17003[4].isEmpty() && m20988(this.f17003[5])) {
HashMap<String, C4433>[] hashMapArr = this.f17003;
hashMapArr[4] = hashMapArr[5];
hashMapArr[5] = new HashMap<>();
}
m20988(this.f17003[4]);
m21018(0, f16855, f16730);
m21018(0, f16731, f16656);
m21018(0, f16889, f16721);
m21018(5, f16855, f16730);
m21018(5, f16731, f16656);
m21018(5, f16889, f16721);
m21018(4, f16730, f16855);
m21018(4, f16656, f16731);
m21018(4, f16721, f16889);
}
private boolean m20988(HashMap hashMap) throws IOException {
C4433 c4433 = (C4433) hashMap.get(f16656);
C4433 c44332 = (C4433) hashMap.get(f16721);
if (c4433 == null || c44332 == null) {
return false;
}
return c4433.m21092(this.f16999) <= 512 && c44332.m21092(this.f16999) <= 512;
}
private boolean m20989(byte[] bArr) throws IOException {
int i = 0;
while (true) {
byte[] bArr2 = f16802;
if (i >= bArr2.length) {
return true;
}
if (bArr[i] != bArr2[i]) {
return false;
}
i++;
}
}
private static boolean m20990(int i) {
return (i == 4 || i == 9 || i == 13 || i == 14) ? false : true;
}
private void m20991(C4435 c4435, HashMap hashMap) throws IOException {
C4433 c4433 = (C4433) hashMap.get(f16757);
C4433 c44332 = (C4433) hashMap.get(f16719);
if (c4433 == null || c44332 == null) {
return;
}
long[] m21105 = C4438.m21105(c4433.m21093(this.f16999));
long[] m211052 = C4438.m21105(c44332.m21093(this.f16999));
if (m21105 == null || m21105.length == 0 || m211052 == null || m211052.length == 0 || m21105.length != m211052.length) {
return;
}
long j = 0;
for (long j2 : m211052) {
j += j2;
}
int i = (int) j;
byte[] bArr = new byte[i];
int i2 = 1;
this.f17008 = true;
this.f16998 = true;
this.f17016 = true;
int i3 = 0;
int i4 = 0;
int i5 = 0;
while (i3 < m21105.length) {
int i6 = (int) m21105[i3];
int i7 = (int) m211052[i3];
if (i3 < m21105.length - i2 && i6 + i7 != m21105[i3 + 1]) {
this.f17008 = false;
}
int i8 = i6 - i4;
if (i8 < 0) {
return;
}
long j3 = i8;
if (c4435.skip(j3) != j3) {
String str = "Failed to skip " + i8 + " bytes.";
return;
}
int i9 = i4 + i8;
byte[] bArr2 = new byte[i7];
if (c4435.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.f17004 = bArr;
if (this.f17008) {
this.f17014 = (int) m21105[0];
this.f17018 = i;
}
}
private void m20992(int i, int i2) throws IOException {
if (this.f17003[i].isEmpty() || this.f17003[i2].isEmpty()) {
boolean z = f16617;
return;
}
C4433 c4433 = this.f17003[i].get(f16656);
C4433 c44332 = this.f17003[i].get(f16721);
C4433 c44333 = this.f17003[i2].get(f16656);
C4433 c44334 = this.f17003[i2].get(f16721);
if (c4433 == null || c44332 == null) {
boolean z2 = f16617;
return;
}
if (c44333 == null || c44334 == null) {
boolean z3 = f16617;
return;
}
int m21092 = c4433.m21092(this.f16999);
int m210922 = c44332.m21092(this.f16999);
int m210923 = c44333.m21092(this.f16999);
int m210924 = c44334.m21092(this.f16999);
if (m21092 >= m210923 || m210922 >= m210924) {
return;
}
HashMap<String, C4433>[] hashMapArr = this.f17003;
HashMap<String, C4433> hashMap = hashMapArr[i];
hashMapArr[i] = hashMapArr[i2];
hashMapArr[i2] = hashMap;
}
private int m20993(BufferedInputStream bufferedInputStream) throws IOException {
bufferedInputStream.mark(5000);
byte[] bArr = new byte[5000];
bufferedInputStream.read(bArr);
bufferedInputStream.reset();
if (m21003(bArr)) {
return 4;
}
if (m21002(bArr)) {
return 9;
}
if (m20996(bArr)) {
return 12;
}
if (m20997(bArr)) {
return 7;
}
if (m21027(bArr)) {
return 10;
}
if (m20989(bArr)) {
return 13;
}
return m20986(bArr) ? 14 : 0;
}
private static boolean m20994(FileDescriptor fileDescriptor) {
if (Build.VERSION.SDK_INT >= 21) {
try {
C4438.C4439.m21109(fileDescriptor, 0L, OsConstants.SEEK_CUR);
return true;
} catch (Exception unused) {
boolean z = f16617;
}
}
return false;
}
private static double m20995(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(f16780) && !str2.equals(f16762)) {
if (!str2.equals("N") && !str2.equals(f16763)) {
throw new IllegalArgumentException();
}
return parseDouble3;
}
return -parseDouble3;
} catch (ArrayIndexOutOfBoundsException | NumberFormatException unused) {
throw new IllegalArgumentException();
}
}
private boolean m20996(byte[] bArr) throws IOException {
C4435 c4435;
long readInt;
byte[] bArr2;
C4435 c44352 = null;
try {
try {
c4435 = new C4435(bArr);
} catch (Exception unused) {
}
} catch (Throwable th) {
th = th;
}
try {
readInt = c4435.readInt();
bArr2 = new byte[4];
c4435.read(bArr2);
} catch (Exception unused2) {
c44352 = c4435;
boolean z = f16617;
if (c44352 != null) {
c44352.close();
}
return false;
} catch (Throwable th2) {
th = th2;
c44352 = c4435;
if (c44352 != null) {
c44352.close();
}
throw th;
}
if (!Arrays.equals(bArr2, f16995)) {
c4435.close();
return false;
}
long j = 16;
if (readInt == 1) {
readInt = c4435.readLong();
if (readInt < 16) {
c4435.close();
return false;
}
} else {
j = 8;
}
if (readInt > bArr.length) {
readInt = bArr.length;
}
long j2 = readInt - j;
if (j2 < 8) {
c4435.close();
return false;
}
byte[] bArr3 = new byte[4];
boolean z2 = false;
boolean z3 = false;
for (long j3 = 0; j3 < j2 / 4; j3++) {
if (c4435.read(bArr3) != 4) {
c4435.close();
return false;
}
if (j3 != 1) {
if (Arrays.equals(bArr3, f16809)) {
z2 = true;
} else if (Arrays.equals(bArr3, f16829)) {
z3 = true;
}
if (z2 && z3) {
c4435.close();
return true;
}
}
}
c4435.close();
return false;
}
private boolean m20997(byte[] bArr) throws IOException {
C4435 c4435 = null;
try {
C4435 c44352 = new C4435(bArr);
try {
ByteOrder m21021 = m21021(c44352);
this.f16999 = m21021;
c44352.m21096(m21021);
short readShort = c44352.readShort();
boolean z = readShort == 20306 || readShort == 21330;
c44352.close();
return z;
} catch (Exception unused) {
c4435 = c44352;
if (c4435 != null) {
c4435.close();
}
return false;
} catch (Throwable th) {
th = th;
c4435 = c44352;
if (c4435 != null) {
c4435.close();
}
throw th;
}
} catch (Exception unused2) {
} catch (Throwable th2) {
th = th2;
}
}
private void m20998() {
String m21063 = m21063(f16838);
if (m21063 != null && m21063(f16578) == null) {
this.f17003[0].put(f16578, C4433.m21078(m21063));
}
if (m21063(f16721) == null) {
this.f17003[0].put(f16721, C4433.m21089(0L, this.f16999));
}
if (m21063(f16656) == null) {
this.f17003[0].put(f16656, C4433.m21089(0L, this.f16999));
}
if (m21063(f16730) == null) {
this.f17003[0].put(f16730, C4433.m21089(0L, this.f16999));
}
if (m21063(f16613) == null) {
this.f17003[1].put(f16613, C4433.m21089(0L, this.f16999));
}
}
private void m20999(InputStream inputStream, OutputStream outputStream) throws IOException {
if (f16617) {
String str = "savePngAttributes starting with (inputStream: " + inputStream + ", outputStream: " + outputStream + C2486.C2488.f7757;
}
C4435 c4435 = new C4435(inputStream);
ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
C4430 c4430 = new C4430(outputStream, byteOrder);
byte[] bArr = f16802;
C4438.m21104(c4435, c4430, bArr.length);
int i = this.f17006;
if (i == 0) {
int readInt = c4435.readInt();
c4430.m21070(readInt);
C4438.m21104(c4435, c4430, readInt + 4 + 4);
} else {
C4438.m21104(c4435, c4430, ((i - bArr.length) - 4) - 4);
c4435.m21098(c4435.readInt() + 4 + 4);
}
ByteArrayOutputStream byteArrayOutputStream = null;
try {
ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
try {
C4430 c44302 = new C4430(byteArrayOutputStream2, byteOrder);
m21004(c44302);
byte[] byteArray = ((ByteArrayOutputStream) c44302.f17021).toByteArray();
c4430.write(byteArray);
CRC32 crc32 = new CRC32();
crc32.update(byteArray, 4, byteArray.length - 4);
c4430.m21070((int) crc32.getValue());
C4438.m21102(byteArrayOutputStream2);
C4438.m21108(c4435, c4430);
} catch (Throwable th) {
th = th;
byteArrayOutputStream = byteArrayOutputStream2;
C4438.m21102(byteArrayOutputStream);
throw th;
}
} catch (Throwable th2) {
th = th2;
}
}
private void m21000(C4435 c4435) throws IOException {
if (f16617) {
String str = "getPngAttributes starting with: " + c4435;
}
c4435.m21096(ByteOrder.BIG_ENDIAN);
byte[] bArr = f16802;
c4435.m21098(bArr.length);
int length = bArr.length + 0;
while (true) {
try {
int readInt = c4435.readInt();
int i = length + 4;
byte[] bArr2 = new byte[4];
if (c4435.read(bArr2) != 4) {
throw new IOException("Encountered invalid length while parsing PNG chunktype");
}
int i2 = i + 4;
if (i2 == 16 && !Arrays.equals(bArr2, f16714)) {
throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk");
}
if (Arrays.equals(bArr2, f16771)) {
return;
}
if (Arrays.equals(bArr2, f16946)) {
byte[] bArr3 = new byte[readInt];
if (c4435.read(bArr3) != readInt) {
throw new IOException("Failed to read given length for given PNG chunk type: " + C4438.m21103(bArr2));
}
int readInt2 = c4435.readInt();
CRC32 crc32 = new CRC32();
crc32.update(bArr2);
crc32.update(bArr3);
if (((int) crc32.getValue()) == readInt2) {
this.f17006 = i2;
m21026(bArr3, 0);
m20987();
m21035(new C4435(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;
c4435.m21098(i3);
length = i2 + i3;
} catch (EOFException unused) {
throw new IOException("Encountered corrupt PNG file.");
}
}
}
private void m21001(C4437 c4437) throws IOException {
C4433 c4433;
m21034(c4437);
m21031(c4437, 0);
m21037(c4437, 0);
m21037(c4437, 5);
m21037(c4437, 4);
m20987();
if (this.f17011 != 8 || (c4433 = this.f17003[1].get(f16915)) == null) {
return;
}
C4437 c44372 = new C4437(c4433.f17033);
c44372.m21096(this.f16999);
c44372.m21098(6);
m21031(c44372, 9);
C4433 c44332 = this.f17003[9].get(f16554);
if (c44332 != null) {
this.f17003[1].put(f16554, c44332);
}
}
private boolean m21002(byte[] bArr) throws IOException {
byte[] bytes = f16718.getBytes(Charset.defaultCharset());
for (int i = 0; i < bytes.length; i++) {
if (bArr[i] != bytes[i]) {
return false;
}
}
return true;
}
private static boolean m21003(byte[] bArr) throws IOException {
int i = 0;
while (true) {
byte[] bArr2 = f16894;
if (i >= bArr2.length) {
return true;
}
if (bArr[i] != bArr2[i]) {
return false;
}
i++;
}
}
private int m21004(C4430 c4430) throws IOException {
C4432[][] c4432Arr = f16993;
int[] iArr = new int[c4432Arr.length];
int[] iArr2 = new int[c4432Arr.length];
for (C4432 c4432 : f16649) {
m21033(c4432.f17029);
}
if (this.f17016) {
if (this.f16998) {
m21033(f16757);
m21033(f16719);
} else {
m21033(f16814);
m21033(f16924);
}
}
for (int i = 0; i < f16993.length; i++) {
for (Object obj : this.f17003[i].entrySet().toArray()) {
Map.Entry entry = (Map.Entry) obj;
if (entry.getValue() == null) {
this.f17003[i].remove(entry.getKey());
}
}
}
if (!this.f17003[1].isEmpty()) {
this.f17003[0].put(f16649[1].f17029, C4433.m21089(0L, this.f16999));
}
if (!this.f17003[2].isEmpty()) {
this.f17003[0].put(f16649[2].f17029, C4433.m21089(0L, this.f16999));
}
if (!this.f17003[3].isEmpty()) {
this.f17003[1].put(f16649[3].f17029, C4433.m21089(0L, this.f16999));
}
if (this.f17016) {
if (this.f16998) {
this.f17003[4].put(f16757, C4433.m21090(0, this.f16999));
this.f17003[4].put(f16719, C4433.m21090(this.f17018, this.f16999));
} else {
this.f17003[4].put(f16814, C4433.m21089(0L, this.f16999));
this.f17003[4].put(f16924, C4433.m21089(this.f17018, this.f16999));
}
}
for (int i2 = 0; i2 < f16993.length; i2++) {
Iterator<Map.Entry<String, C4433>> it = this.f17003[i2].entrySet().iterator();
int i3 = 0;
while (it.hasNext()) {
int m21094 = it.next().getValue().m21094();
if (m21094 > 4) {
i3 += m21094;
}
}
iArr2[i2] = iArr2[i2] + i3;
}
int i4 = 8;
for (int i5 = 0; i5 < f16993.length; i5++) {
if (!this.f17003[i5].isEmpty()) {
iArr[i5] = i4;
i4 += (this.f17003[i5].size() * 12) + 2 + 4 + iArr2[i5];
}
}
if (this.f17016) {
if (this.f16998) {
this.f17003[4].put(f16757, C4433.m21090(i4, this.f16999));
} else {
this.f17003[4].put(f16814, C4433.m21089(i4, this.f16999));
}
this.f17014 = i4;
i4 += this.f17018;
}
if (this.f17011 == 4) {
i4 += 8;
}
if (f16617) {
for (int i6 = 0; i6 < f16993.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.f17003[i6].size()), Integer.valueOf(iArr2[i6]), Integer.valueOf(i4));
}
}
if (!this.f17003[1].isEmpty()) {
this.f17003[0].put(f16649[1].f17029, C4433.m21089(iArr[1], this.f16999));
}
if (!this.f17003[2].isEmpty()) {
this.f17003[0].put(f16649[2].f17029, C4433.m21089(iArr[2], this.f16999));
}
if (!this.f17003[3].isEmpty()) {
this.f17003[1].put(f16649[3].f17029, C4433.m21089(iArr[3], this.f16999));
}
int i7 = this.f17011;
if (i7 == 4) {
c4430.m21072(i4);
c4430.write(f16816);
} else if (i7 == 13) {
c4430.m21070(i4);
c4430.write(f16946);
} else if (i7 == 14) {
c4430.write(f16584);
c4430.m21070(i4);
}
c4430.m21073(this.f16999 == ByteOrder.BIG_ENDIAN ? f16751 : f16877);
c4430.m21071(this.f16999);
c4430.m21072(42);
c4430.m21075(8L);
for (int i8 = 0; i8 < f16993.length; i8++) {
if (!this.f17003[i8].isEmpty()) {
c4430.m21072(this.f17003[i8].size());
int size = iArr[i8] + 2 + (this.f17003[i8].size() * 12) + 4;
for (Map.Entry<String, C4433> entry2 : this.f17003[i8].entrySet()) {
int i9 = f16842[i8].get(entry2.getKey()).f17027;
C4433 value = entry2.getValue();
int m210942 = value.m21094();
c4430.m21072(i9);
c4430.m21072(value.f17032);
c4430.m21070(value.f17034);
if (m210942 > 4) {
c4430.m21075(size);
size += m210942;
} else {
c4430.write(value.f17033);
if (m210942 < 4) {
while (m210942 < 4) {
c4430.m21074(0);
m210942++;
}
}
}
}
if (i8 != 0 || this.f17003[4].isEmpty()) {
c4430.m21075(0L);
} else {
c4430.m21075(iArr[4]);
}
Iterator<Map.Entry<String, C4433>> it2 = this.f17003[i8].entrySet().iterator();
while (it2.hasNext()) {
byte[] bArr = it2.next().getValue().f17033;
if (bArr.length > 4) {
c4430.write(bArr, 0, bArr.length);
}
}
}
}
if (this.f17016) {
c4430.write(m21054());
}
if (this.f17011 == 14 && i4 % 2 == 1) {
c4430.m21074(0);
}
c4430.m21071(ByteOrder.BIG_ENDIAN);
return i4;
}
private void m21005(@InterfaceC4399 InputStream inputStream) {
Objects.requireNonNull(inputStream, "inputstream shouldn't be null");
for (int i = 0; i < f16993.length; i++) {
try {
try {
this.f17003[i] = new HashMap<>();
} catch (IOException | UnsupportedOperationException unused) {
boolean z = f16617;
m20998();
if (!z) {
return;
}
}
} finally {
m20998();
if (f16617) {
m21017();
}
}
}
if (!this.f17015) {
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
this.f17011 = m20993(bufferedInputStream);
inputStream = bufferedInputStream;
}
if (m20990(this.f17011)) {
C4437 c4437 = new C4437(inputStream);
if (this.f17015) {
m21007(c4437);
} else {
int i2 = this.f17011;
if (i2 == 12) {
m21012(c4437);
} else if (i2 == 7) {
m21006(c4437);
} else if (i2 == 10) {
m21008(c4437);
} else {
m21001(c4437);
}
}
c4437.m21100(this.f17006);
m21035(c4437);
} else {
C4435 c4435 = new C4435(inputStream);
int i3 = this.f17011;
if (i3 == 4) {
m21011(c4435, 0, 0);
} else if (i3 == 13) {
m21000(c4435);
} else if (i3 == 9) {
m21032(c4435);
} else if (i3 == 14) {
m21028(c4435);
}
}
}
private void m21006(C4437 c4437) throws IOException {
m21001(c4437);
C4433 c4433 = this.f17003[1].get(f16915);
if (c4433 != null) {
C4437 c44372 = new C4437(c4433.f17033);
c44372.m21096(this.f16999);
byte[] bArr = f16825;
byte[] bArr2 = new byte[bArr.length];
c44372.readFully(bArr2);
c44372.m21100(0L);
byte[] bArr3 = f16654;
byte[] bArr4 = new byte[bArr3.length];
c44372.readFully(bArr4);
if (Arrays.equals(bArr2, bArr)) {
c44372.m21100(8L);
} else if (Arrays.equals(bArr4, bArr3)) {
c44372.m21100(12L);
}
m21031(c44372, 6);
C4433 c44332 = this.f17003[7].get(f16717);
C4433 c44333 = this.f17003[7].get(f16822);
if (c44332 != null && c44333 != null) {
this.f17003[5].put(f16814, c44332);
this.f17003[5].put(f16924, c44333);
}
C4433 c44334 = this.f17003[8].get(f16847);
if (c44334 != null) {
int[] iArr = (int[]) c44334.m21093(this.f16999);
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;
}
C4433 m21090 = C4433.m21090(i, this.f16999);
C4433 m210902 = C4433.m21090(i2, this.f16999);
this.f17003[0].put(f16721, m21090);
this.f17003[0].put(f16656, m210902);
}
}
}
private void m21007(C4437 c4437) throws IOException {
byte[] bArr = f16816;
c4437.m21098(bArr.length);
byte[] bArr2 = new byte[c4437.available()];
c4437.readFully(bArr2);
this.f17006 = bArr.length;
m21026(bArr2, 0);
}
private void m21008(C4437 c4437) throws IOException {
if (f16617) {
String str = "getRw2Attributes starting with: " + c4437;
}
m21001(c4437);
C4433 c4433 = this.f17003[0].get(f16560);
if (c4433 != null) {
m21011(new C4435(c4433.f17033), (int) c4433.f17031, 5);
}
C4433 c44332 = this.f17003[0].get(f16688);
C4433 c44333 = this.f17003[1].get(f16981);
if (c44332 == null || c44333 != null) {
return;
}
this.f17003[1].put(f16981, c44332);
}
private void m21009(C4435 c4435, HashMap hashMap) throws IOException {
C4433 c4433 = (C4433) hashMap.get(f16814);
C4433 c44332 = (C4433) hashMap.get(f16924);
if (c4433 == null || c44332 == null) {
return;
}
int m21092 = c4433.m21092(this.f16999);
int m210922 = c44332.m21092(this.f16999);
if (this.f17011 == 7) {
m21092 += this.f17017;
}
if (m21092 > 0 && m210922 > 0) {
this.f17016 = true;
if (this.f17002 == null && this.f17001 == null && this.f17013 == null) {
byte[] bArr = new byte[m210922];
c4435.skip(m21092);
c4435.read(bArr);
this.f17004 = bArr;
}
this.f17014 = m21092;
this.f17018 = m210922;
}
if (f16617) {
String str = "Setting thumbnail attributes with offset: " + m21092 + ", length: " + m210922;
}
}
private static Pair<Integer, Integer> m21010(String str) {
if (str.contains(",")) {
String[] split = str.split(",", -1);
Pair<Integer, Integer> m21010 = m21010(split[0]);
if (((Integer) m21010.first).intValue() == 2) {
return m21010;
}
for (int i = 1; i < split.length; i++) {
Pair<Integer, Integer> m210102 = m21010(split[i]);
int intValue = (((Integer) m210102.first).equals(m21010.first) || ((Integer) m210102.second).equals(m21010.first)) ? ((Integer) m21010.first).intValue() : -1;
int intValue2 = (((Integer) m21010.second).intValue() == -1 || !(((Integer) m210102.first).equals(m21010.second) || ((Integer) m210102.second).equals(m21010.second))) ? -1 : ((Integer) m21010.second).intValue();
if (intValue == -1 && intValue2 == -1) {
return new Pair<>(2, -1);
}
if (intValue == -1) {
m21010 = new Pair<>(Integer.valueOf(intValue2), -1);
} else if (intValue2 == -1) {
m21010 = new Pair<>(Integer.valueOf(intValue), -1);
}
}
return m21010;
}
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 void m21011(C4435 c4435, int i, int i2) throws IOException {
if (f16617) {
String str = "getJpegAttributes starting with: " + c4435;
}
c4435.m21096(ByteOrder.BIG_ENDIAN);
byte readByte = c4435.readByte();
byte b = -1;
if (readByte != -1) {
throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255));
}
if (c4435.readByte() != -40) {
throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255));
}
int i3 = 2;
int i4 = 2;
while (true) {
byte readByte2 = c4435.readByte();
if (readByte2 != b) {
throw new IOException("Invalid marker:" + Integer.toHexString(readByte2 & 255));
}
int i5 = i4 + 1;
byte readByte3 = c4435.readByte();
boolean z = f16617;
if (z) {
String str2 = "Found JPEG segment indicator: " + Integer.toHexString(readByte3 & 255);
}
int i6 = i5 + 1;
if (readByte3 != -39 && readByte3 != -38) {
int readUnsignedShort = c4435.readUnsignedShort() - i3;
int i7 = i6 + i3;
if (z) {
String str3 = "JPEG segment: " + Integer.toHexString(readByte3 & 255) + " (length: " + (readUnsignedShort + 2) + C2486.C2488.f7757;
}
if (readUnsignedShort < 0) {
throw new IOException("Invalid length");
}
if (readByte3 == -31) {
byte[] bArr = new byte[readUnsignedShort];
c4435.readFully(bArr);
int i8 = i7 + readUnsignedShort;
byte[] bArr2 = f16816;
if (C4438.m21101(bArr, bArr2)) {
byte[] copyOfRange = Arrays.copyOfRange(bArr, bArr2.length, readUnsignedShort);
this.f17006 = i + i7 + bArr2.length;
m21026(copyOfRange, i2);
m21035(new C4435(copyOfRange));
} else {
byte[] bArr3 = f16647;
if (C4438.m21101(bArr, bArr3)) {
int length = i7 + bArr3.length;
byte[] copyOfRange2 = Arrays.copyOfRange(bArr, bArr3.length, readUnsignedShort);
if (m21063(f16572) == null) {
this.f17003[0].put(f16572, new C4433(1, copyOfRange2.length, length, copyOfRange2));
this.f17005 = true;
}
}
}
i7 = i8;
} else if (readByte3 != -2) {
switch (readByte3) {
default:
switch (readByte3) {
default:
switch (readByte3) {
default:
switch (readByte3) {
}
case -55:
case -54:
case -53:
c4435.m21098(1);
this.f17003[i2].put(i2 != 4 ? f16656 : f16731, C4433.m21089(c4435.readUnsignedShort(), this.f16999));
this.f17003[i2].put(i2 != 4 ? f16721 : f16889, C4433.m21089(c4435.readUnsignedShort(), this.f16999));
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");
}
c4435.m21098(readUnsignedShort);
i4 = i7 + readUnsignedShort;
i3 = 2;
b = -1;
} else {
byte[] bArr4 = new byte[readUnsignedShort];
if (c4435.read(bArr4) != readUnsignedShort) {
throw new IOException("Invalid exif");
}
if (m21063(f16933) == null) {
this.f17003[1].put(f16933, C4433.m21078(new String(bArr4, f16667)));
}
}
readUnsignedShort = 0;
if (readUnsignedShort >= 0) {
}
}
}
}
private void m21012(C4437 c4437) 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 {
C4438.C4440.m21112(mediaMetadataRetriever, new C4431(c4437));
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.f17003[0].put(f16721, C4433.m21090(Integer.parseInt(str3), this.f16999));
}
if (str != null) {
this.f17003[0].put(f16656, C4433.m21090(Integer.parseInt(str), this.f16999));
}
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.f17003[0].put(f16730, C4433.m21090(i, this.f16999));
}
if (extractMetadata != null && extractMetadata2 != null) {
int parseInt2 = Integer.parseInt(extractMetadata);
int parseInt3 = Integer.parseInt(extractMetadata2);
if (parseInt3 <= 6) {
throw new IOException("Invalid exif length");
}
c4437.m21100(parseInt2);
byte[] bArr = new byte[6];
if (c4437.read(bArr) != 6) {
throw new IOException("Can't read identifier");
}
int i2 = parseInt2 + 6;
int i3 = parseInt3 - 6;
if (!Arrays.equals(bArr, f16816)) {
throw new IOException("Invalid identifier");
}
byte[] bArr2 = new byte[i3];
if (c4437.read(bArr2) != i3) {
throw new IOException("Can't read exif");
}
this.f17006 = i2;
m21026(bArr2, 0);
}
if (f16617) {
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 void m21013(InputStream inputStream, OutputStream outputStream) throws IOException {
ByteArrayOutputStream byteArrayOutputStream;
int i;
int i2;
int i3;
int i4;
if (f16617) {
String str = "saveWebpAttributes starting with (inputStream: " + inputStream + ", outputStream: " + outputStream + C2486.C2488.f7757;
}
ByteOrder byteOrder = ByteOrder.LITTLE_ENDIAN;
C4435 c4435 = new C4435(inputStream, byteOrder);
C4430 c4430 = new C4430(outputStream, byteOrder);
byte[] bArr = f16879;
C4438.m21104(c4435, c4430, bArr.length);
byte[] bArr2 = f16640;
c4435.m21098(bArr2.length + 4);
ByteArrayOutputStream byteArrayOutputStream2 = null;
try {
try {
byteArrayOutputStream = new ByteArrayOutputStream();
} catch (Exception e) {
e = e;
}
} catch (Throwable th) {
th = th;
}
try {
C4430 c44302 = new C4430(byteArrayOutputStream, byteOrder);
int i5 = this.f17006;
if (i5 != 0) {
C4438.m21104(c4435, c44302, ((i5 - ((bArr.length + 4) + bArr2.length)) - 4) - 4);
c4435.m21098(4);
c4435.m21098(c4435.readInt());
m21004(c44302);
} else {
byte[] bArr3 = new byte[4];
if (c4435.read(bArr3) != 4) {
throw new IOException("Encountered invalid length while parsing WebP chunk type");
}
byte[] bArr4 = f16664;
boolean z = true;
if (Arrays.equals(bArr3, bArr4)) {
int readInt = c4435.readInt();
byte[] bArr5 = new byte[readInt % 2 == 1 ? readInt + 1 : readInt];
c4435.read(bArr5);
bArr5[0] = (byte) (8 | bArr5[0]);
if (((bArr5[0] >> 1) & 1) != 1) {
z = false;
}
c44302.write(bArr4);
c44302.m21070(readInt);
c44302.write(bArr5);
if (z) {
m21016(c4435, c44302, f16568, null);
while (true) {
byte[] bArr6 = new byte[4];
inputStream.read(bArr6);
if (!Arrays.equals(bArr6, f16642)) {
break;
} else {
m21022(c4435, c44302, bArr6);
}
}
m21004(c44302);
} else {
m21016(c4435, c44302, f16970, f16557);
m21004(c44302);
}
} else {
byte[] bArr7 = f16970;
if (Arrays.equals(bArr3, bArr7) || Arrays.equals(bArr3, f16557)) {
int readInt2 = c4435.readInt();
int i6 = readInt2 % 2 == 1 ? readInt2 + 1 : readInt2;
byte[] bArr8 = new byte[3];
if (Arrays.equals(bArr3, bArr7)) {
c4435.read(bArr8);
byte[] bArr9 = new byte[3];
if (c4435.read(bArr9) != 3 || !Arrays.equals(f16951, bArr9)) {
throw new IOException("Encountered error while checking VP8 signature");
}
i = c4435.readInt();
i2 = (i << 18) >> 18;
i3 = (i << 2) >> 18;
i6 -= 10;
} else if (!Arrays.equals(bArr3, f16557)) {
i = 0;
i2 = 0;
i3 = 0;
} else {
if (c4435.readByte() != 47) {
throw new IOException("Encountered error while checking VP8L signature");
}
i = c4435.readInt();
i4 = i & 8;
i6 -= 5;
i3 = ((i << 4) >> 18) + 1;
i2 = ((i << 18) >> 18) + 1;
c44302.write(bArr4);
c44302.m21070(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);
c44302.write(bArr10);
c44302.write(bArr3);
c44302.m21070(readInt2);
if (!Arrays.equals(bArr3, bArr7)) {
c44302.write(bArr8);
c44302.write(f16951);
c44302.m21070(i);
} else if (Arrays.equals(bArr3, f16557)) {
c44302.write(47);
c44302.m21070(i);
}
C4438.m21104(c4435, c44302, i6);
m21004(c44302);
}
i4 = 0;
c44302.write(bArr4);
c44302.m21070(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);
c44302.write(bArr102);
c44302.write(bArr3);
c44302.m21070(readInt2);
if (!Arrays.equals(bArr3, bArr7)) {
}
C4438.m21104(c4435, c44302, i6);
m21004(c44302);
}
}
}
C4438.m21108(c4435, c44302);
int size = byteArrayOutputStream.size();
byte[] bArr11 = f16640;
c4430.m21070(size + bArr11.length);
c4430.write(bArr11);
byteArrayOutputStream.writeTo(c4430);
C4438.m21102(byteArrayOutputStream);
} catch (Exception e2) {
e = e2;
byteArrayOutputStream2 = byteArrayOutputStream;
throw new IOException("Failed to save WebP file", e);
} catch (Throwable th2) {
th = th2;
byteArrayOutputStream2 = byteArrayOutputStream;
C4438.m21102(byteArrayOutputStream2);
throw th;
}
}
private void m21014(C4437 c4437, int i) throws IOException {
C4433 c4433 = this.f17003[i].get(f16656);
C4433 c44332 = this.f17003[i].get(f16721);
if (c4433 == null || c44332 == null) {
C4433 c44333 = this.f17003[i].get(f16814);
C4433 c44334 = this.f17003[i].get(f16924);
if (c44333 == null || c44334 == null) {
return;
}
int m21092 = c44333.m21092(this.f16999);
int m210922 = c44333.m21092(this.f16999);
c4437.m21100(m21092);
byte[] bArr = new byte[m210922];
c4437.read(bArr);
m21011(new C4435(bArr), m21092, i);
}
}
private boolean m21015(HashMap hashMap) throws IOException {
C4433 c4433;
C4433 c44332 = (C4433) hashMap.get(f16963);
if (c44332 == null) {
return false;
}
int[] iArr = (int[]) c44332.m21093(this.f16999);
int[] iArr2 = f16800;
if (Arrays.equals(iArr2, iArr)) {
return true;
}
if (this.f17011 != 3 || (c4433 = (C4433) hashMap.get(f16885)) == null) {
return false;
}
int m21092 = c4433.m21092(this.f16999);
return (m21092 == 1 && Arrays.equals(iArr, f16581)) || (m21092 == 6 && Arrays.equals(iArr, iArr2));
}
private void m21016(C4435 c4435, C4430 c4430, byte[] bArr, byte[] bArr2) throws IOException {
String str;
while (true) {
byte[] bArr3 = new byte[4];
if (c4435.read(bArr3) != 4) {
StringBuilder sb = new StringBuilder();
sb.append("Encountered invalid length while copying WebP chunks up tochunk type ");
Charset charset = f16667;
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());
}
m21022(c4435, c4430, bArr3);
if (Arrays.equals(bArr3, bArr)) {
return;
}
if (bArr2 != null && Arrays.equals(bArr3, bArr2)) {
return;
}
}
}
private void m21017() {
for (int i = 0; i < this.f17003.length; i++) {
String str = "The size of tag group[" + i + "]: " + this.f17003[i].size();
for (Map.Entry<String, C4433> entry : this.f17003[i].entrySet()) {
C4433 value = entry.getValue();
String str2 = "tagName: " + entry.getKey() + ", tagType: " + value.toString() + ", tagValue: '" + value.m21095(this.f16999) + "'";
}
}
}
private void m21018(int i, String str, String str2) {
if (this.f17003[i].isEmpty() || this.f17003[i].get(str) == null) {
return;
}
HashMap[] hashMapArr = this.f17003;
hashMapArr[i].put(str2, hashMapArr[i].get(str));
this.f17003[i].remove(str);
}
private String m21019(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";
}
public static boolean m21020(@InterfaceC4399 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 ByteOrder m21021(C4435 c4435) throws IOException {
short readShort = c4435.readShort();
if (readShort == 18761) {
boolean z = f16617;
return ByteOrder.LITTLE_ENDIAN;
}
if (readShort == 19789) {
boolean z2 = f16617;
return ByteOrder.BIG_ENDIAN;
}
throw new IOException("Invalid byte order: " + Integer.toHexString(readShort));
}
private void m21022(C4435 c4435, C4430 c4430, byte[] bArr) throws IOException {
int readInt = c4435.readInt();
c4430.write(bArr);
c4430.m21070(readInt);
if (readInt % 2 == 1) {
readInt++;
}
C4438.m21104(c4435, c4430, readInt);
}
private static boolean m21023(BufferedInputStream bufferedInputStream) throws IOException {
byte[] bArr = f16816;
bufferedInputStream.mark(bArr.length);
byte[] bArr2 = new byte[bArr.length];
bufferedInputStream.read(bArr2);
bufferedInputStream.reset();
int i = 0;
while (true) {
byte[] bArr3 = f16816;
if (i >= bArr3.length) {
return true;
}
if (bArr2[i] != bArr3[i]) {
return false;
}
i++;
}
}
private static boolean m21024(int i) {
return i == 4 || i == 13 || i == 14 || i == 3 || i == 0;
}
private static Long m21025(@InterfaceC4397 String str, @InterfaceC4397 String str2, @InterfaceC4397 String str3) {
if (str != null && f16996.matcher(str).matches()) {
ParsePosition parsePosition = new ParsePosition(0);
try {
Date parse = f16734.parse(str, parsePosition);
if (parse == null && (parse = f16967.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 += C4438.m21106(str2);
}
return Long.valueOf(time);
} catch (IllegalArgumentException unused) {
}
}
return null;
}
private void m21026(byte[] bArr, int i) throws IOException {
C4437 c4437 = new C4437(bArr);
m21034(c4437);
m21031(c4437, i);
}
private boolean m21027(byte[] bArr) throws IOException {
C4435 c4435 = null;
try {
C4435 c44352 = new C4435(bArr);
try {
ByteOrder m21021 = m21021(c44352);
this.f16999 = m21021;
c44352.m21096(m21021);
boolean z = c44352.readShort() == 85;
c44352.close();
return z;
} catch (Exception unused) {
c4435 = c44352;
if (c4435 != null) {
c4435.close();
}
return false;
} catch (Throwable th) {
th = th;
c4435 = c44352;
if (c4435 != null) {
c4435.close();
}
throw th;
}
} catch (Exception unused2) {
} catch (Throwable th2) {
th = th2;
}
}
private void m21028(C4435 c4435) throws IOException {
if (f16617) {
String str = "getWebpAttributes starting with: " + c4435;
}
c4435.m21096(ByteOrder.LITTLE_ENDIAN);
c4435.m21098(f16879.length);
int readInt = c4435.readInt() + 8;
byte[] bArr = f16640;
c4435.m21098(bArr.length);
int length = bArr.length + 8;
while (true) {
try {
byte[] bArr2 = new byte[4];
if (c4435.read(bArr2) != 4) {
throw new IOException("Encountered invalid length while parsing WebP chunktype");
}
int readInt2 = c4435.readInt();
int i = length + 4 + 4;
if (Arrays.equals(f16584, bArr2)) {
byte[] bArr3 = new byte[readInt2];
if (c4435.read(bArr3) == readInt2) {
this.f17006 = i;
m21026(bArr3, 0);
m21035(new C4435(bArr3));
return;
} else {
throw new IOException("Failed to read given length for given PNG chunk type: " + C4438.m21103(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");
}
c4435.m21098(readInt2);
} catch (EOFException unused) {
throw new IOException("Encountered corrupt WebP file.");
}
}
}
@InterfaceC4397
private C4433 m21029(@InterfaceC4399 String str) {
Objects.requireNonNull(str, "tag shouldn't be null");
if (f16881.equals(str)) {
boolean z = f16617;
str = f16981;
}
for (int i = 0; i < f16993.length; i++) {
C4433 c4433 = this.f17003[i].get(str);
if (c4433 != null) {
return c4433;
}
}
return null;
}
private void m21030(String str) throws IOException {
Objects.requireNonNull(str, "filename cannot be null");
FileInputStream fileInputStream = null;
this.f17001 = null;
this.f17002 = str;
try {
FileInputStream fileInputStream2 = new FileInputStream(str);
try {
if (m20994(fileInputStream2.getFD())) {
this.f17013 = fileInputStream2.getFD();
} else {
this.f17013 = null;
}
m21005(fileInputStream2);
C4438.m21102(fileInputStream2);
} catch (Throwable th) {
th = th;
fileInputStream = fileInputStream2;
C4438.m21102(fileInputStream);
throw th;
}
} catch (Throwable th2) {
th = th2;
}
}
private void m21031(C4437 c4437, int i) throws IOException {
C4432 c4432;
int i2;
long j;
boolean z;
short s;
long j2;
C4432 c44322;
short s2;
int readUnsignedShort;
int i3 = i;
this.f17012.add(Integer.valueOf(c4437.f17037));
short readShort = c4437.readShort();
if (f16617) {
String str = "numberOfDirectoryEntry: " + ((int) readShort);
}
if (readShort <= 0) {
return;
}
char c = 0;
short s3 = 0;
while (s3 < readShort) {
int readUnsignedShort2 = c4437.readUnsignedShort();
int readUnsignedShort3 = c4437.readUnsignedShort();
int readInt = c4437.readInt();
long m21097 = c4437.m21097() + 4;
C4432 c44323 = f16818[i3].get(Integer.valueOf(readUnsignedShort2));
boolean z2 = f16617;
if (z2) {
Object[] objArr = new Object[5];
objArr[c] = Integer.valueOf(i);
objArr[1] = Integer.valueOf(readUnsignedShort2);
objArr[2] = c44323 != null ? c44323.f17029 : 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 (c44323 != null) {
if (readUnsignedShort3 > 0) {
if (readUnsignedShort3 < f16748.length) {
if (c44323.m21076(readUnsignedShort3)) {
if (readUnsignedShort3 == 7) {
readUnsignedShort3 = c44323.f17026;
}
i2 = readUnsignedShort2;
c4432 = c44323;
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 = c4437.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.f17011 == 7) {
c44322 = c4432;
s2 = s3;
if (f16915.equals(c44322.f17029)) {
this.f17017 = readInt2;
} else if (i3 == 6 && f16676.equals(c44322.f17029)) {
this.f17007 = readInt2;
this.f17010 = readInt;
C4433 m21090 = C4433.m21090(6, this.f16999);
j2 = m21097;
C4433 m21089 = C4433.m21089(this.f17007, this.f16999);
C4433 m210892 = C4433.m21089(this.f17010, this.f16999);
this.f17003[4].put(f16678, m21090);
this.f17003[4].put(f16814, m21089);
this.f17003[4].put(f16924, m210892);
}
j2 = m21097;
} else {
j2 = m21097;
c44322 = c4432;
s2 = s3;
}
c4437.m21100(readInt2);
} else {
s = readShort;
j2 = m21097;
c44322 = c4432;
s2 = s3;
}
Integer num = f16796.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 = c4437.m21099();
} else if (readUnsignedShort3 == 8) {
readUnsignedShort = c4437.readShort();
} else if (readUnsignedShort3 == 9 || readUnsignedShort3 == 13) {
readUnsignedShort = c4437.readInt();
}
if (z2) {
String.format("Offset: %d, tagName: %s", Long.valueOf(j3), c44322.f17029);
}
if (j3 <= 0) {
if (!this.f17012.contains(Integer.valueOf((int) j3))) {
c4437.m21100(j3);
m21031(c4437, num.intValue());
} else if (z2) {
String str4 = "Skip jump into the IFD since it has already been read: IfdType " + num + " (at " + j3 + C2486.C2488.f7757;
}
} else if (z2) {
String str5 = "Skip jump into the IFD since its offset is invalid: " + j3;
}
c4437.m21100(j2);
} else {
readUnsignedShort = c4437.readUnsignedShort();
}
j3 = readUnsignedShort;
if (z2) {
}
if (j3 <= 0) {
}
c4437.m21100(j2);
} else {
long j4 = j2;
int m210972 = c4437.m21097() + this.f17006;
byte[] bArr = new byte[(int) j];
c4437.readFully(bArr);
C4433 c4433 = new C4433(readUnsignedShort3, readInt, m210972, bArr);
this.f17003[i].put(c44322.f17029, c4433);
if (f16867.equals(c44322.f17029)) {
this.f17011 = 3;
}
if (((f16917.equals(c44322.f17029) || f16622.equals(c44322.f17029)) && c4433.m21095(this.f16999).contains(f16695)) || (f16678.equals(c44322.f17029) && c4433.m21092(this.f16999) == 65535)) {
this.f17011 = 8;
}
if (c4437.m21097() != j4) {
c4437.m21100(j4);
}
}
} else {
c4437.m21100(m21097);
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 (" + f16887[readUnsignedShort3] + ") is unexpected for tag: " + c44323.f17029;
}
}
}
c4432 = c44323;
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;
}
c4432 = c44323;
i2 = readUnsignedShort2;
z = false;
j = 0;
if (z) {
}
s3 = (short) (s2 + 1);
i3 = i;
readShort = s;
c = 0;
}
int readInt3 = c4437.readInt();
boolean z3 = f16617;
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.f17012.contains(Integer.valueOf(readInt3))) {
if (z3) {
String str10 = "Stop reading file since re-reading an IFD may cause an infinite loop: " + readInt3;
return;
}
return;
}
c4437.m21100(j5);
if (this.f17003[4].isEmpty()) {
m21031(c4437, 4);
} else if (this.f17003[5].isEmpty()) {
m21031(c4437, 5);
}
}
private void m21032(C4435 c4435) throws IOException {
boolean z = f16617;
if (z) {
String str = "getRafAttributes starting with: " + c4435;
}
c4435.m21098(84);
byte[] bArr = new byte[4];
byte[] bArr2 = new byte[4];
byte[] bArr3 = new byte[4];
c4435.read(bArr);
c4435.read(bArr2);
c4435.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];
c4435.m21098(i - c4435.m21097());
c4435.read(bArr4);
m21011(new C4435(bArr4), i, 5);
c4435.m21098(i3 - c4435.m21097());
c4435.m21096(ByteOrder.BIG_ENDIAN);
int readInt = c4435.readInt();
if (z) {
String str2 = "numberOfDirectoryEntry: " + readInt;
}
for (int i4 = 0; i4 < readInt; i4++) {
int readUnsignedShort = c4435.readUnsignedShort();
int readUnsignedShort2 = c4435.readUnsignedShort();
if (readUnsignedShort == f16576.f17027) {
short readShort = c4435.readShort();
short readShort2 = c4435.readShort();
C4433 m21090 = C4433.m21090(readShort, this.f16999);
C4433 m210902 = C4433.m21090(readShort2, this.f16999);
this.f17003[0].put(f16656, m21090);
this.f17003[0].put(f16721, m210902);
if (f16617) {
String str3 = "Updated to length: " + ((int) readShort) + ", width: " + ((int) readShort2);
return;
}
return;
}
c4435.m21098(readUnsignedShort2);
}
}
private void m21033(String str) {
for (int i = 0; i < f16993.length; i++) {
this.f17003[i].remove(str);
}
}
private void m21034(C4435 c4435) throws IOException {
ByteOrder m21021 = m21021(c4435);
this.f16999 = m21021;
c4435.m21096(m21021);
int readUnsignedShort = c4435.readUnsignedShort();
int i = this.f17011;
if (i != 7 && i != 10 && readUnsignedShort != 42) {
throw new IOException("Invalid start code: " + Integer.toHexString(readUnsignedShort));
}
int readInt = c4435.readInt();
if (readInt < 8) {
throw new IOException("Invalid first Ifd offset: " + readInt);
}
int i2 = readInt - 8;
if (i2 > 0) {
c4435.m21098(i2);
}
}
private void m21035(C4435 c4435) throws IOException {
HashMap<String, C4433> hashMap = this.f17003[4];
C4433 c4433 = hashMap.get(f16678);
if (c4433 == null) {
this.f17000 = 6;
m21009(c4435, hashMap);
return;
}
int m21092 = c4433.m21092(this.f16999);
this.f17000 = m21092;
if (m21092 != 1) {
if (m21092 == 6) {
m21009(c4435, hashMap);
return;
} else if (m21092 != 7) {
return;
}
}
if (m21015(hashMap)) {
m20991(c4435, hashMap);
}
}
private void m21036(InputStream inputStream, OutputStream outputStream) throws IOException {
if (f16617) {
String str = "saveJpegAttributes starting with (inputStream: " + inputStream + ", outputStream: " + outputStream + C2486.C2488.f7757;
}
C4435 c4435 = new C4435(inputStream);
C4430 c4430 = new C4430(outputStream, ByteOrder.BIG_ENDIAN);
if (c4435.readByte() != -1) {
throw new IOException("Invalid marker");
}
c4430.m21074(-1);
if (c4435.readByte() != -40) {
throw new IOException("Invalid marker");
}
c4430.m21074(-40);
C4433 c4433 = null;
if (m21063(f16572) != null && this.f17005) {
c4433 = this.f17003[0].remove(f16572);
}
c4430.m21074(-1);
c4430.m21074(-31);
m21004(c4430);
if (c4433 != null) {
this.f17003[0].put(f16572, c4433);
}
byte[] bArr = new byte[4096];
while (c4435.readByte() == -1) {
byte readByte = c4435.readByte();
if (readByte == -39 || readByte == -38) {
c4430.m21074(-1);
c4430.m21074(readByte);
C4438.m21108(c4435, c4430);
return;
}
if (readByte != -31) {
c4430.m21074(-1);
c4430.m21074(readByte);
int readUnsignedShort = c4435.readUnsignedShort();
c4430.m21072(readUnsignedShort);
int i = readUnsignedShort - 2;
if (i < 0) {
throw new IOException("Invalid length");
}
while (i > 0) {
int read = c4435.read(bArr, 0, Math.min(i, 4096));
if (read >= 0) {
c4430.write(bArr, 0, read);
i -= read;
}
}
} else {
int readUnsignedShort2 = c4435.readUnsignedShort() - 2;
if (readUnsignedShort2 < 0) {
throw new IOException("Invalid length");
}
byte[] bArr2 = new byte[6];
if (readUnsignedShort2 >= 6) {
if (c4435.read(bArr2) != 6) {
throw new IOException("Invalid exif");
}
if (Arrays.equals(bArr2, f16816)) {
c4435.m21098(readUnsignedShort2 - 6);
}
}
c4430.m21074(-1);
c4430.m21074(readByte);
c4430.m21072(readUnsignedShort2 + 2);
if (readUnsignedShort2 >= 6) {
readUnsignedShort2 -= 6;
c4430.write(bArr2);
}
while (readUnsignedShort2 > 0) {
int read2 = c4435.read(bArr, 0, Math.min(readUnsignedShort2, 4096));
if (read2 >= 0) {
c4430.write(bArr, 0, read2);
readUnsignedShort2 -= read2;
}
}
}
}
throw new IOException("Invalid marker");
}
private void m21037(C4437 c4437, int i) throws IOException {
C4433 m21090;
C4433 m210902;
C4433 c4433 = this.f17003[i].get(f16593);
C4433 c44332 = this.f17003[i].get(f16944);
C4433 c44333 = this.f17003[i].get(f16961);
C4433 c44334 = this.f17003[i].get(f16694);
C4433 c44335 = this.f17003[i].get(f16753);
if (c4433 == null) {
if (c44332 == null || c44333 == null || c44334 == null || c44335 == null) {
m21014(c4437, i);
return;
}
int m21092 = c44332.m21092(this.f16999);
int m210922 = c44334.m21092(this.f16999);
int m210923 = c44335.m21092(this.f16999);
int m210924 = c44333.m21092(this.f16999);
if (m210922 <= m21092 || m210923 <= m210924) {
return;
}
C4433 m210903 = C4433.m21090(m210922 - m21092, this.f16999);
C4433 m210904 = C4433.m21090(m210923 - m210924, this.f16999);
this.f17003[i].put(f16656, m210903);
this.f17003[i].put(f16721, m210904);
return;
}
if (c4433.f17032 == 5) {
C4429[] c4429Arr = (C4429[]) c4433.m21093(this.f16999);
if (c4429Arr == null || c4429Arr.length != 2) {
String str = "Invalid crop size values. cropSize=" + Arrays.toString(c4429Arr);
return;
}
m21090 = C4433.m21083(c4429Arr[0], this.f16999);
m210902 = C4433.m21083(c4429Arr[1], this.f16999);
} else {
int[] iArr = (int[]) c4433.m21093(this.f16999);
if (iArr == null || iArr.length != 2) {
String str2 = "Invalid crop size values. cropSize=" + Arrays.toString(iArr);
return;
}
m21090 = C4433.m21090(iArr[0], this.f16999);
m210902 = C4433.m21090(iArr[1], this.f16999);
}
this.f17003[i].put(f16721, m21090);
this.f17003[i].put(f16656, m210902);
}
public void m21038(Location location) {
if (location == null) {
return;
}
m21052(f16704, location.getProvider());
m21061(location.getLatitude(), location.getLongitude());
m21044(location.getAltitude());
m21052(f16673, "K");
m21052(f16831, new C4429((location.getSpeed() * TimeUnit.HOURS.toSeconds(1L)) / 1000.0f).toString());
String[] split = f16734.format(new Date(location.getTime())).split(C7366.f27648, -1);
m21052(f16828, split[0]);
m21052(f16769, split[1]);
}
@InterfaceC4397
public byte[] m21039(@InterfaceC4399 String str) {
Objects.requireNonNull(str, "tag shouldn't be null");
C4433 m21029 = m21029(str);
if (m21029 != null) {
return m21029.f17033;
}
return null;
}
@InterfaceC4397
public double[] m21040() {
String m21063 = m21063(f16675);
String m210632 = m21063(f16659);
String m210633 = m21063(f16945);
String m210634 = m21063(f16896);
if (m21063 == null || m210632 == null || m210633 == null || m210634 == null) {
return null;
}
try {
return new double[]{m20995(m21063, m210632), m20995(m210633, m210634)};
} catch (IllegalArgumentException unused) {
String str = "Latitude/longitude values are not parsable. " + String.format("latValue=%s, latRef=%s, lngValue=%s, lngRef=%s", m21063, m210632, m210633, m210634);
return null;
}
}
public double m21041(double d) {
double m21055 = m21055(f16710, -1.0d);
int m21060 = m21060(f16849, -1);
if (m21055 < ShadowDrawableWrapper.COS_45 || m21060 < 0) {
return d;
}
double d2 = m21060 != 1 ? 1 : -1;
Double.isNaN(d2);
return m21055 * d2;
}
public void m21042() 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 (!m21024(this.f17011)) {
throw new IOException("ExifInterface only supports saving attributes for JPEG, PNG, WebP, and DNG formats.");
}
if (this.f17013 == null && this.f17002 == null) {
throw new IOException("ExifInterface does not support saving attributes for the current input.");
}
if (this.f17016 && this.f16998 && !this.f17008) {
throw new IOException("ExifInterface does not support saving attributes when the image file has non-consecutive thumbnail strips");
}
this.f17009 = true;
this.f17004 = m21043();
InputStream inputStream2 = null;
try {
File createTempFile = File.createTempFile("temp", "tmp");
if (this.f17002 != null) {
fileInputStream = new FileInputStream(this.f17002);
} else if (Build.VERSION.SDK_INT >= 21) {
C4438.C4439.m21109(this.f17013, 0L, OsConstants.SEEK_SET);
fileInputStream = new FileInputStream(this.f17013);
} else {
fileInputStream = null;
}
try {
fileOutputStream = new FileOutputStream(createTempFile);
try {
C4438.m21108(fileInputStream, fileOutputStream);
C4438.m21102(fileInputStream);
C4438.m21102(fileOutputStream);
try {
try {
try {
fileInputStream2 = new FileInputStream(createTempFile);
try {
if (this.f17002 != null) {
fileOutputStream3 = new FileOutputStream(this.f17002);
} else if (Build.VERSION.SDK_INT >= 21) {
C4438.C4439.m21109(this.f17013, 0L, OsConstants.SEEK_SET);
fileOutputStream3 = new FileOutputStream(this.f17013);
} 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.f17002 != null) {
if (Build.VERSION.SDK_INT >= 21) {
C4438.C4439.m21109(this.f17013, 0L, OsConstants.SEEK_SET);
fileOutputStream4 = new FileOutputStream(this.f17013);
}
C4438.m21108(inputStream, fileOutputStream3);
C4438.m21102(inputStream);
C4438.m21102(fileOutputStream3);
throw new IOException("Failed to save new file", exc);
}
fileOutputStream4 = new FileOutputStream(this.f17002);
fileOutputStream3 = fileOutputStream4;
C4438.m21108(inputStream, fileOutputStream3);
C4438.m21102(inputStream);
C4438.m21102(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;
C4438.m21102(inputStream2);
C4438.m21102(fileOutputStream3);
throw th;
}
} catch (Throwable th3) {
th = th3;
inputStream2 = inputStream;
C4438.m21102(inputStream2);
C4438.m21102(fileOutputStream3);
throw th;
}
}
} catch (Exception e6) {
e = e6;
fileOutputStream2 = null;
}
} catch (Throwable th4) {
th = th4;
closeable = null;
C4438.m21102(inputStream2);
C4438.m21102(closeable);
if (0 == 0) {
createTempFile.delete();
}
throw th;
}
} catch (Throwable th5) {
th = th5;
}
try {
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream3);
try {
int i = this.f17011;
if (i == 4) {
m21036(bufferedInputStream, bufferedOutputStream);
} else if (i == 13) {
m20999(bufferedInputStream, bufferedOutputStream);
} else if (i == 14) {
m21013(bufferedInputStream, bufferedOutputStream);
} else if (i == 3 || i == 0) {
m21004(new C4430(bufferedOutputStream, ByteOrder.BIG_ENDIAN));
}
C4438.m21102(bufferedInputStream);
C4438.m21102(bufferedOutputStream);
createTempFile.delete();
this.f17004 = null;
} catch (Exception e7) {
exc = e7;
inputStream2 = fileInputStream2;
inputStream = new FileInputStream(createTempFile);
if (this.f17002 != null) {
}
fileOutputStream3 = fileOutputStream4;
C4438.m21108(inputStream, fileOutputStream3);
C4438.m21102(inputStream);
C4438.m21102(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;
C4438.m21102(inputStream2);
C4438.m21102(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;
C4438.m21102(inputStream2);
C4438.m21102(fileOutputStream);
throw th;
}
} catch (Throwable th8) {
th = th8;
inputStream2 = fileInputStream;
C4438.m21102(inputStream2);
C4438.m21102(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;
}
}
@InterfaceC4397
public byte[] m21043() {
int i = this.f17000;
if (i == 6 || i == 7) {
return m21054();
}
return null;
}
public void m21044(double d) {
String str = d >= ShadowDrawableWrapper.COS_45 ? PushConstants.PUSH_TYPE_NOTIFY : "1";
m21052(f16710, new C4429(Math.abs(d)).toString());
m21052(f16849, str);
}
@InterfaceC4397
@InterfaceC4379({InterfaceC4379.EnumC4380.LIBRARY})
public Long m21045() {
return m21025(m21063(f16858), m21063(f16793), m21063(f16599));
}
public void m21046() {
int i = 1;
switch (m21060(f16730, 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;
}
m21052(f16730, Integer.toString(i));
}
@InterfaceC4379({InterfaceC4379.EnumC4380.LIBRARY})
public void m21047(@InterfaceC4399 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;
}
m21052(f16578, f16734.format(new Date(l.longValue())));
m21052(f16984, l2);
}
@InterfaceC4397
@InterfaceC4379({InterfaceC4379.EnumC4380.LIBRARY})
public Long m21048() {
return m21025(m21063(f16578), m21063(f16984), m21063(f16804));
}
public boolean m21049(@InterfaceC4399 String str) {
return m21029(str) != null;
}
@Deprecated
public boolean m21050(float[] fArr) {
double[] m21040 = m21040();
if (m21040 == null) {
return false;
}
fArr[0] = (float) m21040[0];
fArr[1] = (float) m21040[1];
return true;
}
@InterfaceC4397
@InterfaceC4379({InterfaceC4379.EnumC4380.LIBRARY})
public Long m21051() {
return m21025(m21063(f16838), m21063(f16652), m21063(f16901));
}
public void m21052(@InterfaceC4399 String str, @InterfaceC4397 String str2) {
C4432 c4432;
int i;
String str3 = str;
String str4 = str2;
Objects.requireNonNull(str3, "tag shouldn't be null");
if ((f16578.equals(str3) || f16838.equals(str3) || f16858.equals(str3)) && str4 != null) {
boolean find = f16895.matcher(str4).find();
boolean find2 = f16935.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 (f16881.equals(str3)) {
str3 = f16981;
}
int i2 = 2;
int i3 = 1;
if (str4 != null && f16618.contains(str3)) {
if (str3.equals(f16769)) {
Matcher matcher = f16899.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 C4429(Double.parseDouble(str4)).toString();
} catch (NumberFormatException unused) {
String str7 = "Invalid value for " + str3 + " : " + str4;
return;
}
}
}
char c = 0;
int i4 = 0;
while (i4 < f16993.length) {
if ((i4 != 4 || this.f17016) && (c4432 = f16842[i4].get(str3)) != null) {
if (str4 != null) {
Pair<Integer, Integer> m21010 = m21010(str4);
if (c4432.f17026 == ((Integer) m21010.first).intValue() || c4432.f17026 == ((Integer) m21010.second).intValue()) {
i = c4432.f17026;
} else {
int i5 = c4432.f17028;
if (i5 == -1 || !(i5 == ((Integer) m21010.first).intValue() || c4432.f17028 == ((Integer) m21010.second).intValue())) {
int i6 = c4432.f17026;
if (i6 == i3 || i6 == 7 || i6 == i2) {
i = i6;
} else if (f16617) {
StringBuilder sb = new StringBuilder();
sb.append("Given tag (");
sb.append(str3);
sb.append(") value didn't match with one of expected formats: ");
String[] strArr = f16887;
sb.append(strArr[c4432.f17026]);
sb.append(c4432.f17028 == -1 ? "" : ", " + strArr[c4432.f17028]);
sb.append(" (guess: ");
sb.append(strArr[((Integer) m21010.first).intValue()]);
sb.append(((Integer) m21010.second).intValue() != -1 ? ", " + strArr[((Integer) m21010.second).intValue()] : "");
sb.append(C2486.C2488.f7757);
sb.toString();
}
} else {
i = c4432.f17028;
}
}
switch (i) {
case 1:
this.f17003[i4].put(str3, C4433.m21080(str4));
continue;
case 2:
case 7:
this.f17003[i4].put(str3, C4433.m21078(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.f17003[i4].put(str3, C4433.m21082(iArr, this.f16999));
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.f17003[i4].put(str3, C4433.m21077(jArr, this.f16999));
continue;
case 5:
String[] split3 = str4.split(",", -1);
C4429[] c4429Arr = new C4429[split3.length];
int i9 = 0;
while (i9 < split3.length) {
String[] split4 = split3[i9].split("/", -1);
c4429Arr[i9] = new C4429((long) Double.parseDouble(split4[c]), (long) Double.parseDouble(split4[1]));
i9++;
c = 0;
}
this.f17003[i4].put(str3, C4433.m21087(c4429Arr, this.f16999));
continue;
case 6:
case 8:
case 11:
default:
if (f16617) {
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.f17003[i4].put(str3, C4433.m21088(iArr2, this.f16999));
break;
case 10:
String[] split6 = str4.split(",", -1);
C4429[] c4429Arr2 = new C4429[split6.length];
int i11 = 0;
while (i11 < split6.length) {
String[] split7 = split6[i11].split("/", -1);
c4429Arr2[i11] = new C4429((long) Double.parseDouble(split7[c]), (long) Double.parseDouble(split7[i3]));
i11++;
split6 = split6;
i3 = 1;
}
this.f17003[i4].put(str3, C4433.m21085(c4429Arr2, this.f16999));
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.f17003[i4].put(str3, C4433.m21079(dArr, this.f16999));
break;
}
} else {
this.f17003[i4].remove(str3);
}
}
i4++;
i2 = 2;
c = 0;
i3 = 1;
}
}
@InterfaceC4397
@SuppressLint({"AutoBoxing"})
public Long m21053() {
String m21063 = m21063(f16828);
String m210632 = m21063(f16769);
if (m21063 != null && m210632 != null) {
Pattern pattern = f16996;
if (pattern.matcher(m21063).matches() || pattern.matcher(m210632).matches()) {
String str = m21063 + ' ' + m210632;
ParsePosition parsePosition = new ParsePosition(0);
try {
Date parse = f16734.parse(str, parsePosition);
if (parse == null && (parse = f16967.parse(str, parsePosition)) == null) {
return null;
}
return Long.valueOf(parse.getTime());
} catch (IllegalArgumentException unused) {
}
}
}
return null;
}
@InterfaceC4397
public byte[] m21054() {
Throwable th;
FileDescriptor fileDescriptor;
InputStream inputStream;
Throwable th2;
InputStream inputStream2 = null;
if (!this.f17016) {
return null;
}
byte[] bArr = this.f17004;
if (bArr != null) {
return bArr;
}
try {
inputStream = this.f17001;
try {
if (inputStream != null) {
try {
if (!inputStream.markSupported()) {
C4438.m21102(inputStream);
return null;
}
inputStream.reset();
} catch (Exception unused) {
fileDescriptor = null;
C4438.m21102(inputStream);
if (fileDescriptor != null) {
}
return null;
} catch (Throwable th3) {
inputStream2 = inputStream;
th = th3;
fileDescriptor = null;
C4438.m21102(inputStream2);
if (fileDescriptor == null) {
}
}
} else {
if (this.f17002 == null) {
if (Build.VERSION.SDK_INT >= 21) {
FileDescriptor m21111 = C4438.C4439.m21111(this.f17013);
try {
C4438.C4439.m21109(m21111, 0L, OsConstants.SEEK_SET);
fileDescriptor = m21111;
inputStream = new FileInputStream(m21111);
} catch (Exception unused2) {
fileDescriptor = m21111;
inputStream = null;
C4438.m21102(inputStream);
if (fileDescriptor != null) {
C4438.m21107(fileDescriptor);
}
return null;
} catch (Throwable th4) {
th2 = th4;
fileDescriptor = m21111;
th = th2;
C4438.m21102(inputStream2);
if (fileDescriptor == null) {
throw th;
}
C4438.m21107(fileDescriptor);
throw th;
}
} else {
inputStream = null;
fileDescriptor = null;
}
if (inputStream != null) {
throw new FileNotFoundException();
}
if (inputStream.skip(this.f17014 + this.f17006) != this.f17014 + this.f17006) {
throw new IOException("Corrupted image");
}
byte[] bArr2 = new byte[this.f17018];
if (inputStream.read(bArr2) != this.f17018) {
throw new IOException("Corrupted image");
}
this.f17004 = bArr2;
C4438.m21102(inputStream);
if (fileDescriptor != null) {
C4438.m21107(fileDescriptor);
}
return bArr2;
}
inputStream = new FileInputStream(this.f17002);
}
if (inputStream != null) {
}
} catch (Exception unused3) {
C4438.m21102(inputStream);
if (fileDescriptor != null) {
}
return null;
} catch (Throwable th5) {
th2 = th5;
inputStream2 = inputStream;
th = th2;
C4438.m21102(inputStream2);
if (fileDescriptor == null) {
}
}
fileDescriptor = null;
} catch (Exception unused4) {
inputStream = null;
fileDescriptor = null;
} catch (Throwable th6) {
th = th6;
fileDescriptor = null;
}
}
public double m21055(@InterfaceC4399 String str, double d) {
Objects.requireNonNull(str, "tag shouldn't be null");
C4433 m21029 = m21029(str);
if (m21029 == null) {
return d;
}
try {
return m21029.m21091(this.f16999);
} catch (NumberFormatException unused) {
return d;
}
}
@InterfaceC4397
public long[] m21056() {
if (this.f17009) {
throw new IllegalStateException("The underlying file has been modified since being parsed");
}
if (!this.f17016) {
return null;
}
if (!this.f16998 || this.f17008) {
return new long[]{this.f17014 + this.f17006, this.f17018};
}
return null;
}
public boolean m21057() {
return this.f17016;
}
public void m21058() {
int i = 1;
switch (m21060(f16730, 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;
}
m21052(f16730, Integer.toString(i));
}
public void m21059() {
m21052(f16730, Integer.toString(1));
}
public int m21060(@InterfaceC4399 String str, int i) {
Objects.requireNonNull(str, "tag shouldn't be null");
C4433 m21029 = m21029(str);
if (m21029 == null) {
return i;
}
try {
return m21029.m21092(this.f16999);
} catch (NumberFormatException unused) {
return i;
}
}
public void m21061(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.");
}
m21052(f16659, d >= ShadowDrawableWrapper.COS_45 ? "N" : f16780);
m21052(f16675, m21019(Math.abs(d)));
m21052(f16896, d2 >= ShadowDrawableWrapper.COS_45 ? f16763 : f16762);
m21052(f16945, m21019(Math.abs(d2)));
}
public int m21062() {
switch (m21060(f16730, 1)) {
case 3:
case 4:
return 180;
case 5:
case 8:
return SubsamplingScaleImageView.ORIENTATION_270;
case 6:
case 7:
return 90;
default:
return 0;
}
}
@InterfaceC4397
public String m21063(@InterfaceC4399 String str) {
Objects.requireNonNull(str, "tag shouldn't be null");
C4433 m21029 = m21029(str);
if (m21029 != null) {
if (!f16618.contains(str)) {
return m21029.m21095(this.f16999);
}
if (str.equals(f16769)) {
int i = m21029.f17032;
if (i != 5 && i != 10) {
String str2 = "GPS Timestamp format is not rational. format=" + m21029.f17032;
return null;
}
C4429[] c4429Arr = (C4429[]) m21029.m21093(this.f16999);
if (c4429Arr != null && c4429Arr.length == 3) {
return String.format("%02d:%02d:%02d", Integer.valueOf((int) (c4429Arr[0].f17019 / c4429Arr[0].f17020)), Integer.valueOf((int) (c4429Arr[1].f17019 / c4429Arr[1].f17020)), Integer.valueOf((int) (c4429Arr[2].f17019 / c4429Arr[2].f17020)));
}
String str3 = "Invalid GPS Timestamp array. array=" + Arrays.toString(c4429Arr);
return null;
}
try {
return Double.toString(m21029.m21091(this.f16999));
} catch (NumberFormatException unused) {
}
}
return null;
}
public void m21064(int i) {
if (i % 90 != 0) {
throw new IllegalArgumentException("degree should be a multiple of 90");
}
int m21060 = m21060(f16730, 1);
List<Integer> list = f16863;
if (list.contains(Integer.valueOf(m21060))) {
int indexOf = (list.indexOf(Integer.valueOf(m21060)) + (i / 90)) % 4;
r4 = list.get(indexOf + (indexOf < 0 ? 4 : 0)).intValue();
} else {
List<Integer> list2 = f16772;
if (list2.contains(Integer.valueOf(m21060))) {
int indexOf2 = (list2.indexOf(Integer.valueOf(m21060)) + (i / 90)) % 4;
r4 = list2.get(indexOf2 + (indexOf2 < 0 ? 4 : 0)).intValue();
}
}
m21052(f16730, Integer.toString(r4));
}
public boolean m21065() {
if (!this.f17016) {
return false;
}
int i = this.f17000;
return i == 6 || i == 7;
}
@InterfaceC4397
public Bitmap m21066() {
if (!this.f17016) {
return null;
}
if (this.f17004 == null) {
this.f17004 = m21054();
}
int i = this.f17000;
if (i == 6 || i == 7) {
return BitmapFactory.decodeByteArray(this.f17004, 0, this.f17018);
}
if (i == 1) {
int length = this.f17004.length / 3;
int[] iArr = new int[length];
for (int i2 = 0; i2 < length; i2++) {
byte[] bArr = this.f17004;
int i3 = i2 * 3;
iArr[i2] = (bArr[i3] << C1351.f6011) + 0 + (bArr[i3 + 1] << 8) + bArr[i3 + 2];
}
C4433 c4433 = this.f17003[4].get(f16731);
C4433 c44332 = this.f17003[4].get(f16889);
if (c4433 != null && c44332 != null) {
return Bitmap.createBitmap(iArr, c44332.m21092(this.f16999), c4433.m21092(this.f16999), Bitmap.Config.ARGB_8888);
}
}
return null;
}
@InterfaceC4397
public long[] m21067(@InterfaceC4399 String str) {
Objects.requireNonNull(str, "tag shouldn't be null");
if (this.f17009) {
throw new IllegalStateException("The underlying file has been modified since being parsed");
}
C4433 m21029 = m21029(str);
if (m21029 != null) {
return new long[]{m21029.f17031, m21029.f17033.length};
}
return null;
}
public boolean m21068() {
int m21060 = m21060(f16730, 1);
return m21060 == 2 || m21060 == 7 || m21060 == 4 || m21060 == 5;
}
public static class C4437 extends C4435 {
public C4437(byte[] bArr) throws IOException {
super(bArr);
this.f17039.mark(Integer.MAX_VALUE);
}
public void m21100(long j) throws IOException {
int i = this.f17037;
if (i > j) {
this.f17037 = 0;
this.f17039.reset();
} else {
j -= i;
}
m21098((int) j);
}
public C4437(InputStream inputStream) throws IOException {
super(inputStream);
if (inputStream.markSupported()) {
this.f17039.mark(Integer.MAX_VALUE);
return;
}
throw new IllegalArgumentException("Cannot create SeekableByteOrderedDataInputStream with stream that does not support mark/reset");
}
}
public static class C4432 {
public final int f17026;
public final int f17027;
public final int f17028;
public final String f17029;
public C4432(String str, int i, int i2) {
this.f17029 = str;
this.f17027 = i;
this.f17026 = i2;
this.f17028 = -1;
}
public boolean m21076(int i) {
int i2;
int i3 = this.f17026;
if (i3 == 7 || i == 7 || i3 == i || (i2 = this.f17028) == 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 C4432(String str, int i, int i2, int i3) {
this.f17029 = str;
this.f17027 = i;
this.f17026 = i2;
this.f17028 = i3;
}
}
public C4428(@InterfaceC4399 String str) throws IOException {
C4432[][] c4432Arr = f16993;
this.f17003 = new HashMap[c4432Arr.length];
this.f17012 = new HashSet(c4432Arr.length);
this.f16999 = ByteOrder.BIG_ENDIAN;
Objects.requireNonNull(str, "filename cannot be null");
m21030(str);
}
public C4428(@InterfaceC4399 FileDescriptor fileDescriptor) throws IOException {
FileInputStream fileInputStream;
Throwable th;
C4432[][] c4432Arr = f16993;
this.f17003 = new HashMap[c4432Arr.length];
this.f17012 = new HashSet(c4432Arr.length);
this.f16999 = ByteOrder.BIG_ENDIAN;
Objects.requireNonNull(fileDescriptor, "fileDescriptor cannot be null");
this.f17001 = null;
this.f17002 = null;
boolean z = false;
if (Build.VERSION.SDK_INT >= 21 && m20994(fileDescriptor)) {
this.f17013 = fileDescriptor;
try {
fileDescriptor = C4438.C4439.m21111(fileDescriptor);
z = true;
} catch (Exception e) {
throw new IOException("Failed to duplicate file descriptor", e);
}
} else {
this.f17013 = null;
}
try {
fileInputStream = new FileInputStream(fileDescriptor);
try {
m21005(fileInputStream);
C4438.m21102(fileInputStream);
if (z) {
C4438.m21107(fileDescriptor);
}
} catch (Throwable th2) {
th = th2;
C4438.m21102(fileInputStream);
if (z) {
C4438.m21107(fileDescriptor);
}
throw th;
}
} catch (Throwable th3) {
fileInputStream = null;
th = th3;
}
}
public C4428(@InterfaceC4399 InputStream inputStream) throws IOException {
this(inputStream, 0);
}
public C4428(@InterfaceC4399 InputStream inputStream, int i) throws IOException {
C4432[][] c4432Arr = f16993;
this.f17003 = new HashMap[c4432Arr.length];
this.f17012 = new HashSet(c4432Arr.length);
this.f16999 = ByteOrder.BIG_ENDIAN;
Objects.requireNonNull(inputStream, "inputStream cannot be null");
this.f17002 = null;
if (i == 1) {
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, f16816.length);
if (!m21023(bufferedInputStream)) {
return;
}
this.f17015 = true;
this.f17001 = null;
this.f17013 = null;
inputStream = bufferedInputStream;
} else if (inputStream instanceof AssetManager.AssetInputStream) {
this.f17001 = (AssetManager.AssetInputStream) inputStream;
this.f17013 = null;
} else {
if (inputStream instanceof FileInputStream) {
FileInputStream fileInputStream = (FileInputStream) inputStream;
if (m20994(fileInputStream.getFD())) {
this.f17001 = null;
this.f17013 = fileInputStream.getFD();
}
}
this.f17001 = null;
this.f17013 = null;
}
m21005(inputStream);
}
}