package X; import android.content.Context; import android.text.TextUtils; import com.bytedance.covode.number.Covode; import com.swift.sandhook.utils.FileUtils; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.InputStream; /* renamed from: X.2Wi reason: invalid class name and case insensitive filesystem */ public final class C59552Wi { public static String LIZ = "webview_monitor_js_file_v2/slardar_sdk.js"; public static String LIZIZ = "webview_monitor_js_file_v2/slardar_bridge.js"; public static String LIZJ = ""; public static String LIZLLL = ""; public static String LJ = ""; public static String LJFF = " javascript:( "; public static String LJI = " )() "; public static String LJII = " function(){ "; public static String LJIIIIZZ = " } "; static { Covode.recordClassIndex(18017); } public static String LIZ(Context context, String str, String str2, boolean z) { if (TextUtils.isEmpty(LIZJ)) { if (TextUtils.isEmpty(str)) { LIZJ = LIZ(context, LIZ, true); } else { LIZJ = LIZ(context, str, false); } } if (TextUtils.isEmpty(LIZLLL)) { LIZLLL = LIZ(context, LIZIZ, true); } LJ = str2; if (str2 == null) { str2 = ""; } LJ = str2; if (!z) { LIZJ = ""; LJ = ""; LIZLLL = ""; } return LJFF + LJII + LIZJ + LIZLLL + LJ + LJIIIIZZ + LJI; } public static String LIZ(Context context, String str, boolean z) { InputStream inputStream; byte[] bArr = new byte[FileUtils.FileMode.MODE_ISGID]; ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); InputStream inputStream2 = null; if (z) { try { inputStream = context.getAssets().open(str); } catch (Exception e) { C63302eV.LIZ("default_handle", e); if (0 != 0) { try { inputStream2.close(); } catch (Exception e2) { C63302eV.LIZ("default_handle", e2); } } } catch (Throwable th) { if (0 != 0) { try { inputStream2.close(); } catch (Exception e3) { C63302eV.LIZ("default_handle", e3); } } throw th; } } else { inputStream = new FileInputStream(str); } while (true) { int read = inputStream.read(bArr); if (read == -1) { break; } byteArrayOutputStream.write(bArr, 0, read); } if (inputStream != null) { try { inputStream.close(); } catch (Exception e4) { C63302eV.LIZ("default_handle", e4); } } return byteArrayOutputStream.toString(); } }