'use strict';

/*!
 * @techmely/utils
 * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
 * MIT Licensed
 */


// src/RopeSequence/RopeSequence.ts
var RopeSequence = class _RopeSequence {
  // Create a rope representing the given array, or return the rope
  // itself if a rope was given.
  static from(values) {
    if (values instanceof _RopeSequence)
      return values;
    return values?.length ? new Leaf(values) : _RopeSequence.empty;
  }
  leafAppend(other) {
    return void 0;
  }
  leafPrepend(other) {
    return void 0;
  }
  sliceInner(from, to) {
    return new Leaf([]);
  }
  getInner(index) {
    return void 0;
  }
  forEachInner(f, from, to, start) {
  }
  forEachInvertedInner(f, from, to, start) {
  }
  /**
   * Append an array or other rope to this one, returning a new rope.
   */
  append(other) {
    if (!other.length)
      return this;
    other = _RopeSequence.from(other);
    return !this.length && other || other.length < GOOD_LEAF_SIZE && this.leafAppend(other) || this.length < GOOD_LEAF_SIZE && other.leafPrepend(this) || this.appendInner(other);
  }
  // :: (union<[T], RopeSequence<T>>) → RopeSequence<T>
  // Prepend an array or other rope to this one, returning a new rope.
  prepend(other) {
    if (!other.length)
      return this;
    return _RopeSequence.from(other).append(this);
  }
  appendInner(other) {
    return new Append(this, other);
  }
  /**
   * Create a rope representing a sub-sequence of this rope.
   */
  slice(from = 0, to = _RopeSequence.length) {
    if (from >= to)
      return _RopeSequence.empty;
    return this.sliceInner(Math.max(0, from), Math.min(this.length, to));
  }
  // :: (number) → T
  // Retrieve the element at the given position from this rope.
  get(i) {
    if (i < 0 || i >= _RopeSequence.length)
      return void 0;
    return this.getInner(i);
  }
  // :: ((element: T, index: number) → ?bool, ?number, ?number)
  // Call the given function for each element between the given
  // indices. This tends to be more efficient than looping over the
  // indices and calling `get`, because it doesn't have to descend the
  // tree for every element.
  forEach(f, from = 0, to = _RopeSequence.length) {
    if (from <= to)
      this.forEachInner(f, from, to, 0);
    else
      this.forEachInvertedInner(f, from, to, 0);
  }
  // Map the given functions over the elements of the rope, producing
  // a flat array.
  map(f, from = 0, to = _RopeSequence.length) {
    const result = [];
    this.forEach((elt, i) => result.push(f(elt, i)), from, to);
    return result;
  }
  set length(v) {
    this.length = v;
  }
  get length() {
    return this.values.length;
  }
};
var GOOD_LEAF_SIZE = 200;
var Leaf = class _Leaf extends RopeSequence {
  constructor(values) {
    super();
    this.values = values;
  }
  flatten() {
    return this.values;
  }
  sliceInner(from, to) {
    if (from === 0 && to === this.length)
      return this;
    return new _Leaf(this.values.slice(from, to));
  }
  getInner(i) {
    return this.values[i];
  }
  forEachInner(f, from, to, start) {
    for (let i = from; i < to; i++)
      if (f(this.values[i], start + i) === false)
        return false;
  }
  forEachInvertedInner(f, from, to, start) {
    for (let i = from - 1; i >= to; i--)
      if (f(this.values[i], start + i) === false)
        return false;
  }
  leafAppend(other) {
    if (this.length + other.length <= GOOD_LEAF_SIZE)
      return new _Leaf(this.values.concat(other.flatten()));
  }
  leafPrepend(other) {
    if (this.length + other.length <= GOOD_LEAF_SIZE)
      return new _Leaf(other.flatten().concat(this.values));
  }
  set length(v) {
    this.length = v;
  }
  get length() {
    return this.values.length;
  }
  get depth() {
    return 0;
  }
};
RopeSequence.empty = new Leaf([]);
var Append = class _Append extends RopeSequence {
  constructor(left, right) {
    super();
    this.left = left;
    this.right = right;
    this.length = left.length + right.length;
    this.depth = Math.max(left.depth, right.depth) + 1;
  }
  flatten() {
    return this.left.flatten().concat(this.right.flatten());
  }
  getInner(i) {
    return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length);
  }
  forEachInner(f, from, to, start) {
    const leftLen = this.left.length;
    if (from < leftLen && this.left.forEachInner(f, from, Math.min(to, leftLen), start) === false)
      return false;
    if (to > leftLen && this.right.forEachInner(
      f,
      Math.max(from - leftLen, 0),
      Math.min(this.length, to) - leftLen,
      start + leftLen
    ) === false)
      return false;
  }
  forEachInvertedInner(f, from, to, start) {
    const leftLen = this.left.length;
    if (from > leftLen && this.right.forEachInvertedInner(
      f,
      from - leftLen,
      Math.max(to, leftLen) - leftLen,
      start + leftLen
    ) === false)
      return false;
    if (to < leftLen && this.left.forEachInvertedInner(f, Math.min(from, leftLen), to, start) === false)
      return false;
  }
  sliceInner(from, to) {
    if (from === 0 && to === this.length)
      return this;
    const leftLen = this.left.length;
    if (to <= leftLen)
      return this.left.slice(from, to);
    if (from >= leftLen)
      return this.right.slice(from - leftLen, to - leftLen);
    return this.left.slice(from, leftLen).append(this.right.slice(0, to - leftLen));
  }
  leafAppend(other) {
    const inner = this.right.leafAppend(other);
    if (inner)
      return new _Append(this.left, inner);
  }
  leafPrepend(other) {
    const inner = this.left.leafPrepend(other);
    if (inner)
      return new _Append(inner, this.right);
  }
  appendInner(other) {
    if (this.left.depth >= Math.max(this.right.depth, other.depth) + 1)
      return new _Append(this.left, new _Append(this.right, other));
    return new _Append(this, other);
  }
};

// src/isBrowser.ts
function isBrowser() {
  return typeof window !== "undefined";
}

// src/alias.ts
var $ = (tag) => isBrowser() ? document.querySelector.call(void 0, tag) : null;
var $$ = (tag) => isBrowser() ? document.querySelectorAll.call(void 0, tag) : null;

// src/percentToHex.ts
function percentToHex(percent) {
  if (percent < 0 || percent > 100) {
    throw new Error("Value must in range [0, 100]");
  }
  const intValue = Math.round(percent / 100 * 255);
  const hexValue = intValue.toString(16);
  return hexValue.padStart(2, "0").toUpperCase();
}

// src/alphaHex.ts
var HEX_LENGTH = 6;
var HEX_OPACITY_LENGTH = 8;
function alphaHex(hex, alpha) {
  if (!hex) {
    throw new Error("Hex value is required");
  }
  if (hex.length === HEX_OPACITY_LENGTH) {
    return `${hex.slice(0, HEX_LENGTH)}${percentToHex(alpha)}`;
  }
  return `${hex}${percentToHex(alpha)}`;
}

// src/cacheImportModule.ts
var lazyImportCache = /* @__PURE__ */ new Map();
function createCachedImport(name, imp) {
  return () => {
    const cached = lazyImportCache.get(name);
    if (cached)
      return cached;
    const promise = imp().then((module) => {
      lazyImportCache.set(name, module);
      return module;
    });
    lazyImportCache.set(name, promise);
    return promise;
  };
}

// src/cacheStringFunc.ts
function cacheStringFunction(fn) {
  const cache = /* @__PURE__ */ Object.create(null);
  return (str) => {
    const hit = cache[str];
    return hit || (cache[str] = fn(str));
  };
}

// src/calculateFrequencies/index.ts
function calculateFrequencies(arr) {
  return arr.reduce((acc, curr) => {
    acc[curr] = (acc[curr] ?? 0) + 1;
    return acc;
  }, {});
}

// src/invariant.ts
var prefix = "Invariant failed";
function invariant(condition, message) {
  if (condition) {
    return;
  }
  if (typeof message === "string" || typeof message === "function") {
    const provided = typeof message === "function" ? message() : message;
    const value = provided ? `${prefix}: ${provided}` : prefix;
    throw new Error(value);
  }
  if (message)
    throw message;
  throw new Error(prefix);
}

// src/calculateScrollPercentage/index.ts
function calculateScrollPercentage() {
  invariant(isBrowser());
  const scrollPosition = window.scrollY || window.scrollY || document.documentElement.scrollTop;
  const totalHeight = document.documentElement.scrollHeight - window.innerHeight;
  const scrollPercentage = scrollPosition / totalHeight * 100;
  return scrollPercentage;
}

// src/isFunction.ts
function isFunction2(val) {
  return typeof val === "function";
}

// src/callOrReturn.ts
function callOrReturn(value, context = void 0, ...props) {
  if (isFunction2(value)) {
    if (context) {
      return value.bind(context)(...props);
    }
    return value(...props);
  }
  return value;
}

// src/camel2Snake.ts
var camel2snake = cacheStringFunction((str) => {
  return str.replace(/[A-Z0-9]/g, (char) => `_${char.toLocaleLowerCase()}`);
});

// src/camel2SnakeObject.ts
function camel2SnakeObject(obj) {
  return Object.entries(obj).reduce(
    // biome-ignore lint/performance/noAccumulatingSpread: Ignore here
    (acc, cur) => ({ ...acc, [camel2snake(cur[0])]: cur[1] }),
    {}
  );
}

// src/camelize.ts
var camelizeRE = /-(\w)/g;
var camelize = cacheStringFunction((str) => {
  return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
});

// src/cancelIdleCallback.ts
function cancelIdleCallbackShim(id) {
  clearTimeout(id);
}
var cancelIdleCallback = typeof window !== "undefined" ? window.cancelIdleCallback || cancelIdleCallbackShim : cancelIdleCallbackShim;

// src/capitalizeFirst.ts
var capitalizeFirst = cacheStringFunction((value) => {
  return value.replace(/^./, value[0].toUpperCase());
});

// src/isEdgeBrowser.ts
function isEdgeBrowser() {
  return typeof navigator !== "undefined" && navigator.userAgent.indexOf("Edg") > -1;
}

// src/isOpera.ts
function isOpera() {
  return typeof window !== "undefined" && typeof window.opr !== "undefined";
}

// src/isChrome.ts
function isChrome() {
  if (typeof window === "undefined")
    return false;
  const isChromium = window.chrome;
  const vendor = window.navigator.vendor;
  return isChromium !== null && typeof isChromium !== "undefined" && vendor === "Google Inc." && isOpera() === false && isEdgeBrowser() === false;
}

// src/chromeVersion.ts
function chromeVersion() {
  if (isChrome()) {
    const segments = /Chrome\/(\d+)/.exec(navigator.userAgent) || [0, 0];
    return +segments[1];
  }
  return 0;
}

// src/chunkArray.ts
function chunk(array, size = 1) {
  if (!array || array.length === 0) {
    return [];
  }
  const chunkLength = Math.ceil(array.length / size);
  return Array.from({ length: chunkLength }, (_v, i) => {
    const start = i * size;
    return array.slice(start, start + size);
  });
}

// src/clamp.ts
function clamp(n, min, max) {
  return Math.min(max, Math.max(min, n));
}

// src/convertHrTime.ts
function convertHrTime(hrtime) {
  const nanoseconds = hrtime;
  const number = Number(nanoseconds);
  const milliseconds = number / 1e6;
  const seconds = number / 1e9;
  return {
    seconds,
    milliseconds,
    nanoseconds
  };
}

// src/isDate.ts
function isDate(val) {
  return toString.call(val) === "[object Date]";
}

// src/cookie.ts
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
function parseCookie(str, options) {
  if (typeof str !== "string") {
    throw new TypeError("argument str must be a string");
  }
  const obj = {};
  const opt = options || {};
  const dec = opt.decode || decode;
  let index = 0;
  while (index < str.length) {
    const eqIdx = str.indexOf("=", index);
    if (eqIdx === -1) {
      break;
    }
    let endIdx = str.indexOf(";", index);
    if (endIdx === -1) {
      endIdx = str.length;
    } else if (endIdx < eqIdx) {
      index = str.lastIndexOf(";", eqIdx - 1) + 1;
      continue;
    }
    const key = str.slice(index, eqIdx).trim();
    if (obj[key] === void 0) {
      let val = str.slice(eqIdx + 1, endIdx).trim();
      if (val.charCodeAt(0) === 34) {
        val = val.slice(1, -1);
      }
      obj[key] = tryDecode(val, dec);
    }
    index = endIdx + 1;
  }
  return obj;
}
function serializeCookie(name, value, options) {
  const opt = options || {};
  const enc = opt.encode || encode;
  if (typeof enc !== "function") {
    throw new TypeError("option encode is invalid");
  }
  if (!fieldContentRegExp.test(name)) {
    throw new TypeError("argument name is invalid");
  }
  const encValue = enc(value);
  if (value && !fieldContentRegExp.test(value)) {
    throw new TypeError("argument val is invalid");
  }
  let str = `${name}=${encValue}`;
  if (null != opt.maxAge) {
    const maxAge = opt.maxAge - 0;
    if (Number.isNaN(maxAge) || !Number.isFinite(maxAge)) {
      throw new TypeError("option maxAge is invalid");
    }
    str += `; Max-Age=${Math.floor(maxAge)}`;
  }
  if (opt.domain) {
    if (!fieldContentRegExp.test(opt.domain)) {
      throw new TypeError("option domain is invalid");
    }
    str += `; Domain=${opt.domain}`;
  }
  if (opt.path) {
    if (!fieldContentRegExp.test(opt.path)) {
      throw new TypeError("option path is invalid");
    }
    str += `; Path=${opt.path}`;
  }
  if (opt.expires) {
    const expires = opt.expires;
    if (!isDate(expires) || Number.isNaN(expires.valueOf())) {
      throw new TypeError("option expires is invalid");
    }
    str += `; Expires=${expires.toUTCString()}`;
  }
  if (opt.httpOnly) {
    str += "; HttpOnly";
  }
  if (opt.secure) {
    str += "; Secure";
  }
  if (opt.priority) {
    const priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
    switch (priority) {
      case "low":
        str += "; Priority=Low";
        break;
      case "medium":
        str += "; Priority=Medium";
        break;
      case "high":
        str += "; Priority=High";
        break;
      default:
        throw new TypeError("option priority is invalid");
    }
  }
  if (opt.sameSite) {
    const sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
    switch (sameSite) {
      case true:
        str += "; SameSite=Strict";
        break;
      case "lax":
        str += "; SameSite=Lax";
        break;
      case "strict":
        str += "; SameSite=Strict";
        break;
      case "none":
        str += "; SameSite=None";
        break;
      default:
        throw new TypeError("option sameSite is invalid");
    }
  }
  return str;
}
function decode(str) {
  return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
}
function encode(val) {
  return encodeURIComponent(val);
}
function tryDecode(str, decode2) {
  try {
    return decode2(str);
  } catch (e) {
    return str;
  }
}
var listenCookieChange = (callback, interval = 500) => {
  let lastCookie = document.cookie;
  setInterval(() => {
    const { cookie } = document;
    if (cookie !== lastCookie) {
      try {
        callback({
          oldCookie: parseCookie(lastCookie),
          newCookie: parseCookie(cookie)
        });
      } finally {
        lastCookie = cookie;
      }
    }
  }, interval);
};
var CookieService = class {
  constructor(nodeEnv, env, cookieDomain) {
    this.nodeEnv = nodeEnv;
    this.env = env;
    this.domain = cookieDomain;
    this.tokenName = `token_${this.env}`;
  }
  get(name, options) {
    if (typeof window === "undefined")
      return void 0;
    try {
      const cookies = parseCookie(document.cookie, options);
      return cookies[name];
    } catch (error) {
      console.error({ error });
      return void 0;
    }
  }
  set(key, value, options) {
    const defaultOptions = {
      secure: true,
      path: "/",
      domain: this.domain,
      priority: "Medium",
      httpOnly: false,
      ...options
    };
    try {
      document.cookie = serializeCookie(key, value, defaultOptions);
    } catch (error) {
      console.error({ error });
    }
  }
  setToken(token) {
    document.cookie = this.env === "development" ? `${this.tokenName}=${token}; path=/; Secure` : `${this.tokenName}=${token}; path=/; Domain=${this.domain}; Secure`;
  }
  getToken() {
    const token = this.get(this.tokenName);
    return token;
  }
  clearToken() {
    document.cookie = this.env === "development" ? `${this.tokenName}=; path=/; Secure` : `${this.tokenName}=; path=/; Domain=${this.domain}; Secure`;
  }
};

// src/createElement/createElement.ts
function createElement(tag, ...children) {
  invariant(isBrowser(), "Not in browser environment");
  let element = tag;
  if (typeof element === "string")
    element = document.createElement(element);
  let i = 1;
  const next = arguments[1];
  if (next && typeof next === "object" && !next.nodeType && !Array.isArray(next)) {
    for (const name in next) {
      const value = next?.[name];
      if (typeof value === "string")
        element.setAttribute(name, value);
      if (value)
        element[name] = value;
    }
    i++;
  }
  for (; i < arguments.length; i++)
    add(element, arguments[i]);
  return element;
}
function add(element, child) {
  if (!child)
    return;
  if (typeof child === "string") {
    element.appendChild(document.createTextNode(child));
  } else if (child.nodeType !== null) {
    element.appendChild(child);
  } else if (Array.isArray(child)) {
    for (const c of child) {
      add(element, c);
    }
  }
}

// src/createStyleTag/index.ts
function createStyleTag(style, options) {
  invariant(isBrowser());
  const { id, ...rest } = options;
  const styleTag = document.querySelector(`style[#${id}]`);
  if (styleTag)
    return styleTag;
  const styleNode = document.createElement("style");
  const values = Object.entries(rest);
  for (const [k, v] of values) {
    styleNode.setAttribute(k, v);
  }
  styleNode.setAttribute("id", id);
  styleNode.innerHTML = style;
  document.getElementsByTagName("head")[0].appendChild(styleNode);
  return styleNode;
}

// src/cutString.ts
function cutString(value, limit) {
  if (!value && typeof value !== "string")
    return void 0;
  if (value.length === 0)
    return value;
  return value.split("").slice(0, limit).join("");
}

// src/debounce/index.ts
function debounce(func, delay2, immediate = false) {
  let timeoutId;
  return function(...args) {
    const callNow = immediate && !timeoutId;
    if (timeoutId)
      clearTimeout(timeoutId);
    timeoutId = setTimeout(() => {
      timeoutId = null;
      if (!immediate) {
        func.apply(this, args);
      }
    }, delay2);
    if (callNow) {
      func.apply(this, args);
    }
  };
}

// src/deleteProps.ts
function deleteProps(obj, propOrProps) {
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
  return Object.keys(obj).reduce((newObj, prop) => {
    if (!props.includes(prop)) {
      newObj[prop] = obj[prop];
    }
    return newObj;
  }, {});
}

// src/downloadByData.ts
function downloadByData(data, filename, mime, bom) {
  const blobData = typeof bom !== "undefined" ? [bom, data] : [data];
  const blob = new Blob(blobData, { type: mime || "application/octet-stream" });
  const blobURL = window.URL.createObjectURL(blob);
  const tempLink = document.createElement("a");
  tempLink.style.display = "none";
  tempLink.href = blobURL;
  tempLink.setAttribute("download", filename);
  tempLink.dataset.testid = "link-download-blob-file";
  if (typeof tempLink.download === "undefined") {
    tempLink.setAttribute("target", "_blank");
  }
  document.body.appendChild(tempLink);
  tempLink.click();
  document.body.removeChild(tempLink);
  window.URL.revokeObjectURL(blobURL);
}

// src/emitter.ts
function emitter(all) {
  const events = all || /* @__PURE__ */ new Map();
  const getHandlers = (type) => events.get(type);
  function on(type, handler) {
    const handlers = getHandlers(type);
    if (handlers) {
      handlers.push(handler);
    } else {
      events.set(type, [handler]);
    }
  }
  function off(type, handler) {
    const handlers = getHandlers(type);
    if (handlers) {
      if (handler) {
        const indexHandler = handlers.indexOf(handler) >>> 0;
        handlers.splice(indexHandler, 1);
      } else {
        events.set(type, []);
      }
    }
  }
  function emit(type, event) {
    let handlers = getHandlers(type);
    if (handlers) {
      for (const handler of handlers) {
        if (event)
          handler(event);
      }
    }
    handlers = events.get("*");
    if (handlers) {
      for (const handler of handlers) {
        if (event)
          handler(type, event);
      }
    }
  }
  return {
    events,
    on,
    off,
    emit
  };
}

// src/env.ts
var _envShim = /* @__PURE__ */ Object.create(null);
var _getEnv = (useShim) => globalThis.process?.env || // Node.js/Bun
undefined || // Vite env
globalThis.Deno?.env.toObject() || // Deno env
globalThis.__env__ || // Custom env
(useShim ? _envShim : globalThis);
function envShims() {
  return new Proxy(_envShim, {
    get(_, prop) {
      const env = _getEnv();
      return env[prop] ?? _envShim[prop];
    },
    has(_, prop) {
      const env = _getEnv();
      return prop in env || prop in _envShim;
    },
    set(_, prop, value) {
      const env = _getEnv(true);
      env[prop] = value;
      return true;
    },
    deleteProperty(_, prop) {
      if (!prop) {
        return false;
      }
      const env = _getEnv(true);
      delete env[prop];
      return true;
    },
    ownKeys() {
      const env = _getEnv();
      return Object.keys(env);
    }
  });
}

// src/escapeRegex.ts
function escapeRegExp(val) {
  return val.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}

// src/filterArrays/index.ts
function filterArrays(arr1, arr2, filterCondition) {
  const set2 = new Set(arr2);
  const result = [];
  for (const a of arr1) {
    for (const b of set2) {
      if (filterCondition(a, b)) {
        result.push(a);
        break;
      }
    }
  }
  return result;
}

// src/findDuplicates.ts
function findDuplicates(items) {
  const filtered = items.filter((el, index) => items.indexOf(el) !== index);
  return [...new Set(filtered)];
}

// src/findFirstDefined.ts
function findFirstDefined(...args) {
  return args.find((arg) => arg !== void 0);
}

// src/findLastIndex.ts
function findLastIndex(array, predicate) {
  let l = array.length;
  while (l--) {
    if (predicate(array[l], l, array)) {
      return l;
    }
  }
  return -1;
}

// src/firstUniqueArray.ts
function firstUniqueArr(array) {
  if (!array || array?.length === 0)
    return void 0;
  const arrLength = array.length;
  if (array.length === 1)
    return array[0];
  for (let i = 0; i < arrLength; i++) {
    const element = array[i];
    if (array.indexOf(element) === array.lastIndexOf(element))
      return element;
  }
  return void 0;
}

// src/firstUniqueChar.ts
function firstUniqueChar(value) {
  if (!value)
    return void 0;
  const charLength = value.length;
  for (let i = 0; i < charLength; i++) {
    const letter = value[i];
    if (value.indexOf(letter) === value.lastIndexOf(letter))
      return letter;
  }
  return void 0;
}

// src/flattenObject/index.ts
function flattenObject(obj, prefix2 = "", result = {}) {
  for (const key in obj) {
    const newKey = prefix2 ? `${prefix2}.${key}` : key;
    if (typeof obj[key] === "object" && obj[key] !== null && !Array.isArray(obj[key])) {
      flattenObject(obj[key], newKey, result);
    } else {
      result[newKey] = obj[key];
    }
  }
  return result;
}

// src/formatBytes.ts
var formatBytes = (bytes, options) => {
  const sizes = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
  const { numberOfDecimals = 0 } = options ?? {};
  if (!bytes || bytes <= 0) {
    return "0 bytes";
  }
  if (bytes === 1) {
    return "1 byte";
  }
  const base = 1e3;
  const exponent = Math.trunc(Math.log(bytes) / Math.log(base));
  const rawValue = bytes / base ** exponent;
  let [whole, partial = ""] = rawValue.toString().split(".");
  if (numberOfDecimals > 0) {
    const count = numberOfDecimals - partial.length;
    if (count > 0) {
      partial += "0".repeat(count);
    }
    whole += `.${partial.slice(0, numberOfDecimals)}`;
  }
  const abbreviationSuffix = sizes[exponent];
  return `${whole} ${abbreviationSuffix}`;
};

// src/isNumber.ts
function isNumber(val) {
  return toString.call(val) === "[object Number]";
}

// src/formatLot10Volume.ts
function formatLot10Volume(volume, precision = 0, defaultValue = "-") {
  if (!isNumber(volume)) {
    return defaultValue;
  }
  return (volume * 10)?.toLocaleString("en", { minimumFractionDigits: precision }).slice(0, -1);
}

// src/formatNumber.ts
function formatNumber(num, precision = 0, defaultValue = "-") {
  if (!isNumber(num)) {
    return defaultValue;
  }
  return num.toLocaleString("en", {
    minimumFractionDigits: precision,
    maximumFractionDigits: precision
  });
}

// src/fromString2Primitive.ts
function fromStringToPrimitives(value) {
  if (typeof value !== "string") {
    return value;
  }
  if (value.match(/^[+-]?(?:\d*\.)?\d+$/)) {
    return Number(value);
  }
  if (value === "true") {
    return true;
  }
  if (value === "false") {
    return false;
  }
  return value;
}

// src/isServer.ts
function isServer() {
  return typeof window === "undefined";
}

// src/fullScreen.ts
function requestFullscreen(mode = true, el = "body") {
  if (isServer())
    return;
  if (mode)
    document.querySelector(el)?.requestFullscreen();
  else
    document.exitFullscreen();
}

// src/generateSampleArray.ts
function generateSample(arr, count) {
  return Array.from({ length: count }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);
}

// src/get/index.ts
function get(from, selector) {
  return selector.replace(/\[([^\[\]]*)\]/g, ".$1.").split(".").filter((t) => t !== "").reduce((acc, curr) => acc?.[curr], from);
}

// src/getMineTypeFromExtension.ts
var MimeType = /* @__PURE__ */ ((MimeType2) => {
  MimeType2["JPG"] = "image/jpeg";
  MimeType2["GIF"] = "image/gif";
  MimeType2["PNG"] = "image/png";
  MimeType2["MP4"] = "video/mp4";
  MimeType2["QuickTime"] = "video/quicktime";
  MimeType2["AVI"] = "video/x-msvideo";
  MimeType2["WMV"] = "video/x-ms-wmv";
  MimeType2["HEIC"] = "image/heic";
  return MimeType2;
})(MimeType || {});
var mimeTable = [
  { ext: ["gif"], type: "image/gif" /* GIF */ },
  { ext: ["jpe", "jpeg", "jpg"], type: "image/jpeg" /* JPG */ },
  { ext: ["png"], type: "image/png" /* PNG */ },
  { ext: ["qt", "mov"], type: "video/quicktime" /* QuickTime */ },
  { ext: ["mp4", "mp4v", "mpg4", "m4v"], type: "video/mp4" /* MP4 */ },
  { ext: ["avi"], type: "video/x-msvideo" /* AVI */ },
  { ext: ["wmv"], type: "video/x-ms-wmv" /* WMV */ },
  { ext: ["heic"], type: "image/heic" /* HEIC */ }
];
var getMimeTypeFromExtension = (extension) => {
  const result = mimeTable.find(({ ext }) => ext.includes(extension));
  if (!result) {
    throw new Error(`'${extension}' is not a valid extension`);
  }
  return result.type;
};

// src/getQuarter.ts
function getQuarter(d = /* @__PURE__ */ new Date()) {
  return Math.ceil((d.getMonth() + 1) / 3);
}

// src/getRandomInt.ts
function getRandomInt(min, max) {
  const _min = Math.ceil(min);
  const _max = Math.floor(max);
  return Math.floor(Math.random() * (_max - _min) + _min);
}

// src/getRandomIntInclusive.ts
function getRandomIntInclusive(min, max) {
  const _min = Math.ceil(min);
  const _max = Math.floor(max);
  return Math.floor(Math.random() * (_max - _min + 1) + _min);
}

// src/getRandomString.ts
function getRandomString(length, alphanumeric) {
  let str = "";
  let i = 0;
  const min = alphanumeric === "a" ? 10 : 0;
  const max = alphanumeric === "n" ? 10 : 62;
  while (i++ < length) {
    let r = Math.trunc(Math.random() * (max - min) + min);
    str += String.fromCodePoint(r += r > 9 ? r < 36 ? 55 : 61 : 48);
  }
  return str;
}

// src/lerp.ts
function lerp(y1, y2, mu) {
  return y1 * (1 - mu) + y2 * mu;
}

// src/getStrokeRadius.ts
function getStrokeRadius(size, thinning, easing, pressure = 0.5) {
  if (!thinning) {
    return size / 2;
  }
  const newPressure = clamp(easing(pressure), 0, 1);
  return (thinning < 0 ? lerp(size, size + size * clamp(thinning, -0.95, -0.05), newPressure) : lerp(size - size * clamp(thinning, 0.05, 0.95), size, newPressure)) / 2;
}

// src/groupBy.ts
function groupBy(list, keyGetter) {
  const map = /* @__PURE__ */ new Map();
  for (const item of list) {
    const key = keyGetter(item);
    const collection = map.get(key);
    if (collection) {
      collection.push(item);
    } else {
      map.set(key, [item]);
    }
  }
  return map;
}

// src/hasDuplicates/index.ts
function hasDuplicates(arr) {
  return arr.length !== new Set(arr).size;
}

// src/isDeepEqual/index.ts
function isDeepEqual(obj1, obj2) {
  if (obj1 === obj2) {
    return true;
  }
  if (typeof obj1 === "object" && obj1 !== null && typeof obj2 === "object" && obj2 !== null) {
    const keys1 = Object.keys(obj1);
    const keys2 = Object.keys(obj2);
    if (keys1.length !== keys2.length) {
      return false;
    }
    for (const key of keys1) {
      if (!Object.hasOwn(obj2, key)) {
        return false;
      }
      if (!isDeepEqual(obj1[key], obj2[key])) {
        return false;
      }
    }
    return true;
  }
  return false;
}

// src/haveSameElement/index.ts
function haveSameElement(arr1, arr2) {
  for (let i = 0; i < arr1.length; i++) {
    const el = arr1[i];
    if (arr2.some((e) => isDeepEqual(e, el))) {
      return true;
    }
  }
  return false;
}

// src/http.ts
var HTTP_CONTINUE = 100;
var HTTP_SWITCHING_PROTOCOLS = 101;
var HTTP_PROCESSING = 102;
var HTTP_EARLY_HINTS = 103;
var HTTP_OK = 200;
var HTTP_CREATED = 201;
var HTTP_ACCEPTED = 202;
var HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
var HTTP_NO_CONTENT = 204;
var HTTP_RESET_CONTENT = 205;
var HTTP_PARTIAL_CONTENT = 206;
var HTTP_MULTI_STATUS = 207;
var HTTP_ALREADY_REPORTED = 208;
var HTTP_IM_USED = 226;
var HTTP_MULTIPLE_CHOICES = 300;
var HTTP_MOVED_PERMANENTLY = 301;
var HTTP_FOUND = 302;
var HTTP_SEE_OTHER = 303;
var HTTP_NOT_MODIFIED = 304;
var HTTP_USE_PROXY = 305;
var HTTP_RESERVED = 306;
var HTTP_TEMPORARY_REDIRECT = 307;
var HTTP_PERMANENTLY_REDIRECT = 308;
var HTTP_BAD_REQUEST = 400;
var HTTP_UNAUTHORIZED = 401;
var HTTP_PAYMENT_REQUIRED = 402;
var HTTP_FORBIDDEN = 403;
var HTTP_NOT_FOUND = 404;
var HTTP_METHOD_NOT_ALLOWED = 405;
var HTTP_NOT_ACCEPTABLE = 406;
var HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
var HTTP_REQUEST_TIMEOUT = 408;
var HTTP_CONFLICT = 409;
var HTTP_GONE = 410;
var HTTP_LENGTH_REQUIRED = 411;
var HTTP_PRECONDITION_FAILED = 412;
var HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
var HTTP_REQUEST_URI_TOO_LONG = 414;
var HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
var HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
var HTTP_EXPECTATION_FAILED = 417;
var HTTP_I_AM_A_TEAPOT = 418;
var HTTP_MISDIRECTED_REQUEST = 421;
var HTTP_UNPROCESSABLE_ENTITY = 422;
var HTTP_LOCKED = 423;
var HTTP_FAILED_DEPENDENCY = 424;
var HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425;
var HTTP_UPGRADE_REQUIRED = 426;
var HTTP_PRECONDITION_REQUIRED = 428;
var HTTP_TOO_MANY_REQUESTS = 429;
var HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
var HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
var HTTP_INTERNAL_SERVER_ERROR = 500;
var HTTP_NOT_IMPLEMENTED = 501;
var HTTP_BAD_GATEWAY = 502;
var HTTP_SERVICE_UNAVAILABLE = 503;
var HTTP_GATEWAY_TIMEOUT = 504;
var HTTP_VERSION_NOT_SUPPORTED = 505;
var HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506;
var HTTP_INSUFFICIENT_STORAGE = 507;
var HTTP_LOOP_DETECTED = 508;
var HTTP_NOT_EXTENDED = 510;
var HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511;
var HTTP_CF_UNKNOWN = 520;
var HTTP_CF_WEB_SERVER_IS_DOWN = 521;
var HTTP_CF_CONNECTION_TIMED_OUT = 522;
var HTTP_CF_ORIGIN_IS_UNREACHABLE = 523;
var HTTP_CF_A_TIMEOUT_OCCURRED = 524;
var HTTP_CF_SSL_HANDSHAKE_FAILED = 525;
var HTTP_CF_INVALID_SSL_CERTIFICATE = 526;
var HTTP_CF_RAILGUN_ERROR = 527;

// src/hyphenate.ts
var hyphenateRE = /\B([A-Z])/g;
var hyphenate = cacheStringFunction(
  (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
);

// src/intHex.ts
function intToHex(integer) {
  if (integer < 0) {
    throw new Error("Invalid integer as argument, must be unsigned!");
  }
  const hex = integer.toString(16);
  return hex.length % 2 ? `0${hex}` : hex;
}

// src/intBuffer.ts
function intToBuffer(integer) {
  const hex = intToHex(integer);
  return Buffer.from(hex, "hex");
}

// src/isAndroid.ts
function isAndroid() {
  return typeof navigator !== "undefined" ? /(android)/i.test(navigator.userAgent) : false;
}

// src/isAppleDevice/index.ts
function isAppleDevice() {
  if (typeof navigator === "undefined")
    return false;
  return /(Mac|iPhone|iPod|iPad)/i.test(navigator.userAgent);
}

// src/isArray.ts
function isArray(val) {
  return val && Array.isArray(val);
}

// src/isBase64.ts
function isBase64(base) {
  return /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/.test(base);
}

// src/isBoolean.ts
function isBoolean(val) {
  return typeof val === "boolean";
}

// src/isBot.ts
var botPatterns = [
  " daum[ /]",
  " deusu/",
  " yadirectfetcher",
  "(?:^| )site",
  "(?:^|[^g])news",
  "(?<! (?:channel/|google/))google(?!(app|/google| pixel))",
  "(?<! cu)bot(?:[^\\w]|_|$)",
  "(?<! ya(?:yandex)?)search",
  "(?<!(?:lib))http",
  "(?<![hg]m)score",
  "@[a-z]",
  "\\(at\\)[a-z]",
  "\\[at\\][a-z]",
  "^12345",
  "^<",
  "^[\\w \\.\\-\\(?:\\):]+(?:/v?\\d+(\\.\\d+)?(?:\\.\\d{1,10})?)?(?:,|$)",
  "^[^ ]{50,}$",
  "^active",
  "^ad muncher",
  "^amaya",
  "^anglesharp/",
  "^avsdevicesdk/",
  "^bidtellect/",
  "^biglotron",
  "^bot",
  "^btwebclient/",
  "^clamav[ /]",
  "^client/",
  "^cobweb/",
  "^coccoc",
  "^custom",
  "^ddg[_-]android",
  "^discourse",
  "^dispatch/\\d",
  "^downcast/",
  "^duckduckgo",
  "^facebook",
  "^fdm[ /]\\d",
  "^getright/",
  "^gozilla/",
  "^hatena",
  "^hobbit",
  "^hotzonu",
  "^hwcdn/",
  "^jeode/",
  "^jetty/",
  "^jigsaw",
  "^linkdex",
  "^metauri",
  "^microsoft bits",
  "^movabletype",
  "^mozilla/\\d\\.\\d \\(compatible;?\\)$",
  "^mozilla/\\d\\.\\d \\w*$",
  "^navermailapp",
  "^netsurf",
  "^nuclei",
  "^offline explorer",
  "^php",
  "^postman",
  "^postrank",
  "^python",
  "^rank",
  "^read",
  "^reed",
  "^rest",
  "^serf",
  "^snapchat",
  "^space bison",
  "^svn",
  "^swcd ",
  "^taringa",
  "^thumbor/",
  "^tumblr/",
  "^user-agent:",
  "^valid",
  "^venus/fedoraplanet",
  "^w3c",
  "^webbandit/",
  "^webcopier",
  "^wget",
  "^whatsapp",
  "^xenu link sleuth",
  "^yahoo",
  "^yandex",
  "^zdm/\\d",
  "^zoom marketplace/",
  "^{{.*}}$",
  "adbeat\\.com",
  "appinsights",
  "archive",
  "ask jeeves/teoma",
  "bit\\.ly/",
  "bluecoat drtr",
  "browsex",
  "burpcollaborator",
  "capture",
  "catch",
  "check",
  "chrome-lighthouse",
  "chromeframe",
  "classifier",
  "cloud",
  "crawl",
  "cryptoapi",
  "dareboost",
  "datanyze",
  "dataprovider",
  "dejaclick",
  "dmbrowser",
  "download",
  "evc-batch/",
  "feed",
  "firephp",
  "freesafeip",
  "gomezagent",
  "headless",
  "httrack",
  "hubspot marketing grader",
  "hydra",
  "ibisbrowser",
  "images",
  "inspect",
  "iplabel",
  "ips-agent",
  "java(?!;)",
  "library",
  "mail\\.ru/",
  "manager",
  "monitor",
  "neustar wpm",
  "nutch",
  "offbyone",
  "optimize",
  "pageburst",
  "parser",
  "perl",
  "phantom",
  "pingdom",
  "powermarks",
  "preview",
  "proxy",
  "ptst[ /]\\d",
  "reader",
  "reputation",
  "resolver",
  "retriever",
  "rexx;",
  "rigor",
  "robot",
  "rss",
  "scan",
  "scrape",
  "server",
  "sogou",
  "sparkler/",
  "speedcurve",
  "spider",
  "splash",
  "statuscake",
  "stumbleupon\\.com",
  "supercleaner",
  "synapse",
  "synthetic",
  "torrent",
  "trace",
  "transcoder",
  "twingly recon",
  "url",
  "virtuoso",
  "wappalyzer",
  "webglance",
  "webkit2png",
  "whatcms/",
  "wordpress",
  "zgrab"
];
var botFullPattern = " daum[ /]| deusu/| yadirectfetcher|(?:^| )site|(?:^|[^g])news|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bot(?:[^\\w]|_|$)|(?<! ya(?:yandex)?)search|(?<!(?:lib))http|(?<![hg]m)score|@[a-z]|\\(at\\)[a-z]|\\[at\\][a-z]|^12345|^<|^[\\w \\.\\-\\(?:\\):]+(?:/v?\\d+(\\.\\d+)?(?:\\.\\d{1,10})?)?(?:,|$)|^[^ ]{50,}$|^active|^ad muncher|^amaya|^anglesharp/|^avsdevicesdk/|^bidtellect/|^biglotron|^bot|^btwebclient/|^clamav[ /]|^client/|^cobweb/|^coccoc|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^facebook|^fdm[ /]\\d|^getright/|^gozilla/|^hatena|^hobbit|^hotzonu|^hwcdn/|^jeode/|^jetty/|^jigsaw|^linkdex|^metauri|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d \\(compatible;?\\)$|^mozilla/\\d\\.\\d \\w*$|^navermailapp|^netsurf|^nuclei|^offline explorer|^php|^postman|^postrank|^python|^rank|^read|^reed|^rest|^serf|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^tumblr/|^user-agent:|^valid|^venus/fedoraplanet|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|adbeat\\.com|appinsights|archive|ask jeeves/teoma|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check|chrome-lighthouse|chromeframe|classifier|cloud|crawl|cryptoapi|dareboost|datanyze|dataprovider|dejaclick|dmbrowser|download|evc-batch/|feed|firephp|freesafeip|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|images|inspect|iplabel|ips-agent|java(?!;)|library|mail\\.ru/|manager|monitor|neustar wpm|nutch|offbyone|optimize|pageburst|parser|perl|phantom|pingdom|powermarks|preview|proxy|ptst[ /]\\d|reader|reputation|resolver|retriever|rexx;|rigor|robot|rss|scan|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|stumbleupon\\.com|supercleaner|synapse|synthetic|torrent|trace|transcoder|twingly recon|url|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|wordpress|zgrab";
var regularExpression = / daum[ /]| deusu\/| yadirectfetcher|(?:^| )site|(?:^|[^g])news|(?<! (?:channel\/|google\/))google(?!(app|\/google| pixel))|(?<! cu)bot(?:[^\w]|_|$)|(?<! ya(?:yandex)?)search|(?<!(?:lib))http|(?<![hg]m)score|@[a-z]|\(at\)[a-z]|\[at\][a-z]|^12345|^<|^[\w \.\-\(?:\):]+(?:\/v?\d+(\.\d+)?(?:\.\d{1,10})?)?(?:,|$)|^[^ ]{50,}$|^active|^ad muncher|^amaya|^anglesharp\/|^avsdevicesdk\/|^bidtellect\/|^biglotron|^bot|^btwebclient\/|^clamav[ /]|^client\/|^cobweb\/|^coccoc|^custom|^ddg[_-]android|^discourse|^dispatch\/\d|^downcast\/|^duckduckgo|^facebook|^fdm[ /]\d|^getright\/|^gozilla\/|^hatena|^hobbit|^hotzonu|^hwcdn\/|^jeode\/|^jetty\/|^jigsaw|^linkdex|^metauri|^microsoft bits|^movabletype|^mozilla\/\d\.\d \(compatible;?\)$|^mozilla\/\d\.\d \w*$|^navermailapp|^netsurf|^nuclei|^offline explorer|^php|^postman|^postrank|^python|^rank|^read|^reed|^rest|^serf|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor\/|^tumblr\/|^user-agent:|^valid|^venus\/fedoraplanet|^w3c|^webbandit\/|^webcopier|^wget|^whatsapp|^xenu link sleuth|^yahoo|^yandex|^zdm\/\d|^zoom marketplace\/|^{{.*}}$|adbeat\.com|appinsights|archive|ask jeeves\/teoma|bit\.ly\/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check|chrome-lighthouse|chromeframe|classifier|cloud|crawl|cryptoapi|dareboost|datanyze|dataprovider|dejaclick|dmbrowser|download|evc-batch\/|feed|firephp|freesafeip|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|images|inspect|iplabel|ips-agent|java(?!;)|library|mail\.ru\/|manager|monitor|neustar wpm|nutch|offbyone|optimize|pageburst|parser|perl|phantom|pingdom|powermarks|preview|proxy|ptst[ /]\d|reader|reputation|resolver|retriever|rexx;|rigor|robot|rss|scan|scrape|server|sogou|sparkler\/|speedcurve|spider|splash|statuscake|stumbleupon\.com|supercleaner|synapse|synthetic|torrent|trace|transcoder|twingly recon|url|virtuoso|wappalyzer|webglance|webkit2png|whatcms\/|wordpress|zgrab/i;
var naivePattern = /bot|spider|crawl|http|lighthouse/i;
var botRegPattern = regularExpression;
function isBotNaive(userAgent) {
  return naivePattern.test(userAgent || "");
}
var usedPattern;
function isBot(userAgent) {
  if (typeof usedPattern === "undefined") {
    try {
      usedPattern = new RegExp(botFullPattern, "i");
    } catch (error) {
      usedPattern = naivePattern;
    }
  }
  return usedPattern.test(userAgent || "");
}
function createIsBot(customPattern) {
  return (userAgent) => {
    return customPattern.test(userAgent || "");
  };
}
function createIsBotFromList(list) {
  const pattern = new RegExp(list.join("|"), "i");
  return (userAgent) => {
    return pattern.test(userAgent || "");
  };
}
function isBotMatch(userAgent) {
  return userAgent?.match(botRegPattern)?.[0] ?? null;
}
function isBotMatches(userAgent) {
  if (!userAgent)
    return [];
  return botPatterns.map((part) => {
    const matched = userAgent.match(new RegExp(part, "i"));
    if (!matched)
      return "";
    return matched[0];
  }).filter(Boolean);
}
function isBotPattern(userAgent) {
  return userAgent ? botPatterns.find((pattern) => new RegExp(pattern, "i").test(userAgent)) ?? null : null;
}
function isBotPatterns(userAgent) {
  return userAgent ? botPatterns.filter((pattern) => new RegExp(pattern, "i").test(userAgent)) : [];
}

// src/isChromeIOS.ts
function isIOSChrome() {
  return typeof navigator !== "undefined" && navigator.userAgent.match("CriOS");
}

// src/isCrawler.ts
function isCrawler() {
  return typeof window !== "undefined" && (!("onscroll" in window) || /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent));
}

// src/isDefined.ts
function isDefined(val) {
  return typeof val !== "undefined";
}

// src/isDistinctArray/index.ts
function isDistinctArray(arr) {
  return arr.length === new Set(arr).size;
}

// src/isEmptyArray.ts
function isEmptyArr(array) {
  return Array.isArray(array) && array?.length === 0;
}

// src/isObject.ts
function isObject2(val) {
  return toString.call(val) === "[object Object]" && !Array.isArray(val);
}

// src/isString.ts
function isString(val) {
  return typeof val === "string";
}

// src/isEmpty.ts
function isEmpty(val) {
  if (!val) {
    return true;
  }
  if (isArray(val)) {
    return isEmptyArr(val);
  }
  if (isString(val)) {
    return val.trim().length === 0;
  }
  if (val instanceof Map || val instanceof Set) {
    return val.size === 0;
  }
  if (isObject2(val)) {
    return Object.keys(val).length === 0;
  }
  return false;
}

// src/isEmpties.ts
function isEmpties(...args) {
  if (args.length > 1) {
    return args.reduce((a, b) => a && isEmpty(b), true);
  }
  return false;
}

// src/isGecko.ts
function isGecko() {
  return typeof navigator !== "undefined" && /gecko\/(\d+)/i.test(navigator.userAgent);
}

// src/isHexColor.ts
var hexColor = /^#(([\da-f]{2}){3,4})$/;
function isHex(hex) {
  return hexColor.test(hex);
}

// src/isIOS.ts
function isIOS() {
  return typeof navigator !== "undefined" ? ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
    navigator.platform
  ) || // iPad on iOS 13 detection
  navigator.userAgent.includes("Mac") && "ontouchend" in document : false;
}

// src/isISOString/index.ts
function isISOString(val) {
  const d = new Date(val);
  return !Number.isNaN(d.valueOf()) && d.toISOString() === val;
}

// src/toISOStringTimezone/index.ts
var pad = (n) => `${Math.floor(Math.abs(n))}`.padStart(2, "0");
var getTimezoneOffset = (date) => {
  const tzOffset = -date.getTimezoneOffset();
  const diff = tzOffset >= 0 ? "+" : "-";
  return `${diff + pad(tzOffset / 60)}:${pad(tzOffset % 60)}`;
};
function toISOStringTimezone(date) {
  return `${date.getFullYear()}
    -${pad(date.getMonth() + 1)}
    -${pad(date.getDate())}
    T${pad(date.getHours())}
    :${pad(date.getMinutes())}
    :${pad(date.getSeconds())}
    ${getTimezoneOffset(date)}`;
}

// src/isISOStringTimeZone/index.ts
function isISOStringWithTimezone(val) {
  const d = new Date(val);
  return !Number.isNaN(d.valueOf()) && toISOStringTimezone(d) === val;
}

// src/isKeyof.ts
function isKeyOf(obj, k) {
  return k in obj;
}

// src/process.ts
var _process = globalThis.process || /* @__PURE__ */ Object.create(null);
var processShims = {
  versions: {}
};
var globProcess = new Proxy(_process, {
  get(target, prop) {
    if (prop === "env") {
      return envShims();
    }
    if (prop in target) {
      return target[prop];
    }
    if (prop in processShims) {
      return processShims[prop];
    }
  }
});

// src/isLinux.ts
function isLinux() {
  return /^linux/i.test(globProcess.platform || "");
}

// src/isMacOs.ts
function isMacOS() {
  return /^darwin/i.test(globProcess.platform || "");
}

// src/matchMedia.ts
function windowMatchMedia() {
  return typeof window !== "undefined" ? window.matchMedia || window.msMatchMedia : void 0;
}

// src/isMobile.ts
function isMobile() {
  return typeof window !== "undefined" ? windowMatchMedia()?.("(pointer:coarse)")?.matches : false;
}

// src/toBoolean.ts
function toBoolean(val) {
  return val ? val !== "false" : false;
}

// src/isNodeProd.ts
function isNodeProd() {
  return globProcess.env.NODE_ENV === "production" || toBoolean(envShims().PRODUCTION);
}

// src/isNodeTest.ts
function isNodeTest() {
  return globProcess.env.NODE_ENV === "test" || toBoolean(envShims().TEST);
}

// src/isNotEmpty.ts
function isNotEmpty(val) {
  return !isEmpty(val);
}

// src/isNotEmpties.ts
function isNotEmpties(...args) {
  if (args.length > 1) {
    return args.reduce((a, b) => a && isNotEmpty(b), true);
  }
  return false;
}

// src/isNotNull.ts
function isNotNull(v) {
  return v !== null;
}

// src/isNotNullish.ts
function isNotNullish(v) {
  return v != null;
}

// src/isNullOrUndef/index.ts
function isNullOrUndefined(value) {
  return value === null || value === void 0;
}

// src/isPlainObject/index.ts
function isPlainObject(value) {
  if (!isObjectLike(value) || getTag(value) !== "[object Object]") {
    return false;
  }
  if (Object.getPrototypeOf(value) === null) {
    return true;
  }
  let proto = value;
  while (Object.getPrototypeOf(proto) !== null) {
    proto = Object.getPrototypeOf(proto);
  }
  return Object.getPrototypeOf(value) === proto;
}
function isObjectLike(value) {
  return typeof value === "object" && value !== null;
}
function getTag(value) {
  if (value == null) {
    return value === void 0 ? "[object Undefined]" : "[object Null]";
  }
  return Object.prototype.toString.call(value);
}

// src/isPngImage.ts
function isPngImage(buffer) {
  if (!buffer || buffer.length < 8) {
    return false;
  }
  return buffer[0] === 137 && buffer[1] === 80 && buffer[2] === 78 && buffer[3] === 71 && buffer[4] === 13 && buffer[5] === 10 && buffer[6] === 26 && buffer[7] === 10;
}

// src/isPrefersReducedMotion.ts
function isPrefersReducedMotion() {
  const mediaQuery = windowMatchMedia()?.("(prefers-reduced-motion: reduce)");
  return typeof window !== "undefined" ? mediaQuery?.matches : false;
}

// src/isPrimitive.ts
function isPrimitive(value) {
  if (value === null) {
    return true;
  }
  return !["array", "function", "object"].includes(typeof value);
}

// src/isPromise.ts
function isPromise(val) {
  return isObject(val) && isFunction(val.then) && isFunction(val.catch);
}

// src/isRegexp.ts
function isRegExp(value) {
  return Object.prototype.toString.call(value) === "[object RegExp]";
}

// src/isSafari.ts
function isSafari() {
  return typeof navigator !== "undefined" && navigator.vendor.indexOf("Apple") > -1 && navigator.userAgent.indexOf("CriOS") === -1 && navigator.userAgent.indexOf("FxiOS") === -1;
}

// src/isSameDay.ts
function isSameDay(date1, date2) {
  if (!(date1 && date2)) {
    return false;
  }
  return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
}

// src/isSameMonth.ts
function isSameMonth(date1, date2) {
  if (!(date1 && date2)) {
    return false;
  }
  return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth();
}

// src/isSet.ts
function isSet(val) {
  return toString.call(val) === "[object Set]";
}

// src/isSlowConnection.ts
function isSlowConnection() {
  if (isServer()) {
    return;
  }
  const cn = navigator.connection;
  if (cn && (cn.saveData || /2g/.test(cn.effectiveType))) {
    return true;
  }
  return false;
}

// src/isStream.ts
function isStream(val) {
  return val !== null && typeof val === "object" && typeof val.pipe === "function";
}

// src/isSymbol.ts
function isSymbol(val) {
  return typeof val === "symbol";
}

// src/isToday.ts
function isToday(date) {
  return isSameDay(date, /* @__PURE__ */ new Date());
}

// src/isUndefined.ts
function isUndefined(val) {
  return typeof val === "undefined";
}

// src/isWebkit.ts
function isWebkit() {
  return typeof document !== "undefined" && "webkitFontSmoothing" in document.documentElement.style;
}

// src/isWindow.ts
function isWindows() {
  return /^win/i.test(globProcess.platform || "");
}

// src/kebabize/index.ts
function kebabize(value) {
  return value.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($2, ofs) => (ofs ? "-" : "") + $2.toLowerCase());
}

// src/listify/index.ts
function listify(obj, mapFn) {
  return Object.entries(obj).reduce((acc, [key, value]) => {
    acc.push(mapFn(key, value));
    return acc;
  }, []);
}

// src/mapObject.ts
function mapObject(obj, fn) {
  return Object.fromEntries(
    Object.entries(obj).map(([k, v]) => fn(k, v)).filter(isNotNullish)
  );
}

// src/mask/index.ts
function mask(cc, num = 4, mask2 = "*") {
  invariant(cc);
  return `${cc}`.slice(-num).padStart(`${cc}`.length, mask2);
}

// src/mergeDeep.ts
function mergeDeep(target, ...sources) {
  if (sources.length === 0) {
    return target;
  }
  const source = sources.shift();
  if (source === void 0) {
    return target;
  }
  if (isObject2(target) && isObject2(source)) {
    const sourceKeys = Object.keys(source);
    for (const key of sourceKeys) {
      if (isObject2(source[key])) {
        if (!target[key]) {
          target[key] = {};
        }
        if (isObject2(target[key])) {
          mergeDeep(target[key], source[key]);
        } else {
          target[key] = source[key];
        }
      } else {
        target[key] = source[key];
      }
    }
  }
  return mergeDeep(target, ...sources);
}

// src/minMax.ts
function minMax(value = 0, min = 0, max = 0) {
  return Math.min(Math.max(value, min), max);
}

// src/mutexLock.ts
var MutexLock = class {
  #mutex = Promise.resolve();
  lock() {
    let begin = () => {
    };
    this.#mutex = this.#mutex.then(() => new Promise(begin));
    return new Promise((res) => {
      begin = res;
    });
  }
  async dispatch(fn) {
    const unlock = await this.lock();
    try {
      return await Promise.resolve(fn());
    } catch (error) {
      throw new Error("Dispatch failed!");
    } finally {
      unlock();
    }
  }
};

// src/nextEvent.ts
function nextEvent(element, eventName) {
  return new Promise(
    (resolve) => element.addEventListener(eventName, (event) => resolve(event), { once: true })
  );
}

// src/nextFrame.ts
function nextFrame() {
  return new Promise(requestAnimationFrame);
}

// src/nextIdle.ts
function nextIdle() {
  return window !== void 0 ? new Promise(window.requestIdleCallback || setTimeout) : setTimeout;
}

// src/noop.ts
var noop = () => {
};

// src/normalizeArray.ts
function normalize(array, key) {
  if (!array || array.length === 0)
    return {};
  return array.reduce(
    (acc, cur) => {
      const keyValue = cur[key];
      if (keyValue) {
        return Object.assign(acc, { [keyValue]: cur });
      }
      return acc;
    },
    {}
  );
}

// src/numberBoundaryStatePrecision.ts
var _boundaryCheckingState = true;
function checkBoundaryPrecision(num) {
  if (_boundaryCheckingState) {
    if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
      console.warn(
        `${num} is beyond boundary when transfer to integer, the results may not be accurate`
      );
    }
  }
}
function enableBoundaryCheckingPrecision(flag = true) {
  _boundaryCheckingState = flag;
}

// src/numberCreateOperationPrecision.ts
function createOperationPrecision(operation) {
  return (...nums) => {
    const [first, ...others] = nums;
    return others.reduce((prev, next) => operation(prev, next), first);
  };
}

// src/numberDigitLengthPrecision.ts
function digitLengthPrecision(num) {
  const eSplit = num.toString().split(/[eE]/);
  const len = (eSplit[0].split(".")[1] || "").length - +(eSplit[1] || 0);
  return len > 0 ? len : 0;
}

// src/numberStripPrecision.ts
function stripPrecision(num, precision = 15) {
  return +parseFloat(Number(num).toPrecision(precision));
}

// src/numberFloat2FixedPrecision.ts
function float2FixedPrecision(num) {
  if (num.toString().indexOf("e") === -1) {
    return Number(num.toString().replace(".", ""));
  }
  const dLen = digitLengthPrecision(num);
  const powDLen = 10 ** dLen;
  return dLen > 0 ? stripPrecision(Number(num) * powDLen) : Number(num);
}

// src/numberTimesPrecision.ts
var timesPrecision = createOperationPrecision((num1, num2) => {
  const num1Changed = float2FixedPrecision(num1);
  const num2Changed = float2FixedPrecision(num2);
  const baseNum = digitLengthPrecision(num1) + digitLengthPrecision(num2);
  const leftValue = num1Changed * num2Changed;
  checkBoundaryPrecision(leftValue);
  const baseNumPow = 10 ** baseNum;
  return leftValue / baseNumPow;
});

// src/numberDivinePrecision.ts
var dividePrecision = createOperationPrecision((num1, num2) => {
  const num1Changed = float2FixedPrecision(num1);
  const num2Changed = float2FixedPrecision(num2);
  checkBoundaryPrecision(num1Changed);
  checkBoundaryPrecision(num2Changed);
  return timesPrecision(
    num1Changed / num2Changed,
    stripPrecision(10 ** (digitLengthPrecision(num2) - digitLengthPrecision(num1)))
  );
});

// src/numberMinusPrecision.ts
var minusPrecision = createOperationPrecision((num1, num2) => {
  const baseNum = 10 ** Math.max(digitLengthPrecision(num1), digitLengthPrecision(num2));
  return (timesPrecision(num1, baseNum) - timesPrecision(num2, baseNum)) / baseNum;
});

// src/numberPlusPrecision.ts
var plusPrecision = createOperationPrecision((num1, num2) => {
  const baseNum = 10 ** Math.max(digitLengthPrecision(num1), digitLengthPrecision(num2));
  return (timesPrecision(num1, baseNum) + timesPrecision(num2, baseNum)) / baseNum;
});

// src/numberRoundPrecision.ts
function roundPrecision(num, decimal) {
  const base = 10 ** decimal;
  let result = dividePrecision(Math.round(Math.abs(timesPrecision(num, base))), base);
  if (isNumber(num) && num < 0 && result !== 0) {
    result = timesPrecision(result, -1);
  }
  return result;
}

// src/objectEntries.ts
function objectEntries(obj) {
  return Object.entries(obj);
}

// src/objectKeys.ts
function objectKeys(obj) {
  return Object.keys(obj);
}

// src/onClickOutside/index.ts
function onClickOutside(element, callback) {
  if (isServer())
    return;
  document.addEventListener("click", (e) => {
    if (!element.contains(e.target))
      callback();
  });
}

// src/onScrollStop/index.ts
function onScrollStop(callback, timeout = 150) {
  if (isServer())
    return;
  let isScrolling;
  window.addEventListener(
    "scroll",
    () => {
      clearTimeout(isScrolling);
      isScrolling = setTimeout(() => {
        callback();
      }, timeout);
    },
    false
  );
}

// src/orderMap.ts
var OrderedMap = class _OrderedMap {
  constructor(content) {
    this.content = content;
  }
  // Return a map with the given content. If null, create an empty
  // map. If given an ordered map, return that map itself. If given an
  // object, create a map from the object's properties.
  static from(value) {
    if (value instanceof _OrderedMap)
      return value;
    const content = [];
    if (value)
      for (const prop in value)
        content.push(prop, value[prop]);
    return new _OrderedMap(content);
  }
  /**
   * the amount of keys in this map.
   */
  get size() {
    return this.content.length >> 1;
  }
  #find(key) {
    for (let i = 0; i < this.content.length; i += 2)
      if (this.content[i] === key)
        return i;
    return -1;
  }
  /**
   * Retrieve the value stored under `key`, or return undefined when no such key exists.
   */
  get(key) {
    const found = this.#find(key);
    return found === -1 ? void 0 : this.content[found + 1];
  }
  /**
   * Create a new map by replacing the value of `key` with a new value,
   * or adding a binding to the end of the map. If `newKey` is given, the key of the binding will be replaced with that key.
   */
  update(key, value, newKey) {
    const self = newKey && newKey !== key ? this.remove(newKey) : this;
    const found = self.#find(key);
    const content = self.content.slice();
    if (found === -1) {
      content.push(newKey || key, value);
    } else {
      content[found + 1] = value;
      if (newKey)
        content[found] = newKey;
    }
    return new _OrderedMap(content);
  }
  /**
   * Return a map with the given key removed, if it existed.
   */
  remove(key) {
    const found = this.#find(key);
    if (found === -1)
      return this;
    const content = this.content.slice();
    content.splice(found, 2);
    return new _OrderedMap(content);
  }
  /**
   * Add a new key to the start of the map.
   */
  addToStart(key, value) {
    return new _OrderedMap([key, value].concat(this.remove(key).content));
  }
  /**
   * Add a new key to the end of the map.
   */
  addToEnd(key, value) {
    const content = this.remove(key).content.slice();
    content.push(key, value);
    return new _OrderedMap(content);
  }
  /**
   * Add the given key/value before `place`. If `place` is not found, the new key is added to the end.
   */
  addBefore(place, key, value) {
    const without = this.remove(key);
    const content = without.content.slice();
    const found = without.#find(place);
    content.splice(found === -1 ? content.length : found, 0, key, value);
    return new _OrderedMap(content);
  }
  /**
   * Call the given function for each key/value pair in the map, in order
   */
  forEach(fn) {
    for (let i = 0; i < this.content.length; i += 2) {
      fn(this.content[i], this.content[i + 1]);
    }
  }
  /**
   * Create a new map by prepending the keys in this map that don't appear in `map` before the keys in `map`
   */
  prepend(map) {
    map = _OrderedMap.from(map);
    if (!map.size)
      return this;
    return new _OrderedMap(map.content.concat(this.subtract(map).content));
  }
  /**
   * Create a new map by appending the keys in this map that don't appear in `map` after the keys in `map`.
   */
  append(map) {
    map = _OrderedMap.from(map);
    if (!map.size)
      return this;
    return new _OrderedMap(this.subtract(map).content.concat(map.content));
  }
  /**
   * Create a map containing all the keys in this map that don't appear in `map`
   */
  subtract(map) {
    let instance = this;
    map = _OrderedMap.from(map);
    for (let i = 0; i < map.content.length; i += 2) {
      instance = instance.remove(map.content[i]);
    }
    return instance;
  }
  /**
   * Turn ordered map into a plain object.
   */
  toObject() {
    const result = {};
    this.forEach((key, value) => {
      result[key] = value;
    });
    return result;
  }
};

// src/parseQueryString/index.ts
function parseQueryString(url) {
  const params = [...new URLSearchParams(url.split("?")[1])];
  return params.reduce((acc, [key, value]) => {
    acc[key] = value;
    return acc;
  }, {});
}

// src/partition/index.ts
function partition(arr, fn) {
  return arr.reduce((acc, val, i, arr2) => {
    const current = fn(val, i, arr2);
    if (acc.has(current))
      acc.get(current).push(val);
    else
      acc.set(current, [val]);
    return acc;
  }, /* @__PURE__ */ new Map()).values();
}

// src/pascalToKebabCase/index.ts
var pascalToKebabCase = cacheStringFunction((p) => {
  return p.replace(/[A-Z]/g, (x) => `-${x.toLowerCase()}`).slice(1);
});

// src/ranking/index.ts
function ranking(arr, compFn) {
  return arr.map((a) => arr.filter((b) => compFn(a, b)).length + 1);
}

// src/removeWhitespace/index.ts
function removeWhitespace(value) {
  return value.replace(/\s/g, "");
}

// src/runHeavyAsyncFn/index.ts
var runAsync = (fn) => {
  const worker = new Worker(URL.createObjectURL(new Blob([`postMessage((${fn})());`])));
  return new Promise((res, rej) => {
    worker.onmessage = ({ data }) => {
      res(data);
      worker.terminate();
    };
    worker.onerror = (err) => {
      rej(err);
      worker.terminate();
    };
  });
};

// src/scrollToTop/index.ts
function scrollToTop() {
  if (isServer())
    return;
  const c = document.documentElement.scrollTop || document.body.scrollTop;
  if (c > 0) {
    window.requestAnimationFrame(scrollToTop);
    window.scrollTo(0, c - c / 8);
  }
}

// src/stringifyQueryObject/index.ts
function stringifyQueryObject(queryParameters) {
  if (!queryParameters)
    return "";
  return Object.entries(queryParameters).reduce((queryString, [key, val]) => {
    const symbol = queryString.length === 0 ? "?" : "&";
    queryString += typeof val === "string" ? `${symbol}${key}=${val}` : "";
    return queryString;
  }, "");
}

// src/throttle/index.ts
function throttle(func, limit) {
  let inThrottle = false;
  return function(...args) {
    if (!inThrottle) {
      func.apply(this, args);
      inThrottle = true;
      setTimeout(() => {
        inThrottle = false;
      }, limit);
    }
  };
}

// src/toNumber/index.ts
function toNumber(value) {
  const n = parseFloat(value);
  return Number.isNaN(n) ? value : n;
}

// src/truncate/index.ts
function truncate(str, limit, text = "...") {
  if (str.length > limit) {
    return `${str.substring(0, limit)} ${text}`;
  }
  return str;
}

// src/useObserverElement.ts
function useObserverElement() {
  invariant(isBrowser());
  let observer = null;
  const callbacks = /* @__PURE__ */ new Map();
  const observe = (element, callback) => {
    if (!observer) {
      observer = new IntersectionObserver((entries) => {
        for (const entry of entries) {
          const callback2 = callbacks.get(entry.target);
          const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
          if (isVisible && callback2) {
            callback2();
          }
        }
      });
    }
    callbacks.set(element, callback);
    observer.observe(element);
    return () => {
      callbacks.delete(element);
      observer?.unobserve(element);
      if (callbacks.size === 0) {
        observer?.disconnect();
        observer = null;
      }
    };
  };
  return observe;
}

// src/webkitVersion.ts
function webkitVersion() {
  if (typeof navigator === "undefined")
    return 0;
  return isWebkit() ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
}

// src/p.cancelable.ts
var CancelError = class extends Error {
  constructor(reason) {
    super(reason || "Promise was canceled");
    this.name = "CancelError";
  }
  get isCanceled() {
    return true;
  }
};
var promiseState = Object.freeze({
  pending: Symbol("pending"),
  canceled: Symbol("canceled"),
  resolved: Symbol("resolved"),
  rejected: Symbol("rejected")
});
var PCancelable = class _PCancelable extends Promise {
  static fn(userFunction) {
    return (...arguments_) => new _PCancelable((resolve, reject, onCancel) => {
      arguments_.push(onCancel);
      userFunction(...arguments_).then(resolve, reject);
    });
  }
  #cancelHandlers = [];
  #rejectOnCancel = true;
  #state = promiseState.pending;
  #promise;
  #reject = () => {
  };
  constructor(executor) {
    super(executor);
    this.#promise = new Promise((resolve, reject) => {
      this.#reject = reject;
      const onCancel = (handler) => {
        if (this.#state !== promiseState.pending) {
          throw new Error(
            `The \`onCancel\` handler was attached after the promise ${this.#state.description}.`
          );
        }
        this.#cancelHandlers.push(handler);
      };
      const addedProperties = {
        shouldReject: {
          get: () => this.#rejectOnCancel,
          set: (boolean) => {
            this.#rejectOnCancel = boolean;
          }
        }
      };
      objectDefProperties(onCancel, addedProperties);
      const onResolve = (value) => {
        if (this.#state !== promiseState.canceled || !onCancel.shouldReject) {
          resolve(value);
          this.#setState(promiseState.resolved);
        }
      };
      const onReject = (error) => {
        if (this.#state !== promiseState.canceled || !onCancel.shouldReject) {
          reject(error);
          this.#setState(promiseState.rejected);
        }
      };
      executor(onResolve, onReject, onCancel);
    });
  }
  // @ts-expect-error Ignore then
  then(onFulfilled, onRejected) {
    return this.#promise.then(onFulfilled, onRejected);
  }
  catch(onRejected) {
    return this.#promise.catch(onRejected);
  }
  finally(onFinally) {
    return this.#promise.finally(onFinally);
  }
  cancel(reason) {
    if (this.#state !== promiseState.pending) {
      return;
    }
    this.#setState(promiseState.canceled);
    if (this.#cancelHandlers.length > 0) {
      try {
        for (const handler of this.#cancelHandlers) {
          handler();
        }
      } catch (error) {
        this.#reject(error);
        return;
      }
    }
    if (this.#rejectOnCancel) {
      this.#reject(new CancelError(reason));
    }
  }
  get isCanceled() {
    return this.#state === promiseState.canceled;
  }
  #setState(state) {
    if (this.#state === promiseState.pending) {
      this.#state = state;
    }
  }
};
function objectDefProperties(obj, objAddendum) {
  Object.defineProperties(obj, objAddendum);
}

// src/p.defer.ts
var PDefer = class {
  constructor() {
    this.placeholder = "dummy p-defer";
  }
};

// src/p.delay.ts
var createAbortError = () => {
  const error = new Error("Delay aborted");
  error.name = "AbortError";
  return error;
};
var clearMethods = /* @__PURE__ */ new WeakMap();
function delay(milliseconds, options) {
  return createDelay(milliseconds, options);
}
function createDelay(milliseconds, { value, signal } = {}) {
  if (signal?.aborted) {
    return Promise.reject(createAbortError());
  }
  let timeoutId;
  let settle;
  let rejectFunction;
  const signalListener = () => {
    clearTimeout(timeoutId);
    rejectFunction(createAbortError());
  };
  const cleanup = () => {
    if (signal) {
      signal.removeEventListener("abort", signalListener);
    }
  };
  const delayPromise = new Promise((resolve, reject) => {
    settle = () => {
      cleanup();
      if (value)
        resolve(value);
    };
    rejectFunction = reject;
    timeoutId = setTimeout(settle, milliseconds);
  });
  if (signal) {
    signal.addEventListener("abort", signalListener, { once: true });
  }
  clearMethods.set(delayPromise, () => {
    clearTimeout(timeoutId);
    timeoutId = void 0;
    settle();
  });
  return delayPromise;
}
async function rangeDelay(minimum, maximum, options = {}) {
  return delay(getRandomInt(minimum, maximum), options);
}
function clearDelay(promise) {
  clearMethods.get(promise)?.();
}

// src/p.queue.ts
var PQueue = class {
  constructor() {
    this.placeholder = "dummy p-queue";
  }
};

// src/p.timeout.ts
var PTimeOut = class {
  constructor() {
    this.placeholder = "dummy p-timeout";
  }
};

// src/pick.ts
function pick(state, paths) {
  if (Array.isArray(paths)) {
    return paths.reduce((acc, path) => {
      const _paths = path.split(".");
      return set(acc, _paths, get2(state, _paths));
    }, {});
  }
  return get2(state, paths.split("."));
}
function get2(state, paths) {
  return paths.reduce((acc, path) => acc?.[path], state);
}
var ProtoRE = /^(__proto__)$/;
function set(state, paths, val) {
  const last = paths.at(-1);
  if (last === void 0)
    return state;
  const restPaths = paths.slice(0, -1);
  const result = restPaths.reduce(
    // biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
    (obj, p) => ProtoRE.test(p) ? {} : obj[p] ||= {},
    state
  );
  result[last] = val;
  return state;
}

// src/regex.ts
var emailRegex = new RegExp(
  /^(([^\s"(),.:;<>@[\\\]]+(\.[^\s"(),.:;<>@[\\\]]+)*)|(".+"))@((\[(?:\d{1,3}\.){3}\d{1,3}])|(([\dA-Za-z-]+\.)+[A-Za-z]{2,}))$/
);
var isValidEmail = (email) => emailRegex.test(email);
var vietnamPhoneRegex = new RegExp(/^0(\d{9})$/);
var isValidVnPhone = (phone) => vietnamPhoneRegex.test(phone);
var urlRegex = /(((^https?:(?:\/\/)?)(?:[\w$&+,:;=-]+@)?[\d.A-Za-z-]+(?::\d+)?|(?:www.|[\w$&+,:;=-]+@)[\d.A-Za-z-]+)((?:\/[\w%+./~-]*)?\??[\w%&+.;=@-]*(?:#\w*)?)?)$/;
var isValidUrl = (path) => urlRegex.test(path);
var multilineCommentsRegex = /\/\*(.|[\r\n])*?\*\//gm;
var singlelineCommentsRegex = /\/\/.*/g;
var escapedSpaceCharactersRegex = /( |\\t|\\n|\\f|\\r)+/g;

// src/removeArray.ts
function remove(arr, el) {
  const i = arr.indexOf(el);
  if (i > -1) {
    arr.splice(i, 1);
  }
}

// src/removeEmptyObject.ts
function removeEmptyObj(obj) {
  return Object.fromEntries(
    Object.entries(obj).filter(([_, v]) => isNotNull(v) && isDefined(v) && isNotEmpty(v))
  );
}

// src/removeUndefinedObject.ts
function removeUndefObj(obj) {
  const keys = Object.keys(obj);
  for (const key of keys) {
    isUndefined(obj[key]) ? obj[key] === void 0 : {};
  }
  return obj;
}

// src/requestIdleCallback.ts
function requestIdleCallbackShim(cb) {
  const start = Date.now();
  return setTimeout(() => {
    cb({
      didTimeout: false,
      timeRemaining: () => Math.max(0, 50 - (Date.now() - start))
    });
  }, 1);
}
var requestIdleCallback = typeof window !== "undefined" ? window.requestIdleCallback || requestIdleCallbackShim : requestIdleCallbackShim;

// src/shuffleArray.ts
function shuffle(array) {
  for (let i = array.length - 1; i > 0; i--) {
    const factor = Math.floor(Math.random() * (i + 1));
    [array[i], array[factor]] = [array[factor], array[i]];
  }
  return array;
}

// src/singleton.ts
function singleton(name, valueFactory) {
  const g = global;
  g.__singletons ??= {};
  g.__singletons[name] ??= valueFactory();
  return g.__singletons[name];
}

// src/sleep.ts
function sleep(ms) {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve();
    }, ms);
  });
}

// src/slugify/index.ts
function slugify(text) {
  if (!text) {
    return "";
  }
  return text.toString().normalize("NFKD").toLowerCase().trim().replace(/\s+/g, "-").replace(/[Đđ]/g, "d").replace(/[^\w-]+/g, "").replace(/[^\w-]+/g, "").replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/--+/g, "-");
}

// src/snakeToCamel.ts
var snake2camel = cacheStringFunction((str) => {
  return str.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
});

// src/sortByKey.ts
var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
  SortDirection2["ASC"] = "ASC";
  SortDirection2["DESC"] = "DESC";
  return SortDirection2;
})(SortDirection || {});
function sortByDate(a, b, key, direction = "ASC" /* ASC */) {
  if (a[key] < b[key]) {
    return direction === "ASC" /* ASC */ ? 1 : -1;
  }
  if (a[key] > b[key]) {
    return direction === "ASC" /* ASC */ ? -1 : 1;
  }
  return 0;
}

// src/sortData.ts
function sortData(a, b, direction = "ASC" /* ASC */, options) {
  let result = 0;
  const { locale = "vi", shouldIgnoreZero = false } = options || {};
  if (shouldIgnoreZero) {
    if (a === b) {
      return 0;
    }
    if (a === 0) {
      return 1;
    }
    if (b === 0) {
      return -1;
    }
  }
  if (isNumber(a) && isNumber(b)) {
    const aParsed = a?.toString() ?? "";
    const bParsed = b?.toString() ?? "";
    result = isNumber(a) && isNumber(b) ? a - b : aParsed.localeCompare(bParsed, locale);
  }
  return direction === "ASC" /* ASC */ ? result : -result;
}

// src/stopAnimation.ts
function stopAnimations(el) {
  return Promise.all(
    el.getAnimations().map((animation) => {
      return new Promise((resolve) => {
        const handleAnimationEvent = requestAnimationFrame(resolve);
        animation.addEventListener("cancel", () => handleAnimationEvent, { once: true });
        animation.addEventListener("finish", () => handleAnimationEvent, { once: true });
        animation.cancel();
        cancelAnimationFrame(handleAnimationEvent);
      });
    })
  );
}

// src/suffixAmpm.ts
function suffixAmPm(h) {
  return `${h % 12 === 0 ? 12 : h % 12}${h < 12 ? "am" : "pm"}`;
}

// src/sum.ts
function sum(...args) {
  return [...args].flat(1).reduce((a, b) => a + b, 0);
}

// src/take.ts
function take(array, limit) {
  return array.slice(0, limit);
}

// src/timeSpan.ts
function timeSpan() {
  const start = process.hrtime.bigint();
  const end = (type) => convertHrTime(process.hrtime.bigint() - start)[type];
  const result = () => end("milliseconds");
  result.toRounded = () => Math.round(end("milliseconds"));
  result.toSeconds = () => end("seconds");
  result.toNanoseconds = () => end("nanoseconds");
  return result;
}

// src/toPointsArray.ts
function toPointsArray(points) {
  if (isArray(points[0])) {
    return points.map(([x, y, pressure = 0.5]) => [x, y, pressure]);
  }
  return points.map(({ x, y, pressure = 0.5 }) => [x, y, pressure]);
}

// src/toggleClass/toggleClass.ts
function toggleClass(dom, cls, on = true) {
  if (on)
    dom.classList.add(cls);
  else
    dom.classList.remove(cls);
}

// src/transitionEnd.ts
function transitionEnd(element) {
  return nextEvent(element, "transitionend");
}

// src/uniqueArray.ts
function unique(array) {
  return [...new Set(array)];
}

// src/uniqueObject.ts
function uniqueObj(items, uniqueKey) {
  const map = /* @__PURE__ */ new Map();
  for (const item of items) {
    const key = item[uniqueKey];
    if (!map.has(key)) {
      map.set(key, item);
    }
  }
  return [...map.values()];
}

exports.$ = $;
exports.$$ = $$;
exports.CookieService = CookieService;
exports.GOOD_LEAF_SIZE = GOOD_LEAF_SIZE;
exports.HTTP_ACCEPTED = HTTP_ACCEPTED;
exports.HTTP_ALREADY_REPORTED = HTTP_ALREADY_REPORTED;
exports.HTTP_BAD_GATEWAY = HTTP_BAD_GATEWAY;
exports.HTTP_BAD_REQUEST = HTTP_BAD_REQUEST;
exports.HTTP_CF_A_TIMEOUT_OCCURRED = HTTP_CF_A_TIMEOUT_OCCURRED;
exports.HTTP_CF_CONNECTION_TIMED_OUT = HTTP_CF_CONNECTION_TIMED_OUT;
exports.HTTP_CF_INVALID_SSL_CERTIFICATE = HTTP_CF_INVALID_SSL_CERTIFICATE;
exports.HTTP_CF_ORIGIN_IS_UNREACHABLE = HTTP_CF_ORIGIN_IS_UNREACHABLE;
exports.HTTP_CF_RAILGUN_ERROR = HTTP_CF_RAILGUN_ERROR;
exports.HTTP_CF_SSL_HANDSHAKE_FAILED = HTTP_CF_SSL_HANDSHAKE_FAILED;
exports.HTTP_CF_UNKNOWN = HTTP_CF_UNKNOWN;
exports.HTTP_CF_WEB_SERVER_IS_DOWN = HTTP_CF_WEB_SERVER_IS_DOWN;
exports.HTTP_CONFLICT = HTTP_CONFLICT;
exports.HTTP_CONTINUE = HTTP_CONTINUE;
exports.HTTP_CREATED = HTTP_CREATED;
exports.HTTP_EARLY_HINTS = HTTP_EARLY_HINTS;
exports.HTTP_EXPECTATION_FAILED = HTTP_EXPECTATION_FAILED;
exports.HTTP_FAILED_DEPENDENCY = HTTP_FAILED_DEPENDENCY;
exports.HTTP_FORBIDDEN = HTTP_FORBIDDEN;
exports.HTTP_FOUND = HTTP_FOUND;
exports.HTTP_GATEWAY_TIMEOUT = HTTP_GATEWAY_TIMEOUT;
exports.HTTP_GONE = HTTP_GONE;
exports.HTTP_IM_USED = HTTP_IM_USED;
exports.HTTP_INSUFFICIENT_STORAGE = HTTP_INSUFFICIENT_STORAGE;
exports.HTTP_INTERNAL_SERVER_ERROR = HTTP_INTERNAL_SERVER_ERROR;
exports.HTTP_I_AM_A_TEAPOT = HTTP_I_AM_A_TEAPOT;
exports.HTTP_LENGTH_REQUIRED = HTTP_LENGTH_REQUIRED;
exports.HTTP_LOCKED = HTTP_LOCKED;
exports.HTTP_LOOP_DETECTED = HTTP_LOOP_DETECTED;
exports.HTTP_METHOD_NOT_ALLOWED = HTTP_METHOD_NOT_ALLOWED;
exports.HTTP_MISDIRECTED_REQUEST = HTTP_MISDIRECTED_REQUEST;
exports.HTTP_MOVED_PERMANENTLY = HTTP_MOVED_PERMANENTLY;
exports.HTTP_MULTIPLE_CHOICES = HTTP_MULTIPLE_CHOICES;
exports.HTTP_MULTI_STATUS = HTTP_MULTI_STATUS;
exports.HTTP_NETWORK_AUTHENTICATION_REQUIRED = HTTP_NETWORK_AUTHENTICATION_REQUIRED;
exports.HTTP_NON_AUTHORITATIVE_INFORMATION = HTTP_NON_AUTHORITATIVE_INFORMATION;
exports.HTTP_NOT_ACCEPTABLE = HTTP_NOT_ACCEPTABLE;
exports.HTTP_NOT_EXTENDED = HTTP_NOT_EXTENDED;
exports.HTTP_NOT_FOUND = HTTP_NOT_FOUND;
exports.HTTP_NOT_IMPLEMENTED = HTTP_NOT_IMPLEMENTED;
exports.HTTP_NOT_MODIFIED = HTTP_NOT_MODIFIED;
exports.HTTP_NO_CONTENT = HTTP_NO_CONTENT;
exports.HTTP_OK = HTTP_OK;
exports.HTTP_PARTIAL_CONTENT = HTTP_PARTIAL_CONTENT;
exports.HTTP_PAYMENT_REQUIRED = HTTP_PAYMENT_REQUIRED;
exports.HTTP_PERMANENTLY_REDIRECT = HTTP_PERMANENTLY_REDIRECT;
exports.HTTP_PRECONDITION_FAILED = HTTP_PRECONDITION_FAILED;
exports.HTTP_PRECONDITION_REQUIRED = HTTP_PRECONDITION_REQUIRED;
exports.HTTP_PROCESSING = HTTP_PROCESSING;
exports.HTTP_PROXY_AUTHENTICATION_REQUIRED = HTTP_PROXY_AUTHENTICATION_REQUIRED;
exports.HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = HTTP_REQUESTED_RANGE_NOT_SATISFIABLE;
exports.HTTP_REQUEST_ENTITY_TOO_LARGE = HTTP_REQUEST_ENTITY_TOO_LARGE;
exports.HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE;
exports.HTTP_REQUEST_TIMEOUT = HTTP_REQUEST_TIMEOUT;
exports.HTTP_REQUEST_URI_TOO_LONG = HTTP_REQUEST_URI_TOO_LONG;
exports.HTTP_RESERVED = HTTP_RESERVED;
exports.HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL;
exports.HTTP_RESET_CONTENT = HTTP_RESET_CONTENT;
exports.HTTP_SEE_OTHER = HTTP_SEE_OTHER;
exports.HTTP_SERVICE_UNAVAILABLE = HTTP_SERVICE_UNAVAILABLE;
exports.HTTP_SWITCHING_PROTOCOLS = HTTP_SWITCHING_PROTOCOLS;
exports.HTTP_TEMPORARY_REDIRECT = HTTP_TEMPORARY_REDIRECT;
exports.HTTP_TOO_MANY_REQUESTS = HTTP_TOO_MANY_REQUESTS;
exports.HTTP_UNAUTHORIZED = HTTP_UNAUTHORIZED;
exports.HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = HTTP_UNAVAILABLE_FOR_LEGAL_REASONS;
exports.HTTP_UNPROCESSABLE_ENTITY = HTTP_UNPROCESSABLE_ENTITY;
exports.HTTP_UNSUPPORTED_MEDIA_TYPE = HTTP_UNSUPPORTED_MEDIA_TYPE;
exports.HTTP_UPGRADE_REQUIRED = HTTP_UPGRADE_REQUIRED;
exports.HTTP_USE_PROXY = HTTP_USE_PROXY;
exports.HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL;
exports.HTTP_VERSION_NOT_SUPPORTED = HTTP_VERSION_NOT_SUPPORTED;
exports.MimeType = MimeType;
exports.MutexLock = MutexLock;
exports.OrderedMap = OrderedMap;
exports.PCancelable = PCancelable;
exports.PDefer = PDefer;
exports.PQueue = PQueue;
exports.PTimeOut = PTimeOut;
exports.RopeSequence = RopeSequence;
exports.SortDirection = SortDirection;
exports.alphaHex = alphaHex;
exports.botFullPattern = botFullPattern;
exports.botPatterns = botPatterns;
exports.botRegPattern = botRegPattern;
exports.cacheStringFunction = cacheStringFunction;
exports.calculateFrequencies = calculateFrequencies;
exports.calculateScrollPercentage = calculateScrollPercentage;
exports.callOrReturn = callOrReturn;
exports.camel2SnakeObject = camel2SnakeObject;
exports.camel2snake = camel2snake;
exports.camelize = camelize;
exports.cancelIdleCallback = cancelIdleCallback;
exports.capitalizeFirst = capitalizeFirst;
exports.checkBoundaryPrecision = checkBoundaryPrecision;
exports.chromeVersion = chromeVersion;
exports.chunk = chunk;
exports.clamp = clamp;
exports.clearDelay = clearDelay;
exports.convertHrTime = convertHrTime;
exports.createCachedImport = createCachedImport;
exports.createDelay = createDelay;
exports.createElement = createElement;
exports.createIsBot = createIsBot;
exports.createIsBotFromList = createIsBotFromList;
exports.createOperationPrecision = createOperationPrecision;
exports.createStyleTag = createStyleTag;
exports.cutString = cutString;
exports.debounce = debounce;
exports.delay = delay;
exports.deleteProps = deleteProps;
exports.digitLengthPrecision = digitLengthPrecision;
exports.dividePrecision = dividePrecision;
exports.downloadByData = downloadByData;
exports.emailRegex = emailRegex;
exports.emitter = emitter;
exports.enableBoundaryCheckingPrecision = enableBoundaryCheckingPrecision;
exports.envShims = envShims;
exports.escapeRegExp = escapeRegExp;
exports.escapedSpaceCharactersRegex = escapedSpaceCharactersRegex;
exports.filterArrays = filterArrays;
exports.findDuplicates = findDuplicates;
exports.findFirstDefined = findFirstDefined;
exports.findLastIndex = findLastIndex;
exports.firstUniqueArr = firstUniqueArr;
exports.firstUniqueChar = firstUniqueChar;
exports.flattenObject = flattenObject;
exports.float2FixedPrecision = float2FixedPrecision;
exports.formatBytes = formatBytes;
exports.formatLot10Volume = formatLot10Volume;
exports.formatNumber = formatNumber;
exports.fromStringToPrimitives = fromStringToPrimitives;
exports.generateSample = generateSample;
exports.get = get;
exports.getMimeTypeFromExtension = getMimeTypeFromExtension;
exports.getQuarter = getQuarter;
exports.getRandomInt = getRandomInt;
exports.getRandomIntInclusive = getRandomIntInclusive;
exports.getRandomString = getRandomString;
exports.getStrokeRadius = getStrokeRadius;
exports.getTag = getTag;
exports.globProcess = globProcess;
exports.groupBy = groupBy;
exports.hasDuplicates = hasDuplicates;
exports.haveSameElement = haveSameElement;
exports.hexColor = hexColor;
exports.hyphenate = hyphenate;
exports.intToBuffer = intToBuffer;
exports.intToHex = intToHex;
exports.invariant = invariant;
exports.isAndroid = isAndroid;
exports.isAppleDevice = isAppleDevice;
exports.isArray = isArray;
exports.isBase64 = isBase64;
exports.isBoolean = isBoolean;
exports.isBot = isBot;
exports.isBotMatch = isBotMatch;
exports.isBotMatches = isBotMatches;
exports.isBotNaive = isBotNaive;
exports.isBotPattern = isBotPattern;
exports.isBotPatterns = isBotPatterns;
exports.isBrowser = isBrowser;
exports.isChrome = isChrome;
exports.isCrawler = isCrawler;
exports.isDate = isDate;
exports.isDeepEqual = isDeepEqual;
exports.isDefined = isDefined;
exports.isDistinctArray = isDistinctArray;
exports.isEdgeBrowser = isEdgeBrowser;
exports.isEmpties = isEmpties;
exports.isEmpty = isEmpty;
exports.isEmptyArr = isEmptyArr;
exports.isFunction = isFunction2;
exports.isGecko = isGecko;
exports.isHex = isHex;
exports.isIOS = isIOS;
exports.isIOSChrome = isIOSChrome;
exports.isISOString = isISOString;
exports.isISOStringWithTimezone = isISOStringWithTimezone;
exports.isKeyOf = isKeyOf;
exports.isLinux = isLinux;
exports.isMacOS = isMacOS;
exports.isMobile = isMobile;
exports.isNodeProd = isNodeProd;
exports.isNodeTest = isNodeTest;
exports.isNotEmpties = isNotEmpties;
exports.isNotEmpty = isNotEmpty;
exports.isNotNull = isNotNull;
exports.isNotNullish = isNotNullish;
exports.isNullOrUndefined = isNullOrUndefined;
exports.isNumber = isNumber;
exports.isObject = isObject2;
exports.isOpera = isOpera;
exports.isPlainObject = isPlainObject;
exports.isPngImage = isPngImage;
exports.isPrefersReducedMotion = isPrefersReducedMotion;
exports.isPrimitive = isPrimitive;
exports.isPromise = isPromise;
exports.isRegExp = isRegExp;
exports.isSafari = isSafari;
exports.isSameDay = isSameDay;
exports.isSameMonth = isSameMonth;
exports.isServer = isServer;
exports.isSet = isSet;
exports.isSlowConnection = isSlowConnection;
exports.isStream = isStream;
exports.isString = isString;
exports.isSymbol = isSymbol;
exports.isToday = isToday;
exports.isUndefined = isUndefined;
exports.isValidEmail = isValidEmail;
exports.isValidUrl = isValidUrl;
exports.isValidVnPhone = isValidVnPhone;
exports.isWebkit = isWebkit;
exports.isWindows = isWindows;
exports.kebabize = kebabize;
exports.lerp = lerp;
exports.listenCookieChange = listenCookieChange;
exports.listify = listify;
exports.mapObject = mapObject;
exports.mask = mask;
exports.mergeDeep = mergeDeep;
exports.mimeTable = mimeTable;
exports.minMax = minMax;
exports.minusPrecision = minusPrecision;
exports.multilineCommentsRegex = multilineCommentsRegex;
exports.nextEvent = nextEvent;
exports.nextFrame = nextFrame;
exports.nextIdle = nextIdle;
exports.noop = noop;
exports.normalize = normalize;
exports.objectEntries = objectEntries;
exports.objectKeys = objectKeys;
exports.onClickOutside = onClickOutside;
exports.onScrollStop = onScrollStop;
exports.parseCookie = parseCookie;
exports.parseQueryString = parseQueryString;
exports.partition = partition;
exports.pascalToKebabCase = pascalToKebabCase;
exports.percentToHex = percentToHex;
exports.pick = pick;
exports.plusPrecision = plusPrecision;
exports.rangeDelay = rangeDelay;
exports.ranking = ranking;
exports.remove = remove;
exports.removeEmptyObj = removeEmptyObj;
exports.removeUndefObj = removeUndefObj;
exports.removeWhitespace = removeWhitespace;
exports.requestFullscreen = requestFullscreen;
exports.requestIdleCallback = requestIdleCallback;
exports.roundPrecision = roundPrecision;
exports.runAsync = runAsync;
exports.scrollToTop = scrollToTop;
exports.serializeCookie = serializeCookie;
exports.shuffle = shuffle;
exports.singlelineCommentsRegex = singlelineCommentsRegex;
exports.singleton = singleton;
exports.sleep = sleep;
exports.slugify = slugify;
exports.snake2camel = snake2camel;
exports.sortByDate = sortByDate;
exports.sortData = sortData;
exports.stopAnimations = stopAnimations;
exports.stringifyQueryObject = stringifyQueryObject;
exports.stripPrecision = stripPrecision;
exports.suffixAmPm = suffixAmPm;
exports.sum = sum;
exports.take = take;
exports.throttle = throttle;
exports.timeSpan = timeSpan;
exports.timesPrecision = timesPrecision;
exports.toBoolean = toBoolean;
exports.toISOStringTimezone = toISOStringTimezone;
exports.toNumber = toNumber;
exports.toPointsArray = toPointsArray;
exports.toggleClass = toggleClass;
exports.transitionEnd = transitionEnd;
exports.truncate = truncate;
exports.unique = unique;
exports.uniqueObj = uniqueObj;
exports.urlRegex = urlRegex;
exports.useObserverElement = useObserverElement;
exports.vietnamPhoneRegex = vietnamPhoneRegex;
exports.webkitVersion = webkitVersion;
