104 lines
3.6 KiB
Java
104 lines
3.6 KiB
Java
|
package com.google.android.gms.internal.gtm;
|
||
|
|
||
|
import com.google.android.gms.common.internal.ImagesContract;
|
||
|
import com.google.android.gms.common.internal.Preconditions;
|
||
|
import com.huawei.hms.framework.common.ContainerUtils;
|
||
|
import java.io.UnsupportedEncodingException;
|
||
|
import java.net.URLEncoder;
|
||
|
import java.util.HashSet;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.Map;
|
||
|
import java.util.Set;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class zzlk extends zzhb {
|
||
|
@Override // com.google.android.gms.internal.gtm.zzhb
|
||
|
protected final zzoa<?> zza(zzfl zzflVar, zzoa<?>... zzoaVarArr) {
|
||
|
String str;
|
||
|
boolean z = true;
|
||
|
Preconditions.checkArgument(true);
|
||
|
Preconditions.checkArgument(zzoaVarArr.length > 0);
|
||
|
zzoa<?> zzoaVar = zzoaVarArr[0];
|
||
|
zzoa<?> zzoaVar2 = zzoaVarArr.length > 1 ? zzoaVarArr[1] : zzog.zzaum;
|
||
|
int i = 2;
|
||
|
String zzd = (zzoaVarArr.length <= 2 || zzoaVarArr[2] == zzog.zzaum) ? "" : zzha.zzd(zzoaVarArr[2]);
|
||
|
if (zzoaVarArr.length > 3 && zzoaVarArr[3] != zzog.zzaum) {
|
||
|
str = zzha.zzd(zzoaVarArr[3]);
|
||
|
} else {
|
||
|
str = ContainerUtils.KEY_VALUE_DELIMITER;
|
||
|
}
|
||
|
HashSet hashSet = null;
|
||
|
if (zzoaVar2 != zzog.zzaum) {
|
||
|
Preconditions.checkArgument(zzoaVar2 instanceof zzom);
|
||
|
if (ImagesContract.URL.equals(zzoaVar2.value())) {
|
||
|
i = 1;
|
||
|
} else if ("backslash".equals(zzoaVar2.value())) {
|
||
|
hashSet = new HashSet();
|
||
|
zza(hashSet, zzd);
|
||
|
zza(hashSet, str);
|
||
|
hashSet.remove('\\');
|
||
|
} else {
|
||
|
return new zzom("");
|
||
|
}
|
||
|
} else {
|
||
|
i = 0;
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
if (zzoaVar instanceof zzoh) {
|
||
|
for (zzoa<?> zzoaVar3 : ((zzoh) zzoaVar).value()) {
|
||
|
if (!z) {
|
||
|
sb.append(zzd);
|
||
|
}
|
||
|
zzb(sb, zzha.zzd(zzoaVar3), i, hashSet);
|
||
|
z = false;
|
||
|
}
|
||
|
} else if (zzoaVar instanceof zzok) {
|
||
|
Map<String, zzoa<?>> value = ((zzok) zzoaVar).value();
|
||
|
for (String str2 : value.keySet()) {
|
||
|
if (!z) {
|
||
|
sb.append(zzd);
|
||
|
}
|
||
|
String zzd2 = zzha.zzd(value.get(str2));
|
||
|
zzb(sb, str2, i, hashSet);
|
||
|
sb.append(str);
|
||
|
zzb(sb, zzd2, i, hashSet);
|
||
|
z = false;
|
||
|
}
|
||
|
} else {
|
||
|
zzb(sb, zzha.zzd(zzoaVar), i, hashSet);
|
||
|
}
|
||
|
return new zzom(sb.toString());
|
||
|
}
|
||
|
|
||
|
private static void zza(Set<Character> set, String str) {
|
||
|
for (int i = 0; i < str.length(); i++) {
|
||
|
set.add(Character.valueOf(str.charAt(i)));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private static void zzb(StringBuilder sb, String str, int i, Set<Character> set) {
|
||
|
sb.append(zzb(str, i, set));
|
||
|
}
|
||
|
|
||
|
private static String zzb(String str, int i, Set<Character> set) {
|
||
|
if (i == 1) {
|
||
|
try {
|
||
|
return URLEncoder.encode(str, "UTF-8").replaceAll("\\+", "%20");
|
||
|
} catch (UnsupportedEncodingException unused) {
|
||
|
return str;
|
||
|
}
|
||
|
}
|
||
|
if (i != 2) {
|
||
|
return str;
|
||
|
}
|
||
|
String replace = str.replace("\\", "\\\\");
|
||
|
Iterator<Character> it = set.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
String ch = it.next().toString();
|
||
|
String valueOf = String.valueOf(ch);
|
||
|
replace = replace.replace(ch, valueOf.length() != 0 ? "\\".concat(valueOf) : new String("\\"));
|
||
|
}
|
||
|
return replace;
|
||
|
}
|
||
|
}
|