(function (_, dev_icerock_moko_resources_internal_messageFormat_MessageFormat_rhgpjd, $module$bcp_47_7qe1cl, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core) {
  'use strict';
  //region block: imports
  var imul = Math.imul;
  var parse = $module$bcp_47_7qe1cl.parse;
  var asList = kotlin_kotlin.$_$.g6;
  var protoOf = kotlin_kotlin.$_$.wc;
  var classMeta = kotlin_kotlin.$_$.lb;
  var setMetadataFor = kotlin_kotlin.$_$.xc;
  var getStringHashCode = kotlin_kotlin.$_$.vb;
  var copyToArray = kotlin_kotlin.$_$.e7;
  var hashCode = kotlin_kotlin.$_$.wb;
  var THROW_CCE = kotlin_kotlin.$_$.hi;
  var equals = kotlin_kotlin.$_$.ob;
  var VOID = kotlin_kotlin.$_$.f;
  var objectMeta = kotlin_kotlin.$_$.vc;
  var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.u1;
  var isArray = kotlin_kotlin.$_$.yb;
  var toList = kotlin_kotlin.$_$.u9;
  var emptyList = kotlin_kotlin.$_$.i7;
  var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.v;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.m;
  var Unit_instance = kotlin_kotlin.$_$.m5;
  var collectionSizeOrDefault = kotlin_kotlin.$_$.n6;
  var mapCapacity = kotlin_kotlin.$_$.m8;
  var coerceAtLeast = kotlin_kotlin.$_$.jd;
  var LinkedHashMap_init_$Create$_0 = kotlin_kotlin.$_$.u;
  var List = kotlin_kotlin.$_$.w5;
  var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.l;
  var to = kotlin_kotlin.$_$.nj;
  var json = kotlin_kotlin.$_$.lc;
  var plus = kotlin_kotlin.$_$.s8;
  var CoroutineImpl = kotlin_kotlin.$_$.va;
  var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z1;
  var isInterface = kotlin_kotlin.$_$.gc;
  var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.ha;
  var async = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.f2;
  var plus_0 = kotlin_kotlin.$_$.a9;
  var awaitAll = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h;
  var toString = kotlin_kotlin.$_$.bd;
  var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.a2;
  var await_0 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.i;
  var coroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j;
  var UnsupportedOperationException_init_$Create$ = kotlin_kotlin.$_$.r2;
  var listOf = kotlin_kotlin.$_$.l8;
  var interfaceMeta = kotlin_kotlin.$_$.xb;
  var Companion_instance = kotlin_kotlin.$_$.h5;
  var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.d3;
  var createFailure = kotlin_kotlin.$_$.yi;
  var Result__exceptionOrNull_impl_p6xea9 = kotlin_kotlin.$_$.e3;
  var throwOnFailure = kotlin_kotlin.$_$.kj;
  var _Result___get_value__impl__bjfvqg = kotlin_kotlin.$_$.g3;
  //endregion
  //region block: pre-declaration
  setMetadataFor(PluralsResource, 'PluralsResource', classMeta);
  setMetadataFor(StringResource, 'StringResource', classMeta);
  setMetadataFor(PluralFormattedStringDesc, 'PluralFormattedStringDesc', classMeta, VOID, VOID, VOID, VOID, VOID, [0]);
  setMetadataFor(LocaleType, 'LocaleType', classMeta);
  setMetadataFor(System, 'System', objectMeta, LocaleType);
  setMetadataFor(Companion, 'Companion', objectMeta);
  setMetadataFor(ParsedLocale, 'ParsedLocale', classMeta);
  setMetadataFor(SupportedLocale, 'SupportedLocale', classMeta);
  setMetadataFor(SupportedLocales, 'SupportedLocales', classMeta, VOID, [List]);
  setMetadataFor(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda, 'RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1, 'RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  function plus_1(other) {
    var tmp = JsStringProvider$plus$lambda(this, other);
    return new sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0(tmp);
  }
  setMetadataFor(JsStringProvider, 'JsStringProvider', interfaceMeta);
  setMetadataFor(sam$dev_icerock_moko_resources_provider_JsStringProvider$0, 'sam$dev_icerock_moko_resources_provider_JsStringProvider$0', classMeta, VOID, [JsStringProvider]);
  setMetadataFor(RemoteJsStringLoader$Impl$getOrLoad$slambda, 'RemoteJsStringLoader$Impl$getOrLoad$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($loadLocalizationFileCOROUTINE$3, '$loadLocalizationFileCOROUTINE$3', classMeta, CoroutineImpl);
  setMetadataFor($getOrLoadCOROUTINE$4, '$getOrLoadCOROUTINE$4', classMeta, CoroutineImpl);
  setMetadataFor($downloadLocaleFileCOROUTINE$5, '$downloadLocaleFileCOROUTINE$5', classMeta, CoroutineImpl);
  setMetadataFor($downloadFallbackFileCOROUTINE$6, '$downloadFallbackFileCOROUTINE$6', classMeta, CoroutineImpl);
  setMetadataFor(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda, 'RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RemoteJsStringLoader$Composition$getOrLoad$slambda, 'RemoteJsStringLoader$Composition$getOrLoad$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($getOrLoadCOROUTINE$7, '$getOrLoadCOROUTINE$7', classMeta, CoroutineImpl);
  function plus_2(other) {
    return new Composition(listOf([this, other]));
  }
  setMetadataFor(RemoteJsStringLoader, 'RemoteJsStringLoader', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [0]);
  setMetadataFor(Impl, 'Impl', classMeta, VOID, [RemoteJsStringLoader], VOID, VOID, VOID, [1, 0]);
  setMetadataFor(Composition, 'Composition', classMeta, VOID, [RemoteJsStringLoader], VOID, VOID, VOID, [0]);
  setMetadataFor(sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0, 'sam$dev_icerock_moko_resources_provider_JsStringProvider$0', classMeta, VOID, [JsStringProvider]);
  //endregion
  function format(_this__u8e3s4, number, args) {
    return PluralFormatted(Companion_getInstance(), _this__u8e3s4, number, asList(args));
  }
  function PluralFormatted(_this__u8e3s4, pluralsRes, number, args) {
    return new PluralFormattedStringDesc(pluralsRes, number, args);
  }
  function PluralsResource(key, loader) {
    this.bm8_1 = key;
    this.cm8_1 = loader;
  }
  protoOf(PluralsResource).dm8 = function (provider, locale, quantity, args) {
    var pluralString = provider.em8(this.bm8_1, locale);
    var pluralLocale = locale == null ? currentLocale() : locale;
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var tmp$ret$2 = [pluralLocale];
    var compiledPlural = _CompiledPlural___init__impl__m1vc38((new dev_icerock_moko_resources_internal_messageFormat_MessageFormat_rhgpjd(tmp$ret$2)).compile(pluralString));
    return CompiledPlural__evaluate_impl_gca2wx(compiledPlural, quantity, args.slice());
  };
  function StringResource(key, loader) {
    this.fm8_1 = key;
    this.gm8_1 = loader;
  }
  protoOf(StringResource).hm8 = function (provider, locale) {
    return provider.em8(this.fm8_1, locale);
  };
  protoOf(StringResource).im8 = function (provider, locale, args) {
    var rawString = provider.em8(this.fm8_1, locale);
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var tmp$ret$2 = [locale == null ? currentLocale() : locale];
    var compiled = _CompiledVariableString___init__impl__gl5jz1((new dev_icerock_moko_resources_internal_messageFormat_MessageFormat_rhgpjd(tmp$ret$2)).compile(rawString));
    return CompiledVariableString__evaluate_impl_iy6o3u(compiled, args.slice());
  };
  protoOf(StringResource).equals = function (other) {
    if (!(other instanceof StringResource))
      return false;
    if (!(this.fm8_1 === other.fm8_1))
      return false;
    return true;
  };
  protoOf(StringResource).hashCode = function () {
    return getStringHashCode(this.fm8_1);
  };
  function PluralFormattedStringDesc(pluralsRes, number, args) {
    this.jm8_1 = pluralsRes;
    this.km8_1 = number;
    this.lm8_1 = args;
  }
  protoOf(PluralFormattedStringDesc).mm8 = function (provider) {
    var tmp = Companion_getInstance().nm8_1.om8();
    // Inline function 'kotlin.collections.toTypedArray' call
    var this_0 = this.lm8_1;
    var tmp$ret$0 = copyToArray(this_0);
    return this.jm8_1.dm8(provider, tmp, this.km8_1, tmp$ret$0.slice());
  };
  protoOf(PluralFormattedStringDesc).toString = function () {
    return 'PluralFormattedStringDesc(pluralsRes=' + this.jm8_1 + ', number=' + this.km8_1 + ', args=' + this.lm8_1 + ')';
  };
  protoOf(PluralFormattedStringDesc).hashCode = function () {
    var result = hashCode(this.jm8_1);
    result = imul(result, 31) + this.km8_1 | 0;
    result = imul(result, 31) + hashCode(this.lm8_1) | 0;
    return result;
  };
  protoOf(PluralFormattedStringDesc).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof PluralFormattedStringDesc))
      return false;
    var tmp0_other_with_cast = other instanceof PluralFormattedStringDesc ? other : THROW_CCE();
    if (!equals(this.jm8_1, tmp0_other_with_cast.jm8_1))
      return false;
    if (!(this.km8_1 === tmp0_other_with_cast.km8_1))
      return false;
    if (!equals(this.lm8_1, tmp0_other_with_cast.lm8_1))
      return false;
    return true;
  };
  function System() {
    System_instance = this;
    LocaleType.call(this);
  }
  protoOf(System).om8 = function () {
    return currentLocale();
  };
  var System_instance;
  function System_getInstance() {
    if (System_instance == null)
      new System();
    return System_instance;
  }
  function LocaleType() {
  }
  function Companion() {
    Companion_instance_0 = this;
    this.nm8_1 = System_getInstance();
  }
  var Companion_instance_0;
  function Companion_getInstance() {
    if (Companion_instance_0 == null)
      new Companion();
    return Companion_instance_0;
  }
  function currentLocale() {
    return window.navigator.language;
  }
  var cachedLocale;
  function ParsedLocale(parseResult) {
    var tmp = this;
    var tmp_0 = parseResult['language'];
    var tmp0_elvis_lhs = (!(tmp_0 == null) ? typeof tmp_0 === 'string' : false) ? tmp_0 : null;
    var tmp_1;
    if (tmp0_elvis_lhs == null) {
      throw IllegalArgumentException_init_$Create$('Primary language tags must not be empty');
    } else {
      tmp_1 = tmp0_elvis_lhs;
    }
    tmp.pm8_1 = tmp_1;
    var tmp_2 = this;
    // Inline function 'kotlin.collections.orEmpty' call
    var tmp_3 = parseResult['extendedLanguageSubtags'];
    var tmp0_safe_receiver = (!(tmp_3 == null) ? isArray(tmp_3) : false) ? tmp_3 : null;
    var tmp0_elvis_lhs_0 = tmp0_safe_receiver == null ? null : toList(tmp0_safe_receiver);
    tmp_2.qm8_1 = tmp0_elvis_lhs_0 == null ? emptyList() : tmp0_elvis_lhs_0;
    var tmp_4 = this;
    // Inline function 'kotlin.text.orEmpty' call
    var tmp_5 = parseResult['script'];
    var tmp0_elvis_lhs_1 = (!(tmp_5 == null) ? typeof tmp_5 === 'string' : false) ? tmp_5 : null;
    tmp_4.rm8_1 = tmp0_elvis_lhs_1 == null ? '' : tmp0_elvis_lhs_1;
    var tmp_6 = this;
    // Inline function 'kotlin.text.orEmpty' call
    var tmp_7 = parseResult['region'];
    var tmp0_elvis_lhs_2 = (!(tmp_7 == null) ? typeof tmp_7 === 'string' : false) ? tmp_7 : null;
    tmp_6.sm8_1 = tmp0_elvis_lhs_2 == null ? '' : tmp0_elvis_lhs_2;
    var tmp_8 = this;
    // Inline function 'kotlin.collections.orEmpty' call
    var tmp_9 = parseResult['variants'];
    var tmp0_safe_receiver_0 = (!(tmp_9 == null) ? isArray(tmp_9) : false) ? tmp_9 : null;
    var tmp0_elvis_lhs_3 = tmp0_safe_receiver_0 == null ? null : toList(tmp0_safe_receiver_0);
    tmp_8.tm8_1 = tmp0_elvis_lhs_3 == null ? emptyList() : tmp0_elvis_lhs_3;
    var tmp_10 = this;
    // Inline function 'kotlin.collections.orEmpty' call
    var tmp_11 = parseResult['extensions'];
    var tmp0_safe_receiver_1 = (!(tmp_11 == null) ? isArray(tmp_11) : false) ? tmp_11 : null;
    var tmp0_elvis_lhs_4 = tmp0_safe_receiver_1 == null ? null : toList(tmp0_safe_receiver_1);
    tmp_10.um8_1 = tmp0_elvis_lhs_4 == null ? emptyList() : tmp0_elvis_lhs_4;
    var tmp_12 = this;
    // Inline function 'kotlin.collections.orEmpty' call
    var tmp_13 = parseResult['privateuse'];
    var tmp0_safe_receiver_2 = (!(tmp_13 == null) ? isArray(tmp_13) : false) ? tmp_13 : null;
    var tmp0_elvis_lhs_5 = tmp0_safe_receiver_2 == null ? null : toList(tmp0_safe_receiver_2);
    tmp_12.vm8_1 = tmp0_elvis_lhs_5 == null ? emptyList() : tmp0_elvis_lhs_5;
  }
  function parseBcpLocale(tag) {
    return new ParsedLocale(parse(tag));
  }
  function SupportedLocale(locale, fileUrl) {
    this.wm8_1 = locale;
    this.xm8_1 = fileUrl;
    this.ym8_1 = parseBcpLocale(this.wm8_1);
  }
  protoOf(SupportedLocale).toString = function () {
    return 'SupportedLocale(locale=' + this.wm8_1 + ', fileUrl=' + this.xm8_1 + ')';
  };
  protoOf(SupportedLocale).hashCode = function () {
    var result = getStringHashCode(this.wm8_1);
    result = imul(result, 31) + getStringHashCode(this.xm8_1) | 0;
    return result;
  };
  protoOf(SupportedLocale).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof SupportedLocale))
      return false;
    var tmp0_other_with_cast = other instanceof SupportedLocale ? other : THROW_CCE();
    if (!(this.wm8_1 === tmp0_other_with_cast.wm8_1))
      return false;
    if (!(this.xm8_1 === tmp0_other_with_cast.xm8_1))
      return false;
    return true;
  };
  function SupportedLocales(locales) {
    this.zm8_1 = locales;
    var tmp = this;
    // Inline function 'kotlin.collections.groupBy' call
    // Inline function 'kotlin.collections.groupByTo' call
    var this_0 = this.zm8_1;
    var destination = LinkedHashMap_init_$Create$();
    var tmp0_iterator = this_0.w();
    while (tmp0_iterator.f()) {
      var element = tmp0_iterator.e();
      // Inline function 'dev.icerock.moko.resources.internal.SupportedLocales.languageMap.<anonymous>' call
      var key = element.ym8_1.pm8_1;
      // Inline function 'kotlin.collections.getOrPut' call
      var value = destination.q(key);
      var tmp_0;
      if (value == null) {
        // Inline function 'kotlin.collections.groupByTo.<anonymous>' call
        var answer = ArrayList_init_$Create$();
        destination.s(key, answer);
        tmp_0 = answer;
      } else {
        tmp_0 = value;
      }
      var list = tmp_0;
      list.i1(element);
    }
    tmp.am9_1 = destination;
    var tmp_1 = this;
    // Inline function 'kotlin.collections.associateBy' call
    var this_1 = this.zm8_1;
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_1, 10)), 16);
    // Inline function 'kotlin.collections.associateByTo' call
    var destination_0 = LinkedHashMap_init_$Create$_0(capacity);
    var tmp0_iterator_0 = this_1.w();
    while (tmp0_iterator_0.f()) {
      var element_0 = tmp0_iterator_0.e();
      // Inline function 'dev.icerock.moko.resources.internal.SupportedLocales.localeMap.<anonymous>' call
      var tmp$ret$5 = element_0.wm8_1;
      destination_0.s(tmp$ret$5, element_0);
    }
    tmp_1.bm9_1 = destination_0;
  }
  protoOf(SupportedLocales).u = function () {
    return this.zm8_1.u();
  };
  protoOf(SupportedLocales).cm9 = function (element) {
    return this.zm8_1.a1(element);
  };
  protoOf(SupportedLocales).a1 = function (element) {
    if (!(element instanceof SupportedLocale))
      return false;
    return this.cm9(element instanceof SupportedLocale ? element : THROW_CCE());
  };
  protoOf(SupportedLocales).dm9 = function (elements) {
    return this.zm8_1.b1(elements);
  };
  protoOf(SupportedLocales).b1 = function (elements) {
    return this.dm9(elements);
  };
  protoOf(SupportedLocales).v = function (index) {
    return this.zm8_1.v(index);
  };
  protoOf(SupportedLocales).em9 = function (element) {
    return this.zm8_1.x(element);
  };
  protoOf(SupportedLocales).x = function (element) {
    if (!(element instanceof SupportedLocale))
      return -1;
    return this.em9(element instanceof SupportedLocale ? element : THROW_CCE());
  };
  protoOf(SupportedLocales).c1 = function () {
    return this.zm8_1.c1();
  };
  protoOf(SupportedLocales).w = function () {
    return this.zm8_1.w();
  };
  protoOf(SupportedLocales).y = function () {
    return this.zm8_1.y();
  };
  protoOf(SupportedLocales).z = function (fromIndex, toIndex) {
    return this.zm8_1.z(fromIndex, toIndex);
  };
  function _CompiledVariableString___init__impl__gl5jz1(function_0) {
    return function_0;
  }
  function _get_function__m6jw1f($this) {
    return $this;
  }
  function CompiledVariableString__evaluate_impl_iy6o3u($this, args) {
    // Inline function 'kotlin.collections.mapIndexed' call
    // Inline function 'kotlin.collections.mapIndexedTo' call
    var destination = ArrayList_init_$Create$_0(args.length);
    var index = 0;
    var inductionVariable = 0;
    var last = args.length;
    while (inductionVariable < last) {
      var item = args[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      // Inline function 'dev.icerock.moko.resources.internal.messageFormat.CompiledVariableString.evaluate.<anonymous>' call
      var tmp1 = index;
      index = tmp1 + 1 | 0;
      var tmp$ret$0 = to('' + tmp1, item);
      destination.i1(tmp$ret$0);
    }
    var keyValues = destination;
    // Inline function 'kotlin.collections.toTypedArray' call
    var tmp$ret$3 = copyToArray(keyValues);
    var json_0 = json(tmp$ret$3.slice());
    return _get_function__m6jw1f($this)(json_0);
  }
  function _CompiledPlural___init__impl__m1vc38(function_0) {
    return function_0;
  }
  function _get_function__m6jw1f_0($this) {
    return $this;
  }
  function CompiledPlural__evaluate_impl_gca2wx($this, quantity, args) {
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var tmp = [to('PLURAL', quantity)];
    // Inline function 'kotlin.collections.mapIndexed' call
    // Inline function 'kotlin.collections.mapIndexedTo' call
    var destination = ArrayList_init_$Create$_0(args.length);
    var index = 0;
    var inductionVariable = 0;
    var last = args.length;
    while (inductionVariable < last) {
      var item = args[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      // Inline function 'dev.icerock.moko.resources.internal.messageFormat.CompiledPlural.evaluate.<anonymous>' call
      var tmp1 = index;
      index = tmp1 + 1 | 0;
      var tmp$ret$3 = to('' + tmp1, item);
      destination.i1(tmp$ret$3);
    }
    var keyValues = plus(tmp, destination);
    var json_0 = json(keyValues.slice());
    return _get_function__m6jw1f_0($this)(json_0);
  }
  function RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda(this$0, $it, resultContinuation) {
    this.nm9_1 = this$0;
    this.om9_1 = $it;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda).u1m = function ($this$async, $completion) {
    var tmp = this.v1m($this$async, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            suspendResult = downloadLocaleFile(this.nm9_1, this.om9_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return Unit_instance;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda).v1m = function ($this$async, completion) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda(this.nm9_1, this.om9_1, completion);
    i.pm9_1 = $this$async;
    return i;
  };
  function RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_0(this$0, $it, resultContinuation) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda(this$0, $it, resultContinuation);
    var l = function ($this$async, $completion) {
      return i.u1m($this$async, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1(this$0, resultContinuation) {
    this.ym9_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1).u1m = function ($this$async, $completion) {
    var tmp = this.v1m($this$async, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            suspendResult = downloadFallbackFile(this.ym9_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return Unit_instance;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1).v1m = function ($this$async, completion) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1(this.ym9_1, completion);
    i.zm9_1 = $this$async;
    return i;
  };
  function RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_2(this$0, resultContinuation) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1(this$0, resultContinuation);
    var l = function ($this$async, $completion) {
      return i.u1m($this$async, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function loadLocalizationFile($this, fileUri, $completion) {
    var tmp = new $loadLocalizationFileCOROUTINE$3($this, fileUri, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function downloadLocaleFile($this, locale, $completion) {
    var tmp = new $downloadLocaleFileCOROUTINE$5($this, locale, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function downloadFallbackFile($this, $completion) {
    var tmp = new $downloadFallbackFileCOROUTINE$6($this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function sam$dev_icerock_moko_resources_provider_JsStringProvider$0(function_0) {
    this.gmb_1 = function_0;
  }
  protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0).em8 = function (id, locale) {
    return this.gmb_1(id, locale);
  };
  function RemoteJsStringLoader$Impl$getOrLoad$slambda(this$0, resultContinuation) {
    this.qmb_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda).smb = function ($this$coroutineScope, $completion) {
    var tmp = this.v1m($this$coroutineScope, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda).he = function (p1, $completion) {
    return this.smb((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            var this_0 = this.qmb_1.tmb_1;
            var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
            var tmp0_iterator = this_0.w();
            while (tmp0_iterator.f()) {
              var item = tmp0_iterator.e();
              destination.i1(async(this.rmb_1, VOID, VOID, RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_0(this.qmb_1, item, null)));
            }

            suspendResult = awaitAll(plus_0(destination, async(this.rmb_1, VOID, VOID, RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_2(this.qmb_1, null))), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return suspendResult;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda).v1m = function ($this$coroutineScope, completion) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda(this.qmb_1, completion);
    i.rmb_1 = $this$coroutineScope;
    return i;
  };
  function RemoteJsStringLoader$Impl$getOrLoad$slambda_0(this$0, resultContinuation) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda(this$0, resultContinuation);
    var l = function ($this$coroutineScope, $completion) {
      return i.smb($this$coroutineScope, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RemoteJsStringLoader$Impl$getOrLoad$lambda(this$0) {
    return function (id, locale) {
      var tmp;
      if (locale == null) {
        tmp = null;
      } else {
        // Inline function 'kotlin.let' call
        // Inline function 'kotlin.contracts.contract' call
        // Inline function 'dev.icerock.moko.resources.provider.Impl.getOrLoad.<anonymous>.<anonymous>' call
        tmp = this$0.vmb_1.q(locale);
      }
      var tmp1_elvis_lhs = tmp;
      var tmp2_elvis_lhs = tmp1_elvis_lhs == null ? this$0.wmb_1 : tmp1_elvis_lhs;
      var tmp_0;
      if (tmp2_elvis_lhs == null) {
        var message = 'Invalid state after download';
        throw IllegalStateException_init_$Create$(toString(message));
      } else {
        tmp_0 = tmp2_elvis_lhs;
      }
      var localeFile = tmp_0;
      var tmp3_safe_receiver = localeFile[id];
      var tmp6_elvis_lhs = tmp3_safe_receiver == null ? null : toString(tmp3_safe_receiver);
      var tmp_1;
      if (tmp6_elvis_lhs == null) {
        var tmp4_safe_receiver = this$0.wmb_1;
        var tmp5_safe_receiver = tmp4_safe_receiver == null ? null : tmp4_safe_receiver[id];
        tmp_1 = tmp5_safe_receiver == null ? null : toString(tmp5_safe_receiver);
      } else {
        tmp_1 = tmp6_elvis_lhs;
      }
      var tmp7_elvis_lhs = tmp_1;
      var tmp_2;
      if (tmp7_elvis_lhs == null) {
        var message_0 = id + ' string resource not found';
        throw IllegalStateException_init_$Create$(toString(message_0));
      } else {
        tmp_2 = tmp7_elvis_lhs;
      }
      return tmp_2;
    };
  }
  function $loadLocalizationFileCOROUTINE$3(_this__u8e3s4, fileUri, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.ima_1 = _this__u8e3s4;
    this.jma_1 = fileUri;
  }
  protoOf($loadLocalizationFileCOROUTINE$3).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 3;
            this.hd_1 = 1;
            suspendResult = await_0(window.fetch(this.jma_1), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.kma_1 = suspendResult;
            if (!this.kma_1.ok) {
              var message = 'response not ok for ' + this.jma_1 + ' - ' + this.kma_1.statusText + ' ' + this.kma_1.body;
              throw IllegalStateException_init_$Create$(toString(message));
            }

            this.hd_1 = 2;
            suspendResult = await_0(this.kma_1.json(), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            var json = (suspendResult == null ? true : !(suspendResult == null)) ? suspendResult : THROW_CCE();
            var tmp_0;
            if (json == null) {
              var message_0 = 'Could not read json at ' + this.jma_1;
              throw IllegalStateException_init_$Create$(toString(message_0));
            } else {
              tmp_0 = json;
            }

            return tmp_0;
          case 3:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 3) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $getOrLoadCOROUTINE$4(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.fmc_1 = _this__u8e3s4;
  }
  protoOf($getOrLoadCOROUTINE$4).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            suspendResult = coroutineScope(RemoteJsStringLoader$Impl$getOrLoad$slambda_0(this.fmc_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var tmp_0 = RemoteJsStringLoader$Impl$getOrLoad$lambda(this.fmc_1);
            return new sam$dev_icerock_moko_resources_provider_JsStringProvider$0(tmp_0);
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $downloadLocaleFileCOROUTINE$5(_this__u8e3s4, locale, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.tma_1 = _this__u8e3s4;
    this.uma_1 = locale;
  }
  protoOf($downloadLocaleFileCOROUTINE$5).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            if (!(this.tma_1.vmb_1.q(this.uma_1.wm8_1) == null))
              return Unit_instance;
            var tmp_0 = this;
            tmp_0.vma_1 = this.tma_1.vmb_1;
            var tmp_1 = this;
            tmp_1.wma_1 = this.uma_1.wm8_1;
            this.hd_1 = 1;
            suspendResult = loadLocalizationFile(this.tma_1, this.uma_1.xm8_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var value = suspendResult;
            this.vma_1.s(this.wma_1, value);
            return Unit_instance;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $downloadFallbackFileCOROUTINE$6(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.fmb_1 = _this__u8e3s4;
  }
  protoOf($downloadFallbackFileCOROUTINE$6).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            if (!(this.fmb_1.wmb_1 == null))
              return Unit_instance;
            this.hd_1 = 1;
            suspendResult = loadLocalizationFile(this.fmb_1, this.fmb_1.umb_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var ARGUMENT = suspendResult;
            this.fmb_1.wmb_1 = ARGUMENT;
            return Unit_instance;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda($it, resultContinuation) {
    this.omc_1 = $it;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda).qmc = function ($this$async, $completion) {
    var tmp = this.v1m($this$async, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda).he = function (p1, $completion) {
    return this.qmc((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            suspendResult = this.omc_1.rmc(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return suspendResult;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda).v1m = function ($this$async, completion) {
    var i = new RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda(this.omc_1, completion);
    i.pmc_1 = $this$async;
    return i;
  };
  function RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda_0($it, resultContinuation) {
    var i = new RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda($it, resultContinuation);
    var l = function ($this$async, $completion) {
      return i.qmc($this$async, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RemoteJsStringLoader$Composition$getOrLoad$slambda(this$0, resultContinuation) {
    this.amd_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda).cmd = function ($this$coroutineScope, $completion) {
    var tmp = this.v1m($this$coroutineScope, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda).he = function (p1, $completion) {
    return this.cmd((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            var this_0 = this.amd_1.dmd_1;
            var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
            var tmp0_iterator = this_0.w();
            while (tmp0_iterator.f()) {
              var item = tmp0_iterator.e();
              destination.i1(async(this.bmd_1, VOID, VOID, RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda_0(item, null)));
            }

            suspendResult = awaitAll(destination, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return suspendResult;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda).v1m = function ($this$coroutineScope, completion) {
    var i = new RemoteJsStringLoader$Composition$getOrLoad$slambda(this.amd_1, completion);
    i.bmd_1 = $this$coroutineScope;
    return i;
  };
  function RemoteJsStringLoader$Composition$getOrLoad$slambda_0(this$0, resultContinuation) {
    var i = new RemoteJsStringLoader$Composition$getOrLoad$slambda(this$0, resultContinuation);
    var l = function ($this$coroutineScope, $completion) {
      return i.cmd($this$coroutineScope, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function $getOrLoadCOROUTINE$7(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.mmd_1 = _this__u8e3s4;
  }
  protoOf($getOrLoadCOROUTINE$7).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            suspendResult = coroutineScope(RemoteJsStringLoader$Composition$getOrLoad$slambda_0(this.mmd_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var providers = suspendResult;
            var iterator = providers.w();
            if (!iterator.f())
              throw UnsupportedOperationException_init_$Create$("Empty collection can't be reduced.");
            var accumulator = iterator.e();
            while (iterator.f()) {
              var acc = accumulator;
              var jsStringProvider = iterator.e();
              accumulator = acc.hmb(jsStringProvider);
            }

            return accumulator;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function Impl(supportedLocales, fallbackFileUri) {
    this.tmb_1 = supportedLocales;
    this.umb_1 = fallbackFileUri;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.vmb_1 = LinkedHashMap_init_$Create$();
    this.wmb_1 = null;
  }
  protoOf(Impl).rmc = function ($completion) {
    var tmp = new $getOrLoadCOROUTINE$4(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  function Composition(loaders) {
    this.dmd_1 = loaders;
  }
  protoOf(Composition).rmc = function ($completion) {
    var tmp = new $getOrLoadCOROUTINE$7(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  function RemoteJsStringLoader() {
  }
  function sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0(function_0) {
    this.omd_1 = function_0;
  }
  protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0).em8 = function (id, locale) {
    return this.omd_1(id, locale);
  };
  function JsStringProvider$plus$lambda(this$0, $other) {
    return function (id, locale) {
      // Inline function 'kotlin.getOrThrow' call
      // Inline function 'kotlin.recover' call
      // Inline function 'kotlin.runCatching' call
      var this_0 = this$0;
      var tmp;
      try {
        // Inline function 'kotlin.Companion.success' call
        // Inline function 'dev.icerock.moko.resources.provider.JsStringProvider.plus.<anonymous>.<anonymous>' call
        var value = this_0.em8(id, locale);
        tmp = _Result___init__impl__xyqfz8(value);
      } catch ($p) {
        var tmp_0;
        if ($p instanceof Error) {
          var e = $p;
          // Inline function 'kotlin.Companion.failure' call
          tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
        } else {
          throw $p;
        }
        tmp = tmp_0;
      }
      var this_1 = tmp;
      // Inline function 'kotlin.contracts.contract' call
      var exception = Result__exceptionOrNull_impl_p6xea9(this_1);
      var tmp_1;
      if (exception == null) {
        tmp_1 = this_1;
      } else {
        // Inline function 'kotlin.Companion.success' call
        // Inline function 'dev.icerock.moko.resources.provider.JsStringProvider.plus.<anonymous>.<anonymous>' call
        var value_0 = $other.em8(id, locale);
        tmp_1 = _Result___init__impl__xyqfz8(value_0);
      }
      var this_2 = tmp_1;
      throwOnFailure(this_2);
      var tmp_2 = _Result___get_value__impl__bjfvqg(this_2);
      return (tmp_2 == null ? true : !(tmp_2 == null)) ? tmp_2 : THROW_CCE();
    };
  }
  function JsStringProvider() {
  }
  //region block: post-declaration
  protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0).hmb = plus_1;
  protoOf(Impl).nmd = plus_2;
  protoOf(Composition).nmd = plus_2;
  protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0).hmb = plus_1;
  //endregion
  //region block: init
  cachedLocale = null;
  //endregion
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = SupportedLocales;
  _.$_$.b = SupportedLocale;
  _.$_$.c = JsStringProvider;
  _.$_$.d = Impl;
  _.$_$.e = PluralsResource;
  _.$_$.f = StringResource;
  _.$_$.g = format;
  //endregion
  return _;
}(module.exports, require('@messageformat/core'), require('bcp-47'), require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-coroutines-core.js')));

//# sourceMappingURL=moko-resources-resources.js.map
