(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.$_$.vc; var classMeta = kotlin_kotlin.$_$.kb; var setMetadataFor = kotlin_kotlin.$_$.wc; var getStringHashCode = kotlin_kotlin.$_$.ub; var copyToArray = kotlin_kotlin.$_$.e7; var hashCode = kotlin_kotlin.$_$.vb; var THROW_CCE = kotlin_kotlin.$_$.gi; var equals = kotlin_kotlin.$_$.nb; var VOID = kotlin_kotlin.$_$.f; var objectMeta = kotlin_kotlin.$_$.uc; var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.u1; var isArray = kotlin_kotlin.$_$.xb; var toList = kotlin_kotlin.$_$.t9; 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.$_$.l8; var coerceAtLeast = kotlin_kotlin.$_$.id; 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.$_$.mj; var json = kotlin_kotlin.$_$.kc; var plus = kotlin_kotlin.$_$.r8; var CoroutineImpl = kotlin_kotlin.$_$.ua; var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z1; var isInterface = kotlin_kotlin.$_$.fc; var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.ga; var async = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.f2; var plus_0 = kotlin_kotlin.$_$.z8; var awaitAll = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h; var toString = kotlin_kotlin.$_$.ad; 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.$_$.k8; var interfaceMeta = kotlin_kotlin.$_$.wb; var Companion_instance = kotlin_kotlin.$_$.h5; var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.d3; var createFailure = kotlin_kotlin.$_$.xi; var Result__exceptionOrNull_impl_p6xea9 = kotlin_kotlin.$_$.e3; var throwOnFailure = kotlin_kotlin.$_$.jj; 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.llj_1 = key; this.mlj_1 = loader; } protoOf(PluralsResource).nlj = function (provider, locale, quantity, args) { var pluralString = provider.olj(this.llj_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.plj_1 = key; this.qlj_1 = loader; } protoOf(StringResource).rlj = function (provider, locale) { return provider.olj(this.plj_1, locale); }; protoOf(StringResource).slj = function (provider, locale, args) { var rawString = provider.olj(this.plj_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.plj_1 === other.plj_1)) return false; return true; }; protoOf(StringResource).hashCode = function () { return getStringHashCode(this.plj_1); }; function PluralFormattedStringDesc(pluralsRes, number, args) { this.tlj_1 = pluralsRes; this.ulj_1 = number; this.vlj_1 = args; } protoOf(PluralFormattedStringDesc).wlj = function (provider) { var tmp = Companion_getInstance().xlj_1.ylj(); // Inline function 'kotlin.collections.toTypedArray' call var this_0 = this.vlj_1; var tmp$ret$0 = copyToArray(this_0); return this.tlj_1.nlj(provider, tmp, this.ulj_1, tmp$ret$0.slice()); }; protoOf(PluralFormattedStringDesc).toString = function () { return 'PluralFormattedStringDesc(pluralsRes=' + this.tlj_1 + ', number=' + this.ulj_1 + ', args=' + this.vlj_1 + ')'; }; protoOf(PluralFormattedStringDesc).hashCode = function () { var result = hashCode(this.tlj_1); result = imul(result, 31) + this.ulj_1 | 0; result = imul(result, 31) + hashCode(this.vlj_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.tlj_1, tmp0_other_with_cast.tlj_1)) return false; if (!(this.ulj_1 === tmp0_other_with_cast.ulj_1)) return false; if (!equals(this.vlj_1, tmp0_other_with_cast.vlj_1)) return false; return true; }; function System() { System_instance = this; LocaleType.call(this); } protoOf(System).ylj = 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.xlj_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.zlj_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.alk_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.blk_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.clk_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.dlk_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.elk_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.flk_1 = tmp0_elvis_lhs_5 == null ? emptyList() : tmp0_elvis_lhs_5; } function parseBcpLocale(tag) { return new ParsedLocale(parse(tag)); } function SupportedLocale(locale, fileUrl) { this.glk_1 = locale; this.hlk_1 = fileUrl; this.ilk_1 = parseBcpLocale(this.glk_1); } protoOf(SupportedLocale).toString = function () { return 'SupportedLocale(locale=' + this.glk_1 + ', fileUrl=' + this.hlk_1 + ')'; }; protoOf(SupportedLocale).hashCode = function () { var result = getStringHashCode(this.glk_1); result = imul(result, 31) + getStringHashCode(this.hlk_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.glk_1 === tmp0_other_with_cast.glk_1)) return false; if (!(this.hlk_1 === tmp0_other_with_cast.hlk_1)) return false; return true; }; function SupportedLocales(locales) { this.jlk_1 = locales; var tmp = this; // Inline function 'kotlin.collections.groupBy' call // Inline function 'kotlin.collections.groupByTo' call var this_0 = this.jlk_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.' call var key = element.ilk_1.zlj_1; // Inline function 'kotlin.collections.getOrPut' call var value = destination.q(key); var tmp_0; if (value == null) { // Inline function 'kotlin.collections.groupByTo.' 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.klk_1 = destination; var tmp_1 = this; // Inline function 'kotlin.collections.associateBy' call var this_1 = this.jlk_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.' call var tmp$ret$5 = element_0.glk_1; destination_0.s(tmp$ret$5, element_0); } tmp_1.llk_1 = destination_0; } protoOf(SupportedLocales).u = function () { return this.jlk_1.u(); }; protoOf(SupportedLocales).mlk = function (element) { return this.jlk_1.a1(element); }; protoOf(SupportedLocales).a1 = function (element) { if (!(element instanceof SupportedLocale)) return false; return this.mlk(element instanceof SupportedLocale ? element : THROW_CCE()); }; protoOf(SupportedLocales).nlk = function (elements) { return this.jlk_1.b1(elements); }; protoOf(SupportedLocales).b1 = function (elements) { return this.nlk(elements); }; protoOf(SupportedLocales).v = function (index) { return this.jlk_1.v(index); }; protoOf(SupportedLocales).olk = function (element) { return this.jlk_1.x(element); }; protoOf(SupportedLocales).x = function (element) { if (!(element instanceof SupportedLocale)) return -1; return this.olk(element instanceof SupportedLocale ? element : THROW_CCE()); }; protoOf(SupportedLocales).c1 = function () { return this.jlk_1.c1(); }; protoOf(SupportedLocales).w = function () { return this.jlk_1.w(); }; protoOf(SupportedLocales).y = function () { return this.jlk_1.y(); }; protoOf(SupportedLocales).z = function (fromIndex, toIndex) { return this.jlk_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.' 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.' 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.xlk_1 = this$0; this.ylk_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.xlk_1, this.ylk_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.xlk_1, this.ylk_1, completion); i.zlk_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.ill_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.ill_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.ill_1, completion); i.jll_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.qlm_1 = function_0; } protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0).olj = function (id, locale) { return this.qlm_1(id, locale); }; function RemoteJsStringLoader$Impl$getOrLoad$slambda(this$0, resultContinuation) { this.aln_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda).cln = 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.cln((!(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.aln_1.dln_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.bln_1, VOID, VOID, RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_0(this.aln_1, item, null))); } suspendResult = awaitAll(plus_0(destination, async(this.bln_1, VOID, VOID, RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_2(this.aln_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.aln_1, completion); i.bln_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.cln($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..' call tmp = this$0.fln_1.q(locale); } var tmp1_elvis_lhs = tmp; var tmp2_elvis_lhs = tmp1_elvis_lhs == null ? this$0.gln_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.gln_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.sll_1 = _this__u8e3s4; this.tll_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.tll_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.ull_1 = suspendResult; if (!this.ull_1.ok) { var message = 'response not ok for ' + this.tll_1 + ' - ' + this.ull_1.statusText + ' ' + this.ull_1.body; throw IllegalStateException_init_$Create$(toString(message)); } this.hd_1 = 2; suspendResult = await_0(this.ull_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.tll_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.pln_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.pln_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var tmp_0 = RemoteJsStringLoader$Impl$getOrLoad$lambda(this.pln_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.dlm_1 = _this__u8e3s4; this.elm_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.dlm_1.fln_1.q(this.elm_1.glk_1) == null)) return Unit_instance; var tmp_0 = this; tmp_0.flm_1 = this.dlm_1.fln_1; var tmp_1 = this; tmp_1.glm_1 = this.elm_1.glk_1; this.hd_1 = 1; suspendResult = loadLocalizationFile(this.dlm_1, this.elm_1.hlk_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var value = suspendResult; this.flm_1.s(this.glm_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.plm_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.plm_1.gln_1 == null)) return Unit_instance; this.hd_1 = 1; suspendResult = loadLocalizationFile(this.plm_1, this.plm_1.eln_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var ARGUMENT = suspendResult; this.plm_1.gln_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.yln_1 = $it; CoroutineImpl.call(this, resultContinuation); } protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda).alo = 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.alo((!(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.yln_1.blo(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.yln_1, completion); i.zln_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.alo($this$async, $completion); }; l.$arity = 1; return l; } function RemoteJsStringLoader$Composition$getOrLoad$slambda(this$0, resultContinuation) { this.klo_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda).mlo = 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.mlo((!(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.klo_1.nlo_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.llo_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.klo_1, completion); i.llo_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.mlo($this$coroutineScope, $completion); }; l.$arity = 1; return l; } function $getOrLoadCOROUTINE$7(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.wlo_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.wlo_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.rlm(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.dln_1 = supportedLocales; this.eln_1 = fallbackFileUri; var tmp = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp.fln_1 = LinkedHashMap_init_$Create$(); this.gln_1 = null; } protoOf(Impl).blo = 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.nlo_1 = loaders; } protoOf(Composition).blo = 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.ylo_1 = function_0; } protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0).olj = function (id, locale) { return this.ylo_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..' call var value = this_0.olj(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..' call var value_0 = $other.olj(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).rlm = plus_1; protoOf(Impl).xlo = plus_2; protoOf(Composition).xlo = plus_2; protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0).rlm = 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