导航菜单

页面标题

页面副标题

Cantique de Louanges v12 - t.java 源代码

正在查看: Cantique de Louanges v12 应用的 t.java JAVA 源代码文件

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


package com.json.sdk.controller;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.CountDownTimer;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.ConsoleMessage;
import android.webkit.DownloadListener;
import android.webkit.JavascriptInterface;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.Toast;
import com.json.MessageToNative;
import com.json.a6;
import com.json.b4;
import com.json.bd;
import com.json.da;
import com.json.e5;
import com.json.e9;
import com.json.f0;
import com.json.fa;
import com.json.g6;
import com.json.g8;
import com.json.gb;
import com.json.h6;
import com.json.ha;
import com.json.hb;
import com.json.i2;
import com.json.i6;
import com.json.i8;
import com.json.j3;
import com.json.j6;
import com.json.ja;
import com.json.k0;
import com.json.k2;
import com.json.k3;
import com.json.l2;
import com.json.m6;
import com.json.mediationsdk.utils.IronSourceConstants;
import com.json.n3;
import com.json.nd;
import com.json.o2;
import com.json.o6;
import com.json.od;
import com.json.p2;
import com.json.p8;
import com.json.q2;
import com.json.q5;
import com.json.q6;
import com.json.s3;
import com.json.s8;
import com.json.sdk.controller.f;
import com.json.sdk.controller.k;
import com.json.sdk.controller.l;
import com.json.sdk.controller.t;
import com.json.sdk.utils.IronSourceStorageUtils;
import com.json.sdk.utils.Logger;
import com.json.sdk.utils.SDKUtils;
import com.json.v4;
import com.json.w2;
import com.json.wc;
import com.json.x2;
import com.json.y2;
import com.json.y6;
import com.json.z2;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.playercommon.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.unity3d.ads.adplayer.AndroidWebViewClient;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class t implements com.json.sdk.controller.k, fa, DownloadListener {
    private static String Y = "success";
    public static int Z = 0;

    public static String f33999a0 = "is_store";

    public static String f34000b0 = "external_url";

    public static String f34001c0 = "secondary_web_view";

    private static String f34002d0 = "fail";
    private x2 A;
    private String B;
    private com.json.sdk.controller.d C;
    private bd D;
    private f0 E;
    private k3 H;
    private com.json.sdk.controller.n I;
    private com.json.sdk.controller.o J;
    private com.json.sdk.controller.s K;
    private com.json.sdk.controller.i L;
    private com.json.sdk.controller.a M;
    private com.json.sdk.controller.j N;
    private nd O;
    private com.json.sdk.controller.c P;
    private i2 Q;
    private JSONObject R;
    private k.a S;
    private k.b T;
    q2 V;
    final i8 W;
    private ha X;

    private final q5 f34003a;

    private String f34007e;

    private String f34008f;

    private Map f34009g;

    private final s3 f34010h;

    private boolean f34011i;

    private s f34012j;

    private boolean f34013k;

    private CountDownTimer f34014l;

    public CountDownTimer f34015m;

    private final r f34019q;

    private View f34020r;

    private FrameLayout f34021s;

    private WebChromeClient.CustomViewCallback f34022t;

    private FrameLayout f34023u;

    private x f34024v;

    private String f34025w;

    private z2 f34026x;

    private y2 f34027y;

    private da f34028z;

    private String f34004b = t.class.getSimpleName();

    private String f34005c = IronSourceConstants.IRONSOURCE_CONFIG_NAME;

    private final String f34006d = "We're sorry, some error occurred. we will investigate it";

    private int f34016n = 50;

    private int f34017o = 50;

    private String f34018p = "top-right";
    private Object F = new Object();
    private boolean G = false;
    private final e5 U = e9.h().c();

    class a implements Runnable {

        final h6.e f34029a;

        final j3 f34030b;

        final String f34031c;

        a(h6.e eVar, j3 j3Var, String str) {
            this.f34029a = eVar;
            this.f34030b = j3Var;
            this.f34031c = str;
        }

        @Override
        public void run() {
            h6.e eVar = h6.e.RewardedVideo;
            h6.e eVar2 = this.f34029a;
            if (eVar != eVar2 && h6.e.Interstitial != eVar2 && h6.e.Banner != eVar2) {
                if (h6.e.OfferWall == eVar2) {
                    t.this.f34028z.onOfferwallInitFail(this.f34031c);
                    return;
                } else {
                    if (h6.e.OfferWallCredits == eVar2) {
                        t.this.f34028z.onGetOWCreditsFailed(this.f34031c);
                        return;
                    }
                    return;
                }
            }
            j3 j3Var = this.f34030b;
            if (j3Var == null || TextUtils.isEmpty(j3Var.h())) {
                return;
            }
            w2 w10 = t.this.w(this.f34029a);
            Log.d(t.this.f34004b, "onAdProductInitFailed (message:" + this.f34031c + ")(" + this.f34029a + ")");
            if (w10 != null) {
                w10.a(this.f34029a, this.f34030b.h(), this.f34031c);
            }
        }
    }

    class b implements Runnable {
        b() {
        }

        @Override
        public void run() {
            t.this.a(1);
        }
    }

    class c implements Runnable {
        c() {
        }

        @Override
        public void run() {
            t.this.a(1);
        }
    }

    class d implements Runnable {

        final i6 f34035a;

        d(i6 i6Var) {
            this.f34035a = i6Var;
        }

        @Override
        public void run() {
            t.this.P.b("controller html - failed to download - " + this.f34035a.b());
        }
    }

    class e implements Runnable {

        final String f34037a;

        final String f34038b;

        e(String str, String str2) {
            this.f34037a = str;
            this.f34038b = str2;
        }

        @Override
        public void run() {
            if (t.this.k() == h6.d.MODE_3.a()) {
                Toast.makeText(t.this.j(), this.f34037a + " : " + this.f34038b, 1).show();
            }
        }
    }

    class f implements Runnable {

        final Context f34040a;

        f(Context context) {
            this.f34040a = context;
        }

        @Override
        public void run() {
            t.this.y0(this.f34040a);
        }
    }

    class g implements Runnable {

        final Context f34042a;

        g(Context context) {
            this.f34042a = context;
        }

        @Override
        public void run() {
            t.this.C0(this.f34042a);
        }
    }

    class h implements Runnable {

        final h6.e f34044a;

        final String f34045b;

        h(h6.e eVar, String str) {
            this.f34044a = eVar;
            this.f34045b = str;
        }

        @Override
        public void run() {
            h6.e eVar = this.f34044a;
            if (eVar != h6.e.RewardedVideo && eVar != h6.e.Interstitial) {
                if (eVar == h6.e.OfferWall) {
                    t.this.f34028z.onOWAdClosed();
                }
            } else {
                w2 w10 = t.this.w(eVar);
                if (w10 != null) {
                    w10.a(this.f34044a, this.f34045b);
                }
            }
        }
    }

    class i extends i2 {
        i(JSONObject jSONObject, Context context) {
            super(jSONObject, context);
        }

        @Override
        public void a() {
            if (t.this.f34011i) {
                t.this.m("none");
            }
        }

        @Override
        public void b(String str, JSONObject jSONObject) {
            if (jSONObject == null || !t.this.f34011i) {
                return;
            }
            try {
                jSONObject.put("connectionType", str);
                t.this.e(jSONObject);
            } catch (JSONException e10) {
                e10.printStackTrace();
            }
        }

        @Override
        public void a(String str, JSONObject jSONObject) {
            if (t.this.f34011i) {
                t.this.m(str);
            }
        }
    }

    class j implements nd {
        j() {
        }

        @Override
        public void a(String str, JSONObject jSONObject) {
            t.this.N0(t.this.j0(str, jSONObject.toString()));
        }
    }

    class k implements Runnable {

        final JSONObject f34049a;

        final WebView f34050b;

        final String f34051c;

        k(JSONObject jSONObject, WebView webView, String str) {
            this.f34049a = jSONObject;
            this.f34050b = webView;
            this.f34051c = str;
        }

        @Override
        public void run() {
            t.this.R(this.f34049a, this.f34050b);
            t.this.S0(AndroidWebViewClient.BLANK_PAGE);
            t.this.S0(this.f34051c);
        }
    }

    class l extends CountDownTimer {

        final int f34053a;

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                t.this.P.b(o2.c.f33258j);
            }
        }

        l(long j10, long j11, int i10) {
            super(j10, j11);
            this.f34053a = i10;
        }

        @Override
        public void onFinish() {
            Logger.i(t.this.f34004b, "Loading Controller Timer Finish");
            int i10 = this.f34053a;
            if (i10 == 3) {
                t.this.f0(new a());
            } else {
                t.this.a(i10 + 1);
            }
        }

        @Override
        public void onTick(long j10) {
            Logger.i(t.this.f34004b, "Loading Controller Timer Tick " + j10);
        }
    }

    class m implements v {
        m() {
        }

        @Override
        public void a(String str, h6.e eVar, j3 j3Var) {
            t.this.O(str, eVar, j3Var);
        }
    }

    class n implements v {
        n() {
        }

        @Override
        public void a(String str, h6.e eVar, j3 j3Var) {
            t.this.O(str, eVar, j3Var);
        }
    }

    class o implements v {
        o() {
        }

        @Override
        public void a(String str, h6.e eVar, j3 j3Var) {
            t.this.O(str, eVar, j3Var);
        }
    }

    class p implements v {
        p() {
        }

        @Override
        public void a(String str, h6.e eVar, j3 j3Var) {
            t.this.O(str, eVar, j3Var);
        }
    }

    class q implements v {
        q() {
        }

        @Override
        public void a(String str, h6.e eVar, j3 j3Var) {
            t.this.O(str, eVar, j3Var);
        }
    }

    private class r extends WebChromeClient {
        private r() {
        }

        @Override
        public View getVideoLoadingProgressView() {
            FrameLayout frameLayout = new FrameLayout(t.this.W.getContext());
            frameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
            return frameLayout;
        }

        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            Logger.i("MyApplication", consoleMessage.message() + " -- From line " + consoleMessage.lineNumber() + " of " + consoleMessage.sourceId());
            return true;
        }

        @Override
        public boolean onCreateWindow(WebView webView, boolean z10, boolean z11, Message message) {
            WebView webView2 = new WebView(webView.getContext());
            webView2.setWebChromeClient(this);
            webView2.setWebViewClient(new C0464t(t.this, null));
            ((WebView.WebViewTransport) message.obj).setWebView(webView2);
            message.sendToTarget();
            Logger.i("onCreateWindow", "onCreateWindow");
            return true;
        }

        @Override
        public void onHideCustomView() {
            Logger.i("Test", "onHideCustomView");
            if (t.this.f34020r == null) {
                return;
            }
            t.this.f34020r.setVisibility(8);
            t.this.f34021s.removeView(t.this.f34020r);
            t.this.f34020r = null;
            t.this.f34021s.setVisibility(8);
            t.this.f34022t.onCustomViewHidden();
            t.this.W.setVisibility(0);
        }

        @Override
        public void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
            Logger.i("Test", "onShowCustomView");
            t.this.W.setVisibility(8);
            if (t.this.f34020r != null) {
                Logger.i("Test", "mCustomView != null");
                customViewCallback.onCustomViewHidden();
                return;
            }
            Logger.i("Test", "mCustomView == null");
            t.this.f34021s.addView(view);
            t.this.f34020r = view;
            t.this.f34022t = customViewCallback;
            t.this.f34021s.setVisibility(0);
        }

        r(t tVar, i iVar) {
            this();
        }
    }

    static class s {

        h6.e f34062a;

        String f34063b;

        public s(h6.e eVar, String str) {
            this.f34062a = eVar;
            this.f34063b = str;
        }

        String a() {
            return this.f34063b;
        }

        h6.e b() {
            return this.f34062a;
        }
    }

    private class C0464t extends WebViewClient {
        private C0464t() {
        }

        @Override
        @TargetApi(26)
        public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
            boolean didCrash;
            String str = t.this.f34004b;
            StringBuilder sb2 = new StringBuilder();
            sb2.append("Chromium process crashed - detail.didCrash(): ");
            didCrash = renderProcessGoneDetail.didCrash();
            sb2.append(didCrash);
            Logger.e(str, sb2.toString());
            return true;
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            Context j10 = t.this.j();
            Intent intent = new Intent(j10, (Class<?>) OpenUrlActivity.class);
            intent.putExtra(t.f34000b0, str);
            intent.putExtra(t.f34001c0, false);
            j10.startActivity(intent);
            return true;
        }

        C0464t(t tVar, i iVar) {
            this();
        }
    }

    public class u {

        class a implements Runnable {

            final String f34066a;

            a(String str) {
                this.f34066a = str;
            }

            @Override
            public void run() {
                try {
                    t.this.N.g(new JSONObject(this.f34066a), u.this.new e0());
                } catch (Exception e10) {
                    e10.printStackTrace();
                    Logger.i(t.this.f34004b, "fileSystemAPI failed with exception " + e10.getMessage());
                }
            }
        }

        class a0 implements Runnable {

            final String f34068a;

            a0(String str) {
                this.f34068a = str;
            }

            @Override
            public void run() {
                try {
                    Logger.i(t.this.f34004b, "omidAPI(" + this.f34068a + ")");
                    t.this.I.b(new hb(this.f34068a).toString(), u.this.new e0());
                } catch (Exception e10) {
                    e10.printStackTrace();
                    Logger.i(t.this.f34004b, "omidAPI failed with exception " + e10.getMessage());
                }
            }
        }

        class b implements Runnable {

            final String f34070a;

            final String f34071b;

            b(String str, String str2) {
                this.f34070a = str;
                this.f34071b = str2;
            }

            @Override
            public void run() {
                String str = this.f34070a;
                if (str == null) {
                    str = "We're sorry, some error occurred. we will investigate it";
                }
                Log.d(t.this.f34004b, "onRVInitFail(message:" + str + ")");
                t.this.f34026x.a(h6.e.RewardedVideo, this.f34071b, str);
            }
        }

        class b0 implements Runnable {
            b0() {
            }

            @Override
            public void run() {
                t.this.W.removeJavascriptInterface(o2.f33212f);
            }
        }

        class c implements Runnable {

            final String f34074a;

            final String f34075b;

            final int f34076c;

            final boolean f34077d;

            final int f34078e;

            final boolean f34079f;

            final String f34080g;

            final String f34081h;

            c(String str, String str2, int i10, boolean z10, int i11, boolean z11, String str3, String str4) {
                this.f34074a = str;
                this.f34075b = str2;
                this.f34076c = i10;
                this.f34077d = z10;
                this.f34078e = i11;
                this.f34079f = z11;
                this.f34080g = str3;
                this.f34081h = str4;
            }

            @Override
            public void run() {
                if (this.f34074a.equalsIgnoreCase(h6.e.RewardedVideo.toString())) {
                    t.this.f34026x.a(this.f34075b, this.f34076c);
                    return;
                }
                if (this.f34074a.equalsIgnoreCase(h6.e.OfferWall.toString()) && this.f34077d && t.this.f34028z.onOWAdCredited(this.f34076c, this.f34078e, this.f34079f) && !TextUtils.isEmpty(this.f34080g)) {
                    if (g8.e().a(this.f34080g, t.this.f34007e, t.this.f34008f)) {
                        t.this.Q(this.f34081h, true, null, null);
                    } else {
                        t.this.Q(this.f34081h, false, "Time Stamp could not be stored", null);
                    }
                }
            }
        }

        class c0 implements Runnable {
            c0() {
            }

            @Override
            public void run() {
                t.this.W.getSettings().setMixedContentMode(0);
            }
        }

        class d implements Runnable {

            final String f34084a;

            final String f34085b;

            d(String str, String str2) {
                this.f34084a = str;
                this.f34085b = str2;
            }

            @Override
            public void run() {
                String str = this.f34084a;
                if (str == null) {
                    str = "We're sorry, some error occurred. we will investigate it";
                }
                Log.d(t.this.f34004b, "onRVShowFail(message:" + this.f34084a + ")");
                t.this.f34026x.d(this.f34085b, str);
            }
        }

        class d0 implements Runnable {

            final int f34087a;

            final String f34088b;

            final com.json.e0 f34089c;

            d0(int i10, String str, com.json.e0 e0Var) {
                this.f34087a = i10;
                this.f34088b = str;
                this.f34089c = e0Var;
            }

            @Override
            public void run() {
                if (this.f34087a <= 0) {
                    t.this.f34026x.d(this.f34088b);
                } else {
                    Log.d(t.this.f34004b, "onRVInitSuccess()");
                    t.this.f34026x.a(h6.e.RewardedVideo, this.f34088b, this.f34089c);
                }
            }
        }

        class e implements Runnable {

            final String f34091a;

            final int f34092b;

            e(String str, int i10) {
                this.f34091a = str;
                this.f34092b = i10;
            }

            @Override
            public void run() {
                t.this.f34027y.onInterstitialAdRewarded(this.f34091a, this.f34092b);
            }
        }

        public class e0 implements p8 {
            public e0() {
            }

            @Override
            public void a(boolean z10, String str, hb hbVar) {
                hbVar.b(z10 ? t.Y : t.f34002d0, str);
                t.this.Q(hbVar.toString(), z10, null, null);
            }

            @Override
            public void a(boolean z10, String str, String str2) {
                hb hbVar = new hb();
                hbVar.b(z10 ? t.Y : t.f34002d0, str);
                hbVar.b("data", str2);
                t.this.Q(hbVar.toString(), z10, null, null);
            }

            @Override
            public void a(boolean z10, String str, JSONObject jSONObject) {
                try {
                    jSONObject.put(z10 ? t.Y : t.f34002d0, str);
                    t.this.Q(jSONObject.toString(), z10, null, null);
                } catch (JSONException e10) {
                    e10.printStackTrace();
                }
            }
        }

        class f implements Runnable {

            final String f34095a;

            f(String str) {
                this.f34095a = str;
            }

            @Override
            public void run() {
                t.this.f34028z.onOWShowSuccess(this.f34095a);
            }
        }

        class g implements Runnable {
            g() {
            }

            @Override
            public void run() {
                t tVar = t.this;
                tVar.W.setOnTouchListener(new y(tVar, null));
            }
        }

        class h implements Runnable {

            final String f34098a;

            h(String str) {
                this.f34098a = str;
            }

            @Override
            public void run() {
                String str = this.f34098a;
                if (str == null) {
                    str = "We're sorry, some error occurred. we will investigate it";
                }
                t.this.f34028z.onOWShowFail(str);
            }
        }

        class i implements Runnable {

            final String f34100a;

            i(String str) {
                this.f34100a = str;
            }

            @Override
            public void run() {
                Log.d(t.this.f34004b, "onInterstitialInitSuccess()");
                t.this.f34027y.a(h6.e.Interstitial, this.f34100a, (com.json.e0) null);
            }
        }

        class j implements Runnable {

            final String f34102a;

            final String f34103b;

            j(String str, String str2) {
                this.f34102a = str;
                this.f34103b = str2;
            }

            @Override
            public void run() {
                String str = this.f34102a;
                if (str == null) {
                    str = "We're sorry, some error occurred. we will investigate it";
                }
                Log.d(t.this.f34004b, "onInterstitialInitFail(message:" + str + ")");
                t.this.f34027y.a(h6.e.Interstitial, this.f34103b, str);
            }
        }

        class k implements Runnable {

            final w2 f34105a;

            final h6.e f34106b;

            final String f34107c;

            k(w2 w2Var, h6.e eVar, String str) {
                this.f34105a = w2Var;
                this.f34106b = eVar;
                this.f34107c = str;
            }

            @Override
            public void run() {
                this.f34105a.c(this.f34106b, this.f34107c);
            }
        }

        class l implements Runnable {

            final String f34109a;

            l(String str) {
                this.f34109a = str;
            }

            @Override
            public void run() {
                t.this.f34027y.b(h6.e.Interstitial, this.f34109a);
                t.this.f34027y.c(this.f34109a);
            }
        }

        class m implements Runnable {
            m() {
            }

            @Override
            public void run() {
                Log.d(t.this.f34004b, "onOfferWallInitSuccess()");
                t.this.f34028z.onOfferwallInitSuccess();
            }
        }

        class n implements Runnable {

            final String f34112a;

            n(String str) {
                this.f34112a = str;
            }

            @Override
            public void run() {
                String str = this.f34112a;
                if (str == null) {
                    str = "We're sorry, some error occurred. we will investigate it";
                }
                Log.d(t.this.f34004b, "onOfferWallInitFail(message:" + str + ")");
                t.this.f34028z.onOfferwallInitFail(str);
            }
        }

        class o implements Runnable {
            o() {
            }

            @Override
            public void run() {
                t.this.y();
            }
        }

        class p implements Runnable {

            final String f34115a;

            p(String str) {
                this.f34115a = str;
            }

            @Override
            public void run() {
                t.this.f34027y.b(this.f34115a);
            }
        }

        class q implements Runnable {

            final String f34117a;

            final String f34118b;

            q(String str, String str2) {
                this.f34117a = str;
                this.f34118b = str2;
            }

            @Override
            public void run() {
                String str = this.f34117a;
                if (str == null) {
                    str = "We're sorry, some error occurred. we will investigate it";
                }
                t.this.f34027y.c(this.f34118b, str);
            }
        }

        class r implements Runnable {

            final String f34120a;

            final String f34121b;

            r(String str, String str2) {
                this.f34120a = str;
                this.f34121b = str2;
            }

            @Override
            public void run() {
                String str = this.f34120a;
                if (str == null) {
                    str = "We're sorry, some error occurred. we will investigate it";
                }
                t.this.f34027y.b(this.f34121b, str);
            }
        }

        class s implements Runnable {

            final String f34123a;

            s(String str) {
                this.f34123a = str;
            }

            @Override
            public void run() {
                Log.d(t.this.f34004b, "onBannerInitSuccess()");
                t.this.A.a(h6.e.Banner, this.f34123a, (com.json.e0) null);
            }
        }

        class RunnableC0465t implements Runnable {

            final String f34125a;

            final String f34126b;

            RunnableC0465t(String str, String str2) {
                this.f34125a = str;
                this.f34126b = str2;
            }

            @Override
            public void run() {
                String str = this.f34125a;
                if (str == null) {
                    str = "We're sorry, some error occurred. we will investigate it";
                }
                Log.d(t.this.f34004b, "onBannerInitFail(message:" + str + ")");
                t.this.A.a(h6.e.Banner, this.f34126b, str);
            }
        }

        class RunnableC0466u implements Runnable {

            final String f34128a;

            final a6 f34129b;

            RunnableC0466u(String str, a6 a6Var) {
                this.f34128a = str;
                this.f34129b = a6Var;
            }

            @Override
            public void run() {
                Log.d(t.this.f34004b, "onBannerLoadSuccess()");
                t.this.A.a(this.f34128a, this.f34129b);
            }
        }

        class v implements Runnable {

            final String f34131a;

            final String f34132b;

            v(String str, String str2) {
                this.f34131a = str;
                this.f34132b = str2;
            }

            @Override
            public void run() {
                Log.d(t.this.f34004b, "onLoadBannerFail()");
                String str = this.f34131a;
                if (str == null) {
                    str = "We're sorry, some error occurred. we will investigate it";
                }
                t.this.A.a(this.f34132b, str);
            }
        }

        class w implements Runnable {

            final String f34134a;

            w(String str) {
                this.f34134a = str;
            }

            @Override
            public void run() {
                try {
                    if (new JSONObject(this.f34134a).has(f.b.MSG_ID)) {
                        t.this.S.a(f.CallbackToNative.a(this.f34134a));
                    } else {
                        t.this.T.a(MessageToNative.a(this.f34134a));
                    }
                } catch (JSONException e10) {
                    Logger.e(t.this.f34004b, "failed to parse received message");
                    e10.printStackTrace();
                }
            }
        }

        class x implements Runnable {

            final String f34136a;

            x(String str) {
                this.f34136a = str;
            }

            @Override
            public void run() {
                String str = this.f34136a;
                if (str == null) {
                    str = "We're sorry, some error occurred. we will investigate it";
                }
                t.this.f34028z.onGetOWCreditsFailed(str);
            }
        }

        class y implements Runnable {

            final h6.e f34138a;

            final String f34139b;

            final String f34140c;

            final JSONObject f34141d;

            y(h6.e eVar, String str, String str2, JSONObject jSONObject) {
                this.f34138a = eVar;
                this.f34139b = str;
                this.f34140c = str2;
                this.f34141d = jSONObject;
            }

            @Override
            public void run() {
                h6.e eVar = this.f34138a;
                if (eVar != h6.e.Interstitial && eVar != h6.e.RewardedVideo && eVar != h6.e.Banner) {
                    if (eVar == h6.e.OfferWall) {
                        t.this.f34028z.onOfferwallEventNotificationReceived(this.f34140c, this.f34141d);
                    }
                } else {
                    w2 w10 = t.this.w(eVar);
                    if (w10 != null) {
                        w10.a(this.f34138a, this.f34139b, this.f34140c, this.f34141d);
                    }
                }
            }
        }

        class z implements Runnable {
            z() {
            }

            @Override
            public void run() {
                t.this.u();
            }
        }

        public u() {
        }

        private void a(String str, int i10) {
            j3 a10;
            t tVar = t.this;
            h6.e eVar = h6.e.Interstitial;
            if (tVar.a1(eVar.toString()) && (a10 = t.this.H.a(eVar, str)) != null && a10.k()) {
                t.this.f0(new e(str, i10));
            }
        }

        private void b(String str, String str2) {
            if (TextUtils.isEmpty(str)) {
                return;
            }
            t.this.N0(t.this.j0(str, str2));
        }

        private void c(String str, boolean z10) {
            j3 a10 = t.this.H.a(h6.e.Interstitial, str);
            if (a10 != null) {
                a10.a(z10);
            }
        }

        private void d(JSONObject jSONObject) {
            try {
                jSONObject.put("controllerSourceData", t.this.C.n());
            } catch (Exception unused) {
            }
        }

        private void e(JSONObject jSONObject, String str) {
            if (f(str)) {
                try {
                    JSONObject jSONObject2 = new JSONObject(str);
                    jSONObject.putOpt("testerABGroup", jSONObject2.get("testerABGroup"));
                    jSONObject.putOpt("testFriendlyName", jSONObject2.get("testFriendlyName"));
                } catch (JSONException unused) {
                    Logger.d(t.this.f34004b, "getControllerConfig Error while parsing Tester AB Group parameters");
                }
            }
        }

        private void h(JSONObject jSONObject) {
            try {
                FeaturesManager featuresManager = FeaturesManager.getInstance();
                if (featuresManager.a().isEmpty()) {
                    return;
                }
                jSONObject.put(o2.a.f33235g, new JSONArray((Collection) featuresManager.a()));
            } catch (Exception e10) {
                o6.a(gb.f31863p, new j6().a(b4.f31535z, e10.getMessage()).a());
                Logger.d(t.this.f34004b, "getControllerConfig Error while adding supported features data from FeaturesManager");
            }
        }

        private void i(JSONObject jSONObject) {
            h(jSONObject);
            e(jSONObject, SDKUtils.getTesterParameters());
            d(jSONObject);
        }

        @JavascriptInterface
        public void adClicked(String str) {
            Logger.i(t.this.f34004b, "adClicked(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d(o2.h.f33360m);
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            if (TextUtils.isEmpty(fetchDemandSourceId)) {
                return;
            }
            h6.e G0 = t.this.G0(d10);
            w2 w10 = t.this.w(G0);
            if (G0 == null || w10 == null) {
                return;
            }
            t.this.f0(new k(w10, G0, fetchDemandSourceId));
        }

        @JavascriptInterface
        public void adCredited(String str) {
            String str2;
            boolean z10;
            boolean z11;
            Log.d(t.this.f34005c, "adCredited(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d(o2.h.f33356k);
            boolean z12 = false;
            int parseInt = d10 != null ? Integer.parseInt(d10) : 0;
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            String d11 = hbVar.d(o2.h.f33360m);
            if (TextUtils.isEmpty(d11)) {
                Log.d(t.this.f34005c, "adCredited | product type is missing");
            }
            if (h6.e.Interstitial.toString().equalsIgnoreCase(d11)) {
                a(fetchDemandSourceId, parseInt);
                return;
            }
            String d12 = hbVar.d(o2.h.f33358l);
            int parseInt2 = d12 != null ? Integer.parseInt(d12) : 0;
            if (!h6.e.OfferWall.toString().equalsIgnoreCase(d11)) {
                str2 = null;
                z10 = false;
                z11 = false;
            } else {
                if (hbVar.e(InAppPurchaseMetaData.KEY_SIGNATURE) || hbVar.e(CampaignEx.JSON_KEY_TIMESTAMP) || hbVar.e("totalCreditsFlag")) {
                    t.this.Q(str, false, "One of the keys are missing: signature/timestamp/totalCreditsFlag", null);
                    return;
                }
                if (hbVar.d(InAppPurchaseMetaData.KEY_SIGNATURE).equalsIgnoreCase(SDKUtils.getMD5(d12 + t.this.f34007e + t.this.f34008f))) {
                    z12 = true;
                } else {
                    t.this.Q(str, false, "Controller signature is not equal to SDK signature", null);
                }
                boolean c10 = hbVar.c("totalCreditsFlag");
                str2 = hbVar.d(CampaignEx.JSON_KEY_TIMESTAMP);
                z11 = c10;
                z10 = z12;
            }
            if (t.this.a1(d11)) {
                t.this.f0(new c(d11, fetchDemandSourceId, parseInt, z10, parseInt2, z11, str2, str));
            }
        }

        @JavascriptInterface
        public void adUnitsReady(String str) {
            Logger.i(t.this.f34004b, "adUnitsReady(" + str + ")");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(new hb(str));
            com.json.e0 e0Var = new com.json.e0(str);
            if (!e0Var.g()) {
                t.this.Q(str, false, o2.c.f33268t, null);
                return;
            }
            t.this.Q(str, true, null, null);
            String d10 = e0Var.d();
            if (h6.e.RewardedVideo.toString().equalsIgnoreCase(d10) && t.this.a1(d10)) {
                t.this.f0(new d0(Integer.parseInt(e0Var.c()), fetchDemandSourceId, e0Var));
            }
        }

        @JavascriptInterface
        public void adViewAPI(String str) {
            try {
                Logger.i(t.this.f34004b, "adViewAPI(" + str + ")");
                t.this.M.b(new hb(str).toString(), new e0());
            } catch (Exception e10) {
                e10.printStackTrace();
                Logger.i(t.this.f34004b, "adViewAPI failed with exception " + e10.getMessage());
            }
        }

        @JavascriptInterface
        public void bannerViewAPI(String str) {
            Logger.i(t.this.f34004b, "bannerViewAPI is not supported in this native version, only adview API");
        }

        @JavascriptInterface
        public void cleanAdInstance(String str) {
            h6.e G0;
            try {
                Logger.i(t.this.f34004b, "cleanAdInstance(" + str + ")");
                hb hbVar = new hb(str);
                String d10 = hbVar.d(o2.h.f33360m);
                String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
                if (TextUtils.isEmpty(fetchDemandSourceId) || (G0 = t.this.G0(d10)) == null) {
                    return;
                }
                t.this.H.b(G0, fetchDemandSourceId);
            } catch (Exception e10) {
                t.this.Q(str, false, e10.getMessage(), null);
                e10.printStackTrace();
            }
        }

        @JavascriptInterface
        public void clearLastUpdateTimeData(String str) {
            try {
                ArrayList<String> a10 = g8.e().a();
                hb hbVar = new hb(str);
                if (!a10.isEmpty()) {
                    hbVar.b(o2.h.f33383x0, a10.toString());
                }
                t.this.Q(hbVar.toString(), true, null, null);
            } catch (Exception e10) {
                t.this.Q(str, false, e10.getMessage(), null);
                e10.printStackTrace();
            }
        }

        @JavascriptInterface
        public void deleteFile(String str) {
            try {
                Logger.i(t.this.f34004b, "deleteFile(" + str + ")");
                hb hbVar = new hb(str);
                String d10 = hbVar.d(o2.h.f33338b);
                String d11 = hbVar.d("path");
                if (d11 != null && !TextUtils.isEmpty(d10)) {
                    q6 q6Var = new q6(IronSourceStorageUtils.buildAbsolutePathToDirInCache(t.this.B, d11), d10);
                    IronSourceStorageUtils.ensurePathSafety(q6Var, t.this.B);
                    if (!q6Var.exists()) {
                        t.this.Q(str, false, o2.c.f33254f, "1");
                        return;
                    } else {
                        t.this.Q(str, IronSourceStorageUtils.deleteFile(q6Var), null, null);
                        return;
                    }
                }
                t.this.Q(str, false, o2.c.f33255g, "1");
            } catch (Exception e10) {
                t.this.Q(str, false, e10.getMessage(), null);
                e10.printStackTrace();
            }
        }

        @JavascriptInterface
        public void deleteFolder(String str) {
            try {
                Logger.i(t.this.f34004b, "deleteFolder(" + str + ")");
                String d10 = new hb(str).d("path");
                if (d10 == null) {
                    t.this.Q(str, false, o2.c.f33255g, "1");
                    return;
                }
                q6 q6Var = new q6(IronSourceStorageUtils.buildAbsolutePathToDirInCache(t.this.B, d10));
                IronSourceStorageUtils.ensurePathSafety(q6Var, t.this.B);
                if (!q6Var.exists()) {
                    t.this.Q(str, false, o2.c.f33253e, "1");
                } else {
                    t.this.Q(str, IronSourceStorageUtils.deleteFolder(q6Var.getPath()), null, null);
                }
            } catch (Exception e10) {
                t.this.Q(str, false, e10.getMessage(), null);
                e10.printStackTrace();
            }
        }

        @JavascriptInterface
        public void deviceDataAPI(String str) {
            try {
                Logger.i(t.this.f34004b, "deviceDataAPI(" + str + ")");
                t.this.L.c(new hb(str).toString(), new e0());
            } catch (Exception e10) {
                e10.printStackTrace();
                Logger.i(t.this.f34004b, "deviceDataAPI failed with exception " + e10.getMessage());
            }
        }

        @JavascriptInterface
        public void displayWebView(String str) {
            Logger.i(t.this.f34004b, "displayWebView(" + str + ")");
            t.this.Q(str, true, null, null);
            hb hbVar = new hb(str);
            boolean booleanValue = ((Boolean) hbVar.b(o2.h.f33342d)).booleanValue();
            String d10 = hbVar.d(o2.h.f33360m);
            boolean c10 = hbVar.c(o2.h.f33376u);
            String d11 = hbVar.d("adViewId");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            boolean c11 = hbVar.c(o2.h.f33387z0);
            if (!booleanValue) {
                t.this.a(x.Gone);
                t.this.K0();
                return;
            }
            t.this.G = hbVar.c(o2.h.f33378v);
            boolean c12 = hbVar.c(o2.h.f33384y);
            x o10 = t.this.o();
            x xVar = x.Display;
            if (o10 == xVar) {
                Logger.i(t.this.f34004b, "State: " + t.this.f34024v);
                return;
            }
            t.this.a(xVar);
            Logger.i(t.this.f34004b, "State: " + t.this.f34024v);
            Context j10 = t.this.j();
            String m10 = t.this.m();
            int I = t.this.U.I(j10);
            if (c10) {
                com.json.sdk.controller.h hVar = new com.json.sdk.controller.h(j10);
                hVar.addView(t.this.f34023u);
                hVar.a(t.this);
                return;
            }
            Intent intent = c12 ? new Intent(j10, (Class<?>) InterstitialActivity.class) : new Intent(j10, (Class<?>) ControllerActivity.class);
            h6.e eVar = h6.e.RewardedVideo;
            if (eVar.toString().equalsIgnoreCase(d10)) {
                if ("application".equals(m10)) {
                    m10 = SDKUtils.translateRequestedOrientation(t.this.U.K(j10));
                }
                intent.putExtra(o2.h.f33360m, eVar.toString());
                t.this.E.a(eVar.ordinal());
                t.this.E.f(fetchDemandSourceId);
                if (t.this.a1(eVar.toString())) {
                    t.this.f34026x.b(eVar, fetchDemandSourceId);
                }
            } else {
                h6.e eVar2 = h6.e.OfferWall;
                if (eVar2.toString().equalsIgnoreCase(d10)) {
                    intent.putExtra(o2.h.f33360m, eVar2.toString());
                    t.this.E.a(eVar2.ordinal());
                } else {
                    h6.e eVar3 = h6.e.Interstitial;
                    if (eVar3.toString().equalsIgnoreCase(d10)) {
                        if ("application".equals(m10)) {
                            m10 = SDKUtils.translateRequestedOrientation(t.this.U.K(j10));
                        }
                        intent.putExtra(o2.h.f33360m, eVar3.toString());
                    }
                }
            }
            if (d11 != null) {
                intent.putExtra("adViewId", d11);
            }
            intent.putExtra(o2.h.f33387z0, c11);
            intent.setFlags(536870912);
            intent.putExtra(o2.h.f33378v, t.this.G);
            intent.putExtra(o2.h.A, m10);
            intent.putExtra(o2.h.B, I);
            t tVar = t.this;
            tVar.f34012j = new s(tVar.G0(d10), fetchDemandSourceId);
            j10.startActivity(intent);
        }

        boolean f(String str) {
            if (TextUtils.isEmpty(str) || str.contains("-1")) {
                return false;
            }
            try {
                JSONObject jSONObject = new JSONObject(str);
                if (jSONObject.getString("testerABGroup").isEmpty()) {
                    return false;
                }
                return !jSONObject.getString("testFriendlyName").isEmpty();
            } catch (JSONException e10) {
                e10.printStackTrace();
                return false;
            }
        }

        @JavascriptInterface
        public void fileSystemAPI(String str) {
            Logger.i(t.this.f34004b, "fileSystemAPI(" + str + ")");
            t.this.N(new a(str));
        }

        void g(String str) {
            t.this.N0(t.this.E(o2.g.f33304d, str, null, null));
        }

        @JavascriptInterface
        public void getApplicationInfo(String str) {
            Logger.i(t.this.f34004b, "getApplicationInfo(" + str + ")");
            String x02 = t.this.x0(str);
            String s02 = t.this.s0(str);
            hb hbVar = new hb(str);
            Object[] v02 = t.this.v0(hbVar.d(o2.h.f33360m), SDKUtils.fetchDemandSourceId(hbVar));
            String str2 = (String) v02[0];
            if (((Boolean) v02[1]).booleanValue()) {
                if (!TextUtils.isEmpty(s02)) {
                    x02 = s02;
                }
                x02 = null;
            }
            if (TextUtils.isEmpty(x02)) {
                return;
            }
            t.this.N0(t.this.E(x02, str2, o2.g.f33320m, o2.g.f33321n));
        }

        @JavascriptInterface
        public void getCachedFilesMap(String str) {
            t tVar;
            String str2;
            Logger.i(t.this.f34004b, "getCachedFilesMap(" + str + ")");
            String x02 = t.this.x0(str);
            if (TextUtils.isEmpty(x02)) {
                return;
            }
            hb hbVar = new hb(str);
            if (hbVar.a("path")) {
                String str3 = (String) hbVar.b("path");
                if (IronSourceStorageUtils.isPathExist(t.this.B, str3)) {
                    t.this.N0(t.this.E(x02, IronSourceStorageUtils.getCachedFilesMap(t.this.B, str3), o2.g.f33325r, o2.g.f33324q));
                    return;
                }
                tVar = t.this;
                str2 = o2.c.f33270v;
            } else {
                tVar = t.this;
                str2 = o2.c.f33269u;
            }
            tVar.Q(str, false, str2, null);
        }

        @JavascriptInterface
        public void getConnectivityInfo(String str) {
            String j02;
            Logger.i(t.this.f34004b, "getConnectivityInfo(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d(t.Y);
            String d11 = hbVar.d(t.f34002d0);
            JSONObject jSONObject = new JSONObject();
            if (t.this.Q != null) {
                jSONObject = t.this.Q.a(t.this.W.getContext());
            }
            if (jSONObject.length() > 0) {
                j02 = t.this.j0(d10, jSONObject.toString());
            } else {
                j02 = t.this.j0(d11, t.this.F("errMsg", o2.c.C, null, null, null, null, null, null, null, false));
            }
            t.this.N0(j02);
        }

        @JavascriptInterface
        public void getControllerConfig(String str) {
            Logger.i(t.this.f34004b, "getControllerConfig(" + str + ")");
            String d10 = new hb(str).d(t.Y);
            if (TextUtils.isEmpty(d10)) {
                return;
            }
            JSONObject controllerConfigAsJSONObject = SDKUtils.getControllerConfigAsJSONObject();
            i(controllerConfigAsJSONObject);
            t.this.N0(t.this.j0(d10, controllerConfigAsJSONObject.toString()));
        }

        @JavascriptInterface
        public void getDemandSourceState(String str) {
            String s02;
            Logger.i(t.this.f34004b, "getMediationState(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d("demandSourceName");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            String d11 = hbVar.d(o2.h.f33360m);
            if (d11 == null || d10 == null) {
                return;
            }
            try {
                h6.e productType = SDKUtils.getProductType(d11);
                if (productType != null) {
                    j3 a10 = t.this.H.a(productType, fetchDemandSourceId);
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put(o2.h.f33360m, d11);
                    jSONObject.put("demandSourceName", d10);
                    jSONObject.put("demandSourceId", fetchDemandSourceId);
                    if (a10 == null || a10.a(-1)) {
                        s02 = t.this.s0(str);
                    } else {
                        s02 = t.this.x0(str);
                        jSONObject.put("state", a10.j());
                    }
                    b(s02, jSONObject.toString());
                }
            } catch (Exception e10) {
                t.this.Q(str, false, e10.getMessage(), null);
                e10.printStackTrace();
            }
        }

        @JavascriptInterface
        public void getDeviceStatus(String str) {
            Logger.i(t.this.f34004b, "getDeviceStatus(" + str + ")");
            String x02 = t.this.x0(str);
            String s02 = t.this.s0(str);
            t tVar = t.this;
            Object[] u02 = tVar.u0(tVar.W.getContext());
            String str2 = (String) u02[0];
            if (((Boolean) u02[1]).booleanValue()) {
                if (!TextUtils.isEmpty(s02)) {
                    x02 = s02;
                }
                x02 = null;
            }
            if (TextUtils.isEmpty(x02)) {
                return;
            }
            t.this.N0(t.this.E(x02, str2, o2.g.f33318k, o2.g.f33319l));
        }

        @JavascriptInterface
        public void getDeviceVolume(String str) {
            Logger.i(t.this.f34004b, "getDeviceVolume(" + str + ")");
            try {
                Context context = t.this.W.getContext();
                float a10 = n3.b(context).a(context);
                hb hbVar = new hb(str);
                hbVar.b("deviceVolume", String.valueOf(a10));
                t.this.Q(hbVar.toString(), true, null, null);
            } catch (Exception e10) {
                e10.printStackTrace();
            }
        }

        @JavascriptInterface
        public void getInitSummery(String str) {
            Logger.i(t.this.f34004b, "getInitSummery(" + str + ")");
            hb hbVar = new hb(str);
            hbVar.a(o2.i.f33421q0, t.this.R);
            t.this.Q(hbVar.toString(), true, null, null);
        }

        @JavascriptInterface
        public void getOrientation(String str) {
            o6.a(gb.f31873z, new j6().a(b4.f31533x, str).a());
            String x02 = t.this.x0(str);
            String jSONObject = SDKUtils.getOrientation(t.this.W.getContext()).toString();
            if (TextUtils.isEmpty(x02)) {
                return;
            }
            t.this.N0(t.this.E(x02, jSONObject, o2.g.f33303c0, o2.g.f33305d0));
        }

        @JavascriptInterface
        public void getUserData(String str) {
            Logger.i(t.this.f34004b, "getUserData(" + str + ")");
            hb hbVar = new hb(str);
            if (!hbVar.a(o2.h.W)) {
                t.this.Q(str, false, o2.c.H, null);
                return;
            }
            String x02 = t.this.x0(str);
            String d10 = hbVar.d(o2.h.W);
            t.this.N0(t.this.j0(x02, t.this.F(d10, g8.e().a(d10), null, null, null, null, null, null, null, false)));
        }

        @JavascriptInterface
        public void iabTokenAPI(String str) {
            try {
                Logger.i(t.this.f34004b, "iabTokenAPI(" + str + ")");
                t.this.K.d(new hb(str).toString(), new e0());
            } catch (Exception e10) {
                e10.printStackTrace();
                Logger.i(t.this.f34004b, "iabTokenAPI failed with exception " + e10.getMessage());
            }
        }

        @JavascriptInterface
        public void initController(String str) {
            Logger.i(t.this.f34004b, "initController(" + str + ")");
            hb hbVar = new hb(str);
            CountDownTimer countDownTimer = t.this.f34015m;
            if (countDownTimer != null) {
                countDownTimer.cancel();
                t.this.f34015m = null;
            }
            if (hbVar.a(o2.h.f33368q)) {
                String d10 = hbVar.d(o2.h.f33368q);
                if (o2.h.f33372s.equalsIgnoreCase(d10)) {
                    t.this.f34011i = true;
                    t.this.P.g();
                    return;
                }
                if (o2.h.f33370r.equalsIgnoreCase(d10)) {
                    t.this.P.a();
                    return;
                }
                if (!o2.h.f33374t.equalsIgnoreCase(d10)) {
                    Logger.i(t.this.f34004b, "No STAGE mentioned! should not get here!");
                    return;
                }
                String d11 = hbVar.d("errMsg");
                t.this.P.b("controller js failed to initialize : " + d11);
            }
        }

        @JavascriptInterface
        public void omidAPI(String str) {
            t.this.m0(new a0(str));
        }

        @JavascriptInterface
        public void onAdWindowsClosed(String str) {
            Logger.i(t.this.f34004b, "onAdWindowsClosed(" + str + ")");
            t.this.E.a();
            t.this.E.f(null);
            t.this.f34012j = null;
            hb hbVar = new hb(str);
            String d10 = hbVar.d(o2.h.f33360m);
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            h6.e G0 = t.this.G0(d10);
            Log.d(t.this.f34005c, "onAdClosed() with type " + G0);
            if (t.this.a1(d10)) {
                t.this.I(G0, fetchDemandSourceId);
            }
        }

        @JavascriptInterface
        public void onCleanUpNonDisplayBannersSuccess(String str) {
            Logger.i(t.this.f34004b, "onCleanUpNonDisplayBannersSuccess() value=" + str);
        }

        @JavascriptInterface
        public void onGetApplicationInfoFail(String str) {
            Logger.i(t.this.f34004b, "onGetApplicationInfoFail(" + str + ")");
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.f33321n, str);
        }

        @JavascriptInterface
        public void onGetApplicationInfoSuccess(String str) {
            Logger.i(t.this.f34004b, "onGetApplicationInfoSuccess(" + str + ")");
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.f33320m, str);
        }

        @JavascriptInterface
        public void onGetCachedFilesMapFail(String str) {
            Logger.i(t.this.f34004b, "onGetCachedFilesMapFail(" + str + ")");
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.f33324q, str);
        }

        @JavascriptInterface
        public void onGetCachedFilesMapSuccess(String str) {
            Logger.i(t.this.f34004b, "onGetCachedFilesMapSuccess(" + str + ")");
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.f33325r, str);
        }

        @JavascriptInterface
        public void onGetDeviceStatusFail(String str) {
            Logger.i(t.this.f34004b, "onGetDeviceStatusFail(" + str + ")");
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.f33319l, str);
        }

        @JavascriptInterface
        public void onGetDeviceStatusSuccess(String str) {
            Logger.i(t.this.f34004b, "onGetDeviceStatusSuccess(" + str + ")");
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.f33318k, str);
        }

        @JavascriptInterface
        public void onGetUserCreditsFail(String str) {
            Logger.i(t.this.f34004b, "onGetUserCreditsFail(" + str + ")");
            String d10 = new hb(str).d("errMsg");
            if (t.this.a1(h6.e.OfferWall.toString())) {
                t.this.f0(new x(d10));
            }
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.f33311g0, str);
        }

        @JavascriptInterface
        public void onInitBannerFail(String str) {
            Logger.i(t.this.f34004b, "onInitBannerFail(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d("errMsg");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            if (TextUtils.isEmpty(fetchDemandSourceId)) {
                Logger.i(t.this.f34004b, "onInitBannerFail failed with no demand source");
                return;
            }
            k3 k3Var = t.this.H;
            h6.e eVar = h6.e.Banner;
            j3 a10 = k3Var.a(eVar, fetchDemandSourceId);
            if (a10 != null) {
                a10.b(3);
            }
            if (t.this.a1(eVar.toString())) {
                t.this.f0(new RunnableC0465t(d10, fetchDemandSourceId));
            }
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.S, str);
        }

        @JavascriptInterface
        public void onInitBannerSuccess(String str) {
            Logger.i(t.this.f34004b, "onInitBannerSuccess()");
            t.this.E0(o2.g.R, com.json.mediationsdk.metadata.a.f32682g);
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(new hb(str));
            if (TextUtils.isEmpty(fetchDemandSourceId)) {
                Logger.i(t.this.f34004b, "onInitBannerSuccess failed with no demand source");
            } else if (t.this.a1(h6.e.Banner.toString())) {
                t.this.f0(new s(fetchDemandSourceId));
            }
        }

        @JavascriptInterface
        public void onInitInterstitialFail(String str) {
            Logger.i(t.this.f34004b, "onInitInterstitialFail(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d("errMsg");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            if (TextUtils.isEmpty(fetchDemandSourceId)) {
                Logger.i(t.this.f34004b, "onInitInterstitialSuccess failed with no demand source");
                return;
            }
            k3 k3Var = t.this.H;
            h6.e eVar = h6.e.Interstitial;
            j3 a10 = k3Var.a(eVar, fetchDemandSourceId);
            if (a10 != null) {
                a10.b(3);
            }
            if (t.this.a1(eVar.toString())) {
                t.this.f0(new j(d10, fetchDemandSourceId));
            }
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.J, str);
        }

        @JavascriptInterface
        public void onInitInterstitialSuccess(String str) {
            Logger.i(t.this.f34004b, "onInitInterstitialSuccess()");
            t.this.E0(o2.g.I, com.json.mediationsdk.metadata.a.f32682g);
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(new hb(str));
            if (TextUtils.isEmpty(fetchDemandSourceId)) {
                Logger.i(t.this.f34004b, "onInitInterstitialSuccess failed with no demand source");
            } else if (t.this.a1(h6.e.Interstitial.toString())) {
                t.this.f0(new i(fetchDemandSourceId));
            }
        }

        @JavascriptInterface
        public void onInitOfferWallFail(String str) {
            Logger.i(t.this.f34004b, "onInitOfferWallFail(" + str + ")");
            t.this.E.a(false);
            String d10 = new hb(str).d("errMsg");
            if (t.this.E.l()) {
                t.this.E.b(false);
                if (t.this.a1(h6.e.OfferWall.toString())) {
                    t.this.f0(new n(d10));
                }
            }
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.B, str);
        }

        @JavascriptInterface
        public void onInitOfferWallSuccess(String str) {
            t.this.E0(o2.g.A, com.json.mediationsdk.metadata.a.f32682g);
            t.this.E.a(true);
            if (t.this.E.l()) {
                t.this.E.b(false);
                if (t.this.a1(h6.e.OfferWall.toString())) {
                    t.this.f0(new m());
                }
            }
        }

        @JavascriptInterface
        public void onInitRewardedVideoFail(String str) {
            Logger.i(t.this.f34004b, "onInitRewardedVideoFail(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d("errMsg");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            k3 k3Var = t.this.H;
            h6.e eVar = h6.e.RewardedVideo;
            j3 a10 = k3Var.a(eVar, fetchDemandSourceId);
            if (a10 != null) {
                a10.b(3);
            }
            if (t.this.a1(eVar.toString())) {
                t.this.f0(new b(d10, fetchDemandSourceId));
            }
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.f33310g, str);
        }

        @JavascriptInterface
        public void onLoadBannerFail(String str) {
            Logger.i(t.this.f34004b, "onLoadBannerFail()");
            hb hbVar = new hb(str);
            String d10 = hbVar.d("errMsg");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            t.this.Q(str, true, null, null);
            if (!TextUtils.isEmpty(fetchDemandSourceId) && t.this.a1(h6.e.Banner.toString())) {
                t.this.f0(new v(d10, fetchDemandSourceId));
            }
        }

        @JavascriptInterface
        public void onLoadBannerSuccess(String str) {
            Logger.i(t.this.f34004b, "onLoadBannerSuccess()");
            hb hbVar = new hb(str);
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            String d10 = hbVar.d("adViewId");
            t.this.Q(str, true, null, null);
            y6 a10 = g6.a().a(d10);
            if (a10 == null) {
                t.this.A.a(fetchDemandSourceId, "not found view for the current adViewId= " + d10);
                return;
            }
            if (a10 instanceof a6) {
                a6 a6Var = (a6) a10;
                if (t.this.a1(h6.e.Banner.toString())) {
                    t.this.f0(new RunnableC0466u(fetchDemandSourceId, a6Var));
                }
            }
        }

        @JavascriptInterface
        public void onLoadInterstitialFail(String str) {
            Logger.i(t.this.f34004b, "onLoadInterstitialFail(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d("errMsg");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            t.this.Q(str, true, null, null);
            if (TextUtils.isEmpty(fetchDemandSourceId)) {
                return;
            }
            c(fetchDemandSourceId, false);
            if (t.this.a1(h6.e.Interstitial.toString())) {
                t.this.f0(new q(d10, fetchDemandSourceId));
            }
            t.this.E0(o2.g.M, com.json.mediationsdk.metadata.a.f32682g);
        }

        @JavascriptInterface
        public void onLoadInterstitialSuccess(String str) {
            Logger.i(t.this.f34004b, "onLoadInterstitialSuccess(" + str + ")");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(new hb(str));
            c(fetchDemandSourceId, true);
            t.this.Q(str, true, null, null);
            if (t.this.a1(h6.e.Interstitial.toString())) {
                t.this.f0(new p(fetchDemandSourceId));
            }
            t.this.E0(o2.g.L, com.json.mediationsdk.metadata.a.f32682g);
        }

        @JavascriptInterface
        public void onOfferWallGeneric(String str) {
            Logger.i(t.this.f34004b, "onOfferWallGeneric(" + str + ")");
        }

        @JavascriptInterface
        public void onReceivedMessage(String str) {
            Logger.i(t.this.f34004b, "onReceivedMessage(" + str + ")");
            q5.f33580a.a(new w(str));
        }

        @JavascriptInterface
        public void onShowInterstitialFail(String str) {
            Logger.i(t.this.f34004b, "onShowInterstitialFail(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d("errMsg");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            t.this.Q(str, true, null, null);
            if (TextUtils.isEmpty(fetchDemandSourceId)) {
                return;
            }
            c(fetchDemandSourceId, false);
            if (t.this.a1(h6.e.Interstitial.toString())) {
                t.this.f0(new r(d10, fetchDemandSourceId));
            }
            t.this.E0(o2.g.P, str);
        }

        @JavascriptInterface
        public void onShowInterstitialSuccess(String str) {
            Logger.i(t.this.f34004b, "onShowInterstitialSuccess(" + str + ")");
            t.this.Q(str, true, null, null);
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(new hb(str));
            if (TextUtils.isEmpty(fetchDemandSourceId)) {
                Logger.i(t.this.f34004b, "onShowInterstitialSuccess called with no demand");
                return;
            }
            f0 f0Var = t.this.E;
            h6.e eVar = h6.e.Interstitial;
            f0Var.a(eVar.ordinal());
            t.this.E.f(fetchDemandSourceId);
            if (t.this.a1(eVar.toString())) {
                t.this.f0(new l(fetchDemandSourceId));
                t.this.E0(o2.g.O, str);
            }
            c(fetchDemandSourceId, false);
        }

        @JavascriptInterface
        public void onShowOfferWallFail(String str) {
            Logger.i(t.this.f34004b, "onShowOfferWallFail(" + str + ")");
            String d10 = new hb(str).d("errMsg");
            if (t.this.a1(h6.e.OfferWall.toString())) {
                t.this.f0(new h(d10));
            }
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.F, str);
        }

        @JavascriptInterface
        public void onShowOfferWallSuccess(String str) {
            Logger.i(t.this.f34004b, "onShowOfferWallSuccess(" + str + ")");
            f0 f0Var = t.this.E;
            h6.e eVar = h6.e.OfferWall;
            f0Var.a(eVar.ordinal());
            String valueFromJsonObject = SDKUtils.getValueFromJsonObject(str, o2.f33215i);
            if (t.this.a1(eVar.toString())) {
                t.this.f0(new f(valueFromJsonObject));
            }
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.E, str);
        }

        @JavascriptInterface
        public void onShowRewardedVideoFail(String str) {
            Logger.i(t.this.f34004b, "onShowRewardedVideoFail(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d("errMsg");
            String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
            if (t.this.a1(h6.e.RewardedVideo.toString())) {
                t.this.f0(new d(d10, fetchDemandSourceId));
            }
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.f33316j, str);
        }

        @JavascriptInterface
        public void onShowRewardedVideoSuccess(String str) {
            Logger.i(t.this.f34004b, "onShowRewardedVideoSuccess(" + str + ")");
            t.this.Q(str, true, null, null);
            t.this.E0(o2.g.f33314i, str);
        }

        @JavascriptInterface
        public void onVideoStatusChanged(String str) {
            Log.d(t.this.f34004b, "onVideoStatusChanged(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d(o2.h.f33360m);
            if (t.this.D == null || TextUtils.isEmpty(d10)) {
                return;
            }
            String d11 = hbVar.d("status");
            if (o2.h.f33345e0.equalsIgnoreCase(d11)) {
                t.this.D.onVideoStarted();
                return;
            }
            if (o2.h.f33347f0.equalsIgnoreCase(d11)) {
                t.this.D.onVideoPaused();
                return;
            }
            if (o2.h.f33349g0.equalsIgnoreCase(d11)) {
                t.this.D.onVideoResumed();
                return;
            }
            if (o2.h.f33351h0.equalsIgnoreCase(d11)) {
                t.this.D.onVideoEnded();
                return;
            }
            if (o2.h.f33353i0.equalsIgnoreCase(d11)) {
                t.this.D.onVideoStopped();
                return;
            }
            Logger.i(t.this.f34004b, "onVideoStatusChanged: unknown status: " + d11);
        }

        @JavascriptInterface
        public void openUrl(String str) {
            char c10;
            Logger.i(t.this.f34004b, "openUrl(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d("url");
            String d11 = hbVar.d("method");
            String d12 = hbVar.d("package_name");
            try {
                Context j10 = t.this.j();
                String lowerCase = d11.toLowerCase();
                int hashCode = lowerCase.hashCode();
                if (hashCode == -1455867212) {
                    if (lowerCase.equals(o2.h.J)) {
                        c10 = 0;
                        if (c10 != 0) {
                        }
                        t.this.Q(str, true, null, null);
                    }
                    c10 = 65535;
                    if (c10 != 0) {
                    }
                    t.this.Q(str, true, null, null);
                }
                if (hashCode == 109770977) {
                    if (lowerCase.equals(o2.h.U)) {
                        c10 = 2;
                        if (c10 != 0) {
                        }
                        t.this.Q(str, true, null, null);
                    }
                    c10 = 65535;
                    if (c10 != 0) {
                    }
                    t.this.Q(str, true, null, null);
                }
                if (hashCode == 1224424441 && lowerCase.equals(o2.h.K)) {
                    c10 = 1;
                    if (c10 != 0) {
                        wc.a(j10, d10, d12);
                    } else if (c10 == 1) {
                        Intent intent = new Intent(j10, (Class<?>) OpenUrlActivity.class);
                        intent.putExtra(t.f34000b0, d10);
                        intent.putExtra(t.f34001c0, true);
                        intent.putExtra(o2.h.f33378v, t.this.G);
                        j10.startActivity(intent);
                    } else {
                        if (c10 != 2) {
                            t.this.Q(str, false, "method " + d11 + " is unsupported", null);
                            return;
                        }
                        Intent intent2 = new Intent(j10, (Class<?>) OpenUrlActivity.class);
                        intent2.putExtra(t.f34000b0, d10);
                        intent2.putExtra(t.f33999a0, true);
                        intent2.putExtra(t.f34001c0, true);
                        j10.startActivity(intent2);
                    }
                    t.this.Q(str, true, null, null);
                }
                c10 = 65535;
                if (c10 != 0) {
                }
                t.this.Q(str, true, null, null);
            } catch (Exception e10) {
                t.this.Q(str, false, e10.getMessage(), null);
                e10.printStackTrace();
            }
        }

        @JavascriptInterface
        public void pauseControllerWebview() {
            t.this.m0(new z());
        }

        @JavascriptInterface
        public void permissionsAPI(String str) {
            try {
                Logger.i(t.this.f34004b, "permissionsAPI(" + str + ")");
                t.this.J.b(new hb(str).toString(), new e0());
            } catch (Exception e10) {
                e10.printStackTrace();
                Logger.i(t.this.f34004b, "permissionsAPI failed with exception " + e10.getMessage());
            }
        }

        @JavascriptInterface
        public void postAdEventNotification(String str) {
            try {
                Logger.i(t.this.f34004b, "postAdEventNotification(" + str + ")");
                hb hbVar = new hb(str);
                String d10 = hbVar.d(o2.h.f33357k0);
                if (TextUtils.isEmpty(d10)) {
                    t.this.Q(str, false, o2.c.f33273y, null);
                    return;
                }
                String d11 = hbVar.d(o2.h.f33359l0);
                String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(hbVar);
                String str2 = !TextUtils.isEmpty(fetchDemandSourceId) ? fetchDemandSourceId : d11;
                JSONObject jSONObject = (JSONObject) hbVar.b(o2.h.f33361m0);
                String d12 = hbVar.d(o2.h.f33360m);
                h6.e G0 = t.this.G0(d12);
                if (!t.this.a1(d12)) {
                    t.this.Q(str, false, o2.c.f33272x, null);
                    return;
                }
                String x02 = t.this.x0(str);
                if (!TextUtils.isEmpty(x02)) {
                    t.this.N0(t.this.E(x02, t.this.F(o2.h.f33360m, d12, o2.h.f33357k0, d10, "demandSourceName", d11, "demandSourceId", str2, null, false), o2.g.f33313h0, o2.g.f33315i0));
                }
                t.this.f0(new y(G0, str2, d10, jSONObject));
            } catch (Exception e10) {
                e10.printStackTrace();
            }
        }

        @JavascriptInterface
        public void removeCloseEventHandler(String str) {
            Logger.i(t.this.f34004b, "removeCloseEventHandler(" + str + ")");
            if (t.this.f34014l != null) {
                t.this.f34014l.cancel();
            }
            t.this.f34013k = true;
        }

        @JavascriptInterface
        public void removeMessagingInterface(String str) {
            t.this.m0(new b0());
        }

        @JavascriptInterface
        public void requestToDestroyBanner(String str) {
            Logger.i(t.this.f34004b, "onCleanUpNonDisplayBannersFail() value=" + str);
        }

        @JavascriptInterface
        public void resumeControllerWebview() {
            t.this.m0(new o());
        }

        @JavascriptInterface
        public void saveFile(String str) {
            try {
                Logger.i(t.this.f34004b, "saveFile(" + str + ")");
                hb hbVar = new hb(str);
                String d10 = hbVar.d("path");
                String d11 = hbVar.d(o2.h.f33338b);
                if (TextUtils.isEmpty(d11)) {
                    t.this.Q(str, false, o2.c.f33255g, "1");
                    return;
                }
                q6 q6Var = new q6(IronSourceStorageUtils.buildAbsolutePathToDirInCache(t.this.B, d10), SDKUtils.getFileName(d11));
                IronSourceStorageUtils.ensurePathSafety(q6Var, t.this.B);
                if (t.this.U.a(t.this.B) <= 0) {
                    t.this.Q(str, false, p2.A, null);
                    return;
                }
                if (!SDKUtils.isExternalStorageAvailable()) {
                    t.this.Q(str, false, p2.B, null);
                    return;
                }
                if (q6Var.exists()) {
                    t.this.Q(str, false, p2.f33500z, null);
                    return;
                }
                if (!k2.g(t.this.W.getContext())) {
                    t.this.Q(str, false, p2.C, null);
                    return;
                }
                t.this.Q(str, true, null, null);
                t.this.f34010h.a(q6Var, d11, hbVar.a("connectionTimeout", 0), hbVar.a("readTimeout", 0));
            } catch (Exception e10) {
                t.this.Q(str, false, e10.getMessage(), null);
                e10.printStackTrace();
            }
        }

        @JavascriptInterface
        public void setBackButtonState(String str) {
            Logger.i(t.this.f34004b, "setBackButtonState(" + str + ")");
            g8.e().c(new hb(str).d("state"));
        }

        @JavascriptInterface
        public void setForceClose(String str) {
            Logger.i(t.this.f34004b, "setForceClose(" + str + ")");
            hb hbVar = new hb(str);
            String d10 = hbVar.d("width");
            String d11 = hbVar.d("height");
            t.this.f34016n = Integer.parseInt(d10);
            t.this.f34017o = Integer.parseInt(d11);
            t.this.f34018p = hbVar.d(o2.h.L);
        }

        @JavascriptInterface
        public void setMixedContentAlwaysAllow(String str) {
            Logger.i(t.this.f34004b, "setMixedContentAlwaysAllow(" + str + ")");
            t.this.m0(new c0());
        }

        @JavascriptInterface
        public void setOrientation(String str) {
            try {
                Logger.i(t.this.f34004b, "setOrientation(" + str + ")");
                String d10 = new hb(str).d("orientation");
                t.this.n(d10);
                if (t.this.X != null) {
                    t.this.X.onOrientationChanged(d10, t.this.U.I(t.this.W.getContext()));
                }
            } catch (Exception e10) {
                e10.printStackTrace();
            }
        }

        @JavascriptInterface
        public void setStoreSearchKeys(String str) {
            Logger.i(t.this.f34004b, "setStoreSearchKeys(" + str + ")");
            g8.e().e(str);
        }

        @JavascriptInterface
        public void setTouchListener(String str) {
            Logger.i(t.this.f34004b, "removeCloseEventHandler(" + str + ")");
            t.this.m0(new g());
        }

        @JavascriptInterface
        public void setUserData(String str) {
            Logger.i(t.this.f34004b, "setUserData(" + str + ")");
            hb hbVar = new hb(str);
            if (!hbVar.a(o2.h.W)) {
                t.this.Q(str, false, o2.c.H, null);
                return;
            }
            if (!hbVar.a("value")) {
                t.this.Q(str, false, o2.c.I, null);
                return;
            }
            String d10 = hbVar.d(o2.h.W);
            String d11 = hbVar.d("value");
            g8.e().a(d10, d11);
            t.this.N0(t.this.j0(t.this.x0(str), t.this.F(d10, d11, null, null, null, null, null, null, null, false)));
        }

        @JavascriptInterface
        public void setWebviewBackgroundColor(String str) {
            Logger.i(t.this.f34004b, "setWebviewBackgroundColor(" + str + ")");
            t.this.Y0(str);
        }
    }

    private interface v {
        void a(String str, h6.e eVar, j3 j3Var);
    }

    static class w {

        String f34144a;

        String f34145b;

        w() {
        }
    }

    public enum x {
        Display,
        Gone
    }

    private class y implements View.OnTouchListener {

        class a extends CountDownTimer {
            a(long j10, long j11) {
                super(j10, j11);
            }

            @Override
            public void onFinish() {
                Logger.i(t.this.f34004b, "Close Event Timer Finish");
                if (t.this.f34013k) {
                    t.this.f34013k = false;
                } else {
                    t.this.c(o2.h.f33352i);
                }
            }

            @Override
            public void onTick(long j10) {
                Logger.i(t.this.f34004b, "Close Event Timer Tick " + j10);
            }
        }

        private y() {
        }

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (motionEvent.getAction() == 1) {
                float x10 = motionEvent.getX();
                float y10 = motionEvent.getY();
                String str = t.this.f34004b;
                StringBuilder sb2 = new StringBuilder();
                sb2.append("X:");
                int i10 = (int) x10;
                sb2.append(i10);
                sb2.append(" Y:");
                int i11 = (int) y10;
                sb2.append(i11);
                Logger.i(str, sb2.toString());
                int r10 = t.this.U.r();
                int a10 = t.this.U.a();
                Logger.i(t.this.f34004b, "Width:" + r10 + " Height:" + a10);
                int dpToPx = SDKUtils.dpToPx((long) t.this.f34016n);
                int dpToPx2 = SDKUtils.dpToPx((long) t.this.f34017o);
                if ("top-right".equalsIgnoreCase(t.this.f34018p)) {
                    i10 = r10 - i10;
                } else if (!o2.e.f33290c.equalsIgnoreCase(t.this.f34018p)) {
                    if (o2.e.f33291d.equalsIgnoreCase(t.this.f34018p)) {
                        i10 = r10 - i10;
                    } else if (!o2.e.f33292e.equalsIgnoreCase(t.this.f34018p)) {
                        i10 = 0;
                        i11 = 0;
                    }
                    i11 = a10 - i11;
                }
                if (i10 <= dpToPx && i11 <= dpToPx2) {
                    t.this.f34013k = false;
                    if (t.this.f34014l != null) {
                        t.this.f34014l.cancel();
                    }
                    t.this.f34014l = new a(AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS, 500L).start();
                }
            }
            return false;
        }

        y(t tVar, i iVar) {
            this();
        }
    }

    private class z extends WebViewClient {
        private z() {
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            Logger.i("onPageFinished", str);
            if (str.contains("adUnit") || str.contains("index.html")) {
                t.this.t();
            }
            super.onPageFinished(webView, str);
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            Logger.i("onPageStarted", str);
            super.onPageStarted(webView, str, bitmap);
        }

        @Override
        public void onReceivedError(WebView webView, int i10, String str, String str2) {
            Logger.i("onReceivedError", str2 + " " + str);
            if (str2.contains(o2.f33213g) && t.this.P != null) {
                t.this.P.b("controller html - web-view receivedError on loading - " + str + " (errorCode: " + i10 + ")");
            }
            super.onReceivedError(webView, i10, str, str2);
        }

        @Override
        @TargetApi(26)
        public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
            boolean didCrash;
            boolean didCrash2;
            String str = t.this.f34004b;
            StringBuilder sb2 = new StringBuilder();
            sb2.append("Chromium process crashed - detail.didCrash(): ");
            didCrash = renderProcessGoneDetail.didCrash();
            sb2.append(didCrash);
            Log.e(str, sb2.toString());
            didCrash2 = renderProcessGoneDetail.didCrash();
            String str2 = didCrash2 ? "Render process was observed to crash" : "Render process was killed by the system";
            if (t.this.P != null) {
                t.this.P.c(str2);
            }
            t.this.p();
            return true;
        }

        @Override
        public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
            boolean z10;
            Logger.i("shouldInterceptRequest", str);
            try {
                z10 = new URL(str).getFile().contains("mraid.js");
            } catch (MalformedURLException unused) {
                z10 = false;
            }
            if (z10) {
                String str2 = com.vungle.ads.internal.model.b.FILE_SCHEME + t.this.B + File.separator + "mraid.js";
                try {
                    new FileInputStream(new File(str2));
                    return new WebResourceResponse("text/javascript", "UTF-8", getClass().getResourceAsStream(str2));
                } catch (FileNotFoundException unused2) {
                }
            }
            return super.shouldInterceptRequest(webView, str);
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            Logger.i("shouldOverrideUrlLoading", str);
            try {
                if (t.this.h(str)) {
                    t.this.s();
                    return true;
                }
            } catch (Exception e10) {
                e10.printStackTrace();
            }
            return super.shouldOverrideUrlLoading(webView, str);
        }

        z(t tVar, i iVar) {
            this();
        }
    }

    public t(Context context, k3 k3Var, q2 q2Var, com.json.sdk.controller.c cVar, q5 q5Var, int i10, s3 s3Var, String str, k.a aVar, k.b bVar, String str2, String str3) throws Throwable {
        i8 i8Var = new i8(context, new s8.a());
        this.W = i8Var;
        Logger.i(this.f34004b, "C'tor");
        this.V = q2Var;
        this.P = cVar;
        this.f34003a = q5Var;
        this.H = k3Var;
        G(context, i8Var);
        this.B = str;
        this.E = new f0();
        this.R = new JSONObject();
        this.f34010h = s3Var;
        s3Var.a(this);
        this.S = aVar;
        this.T = bVar;
        this.C = new com.json.sdk.controller.d(SDKUtils.getNetworkConfiguration(), this.B, SDKUtils.getControllerUrl(), s3Var);
        i iVar = null;
        r rVar = new r(this, iVar);
        this.f34019q = rVar;
        i8Var.setWebViewClient(new z(this, iVar));
        i8Var.setWebChromeClient(rVar);
        od.a(i8Var);
        H(i8Var);
        i8Var.setDownloadListener(this);
        this.Q = h0(context);
        b(context);
        c(i10);
        this.f34007e = str2;
        this.f34008f = str3;
    }

    private String A(h6.e eVar, JSONObject jSONObject) {
        HashMap hashMap = new HashMap();
        hashMap.put("sessionDepth", Integer.toString(jSONObject.optInt("sessionDepth")));
        String optString = jSONObject.optString("demandSourceName");
        String fetchDemandSourceId = SDKUtils.fetchDemandSourceId(jSONObject);
        j3 a10 = this.H.a(eVar, fetchDemandSourceId);
        if (a10 != null) {
            if (a10.g() != null) {
                hashMap.putAll(a10.g());
            }
            if (!TextUtils.isEmpty(optString)) {
                hashMap.put("demandSourceName", optString);
            }
            if (!TextUtils.isEmpty(fetchDemandSourceId)) {
                hashMap.put("demandSourceId", fetchDemandSourceId);
            }
        }
        Map d02 = d0(eVar);
        if (d02 != null) {
            hashMap.putAll(d02);
        }
        String flatMapToJsonAsString = SDKUtils.flatMapToJsonAsString(hashMap);
        o2.g b10 = o2.g.b(eVar);
        return E(b10.f33334a, flatMapToJsonAsString, b10.f33335b, b10.f33336c);
    }

    private String B0(String str) {
        return new l.a(str).a();
    }

    public void C0(Context context) {
        try {
            i2 i2Var = this.Q;
            if (i2Var == null) {
                return;
            }
            i2Var.c(context);
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public String E(String str, String str2, String str3, String str4) {
        return new l.a(str, str2, str3, str4).a();
    }

    public void E0(String str, String str2) {
        String d10 = new hb(str2).d("errMsg");
        if (TextUtils.isEmpty(d10)) {
            return;
        }
        m0(new e(str, d10));
    }

    public String F(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, boolean z10) {
        JSONObject jSONObject = new JSONObject();
        try {
            if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2)) {
                jSONObject.put(str, SDKUtils.encodeString(str2));
            }
            if (!TextUtils.isEmpty(str3) && !TextUtils.isEmpty(str4)) {
                jSONObject.put(str3, SDKUtils.encodeString(str4));
            }
            if (!TextUtils.isEmpty(str5) && !TextUtils.isEmpty(str6)) {
                jSONObject.put(str5, SDKUtils.encodeString(str6));
            }
            if (!TextUtils.isEmpty(str7) && !TextUtils.isEmpty(str8)) {
                jSONObject.put(str7, SDKUtils.encodeString(str8));
            }
            if (!TextUtils.isEmpty(str9)) {
                jSONObject.put(str9, z10);
            }
        } catch (JSONException e10) {
            e10.printStackTrace();
        }
        return jSONObject.toString();
    }

    private void G(Context context, WebView webView) {
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
        this.f34023u = new FrameLayout(context);
        this.f34021s = new FrameLayout(context);
        this.f34021s.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
        this.f34021s.setVisibility(8);
        FrameLayout frameLayout = new FrameLayout(context);
        frameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
        frameLayout.addView(webView);
        this.f34023u.addView(this.f34021s, layoutParams);
        this.f34023u.addView(frameLayout);
    }

    public h6.e G0(String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        h6.e eVar = h6.e.Interstitial;
        if (str.equalsIgnoreCase(eVar.toString())) {
            return eVar;
        }
        h6.e eVar2 = h6.e.RewardedVideo;
        if (str.equalsIgnoreCase(eVar2.toString())) {
            return eVar2;
        }
        h6.e eVar3 = h6.e.OfferWall;
        if (str.equalsIgnoreCase(eVar3.toString())) {
            return eVar3;
        }
        h6.e eVar4 = h6.e.Banner;
        if (str.equalsIgnoreCase(eVar4.toString())) {
            return eVar4;
        }
        return null;
    }

    private void H(WebView webView) {
        com.json.sdk.controller.q qVar = new com.json.sdk.controller.q(com.json.sdk.controller.q.a());
        webView.addJavascriptInterface(t(qVar), o2.f33211e);
        webView.addJavascriptInterface(Y(qVar), o2.f33212f);
    }

    private void J(j3 j3Var, Map map) {
        Map<String, String> mergeHashMaps = SDKUtils.mergeHashMaps(new Map[]{map, j3Var.b()});
        this.E.d(j3Var.h(), true);
        N0(E(o2.g.K, SDKUtils.flatMapToJsonAsString(mergeHashMaps), o2.g.L, o2.g.M));
    }

    public void K0() {
        ha haVar = this.X;
        if (haVar != null) {
            haVar.onCloseRequested();
        }
    }

    public void N0(final String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        m0(new Runnable() {
            @Override
            public final void run() {
                t.this.P0(str);
            }
        });
    }

    public void O(String str, h6.e eVar, j3 j3Var) {
        if (a1(eVar.toString())) {
            f0(new a(eVar, j3Var, str));
        }
    }

    private void P(String str, h6.e eVar, j3 j3Var, v vVar) {
        if (TextUtils.isEmpty(str)) {
            vVar.a("Application key are missing", eVar, j3Var);
        } else {
            N0(v(eVar, j3Var).f34145b);
        }
    }

    public void P0(String str) {
        this.W.a(new l.b(str, k()).a());
    }

    public void Q(String str, boolean z10, String str2, String str3) {
        hb hbVar = new hb(str);
        String d10 = hbVar.d(Y);
        String d11 = hbVar.d(f34002d0);
        if (!z10) {
            if (!TextUtils.isEmpty(d11)) {
                d10 = d11;
            }
            d10 = null;
        }
        if (TextUtils.isEmpty(d10)) {
            return;
        }
        if (!TextUtils.isEmpty(str2)) {
            try {
                str = new JSONObject(str).put("errMsg", str2).toString();
            } catch (JSONException unused) {
            }
        }
        if (!TextUtils.isEmpty(str3)) {
            try {
                str = new JSONObject(str).put(o2.h.f33348g, str3).toString();
            } catch (JSONException unused2) {
            }
        }
        N0(j0(d10, str));
    }

    public void R(JSONObject jSONObject, WebView webView) {
        if (jSONObject.optBoolean("inspectWebview")) {
            WebView.setWebContentsDebuggingEnabled(true);
        }
    }

    public void S0(String str) {
        try {
            Logger.i(this.f34004b, "load(): " + str);
            this.W.loadUrl(str);
        } catch (Throwable th) {
            Logger.e(this.f34004b, "WebViewController::load: " + th);
        }
    }

    private void V0(String str) {
        WebSettings settings;
        int i10;
        if (str.equalsIgnoreCase(MBridgeConstans.ENDCARD_URL_TYPE_PL)) {
            settings = this.W.getSettings();
            i10 = 2;
        } else {
            settings = this.W.getSettings();
            i10 = -1;
        }
        settings.setCacheMode(i10);
    }

    public void Y0(String str) {
        WebView webView;
        hb hbVar = new hb(str);
        String d10 = hbVar.d("color");
        String d11 = hbVar.d("adViewId");
        int parseColor = !o2.h.T.equalsIgnoreCase(d10) ? Color.parseColor(d10) : 0;
        if (d11 != null) {
            webView = g6.a().a(d11).getPresentingView();
            if (webView == null) {
                return;
            }
        } else {
            webView = this.W;
        }
        webView.setBackgroundColor(parseColor);
    }

    public boolean a1(String str) {
        boolean z10 = false;
        if (TextUtils.isEmpty(str)) {
            Logger.d(this.f34004b, "Trying to trigger a listener - no product was found");
            return false;
        }
        if (!str.equalsIgnoreCase(h6.e.Interstitial.toString()) ? !str.equalsIgnoreCase(h6.e.RewardedVideo.toString()) ? !str.equalsIgnoreCase(h6.e.Banner.toString()) ? (str.equalsIgnoreCase(h6.e.OfferWall.toString()) || str.equalsIgnoreCase(h6.e.OfferWallCredits.toString())) && this.f34028z != null : this.A != null : this.f34026x != null : this.f34027y != null) {
            z10 = true;
        }
        if (!z10) {
            Logger.d(this.f34004b, "Trying to trigger a listener - no listener was found for product " + str);
        }
        return z10;
    }

    private String b0(String str) {
        String str2 = this.B + File.separator;
        return str.contains(str2) ? str.substring(str2.length()) : str;
    }

    private String c0(String str, String str2, String str3) {
        return new l.a(str, null, str2, str3).a();
    }

    private Map d0(h6.e eVar) {
        if (eVar == h6.e.OfferWall) {
            return this.f34009g;
        }
        return null;
    }

    private i2 h0(Context context) {
        return new i(SDKUtils.getControllerConfigAsJSONObject(), context);
    }

    public String j0(String str, String str2) {
        return new l.a(str, str2).a();
    }

    private void n0(JSONObject jSONObject) {
        jSONObject.put(SDKUtils.encodeString("gpi"), ja.d(this.W.getContext()));
    }

    public String s0(String str) {
        return new hb(str).d(f34002d0);
    }

    private String t0(JSONObject jSONObject) {
        n3 b10 = n3.b(this.W.getContext());
        StringBuilder sb2 = new StringBuilder();
        String sDKVersion = SDKUtils.getSDKVersion();
        if (!TextUtils.isEmpty(sDKVersion)) {
            sb2.append("SDKVersion");
            sb2.append(o2.i.f33390b);
            sb2.append(sDKVersion);
            sb2.append(o2.i.f33392c);
        }
        String e10 = b10.e();
        if (!TextUtils.isEmpty(e10)) {
            sb2.append("deviceOs");
            sb2.append(o2.i.f33390b);
            sb2.append(e10);
        }
        Uri parse = Uri.parse(SDKUtils.getControllerUrl());
        if (parse != null) {
            String str = parse.getScheme() + ":";
            String host = parse.getHost();
            int port = parse.getPort();
            if (port != -1) {
                host = host + ":" + port;
            }
            sb2.append(o2.i.f33392c);
            sb2.append("protocol");
            sb2.append(o2.i.f33390b);
            sb2.append(str);
            sb2.append(o2.i.f33392c);
            sb2.append(o2.i.C);
            sb2.append(o2.i.f33390b);
            sb2.append(host);
            if (jSONObject.keys().hasNext()) {
                try {
                    String jSONObject2 = new JSONObject(jSONObject, new String[]{o2.i.Y, "applicationKey"}).toString();
                    if (!TextUtils.isEmpty(jSONObject2)) {
                        sb2.append(o2.i.f33392c);
                        sb2.append(o2.i.M);
                        sb2.append(o2.i.f33390b);
                        sb2.append(jSONObject2);
                    }
                } catch (JSONException e11) {
                    e11.printStackTrace();
                }
            }
            sb2.append(o2.i.f33392c);
            sb2.append("debug");
            sb2.append(o2.i.f33390b);
            sb2.append(k());
        }
        return sb2.toString();
    }

    public Object[] u0(Context context) {
        boolean z10;
        n3 b10 = n3.b(context);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("appOrientation", "none");
            jSONObject.put(o2.i.f33430z, SDKUtils.translateDeviceOrientation(this.U.E(context)));
            String d10 = b10.d();
            if (d10 != null) {
                jSONObject.put(SDKUtils.encodeString("deviceOEM"), SDKUtils.encodeString(d10));
            }
            String c10 = b10.c();
            if (c10 != null) {
                jSONObject.put(SDKUtils.encodeString("deviceModel"), SDKUtils.encodeString(c10));
                z10 = false;
            } else {
                z10 = true;
            }
            try {
                SDKUtils.loadGoogleAdvertiserInfo(context);
                String advertiserId = SDKUtils.getAdvertiserId();
                if (!TextUtils.isEmpty(advertiserId)) {
                    Logger.i(this.f34004b, "add AID");
                    jSONObject.put("deviceIds" + o2.i.f33394d + "AID" + o2.i.f33396e, SDKUtils.encodeString(advertiserId));
                }
                String limitAdTracking = SDKUtils.getLimitAdTracking();
                if (!TextUtils.isEmpty(limitAdTracking)) {
                    Logger.i(this.f34004b, "add LAT");
                    jSONObject.put("isLimitAdTrackingEnabled", Boolean.parseBoolean(limitAdTracking));
                }
                String e10 = b10.e();
                if (e10 != null) {
                    jSONObject.put(SDKUtils.encodeString("deviceOs"), SDKUtils.encodeString(e10));
                } else {
                    z10 = true;
                }
                String f10 = b10.f();
                if (f10 != null) {
                    jSONObject.put(SDKUtils.encodeString("deviceOSVersion"), f10.replaceAll("[^0-9/.]", ""));
                } else {
                    z10 = true;
                }
                String f11 = b10.f();
                if (f11 != null) {
                    jSONObject.put(SDKUtils.encodeString("deviceOSVersionFull"), SDKUtils.encodeString(f11));
                }
                String valueOf = String.valueOf(b10.a());
                if (valueOf != null) {
                    jSONObject.put(SDKUtils.encodeString("deviceApiLevel"), valueOf);
                } else {
                    z10 = true;
                }
                jSONObject.put(v4.V, String.valueOf(com.json.o.a()));
                String sDKVersion = SDKUtils.getSDKVersion();
                if (sDKVersion != null) {
                    jSONObject.put(SDKUtils.encodeString("SDKVersion"), SDKUtils.encodeString(sDKVersion));
                }
                if (b10.b() != null && b10.b().length() > 0) {
                    jSONObject.put(SDKUtils.encodeString("mobileCarrier"), SDKUtils.encodeString(b10.b()));
                }
                String b11 = l2.b(context);
                if (b11.equals("none")) {
                    z10 = true;
                } else {
                    jSONObject.put(SDKUtils.encodeString("connectionType"), SDKUtils.encodeString(b11));
                }
                if (Build.VERSION.SDK_INT >= 23) {
                    jSONObject.put(SDKUtils.encodeString("hasVPN"), l2.d(context));
                }
                jSONObject.put("uxt", IronSourceStorageUtils.isUxt());
                String language = context.getResources().getConfiguration().locale.getLanguage();
                if (!TextUtils.isEmpty(language)) {
                    jSONObject.put(SDKUtils.encodeString("deviceLanguage"), SDKUtils.encodeString(language.toUpperCase()));
                }
                if (SDKUtils.isExternalStorageAvailable()) {
                    jSONObject.put(SDKUtils.encodeString("diskFreeSize"), SDKUtils.encodeString(String.valueOf(this.U.a(this.B))));
                } else {
                    z10 = true;
                }
                String valueOf2 = String.valueOf(this.U.r());
                if (TextUtils.isEmpty(valueOf2)) {
                    z10 = true;
                } else {
                    jSONObject.put(SDKUtils.encodeString(o2.i.F) + o2.i.f33394d + SDKUtils.encodeString("width") + o2.i.f33396e, SDKUtils.encodeString(valueOf2));
                }
                jSONObject.put(SDKUtils.encodeString(o2.i.F) + o2.i.f33394d + SDKUtils.encodeString("height") + o2.i.f33396e, SDKUtils.encodeString(String.valueOf(this.U.a())));
                String g10 = k0.g(this.W.getContext());
                if (!TextUtils.isEmpty(g10)) {
                    jSONObject.put(SDKUtils.encodeString("bundleId"), SDKUtils.encodeString(g10));
                }
                String valueOf3 = String.valueOf(this.U.h());
                if (!TextUtils.isEmpty(valueOf3)) {
                    jSONObject.put(SDKUtils.encodeString("deviceScreenScale"), SDKUtils.encodeString(valueOf3));
                }
                String valueOf4 = String.valueOf(this.U.f());
                if (!TextUtils.isEmpty(valueOf4)) {
                    jSONObject.put(SDKUtils.encodeString("unLocked"), SDKUtils.encodeString(valueOf4));
                }
                jSONObject.put(SDKUtils.encodeString("deviceVolume"), n3.b(context).a(context));
                jSONObject.put(SDKUtils.encodeString("batteryLevel"), this.U.w(context));
                jSONObject.put(SDKUtils.encodeString("mcc"), k2.b(context));
                jSONObject.put(SDKUtils.encodeString("mnc"), k2.c(context));
                jSONObject.put(SDKUtils.encodeString("phoneType"), k2.e(context));
                jSONObject.put(SDKUtils.encodeString("simOperator"), SDKUtils.encodeString(k2.f(context)));
                jSONObject.put(SDKUtils.encodeString("lastUpdateTime"), k0.f(context));
                jSONObject.put(SDKUtils.encodeString("firstInstallTime"), k0.d(context));
                jSONObject.put(SDKUtils.encodeString("appVersion"), SDKUtils.encodeString(k0.b(context)));
                String e11 = k0.e(context);
                if (!TextUtils.isEmpty(e11)) {
                    jSONObject.put(SDKUtils.encodeString("installerPackageName"), SDKUtils.encodeString(e11));
                }
                n0(jSONObject);
                jSONObject.put(SDKUtils.encodeString(o2.i.f33417o0), this.U.z(context));
            } catch (JSONException e12) {
                e = e12;
                e.printStackTrace();
                return new Object[]{jSONObject.toString(), Boolean.valueOf(z10)};
            }
        } catch (JSONException e13) {
            e = e13;
            z10 = false;
        }
        return new Object[]{jSONObject.toString(), Boolean.valueOf(z10)};
    }

    private w v(h6.e eVar, j3 j3Var) {
        w wVar = new w();
        if (eVar == h6.e.RewardedVideo || eVar == h6.e.Interstitial || eVar == h6.e.OfferWall || eVar == h6.e.Banner) {
            HashMap hashMap = new HashMap();
            hashMap.put("applicationKey", this.f34007e);
            if (!TextUtils.isEmpty(this.f34008f)) {
                hashMap.put("applicationUserId", this.f34008f);
            }
            if (j3Var != null) {
                if (j3Var.g() != null) {
                    hashMap.putAll(j3Var.g());
                    hashMap.put(o2.h.f33385y0, String.valueOf(com.json.j.f32002a.c(j3Var.h())));
                }
                hashMap.put("demandSourceName", j3Var.f());
                hashMap.put("demandSourceId", j3Var.h());
            }
            Map d02 = d0(eVar);
            if (d02 != null) {
                hashMap.putAll(d02);
            }
            String flatMapToJsonAsString = SDKUtils.flatMapToJsonAsString(hashMap);
            o2.g a10 = o2.g.a(eVar);
            String E = E(a10.f33334a, flatMapToJsonAsString, a10.f33335b, a10.f33336c);
            wVar.f34144a = a10.f33334a;
            wVar.f34145b = E;
        } else if (eVar == h6.e.OfferWallCredits) {
            String E2 = E(o2.g.D, F(o2.h.f33360m, o2.h.f33337a0, "applicationKey", this.f34007e, "applicationUserId", this.f34008f, null, null, null, false), "null", o2.g.f33311g0);
            wVar.f34144a = o2.g.D;
            wVar.f34145b = E2;
        }
        return wVar;
    }

    public Object[] v0(String str, String str2) {
        boolean z10;
        JSONObject jSONObject = new JSONObject();
        Map<String, String> map = null;
        if (TextUtils.isEmpty(str)) {
            z10 = true;
        } else {
            h6.e G0 = G0(str);
            if (G0 == h6.e.OfferWall) {
                map = this.f34009g;
            } else {
                j3 a10 = this.H.a(G0, str2);
                if (a10 != null) {
                    map = a10.g();
                    map.put("demandSourceName", a10.f());
                    map.put("demandSourceId", a10.h());
                }
            }
            try {
                jSONObject.put(o2.h.f33360m, str);
            } catch (JSONException e10) {
                e10.printStackTrace();
            }
            try {
                Map<String, String> initSDKParams = SDKUtils.getInitSDKParams();
                if (initSDKParams != null) {
                    jSONObject = SDKUtils.mergeJSONObjects(jSONObject, new JSONObject(initSDKParams));
                }
            } catch (Exception e11) {
                e11.printStackTrace();
            }
            z10 = false;
        }
        if (!TextUtils.isEmpty(this.f34008f)) {
            try {
                jSONObject.put(SDKUtils.encodeString("applicationUserId"), SDKUtils.encodeString(this.f34008f));
            } catch (JSONException e12) {
                e12.printStackTrace();
            }
        }
        if (TextUtils.isEmpty(this.f34007e)) {
            z10 = true;
        } else {
            try {
                jSONObject.put(SDKUtils.encodeString("applicationKey"), SDKUtils.encodeString(this.f34007e));
            } catch (JSONException e13) {
                e13.printStackTrace();
            }
        }
        if (map != null && !map.isEmpty()) {
            for (Map.Entry<String, String> entry : map.entrySet()) {
                if (entry.getKey().equalsIgnoreCase("sdkWebViewCache")) {
                    V0(entry.getValue());
                }
                try {
                    jSONObject.put(SDKUtils.encodeString(entry.getKey()), SDKUtils.encodeString(entry.getValue()));
                } catch (JSONException e14) {
                    e14.printStackTrace();
                }
            }
        }
        return new Object[]{jSONObject.toString(), Boolean.valueOf(z10)};
    }

    public w2 w(h6.e eVar) {
        if (eVar == h6.e.Interstitial) {
            return this.f34027y;
        }
        if (eVar == h6.e.RewardedVideo) {
            return this.f34026x;
        }
        if (eVar == h6.e.Banner) {
            return this.A;
        }
        return null;
    }

    public String x0(String str) {
        return new hb(str).d(Y);
    }

    public void y0(Context context) {
        try {
            i2 i2Var = this.Q;
            if (i2Var == null) {
                return;
            }
            i2Var.b(context);
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    void I(h6.e eVar, String str) {
        f0(new h(eVar, str));
    }

    void N(Runnable runnable) {
        q5 q5Var = this.f34003a;
        if (q5Var != null) {
            q5Var.a(runnable);
        }
    }

    com.json.sdk.controller.p Y(com.json.sdk.controller.q qVar) {
        return new com.json.sdk.controller.p(qVar);
    }

    @Override
    public void destroy() {
        this.W.destroy();
        s3 s3Var = this.f34010h;
        if (s3Var != null) {
            s3Var.d();
        }
        i2 i2Var = this.Q;
        if (i2Var != null) {
            i2Var.b();
        }
        CountDownTimer countDownTimer = this.f34015m;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
    }

    void f0(Runnable runnable) {
        q5 q5Var = this.f34003a;
        if (q5Var != null) {
            q5Var.b(runnable);
        }
    }

    void m0(Runnable runnable) {
        q5 q5Var = this.f34003a;
        if (q5Var != null) {
            q5Var.c(runnable);
        }
    }

    @Override
    public void onDownloadStart(String str, String str2, String str3, String str4, long j10) {
        Logger.i(this.f34004b, str + " " + str4);
    }

    com.json.sdk.controller.g t(com.json.sdk.controller.q qVar) {
        return new com.json.sdk.controller.g(new com.json.sdk.controller.b(new u()), qVar);
    }

    public void y() {
        try {
            this.W.onResume();
        } catch (Throwable th) {
            Logger.i(this.f34004b, "WebViewController: onResume() - " + th);
        }
    }

    public void a(int i10) {
        b(i10);
    }

    @Override
    public void b() {
        N0(B0(o2.g.f33326s));
    }

    @Override
    public void c() {
        a(this.E);
    }

    @Override
    public void d() {
        N0(B0(o2.g.f33327t));
    }

    @Override
    public h6.c e() {
        return h6.c.Web;
    }

    @Override
    public void f() {
        this.C.c(new j6());
        if (this.C.s()) {
            a(1);
        }
    }

    public boolean h(String str) {
        List<String> d10 = g8.e().d();
        if (d10 == null) {
            return false;
        }
        try {
            if (d10.isEmpty()) {
                return false;
            }
            Iterator<String> it = d10.iterator();
            while (it.hasNext()) {
                if (str.contains(it.next())) {
                    wc.a(j(), str);
                    return true;
                }
            }
            return false;
        } catch (Exception e10) {
            e10.printStackTrace();
            return false;
        }
    }

    public nd i() {
        if (this.O == null) {
            this.O = new j();
        }
        return this.O;
    }

    public Context j() {
        return this.V.a();
    }

    public int k() {
        return Z;
    }

    public FrameLayout l() {
        return this.f34023u;
    }

    public String m() {
        return this.f34025w;
    }

    public f0 n() {
        return this.E;
    }

    public x o() {
        return this.f34024v;
    }

    public void p() {
        if (this.f34012j == null) {
            return;
        }
        K0();
        h6.e b10 = this.f34012j.b();
        String a10 = this.f34012j.a();
        if (a1(b10.toString())) {
            I(b10, a10);
        }
    }

    public void q() {
        this.f34019q.onHideCustomView();
    }

    public boolean r() {
        return this.f34020r != null;
    }

    public void s() {
        N0(B0(o2.g.f33307e0));
    }

    public void t() {
        N0(B0(o2.g.G));
    }

    public void u() {
        try {
            this.W.onPause();
        } catch (Throwable th) {
            Logger.i(this.f34004b, "WebViewController: onPause() - " + th);
        }
    }

    public void v() {
        this.D = null;
    }

    public void w() {
        this.X = null;
    }

    public void x() {
        this.W.requestFocus();
    }

    @Override
    public void a(Activity activity) {
        this.V.a(activity);
    }

    public void b(int i10) {
        if (!this.C.u()) {
            Logger.i(this.f34004b, "load(): Mobile Controller HTML Does not exist");
            return;
        }
        JSONObject controllerConfigAsJSONObject = SDKUtils.getControllerConfigAsJSONObject();
        String t02 = t0(controllerConfigAsJSONObject);
        Map<String, String> initSDKParams = SDKUtils.getInitSDKParams();
        if (initSDKParams != null && initSDKParams.containsKey(b4.f31516g)) {
            t02 = String.format("%s&sessionid=%s", t02, initSDKParams.get(b4.f31516g));
        }
        this.f34003a.c(new k(controllerConfigAsJSONObject, this.W, this.C.o().toURI().toString() + "?" + t02));
        this.f34015m = new l(50000L, 1000L, i10).start();
    }

    public void c(int i10) {
        Z = i10;
    }

    public void e(String str, String str2) {
        N0(j0(o2.g.f33302b0, F(o2.h.f33366p, str2, o2.h.f33360m, str, null, null, null, null, null, false)));
    }

    public void k(String str) {
        N0(j0(o2.g.f33329v, F(o2.h.f33350h, str, null, null, null, null, null, null, null, false)));
    }

    public void m(String str) {
        Logger.i(this.f34004b, "device status changed, connection type " + str);
        m6.a(str);
        N0(j0(o2.g.f33330w, F("connectionType", str, null, null, null, null, null, null, null, false)));
    }

    public void n(String str) {
        this.f34025w = str;
    }

    @Override
    public void a(Context context) {
        N(new g(context));
    }

    @Override
    public void b(Context context) {
        N(new f(context));
    }

    public void c(String str) {
        if (str.equals(o2.h.f33352i)) {
            K0();
        }
        N0(j0(o2.g.f33332y, F(o2.h.f33350h, str, null, null, null, null, null, null, null, false)));
    }

    public void e(JSONObject jSONObject) {
        Logger.i(this.f34004b, "device connection info changed: " + jSONObject.toString());
        N0(j0(o2.g.f33331x, F(o2.i.f33401g0, jSONObject.toString(), null, null, null, null, null, null, null, false)));
    }

    public void a(bd bdVar) {
        this.D = bdVar;
    }

    @Override
    public void b(j3 j3Var, Map<String, String> map, y2 y2Var) {
        J(j3Var, map);
    }

    public void a(f0 f0Var) {
        String b10;
        w2 w10;
        synchronized (this.F) {
            if (f0Var.m() && this.f34011i) {
                Log.d(this.f34004b, "restoreState(state:" + f0Var + ")");
                int c10 = f0Var.c();
                if (c10 != -1) {
                    h6.e eVar = h6.e.RewardedVideo;
                    if (c10 == eVar.ordinal()) {
                        Log.d(this.f34004b, "onRVAdClosed()");
                        b10 = f0Var.b();
                        w10 = w(eVar);
                        if (w10 != null && !TextUtils.isEmpty(b10)) {
                            w10.a(eVar, b10);
                        }
                        f0Var.a(-1);
                        f0Var.f(null);
                    } else {
                        eVar = h6.e.Interstitial;
                        if (c10 == eVar.ordinal()) {
                            Log.d(this.f34004b, "onInterstitialAdClosed()");
                            b10 = f0Var.b();
                            w10 = w(eVar);
                            if (w10 != null) {
                            }
                        } else if (c10 == h6.e.OfferWall.ordinal()) {
                            Log.d(this.f34004b, "onOWAdClosed()");
                            da daVar = this.f34028z;
                            if (daVar != null) {
                                daVar.onOWAdClosed();
                            }
                        }
                        f0Var.a(-1);
                        f0Var.f(null);
                    }
                } else {
                    Log.d(this.f34004b, "No ad was opened");
                }
                String d10 = f0Var.d();
                String f10 = f0Var.f();
                for (j3 j3Var : this.H.a(h6.e.Interstitial)) {
                    if (j3Var.e() == 2) {
                        Log.d(this.f34004b, "initInterstitial(appKey:" + d10 + ", userId:" + f10 + ", demandSource:" + j3Var.f() + ")");
                        a(d10, f10, j3Var, this.f34027y);
                    }
                }
                String i10 = f0Var.i();
                String j10 = f0Var.j();
                for (j3 j3Var2 : this.H.a(h6.e.RewardedVideo)) {
                    if (j3Var2.e() == 2) {
                        String f11 = j3Var2.f();
                        Log.d(this.f34004b, "onRVNoMoreOffers()");
                        this.f34026x.d(f11);
                        Log.d(this.f34004b, "initRewardedVideo(appKey:" + i10 + ", userId:" + j10 + ", demandSource:" + f11 + ")");
                        a(i10, j10, j3Var2, this.f34026x);
                    }
                }
                f0Var.c(false);
            }
            this.E = f0Var;
        }
    }

    public void b(String str, String str2) {
        if (TextUtils.isEmpty(str2)) {
            str2 = o2.c.B;
        }
        String str3 = str2;
        if (TextUtils.isEmpty(str)) {
            str = o2.c.A;
        }
        N0(j0(o2.g.f33309f0, F("errMsg", str, "url", str3, null, null, null, null, null, false)));
    }

    public void a(ha haVar) {
        this.X = haVar;
        this.W.a(haVar);
    }

    @Override
    public void b(JSONObject jSONObject) {
        if (jSONObject != null) {
            this.R = jSONObject;
        }
    }

    @Override
    public void a(j3 j3Var) {
        Map<String, String> b10 = j3Var.b();
        if (b10 != null) {
            N0(E(o2.g.Y, SDKUtils.flatMapToJsonAsString(b10), o2.g.V, o2.g.W));
        }
    }

    @Override
    public void a(j3 j3Var, Map<String, String> map, x2 x2Var) {
        Map<String, String> mergeHashMaps = SDKUtils.mergeHashMaps(new Map[]{map, j3Var.b()});
        if (map != null) {
            N0(E(o2.g.T, SDKUtils.flatMapToJsonAsString(mergeHashMaps), o2.g.U, o2.g.X));
        }
    }

    @Override
    public void a(j3 j3Var, Map<String, String> map, y2 y2Var) {
        N0(A(h6.e.Interstitial, new JSONObject(SDKUtils.mergeHashMaps(new Map[]{map, j3Var.b()}))));
    }

    @Override
    public void a(q6 q6Var) {
        if (q6Var.getName().contains(o2.f33213g)) {
            this.C.f(new b());
        } else {
            a(q6Var.getName(), q6Var.getParent());
        }
    }

    @Override
    public void a(q6 q6Var, i6 i6Var) {
        if (q6Var.getName().contains(o2.f33213g)) {
            this.C.g(new c(), new d(i6Var));
        } else {
            a(q6Var.getName(), q6Var.getParent(), i6Var.b());
        }
    }

    public void a(com.json.sdk.controller.a aVar) {
        this.M = aVar;
        aVar.a(i());
    }

    @Override
    public void a(f.MessageToController messageToController, k.a aVar) {
        N0(E(messageToController.e(), messageToController.h(), o2.g.Z, o2.g.Z));
    }

    public void a(com.json.sdk.controller.i iVar) {
        this.L = iVar;
    }

    public void a(com.json.sdk.controller.j jVar) {
        this.N = jVar;
    }

    public void a(com.json.sdk.controller.n nVar) {
        this.I = nVar;
    }

    public void a(com.json.sdk.controller.o oVar) {
        this.J = oVar;
    }

    public void a(com.json.sdk.controller.s sVar) {
        this.K = sVar;
    }

    public void a(x xVar) {
        this.f34024v = xVar;
    }

    @Override
    public void a(String str, y2 y2Var) {
        HashMap hashMap = new HashMap();
        hashMap.put("demandSourceName", str);
        String flatMapToJsonAsString = SDKUtils.flatMapToJsonAsString(hashMap);
        this.E.d(str, true);
        N0(E(o2.g.K, flatMapToJsonAsString, o2.g.L, o2.g.M));
    }

    public void a(String str, String str2) {
        try {
            N0(j0(o2.g.f33322o, F(o2.h.f33338b, str, "path", b0(str2), null, null, null, null, null, false)));
        } catch (Exception e10) {
            a(str, str2, e10.getMessage());
        }
    }

    @Override
    public void a(String str, String str2, da daVar) {
        this.f34007e = str;
        this.f34008f = str2;
        this.f34028z = daVar;
        if (TextUtils.isEmpty(str2)) {
            O("UserId missing", h6.e.OfferWallCredits, null);
        } else {
            P(this.f34007e, h6.e.OfferWallCredits, null, new p());
        }
    }

    @Override
    public void a(String str, String str2, j3 j3Var, x2 x2Var) {
        this.f34007e = str;
        this.f34008f = str2;
        this.A = x2Var;
        P(str, h6.e.Banner, j3Var, new q());
    }

    @Override
    public void a(String str, String str2, j3 j3Var, y2 y2Var) {
        this.f34007e = str;
        this.f34008f = str2;
        this.f34027y = y2Var;
        this.E.g(str);
        this.E.h(this.f34008f);
        P(this.f34007e, h6.e.Interstitial, j3Var, new n());
    }

    @Override
    public void a(String str, String str2, j3 j3Var, z2 z2Var) {
        this.f34007e = str;
        this.f34008f = str2;
        this.f34026x = z2Var;
        this.E.i(str);
        this.E.j(str2);
        P(str, h6.e.RewardedVideo, j3Var, new m());
    }

    public void a(String str, String str2, String str3) {
        try {
            N0(j0(o2.g.f33323p, F(o2.h.f33338b, str, "path", b0(str2), "errMsg", str3, null, null, null, false)));
        } catch (Exception unused) {
        }
    }

    @Override
    public void a(String str, String str2, Map<String, String> map, da daVar) {
        this.f34007e = str;
        this.f34008f = str2;
        this.f34009g = map;
        this.f34028z = daVar;
        this.E.b(map);
        this.E.b(true);
        if (TextUtils.isEmpty(str2)) {
            O("UserId missing", h6.e.OfferWall, null);
        } else {
            P(this.f34007e, h6.e.OfferWall, null, new o());
        }
    }

    @Override
    public void a(Map<String, String> map, da daVar) {
        this.f34009g = map;
        N0(c0(o2.g.C, o2.g.E, o2.g.F));
    }

    @Override
    public void a(JSONObject jSONObject) {
        N0(j0(o2.g.f33317j0, jSONObject != null ? jSONObject.toString() : null));
    }

    @Override
    public void a(JSONObject jSONObject, x2 x2Var) {
        N0(E(o2.g.T, jSONObject.toString(), o2.g.U, o2.g.X));
    }

    @Override
    public void a(JSONObject jSONObject, y2 y2Var) {
        N0(A(h6.e.Interstitial, jSONObject));
    }

    @Override
    public void a(JSONObject jSONObject, z2 z2Var) {
        N0(A(h6.e.RewardedVideo, jSONObject));
    }

    public void a(boolean z10, String str) {
        N0(j0(o2.g.f33301a0, F(o2.h.K, str, null, null, null, null, null, null, o2.h.f33364o, z10)));
    }

    @Override
    public boolean a(String str) {
        j3 a10 = this.H.a(h6.e.Interstitial, str);
        return a10 != null && a10.d();
    }
}