(function (_, kotlin_kotlin) {
  'use strict';
  //region block: imports
  var VOID = kotlin_kotlin.$_$.f;
  var numberRangeToNumber = kotlin_kotlin.$_$.oc;
  var collectionSizeOrDefault = kotlin_kotlin.$_$.n6;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.l;
  var Default_getInstance = kotlin_kotlin.$_$.b5;
  var charSequenceGet = kotlin_kotlin.$_$.ib;
  var Char = kotlin_kotlin.$_$.ph;
  var Unit_instance = kotlin_kotlin.$_$.m5;
  var joinToString = kotlin_kotlin.$_$.a8;
  var removePrefix = kotlin_kotlin.$_$.rf;
  var Regex_init_$Create$ = kotlin_kotlin.$_$.d1;
  var numberToLong = kotlin_kotlin.$_$.tc;
  var THROW_CCE = kotlin_kotlin.$_$.hi;
  //endregion
  //region block: pre-declaration
  //endregion
  var CHAR_POOL_DEFAULT;
  function randomString(length, charPool) {
    charPool = charPool === VOID ? CHAR_POOL_DEFAULT : charPool;
    // Inline function 'kotlin.collections.map' call
    var this_0 = numberRangeToNumber(1, length);
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
    var tmp0_iterator = this_0.w();
    while (tmp0_iterator.f()) {
      var item = tmp0_iterator.e();
      // Inline function 'com.ustadmobile.lib.util.randomString.<anonymous>' call
      var tmp$ret$0 = charSequenceGet(charPool, Default_getInstance().vj(0, charPool.length));
      destination.i1(new Char(tmp$ret$0));
    }
    return joinToString(destination, '');
  }
  var RANGE_CONTENT_LENGTH_HEADER;
  var RANGE_CONTENT_RANGE_HEADER;
  var RANGE_CONTENT_ACCEPT_RANGE_HEADER;
  function get_sanitizeRegex() {
    _init_properties_UmAccountUtil_kt__77mlln();
    return sanitizeRegex;
  }
  var sanitizeRegex;
  function sanitizeDbNameFromUrl(url) {
    _init_properties_UmAccountUtil_kt__77mlln();
    // Inline function 'kotlin.text.replace' call
    var this_0 = removePrefix(removePrefix(url, 'https://'), 'http://');
    return get_sanitizeRegex().q9(this_0, '_');
  }
  var properties_initialized_UmAccountUtil_kt_2rfqnb;
  function _init_properties_UmAccountUtil_kt__77mlln() {
    if (!properties_initialized_UmAccountUtil_kt_2rfqnb) {
      properties_initialized_UmAccountUtil_kt_2rfqnb = true;
      sanitizeRegex = Regex_init_$Create$('\\W');
    }
  }
  function getSystemTimeInMillis() {
    return numberToLong((new Date()).getTime());
  }
  function getDefaultTimeZoneId() {
    var tmp = Intl.DateTimeFormat().resolvedOptions().timeZone;
    return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  }
  //region block: init
  CHAR_POOL_DEFAULT = 'abcdefghikjmnpqrstuvxwyz23456789';
  RANGE_CONTENT_LENGTH_HEADER = 'Content-Length';
  RANGE_CONTENT_RANGE_HEADER = 'Content-Range';
  RANGE_CONTENT_ACCEPT_RANGE_HEADER = 'Accept-Ranges';
  //endregion
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = getDefaultTimeZoneId;
  _.$_$.b = getSystemTimeInMillis;
  _.$_$.c = randomString;
  _.$_$.d = sanitizeDbNameFromUrl;
  //endregion
  return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js')));

//# sourceMappingURL=UstadMobile-lib-util.js.map
