import { getDomainRegexp as u } from "./check.js";
import { a as n } from "../.chunks/forms-BpbQYyEQ.es.js";
const s = new RegExp(`^[^a-zа-я0-9_%#!?.:'"«»[\\](){} \\r\\n\\t<>&/+-]`, "i"), g = (e) => {
  const r = e?.[0]?.match(s);
  return {
    icon: r ? e[0] : null,
    content: r ? e.substring(1) : e
  };
}, w = (e) => {
  e += "";
  let r = 0;
  if (!e.length) return r;
  for (let a = 0; a < e.length; a++) {
    const l = e.charCodeAt(a);
    r = (r << 5) - r + l, r = r & r;
  }
  return r < 0 && (r *= -1), r;
}, d = (e) => /^\w+:\/\/([\w-]+\.)+[\w-]+(:\d+)?(\/|$)/.test(e), M = (e) => {
  let r = e + "";
  r = r.replace("-", "–");
  let a = r.split("."), l = a[0], t = a.length > 1 ? "." + a[1] : "";
  if (l.replace(/[+–]/, "").length <= 4) return r;
  const o = /(\d+)(\d{3})/;
  for (; o.test(l); )
    l = l.replace(o, "$1 $2");
  return l + t;
}, m = (e) => e === void 0 ? "" : e.replace(/\r\n|\r|\n/g, "<br>"), h = (e) => typeof e == "string" ? e.trim() !== "" && !isNaN(Number(e)) : !0, C = (e, r = 2, a = 1e3, l = "") => {
  if (h(e))
    e = Number(e);
  else
    return String(e);
  const t = Math.pow(10, r);
  let o;
  return Math.abs(e) > Math.pow(a, 3) ? o = Math.round(e / Math.pow(a, 3) * t) / t + " <small>G" + l + "</small>" : Math.abs(e) > Math.pow(a, 2) ? o = Math.round(e / Math.pow(a, 2) * t) / t + " <small>M" + l + "</small>" : Math.abs(e) > a ? o = Math.round(e / a * t) / t + " <small>K" + l + "</small>" : o = Math.round(e * t) / t + "", o = o.replace(/^(-?\d+)(\d{3})/, "$1 $2"), o;
}, E = (e, r, a = 1) => {
  if (e == null) return "";
  if (e += "", r == null || e.length <= r) return e;
  if (a === 0)
    e = e.substr(e.length - r, r), e = "..." + e;
  else if (a === 1) {
    const l = e.substr(0, r / 2), t = e.substr(e.length - r / 2, Math.ceil(r / 2));
    e = l + "..." + t;
  } else a === 2 && (e = e.substr(0, r), e = e + "...");
  return e;
}, R = (e, r, a, l) => {
  if (n().value === "en")
    return e === 1 ? a : r;
  const t = e % 100, o = e % 10;
  return t >= 5 && t <= 20 || o === 0 ? r : o === 1 ? a : o >= 2 && o <= 4 ? l : o >= 5 && o <= 9 ? r : l;
}, b = (e) => {
  if (n().value != "ru" || e == "") return e;
  const r = e.split(" ");
  return $.map(r, function(a, l) {
    a = a + "а", a = a.replace("оа", "о"), a = a.replace("аяа", "ой"), a = a.replace("шийа", "шого"), a = a.replace("ыйа", "ого"), a = a.replace("йа", "я"), a = a.replace("ьа", "я"), a = a.replace("яа", "и"), a = a.replace("оваа", "овой"), a = a.replace("аа", "ы"), a = a.replace("кия", "кого"), a = a.replace("каи", "кой"), r[l] = a;
  }), e = r.join(" "), e;
}, A = (e) => {
  const r = {
    а: "a",
    б: "b",
    в: "v",
    г: "g",
    д: "d",
    е: "e",
    ё: "e",
    ж: "j",
    з: "z",
    и: "i",
    й: "i",
    к: "k",
    л: "l",
    м: "m",
    н: "n",
    о: "o",
    п: "p",
    р: "r",
    с: "s",
    т: "t",
    у: "u",
    ф: "f",
    х: "h",
    ц: "c",
    ч: "ch",
    ш: "sh",
    щ: "shch",
    ъ: "",
    ы: "y",
    ь: "",
    э: "e",
    ю: "u",
    я: "ya"
  }, a = e.split(" ");
  return $.map(a, function(l, t) {
    const o = [];
    for (let c = 0; c < l.length; ++c)
      o.push(
        r[l[c]] || r[l[c].toLowerCase()] == null && l[c] || r[l[c].toLowerCase()].replace(/^(.)/, function(p) {
          return p.toUpperCase();
        })
      );
    a[t] = o.join("");
  }), e = a.join(" "), e;
}, k = (e) => (e = e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"), e), v = (e, r) => {
  let a = null;
  switch (r.operator) {
    case "CONTAINS":
    case "REGEXP":
      try {
        let l = r.values[0];
        r.operator != "REGEXP" && (l = l.replace(/([()\[\]])/g, "\\$1")), a = new RegExp("(" + l + ")", "gi");
      } catch {
        return e;
      }
      break;
  }
  return e = e.replace(a, '<b class="found">$1</b>'), e;
}, L = (e) => e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map((r) => r.toLowerCase()).join("_"), S = (e) => `/controller/file/?src=${"/cloud/common/flags/" + e.toUpperCase() + ".svg"}`, y = (e) => {
  const r = u(), a = "(([\\/?\\w&=%+#;:-]*(\\.\\w+)?))*", l = new RegExp(`(^|[\\s>(),])([a-z0-9а-яё_.]+@${r}${a})`, "gui");
  e = e.replace(l, '$1<a href="mailto:$2" target="_blank" rel="noopener">↑[$2]↓</a>');
  const t = new RegExp(`(^|[\\s>(),])(https?://)?(${r}${a})`, "gui");
  return e = e.replace(t, '$1<a href="√$2$3" target="_blank" rel="nofollow noopener">$2$3</a>'), e = e.replaceAll("√http", "http"), e = e.replaceAll("√", "http://"), e = e.replaceAll(/(↑\[|]↓)/g, ""), e;
}, N = (e) => e.charAt(0).toUpperCase() + e.slice(1), I = (e = 20) => {
  const r = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890";
  let a = "";
  for (let l = 0; l < e; l++)
    a += r[Math.floor(Math.random() * r.length)];
  return a;
};
export {
  s as REGEXP_START_SYMBOL_ICON,
  M as addCommasWhite,
  y as addLinkTags,
  L as camelToSnakeCase,
  E as ellipsis,
  g as extractIconAndContent,
  S as genFlagLinkByCountryCode,
  w as genIntHash,
  I as getRandomHash,
  v as highlightHtml,
  k as htmlspecialchars,
  d as isUrl,
  m as nl2br,
  R as numberEnding,
  C as numberWithWord,
  A as rusToLatin,
  N as toCapitalize,
  b as toRoditPadej
};
//# sourceMappingURL=string.js.map
