package com.google.android.gms.internal.gtm; import com.huawei.hms.framework.common.ContainerUtils; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import org.simpleframework.xml.strategy.Name; /* loaded from: classes.dex */ public final class zznf { private String zzafk = "https://www.google-analytics.com"; public final String zzb(zzmk zzmkVar) { String sb; String str = this.zzafk; if (zzmkVar.zzlg()) { sb = zzmkVar.zzlh(); } else if (zzmkVar == null) { sb = ""; } else { String trim = !zzmkVar.zzli().trim().equals("") ? zzmkVar.zzli().trim() : "-1"; StringBuilder sb2 = new StringBuilder(); if (zzmkVar.zzle() != null) { sb2.append(zzmkVar.zzle()); } else { sb2.append(Name.MARK); } sb2.append(ContainerUtils.KEY_VALUE_DELIMITER); sb2.append(zzbs(zzmkVar.getContainerId())); sb2.append("&pv="); sb2.append(zzbs(trim)); sb2.append("&rv=5.0"); if (zzmkVar.zzlg()) { sb2.append(">m_debug=x"); } sb = sb2.toString(); } StringBuilder sb3 = new StringBuilder(String.valueOf(str).length() + 13 + String.valueOf(sb).length()); sb3.append(str); sb3.append("/gtm/android?"); sb3.append(sb); return sb3.toString(); } private static String zzbs(String str) { try { return URLEncoder.encode(str, "UTF-8").replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException unused) { String valueOf = String.valueOf(str); zzev.zzav(valueOf.length() != 0 ? "Cannot encode the string: ".concat(valueOf) : new String("Cannot encode the string: ")); return ""; } } }