package com.tencent.mm.plugin.appbrand.dynamic;

import android.os.Bundle;
import android.text.TextUtils;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ipcinvoker.wx_extension.b$a;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.sqlitelint.config.SharePluginInfo;
import com.tencent.ytcommon.BuildConfig;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public final class f {
    private static f hlA = new f();
    Map<String, b> hlB = new ConcurrentHashMap();
    b$a hlC = new 1(this);

    public f() {
        AppMethodBeat.i(10685);
        AppMethodBeat.o(10685);
    }

    static /* synthetic */ String access$000(String str) {
        AppMethodBeat.i(10690);
        String zU = zU(str);
        AppMethodBeat.o(10690);
        return zU;
    }

    static {
        AppMethodBeat.i(10691);
        AppMethodBeat.o(10691);
    }

    public static f azA() {
        return hlA;
    }

    public final boolean aZ(String str, int i) {
        AppMethodBeat.i(10686);
        if (TextUtils.isEmpty(str)) {
            AppMethodBeat.o(10686);
            return false;
        } else if (this.hlB.containsKey(str)) {
            switch (i) {
                case 2103:
                    j.azE().E(str, 628, 9);
                    break;
            }
            boolean add = ((b) this.hlB.get(str)).hlF.add(Integer.valueOf(i));
            AppMethodBeat.o(10686);
            return add;
        } else {
            ab.w("MicroMsg.DynamicPageViewStateMonitor", "no keyList exists, widgetId[%s]", new Object[]{str});
            AppMethodBeat.o(10686);
            return false;
        }
    }

    public static void zT(String str) {
        AppMethodBeat.i(10687);
        Bundle bundle = new Bundle();
        String zU = zU(str);
        bundle.putString(SharePluginInfo.ISSUE_KEY_ID, zU);
        bundle.putInt("widgetState", 2109);
        com.tencent.mm.ipcinvoker.f.a(i.azC().zV(zU), bundle, a.class, null);
        AppMethodBeat.o(10687);
    }

    public static void n(int i, String str, String str2) {
        AppMethodBeat.i(10688);
        Bundle bundle = new Bundle();
        bundle.putBoolean("isOpenWeappFial", true);
        bundle.putInt("widgetState", i);
        bundle.putString("appid", str);
        bundle.putString("sceneNote", str2);
        com.tencent.mm.ipcinvoker.f.a(i.azC().zV(zU(str2)), bundle, a.class, null);
        AppMethodBeat.o(10688);
    }

    private static String zU(String str) {
        AppMethodBeat.i(10689);
        String str2;
        if (TextUtils.isEmpty(str)) {
            str2 = BuildConfig.FLAVOR;
            AppMethodBeat.o(10689);
            return str2;
        }
        Matcher matcher = Pattern.compile(":widgetId=.*:").matcher(str);
        if (matcher.matches()) {
            str2 = matcher.group();
            if (!TextUtils.isEmpty(str2)) {
                str2 = str2.substring(str2.indexOf("=") + 1, str2.lastIndexOf(":"));
                AppMethodBeat.o(10689);
                return str2;
            }
        }
        str2 = BuildConfig.FLAVOR;
        AppMethodBeat.o(10689);
        return str2;
    }
}
