import { __require as D } from "./index-diacritics.js";
var v, g;
function T() {
  if (g) return v;
  g = 1;
  var o = D().clean, m = /[.*+?^${}()|[\]\\]/g, p = /[a-z0-9_]/i, A = /\s+/;
  function R(a) {
    return a.replace(m, "\\$&");
  }
  function q(a, f) {
    return a = a || {}, Object.keys(a).forEach(function(n) {
      f[n] = !!a[n];
    }), f;
  }
  return v = function(f, n, c) {
    c = q(c, {
      insideWords: !1,
      findAllOccurrences: !1,
      requireMatchAll: !1
    });
    var h = Array.from(f).map(function(e) {
      return o(e);
    }), i = h.join("");
    return n = o(n), n.trim().split(A).filter(function(e) {
      return e.length > 0;
    }).reduce(function(e, t) {
      var l = t.length, _ = !c.insideWords && p.test(t[0]) ? "\\b" : "", x = new RegExp(_ + R(t), "i"), u, r;
      if (u = x.exec(i), c.requireMatchAll && u === null)
        return i = "", [];
      for (; u; ) {
        r = u.index;
        var w = h.slice(r, r + l).join("").length, M = l - w, d = r - h.slice(0, r).join("").length, C = M, s = [
          r + d,
          r + l + d + C
        ];
        if (s[0] !== s[1] && e.push(s), i = i.slice(0, r) + new Array(l + 1).join(" ") + i.slice(r + l), !c.findAllOccurrences)
          break;
        u = x.exec(i);
      }
      return e;
    }, []).sort(function(e, t) {
      return e[0] - t[0];
    });
  }, v;
}
export {
  T as __require
};
