"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getUrl = getUrl;
var _configuration = require("../configuration");
/**
 * Resolves a resource URL: absolute URLs (starting with "http") are returned as-is,
 * otherwise the host is prepended.
 * @param {string} url - Resource path or absolute URL
 * @param {string} [host=getConf('network.host')] - Host to prepend for relative URLs (uses default if falsy)
 * @returns {string} Resolved URL
 */
function getUrl(url, host) {
  if (url == null || url === '') {
    return url;
  }
  var resolvedHost = host || (0, _configuration.getConf)('network.host');
  return url.startsWith('http') ? url : "".concat(resolvedHost).concat(url);
}