package o;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.ab0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractC0725ab0 extends AbstractC1904ms0 {
    public static String G(String str) {
        Comparable comparable;
        String strSubstring;
        List listC0 = Za0.c0(str);
        ArrayList arrayList = new ArrayList();
        for (Object obj : listC0) {
            if (!Za0.Y((String) obj)) {
                arrayList.add(obj);
            }
        }
        ArrayList arrayList2 = new ArrayList(AbstractC0034Bi.W(arrayList, 10));
        int size = arrayList.size();
        int i = 0;
        int i2 = 0;
        while (i2 < size) {
            Object obj2 = arrayList.get(i2);
            i2++;
            String str2 = (String) obj2;
            int length = str2.length();
            int length2 = 0;
            while (true) {
                if (length2 >= length) {
                    length2 = -1;
                    break;
                }
                if (!AbstractC0940cn0.z(str2.charAt(length2))) {
                    break;
                }
                length2++;
            }
            if (length2 == -1) {
                length2 = str2.length();
            }
            arrayList2.add(Integer.valueOf(length2));
        }
        Iterator it = arrayList2.iterator();
        if (it.hasNext()) {
            comparable = (Comparable) it.next();
            while (it.hasNext()) {
                Comparable comparable2 = (Comparable) it.next();
                if (comparable.compareTo(comparable2) > 0) {
                    comparable = comparable2;
                }
            }
        } else {
            comparable = null;
        }
        Integer num = (Integer) comparable;
        int iIntValue = num != null ? num.intValue() : 0;
        int length3 = str.length();
        listC0.size();
        int iR = AbstractC0008Ai.R(listC0);
        ArrayList arrayList3 = new ArrayList();
        for (Object obj3 : listC0) {
            int i3 = i + 1;
            if (i < 0) {
                AbstractC0008Ai.V();
                throw null;
            }
            String str3 = (String) obj3;
            if ((i == 0 || i == iR) && Za0.Y(str3)) {
                strSubstring = null;
            } else {
                if (iIntValue < 0) {
                    throw new IllegalArgumentException(AbstractC0126Ew.k(iIntValue, "Requested character count ", " is less than zero.").toString());
                }
                int length4 = str3.length();
                if (iIntValue <= length4) {
                    length4 = iIntValue;
                }
                strSubstring = str3.substring(length4);
            }
            if (strSubstring != null) {
                arrayList3.add(strSubstring);
            }
            i = i3;
        }
        StringBuilder sb = new StringBuilder(length3);
        AbstractC3117zi.h0(arrayList3, sb, null, 124);
        return sb.toString();
    }

    public static String H(String str) {
        if (Za0.Y("|")) {
            throw new IllegalArgumentException("marginPrefix must be non-blank string.");
        }
        List listC0 = Za0.c0(str);
        int length = str.length();
        listC0.size();
        int iR = AbstractC0008Ai.R(listC0);
        ArrayList arrayList = new ArrayList();
        Iterator it = listC0.iterator();
        int i = 0;
        while (true) {
            String strSubstring = null;
            if (!it.hasNext()) {
                StringBuilder sb = new StringBuilder(length);
                AbstractC3117zi.h0(arrayList, sb, null, 124);
                return sb.toString();
            }
            Object next = it.next();
            int i2 = i + 1;
            if (i < 0) {
                AbstractC0008Ai.V();
                throw null;
            }
            String str2 = (String) next;
            if ((i != 0 && i != iR) || !Za0.Y(str2)) {
                int length2 = str2.length();
                int i3 = 0;
                while (true) {
                    if (i3 >= length2) {
                        i3 = -1;
                        break;
                    }
                    if (!AbstractC0940cn0.z(str2.charAt(i3))) {
                        break;
                    }
                    i3++;
                }
                if (i3 != -1 && str2.startsWith("|", i3)) {
                    strSubstring = str2.substring("|".length() + i3);
                }
                if (strSubstring == null) {
                    strSubstring = str2;
                }
            }
            if (strSubstring != null) {
                arrayList.add(strSubstring);
            }
            i = i2;
        }
    }
}
