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

import android.text.TextUtils;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.dynamic.d.b.a.b;
import com.tencent.mm.plugin.appbrand.dynamic.d.b.a.c;
import com.tencent.mm.plugin.appbrand.dynamic.d.b.a.d;
import com.tencent.mm.plugin.appbrand.dynamic.d.b.a.e;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

public final class a {
    private static Map<String, Map<Integer, e>> hnt;
    private static final Pattern hnu = Pattern.compile("(\\{\"method\":\"drawImage\",\"data\":\\[\"undefined\".*?\\})|(\\{\"method\":\"fillText\",\"data\":[^\\}]*?undefined.[^\\}]*?\\]\\})|(\\{\"method\":\"strokeText\",\"data\":[^\\}]*?undefined.[^\\}]*?\\]\\})");

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

    public static e bb(String str, int i) {
        HashMap hashMap;
        Map map;
        AppMethodBeat.i(10878);
        if (hnt == null) {
            hashMap = new HashMap();
            hnt = hashMap;
            hashMap.put(str, new HashMap());
        }
        Map map2 = (Map) hnt.get(str);
        if (map2 == null) {
            hashMap = new HashMap();
            hnt.put(str, hashMap);
            map = hashMap;
        } else {
            map = map2;
        }
        e eVar = (e) map.get(Integer.valueOf(i));
        if (eVar == null) {
            switch (i) {
                case 0:
                    eVar = new d();
                    break;
                case 1:
                    eVar = new b();
                    break;
                case 2:
                    eVar = new c();
                    break;
                default:
                    eVar = new c();
                    break;
            }
            map.put(Integer.valueOf(i), eVar);
        }
        AppMethodBeat.o(10878);
        return eVar;
    }

    public static void Ah(String str) {
        AppMethodBeat.i(10879);
        if (hnt == null) {
            AppMethodBeat.o(10879);
            return;
        }
        Map map = (Map) hnt.get(str);
        if (map != null) {
            for (e reset : map.values()) {
                reset.reset();
            }
            map.clear();
        }
        AppMethodBeat.o(10879);
    }

    public static void bN(String str, String str2) {
        AppMethodBeat.i(10880);
        if (TextUtils.isEmpty(str2)) {
            AppMethodBeat.o(10880);
            return;
        }
        com.tencent.mm.sdk.g.d.xDG.b(new 1(str2, str), "onDrawFrame");
        AppMethodBeat.o(10880);
    }
}
