package com.discord.utilities.search; import d0.g0.w; import d0.t.n0; import d0.t.u; import d0.z.d.m; import java.util.Set; import kotlin.text.Regex; /* compiled from: SearchUtils.kt */ public final class SearchUtils { public static final SearchUtils INSTANCE = new SearchUtils(); private SearchUtils() { } public final boolean fuzzyMatch(String str, String str2) { m.checkNotNullParameter(str, "query"); m.checkNotNullParameter(str2, "target"); if (str.length() > str2.length()) { return false; } if (str.length() == str2.length()) { return m.areEqual(str, str2); } int length = str.length(); int i = 0; int i2 = 0; while (i < length) { char charAt = str.charAt(i); while (i2 < str2.length()) { int i3 = i2 + 1; char charAt2 = str2.charAt(i2); if (charAt2 == charAt || (charAt == ' ' && charAt2 == '-')) { i++; i2 = i3; } else { i2 = i3; } } return false; } return true; } public final Set getQueriesFromSearchText(String str) { m.checkNotNullParameter(str, "searchText"); return str.length() == 0 ? n0.emptySet() : u.toSet(w.split$default((CharSequence) new Regex("(\\n|\\t|\\s)").replace(new Regex("([!.;,\\-—–?\"'])").replace(w.trim(str).toString(), ""), " "), new char[]{' '}, false, 0, 6, (Object) null)); } }