var c = {
  compareTwoStrings: g,
  findBestMatch: o
};
function g(r, t) {
  if (r = r.replace(/\s+/g, ""), t = t.replace(/\s+/g, ""), r === t)
    return 1;
  if (r.length < 2 || t.length < 2)
    return 0;
  let e = /* @__PURE__ */ new Map();
  for (let a = 0; a < r.length - 1; a++) {
    const n = r.substring(a, a + 2), i = e.has(n) ? e.get(n) + 1 : 1;
    e.set(n, i);
  }
  let s = 0;
  for (let a = 0; a < t.length - 1; a++) {
    const n = t.substring(a, a + 2), i = e.has(n) ? e.get(n) : 0;
    i > 0 && (e.set(n, i - 1), s++);
  }
  return 2 * s / (r.length + t.length - 2);
}
function o(r, t) {
  if (!l(r, t))
    throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");
  const e = [];
  let s = 0;
  for (let n = 0; n < t.length; n++) {
    const i = t[n], u = g(r, i);
    e.push({ target: i, rating: u }), u > e[s].rating && (s = n);
  }
  const a = e[s];
  return { ratings: e, bestMatch: a, bestMatchIndex: s };
}
function l(r, t) {
  return !(typeof r != "string" || !Array.isArray(t) || !t.length || t.find(function(e) {
    return typeof e != "string";
  }));
}
export {
  c as default
};
//# sourceMappingURL=index.js.map
