package com.ifpdos.udi.sdk.kotlin.comment.parser;

import d.b.a.a.a;
import g.h0.c.g;
import g.h0.c.l;
import g.i;
import g.m0.f;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/* JADX INFO: compiled from: CommentDetails.kt */
/* JADX INFO: loaded from: classes.dex */
@i
public final class CommentDetails {
    public static final Companion Companion = new Companion(null);
    private final Map<String, List<String>> annotations;
    private final String description;
    private final String raw;
    private final String summary;
    private final String total;

    /* JADX INFO: compiled from: CommentDetails.kt */
    @i
    public static final class Companion {
        private Companion() {
        }

        public /* synthetic */ Companion(g gVar) {
            this();
        }

        private final void parserAnnotations(String str, Map<String, List<String>> map) {
            if (!f.b(str, " ", false, 2)) {
                List<String> arrayList = map.get(str);
                if (arrayList == null) {
                    arrayList = new ArrayList<>();
                    map.put(str, arrayList);
                }
                arrayList.add("");
                return;
            }
            List listE = f.E(str, new String[]{" "}, false, 2, 2);
            String str2 = (String) listE.get(0);
            String str3 = (String) listE.get(1);
            List<String> arrayList2 = map.get(str2);
            if (arrayList2 == null) {
                arrayList2 = new ArrayList<>();
                map.put(str2, arrayList2);
            }
            arrayList2.add(str3);
        }

        public final CommentDetails parseComment(String str) {
            String str2;
            l.f(str, "comment");
            StringBuilder sb = new StringBuilder();
            StringBuilder sb2 = new StringBuilder();
            LinkedHashMap linkedHashMap = new LinkedHashMap();
            Iterator it = f.E(f.R(str).toString(), new String[]{"\n"}, false, 0, 6).iterator();
            StringBuilder sb3 = sb;
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                String str3 = (String) it.next();
                if (f.J(f.R(str3).toString(), "@", false, 2)) {
                    Companion companion = CommentDetails.Companion;
                    String strSubstring = str3.substring(f.m(str3, "@", 0, false, 6) + 1);
                    l.e(strSubstring, "this as java.lang.String).substring(startIndex)");
                    companion.parserAnnotations(strSubstring, linkedHashMap);
                } else {
                    if (str3.length() == 0) {
                        if (sb.length() > 0) {
                            sb2.append("\n");
                            sb3 = sb2;
                        }
                    }
                    sb3.append(str3);
                    sb3.append("\n");
                }
            }
            String string = sb.toString();
            l.e(string, "summaryBuilder.toString()");
            String string2 = f.R(string).toString();
            String string3 = sb2.toString();
            l.e(string3, "descriptionBuilder.toString()");
            String string4 = f.R(string3).toString();
            if (string4.length() > 0) {
                str2 = string2 + '\n' + string4;
            } else {
                str2 = string2;
            }
            return new CommentDetails(f.R(str).toString(), str2, string2, string4, linkedHashMap);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public CommentDetails(String str, String str2, String str3, String str4, Map<String, ? extends List<String>> map) {
        l.f(str, "raw");
        l.f(str2, "total");
        l.f(str3, "summary");
        l.f(str4, "description");
        l.f(map, "annotations");
        this.raw = str;
        this.total = str2;
        this.summary = str3;
        this.description = str4;
        this.annotations = map;
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static /* synthetic */ CommentDetails copy$default(CommentDetails commentDetails, String str, String str2, String str3, String str4, Map map, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            str = commentDetails.raw;
        }
        if ((i2 & 2) != 0) {
            str2 = commentDetails.total;
        }
        String str5 = str2;
        if ((i2 & 4) != 0) {
            str3 = commentDetails.summary;
        }
        String str6 = str3;
        if ((i2 & 8) != 0) {
            str4 = commentDetails.description;
        }
        String str7 = str4;
        if ((i2 & 16) != 0) {
            map = commentDetails.annotations;
        }
        return commentDetails.copy(str, str5, str6, str7, map);
    }

    public final String component1() {
        return this.raw;
    }

    public final String component2() {
        return this.total;
    }

    public final String component3() {
        return this.summary;
    }

    public final String component4() {
        return this.description;
    }

    public final Map<String, List<String>> component5() {
        return this.annotations;
    }

    public final CommentDetails copy(String str, String str2, String str3, String str4, Map<String, ? extends List<String>> map) {
        l.f(str, "raw");
        l.f(str2, "total");
        l.f(str3, "summary");
        l.f(str4, "description");
        l.f(map, "annotations");
        return new CommentDetails(str, str2, str3, str4, map);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof CommentDetails)) {
            return false;
        }
        CommentDetails commentDetails = (CommentDetails) obj;
        return l.a(this.raw, commentDetails.raw) && l.a(this.total, commentDetails.total) && l.a(this.summary, commentDetails.summary) && l.a(this.description, commentDetails.description) && l.a(this.annotations, commentDetails.annotations);
    }

    public final Map<String, List<String>> getAnnotations() {
        return this.annotations;
    }

    public final String getDescription() {
        return this.description;
    }

    public final String getRaw() {
        return this.raw;
    }

    public final String getSummary() {
        return this.summary;
    }

    public final String getTotal() {
        return this.total;
    }

    public int hashCode() {
        return this.annotations.hashCode() + a.x(this.description, a.x(this.summary, a.x(this.total, this.raw.hashCode() * 31, 31), 31), 31);
    }

    public String toString() {
        StringBuilder sbB = a.B("CommentDetails(raw=");
        sbB.append(this.raw);
        sbB.append(", total=");
        sbB.append(this.total);
        sbB.append(", summary=");
        sbB.append(this.summary);
        sbB.append(", description=");
        sbB.append(this.description);
        sbB.append(", annotations=");
        sbB.append(this.annotations);
        sbB.append(')');
        return sbB.toString();
    }
}
