"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.get = get;
exports.range = range;
exports.isObj = isObj;
exports.isDef = isDef;
exports.camelize = camelize;
exports.isAndroid = isAndroid;
exports.isFunction = isFunction;
exports.noop = noop;
exports.isPromise = isPromise;
exports.inBrowser = exports.isServer = void 0;

var _vue = _interopRequireDefault(require("vue"));

var isServer = _vue.default.prototype.$isServer;
exports.isServer = isServer;
var inBrowser = typeof window !== "undefined";
exports.inBrowser = inBrowser;

function isDef(value) {
  return value !== undefined && value !== null;
}

function isObj(x) {
  var type = typeof x;
  return x !== null && (type === "object" || type === "function");
}

function get(object, path) {
  var keys = path.split(".");
  var result = object;
  keys.forEach(function (key) {
    result = isDef(result[key]) ? result[key] : "";
  });
  return result;
}

var camelizeRE = /-(\w)/g;

function camelize(str) {
  return str.replace(camelizeRE, function (_, c) {
    return c.toUpperCase();
  });
}

function isAndroid() {
  /* istanbul ignore next */
  return isServer ? false : /android/.test(navigator.userAgent.toLowerCase());
}

function range(num, min, max) {
  return Math.min(Math.max(num, min), max);
}

function isFunction(val) {
  return typeof val === "function";
} // eslint-disable-next-line @typescript-eslint/no-empty-function


function noop() {}

function isPromise(val) {
  return isObj(val) && isFunction(val.then) && isFunction(val.catch);
}