导航菜单

页面标题

页面副标题

ZG·三农 v1.1.5 - IndexKt.java 源代码

正在查看: ZG·三农 v1.1.5 应用的 IndexKt.java JAVA 源代码文件

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


package uts.sdk.modules.DCloudUniChooseMedia;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import androidx.core.content.FileProvider;
import io.dcloud.feature.uniapp.adapter.AbsURIAdapter;
import io.dcloud.feature.uniapp.dom.AbsEvent;
import io.dcloud.feature.weex.extend.DCWXSlider;
import io.dcloud.uts.JSON;
import io.dcloud.uts.Map;
import io.dcloud.uts.NumberKt;
import io.dcloud.uts.StringKt;
import io.dcloud.uts.UTSAndroid;
import io.dcloud.uts.UTSArray;
import io.dcloud.uts.UTSArrayKt;
import io.dcloud.uts.UTSCallback;
import io.dcloud.uts.UTSJSONObject;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.functions.Function3;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.text.StringsKt;
import kotlinx.coroutines.DebugKt;
import uts.sdk.modules.DCloudUniMedia.Media;
import uts.sdk.modules.DCloudUniMedia.SystemPickerActivity;

@Metadata(d1 = {"\u0000\u009e\u0001\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u0004\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0010\n\u0002\u0010\u0000\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\u001a\u000e\u0010+\u001a\u00020\u00142\u0006\u0010\u0013\u001a\u00020\u0010\u001a\u000e\u0010,\u001a\u00020\u00142\u0006\u0010\u0013\u001a\u00020-\u001a\u0016\u0010.\u001a\u00020/2\u0006\u00100\u001a\u00020\u00012\u0006\u00101\u001a\u00020\u0001\u001a\u0006\u00102\u001a\u00020\u0001\u001a\u0018\u00103\u001a\u0004\u0018\u0001042\u0006\u00105\u001a\u00020\u00012\u0006\u00106\u001a\u00020\u0006\u001a\u000e\u00107\u001a\u0002082\u0006\u00105\u001a\u00020\u0001\u001a\u0018\u00109\u001a\u0004\u0018\u0001042\u0006\u00105\u001a\u00020\u00012\u0006\u00106\u001a\u00020\u0006\u001a\u0016\u0010:\u001a\u00020\u00062\u000e\u0010;\u001a\n\u0012\u0004\u0012\u00020\u0001\u0018\u00010<\u001a\u0016\u0010=\u001a\u00020\u00062\u000e\u0010>\u001a\n\u0018\u00010\u0001j\u0004\u0018\u0001`?\u001a\u001a\u0010@\u001a\u0004\u0018\u00010A2\u0006\u0010B\u001a\u00020\u00012\b\u0010C\u001a\u0004\u0018\u00010\u0001\u001ak\u0010D\u001a\u00020\u00142\u0006\u0010E\u001a\u00020\u00062\u0006\u0010F\u001a\u00020/2\u0006\u0010G\u001a\u00020\u00012K\u0010H\u001aG\u0012\u0013\u0012\u00110\u0006¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(E\u0012\u0013\u0012\u00110/¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(F\u0012\u0013\u0012\u00110\u0006¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(I\u0012\u0004\u0012\u00020\u00140\u001b\u001a\u001e\u0010J\u001a\u00020\u00142\u0006\u0010K\u001a\u00020\u00102\u0006\u0010E\u001a\u00020\u00062\u0006\u0010L\u001a\u00020\u0006\u001a\u0016\u0010M\u001a\u00020\u00142\u0006\u0010K\u001a\u00020\u00102\u0006\u0010F\u001a\u00020/\u001a\u0016\u0010N\u001a\u00020\u00142\u0006\u0010K\u001a\u00020\u00102\u0006\u0010F\u001a\u00020/\u001aR\u0010O\u001a\u00020\u00142\u0006\u0010E\u001a\u00020\u00062\u0006\u0010L\u001a\u00020\u00062\u0006\u0010F\u001a\u00020/2\u000e\u0010P\u001a\n\u0012\u0004\u0012\u00020\u0001\u0018\u00010<2\b\u0010Q\u001a\u0004\u0018\u00010R2\u000e\u0010S\u001a\n\u0018\u00010\u0001j\u0004\u0018\u0001`?2\b\u0010T\u001a\u0004\u0018\u00010\u0001\u001a\u001a\u0010U\u001a\u00020/2\b\u0010V\u001a\u0004\u0018\u00010W2\b\u0010C\u001a\u0004\u0018\u00010\u0001\u001a[\u0010X\u001a\u00020\u00142\u0006\u0010\u0013\u001a\u00020\u00102K\u0010H\u001aG\u0012\u0013\u0012\u00110\u0006¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(E\u0012\u0013\u0012\u00110/¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(F\u0012\u0013\u0012\u00110\u0006¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(I\u0012\u0004\u0012\u00020\u00140\u001b\"\u0014\u0010\u0000\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u0003\"\u001d\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00010\u0005¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\b\"\u0014\u0010\t\u001a\u00020\u0006X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000b\"\u0014\u0010\f\u001a\u00020\u0001X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u0003\"0\u0010\u000e\u001a!\u0012\u0013\u0012\u00110\u0010¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u0013\u0012\u0004\u0012\u00020\u00140\u000fj\u0002`\u0015¢\u0006\b\n\u0000\u001a\u0004\b\u0016\u0010\u0017\"\u0011\u0010\u0018\u001a\u00020\u0001¢\u0006\b\n\u0000\u001a\u0004\b\u0019\u0010\u0003\"c\u0010\u001a\u001aK\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u001d\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u001e\u0012\u0015\u0012\u0013\u0018\u00010\u001f¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b( \u0012\u0004\u0012\u00020\u0014\u0018\u00010\u001bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b!\u0010\"\"\u0004\b#\u0010$\"c\u0010%\u001aK\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u001d\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u001e\u0012\u0015\u0012\u0013\u0018\u00010\u001f¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b( \u0012\u0004\u0012\u00020\u0014\u0018\u00010\u001bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b&\u0010\"\"\u0004\b'\u0010$\"c\u0010(\u001aK\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u001d\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u001e\u0012\u0015\u0012\u0013\u0018\u00010\u001f¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b( \u0012\u0004\u0012\u00020\u0014\u0018\u00010\u001bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b)\u0010\"\"\u0004\b*\u0010$*@\u0010Y\"\u001d\u0012\u0013\u0012\u00110\u0010¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u0013\u0012\u0004\u0012\u00020\u00140\u000f2\u001d\u0012\u0013\u0012\u00110\u0010¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b(\u0013\u0012\u0004\u0012\u00020\u00140\u000f*@\u0010Z\"\u001d\u0012\u0013\u0012\u00110R¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b([\u0012\u0004\u0012\u00020\u00140\u000f2\u001d\u0012\u0013\u0012\u00110R¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b([\u0012\u0004\u0012\u00020\u00140\u000f*\n\u0010\\\"\u00020\u00062\u00020\u0006*\n\u0010]\"\u00020^2\u00020^*S\u0010_\"\u001d\u0012\u0013\u0012\u0011``¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b([\u0012\u0004\u0012\u00020\u00140\u000f20\u0012&\u0012$0^j\u0011``¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b([¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b([\u0012\u0004\u0012\u00020\u00140\u000f*\n\u0010a\"\u00020\u00012\u00020\u0001*\n\u0010b\"\u00020\u00012\u00020\u0001*@\u0010c\"\u001d\u0012\u0013\u0012\u00110d¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b([\u0012\u0004\u0012\u00020\u00140\u000f2\u001d\u0012\u0013\u0012\u00110d¢\u0006\f\b\u0011\u0012\b\b\u0012\u0012\u0004\b\b([\u0012\u0004\u0012\u00020\u00140\u000f¨\u0006e"}, d2 = {"ASSETS_PATH", "", "getASSETS_PATH", "()Ljava/lang/String;", "ChooseMediaUniErrors", "Lio/dcloud/uts/Map;", "", "getChooseMediaUniErrors", "()Lio/dcloud/uts/Map;", "GALLERY_MEDIA_PICKER_RESULT", "getGALLERY_MEDIA_PICKER_RESULT", "()Ljava/lang/Number;", "UniError_ChooseMedia", "getUniError_ChooseMedia", "chooseMedia", "Lkotlin/Function1;", "Luts/sdk/modules/DCloudUniChooseMedia/ChooseMediaOptions;", "Lkotlin/ParameterName;", "name", "options", "", "Luts/sdk/modules/DCloudUniChooseMedia/ChooseMedia;", "getChooseMedia", "()Lkotlin/jvm/functions/Function1;", "mediaCachePath", "getMediaCachePath", "openMediaFunction", "Lkotlin/Function3;", "", "requestCode", "resultCode", "Landroid/content/Intent;", "data", "getOpenMediaFunction", "()Lkotlin/jvm/functions/Function3;", "setOpenMediaFunction", "(Lkotlin/jvm/functions/Function3;)V", "takeCameraFunction", "getTakeCameraFunction", "setTakeCameraFunction", "takeVideoFunction", "getTakeVideoFunction", "setTakeVideoFunction", "chooseMediaAll", "chooseMediaByJs", "Luts/sdk/modules/DCloudUniChooseMedia/ChooseMediaOptionsJSONObject;", "copyFile", "", "fromFilePath", "toFilePath", "getGlobalConfig", "getMediaFileByType", "Luts/sdk/modules/DCloudUniChooseMedia/ChooseMediaTempFile;", "path", "mimeType", "getMediaInfo", "", "getMediaTempFile", "getMediaType", "types", "Lio/dcloud/uts/UTSArray;", "getOrientation", "reassignedPageOrientation", "Luts/sdk/modules/DCloudUniChooseMedia/ChooseMediaPageOrientation;", "getVideoMetadata", "Lio/dcloud/uts/UTSJSONObject;", "src", "filePath", "onMediaTypeSelect", "count", "compressed", "item", "onSourceTypeSelect", DCWXSlider.INDEX, "openAlbumForMedia", "option", AbsEvent.EVENT_KEY_TYPE, "openCameraForMediaImage", "openCameraForMediaVideo", "openGalleryActivity", "sizeType", "crop", "", "pageOrientation", "useSystem", "saveBitmapToLocalPath", "bitmap", "Landroid/graphics/Bitmap;", "uniChooseMedia", "ChooseMedia", "ChooseMediaCompleteCallback", "callback", "ChooseMediaErrorCode", "ChooseMediaFail", "Luts/sdk/modules/DCloudUniChooseMedia/IChooseMediaError;", "ChooseMediaFailCallback", "Luts/sdk/modules/DCloudUniChooseMedia/ChooseMediaFail;", "ChooseMediaFileType", "ChooseMediaPageOrientation", "ChooseMediaSuccessCallback", "Luts/sdk/modules/DCloudUniChooseMedia/ChooseMediaSuccess;", "uni-chooseMedia_release"}, k = 2, mv = {1, 8, 0}, xi = 48)
public final class IndexKt {
    private static final String UniError_ChooseMedia = "uni-chooseMedia";
    private static Function3<? super Integer, ? super Integer, ? super Intent, Unit> openMediaFunction;
    private static Function3<? super Integer, ? super Integer, ? super Intent, Unit> takeCameraFunction;
    private static Function3<? super Integer, ? super Integer, ? super Intent, Unit> takeVideoFunction;
    private static final Map<Number, String> ChooseMediaUniErrors = new Map<>((UTSArray<UTSArray<Object>>) UTSArrayKt.utsArrayOf(UTSArrayKt.utsArrayOf(1101001, "user cancel"), UTSArrayKt.utsArrayOf(1101005, "No Permission"), UTSArrayKt.utsArrayOf(1101006, "save error"), UTSArrayKt.utsArrayOf(1101008, "camera error")));
    private static final String mediaCachePath = UTSAndroid.INSTANCE.getAppCachePath() + "uni-media/";
    private static final String ASSETS_PATH = "/android_asset/";
    private static final Function1<ChooseMediaOptions, Unit> chooseMedia = new Function1<ChooseMediaOptions, Unit>() {
        @Override
        public Unit invoke(ChooseMediaOptions chooseMediaOptions) {
            invoke2(chooseMediaOptions);
            return Unit.INSTANCE;
        }

        public final void invoke2(ChooseMediaOptions options) {
            Intrinsics.checkNotNullParameter(options, "options");
            IndexKt.chooseMediaAll(options);
        }
    };
    private static final Number GALLERY_MEDIA_PICKER_RESULT = (Number) 1004;

    public static final String getUniError_ChooseMedia() {
        return UniError_ChooseMedia;
    }

    public static final Map<Number, String> getChooseMediaUniErrors() {
        return ChooseMediaUniErrors;
    }

    public static final String getMediaCachePath() {
        return mediaCachePath;
    }

    public static final String getASSETS_PATH() {
        return ASSETS_PATH;
    }

    public static final Function1<ChooseMediaOptions, Unit> getChooseMedia() {
        return chooseMedia;
    }

    public static final void chooseMediaAll(final ChooseMediaOptions options) {
        Intrinsics.checkNotNullParameter(options, "options");
        uniChooseMedia(options, new Function3<Number, Boolean, Number, Unit>() {
            {
                super(3);
            }

            @Override
            public Unit invoke(Number number, Boolean bool, Number number2) {
                invoke(number, bool.booleanValue(), number2);
                return Unit.INSTANCE;
            }

            public final void invoke(final Number count, final boolean z, final Number index) {
                Intrinsics.checkNotNullParameter(count, "count");
                Intrinsics.checkNotNullParameter(index, "index");
                if (NumberKt.numberEquals(index, 1)) {
                    if (Build.VERSION.SDK_INT <= 32) {
                        Activity uniActivity = UTSAndroid.INSTANCE.getUniActivity();
                        Intrinsics.checkNotNull(uniActivity);
                        if (uniActivity.getApplicationInfo().targetSdkVersion < 33) {
                            UTSAndroid uTSAndroid = UTSAndroid.INSTANCE;
                            Activity uniActivity2 = UTSAndroid.INSTANCE.getUniActivity();
                            Intrinsics.checkNotNull(uniActivity2);
                            UTSArray utsArrayOf = UTSArrayKt.utsArrayOf("android.permission.READ_EXTERNAL_STORAGE");
                            final ChooseMediaOptions chooseMediaOptions = ChooseMediaOptions.this;
                            Function2<Boolean, UTSArray<String>, Unit> function2 = new Function2<Boolean, UTSArray<String>, Unit>() {
                                {
                                    super(2);
                                }

                                @Override
                                public Unit invoke(Boolean bool, UTSArray<String> uTSArray) {
                                    invoke(bool.booleanValue(), uTSArray);
                                    return Unit.INSTANCE;
                                }

                                public final void invoke(boolean z2, UTSArray<String> b) {
                                    Intrinsics.checkNotNullParameter(b, "b");
                                    ChooseMediaOptions chooseMediaOptions2 = ChooseMediaOptions.this;
                                    IndexKt.openAlbumForMedia(chooseMediaOptions2, count, IndexKt.getMediaType(chooseMediaOptions2.getMediaType()));
                                }
                            };
                            final ChooseMediaOptions chooseMediaOptions2 = ChooseMediaOptions.this;
                            uTSAndroid.requestSystemPermission(uniActivity2, utsArrayOf, function2, new Function2<Boolean, UTSArray<String>, Unit>() {
                                {
                                    super(2);
                                }

                                @Override
                                public Unit invoke(Boolean bool, UTSArray<String> uTSArray) {
                                    invoke(bool.booleanValue(), uTSArray);
                                    return Unit.INSTANCE;
                                }

                                public final void invoke(boolean z2, UTSArray<String> b) {
                                    Intrinsics.checkNotNullParameter(b, "b");
                                    ChooseMediaErrorImpl chooseMediaErrorImpl = new ChooseMediaErrorImpl((Number) 1101005, IndexKt.getUniError_ChooseMedia());
                                    Function1<IChooseMediaError, Unit> fail = ChooseMediaOptions.this.getFail();
                                    if (fail != null) {
                                        fail.invoke(chooseMediaErrorImpl);
                                    }
                                    Function1<Object, Unit> complete = ChooseMediaOptions.this.getComplete();
                                    if (complete != null) {
                                        complete.invoke(chooseMediaErrorImpl);
                                    }
                                }
                            }, (r12 & 16) != 0 ? false : false);
                            return;
                        }
                    }
                    ChooseMediaOptions chooseMediaOptions3 = ChooseMediaOptions.this;
                    IndexKt.openAlbumForMedia(chooseMediaOptions3, count, IndexKt.getMediaType(chooseMediaOptions3.getMediaType()));
                    return;
                }
                if (Build.VERSION.SDK_INT >= 23) {
                    UTSArray utsArrayOf2 = UTSArrayKt.utsArrayOf("android.permission.CAMERA");
                    Intrinsics.checkNotNull(utsArrayOf2, "null cannot be cast to non-null type io.dcloud.uts.UTSArray<kotlin.String>");
                    UTSAndroid uTSAndroid2 = UTSAndroid.INSTANCE;
                    Activity uniActivity3 = UTSAndroid.INSTANCE.getUniActivity();
                    Intrinsics.checkNotNull(uniActivity3);
                    final ChooseMediaOptions chooseMediaOptions4 = ChooseMediaOptions.this;
                    Function2<Boolean, UTSArray<String>, Unit> function22 = new Function2<Boolean, UTSArray<String>, Unit>() {
                        {
                            super(2);
                        }

                        @Override
                        public Unit invoke(Boolean bool, UTSArray<String> uTSArray) {
                            invoke(bool.booleanValue(), uTSArray);
                            return Unit.INSTANCE;
                        }

                        public final void invoke(boolean z2, UTSArray<String> b) {
                            Intrinsics.checkNotNullParameter(b, "b");
                            if (NumberKt.numberEquals(index, 0)) {
                                IndexKt.openCameraForMediaImage(chooseMediaOptions4, z);
                            } else if (NumberKt.numberEquals(index, 2)) {
                                IndexKt.openCameraForMediaVideo(chooseMediaOptions4, z);
                            }
                        }
                    };
                    final ChooseMediaOptions chooseMediaOptions5 = ChooseMediaOptions.this;
                    uTSAndroid2.requestSystemPermission(uniActivity3, utsArrayOf2, function22, new Function2<Boolean, UTSArray<String>, Unit>() {
                        {
                            super(2);
                        }

                        @Override
                        public Unit invoke(Boolean bool, UTSArray<String> uTSArray) {
                            invoke(bool.booleanValue(), uTSArray);
                            return Unit.INSTANCE;
                        }

                        public final void invoke(boolean z2, UTSArray<String> b) {
                            Intrinsics.checkNotNullParameter(b, "b");
                            ChooseMediaErrorImpl chooseMediaErrorImpl = new ChooseMediaErrorImpl((Number) 1101005, IndexKt.getUniError_ChooseMedia());
                            Function1<IChooseMediaError, Unit> fail = ChooseMediaOptions.this.getFail();
                            if (fail != null) {
                                fail.invoke(chooseMediaErrorImpl);
                            }
                            Function1<Object, Unit> complete = ChooseMediaOptions.this.getComplete();
                            if (complete != null) {
                                complete.invoke(chooseMediaErrorImpl);
                            }
                        }
                    }, (r12 & 16) != 0 ? false : false);
                    return;
                }
                if (NumberKt.numberEquals(index, 0)) {
                    IndexKt.openCameraForMediaImage(ChooseMediaOptions.this, z);
                } else if (NumberKt.numberEquals(index, 2)) {
                    IndexKt.openCameraForMediaVideo(ChooseMediaOptions.this, z);
                }
            }
        });
    }

    public static final void uniChooseMedia(final uts.sdk.modules.DCloudUniChooseMedia.ChooseMediaOptions r23, final kotlin.jvm.functions.Function3<? super java.lang.Number, ? super java.lang.Boolean, ? super java.lang.Number, kotlin.Unit> r24) {
        throw new UnsupportedOperationException("Method not decompiled: uts.sdk.modules.DCloudUniChooseMedia.IndexKt.uniChooseMedia(uts.sdk.modules.DCloudUniChooseMedia.ChooseMediaOptions, kotlin.jvm.functions.Function3):void");
    }

    public static final void onMediaTypeSelect(Number count, boolean z, String item, Function3<? super Number, ? super Boolean, ? super Number, Unit> onSourceTypeSelect) {
        Intrinsics.checkNotNullParameter(count, "count");
        Intrinsics.checkNotNullParameter(item, "item");
        Intrinsics.checkNotNullParameter(onSourceTypeSelect, "onSourceTypeSelect");
        int hashCode = item.hashCode();
        if (hashCode == -1915178910) {
            if (item.equals("从相册选择")) {
                onSourceTypeSelect.invoke(count, Boolean.valueOf(z), 1);
            }
        } else if (hashCode == 777242) {
            if (item.equals("录像")) {
                onSourceTypeSelect.invoke(count, Boolean.valueOf(z), 2);
            }
        } else if (hashCode == 809751 && item.equals("拍摄")) {
            onSourceTypeSelect.invoke(count, Boolean.valueOf(z), 0);
        }
    }

    public static final Number getMediaType(UTSArray<String> uTSArray) {
        Integer valueOf = Integer.valueOf(SystemPickerActivity.PICKER_IMAGE_VIDEO);
        if (uTSArray == null) {
            return valueOf;
        }
        String uTSArray2 = uTSArray.toString();
        Locale ENGLISH = Locale.ENGLISH;
        Intrinsics.checkNotNullExpressionValue(ENGLISH, "ENGLISH");
        String lowerCase = uTSArray2.toLowerCase(ENGLISH);
        Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(locale)");
        String str = lowerCase;
        if (StringsKt.contains$default(str, "mix", false, 2, null)) {
            return valueOf;
        }
        if (StringsKt.contains$default(str, AbsURIAdapter.IMAGE, false, 2, null) && StringsKt.contains$default(str, AbsURIAdapter.VIDEO, false, 2, null)) {
            return valueOf;
        }
        if (StringsKt.contains$default(str, AbsURIAdapter.IMAGE, false, 2, null)) {
            return (Number) 100;
        }
        if (StringsKt.contains$default(str, AbsURIAdapter.VIDEO, false, 2, null)) {
            return Integer.valueOf(SystemPickerActivity.PICKER_VIDEO);
        }
        return valueOf;
    }

    public static final Function3<Integer, Integer, Intent, Unit> getTakeVideoFunction() {
        return takeVideoFunction;
    }

    public static final void setTakeVideoFunction(Function3<? super Integer, ? super Integer, ? super Intent, Unit> function3) {
        takeVideoFunction = function3;
    }

    public static final void openCameraForMediaVideo(final uts.sdk.modules.DCloudUniChooseMedia.ChooseMediaOptions r4, boolean r5) {
        throw new UnsupportedOperationException("Method not decompiled: uts.sdk.modules.DCloudUniChooseMedia.IndexKt.openCameraForMediaVideo(uts.sdk.modules.DCloudUniChooseMedia.ChooseMediaOptions, boolean):void");
    }

    public static final Function3<Integer, Integer, Intent, Unit> getTakeCameraFunction() {
        return takeCameraFunction;
    }

    public static final void setTakeCameraFunction(Function3<? super Integer, ? super Integer, ? super Intent, Unit> function3) {
        takeCameraFunction = function3;
    }

    public static final void openCameraForMediaImage(final ChooseMediaOptions option, boolean z) {
        Intrinsics.checkNotNullParameter(option, "option");
        final Integer num = (Number) 24;
        if (takeCameraFunction != null) {
            UTSAndroid uTSAndroid = UTSAndroid.INSTANCE;
            Function3<? super Integer, ? super Integer, ? super Intent, Unit> function3 = takeCameraFunction;
            Intrinsics.checkNotNull(function3);
            uTSAndroid.offAppActivityResult(function3);
        }
        final Ref.ObjectRef objectRef = new Ref.ObjectRef();
        objectRef.element = mediaCachePath + System.currentTimeMillis() + ".jpg";
        try {
            final Ref.ObjectRef objectRef2 = new Ref.ObjectRef();
            objectRef2.element = new File((String) objectRef.element);
            if (!((File) objectRef2.element).getParentFile().exists()) {
                ((File) objectRef2.element).getParentFile().mkdirs();
            }
            takeCameraFunction = new Function3<Integer, Integer, Intent, Unit>() {
                {
                    super(3);
                }

                @Override
                public Unit invoke(Integer num2, Integer num3, Intent intent) {
                    invoke(num2.intValue(), num3.intValue(), intent);
                    return Unit.INSTANCE;
                }

                public final void invoke(int i, int i2, Intent intent) {
                    if (NumberKt.numberEquals(num, Integer.valueOf(i))) {
                        UTSAndroid uTSAndroid2 = UTSAndroid.INSTANCE;
                        Function3<Integer, Integer, Intent, Unit> takeCameraFunction2 = IndexKt.getTakeCameraFunction();
                        Intrinsics.checkNotNull(takeCameraFunction2);
                        uTSAndroid2.offAppActivityResult(takeCameraFunction2);
                        if (i2 == -1) {
                            if (objectRef2.element.exists()) {
                                ChooseMediaTempFile mediaFileByType = IndexKt.getMediaFileByType(objectRef.element, (Number) 1);
                                if (mediaFileByType != null) {
                                    ChooseMediaSuccess chooseMediaSuccess = new ChooseMediaSuccess(UTSArrayKt.utsArrayOf(mediaFileByType), AbsURIAdapter.IMAGE);
                                    Function1<ChooseMediaSuccess, Unit> success = option.getSuccess();
                                    if (success != null) {
                                        success.invoke(chooseMediaSuccess);
                                    }
                                    Function1<Object, Unit> complete = option.getComplete();
                                    if (complete != null) {
                                        complete.invoke(chooseMediaSuccess);
                                        return;
                                    }
                                    return;
                                }
                                ChooseMediaErrorImpl chooseMediaErrorImpl = new ChooseMediaErrorImpl((Number) 1101001, IndexKt.getUniError_ChooseMedia());
                                Function1<IChooseMediaError, Unit> fail = option.getFail();
                                if (fail != null) {
                                    fail.invoke(chooseMediaErrorImpl);
                                }
                                Function1<Object, Unit> complete2 = option.getComplete();
                                if (complete2 != null) {
                                    complete2.invoke(chooseMediaErrorImpl);
                                    return;
                                }
                                return;
                            }
                            ChooseMediaErrorImpl chooseMediaErrorImpl2 = new ChooseMediaErrorImpl((Number) 1101008, IndexKt.getUniError_ChooseMedia());
                            Function1<IChooseMediaError, Unit> fail2 = option.getFail();
                            if (fail2 != null) {
                                fail2.invoke(chooseMediaErrorImpl2);
                            }
                            Function1<Object, Unit> complete3 = option.getComplete();
                            if (complete3 != null) {
                                complete3.invoke(chooseMediaErrorImpl2);
                                return;
                            }
                            return;
                        }
                        ChooseMediaErrorImpl chooseMediaErrorImpl3 = new ChooseMediaErrorImpl((Number) 1101001, IndexKt.getUniError_ChooseMedia());
                        Function1<IChooseMediaError, Unit> fail3 = option.getFail();
                        if (fail3 != null) {
                            fail3.invoke(chooseMediaErrorImpl3);
                        }
                        Function1<Object, Unit> complete4 = option.getComplete();
                        if (complete4 != null) {
                            complete4.invoke(chooseMediaErrorImpl3);
                        }
                    }
                }
            };
            UTSAndroid uTSAndroid2 = UTSAndroid.INSTANCE;
            Function3<? super Integer, ? super Integer, ? super Intent, Unit> function32 = takeCameraFunction;
            Intrinsics.checkNotNull(function32);
            uTSAndroid2.onAppActivityResult(function32);
            Activity uniActivity = UTSAndroid.INSTANCE.getUniActivity();
            Intrinsics.checkNotNull(uniActivity);
            StringBuilder sb = new StringBuilder();
            Activity uniActivity2 = UTSAndroid.INSTANCE.getUniActivity();
            Intrinsics.checkNotNull(uniActivity2);
            sb.append(uniActivity2.getPackageName());
            sb.append(".dc.fileprovider");
            Uri uriForFile = FileProvider.getUriForFile(uniActivity, sb.toString(), (File) objectRef2.element);
            Intrinsics.checkNotNullExpressionValue(uriForFile, "getUriForFile(UTSAndroid…c.fileprovider\", picFile)");
            Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
            intent.putExtra("output", uriForFile);
            Activity uniActivity3 = UTSAndroid.INSTANCE.getUniActivity();
            if (uniActivity3 != null) {
                uniActivity3.startActivityForResult(intent, num.intValue());
            }
        } catch (Exception unused) {
        }
    }

    public static final Number getGALLERY_MEDIA_PICKER_RESULT() {
        return GALLERY_MEDIA_PICKER_RESULT;
    }

    public static final Function3<Integer, Integer, Intent, Unit> getOpenMediaFunction() {
        return openMediaFunction;
    }

    public static final void setOpenMediaFunction(Function3<? super Integer, ? super Integer, ? super Intent, Unit> function3) {
        openMediaFunction = function3;
    }

    public static final void openAlbumForMedia(final ChooseMediaOptions option, Number count, Number type) {
        Intrinsics.checkNotNullParameter(option, "option");
        Intrinsics.checkNotNullParameter(count, "count");
        Intrinsics.checkNotNullParameter(type, "type");
        if (openMediaFunction != null) {
            UTSAndroid uTSAndroid = UTSAndroid.INSTANCE;
            Function3<? super Integer, ? super Integer, ? super Intent, Unit> function3 = openMediaFunction;
            Intrinsics.checkNotNull(function3);
            uTSAndroid.offAppActivityResult(function3);
        }
        openMediaFunction = new Function3<Integer, Integer, Intent, Unit>() {
            {
                super(3);
            }

            @Override
            public Unit invoke(Integer num, Integer num2, Intent intent) {
                invoke(num.intValue(), num2.intValue(), intent);
                return Unit.INSTANCE;
            }

            public final void invoke(int i, int i2, Intent intent) {
                String join;
                ArrayList parcelableArrayListExtra;
                if (NumberKt.numberEquals(Integer.valueOf(i), IndexKt.getGALLERY_MEDIA_PICKER_RESULT())) {
                    UTSAndroid uTSAndroid2 = UTSAndroid.INSTANCE;
                    Function3<Integer, Integer, Intent, Unit> openMediaFunction2 = IndexKt.getOpenMediaFunction();
                    Intrinsics.checkNotNull(openMediaFunction2);
                    uTSAndroid2.offAppActivityResult(openMediaFunction2);
                    UTSArray uTSArray = new UTSArray();
                    UTSArray uTSArray2 = new UTSArray();
                    if (intent != null && (parcelableArrayListExtra = intent.getParcelableArrayListExtra("select_result")) != null) {
                        for (Number number = (Number) 0; NumberKt.compareTo(number, Integer.valueOf(parcelableArrayListExtra.size())) < 0; number = NumberKt.inc(number)) {
                            Object obj = parcelableArrayListExtra.get(number.intValue());
                            Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type uts.sdk.modules.DCloudUniMedia.Media");
                            Media media = (Media) obj;
                            String str = media.path;
                            Intrinsics.checkNotNullExpressionValue(str, "element.path");
                            ChooseMediaTempFile mediaFileByType = IndexKt.getMediaFileByType(str, Integer.valueOf(media.mediaType));
                            if (mediaFileByType != null) {
                                uTSArray.add(mediaFileByType);
                                if (uTSArray2.indexOf(mediaFileByType.getFileType()) == -1) {
                                    uTSArray2.add(mediaFileByType.getFileType());
                                }
                            }
                        }
                    }
                    if (uTSArray.size() == 0) {
                        ChooseMediaErrorImpl chooseMediaErrorImpl = new ChooseMediaErrorImpl((Number) 1101001, IndexKt.getUniError_ChooseMedia());
                        Function1<IChooseMediaError, Unit> fail = ChooseMediaOptions.this.getFail();
                        if (fail != null) {
                            fail.invoke(chooseMediaErrorImpl);
                        }
                        Function1<Object, Unit> complete = ChooseMediaOptions.this.getComplete();
                        if (complete != null) {
                            complete.invoke(chooseMediaErrorImpl);
                            return;
                        }
                        return;
                    }
                    if (ChooseMediaOptions.this.getMediaType() != null) {
                        UTSArray<String> mediaType = ChooseMediaOptions.this.getMediaType();
                        Intrinsics.checkNotNull(mediaType);
                        String uTSArray3 = mediaType.toString();
                        Locale ENGLISH = Locale.ENGLISH;
                        Intrinsics.checkNotNullExpressionValue(ENGLISH, "ENGLISH");
                        String lowerCase = uTSArray3.toLowerCase(ENGLISH);
                        Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(locale)");
                        join = "mix";
                        if (!StringsKt.contains$default(lowerCase, "mix", false, 2, null)) {
                            join = TextUtils.join(",", uTSArray2);
                            Intrinsics.checkNotNullExpressionValue(join, "join(\",\", resultTypes)");
                        }
                    } else {
                        join = TextUtils.join(",", uTSArray2);
                        Intrinsics.checkNotNullExpressionValue(join, "join(\",\", resultTypes)");
                    }
                    ChooseMediaSuccess chooseMediaSuccess = new ChooseMediaSuccess(uTSArray, join);
                    Function1<ChooseMediaSuccess, Unit> success = ChooseMediaOptions.this.getSuccess();
                    if (success != null) {
                        success.invoke(chooseMediaSuccess);
                    }
                    Function1<Object, Unit> complete2 = ChooseMediaOptions.this.getComplete();
                    if (complete2 != null) {
                        complete2.invoke(chooseMediaSuccess);
                    }
                }
            }
        };
        UTSAndroid uTSAndroid2 = UTSAndroid.INSTANCE;
        Function3<? super Integer, ? super Integer, ? super Intent, Unit> function32 = openMediaFunction;
        Intrinsics.checkNotNull(function32);
        uTSAndroid2.onAppActivityResult(function32);
        openGalleryActivity(count, type, false, null, null, option.getPageOrientation(), null);
    }

    public static final void openGalleryActivity(Number count, Number type, boolean z, UTSArray<String> uTSArray, Object obj, String str, String str2) {
        Intrinsics.checkNotNullParameter(count, "count");
        Intrinsics.checkNotNullParameter(type, "type");
        Intent intent = new Intent();
        Activity uniActivity = UTSAndroid.INSTANCE.getUniActivity();
        Intrinsics.checkNotNull(uniActivity);
        Intrinsics.checkNotNull(uniActivity);
        intent.setClassName(uniActivity, "uts.sdk.modules.DCloudUniMedia.SystemPickerActivity");
        intent.putExtra(SystemPickerActivity.SELECT_MODE, type);
        intent.putExtra("single_select", false);
        intent.putExtra("COMPRESSED", z);
        intent.putExtra(SystemPickerActivity.MAX_SELECT_COUNT, count);
        if (uTSArray != null) {
            intent.putExtra("size_type", JSON.stringify(uTSArray));
        }
        intent.putExtra(SystemPickerActivity.DOC_PATH, mediaCachePath);
        intent.putExtra("image_editable", true);
        intent.putExtra("page_orientation", getOrientation(str));
        intent.putExtra("copy_privacy_path", !UTSAndroid.INSTANCE.isUniAppX());
        Activity uniActivity2 = UTSAndroid.INSTANCE.getUniActivity();
        Intrinsics.checkNotNull(uniActivity2);
        Intrinsics.checkNotNull(uniActivity2);
        uniActivity2.startActivityForResult(intent, GALLERY_MEDIA_PICKER_RESULT.intValue());
    }

    public static final ChooseMediaTempFile getMediaFileByType(String path, Number mimeType) {
        Intrinsics.checkNotNullParameter(path, "path");
        Intrinsics.checkNotNullParameter(mimeType, "mimeType");
        if (StringsKt.startsWith$default(path, "content://", false, 2, null)) {
            Activity uniActivity = UTSAndroid.INSTANCE.getUniActivity();
            Intrinsics.checkNotNull(uniActivity);
            String type = uniActivity.getContentResolver().getType(Uri.parse(path));
            Intrinsics.checkNotNull(type);
            if (StringsKt.startsWith$default(type, "image/", false, 2, null)) {
                return getMediaTempFile(path, (Number) 1);
            }
            if (StringsKt.startsWith$default(type, AbsURIAdapter.VIDEO, false, 2, null)) {
                return getMediaTempFile(path, (Number) 3);
            }
            return null;
        }
        if (NumberKt.numberEquals(mimeType, 1) || NumberKt.numberEquals(mimeType, 3)) {
            return getMediaTempFile(path, mimeType);
        }
        String replace = StringsKt.startsWith$default(path, "file://", false, 2, null) ? StringKt.replace(path, "file://", "") : path;
        try {
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inJustDecodeBounds = false;
            BitmapFactory.decodeFile(replace, options);
            if (options.outHeight >= 0 && options.outWidth >= 0) {
                return getMediaTempFile(path, (Number) 1);
            }
            return getMediaTempFile(path, (Number) 3);
        } catch (Throwable unused) {
            return getMediaTempFile(path, (Number) 3);
        }
    }

    public static final ChooseMediaTempFile getMediaTempFile(String path, Number mimeType) {
        String str;
        Intrinsics.checkNotNullParameter(path, "path");
        Intrinsics.checkNotNullParameter(mimeType, "mimeType");
        if (StringsKt.startsWith$default(path, "file://", false, 2, null) || StringsKt.startsWith$default(path, "content://", false, 2, null)) {
            str = path;
        } else {
            str = "file://" + path;
        }
        if (NumberKt.numberEquals(mimeType, 1)) {
            return new ChooseMediaTempFile(str, AbsURIAdapter.IMAGE, Long.valueOf(getMediaInfo(path)), null, null, null, null, 120, null);
        }
        if (!NumberKt.numberEquals(mimeType, 3)) {
            return null;
        }
        UTSJSONObject videoMetadata = getVideoMetadata(path, mediaCachePath + "video_thumb_" + System.currentTimeMillis() + ".jpg");
        if (videoMetadata == null) {
            videoMetadata = new UTSJSONObject() {
                private Number duration;
                private String filePath;
                private Number height;
                private Number size;
                private Number width;

                {
                    Double valueOf = Double.valueOf(0.0d);
                    this.duration = valueOf;
                    this.size = valueOf;
                    this.height = valueOf;
                    this.width = valueOf;
                    this.filePath = "";
                }

                public final Number getDuration() {
                    return this.duration;
                }

                public final void setDuration(Number number) {
                    Intrinsics.checkNotNullParameter(number, "<set-?>");
                    this.duration = number;
                }

                public final Number getSize() {
                    return this.size;
                }

                public final void setSize(Number number) {
                    Intrinsics.checkNotNullParameter(number, "<set-?>");
                    this.size = number;
                }

                public final Number getHeight() {
                    return this.height;
                }

                public final void setHeight(Number number) {
                    Intrinsics.checkNotNullParameter(number, "<set-?>");
                    this.height = number;
                }

                public final Number getWidth() {
                    return this.width;
                }

                public final void setWidth(Number number) {
                    Intrinsics.checkNotNullParameter(number, "<set-?>");
                    this.width = number;
                }

                public final String getFilePath() {
                    return this.filePath;
                }

                public final void setFilePath(String str2) {
                    Intrinsics.checkNotNullParameter(str2, "<set-?>");
                    this.filePath = str2;
                }
            };
        }
        Object obj = videoMetadata.get("filePath");
        Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type kotlin.String");
        String str2 = (String) obj;
        Object obj2 = videoMetadata.get("width");
        Intrinsics.checkNotNull(obj2, "null cannot be cast to non-null type kotlin.Number");
        Number number = (Number) obj2;
        Object obj3 = videoMetadata.get("height");
        Intrinsics.checkNotNull(obj3, "null cannot be cast to non-null type kotlin.Number");
        Number number2 = (Number) obj3;
        Object obj4 = videoMetadata.get("size");
        Intrinsics.checkNotNull(obj4, "null cannot be cast to non-null type kotlin.Number");
        Object obj5 = videoMetadata.get("duration");
        Intrinsics.checkNotNull(obj5, "null cannot be cast to non-null type kotlin.Number");
        return new ChooseMediaTempFile(str, AbsURIAdapter.VIDEO, (Number) obj4, (Number) obj5, number2, number, str2);
    }

    public static final long getMediaInfo(java.lang.String r12) {
        throw new UnsupportedOperationException("Method not decompiled: uts.sdk.modules.DCloudUniChooseMedia.IndexKt.getMediaInfo(java.lang.String):long");
    }

    public static final io.dcloud.uts.UTSJSONObject getVideoMetadata(java.lang.String r13, java.lang.String r14) {
        throw new UnsupportedOperationException("Method not decompiled: uts.sdk.modules.DCloudUniChooseMedia.IndexKt.getVideoMetadata(java.lang.String, java.lang.String):io.dcloud.uts.UTSJSONObject");
    }

    public static final boolean saveBitmapToLocalPath(Bitmap bitmap, String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        File file = new File(str);
        if (!file.getParentFile().exists()) {
            file.getParentFile().mkdirs();
        }
        if (!file.exists()) {
            file.createNewFile();
        }
        if (bitmap == null) {
            return false;
        }
        FileOutputStream fileOutputStream = null;
        try {
            FileOutputStream fileOutputStream2 = new FileOutputStream(file);
            try {
                bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream2);
                fileOutputStream2.close();
                return true;
            } catch (Throwable unused) {
                fileOutputStream = fileOutputStream2;
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
                return false;
            }
        } catch (Throwable unused2) {
        }
    }

    public static final Number getOrientation(String str) {
        if (str == null) {
            str = getGlobalConfig();
        }
        Intrinsics.checkNotNull(str);
        int hashCode = str.hashCode();
        if (hashCode != 3005871) {
            if (hashCode != 729267099) {
                if (hashCode == 1430647483 && str.equals("landscape")) {
                    return (Number) 6;
                }
            } else if (str.equals("portrait")) {
                return (Number) 1;
            }
        } else if (str.equals(DebugKt.DEBUG_PROPERTY_VALUE_AUTO)) {
            return (Number) 2;
        }
        return (Number) 1;
    }

    public static final String getGlobalConfig() {
        Object obj;
        try {
            Class<?> cls = Class.forName("io.dcloud.uniapp.framework.IndexKt");
            if (cls != null) {
                Field declaredField = cls.getDeclaredField("__uniConfig");
                declaredField.setAccessible(true);
                Object obj2 = declaredField.get(null);
                if (obj2 != null) {
                    Field declaredField2 = obj2.getClass().getDeclaredField("globalStyle");
                    declaredField2.setAccessible(true);
                    Object obj3 = declaredField2.get(obj2);
                    if (obj3 != null && (obj3 instanceof Map) && (obj = ((java.util.Map) obj3).get("pageOrientation")) != null) {
                        return (String) obj;
                    }
                }
            }
        } catch (Throwable unused) {
        }
        return "portrait";
    }

    public static final boolean copyFile(String fromFilePath, String toFilePath) {
        FileInputStream fileInputStream;
        Intrinsics.checkNotNullParameter(fromFilePath, "fromFilePath");
        Intrinsics.checkNotNullParameter(toFilePath, "toFilePath");
        try {
            String str = ASSETS_PATH;
            if (StringsKt.startsWith$default(fromFilePath, str, false, 2, null)) {
                Activity uniActivity = UTSAndroid.INSTANCE.getUniActivity();
                Intrinsics.checkNotNull(uniActivity);
                fileInputStream = uniActivity.getAssets().open(StringKt.replace(fromFilePath, str, ""));
            } else if (StringsKt.startsWith$default(fromFilePath, "content://", false, 2, null)) {
                Activity uniActivity2 = UTSAndroid.INSTANCE.getUniActivity();
                Intrinsics.checkNotNull(uniActivity2);
                fileInputStream = uniActivity2.getContentResolver().openInputStream(Uri.parse(fromFilePath));
            } else {
                File file = new File(fromFilePath);
                if (!file.exists() || !file.isFile() || !file.canRead()) {
                    return false;
                }
                fileInputStream = new FileInputStream(file);
            }
            if (fileInputStream == null) {
                return false;
            }
            File file2 = new File(toFilePath);
            if (!file2.getParentFile().exists()) {
                file2.getParentFile().mkdirs();
            }
            if (!file2.exists()) {
                file2.createNewFile();
            }
            FileOutputStream fileOutputStream = new FileOutputStream(file2);
            byte[] bArr = new byte[1024];
            for (int read = fileInputStream.read(bArr); read > 0; read = fileInputStream.read(bArr)) {
                fileOutputStream.write(bArr, 0, read);
            }
            fileInputStream.close();
            fileOutputStream.close();
            return true;
        } catch (Throwable unused) {
            return false;
        }
    }

    public static final void chooseMediaByJs(final ChooseMediaOptionsJSONObject options) {
        Intrinsics.checkNotNullParameter(options, "options");
        chooseMedia.invoke(new ChooseMediaOptions(options.getPageOrientation(), options.getCount(), options.getMediaType(), options.getSourceType(), options.getMaxDuration(), options.getCamera(), new Function1<ChooseMediaSuccess, Unit>() {
            {
                super(1);
            }

            @Override
            public Unit invoke(ChooseMediaSuccess chooseMediaSuccess) {
                invoke2(chooseMediaSuccess);
                return Unit.INSTANCE;
            }

            public final void invoke2(ChooseMediaSuccess callback) {
                Intrinsics.checkNotNullParameter(callback, "callback");
                UTSCallback success = ChooseMediaOptionsJSONObject.this.getSuccess();
                if (success != null) {
                    success.invoke(callback);
                }
            }
        }, new Function1<IChooseMediaError, Unit>() {
            {
                super(1);
            }

            @Override
            public Unit invoke(IChooseMediaError iChooseMediaError) {
                invoke2(iChooseMediaError);
                return Unit.INSTANCE;
            }

            public final void invoke2(IChooseMediaError callback) {
                Intrinsics.checkNotNullParameter(callback, "callback");
                UTSCallback fail = ChooseMediaOptionsJSONObject.this.getFail();
                if (fail != null) {
                    fail.invoke(callback);
                }
            }
        }, new Function1<Object, Unit>() {
            {
                super(1);
            }

            @Override
            public Unit invoke(Object obj) {
                invoke2(obj);
                return Unit.INSTANCE;
            }

            public final void invoke2(Object callback) {
                Intrinsics.checkNotNullParameter(callback, "callback");
                UTSCallback complete = ChooseMediaOptionsJSONObject.this.getComplete();
                if (complete != null) {
                    complete.invoke(callback);
                }
            }
        }));
    }
}